summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitattributes1
-rw-r--r--.gitignore1
-rw-r--r--cpp/src/Slice/JavaUtil.cpp3068
-rw-r--r--cpp/src/Slice/JavaUtil.h191
-rw-r--r--cpp/src/Slice/Parser.cpp188
-rw-r--r--cpp/src/Slice/Parser.h4
-rw-r--r--cpp/src/Slice/Preprocessor.cpp29
-rw-r--r--cpp/src/Slice/Preprocessor.h4
-rw-r--r--cpp/src/slice2java/Gen.cpp5150
-rw-r--r--cpp/src/slice2java/Gen.h163
-rw-r--r--cpp/src/slice2java/GenCompat.cpp6664
-rw-r--r--cpp/src/slice2java/GenCompat.h317
-rw-r--r--cpp/src/slice2java/Main.cpp104
-rw-r--r--java-compat/.externalToolBuilders/Slice.launch17
-rw-r--r--java-compat/.gitignore4
-rw-r--r--java-compat/.settings/org.eclipse.jdt.core.prefs384
-rw-r--r--java-compat/.settings/org.eclipse.jdt.ui.prefs3
-rw-r--r--java-compat/BuildInstructions.md165
-rw-r--r--java-compat/Makefile46
-rwxr-xr-xjava-compat/allTests.py86
-rw-r--r--java-compat/build.gradle73
-rw-r--r--java-compat/gradle.properties77
-rwxr-xr-xjava-compat/gradle/GRADLE_LICENSE16
-rw-r--r--java-compat/gradle/wrapper/gradle-wrapper.jarbin0 -> 53319 bytes
-rw-r--r--java-compat/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xjava-compat/gradlew164
-rwxr-xr-xjava-compat/gradlew.bat90
-rw-r--r--java-compat/settings.gradle35
-rw-r--r--java-compat/src/Glacier2/build.gradle29
-rw-r--r--java-compat/src/Glacier2/src/main/java/Glacier2/Application.java (renamed from java/src/Glacier2/src/main/java/Glacier2/Application.java)0
-rw-r--r--java-compat/src/Glacier2/src/main/java/Glacier2/SessionCallback.java (renamed from java/src/Glacier2/src/main/java/Glacier2/SessionCallback.java)0
-rw-r--r--java-compat/src/Glacier2/src/main/java/Glacier2/SessionFactoryHelper.java (renamed from java/src/Glacier2/src/main/java/Glacier2/SessionFactoryHelper.java)0
-rw-r--r--java-compat/src/Glacier2/src/main/java/Glacier2/SessionHelper.java (renamed from java/src/Glacier2/src/main/java/Glacier2/SessionHelper.java)0
-rw-r--r--java-compat/src/Ice/build.gradle26
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/AMDCallback.java (renamed from java/src/Ice/src/main/java/Ice/AMDCallback.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/AMD_Object_ice_invoke.java (renamed from java/src/Ice/src/main/java/Ice/AMD_Object_ice_invoke.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/Application.java (renamed from java/src/Ice/src/main/java/Ice/Application.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/AsyncCallback.java (renamed from java/src/Ice/src/main/java/Ice/AsyncCallback.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/AsyncResult.java (renamed from java/src/Ice/src/main/java/Ice/AsyncResult.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/BatchRequest.java (renamed from java/src/Ice/src/main/java/Ice/BatchRequest.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/BatchRequestInterceptor.java (renamed from java/src/Ice/src/main/java/Ice/BatchRequestInterceptor.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/Blobject.java (renamed from java/src/Ice/src/main/java/Ice/Blobject.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/BlobjectAsync.java (renamed from java/src/Ice/src/main/java/Ice/BlobjectAsync.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/BooleanHolder.java (renamed from java/src/Ice/src/main/java/Ice/BooleanHolder.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/BooleanOptional.java (renamed from java/src/Ice/src/main/java/Ice/BooleanOptional.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ByteHolder.java (renamed from java/src/Ice/src/main/java/Ice/ByteHolder.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ByteOptional.java (renamed from java/src/Ice/src/main/java/Ice/ByteOptional.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/Callback.java (renamed from java/src/Ice/src/main/java/Ice/Callback.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/Callback_Communicator_flushBatchRequests.java (renamed from java/src/Ice/src/main/java/Ice/Callback_Communicator_flushBatchRequests.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/Callback_Connection_flushBatchRequests.java (renamed from java/src/Ice/src/main/java/Ice/Callback_Connection_flushBatchRequests.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/Callback_Object_ice_flushBatchRequests.java (renamed from java/src/Ice/src/main/java/Ice/Callback_Object_ice_flushBatchRequests.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/Callback_Object_ice_getConnection.java (renamed from java/src/Ice/src/main/java/Ice/Callback_Object_ice_getConnection.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/Callback_Object_ice_id.java (renamed from java/src/Ice/src/main/java/Ice/Callback_Object_ice_id.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/Callback_Object_ice_ids.java (renamed from java/src/Ice/src/main/java/Ice/Callback_Object_ice_ids.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/Callback_Object_ice_invoke.java (renamed from java/src/Ice/src/main/java/Ice/Callback_Object_ice_invoke.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/Callback_Object_ice_isA.java (renamed from java/src/Ice/src/main/java/Ice/Callback_Object_ice_isA.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/Callback_Object_ice_ping.java (renamed from java/src/Ice/src/main/java/Ice/Callback_Object_ice_ping.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ClassResolver.java (renamed from java/src/Ice/src/main/java/Ice/ClassResolver.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/CommunicatorI.java (renamed from java/src/Ice/src/main/java/Ice/CommunicatorI.java)4
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/CompactIdResolver.java (renamed from java/src/Ice/src/main/java/Ice/CompactIdResolver.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ConnectionI.java (renamed from java/src/Ice/src/main/java/Ice/ConnectionI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/DispatchInterceptor.java (renamed from java/src/Ice/src/main/java/Ice/DispatchInterceptor.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/DispatchInterceptorAsyncCallback.java (renamed from java/src/Ice/src/main/java/Ice/DispatchInterceptorAsyncCallback.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/DispatchStatus.java (renamed from java/src/Ice/src/main/java/Ice/DispatchStatus.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/Dispatcher.java (renamed from java/src/Ice/src/main/java/Ice/Dispatcher.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/DoubleHolder.java (renamed from java/src/Ice/src/main/java/Ice/DoubleHolder.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/DoubleOptional.java (renamed from java/src/Ice/src/main/java/Ice/DoubleOptional.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/Exception.java (renamed from java/src/Ice/src/main/java/Ice/Exception.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/FloatHolder.java (renamed from java/src/Ice/src/main/java/Ice/FloatHolder.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/FloatOptional.java (renamed from java/src/Ice/src/main/java/Ice/FloatOptional.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/FormatType.java (renamed from java/src/Ice/src/main/java/Ice/FormatType.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/Holder.java (renamed from java/src/Ice/src/main/java/Ice/Holder.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ImplicitContextI.java (renamed from java/src/Ice/src/main/java/Ice/ImplicitContextI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/InitializationData.java (renamed from java/src/Ice/src/main/java/Ice/InitializationData.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/InputStream.java (renamed from java/src/Ice/src/main/java/Ice/InputStream.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/IntHolder.java (renamed from java/src/Ice/src/main/java/Ice/IntHolder.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/IntOptional.java (renamed from java/src/Ice/src/main/java/Ice/IntOptional.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/LocalException.java (renamed from java/src/Ice/src/main/java/Ice/LocalException.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/LocalObjectHolder.java (renamed from java/src/Ice/src/main/java/Ice/LocalObjectHolder.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/LoggerI.java (renamed from java/src/Ice/src/main/java/Ice/LoggerI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/LoggerPlugin.java (renamed from java/src/Ice/src/main/java/Ice/LoggerPlugin.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/LongHolder.java (renamed from java/src/Ice/src/main/java/Ice/LongHolder.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/LongOptional.java (renamed from java/src/Ice/src/main/java/Ice/LongOptional.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/NativePropertiesAdmin.java (renamed from java/src/Ice/src/main/java/Ice/NativePropertiesAdmin.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/Object.java (renamed from java/src/Ice/src/main/java/Ice/Object.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ObjectAdapterI.java (renamed from java/src/Ice/src/main/java/Ice/ObjectAdapterI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ObjectHolder.java (renamed from java/src/Ice/src/main/java/Ice/ObjectHolder.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ObjectHolderBase.java (renamed from java/src/Ice/src/main/java/Ice/ObjectHolderBase.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ObjectImpl.java (renamed from java/src/Ice/src/main/java/Ice/ObjectImpl.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ObjectInputStream.java (renamed from java/src/Ice/src/main/java/Ice/ObjectInputStream.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ObjectPrx.java (renamed from java/src/Ice/src/main/java/Ice/ObjectPrx.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ObjectPrxHelper.java (renamed from java/src/Ice/src/main/java/Ice/ObjectPrxHelper.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ObjectPrxHelperBase.java (renamed from java/src/Ice/src/main/java/Ice/ObjectPrxHelperBase.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ObjectPrxHolder.java (renamed from java/src/Ice/src/main/java/Ice/ObjectPrxHolder.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ObjectReader.java (renamed from java/src/Ice/src/main/java/Ice/ObjectReader.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ObjectWriter.java (renamed from java/src/Ice/src/main/java/Ice/ObjectWriter.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/OnewayCallback.java (renamed from java/src/Ice/src/main/java/Ice/OnewayCallback.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/Optional.java (renamed from java/src/Ice/src/main/java/Ice/Optional.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/OptionalFormat.java (renamed from java/src/Ice/src/main/java/Ice/OptionalFormat.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/OptionalObject.java (renamed from java/src/Ice/src/main/java/Ice/OptionalObject.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/OutputStream.java (renamed from java/src/Ice/src/main/java/Ice/OutputStream.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/PluginFactory.java (renamed from java/src/Ice/src/main/java/Ice/PluginFactory.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/PluginManagerI.java (renamed from java/src/Ice/src/main/java/Ice/PluginManagerI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/PropertiesAdminUpdateCallback.java (renamed from java/src/Ice/src/main/java/Ice/PropertiesAdminUpdateCallback.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/PropertiesI.java (renamed from java/src/Ice/src/main/java/Ice/PropertiesI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ProxyIdentityFacetKey.java (renamed from java/src/Ice/src/main/java/Ice/ProxyIdentityFacetKey.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ProxyIdentityKey.java (renamed from java/src/Ice/src/main/java/Ice/ProxyIdentityKey.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ReadValueCallback.java (renamed from java/src/Ice/src/main/java/Ice/ReadValueCallback.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/Request.java (renamed from java/src/Ice/src/main/java/Ice/Request.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ShortHolder.java (renamed from java/src/Ice/src/main/java/Ice/ShortHolder.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ShortOptional.java (renamed from java/src/Ice/src/main/java/Ice/ShortOptional.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/SignalPolicy.java (renamed from java/src/Ice/src/main/java/Ice/SignalPolicy.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/SliceInfo.java (renamed from java/src/Ice/src/main/java/Ice/SliceInfo.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/SlicedData.java (renamed from java/src/Ice/src/main/java/Ice/SlicedData.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/StringHolder.java (renamed from java/src/Ice/src/main/java/Ice/StringHolder.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/SysLoggerI.java (renamed from java/src/Ice/src/main/java/Ice/SysLoggerI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/SystemException.java (renamed from java/src/Ice/src/main/java/Ice/SystemException.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ThreadHookPlugin.java (renamed from java/src/Ice/src/main/java/Ice/ThreadHookPlugin.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ThreadNotification.java (renamed from java/src/Ice/src/main/java/Ice/ThreadNotification.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/TieBase.java (renamed from java/src/Ice/src/main/java/Ice/TieBase.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/TwowayCallback.java (renamed from java/src/Ice/src/main/java/Ice/TwowayCallback.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/TwowayCallbackArg1.java (renamed from java/src/Ice/src/main/java/Ice/TwowayCallbackArg1.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/TwowayCallbackArg1UE.java (renamed from java/src/Ice/src/main/java/Ice/TwowayCallbackArg1UE.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/TwowayCallbackBool.java (renamed from java/src/Ice/src/main/java/Ice/TwowayCallbackBool.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/TwowayCallbackBoolUE.java (renamed from java/src/Ice/src/main/java/Ice/TwowayCallbackBoolUE.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/TwowayCallbackByte.java (renamed from java/src/Ice/src/main/java/Ice/TwowayCallbackByte.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/TwowayCallbackByteUE.java (renamed from java/src/Ice/src/main/java/Ice/TwowayCallbackByteUE.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/TwowayCallbackDouble.java (renamed from java/src/Ice/src/main/java/Ice/TwowayCallbackDouble.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/TwowayCallbackDoubleUE.java (renamed from java/src/Ice/src/main/java/Ice/TwowayCallbackDoubleUE.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/TwowayCallbackFloat.java (renamed from java/src/Ice/src/main/java/Ice/TwowayCallbackFloat.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/TwowayCallbackFloatUE.java (renamed from java/src/Ice/src/main/java/Ice/TwowayCallbackFloatUE.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/TwowayCallbackInt.java (renamed from java/src/Ice/src/main/java/Ice/TwowayCallbackInt.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/TwowayCallbackIntUE.java (renamed from java/src/Ice/src/main/java/Ice/TwowayCallbackIntUE.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/TwowayCallbackLong.java (renamed from java/src/Ice/src/main/java/Ice/TwowayCallbackLong.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/TwowayCallbackLongUE.java (renamed from java/src/Ice/src/main/java/Ice/TwowayCallbackLongUE.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/TwowayCallbackShort.java (renamed from java/src/Ice/src/main/java/Ice/TwowayCallbackShort.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/TwowayCallbackShortUE.java (renamed from java/src/Ice/src/main/java/Ice/TwowayCallbackShortUE.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/TwowayCallbackUE.java (renamed from java/src/Ice/src/main/java/Ice/TwowayCallbackUE.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/TwowayCallbackVoidUE.java (renamed from java/src/Ice/src/main/java/Ice/TwowayCallbackVoidUE.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/UnknownSlicedValue.java (renamed from java/src/Ice/src/main/java/Ice/UnknownSlicedValue.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/UserException.java (renamed from java/src/Ice/src/main/java/Ice/UserException.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/UserExceptionFactory.java (renamed from java/src/Ice/src/main/java/Ice/UserExceptionFactory.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/Util.java (renamed from java/src/Ice/src/main/java/Ice/Util.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/ValueFactoryManagerI.java (renamed from java/src/Ice/src/main/java/Ice/ValueFactoryManagerI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/_AMD_Object_ice_invoke.java (renamed from java/src/Ice/src/main/java/Ice/_AMD_Object_ice_invoke.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/Ice/_Callback_Object_ice_invoke.java (renamed from java/src/Ice/src/main/java/Ice/_Callback_Object_ice_invoke.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ACMConfig.java (renamed from java/src/Ice/src/main/java/IceInternal/ACMConfig.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ACMMonitor.java (renamed from java/src/Ice/src/main/java/IceInternal/ACMMonitor.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Acceptor.java (renamed from java/src/Ice/src/main/java/IceInternal/Acceptor.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/AsyncResultI.java (renamed from java/src/Ice/src/main/java/IceInternal/AsyncResultI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/AsyncStatus.java (renamed from java/src/Ice/src/main/java/IceInternal/AsyncStatus.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/BZip2.java (renamed from java/src/Ice/src/main/java/IceInternal/BZip2.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/BatchRequestQueue.java (renamed from java/src/Ice/src/main/java/IceInternal/BatchRequestQueue.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/BufSizeWarnInfo.java (renamed from java/src/Ice/src/main/java/IceInternal/BufSizeWarnInfo.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Buffer.java (renamed from java/src/Ice/src/main/java/IceInternal/Buffer.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/CallbackBase.java (renamed from java/src/Ice/src/main/java/IceInternal/CallbackBase.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/CancellationHandler.java (renamed from java/src/Ice/src/main/java/IceInternal/CancellationHandler.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/CollocatedObserverI.java (renamed from java/src/Ice/src/main/java/IceInternal/CollocatedObserverI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/CollocatedRequestHandler.java (renamed from java/src/Ice/src/main/java/IceInternal/CollocatedRequestHandler.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/CommunicatorFlushBatch.java (renamed from java/src/Ice/src/main/java/IceInternal/CommunicatorFlushBatch.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/CommunicatorObserverI.java (renamed from java/src/Ice/src/main/java/IceInternal/CommunicatorObserverI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java (renamed from java/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ConnectionACMMonitor.java (renamed from java/src/Ice/src/main/java/IceInternal/ConnectionACMMonitor.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ConnectionFlushBatch.java (renamed from java/src/Ice/src/main/java/IceInternal/ConnectionFlushBatch.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ConnectionObserverI.java (renamed from java/src/Ice/src/main/java/IceInternal/ConnectionObserverI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ConnectionRequestHandler.java (renamed from java/src/Ice/src/main/java/IceInternal/ConnectionRequestHandler.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Connector.java (renamed from java/src/Ice/src/main/java/IceInternal/Connector.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/DefaultsAndOverrides.java (renamed from java/src/Ice/src/main/java/IceInternal/DefaultsAndOverrides.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/DictionaryPatcher.java (renamed from java/src/Ice/src/main/java/IceInternal/DictionaryPatcher.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/DispatchObserverI.java (renamed from java/src/Ice/src/main/java/IceInternal/DispatchObserverI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/DispatchWorkItem.java (renamed from java/src/Ice/src/main/java/IceInternal/DispatchWorkItem.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/EndpointFactory.java (renamed from java/src/Ice/src/main/java/IceInternal/EndpointFactory.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/EndpointFactoryManager.java (renamed from java/src/Ice/src/main/java/IceInternal/EndpointFactoryManager.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/EndpointHostResolver.java (renamed from java/src/Ice/src/main/java/IceInternal/EndpointHostResolver.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/EndpointI.java (renamed from java/src/Ice/src/main/java/IceInternal/EndpointI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/EndpointIHolder.java (renamed from java/src/Ice/src/main/java/IceInternal/EndpointIHolder.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/EndpointI_connectors.java (renamed from java/src/Ice/src/main/java/IceInternal/EndpointI_connectors.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/EventHandler.java (renamed from java/src/Ice/src/main/java/IceInternal/EventHandler.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/EventHandlerOpPair.java (renamed from java/src/Ice/src/main/java/IceInternal/EventHandlerOpPair.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Ex.java (renamed from java/src/Ice/src/main/java/IceInternal/Ex.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/FactoryACMMonitor.java (renamed from java/src/Ice/src/main/java/IceInternal/FactoryACMMonitor.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/FixedReference.java (renamed from java/src/Ice/src/main/java/IceInternal/FixedReference.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_BoolCallback.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_BoolCallback.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_ByteCallback.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_ByteCallback.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_CallbackBase.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_CallbackBase.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_DoubleCallback.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_DoubleCallback.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_FloatCallback.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_FloatCallback.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_GenericCallback1.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_GenericCallback1.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_IntCallback.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_IntCallback.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_LongCallback.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_LongCallback.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_OnewayCallback.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_OnewayCallback.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_ShortCallback.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_ShortCallback.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallback.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallback.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackArg1.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackArg1.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackArg1UE.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackArg1UE.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackBool.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackBool.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackBoolUE.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackBoolUE.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackByte.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackByte.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackByteUE.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackByteUE.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackDouble.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackDouble.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackDoubleUE.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackDoubleUE.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackFloat.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackFloat.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackFloatUE.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackFloatUE.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackInt.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackInt.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackIntUE.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackIntUE.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackLong.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackLong.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackLongUE.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackLongUE.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackShort.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackShort.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackShortUE.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackShortUE.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackUE.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackUE.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackVoidUE.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackVoidUE.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Functional_VoidCallback.java (renamed from java/src/Ice/src/main/java/IceInternal/Functional_VoidCallback.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/HTTPNetworkProxy.java (renamed from java/src/Ice/src/main/java/IceInternal/HTTPNetworkProxy.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/HashUtil.java (renamed from java/src/Ice/src/main/java/IceInternal/HashUtil.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/HttpParser.java (renamed from java/src/Ice/src/main/java/IceInternal/HttpParser.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/IPEndpointI.java (renamed from java/src/Ice/src/main/java/IceInternal/IPEndpointI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Incoming.java (renamed from java/src/Ice/src/main/java/IceInternal/Incoming.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/IncomingAsync.java (renamed from java/src/Ice/src/main/java/IceInternal/IncomingAsync.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/IncomingBase.java (renamed from java/src/Ice/src/main/java/IceInternal/IncomingBase.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/IncomingConnectionFactory.java (renamed from java/src/Ice/src/main/java/IceInternal/IncomingConnectionFactory.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/InputStreamWrapper.java (renamed from java/src/Ice/src/main/java/IceInternal/InputStreamWrapper.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Instance.java (renamed from java/src/Ice/src/main/java/IceInternal/Instance.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/InvocationObserverI.java (renamed from java/src/Ice/src/main/java/IceInternal/InvocationObserverI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ListPatcher.java (renamed from java/src/Ice/src/main/java/IceInternal/ListPatcher.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/LocatorInfo.java (renamed from java/src/Ice/src/main/java/IceInternal/LocatorInfo.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/LocatorManager.java (renamed from java/src/Ice/src/main/java/IceInternal/LocatorManager.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/LocatorTable.java (renamed from java/src/Ice/src/main/java/IceInternal/LocatorTable.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/LoggerAdminI.java (renamed from java/src/Ice/src/main/java/IceInternal/LoggerAdminI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/LoggerAdminLogger.java (renamed from java/src/Ice/src/main/java/IceInternal/LoggerAdminLogger.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/LoggerAdminLoggerI.java (renamed from java/src/Ice/src/main/java/IceInternal/LoggerAdminLoggerI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/MetricsAdminI.java (renamed from java/src/Ice/src/main/java/IceInternal/MetricsAdminI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/MetricsMap.java (renamed from java/src/Ice/src/main/java/IceInternal/MetricsMap.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/MetricsViewI.java (renamed from java/src/Ice/src/main/java/IceInternal/MetricsViewI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Network.java (renamed from java/src/Ice/src/main/java/IceInternal/Network.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/NetworkProxy.java (renamed from java/src/Ice/src/main/java/IceInternal/NetworkProxy.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ObjectAdapterFactory.java (renamed from java/src/Ice/src/main/java/IceInternal/ObjectAdapterFactory.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ObjectInputStream.java (renamed from java/src/Ice/src/main/java/IceInternal/ObjectInputStream.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ObserverHelper.java (renamed from java/src/Ice/src/main/java/IceInternal/ObserverHelper.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/OpaqueEndpointI.java (renamed from java/src/Ice/src/main/java/IceInternal/OpaqueEndpointI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/OutgoingAsync.java (renamed from java/src/Ice/src/main/java/IceInternal/OutgoingAsync.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/OutgoingAsyncBase.java (renamed from java/src/Ice/src/main/java/IceInternal/OutgoingAsyncBase.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/OutgoingConnectionFactory.java (renamed from java/src/Ice/src/main/java/IceInternal/OutgoingConnectionFactory.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/OutputStreamWrapper.java (renamed from java/src/Ice/src/main/java/IceInternal/OutputStreamWrapper.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ProcessI.java (renamed from java/src/Ice/src/main/java/IceInternal/ProcessI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/PropertiesAdminI.java (renamed from java/src/Ice/src/main/java/IceInternal/PropertiesAdminI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Property.java (renamed from java/src/Ice/src/main/java/IceInternal/Property.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/PropertyNames.java (renamed from java/src/Ice/src/main/java/IceInternal/PropertyNames.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Protocol.java (renamed from java/src/Ice/src/main/java/IceInternal/Protocol.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ProtocolInstance.java (renamed from java/src/Ice/src/main/java/IceInternal/ProtocolInstance.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ProtocolPluginFacade.java (renamed from java/src/Ice/src/main/java/IceInternal/ProtocolPluginFacade.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ProtocolPluginFacadeI.java (renamed from java/src/Ice/src/main/java/IceInternal/ProtocolPluginFacadeI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ProxyFactory.java (renamed from java/src/Ice/src/main/java/IceInternal/ProxyFactory.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ProxyFlushBatch.java (renamed from java/src/Ice/src/main/java/IceInternal/ProxyFlushBatch.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ProxyGetConnection.java (renamed from java/src/Ice/src/main/java/IceInternal/ProxyGetConnection.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ProxyOutgoingAsyncBase.java (renamed from java/src/Ice/src/main/java/IceInternal/ProxyOutgoingAsyncBase.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/QueueExecutorService.java (renamed from java/src/Ice/src/main/java/IceInternal/QueueExecutorService.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/QueueRequestHandler.java (renamed from java/src/Ice/src/main/java/IceInternal/QueueRequestHandler.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ReadyCallback.java (renamed from java/src/Ice/src/main/java/IceInternal/ReadyCallback.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Reference.java (renamed from java/src/Ice/src/main/java/IceInternal/Reference.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ReferenceFactory.java (renamed from java/src/Ice/src/main/java/IceInternal/ReferenceFactory.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/RemoteObserverI.java (renamed from java/src/Ice/src/main/java/IceInternal/RemoteObserverI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ReplyStatus.java (renamed from java/src/Ice/src/main/java/IceInternal/ReplyStatus.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/RequestHandler.java (renamed from java/src/Ice/src/main/java/IceInternal/RequestHandler.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/RequestHandlerFactory.java (renamed from java/src/Ice/src/main/java/IceInternal/RequestHandlerFactory.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ResponseHandler.java (renamed from java/src/Ice/src/main/java/IceInternal/ResponseHandler.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/RetryException.java (renamed from java/src/Ice/src/main/java/IceInternal/RetryException.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/RetryQueue.java (renamed from java/src/Ice/src/main/java/IceInternal/RetryQueue.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/RetryTask.java (renamed from java/src/Ice/src/main/java/IceInternal/RetryTask.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/RoutableReference.java (renamed from java/src/Ice/src/main/java/IceInternal/RoutableReference.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/RouterInfo.java (renamed from java/src/Ice/src/main/java/IceInternal/RouterInfo.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/RouterManager.java (renamed from java/src/Ice/src/main/java/IceInternal/RouterManager.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/SOCKSNetworkProxy.java (renamed from java/src/Ice/src/main/java/IceInternal/SOCKSNetworkProxy.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Selector.java (renamed from java/src/Ice/src/main/java/IceInternal/Selector.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/SequencePatcher.java (renamed from java/src/Ice/src/main/java/IceInternal/SequencePatcher.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ServantError.java (renamed from java/src/Ice/src/main/java/IceInternal/ServantError.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ServantManager.java (renamed from java/src/Ice/src/main/java/IceInternal/ServantManager.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/SocketOperation.java (renamed from java/src/Ice/src/main/java/IceInternal/SocketOperation.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/StreamSocket.java (renamed from java/src/Ice/src/main/java/IceInternal/StreamSocket.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/TcpAcceptor.java (renamed from java/src/Ice/src/main/java/IceInternal/TcpAcceptor.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/TcpConnector.java (renamed from java/src/Ice/src/main/java/IceInternal/TcpConnector.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/TcpEndpointFactory.java (renamed from java/src/Ice/src/main/java/IceInternal/TcpEndpointFactory.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/TcpEndpointI.java (renamed from java/src/Ice/src/main/java/IceInternal/TcpEndpointI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/TcpTransceiver.java (renamed from java/src/Ice/src/main/java/IceInternal/TcpTransceiver.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ThreadObserverI.java (renamed from java/src/Ice/src/main/java/IceInternal/ThreadObserverI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ThreadPool.java (renamed from java/src/Ice/src/main/java/IceInternal/ThreadPool.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ThreadPoolCurrent.java (renamed from java/src/Ice/src/main/java/IceInternal/ThreadPoolCurrent.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ThreadPoolWorkItem.java (renamed from java/src/Ice/src/main/java/IceInternal/ThreadPoolWorkItem.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ThreadPoolWorkQueue.java (renamed from java/src/Ice/src/main/java/IceInternal/ThreadPoolWorkQueue.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Time.java (renamed from java/src/Ice/src/main/java/IceInternal/Time.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/TraceLevels.java (renamed from java/src/Ice/src/main/java/IceInternal/TraceLevels.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/TraceUtil.java (renamed from java/src/Ice/src/main/java/IceInternal/TraceUtil.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Transceiver.java (renamed from java/src/Ice/src/main/java/IceInternal/Transceiver.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/TwowayCallback.java (renamed from java/src/Ice/src/main/java/IceInternal/TwowayCallback.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/UdpConnector.java (renamed from java/src/Ice/src/main/java/IceInternal/UdpConnector.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/UdpEndpointFactory.java (renamed from java/src/Ice/src/main/java/IceInternal/UdpEndpointFactory.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/UdpEndpointI.java (renamed from java/src/Ice/src/main/java/IceInternal/UdpEndpointI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/UdpTransceiver.java (renamed from java/src/Ice/src/main/java/IceInternal/UdpTransceiver.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/Util.java (renamed from java/src/Ice/src/main/java/IceInternal/Util.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ValueFactoryManagerI.java (renamed from java/src/Ice/src/main/java/IceInternal/ValueFactoryManagerI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/ValueWriter.java (renamed from java/src/Ice/src/main/java/IceInternal/ValueWriter.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/WSAcceptor.java (renamed from java/src/Ice/src/main/java/IceInternal/WSAcceptor.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/WSConnector.java (renamed from java/src/Ice/src/main/java/IceInternal/WSConnector.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/WSEndpoint.java (renamed from java/src/Ice/src/main/java/IceInternal/WSEndpoint.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/WSEndpointFactory.java (renamed from java/src/Ice/src/main/java/IceInternal/WSEndpointFactory.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/WSTransceiver.java (renamed from java/src/Ice/src/main/java/IceInternal/WSTransceiver.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/WebSocketException.java (renamed from java/src/Ice/src/main/java/IceInternal/WebSocketException.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceMX/MetricsHelper.java (renamed from java/src/Ice/src/main/java/IceMX/MetricsHelper.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceMX/Observer.java (renamed from java/src/Ice/src/main/java/IceMX/Observer.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceMX/ObserverFactory.java (renamed from java/src/Ice/src/main/java/IceMX/ObserverFactory.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceMX/ObserverFactoryWithDelegate.java (renamed from java/src/Ice/src/main/java/IceMX/ObserverFactoryWithDelegate.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceMX/ObserverWithDelegate.java (renamed from java/src/Ice/src/main/java/IceMX/ObserverWithDelegate.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceMX/ObserverWithDelegateI.java (renamed from java/src/Ice/src/main/java/IceMX/ObserverWithDelegateI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceSSL/AcceptorI.java (renamed from java/src/Ice/src/main/java/IceSSL/AcceptorI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceSSL/CertificateVerifier.java (renamed from java/src/Ice/src/main/java/IceSSL/CertificateVerifier.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceSSL/ConnectorI.java (renamed from java/src/Ice/src/main/java/IceSSL/ConnectorI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceSSL/EndpointFactoryI.java (renamed from java/src/Ice/src/main/java/IceSSL/EndpointFactoryI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceSSL/EndpointI.java (renamed from java/src/Ice/src/main/java/IceSSL/EndpointI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceSSL/Instance.java (renamed from java/src/Ice/src/main/java/IceSSL/Instance.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceSSL/NativeConnectionInfo.java (renamed from java/src/Ice/src/main/java/IceSSL/NativeConnectionInfo.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceSSL/PasswordCallback.java (renamed from java/src/Ice/src/main/java/IceSSL/PasswordCallback.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceSSL/Plugin.java (renamed from java/src/Ice/src/main/java/IceSSL/Plugin.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceSSL/PluginFactory.java (renamed from java/src/Ice/src/main/java/IceSSL/PluginFactory.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceSSL/PluginI.java (renamed from java/src/Ice/src/main/java/IceSSL/PluginI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceSSL/RFC2253.java (renamed from java/src/Ice/src/main/java/IceSSL/RFC2253.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceSSL/SSLEngine.java (renamed from java/src/Ice/src/main/java/IceSSL/SSLEngine.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceSSL/TransceiverI.java (renamed from java/src/Ice/src/main/java/IceSSL/TransceiverI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceSSL/TrustManager.java (renamed from java/src/Ice/src/main/java/IceSSL/TrustManager.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceSSL/Util.java (renamed from java/src/Ice/src/main/java/IceSSL/Util.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceSSL/X509KeyManagerI.java (renamed from java/src/Ice/src/main/java/IceSSL/X509KeyManagerI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceSSL/X509TrustManagerI.java (renamed from java/src/Ice/src/main/java/IceSSL/X509TrustManagerI.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceUtilInternal/Assert.java (renamed from java/src/Ice/src/main/java/IceUtilInternal/Assert.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceUtilInternal/Base64.java (renamed from java/src/Ice/src/main/java/IceUtilInternal/Base64.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceUtilInternal/Options.java (renamed from java/src/Ice/src/main/java/IceUtilInternal/Options.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceUtilInternal/OutputBase.java (renamed from java/src/Ice/src/main/java/IceUtilInternal/OutputBase.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceUtilInternal/StopWatch.java (renamed from java/src/Ice/src/main/java/IceUtilInternal/StopWatch.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceUtilInternal/StringUtil.java (renamed from java/src/Ice/src/main/java/IceUtilInternal/StringUtil.java)0
-rw-r--r--java-compat/src/Ice/src/main/java/IceUtilInternal/XMLOutput.java (renamed from java/src/Ice/src/main/java/IceUtilInternal/XMLOutput.java)0
-rw-r--r--java-compat/src/IceBT/build.gradle (renamed from java/src/IceBT/build.gradle)6
-rw-r--r--java-compat/src/IceBT/src/main/java/IceBT/AcceptorI.java (renamed from java/src/IceBT/src/main/java/IceBT/AcceptorI.java)0
-rw-r--r--java-compat/src/IceBT/src/main/java/IceBT/ConnectorI.java (renamed from java/src/IceBT/src/main/java/IceBT/ConnectorI.java)0
-rw-r--r--java-compat/src/IceBT/src/main/java/IceBT/EndpointFactoryI.java (renamed from java/src/IceBT/src/main/java/IceBT/EndpointFactoryI.java)0
-rw-r--r--java-compat/src/IceBT/src/main/java/IceBT/EndpointI.java (renamed from java/src/IceBT/src/main/java/IceBT/EndpointI.java)0
-rw-r--r--java-compat/src/IceBT/src/main/java/IceBT/Instance.java (renamed from java/src/IceBT/src/main/java/IceBT/Instance.java)0
-rw-r--r--java-compat/src/IceBT/src/main/java/IceBT/PluginFactory.java (renamed from java/src/IceBT/src/main/java/IceBT/PluginFactory.java)0
-rw-r--r--java-compat/src/IceBT/src/main/java/IceBT/PluginI.java (renamed from java/src/IceBT/src/main/java/IceBT/PluginI.java)0
-rw-r--r--java-compat/src/IceBT/src/main/java/IceBT/TransceiverI.java (renamed from java/src/IceBT/src/main/java/IceBT/TransceiverI.java)0
-rw-r--r--java-compat/src/IceBT/src/main/java/IceBT/Util.java (renamed from java/src/IceBT/src/main/java/IceBT/Util.java)0
-rw-r--r--java-compat/src/IceBT/src/main/java/android/bluetooth/BluetoothAdapter.java (renamed from java/src/IceBT/src/main/java/android/bluetooth/BluetoothAdapter.java)0
-rw-r--r--java-compat/src/IceBT/src/main/java/android/bluetooth/BluetoothDevice.java (renamed from java/src/IceBT/src/main/java/android/bluetooth/BluetoothDevice.java)0
-rw-r--r--java-compat/src/IceBT/src/main/java/android/bluetooth/BluetoothServerSocket.java (renamed from java/src/IceBT/src/main/java/android/bluetooth/BluetoothServerSocket.java)0
-rw-r--r--java-compat/src/IceBT/src/main/java/android/bluetooth/BluetoothSocket.java (renamed from java/src/IceBT/src/main/java/android/bluetooth/BluetoothSocket.java)0
-rw-r--r--java-compat/src/IceBox/build.gradle29
-rw-r--r--java-compat/src/IceBox/src/main/java/IceBox/Admin.java (renamed from java/src/IceBox/src/main/java/IceBox/Admin.java)0
-rw-r--r--java-compat/src/IceBox/src/main/java/IceBox/Server.java (renamed from java/src/IceBox/src/main/java/IceBox/Server.java)0
-rw-r--r--java-compat/src/IceBox/src/main/java/IceBox/ServiceManagerI.java (renamed from java/src/IceBox/src/main/java/IceBox/ServiceManagerI.java)0
-rw-r--r--java-compat/src/IceDiscovery/build.gradle27
-rw-r--r--java-compat/src/IceDiscovery/src/main/java/IceDiscovery/LocatorI.java (renamed from java/src/IceDiscovery/src/main/java/IceDiscovery/LocatorI.java)0
-rw-r--r--java-compat/src/IceDiscovery/src/main/java/IceDiscovery/LocatorRegistryI.java (renamed from java/src/IceDiscovery/src/main/java/IceDiscovery/LocatorRegistryI.java)0
-rw-r--r--java-compat/src/IceDiscovery/src/main/java/IceDiscovery/LookupI.java (renamed from java/src/IceDiscovery/src/main/java/IceDiscovery/LookupI.java)0
-rw-r--r--java-compat/src/IceDiscovery/src/main/java/IceDiscovery/LookupReplyI.java (renamed from java/src/IceDiscovery/src/main/java/IceDiscovery/LookupReplyI.java)0
-rw-r--r--java-compat/src/IceDiscovery/src/main/java/IceDiscovery/PluginFactory.java (renamed from java/src/IceDiscovery/src/main/java/IceDiscovery/PluginFactory.java)0
-rw-r--r--java-compat/src/IceDiscovery/src/main/java/IceDiscovery/PluginI.java (renamed from java/src/IceDiscovery/src/main/java/IceDiscovery/PluginI.java)0
-rw-r--r--java-compat/src/IceGrid/build.gradle30
-rw-r--r--java-compat/src/IceLocatorDiscovery/build.gradle27
-rw-r--r--java-compat/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginFactory.java (renamed from java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginFactory.java)0
-rw-r--r--java-compat/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java (renamed from java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java)0
-rw-r--r--java-compat/src/IcePatch2/build.gradle29
-rw-r--r--java-compat/src/IceStorm/build.gradle29
-rw-r--r--java-compat/test/Ice/translator/DoubleModuleNoPackage.ice66
-rw-r--r--java-compat/test/Ice/translator/DoubleModuleWithPackage.ice68
-rw-r--r--java-compat/test/Ice/translator/Metadata.ice124
-rw-r--r--java-compat/test/Ice/translator/SingleModuleNoPackage.ice63
-rw-r--r--java-compat/test/Ice/translator/SingleModuleWithPackage.ice65
-rw-r--r--java-compat/test/Ice/translator/Test/CustomList.java5
-rw-r--r--java-compat/test/Ice/translator/TestDoubleModuleNoPackage4.ice79
-rw-r--r--java-compat/test/Ice/translator/TestDoubleModuleNoPackage5.ice82
-rw-r--r--java-compat/test/Ice/translator/TestDoubleModuleNoPackage6.ice82
-rw-r--r--java-compat/test/Ice/translator/TestDoubleModuleNoPackage7.ice84
-rw-r--r--java-compat/test/Ice/translator/TestDoubleModuleWithPackage10.ice84
-rw-r--r--java-compat/test/Ice/translator/TestDoubleModuleWithPackage11.ice84
-rw-r--r--java-compat/test/Ice/translator/TestDoubleModuleWithPackage4.ice79
-rw-r--r--java-compat/test/Ice/translator/TestDoubleModuleWithPackage5.ice79
-rw-r--r--java-compat/test/Ice/translator/TestDoubleModuleWithPackage6.ice81
-rw-r--r--java-compat/test/Ice/translator/TestDoubleModuleWithPackage7.ice81
-rw-r--r--java-compat/test/Ice/translator/TestDoubleModuleWithPackage8.ice82
-rw-r--r--java-compat/test/Ice/translator/TestDoubleModuleWithPackage9.ice82
-rw-r--r--java-compat/test/Ice/translator/TestSingleModuleNoPackage4.ice79
-rw-r--r--java-compat/test/Ice/translator/TestSingleModuleNoPackage6.ice82
-rw-r--r--java-compat/test/Ice/translator/TestSingleModuleNoPackage7.ice82
-rw-r--r--java-compat/test/Ice/translator/TestSingleModuleWithPackage10.ice82
-rw-r--r--java-compat/test/Ice/translator/TestSingleModuleWithPackage11.ice84
-rw-r--r--java-compat/test/Ice/translator/TestSingleModuleWithPackage12.ice84
-rw-r--r--java-compat/test/Ice/translator/TestSingleModuleWithPackage13.ice84
-rw-r--r--java-compat/test/Ice/translator/TestSingleModuleWithPackage4.ice79
-rw-r--r--java-compat/test/Ice/translator/TestSingleModuleWithPackage5.ice79
-rw-r--r--java-compat/test/Ice/translator/TestSingleModuleWithPackage6.ice81
-rw-r--r--java-compat/test/Ice/translator/TestSingleModuleWithPackage7.ice81
-rw-r--r--java-compat/test/Ice/translator/TestSingleModuleWithPackage9.ice82
-rw-r--r--java-compat/test/Ice/translator/Underscore.ice38
-rw-r--r--java-compat/test/build.gradle52
-rw-r--r--java-compat/test/controller/build.gradle22
-rw-r--r--java-compat/test/controller/src/main/java/Test/Common/ControllerServer.java325
-rw-r--r--java-compat/test/controller/src/main/slice/Controller.ice38
-rw-r--r--java-compat/test/ejb/README.md73
-rw-r--r--java-compat/test/ejb/src/common/com/zeroc/ice/IceAdapter.java52
-rw-r--r--java-compat/test/ejb/src/ejb1/META-INF/jboss.xml9
-rw-r--r--java-compat/test/ejb/src/ejb1/com/zeroc/ejb/Client.java68
-rw-r--r--java-compat/test/ejb/src/ejb1/com/zeroc/ejb/DatabaseI.java35
-rw-r--r--java-compat/test/ejb/src/ejb1/com/zeroc/ejb/DatabaseServer.java43
-rw-r--r--java-compat/test/ejb/src/ejb1/com/zeroc/ejb/Init.java18
-rw-r--r--java-compat/test/ejb/src/ejb1/com/zeroc/ejb/InitBean.java44
-rw-r--r--java-compat/test/ejb/src/ejb1/com/zeroc/ejb/Service.java22
-rw-r--r--java-compat/test/ejb/src/ejb1/com/zeroc/ejb/ServiceBean.java50
-rw-r--r--java-compat/test/ejb/src/ejb1/com/zeroc/ejb/ServiceI.java41
-rw-r--r--java-compat/test/ejb/src/ejb2/META-INF/jboss.xml9
-rw-r--r--java-compat/test/ejb/src/ejb2/com/zeroc/ejb/Client.java68
-rw-r--r--java-compat/test/ejb/src/ejb2/com/zeroc/ejb/DatabaseI.java35
-rw-r--r--java-compat/test/ejb/src/ejb2/com/zeroc/ejb/DatabaseServer.java43
-rw-r--r--java-compat/test/ejb/src/ejb2/com/zeroc/ejb/Init.java18
-rw-r--r--java-compat/test/ejb/src/ejb2/com/zeroc/ejb/InitBean.java44
-rw-r--r--java-compat/test/ejb/src/ejb2/com/zeroc/ejb/Service.java22
-rw-r--r--java-compat/test/ejb/src/ejb2/com/zeroc/ejb/ServiceBean.java86
-rw-r--r--java-compat/test/ejb/src/ejb2/com/zeroc/ejb/ServiceI.java41
-rw-r--r--java-compat/test/ejb/src/resources/jndi.properties3
-rw-r--r--java-compat/test/ejb/src/slice/common.ice18
-rw-r--r--java-compat/test/ejb/src/slice/ejb1.ice40
-rw-r--r--java-compat/test/ejb/src/slice/ejb2.ice42
-rw-r--r--java-compat/test/plugins/build.gradle30
-rw-r--r--java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/BasePlugin.java41
-rw-r--r--java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/BasePluginFail.java45
-rw-r--r--java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginFactory.java75
-rw-r--r--java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginInitializeFailException.java18
-rw-r--r--java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginInitializeFailFactory.java42
-rw-r--r--java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginOneFactory.java42
-rw-r--r--java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginOneFailFactory.java68
-rw-r--r--java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginThreeFactory.java42
-rw-r--r--java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginThreeFailFactory.java59
-rw-r--r--java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginTwoFactory.java42
-rw-r--r--java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginTwoFailFactory.java68
-rw-r--r--java-compat/test/slice.gradle85
-rw-r--r--java-compat/test/src/main/java/test/Glacier2/router/Callback.ice40
-rw-r--r--java-compat/test/src/main/java/test/Glacier2/router/CallbackI.java40
-rw-r--r--java-compat/test/src/main/java/test/Glacier2/router/CallbackReceiverI.java59
-rw-r--r--java-compat/test/src/main/java/test/Glacier2/router/Client.java484
-rw-r--r--java-compat/test/src/main/java/test/Glacier2/router/Server.java51
-rwxr-xr-xjava-compat/test/src/main/java/test/Glacier2/router/run.py53
-rw-r--r--java-compat/test/src/main/java/test/Glacier2/sessionHelper/Callback.ice41
-rw-r--r--java-compat/test/src/main/java/test/Glacier2/sessionHelper/CallbackI.java40
-rw-r--r--java-compat/test/src/main/java/test/Glacier2/sessionHelper/Client.java541
-rw-r--r--java-compat/test/src/main/java/test/Glacier2/sessionHelper/Server.java47
-rwxr-xr-xjava-compat/test/src/main/java/test/Glacier2/sessionHelper/run.py49
-rw-r--r--java-compat/test/src/main/java/test/Ice/acm/AllTests.java659
-rw-r--r--java-compat/test/src/main/java/test/Ice/acm/Client.java36
-rw-r--r--java-compat/test/src/main/java/test/Ice/acm/RemoteCommunicatorI.java50
-rw-r--r--java-compat/test/src/main/java/test/Ice/acm/RemoteObjectAdapterI.java53
-rw-r--r--java-compat/test/src/main/java/test/Ice/acm/Server.java48
-rw-r--r--java-compat/test/src/main/java/test/Ice/acm/Test.ice39
-rw-r--r--java-compat/test/src/main/java/test/Ice/acm/TestI.java80
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/acm/run.py25
-rw-r--r--java-compat/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java105
-rw-r--r--java-compat/test/src/main/java/test/Ice/adapterDeactivation/Client.java38
-rw-r--r--java-compat/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java49
-rw-r--r--java-compat/test/src/main/java/test/Ice/adapterDeactivation/CookieI.java21
-rw-r--r--java-compat/test/src/main/java/test/Ice/adapterDeactivation/ServantLocatorI.java78
-rw-r--r--java-compat/test/src/main/java/test/Ice/adapterDeactivation/Server.java45
-rw-r--r--java-compat/test/src/main/java/test/Ice/adapterDeactivation/Test.ice28
-rw-r--r--java-compat/test/src/main/java/test/Ice/adapterDeactivation/TestI.java39
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/adapterDeactivation/run.py26
-rw-r--r--java-compat/test/src/main/java/test/Ice/admin/AllTests.java553
-rw-r--r--java-compat/test/src/main/java/test/Ice/admin/Client.java30
-rw-r--r--java-compat/test/src/main/java/test/Ice/admin/RemoteCommunicatorFactoryI.java94
-rw-r--r--java-compat/test/src/main/java/test/Ice/admin/RemoteCommunicatorI.java111
-rw-r--r--java-compat/test/src/main/java/test/Ice/admin/RemoteLoggerI.java77
-rw-r--r--java-compat/test/src/main/java/test/Ice/admin/Server.java42
-rw-r--r--java-compat/test/src/main/java/test/Ice/admin/Test.ice54
-rw-r--r--java-compat/test/src/main/java/test/Ice/admin/TestFacetI.java20
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/admin/run.py25
-rw-r--r--java-compat/test/src/main/java/test/Ice/ami/AMI.java2648
-rw-r--r--java-compat/test/src/main/java/test/Ice/ami/AllTests.java90
-rw-r--r--java-compat/test/src/main/java/test/Ice/ami/Client.java45
-rw-r--r--java-compat/test/src/main/java/test/Ice/ami/Collocated.java49
-rw-r--r--java-compat/test/src/main/java/test/Ice/ami/Server.java54
-rw-r--r--java-compat/test/src/main/java/test/Ice/ami/Test.ice52
-rw-r--r--java-compat/test/src/main/java/test/Ice/ami/TestControllerI.java36
-rw-r--r--java-compat/test/src/main/java/test/Ice/ami/TestI.java145
-rw-r--r--java-compat/test/src/main/java/test/Ice/ami/lambda/AMI.java (renamed from java/test/src/main/java/test/Ice/ami/lambda/AMI.java)0
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/ami/run.py26
-rw-r--r--java-compat/test/src/main/java/test/Ice/background/Acceptor.java86
-rw-r--r--java-compat/test/src/main/java/test/Ice/background/AllTests.java1352
-rw-r--r--java-compat/test/src/main/java/test/Ice/background/BackgroundControllerI.java119
-rw-r--r--java-compat/test/src/main/java/test/Ice/background/BackgroundI.java42
-rw-r--r--java-compat/test/src/main/java/test/Ice/background/Client.java73
-rw-r--r--java-compat/test/src/main/java/test/Ice/background/Collocated.java99
-rw-r--r--java-compat/test/src/main/java/test/Ice/background/Configuration.java168
-rw-r--r--java-compat/test/src/main/java/test/Ice/background/Connector.java76
-rw-r--r--java-compat/test/src/main/java/test/Ice/background/EndpointFactory.java68
-rw-r--r--java-compat/test/src/main/java/test/Ice/background/EndpointI.java294
-rw-r--r--java-compat/test/src/main/java/test/Ice/background/PluginFactory.java60
-rw-r--r--java-compat/test/src/main/java/test/Ice/background/Server.java152
-rw-r--r--java-compat/test/src/main/java/test/Ice/background/Test.ice47
-rw-r--r--java-compat/test/src/main/java/test/Ice/background/Transceiver.java223
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/background/run.py25
-rw-r--r--java-compat/test/src/main/java/test/Ice/binding/AllTests.java982
-rw-r--r--java-compat/test/src/main/java/test/Ice/binding/Client.java37
-rw-r--r--java-compat/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java52
-rw-r--r--java-compat/test/src/main/java/test/Ice/binding/RemoteObjectAdapterI.java48
-rw-r--r--java-compat/test/src/main/java/test/Ice/binding/Server.java45
-rw-r--r--java-compat/test/src/main/java/test/Ice/binding/Test.ice37
-rw-r--r--java-compat/test/src/main/java/test/Ice/binding/TestI.java25
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/binding/run.py25
-rw-r--r--java-compat/test/src/main/java/test/Ice/checksum/AllTests.java92
-rw-r--r--java-compat/test/src/main/java/test/Ice/checksum/ChecksumI.java34
-rw-r--r--java-compat/test/src/main/java/test/Ice/checksum/Client.java45
-rw-r--r--java-compat/test/src/main/java/test/Ice/checksum/Server.java45
-rw-r--r--java-compat/test/src/main/java/test/Ice/checksum/Test.ice25
-rw-r--r--java-compat/test/src/main/java/test/Ice/checksum/TestServer.ice25
-rw-r--r--java-compat/test/src/main/java/test/Ice/checksum/Types.ice635
-rw-r--r--java-compat/test/src/main/java/test/Ice/checksum/TypesServer.ice632
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/checksum/run.py25
-rw-r--r--java-compat/test/src/main/java/test/Ice/classLoader/AbstractClassI.java21
-rw-r--r--java-compat/test/src/main/java/test/Ice/classLoader/AllTests.java215
-rw-r--r--java-compat/test/src/main/java/test/Ice/classLoader/CertificateVerifierI.java19
-rw-r--r--java-compat/test/src/main/java/test/Ice/classLoader/Client.java39
-rw-r--r--java-compat/test/src/main/java/test/Ice/classLoader/InitialI.java55
-rw-r--r--java-compat/test/src/main/java/test/Ice/classLoader/PasswordCallbackI.java31
-rw-r--r--java-compat/test/src/main/java/test/Ice/classLoader/PluginFactoryI.java32
-rw-r--r--java-compat/test/src/main/java/test/Ice/classLoader/Server.java44
-rw-r--r--java-compat/test/src/main/java/test/Ice/classLoader/Test.ice36
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/classLoader/run.py25
-rw-r--r--java-compat/test/src/main/java/test/Ice/custom/AllTests.java354
-rw-r--r--java-compat/test/src/main/java/test/Ice/custom/Client.java43
-rw-r--r--java-compat/test/src/main/java/test/Ice/custom/Collocated.java46
-rw-r--r--java-compat/test/src/main/java/test/Ice/custom/Server.java46
-rw-r--r--java-compat/test/src/main/java/test/Ice/custom/Test.ice84
-rw-r--r--java-compat/test/src/main/java/test/Ice/custom/TestI.java241
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/custom/run.py26
-rw-r--r--java-compat/test/src/main/java/test/Ice/defaultServant/AllTests.java171
-rw-r--r--java-compat/test/src/main/java/test/Ice/defaultServant/Client.java30
-rw-r--r--java-compat/test/src/main/java/test/Ice/defaultServant/MyObjectI.java48
-rw-r--r--java-compat/test/src/main/java/test/Ice/defaultServant/Test.ice21
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/defaultServant/run.py30
-rw-r--r--java-compat/test/src/main/java/test/Ice/defaultValue/AllTests.java205
-rw-r--r--java-compat/test/src/main/java/test/Ice/defaultValue/Client.java29
-rw-r--r--java-compat/test/src/main/java/test/Ice/defaultValue/Test.ice208
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/defaultValue/run.py29
-rw-r--r--java-compat/test/src/main/java/test/Ice/dispatcher/AllTests.java229
-rw-r--r--java-compat/test/src/main/java/test/Ice/dispatcher/Client.java61
-rw-r--r--java-compat/test/src/main/java/test/Ice/dispatcher/Collocated.java66
-rw-r--r--java-compat/test/src/main/java/test/Ice/dispatcher/Dispatcher.java117
-rw-r--r--java-compat/test/src/main/java/test/Ice/dispatcher/Server.java75
-rw-r--r--java-compat/test/src/main/java/test/Ice/dispatcher/Test.ice32
-rw-r--r--java-compat/test/src/main/java/test/Ice/dispatcher/TestControllerI.java37
-rw-r--r--java-compat/test/src/main/java/test/Ice/dispatcher/TestI.java66
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/dispatcher/run.py26
-rw-r--r--java-compat/test/src/main/java/test/Ice/echo/BlobjectI.java109
-rw-r--r--java-compat/test/src/main/java/test/Ice/echo/Server.java71
-rw-r--r--java-compat/test/src/main/java/test/Ice/echo/Test.ice26
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/echo/run.py30
-rw-r--r--java-compat/test/src/main/java/test/Ice/enums/AllTests.java336
-rw-r--r--java-compat/test/src/main/java/test/Ice/enums/Client.java42
-rw-r--r--java-compat/test/src/main/java/test/Ice/enums/Server.java45
-rw-r--r--java-compat/test/src/main/java/test/Ice/enums/Test.ice98
-rw-r--r--java-compat/test/src/main/java/test/Ice/enums/TestIntfI.java86
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/enums/run.py29
-rw-r--r--java-compat/test/src/main/java/test/Ice/exceptions/AMDServer.java62
-rw-r--r--java-compat/test/src/main/java/test/Ice/exceptions/AMDThrowerI.java240
-rw-r--r--java-compat/test/src/main/java/test/Ice/exceptions/AllTests.java1502
-rw-r--r--java-compat/test/src/main/java/test/Ice/exceptions/Client.java43
-rw-r--r--java-compat/test/src/main/java/test/Ice/exceptions/Collocated.java56
-rw-r--r--java-compat/test/src/main/java/test/Ice/exceptions/DummyLogger.java66
-rw-r--r--java-compat/test/src/main/java/test/Ice/exceptions/EmptyI.java17
-rw-r--r--java-compat/test/src/main/java/test/Ice/exceptions/ServantLocatorI.java30
-rw-r--r--java-compat/test/src/main/java/test/Ice/exceptions/Server.java62
-rw-r--r--java-compat/test/src/main/java/test/Ice/exceptions/Test.ice77
-rw-r--r--java-compat/test/src/main/java/test/Ice/exceptions/TestAMD.ice72
-rw-r--r--java-compat/test/src/main/java/test/Ice/exceptions/ThrowerI.java201
-rw-r--r--java-compat/test/src/main/java/test/Ice/exceptions/ValueFactoryI.java21
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/exceptions/run.py51
-rw-r--r--java-compat/test/src/main/java/test/Ice/facets/AI.java27
-rw-r--r--java-compat/test/src/main/java/test/Ice/facets/AllTests.java206
-rw-r--r--java-compat/test/src/main/java/test/Ice/facets/BI.java34
-rw-r--r--java-compat/test/src/main/java/test/Ice/facets/CI.java34
-rw-r--r--java-compat/test/src/main/java/test/Ice/facets/Client.java41
-rw-r--r--java-compat/test/src/main/java/test/Ice/facets/Collocated.java49
-rw-r--r--java-compat/test/src/main/java/test/Ice/facets/DI.java48
-rw-r--r--java-compat/test/src/main/java/test/Ice/facets/EI.java27
-rw-r--r--java-compat/test/src/main/java/test/Ice/facets/EmptyI.java16
-rw-r--r--java-compat/test/src/main/java/test/Ice/facets/FI.java34
-rw-r--r--java-compat/test/src/main/java/test/Ice/facets/GI.java37
-rw-r--r--java-compat/test/src/main/java/test/Ice/facets/HI.java44
-rw-r--r--java-compat/test/src/main/java/test/Ice/facets/Server.java49
-rw-r--r--java-compat/test/src/main/java/test/Ice/facets/Test.ice61
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/facets/run.py26
-rw-r--r--java-compat/test/src/main/java/test/Ice/faultTolerance/AllTests.java328
-rw-r--r--java-compat/test/src/main/java/test/Ice/faultTolerance/Client.java105
-rw-r--r--java-compat/test/src/main/java/test/Ice/faultTolerance/Server.java91
-rw-r--r--java-compat/test/src/main/java/test/Ice/faultTolerance/Test.ice24
-rw-r--r--java-compat/test/src/main/java/test/Ice/faultTolerance/TestI.java51
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/faultTolerance/run.py45
-rw-r--r--java-compat/test/src/main/java/test/Ice/hash/Client.java445
-rw-r--r--java-compat/test/src/main/java/test/Ice/hash/Test.ice72
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/hash/run.py24
-rw-r--r--java-compat/test/src/main/java/test/Ice/hold/AllTests.java239
-rw-r--r--java-compat/test/src/main/java/test/Ice/hold/Client.java37
-rw-r--r--java-compat/test/src/main/java/test/Ice/hold/HoldI.java133
-rw-r--r--java-compat/test/src/main/java/test/Ice/hold/Server.java64
-rw-r--r--java-compat/test/src/main/java/test/Ice/hold/Test.ice25
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/hold/run.py25
-rw-r--r--java-compat/test/src/main/java/test/Ice/info/AllTests.java240
-rw-r--r--java-compat/test/src/main/java/test/Ice/info/Client.java37
-rw-r--r--java-compat/test/src/main/java/test/Ice/info/Server.java41
-rw-r--r--java-compat/test/src/main/java/test/Ice/info/Test.ice27
-rw-r--r--java-compat/test/src/main/java/test/Ice/info/TestI.java101
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/info/run.py25
-rw-r--r--java-compat/test/src/main/java/test/Ice/inheritance/AllTests.java248
-rw-r--r--java-compat/test/src/main/java/test/Ice/inheritance/CAI.java28
-rw-r--r--java-compat/test/src/main/java/test/Ice/inheritance/CBI.java36
-rw-r--r--java-compat/test/src/main/java/test/Ice/inheritance/CCI.java44
-rw-r--r--java-compat/test/src/main/java/test/Ice/inheritance/CDI.java76
-rw-r--r--java-compat/test/src/main/java/test/Ice/inheritance/Client.java42
-rw-r--r--java-compat/test/src/main/java/test/Ice/inheritance/Collocated.java46
-rw-r--r--java-compat/test/src/main/java/test/Ice/inheritance/IAI.java28
-rw-r--r--java-compat/test/src/main/java/test/Ice/inheritance/IB1I.java36
-rw-r--r--java-compat/test/src/main/java/test/Ice/inheritance/IB2I.java36
-rw-r--r--java-compat/test/src/main/java/test/Ice/inheritance/ICI.java52
-rw-r--r--java-compat/test/src/main/java/test/Ice/inheritance/InitialI.java116
-rw-r--r--java-compat/test/src/main/java/test/Ice/inheritance/Server.java43
-rw-r--r--java-compat/test/src/main/java/test/Ice/inheritance/Test.ice84
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/inheritance/run.py26
-rw-r--r--java-compat/test/src/main/java/test/Ice/interceptor/AMDInterceptorI.java (renamed from java/test/src/main/java/test/Ice/interceptor/AMDInterceptorI.java)0
-rw-r--r--java-compat/test/src/main/java/test/Ice/interceptor/Client.java270
-rw-r--r--java-compat/test/src/main/java/test/Ice/interceptor/InterceptorI.java84
-rw-r--r--java-compat/test/src/main/java/test/Ice/interceptor/MyObjectI.java201
-rw-r--r--java-compat/test/src/main/java/test/Ice/interceptor/MySystemException.java25
-rw-r--r--java-compat/test/src/main/java/test/Ice/interceptor/Test.ice84
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/interceptor/run.py30
-rw-r--r--java-compat/test/src/main/java/test/Ice/interrupt/AllTests.java820
-rw-r--r--java-compat/test/src/main/java/test/Ice/interrupt/Client.java65
-rw-r--r--java-compat/test/src/main/java/test/Ice/interrupt/Collocated.java71
-rw-r--r--java-compat/test/src/main/java/test/Ice/interrupt/Server.java71
-rw-r--r--java-compat/test/src/main/java/test/Ice/interrupt/Test.ice44
-rw-r--r--java-compat/test/src/main/java/test/Ice/interrupt/TestControllerI.java69
-rw-r--r--java-compat/test/src/main/java/test/Ice/interrupt/TestI.java67
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/interrupt/run.py26
-rw-r--r--java-compat/test/src/main/java/test/Ice/invoke/AllTests.java394
-rw-r--r--java-compat/test/src/main/java/test/Ice/invoke/BlobjectAsyncI.java72
-rw-r--r--java-compat/test/src/main/java/test/Ice/invoke/BlobjectI.java76
-rw-r--r--java-compat/test/src/main/java/test/Ice/invoke/Client.java69
-rw-r--r--java-compat/test/src/main/java/test/Ice/invoke/ServantLocatorI.java46
-rw-r--r--java-compat/test/src/main/java/test/Ice/invoke/Server.java50
-rw-r--r--java-compat/test/src/main/java/test/Ice/invoke/Test.ice31
-rw-r--r--java-compat/test/src/main/java/test/Ice/invoke/lambda/AllTests.java (renamed from java/test/src/main/java/test/Ice/invoke/lambda/AllTests.java)0
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/invoke/run.py27
-rw-r--r--java-compat/test/src/main/java/test/Ice/location/AllTests.java696
-rw-r--r--java-compat/test/src/main/java/test/Ice/location/Client.java57
-rw-r--r--java-compat/test/src/main/java/test/Ice/location/HelloI.java22
-rw-r--r--java-compat/test/src/main/java/test/Ice/location/Server.java70
-rw-r--r--java-compat/test/src/main/java/test/Ice/location/ServerLocator.java86
-rw-r--r--java-compat/test/src/main/java/test/Ice/location/ServerLocatorRegistry.java91
-rw-r--r--java-compat/test/src/main/java/test/Ice/location/ServerManagerI.java92
-rw-r--r--java-compat/test/src/main/java/test/Ice/location/Test.ice56
-rw-r--r--java-compat/test/src/main/java/test/Ice/location/TestI.java67
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/location/run.py25
-rw-r--r--java-compat/test/src/main/java/test/Ice/metrics/AMDMetricsI.java84
-rw-r--r--java-compat/test/src/main/java/test/Ice/metrics/AMDServer.java52
-rw-r--r--java-compat/test/src/main/java/test/Ice/metrics/AllTests.java1301
-rw-r--r--java-compat/test/src/main/java/test/Ice/metrics/ChildInvocationObserverI.java31
-rw-r--r--java-compat/test/src/main/java/test/Ice/metrics/Client.java60
-rw-r--r--java-compat/test/src/main/java/test/Ice/metrics/Collocated.java78
-rw-r--r--java-compat/test/src/main/java/test/Ice/metrics/CollocatedObserverI.java15
-rw-r--r--java-compat/test/src/main/java/test/Ice/metrics/CommunicatorObserverI.java147
-rw-r--r--java-compat/test/src/main/java/test/Ice/metrics/ConnectionObserverI.java40
-rw-r--r--java-compat/test/src/main/java/test/Ice/metrics/ControllerI.java34
-rw-r--r--java-compat/test/src/main/java/test/Ice/metrics/DispatchObserverI.java40
-rw-r--r--java-compat/test/src/main/java/test/Ice/metrics/InvocationObserverI.java75
-rw-r--r--java-compat/test/src/main/java/test/Ice/metrics/MetricsI.java81
-rw-r--r--java-compat/test/src/main/java/test/Ice/metrics/ObserverI.java63
-rw-r--r--java-compat/test/src/main/java/test/Ice/metrics/RemoveObserverI.java15
-rw-r--r--java-compat/test/src/main/java/test/Ice/metrics/Server.java53
-rw-r--r--java-compat/test/src/main/java/test/Ice/metrics/Test.ice51
-rw-r--r--java-compat/test/src/main/java/test/Ice/metrics/TestAMD.ice51
-rw-r--r--java-compat/test/src/main/java/test/Ice/metrics/ThreadObserverI.java31
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/metrics/run.py28
-rw-r--r--java-compat/test/src/main/java/test/Ice/networkProxy/AllTests.java84
-rw-r--r--java-compat/test/src/main/java/test/Ice/networkProxy/Client.java39
-rw-r--r--java-compat/test/src/main/java/test/Ice/networkProxy/Server.java51
-rw-r--r--java-compat/test/src/main/java/test/Ice/networkProxy/Test.ice21
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/networkProxy/run.py46
-rw-r--r--java-compat/test/src/main/java/test/Ice/objects/AllTests.java297
-rw-r--r--java-compat/test/src/main/java/test/Ice/objects/BI.java44
-rw-r--r--java-compat/test/src/main/java/test/Ice/objects/CI.java45
-rw-r--r--java-compat/test/src/main/java/test/Ice/objects/Client.java112
-rw-r--r--java-compat/test/src/main/java/test/Ice/objects/Collocated.java119
-rw-r--r--java-compat/test/src/main/java/test/Ice/objects/DI.java45
-rw-r--r--java-compat/test/src/main/java/test/Ice/objects/EI.java29
-rw-r--r--java-compat/test/src/main/java/test/Ice/objects/FI.java35
-rw-r--r--java-compat/test/src/main/java/test/Ice/objects/HI.java17
-rw-r--r--java-compat/test/src/main/java/test/Ice/objects/II.java16
-rw-r--r--java-compat/test/src/main/java/test/Ice/objects/InitialI.java225
-rw-r--r--java-compat/test/src/main/java/test/Ice/objects/JI.java17
-rw-r--r--java-compat/test/src/main/java/test/Ice/objects/Server.java73
-rw-r--r--java-compat/test/src/main/java/test/Ice/objects/Test.ice253
-rw-r--r--java-compat/test/src/main/java/test/Ice/objects/UnexpectedObjectExceptionTestI.java29
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/objects/run.py35
-rw-r--r--java-compat/test/src/main/java/test/Ice/operations/AMDMyDerivedClassI.java999
-rw-r--r--java-compat/test/src/main/java/test/Ice/operations/AMDServer.java48
-rw-r--r--java-compat/test/src/main/java/test/Ice/operations/AMDTieMyDerivedClassI.java (renamed from java/test/src/main/java/test/Ice/operations/AMDTieMyDerivedClassI.java)0
-rw-r--r--java-compat/test/src/main/java/test/Ice/operations/AMDTieServer.java (renamed from java/test/src/main/java/test/Ice/operations/AMDTieServer.java)0
-rw-r--r--java-compat/test/src/main/java/test/Ice/operations/AllTests.java127
-rw-r--r--java-compat/test/src/main/java/test/Ice/operations/BatchOneways.java181
-rw-r--r--java-compat/test/src/main/java/test/Ice/operations/BatchOnewaysAMI.java136
-rw-r--r--java-compat/test/src/main/java/test/Ice/operations/Client.java58
-rw-r--r--java-compat/test/src/main/java/test/Ice/operations/Collocated.java64
-rw-r--r--java-compat/test/src/main/java/test/Ice/operations/MyDerivedClassI.java911
-rw-r--r--java-compat/test/src/main/java/test/Ice/operations/Oneways.java60
-rw-r--r--java-compat/test/src/main/java/test/Ice/operations/OnewaysAMI.java244
-rw-r--r--java-compat/test/src/main/java/test/Ice/operations/Server.java47
-rw-r--r--java-compat/test/src/main/java/test/Ice/operations/Test.ice354
-rw-r--r--java-compat/test/src/main/java/test/Ice/operations/TestAMD.ice354
-rw-r--r--java-compat/test/src/main/java/test/Ice/operations/TieMyDerivedClassI.java (renamed from java/test/src/main/java/test/Ice/operations/TieMyDerivedClassI.java)0
-rw-r--r--java-compat/test/src/main/java/test/Ice/operations/TieServer.java (renamed from java/test/src/main/java/test/Ice/operations/TieServer.java)0
-rw-r--r--java-compat/test/src/main/java/test/Ice/operations/Twoways.java1606
-rw-r--r--java-compat/test/src/main/java/test/Ice/operations/TwowaysAMI.java2936
-rw-r--r--java-compat/test/src/main/java/test/Ice/operations/lambda/OnewaysLambdaAMI.java (renamed from java/test/src/main/java/test/Ice/operations/lambda/OnewaysLambdaAMI.java)0
-rw-r--r--java-compat/test/src/main/java/test/Ice/operations/lambda/TwowaysLambdaAMI.java (renamed from java/test/src/main/java/test/Ice/operations/lambda/TwowaysLambdaAMI.java)0
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/operations/run.py39
-rw-r--r--java-compat/test/src/main/java/test/Ice/optional/AMDInitialI.java625
-rw-r--r--java-compat/test/src/main/java/test/Ice/optional/AMDServer.java41
-rw-r--r--java-compat/test/src/main/java/test/Ice/optional/AllTests.java2580
-rw-r--r--java-compat/test/src/main/java/test/Ice/optional/Client.java42
-rw-r--r--java-compat/test/src/main/java/test/Ice/optional/InitialI.java674
-rw-r--r--java-compat/test/src/main/java/test/Ice/optional/SerializableClass.java32
-rw-r--r--java-compat/test/src/main/java/test/Ice/optional/Server.java41
-rw-r--r--java-compat/test/src/main/java/test/Ice/optional/Test.ice339
-rw-r--r--java-compat/test/src/main/java/test/Ice/optional/TestAMD.ice342
-rw-r--r--java-compat/test/src/main/java/test/Ice/optional/lambda/AllTests.java (renamed from java/test/src/main/java/test/Ice/optional/lambda/AllTests.java)0
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/optional/run.py30
-rw-r--r--java-compat/test/src/main/java/test/Ice/packagemd/AllTests.java196
-rw-r--r--java-compat/test/src/main/java/test/Ice/packagemd/Client.java43
-rw-r--r--java-compat/test/src/main/java/test/Ice/packagemd/InitialI.java143
-rw-r--r--java-compat/test/src/main/java/test/Ice/packagemd/NoPackage.ice39
-rw-r--r--java-compat/test/src/main/java/test/Ice/packagemd/Package.ice57
-rw-r--r--java-compat/test/src/main/java/test/Ice/packagemd/Server.java44
-rw-r--r--java-compat/test/src/main/java/test/Ice/packagemd/Test.ice40
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/packagemd/run.py25
-rw-r--r--java-compat/test/src/main/java/test/Ice/plugin/Client.java219
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/plugin/run.py31
-rw-r--r--java-compat/test/src/main/java/test/Ice/properties/Client.java116
-rw-r--r--java-compat/test/src/main/java/test/Ice/properties/config/.gitignore1
-rw-r--r--java-compat/test/src/main/java/test/Ice/properties/config/config.11
-rw-r--r--java-compat/test/src/main/java/test/Ice/properties/config/config.21
-rw-r--r--java-compat/test/src/main/java/test/Ice/properties/config/config.31
-rw-r--r--java-compat/test/src/main/java/test/Ice/properties/config/escapes.cfg35
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/properties/run.py51
-rw-r--r--java-compat/test/src/main/java/test/Ice/proxy/AMDMyDerivedClassI.java57
-rw-r--r--java-compat/test/src/main/java/test/Ice/proxy/AMDServer.java43
-rw-r--r--java-compat/test/src/main/java/test/Ice/proxy/AllTests.java981
-rw-r--r--java-compat/test/src/main/java/test/Ice/proxy/Client.java41
-rw-r--r--java-compat/test/src/main/java/test/Ice/proxy/Collocated.java45
-rw-r--r--java-compat/test/src/main/java/test/Ice/proxy/MyDerivedClassI.java50
-rw-r--r--java-compat/test/src/main/java/test/Ice/proxy/Server.java42
-rw-r--r--java-compat/test/src/main/java/test/Ice/proxy/Test.ice30
-rw-r--r--java-compat/test/src/main/java/test/Ice/proxy/TestAMD.ice30
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/proxy/run.py28
-rw-r--r--java-compat/test/src/main/java/test/Ice/retry/AllTests.java297
-rw-r--r--java-compat/test/src/main/java/test/Ice/retry/Client.java73
-rw-r--r--java-compat/test/src/main/java/test/Ice/retry/Collocated.java85
-rw-r--r--java-compat/test/src/main/java/test/Ice/retry/Instrumentation.java205
-rw-r--r--java-compat/test/src/main/java/test/Ice/retry/RetryI.java80
-rw-r--r--java-compat/test/src/main/java/test/Ice/retry/Server.java42
-rw-r--r--java-compat/test/src/main/java/test/Ice/retry/SystemFailure.java20
-rw-r--r--java-compat/test/src/main/java/test/Ice/retry/Test.ice27
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/retry/run.py26
-rw-r--r--java-compat/test/src/main/java/test/Ice/seqMapping/AMDMyClassI.java44
-rw-r--r--java-compat/test/src/main/java/test/Ice/seqMapping/AMDServer.java43
-rw-r--r--java-compat/test/src/main/java/test/Ice/seqMapping/AllTests.java40
-rw-r--r--java-compat/test/src/main/java/test/Ice/seqMapping/Client.java49
-rw-r--r--java-compat/test/src/main/java/test/Ice/seqMapping/Collocated.java46
-rw-r--r--java-compat/test/src/main/java/test/Ice/seqMapping/MyClassI.java44
-rw-r--r--java-compat/test/src/main/java/test/Ice/seqMapping/Serialize/Large.java24
-rw-r--r--java-compat/test/src/main/java/test/Ice/seqMapping/Serialize/Small.java15
-rw-r--r--java-compat/test/src/main/java/test/Ice/seqMapping/Serialize/SmallHolder.java15
-rw-r--r--java-compat/test/src/main/java/test/Ice/seqMapping/Serialize/Struct.java18
-rw-r--r--java-compat/test/src/main/java/test/Ice/seqMapping/Serialize/StructHolder.java15
-rw-r--r--java-compat/test/src/main/java/test/Ice/seqMapping/Server.java43
-rw-r--r--java-compat/test/src/main/java/test/Ice/seqMapping/Test.ice54
-rw-r--r--java-compat/test/src/main/java/test/Ice/seqMapping/TestAMD.ice54
-rw-r--r--java-compat/test/src/main/java/test/Ice/seqMapping/Twoways.java137
-rw-r--r--java-compat/test/src/main/java/test/Ice/seqMapping/TwowaysAMI.java248
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/seqMapping/run.py28
-rw-r--r--java-compat/test/src/main/java/test/Ice/serialize/AllTests.java170
-rw-r--r--java-compat/test/src/main/java/test/Ice/serialize/Client.java42
-rw-r--r--java-compat/test/src/main/java/test/Ice/serialize/InitialI.java119
-rw-r--r--java-compat/test/src/main/java/test/Ice/serialize/Server.java45
-rw-r--r--java-compat/test/src/main/java/test/Ice/serialize/Test.ice84
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/serialize/run.py25
-rw-r--r--java-compat/test/src/main/java/test/Ice/servantLocator/AMDCookieI.java22
-rw-r--r--java-compat/test/src/main/java/test/Ice/servantLocator/AMDServantLocatorI.java184
-rw-r--r--java-compat/test/src/main/java/test/Ice/servantLocator/AMDServer.java46
-rw-r--r--java-compat/test/src/main/java/test/Ice/servantLocator/AMDTestActivationI.java32
-rw-r--r--java-compat/test/src/main/java/test/Ice/servantLocator/AMDTestI.java145
-rw-r--r--java-compat/test/src/main/java/test/Ice/servantLocator/AllTests.java375
-rw-r--r--java-compat/test/src/main/java/test/Ice/servantLocator/Client.java40
-rw-r--r--java-compat/test/src/main/java/test/Ice/servantLocator/Collocated.java46
-rw-r--r--java-compat/test/src/main/java/test/Ice/servantLocator/CookieI.java22
-rw-r--r--java-compat/test/src/main/java/test/Ice/servantLocator/ServantLocatorI.java184
-rw-r--r--java-compat/test/src/main/java/test/Ice/servantLocator/Server.java45
-rw-r--r--java-compat/test/src/main/java/test/Ice/servantLocator/Test.ice55
-rw-r--r--java-compat/test/src/main/java/test/Ice/servantLocator/TestAMD.ice55
-rw-r--r--java-compat/test/src/main/java/test/Ice/servantLocator/TestActivationI.java32
-rw-r--r--java-compat/test/src/main/java/test/Ice/servantLocator/TestI.java122
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/servantLocator/run.py28
-rw-r--r--java-compat/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java43
-rw-r--r--java-compat/test/src/main/java/test/Ice/slicing/exceptions/AMDTestI.java321
-rw-r--r--java-compat/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java1278
-rw-r--r--java-compat/test/src/main/java/test/Ice/slicing/exceptions/Client.java41
-rw-r--r--java-compat/test/src/main/java/test/Ice/slicing/exceptions/ClientPrivate.ice123
-rw-r--r--java-compat/test/src/main/java/test/Ice/slicing/exceptions/Server.java43
-rw-r--r--java-compat/test/src/main/java/test/Ice/slicing/exceptions/ServerPrivate.ice143
-rw-r--r--java-compat/test/src/main/java/test/Ice/slicing/exceptions/ServerPrivateAMD.ice143
-rw-r--r--java-compat/test/src/main/java/test/Ice/slicing/exceptions/TestI.java279
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/slicing/exceptions/run.py40
-rw-r--r--java-compat/test/src/main/java/test/Ice/slicing/objects/AMDServer.java43
-rw-r--r--java-compat/test/src/main/java/test/Ice/slicing/objects/AMDTestI.java571
-rw-r--r--java-compat/test/src/main/java/test/Ice/slicing/objects/AllTests.java3151
-rw-r--r--java-compat/test/src/main/java/test/Ice/slicing/objects/Client.java41
-rw-r--r--java-compat/test/src/main/java/test/Ice/slicing/objects/ClientPrivate.ice215
-rw-r--r--java-compat/test/src/main/java/test/Ice/slicing/objects/Server.java43
-rw-r--r--java-compat/test/src/main/java/test/Ice/slicing/objects/ServerPrivate.ice233
-rw-r--r--java-compat/test/src/main/java/test/Ice/slicing/objects/ServerPrivateAMD.ice228
-rw-r--r--java-compat/test/src/main/java/test/Ice/slicing/objects/TestI.java543
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/slicing/objects/run.py40
-rw-r--r--java-compat/test/src/main/java/test/Ice/stream/Client.java861
-rw-r--r--java-compat/test/src/main/java/test/Ice/stream/Serialize/Small.java15
-rw-r--r--java-compat/test/src/main/java/test/Ice/stream/Test.ice123
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/stream/run.py28
-rw-r--r--java-compat/test/src/main/java/test/Ice/threadPoolPriority/Client.java50
-rw-r--r--java-compat/test/src/main/java/test/Ice/threadPoolPriority/PriorityI.java20
-rw-r--r--java-compat/test/src/main/java/test/Ice/threadPoolPriority/Server.java42
-rw-r--r--java-compat/test/src/main/java/test/Ice/threadPoolPriority/Test.ice22
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/threadPoolPriority/run.py25
-rw-r--r--java-compat/test/src/main/java/test/Ice/throughput/Client.java493
-rw-r--r--java-compat/test/src/main/java/test/Ice/throughput/Server.java41
-rw-r--r--java-compat/test/src/main/java/test/Ice/throughput/Throughput.ice66
-rw-r--r--java-compat/test/src/main/java/test/Ice/throughput/ThroughputI.java201
-rw-r--r--java-compat/test/src/main/java/test/Ice/timeout/AllTests.java541
-rw-r--r--java-compat/test/src/main/java/test/Ice/timeout/Client.java63
-rw-r--r--java-compat/test/src/main/java/test/Ice/timeout/Server.java51
-rw-r--r--java-compat/test/src/main/java/test/Ice/timeout/Test.ice29
-rw-r--r--java-compat/test/src/main/java/test/Ice/timeout/TimeoutI.java84
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/timeout/run.py25
-rw-r--r--java-compat/test/src/main/java/test/Ice/udp/AllTests.java249
-rw-r--r--java-compat/test/src/main/java/test/Ice/udp/Client.java57
-rw-r--r--java-compat/test/src/main/java/test/Ice/udp/Server.java91
-rw-r--r--java-compat/test/src/main/java/test/Ice/udp/Test.ice32
-rw-r--r--java-compat/test/src/main/java/test/Ice/udp/TestIntfI.java74
-rwxr-xr-xjava-compat/test/src/main/java/test/Ice/udp/run.py43
-rw-r--r--java-compat/test/src/main/java/test/IceBox/admin/AllTests.java128
-rw-r--r--java-compat/test/src/main/java/test/IceBox/admin/Client.java44
-rw-r--r--java-compat/test/src/main/java/test/IceBox/admin/Test.ice26
-rw-r--r--java-compat/test/src/main/java/test/IceBox/admin/TestFacetI.java57
-rw-r--r--java-compat/test/src/main/java/test/IceBox/admin/TestServiceI.java46
-rw-r--r--java-compat/test/src/main/java/test/IceBox/admin/config.admin4
-rw-r--r--java-compat/test/src/main/java/test/IceBox/admin/config.icebox5
-rw-r--r--java-compat/test/src/main/java/test/IceBox/admin/config.service3
-rwxr-xr-xjava-compat/test/src/main/java/test/IceBox/admin/run.py44
-rw-r--r--java-compat/test/src/main/java/test/IceBox/configuration/AllTests.java101
-rw-r--r--java-compat/test/src/main/java/test/IceBox/configuration/Client.java46
-rw-r--r--java-compat/test/src/main/java/test/IceBox/configuration/Test.ice25
-rw-r--r--java-compat/test/src/main/java/test/IceBox/configuration/TestI.java38
-rw-r--r--java-compat/test/src/main/java/test/IceBox/configuration/TestServiceI.java30
-rw-r--r--java-compat/test/src/main/java/test/IceBox/configuration/config.icebox13
-rw-r--r--java-compat/test/src/main/java/test/IceBox/configuration/config.icebox216
-rw-r--r--java-compat/test/src/main/java/test/IceBox/configuration/config.service19
-rw-r--r--java-compat/test/src/main/java/test/IceBox/configuration/config.service1-211
-rw-r--r--java-compat/test/src/main/java/test/IceBox/configuration/config.service24
-rw-r--r--java-compat/test/src/main/java/test/IceBox/configuration/config.service2-29
-rw-r--r--java-compat/test/src/main/java/test/IceBox/configuration/config.service38
-rw-r--r--java-compat/test/src/main/java/test/IceBox/configuration/config.service46
-rwxr-xr-xjava-compat/test/src/main/java/test/IceBox/configuration/run.py27
-rw-r--r--java-compat/test/src/main/java/test/IceDiscovery/simple/AllTests.java220
-rw-r--r--java-compat/test/src/main/java/test/IceDiscovery/simple/Client.java38
-rw-r--r--java-compat/test/src/main/java/test/IceDiscovery/simple/ControllerI.java66
-rw-r--r--java-compat/test/src/main/java/test/IceDiscovery/simple/Server.java46
-rw-r--r--java-compat/test/src/main/java/test/IceDiscovery/simple/Test.ice33
-rw-r--r--java-compat/test/src/main/java/test/IceDiscovery/simple/TestIntfI.java22
-rwxr-xr-xjava-compat/test/src/main/java/test/IceDiscovery/simple/run.py52
-rw-r--r--java-compat/test/src/main/java/test/IceGrid/simple/.gitignore4
-rw-r--r--java-compat/test/src/main/java/test/IceGrid/simple/AllTests.java364
-rw-r--r--java-compat/test/src/main/java/test/IceGrid/simple/Client.java57
-rw-r--r--java-compat/test/src/main/java/test/IceGrid/simple/Server.java62
-rw-r--r--java-compat/test/src/main/java/test/IceGrid/simple/Test.ice21
-rw-r--r--java-compat/test/src/main/java/test/IceGrid/simple/TestI.java27
-rw-r--r--java-compat/test/src/main/java/test/IceGrid/simple/db/.gitignore1
-rwxr-xr-xjava-compat/test/src/main/java/test/IceGrid/simple/run.py35
-rw-r--r--java-compat/test/src/main/java/test/IceGrid/simple/simple_server.xml22
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/certs/README.md9
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/certs/c_dsa_ca1.jksbin0 -> 1804 bytes
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/certs/c_rsa_ca1.jksbin0 -> 2573 bytes
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/certs/c_rsa_ca1_exp.jksbin0 -> 2554 bytes
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/certs/c_rsa_ca2.jksbin0 -> 2581 bytes
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/certs/c_rsa_cai2.jksbin0 -> 5025 bytes
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/certs/cacert1.jksbin0 -> 1073 bytes
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/certs/cacert2.jksbin0 -> 1074 bytes
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/certs/cacerts.jksbin0 -> 2125 bytes
-rwxr-xr-xjava-compat/test/src/main/java/test/IceSSL/certs/makecerts.py113
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/certs/s_cacert2.jksbin0 -> 2364 bytes
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/certs/s_dsa_ca1.jksbin0 -> 1804 bytes
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_ca1.jksbin0 -> 2573 bytes
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_ca1_cn1.jksbin0 -> 2560 bytes
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_ca1_cn2.jksbin0 -> 2558 bytes
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_ca1_exp.jksbin0 -> 2555 bytes
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_ca2.jksbin0 -> 2583 bytes
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_cai1.jksbin0 -> 3798 bytes
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_cai2.jksbin0 -> 5026 bytes
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_dsa_ca1.jksbin0 -> 4351 bytes
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_wroot_ca1.jksbin0 -> 3598 bytes
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/certs/seed.datbin0 -> 1024 bytes
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/configuration/AllTests.java2272
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/configuration/CertificateVerifierI.java99
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/configuration/Client.java51
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/configuration/PasswordCallbackI.java48
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/configuration/Server.java46
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/configuration/ServerFactoryI.java70
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/configuration/ServerI.java85
-rw-r--r--java-compat/test/src/main/java/test/IceSSL/configuration/Test.ice32
-rwxr-xr-xjava-compat/test/src/main/java/test/IceSSL/configuration/run.py26
-rw-r--r--java-compat/test/src/main/java/test/IceUtil/inputUtil/Client.java169
-rwxr-xr-xjava-compat/test/src/main/java/test/IceUtil/inputUtil/run.py29
-rw-r--r--java-compat/test/src/main/java/test/Slice/generation/.gitignore1
-rw-r--r--java-compat/test/src/main/java/test/Slice/generation/File1.ice21
-rw-r--r--java-compat/test/src/main/java/test/Slice/generation/File2.ice21
-rw-r--r--java-compat/test/src/main/java/test/Slice/generation/list-generated.out29
-rwxr-xr-xjava-compat/test/src/main/java/test/Slice/generation/run.py56
-rw-r--r--java-compat/test/src/main/java/test/Slice/keyword/Client.java229
-rw-r--r--java-compat/test/src/main/java/test/Slice/keyword/Key.ice79
-rwxr-xr-xjava-compat/test/src/main/java/test/Slice/keyword/run.py29
-rw-r--r--java-compat/test/src/main/java/test/Slice/macros/Client.java54
-rw-r--r--java-compat/test/src/main/java/test/Slice/macros/Test.ice58
-rwxr-xr-xjava-compat/test/src/main/java/test/Slice/macros/run.py29
-rw-r--r--java-compat/test/src/main/java/test/Slice/structure/Client.java315
-rw-r--r--java-compat/test/src/main/java/test/Slice/structure/Test.ice48
-rwxr-xr-xjava-compat/test/src/main/java/test/Slice/structure/run.py29
-rw-r--r--java-compat/test/src/main/java/test/Util/Application.java284
-rw-r--r--java/build.gradle3
-rw-r--r--java/gradle.properties1
-rw-r--r--java/gradle/wrapper/gradle-wrapper.jarbin53324 -> 53319 bytes
-rw-r--r--java/gradle/wrapper/gradle-wrapper.properties2
-rw-r--r--java/settings.gradle4
-rw-r--r--java/src/Glacier2/build.gradle17
-rw-r--r--java/src/Glacier2/src/main/java/com/zeroc/Glacier2/Application.java500
-rw-r--r--java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionCallback.java48
-rw-r--r--java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionFactoryHelper.java381
-rw-r--r--java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionHelper.java607
-rw-r--r--java/src/Ice/build.gradle6
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/Application.java699
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/AsyncResult.java105
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/BatchRequest.java33
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/BatchRequestInterceptor.java28
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/Blobject.java48
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/BlobjectAsync.java66
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/ClassResolver.java29
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/CommunicatorI.java333
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/CompactIdResolver.java29
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/ConnectionI.java3002
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/DispatchInterceptor.java43
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/Dispatcher.java34
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/Exception.java91
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/FormatType.java29
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/ImplicitContextI.java318
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/InitializationData.java96
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/InputStream.java3436
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/InvocationFuture.java131
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/LocalException.java25
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/LoggerI.java163
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/LoggerPlugin.java70
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/MarshaledResult.java12
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/NativePropertiesAdmin.java16
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/Object.java320
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/ObjectAdapterI.java1559
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/ObjectInputStream.java43
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/ObjectPrx.java1252
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/OptionalFormat.java70
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/OutputStream.java2434
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/PluginFactory.java27
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/PluginManagerI.java549
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/PropertiesAdminUpdateCallback.java16
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/PropertiesI.java764
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/ProxyIdentityFacetKey.java97
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/ProxyIdentityKey.java89
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/ReadValueCallback.java28
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/Request.java23
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/SignalPolicy.java31
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/SliceInfo.java46
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/SlicedData.java26
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/SysLoggerI.java244
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/SystemException.java25
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/ThreadHookPlugin.java64
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/ThreadNotification.java34
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/UnknownSlicedValue.java53
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/UserException.java108
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/UserExceptionFactory.java26
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/Util.java665
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/Value.java90
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/ValueFactoryManagerI.java30
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/ValueReader.java35
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/ValueWriter.java35
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxFactoryMethods.java144
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxI.java690
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ACMConfig.java85
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ACMMonitor.java21
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/Acceptor.java23
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/AsyncStatus.java17
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/BZip2.java281
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/BatchRequestQueue.java239
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/BufSizeWarnInfo.java25
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/Buffer.java223
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/CancellationHandler.java15
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/CollocatedObserverI.java34
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/CollocatedRequestHandler.java437
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/CommunicatorFlushBatch.java206
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/CommunicatorObserverI.java843
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectRequestHandler.java383
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionACMMonitor.java127
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionFlushBatch.java106
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionObserverI.java61
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionRequestHandler.java82
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/Connector.java25
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/DefaultsAndOverrides.java243
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/DictionaryPatcher.java38
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/DispatchObserverI.java53
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/DispatchWorkItem.java44
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointFactory.java21
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointFactoryManager.java184
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointHostResolver.java204
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointI.java197
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointIHolder.java15
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointI_connectors.java16
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/EventHandler.java44
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/EventHandlerOpPair.java22
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/Ex.java49
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/FactoryACMMonitor.java233
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/FixedReference.java320
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/HTTPNetworkProxy.java135
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/HashUtil.java120
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/Holder.java24
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/HttpParser.java732
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/IPEndpointI.java380
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/Incoming.java896
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/IncomingConnectionFactory.java660
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/InputStreamWrapper.java96
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/Instance.java1917
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/InvocationFutureI.java526
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/InvocationObserverI.java250
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ListPatcher.java43
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/LocatorInfo.java706
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/LocatorManager.java138
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/LocatorTable.java130
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/LoggerAdminI.java472
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/LoggerAdminLogger.java16
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/LoggerAdminLoggerI.java255
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsAdminI.java397
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsMap.java518
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsViewI.java126
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/Network.java1358
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/NetworkProxy.java60
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ObjectAdapterFactory.java271
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ObjectInputStream.java52
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ObserverHelper.java65
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/OpaqueEndpointI.java422
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingAsync.java375
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingAsyncBase.java108
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingConnectionFactory.java1153
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/OutputStreamWrapper.java178
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/Patcher.java52
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ProcessI.java44
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertiesAdminI.java210
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/Property.java42
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java1254
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/Protocol.java201
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ProtocolInstance.java142
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ProtocolPluginFacade.java34
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ProtocolPluginFacadeI.java59
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyFactory.java302
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyFlushBatch.java114
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyGetConnection.java106
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyIceInvoke.java218
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyOutgoingAsyncBase.java533
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/QueueExecutorService.java118
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/QueueRequestHandler.java96
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ReadyCallback.java15
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/Reference.java547
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ReferenceFactory.java920
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/RemoteObserverI.java33
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ReplyStatus.java22
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/RequestHandler.java22
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/RequestHandlerFactory.java96
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ResponseHandler.java18
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/RetryException.java27
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/RetryQueue.java84
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/RetryTask.java80
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/RoutableReference.java974
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/RouterInfo.java285
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/RouterManager.java77
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/SOCKSNetworkProxy.java128
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/Selector.java408
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/SequencePatcher.java39
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ServantError.java28
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ServantManager.java325
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/SocketOperation.java20
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/StreamSocket.java329
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpAcceptor.java150
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpConnector.java101
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpEndpointFactory.java58
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpEndpointI.java318
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpTransceiver.java126
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadObserverI.java69
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPool.java823
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPoolCurrent.java51
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPoolWorkItem.java15
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPoolWorkQueue.java116
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/Time.java19
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/TraceLevels.java45
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/TraceUtil.java515
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/Transceiver.java32
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpConnector.java113
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpEndpointFactory.java58
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpEndpointI.java395
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpTransceiver.java653
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/Util.java301
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ValueFactoryManagerI.java35
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/ValueWriter.java191
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/WSAcceptor.java82
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/WSConnector.java77
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/WSEndpoint.java326
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/WSEndpointFactory.java59
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/WSTransceiver.java1616
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceInternal/WebSocketException.java28
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceMX/MetricsHelper.java188
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceMX/Observer.java137
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverFactory.java142
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverFactoryWithDelegate.java48
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverWithDelegate.java75
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverWithDelegateI.java14
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceSSL/AcceptorI.java85
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceSSL/CertificateVerifier.java26
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceSSL/ConnectorI.java80
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceSSL/EndpointFactoryI.java62
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceSSL/EndpointI.java262
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceSSL/Instance.java62
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceSSL/NativeConnectionInfo.java28
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceSSL/PasswordCallback.java45
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceSSL/Plugin.java94
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceSSL/PluginFactory.java34
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceSSL/PluginI.java109
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceSSL/RFC2253.java434
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceSSL/SSLEngine.java1320
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceSSL/TransceiverI.java591
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceSSL/TrustManager.java363
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceSSL/Util.java72
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceSSL/X509KeyManagerI.java114
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceSSL/X509TrustManagerI.java82
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/Assert.java45
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/Options.java403
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/OutputBase.java188
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/StopWatch.java42
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/StringUtil.java554
-rw-r--r--java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/XMLOutput.java275
-rw-r--r--java/src/IceBox/build.gradle8
-rw-r--r--java/src/IceBox/src/main/java/com/zeroc/IceBox/Admin.java183
-rw-r--r--java/src/IceBox/src/main/java/com/zeroc/IceBox/Server.java76
-rw-r--r--java/src/IceBox/src/main/java/com/zeroc/IceBox/ServiceManagerI.java1177
-rw-r--r--java/src/IceDiscovery/build.gradle6
-rw-r--r--java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LocatorI.java49
-rw-r--r--java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LocatorRegistryI.java186
-rw-r--r--java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LookupI.java378
-rw-r--r--java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LookupReplyI.java33
-rw-r--r--java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/PluginFactory.java19
-rw-r--r--java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/PluginI.java135
-rw-r--r--java/src/IceGrid/build.gradle8
-rw-r--r--java/src/IceGridGUI/build.gradle26
-rw-r--r--java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/MetricsView.java376
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/AdapterObserverI.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/AdapterObserverI.java)14
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/AdminRouter.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/AdminRouter.java)14
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/AbstractServerEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/AbstractServerEditor.java)4
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Adapter.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Adapter.java)10
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/AdapterEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/AdapterEditor.java)24
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ApplicationEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ApplicationEditor.java)6
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ArrayMapField.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ArrayMapField.java)14
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Communicator.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Communicator.java)18
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/CommunicatorChildEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/CommunicatorChildEditor.java)2
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/CommunicatorSubEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/CommunicatorSubEditor.java)8
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/DbEnv.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/DbEnv.java)12
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/DbEnvEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/DbEnvEditor.java)6
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/DescriptorHolder.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/DescriptorHolder.java)2
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Editable.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Editable.java)12
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Editor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Editor.java)6
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ListTextField.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ListTextField.java)11
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ListTreeNode.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ListTreeNode.java)6
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Node.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Node.java)56
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/NodeEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/NodeEditor.java)8
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Nodes.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Nodes.java)22
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ParameterValuesField.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ParameterValuesField.java)13
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ParametersField.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ParametersField.java)13
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PlainServer.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PlainServer.java)8
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PlainServerEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PlainServerEditor.java)4
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PlainService.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PlainService.java)6
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PlainServiceEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PlainServiceEditor.java)6
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertiesField.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertiesField.java)29
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertySet.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertySet.java)8
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertySetEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertySetEditor.java)6
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertySetParent.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertySetParent.java)4
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertySets.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertySets.java)12
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ReplicaGroup.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ReplicaGroup.java)6
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ReplicaGroupEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ReplicaGroupEditor.java)16
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ReplicaGroups.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ReplicaGroups.java)12
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Root.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Root.java)388
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Server.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Server.java)2
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerInstance.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerInstance.java)8
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerInstanceEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerInstanceEditor.java)6
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerInstancePropertySetEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerInstancePropertySetEditor.java)4
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerSubEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerSubEditor.java)10
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerTemplate.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerTemplate.java)6
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerTemplateEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerTemplateEditor.java)2
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerTemplates.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerTemplates.java)16
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Service.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Service.java)2
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceInstance.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceInstance.java)10
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceInstanceEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceInstanceEditor.java)6
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceSubEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceSubEditor.java)6
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceTemplate.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceTemplate.java)6
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceTemplateEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceTemplateEditor.java)2
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceTemplates.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceTemplates.java)14
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/SimpleMapField.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/SimpleMapField.java)14
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/TemplateEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/TemplateEditor.java)8
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/TemplateInstance.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/TemplateInstance.java)2
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Templates.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Templates.java)8
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/TreeNode.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/TreeNode.java)30
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/UpdateFailedException.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Application/UpdateFailedException.java)2
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ApplicationActions.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/ApplicationActions.java)4
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ApplicationObserverI.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/ApplicationObserverI.java)16
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ApplicationPane.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/ApplicationPane.java)12
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/CellRenderer.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/CellRenderer.java)2
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Coordinator.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Coordinator.java)830
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/EditorBase.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/EditorBase.java)2
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Fallback.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Fallback.java)6
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveActions.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveActions.java)4
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Adapter.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Adapter.java)10
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/AdapterEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/AdapterEditor.java)6
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ApplicationDetailsDialog.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ApplicationDetailsDialog.java)4
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/CommunicatorEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/CommunicatorEditor.java)6
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/DbEnv.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/DbEnv.java)6
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/DbEnvEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/DbEnvEditor.java)6
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Editor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Editor.java)4
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/GraphView.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/GraphView.java)720
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ListArrayTreeNode.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ListArrayTreeNode.java)2
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ListTreeNode.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ListTreeNode.java)2
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/LogFilterDialog.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/LogFilterDialog.java)38
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/LogPrefsDialog.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/LogPrefsDialog.java)8
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/MetricsFieldContext.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/MetricsFieldContext.java)2
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/MetricsView.java280
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/MetricsViewEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/MetricsViewEditor.java)273
-rwxr-xr-xjava/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Node.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Node.java)266
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/NodeEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/NodeEditor.java)4
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ObjectDialog.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ObjectDialog.java)2
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/RegistryEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/RegistryEditor.java)6
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Root.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Root.java)331
-rwxr-xr-xjava/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Server.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Server.java)416
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ServerEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ServerEditor.java)24
-rwxr-xr-xjava/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Service.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Service.java)266
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ServiceEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ServiceEditor.java)6
-rwxr-xr-xjava/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ShowIceLogDialog.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ShowIceLogDialog.java)338
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ShowLogFileDialog.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ShowLogFileDialog.java)129
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Slave.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Slave.java)41
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/SlaveEditor.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/SlaveEditor.java)4
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/TableField.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/TableField.java)32
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/TreeNode.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/TreeNode.java)86
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/WriteMessageDialog.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/WriteMessageDialog.java)79
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeploymentPane.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeploymentPane.java)12
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Logger.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Logger.java)30
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Main.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Main.java)16
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/MainPane.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/MainPane.java)16
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/MainProxy.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/MainProxy.java)43
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/NodeObserverI.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/NodeObserverI.java)62
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ObjectObserverI.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/ObjectObserverI.java)52
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/RegistryObserverI.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/RegistryObserverI.java)40
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/SessionKeeper.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/SessionKeeper.java)737
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/SimpleInternalFrame.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/SimpleInternalFrame.java)2
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/StatusBar.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/StatusBar.java)2
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Tab.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Tab.java)2
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/TreeNodeBase.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/TreeNodeBase.java)6
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Utils.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/Utils.java)86
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/XMLWriter.java (renamed from java/src/IceGridGUI/src/main/java/IceGridGUI/XMLWriter.java)5
-rw-r--r--java/src/IceLocatorDiscovery/build.gradle6
-rw-r--r--java/src/IceLocatorDiscovery/src/main/java/com/zeroc/IceLocatorDiscovery/PluginFactory.java19
-rw-r--r--java/src/IceLocatorDiscovery/src/main/java/com/zeroc/IceLocatorDiscovery/PluginI.java447
-rw-r--r--java/src/IcePatch2/build.gradle8
-rw-r--r--java/src/IceStorm/build.gradle17
-rw-r--r--java/test/build.gradle5
-rw-r--r--java/test/controller/build.gradle6
-rw-r--r--java/test/controller/src/main/java/Test/Common/ControllerServer.java45
-rw-r--r--java/test/ejb/src/common/com/zeroc/ice/IceAdapter.java19
-rw-r--r--java/test/ejb/src/ejb1/com/zeroc/ejb/Client.java16
-rw-r--r--java/test/ejb/src/ejb1/com/zeroc/ejb/DatabaseI.java10
-rw-r--r--java/test/ejb/src/ejb1/com/zeroc/ejb/DatabaseServer.java17
-rw-r--r--java/test/ejb/src/ejb1/com/zeroc/ejb/InitBean.java10
-rw-r--r--java/test/ejb/src/ejb1/com/zeroc/ejb/ServiceBean.java13
-rw-r--r--java/test/ejb/src/ejb1/com/zeroc/ejb/ServiceI.java9
-rw-r--r--java/test/ejb/src/ejb2/com/zeroc/ejb/Client.java16
-rw-r--r--java/test/ejb/src/ejb2/com/zeroc/ejb/DatabaseI.java10
-rw-r--r--java/test/ejb/src/ejb2/com/zeroc/ejb/DatabaseServer.java17
-rw-r--r--java/test/ejb/src/ejb2/com/zeroc/ejb/InitBean.java10
-rw-r--r--java/test/ejb/src/ejb2/com/zeroc/ejb/ServiceBean.java57
-rw-r--r--java/test/ejb/src/ejb2/com/zeroc/ejb/ServiceI.java9
-rw-r--r--java/test/plugins/build.gradle1
-rw-r--r--java/test/plugins/src/main/java/test/Ice/plugin/plugins/BasePlugin.java6
-rw-r--r--java/test/plugins/src/main/java/test/Ice/plugin/plugins/BasePluginFail.java6
-rw-r--r--java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginFactory.java6
-rw-r--r--java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginInitializeFailFactory.java6
-rw-r--r--java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginOneFactory.java6
-rw-r--r--java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginOneFailFactory.java6
-rw-r--r--java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginThreeFactory.java6
-rw-r--r--java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginThreeFailFactory.java6
-rw-r--r--java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginTwoFactory.java6
-rw-r--r--java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginTwoFailFactory.java6
-rw-r--r--java/test/slice.gradle15
-rw-r--r--java/test/src/main/java/test/Glacier2/router/CallbackI.java13
-rw-r--r--java/test/src/main/java/test/Glacier2/router/CallbackReceiverI.java13
-rw-r--r--java/test/src/main/java/test/Glacier2/router/Client.java160
-rw-r--r--java/test/src/main/java/test/Glacier2/router/Server.java32
-rw-r--r--java/test/src/main/java/test/Glacier2/sessionHelper/CallbackI.java13
-rw-r--r--java/test/src/main/java/test/Glacier2/sessionHelper/Client.java129
-rw-r--r--java/test/src/main/java/test/Glacier2/sessionHelper/Server.java22
-rw-r--r--java/test/src/main/java/test/Ice/acm/AllTests.java81
-rw-r--r--java/test/src/main/java/test/Ice/acm/Client.java11
-rw-r--r--java/test/src/main/java/test/Ice/acm/RemoteCommunicatorI.java24
-rw-r--r--java/test/src/main/java/test/Ice/acm/RemoteObjectAdapterI.java24
-rw-r--r--java/test/src/main/java/test/Ice/acm/Server.java27
-rw-r--r--java/test/src/main/java/test/Ice/acm/TestI.java45
-rw-r--r--java/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java27
-rw-r--r--java/test/src/main/java/test/Ice/adapterDeactivation/Client.java16
-rw-r--r--java/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java23
-rw-r--r--java/test/src/main/java/test/Ice/adapterDeactivation/CookieI.java3
-rw-r--r--java/test/src/main/java/test/Ice/adapterDeactivation/ServantLocatorI.java25
-rw-r--r--java/test/src/main/java/test/Ice/adapterDeactivation/Server.java21
-rw-r--r--java/test/src/main/java/test/Ice/adapterDeactivation/TestI.java12
-rw-r--r--java/test/src/main/java/test/Ice/admin/AllTests.java392
-rw-r--r--java/test/src/main/java/test/Ice/admin/RemoteCommunicatorFactoryI.java29
-rw-r--r--java/test/src/main/java/test/Ice/admin/RemoteCommunicatorI.java24
-rw-r--r--java/test/src/main/java/test/Ice/admin/RemoteLoggerI.java27
-rw-r--r--java/test/src/main/java/test/Ice/admin/Server.java19
-rw-r--r--java/test/src/main/java/test/Ice/admin/TestFacetI.java4
-rw-r--r--java/test/src/main/java/test/Ice/ami/AMI.java2466
-rw-r--r--java/test/src/main/java/test/Ice/ami/AllTests.java53
-rw-r--r--java/test/src/main/java/test/Ice/ami/Client.java13
-rw-r--r--java/test/src/main/java/test/Ice/ami/Collocated.java25
-rw-r--r--java/test/src/main/java/test/Ice/ami/Server.java31
-rw-r--r--java/test/src/main/java/test/Ice/ami/TestControllerI.java16
-rw-r--r--java/test/src/main/java/test/Ice/ami/TestI.java44
-rw-r--r--java/test/src/main/java/test/Ice/background/Acceptor.java32
-rw-r--r--java/test/src/main/java/test/Ice/background/AllTests.java595
-rw-r--r--java/test/src/main/java/test/Ice/background/BackgroundControllerI.java54
-rw-r--r--java/test/src/main/java/test/Ice/background/BackgroundI.java14
-rw-r--r--java/test/src/main/java/test/Ice/background/Client.java38
-rw-r--r--java/test/src/main/java/test/Ice/background/Collocated.java7
-rw-r--r--java/test/src/main/java/test/Ice/background/Configuration.java74
-rw-r--r--java/test/src/main/java/test/Ice/background/Connector.java22
-rw-r--r--java/test/src/main/java/test/Ice/background/EndpointFactory.java28
-rw-r--r--java/test/src/main/java/test/Ice/background/EndpointI.java111
-rw-r--r--java/test/src/main/java/test/Ice/background/PluginFactory.java30
-rw-r--r--java/test/src/main/java/test/Ice/background/Server.java106
-rw-r--r--java/test/src/main/java/test/Ice/background/Transceiver.java81
-rw-r--r--java/test/src/main/java/test/Ice/binding/AllTests.java389
-rw-r--r--java/test/src/main/java/test/Ice/binding/Client.java9
-rw-r--r--java/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java23
-rw-r--r--java/test/src/main/java/test/Ice/binding/RemoteObjectAdapterI.java24
-rw-r--r--java/test/src/main/java/test/Ice/binding/Server.java23
-rw-r--r--java/test/src/main/java/test/Ice/binding/TestI.java8
-rw-r--r--java/test/src/main/java/test/Ice/checksum/AllTests.java10
-rw-r--r--java/test/src/main/java/test/Ice/checksum/ChecksumI.java11
-rw-r--r--java/test/src/main/java/test/Ice/checksum/Client.java18
-rw-r--r--java/test/src/main/java/test/Ice/checksum/Server.java23
-rw-r--r--java/test/src/main/java/test/Ice/classLoader/AbstractClassI.java5
-rw-r--r--java/test/src/main/java/test/Ice/classLoader/AllTests.java40
-rw-r--r--java/test/src/main/java/test/Ice/classLoader/CertificateVerifierI.java4
-rw-r--r--java/test/src/main/java/test/Ice/classLoader/Client.java10
-rw-r--r--java/test/src/main/java/test/Ice/classLoader/InitialI.java21
-rw-r--r--java/test/src/main/java/test/Ice/classLoader/PasswordCallbackI.java2
-rw-r--r--java/test/src/main/java/test/Ice/classLoader/PluginFactoryI.java6
-rw-r--r--java/test/src/main/java/test/Ice/classLoader/Server.java21
-rw-r--r--java/test/src/main/java/test/Ice/custom/AllTests.java248
-rw-r--r--java/test/src/main/java/test/Ice/custom/Client.java13
-rw-r--r--java/test/src/main/java/test/Ice/custom/Collocated.java21
-rw-r--r--java/test/src/main/java/test/Ice/custom/Server.java21
-rw-r--r--java/test/src/main/java/test/Ice/custom/TestI.java178
-rw-r--r--java/test/src/main/java/test/Ice/defaultServant/AllTests.java44
-rw-r--r--java/test/src/main/java/test/Ice/defaultServant/MyObjectI.java17
-rw-r--r--java/test/src/main/java/test/Ice/defaultValue/AllTests.java6
-rw-r--r--java/test/src/main/java/test/Ice/dispatcher/AllTests.java216
-rw-r--r--java/test/src/main/java/test/Ice/dispatcher/Client.java13
-rw-r--r--java/test/src/main/java/test/Ice/dispatcher/Collocated.java25
-rw-r--r--java/test/src/main/java/test/Ice/dispatcher/Dispatcher.java33
-rw-r--r--java/test/src/main/java/test/Ice/dispatcher/Server.java33
-rw-r--r--java/test/src/main/java/test/Ice/dispatcher/TestControllerI.java15
-rw-r--r--java/test/src/main/java/test/Ice/dispatcher/TestI.java18
-rw-r--r--java/test/src/main/java/test/Ice/echo/BlobjectI.java89
-rw-r--r--java/test/src/main/java/test/Ice/echo/Server.java23
-rw-r--r--java/test/src/main/java/test/Ice/enums/AllTests.java144
-rw-r--r--java/test/src/main/java/test/Ice/enums/Client.java11
-rw-r--r--java/test/src/main/java/test/Ice/enums/Server.java19
-rw-r--r--java/test/src/main/java/test/Ice/enums/TestIntfI.java53
-rw-r--r--java/test/src/main/java/test/Ice/exceptions/AMDServer.java44
-rw-r--r--java/test/src/main/java/test/Ice/exceptions/AMDThrowerI.java153
-rw-r--r--java/test/src/main/java/test/Ice/exceptions/AllTests.java1042
-rw-r--r--java/test/src/main/java/test/Ice/exceptions/Client.java15
-rw-r--r--java/test/src/main/java/test/Ice/exceptions/Collocated.java33
-rw-r--r--java/test/src/main/java/test/Ice/exceptions/DummyLogger.java27
-rw-r--r--java/test/src/main/java/test/Ice/exceptions/EmptyI.java5
-rw-r--r--java/test/src/main/java/test/Ice/exceptions/ServantLocatorI.java9
-rw-r--r--java/test/src/main/java/test/Ice/exceptions/Server.java43
-rw-r--r--java/test/src/main/java/test/Ice/exceptions/ThrowerI.java76
-rw-r--r--java/test/src/main/java/test/Ice/exceptions/ValueFactoryI.java5
-rw-r--r--java/test/src/main/java/test/Ice/facets/AI.java10
-rw-r--r--java/test/src/main/java/test/Ice/facets/AllTests.java101
-rw-r--r--java/test/src/main/java/test/Ice/facets/BI.java13
-rw-r--r--java/test/src/main/java/test/Ice/facets/CI.java13
-rw-r--r--java/test/src/main/java/test/Ice/facets/Client.java11
-rw-r--r--java/test/src/main/java/test/Ice/facets/Collocated.java27
-rw-r--r--java/test/src/main/java/test/Ice/facets/DI.java19
-rw-r--r--java/test/src/main/java/test/Ice/facets/EI.java10
-rw-r--r--java/test/src/main/java/test/Ice/facets/EmptyI.java4
-rw-r--r--java/test/src/main/java/test/Ice/facets/FI.java13
-rw-r--r--java/test/src/main/java/test/Ice/facets/GI.java15
-rw-r--r--java/test/src/main/java/test/Ice/facets/HI.java18
-rw-r--r--java/test/src/main/java/test/Ice/facets/Server.java29
-rw-r--r--java/test/src/main/java/test/Ice/faultTolerance/AllTests.java155
-rw-r--r--java/test/src/main/java/test/Ice/faultTolerance/Client.java25
-rw-r--r--java/test/src/main/java/test/Ice/faultTolerance/Server.java22
-rw-r--r--java/test/src/main/java/test/Ice/faultTolerance/TestI.java19
-rw-r--r--java/test/src/main/java/test/Ice/hash/Client.java174
-rw-r--r--java/test/src/main/java/test/Ice/hold/AllTests.java98
-rw-r--r--java/test/src/main/java/test/Ice/hold/Client.java9
-rw-r--r--java/test/src/main/java/test/Ice/hold/HoldI.java30
-rw-r--r--java/test/src/main/java/test/Ice/hold/Server.java41
-rw-r--r--java/test/src/main/java/test/Ice/info/AllTests.java108
-rw-r--r--java/test/src/main/java/test/Ice/info/Client.java9
-rw-r--r--java/test/src/main/java/test/Ice/info/Server.java17
-rw-r--r--java/test/src/main/java/test/Ice/info/TestI.java49
-rw-r--r--java/test/src/main/java/test/Ice/inheritance/AllTests.java11
-rw-r--r--java/test/src/main/java/test/Ice/inheritance/CAI.java10
-rw-r--r--java/test/src/main/java/test/Ice/inheritance/CBI.java13
-rw-r--r--java/test/src/main/java/test/Ice/inheritance/CCI.java16
-rw-r--r--java/test/src/main/java/test/Ice/inheritance/CDI.java28
-rw-r--r--java/test/src/main/java/test/Ice/inheritance/Client.java11
-rw-r--r--java/test/src/main/java/test/Ice/inheritance/Collocated.java19
-rw-r--r--java/test/src/main/java/test/Ice/inheritance/IAI.java10
-rw-r--r--java/test/src/main/java/test/Ice/inheritance/IB1I.java13
-rw-r--r--java/test/src/main/java/test/Ice/inheritance/IB2I.java13
-rw-r--r--java/test/src/main/java/test/Ice/inheritance/ICI.java19
-rw-r--r--java/test/src/main/java/test/Ice/inheritance/InitialI.java58
-rw-r--r--java/test/src/main/java/test/Ice/inheritance/Server.java19
-rw-r--r--java/test/src/main/java/test/Ice/interceptor/Client.java106
-rw-r--r--java/test/src/main/java/test/Ice/interceptor/InterceptorI.java44
-rw-r--r--java/test/src/main/java/test/Ice/interceptor/MyObjectI.java227
-rw-r--r--java/test/src/main/java/test/Ice/interceptor/MySystemException.java6
-rw-r--r--java/test/src/main/java/test/Ice/interrupt/AllTests.java472
-rw-r--r--java/test/src/main/java/test/Ice/interrupt/Client.java19
-rw-r--r--java/test/src/main/java/test/Ice/interrupt/Collocated.java39
-rw-r--r--java/test/src/main/java/test/Ice/interrupt/Server.java36
-rw-r--r--java/test/src/main/java/test/Ice/interrupt/TestControllerI.java23
-rw-r--r--java/test/src/main/java/test/Ice/interrupt/TestI.java19
-rw-r--r--java/test/src/main/java/test/Ice/invoke/AllTests.java305
-rw-r--r--java/test/src/main/java/test/Ice/invoke/BlobjectAsyncI.java38
-rw-r--r--java/test/src/main/java/test/Ice/invoke/BlobjectI.java38
-rw-r--r--java/test/src/main/java/test/Ice/invoke/Client.java37
-rw-r--r--java/test/src/main/java/test/Ice/invoke/ServantLocatorI.java20
-rw-r--r--java/test/src/main/java/test/Ice/invoke/Server.java11
-rw-r--r--java/test/src/main/java/test/Ice/location/AllTests.java229
-rw-r--r--java/test/src/main/java/test/Ice/location/Client.java15
-rw-r--r--java/test/src/main/java/test/Ice/location/HelloI.java8
-rw-r--r--java/test/src/main/java/test/Ice/location/Server.java36
-rw-r--r--java/test/src/main/java/test/Ice/location/ServerLocator.java45
-rw-r--r--java/test/src/main/java/test/Ice/location/ServerLocatorRegistry.java56
-rw-r--r--java/test/src/main/java/test/Ice/location/ServerManagerI.java45
-rw-r--r--java/test/src/main/java/test/Ice/location/TestI.java39
-rw-r--r--java/test/src/main/java/test/Ice/metrics/AMDMetricsI.java58
-rw-r--r--java/test/src/main/java/test/Ice/metrics/AMDServer.java31
-rw-r--r--java/test/src/main/java/test/Ice/metrics/AllTests.java435
-rw-r--r--java/test/src/main/java/test/Ice/metrics/ChildInvocationObserverI.java11
-rw-r--r--java/test/src/main/java/test/Ice/metrics/Client.java27
-rw-r--r--java/test/src/main/java/test/Ice/metrics/Collocated.java43
-rw-r--r--java/test/src/main/java/test/Ice/metrics/CollocatedObserverI.java5
-rw-r--r--java/test/src/main/java/test/Ice/metrics/CommunicatorObserverI.java53
-rw-r--r--java/test/src/main/java/test/Ice/metrics/ConnectionObserverI.java14
-rw-r--r--java/test/src/main/java/test/Ice/metrics/ControllerI.java15
-rw-r--r--java/test/src/main/java/test/Ice/metrics/DispatchObserverI.java14
-rw-r--r--java/test/src/main/java/test/Ice/metrics/InvocationObserverI.java27
-rw-r--r--java/test/src/main/java/test/Ice/metrics/MetricsI.java37
-rw-r--r--java/test/src/main/java/test/Ice/metrics/ObserverI.java27
-rw-r--r--java/test/src/main/java/test/Ice/metrics/RemoveObserverI.java5
-rw-r--r--java/test/src/main/java/test/Ice/metrics/Server.java33
-rw-r--r--java/test/src/main/java/test/Ice/metrics/ThreadObserverI.java12
-rw-r--r--java/test/src/main/java/test/Ice/networkProxy/AllTests.java23
-rw-r--r--java/test/src/main/java/test/Ice/networkProxy/Client.java9
-rw-r--r--java/test/src/main/java/test/Ice/networkProxy/Server.java23
-rw-r--r--java/test/src/main/java/test/Ice/objects/AllTests.java66
-rw-r--r--java/test/src/main/java/test/Ice/objects/BI.java6
-rw-r--r--java/test/src/main/java/test/Ice/objects/CI.java7
-rw-r--r--java/test/src/main/java/test/Ice/objects/Client.java28
-rw-r--r--java/test/src/main/java/test/Ice/objects/Collocated.java44
-rw-r--r--java/test/src/main/java/test/Ice/objects/DI.java7
-rw-r--r--java/test/src/main/java/test/Ice/objects/EI.java8
-rw-r--r--java/test/src/main/java/test/Ice/objects/FI.java11
-rw-r--r--java/test/src/main/java/test/Ice/objects/HI.java1
-rw-r--r--java/test/src/main/java/test/Ice/objects/II.java4
-rw-r--r--java/test/src/main/java/test/Ice/objects/InitialI.java114
-rw-r--r--java/test/src/main/java/test/Ice/objects/JI.java5
-rw-r--r--java/test/src/main/java/test/Ice/objects/Server.java31
-rw-r--r--java/test/src/main/java/test/Ice/objects/Test.ice4
-rw-r--r--java/test/src/main/java/test/Ice/objects/UnexpectedObjectExceptionTestI.java17
-rw-r--r--java/test/src/main/java/test/Ice/operations/AMDMyDerivedClassI.java948
-rw-r--r--java/test/src/main/java/test/Ice/operations/AMDServer.java15
-rw-r--r--java/test/src/main/java/test/Ice/operations/AllTests.java76
-rw-r--r--java/test/src/main/java/test/Ice/operations/BatchOneways.java40
-rw-r--r--java/test/src/main/java/test/Ice/operations/BatchOnewaysAMI.java67
-rw-r--r--java/test/src/main/java/test/Ice/operations/Client.java17
-rw-r--r--java/test/src/main/java/test/Ice/operations/Collocated.java21
-rw-r--r--java/test/src/main/java/test/Ice/operations/MyDerivedClassI.java760
-rw-r--r--java/test/src/main/java/test/Ice/operations/Oneways.java15
-rw-r--r--java/test/src/main/java/test/Ice/operations/OnewaysAMI.java163
-rw-r--r--java/test/src/main/java/test/Ice/operations/Server.java15
-rw-r--r--java/test/src/main/java/test/Ice/operations/Twoways.java1395
-rw-r--r--java/test/src/main/java/test/Ice/operations/TwowaysAMI.java3100
-rwxr-xr-xjava/test/src/main/java/test/Ice/operations/run.py8
-rw-r--r--java/test/src/main/java/test/Ice/optional/AMDInitialI.java511
-rw-r--r--java/test/src/main/java/test/Ice/optional/AMDServer.java13
-rw-r--r--java/test/src/main/java/test/Ice/optional/AllTests.java1773
-rw-r--r--java/test/src/main/java/test/Ice/optional/Client.java9
-rw-r--r--java/test/src/main/java/test/Ice/optional/InitialI.java513
-rw-r--r--java/test/src/main/java/test/Ice/optional/Server.java13
-rw-r--r--java/test/src/main/java/test/Ice/optional/Test.ice28
-rw-r--r--java/test/src/main/java/test/Ice/packagemd/AllTests.java21
-rw-r--r--java/test/src/main/java/test/Ice/packagemd/Client.java13
-rw-r--r--java/test/src/main/java/test/Ice/packagemd/InitialI.java55
-rw-r--r--java/test/src/main/java/test/Ice/packagemd/Server.java21
-rw-r--r--java/test/src/main/java/test/Ice/plugin/Client.java57
-rw-r--r--java/test/src/main/java/test/Ice/properties/Client.java31
-rw-r--r--java/test/src/main/java/test/Ice/proxy/AMDMyDerivedClassI.java38
-rw-r--r--java/test/src/main/java/test/Ice/proxy/AMDServer.java19
-rw-r--r--java/test/src/main/java/test/Ice/proxy/AllTests.java221
-rw-r--r--java/test/src/main/java/test/Ice/proxy/Client.java12
-rw-r--r--java/test/src/main/java/test/Ice/proxy/Collocated.java17
-rw-r--r--java/test/src/main/java/test/Ice/proxy/MyDerivedClassI.java22
-rw-r--r--java/test/src/main/java/test/Ice/proxy/Server.java19
-rw-r--r--java/test/src/main/java/test/Ice/retry/AllTests.java129
-rw-r--r--java/test/src/main/java/test/Ice/retry/Client.java21
-rw-r--r--java/test/src/main/java/test/Ice/retry/Collocated.java30
-rw-r--r--java/test/src/main/java/test/Ice/retry/Instrumentation.java124
-rw-r--r--java/test/src/main/java/test/Ice/retry/RetryI.java35
-rw-r--r--java/test/src/main/java/test/Ice/retry/Server.java19
-rw-r--r--java/test/src/main/java/test/Ice/retry/SystemFailure.java7
-rw-r--r--java/test/src/main/java/test/Ice/seqMapping/AMDMyClassI.java27
-rw-r--r--java/test/src/main/java/test/Ice/seqMapping/AMDServer.java18
-rw-r--r--java/test/src/main/java/test/Ice/seqMapping/AllTests.java7
-rw-r--r--java/test/src/main/java/test/Ice/seqMapping/Client.java12
-rw-r--r--java/test/src/main/java/test/Ice/seqMapping/Collocated.java18
-rw-r--r--java/test/src/main/java/test/Ice/seqMapping/MyClassI.java20
-rw-r--r--java/test/src/main/java/test/Ice/seqMapping/Server.java18
-rw-r--r--java/test/src/main/java/test/Ice/seqMapping/Test.ice2
-rw-r--r--java/test/src/main/java/test/Ice/seqMapping/TestAMD.ice2
-rw-r--r--java/test/src/main/java/test/Ice/seqMapping/Twoways.java100
-rw-r--r--java/test/src/main/java/test/Ice/seqMapping/TwowaysAMI.java233
-rw-r--r--java/test/src/main/java/test/Ice/serialize/AllTests.java28
-rw-r--r--java/test/src/main/java/test/Ice/serialize/Client.java13
-rw-r--r--java/test/src/main/java/test/Ice/serialize/InitialI.java36
-rw-r--r--java/test/src/main/java/test/Ice/serialize/Server.java20
-rw-r--r--java/test/src/main/java/test/Ice/servantLocator/AMDCookieI.java3
-rw-r--r--java/test/src/main/java/test/Ice/servantLocator/AMDServantLocatorI.java53
-rw-r--r--java/test/src/main/java/test/Ice/servantLocator/AMDServer.java19
-rw-r--r--java/test/src/main/java/test/Ice/servantLocator/AMDTestActivationI.java8
-rw-r--r--java/test/src/main/java/test/Ice/servantLocator/AMDTestI.java107
-rw-r--r--java/test/src/main/java/test/Ice/servantLocator/AllTests.java45
-rw-r--r--java/test/src/main/java/test/Ice/servantLocator/Client.java9
-rw-r--r--java/test/src/main/java/test/Ice/servantLocator/Collocated.java19
-rw-r--r--java/test/src/main/java/test/Ice/servantLocator/CookieI.java3
-rw-r--r--java/test/src/main/java/test/Ice/servantLocator/ServantLocatorI.java53
-rw-r--r--java/test/src/main/java/test/Ice/servantLocator/Server.java19
-rw-r--r--java/test/src/main/java/test/Ice/servantLocator/TestActivationI.java8
-rw-r--r--java/test/src/main/java/test/Ice/servantLocator/TestI.java49
-rw-r--r--java/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java19
-rw-r--r--java/test/src/main/java/test/Ice/slicing/exceptions/AMDTestI.java210
-rw-r--r--java/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java819
-rw-r--r--java/test/src/main/java/test/Ice/slicing/exceptions/Client.java17
-rw-r--r--java/test/src/main/java/test/Ice/slicing/exceptions/Server.java19
-rw-r--r--java/test/src/main/java/test/Ice/slicing/exceptions/TestI.java73
-rw-r--r--java/test/src/main/java/test/Ice/slicing/objects/AMDServer.java21
-rw-r--r--java/test/src/main/java/test/Ice/slicing/objects/AMDTestI.java240
-rw-r--r--java/test/src/main/java/test/Ice/slicing/objects/AllTests.java2074
-rw-r--r--java/test/src/main/java/test/Ice/slicing/objects/Client.java11
-rw-r--r--java/test/src/main/java/test/Ice/slicing/objects/Server.java21
-rw-r--r--java/test/src/main/java/test/Ice/slicing/objects/TestI.java199
-rw-r--r--java/test/src/main/java/test/Ice/stream/Client.java293
-rw-r--r--java/test/src/main/java/test/Ice/stream/Test.ice4
-rw-r--r--java/test/src/main/java/test/Ice/threadPoolPriority/Client.java8
-rw-r--r--java/test/src/main/java/test/Ice/threadPoolPriority/PriorityI.java17
-rw-r--r--java/test/src/main/java/test/Ice/threadPoolPriority/Server.java13
-rw-r--r--java/test/src/main/java/test/Ice/throughput/Client.java75
-rw-r--r--java/test/src/main/java/test/Ice/throughput/Server.java18
-rw-r--r--java/test/src/main/java/test/Ice/throughput/ThroughputI.java55
-rw-r--r--java/test/src/main/java/test/Ice/timeout/AllTests.java221
-rw-r--r--java/test/src/main/java/test/Ice/timeout/Client.java17
-rw-r--r--java/test/src/main/java/test/Ice/timeout/Server.java21
-rw-r--r--java/test/src/main/java/test/Ice/timeout/TimeoutI.java26
-rw-r--r--java/test/src/main/java/test/Ice/udp/AllTests.java42
-rw-r--r--java/test/src/main/java/test/Ice/udp/Client.java17
-rw-r--r--java/test/src/main/java/test/Ice/udp/Server.java33
-rw-r--r--java/test/src/main/java/test/Ice/udp/TestIntfI.java22
-rw-r--r--java/test/src/main/java/test/IceBox/admin/AllTests.java42
-rw-r--r--java/test/src/main/java/test/IceBox/admin/Client.java13
-rw-r--r--java/test/src/main/java/test/IceBox/admin/TestFacetI.java4
-rw-r--r--java/test/src/main/java/test/IceBox/admin/TestServiceI.java15
-rw-r--r--java/test/src/main/java/test/IceBox/configuration/AllTests.java15
-rw-r--r--java/test/src/main/java/test/IceBox/configuration/Client.java17
-rw-r--r--java/test/src/main/java/test/IceBox/configuration/TestI.java14
-rw-r--r--java/test/src/main/java/test/IceBox/configuration/TestServiceI.java12
-rw-r--r--java/test/src/main/java/test/IceDiscovery/simple/AllTests.java39
-rw-r--r--java/test/src/main/java/test/IceDiscovery/simple/ControllerI.java31
-rw-r--r--java/test/src/main/java/test/IceDiscovery/simple/Server.java6
-rw-r--r--java/test/src/main/java/test/IceDiscovery/simple/TestIntfI.java5
-rwxr-xr-xjava/test/src/main/java/test/IceDiscovery/simple/run.py2
-rw-r--r--java/test/src/main/java/test/IceGrid/simple/AllTests.java148
-rw-r--r--java/test/src/main/java/test/IceGrid/simple/Client.java11
-rw-r--r--java/test/src/main/java/test/IceGrid/simple/Server.java32
-rw-r--r--java/test/src/main/java/test/IceGrid/simple/TestI.java10
-rw-r--r--java/test/src/main/java/test/IceSSL/configuration/AllTests.java784
-rw-r--r--java/test/src/main/java/test/IceSSL/configuration/CertificateVerifierI.java27
-rw-r--r--java/test/src/main/java/test/IceSSL/configuration/Client.java9
-rw-r--r--java/test/src/main/java/test/IceSSL/configuration/PasswordCallbackI.java17
-rw-r--r--java/test/src/main/java/test/IceSSL/configuration/Server.java16
-rw-r--r--java/test/src/main/java/test/IceSSL/configuration/ServerFactoryI.java36
-rw-r--r--java/test/src/main/java/test/IceSSL/configuration/ServerI.java35
-rw-r--r--java/test/src/main/java/test/IceUtil/inputUtil/Client.java113
-rw-r--r--java/test/src/main/java/test/Slice/generation/list-generated.out16
-rw-r--r--java/test/src/main/java/test/Slice/keyword/Client.java103
-rw-r--r--java/test/src/main/java/test/Slice/keyword/Key.ice2
-rw-r--r--java/test/src/main/java/test/Slice/macros/Client.java5
-rw-r--r--java/test/src/main/java/test/Slice/structure/Client.java28
-rw-r--r--java/test/src/main/java/test/Util/Application.java64
-rw-r--r--scripts/IceGridAdmin.py4
-rwxr-xr-xscripts/TestUtil.py66
-rw-r--r--slice/Glacier2/Metrics.ice5
-rw-r--r--slice/Glacier2/PermissionsVerifier.ice6
-rw-r--r--slice/Glacier2/PermissionsVerifierF.ice7
-rw-r--r--slice/Glacier2/Router.ice6
-rw-r--r--slice/Glacier2/RouterF.ice7
-rw-r--r--slice/Glacier2/SSLInfo.ice6
-rw-r--r--slice/Glacier2/Session.ice6
-rw-r--r--slice/Ice/BuiltinSequences.ice7
-rw-r--r--slice/Ice/Communicator.ice9
-rw-r--r--slice/Ice/CommunicatorF.ice7
-rw-r--r--slice/Ice/Connection.ice5
-rw-r--r--slice/Ice/ConnectionF.ice7
-rw-r--r--slice/Ice/Current.ice6
-rw-r--r--slice/Ice/Endpoint.ice8
-rw-r--r--slice/Ice/EndpointF.ice7
-rw-r--r--slice/Ice/EndpointTypes.ice8
-rw-r--r--slice/Ice/FacetMap.ice7
-rw-r--r--slice/Ice/Identity.ice7
-rw-r--r--slice/Ice/ImplicitContext.ice6
-rw-r--r--slice/Ice/ImplicitContextF.ice7
-rw-r--r--slice/Ice/Instrumentation.ice6
-rw-r--r--slice/Ice/InstrumentationF.ice7
-rw-r--r--slice/Ice/JavaCompat.ice24
-rw-r--r--slice/Ice/LocalException.ice6
-rw-r--r--slice/Ice/Locator.ice8
-rw-r--r--slice/Ice/LocatorF.ice7
-rw-r--r--slice/Ice/Logger.ice7
-rw-r--r--slice/Ice/LoggerF.ice7
-rw-r--r--slice/Ice/Metrics.ice5
-rw-r--r--slice/Ice/ObjectAdapter.ice7
-rw-r--r--slice/Ice/ObjectAdapterF.ice7
-rw-r--r--slice/Ice/ObjectFactory.ice7
-rw-r--r--slice/Ice/Plugin.ice6
-rw-r--r--slice/Ice/PluginF.ice7
-rw-r--r--slice/Ice/Process.ice7
-rw-r--r--slice/Ice/ProcessF.ice7
-rw-r--r--slice/Ice/Properties.ice6
-rw-r--r--slice/Ice/PropertiesAdmin.ice5
-rw-r--r--slice/Ice/PropertiesF.ice7
-rw-r--r--slice/Ice/RemoteLogger.ice6
-rw-r--r--slice/Ice/Router.ice6
-rw-r--r--slice/Ice/RouterF.ice7
-rw-r--r--slice/Ice/ServantLocator.ice6
-rw-r--r--slice/Ice/ServantLocatorF.ice7
-rw-r--r--slice/Ice/SliceChecksumDict.ice7
-rw-r--r--slice/Ice/ValueFactory.ice6
-rw-r--r--slice/Ice/Version.ice6
-rw-r--r--slice/IceBT/ConnectionInfo.ice5
-rw-r--r--slice/IceBT/EndpointInfo.ice5
-rw-r--r--slice/IceBT/Types.ice6
-rw-r--r--slice/IceBox/IceBox.ice6
-rw-r--r--slice/IceDiscovery/IceDiscovery.ice5
-rw-r--r--slice/IceGrid/Admin.ice6
-rw-r--r--slice/IceGrid/Descriptor.ice6
-rw-r--r--slice/IceGrid/Exception.ice6
-rw-r--r--slice/IceGrid/FileParser.ice6
-rw-r--r--slice/IceGrid/PluginFacade.ice5
-rw-r--r--slice/IceGrid/Registry.ice6
-rw-r--r--slice/IceGrid/Session.ice6
-rw-r--r--slice/IceGrid/UserAccountMapper.ice7
-rw-r--r--slice/IceLocatorDiscovery/IceLocatorDiscovery.ice5
-rw-r--r--slice/IcePatch2/FileInfo.ice7
-rw-r--r--slice/IcePatch2/FileServer.ice5
-rw-r--r--slice/IceSSL/ConnectionInfo.ice6
-rw-r--r--slice/IceSSL/EndpointInfo.ice6
-rw-r--r--slice/IceStorm/IceStorm.ice6
-rw-r--r--slice/IceStorm/Metrics.ice5
1716 files changed, 160026 insertions, 27022 deletions
diff --git a/.gitattributes b/.gitattributes
index 176a458f94e..5bc0be0ee33 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1 +1,2 @@
* text=auto
+gradlew.bat text eol=crlf
diff --git a/.gitignore b/.gitignore
index 8f6f73f6b4f..523f3b1d91d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,6 +35,7 @@ cgenerated
sgenerated
/java/depcache
/java/lib
+/java-compat/lib
/android/lib
/cpp/bin
/cpp/lib
diff --git a/cpp/src/Slice/JavaUtil.cpp b/cpp/src/Slice/JavaUtil.cpp
index c4e4061ea39..52c72714619 100644
--- a/cpp/src/Slice/JavaUtil.cpp
+++ b/cpp/src/Slice/JavaUtil.cpp
@@ -71,6 +71,438 @@ typeToBufferString(const TypePtr& type)
return builtinBufferTable[builtin->kind()];
}
}
+
+string
+lookupKwd(const string& name)
+{
+ //
+ // Keyword list. *Must* be kept in alphabetical order. Note that checkedCast and uncheckedCast
+ // are not Java keywords, but are in this list to prevent illegal code being generated if
+ // someone defines Slice operations with that name.
+ //
+ // NOTE: Any changes made to this list must also be made in BasicStream.java.
+ //
+ static const string keywordList[] =
+ {
+ "abstract", "assert", "boolean", "break", "byte", "case", "catch",
+ "char", "checkedCast", "class", "clone", "const", "continue", "default", "do",
+ "double", "else", "enum", "equals", "extends", "false", "final", "finalize",
+ "finally", "float", "for", "getClass", "goto", "hashCode", "if",
+ "implements", "import", "instanceof", "int", "interface", "long",
+ "native", "new", "notify", "notifyAll", "null", "package", "private",
+ "protected", "public", "return", "short", "static", "strictfp", "super", "switch",
+ "synchronized", "this", "throw", "throws", "toString", "transient",
+ "true", "try", "uncheckedCast", "void", "volatile", "wait", "while"
+ };
+ bool found = binary_search(&keywordList[0],
+ &keywordList[sizeof(keywordList) / sizeof(*keywordList)],
+ name);
+ return found ? "_" + name : name;
+}
+
+//
+// Split a scoped name into its components and return the components as a list of (unscoped) identifiers.
+//
+static StringList
+splitScopedName(const string& scoped)
+{
+ assert(scoped[0] == ':');
+ StringList ids;
+ string::size_type next = 0;
+ string::size_type pos;
+ while((pos = scoped.find("::", next)) != string::npos)
+ {
+ pos += 2;
+ if(pos != scoped.size())
+ {
+ string::size_type endpos = scoped.find("::", pos);
+ if(endpos != string::npos)
+ {
+ ids.push_back(scoped.substr(pos, endpos - pos));
+ }
+ }
+ next = pos;
+ }
+ if(next != scoped.size())
+ {
+ ids.push_back(scoped.substr(next));
+ }
+ else
+ {
+ ids.push_back("");
+ }
+
+ return ids;
+}
+
+class MetaDataVisitor : public ParserVisitor
+{
+public:
+
+ virtual bool visitUnitStart(const UnitPtr& p)
+ {
+ static const string prefix = "java:";
+
+ //
+ // Validate global metadata in the top-level file and all included files.
+ //
+ StringList files = p->allFiles();
+
+ for(StringList::iterator q = files.begin(); q != files.end(); ++q)
+ {
+ string file = *q;
+ DefinitionContextPtr dc = p->findDefinitionContext(file);
+ assert(dc);
+ StringList globalMetaData = dc->getMetaData();
+ for(StringList::const_iterator r = globalMetaData.begin(); r != globalMetaData.end(); ++r)
+ {
+ string s = *r;
+ if(_history.count(s) == 0)
+ {
+ if(s.find(prefix) == 0)
+ {
+ bool ok = false;
+
+ static const string packagePrefix = "java:package:";
+ if(s.find(packagePrefix) == 0 && s.size() > packagePrefix.size())
+ {
+ ok = true;
+ }
+
+ if(!ok)
+ {
+ emitWarning(file, "", "ignoring invalid global metadata `" + s + "'");
+ }
+ }
+ _history.insert(s);
+ }
+ }
+ }
+ return true;
+ }
+
+ virtual bool visitModuleStart(const ModulePtr& p)
+ {
+ StringList metaData = getMetaData(p);
+ validateType(p, metaData, p->file(), p->line());
+ validateGetSet(p, metaData, p->file(), p->line());
+ return true;
+ }
+
+ virtual void visitClassDecl(const ClassDeclPtr& p)
+ {
+ StringList metaData = getMetaData(p);
+ validateType(p, metaData, p->file(), p->line());
+ validateGetSet(p, metaData, p->file(), p->line());
+ }
+
+ virtual bool visitClassDefStart(const ClassDefPtr& p)
+ {
+ StringList metaData = getMetaData(p);
+ validateType(p, metaData, p->file(), p->line());
+ validateGetSet(p, metaData, p->file(), p->line());
+ return true;
+ }
+
+ virtual bool visitExceptionStart(const ExceptionPtr& p)
+ {
+ StringList metaData = getMetaData(p);
+ validateType(p, metaData, p->file(), p->line());
+ validateGetSet(p, metaData, p->file(), p->line());
+ return true;
+ }
+
+ virtual bool visitStructStart(const StructPtr& p)
+ {
+ StringList metaData = getMetaData(p);
+ validateType(p, metaData, p->file(), p->line());
+ validateGetSet(p, metaData, p->file(), p->line());
+ return true;
+ }
+
+ virtual void visitOperation(const OperationPtr& p)
+ {
+ if(p->hasMetaData("UserException"))
+ {
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(p->container());
+ if(!cl->isLocal())
+ {
+ ostringstream os;
+ os << "ignoring invalid metadata `UserException': directive applies only to local operations "
+ << "but enclosing " << (cl->isInterface() ? "interface" : "class") << " `" << cl->name()
+ << "' is not local";
+ emitWarning(p->file(), p->line(), os.str());
+ }
+ }
+ StringList metaData = getMetaData(p);
+ TypePtr returnType = p->returnType();
+ if(!metaData.empty())
+ {
+ if(!returnType)
+ {
+ for(StringList::const_iterator q = metaData.begin(); q != metaData.end(); ++q)
+ {
+ if(q->find("java:type:", 0) == 0)
+ {
+ emitWarning(p->file(), p->line(), "ignoring invalid metadata `" + *q +
+ "' for operation with void return type");
+ break;
+ }
+ }
+ }
+ else
+ {
+ validateType(returnType, metaData, p->file(), p->line());
+ }
+ }
+
+ ParamDeclList params = p->parameters();
+ for(ParamDeclList::iterator q = params.begin(); q != params.end(); ++q)
+ {
+ metaData = getMetaData(*q);
+ validateType((*q)->type(), metaData, p->file(), (*q)->line());
+ }
+
+ validateGetSet(p, metaData, p->file(), p->line());
+ }
+
+ virtual void visitDataMember(const DataMemberPtr& p)
+ {
+ StringList metaData = getMetaData(p);
+ validateType(p->type(), metaData, p->file(), p->line());
+ validateGetSet(p, metaData, p->file(), p->line());
+ }
+
+ virtual void visitSequence(const SequencePtr& p)
+ {
+ static const string protobuf = "java:protobuf:";
+ static const string serializable = "java:serializable:";
+ static const string bytebuffer = "java:buffer";
+ StringList metaData = getMetaData(p);
+ const string file = p->file();
+ const string line = p->line();
+ for(StringList::const_iterator q = metaData.begin(); q != metaData.end(); )
+ {
+ string s = *q++;
+ if(_history.count(s) == 0) // Don't complain about the same metadata more than once.
+ {
+ if(s.find(protobuf) == 0 || s.find(serializable) == 0)
+ {
+ //
+ // Remove from list so validateType does not try to handle as well.
+ //
+ metaData.remove(s);
+
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(p->type());
+ if(!builtin || builtin->kind() != Builtin::KindByte)
+ {
+ _history.insert(s);
+ emitWarning(file, line, "ignoring invalid metadata `" + s + "': " +
+ "this metadata can only be used with a byte sequence");
+ }
+ }
+ else if(s.find(bytebuffer) == 0)
+ {
+ metaData.remove(s);
+
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(p->type());
+ if(!builtin ||
+ (builtin->kind() != Builtin::KindByte && builtin->kind() != Builtin::KindShort &&
+ builtin->kind() != Builtin::KindInt && builtin->kind() != Builtin::KindLong &&
+ builtin->kind() != Builtin::KindFloat && builtin->kind() != Builtin::KindDouble))
+ {
+ _history.insert(s);
+ emitWarning(file, line, "ignoring invalid metadata `" + s + "': " +
+ "this metadata can not be used with this type");
+ }
+ }
+ }
+ }
+
+ validateType(p, metaData, file, line);
+ validateGetSet(p, metaData, file, line);
+ }
+
+ virtual void visitDictionary(const DictionaryPtr& p)
+ {
+ StringList metaData = getMetaData(p);
+ validateType(p, metaData, p->file(), p->line());
+ validateGetSet(p, metaData, p->file(), p->line());
+ }
+
+ virtual void visitEnum(const EnumPtr& p)
+ {
+ StringList metaData = getMetaData(p);
+ validateType(p, metaData, p->file(), p->line());
+ validateGetSet(p, metaData, p->file(), p->line());
+ }
+
+ virtual void visitConst(const ConstPtr& p)
+ {
+ StringList metaData = getMetaData(p);
+ validateType(p, metaData, p->file(), p->line());
+ validateGetSet(p, metaData, p->file(), p->line());
+ }
+
+private:
+
+ StringList getMetaData(const ContainedPtr& cont)
+ {
+ static const string prefix = "java:";
+
+ StringList metaData = cont->getMetaData();
+ StringList result;
+
+ for(StringList::const_iterator p = metaData.begin(); p != metaData.end(); ++p)
+ {
+ string s = *p;
+ if(_history.count(s) == 0) // Don't complain about the same metadata more than once.
+ {
+ if(s.find(prefix) == 0)
+ {
+ string::size_type pos = s.find(':', prefix.size());
+ if(pos == string::npos)
+ {
+ if(s.size() > prefix.size())
+ {
+ string rest = s.substr(prefix.size());
+ if(rest == "getset")
+ {
+ result.push_back(s);
+ }
+ else if(rest == "buffer")
+ {
+ result.push_back(s);
+ }
+ continue;
+ }
+ }
+ else if(s.substr(prefix.size(), pos - prefix.size()) == "type")
+ {
+ result.push_back(s);
+ continue;
+ }
+ else if(s.substr(prefix.size(), pos - prefix.size()) == "serializable")
+ {
+ result.push_back(s);
+ continue;
+ }
+ else if(s.substr(prefix.size(), pos - prefix.size()) == "protobuf")
+ {
+ result.push_back(s);
+ continue;
+ }
+ else if(s.substr(prefix.size(), pos - prefix.size()) == "serialVersionUID")
+ {
+ result.push_back(s);
+ continue;
+ }
+
+ emitWarning(cont->file(), cont->line(), "ignoring invalid metadata `" + s + "'");
+ }
+ else if(s == "delegate")
+ {
+ result.push_back(s);
+ continue;
+ }
+
+ _history.insert(s);
+ }
+ }
+
+ return result;
+ }
+
+ void validateType(const SyntaxTreeBasePtr& p, const StringList& metaData, const string& file, const string& line)
+ {
+ for(StringList::const_iterator i = metaData.begin(); i != metaData.end(); ++i)
+ {
+ //
+ // Type metadata ("java:type:Foo") is only supported by sequences and dictionaries.
+ //
+ if(i->find("java:type:", 0) == 0 && (!SequencePtr::dynamicCast(p) && !DictionaryPtr::dynamicCast(p)))
+ {
+ string str;
+ ContainedPtr cont = ContainedPtr::dynamicCast(p);
+ if(cont)
+ {
+ str = cont->kindOf();
+ }
+ else
+ {
+ BuiltinPtr b = BuiltinPtr::dynamicCast(p);
+ assert(b);
+ str = b->typeId();
+ }
+ emitWarning(file, line, "invalid metadata for " + str);
+ }
+ else if(i->find("java:buffer") == 0)
+ {
+ SequencePtr seq = SequencePtr::dynamicCast(p);
+ if(seq)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(seq->type());
+ if(builtin &&
+ (builtin->kind() == Builtin::KindByte || builtin->kind() == Builtin::KindShort ||
+ builtin->kind() == Builtin::KindInt || builtin->kind() == Builtin::KindLong ||
+ builtin->kind() == Builtin::KindFloat || builtin->kind() == Builtin::KindDouble))
+ {
+ continue;
+ }
+
+ }
+ emitWarning(file, line, "ignoring invalid metadata `" + *i + "'");
+ }
+ else if(i->find("java:protobuf:") == 0 || i->find("java:serializable:") == 0)
+ {
+ //
+ // Only valid in sequence defintion which is checked in visitSequence
+ //
+ emitWarning(file, line, "ignoring invalid metadata `" + *i + "'");
+ }
+ else if(i->find("delegate") == 0)
+ {
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(p);
+ if(cl && cl->isDelegate())
+ {
+ continue;
+ }
+ emitWarning(file, line, "ignoring invalid metadata `" + *i + "'");
+ }
+ }
+ }
+
+ void validateGetSet(const SyntaxTreeBasePtr& p, const StringList& metaData, const string& file, const string& line)
+ {
+ for(StringList::const_iterator i = metaData.begin(); i != metaData.end(); ++i)
+ {
+ //
+ // The "getset" metadata can only be specified on a class, struct, exception or data member.
+ //
+ if((*i) == "java:getset" &&
+ (!ClassDefPtr::dynamicCast(p) && !StructPtr::dynamicCast(p) && !ExceptionPtr::dynamicCast(p) &&
+ !DataMemberPtr::dynamicCast(p)))
+ {
+ string str;
+ ContainedPtr cont = ContainedPtr::dynamicCast(p);
+ if(cont)
+ {
+ str = cont->kindOf();
+ }
+ else
+ {
+ BuiltinPtr b = BuiltinPtr::dynamicCast(p);
+ assert(b);
+ str = b->typeId();
+ }
+ emitWarning(file, line, "invalid metadata for " + str);
+ }
+ }
+ }
+
+ StringSet _history;
+};
+
}
long
@@ -162,8 +594,6 @@ Slice::computeSerialVersionUUID(const ExceptionPtr& p)
return hashCode;
}
-
-
Slice::JavaOutput::JavaOutput()
{
}
@@ -302,15 +732,15 @@ Slice::JavaOutput::printHeader()
print("//\n");
}
-const string Slice::JavaGenerator::_getSetMetaData = "java:getset";
+const string Slice::JavaCompatGenerator::_getSetMetaData = "java:getset";
-Slice::JavaGenerator::JavaGenerator(const string& dir) :
+Slice::JavaCompatGenerator::JavaCompatGenerator(const string& dir) :
_dir(dir),
_out(0)
{
}
-Slice::JavaGenerator::~JavaGenerator()
+Slice::JavaCompatGenerator::~JavaCompatGenerator()
{
// If open throws an exception other generators could be left open
// during the stack unwind.
@@ -322,7 +752,7 @@ Slice::JavaGenerator::~JavaGenerator()
}
void
-Slice::JavaGenerator::open(const string& absolute, const string& file)
+Slice::JavaCompatGenerator::open(const string& absolute, const string& file)
{
assert(_out == 0);
@@ -340,7 +770,7 @@ Slice::JavaGenerator::open(const string& absolute, const string& file)
}
void
-Slice::JavaGenerator::close()
+Slice::JavaCompatGenerator::close()
{
assert(_out != 0);
*_out << nl;
@@ -349,75 +779,12 @@ Slice::JavaGenerator::close()
}
Output&
-Slice::JavaGenerator::output() const
+Slice::JavaCompatGenerator::output() const
{
assert(_out != 0);
return *_out;
}
-static string
-lookupKwd(const string& name)
-{
- //
- // Keyword list. *Must* be kept in alphabetical order. Note that checkedCast and uncheckedCast
- // are not Java keywords, but are in this list to prevent illegal code being generated if
- // someone defines Slice operations with that name.
- //
- // NOTE: Any changes made to this list must also be made in BasicStream.java.
- //
- static const string keywordList[] =
- {
- "abstract", "assert", "boolean", "break", "byte", "case", "catch",
- "char", "checkedCast", "class", "clone", "const", "continue", "default", "do",
- "double", "else", "enum", "equals", "extends", "false", "final", "finalize",
- "finally", "float", "for", "getClass", "goto", "hashCode", "if",
- "implements", "import", "instanceof", "int", "interface", "long",
- "native", "new", "notify", "notifyAll", "null", "package", "private",
- "protected", "public", "return", "short", "static", "strictfp", "super", "switch",
- "synchronized", "this", "throw", "throws", "toString", "transient",
- "true", "try", "uncheckedCast", "void", "volatile", "wait", "while"
- };
- bool found = binary_search(&keywordList[0],
- &keywordList[sizeof(keywordList) / sizeof(*keywordList)],
- name);
- return found ? "_" + name : name;
-}
-
-//
-// Split a scoped name into its components and return the components as a list of (unscoped) identifiers.
-//
-static StringList
-splitScopedName(const string& scoped)
-{
- assert(scoped[0] == ':');
- StringList ids;
- string::size_type next = 0;
- string::size_type pos;
- while((pos = scoped.find("::", next)) != string::npos)
- {
- pos += 2;
- if(pos != scoped.size())
- {
- string::size_type endpos = scoped.find("::", pos);
- if(endpos != string::npos)
- {
- ids.push_back(scoped.substr(pos, endpos - pos));
- }
- }
- next = pos;
- }
- if(next != scoped.size())
- {
- ids.push_back(scoped.substr(next));
- }
- else
- {
- ids.push_back("");
- }
-
- return ids;
-}
-
//
// If the passed name is a scoped name, return the identical scoped name,
// but with all components that are Java keywords replaced by
@@ -426,7 +793,7 @@ splitScopedName(const string& scoped)
// otherwise, return the name unchanged.
//
string
-Slice::JavaGenerator::fixKwd(const string& name) const
+Slice::JavaCompatGenerator::fixKwd(const string& name) const
{
if(name.empty())
{
@@ -447,7 +814,7 @@ Slice::JavaGenerator::fixKwd(const string& name) const
}
string
-Slice::JavaGenerator::convertScopedName(const string& scoped, const string& prefix, const string& suffix) const
+Slice::JavaCompatGenerator::convertScopedName(const string& scoped, const string& prefix, const string& suffix) const
{
string result;
string::size_type start = 0;
@@ -497,7 +864,7 @@ Slice::JavaGenerator::convertScopedName(const string& scoped, const string& pref
}
string
-Slice::JavaGenerator::getPackagePrefix(const ContainedPtr& cont) const
+Slice::JavaCompatGenerator::getPackagePrefix(const ContainedPtr& cont) const
{
UnitPtr unit = cont->container()->unit();
string file = cont->file();
@@ -522,7 +889,7 @@ Slice::JavaGenerator::getPackagePrefix(const ContainedPtr& cont) const
}
string
-Slice::JavaGenerator::getPackage(const ContainedPtr& cont) const
+Slice::JavaCompatGenerator::getPackage(const ContainedPtr& cont) const
{
string scope = convertScopedName(cont->scope());
string prefix = getPackagePrefix(cont);
@@ -542,10 +909,10 @@ Slice::JavaGenerator::getPackage(const ContainedPtr& cont) const
}
string
-Slice::JavaGenerator::getAbsolute(const ContainedPtr& cont,
- const string& package,
- const string& prefix,
- const string& suffix) const
+Slice::JavaCompatGenerator::getAbsolute(const ContainedPtr& cont,
+ const string& package,
+ const string& prefix,
+ const string& suffix) const
{
string name = cont->name();
if(prefix == "" && suffix == "")
@@ -568,12 +935,12 @@ Slice::JavaGenerator::getAbsolute(const ContainedPtr& cont,
}
string
-Slice::JavaGenerator::getStaticId(const TypePtr& type, const string& package) const
+Slice::JavaCompatGenerator::getStaticId(const TypePtr& type, const string& package) const
{
BuiltinPtr b = BuiltinPtr::dynamicCast(type);
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- assert((b && (b->kind() == Builtin::KindObject || b->kind() == Builtin::KindValue)) || cl);
+ assert((b && b->usesClasses()) || cl);
if(b)
{
@@ -590,7 +957,7 @@ Slice::JavaGenerator::getStaticId(const TypePtr& type, const string& package) co
}
bool
-Slice::JavaGenerator::useOptionalMapping(const OperationPtr& p)
+Slice::JavaCompatGenerator::useOptionalMapping(const OperationPtr& p)
{
//
// The "java:optional" metadata can be applied to an operation or its
@@ -607,7 +974,7 @@ Slice::JavaGenerator::useOptionalMapping(const OperationPtr& p)
}
string
-Slice::JavaGenerator::getOptionalFormat(const TypePtr& type)
+Slice::JavaCompatGenerator::getOptionalFormat(const TypePtr& type)
{
BuiltinPtr bp = BuiltinPtr::dynamicCast(type);
if(bp)
@@ -692,12 +1059,12 @@ Slice::JavaGenerator::getOptionalFormat(const TypePtr& type)
}
string
-Slice::JavaGenerator::typeToString(const TypePtr& type,
- TypeMode mode,
- const string& package,
- const StringList& metaData,
- bool formal,
- bool optional) const
+Slice::JavaCompatGenerator::typeToString(const TypePtr& type,
+ TypeMode mode,
+ const string& package,
+ const StringList& metaData,
+ bool formal,
+ bool optional) const
{
static const char* builtinTable[] =
{
@@ -894,11 +1261,11 @@ Slice::JavaGenerator::typeToString(const TypePtr& type,
}
string
-Slice::JavaGenerator::typeToObjectString(const TypePtr& type,
- TypeMode mode,
- const string& package,
- const StringList& metaData,
- bool formal) const
+Slice::JavaCompatGenerator::typeToObjectString(const TypePtr& type,
+ TypeMode mode,
+ const string& package,
+ const StringList& metaData,
+ bool formal) const
{
static const char* builtinTable[] =
{
@@ -926,18 +1293,18 @@ Slice::JavaGenerator::typeToObjectString(const TypePtr& type,
}
void
-Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
- const string& package,
- const TypePtr& type,
- OptionalMode mode,
- bool optionalMapping,
- int tag,
- const string& param,
- bool marshal,
- int& iter,
- bool holder,
- const StringList& metaData,
- const string& patchParams)
+Slice::JavaCompatGenerator::writeMarshalUnmarshalCode(Output& out,
+ const string& package,
+ const TypePtr& type,
+ OptionalMode mode,
+ bool optionalMapping,
+ int tag,
+ const string& param,
+ bool marshal,
+ int& iter,
+ bool holder,
+ const StringList& metaData,
+ const string& patchParams)
{
string stream = marshal ? "__os" : "__is";
string v;
@@ -1864,14 +2231,14 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
}
void
-Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
- const string& package,
- const DictionaryPtr& dict,
- const string& param,
- bool marshal,
- int& iter,
- bool useHelper,
- const StringList& metaData)
+Slice::JavaCompatGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
+ const string& package,
+ const DictionaryPtr& dict,
+ const string& param,
+ bool marshal,
+ int& iter,
+ bool useHelper,
+ const StringList& metaData)
{
string stream = marshal ? "__os" : "__is";
string v = param;
@@ -1987,7 +2354,7 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
}
BuiltinPtr b = BuiltinPtr::dynamicCast(type);
- if(ClassDeclPtr::dynamicCast(type) || (b && (b->kind() == Builtin::KindObject || b->kind() == Builtin::KindValue)))
+ if(ClassDeclPtr::dynamicCast(type) || (b && b->usesClasses()))
{
string keyTypeStr = typeToObjectString(key, TypeModeIn, package);
string valueTypeStr = typeToObjectString(value, TypeModeIn, package);
@@ -2010,8 +2377,7 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
}
}
BuiltinPtr builtin = BuiltinPtr::dynamicCast(value);
- if(!(builtin && (builtin->kind() == Builtin::KindObject || builtin->kind() == Builtin::KindValue)) &&
- !ClassDeclPtr::dynamicCast(value))
+ if(!(builtin && builtin->usesClasses()) && !ClassDeclPtr::dynamicCast(value))
{
out << nl << "" << v << ".put(__key, __value);";
}
@@ -2020,14 +2386,14 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
}
void
-Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
- const string& package,
- const SequencePtr& seq,
- const string& param,
- bool marshal,
- int& iter,
- bool useHelper,
- const StringList& metaData)
+Slice::JavaCompatGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
+ const string& package,
+ const SequencePtr& seq,
+ const string& param,
+ bool marshal,
+ int& iter,
+ bool useHelper,
+ const StringList& metaData)
{
string stream = marshal ? "__os" : "__is";
string v = param;
@@ -2280,33 +2646,13 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
bool isObject = false;
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if((b && (b->kind() == Builtin::KindObject || b->kind() == Builtin::KindValue)) || cl)
+ if((b && b->usesClasses()) || cl)
{
isObject = true;
}
out << nl << v << " = new " << instanceType << "();";
out << nl << "final int __len" << iter << " = " << stream << ".readAndCheckSeqSize(" << type->minWireSize()
<< ");";
- if(isObject)
- {
- if(b)
- {
- out << nl << "final String __type" << iter << " = Ice.ObjectImpl.ice_staticId();";
- }
- else
- {
- assert(cl);
- if(cl->isInterface())
- {
- out << nl << "final String __type" << iter << " = "
- << getAbsolute(cl, package, "_", "Disp") << ".ice_staticId();";
- }
- else
- {
- out << nl << "final String __type" << iter << " = " << origContentS << ".ice_staticId();";
- }
- }
- }
out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __len" << iter << "; __i" << iter
<< "++)";
out << sb;
@@ -2482,32 +2828,12 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
bool isObject = false;
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(origContent);
- if((b && (b->kind() == Builtin::KindObject || b->kind() == Builtin::KindValue)) || cl)
+ if((b && b->usesClasses()) || cl)
{
isObject = true;
}
out << nl << "final int __len" << iter << " = " << stream << ".readAndCheckSeqSize("
<< type->minWireSize() << ");";
- if(isObject)
- {
- if(b)
- {
- out << nl << "final String __type" << iter << " = Ice.ObjectImpl.ice_staticId();";
- }
- else
- {
- assert(cl);
- if(cl->isInterface())
- {
- out << nl << "final String __type" << iter << " = "
- << getAbsolute(cl, package, "_", "Disp") << ".ice_staticId();";
- }
- else
- {
- out << nl << "final String __type" << iter << " = " << origContentS << ".ice_staticId();";
- }
- }
- }
//
// We cannot allocate an array of a generic type, such as
//
@@ -2574,7 +2900,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
bool
-Slice::JavaGenerator::findMetaData(const string& prefix, const StringList& metaData, string& value)
+Slice::JavaCompatGenerator::findMetaData(const string& prefix, const StringList& metaData, string& value)
{
for(StringList::const_iterator q = metaData.begin(); q != metaData.end(); ++q)
{
@@ -2589,7 +2915,7 @@ Slice::JavaGenerator::findMetaData(const string& prefix, const StringList& metaD
}
bool
-Slice::JavaGenerator::getTypeMetaData(const StringList& metaData, string& instanceType, string& formalType)
+Slice::JavaCompatGenerator::getTypeMetaData(const StringList& metaData, string& instanceType, string& formalType)
{
//
// Extract the instance type and an optional formal type.
@@ -2617,7 +2943,7 @@ Slice::JavaGenerator::getTypeMetaData(const StringList& metaData, string& instan
}
bool
-Slice::JavaGenerator::hasTypeMetaData(const TypePtr& type, const StringList& localMetaData)
+Slice::JavaCompatGenerator::hasTypeMetaData(const TypePtr& type, const StringList& localMetaData)
{
ContainedPtr cont = ContainedPtr::dynamicCast(type);
if(cont)
@@ -2672,11 +2998,11 @@ Slice::JavaGenerator::hasTypeMetaData(const TypePtr& type, const StringList& loc
}
bool
-Slice::JavaGenerator::getDictionaryTypes(const DictionaryPtr& dict,
- const string& package,
- const StringList& metaData,
- string& instanceType,
- string& formalType) const
+Slice::JavaCompatGenerator::getDictionaryTypes(const DictionaryPtr& dict,
+ const string& package,
+ const StringList& metaData,
+ string& instanceType,
+ string& formalType) const
{
//
// Get the types of the key and value.
@@ -2707,11 +3033,11 @@ Slice::JavaGenerator::getDictionaryTypes(const DictionaryPtr& dict,
}
bool
-Slice::JavaGenerator::getSequenceTypes(const SequencePtr& seq,
- const string& package,
- const StringList& metaData,
- string& instanceType,
- string& formalType) const
+Slice::JavaCompatGenerator::getSequenceTypes(const SequencePtr& seq,
+ const string& package,
+ const StringList& metaData,
+ string& instanceType,
+ string& formalType) const
{
BuiltinPtr builtin = BuiltinPtr::dynamicCast(seq->type());
if(builtin)
@@ -2770,7 +3096,7 @@ Slice::JavaGenerator::getSequenceTypes(const SequencePtr& seq,
}
bool
-Slice::JavaGenerator::sequenceHasHolder(const SequencePtr& p) const
+Slice::JavaCompatGenerator::sequenceHasHolder(const SequencePtr& p) const
{
BuiltinPtr builtin = BuiltinPtr::dynamicCast(p->type());
if(builtin && builtin->kind() == Builtin::KindByte)
@@ -2806,331 +3132,2181 @@ Slice::JavaGenerator::sequenceHasHolder(const SequencePtr& p) const
JavaOutput*
-Slice::JavaGenerator::createOutput()
+Slice::JavaCompatGenerator::createOutput()
{
return new JavaOutput;
}
void
-Slice::JavaGenerator::validateMetaData(const UnitPtr& u)
+Slice::JavaCompatGenerator::validateMetaData(const UnitPtr& u)
{
MetaDataVisitor visitor;
u->visit(&visitor, true);
}
-bool
-Slice::JavaGenerator::MetaDataVisitor::visitUnitStart(const UnitPtr& p)
+const string Slice::JavaGenerator::_getSetMetaData = "java:getset";
+
+Slice::JavaGenerator::JavaGenerator(const string& dir) :
+ _dir(dir),
+ _out(0)
{
- static const string prefix = "java:";
+}
+
+Slice::JavaGenerator::~JavaGenerator()
+{
+ // If open throws an exception other generators could be left open
+ // during the stack unwind.
+ if(_out != 0)
+ {
+ close();
+ }
+ assert(_out == 0);
+}
+
+void
+Slice::JavaGenerator::open(const string& absolute, const string& file)
+{
+ assert(_out == 0);
+
+ JavaOutput* out = createOutput();
+ try
+ {
+ out->openClass(absolute, _dir, file);
+ }
+ catch(const FileException&)
+ {
+ delete out;
+ throw;
+ }
+ _out = out;
+}
+
+void
+Slice::JavaGenerator::close()
+{
+ assert(_out != 0);
+ *_out << nl;
+ delete _out;
+ _out = 0;
+}
+
+Output&
+Slice::JavaGenerator::output() const
+{
+ assert(_out != 0);
+ return *_out;
+}
+
+//
+// If the passed name is a scoped name, return the identical scoped name,
+// but with all components that are Java keywords replaced by
+// their "_"-prefixed version; otherwise, if the passed name is
+// not scoped, but a Java keyword, return the "_"-prefixed name;
+// otherwise, return the name unchanged.
+//
+string
+Slice::JavaGenerator::fixKwd(const string& name) const
+{
+ if(name.empty())
+ {
+ return name;
+ }
+ if(name[0] != ':')
+ {
+ return lookupKwd(name);
+ }
+ StringList ids = splitScopedName(name);
+ transform(ids.begin(), ids.end(), ids.begin(), ptr_fun(lookupKwd));
+ stringstream result;
+ for(StringList::const_iterator i = ids.begin(); i != ids.end(); ++i)
+ {
+ result << "::" + *i;
+ }
+ return result.str();
+}
+
+string
+Slice::JavaGenerator::convertScopedName(const string& scoped, const string& prefix, const string& suffix) const
+{
+ string result;
+ string::size_type start = 0;
+ string fscoped = fixKwd(scoped);
//
- // Validate global metadata in the top-level file and all included files.
+ // Skip leading "::"
//
- StringList files = p->allFiles();
+ if(fscoped[start] == ':')
+ {
+ assert(fscoped[start + 1] == ':');
+ start += 2;
+ }
- for(StringList::iterator q = files.begin(); q != files.end(); ++q)
+ //
+ // Convert all occurrences of "::" to "."
+ //
+ string::size_type pos;
+ do
{
- string file = *q;
- DefinitionContextPtr dc = p->findDefinitionContext(file);
- assert(dc);
- StringList globalMetaData = dc->getMetaData();
- for(StringList::const_iterator r = globalMetaData.begin(); r != globalMetaData.end(); ++r)
+ pos = fscoped.find(':', start);
+ string fix;
+ if(pos == string::npos)
{
- string s = *r;
- if(_history.count(s) == 0)
+ string s = fscoped.substr(start);
+ if(!s.empty())
{
- if(s.find(prefix) == 0)
- {
- bool ok = false;
-
- static const string packagePrefix = "java:package:";
- if(s.find(packagePrefix) == 0 && s.size() > packagePrefix.size())
- {
- ok = true;
- }
-
- if(!ok)
- {
- emitWarning(file, "", "ignoring invalid global metadata `" + s + "'");
- }
- }
- _history.insert(s);
+ fix = prefix + fixKwd(s) + suffix;
}
}
+ else
+ {
+ assert(fscoped[pos + 1] == ':');
+ fix = fixKwd(fscoped.substr(start, pos - start));
+ start = pos + 2;
+ }
+
+ if(!result.empty() && !fix.empty())
+ {
+ result += ".";
+ }
+ result += fix;
}
- return true;
+ while(pos != string::npos);
+
+ return result;
}
-bool
-Slice::JavaGenerator::MetaDataVisitor::visitModuleStart(const ModulePtr& p)
+string
+Slice::JavaGenerator::getPackagePrefix(const ContainedPtr& cont) const
{
- StringList metaData = getMetaData(p);
- validateType(p, metaData, p->file(), p->line());
- validateGetSet(p, metaData, p->file(), p->line());
- return true;
+ UnitPtr unit = cont->container()->unit();
+ string file = cont->file();
+ assert(!file.empty());
+
+ map<string, string>::const_iterator p = _filePackagePrefix.find(file);
+ if(p != _filePackagePrefix.end())
+ {
+ return p->second;
+ }
+
+ static const string prefix = "java:package:";
+ DefinitionContextPtr dc = unit->findDefinitionContext(file);
+ assert(dc);
+ string q = dc->findMetaData(prefix);
+ if(!q.empty())
+ {
+ q = q.substr(prefix.size());
+ }
+ _filePackagePrefix[file] = q;
+ return q;
}
-void
-Slice::JavaGenerator::MetaDataVisitor::visitClassDecl(const ClassDeclPtr& p)
+string
+Slice::JavaGenerator::getPackage(const ContainedPtr& cont) const
{
- StringList metaData = getMetaData(p);
- validateType(p, metaData, p->file(), p->line());
- validateGetSet(p, metaData, p->file(), p->line());
+ string scope = convertScopedName(cont->scope());
+ string prefix = getPackagePrefix(cont);
+ if(!prefix.empty())
+ {
+ if(!scope.empty())
+ {
+ return prefix + "." + scope;
+ }
+ else
+ {
+ return prefix;
+ }
+ }
+
+ return scope;
}
-bool
-Slice::JavaGenerator::MetaDataVisitor::visitClassDefStart(const ClassDefPtr& p)
+string
+Slice::JavaGenerator::getAbsolute(const ContainedPtr& cont,
+ const string& package,
+ const string& prefix,
+ const string& suffix) const
{
- StringList metaData = getMetaData(p);
- validateType(p, metaData, p->file(), p->line());
- validateGetSet(p, metaData, p->file(), p->line());
- return true;
+ string name = cont->name();
+ if(prefix == "" && suffix == "")
+ {
+ name = fixKwd(name);
+ }
+ string contPkg = getPackage(cont);
+ if(contPkg == package)
+ {
+ return prefix + name + suffix;
+ }
+ else if(!contPkg.empty())
+ {
+ return contPkg + "." + prefix + name + suffix;
+ }
+ else
+ {
+ return prefix + name + suffix;
+ }
}
-bool
-Slice::JavaGenerator::MetaDataVisitor::visitExceptionStart(const ExceptionPtr& p)
+string
+Slice::JavaGenerator::getStaticId(const TypePtr& type, const string& package) const
{
- StringList metaData = getMetaData(p);
- validateType(p, metaData, p->file(), p->line());
- validateGetSet(p, metaData, p->file(), p->line());
- return true;
+ BuiltinPtr b = BuiltinPtr::dynamicCast(type);
+ ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
+
+ assert((b && b->usesClasses()) || cl);
+
+ if(b && b->kind() == Builtin::KindObject)
+ {
+ return "com.zeroc.Ice.Object.ice_staticId";
+ }
+ else if(b && b->kind() == Builtin::KindValue)
+ {
+ return "com.zeroc.Ice.Value.ice_staticId";
+ }
+ else
+ {
+ return getAbsolute(cl, package) + ".ice_staticId";
+ }
}
bool
-Slice::JavaGenerator::MetaDataVisitor::visitStructStart(const StructPtr& p)
+Slice::JavaGenerator::useOptionalMapping(const OperationPtr& p)
{
- StringList metaData = getMetaData(p);
- validateType(p, metaData, p->file(), p->line());
- validateGetSet(p, metaData, p->file(), p->line());
- return true;
+ //
+ // The "java:optional" metadata can be applied to an operation or its
+ // interface to force the mapping to use the Optional types.
+ //
+ // Without the tag, parameters use the normal (non-optional) mapping.
+ //
+ static const string tag = "java:optional";
+
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(p->container());
+ assert(cl);
+
+ return p->hasMetaData(tag) || cl->hasMetaData(tag);
}
-void
-Slice::JavaGenerator::MetaDataVisitor::visitOperation(const OperationPtr& p)
+string
+Slice::JavaGenerator::getOptionalFormat(const TypePtr& type)
{
- if(p->hasMetaData("UserException"))
+ const string prefix = "com.zeroc.Ice.OptionalFormat.";
+
+ BuiltinPtr bp = BuiltinPtr::dynamicCast(type);
+ if(bp)
{
- ClassDefPtr cl = ClassDefPtr::dynamicCast(p->container());
- if(!cl->isLocal())
+ switch(bp->kind())
+ {
+ case Builtin::KindByte:
+ case Builtin::KindBool:
+ {
+ return prefix + "F1";
+ }
+ case Builtin::KindShort:
+ {
+ return prefix + "F2";
+ }
+ case Builtin::KindInt:
+ case Builtin::KindFloat:
+ {
+ return prefix + "F4";
+ }
+ case Builtin::KindLong:
+ case Builtin::KindDouble:
+ {
+ return prefix + "F8";
+ }
+ case Builtin::KindString:
+ {
+ return prefix + "VSize";
+ }
+ case Builtin::KindObject:
{
- ostringstream os;
- os << "ignoring invalid metadata `UserException': directive applies only to local operations "
- << "but enclosing " << (cl->isInterface() ? "interface" : "class") << " `" << cl->name()
- << "' is not local";
- emitWarning(p->file(), p->line(), os.str());
+ return prefix + "Class";
+ }
+ case Builtin::KindObjectProxy:
+ {
+ return prefix + "FSize";
+ }
+ case Builtin::KindLocalObject:
+ {
+ assert(false);
+ break;
+ }
+ case Builtin::KindValue:
+ {
+ return prefix + "Class";
+ }
}
}
- StringList metaData = getMetaData(p);
- TypePtr returnType = p->returnType();
- if(!metaData.empty())
+
+ if(EnumPtr::dynamicCast(type))
+ {
+ return prefix + "Size";
+ }
+
+ SequencePtr seq = SequencePtr::dynamicCast(type);
+ if(seq)
{
- if(!returnType)
+ return seq->type()->isVariableLength() ? prefix + "FSize" : prefix + "VSize";
+ }
+
+ DictionaryPtr d = DictionaryPtr::dynamicCast(type);
+ if(d)
+ {
+ return (d->keyType()->isVariableLength() || d->valueType()->isVariableLength()) ?
+ prefix + "FSize" : prefix + "VSize";
+ }
+
+ StructPtr st = StructPtr::dynamicCast(type);
+ if(st)
+ {
+ return st->isVariableLength() ? prefix + "FSize" : prefix + "VSize";
+ }
+
+ if(ProxyPtr::dynamicCast(type))
+ {
+ return prefix + "FSize";
+ }
+
+ ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
+ assert(cl);
+ return prefix + "Class";
+}
+
+string
+Slice::JavaGenerator::typeToString(const TypePtr& type,
+ TypeMode mode,
+ const string& package,
+ const StringList& metaData,
+ bool formal,
+ bool optional,
+ bool local) const
+{
+ static const char* builtinTable[] =
+ {
+ "byte",
+ "boolean",
+ "short",
+ "int",
+ "long",
+ "float",
+ "double",
+ "String",
+ "com.zeroc.Ice.Value",
+ "com.zeroc.Ice.ObjectPrx",
+ "java.lang.Object",
+ "com.zeroc.Ice.Value"
+ };
+ static const char* builtinLocalTable[] =
+ {
+ "byte",
+ "boolean",
+ "short",
+ "int",
+ "long",
+ "float",
+ "double",
+ "String",
+ "com.zeroc.Ice.Object",
+ "com.zeroc.Ice.ObjectPrx",
+ "java.lang.Object",
+ "com.zeroc.Ice.Value"
+ };
+ static const char* builtinOptionalTable[] =
+ {
+ "java.util.Optional<java.lang.Byte>",
+ "java.util.Optional<java.lang.Boolean>",
+ "java.util.Optional<java.lang.Short>",
+ "java.util.OptionalInt",
+ "java.util.OptionalLong",
+ "java.util.Optional<java.lang.Float>",
+ "java.util.OptionalDouble",
+ "???",
+ "???",
+ "???",
+ "???",
+ "???"
+ };
+
+ if(!type)
+ {
+ assert(mode == TypeModeReturn);
+ return "void";
+ }
+
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
+ if(builtin)
+ {
+ if(optional)
{
- for(StringList::const_iterator q = metaData.begin(); q != metaData.end(); ++q)
+ switch(builtin->kind())
{
- if(q->find("java:type:", 0) == 0)
+ case Builtin::KindByte:
+ case Builtin::KindBool:
+ case Builtin::KindShort:
+ case Builtin::KindInt:
+ case Builtin::KindLong:
+ case Builtin::KindFloat:
+ case Builtin::KindDouble:
+ {
+ return builtinOptionalTable[builtin->kind()];
+ }
+ case Builtin::KindString:
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ case Builtin::KindLocalObject:
+ case Builtin::KindValue:
{
- emitWarning(p->file(), p->line(), "ignoring invalid metadata `" + *q +
- "' for operation with void return type");
break;
}
}
}
else
{
- validateType(returnType, metaData, p->file(), p->line());
+ return local ? builtinLocalTable[builtin->kind()] : builtinTable[builtin->kind()];
+ }
+ }
+
+ ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
+
+ if(optional)
+ {
+ return "java.util.Optional<" + typeToObjectString(type, mode, package, metaData, formal, local) + ">";
+ }
+
+ if(cl)
+ {
+ if(cl->isInterface() && !local)
+ {
+ return "com.zeroc.Ice.Value";
+ }
+ else
+ {
+ return getAbsolute(cl, package);
}
}
- ParamDeclList params = p->parameters();
- for(ParamDeclList::iterator q = params.begin(); q != params.end(); ++q)
+ ProxyPtr proxy = ProxyPtr::dynamicCast(type);
+ if(proxy)
+ {
+ ClassDefPtr def = proxy->_class()->definition();
+ assert(def);
+ if(def->isAbstract())
+ {
+ return getAbsolute(proxy->_class(), package, "", "Prx");
+ }
+ else
+ {
+ return "com.zeroc.Ice.ObjectPrx";
+ }
+ }
+
+ DictionaryPtr dict = DictionaryPtr::dynamicCast(type);
+ if(dict)
{
- metaData = getMetaData(*q);
- validateType((*q)->type(), metaData, p->file(), (*q)->line());
+ string instanceType, formalType;
+ getDictionaryTypes(dict, package, metaData, instanceType, formalType, local);
+ return formal ? formalType : instanceType;
}
- validateGetSet(p, metaData, p->file(), p->line());
+ SequencePtr seq = SequencePtr::dynamicCast(type);
+ if(seq)
+ {
+ string instanceType, formalType;
+ getSequenceTypes(seq, package, metaData, instanceType, formalType, local);
+ return formal ? formalType : instanceType;
+ }
+
+ ContainedPtr contained = ContainedPtr::dynamicCast(type);
+ if(contained)
+ {
+ if(mode == TypeModeOut)
+ {
+ return getAbsolute(contained, package, "", "Holder");
+ }
+ else
+ {
+ return getAbsolute(contained, package);
+ }
+ }
+
+ return "???";
}
-void
-Slice::JavaGenerator::MetaDataVisitor::visitDataMember(const DataMemberPtr& p)
+string
+Slice::JavaGenerator::typeToObjectString(const TypePtr& type,
+ TypeMode mode,
+ const string& package,
+ const StringList& metaData,
+ bool formal,
+ bool local) const
{
- StringList metaData = getMetaData(p);
- validateType(p->type(), metaData, p->file(), p->line());
- validateGetSet(p, metaData, p->file(), p->line());
+ static const char* builtinTable[] =
+ {
+ "java.lang.Byte",
+ "java.lang.Boolean",
+ "java.lang.Short",
+ "java.lang.Integer",
+ "java.lang.Long",
+ "java.lang.Float",
+ "java.lang.Double",
+ "java.lang.String",
+ "com.zeroc.Ice.Value",
+ "com.zeroc.Ice.ObjectPrx",
+ "java.lang.Object",
+ "com.zeroc.Ice.Value"
+ };
+ static const char* builtinLocalTable[] =
+ {
+ "java.lang.Byte",
+ "java.lang.Boolean",
+ "java.lang.Short",
+ "java.lang.Integer",
+ "java.lang.Long",
+ "java.lang.Float",
+ "java.lang.Double",
+ "java.lang.String",
+ "com.zeroc.Ice.Object",
+ "com.zeroc.Ice.ObjectPrx",
+ "java.lang.Object",
+ "com.zeroc.Ice.Value"
+ };
+
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
+ if(builtin && mode != TypeModeOut)
+ {
+ return local ? builtinLocalTable[builtin->kind()] : builtinTable[builtin->kind()];
+ }
+
+ return typeToString(type, mode, package, metaData, formal, false, local);
}
void
-Slice::JavaGenerator::MetaDataVisitor::visitSequence(const SequencePtr& p)
+Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
+ const string& package,
+ const TypePtr& type,
+ OptionalMode mode,
+ bool optionalMapping,
+ int tag,
+ const string& param,
+ bool marshal,
+ int& iter,
+ const StringList& metaData,
+ const string& patchParams)
{
- static const string protobuf = "java:protobuf:";
- static const string serializable = "java:serializable:";
- static const string bytebuffer = "java:buffer";
- StringList metaData = getMetaData(p);
- const string file = p->file();
- const string line = p->line();
- for(StringList::const_iterator q = metaData.begin(); q != metaData.end(); )
+ const string stream = marshal ? "__os" : "__is";
+ const bool optionalParam = mode == OptionalInParam || mode == OptionalOutParam || mode == OptionalReturnParam;
+
+ const BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
+ if(builtin)
{
- string s = *q++;
- if(_history.count(s) == 0) // Don't complain about the same metadata more than once.
+ switch(builtin->kind())
{
- if(s.find(protobuf) == 0 || s.find(serializable) == 0)
+ case Builtin::KindByte:
{
- //
- // Remove from list so validateType does not try to handle as well.
- //
- metaData.remove(s);
+ if(marshal)
+ {
+ if(optionalParam)
+ {
+ out << nl << stream << ".writeByte(" << tag << ", " << param << ");";
+ }
+ else
+ {
+ out << nl << stream << ".writeByte(" << param << ");";
+ }
+ }
+ else
+ {
+ if(optionalParam)
+ {
+ out << nl << param << " = " << stream << ".readByte(" << tag << ");";
+ }
+ else
+ {
+ out << nl << param << " = " << stream << ".readByte();";
+ }
+ }
+ break;
+ }
+ case Builtin::KindBool:
+ {
+ if(marshal)
+ {
+ if(optionalParam)
+ {
+ out << nl << stream << ".writeBool(" << tag << ", " << param << ");";
+ }
+ else
+ {
+ out << nl << stream << ".writeBool(" << param << ");";
+ }
+ }
+ else
+ {
+ if(optionalParam)
+ {
+ out << nl << param << " = " << stream << ".readBool(" << tag << ");";
+ }
+ else
+ {
+ out << nl << param << " = " << stream << ".readBool();";
+ }
+ }
+ break;
+ }
+ case Builtin::KindShort:
+ {
+ if(marshal)
+ {
+ if(optionalParam)
+ {
+ out << nl << stream << ".writeShort(" << tag << ", " << param << ");";
+ }
+ else
+ {
+ out << nl << stream << ".writeShort(" << param << ");";
+ }
+ }
+ else
+ {
+ if(optionalParam)
+ {
+ out << nl << param << " = " << stream << ".readShort(" << tag << ");";
+ }
+ else
+ {
+ out << nl << param << " = " << stream << ".readShort();";
+ }
+ }
+ break;
+ }
+ case Builtin::KindInt:
+ {
+ if(marshal)
+ {
+ if(optionalParam)
+ {
+ out << nl << stream << ".writeInt(" << tag << ", " << param << ");";
+ }
+ else
+ {
+ out << nl << stream << ".writeInt(" << param << ");";
+ }
+ }
+ else
+ {
+ if(optionalParam)
+ {
+ out << nl << param << " = " << stream << ".readInt(" << tag << ");";
+ }
+ else
+ {
+ out << nl << param << " = " << stream << ".readInt();";
+ }
+ }
+ break;
+ }
+ case Builtin::KindLong:
+ {
+ if(marshal)
+ {
+ if(optionalParam)
+ {
+ out << nl << stream << ".writeLong(" << tag << ", " << param << ");";
+ }
+ else
+ {
+ out << nl << stream << ".writeLong(" << param << ");";
+ }
+ }
+ else
+ {
+ if(optionalParam)
+ {
+ out << nl << param << " = " << stream << ".readLong(" << tag << ");";
+ }
+ else
+ {
+ out << nl << param << " = " << stream << ".readLong();";
+ }
+ }
+ break;
+ }
+ case Builtin::KindFloat:
+ {
+ if(marshal)
+ {
+ if(optionalParam)
+ {
+ out << nl << stream << ".writeFloat(" << tag << ", " << param << ");";
+ }
+ else
+ {
+ out << nl << stream << ".writeFloat(" << param << ");";
+ }
+ }
+ else
+ {
+ if(optionalParam)
+ {
+ out << nl << param << " = " << stream << ".readFloat(" << tag << ");";
+ }
+ else
+ {
+ out << nl << param << " = " << stream << ".readFloat();";
+ }
+ }
+ break;
+ }
+ case Builtin::KindDouble:
+ {
+ if(marshal)
+ {
+ if(optionalParam)
+ {
+ out << nl << stream << ".writeDouble(" << tag << ", " << param << ");";
+ }
+ else
+ {
+ out << nl << stream << ".writeDouble(" << param << ");";
+ }
+ }
+ else
+ {
+ if(optionalParam)
+ {
+ out << nl << param << " = " << stream << ".readDouble(" << tag << ");";
+ }
+ else
+ {
+ out << nl << param << " = " << stream << ".readDouble();";
+ }
+ }
+ break;
+ }
+ case Builtin::KindString:
+ {
+ if(marshal)
+ {
+ if(optionalParam)
+ {
+ out << nl << stream << ".writeString(" << tag << ", " << param << ");";
+ }
+ else
+ {
+ out << nl << stream << ".writeString(" << param << ");";
+ }
+ }
+ else
+ {
+ if(optionalParam)
+ {
+ out << nl << param << " = " << stream << ".readString(" << tag << ");";
+ }
+ else
+ {
+ out << nl << param << " = " << stream << ".readString();";
+ }
+ }
+ break;
+ }
+ case Builtin::KindObject:
+ case Builtin::KindValue:
+ {
+ if(marshal)
+ {
+ if(optionalParam)
+ {
+ out << nl << stream << ".writeValue(" << tag << ", " << param << ");";
+ }
+ else
+ {
+ out << nl << stream << ".writeValue(" << param << ");";
+ }
+ }
+ else
+ {
+ assert(!patchParams.empty());
+ if(optionalParam)
+ {
+ out << nl << stream << ".readValue(" << tag << ", " << patchParams << ");";
+ }
+ else
+ {
+ out << nl << stream << ".readValue(" << patchParams << ");";
+ }
+ }
+ break;
+ }
+ case Builtin::KindObjectProxy:
+ {
+ if(marshal)
+ {
+ if(optionalParam)
+ {
+ out << nl << stream << ".writeProxy(" << tag << ", " << param << ");";
+ }
+ else if(mode == OptionalMember)
+ {
+ out << nl << "int __pos = " << stream << ".startSize();";
+ out << nl << stream << ".writeProxy(" << param << ");";
+ out << nl << stream << ".endSize(__pos);";
+ }
+ else
+ {
+ out << nl << stream << ".writeProxy(" << param << ");";
+ }
+ }
+ else
+ {
+ if(optionalParam)
+ {
+ out << nl << param << " = " << stream << ".readProxy(" << tag << ");";
+ }
+ else if(mode == OptionalMember)
+ {
+ out << nl << stream << ".skip(4);";
+ out << nl << param << " = " << stream << ".readProxy();";
+ }
+ else
+ {
+ out << nl << param << " = " << stream << ".readProxy();";
+ }
+ }
+ break;
+ }
+ case Builtin::KindLocalObject:
+ {
+ assert(false);
+ break;
+ }
+ }
+ return;
+ }
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(p->type());
- if(!builtin || builtin->kind() != Builtin::KindByte)
+ ProxyPtr prx = ProxyPtr::dynamicCast(type);
+ if(prx)
+ {
+ string typeS = typeToString(type, TypeModeIn, package);
+ if(marshal)
+ {
+ if(optionalParam)
+ {
+ if(optionalMapping)
{
- _history.insert(s);
- emitWarning(file, line, "ignoring invalid metadata `" + s + "': " +
- "this metadata can only be used with a byte sequence");
+ out << nl << "if(" << param << " != null && " << param << ".isPresent() && " << stream
+ << ".writeOptional(" << tag << ", " << getOptionalFormat(type) << "))";
+ out << sb;
+ out << nl << "int __pos = " << stream << ".startSize();";
+ out << nl << stream << ".writeProxy(" << param << ".get());";
+ out << nl << stream << ".endSize(__pos);";
+ out << eb;
+ }
+ else
+ {
+ out << nl << "if(" << stream << ".writeOptional(" << tag << ", " << getOptionalFormat(type) << "))";
+ out << sb;
+ out << nl << "int __pos = " << stream << ".startSize();";
+ out << nl << stream << ".writeProxy(" << param << ");";
+ out << nl << stream << ".endSize(__pos);";
+ out << eb;
}
}
- else if(s.find(bytebuffer) == 0)
+ else if(mode == OptionalMember)
+ {
+ out << nl << "int __pos = " << stream << ".startSize();";
+ out << nl << stream << ".writeProxy(" << param << ");";
+ out << nl << stream << ".endSize(__pos);";
+ }
+ else
+ {
+ out << nl << stream << ".writeProxy(" << param << ");";
+ }
+ }
+ else
+ {
+ if(optionalParam)
+ {
+ out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(type) << "))";
+ out << sb;
+ out << nl << stream << ".skip(4);";
+ out << nl << param << " = java.util.Optional.ofNullable(" << typeS << ".uncheckedCast(" << stream
+ << ".readProxy()));";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << param << " = java.util.Optional.empty();";
+ out << eb;
+ }
+ else if(mode == OptionalMember)
+ {
+ out << nl << stream << ".skip(4);";
+ out << nl << param << " = " << typeS << ".uncheckedCast(" << stream << ".readProxy());";
+ }
+ else
{
- metaData.remove(s);
+ out << nl << param << " = " << typeS << ".uncheckedCast(" << stream << ".readProxy());";
+ }
+ }
+ return;
+ }
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(p->type());
- if(!builtin ||
- (builtin->kind() != Builtin::KindByte && builtin->kind() != Builtin::KindShort &&
- builtin->kind() != Builtin::KindInt && builtin->kind() != Builtin::KindLong &&
- builtin->kind() != Builtin::KindFloat && builtin->kind() != Builtin::KindDouble))
+ ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
+ if(cl)
+ {
+ if(marshal)
+ {
+ if(optionalParam)
+ {
+ out << nl << stream << ".writeValue(" << tag << ", " << param << ");";
+ }
+ else
+ {
+ out << nl << stream << ".writeValue(" << param << ");";
+ }
+ }
+ else
+ {
+ assert(!patchParams.empty());
+ if(optionalParam)
+ {
+ out << nl << stream << ".readValue(" << tag << ", " << patchParams << ");";
+ }
+ else
+ {
+ out << nl << stream << ".readValue(" << patchParams << ");";
+ }
+ }
+ return;
+ }
+
+ StructPtr st = StructPtr::dynamicCast(type);
+ if(st)
+ {
+ string typeS = typeToString(type, TypeModeIn, package, metaData);
+ if(marshal)
+ {
+ if(optionalParam || mode == OptionalMember)
+ {
+ string val;
+ if(optionalParam)
{
- _history.insert(s);
- emitWarning(file, line, "ignoring invalid metadata `" + s + "': " +
- "this metadata can not be used with this type");
+ if(optionalMapping)
+ {
+ out << nl << "if(" << param << " != null && " << param << ".isPresent() && " << stream
+ << ".writeOptional(" << tag << ", " << getOptionalFormat(type) << "))";
+ val = param + ".get()";
+ }
+ else
+ {
+ out << nl << "if(" << stream << ".writeOptional(" << tag << ", " << getOptionalFormat(type)
+ << "))";
+ val = param;
+ }
+ out << sb;
+ }
+ else
+ {
+ val = param;
+ }
+
+ if(st->isVariableLength())
+ {
+ out << nl << "int __pos = " << stream << ".startSize();";
+ out << nl << typeS << ".write(" << stream << ", " << val << ");";
+ out << nl << stream << ".endSize(__pos);";
+ }
+ else
+ {
+ out << nl << stream << ".writeSize(" << st->minWireSize() << ");";
+ out << nl << typeS << ".write(" << stream << ", " << val << ");";
+ }
+ if(optionalParam)
+ {
+ out << eb;
+ }
+ }
+ else
+ {
+ out << nl << typeS << ".write(" << stream << ", " << param << ");";
+ }
+ }
+ else
+ {
+ if(optionalParam)
+ {
+ out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(type) << "))";
+ out << sb;
+
+ if(st->isVariableLength())
+ {
+ out << nl << stream << ".skip(4);";
+ }
+ else
+ {
+ out << nl << stream << ".skipSize();";
+ }
+
+ out << nl << param << " = java.util.Optional.of(" << typeS << ".read(" << stream
+ << ", null));";
+
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << param << " = java.util.Optional.empty();";
+ out << eb;
+ }
+ else if(mode == OptionalMember)
+ {
+ if(st->isVariableLength())
+ {
+ out << nl << stream << ".skip(4);";
+ }
+ else
+ {
+ out << nl << stream << ".skipSize();";
}
+ out << nl << param << " = " << typeS << ".read(" << stream << ", " << param << ");";
+ }
+ else
+ {
+ out << nl << param << " = " << typeS << ".read(" << stream << ", " << param << ");";
}
}
+ return;
}
- validateType(p, metaData, file, line);
- validateGetSet(p, metaData, file, line);
-}
+ EnumPtr en = EnumPtr::dynamicCast(type);
+ if(en)
+ {
+ string typeS = typeToString(type, TypeModeIn, package, metaData);
+ if(marshal)
+ {
+ if(optionalParam)
+ {
+ if(optionalMapping)
+ {
+ out << nl << "if(" << param << " != null && " << param << ".isPresent() && " << stream
+ << ".writeOptional(" << tag << ", " << getOptionalFormat(type) << "))";
+ out << sb;
+ out << nl << typeS << ".write(" << stream << ", " << param << ".get());";
+ out << eb;
+ }
+ else
+ {
+ out << nl << "if(" << stream << ".writeOptional(" << tag << ", " << getOptionalFormat(type) << "))";
+ out << sb;
+ out << nl << typeS << ".write(" << stream << ", " << param << ");";
+ out << eb;
+ }
+ }
+ else
+ {
+ out << nl << typeS << ".write(" << stream << ", " << param << ");";
+ }
+ }
+ else
+ {
+ if(optionalParam)
+ {
+ out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(type) << "))";
+ out << sb;
+ out << nl << param << " = java.util.Optional.of(" << typeS << ".read(" << stream << "));";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << param << " = java.util.Optional.empty();";
+ out << eb;
+ }
+ else
+ {
+ out << nl << param << " = " << typeS << ".read(" << stream << ");";
+ }
+ }
+ return;
+ }
-void
-Slice::JavaGenerator::MetaDataVisitor::visitDictionary(const DictionaryPtr& p)
-{
- StringList metaData = getMetaData(p);
- validateType(p, metaData, p->file(), p->line());
- validateGetSet(p, metaData, p->file(), p->line());
-}
+ DictionaryPtr dict = DictionaryPtr::dynamicCast(type);
+ if(dict)
+ {
+ if(optionalParam || mode == OptionalMember)
+ {
+ string typeS = typeToString(type, TypeModeIn, package, metaData);
+ TypePtr keyType = dict->keyType();
+ TypePtr valueType = dict->valueType();
-void
-Slice::JavaGenerator::MetaDataVisitor::visitEnum(const EnumPtr& p)
-{
- StringList metaData = getMetaData(p);
- validateType(p, metaData, p->file(), p->line());
- validateGetSet(p, metaData, p->file(), p->line());
-}
+ if(marshal)
+ {
+ if(optionalParam)
+ {
+ if(optionalMapping)
+ {
+ out << nl << "if(" << param << " != null && " << param << ".isPresent() && " << stream
+ << ".writeOptional(" << tag << ", " << getOptionalFormat(type) << "))";
+ out << sb;
+ }
+ else
+ {
+ out << nl << "if(" << stream << ".writeOptional(" << tag << ", " << getOptionalFormat(type)
+ << "))";
+ out << sb;
+ }
+ }
-void
-Slice::JavaGenerator::MetaDataVisitor::visitConst(const ConstPtr& p)
-{
- StringList metaData = getMetaData(p);
- validateType(p, metaData, p->file(), p->line());
- validateGetSet(p, metaData, p->file(), p->line());
-}
+ if(keyType->isVariableLength() || valueType->isVariableLength())
+ {
+ string d = optionalParam && optionalMapping ? param + ".get()" : param;
+ out << nl << "int __pos = " << stream << ".startSize();";
+ writeDictionaryMarshalUnmarshalCode(out, package, dict, d, marshal, iter, true, metaData);
+ out << nl << stream << ".endSize(__pos);";
+ }
+ else
+ {
+ const size_t wireSize = keyType->minWireSize() + valueType->minWireSize();
+ string tmpName;
+ if(optionalParam && optionalMapping)
+ {
+ tmpName = "__optDict";
+ out << nl << "final " << typeS << ' ' << tmpName << " = " << param << ".get();";
+ }
+ else
+ {
+ tmpName = param;
+ }
+ out << nl << "final int __optSize = " << tmpName << " == null ? 0 : " << tmpName << ".size();";
+ out << nl << stream << ".writeSize(__optSize > 254 ? __optSize * " << wireSize
+ << " + 5 : __optSize * " << wireSize << " + 1);";
+ writeDictionaryMarshalUnmarshalCode(out, package, dict, tmpName, marshal, iter, true, metaData);
+ }
-StringList
-Slice::JavaGenerator::MetaDataVisitor::getMetaData(const ContainedPtr& cont)
-{
- static const string prefix = "java:";
+ if(optionalParam)
+ {
+ out << eb;
+ }
+ }
+ else
+ {
+ string tmpName;
+
+ if(optionalParam)
+ {
+ tmpName = "__optDict";
+ out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(type) << "))";
+ out << sb;
+ out << nl << typeS << ' ' << tmpName << ';';
+ }
+ else
+ {
+ tmpName = param;
+ }
+
+ if(keyType->isVariableLength() || valueType->isVariableLength())
+ {
+ out << nl << stream << ".skip(4);";
+ }
+ else
+ {
+ out << nl << stream << ".skipSize();";
+ }
- StringList metaData = cont->getMetaData();
- StringList result;
+ writeDictionaryMarshalUnmarshalCode(out, package, dict, tmpName, marshal, iter, true, metaData);
+
+ if(optionalParam)
+ {
+ out << nl << param << " = java.util.Optional.of(" << tmpName << ");";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << param << " = java.util.Optional.empty();";
+ out << eb;
+ }
+ }
+ }
+ else
+ {
+ writeDictionaryMarshalUnmarshalCode(out, package, dict, param, marshal, iter, true, metaData);
+ }
+ return;
+ }
- for(StringList::const_iterator p = metaData.begin(); p != metaData.end(); ++p)
+ SequencePtr seq = SequencePtr::dynamicCast(type);
+ if(seq)
{
- string s = *p;
- if(_history.count(s) == 0) // Don't complain about the same metadata more than once.
+ if(optionalParam || mode == OptionalMember)
{
- if(s.find(prefix) == 0)
+ string typeS = typeToString(type, TypeModeIn, package, metaData);
+ TypePtr elemType = seq->type();
+ BuiltinPtr elemBuiltin = BuiltinPtr::dynamicCast(elemType);
+
+ if(optionalParam && elemBuiltin && elemBuiltin->kind() != Builtin::KindObject &&
+ elemBuiltin->kind() != Builtin::KindObjectProxy && elemBuiltin->kind() != Builtin::KindValue &&
+ !hasTypeMetaData(seq, metaData))
{
- string::size_type pos = s.find(':', prefix.size());
- if(pos == string::npos)
+ static const char* builtinTable[] =
+ {
+ "Byte",
+ "Bool",
+ "Short",
+ "Int",
+ "Long",
+ "Float",
+ "Double",
+ "String",
+ "???",
+ "???",
+ "???"
+ };
+
+ switch(elemBuiltin->kind())
{
- if(s.size() > prefix.size())
+ case Builtin::KindByte:
+ case Builtin::KindBool:
+ case Builtin::KindShort:
+ case Builtin::KindInt:
+ case Builtin::KindLong:
+ case Builtin::KindFloat:
+ case Builtin::KindDouble:
+ case Builtin::KindString:
{
- string rest = s.substr(prefix.size());
- if(rest == "getset")
+ string bs = builtinTable[elemBuiltin->kind()];
+
+ if(marshal)
{
- result.push_back(s);
+ out << nl << stream << ".write" << bs << "Seq(" << tag << ", " << param << ");";
}
- else if(rest == "buffer")
+ else
{
- result.push_back(s);
+ out << nl << param << " = " << stream << ".read" << bs << "Seq(" << tag << ");";
}
- continue;
+ return;
+ }
+ case Builtin::KindValue:
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ case Builtin::KindLocalObject:
+ {
+ assert(false);
+ break;
}
}
- else if(s.substr(prefix.size(), pos - prefix.size()) == "type")
+ }
+
+ string ignore;
+ const size_t wireSize = elemType->minWireSize();
+
+ if(marshal)
+ {
+ if(optionalParam)
{
- result.push_back(s);
- continue;
+ if(optionalMapping)
+ {
+ out << nl << "if(" << param << " != null && " << param << ".isPresent() && " << stream
+ << ".writeOptional(" << tag << ", " << getOptionalFormat(type) << "))";
+ }
+ else
+ {
+ out << nl << "if(" << stream << ".writeOptional(" << tag << ", " << getOptionalFormat(type)
+ << "))";
+ }
+
+ out << sb;
}
- else if(s.substr(prefix.size(), pos - prefix.size()) == "serializable")
+
+ if(elemType->isVariableLength())
{
- result.push_back(s);
- continue;
+ string s = optionalParam && optionalMapping ? param + ".get()" : param;
+ out << nl << "int __pos = " << stream << ".startSize();";
+ writeSequenceMarshalUnmarshalCode(out, package, seq, s, marshal, iter, true, metaData);
+ out << nl << stream << ".endSize(__pos);";
}
- else if(s.substr(prefix.size(), pos - prefix.size()) == "protobuf")
+ else if(findMetaData("java:type:", metaData, ignore) ||
+ findMetaData("java:type:", seq->getMetaData(), ignore))
{
- result.push_back(s);
- continue;
+ //
+ // The sequence is an instance of java.util.List<E>, where E is a fixed-size type.
+ // If the element type is bool or byte, we do NOT write an extra size.
+ //
+
+ string tmpName;
+ if(optionalParam && optionalMapping)
+ {
+ tmpName = "__optSeq";
+ out << nl << "final " << typeS << ' ' << tmpName << " = " << param << ".get();";
+ }
+ else
+ {
+ tmpName = param;
+ }
+
+ if(wireSize > 1)
+ {
+ out << nl << "final int __optSize = " << tmpName << " == null ? 0 : " << tmpName << ".size();";
+ out << nl << stream << ".writeSize(__optSize > 254 ? __optSize * " << wireSize
+ << " + 5 : __optSize * " << wireSize << " + 1);";
+ }
+ writeSequenceMarshalUnmarshalCode(out, package, seq, tmpName, marshal, iter, true, metaData);
}
- else if(s.substr(prefix.size(), pos - prefix.size()) == "serialVersionUID")
+ else if(findMetaData("java:protobuf:", seq->getMetaData(), ignore) ||
+ findMetaData("java:serializable:", seq->getMetaData(), ignore))
{
- result.push_back(s);
- continue;
+ //
+ // This just writes a byte sequence.
+ //
+ string s = optionalParam && optionalMapping ? param + ".get()" : param;
+ writeSequenceMarshalUnmarshalCode(out, package, seq, s, marshal, iter, true, metaData);
}
+ else
+ {
+ //
+ // At this point we have a regular Java array of a fixed-size type.
+ //
+
+ string tmpName;
+ if(optionalParam && optionalMapping)
+ {
+ tmpName = "__optSeq";
+ out << nl << "final " << typeS << ' ' << tmpName << " = " << param << ".get();";
+ }
+ else
+ {
+ tmpName = param;
+ }
+
+ if(wireSize > 1)
+ {
+ out << nl << "final int __optSize = " << tmpName << " == null ? 0 : " << tmpName << ".length;";
+ out << nl << stream << ".writeSize(__optSize > 254 ? __optSize * " << wireSize
+ << " + 5 : __optSize * " << wireSize << " + 1);";
+ }
- emitWarning(cont->file(), cont->line(), "ignoring invalid metadata `" + s + "'");
+ writeSequenceMarshalUnmarshalCode(out, package, seq, tmpName, marshal, iter, true, metaData);
+ }
+
+ if(optionalParam)
+ {
+ out << eb;
+ }
}
- else if(s == "delegate")
+ else
{
- result.push_back(s);
- continue;
+ string tmpName;
+ if(optionalParam)
+ {
+ tmpName = "__optSeq";
+ out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(type) << "))";
+ out << sb;
+ out << nl << typeS << ' ' << tmpName << ';';
+ }
+ else
+ {
+ tmpName = param;
+ }
+
+ if(elemType->isVariableLength())
+ {
+ out << nl << stream << ".skip(4);";
+ }
+ else if(wireSize > 1)
+ {
+ if(findMetaData("java:type:", metaData, ignore) ||
+ findMetaData("java:type:", seq->getMetaData(), ignore))
+ {
+ //
+ // The sequence is an instance of java.util.List<E>, where E is a fixed-size type.
+ //
+
+ out << nl << stream << ".skipSize();";
+ }
+ else if(!findMetaData("java:protobuf:", seq->getMetaData(), ignore) &&
+ !findMetaData("java:serializable:", seq->getMetaData(), ignore))
+ {
+ out << nl << stream << ".skipSize();";
+ }
+ }
+
+ writeSequenceMarshalUnmarshalCode(out, package, seq, tmpName, marshal, iter, true, metaData);
+
+ if(optionalParam)
+ {
+ out << nl << param << " = java.util.Optional.of(" << tmpName << ");";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << param << " = java.util.Optional.empty();";
+ out << eb;
+ }
}
+ }
+ else
+ {
+ writeSequenceMarshalUnmarshalCode(out, package, seq, param, marshal, iter, true, metaData);
+ }
+ return;
+ }
+
+ ConstructedPtr constructed = ConstructedPtr::dynamicCast(type);
+ assert(constructed);
+ string typeS = getAbsolute(constructed, package);
+ if(marshal)
+ {
+ out << nl << typeS << ".write(" << stream << ", " << param << ");";
+ }
+ else
+ {
+ out << nl << param << " = " << typeS << ".read(" << stream << ");";
+ }
+}
+
+void
+Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
+ const string& package,
+ const DictionaryPtr& dict,
+ const string& param,
+ bool marshal,
+ int& iter,
+ bool useHelper,
+ const StringList& metaData)
+{
+ string stream = marshal ? "__os" : "__is";
+ string v = param;
- _history.insert(s);
+ string instanceType;
+
+ //
+ // We have to determine whether it's possible to use the
+ // type's generated helper class for this marshal/unmarshal
+ // task. Since the user may have specified a custom type in
+ // metadata, it's possible that the helper class is not
+ // compatible and therefore we'll need to generate the code
+ // in-line instead.
+ //
+ // Specifically, there may be "local" metadata (i.e., from
+ // a data member or parameter definition) that overrides the
+ // original type. We'll compare the mapped types with and
+ // without local metadata to determine whether we can use
+ // the helper.
+ //
+ string formalType;
+ getDictionaryTypes(dict, "", metaData, instanceType, formalType, false);
+ string origInstanceType, origFormalType;
+ getDictionaryTypes(dict, "", StringList(), origInstanceType, origFormalType, false);
+ if((formalType != origFormalType) || (!marshal && instanceType != origInstanceType))
+ {
+ useHelper = false;
+ }
+
+ //
+ // If we can use the helper, it's easy.
+ //
+ if(useHelper)
+ {
+ string typeS = getAbsolute(dict, package);
+ if(marshal)
+ {
+ out << nl << typeS << "Helper.write(" << stream << ", " << v << ");";
+ }
+ else
+ {
+ out << nl << v << " = " << typeS << "Helper.read(" << stream << ");";
}
+ return;
}
- return result;
+ TypePtr key = dict->keyType();
+ TypePtr value = dict->valueType();
+
+ string keyS = typeToString(key, TypeModeIn, package);
+ string valueS = typeToString(value, TypeModeIn, package);
+
+ ostringstream o;
+ o << iter;
+ string iterS = o.str();
+ iter++;
+
+ if(marshal)
+ {
+ out << nl << "if(" << v << " == null)";
+ out << sb;
+ out << nl << "__os.writeSize(0);";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << "__os.writeSize(" << v << ".size());";
+ string keyObjectS = typeToObjectString(key, TypeModeIn, package);
+ string valueObjectS = typeToObjectString(value, TypeModeIn, package);
+ out << nl << "for(java.util.Map.Entry<" << keyObjectS << ", " << valueObjectS << "> __e : " << v
+ << ".entrySet())";
+ out << sb;
+ for(int i = 0; i < 2; i++)
+ {
+ string arg;
+ TypePtr type;
+ if(i == 0)
+ {
+ arg = "__e.getKey()";
+ type = key;
+ }
+ else
+ {
+ arg = "__e.getValue()";
+ type = value;
+ }
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, arg, true, iter);
+ }
+ out << eb;
+ out << eb;
+ }
+ else
+ {
+ out << nl << v << " = new " << instanceType << "();";
+ out << nl << "int __sz" << iterS << " = __is.readSize();";
+ out << nl << "for(int __i" << iterS << " = 0; __i" << iterS << " < __sz" << iterS << "; __i" << iterS << "++)";
+ out << sb;
+ for(int i = 0; i < 2; i++)
+ {
+ string arg;
+ TypePtr type;
+ string typeS;
+ if(i == 0)
+ {
+ arg = "__key";
+ type = key;
+ typeS = keyS;
+ }
+ else
+ {
+ arg = "__value";
+ type = value;
+ typeS = valueS;
+ }
+
+ BuiltinPtr b = BuiltinPtr::dynamicCast(type);
+ if(ClassDeclPtr::dynamicCast(type) || (b && b->usesClasses()))
+ {
+ string keyTypeStr = typeToObjectString(key, TypeModeIn, package);
+ string valueTypeStr = typeToObjectString(value, TypeModeIn, package);
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, arg, false, iter, StringList(),
+ "new com.zeroc.IceInternal.DictionaryPatcher<" + keyTypeStr + ", " +
+ valueTypeStr + ">(" + v + ", " + typeS + ".class, " + typeS +
+ ".ice_staticId, __key)");
+ }
+ else
+ {
+ if(StructPtr::dynamicCast(type))
+ {
+ out << nl << typeS << ' ' << arg << " = null;";
+ }
+ else
+ {
+ out << nl << typeS << ' ' << arg << ';';
+ }
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, arg, false, iter);
+ }
+ }
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(value);
+ if(!(builtin && builtin->usesClasses()) && !ClassDeclPtr::dynamicCast(value))
+ {
+ out << nl << "" << v << ".put(__key, __value);";
+ }
+ out << eb;
+ }
}
void
-Slice::JavaGenerator::MetaDataVisitor::validateType(const SyntaxTreeBasePtr& p, const StringList& metaData,
- const string& file, const string& line)
+Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
+ const string& package,
+ const SequencePtr& seq,
+ const string& param,
+ bool marshal,
+ int& iter,
+ bool useHelper,
+ const StringList& metaData)
{
- for(StringList::const_iterator i = metaData.begin(); i != metaData.end(); ++i)
+ string stream = marshal ? "__os" : "__is";
+ string v = param;
+
+ //
+ // If the sequence is a byte sequence, check if there's the serializable or protobuf metadata to
+ // get rid of these two easy cases first.
+ //
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(seq->type());
+ if(builtin && builtin->kind() == Builtin::KindByte)
+ {
+ string meta;
+ static const string protobuf = "java:protobuf:";
+ static const string serializable = "java:serializable:";
+ if(seq->findMetaData(serializable, meta))
+ {
+ if(marshal)
+ {
+ out << nl << stream << ".writeSerializable(" << v << ");";
+ }
+ else
+ {
+ string type = typeToString(seq, TypeModeIn, package);
+ out << nl << v << " = (" << type << ")" << stream << ".readSerializable();";
+ }
+ return;
+ }
+ else if(seq->findMetaData(protobuf, meta))
+ {
+ if(marshal)
+ {
+ out << nl << "if(!" << v << ".isInitialized())";
+ out << sb;
+ out << nl << "throw new com.zeroc.Ice.MarshalException(\"type not fully initialized\");";
+ out << eb;
+ out << nl << stream << ".writeByteSeq(" << v << ".toByteArray());";
+ }
+ else
+ {
+ string type = typeToString(seq, TypeModeIn, package);
+ out << nl << "try";
+ out << sb;
+ out << nl << v << " = " << type << ".parseFrom(" << stream << ".readByteSeq());";
+ out << eb;
+ out << nl << "catch(com.google.protobuf.InvalidProtocolBufferException __ex)";
+ out << sb;
+ out << nl << "throw new com.zeroc.Ice.MarshalException(__ex);";
+ out << eb;
+ }
+ return;
+ }
+ }
+
+ if(builtin &&
+ (builtin->kind() == Builtin::KindByte || builtin->kind() == Builtin::KindShort ||
+ builtin->kind() == Builtin::KindInt || builtin->kind() == Builtin::KindLong ||
+ builtin->kind() == Builtin::KindFloat || builtin->kind() == Builtin::KindDouble))
+ {
+ string meta;
+ static const string bytebuffer = "java:buffer";
+ if(seq->findMetaData(bytebuffer, meta) || findMetaData(bytebuffer, metaData, meta))
+ {
+ switch(builtin->kind())
+ {
+ case Builtin::KindByte:
+ {
+ if(marshal)
+ {
+ out << nl << stream << ".writeByteBuffer(" << v << ");";
+ }
+ else
+ {
+ out << nl << v << " = " << stream << ".readByteBuffer();";
+ }
+ break;
+ }
+ case Builtin::KindShort:
+ {
+ if(marshal)
+ {
+ out << nl << stream << ".writeShortBuffer(" << v << ");";
+ }
+ else
+ {
+ out << nl << v << " = " << stream << ".readShortBuffer();";
+ }
+ break;
+ }
+ case Builtin::KindInt:
+ {
+ if(marshal)
+ {
+ out << nl << stream << ".writeIntBuffer(" << v << ");";
+ }
+ else
+ {
+ out << nl << v << " = " << stream << ".readIntBuffer();";
+ }
+ break;
+ }
+ case Builtin::KindLong:
+ {
+ if(marshal)
+ {
+ out << nl << stream << ".writeLongBuffer(" << v << ");";
+ }
+ else
+ {
+ out << nl << v << " = " << stream << ".readLongBuffer();";
+ }
+ break;
+ }
+ case Builtin::KindFloat:
+ {
+ if(marshal)
+ {
+ out << nl << stream << ".writeFloatBuffer(" << v << ");";
+ }
+ else
+ {
+ out << nl << v << " = " << stream << ".readFloatBuffer();";
+ }
+ break;
+ }
+ case Builtin::KindDouble:
+ {
+ if(marshal)
+ {
+ out << nl << stream << ".writeDoubleBuffer(" << v << ");";
+ }
+ else
+ {
+ out << nl << v << " = " << stream << ".readDoubleBuffer();";
+ }
+ break;
+ }
+ case Builtin::KindBool:
+ case Builtin::KindString:
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ case Builtin::KindLocalObject:
+ case Builtin::KindValue:
+ {
+ assert(false);
+ break;
+ }
+ }
+ return;
+ }
+ }
+
+ bool customType = false;
+ string instanceType;
+
+ //
+ // We have to determine whether it's possible to use the
+ // type's generated helper class for this marshal/unmarshal
+ // task. Since the user may have specified a custom type in
+ // metadata, it's possible that the helper class is not
+ // compatible and therefore we'll need to generate the code
+ // in-line instead.
+ //
+ // Specifically, there may be "local" metadata (i.e., from
+ // a data member or parameter definition) that overrides the
+ // original type. We'll compare the mapped types with and
+ // without local metadata to determine whether we can use
+ // the helper.
+ //
+ string formalType;
+ customType = getSequenceTypes(seq, "", metaData, instanceType, formalType, false);
+ string origInstanceType, origFormalType;
+ getSequenceTypes(seq, "", StringList(), origInstanceType, origFormalType, false);
+ if((formalType != origFormalType) || (!marshal && instanceType != origInstanceType))
+ {
+ useHelper = false;
+ }
+
+ //
+ // If we can use the helper, it's easy.
+ //
+ if(useHelper)
+ {
+ string typeS = getAbsolute(seq, package);
+ if(marshal)
+ {
+ out << nl << typeS << "Helper.write(" << stream << ", " << v << ");";
+ }
+ else
+ {
+ out << nl << v << " = " << typeS << "Helper.read(" << stream << ");";
+ }
+ return;
+ }
+
+ //
+ // Determine sequence depth.
+ //
+ int depth = 0;
+ TypePtr origContent = seq->type();
+ SequencePtr s = SequencePtr::dynamicCast(origContent);
+ while(s)
{
//
- // Type metadata ("java:type:Foo") is only supported by sequences and dictionaries.
+ // Stop if the inner sequence type has a custom, serializable or protobuf type.
+ //
+ if(hasTypeMetaData(s))
+ {
+ break;
+ }
+ depth++;
+ origContent = s->type();
+ s = SequencePtr::dynamicCast(origContent);
+ }
+ string origContentS = typeToString(origContent, TypeModeIn, package);
+
+ TypePtr type = seq->type();
+
+ if(customType)
+ {
+ //
+ // Marshal/unmarshal a custom sequence type.
//
- if(i->find("java:type:", 0) == 0 && (!SequencePtr::dynamicCast(p) && !DictionaryPtr::dynamicCast(p)))
+ BuiltinPtr b = BuiltinPtr::dynamicCast(type);
+ string typeS = getAbsolute(seq, package);
+ ostringstream o;
+ o << origContentS;
+ int d = depth;
+ while(d--)
+ {
+ o << "[]";
+ }
+ string cont = o.str();
+ if(marshal)
+ {
+ out << nl << "if(" << v << " == null)";
+ out << sb;
+ out << nl << stream << ".writeSize(0);";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << stream << ".writeSize(" << v << ".size());";
+ string typeS = typeToString(type, TypeModeIn, package);
+ out << nl << "for(" << typeS << " __elem : " << v << ')';
+ out << sb;
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, "__elem", true, iter);
+ out << eb;
+ out << eb; // else
+ }
+ else
+ {
+ bool isObject = false;
+ ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
+ if((b && b->usesClasses()) || cl)
+ {
+ isObject = true;
+ }
+ out << nl << v << " = new " << instanceType << "();";
+ out << nl << "final int __len" << iter << " = " << stream << ".readAndCheckSeqSize(" << type->minWireSize()
+ << ");";
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __len" << iter << "; __i" << iter
+ << "++)";
+ out << sb;
+ if(isObject)
+ {
+ //
+ // Add a null value to the list as a placeholder for the element.
+ //
+ out << nl << v << ".add(null);";
+ ostringstream patchParams;
+ patchParams << "new com.zeroc.IceInternal.ListPatcher<" << origContentS << ">(" << v << ", "
+ << origContentS << ".class, " << origContentS << ".ice_staticId, __i" << iter << ')';
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, "__elem", false, iter,
+ StringList(), patchParams.str());
+ }
+ else
+ {
+ if(StructPtr::dynamicCast(type))
+ {
+ out << nl << cont << " __elem = null;";
+ }
+ else
+ {
+ out << nl << cont << " __elem;";
+ }
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, "__elem", false, iter);
+ }
+ if(!isObject)
+ {
+ out << nl << v << ".add(__elem);";
+ }
+ out << eb;
+ iter++;
+ }
+ }
+ else
+ {
+ BuiltinPtr b = BuiltinPtr::dynamicCast(type);
+ if(b && b->kind() != Builtin::KindObject &&
+ b->kind() != Builtin::KindValue &&
+ b->kind() != Builtin::KindObjectProxy)
+ {
+ switch(b->kind())
+ {
+ case Builtin::KindByte:
+ {
+ if(marshal)
+ {
+ out << nl << stream << ".writeByteSeq(" << v << ");";
+ }
+ else
+ {
+ out << nl << v << " = " << stream << ".readByteSeq();";
+ }
+ break;
+ }
+ case Builtin::KindBool:
+ {
+ if(marshal)
+ {
+ out << nl << stream << ".writeBoolSeq(" << v << ");";
+ }
+ else
+ {
+ out << nl << v << " = " << stream << ".readBoolSeq();";
+ }
+ break;
+ }
+ case Builtin::KindShort:
+ {
+ if(marshal)
+ {
+ out << nl << stream << ".writeShortSeq(" << v << ");";
+ }
+ else
+ {
+ out << nl << v << " = " << stream << ".readShortSeq();";
+ }
+ break;
+ }
+ case Builtin::KindInt:
+ {
+ if(marshal)
+ {
+ out << nl << stream << ".writeIntSeq(" << v << ");";
+ }
+ else
+ {
+ out << nl << v << " = " << stream << ".readIntSeq();";
+ }
+ break;
+ }
+ case Builtin::KindLong:
+ {
+ if(marshal)
+ {
+ out << nl << stream << ".writeLongSeq(" << v << ");";
+ }
+ else
+ {
+ out << nl << v << " = " << stream << ".readLongSeq();";
+ }
+ break;
+ }
+ case Builtin::KindFloat:
+ {
+ if(marshal)
+ {
+ out << nl << stream << ".writeFloatSeq(" << v << ");";
+ }
+ else
+ {
+ out << nl << v << " = " << stream << ".readFloatSeq();";
+ }
+ break;
+ }
+ case Builtin::KindDouble:
+ {
+ if(marshal)
+ {
+ out << nl << stream << ".writeDoubleSeq(" << v << ");";
+ }
+ else
+ {
+ out << nl << v << " = " << stream << ".readDoubleSeq();";
+ }
+ break;
+ }
+ case Builtin::KindString:
+ {
+ if(marshal)
+ {
+ out << nl << stream << ".writeStringSeq(" << v << ");";
+ }
+ else
+ {
+ out << nl << v << " = " << stream << ".readStringSeq();";
+ }
+ break;
+ }
+ case Builtin::KindValue:
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ case Builtin::KindLocalObject:
+ {
+ assert(false);
+ break;
+ }
+ }
+ }
+ else
{
- string str;
- ContainedPtr cont = ContainedPtr::dynamicCast(p);
- if(cont)
+ if(marshal)
{
- str = cont->kindOf();
+ out << nl << "if(" << v << " == null)";
+ out << sb;
+ out << nl << stream << ".writeSize(0);";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << stream << ".writeSize(" << v << ".length);";
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < " << v << ".length; __i" << iter
+ << "++)";
+ out << sb;
+ ostringstream o;
+ o << v << "[__i" << iter << "]";
+ iter++;
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, o.str(), true, iter);
+ out << eb;
+ out << eb;
}
else
{
- BuiltinPtr b = BuiltinPtr::dynamicCast(p);
- assert(b);
- str = b->typeId();
+ bool isObject = false;
+ ClassDeclPtr cl = ClassDeclPtr::dynamicCast(origContent);
+ if((b && b->usesClasses()) || cl)
+ {
+ isObject = true;
+ }
+ out << nl << "final int __len" << iter << " = " << stream << ".readAndCheckSeqSize("
+ << type->minWireSize() << ");";
+ //
+ // We cannot allocate an array of a generic type, such as
+ //
+ // arr = new Map<String, String>[sz];
+ //
+ // Attempting to compile this code results in a "generic array creation" error
+ // message. This problem can occur when the sequence's element type is a
+ // dictionary, or when the element type is a nested sequence that uses a custom
+ // mapping.
+ //
+ // The solution is to rewrite the code as follows:
+ //
+ // arr = (Map<String, String>[])new Map[sz];
+ //
+ // Unfortunately, this produces an unchecked warning during compilation.
+ //
+ // A simple test is to look for a "<" character in the content type, which
+ // indicates the use of a generic type.
+ //
+ string::size_type pos = origContentS.find('<');
+ if(pos != string::npos)
+ {
+ string nonGenericType = origContentS.substr(0, pos);
+ out << nl << v << " = (" << origContentS << "[]";
+ int d = depth;
+ while(d--)
+ {
+ out << "[]";
+ }
+ out << ")new " << nonGenericType << "[__len" << iter << "]";
+ }
+ else
+ {
+ out << nl << v << " = new " << origContentS << "[__len" << iter << "]";
+ }
+ int d = depth;
+ while(d--)
+ {
+ out << "[]";
+ }
+ out << ';';
+ out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __len" << iter << "; __i" << iter
+ << "++)";
+ out << sb;
+ ostringstream o;
+ o << v << "[__i" << iter << "]";
+ if(isObject)
+ {
+ ostringstream patchParams;
+ patchParams << "new com.zeroc.IceInternal.SequencePatcher<" << origContentS << ">(" << v << ", "
+ << origContentS << ".class, " << origContentS << ".ice_staticId, __i" << iter
+ << ')';
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, o.str(), false, iter,
+ StringList(), patchParams.str());
+ }
+ else
+ {
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, o.str(), false, iter);
+ }
+ out << eb;
+ iter++;
}
- emitWarning(file, line, "invalid metadata for " + str);
}
- else if(i->find("java:buffer") == 0)
+ }
+}
+
+bool
+Slice::JavaGenerator::findMetaData(const string& prefix, const StringList& metaData, string& value)
+{
+ for(StringList::const_iterator q = metaData.begin(); q != metaData.end(); ++q)
+ {
+ if(q->find(prefix) == 0)
{
- SequencePtr seq = SequencePtr::dynamicCast(p);
+ value = *q;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool
+Slice::JavaGenerator::getTypeMetaData(const StringList& metaData, string& instanceType, string& formalType)
+{
+ //
+ // Extract the instance type and an optional formal type.
+ // The correct syntax is "java:type:instance-type[:formal-type]".
+ //
+ static const string prefix = "java:type:";
+ string directive;
+ if(findMetaData(prefix, metaData, directive))
+ {
+ string::size_type pos = directive.find(':', prefix.size());
+ if(pos != string::npos)
+ {
+ instanceType = directive.substr(prefix.size(), pos - prefix.size());
+ formalType = directive.substr(pos + 1);
+ }
+ else
+ {
+ instanceType = directive.substr(prefix.size());
+ formalType.clear();
+ }
+ return true;
+ }
+
+ return false;
+}
+
+bool
+Slice::JavaGenerator::hasTypeMetaData(const TypePtr& type, const StringList& localMetaData)
+{
+ ContainedPtr cont = ContainedPtr::dynamicCast(type);
+ if(cont)
+ {
+ static const string prefix = "java:type:";
+ string directive;
+
+ if(findMetaData(prefix, localMetaData, directive))
+ {
+ return true;
+ }
+
+ StringList metaData = cont->getMetaData();
+
+ if(findMetaData(prefix, metaData, directive))
+ {
+ return true;
+ }
+
+ if(findMetaData("java:protobuf:", metaData, directive) ||
+ findMetaData("java:serializable:", metaData, directive))
+ {
+ SequencePtr seq = SequencePtr::dynamicCast(cont);
+ if(seq)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(seq->type());
+ if(builtin && builtin->kind() == Builtin::KindByte)
+ {
+ return true;
+ }
+ }
+ }
+
+ if(findMetaData("java:buffer", localMetaData, directive))
+ {
+ SequencePtr seq = SequencePtr::dynamicCast(cont);
if(seq)
{
BuiltinPtr builtin = BuiltinPtr::dynamicCast(seq->type());
@@ -3139,57 +5315,125 @@ Slice::JavaGenerator::MetaDataVisitor::validateType(const SyntaxTreeBasePtr& p,
builtin->kind() == Builtin::KindInt || builtin->kind() == Builtin::KindLong ||
builtin->kind() == Builtin::KindFloat || builtin->kind() == Builtin::KindDouble))
{
- continue;
+ return true;
}
-
}
- emitWarning(file, line, "ignoring invalid metadata `" + *i + "'");
}
- else if(i->find("java:protobuf:") == 0 || i->find("java:serializable:") == 0)
- {
- //
- // Only valid in sequence defintion which is checked in visitSequence
- //
- emitWarning(file, line, "ignoring invalid metadata `" + *i + "'");
- }
- else if(i->find("delegate") == 0)
+ }
+
+ return false;
+}
+
+bool
+Slice::JavaGenerator::getDictionaryTypes(const DictionaryPtr& dict,
+ const string& package,
+ const StringList& metaData,
+ string& instanceType,
+ string& formalType,
+ bool local) const
+{
+ //
+ // Get the types of the key and value.
+ //
+ string keyTypeStr = typeToObjectString(dict->keyType(), TypeModeIn, package, StringList(), true, local);
+ string valueTypeStr = typeToObjectString(dict->valueType(), TypeModeIn, package, StringList(), true, local);
+
+ //
+ // Collect metadata for a custom type.
+ //
+ if(getTypeMetaData(metaData, instanceType, formalType) ||
+ getTypeMetaData(dict->getMetaData(), instanceType, formalType))
+ {
+ assert(!instanceType.empty());
+ if(formalType.empty())
{
- ClassDefPtr cl = ClassDefPtr::dynamicCast(p);
- if(cl && cl->isDelegate())
- {
- continue;
- }
- emitWarning(file, line, "ignoring invalid metadata `" + *i + "'");
+ formalType = "java.util.Map<" + keyTypeStr + ", " + valueTypeStr + ">";
}
+ return true;
}
+
+ //
+ // Return a default type for the platform.
+ //
+ instanceType = "java.util.HashMap<" + keyTypeStr + ", " + valueTypeStr + ">";
+ formalType = "java.util.Map<" + keyTypeStr + ", " + valueTypeStr + ">";
+ return false;
}
-void
-Slice::JavaGenerator::MetaDataVisitor::validateGetSet(const SyntaxTreeBasePtr& p, const StringList& metaData,
- const string& file, const string& line)
+bool
+Slice::JavaGenerator::getSequenceTypes(const SequencePtr& seq,
+ const string& package,
+ const StringList& metaData,
+ string& instanceType,
+ string& formalType,
+ bool local) const
{
- for(StringList::const_iterator i = metaData.begin(); i != metaData.end(); ++i)
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(seq->type());
+ if(builtin)
{
- //
- // The "getset" metadata can only be specified on a class, struct, exception or data member.
- //
- if((*i) == "java:getset" &&
- (!ClassDefPtr::dynamicCast(p) && !StructPtr::dynamicCast(p) && !ExceptionPtr::dynamicCast(p) &&
- !DataMemberPtr::dynamicCast(p)))
+ if(builtin->kind() == Builtin::KindByte)
{
- string str;
- ContainedPtr cont = ContainedPtr::dynamicCast(p);
- if(cont)
+ string prefix = "java:serializable:";
+ string meta;
+ if(seq->findMetaData(prefix, meta))
{
- str = cont->kindOf();
+ instanceType = formalType = meta.substr(prefix.size());
+ return true;
}
- else
+ prefix = "java:protobuf:";
+ if(seq->findMetaData(prefix, meta))
{
- BuiltinPtr b = BuiltinPtr::dynamicCast(p);
- assert(b);
- str = b->typeId();
+ instanceType = formalType = meta.substr(prefix.size());
+ return true;
}
- emitWarning(file, line, "invalid metadata for " + str);
}
+
+ if((builtin->kind() == Builtin::KindByte || builtin->kind() == Builtin::KindShort ||
+ builtin->kind() == Builtin::KindInt || builtin->kind() == Builtin::KindLong ||
+ builtin->kind() == Builtin::KindFloat || builtin->kind() == Builtin::KindDouble))
+ {
+ string prefix = "java:buffer";
+ string meta;
+ string ignore;
+ if(seq->findMetaData(prefix, meta) || findMetaData(prefix, metaData, ignore))
+ {
+ instanceType = formalType = typeToBufferString(seq->type());
+ return true;
+ }
+ }
+ }
+
+ //
+ // Collect metadata for a custom type.
+ //
+ if(getTypeMetaData(metaData, instanceType, formalType) ||
+ getTypeMetaData(seq->getMetaData(), instanceType, formalType))
+ {
+ assert(!instanceType.empty());
+ if(formalType.empty())
+ {
+ formalType = "java.util.List<" +
+ typeToObjectString(seq->type(), TypeModeIn, package, StringList(), true, local) + ">";
+ }
+ return true;
}
+
+ //
+ // The default mapping is a native array.
+ //
+ instanceType = formalType = typeToString(seq->type(), TypeModeIn, package, metaData, true, false, local) + "[]";
+ return false;
+}
+
+JavaOutput*
+Slice::JavaGenerator::createOutput()
+{
+ return new JavaOutput;
+}
+
+void
+Slice::JavaGenerator::validateMetaData(const UnitPtr& u)
+{
+ MetaDataVisitor visitor;
+ u->visit(&visitor, true);
}
diff --git a/cpp/src/Slice/JavaUtil.h b/cpp/src/Slice/JavaUtil.h
index 6473f406e0e..d9375be077e 100644
--- a/cpp/src/Slice/JavaUtil.h
+++ b/cpp/src/Slice/JavaUtil.h
@@ -59,11 +59,11 @@ public:
virtual void printHeader();
};
-class JavaGenerator : private ::IceUtil::noncopyable
+class JavaCompatGenerator : private ::IceUtil::noncopyable
{
public:
- virtual ~JavaGenerator();
+ virtual ~JavaCompatGenerator();
//
// Validate all metadata in the unit with a "java:" prefix.
@@ -74,7 +74,7 @@ public:
protected:
- JavaGenerator(const std::string&);
+ JavaCompatGenerator(const std::string&);
//
// Given the fully-scoped Java class name, create any intermediate
@@ -220,33 +220,170 @@ protected:
private:
- class MetaDataVisitor : public ParserVisitor
+ std::string _dir;
+ ::IceUtilInternal::Output* _out;
+ mutable std::map<std::string, std::string> _filePackagePrefix;
+};
+
+class JavaGenerator : private ::IceUtil::noncopyable
+{
+public:
+
+ virtual ~JavaGenerator();
+
+ //
+ // Validate all metadata in the unit with a "java:" prefix.
+ //
+ static void validateMetaData(const UnitPtr&);
+
+ void close();
+
+protected:
+
+ JavaGenerator(const std::string&);
+
+ //
+ // Given the fully-scoped Java class name, create any intermediate
+ // package directories and open the class file,
+ //
+ void open(const std::string&, const std::string&);
+
+ ::IceUtilInternal::Output& output() const;
+
+ //
+ // Check a symbol against any of the Java keywords. If a
+ // match is found, return the symbol with a leading underscore.
+ //
+ std::string fixKwd(const std::string&) const;
+
+ //
+ // Convert a Slice scoped name into a Java name.
+ //
+ std::string convertScopedName(const std::string&,
+ const std::string& = std::string(),
+ const std::string& = std::string()) const;
+
+
+ //
+ // Returns the package prefix for a give Slice file.
+ //
+ std::string getPackagePrefix(const ContainedPtr&) const;
+
+ //
+ // Returns the Java package of a Contained entity.
+ //
+ std::string getPackage(const ContainedPtr&) const;
+
+ //
+ // Returns the Java name for a Contained entity. If the optional
+ // package argument matches the entity's package name, then the
+ // package is removed from the result.
+ //
+ std::string getAbsolute(const ContainedPtr&,
+ const std::string& = std::string(),
+ const std::string& = std::string(),
+ const std::string& = std::string()) const;
+
+ //
+ // Return the method call necessary to obtain the static type ID for an object type.
+ //
+ std::string getStaticId(const TypePtr&, const std::string&) const;
+
+ //
+ // Determines whether an operation should use the optional mapping.
+ //
+ bool useOptionalMapping(const OperationPtr&);
+
+ //
+ // Returns the optional type corresponding to the given Slice type.
+ //
+ std::string getOptionalFormat(const TypePtr&);
+
+ //
+ // Get the Java name for a type. If an optional scope is provided,
+ // the scope will be removed from the result if possible.
+ //
+ enum TypeMode
{
- public:
-
- virtual bool visitUnitStart(const UnitPtr&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitClassDecl(const ClassDeclPtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual bool visitExceptionStart(const ExceptionPtr&);
- virtual bool visitStructStart(const StructPtr&);
- virtual void visitOperation(const OperationPtr&);
- virtual void visitDataMember(const DataMemberPtr&);
- virtual void visitSequence(const SequencePtr&);
- virtual void visitDictionary(const DictionaryPtr&);
- virtual void visitEnum(const EnumPtr&);
- virtual void visitConst(const ConstPtr&);
-
- private:
-
- StringList getMetaData(const ContainedPtr&);
- void validateType(const SyntaxTreeBasePtr&, const StringList&, const std::string&, const std::string&);
- void validateGetSet(const SyntaxTreeBasePtr&, const StringList&, const std::string&, const std::string&);
-
- StringSet _history;
+ TypeModeIn,
+ TypeModeOut,
+ TypeModeMember,
+ TypeModeReturn
};
+ std::string typeToString(const TypePtr&, TypeMode, const std::string& = std::string(),
+ const StringList& = StringList(), bool = true, bool = false, bool = false) const;
- friend class JavaGenerator::MetaDataVisitor;
+ //
+ // Get the Java object name for a type. For primitive types, this returns the
+ // Java class type (e.g., Integer). For all other types, this function delegates
+ // to typeToString.
+ //
+ std::string typeToObjectString(const TypePtr&, TypeMode, const std::string& = std::string(),
+ const StringList& = StringList(), bool = true, bool = false) const;
+
+ //
+ // Generate code to marshal or unmarshal a type.
+ //
+ enum OptionalMode
+ {
+ OptionalNone,
+ OptionalInParam,
+ OptionalOutParam,
+ OptionalReturnParam,
+ OptionalMember
+ };
+
+ void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const TypePtr&, OptionalMode,
+ bool, int, const std::string&, bool, int&, const StringList& = StringList(),
+ const std::string& patchParams = "");
+
+ //
+ // Generate code to marshal or unmarshal a dictionary type.
+ //
+ void writeDictionaryMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const DictionaryPtr&,
+ const std::string&, bool, int&, bool,
+ const StringList& = StringList());
+
+ //
+ // Generate code to marshal or unmarshal a sequence type.
+ //
+ void writeSequenceMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const SequencePtr&,
+ const std::string&, bool, int&, bool, const StringList& = StringList());
+
+ //
+ // Search metadata for an entry with the given prefix and return the entire string.
+ //
+ static bool findMetaData(const std::string&, const StringList&, std::string&);
+
+ //
+ // Get custom type metadata. If metadata is found, the abstract and
+ // concrete types are extracted and the function returns true. If an
+ // abstract type is not specified, it is set to an empty string.
+ //
+ static bool getTypeMetaData(const StringList&, std::string&, std::string&);
+
+ //
+ // Determine whether a custom type is defined. The function checks the
+ // metadata of the type's original definition, as well as any optional
+ // metadata that typically represents a data member or parameter.
+ //
+ static bool hasTypeMetaData(const TypePtr&, const StringList& = StringList());
+
+ //
+ // Obtain the concrete and abstract types for a dictionary or sequence type.
+ // The functions return true if a custom type was defined and false to indicate
+ // the default mapping was used.
+ //
+ bool getDictionaryTypes(const DictionaryPtr&, const std::string&, const StringList&,
+ std::string&, std::string&, bool) const;
+ bool getSequenceTypes(const SequencePtr&, const std::string&, const StringList&, std::string&, std::string&,
+ bool) const;
+
+ virtual JavaOutput* createOutput();
+
+ static const std::string _getSetMetaData;
+
+private:
std::string _dir;
::IceUtilInternal::Output* _out;
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index 825c9c8e3fb..e4bb71d4824 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -63,6 +63,23 @@ filterOrderedOptionalDataMembers(const DataMemberList& members)
return result;
}
+void
+sortOptionalParameters(ParamDeclList& params)
+{
+ //
+ // Sort optional parameters by tag.
+ //
+ class SortFn
+ {
+ public:
+ static bool compare(const ParamDeclPtr& lhs, const ParamDeclPtr& rhs)
+ {
+ return lhs->tag() < rhs->tag();
+ }
+ };
+ params.sort(SortFn::compare);
+}
+
bool
isMutableAfterReturnType(const TypePtr& type)
{
@@ -5136,7 +5153,7 @@ Slice::Operation::inParameters() const
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
ParamDeclPtr q = ParamDeclPtr::dynamicCast(*p);
- if(!q->isOutParam())
+ if(q && !q->isOutParam())
{
result.push_back(q);
}
@@ -5144,6 +5161,25 @@ Slice::Operation::inParameters() const
return result;
}
+void
+Slice::Operation::inParameters(ParamDeclList& required, ParamDeclList& optional) const
+{
+ const ParamDeclList params = inParameters();
+ for(ParamDeclList::const_iterator pli = params.begin(); pli != params.end(); ++pli)
+ {
+ if((*pli)->optional())
+ {
+ optional.push_back(*pli);
+ }
+ else
+ {
+ required.push_back(*pli);
+ }
+ }
+
+ sortOptionalParameters(optional);
+}
+
ParamDeclList
Slice::Operation::outParameters() const
{
@@ -5151,7 +5187,7 @@ Slice::Operation::outParameters() const
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
ParamDeclPtr q = ParamDeclPtr::dynamicCast(*p);
- if(q->isOutParam())
+ if(q && q->isOutParam())
{
result.push_back(q);
}
@@ -5159,6 +5195,25 @@ Slice::Operation::outParameters() const
return result;
}
+void
+Slice::Operation::outParameters(ParamDeclList& required, ParamDeclList& optional) const
+{
+ const ParamDeclList params = outParameters();
+ for(ParamDeclList::const_iterator pli = params.begin(); pli != params.end(); ++pli)
+ {
+ if((*pli)->optional())
+ {
+ optional.push_back(*pli);
+ }
+ else
+ {
+ required.push_back(*pli);
+ }
+ }
+
+ sortOptionalParameters(optional);
+}
+
ExceptionList
Slice::Operation::throws() const
{
@@ -5311,12 +5366,25 @@ Slice::Operation::returnsData() const
}
bool
+Slice::Operation::returnsMultipleValues() const
+{
+ int count = outParameters().size();
+
+ if(returnType())
+ {
+ ++count;
+ }
+
+ return count > 1;
+}
+
+bool
Slice::Operation::sendsOptionals() const
{
- ParamDeclList pdl = parameters();
+ ParamDeclList pdl = inParameters();
for(ParamDeclList::const_iterator i = pdl.begin(); i != pdl.end(); ++i)
{
- if(!(*i)->isOutParam() && (*i)->optional())
+ if((*i)->optional())
{
return true;
}
@@ -6207,6 +6275,11 @@ Slice::Unit::parse(const string& filename, FILE* file, bool debug, Slice::Featur
popContainer();
assert(_definitionContextStack.size() == 1);
popDefinitionContext();
+
+ if(!checkUndefinedTypes())
+ {
+ status = EXIT_FAILURE;
+ }
}
Slice::unit = 0;
@@ -6305,6 +6378,113 @@ Slice::Unit::eraseWhiteSpace(string& s)
}
}
+bool
+Slice::Unit::checkUndefinedTypes()
+{
+ class Visitor : public ParserVisitor
+ {
+ public:
+
+ Visitor(int& errors) :
+ _errors(errors),
+ _local(false)
+ {
+ }
+
+ virtual bool visitClassDefStart(const ClassDefPtr& p)
+ {
+ _local = p->isLocal();
+ return true;
+ }
+
+ virtual bool visitExceptionStart(const ExceptionPtr& p)
+ {
+ _local = p->isLocal();
+ return true;
+ }
+
+ virtual bool visitStructStart(const StructPtr& p)
+ {
+ _local = p->isLocal();
+ return true;
+ }
+
+ virtual void visitOperation(const OperationPtr& p)
+ {
+ if(p->returnType())
+ {
+ checkUndefined(p->returnType(), "return type", p->file(), p->line());
+ }
+ ParamDeclList params = p->parameters();
+ for(ParamDeclList::const_iterator q = params.begin(); q != params.end(); ++q)
+ {
+ checkUndefined((*q)->type(), "parameter " + (*q)->name(), (*q)->file(), (*q)->line());
+ }
+ }
+
+ virtual void visitParamDecl(const ParamDeclPtr& p)
+ {
+ checkUndefined(p->type(), "parameter " + p->name(), p->file(), p->line());
+ }
+
+ virtual void visitDataMember(const DataMemberPtr& p)
+ {
+ checkUndefined(p->type(), "member " + p->name(), p->file(), p->line());
+ }
+
+ virtual void visitSequence(const SequencePtr& p)
+ {
+ _local = p->isLocal();
+ checkUndefined(p->type(), "element type", p->file(), p->line());
+ }
+
+ virtual void visitDictionary(const DictionaryPtr& p)
+ {
+ _local = p->isLocal();
+ checkUndefined(p->keyType(), "key type", p->file(), p->line());
+ checkUndefined(p->valueType(), "value type", p->file(), p->line());
+ }
+
+ private:
+
+ void checkUndefined(const TypePtr& type, const string& desc, const string& file, const string& line)
+ {
+ //
+ // See ICE-6867. Any use of a proxy requires the full type definition, as does any
+ // use of a class in a non-local context.
+ //
+ ProxyPtr p = ProxyPtr::dynamicCast(type);
+ if(p)
+ {
+ const ClassDeclPtr cl = p->_class();
+ if(!cl->definition())
+ {
+ ostringstream ostr;
+ ostr << desc << " uses a proxy for undefined type `" << cl->scoped() << "'";
+ emitError(file, line, ostr.str());
+ _errors++;
+ }
+ }
+
+ ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
+ if(cl && !cl->definition() && !_local)
+ {
+ ostringstream ostr;
+ ostr << desc << " refers to undefined type `" << cl->scoped() << "'";
+ emitError(file, line, ostr.str());
+ _errors++;
+ }
+ }
+
+ int& _errors;
+ bool _local;
+ };
+
+ Visitor v(_errors);
+ visit(&v, true);
+ return _errors == 0;
+}
+
// ----------------------------------------------------------------------
// CICompare
// ----------------------------------------------------------------------
diff --git a/cpp/src/Slice/Parser.h b/cpp/src/Slice/Parser.h
index 3e5891db655..c26de803f13 100644
--- a/cpp/src/Slice/Parser.h
+++ b/cpp/src/Slice/Parser.h
@@ -598,7 +598,9 @@ public:
ParamDeclPtr createParamDecl(const std::string&, const TypePtr&, bool, bool, int);
ParamDeclList parameters() const;
ParamDeclList inParameters() const;
+ void inParameters(ParamDeclList&, ParamDeclList&) const;
ParamDeclList outParameters() const;
+ void outParameters(ParamDeclList&, ParamDeclList&) const;
ExceptionList throws() const;
void setExceptionList(const ExceptionList&);
virtual ContainedType containedType() const;
@@ -606,6 +608,7 @@ public:
bool sendsClasses(bool) const;
bool returnsClasses(bool) const;
bool returnsData() const;
+ bool returnsMultipleValues() const;
bool sendsOptionals() const;
int attributes() const;
FormatType format() const;
@@ -1076,6 +1079,7 @@ private:
Unit(bool, bool, bool, bool, const StringList&);
static void eraseWhiteSpace(::std::string&);
+ bool checkUndefinedTypes();
bool _ignRedefs;
bool _all;
diff --git a/cpp/src/Slice/Preprocessor.cpp b/cpp/src/Slice/Preprocessor.cpp
index 26f4bee7db1..dc7c4abdf77 100644
--- a/cpp/src/Slice/Preprocessor.cpp
+++ b/cpp/src/Slice/Preprocessor.cpp
@@ -140,7 +140,7 @@ namespace
{
vector<string>
-baseArgs(vector<string> args, bool keepComments, const string& extraArgs, const string& fileName)
+baseArgs(vector<string> args, bool keepComments, const vector<string>& extraArgs, const string& fileName)
{
if(keepComments)
{
@@ -161,10 +161,7 @@ baseArgs(vector<string> args, bool keepComments, const string& extraArgs, const
args.push_back(os.str());
}
- if(!extraArgs.empty())
- {
- args.push_back(extraArgs);
- }
+ copy(extraArgs.begin(), extraArgs.end(), back_inserter(args));
args.push_back(fileName);
return args;
}
@@ -172,7 +169,15 @@ baseArgs(vector<string> args, bool keepComments, const string& extraArgs, const
}
FILE*
-Slice::Preprocessor::preprocess(bool keepComments, const string& extraArgs)
+Slice::Preprocessor::preprocess(bool keepComments, const string& extraArg)
+{
+ vector<string> args;
+ args.push_back(extraArg);
+ return preprocess(keepComments, args);
+}
+
+FILE*
+Slice::Preprocessor::preprocess(bool keepComments, const vector<string>& extraArgs)
{
if(!checkInputFile())
{
@@ -287,7 +292,17 @@ Slice::Preprocessor::preprocess(bool keepComments, const string& extraArgs)
bool
Slice::Preprocessor::printMakefileDependencies(ostream& out, Language lang, const vector<string>& includePaths,
- const string& extraArgs, const string& cppSourceExt,
+ const string& extraArg, const string& cppSourceExt,
+ const string& optValue)
+{
+ vector<string> extraArgs;
+ extraArgs.push_back(extraArg);
+ return printMakefileDependencies(out, lang, includePaths, extraArgs, cppSourceExt, optValue);
+}
+
+bool
+Slice::Preprocessor::printMakefileDependencies(ostream& out, Language lang, const vector<string>& includePaths,
+ const vector<string>& extraArgs, const string& cppSourceExt,
const string& optValue)
{
if(!checkInputFile())
diff --git a/cpp/src/Slice/Preprocessor.h b/cpp/src/Slice/Preprocessor.h
index 80f8acf4d66..f237a41b3f1 100644
--- a/cpp/src/Slice/Preprocessor.h
+++ b/cpp/src/Slice/Preprocessor.h
@@ -29,12 +29,16 @@ public:
~Preprocessor();
FILE* preprocess(bool, const std::string& = "");
+ FILE* preprocess(bool, const std::vector<std::string>&);
bool close();
enum Language { CPlusPlus, Java, CSharp, Python, Ruby, PHP, JavaScript, JavaScriptJSON, ObjC, SliceXML };
bool printMakefileDependencies(std::ostream&, Language, const std::vector<std::string>&, const std::string& = "",
const std::string& = "cpp", const std::string& = "");
+ bool printMakefileDependencies(std::ostream&, Language, const std::vector<std::string>&,
+ const std::vector<std::string>&, const std::string& = "cpp",
+ const std::string& = "");
std::string getBaseName();
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index 3e526d761ff..192281628a0 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -24,6 +24,9 @@ using namespace Slice;
using namespace IceUtil;
using namespace IceUtilInternal;
+namespace
+{
+
string
u16CodePoint(unsigned short value)
{
@@ -47,55 +50,51 @@ writeU8Buffer(const vector<unsigned char>& u8buffer, ::IceUtilInternal::Output&
}
}
-static string
+string
sliceModeToIceMode(Operation::Mode opMode)
{
- string mode;
+ string mode = "com.zeroc.Ice.OperationMode.";
switch(opMode)
{
- case Operation::Normal:
- {
- mode = "Ice.OperationMode.Normal";
- break;
- }
- case Operation::Nonmutating:
- {
- mode = "Ice.OperationMode.Nonmutating";
- break;
- }
- case Operation::Idempotent:
- {
- mode = "Ice.OperationMode.Idempotent";
- break;
- }
- default:
- {
- assert(false);
- break;
- }
+ case Operation::Normal:
+ mode = "null"; // shorthand for most common case
+ break;
+ case Operation::Nonmutating:
+ mode += "Nonmutating";
+ break;
+ case Operation::Idempotent:
+ mode += "Idempotent";
+ break;
+ default:
+ assert(false);
+ break;
}
return mode;
}
-static string
+string
opFormatTypeToString(const OperationPtr& op)
{
+ string format = "com.zeroc.Ice.FormatType.";
switch(op->format())
{
case DefaultFormat:
- return "Ice.FormatType.DefaultFormat";
+ format = "null"; // shorthand for most common case
+ break;
case CompactFormat:
- return "Ice.FormatType.CompactFormat";
+ format += "CompactFormat";
+ break;
case SlicedFormat:
- return "Ice.FormatType.SlicedFormat";
+ format += "SlicedFormat";
+ break;
default:
assert(false);
+ break;
}
-
- return "???";
+ return format;
}
-static string
+string
getDeprecateReason(const ContainedPtr& p1, const ContainedPtr& p2, const string& type)
{
string deprecateMetadata, deprecateReason;
@@ -111,6 +110,7 @@ getDeprecateReason(const ContainedPtr& p1, const ContainedPtr& p2, const string&
return deprecateReason;
}
+#if TBD
string
initValue(const TypePtr& p)
{
@@ -180,6 +180,16 @@ writeParamList(Output& out, vector<string> params, bool end = true, bool newLine
out.restoreIndent();
}
}
+#endif
+
+bool isValue(const TypePtr& type)
+{
+ BuiltinPtr b = BuiltinPtr::dynamicCast(type);
+ ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
+ return (b && b->usesClasses()) || cl;
+}
+
+}
Slice::JavaVisitor::JavaVisitor(const string& dir) :
JavaGenerator(dir)
@@ -190,378 +200,450 @@ Slice::JavaVisitor::~JavaVisitor()
{
}
-ParamDeclList
-Slice::JavaVisitor::getOutParams(const OperationPtr& op)
+string
+Slice::JavaVisitor::getResultType(const OperationPtr& op, const string& package, bool object, bool dispatch)
{
- ParamDeclList outParams;
- ParamDeclList paramList = op->parameters();
- for(ParamDeclList::const_iterator i = paramList.begin(); i != paramList.end(); ++i)
+ if(dispatch && op->hasMarshaledResult())
{
- if((*i)->isOutParam())
+ ContainedPtr c = ContainedPtr::dynamicCast(op->container());
+ assert(c);
+ string abs = getAbsolute(c, package);
+ string name = op->name();
+ name[0] = toupper(static_cast<unsigned char>(name[0]));
+ return abs + "." + name + "MarshaledResult";
+ }
+ else if(op->returnsMultipleValues())
+ {
+ ContainedPtr c = ContainedPtr::dynamicCast(op->container());
+ assert(c);
+ string abs = getAbsolute(c, package);
+ string name = op->name();
+ name[0] = toupper(static_cast<unsigned char>(name[0]));
+ return abs + "." + name + "Result";
+ }
+ else
+ {
+ TypePtr type = op->returnType();
+ bool optional = op->returnIsOptional();
+ if(!type)
{
- outParams.push_back(*i);
+ const ParamDeclList outParams = op->outParameters();
+ if(!outParams.empty())
+ {
+ assert(outParams.size() == 1);
+ type = outParams.front()->type();
+ optional = outParams.front()->optional();
+ }
+ }
+ if(type)
+ {
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
+ assert(cl);
+ if(optional)
+ {
+ return typeToString(type, TypeModeReturn, package, op->getMetaData(), true, true, cl->isLocal());
+ }
+ else if(object)
+ {
+ return typeToObjectString(type, TypeModeReturn, package, op->getMetaData(), true, cl->isLocal());
+ }
+ else
+ {
+ return typeToString(type, TypeModeReturn, package, op->getMetaData(), true, false, cl->isLocal());
+ }
+ }
+ else
+ {
+ return object ? "Void" : "void";
}
}
- return outParams;
}
-vector<string>
-Slice::JavaVisitor::getParams(const OperationPtr& op, const string& package, bool local, bool optionalMapping)
+void
+Slice::JavaVisitor::writeResultType(Output& out, const OperationPtr& op, const string& package)
{
- vector<string> params;
+ string opName = op->name();
+ opName[0] = toupper(static_cast<unsigned char>(opName[0]));
- ParamDeclList paramList = op->parameters();
- for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
+ out << sp << nl << "public static class " << opName << "Result";
+ out << sb;
+
+ //
+ // Make sure none of the out parameters are named "returnValue".
+ //
+ string retval = "returnValue";
+ const ParamDeclList outParams = op->outParameters();
+ for(ParamDeclList::const_iterator p = outParams.begin(); p != outParams.end(); ++p)
{
- StringList metaData = (*q)->getMetaData();
- bool optional = (*q)->optional();
- if(optional && (local || (*q)->isOutParam()))
+ if((*p)->name() == "returnValue")
{
- optional = optionalMapping;
+ retval = "_returnValue";
+ break;
}
- string typeString = typeToString((*q)->type(), (*q)->isOutParam() ? TypeModeOut : TypeModeIn, package,
- metaData, true, optional);
- params.push_back(typeString + ' ' + fixKwd((*q)->name()));
}
- return params;
-}
+ const TypePtr ret = op->returnType();
+ const ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
+ assert(cl);
-vector<string>
-Slice::JavaVisitor::getParamsProxy(const OperationPtr& op, const string& package, bool final, bool optionalMapping)
-{
- vector<string> params;
+ //
+ // Default constructor.
+ //
+ out << nl << "public " << opName << "Result()";
+ out << sb;
+ out << eb;
- ParamDeclList paramList = op->parameters();
- for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
+ //
+ // One-shot constructor.
+ //
+ out << sp << nl << "public " << opName << "Result" << spar;
+ if(ret)
{
- bool optional;
- if((*q)->optional())
+ out << (typeToString(ret, TypeModeIn, package, op->getMetaData(), true, op->returnIsOptional(), cl->isLocal())
+ + " " + retval);
+ }
+ for(ParamDeclList::const_iterator p = outParams.begin(); p != outParams.end(); ++p)
+ {
+ out << (typeToString((*p)->type(), TypeModeIn, package, (*p)->getMetaData(), true, (*p)->optional(),
+ cl->isLocal()) + " " + fixKwd((*p)->name()));
+ }
+ out << epar;
+ out << sb;
+ if(ret)
+ {
+ out << nl << "this." << retval << " = " << retval << ';';
+ }
+ for(ParamDeclList::const_iterator p = outParams.begin(); p != outParams.end(); ++p)
+ {
+ const string name = fixKwd((*p)->name());
+ out << nl << "this." << name << " = " << name << ';';
+ }
+ out << eb;
+
+ //
+ // Members.
+ //
+ out << sp;
+ if(ret)
+ {
+ out << nl << "public " << typeToString(ret, TypeModeIn, package, op->getMetaData(), true,
+ op->returnIsOptional(), cl->isLocal())
+ << ' ' << retval << ';';
+ }
+
+ for(ParamDeclList::const_iterator p = outParams.begin(); p != outParams.end(); ++p)
+ {
+ out << nl << "public " << typeToString((*p)->type(), TypeModeIn, package, (*p)->getMetaData(), true,
+ (*p)->optional(), cl->isLocal())
+ << ' ' << fixKwd((*p)->name()) << ';';
+ }
+
+ if(!cl->isLocal())
+ {
+ ParamDeclList required, optional;
+ op->outParameters(required, optional);
+
+ out << sp << nl << "public void write(com.zeroc.Ice.OutputStream __os)";
+ out << sb;
+
+ int iter = 0;
+ for(ParamDeclList::const_iterator pli = required.begin(); pli != required.end(); ++pli)
{
- optional = (*q)->isOutParam() ? true : optionalMapping;
+ const string paramName = fixKwd((*pli)->name());
+ writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalNone, false, 0, paramName, true, iter,
+ (*pli)->getMetaData());
}
- else
+
+ if(ret && !op->returnIsOptional())
{
- optional = false;
+ writeMarshalUnmarshalCode(out, package, ret, OptionalNone, false, 0, retval, true, iter, op->getMetaData());
}
- StringList metaData = (*q)->getMetaData();
- string typeString = typeToString((*q)->type(), (*q)->isOutParam() ? TypeModeOut : TypeModeIn, package,
- metaData, true, optional);
- if(final)
+ //
+ // Handle optional parameters.
+ //
+ bool checkReturnType = op->returnIsOptional();
+
+ for(ParamDeclList::const_iterator pli = optional.begin(); pli != optional.end(); ++pli)
{
- typeString = "final " + typeString;
+ if(checkReturnType && op->returnTag() < (*pli)->tag())
+ {
+ writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, true, op->returnTag(), retval, true,
+ iter, op->getMetaData());
+ checkReturnType = false;
+ }
+
+ const string paramName = fixKwd((*pli)->name());
+ writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalOutParam, true, (*pli)->tag(), paramName,
+ true, iter, (*pli)->getMetaData());
}
- params.push_back(typeString + ' ' + fixKwd((*q)->name()));
- }
- return params;
-}
+ if(checkReturnType)
+ {
+ writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, true, op->returnTag(), retval, true, iter,
+ op->getMetaData());
+ }
-vector<string>
-Slice::JavaVisitor::getInOutParams(const OperationPtr& op, const string& package, ParamDir paramType, bool /*proxy*/,
- bool optionalMapping)
-{
- vector<string> params;
+ out << eb;
- ParamDeclList paramList = op->parameters();
- for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
- {
- if((*q)->isOutParam() == (paramType == OutParam))
+ out << sp << nl << "public void read(com.zeroc.Ice.InputStream __is)";
+ out << sb;
+
+ iter = 0;
+ for(ParamDeclList::const_iterator pli = required.begin(); pli != required.end(); ++pli)
{
- bool optional = optionalMapping && (*q)->optional();
- string typeString = typeToString((*q)->type(), paramType == InParam ? TypeModeIn : TypeModeOut, package,
- (*q)->getMetaData(), true, optional);
- params.push_back(typeString + ' ' + fixKwd((*q)->name()));
+ const string paramName = fixKwd((*pli)->name());
+ const string patchParams = getPatcher((*pli)->type(), package, paramName, false);
+ writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalNone, false, 0, paramName, false, iter,
+ (*pli)->getMetaData(), patchParams);
}
- }
- return params;
-}
+ if(ret && !op->returnIsOptional())
+ {
+ const string patchParams = getPatcher(ret, package, retval, false);
+ writeMarshalUnmarshalCode(out, package, ret, OptionalNone, false, 0, retval, false, iter, op->getMetaData(),
+ patchParams);
+ }
-vector<string>
-Slice::JavaVisitor::getParamsAsync(const OperationPtr& op, const string& package, bool amd, bool optionalMapping)
-{
- vector<string> params = getInOutParams(op, package, InParam, !amd, optionalMapping);
+ //
+ // Handle optional parameters.
+ //
+ checkReturnType = op->returnIsOptional();
+
+ for(ParamDeclList::const_iterator pli = optional.begin(); pli != optional.end(); ++pli)
+ {
+ if(checkReturnType && op->returnTag() < (*pli)->tag())
+ {
+ const string patchParams = getPatcher(ret, package, retval, true);
+ writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, true, op->returnTag(), retval, false,
+ iter, op->getMetaData(), patchParams);
+ checkReturnType = false;
+ }
- string name = op->name();
- ContainerPtr container = op->container();
- ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- string classNameAsync = getAbsolute(cl, package, amd ? "AMD_" : "AMI_", '_' + name);
- params.insert(params.begin(), classNameAsync + " __cb");
+ const string paramName = fixKwd((*pli)->name());
+ const string patchParams = getPatcher((*pli)->type(), package, paramName, true);
+ writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalOutParam, true, (*pli)->tag(), paramName,
+ false, iter, (*pli)->getMetaData(), patchParams);
+ }
- return params;
+ if(checkReturnType)
+ {
+ const string patchParams = getPatcher(ret, package, retval, true);
+ writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, true, op->returnTag(), retval, false,
+ iter, op->getMetaData(), patchParams);
+ }
+
+ out << eb;
+ }
+
+ out << eb;
}
-vector<string>
-Slice::JavaVisitor::getParamsAsyncCB(const OperationPtr& op, const string& package, bool /*amd*/, bool optionalMapping)
+void
+Slice::JavaVisitor::writeMarshaledResultType(Output& out, const OperationPtr& op, const string& package)
{
- vector<string> params;
+ string opName = op->name();
+ opName[0] = toupper(static_cast<unsigned char>(opName[0]));
- TypePtr ret = op->returnType();
+ out << sp << nl << "public static class " << opName << "MarshaledResult implements com.zeroc.Ice.MarshaledResult";
+ out << sb;
+
+ const TypePtr ret = op->returnType();
+ const ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
+ assert(cl);
+ const ParamDeclList outParams = op->outParameters();
+ const string retval = "__ret";
+
+ out << sp << nl << "public " << opName << "MarshaledResult" << spar;
if(ret)
{
- string retS = typeToString(ret, TypeModeIn, package, op->getMetaData(), true,
- optionalMapping && op->returnIsOptional());
- params.push_back(retS + " __ret");
+ out << (typeToString(ret, TypeModeIn, package, op->getMetaData(), true, op->returnIsOptional(), cl->isLocal())
+ + " " + retval);
+ }
+ for(ParamDeclList::const_iterator p = outParams.begin(); p != outParams.end(); ++p)
+ {
+ out << (typeToString((*p)->type(), TypeModeIn, package, (*p)->getMetaData(), true, (*p)->optional(),
+ cl->isLocal()) + " " + fixKwd((*p)->name()));
}
+ out << "com.zeroc.Ice.Current __current" << epar;
+ out << sb;
+ out << nl << "__os = com.zeroc.IceInternal.Incoming.createResponseOutputStream(__current);";
+ out << nl << "__os.startEncapsulation(__current.encoding, " << opFormatTypeToString(op) << ");";
- ParamDeclList paramList = op->parameters();
- for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
+ ParamDeclList required, optional;
+ op->outParameters(required, optional);
+ int iter = 0;
+ for(ParamDeclList::const_iterator pli = required.begin(); pli != required.end(); ++pli)
+ {
+ const string paramName = fixKwd((*pli)->name());
+ writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalNone, false, 0, paramName, true, iter,
+ (*pli)->getMetaData());
+ }
+
+ if(ret && !op->returnIsOptional())
{
- if((*q)->isOutParam())
+ writeMarshalUnmarshalCode(out, package, ret, OptionalNone, false, 0, retval, true, iter, op->getMetaData());
+ }
+
+ //
+ // Handle optional parameters.
+ //
+ bool checkReturnType = op->returnIsOptional();
+
+ for(ParamDeclList::const_iterator pli = optional.begin(); pli != optional.end(); ++pli)
+ {
+ if(checkReturnType && op->returnTag() < (*pli)->tag())
{
- string typeString = typeToString((*q)->type(), TypeModeIn, package, (*q)->getMetaData(), true,
- optionalMapping && (*q)->optional());
- params.push_back(typeString + ' ' + fixKwd((*q)->name()));
+ writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, true, op->returnTag(), retval, true,
+ iter, op->getMetaData());
+ checkReturnType = false;
}
+
+ const string paramName = fixKwd((*pli)->name());
+ writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalOutParam, true, (*pli)->tag(), paramName,
+ true, iter, (*pli)->getMetaData());
}
- return params;
-}
+ if(checkReturnType)
+ {
+ writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, true, op->returnTag(), retval, true, iter,
+ op->getMetaData());
+ }
-namespace
-{
+ if(op->returnsClasses(false))
+ {
+ out << nl << "__os.writePendingValues();";
+ }
-const char* builtinAsyncCallbackTable[] =
-{
- "TwowayCallbackByte",
- "TwowayCallbackBool",
- "TwowayCallbackShort",
- "TwowayCallbackInt",
- "TwowayCallbackLong",
- "TwowayCallbackFloat",
- "TwowayCallbackDouble"
-};
+ out << nl << "__os.endEncapsulation();";
+
+ out << eb;
+ out << sp;
+ out << nl << "@Override"
+ << nl << "public com.zeroc.Ice.OutputStream getOutputStream()"
+ << sb
+ << nl << "return __os;"
+ << eb;
+
+ out << sp;
+ out << nl << "private com.zeroc.Ice.OutputStream __os;";
+ out << eb;
}
-string
-Slice::JavaVisitor::getAsyncCallbackInterface(const OperationPtr& op, const string& package)
+void
+Slice::JavaVisitor::allocatePatcher(Output& out, const TypePtr& type, const string& package, const string& name)
{
- TypePtr ret = op->returnType();
- ParamDeclList outParams = getOutParams(op);
- bool throws = !op->throws().empty();
- const string suffix = throws ? "UE" : "";
+ BuiltinPtr b = BuiltinPtr::dynamicCast(type);
+ ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
+ assert((b && b->usesClasses()) || cl);
- if(!ret && outParams.empty())
+ string clsName;
+ if(b || cl->isInterface())
{
- return throws ? "Ice.TwowayCallbackVoidUE" : "Ice.OnewayCallback";
- }
- else if((ret && outParams.empty()) || (!ret && outParams.size() == 1))
- {
- TypePtr t = ret ? ret : outParams.front()->type();
- bool optional = ret ? op->returnIsOptional() : outParams.front()->optional();
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(t);
- if(builtin && !optional)
- {
- const string prefix = "Ice.";
- switch(builtin->kind())
- {
- case Builtin::KindByte:
- case Builtin::KindBool:
- case Builtin::KindShort:
- case Builtin::KindInt:
- case Builtin::KindLong:
- case Builtin::KindFloat:
- case Builtin::KindDouble:
- {
- return prefix + builtinAsyncCallbackTable[builtin->kind()] + suffix;
- }
- default:
- {
- break;
- }
- }
- }
-
- return "Ice.TwowayCallbackArg1" + suffix + "<" +
- typeToString(t, TypeModeIn, package, op->getMetaData(), true, optional) + ">";
+ clsName = "com.zeroc.Ice.Value";
}
else
{
- ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
- return "_Callback_" + cl->name() + "_" + op->name();
+ clsName = getAbsolute(cl, package);
}
+
+ out << nl << "com.zeroc.IceInternal.Patcher<" << clsName << "> " << name << " = new com.zeroc.IceInternal.Patcher<"
+ << clsName << ">(" << clsName << ".class, " << clsName << ".ice_staticId);";
}
string
-Slice::JavaVisitor::getAsyncCallbackBaseClass(const OperationPtr& op, bool functional)
+Slice::JavaVisitor::getPatcher(const TypePtr& type, const string& package, const string& dest, bool optionalMapping)
{
- assert(op->returnsData());
- TypePtr ret = op->returnType();
- ParamDeclList outParams = getOutParams(op);
-
- bool throws = !op->throws().empty();
- const string suffix = throws ? "UE" : "";
- if(!ret && outParams.empty())
- {
- assert(throws);
- return functional ?
- "IceInternal.Functional_TwowayCallbackVoidUE" :
- "IceInternal.TwowayCallback implements Ice.TwowayCallbackVoidUE";
- }
- else if((ret && outParams.empty()) || (!ret && outParams.size() == 1))
+ BuiltinPtr b = BuiltinPtr::dynamicCast(type);
+ ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
+ ostringstream ostr;
+ if((b && b->usesClasses()) || cl)
{
- TypePtr t = ret ? ret : outParams.front()->type();
- bool optional = ret ? op->returnIsOptional() : outParams.front()->optional();
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(t);
- if(builtin && !optional)
+ string clsName;
+ if(b || cl->isInterface())
{
- switch(builtin->kind())
- {
- case Builtin::KindByte:
- case Builtin::KindBool:
- case Builtin::KindShort:
- case Builtin::KindInt:
- case Builtin::KindLong:
- case Builtin::KindFloat:
- case Builtin::KindDouble:
- {
- ostringstream os;
- os << (functional ? "IceInternal.Functional_" : "IceInternal.TwowayCallback implements Ice.")
- << builtinAsyncCallbackTable[builtin->kind()] + suffix;
- return os.str();
- }
- default:
- {
- break;
- }
- }
- }
-
- ostringstream os;
- if(functional)
- {
- os << "IceInternal.Functional_TwowayCallbackArg1";
+ clsName = "com.zeroc.Ice.Value";
}
else
{
- os << "IceInternal.TwowayCallback implements Ice.TwowayCallbackArg1";
+ clsName = getAbsolute(cl, package);
}
- os << suffix << "<" << typeToString(t, TypeModeIn, getPackage(op), op->getMetaData(), true, optional) + ">";
- return os.str();
- }
- else
- {
- ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
- ostringstream os;
- if(functional)
+
+ ostr << "new com.zeroc.IceInternal.Patcher<" << clsName << ">(" << clsName << ".class, "
+ << clsName << ".ice_staticId, " << "__v -> ";
+ if(optionalMapping)
{
- os << "IceInternal.Functional_TwowayCallback" << suffix << " implements ";
+ ostr << dest << " = java.util.Optional.ofNullable(__v)";
}
else
{
- os << "IceInternal.TwowayCallback implements ";
+ ostr << dest << " = __v";
}
- os << "_Callback_" << cl->name() << "_" << op->name();
- return os.str();
+ ostr << ')';
}
+ return ostr.str();
}
string
-Slice::JavaVisitor::getLambdaResponseCB(const OperationPtr& op, const string& package)
+Slice::JavaVisitor::getFutureType(const OperationPtr& op, const string& package)
{
- TypePtr ret = op->returnType();
- ParamDeclList outParams = getOutParams(op);
- if(!ret && outParams.empty())
- {
- return "IceInternal.Functional_VoidCallback";
- }
- else if((ret && outParams.empty()) || (!ret && outParams.size() == 1))
+ if(op->returnType() || op->outParameters().size() > 0)
{
- TypePtr t = ret ? ret : outParams.front()->type();
- bool optional = ret ? op->returnIsOptional() : outParams.front()->optional();
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(t);
- if(builtin && !optional)
- {
- static const char* builtinTable[] =
- {
- "IceInternal.Functional_ByteCallback",
- "IceInternal.Functional_BoolCallback",
- "IceInternal.Functional_ShortCallback",
- "IceInternal.Functional_IntCallback",
- "IceInternal.Functional_LongCallback",
- "IceInternal.Functional_FloatCallback",
- "IceInternal.Functional_DoubleCallback"
- };
- switch(builtin->kind())
- {
- case Builtin::KindByte:
- case Builtin::KindBool:
- case Builtin::KindShort:
- case Builtin::KindInt:
- case Builtin::KindLong:
- case Builtin::KindFloat:
- case Builtin::KindDouble:
- {
- return builtinTable[builtin->kind()];
- }
- default:
- {
- break;
- }
- }
- }
-
- return "IceInternal.Functional_GenericCallback1<" +
- typeToString(t, TypeModeIn, package, op->getMetaData(), true, optional) + ">";
+ return "java.util.concurrent.CompletableFuture<" + getResultType(op, package, true, false) + ">";
}
else
{
- ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
- return "FunctionalCallback_" + cl->name() + "_" + op->name() + "_Response";
+ return "java.util.concurrent.CompletableFuture<Void>";
}
}
-vector<string>
-Slice::JavaVisitor::getParamsAsyncLambda(const OperationPtr& op, const string& package, bool context, bool sentCB,
- bool optionalMapping, bool inParams)
+string
+Slice::JavaVisitor::getFutureImplType(const OperationPtr& op, const string& package)
{
- vector<string> params;
-
- if(inParams)
+ if(op->returnType() || op->outParameters().size() > 0)
{
- params = getInOutParams(op, package, InParam, false, optionalMapping);
+ return "com.zeroc.IceInternal.OutgoingAsync<" + getResultType(op, package, true, false) + ">";
}
-
- if(context)
+ else
{
- params.push_back("java.util.Map<String, String> __ctx");
+ return "com.zeroc.IceInternal.OutgoingAsync<Void>";
}
+}
- params.push_back(getLambdaResponseCB(op, package) + " __responseCb");
-
- if(!op->throws().empty())
- {
- params.push_back("IceInternal.Functional_GenericCallback1<Ice.UserException> __userExceptionCb");
- }
+vector<string>
+Slice::JavaVisitor::getParams(const OperationPtr& op, const string& package)
+{
+ vector<string> params;
- params.push_back("IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb");
+ const ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
+ assert(cl);
- if(sentCB)
+ const ParamDeclList paramList = op->inParameters();
+ for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- params.push_back("IceInternal.Functional_BoolCallback __sentCb");
+ const string type = typeToString((*q)->type(), TypeModeIn, package, (*q)->getMetaData(), true,
+ (*q)->optional(), cl->isLocal());
+ params.push_back(type + ' ' + fixKwd((*q)->name()));
}
return params;
}
vector<string>
-Slice::JavaVisitor::getArgsAsyncLambda(const OperationPtr& op, const string& package, bool context, bool sentCB)
+Slice::JavaVisitor::getParamsProxy(const OperationPtr& op, const string& package, bool optionalMapping)
{
- vector<string> args = getInOutArgs(op, InParam);
- args.push_back(context ? "__ctx" : "null");
- args.push_back(context ? "true" : "false");
- args.push_back("false"); // __synchronous
- args.push_back("__responseCb");
- if(!op->throws().empty())
+ vector<string> params;
+
+ ParamDeclList inParams = op->inParameters();
+ for(ParamDeclList::const_iterator q = inParams.begin(); q != inParams.end(); ++q)
{
- args.push_back("__userExceptionCb");
+ const string typeString = typeToString((*q)->type(), TypeModeIn, package, (*q)->getMetaData(), true,
+ optionalMapping && (*q)->optional());
+ params.push_back(typeString + ' ' + fixKwd((*q)->name()));
}
- args.push_back("__exceptionCb");
- args.push_back(sentCB ? "__sentCb" : "null");
- return args;
+
+ return params;
}
vector<string>
@@ -579,175 +661,190 @@ Slice::JavaVisitor::getArgs(const OperationPtr& op)
}
vector<string>
-Slice::JavaVisitor::getInOutArgs(const OperationPtr& op, ParamDir paramType)
+Slice::JavaVisitor::getInArgs(const OperationPtr& op, bool patcher)
{
vector<string> args;
- ParamDeclList paramList = op->parameters();
+ ParamDeclList paramList = op->inParameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- if((*q)->isOutParam() == (paramType == OutParam))
+ string s = fixKwd((*q)->name());
+ if(patcher && isValue((*q)->type()))
{
- args.push_back(fixKwd((*q)->name()));
+ s += ".value";
}
+ args.push_back(s);
}
return args;
}
-vector<string>
-Slice::JavaVisitor::getArgsAsync(const OperationPtr& op)
-{
- vector<string> args = getInOutArgs(op, InParam);
- args.insert(args.begin(), "__cb");
- return args;
-}
-
-vector<string>
-Slice::JavaVisitor::getArgsAsyncCB(const OperationPtr& op)
+void
+Slice::JavaVisitor::writeMarshalProxyParams(Output& out, const string& package, const OperationPtr& op,
+ bool optionalMapping)
{
- vector<string> args;
-
- TypePtr ret = op->returnType();
- if(ret)
+ int iter = 0;
+ ParamDeclList required, optional;
+ op->inParameters(required, optional);
+ for(ParamDeclList::const_iterator pli = required.begin(); pli != required.end(); ++pli)
{
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
- {
- args.push_back("__ret.value");
- }
- else
- {
- args.push_back("__ret");
- }
+ string paramName = fixKwd((*pli)->name());
+ writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalNone, false, 0, paramName, true,
+ iter, (*pli)->getMetaData());
}
- ParamDeclList paramList = op->parameters();
- for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
+ //
+ // Handle optional parameters.
+ //
+ for(ParamDeclList::const_iterator pli = optional.begin(); pli != optional.end(); ++pli)
{
- if((*q)->isOutParam())
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type()))
- {
- args.push_back(fixKwd((*q)->name()) + ".value");
- }
- else
- {
- args.push_back(fixKwd((*q)->name()));
- }
- }
+ writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalInParam, optionalMapping,
+ (*pli)->tag(), fixKwd((*pli)->name()), true, iter, (*pli)->getMetaData());
}
- return args;
+ if(op->sendsClasses(false))
+ {
+ out << nl << "__os.writePendingValues();";
+ }
}
void
-Slice::JavaVisitor::writeMarshalUnmarshalParams(Output& out, const string& package, const ParamDeclList& params,
- const OperationPtr& op, int& iter, bool marshal, bool optionalMapping,
- bool dispatch)
+Slice::JavaVisitor::writeUnmarshalProxyResults(Output& out, const string& package, const OperationPtr& op)
{
- ParamDeclList optionals;
- for(ParamDeclList::const_iterator pli = params.begin(); pli != params.end(); ++pli)
+ const ParamDeclList outParams = op->outParameters();
+ const TypePtr ret = op->returnType();
+ const string name = "__ret";
+
+ if(op->returnsMultipleValues())
+ {
+ string resultType = getResultType(op, package, false, false);
+ out << nl << resultType << ' ' << name << " = new " << resultType << "();";
+ out << nl << name << ".read(__is);";
+ if(op->returnsClasses(false))
+ {
+ out << nl << "__is.readPendingValues();";
+ }
+ out << nl << "return " << name << ';';
+ }
+ else
{
- if((*pli)->optional())
+ string resultType = getResultType(op, package, false, false);
+
+ bool optional;
+ TypePtr type;
+ int tag;
+ StringList metaData;
+ if(ret)
{
- optionals.push_back(*pli);
+ type = ret;
+ optional = op->returnIsOptional();
+ tag = op->returnTag();
+ metaData = op->getMetaData();
}
else
{
- string paramName = fixKwd((*pli)->name());
- bool holder = marshal == dispatch;
- string patchParams;
- if(!marshal)
- {
- patchParams = paramName;
- }
- writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalNone, false, 0, paramName, marshal,
- iter, holder, (*pli)->getMetaData(), patchParams);
+ assert(outParams.size() == 1);
+ optional = outParams.front()->optional();
+ type = outParams.front()->type();
+ tag = outParams.front()->tag();
+ metaData = outParams.front()->getMetaData();
}
- }
-
- TypePtr ret;
- bool returnsObject = false;
- if(op && op->returnType())
- {
- ret = op->returnType();
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
- ClassDeclPtr cl = ClassDeclPtr::dynamicCast(ret);
- returnsObject = (builtin && builtin->kind() == Builtin::KindObject) || cl;
- const bool optional = optionalMapping && op->returnIsOptional();
+ const bool val = isValue(type);
- string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData(), true, optional);
- bool holder = false;
+ int iter = 0;
- if(!marshal)
+ if(optional)
{
- if(optional)
+ if(val)
{
- out << nl << retS << " __ret = new " << retS << "();";
+ allocatePatcher(out, type, package, name);
}
- else if(returnsObject)
+ else
{
- out << nl << retS << "Holder __ret = new " << retS << "Holder();";
- holder = true;
+ out << nl << resultType << ' ' << name << ';';
}
- else if(StructPtr::dynamicCast(ret))
+ writeMarshalUnmarshalCode(out, package, type, ret ? OptionalReturnParam : OptionalOutParam, true,
+ tag, name, false, iter, metaData, name);
+ }
+ else
+ {
+ if(val)
{
- out << nl << retS << " __ret = null;";
+ allocatePatcher(out, type, package, name);
+ }
+ else if(StructPtr::dynamicCast(type))
+ {
+ out << nl << resultType << ' ' << name << " = null;";
}
else
{
- out << nl << retS << " __ret;";
+ out << nl << resultType << ' ' << name << ';';
}
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, name, false, iter, metaData, name);
}
- if(!op->returnIsOptional())
+ if(op->returnsClasses(false))
{
- writeMarshalUnmarshalCode(out, package, ret, OptionalNone, false, 0, "__ret", marshal, iter, holder,
- op->getMetaData());
+ out << nl << "__is.readPendingValues();";
}
- }
- //
- // Sort optional parameters by tag.
- //
- class SortFn
- {
- public:
- static bool compare(const ParamDeclPtr& lhs, const ParamDeclPtr& rhs)
+ if(optional && val)
{
- return lhs->tag() < rhs->tag();
+ out << nl << "return java.util.Optional.ofNullable(" << name << ".value);";
}
- };
- optionals.sort(SortFn::compare);
-
- //
- // Handle optional parameters.
- //
- bool checkReturnType = op && op->returnIsOptional();
+ else if(val)
+ {
+ out << nl << "return " << name << ".value;";
+ }
+ else
+ {
+ out << nl << "return " << name << ';';
+ }
+ }
+}
- for(ParamDeclList::const_iterator pli = optionals.begin(); pli != optionals.end(); ++pli)
+void
+Slice::JavaVisitor::writeMarshalServantResults(Output& out, const string& package, const OperationPtr& op,
+ const string& param)
+{
+ if(op->returnsMultipleValues())
{
- if(checkReturnType && op->returnTag() < (*pli)->tag())
+ out << nl << param << ".write(__os);";
+ }
+ else
+ {
+ const ParamDeclList params = op->outParameters();
+ bool optional;
+ OptionalMode mode;
+ TypePtr type;
+ int tag;
+ StringList metaData;
+ if(op->returnType())
+ {
+ type = op->returnType();
+ optional = op->returnIsOptional();
+ mode = optional ? OptionalReturnParam : OptionalNone;
+ tag = op->returnTag();
+ metaData = op->getMetaData();
+ }
+ else
{
- writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, optionalMapping, op->returnTag(),
- "__ret", marshal, iter, false, op->getMetaData());
- checkReturnType = false;
+ assert(params.size() == 1);
+ optional = params.front()->optional();
+ mode = optional ? OptionalOutParam : OptionalNone;
+ type = params.front()->type();
+ tag = params.front()->tag();
+ metaData = params.front()->getMetaData();
}
- const bool holder = dispatch && (*pli)->isOutParam() && !optionalMapping;
-
- writeMarshalUnmarshalCode(out, package, (*pli)->type(),
- (*pli)->isOutParam() ? OptionalOutParam : OptionalInParam, optionalMapping,
- (*pli)->tag(), fixKwd((*pli)->name()), marshal, iter, holder, (*pli)->getMetaData());
+ int iter = 0;
+ writeMarshalUnmarshalCode(out, package, type, mode, true, tag, param, true, iter, metaData);
}
- if(checkReturnType)
+ if(op->returnsClasses(false))
{
- writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, optionalMapping, op->returnTag(), "__ret",
- marshal, iter, false, op->getMetaData());
+ out << nl << "__os.writePendingValues();";
}
}
@@ -781,7 +878,7 @@ Slice::JavaVisitor::writeMarshalDataMember(Output& out, const string& package, c
if(!member->optional())
{
writeMarshalUnmarshalCode(out, package, member->type(), OptionalNone, false, 0, fixKwd(member->name()),
- true, iter, false, member->getMetaData());
+ true, iter, member->getMetaData());
}
else
{
@@ -789,216 +886,82 @@ Slice::JavaVisitor::writeMarshalDataMember(Output& out, const string& package, c
<< getOptionalFormat(member->type()) << "))";
out << sb;
writeMarshalUnmarshalCode(out, package, member->type(), OptionalMember, false, 0, fixKwd(member->name()), true,
- iter, false, member->getMetaData());
+ iter, member->getMetaData());
out << eb;
}
}
void
-Slice::JavaVisitor::writeUnmarshalDataMember(Output& out, const string& package, const DataMemberPtr& member,
- int& iter, bool needPatcher, int& patchIter)
+Slice::JavaVisitor::writeUnmarshalDataMember(Output& out, const string& package, const DataMemberPtr& member, int& iter)
{
- string patchParams;
- if(needPatcher)
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(member->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(member->type()))
- {
- ostringstream ostr;
- ostr << "new Patcher(" << patchIter++ << ')';
- patchParams = ostr.str();
- }
- }
+ // TBD: Handle passing interface-by-value
- if(!member->optional())
- {
- writeMarshalUnmarshalCode(out, package, member->type(), OptionalNone, false, 0, fixKwd(member->name()), false,
- iter, false, member->getMetaData(), patchParams);
- }
- else
+ const string patchParams = getPatcher(member->type(), package, fixKwd(member->name()), false);
+
+ if(member->optional())
{
out << nl << "if(__has_" << member->name() << " = __is.readOptional(" << member->tag() << ", "
<< getOptionalFormat(member->type()) << "))";
out << sb;
writeMarshalUnmarshalCode(out, package, member->type(), OptionalMember, false, 0, fixKwd(member->name()), false,
- iter, false, member->getMetaData(), patchParams);
+ iter, member->getMetaData(), patchParams);
out << eb;
}
+ else
+ {
+ writeMarshalUnmarshalCode(out, package, member->type(), OptionalNone, false, 0, fixKwd(member->name()), false,
+ iter, member->getMetaData(), patchParams);
+ }
}
void
-Slice::JavaVisitor::writePatcher(Output& out, const string& package, const DataMemberList& classMembers,
- const DataMemberList& optionalMembers)
+Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
{
- out << sp << nl << "private class Patcher implements Ice.ReadValueCallback";
- out << sb;
- if(classMembers.size() > 1)
+ const string name = fixKwd(p->name());
+ const string package = getPackage(p);
+ const string scoped = p->scoped();
+ const ClassList bases = p->bases();
+ ClassDefPtr base;
+ if(!bases.empty() && !bases.front()->isInterface())
{
- out << sp << nl << "Patcher(int member)";
- out << sb;
- out << nl << "__member = member;";
- out << eb;
+ base = bases.front();
}
+ const OperationList ops = p->operations();
- out << sp << nl << "public void" << nl << "valueReady(Ice.Object v)";
- out << sb;
- if(classMembers.size() > 1)
- {
- out << nl << "switch(__member)";
- out << sb;
- }
- int memberCount = 0;
- for(DataMemberList::const_iterator d = classMembers.begin(); d != classMembers.end(); ++d)
+ for(OperationList::const_iterator r = ops.begin(); r != ops.end(); ++r)
{
- if((*d)->optional())
- {
- continue;
- }
-
- BuiltinPtr b = BuiltinPtr::dynamicCast((*d)->type());
- if(b)
- {
- assert(b->kind() == Builtin::KindObject);
- }
+ OperationPtr op = *r;
- if(classMembers.size() > 1)
- {
- out.dec();
- out << nl << "case " << memberCount << ":";
- out.inc();
- if(b)
- {
- out << nl << "__typeId = Ice.ObjectImpl.ice_staticId();";
- }
- else
- {
- out << nl << "__typeId = \"" << (*d)->type()->typeId() << "\";";
- }
- }
+ vector<string> params = getParams(op, package);
- string memberName = fixKwd((*d)->name());
- if(b)
- {
- out << nl << memberName << " = v;";
- }
- else
- {
- string memberType = typeToString((*d)->type(), TypeModeMember, package);
- out << nl << "if(v == null || v instanceof " << memberType << ")";
- out << sb;
- out << nl << memberName << " = (" << memberType << ")v;";
- out << eb;
- out << nl << "else";
- out << sb;
- out << nl << "IceInternal.Ex.throwUOE(type(), v);";
- out << eb;
- }
+ const bool amd = p->hasMetaData("amd") || op->hasMetaData("amd");
- if(classMembers.size() > 1)
- {
- out << nl << "break;";
- }
+ ExceptionList throws = op->throws();
+ throws.sort();
+ throws.unique();
- memberCount++;
- }
+ out << sp;
- for(DataMemberList::const_iterator d = optionalMembers.begin(); d != optionalMembers.end(); ++d)
- {
- BuiltinPtr b = BuiltinPtr::dynamicCast((*d)->type());
- if(b && b->kind() != Builtin::KindObject)
+ const string deprecateReason = getDeprecateReason(op, p, "operation");
+ const string currentParam = "@param __current The Current object for the invocation.";
+ if(amd)
{
- continue;
+ writeDocCommentAsync(out, op, InParam, currentParam);
+ out << nl << "java.util.concurrent.CompletionStage<" << getResultType(op, package, true, true) << "> "
+ << op->name() << "Async" << spar << params << "com.zeroc.Ice.Current __current" << epar;
+ writeThrowsClause(package, throws);
+ out << ';';
}
-
- TypePtr paramType = (*d)->type();
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
+ else
{
-
- if(classMembers.size() > 1)
- {
- out.dec();
- out << nl << "case " << memberCount << ":";
- out.inc();
- if(b)
- {
- out << nl << "__typeId = Ice.ObjectImpl.ice_staticId();";
- }
- else
- {
- out << nl << "__typeId = \"" << (*d)->type()->typeId() << "\";";
- }
- }
-
- string capName = (*d)->name();
- capName[0] = toupper(static_cast<unsigned char>(capName[0]));
-
- if(b)
- {
- out << nl << "set" << capName << "(v);";
- }
- else
- {
- string memberType = typeToString((*d)->type(), TypeModeMember, package);
- out << nl << "if(v == null || v instanceof " << memberType << ")";
- out << sb;
- out << nl << "set" << capName << "((" << memberType << ")v);";
- out << eb;
- out << nl << "else";
- out << sb;
- out << nl << "IceInternal.Ex.throwUOE(type(), v);";
- out << eb;
- }
-
- if(classMembers.size() > 1)
- {
- out << nl << "break;";
- }
-
- memberCount++;
+ writeDocComment(out, op, deprecateReason, currentParam);
+ out << nl << getResultType(op, package, false, true) << ' ' << fixKwd(op->name()) << spar << params
+ << "com.zeroc.Ice.Current __current" << epar;
+ writeThrowsClause(package, throws);
+ out << ';';
}
}
- if(classMembers.size() > 1)
- {
- out << eb;
- }
- out << eb;
-
- out << sp << nl << "public String" << nl << "type()";
- out << sb;
- if(classMembers.size() > 1)
- {
- out << nl << "return __typeId;";
- }
- else
- {
- out << nl << "return \"" << (*classMembers.begin())->type()->typeId() << "\";";
- }
- out << eb;
-
- if(classMembers.size() > 1)
- {
- out << sp << nl << "private int __member;";
- out << nl << "private String __typeId;";
- }
-
- out << eb;
-}
-
-void
-Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr& p)
-{
- string name = fixKwd(p->name());
- string package = getPackage(p);
- string scoped = p->scoped();
- ClassList bases = p->bases();
- ClassDefPtr base;
- if(!bases.empty() && !bases.front()->isInterface())
- {
- base = bases.front();
- }
-
ClassList allBases = p->allBases();
StringList ids;
transform(allBases.begin(), allBases.end(), back_inserter(ids), constMemFun(&Contained::scoped));
@@ -1008,12 +971,10 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
other.sort();
ids.merge(other);
ids.unique();
- StringList::const_iterator firstIter = ids.begin();
StringList::const_iterator scopedIter = find(ids.begin(), ids.end(), scoped);
assert(scopedIter != ids.end());
- StringList::difference_type scopedPos = ::IceUtilInternal::distance(firstIter, scopedIter);
- out << sp << nl << "public static final String[] __ids =";
+ out << sp << nl << "static final String[] __ids =";
out << sb;
for(StringList::const_iterator q = ids.begin(); q != ids.end();)
@@ -1026,169 +987,34 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
}
out << eb << ';';
- out << sp << nl << "public boolean ice_isA(String s)";
- out << sb;
- out << nl << "return java.util.Arrays.binarySearch(__ids, s) >= 0;";
- out << eb;
-
- out << sp << nl << "public boolean ice_isA(String s, Ice.Current __current)";
- out << sb;
- out << nl << "return java.util.Arrays.binarySearch(__ids, s) >= 0;";
- out << eb;
-
- out << sp << nl << "public String[] ice_ids()";
+ out << sp << nl << "@Override" << nl << "default String[] ice_ids(com.zeroc.Ice.Current __current)";
out << sb;
out << nl << "return __ids;";
out << eb;
- out << sp << nl << "public String[] ice_ids(Ice.Current __current)";
- out << sb;
- out << nl << "return __ids;";
- out << eb;
-
- out << sp << nl << "public String ice_id()";
- out << sb;
- out << nl << "return __ids[" << scopedPos << "];";
- out << eb;
-
- out << sp << nl << "public String ice_id(Ice.Current __current)";
+ out << sp << nl << "@Override" << nl << "default String ice_id(com.zeroc.Ice.Current __current)";
out << sb;
- out << nl << "return __ids[" << scopedPos << "];";
+ out << nl << "return ice_staticId();";
out << eb;
- out << sp << nl << "public static String ice_staticId()";
+ out << sp << nl;
+ out << "static String ice_staticId()";
out << sb;
- out << nl << "return __ids[" << scopedPos << "];";
- out << eb;
-
- OperationList ops = p->allOperations();
-
- //
- // Write the "no Current" implementation of each operation.
- //
- for(OperationList::const_iterator r = ops.begin(); r != ops.end(); ++r)
+ if(p->isInterface())
{
- OperationPtr op = *r;
- string opName = op->name();
-
- ContainerPtr container = op->container();
- ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- assert(cl);
-
- string deprecateReason = getDeprecateReason(op, cl, "operation");
-
- const bool amd = cl->hasMetaData("amd") || op->hasMetaData("amd");
- const bool optionalMapping = useOptionalMapping(op);
-
- vector<string> params;
- vector<string> args;
- TypePtr ret;
-
- if(amd)
- {
- opName += "_async";
- params = getParamsAsync(op, package, true, true);
- args = getArgsAsync(op);
- }
- else
- {
- opName = fixKwd(opName);
- ret = op->returnType();
- params = getParams(op, package, false, optionalMapping);
- args = getArgs(op);
- }
-
- ExceptionList throws = op->throws();
- throws.sort();
- throws.unique();
-
- //
- // Only generate a "no current" version of the operation if it hasn't been done in a base
- // class already, because the "no current" version is final.
- //
- bool generateOperation = cl == p; // Generate if the operation is defined in this class.
- if(!generateOperation)
- {
- //
- // The operation is not defined in this class.
- //
- if(!bases.empty())
- {
- //
- // Check if the operation is already implemented by a base class.
- //
- bool implementedByBase = false;
- if(!bases.front()->isInterface())
- {
- OperationList baseOps = bases.front()->allOperations();
- OperationList::const_iterator i;
- for(i = baseOps.begin(); i != baseOps.end(); ++i)
- {
- if((*i)->name() == op->name())
- {
- implementedByBase = true;
- break;
- }
- }
- if(i == baseOps.end())
- {
- generateOperation = true;
- }
- }
- if(!generateOperation && !implementedByBase)
- {
- //
- // No base class defines the operation. Check if one of the
- // interfaces defines it, in which case this class must provide it.
- //
- if(bases.front()->isInterface() || bases.size() > 1)
- {
- generateOperation = true;
- }
- }
- }
- }
- if(generateOperation)
- {
- out << sp;
- if(amd)
- {
- writeDocCommentAsync(out, op, InParam);
- }
- else
- {
- writeDocComment(out, op, deprecateReason);
- }
- out << nl << "public final "
- << typeToString(ret, TypeModeReturn, package, op->getMetaData(), true,
- optionalMapping && op->returnIsOptional())
- << ' ' << opName << spar << params << epar;
- if(op->hasMetaData("UserException"))
- {
- out.inc();
- out << nl << "throws Ice.UserException";
- out.dec();
- }
- else
- {
- writeThrowsClause(package, throws);
- }
- out << sb << nl;
- if(ret)
- {
- out << "return ";
- }
- out << opName << spar << args << "null" << epar << ';';
- out << eb;
- }
+ out << nl << "return ice_staticId;";
}
+ else
+ {
+ out << nl << "return " << fixKwd(p->name()) << ".ice_staticId;";
+ }
+ out << eb;
//
- // Dispatch operations. We only generate methods for operations
+ // Dispatch methods. We only generate methods for operations
// defined in this ClassDef, because we reuse existing methods
// for inherited operations.
//
- ops = p->operations();
for(OperationList::const_iterator r = ops.begin(); r != ops.end(); ++r)
{
OperationPtr op = *r;
@@ -1204,76 +1030,62 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
{
out << nl << "/** @deprecated **/";
}
- out << nl << "public static Ice.DispatchStatus ___" << opName << '(' << name
- << " __obj, IceInternal.Incoming __inS, Ice.Current __current)";
+ out << nl;
+ out << "static java.util.concurrent.CompletionStage<com.zeroc.Ice.OutputStream> ___" << opName << '(';
+ if(p->isInterface())
+ {
+ out << name;
+ }
+ else
+ {
+ out << '_' << p->name() << "Disp";
+ }
+ out << " __obj, final com.zeroc.IceInternal.Incoming __inS, com.zeroc.Ice.Current __current)";
+ if(!op->throws().empty())
+ {
+ out.inc();
+ out << nl << "throws com.zeroc.Ice.UserException";
+ out.dec();
+ }
out << sb;
const bool amd = cl->hasMetaData("amd") || op->hasMetaData("amd");
- const bool optionalMapping = useOptionalMapping(op);
- if(!amd)
- {
- TypePtr ret = op->returnType();
+ const TypePtr ret = op->returnType();
- ParamDeclList inParams;
- ParamDeclList outParams;
- ParamDeclList paramList = op->parameters();
- for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
- {
- if((*pli)->isOutParam())
- {
- outParams.push_back(*pli);
- }
- else
- {
- inParams.push_back(*pli);
- }
- }
+ const ParamDeclList inParams = op->inParameters();
+ const ParamDeclList outParams = op->outParameters();
- ExceptionList throws = op->throws();
- throws.sort();
- throws.unique();
+ out << nl << "com.zeroc.Ice.Object.__checkMode(" << sliceModeToIceMode(op->mode()) << ", __current.mode);";
+
+ if(!inParams.empty())
+ {
+ ParamDeclList values;
//
- // Arrange exceptions into most-derived to least-derived order. If we don't
- // do this, a base exception handler can appear before a derived exception
- // handler, causing compiler warnings and resulting in the base exception
- // being marshaled instead of the derived exception.
+ // Declare 'in' parameters.
//
-#if defined(__SUNPRO_CC)
- throws.sort(Slice::derivedToBaseCompare);
-#else
- throws.sort(Slice::DerivedToBaseCompare());
-#endif
-
- int iter;
-
- out << nl << "__checkMode(" << sliceModeToIceMode(op->mode()) << ", __current.mode);";
-
- if(!inParams.empty())
+ out << nl << "com.zeroc.Ice.InputStream __is = __inS.startReadParams();";
+ for(ParamDeclList::const_iterator pli = inParams.begin(); pli != inParams.end(); ++pli)
{
- //
- // Unmarshal 'in' parameters.
- //
- out << nl << "Ice.InputStream __is = __inS.startReadParams();";
- for(ParamDeclList::const_iterator pli = inParams.begin(); pli != inParams.end(); ++pli)
+ const TypePtr paramType = (*pli)->type();
+ if(isValue(paramType))
{
- TypePtr paramType = (*pli)->type();
- string paramName = fixKwd((*pli)->name());
- string typeS = typeToString(paramType, TypeModeIn, package, (*pli)->getMetaData(),
- true, (*pli)->optional());
+ allocatePatcher(out, paramType, package, "__" + (*pli)->name());
+ values.push_back(*pli);
+ }
+ else
+ {
+ const string paramName = fixKwd((*pli)->name());
+ const string typeS = typeToString(paramType, TypeModeIn, package, (*pli)->getMetaData(), true,
+ (*pli)->optional());
if((*pli)->optional())
{
- out << nl << typeS << ' ' << paramName << " = new " << typeS << "();";
+ out << nl << typeS << ' ' << paramName << ';';
}
else
{
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
- {
- out << nl << typeS << "Holder " << paramName << " = new " << typeS << "Holder();";
- }
- else if(StructPtr::dynamicCast(paramType))
+ if(StructPtr::dynamicCast(paramType))
{
out << nl << typeS << ' ' << paramName << " = null;";
}
@@ -1283,199 +1095,115 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
}
}
}
- iter = 0;
- writeMarshalUnmarshalParams(out, package, inParams, 0, iter, false, true, true);
- if(op->sendsClasses(false))
- {
- out << nl << "__is.readPendingValues();";
- }
- out << nl << "__inS.endReadParams();";
- }
- else
- {
- out << nl << "__inS.readEmptyParams();";
}
//
- // Declare 'out' parameters.
+ // Unmarshal 'in' parameters.
//
- for(ParamDeclList::const_iterator pli = outParams.begin(); pli != outParams.end(); ++pli)
+ ParamDeclList required, optional;
+ op->inParameters(required, optional);
+ int iter = 0;
+ for(ParamDeclList::const_iterator pli = required.begin(); pli != required.end(); ++pli)
{
- string typeS = typeToString((*pli)->type(), TypeModeOut, package, (*pli)->getMetaData(), true,
- optionalMapping && (*pli)->optional());
- out << nl << typeS << ' ' << fixKwd((*pli)->name()) << " = new " << typeS << "();";
+ const string paramName = isValue((*pli)->type()) ? ("__" + (*pli)->name()) : fixKwd((*pli)->name());
+ writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalNone, false, 0, paramName, false,
+ iter, (*pli)->getMetaData(), paramName);
}
-
- //
- // Call on the servant.
- //
- if(!throws.empty())
+ for(ParamDeclList::const_iterator pli = optional.begin(); pli != optional.end(); ++pli)
{
- out << nl << "try";
- out << sb;
+ const string paramName = isValue((*pli)->type()) ? ("__" + (*pli)->name()) : fixKwd((*pli)->name());
+ writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalInParam, true, (*pli)->tag(),
+ paramName, false, iter, (*pli)->getMetaData(), paramName);
}
- out << nl;
- if(ret)
+ if(op->sendsClasses(false))
{
- string retS = typeToString(ret, TypeModeReturn, package, opMetaData, true,
- optionalMapping && op->returnIsOptional());
- out << retS << " __ret = ";
+ out << nl << "__is.readPendingValues();";
}
- out << "__obj." << fixKwd(opName) << '(';
- for(ParamDeclList::const_iterator pli = inParams.begin(); pli != inParams.end(); ++pli)
+ out << nl << "__inS.endReadParams();";
+
+ for(ParamDeclList::const_iterator pli = values.begin(); pli != values.end(); ++pli)
{
- TypePtr paramType = (*pli)->type();
- out << fixKwd((*pli)->name());
- if(!(*pli)->optional())
+ const TypePtr paramType = (*pli)->type();
+ const string paramName = fixKwd((*pli)->name());
+ const string typeS = typeToString(paramType, TypeModeIn, package, (*pli)->getMetaData(), true,
+ (*pli)->optional());
+ if((*pli)->optional())
{
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
- {
- out << ".value";
- }
+ out << nl << typeS << ' ' << paramName << " = java.util.Optional.ofNullable(__" << (*pli)->name()
+ << ".value);";
}
- out << ", ";
- }
- for(ParamDeclList::const_iterator pli = outParams.begin(); pli != outParams.end(); ++pli)
- {
- out << fixKwd((*pli)->name()) << ", ";
- }
- out << "__current);";
-
- //
- // Marshal 'out' parameters and return value.
- //
- if(!outParams.empty() || ret)
- {
- out << nl << "Ice.OutputStream __os = __inS.__startWriteParams("
- << opFormatTypeToString(op) << ");";
- writeMarshalUnmarshalParams(out, package, outParams, op, iter, true, optionalMapping, true);
- if(op->returnsClasses(false))
+ else
{
- out << nl << "__os.writePendingValues();";
+ out << nl << typeS << ' ' << paramName << " = __" << (*pli)->name() << ".value;";
}
- out << nl << "__inS.__endWriteParams(true);";
}
- else
+ }
+ else
+ {
+ out << nl << "__inS.readEmptyParams();";
+ }
+
+ if(op->format() != DefaultFormat)
+ {
+ out << nl << "__inS.setFormat(" << opFormatTypeToString(op) << ");";
+ }
+
+ if(amd)
+ {
+ if(op->hasMarshaledResult())
{
- out << nl << "__inS.__writeEmptyParams();";
+ out << nl << "return __inS.setMarshaledResultFuture(__obj." << opName << "Async" << spar
+ << getInArgs(op) << "__current" << epar << ");";
}
- out << nl << "return Ice.DispatchStatus.DispatchOK;";
-
- //
- // Handle user exceptions.
- //
- if(!throws.empty())
+ else
{
- out << eb;
- for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t)
+ out << nl << "return __inS.setResultFuture(__obj." << opName << "Async" << spar << getInArgs(op)
+ << "__current" << epar;
+ if(ret || !outParams.empty())
{
- string exS = getAbsolute(*t, package);
- out << nl << "catch(" << exS << " ex)";
+ out << ", (__os, __ret) ->";
+ out.inc();
out << sb;
- out << nl << "__inS.__writeUserException(ex, " << opFormatTypeToString(op) << ");";
- out << nl << "return Ice.DispatchStatus.DispatchUserException;";
+ writeMarshalServantResults(out, package, op, "__ret");
out << eb;
+ out.dec();
}
+ out << ");";
}
-
- out << eb;
}
else
{
- ParamDeclList inParams;
- ParamDeclList paramList = op->parameters();
- for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
+ //
+ // Call on the servant.
+ //
+ out << nl;
+ if(ret || !outParams.empty())
{
- if(!(*pli)->isOutParam())
- {
- inParams.push_back(*pli);
- }
+ out << getResultType(op, package, false, true) << " __ret = ";
}
+ out << "__obj." << fixKwd(opName) << spar << getInArgs(op) << "__current" << epar << ';';
- int iter;
-
- out << nl << "__checkMode(" << sliceModeToIceMode(op->mode()) << ", __current.mode);";
-
- if(!inParams.empty())
+ //
+ // Marshal 'out' parameters and return value.
+ //
+ if(op->hasMarshaledResult())
{
- //
- // Unmarshal 'in' parameters.
- //
- out << nl << "Ice.InputStream __is = __inS.startReadParams();";
- iter = 0;
- for(ParamDeclList::const_iterator pli = inParams.begin(); pli != inParams.end(); ++pli)
- {
- TypePtr paramType = (*pli)->type();
- string paramName = fixKwd((*pli)->name());
- string typeS = typeToString(paramType, TypeModeIn, package, (*pli)->getMetaData(),
- true, (*pli)->optional());
- if((*pli)->optional())
- {
- out << nl << typeS << ' ' << paramName << " = new " << typeS << "();";
- }
- else
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
- {
- out << nl << typeS << "Holder " << paramName << " = new " << typeS << "Holder();";
- }
- else if(StructPtr::dynamicCast(paramType))
- {
- out << nl << typeS << ' ' << paramName << " = null;";
- }
- else
- {
- out << nl << typeS << ' ' << paramName << ';';
- }
- }
- }
- writeMarshalUnmarshalParams(out, package, inParams, 0, iter, false, true, true);
- if(op->sendsClasses(false))
- {
- out << nl << "__is.readPendingValues();";
- }
- out << nl << "__inS.endReadParams();";
+ out << nl << "return __inS.setMarshaledResult(__ret);";
}
- else
+ else if(ret || !outParams.empty())
{
- out << nl << "__inS.readEmptyParams();";
+ out << nl << "com.zeroc.Ice.OutputStream __os = __inS.startWriteParams();";
+ writeMarshalServantResults(out, package, op, "__ret");
+ out << nl << "__inS.endWriteParams(__os);";
+ out << nl << "return __inS.setResult(__os);";
}
-
- //
- // Call on the servant.
- //
- string classNameAMD = "AMD_" + p->name();
- out << nl << classNameAMD << '_' << opName << " __cb = new _" << classNameAMD << '_' << opName
- << "(__inS);";
- out << nl << "try";
- out << sb;
- out << nl << "__obj." << (amd ? opName + "_async" : fixKwd(opName)) << (amd ? "(__cb, " : "(");
- for(ParamDeclList::const_iterator pli = inParams.begin(); pli != inParams.end(); ++pli)
+ else
{
- TypePtr paramType = (*pli)->type();
- out << fixKwd((*pli)->name());
- if(!(*pli)->optional())
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
- {
- out << ".value";
- }
- }
- out << ", ";
+ out << nl << "return __inS.setResult(__inS.writeEmptyParams());";
}
- out << "__current);";
- out << eb;
- out << nl << "catch(java.lang.Exception ex)";
- out << sb;
- out << nl << "__cb.ice_exception(ex);";
- out << eb;
- out << nl << "return Ice.DispatchStatus.DispatchAsync;";
-
- out << eb;
}
+
+ out << eb;
}
OperationList allOps = p->allOperations();
@@ -1490,7 +1218,7 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
allOpNames.sort();
allOpNames.unique();
- out << sp << nl << "private final static String[] __all =";
+ out << sp << nl << "final static String[] __ops =";
out << sb;
for(StringList::const_iterator q = allOpNames.begin(); q != allOpNames.end();)
{
@@ -1519,12 +1247,18 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
break;
}
}
- out << nl << "public Ice.DispatchStatus __dispatch(IceInternal.Incoming in, Ice.Current __current)";
+ out << nl << "@Override" << nl
+ << "default java.util.concurrent.CompletionStage<com.zeroc.Ice.OutputStream> __dispatch("
+ << "com.zeroc.IceInternal.Incoming in, com.zeroc.Ice.Current __current)";
+ out.inc();
+ out << nl << "throws com.zeroc.Ice.UserException";
+ out.dec();
out << sb;
- out << nl << "int pos = java.util.Arrays.binarySearch(__all, __current.operation);";
+ out << nl << "int pos = java.util.Arrays.binarySearch(__ops, __current.operation);";
out << nl << "if(pos < 0)";
out << sb;
- out << nl << "throw new Ice.OperationNotExistException(__current.id, __current.facet, __current.operation);";
+ out << nl << "throw new "
+ << "com.zeroc.Ice.OperationNotExistException(__current.id, __current.facet, __current.operation);";
out << eb;
out << sp << nl << "switch(pos)";
out << sb;
@@ -1537,19 +1271,19 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
out << sb;
if(opName == "ice_id")
{
- out << nl << "return ___ice_id(this, in, __current);";
+ out << nl << "return com.zeroc.Ice.Object.___ice_id(this, in, __current);";
}
else if(opName == "ice_ids")
{
- out << nl << "return ___ice_ids(this, in, __current);";
+ out << nl << "return com.zeroc.Ice.Object.___ice_ids(this, in, __current);";
}
else if(opName == "ice_isA")
{
- out << nl << "return ___ice_isA(this, in, __current);";
+ out << nl << "return com.zeroc.Ice.Object.___ice_isA(this, in, __current);";
}
else if(opName == "ice_ping")
{
- out << nl << "return ___ice_ping(this, in, __current);";
+ out << nl << "return com.zeroc.Ice.Object.___ice_ping(this, in, __current);";
}
else
{
@@ -1572,11 +1306,11 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
string base;
if(cl->isInterface())
{
- base = getAbsolute(cl, package, "_", "Disp");
+ base = getAbsolute(cl, package);
}
else
{
- base = getAbsolute(cl, package);
+ base = getAbsolute(cl, package, "_", "Disp");
}
out << nl << "return " << base << ".___" << opName << "(this, in, __current);";
}
@@ -1588,7 +1322,8 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
}
out << eb;
out << sp << nl << "assert(false);";
- out << nl << "throw new Ice.OperationNotExistException(__current.id, __current.facet, __current.operation);";
+ out << nl << "throw new "
+ << "com.zeroc.Ice.OperationNotExistException(__current.id, __current.facet, __current.operation);";
out << eb;
//
@@ -1607,7 +1342,7 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
if(!attributesMap.empty())
{
- out << sp << nl << "private final static int[] __operationAttributes =";
+ out << sp << nl << "final static int[] __operationAttributes =";
out << sb;
for(StringList::const_iterator q = allOpNames.begin(); q != allOpNames.end();)
{
@@ -1627,9 +1362,9 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
}
out << eb << ';';
- out << sp << nl << "public int ice_operationAttributes(String operation)";
+ out << sp << nl << "@Override" << nl << "default int ice_operationAttributes(String operation)";
out << sb;
- out << nl << "int pos = java.util.Arrays.binarySearch(__all, operation);";
+ out << nl << "int pos = java.util.Arrays.binarySearch(__ops, operation);";
out << nl << "if(pos < 0)";
out << sb;
out << nl << "return -1;";
@@ -1638,6 +1373,20 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
out << eb;
}
}
+}
+
+void
+Slice::JavaVisitor::writeMarshaling(Output& out, const ClassDefPtr& p)
+{
+ string name = fixKwd(p->name());
+ string package = getPackage(p);
+ string scoped = p->scoped();
+ ClassList bases = p->bases();
+ ClassDefPtr base;
+ if(!bases.empty() && !bases.front()->isInterface())
+ {
+ base = bases.front();
+ }
int iter;
DataMemberList members = p->dataMembers();
@@ -1647,14 +1396,18 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
if(preserved && !basePreserved)
{
- out << sp << nl << "public void __write(Ice.OutputStream __os)";
+ out << sp;
+ out << nl << "@Override";
+ out << nl << "public void __write(com.zeroc.Ice.OutputStream __os)";
out << sb;
out << nl << "__os.startValue(__slicedData);";
out << nl << "__writeImpl(__os);";
out << nl << "__os.endValue();";
out << eb;
- out << sp << nl << "public void __read(Ice.InputStream __is)";
+ out << sp;
+ out << nl << "@Override";
+ out << nl << "public void __read(com.zeroc.Ice.InputStream __is)";
out << sb;
out << nl << "__is.startValue();";
out << nl << "__readImpl(__is);";
@@ -1662,9 +1415,11 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
out << eb;
}
- out << sp << nl << "protected void __writeImpl(Ice.OutputStream __os)";
+ out << sp;
+ out << nl << "@Override";
+ out << nl << "protected void __writeImpl(com.zeroc.Ice.OutputStream __os)";
out << sb;
- out << nl << "__os.startSlice(ice_staticId(), " << p->compactId() << (!base ? ", true" : ", false") << ");";
+ out << nl << "__os.startSlice(ice_staticId, " << p->compactId() << (!base ? ", true" : ", false") << ");";
iter = 0;
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
{
@@ -1687,29 +1442,25 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
DataMemberList classMembers = p->classDataMembers();
DataMemberList allClassMembers = p->allClassDataMembers();
- if(classMembers.size() != 0)
- {
- writePatcher(out, package, classMembers, optionalMembers);
- }
-
- out << sp << nl << "protected void __readImpl(Ice.InputStream __is)";
+ out << sp;
+ out << nl << "@Override";
+ out << nl << "protected void __readImpl(com.zeroc.Ice.InputStream __is)";
out << sb;
out << nl << "__is.startSlice();";
- int patchIter = 0;
- const bool needCustomPatcher = classMembers.size() > 1;
iter = 0;
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
{
if(!(*d)->optional())
{
- writeUnmarshalDataMember(out, package, *d, iter, needCustomPatcher, patchIter);
+ writeUnmarshalDataMember(out, package, *d, iter);
}
}
for(DataMemberList::const_iterator d = optionalMembers.begin(); d != optionalMembers.end(); ++d)
{
- writeUnmarshalDataMember(out, package, *d, iter, needCustomPatcher, patchIter);
+ writeUnmarshalDataMember(out, package, *d, iter);
}
+
out << nl << "__is.endSlice();";
if(base)
{
@@ -1719,7 +1470,7 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
if(preserved && !basePreserved)
{
- out << sp << nl << "protected Ice.SlicedData __slicedData;";
+ out << sp << nl << "protected com.zeroc.Ice.SlicedData __slicedData;";
}
}
@@ -1857,13 +1608,15 @@ Slice::JavaVisitor::writeConstantValue(Output& out, const TypePtr& type, const S
out << "\\\"";
}
//
- // Unicode character in the range U+10000 to U+10FFFF is not permitted in a character literal
- // and is represented using a Unicode surrogate pair.
+ // Unicode character in the range U+10000 to U+10FFFF is not permitted in a
+ // character literal and is represented using a Unicode surrogate pair.
//
else if(v > 0xFFFF)
{
- unsigned int high = ((static_cast<unsigned int>(v) - 0x10000) / 0x400) + 0xD800;
- unsigned int low = ((static_cast<unsigned int>(v) - 0x10000) % 0x400) + 0xDC00;
+ unsigned int high =
+ ((static_cast<unsigned int>(v) - 0x10000) / 0x400) + 0xD800;
+ unsigned int low =
+ ((static_cast<unsigned int>(v) - 0x10000) % 0x400) + 0xDC00;
out << u16CodePoint(high);
out << u16CodePoint(low);
}
@@ -2118,7 +1871,6 @@ Slice::JavaVisitor::writeDocCommentOp(Output& out, const OperationPtr& p)
return;
}
-
out << sp << nl << "/**";
//
@@ -2300,7 +2052,7 @@ Slice::JavaVisitor::writeDocCommentAMI(Output& out, const OperationPtr& p, Param
if(paramType == InParam)
{
- out << nl << " * @return The asynchronous result object.";
+ out << nl << " * @return A future for the completion of the request.";
if(!deprecateReason.empty())
{
out << nl << " * @deprecated " << deprecateReason;
@@ -2424,9 +2176,6 @@ Slice::Gen::generate(const UnitPtr& p)
{
JavaGenerator::validateMetaData(p);
- OpsVisitor opsVisitor(_dir);
- p->visit(&opsVisitor, false);
-
PackageVisitor packageVisitor(_dir);
p->visit(&packageVisitor, false);
@@ -2436,9 +2185,6 @@ Slice::Gen::generate(const UnitPtr& p)
CompactIdVisitor compactIdVisitor(_dir);
p->visit(&compactIdVisitor, false);
- HolderVisitor holderVisitor(_dir);
- p->visit(&holderVisitor, false);
-
HelperVisitor helperVisitor(_dir);
p->visit(&helperVisitor, false);
@@ -2447,16 +2193,6 @@ Slice::Gen::generate(const UnitPtr& p)
DispatcherVisitor dispatcherVisitor(_dir);
p->visit(&dispatcherVisitor, false);
-
- AsyncVisitor asyncVisitor(_dir);
- p->visit(&asyncVisitor, false);
-}
-
-void
-Slice::Gen::generateTie(const UnitPtr& p)
-{
- TieVisitor tieVisitor(_dir);
- p->visit(&tieVisitor, false);
}
void
@@ -2467,13 +2203,6 @@ Slice::Gen::generateImpl(const UnitPtr& p)
}
void
-Slice::Gen::generateImplTie(const UnitPtr& p)
-{
- ImplTieVisitor implTieVisitor(_dir);
- p->visit(&implTieVisitor, false);
-}
-
-void
Slice::Gen::writeChecksumClass(const string& checksumClass, const string& dir, const ChecksumMap& m)
{
//
@@ -2508,7 +2237,7 @@ Slice::Gen::writeChecksumClass(const string& checksumClass, const string& dir, c
out << sp << nl << "public static final java.util.Map<String, String> checksums;";
out << sp << nl << "static";
out << sb;
- out << nl << "java.util.Map<String, String> map = new java.util.HashMap<String, String>();";
+ out << nl << "java.util.Map<String, String> map = new java.util.HashMap<>();";
for(ChecksumMap::const_iterator p = m.begin(); p != m.end(); ++p)
{
out << nl << "map.put(\"" << p->first << "\", \"";
@@ -2528,360 +2257,6 @@ Slice::Gen::writeChecksumClass(const string& checksumClass, const string& dir, c
out << nl;
}
-Slice::Gen::OpsVisitor::OpsVisitor(const string& dir) :
- JavaVisitor(dir)
-{
-}
-
-bool
-Slice::Gen::OpsVisitor::visitClassDefStart(const ClassDefPtr& p)
-{
- //
- // Don't generate an Operations interface for non-abstract classes
- //
- if(!p->isAbstract())
- {
- return false;
- }
-
- if(!p->isLocal())
- {
- writeOperations(p, false);
- }
- writeOperations(p, true);
-
- return false;
-}
-
-void
-Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent)
-{
- string name = p->name();
- ClassList bases = p->bases();
- string package = getPackage(p);
- string opIntfName = "Operations";
- if(noCurrent || p->isLocal())
- {
- opIntfName += "NC";
- }
- string absolute = getAbsolute(p, "", "_", opIntfName);
-
- open(absolute, p->file());
-
- Output& out = output();
-
- //
- // Generate the operations interface
- //
- out << sp;
- writeDocComment(out, p, getDeprecateReason(p, 0, p->isInterface() ? "interface" : "class"));
- out << nl << "public interface " << '_' << name << opIntfName;
- if((bases.size() == 1 && bases.front()->isAbstract()) || bases.size() > 1)
- {
- out << " extends ";
- out.useCurrentPosAsIndent();
- bool first = true;
- for(ClassList::const_iterator q = bases.begin(); q != bases.end();)
- {
- if((*q)->isAbstract())
- {
- if(!first)
- {
- out << ',' << nl;
- }
- else
- {
- first = false;
- }
- out << getAbsolute(*q, package, "_", opIntfName);
- }
- ++q;
- }
- out.restoreIndent();
- }
- out << sb;
-
- OperationList ops = p->operations();
- for(OperationList::iterator r = ops.begin(); r != ops.end(); ++r)
- {
- OperationPtr op = *r;
- ContainerPtr container = op->container();
- ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- string opname = op->name();
-
- TypePtr ret;
- vector<string> params;
-
- const bool amd = !p->isLocal() && (cl->hasMetaData("amd") || op->hasMetaData("amd"));
- const bool optionalMapping = useOptionalMapping(op);
-
- if(amd)
- {
- params = getParamsAsync(op, package, true, true);
- }
- else
- {
- params = getParams(op, package, false, optionalMapping);
- ret = op->returnType();
- }
-
- string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData(), true,
- optionalMapping && op->returnIsOptional());
- ExceptionList throws = op->throws();
- throws.sort();
- throws.unique();
- out << sp;
-
- string deprecateReason = getDeprecateReason(*r, p, "operation");
- string extraCurrent;
- if(!noCurrent && !p->isLocal())
- {
- extraCurrent = "@param __current The Current object for the invocation.";
- }
- if(amd)
- {
- writeDocCommentAsync(out, *r, InParam, extraCurrent);
- }
- else
- {
- writeDocComment(out, *r, deprecateReason, extraCurrent);
- }
- out << nl << retS << ' ' << (amd ? opname + "_async" : fixKwd(opname)) << spar << params;
- if(!noCurrent && !p->isLocal())
- {
- out << "Ice.Current __current";
- }
- out << epar;
- if(op->hasMetaData("UserException"))
- {
- out.inc();
- out << nl << "throws Ice.UserException";
- out.dec();
- }
- else
- {
- writeThrowsClause(package, throws);
- }
- out << ';';
- }
-
- out << eb;
-
- close();
-}
-
-Slice::Gen::TieVisitor::TieVisitor(const string& dir) :
- JavaVisitor(dir)
-{
-}
-
-bool
-Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
-{
- string name = p->name();
- ClassList bases = p->bases();
- string package = getPackage(p);
- string absolute = getAbsolute(p, "", "_", "Tie");
- string opIntfName = "Operations";
- if(p->isLocal())
- {
- opIntfName += "NC";
- }
-
- //
- // Don't generate a TIE class for a non-abstract class
- //
- if(!p->isAbstract())
- {
- return false;
- }
-
- open(absolute, p->file());
-
- Output& out = output();
-
- //
- // Generate the TIE class
- //
- out << sp << nl << "public class " << '_' << name << "Tie";
- if(p->isInterface())
- {
- if(p->isLocal())
- {
- out << " implements " << fixKwd(name) << ", Ice.TieBase";
- }
- else
- {
- out << " extends " << '_' << name << "Disp implements Ice.TieBase";
- }
- }
- else
- {
- out << " extends " << fixKwd(name) << " implements Ice.TieBase";
- }
-
- out << sb;
-
- out << sp << nl << "public _" << name << "Tie()";
- out << sb;
- out << eb;
-
- out << sp << nl << "public _" << name << "Tie(" << '_' << name << opIntfName << " delegate)";
- out << sb;
- out << nl << "_ice_delegate = delegate;";
- out << eb;
-
- out << sp << nl << "public java.lang.Object ice_delegate()";
- out << sb;
- out << nl << "return _ice_delegate;";
- out << eb;
-
- out << sp << nl << "public void ice_delegate(java.lang.Object delegate)";
- out << sb;
- out << nl << "_ice_delegate = (_" << name << opIntfName << ")delegate;";
- out << eb;
-
- out << sp << nl << "public boolean equals(java.lang.Object rhs)";
- out << sb;
- out << nl << "if(this == rhs)";
- out << sb;
- out << nl << "return true;";
- out << eb;
- out << nl << "if(!(rhs instanceof " << '_' << name << "Tie))";
- out << sb;
- out << nl << "return false;";
- out << eb;
- out << sp << nl << "return _ice_delegate.equals(((" << '_' << name << "Tie)rhs)._ice_delegate);";
- out << eb;
-
- out << sp << nl << "public int hashCode()";
- out << sb;
- out << nl << "return _ice_delegate.hashCode();";
- out << eb;
-
- if(p->isLocal())
- {
- out << sp << nl << "public _" << name << "Tie clone()";
- out.inc();
- out << nl << "throws java.lang.CloneNotSupportedException";
- out.dec();
- out << sb;
- out << nl << "return (_" << name << "Tie)super.clone();";
- out << eb;
- }
-
- OperationList ops = p->allOperations();
- for(OperationList::iterator r = ops.begin(); r != ops.end(); ++r)
- {
- ContainerPtr container = (*r)->container();
- ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- const bool hasAMD = cl->hasMetaData("amd") || (*r)->hasMetaData("amd");
- const bool optionalMapping = useOptionalMapping(*r);
-
- string opName = hasAMD ? (*r)->name() + "_async" : fixKwd((*r)->name());
-
- TypePtr ret = (*r)->returnType();
- string retS = typeToString(ret, TypeModeReturn, package, (*r)->getMetaData(), true,
- optionalMapping && (*r)->returnIsOptional());
-
- vector<string> params;
- vector<string> args;
- if(hasAMD)
- {
- params = getParamsAsync((*r), package, true, true);
- args = getArgsAsync(*r);
- }
- else
- {
- params = getParams((*r), package, false, optionalMapping);
- args = getArgs(*r);
- }
-
- string deprecateReason = getDeprecateReason(*r, cl, "operation");
-
- out << sp;
- if(!deprecateReason.empty())
- {
- out << nl << "@Deprecated";
- out << nl << "@SuppressWarnings(\"deprecation\")";
- }
- out << nl << "public " << (hasAMD ? string("void") : retS) << ' ' << opName << spar << params;
- if(!p->isLocal())
- {
- out << "Ice.Current __current";
- }
- out << epar;
-
- if((*r)->hasMetaData("UserException"))
- {
- out.inc();
- out << nl << "throws Ice.UserException";
- out.dec();
- }
- else
- {
- ExceptionList throws = (*r)->throws();
- throws.sort();
- throws.unique();
- writeThrowsClause(package, throws);
- }
- out << sb;
- out << nl;
- if(ret && !hasAMD)
- {
- out << "return ";
- }
- out << "_ice_delegate." << opName << spar << args;
- if(!p->isLocal())
- {
- out << "__current";
- }
- out << epar << ';';
- out << eb;
- }
-
- out << sp << nl << "private " << '_' << name << opIntfName << " _ice_delegate;";
- out << sp << nl << "public static final long serialVersionUID = ";
- string serialVersionUID;
- if(p->findMetaData("java:serialVersionUID", serialVersionUID))
- {
- string::size_type pos = serialVersionUID.rfind(":") + 1;
- if(pos == string::npos)
- {
- ostringstream os;
- os << "ignoring invalid serialVersionUID for class `" << p->scoped() << "'; generating default value";
- emitWarning("", "", os.str());
- out << computeSerialVersionUUID(p);
- }
- else
- {
- Int64 v = 0;
- serialVersionUID = serialVersionUID.substr(pos);
- if(serialVersionUID != "0")
- {
- if(!stringToInt64(serialVersionUID, v)) // conversion error
- {
- ostringstream os;
- os << "ignoring invalid serialVersionUID for class `" << p->scoped()
- << "'; generating default value";
- emitWarning("", "", os.str());
- out << computeSerialVersionUUID(p);
- }
- }
- out << v;
- }
- }
- else
- {
- out << computeSerialVersionUUID(p);
- }
- out << "L;";
- out << eb;
- close();
-
- return false;
-}
-
Slice::Gen::PackageVisitor::PackageVisitor(const string& dir) :
JavaVisitor(dir)
{
@@ -2944,9 +2319,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
{
out << " extends ";
out.useCurrentPosAsIndent();
- out << "Ice.Object";
- out << "," << nl << '_' << name;
- out << "Operations, _" << name << "OperationsNC";
+ out << "com.zeroc.Ice.Object";
}
else
{
@@ -2972,7 +2345,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
else
{
out << nl << "public ";
- if(p->allOperations().size() > 0) // Don't use isAbstract() - see bug 3739
+ if(p->isLocal() && !p->allOperations().empty())
{
out << "abstract ";
}
@@ -2980,18 +2353,16 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
out.useCurrentPosAsIndent();
StringList implements;
- bool implementsOnNewLine = true;
if(bases.empty() || bases.front()->isInterface())
{
if(p->isLocal())
{
- implementsOnNewLine = false;
- implements.push_back("java.lang.Cloneable");
+ implements.push_back("java.lang.Cloneable");
}
else
{
- out << " extends Ice.ObjectImpl";
+ out << " extends com.zeroc.Ice.Value";
}
}
else
@@ -3001,161 +2372,11 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
bases.pop_front();
}
- //
- // Implement interfaces
- //
-
- if(p->isAbstract())
- {
- if(!p->isLocal())
- {
- implements.push_back("_" + name + "Operations");
- implements.push_back("_" + name + "OperationsNC");
- }
- }
- if(!bases.empty())
- {
- for(ClassList::const_iterator q = bases.begin(); q != bases.end();)
- {
- implements.push_back(getAbsolute(*q, package));
- q++;
- }
- }
-
- if(!implements.empty())
- {
- if(implementsOnNewLine)
- {
- out << nl;
- }
-
- out << " implements ";
- out.useCurrentPosAsIndent();
-
- for(StringList::const_iterator q = implements.begin(); q != implements.end();)
- {
- if(q != implements.begin())
- {
- out << ',' << nl;
- }
- out << *q;
- q++;
- }
-
- out.restoreIndent();
- }
-
out.restoreIndent();
}
out << sb;
- //
- // For local classes and interfaces, we don't use the OperationsNC interface.
- // Instead, we generate the operation signatures directly into the class
- // or interface.
- //
- if(p->isLocal())
- {
- OperationList ops = p->operations();
- for(OperationList::iterator r = ops.begin(); r != ops.end(); ++r)
- {
- OperationPtr op = *r;
- const ContainerPtr container = op->container();
- const ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- const string opname = op->name();
- const bool optionalMapping = useOptionalMapping(op);
-
- const TypePtr ret = op->returnType();
- vector<string> params = getParams(op, package, true, optionalMapping);
-
- string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData(), true,
- optionalMapping && op->returnIsOptional());
- ExceptionList throws = op->throws();
- throws.sort();
- throws.unique();
- out << sp;
-
- writeDocComment(out, *r, getDeprecateReason(*r, p, "operation"));
- out << nl;
- if(!p->isInterface())
- {
- out << "public abstract ";
- }
- out << retS << ' ' << fixKwd(opname) << spar << params << epar;
- if(op->hasMetaData("UserException"))
- {
- out.inc();
- out << nl << "throws Ice.UserException";
- out.dec();
- }
- else
- {
- writeThrowsClause(package, throws);
- }
- out << ';';
-
- //
- // Generate asynchronous API for local operations marked with "async-oneway" metadata.
- //
- if(p->hasMetaData("async-oneway") || op->hasMetaData("async-oneway"))
- {
- vector<string> inParams = getInOutParams(op, package, InParam, true, true);
-
- out << sp;
- writeDocCommentAMI(out, op, InParam);
- out << nl;
- if(!p->isInterface())
- {
- out << "public abstract ";
- }
- out << "Ice.AsyncResult begin_" << opname << spar << inParams << epar << ';';
-
- out << sp;
- writeDocCommentAMI(out, op, InParam);
- out << nl;
- if(!p->isInterface())
- {
- out << "public abstract ";
- }
- out << "Ice.AsyncResult begin_" << opname << spar << inParams << "Ice.Callback __cb" << epar << ';';
-
- out << sp;
- writeDocCommentAMI(out, op, InParam);
- out << nl;
- if(!p->isInterface())
- {
- out << "public abstract ";
- }
- string cb = "Callback_" + name + "_" + opname + " __cb";
- out << "Ice.AsyncResult begin_" << opname << spar << inParams << cb << epar << ';';
-
-
- out << sp;
- writeDocCommentAMI(out, op, InParam);
- out << nl;
- if(!p->isInterface())
- {
- out << "public abstract ";
- }
- out << nl << "Ice.AsyncResult begin_" << opname;
- writeParamList(out, getParamsAsyncLambda(op, package, false, true));
- out << ';';
-
- vector<string> outParams = getInOutParams(op, package, OutParam, true, true);
- out << sp;
- writeDocCommentAMI(out, op, OutParam);
- out << nl;
- if(!p->isInterface())
- {
- out << "public abstract ";
- }
-
- out << retS << " end_" << opname << spar << outParams << "Ice.AsyncResult __result" << epar << ';';
- }
- }
- }
-
if(!p->isInterface() && !allDataMembers.empty())
{
bool hasOptionalMembers = false;
@@ -3294,36 +2515,6 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
}
}
- //
- // Default factory for non-abstract classes.
- //
- if(!p->isInterface() && p->allOperations().size() == 0 && !p->isLocal())
- {
- out << sp;
- out << nl << "private static class __F implements Ice.ValueFactory";
- out << sb;
- out << nl << "public Ice.Object create(String type)";
- out << sb;
- out << nl << "assert(type.equals(ice_staticId()));";
- out << nl << "return new " << fixKwd(name) << "();";
- out << eb;
- out << eb;
- out << nl << "private static Ice.ValueFactory _factory = new __F();";
- out << sp;
- out << nl << "public static Ice.ValueFactory" << nl << "ice_factory()";
- out << sb;
- out << nl << "return _factory;";
- out << eb;
- }
-
- //
- // Marshalling & dispatch support.
- //
- if(!p->isInterface() && !p->isLocal())
- {
- writeDispatchAndMarshalling(out, p);
- }
-
return true;
}
@@ -3343,7 +2534,7 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p)
if(!p->isInterface())
{
- out << sp << nl << "public " << name << nl << "clone()";
+ out << sp << nl << "public " << name << " clone()";
out << sb;
if(p->isLocal() && !baseClass)
@@ -3367,50 +2558,160 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p)
out << eb;
}
- if(p->isInterface() && !p->isLocal())
+ if(!p->isLocal())
{
- out << sp << nl << "public static final String ice_staticId = \"" << p->scoped() << "\";";
- }
+ out << sp << nl;
+ if(!p->isInterface())
+ {
+ out << "public ";
+ }
+ out << "static final String ice_staticId = \"" << p->scoped() << "\";";
- out << sp << nl << "public static final long serialVersionUID = ";
- string serialVersionUID;
- if(p->findMetaData("java:serialVersionUID", serialVersionUID))
- {
- string::size_type pos = serialVersionUID.rfind(":") + 1;
- if(pos == string::npos)
+ if(!p->isInterface())
{
- ostringstream os;
- os << "ignoring invalid serialVersionUID for class `" << p->scoped() << "'; generating default value";
- emitWarning("", "", os.str());
- out << computeSerialVersionUUID(p);
+ out << sp << nl << "public static String ice_staticId()";
+ out << sb;
+ out << nl << "return ice_staticId;";
+ out << eb;
+
+ out << sp << nl << "@Override";
+ out << nl << "public String ice_id()";
+ out << sb;
+ out << nl << "return ice_staticId;";
+ out << eb;
}
- else
+ }
+
+ if(!p->isInterface())
+ {
+ out << sp << nl << "public static final long serialVersionUID = ";
+ string serialVersionUID;
+ if(p->findMetaData("java:serialVersionUID", serialVersionUID))
{
- Int64 v = 0;
- serialVersionUID = serialVersionUID.substr(pos);
- if(serialVersionUID != "0")
+ string::size_type pos = serialVersionUID.rfind(":") + 1;
+ if(pos == string::npos)
{
- if(!stringToInt64(serialVersionUID, v)) // conversion error
+ ostringstream os;
+ os << "ignoring invalid serialVersionUID for class `" << p->scoped() << "'; generating default value";
+ emitWarning("", "", os.str());
+ out << computeSerialVersionUUID(p);
+ }
+ else
+ {
+ Int64 v = 0;
+ serialVersionUID = serialVersionUID.substr(pos);
+ if(serialVersionUID != "0")
{
- ostringstream os;
- os << "ignoring invalid serialVersionUID for class `" << p->scoped()
- << "'; generating default value";
- emitWarning("", "", os.str());
- out << computeSerialVersionUUID(p);
+ if(!stringToInt64(serialVersionUID, v)) // conversion error
+ {
+ ostringstream os;
+ os << "ignoring invalid serialVersionUID for class `" << p->scoped()
+ << "'; generating default value";
+ emitWarning("", "", os.str());
+ out << computeSerialVersionUUID(p);
+ }
}
+ out << v;
}
- out << v;
}
+ else
+ {
+ out << computeSerialVersionUUID(p);
+ }
+ out << "L;";
}
- else
+
+ if(!p->isLocal())
{
- out << computeSerialVersionUUID(p);
+ if(p->isInterface())
+ {
+ writeDispatch(out, p);
+ }
+ else
+ {
+ writeMarshaling(out, p);
+ }
}
- out << "L;";
+
out << eb;
close();
}
+void
+Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p)
+{
+ //
+ // Generate the operation signature for a servant.
+ //
+
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(p->container());
+ assert(cl);
+
+ const string package = getPackage(cl);
+
+ Output& out = output();
+
+ //
+ // Generate the "Result" type needed by operations that return multiple values.
+ //
+ if(p->returnsMultipleValues())
+ {
+ writeResultType(out, p, package);
+ }
+
+ if(p->hasMarshaledResult())
+ {
+ writeMarshaledResultType(out, p, package);
+ }
+
+ if(cl->isLocal())
+ {
+ const string opname = p->name();
+ vector<string> params = getParams(p, package);
+
+ const string retS = getResultType(p, package, false, false);
+
+ ExceptionList throws = p->throws();
+ throws.sort();
+ throws.unique();
+ out << sp;
+
+ writeDocComment(out, p, getDeprecateReason(p, cl, "operation"));
+ out << nl;
+ if(!cl->isInterface())
+ {
+ out << "public abstract ";
+ }
+ out << retS << ' ' << fixKwd(opname) << spar << params << epar;
+ if(p->hasMetaData("UserException"))
+ {
+ out.inc();
+ out << nl << "throws com.zeroc.Ice.UserException";
+ out.dec();
+ }
+ else
+ {
+ writeThrowsClause(package, throws);
+ }
+ out << ';';
+
+ //
+ // Generate asynchronous API for local operations marked with "async-oneway" metadata.
+ //
+ if(cl->hasMetaData("async-oneway") || p->hasMetaData("async-oneway"))
+ {
+ out << sp;
+ writeDocCommentAMI(out, p, InParam);
+ out << nl;
+ if(!cl->isInterface())
+ {
+ out << "public abstract ";
+ }
+ out << getFutureType(p, package) << ' ' << opname << "Async" << spar << params << epar << ';';
+ }
+ }
+}
+
bool
Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
{
@@ -3436,11 +2737,11 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
{
if(p->isLocal())
{
- out << "Ice.LocalException";
+ out << "com.zeroc.Ice.LocalException";
}
else
{
- out << "Ice.UserException";
+ out << "com.zeroc.Ice.UserException";
}
}
else
@@ -3520,7 +2821,8 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
if(!(*d)->optional())
{
string memberName = fixKwd((*d)->name());
- string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData());
+ string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData(),
+ true, false, p->isLocal());
paramDecl.push_back(memberType + " " + memberName);
}
}
@@ -3599,7 +2901,8 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
for(DataMemberList::const_iterator d = allDataMembers.begin(); d != allDataMembers.end(); ++d)
{
string memberName = fixKwd((*d)->name());
- string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData());
+ string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData(), true,
+ false, p->isLocal());
paramDecl.push_back(memberType + " " + memberName);
}
out << paramDecl << epar;
@@ -3676,7 +2979,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
}
}
- out << sp << nl << "public String" << nl << "ice_id()";
+ out << sp << nl << "public String ice_id()";
out << sb;
out << nl << "return \"" << scoped << "\";";
out << eb;
@@ -3704,15 +3007,18 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
if(preserved && !basePreserved)
{
-
- out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __os)";
+ out << sp;
+ out << nl << "@Override";
+ out << nl << "public void __write(com.zeroc.Ice.OutputStream __os)";
out << sb;
out << nl << "__os.startException(__slicedData);";
out << nl << "__writeImpl(__os);";
out << nl << "__os.endException();";
out << eb;
- out << sp << nl << "public void" << nl << "__read(Ice.InputStream __is)";
+ out << sp;
+ out << nl << "@Override";
+ out << nl << "public void __read(com.zeroc.Ice.InputStream __is)";
out << sb;
out << nl << "__is.startException();";
out << nl << "__readImpl(__is);";
@@ -3720,7 +3026,9 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
out << eb;
}
- out << sp << nl << "protected void" << nl << "__writeImpl(Ice.OutputStream __os)";
+ out << sp;
+ out << nl << "@Override";
+ out << nl << "protected void __writeImpl(com.zeroc.Ice.OutputStream __os)";
out << sb;
out << nl << "__os.startSlice(\"" << scoped << "\", -1, " << (!base ? "true" : "false") << ");";
iter = 0;
@@ -3745,26 +3053,22 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
DataMemberList classMembers = p->classDataMembers();
DataMemberList allClassMembers = p->allClassDataMembers();
- if(classMembers.size() != 0)
- {
- writePatcher(out, package, classMembers, optionalMembers);
- }
- out << sp << nl << "protected void" << nl << "__readImpl(Ice.InputStream __is)";
+ out << sp;
+ out << nl << "@Override";
+ out << nl << "protected void __readImpl(com.zeroc.Ice.InputStream __is)";
out << sb;
out << nl << "__is.startSlice();";
iter = 0;
- int patchIter = 0;
- const bool needCustomPatcher = classMembers.size() > 1;
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
{
if(!(*d)->optional())
{
- writeUnmarshalDataMember(out, package, *d, iter, needCustomPatcher, patchIter);
+ writeUnmarshalDataMember(out, package, *d, iter);
}
}
for(DataMemberList::const_iterator d = optionalMembers.begin(); d != optionalMembers.end(); ++d)
{
- writeUnmarshalDataMember(out, package, *d, iter, needCustomPatcher, patchIter);
+ writeUnmarshalDataMember(out, package, *d, iter);
}
out << nl << "__is.endSlice();";
if(base)
@@ -3777,7 +3081,9 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
if(!base || (base && !base->usesClasses(false)))
{
- out << sp << nl << "public boolean" << nl << "__usesClasses()";
+ out << sp;
+ out << nl << "@Override";
+ out << nl << "public boolean __usesClasses()";
out << sb;
out << nl << "return true;";
out << eb;
@@ -3786,7 +3092,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
if(preserved && !basePreserved)
{
- out << sp << nl << "protected Ice.SlicedData __slicedData;";
+ out << sp << nl << "protected com.zeroc.Ice.SlicedData __slicedData;";
}
}
@@ -3882,7 +3188,8 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
{
string memberName = fixKwd((*d)->name());
- string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData());
+ string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData(), true, false,
+ p->isLocal());
paramDecl.push_back(memberType + " " + memberName);
paramNames.push_back(memberName);
}
@@ -3896,7 +3203,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
out << eb;
}
- out << sp << nl << "public boolean" << nl << "equals(java.lang.Object rhs)";
+ out << sp << nl << "public boolean equals(java.lang.Object rhs)";
out << sb;
out << nl << "if(this == rhs)";
out << sb;
@@ -4003,20 +3310,20 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
out << sp << nl << "return false;";
out << eb;
- out << sp << nl << "public int" << nl << "hashCode()";
+ out << sp << nl << "public int hashCode()";
out << sb;
out << nl << "int __h = 5381;";
- out << nl << "__h = IceInternal.HashUtil.hashAdd(__h, \"" << p->scoped() << "\");";
+ out << nl << "__h = com.zeroc.IceInternal.HashUtil.hashAdd(__h, \"" << p->scoped() << "\");";
iter = 0;
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
{
string memberName = fixKwd((*d)->name());
- out << nl << "__h = IceInternal.HashUtil.hashAdd(__h, " << memberName << ");";
+ out << nl << "__h = com.zeroc.IceInternal.HashUtil.hashAdd(__h, " << memberName << ");";
}
out << nl << "return __h;";
out << eb;
- out << sp << nl << "public " << name << nl << "clone()";
+ out << sp << nl << "public " << name << " clone()";
out << sb;
out << nl << name << " c = null;";
out << nl << "try";
@@ -4032,7 +3339,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
if(!p->isLocal())
{
- out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __os)";
+ out << sp << nl << "public void ice_write(com.zeroc.Ice.OutputStream __os)";
out << sb;
iter = 0;
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
@@ -4043,41 +3350,34 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
DataMemberList classMembers = p->classDataMembers();
- if(classMembers.size() != 0)
- {
- writePatcher(out, package, classMembers, DataMemberList());
- }
-
- out << sp << nl << "public void" << nl << "__read(Ice.InputStream __is)";
+ out << sp << nl << "public void ice_read(com.zeroc.Ice.InputStream __is)";
out << sb;
iter = 0;
- int patchIter = 0;
- const bool needCustomPatcher = classMembers.size() > 1;
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
{
- writeUnmarshalDataMember(out, package, *d, iter, needCustomPatcher, patchIter);
+ writeUnmarshalDataMember(out, package, *d, iter);
}
out << eb;
- out << sp << nl << "static public void" << nl << "write(Ice.OutputStream __os, " << name << " __v)";
+ out << sp << nl << "static public void write(com.zeroc.Ice.OutputStream __os, " << name << " __v)";
out << sb;
out << nl << "if(__v == null)";
out << sb;
- out << nl << "__nullMarshalValue.__write(__os);";
+ out << nl << "__nullMarshalValue.ice_write(__os);";
out << eb;
out << nl << "else";
out << sb;
- out << nl << "__v.__write(__os);";
+ out << nl << "__v.ice_write(__os);";
out << eb;
out << eb;
- out << sp << nl << "static public " << name << nl << "read(Ice.InputStream __is, " << name << " __v)";
+ out << sp << nl << "static public " << name << " read(com.zeroc.Ice.InputStream __is, " << name << " __v)";
out << sb;
out << nl << "if(__v == null)";
out << sb;
out << nl << " __v = new " << name << "();";
out << eb;
- out << nl << "__v.__read(__is);";
+ out << nl << "__v.ice_read(__is);";
out << nl << "return __v;";
out << eb;
@@ -4127,15 +3427,38 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
void
Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
{
- string name = fixKwd(p->name());
- ContainerPtr container = p->container();
- ContainedPtr contained = ContainedPtr::dynamicCast(container);
- StringList metaData = p->getMetaData();
- TypePtr type = p->type();
- string s = typeToString(type, TypeModeMember, getPackage(contained), metaData);
- Output& out = output();
- const bool optional = p->optional();
+ const ContainerPtr container = p->container();
+ const ClassDefPtr cls = ClassDefPtr::dynamicCast(container);
+ const StructPtr st = StructPtr::dynamicCast(container);
+ const ExceptionPtr ex = ExceptionPtr::dynamicCast(container);
+ const ContainedPtr contained = ContainedPtr::dynamicCast(container);
+
+ const string name = fixKwd(p->name());
+ const StringList metaData = p->getMetaData();
const bool getSet = p->hasMetaData(_getSetMetaData) || contained->hasMetaData(_getSetMetaData);
+ const bool optional = p->optional();
+ const TypePtr type = p->type();
+ const BuiltinPtr b = BuiltinPtr::dynamicCast(type);
+ const bool classType = isValue(type);
+
+ bool local;
+ if(cls)
+ {
+ local = cls->isLocal();
+ }
+ else if(st)
+ {
+ local = st->isLocal();
+ }
+ else
+ {
+ assert(ex);
+ local = ex->isLocal();
+ }
+
+ const string s = typeToString(type, TypeModeMember, getPackage(contained), metaData, true, false, local);
+
+ Output& out = output();
out << sp;
@@ -4146,8 +3469,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
// Access visibility for class data members can be controlled by metadata.
// If none is specified, the default is public.
//
- if(contained->containedType() == Contained::ContainedTypeClass &&
- (p->hasMetaData("protected") || contained->hasMetaData("protected")))
+ if(cls && (p->hasMetaData("protected") || contained->hasMetaData("protected")))
{
out << nl << "protected " << s << ' ' << name << ';';
}
@@ -4178,7 +3500,6 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
//
OperationList ops;
string file, line;
- ClassDefPtr cls = ClassDefPtr::dynamicCast(container);
if(cls)
{
ops = cls->allOperations();
@@ -4203,14 +3524,13 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
//
out << sp;
writeDocComment(out, p, deprecateReason);
- out << nl << "public " << s
- << nl << "get" << capName << "()";
+ out << nl << "public " << s << " get" << capName << "()";
out << sb;
if(optional)
{
out << nl << "if(!__has_" << p->name() << ')';
out << sb;
- out << nl << "throw new java.lang.IllegalStateException(\"" << name << " is not set\");";
+ out << nl << "throw new java.util.NoSuchElementException(\"" << name << " is not set\");";
out << eb;
}
out << nl << "return " << name << ';';
@@ -4221,8 +3541,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
//
out << sp;
writeDocComment(out, p, deprecateReason);
- out << nl << "public void"
- << nl << "set" << capName << '(' << s << " _" << name << ')';
+ out << nl << "public void set" << capName << '(' << s << " _" << name << ')';
out << sb;
if(optional)
{
@@ -4238,50 +3557,96 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
{
out << sp;
writeDocComment(out, p, deprecateReason);
- out << nl << "public boolean"
- << nl << "has" << capName << "()";
+ out << nl << "public boolean has" << capName << "()";
out << sb;
out << nl << "return __has_" << p->name() << ';';
out << eb;
out << sp;
writeDocComment(out, p, deprecateReason);
- out << nl << "public void"
- << nl << "clear" << capName << "()";
+ out << nl << "public void clear" << capName << "()";
out << sb;
out << nl << "__has_" << p->name() << " = false;";
out << eb;
- const string optType = typeToString(type, TypeModeMember, getPackage(contained), metaData, true, true);
+ const string optType =
+ typeToString(type, TypeModeMember, getPackage(contained), metaData, true, true, local);
out << sp;
writeDocComment(out, p, deprecateReason);
- out << nl << "public void"
- << nl << "optional" << capName << '(' << optType << " __v)";
+ out << nl << "public void optional" << capName << '(' << optType << " __v)";
out << sb;
- out << nl << "if(__v == null || !__v.isSet())";
+ out << nl << "if(__v == null || !__v.isPresent())";
out << sb;
out << nl << "__has_" << p->name() << " = false;";
out << eb;
out << nl << "else";
out << sb;
out << nl << "__has_" << p->name() << " = true;";
- out << nl << name << " = __v.get();";
+ if(b && b->kind() == Builtin::KindInt)
+ {
+ out << nl << name << " = __v.getAsInt();";
+ }
+ else if(b && b->kind() == Builtin::KindLong)
+ {
+ out << nl << name << " = __v.getAsLong();";
+ }
+ else if(b && b->kind() == Builtin::KindDouble)
+ {
+ out << nl << name << " = __v.getAsDouble();";
+ }
+ else
+ {
+ out << nl << name << " = __v.get();";
+ }
out << eb;
out << eb;
out << sp;
writeDocComment(out, p, deprecateReason);
- out << nl << "public " << optType
- << nl << "optional" << capName << "()";
+ out << nl << "public " << optType << " optional" << capName << "()";
out << sb;
out << nl << "if(__has_" << p->name() << ')';
out << sb;
- out << nl << "return new " << optType << '(' << name << ");";
+ if(classType)
+ {
+ out << nl << "return java.util.Optional.ofNullable(" << name << ");";
+ }
+ else if(b && b->kind() == Builtin::KindInt)
+ {
+ out << nl << "return java.util.OptionalInt.of(" << name << ");";
+ }
+ else if(b && b->kind() == Builtin::KindLong)
+ {
+ out << nl << "return java.util.OptionalLong.of(" << name << ");";
+ }
+ else if(b && b->kind() == Builtin::KindDouble)
+ {
+ out << nl << "return java.util.OptionalDouble.of(" << name << ");";
+ }
+ else
+ {
+ out << nl << "return java.util.Optional.of(" << name << ");";
+ }
out << eb;
out << nl << "else";
out << sb;
- out << nl << "return new " << optType << "();";
+ if(b && b->kind() == Builtin::KindInt)
+ {
+ out << nl << "return java.util.OptionalInt.empty();";
+ }
+ else if(b && b->kind() == Builtin::KindLong)
+ {
+ out << nl << "return java.util.OptionalLong.empty();";
+ }
+ else if(b && b->kind() == Builtin::KindDouble)
+ {
+ out << nl << "return java.util.OptionalDouble.empty();";
+ }
+ else
+ {
+ out << nl << "return java.util.Optional.empty();";
+ }
out << eb;
out << eb;
}
@@ -4289,7 +3654,6 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
//
// Check for bool type.
//
- BuiltinPtr b = BuiltinPtr::dynamicCast(type);
if(b && b->kind() == Builtin::KindBool)
{
if(cls && !validateMethod(ops, "is" + capName, 0, file, line))
@@ -4303,14 +3667,13 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
out << nl << " * @deprecated " << deprecateReason;
out << nl << " **/";
}
- out << nl << "public boolean";
- out << nl << "is" << capName << "()";
+ out << nl << "public boolean is" << capName << "()";
out << sb;
if(optional)
{
out << nl << "if(!__has_" << p->name() << ')';
out << sb;
- out << nl << "throw new java.lang.IllegalStateException(\"" << name << " is not set\");";
+ out << nl << "throw new java.util.NoSuchElementException(\"" << name << " is not set\");";
out << eb;
}
out << nl << "return " << name << ';';
@@ -4332,7 +3695,8 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
return;
}
- string elem = typeToString(seq->type(), TypeModeMember, getPackage(contained));
+ string elem = typeToString(seq->type(), TypeModeMember, getPackage(contained), StringList(), true,
+ false, local);
//
// Indexed getter.
@@ -4344,14 +3708,13 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
out << nl << " * @deprecated " << deprecateReason;
out << nl << " **/";
}
- out << nl << "public " << elem;
- out << nl << "get" << capName << "(int _index)";
+ out << nl << "public " << elem << " get" << capName << "(int _index)";
out << sb;
if(optional)
{
out << nl << "if(!__has_" << p->name() << ')';
out << sb;
- out << nl << "throw new java.lang.IllegalStateException(\"" << name << " is not set\");";
+ out << nl << "throw new java.util.NoSuchElementException(\"" << name << " is not set\");";
out << eb;
}
out << nl << "return " << name << "[_index];";
@@ -4367,14 +3730,13 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
out << nl << " * @deprecated " << deprecateReason;
out << nl << " **/";
}
- out << nl << "public void";
- out << nl << "set" << capName << "(int _index, " << elem << " _val)";
+ out << nl << "public void set" << capName << "(int _index, " << elem << " _val)";
out << sb;
if(optional)
{
out << nl << "if(!__has_" << p->name() << ')';
out << sb;
- out << nl << "throw new java.lang.IllegalStateException(\"" << name << " is not set\");";
+ out << nl << "throw new java.util.NoSuchElementException(\"" << name << " is not set\");";
out << eb;
}
out << nl << name << "[_index] = _val;";
@@ -4418,14 +3780,12 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
}
out << ';';
- out << sp << nl << "public int"
- << nl << "value()";
+ out << sp << nl << "public int value()";
out << sb;
out << nl << "return __value;";
out << eb;
- out << sp << nl << "public static " << name
- << nl << "valueOf(int __v)";
+ out << sp << nl << "public static " << name << " valueOf(int __v)";
out << sb;
out << nl << "switch(__v)";
out << sb;
@@ -4450,12 +3810,12 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
if(!p->isLocal())
{
- out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __os)";
+ out << sp << nl << "public void" << nl << "ice_write(com.zeroc.Ice.OutputStream __os)";
out << sb;
out << nl << "__os.writeEnum(value(), " << p->maxValue() << ");";
out << eb;
- out << sp << nl << "public static void" << nl << "write(Ice.OutputStream __os, " << name << " __v)";
+ out << sp << nl << "public static void write(com.zeroc.Ice.OutputStream __os, " << name << " __v)";
out << sb;
out << nl << "if(__v == null)";
out << sb;
@@ -4468,19 +3828,18 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
out << eb;
out << eb;
- out << sp << nl << "public static " << name << nl << "read(Ice.InputStream __is)";
+ out << sp << nl << "public static " << name << " read(com.zeroc.Ice.InputStream __is)";
out << sb;
out << nl << "int __v = __is.readEnum(" << p->maxValue() << ");";
out << nl << "return __validate(__v);";
out << eb;
- out << sp << nl << "private static " << name
- << nl << "__validate(int __v)";
+ out << sp << nl << "private static " << name << " __validate(int __v)";
out << sb;
out << nl << "final " << name << " __e = valueOf(__v);";
out << nl << "if(__e == null)";
out << sb;
- out << nl << "throw new Ice.MarshalException(\"enumerator value \" + __v + \" is out of range\");";
+ out << nl << "throw new com.zeroc.Ice.MarshalException(\"enumerator value \" + __v + \" is out of range\");";
out << eb;
out << nl << "return __e;";
out << eb;
@@ -4552,7 +3911,7 @@ Slice::Gen::CompactIdVisitor::visitClassDefStart(const ClassDefPtr& p)
if(p->compactId() >= 0)
{
ostringstream os;
- os << prefix << "IceCompactId.TypeId_" << p->compactId();
+ os << prefix << "com.zeroc.IceCompactId.TypeId_" << p->compactId();
open(os.str(), p->file());
Output& out = output();
@@ -4566,553 +3925,11 @@ Slice::Gen::CompactIdVisitor::visitClassDefStart(const ClassDefPtr& p)
return false;
}
-Slice::Gen::HolderVisitor::HolderVisitor(const string& dir) :
- JavaVisitor(dir)
-{
-}
-
-bool
-Slice::Gen::HolderVisitor::visitClassDefStart(const ClassDefPtr& p)
-{
- ClassDeclPtr decl = p->declaration();
- writeHolder(decl);
-
- if(!p->isLocal())
- {
- string name = p->name();
- string absolute = getAbsolute(p, "", "", "PrxHolder");
-
- open(absolute, p->file());
- Output& out = output();
-
- out << sp << nl << "public final class " << name << "PrxHolder";
- out << sb;
- out << sp << nl << "public" << nl << name << "PrxHolder()";
- out << sb;
- out << eb;
- out << sp << nl << "public" << nl << name << "PrxHolder(" << name << "Prx value)";
- out << sb;
- out << nl << "this.value = value;";
- out << eb;
- out << sp << nl << "public " << name << "Prx value;";
- out << eb;
- close();
- }
-
- return false;
-}
-
-bool
-Slice::Gen::HolderVisitor::visitStructStart(const StructPtr& p)
-{
- writeHolder(p);
- return false;
-}
-
-void
-Slice::Gen::HolderVisitor::visitSequence(const SequencePtr& p)
-{
- if(sequenceHasHolder(p))
- {
- writeHolder(p);
- }
-}
-
-void
-Slice::Gen::HolderVisitor::visitDictionary(const DictionaryPtr& p)
-{
- writeHolder(p);
-}
-
-void
-Slice::Gen::HolderVisitor::visitEnum(const EnumPtr& p)
-{
- writeHolder(p);
-}
-
-void
-Slice::Gen::HolderVisitor::writeHolder(const TypePtr& p)
-{
- ContainedPtr contained = ContainedPtr::dynamicCast(p);
- assert(contained);
- string name = contained->name();
- string absolute = getAbsolute(contained, "", "", "Holder");
-
-
- string file;
- if(p->definitionContext())
- {
- file = p->definitionContext()->filename();
- }
-
- open(absolute, file);
- Output& out = output();
-
- string typeS = typeToString(p, TypeModeIn, getPackage(contained));
- out << sp << nl << "public final class " << name << "Holder";
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(p);
- ClassDeclPtr cl = ClassDeclPtr::dynamicCast(p);
- if(!p->isLocal() && ((builtin && builtin->kind() == Builtin::KindObject) || cl))
- {
- out << " extends Ice.ObjectHolderBase<" << typeS << ">";
- }
- else {
- out << " extends Ice.Holder<" << typeS << ">";
- }
- out << sb;
- if(!p->isLocal() && ((builtin && builtin->kind() == Builtin::KindObject) || cl))
- {
- out << sp << nl << "public" << nl << name << "Holder()";
- out << sb;
- out << eb;
- out << sp << nl << "public" << nl << name << "Holder(" << typeS << " value)";
- out << sb;
- out << nl << "this.value = value;";
- out << eb;
-
- out << sp << nl << "public void";
- out << nl << "valueReady(Ice.Object v)";
- out << sb;
- out << nl << "if(v == null || v instanceof " << typeS << ")";
- out << sb;
- out << nl << "value = (" << typeS << ")v;";
- out << eb;
- out << nl << "else";
- out << sb;
- out << nl << "IceInternal.Ex.throwUOE(type(), v);";
- out << eb;
- out << eb;
- out << sp << nl << "public String" << nl << "type()";
- out << sb;
- if(cl)
- {
- if(cl->isInterface())
- {
- out << nl << "return _" << cl->name() << "Disp.ice_staticId();";
- }
- else
- {
- out << nl << "return " << typeS << ".ice_staticId();";
- }
- }
- else
- {
- out << nl << "return \"" << p->typeId() << "\";";
- }
- out << eb;
- }
- else
- {
- out << sp << nl << "public" << nl << name << "Holder()";
- out << sb;
- out << eb;
- out << sp << nl << "public" << nl << name << "Holder(" << typeS << " value)";
- out << sb;
- out << nl << "super(value);";
- out << eb;
- }
- out << eb;
- close();
-}
-
Slice::Gen::HelperVisitor::HelperVisitor(const string& dir) :
JavaVisitor(dir)
{
}
-bool
-Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
-{
- if(p->isLocal())
- {
- return false;
- }
-
- //
- // Proxy helper
- //
- string name = p->name();
- string scoped = p->scoped();
- string package = getPackage(p);
- string absolute = getAbsolute(p);
-
- open(getAbsolute(p, "", "", "PrxHelper"), p->file());
- Output& out = output();
-
- //
- // A proxy helper class serves two purposes: it implements the
- // proxy interface, and provides static helper methods for use
- // by applications (e.g., checkedCast, etc.)
- //
- out << sp;
- writeDocComment(out, getDeprecateReason(p, 0, p->isInterface() ? "interface" : "class"),
- "Provides type-specific helper functions.");
- out << nl << "public final class " << name << "PrxHelper extends Ice.ObjectPrxHelperBase implements " << name
- << "Prx";
-
- out << sb;
-
- string contextParam = "java.util.Map<String, String> __ctx";
- string explicitContextParam = "boolean __explicitCtx";
-
- OperationList ops = p->allOperations();
- for(OperationList::iterator r = ops.begin(); r != ops.end(); ++r)
- {
- OperationPtr op = *r;
- const ContainerPtr container = op->container();
- const ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
-
- out << sp;
- out << nl << "private static final String __" << op->name() << "_name = \"" << op->name() << "\";";
-
- //
- // Use the optional mapping by default.
- //
- writeOperation(p, package, op, true);
-
- //
- // If the operation actually sends any optionals, we generated overloaded methods
- // that use the required mapping.
- //
- if(op->sendsOptionals())
- {
- writeOperation(p, package, op, false);
- }
-
- //
- // End method
- //
- vector<string> outParams = getInOutParams(op, package, OutParam, true, true);
- int iter = 0;
- ExceptionList throws = op->throws();
- throws.sort();
- throws.unique();
- const TypePtr ret = op->returnType();
- const string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData(), true, op->returnIsOptional());
-
- out << sp;
- out << nl << "public " << retS << " end_" << op->name() << spar << outParams << "Ice.AsyncResult __iresult"
- << epar;
- writeThrowsClause(package, throws);
- out << sb;
- if(op->returnsData())
- {
- out << nl << "IceInternal.OutgoingAsync __result = IceInternal.OutgoingAsync.check(__iresult, this, __"
- << op->name() << "_name);";
- out << nl << "try";
- out << sb;
-
- out << nl << "if(!__result.__wait())";
- out << sb;
- out << nl << "try";
- out << sb;
- out << nl << "__result.throwUserException();";
- out << eb;
- //
- // Arrange exceptions into most-derived to least-derived order. If we don't
- // do this, a base exception handler can appear before a derived exception
- // handler, causing compiler warnings and resulting in the base exception
- // being marshaled instead of the derived exception.
- //
-#if defined(__SUNPRO_CC)
- throws.sort(Slice::derivedToBaseCompare);
-#else
- throws.sort(Slice::DerivedToBaseCompare());
-#endif
- for(ExceptionList::const_iterator eli = throws.begin(); eli != throws.end(); ++eli)
- {
- out << nl << "catch(" << getAbsolute(*eli, package) << " __ex)";
- out << sb;
- out << nl << "throw __ex;";
- out << eb;
- }
- out << nl << "catch(Ice.UserException __ex)";
- out << sb;
- out << nl << "throw new Ice.UnknownUserException(__ex.ice_id(), __ex);";
- out << eb;
- out << eb;
-
- if(ret || !outParams.empty())
- {
- out << nl << "Ice.InputStream __is = __result.startReadParams();";
- const ParamDeclList paramList = op->parameters();
- ParamDeclList pl;
- for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
- {
- if((*pli)->isOutParam())
- {
- pl.push_back(*pli);
- }
- }
- writeMarshalUnmarshalParams(out, package, pl, op, iter, false, true);
- if(op->returnsClasses(false))
- {
- out << nl << "__is.readPendingValues();";
- }
- out << nl << "__result.endReadParams();";
- }
- else
- {
- out << nl << "__result.readEmptyParams();";
- }
-
- if(ret)
- {
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
- if(!op->returnIsOptional() &&
- ((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret)))
- {
- out << nl << "return __ret.value;";
- }
- else
- {
- out << nl << "return __ret;";
- }
- }
-
- out << eb;
- out << nl << "finally";
- out << sb;
- out << nl << "if(__result != null)";
- out << sb;
- out << nl << "__result.cacheMessageBuffers();";
- out << eb;
- out << eb;
- }
- else
- {
- out << nl << "__end(__iresult, __" << op->name() << "_name);";
- }
- out << eb;
-
- //
- // The async callbacks implementation of __completed method delegate to the static
- // __<op-name>_completed method implemented bellow.
- //
- if(op->returnsData())
- {
- const ParamDeclList paramList = op->parameters();
- ParamDeclList outParams;
- for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
- {
- if((*pli)->isOutParam())
- {
- outParams.push_back(*pli);
- }
- }
-
- out << sp << nl << "static public void __" << op->name() << "_completed("
- << getAsyncCallbackInterface(op, package) << " __cb, Ice.AsyncResult __result)";
- out << sb;
- out << nl << getAbsolute(cl, "", "", "Prx") << " __proxy = ("
- << getAbsolute(cl, "", "", "Prx") << ")__result.getProxy();";
-
- TypePtr ret = op->returnType();
- if(ret)
- {
- out << nl << typeToString(ret, TypeModeIn, package, op->getMetaData(), true,
- op->returnIsOptional())
- << " __ret = " << (op->returnIsOptional() ? "null" : initValue(ret)) << ';';
- }
- for(ParamDeclList::const_iterator pli = outParams.begin(); pli != outParams.end(); ++pli)
- {
- string ts = typeToString((*pli)->type(), TypeModeOut, package, (*pli)->getMetaData(), true,
- (*pli)->optional());
- out << nl << ts << ' ' << fixKwd((*pli)->name()) << " = new " << ts << "();";
- }
- out << nl << "try";
- out << sb;
- out << nl;
- if(op->returnType())
- {
- out << "__ret = ";
- }
- out << "__proxy.end_" << op->name() << spar << getInOutArgs(op, OutParam) << "__result" << epar
- << ';';
-
- out << eb;
- if(!throws.empty())
- {
- out << nl << "catch(Ice.UserException __ex)";
- out << sb;
- out << nl << "__cb.exception(__ex);";
- out << nl << "return;";
- out << eb;
- }
- out << nl << "catch(Ice.LocalException __ex)";
- out << sb;
- out << nl << "__cb.exception(__ex);";
- out << nl << "return;";
- out << eb;
- out << nl << "catch(Ice.SystemException __ex)";
- out << sb;
- out << nl << "__cb.exception(__ex);";
- out << nl << "return;";
- out << eb;
-
- out << nl << "__cb.response" << spar;
- if(op->returnType())
- {
- out << "__ret";
- }
- for(ParamDeclList::const_iterator pli = outParams.begin(); pli != outParams.end(); ++pli)
- {
- if((*pli)->optional())
- {
- out << fixKwd((*pli)->name());
- }
- else
- {
- out << fixKwd((*pli)->name()) + ".value";
- }
- }
- out << epar << ';';
-
- out << eb;
- }
- }
-
- out << sp;
- writeDocComment(out, "",
- "Contacts the remote server to verify that the object implements this type.\n"
- "Raises a local exception if a communication error occurs.\n"
- "@param __obj The untyped proxy.\n"
- "@return A proxy for this type, or null if the object does not support this type.");
- out << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx __obj)";
- out << sb;
- out << nl << "return checkedCastImpl(__obj, ice_staticId(), " << name << "Prx.class, "
- << name << "PrxHelper.class);";
- out << eb;
-
- out << sp;
- writeDocComment(out, "",
- "Contacts the remote server to verify that the object implements this type.\n"
- "Raises a local exception if a communication error occurs.\n"
- "@param __obj The untyped proxy.\n"
- "@param __ctx The Context map to send with the invocation.\n"
- "@return A proxy for this type, or null if the object does not support this type.");
- out << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx __obj, " << contextParam << ')';
- out << sb;
- out << nl << "return checkedCastImpl(__obj, __ctx, ice_staticId(), " << name
- << "Prx.class, " << name << "PrxHelper.class);";
- out << eb;
-
- out << sp;
- writeDocComment(out, "",
- "Contacts the remote server to verify that a facet of the object implements this type.\n"
- "Raises a local exception if a communication error occurs.\n"
- "@param __obj The untyped proxy.\n"
- "@param __facet The name of the desired facet.\n"
- "@return A proxy for this type, or null if the object does not support this type.");
- out << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx __obj, String __facet)";
- out << sb;
- out << nl << "return checkedCastImpl(__obj, __facet, ice_staticId(), " << name
- << "Prx.class, " << name << "PrxHelper.class);";
- out << eb;
-
- out << sp;
- writeDocComment(out, "",
- "Contacts the remote server to verify that a facet of the object implements this type.\n"
- "Raises a local exception if a communication error occurs.\n"
- "@param __obj The untyped proxy.\n"
- "@param __facet The name of the desired facet.\n"
- "@param __ctx The Context map to send with the invocation.\n"
- "@return A proxy for this type, or null if the object does not support this type.");
- out << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx __obj, String __facet, "
- << contextParam << ')';
- out << sb;
- out << nl << "return checkedCastImpl(__obj, __facet, __ctx, ice_staticId(), " << name
- << "Prx.class, " << name << "PrxHelper.class);";
- out << eb;
-
- out << sp;
- writeDocComment(out, "",
- "Downcasts the given proxy to this type without contacting the remote server.\n"
- "@param __obj The untyped proxy.\n"
- "@return A proxy for this type.");
- out << nl << "public static " << name << "Prx uncheckedCast(Ice.ObjectPrx __obj)";
- out << sb;
- out << nl << "return uncheckedCastImpl(__obj, " << name << "Prx.class, " << name
- << "PrxHelper.class);";
- out << eb;
-
- out << sp;
- writeDocComment(out, "",
- "Downcasts the given proxy to this type without contacting the remote server.\n"
- "@param __obj The untyped proxy.\n"
- "@param __facet The name of the desired facet.\n"
- "@return A proxy for this type.");
- out << nl << "public static " << name << "Prx uncheckedCast(Ice.ObjectPrx __obj, String __facet)";
- out << sb;
- out << nl << "return uncheckedCastImpl(__obj, __facet, " << name << "Prx.class, " << name
- << "PrxHelper.class);";
- out << eb;
-
- ClassList allBases = p->allBases();
- StringList ids;
- transform(allBases.begin(), allBases.end(), back_inserter(ids), constMemFun(&Contained::scoped));
- StringList other;
- other.push_back(scoped);
- other.push_back("::Ice::Object");
- other.sort();
- ids.merge(other);
- ids.unique();
- StringList::const_iterator firstIter = ids.begin();
- StringList::const_iterator scopedIter = find(ids.begin(), ids.end(), scoped);
- assert(scopedIter != ids.end());
- StringList::difference_type scopedPos = ::IceUtilInternal::distance(firstIter, scopedIter);
-
- out << sp << nl << "public static final String[] __ids =";
- out << sb;
-
- for(StringList::const_iterator q = ids.begin(); q != ids.end();)
- {
- out << nl << '"' << *q << '"';
- if(++q != ids.end())
- {
- out << ',';
- }
- }
-
- out << eb << ';';
-
- out << sp;
- writeDocComment(out, "",
- "Provides the Slice type ID of this type.\n"
- "@return The Slice type ID.");
- out << nl << "public static String ice_staticId()";
- out << sb;
- out << nl << "return __ids[" << scopedPos << "];";
- out << eb;
-
- out << sp << nl << "public static void write(Ice.OutputStream __os, " << name << "Prx v)";
- out << sb;
- out << nl << "__os.writeProxy(v);";
- out << eb;
-
- out << sp << nl << "public static " << name << "Prx read(Ice.InputStream __is)";
- out << sb;
- out << nl << "Ice.ObjectPrx proxy = __is.readProxy();";
- out << nl << "if(proxy != null)";
- out << sb;
- out << nl << name << "PrxHelper result = new " << name << "PrxHelper();";
- out << nl << "result.__copyFrom(proxy);";
- out << nl << "return result;";
- out << eb;
- out << nl << "return null;";
- out << eb;
-
- //
- // Avoid serialVersionUID warnings for Proxy Helper classes.
- //
- out << sp << nl << "public static final long serialVersionUID = 0L;";
- out << eb;
-
- close();
-
- return false;
-}
-
void
Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
{
@@ -5167,7 +3984,7 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
bool suppressUnchecked = false;
string instanceType, formalType;
- bool customType = getSequenceTypes(p, "", StringList(), instanceType, formalType);
+ bool customType = getSequenceTypes(p, "", StringList(), instanceType, formalType, false);
if(!customType)
{
@@ -5203,7 +4020,7 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
out << sp << nl << "public final class " << name << "Helper";
out << sb;
- out << nl << "public static void" << nl << "write(Ice.OutputStream __os, " << typeS << " __v)";
+ out << nl << "public static void write(com.zeroc.Ice.OutputStream __os, " << typeS << " __v)";
out << sb;
iter = 0;
writeSequenceMarshalUnmarshalCode(out, package, p, "__v", true, iter, false);
@@ -5214,7 +4031,7 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
{
out << nl << "@SuppressWarnings(\"unchecked\")";
}
- out << nl << "public static " << typeS << nl << "read(Ice.InputStream __is)";
+ out << nl << "public static " << typeS << " read(com.zeroc.Ice.InputStream __is)";
out << sb;
out << nl << typeS << " __v;";
iter = 0;
@@ -5255,14 +4072,13 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
out << sp << nl << "public final class " << name << "Helper";
out << sb;
- out << nl << "public static void" << nl << "write(Ice.OutputStream __os, " << formalType << " __v)";
+ out << nl << "public static void write(com.zeroc.Ice.OutputStream __os, " << formalType << " __v)";
out << sb;
iter = 0;
writeDictionaryMarshalUnmarshalCode(out, package, p, "__v", true, iter, false);
out << eb;
- out << sp << nl << "public static " << formalType
- << nl << "read(Ice.InputStream __is)";
+ out << sp << nl << "public static " << formalType << " read(com.zeroc.Ice.InputStream __is)";
out << sb;
out << nl << formalType << " __v;";
iter = 0;
@@ -5274,691 +4090,711 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
close();
}
-void
-Slice::Gen::HelperVisitor::writeOperation(const ClassDefPtr& p, const string& package, const OperationPtr& op,
- bool optionalMapping)
+Slice::Gen::ProxyVisitor::ProxyVisitor(const string& dir) :
+ JavaVisitor(dir)
{
- const string name = p->name();
- Output& out = output();
-
- const string contextParam = "java.util.Map<String, String> __ctx";
- const string explicitContextParam = "boolean __explicitCtx";
-
- const ContainerPtr container = op->container();
- const ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- const string opName = fixKwd(op->name());
- const TypePtr ret = op->returnType();
- const string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData(), true, op->returnIsOptional());
-
- vector<string> params = getParamsProxy(op, package, false, optionalMapping);
- vector<string> args = getArgs(op);
+}
- ParamDeclList inParams;
- ParamDeclList outParams;
- ParamDeclList paramList = op->parameters();
- for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
+bool
+Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
+{
+ if(p->isLocal())
{
- if((*pli)->isOutParam())
- {
- outParams.push_back(*pli);
- }
- else
- {
- inParams.push_back(*pli);
- }
+ return false;
}
- ExceptionList throws = op->throws();
- throws.sort();
- throws.unique();
-
//
- // Write two synchronous versions of the operation - with and without a
- // context parameter.
+ // Don't generate a proxy interface for a class with no operations.
//
- out << sp << nl << "public " << retS << ' ' << opName << spar << params << epar;
- writeThrowsClause(package, throws);
- out << sb;
- out << nl;
- if(ret)
+ const OperationList ops = p->allOperations();
+ if(!p->isInterface() && ops.empty())
{
- out << "return ";
+ return false;
}
- out << opName << spar << args << "null" << "false" << epar << ';';
- out << eb;
- out << sp << nl << "public " << retS << ' ' << opName << spar << params << contextParam << epar;
- writeThrowsClause(package, throws);
- out << sb;
- out << nl;
- if(ret)
- {
- out << "return ";
- }
- out << opName << spar << args << "__ctx" << "true" << epar << ';';
- out << eb;
+ string name = p->name();
+ ClassList bases = p->bases();
+ string package = getPackage(p);
+ string absolute = getAbsolute(p, "", "", "Prx");
- out << sp;
- out << nl << "private " << retS << ' ' << opName << spar << params << contextParam
- << explicitContextParam << epar;
- writeThrowsClause(package, throws);
- out << sb;
+ open(absolute, p->file());
- // This code replaces the synchronous calls with chained AMI calls.
- if(op->returnsData())
+ Output& out = output();
+
+ //
+ // For proxy purposes, we can ignore a base class if it has no operations.
+ //
+ if(!bases.empty() && !bases.front()->isInterface() && bases.front()->allOperations().empty())
{
- out << nl << "__checkTwowayOnly(__" << op->name() << "_name);";
+ bases.pop_front();
}
- if(ret)
+ //
+ // Generate a Java interface as the user-visible type
+ //
+ out << sp;
+ writeDocComment(out, p, getDeprecateReason(p, 0, p->isInterface() ? "interface" : "class"));
+ out << nl << "public interface " << name << "Prx extends ";
+ out.useCurrentPosAsIndent();
+ if(bases.empty())
{
- out << nl << "return ";
+ out << "com.zeroc.Ice.ObjectPrx";
}
else
{
- out << nl;
- }
-
- out << "end_" << op->name() << "(";
- vector<string> inOutArgs = getInOutArgs(op, OutParam);
- if(!inOutArgs.empty()) {
- for(vector<string>::const_iterator p = inOutArgs.begin(); p != inOutArgs.end(); ++p) {
- out << *p << ", ";
- }
- }
- vector<string> inArgs = getInOutArgs(op, InParam);
- out << "begin_" << op->name() << "(";
- if(!inArgs.empty())
- {
- for(vector<string>::const_iterator p = inArgs.begin(); p != inArgs.end(); ++p) {
- out << *p << ", ";
+ for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
+ {
+ if(q != bases.begin())
+ {
+ out << ',' << nl;
+ }
+ out << getAbsolute(*q, package, "", "Prx");
}
}
- out << "__ctx, __explicitCtx, true, null));";
- out << eb;
+ out.restoreIndent();
- {
- //
- // Write the asynchronous begin methods.
- //
- vector<string> inParams = getInOutParams(op, package, InParam, true, optionalMapping);
- vector<string> inArgs = getInOutArgs(op, InParam);
- const string callbackParam = "Ice.Callback __cb";
- const ParamDeclList paramList = op->parameters();
- int iter;
-
- //
- // Type-unsafe begin methods
- //
- out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << epar;
- out << sb;
- out << nl << "return begin_" << op->name() << spar << inArgs << "null" << "false" << "false" << "null" << epar
- << ';';
- out << eb;
-
- out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << contextParam << epar;
- out << sb;
- out << nl << "return begin_" << op->name() << spar << inArgs << "__ctx" << "true" << "false" << "null" << epar
- << ';';
- out << eb;
+ out << sb;
- out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << callbackParam << epar;
- out << sb;
- out << nl << "return begin_" << op->name() << spar << inArgs << "null" << "false" << "false" << "__cb" << epar
- << ';';
- out << eb;
+ return true;
+}
- out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << contextParam
- << callbackParam << epar;
- out << sb;
- out << nl << "return begin_" << op->name() << spar << inArgs << "__ctx" << "true" << "false" << "__cb" << epar
- << ';';
- out << eb;
+void
+Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
+{
+ Output& out = output();
- //
- // Type-safe begin methods
- //
- string typeSafeCallbackParam;
+ const string contextParam = "java.util.Map<String, String> __ctx";
- //
- // Get the name of the callback using the name of the class in which this
- // operation was defined.
- //
- ContainerPtr container = op->container();
- ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- string opClassName = getAbsolute(cl, package, "Callback_", '_' + op->name());
- typeSafeCallbackParam = opClassName + " __cb";
+ out << sp;
+ writeDocComment(out, "",
+ "Contacts the remote server to verify that the object implements this type.\n"
+ "Raises a local exception if a communication error occurs.\n"
+ "@param __obj The untyped proxy.\n"
+ "@return A proxy for this type, or null if the object does not support this type.");
+ out << nl << "static " << p->name() << "Prx checkedCast(com.zeroc.Ice.ObjectPrx __obj)";
+ out << sb;
+ out << nl << "return com.zeroc.Ice.ObjectPrx.__checkedCast(__obj, ice_staticId, " << p->name()
+ << "Prx.class, _" << p->name() << "PrxI.class);";
+ out << eb;
- out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << typeSafeCallbackParam
- << epar;
- out << sb;
- out << nl << "return begin_" << op->name() << spar << inArgs << "null" << "false" << "false" << "__cb" << epar
- << ';';
- out << eb;
+ out << sp;
+ writeDocComment(out, "",
+ "Contacts the remote server to verify that the object implements this type.\n"
+ "Raises a local exception if a communication error occurs.\n"
+ "@param __obj The untyped proxy.\n"
+ "@param __ctx The Context map to send with the invocation.\n"
+ "@return A proxy for this type, or null if the object does not support this type.");
+ out << nl << "static " << p->name() << "Prx checkedCast(com.zeroc.Ice.ObjectPrx __obj, " << contextParam << ')';
+ out << sb;
+ out << nl << "return com.zeroc.Ice.ObjectPrx.__checkedCast(__obj, __ctx, ice_staticId, " << p->name()
+ << "Prx.class, _" << p->name() << "PrxI.class);";
+ out << eb;
- out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << contextParam
- << typeSafeCallbackParam << epar;
- out << sb;
- out << nl << "return begin_" << op->name() << spar << inArgs << "__ctx" << "true" << "false" << "__cb" << epar
- << ';';
- out << eb;
+ out << sp;
+ writeDocComment(out, "",
+ "Contacts the remote server to verify that a facet of the object implements this type.\n"
+ "Raises a local exception if a communication error occurs.\n"
+ "@param __obj The untyped proxy.\n"
+ "@param __facet The name of the desired facet.\n"
+ "@return A proxy for this type, or null if the object does not support this type.");
+ out << nl << "static " << p->name() << "Prx checkedCast(com.zeroc.Ice.ObjectPrx __obj, String __facet)";
+ out << sb;
+ out << nl << "return com.zeroc.Ice.ObjectPrx.__checkedCast(__obj, __facet, ice_staticId, " << p->name()
+ << "Prx.class, _" << p->name() << "PrxI.class);";
+ out << eb;
- //
- // Async methods that accept Java 8 lambda callbacks.
- //
- out << sp;
- out << nl << "public Ice.AsyncResult begin_" << op->name();
- writeParamList(out, getParamsAsyncLambda(op, package, false, false, optionalMapping));
- out << sb;
- out << nl << "return begin_" << op->name() << spar << getArgsAsyncLambda(op, package) << epar << ';';
- out << eb;
+ out << sp;
+ writeDocComment(out, "",
+ "Contacts the remote server to verify that a facet of the object implements this type.\n"
+ "Raises a local exception if a communication error occurs.\n"
+ "@param __obj The untyped proxy.\n"
+ "@param __facet The name of the desired facet.\n"
+ "@param __ctx The Context map to send with the invocation.\n"
+ "@return A proxy for this type, or null if the object does not support this type.");
+ out << nl << "static " << p->name() << "Prx checkedCast(com.zeroc.Ice.ObjectPrx __obj, String __facet, "
+ << contextParam << ')';
+ out << sb;
+ out << nl << "return com.zeroc.Ice.ObjectPrx.__checkedCast(__obj, __facet, __ctx, ice_staticId, " << p->name()
+ << "Prx.class, _" << p->name() << "PrxI.class);";
+ out << eb;
- out << sp;
- out << nl << "public Ice.AsyncResult begin_" << op->name();
- writeParamList(out, getParamsAsyncLambda(op, package, false, true, optionalMapping));
- out << sb;
- out << nl << "return begin_" << op->name() << spar << getArgsAsyncLambda(op, package, false, true) << epar
- << ';';
- out << eb;
+ out << sp;
+ writeDocComment(out, "",
+ "Downcasts the given proxy to this type without contacting the remote server.\n"
+ "@param __obj The untyped proxy.\n"
+ "@return A proxy for this type.");
+ out << nl << "static " << p->name() << "Prx uncheckedCast(com.zeroc.Ice.ObjectPrx __obj)";
+ out << sb;
+ out << nl << "return com.zeroc.Ice.ObjectPrx.__uncheckedCast(__obj, " << p->name() << "Prx.class, _"
+ << p->name() << "PrxI.class);";
+ out << eb;
- out << sp;
- out << nl << "public Ice.AsyncResult begin_" << op->name();
- writeParamList(out, getParamsAsyncLambda(op, package, true, false, optionalMapping));
- out << sb;
- out << nl << "return begin_" << op->name() << spar << getArgsAsyncLambda(op, package, true) << epar << ';';
- out << eb;
+ out << sp;
+ writeDocComment(out, "",
+ "Downcasts the given proxy to this type without contacting the remote server.\n"
+ "@param __obj The untyped proxy.\n"
+ "@param __facet The name of the desired facet.\n"
+ "@return A proxy for this type.");
+ out << nl << "static " << p->name() << "Prx uncheckedCast(com.zeroc.Ice.ObjectPrx __obj, String __facet)";
+ out << sb;
+ out << nl << "return com.zeroc.Ice.ObjectPrx.__uncheckedCast(__obj, __facet, " << p->name() << "Prx.class, _"
+ << p->name() << "PrxI.class);";
+ out << eb;
- out << sp;
- out << nl << "public Ice.AsyncResult begin_" << op->name();
- writeParamList(out, getParamsAsyncLambda(op, package, true, true, optionalMapping));
- out << sb;
- out << nl << "return begin_" << op->name() << spar << getArgsAsyncLambda(op, package, true, true) << epar
- << ';';
- out << eb;
+ out << sp;
+ writeDocComment(out, "",
+ "Returns a proxy that is identical to this proxy, except for the per-proxy context.\n"
+ "@param newContext The context for the new proxy.\n"
+ "@return A proxy with the specified per-proxy context.");
+ out << nl << "@Override";
+ out << nl << "default " << p->name() << "Prx ice_context(java.util.Map<String, String> newContext)";
+ out << sb;
+ out << nl << "return (" << p->name() << "Prx)__ice_context(newContext);";
+ out << eb;
- vector<string> params = inParams;
- params.push_back(contextParam);
- params.push_back("boolean __explicitCtx");
- params.push_back("boolean __synchronous");
- vector<string> asyncParams = getParamsAsyncLambda(op, package, false, true, optionalMapping, false);
- copy(asyncParams.begin(), asyncParams.end(), back_inserter(params));
+ out << sp;
+ writeDocComment(out, "",
+ "Returns a proxy that is identical to this proxy, except for the adapter ID.\n"
+ "@param newAdapterId The adapter ID for the new proxy.\n"
+ "@return A proxy with the specified adapter ID.");
+ out << nl << "@Override";
+ out << nl << "default " << p->name() << "Prx ice_adapterId(String newAdapterId)";
+ out << sb;
+ out << nl << "return (" << p->name() << "Prx)__ice_adapterId(newAdapterId);";
+ out << eb;
- out << sp;
- out << nl << "private Ice.AsyncResult begin_" << op->name();
- writeParamList(out, params);
- out << sb;
+ out << sp;
+ writeDocComment(out, "",
+ "Returns a proxy that is identical to this proxy, except for the endpoints.\n"
+ "@param newEndpoints The endpoints for the new proxy.\n"
+ "@return A proxy with the specified endpoints.");
+ out << nl << "@Override";
+ out << nl << "default " << p->name() << "Prx ice_endpoints(com.zeroc.Ice.Endpoint[] newEndpoints)";
+ out << sb;
+ out << nl << "return (" << p->name() << "Prx)__ice_endpoints(newEndpoints);";
+ out << eb;
- ParamDeclList outParams = getOutParams(op);
+ out << sp;
+ writeDocComment(out, "",
+ "Returns a proxy that is identical to this proxy, except for the locator cache timeout.\n"
+ "@param newTimeout The new locator cache timeout (in seconds).\n"
+ "@return A proxy with the specified locator cache timeout.");
+ out << nl << "@Override";
+ out << nl << "default " << p->name() << "Prx ice_locatorCacheTimeout(int newTimeout)";
+ out << sb;
+ out << nl << "return (" << p->name() << "Prx)__ice_locatorCacheTimeout(newTimeout);";
+ out << eb;
- if(!op->returnsData())
- {
- params = getInOutArgs(op, InParam);
- params.push_back("__ctx");
- params.push_back("__explicitCtx");
- params.push_back("__synchronous");
- params.push_back("new IceInternal.Functional_OnewayCallback(__responseCb, __exceptionCb, __sentCb)");
- out << nl << "return begin_" << op->name();
- writeParamList(out, params);
- out << ';';
- }
- else if((ret && !outParams.empty()) || (outParams.size() > 1))
- {
- params.clear();
- params.push_back(getLambdaResponseCB(op, package) + " responseCb");
- if(!throws.empty())
- {
- params.push_back("IceInternal.Functional_GenericCallback1<Ice.UserException> userExceptionCb");
- }
- params.push_back("IceInternal.Functional_GenericCallback1<Ice.Exception> exceptionCb");
- params.push_back("IceInternal.Functional_BoolCallback sentCb");
+ out << sp;
+ writeDocComment(out, "",
+ "Returns a proxy that is identical to this proxy, except for the invocation timeout.\n"
+ "@param newTimeout The new invocation timeout (in seconds).\n"
+ "@return A proxy with the specified invocation timeout.");
+ out << nl << "@Override";
+ out << nl << "default " << p->name() << "Prx ice_invocationTimeout(int newTimeout)";
+ out << sb;
+ out << nl << "return (" << p->name() << "Prx)__ice_invocationTimeout(newTimeout);";
+ out << eb;
- out << sp;
- out << nl << "class CB extends " << getAsyncCallbackBaseClass(op, true);
- out << sb;
- out << nl << "public CB";
- writeParamList(out, params);
- out << sb;
- out << nl << "super(responseCb != null, ";
- if(!throws.empty())
- {
- out << "userExceptionCb, ";
- }
- out << "exceptionCb, sentCb);";
- out << nl << "__responseCb = responseCb;";
- out << eb;
+ out << sp;
+ writeDocComment(out, "",
+ "Returns a proxy that is identical to this proxy, except for connection caching.\n"
+ "@param newCache <code>true</code> if the new proxy should cache connections; <code>false</code> otherwise.\n"
+ "@return A proxy with the specified caching policy.");
+ out << nl << "@Override";
+ out << nl << "default " << p->name() << "Prx ice_connectionCached(boolean newCache)";
+ out << sb;
+ out << nl << "return (" << p->name() << "Prx)__ice_connectionCached(newCache);";
+ out << eb;
- out << sp;
- out << nl << "public void response" << spar << getParamsAsyncCB(op, package, false, true) << epar;
- out << sb;
- out << nl << "if(__responseCb != null)";
- out << sb;
- out << nl << "__responseCb.apply" << spar;
- if(ret)
- {
- out << "__ret";
- }
- out << getInOutArgs(op, OutParam) << epar << ';';
- out << eb;
- out << eb;
+ out << sp;
+ writeDocComment(out, "",
+ "Returns a proxy that is identical to this proxy, except for the endpoint selection policy.\n"
+ "@param newType The new endpoint selection policy.\n"
+ "@return A proxy with the specified endpoint selection policy.");
+ out << nl << "@Override";
+ out << nl << "default " << p->name() << "Prx ice_endpointSelection(com.zeroc.Ice.EndpointSelectionType newType)";
+ out << sb;
+ out << nl << "return (" << p->name() << "Prx)__ice_endpointSelection(newType);";
+ out << eb;
- out << sp;
- out << nl << "public final void __completed(Ice.AsyncResult __result)";
- out << sb;
- out << nl << p->name() << "PrxHelper.__" << op->name() << "_completed(this, __result);";
- out << eb;
- out << sp;
- out << nl << "private final " << getLambdaResponseCB(op, package) << " __responseCb;";
- out << eb;
+ out << sp;
+ writeDocComment(out, "",
+ "Returns a proxy that is identical to this proxy, except for how it selects endpoints.\n"
+ "@param b If <code>b</code> is <code>true</code>, only endpoints that use a secure transport are\n"
+ "used by the new proxy. If <code>b</code> is false, the returned proxy uses both secure and\n"
+ "insecure endpoints.\n"
+ "@return A proxy with the specified selection policy.");
+ out << nl << "@Override";
+ out << nl << "default " << p->name() << "Prx ice_secure(boolean b)";
+ out << sb;
+ out << nl << "return (" << p->name() << "Prx)__ice_secure(b);";
+ out << eb;
- out << nl << "return begin_" << op->name() << spar << getInOutArgs(op, InParam) << "__ctx"
- << "__explicitCtx"
- << "__synchronous"
- << (throws.empty() ? "new CB(__responseCb, __exceptionCb, __sentCb)" :
- "new CB(__responseCb, __userExceptionCb, __exceptionCb, __sentCb)")
- << epar << ';';
- }
- else
- {
- params = getInOutArgs(op, InParam);
- params.push_back("__ctx");
- params.push_back("__explicitCtx");
- params.push_back("__synchronous");
-
- const string baseClass = getAsyncCallbackBaseClass(op, true);
- out << nl << "return begin_" << op->name();
- writeParamList(out, params, false, false);
- out << nl
- << (throws.empty() ? "new " + baseClass + "(__responseCb, __exceptionCb, __sentCb)" :
- "new " + baseClass + "(__responseCb, __userExceptionCb, __exceptionCb, __sentCb)");
- out.inc();
- out << sb;
- out << nl << "public final void __completed(Ice.AsyncResult __result)";
- out << sb;
- out << nl << p->name() << "PrxHelper.__" << op->name() << "_completed(this, __result);";
- out << eb;
- out << eb;
- out << ");";
- out.dec();
- out.restoreIndent();
- }
- out << eb;
+ out << sp;
+ writeDocComment(out, "",
+ "Returns a proxy that is identical to this proxy, except for the encoding used to marshal parameters.\n"
+ "@param e The encoding version to use to marshal request parameters.\n"
+ "@return A proxy with the specified encoding version.");
+ out << nl << "@Override";
+ out << nl << "default " << p->name() << "Prx ice_encodingVersion(com.zeroc.Ice.EncodingVersion e)";
+ out << sb;
+ out << nl << "return (" << p->name() << "Prx)__ice_encodingVersion(e);";
+ out << eb;
- //
- // Implementation of begin method
- //
- params = inParams;
- params.push_back(contextParam);
- params.push_back("boolean __explicitCtx");
- params.push_back("boolean __synchronous");
- params.push_back("IceInternal.CallbackBase __cb");
+ out << sp;
+ writeDocComment(out, "",
+ "Returns a proxy that is identical to this proxy, except for its endpoint selection policy.\n"
+ "@param b If <code>b</code> is <code>true</code>, the new proxy will use secure endpoints for invocations\n"
+ "and only use insecure endpoints if an invocation cannot be made via secure endpoints. If <code>b</code> is\n"
+ "<code>false</code>, the proxy prefers insecure endpoints to secure ones.\n"
+ "@return A proxy with the specified selection policy.");
+ out << nl << "@Override";
+ out << nl << "default " << p->name() << "Prx ice_preferSecure(boolean b)";
+ out << sb;
+ out << nl << "return (" << p->name() << "Prx)__ice_preferSecure(b);";
+ out << eb;
- out << sp;
- out << nl << "private Ice.AsyncResult begin_" << op->name();
- writeParamList(out, params);
- out << sb;
- if(op->returnsData())
- {
- out << nl << "__checkAsyncTwowayOnly(__" << op->name() << "_name);";
- }
- out << nl << "IceInternal.OutgoingAsync __result = getOutgoingAsync(__" << op->name()
- << "_name, __cb);";
- out << nl << "try";
- out << sb;
+ out << sp;
+ writeDocComment(out, "",
+ "Returns a proxy that is identical to this proxy, except for the router.\n"
+ "@param router The router for the new proxy.\n"
+ "@return A proxy with the specified router.");
+ out << nl << "@Override";
+ out << nl << "default " << p->name() << "Prx ice_router(com.zeroc.Ice.RouterPrx router)";
+ out << sb;
+ out << nl << "return (" << p->name() << "Prx)__ice_router(router);";
+ out << eb;
- out << nl << "__result.prepare(__" << op->name() << "_name, " << sliceModeToIceMode(op->sendMode())
- << ", __ctx, __explicitCtx, __synchronous);";
+ out << sp;
+ writeDocComment(out, "",
+ "Returns a proxy that is identical to this proxy, except for the locator.\n"
+ "@param locator The locator for the new proxy.\n"
+ "@return A proxy with the specified locator.");
+ out << nl << "@Override";
+ out << nl << "default " << p->name() << "Prx ice_locator(com.zeroc.Ice.LocatorPrx locator)";
+ out << sb;
+ out << nl << "return (" << p->name() << "Prx)__ice_locator(locator);";
+ out << eb;
- iter = 0;
- if(!inArgs.empty())
- {
- out << nl << "Ice.OutputStream __os = __result.startWriteParams("
- << opFormatTypeToString(op) << ");";
- ParamDeclList pl;
- for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
- {
- if(!(*pli)->isOutParam())
- {
- pl.push_back(*pli);
- }
- }
- writeMarshalUnmarshalParams(out, package, pl, 0, iter, true, optionalMapping);
- if(op->sendsClasses(false))
- {
- out << nl << "__os.writePendingValues();";
- }
- out << nl << "__result.endWriteParams();";
- }
- else
- {
- out << nl << "__result.writeEmptyParams();";
- }
+ out << sp;
+ writeDocComment(out, "",
+ "Returns a proxy that is identical to this proxy, except for collocation optimization.\n"
+ "@param b <code>true</code> if the new proxy enables collocation optimization; <code>false</code> otherwise.\n"
+ "@return A proxy with the specified collocation optimization.");
+ out << nl << "@Override";
+ out << nl << "default " << p->name() << "Prx ice_collocationOptimized(boolean b)";
+ out << sb;
+ out << nl << "return (" << p->name() << "Prx)__ice_collocationOptimized(b);";
+ out << eb;
- out << nl << "__result.invoke();";
- out << eb;
- out << nl << "catch(Ice.Exception __ex)";
- out << sb;
- out << nl << "__result.abort(__ex);";
- out << eb;
- out << nl << "return __result;";
- out << eb;
- }
-}
+ out << sp;
+ writeDocComment(out, "",
+ "Returns a proxy that is identical to this proxy, but uses twoway invocations.\n"
+ "@return A proxy that uses twoway invocations.");
+ out << nl << "@Override";
+ out << nl << "default " << p->name() << "Prx ice_twoway()";
+ out << sb;
+ out << nl << "return (" << p->name() << "Prx)__ice_twoway();";
+ out << eb;
-Slice::Gen::ProxyVisitor::ProxyVisitor(const string& dir) :
- JavaVisitor(dir)
-{
-}
+ out << sp;
+ writeDocComment(out, "",
+ "Returns a proxy that is identical to this proxy, but uses oneway invocations.\n"
+ "@return A proxy that uses oneway invocations.");
+ out << nl << "@Override";
+ out << nl << "default " << p->name() << "Prx ice_oneway()";
+ out << sb;
+ out << nl << "return (" << p->name() << "Prx)__ice_oneway();";
+ out << eb;
-bool
-Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
-{
- if(p->isLocal())
- {
- return false;
- }
+ out << sp;
+ writeDocComment(out, "",
+ "Returns a proxy that is identical to this proxy, but uses batch oneway invocations.\n"
+ "@return A proxy that uses batch oneway invocations.");
+ out << nl << "@Override";
+ out << nl << "default " << p->name() << "Prx ice_batchOneway()";
+ out << sb;
+ out << nl << "return (" << p->name() << "Prx)__ice_batchOneway();";
+ out << eb;
- string name = p->name();
- ClassList bases = p->bases();
- string package = getPackage(p);
- string absolute = getAbsolute(p, "", "", "Prx");
+ out << sp;
+ writeDocComment(out, "",
+ "Returns a proxy that is identical to this proxy, but uses datagram invocations.\n"
+ "@return A proxy that uses datagram invocations.");
+ out << nl << "@Override";
+ out << nl << "default " << p->name() << "Prx ice_datagram()";
+ out << sb;
+ out << nl << "return (" << p->name() << "Prx)__ice_datagram();";
+ out << eb;
- open(absolute, p->file());
+ out << sp;
+ writeDocComment(out, "",
+ "Returns a proxy that is identical to this proxy, but uses batch datagram invocations.\n"
+ "@return A proxy that uses batch datagram invocations.");
+ out << nl << "@Override";
+ out << nl << "default " << p->name() << "Prx ice_batchDatagram()";
+ out << sb;
+ out << nl << "return (" << p->name() << "Prx)__ice_batchDatagram();";
+ out << eb;
- Output& out = output();
+ out << sp;
+ writeDocComment(out, "",
+ "Returns a proxy that is identical to this proxy, except for compression.\n"
+ "@param co <code>true</code> enables compression for the new proxy; <code>false</code> disables compression.\n"
+ "@return A proxy with the specified compression setting.");
+ out << nl << "@Override";
+ out << nl << "default " << p->name() << "Prx ice_compress(boolean co)";
+ out << sb;
+ out << nl << "return (" << p->name() << "Prx)__ice_compress(co);";
+ out << eb;
- //
- // Generate a Java interface as the user-visible type
- //
out << sp;
- writeDocComment(out, p, getDeprecateReason(p, 0, p->isInterface() ? "interface" : "class"));
- out << nl << "public interface " << name << "Prx extends ";
- if(bases.empty())
- {
- out << "Ice.ObjectPrx";
- }
- else
- {
- out.useCurrentPosAsIndent();
- for(ClassList::const_iterator q = bases.begin(); q != bases.end();)
- {
- out << getAbsolute(*q, package, "", "Prx");
- if(++q != bases.end())
- {
- out << ',' << nl;
- }
- }
- out.restoreIndent();
- }
+ writeDocComment(out, "",
+ "Returns a proxy that is identical to this proxy, except for its connection timeout setting.\n"
+ "@param t The connection timeout for the proxy in milliseconds.\n"
+ "@return A proxy with the specified timeout.");
+ out << nl << "@Override";
+ out << nl << "default " << p->name() << "Prx ice_timeout(int t)";
+ out << sb;
+ out << nl << "return (" << p->name() << "Prx)__ice_timeout(t);";
+ out << eb;
+ out << sp;
+ writeDocComment(out, "",
+ "Returns a proxy that is identical to this proxy, except for its connection ID.\n"
+ "@param connectionId The connection ID for the new proxy. An empty string removes the connection ID.\n"
+ "@return A proxy with the specified connection ID.");
+ out << nl << "@Override";
+ out << nl << "default " << p->name() << "Prx ice_connectionId(String connectionId)";
out << sb;
+ out << nl << "return (" << p->name() << "Prx)__ice_connectionId(connectionId);";
+ out << eb;
- return true;
-}
+ out << sp;
+ out << nl << "final static String ice_staticId = \"" << p->scoped() << "\";";
+ out << sp;
+ out << nl << "static String ice_staticId()";
+ out << sb;
+ out << nl << "return ice_staticId;";
+ out << eb;
-void
-Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr&)
-{
- Output& out = output();
out << eb;
close();
+
+ string absolute = getAbsolute(p, "", "_", "PrxI");
+
+ open(absolute, p->file());
+
+ Output& outi = output();
+
+ outi << sp;
+ outi << nl << "public class _" << p->name() << "PrxI extends com.zeroc.Ice._ObjectPrxI implements " << p->name()
+ << "Prx";
+ outi << sb;
+ outi << eb;
+ close();
}
void
Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
{
- string name = fixKwd(p->name());
- ContainerPtr container = p->container();
- ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- string package = getPackage(cl);
+ const string name = fixKwd(p->name());
+ const ContainerPtr container = p->container();
+ const ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ const string package = getPackage(cl);
Output& out = output();
- TypePtr ret = p->returnType();
- string retS = typeToString(ret, TypeModeReturn, package, p->getMetaData(), true, p->returnIsOptional());
- vector<string> params = getParamsProxy(p, package, false, true);
+ const TypePtr ret = p->returnType();
+ const string retS = getResultType(p, package, false, false);
+ const bool returnsParams = ret || !p->outParameters().empty();
+ const vector<string> params = getParamsProxy(p, package, false);
+ const bool sendsOptionals = p->sendsOptionals();
+ vector<string> paramsOpt;
+ if(sendsOptionals)
+ {
+ paramsOpt = getParamsProxy(p, package, true);
+ }
+ const vector<string> args = getInArgs(p);
+
ExceptionList throws = p->throws();
throws.sort();
throws.unique();
- string deprecateReason = getDeprecateReason(p, cl, "operation");
- string contextDoc = "@param __ctx The Context map to send with the invocation.";
- string contextParam = "java.util.Map<String, String> __ctx";
- string lambdaResponseDoc = "@param __responseCb The lambda response callback.";
- string lambdaUserExDoc = "@param __userExceptionCb The lambda user exception callback.";
- string lambdaExDoc = "@param __exceptionCb The lambda exception callback.";
- string lambdaSentDoc = "@param __sentCb The lambda sent callback.";
+ //
+ // Arrange exceptions into most-derived to least-derived order. If we don't
+ // do this, a base exception handler can appear before a derived exception
+ // handler, causing compiler warnings and resulting in the base exception
+ // being marshaled instead of the derived exception.
+ //
+#if defined(__SUNPRO_CC)
+ throws.sort(Slice::derivedToBaseCompare);
+#else
+ throws.sort(Slice::DerivedToBaseCompare());
+#endif
- const bool optional = p->sendsOptionals();
+ const string deprecateReason = getDeprecateReason(p, cl, "operation");
+ const string contextDoc = "@param __ctx The Context map to send with the invocation.";
+ const string contextParam = "java.util.Map<String, String> __ctx";
+ const string noExplicitContextArg = "com.zeroc.Ice.ObjectPrx.noExplicitContext";
//
- // Write two synchronous versions of the operation - with and without a context parameter.
+ // Synchronous methods with required parameters.
//
out << sp;
writeDocComment(out, p, deprecateReason);
-
- out << nl << "public " << retS << ' ' << name << spar << params << epar;
+ out << nl << "default " << retS << ' ' << name << spar << params << epar;
writeThrowsClause(package, throws);
- out << ';';
+ out << sb;
+ out << nl;
+ if(returnsParams)
+ {
+ out << "return ";
+ }
+ out << name << spar << args << noExplicitContextArg << epar << ';';
+ out << eb;
out << sp;
writeDocComment(out, p, deprecateReason, contextDoc);
-
- out << nl << "public " << retS << ' ' << name << spar << params << contextParam << epar;
+ out << nl << "default " << retS << ' ' << name << spar << params << contextParam << epar;
writeThrowsClause(package, throws);
- out << ';';
-
- if(optional)
+ out << sb;
+ if(throws.empty())
{
- //
- // Write overloaded versions of the methods using required params.
- //
- vector<string> reqParams = getParamsProxy(p, package, false, false);
+ out << nl;
+ if(returnsParams)
+ {
+ out << "return ";
+ }
+ out << "__" << p->name() << "Async" << spar << args << "__ctx" << "true" << epar << ".__wait();";
+ }
+ else
+ {
+ out << nl << "try";
+ out << sb;
+ out << nl;
+ if(returnsParams)
+ {
+ out << "return ";
+ }
+ out << "__" << p->name() << "Async" << spar << args << "__ctx" << "true" << epar << ".__waitUserEx();";
+ out << eb;
+ for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t)
+ {
+ string exS = getAbsolute(*t, package);
+ out << nl << "catch(" << exS << " __ex)";
+ out << sb;
+ out << nl << "throw __ex;";
+ out << eb;
+ }
+ out << nl << "catch(com.zeroc.Ice.UserException __ex)";
+ out << sb;
+ out << nl << "throw new com.zeroc.Ice.UnknownUserException(__ex.ice_id(), __ex);";
+ out << eb;
+ }
+ out << eb;
+ //
+ // Synchronous methods using optional parameters (if any).
+ //
+ if(sendsOptionals)
+ {
out << sp;
writeDocComment(out, p, deprecateReason);
- out << nl << "public " << retS << ' ' << name << spar << reqParams << epar;
+ out << nl << "default " << retS << ' ' << name << spar << paramsOpt << epar;
writeThrowsClause(package, throws);
- out << ';';
+ out << sb;
+ out << nl;
+ if(returnsParams)
+ {
+ out << "return ";
+ }
+ out << name << spar << args << noExplicitContextArg << epar << ';';
+ out << eb;
out << sp;
writeDocComment(out, p, deprecateReason, contextDoc);
- out << nl << "public " << retS << ' ' << name << spar << reqParams << contextParam << epar;
+ out << nl << "default " << retS << ' ' << name << spar << paramsOpt << contextParam << epar;
writeThrowsClause(package, throws);
- out << ';';
+ out << sb;
+ if(throws.empty())
+ {
+ out << nl;
+ if(returnsParams)
+ {
+ out << "return ";
+ }
+ out << "__" << p->name() << "Async" << spar << args << "__ctx" << "true" << epar << ".__wait();";
+ }
+ else
+ {
+ out << nl << "try";
+ out << sb;
+ out << nl;
+ if(returnsParams)
+ {
+ out << "return ";
+ }
+ out << "__" << p->name() << "Async" << spar << args << "__ctx" << "true" << epar << ".__waitUserEx();";
+ out << eb;
+ for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t)
+ {
+ string exS = getAbsolute(*t, package);
+ out << nl << "catch(" << exS << " __ex)";
+ out << sb;
+ out << nl << "throw __ex;";
+ out << eb;
+ }
+ out << nl << "catch(com.zeroc.Ice.UserException __ex)";
+ out << sb;
+ out << nl << "throw new com.zeroc.Ice.UnknownUserException(__ex.ice_id(), __ex);";
+ out << eb;
+ }
+ out << eb;
}
- {
- //
- // Write the asynchronous begin/end methods.
- //
- // Start with the type-unsafe begin methods.
- //
- vector<string> inParams = getInOutParams(p, package, InParam, true, true);
- string callbackParam = "Ice.Callback __cb";
- string callbackDoc = "@param __cb The asynchronous callback object.";
-
- out << sp;
- writeDocCommentAMI(out, p, InParam);
- out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << epar << ';';
+ //
+ // Asynchronous methods with required parameters.
+ //
+ out << sp;
+ writeDocCommentAMI(out, p, InParam);
- out << sp;
- writeDocCommentAMI(out, p, InParam, contextDoc);
- out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << contextParam << epar << ';';
+ const string future = getFutureType(p, package);
- out << sp;
- writeDocCommentAMI(out, p, InParam, callbackDoc);
- out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << callbackParam << epar << ';';
+ out << nl << "default " << future << ' ' << p->name() << "Async" << spar << params << epar;
+ out << sb;
+ out << nl << "return __" << p->name() << "Async" << spar << args << noExplicitContextArg << "false" << epar << ';';
+ out << eb;
- out << sp;
- writeDocCommentAMI(out, p, InParam, contextDoc, callbackDoc);
- out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << contextParam << callbackParam
- << epar << ';';
+ out << sp;
+ writeDocCommentAMI(out, p, InParam, contextDoc);
- //
- // Type-safe begin methods.
- //
- string typeSafeCallbackParam;
+ out << nl << "default " << future << ' ' << p->name() << "Async" << spar << params << contextParam << epar;
+ out << sb;
+ out << nl << "return __" << p->name() << "Async" << spar << args << "__ctx" << "false" << epar << ';';
+ out << eb;
- //
- // Get the name of the callback using the name of the class in which this
- // operation was defined.
- //
- ContainerPtr container = p->container();
- ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- string opClassName = getAbsolute(cl, package, "Callback_", '_' + p->name());
- typeSafeCallbackParam = opClassName + " __cb";
+ const string futureImpl = getFutureImplType(p, package);
- out << sp;
- writeDocCommentAMI(out, p, InParam, callbackDoc);
- out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << typeSafeCallbackParam
- << epar << ';';
+ out << sp;
+ out << nl << "default " << futureImpl << " __" << p->name() << "Async" << spar << params << contextParam
+ << "boolean __sync" << epar;
+ out << sb;
+ out << nl << futureImpl << " __f = new com.zeroc.IceInternal.OutgoingAsync<>(this, \"" << p->name() << "\", "
+ << sliceModeToIceMode(p->sendMode()) << ", __sync, "
+ << (throws.empty() ? "null" : "__" + p->name() + "_ex") << ");";
- out << sp;
- writeDocCommentAMI(out, p, InParam, contextDoc, callbackDoc);
- out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << contextParam
- << typeSafeCallbackParam << epar << ';';
+ out << nl << "__f.invoke(";
+ out.useCurrentPosAsIndent();
+ out << (p->returnsData() ? "true" : "false") << ", __ctx, " << opFormatTypeToString(p)
+ << ", ";
+ if(!p->inParameters().empty())
+ {
+ out << "__os -> {";
+ out.inc();
+ writeMarshalProxyParams(out, package, p, false);
+ out.dec();
+ out << nl << '}';
+ }
+ else
+ {
+ out << "null";
+ }
+ out << ", ";
+ if(returnsParams)
+ {
+ out << "__is -> {";
+ out.inc();
+ writeUnmarshalProxyResults(out, package, p);
+ out.dec();
+ out << nl << "}";
+ }
+ else
+ {
+ out << "null";
+ }
+ out.restoreIndent();
+ out << ");";
+ out << nl << "return __f;";
+ out << eb;
- //
- // Generate the Callback Response interface if the operation has more than one
- // return parameter. Operations with just one return parameter use one of the
- // builtin async callback interfaces.
- //
+ if(!throws.empty())
+ {
+ out << sp << nl << "static final Class<?>[] __" << p->name() << "_ex =";
+ out << sb;
+ for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t)
{
- ParamDeclList outParams = getOutParams(p);
- if((ret && !outParams.empty()) || outParams.size() > 1)
+ if(t != throws.begin())
{
- vector<string> params = getParamsAsyncCB(p, package, false, true);
- out << sp;
- out << nl << "public interface " << getLambdaResponseCB(p, package);
- out << sb;
- out << nl << "void apply" << spar << params << epar << ';';
- out << eb;
+ out << ",";
}
+ out << nl << getAbsolute(*t, package) << ".class";
}
-
- //
- // Async methods that accept Java 8 lambda callbacks.
- //
- {
- out << sp;
- writeDocCommentAMI(out, p, InParam, lambdaResponseDoc, throws.empty() ? "" : lambdaUserExDoc, lambdaExDoc);
- out << nl << "public Ice.AsyncResult begin_" << p->name();
- writeParamList(out, getParamsAsyncLambda(p, package, false, false, true));
- out << ';';
-
- out << sp;
- writeDocCommentAMI(out, p, InParam, lambdaResponseDoc, throws.empty() ? "" : lambdaUserExDoc, lambdaExDoc,
- lambdaSentDoc);
- out << nl << "public Ice.AsyncResult begin_" << p->name();
- writeParamList(out, getParamsAsyncLambda(p, package, false, true, true));
- out << ';';
-
- out << sp;
- writeDocCommentAMI(out, p, InParam, contextDoc, lambdaResponseDoc, throws.empty() ? "" : lambdaUserExDoc,
- lambdaExDoc);
- out << nl << "public Ice.AsyncResult begin_" << p->name();
- writeParamList(out, getParamsAsyncLambda(p, package, true, false, true));
- out << ';';
-
- out << sp;
- writeDocCommentAMI(out, p, InParam, contextDoc, lambdaResponseDoc, throws.empty() ? "" : lambdaUserExDoc,
- lambdaExDoc, lambdaSentDoc);
- out << nl << "public Ice.AsyncResult begin_" << p->name();
- writeParamList(out, getParamsAsyncLambda(p, package, true, true, true));
- out << ';';
- }
-
- vector<string> outParams = getInOutParams(p, package, OutParam, true, true);
-
- out << sp;
- writeDocCommentAMI(out, p, OutParam);
- out << nl << "public " << retS << " end_" << p->name() << spar << outParams << "Ice.AsyncResult __result"
- << epar;
- writeThrowsClause(package, throws);
- out << ';';
+ out << eb << ';';
}
- if(optional)
+ if(sendsOptionals)
{
- //
- // Write overloaded versions of the methods using required params.
- //
- vector<string> inParams = getInOutParams(p, package, InParam, true, false);
- string callbackParam = "Ice.Callback __cb";
- string callbackDoc = "@param __cb The asynchronous callback object.";
-
out << sp;
writeDocCommentAMI(out, p, InParam);
- out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << epar << ';';
+
+ const string future = getFutureType(p, package);
+
+ out << nl << "default " << future << ' ' << p->name() << "Async" << spar << paramsOpt << epar;
+ out << sb;
+ out << nl << "return __" << p->name() << "Async" << spar << args << noExplicitContextArg << "false" << epar
+ << ';';
+ out << eb;
out << sp;
writeDocCommentAMI(out, p, InParam, contextDoc);
- out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << contextParam << epar << ';';
- out << sp;
- writeDocCommentAMI(out, p, InParam, callbackDoc);
- out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << callbackParam << epar << ';';
+ out << nl << "default " << future << ' ' << p->name() << "Async" << spar << paramsOpt << contextParam << epar;
+ out << sb;
+ out << nl << "return __" << p->name() << "Async" << spar << args << "__ctx" << "false" << epar << ';';
+ out << eb;
out << sp;
- writeDocCommentAMI(out, p, InParam, contextDoc, callbackDoc);
- out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << contextParam << callbackParam
- << epar << ';';
+ out << nl << "default " << futureImpl << " __" << p->name() << "Async" << spar << paramsOpt << contextParam
+ << "boolean __sync" << epar;
+ out << sb;
+ out << nl << futureImpl << " __f = new com.zeroc.IceInternal.OutgoingAsync<>(this, \"" << p->name() << "\", "
+ << sliceModeToIceMode(p->sendMode()) << ", __sync, "
+ << (throws.empty() ? "null" : "__" + p->name() + "_ex") << ");";
- //
- // Async methods that accept Java 8 lambda callbacks.
- //
+ out << nl << "__f.invoke(";
+ out.useCurrentPosAsIndent();
+ out << (p->returnsData() ? "true" : "false") << ", __ctx, " << opFormatTypeToString(p) << ", ";
+ if(!p->inParameters().empty())
{
- out << sp;
- writeDocCommentAMI(out, p, InParam, lambdaResponseDoc, throws.empty() ? "" : lambdaUserExDoc, lambdaExDoc);
- out << nl << "public Ice.AsyncResult begin_" << p->name();
- writeParamList(out, getParamsAsyncLambda(p, package));
- out << ';';
-
- out << sp;
- writeDocCommentAMI(out, p, InParam, lambdaResponseDoc, throws.empty() ? "" : lambdaUserExDoc, lambdaExDoc,
- lambdaSentDoc);
- out << nl << "public Ice.AsyncResult begin_" << p->name();
- writeParamList(out, getParamsAsyncLambda(p, package, false, true));
- out << ';';
-
- out << sp;
- writeDocCommentAMI(out, p, InParam, contextDoc, lambdaResponseDoc, throws.empty() ? "" : lambdaUserExDoc,
- lambdaExDoc);
- out << nl << "public Ice.AsyncResult begin_" << p->name();
- writeParamList(out, getParamsAsyncLambda(p, package, true));
- out << ';';
-
- out << sp;
- writeDocCommentAMI(out, p, InParam, contextDoc, lambdaResponseDoc, throws.empty() ? "" : lambdaUserExDoc,
- lambdaExDoc, lambdaSentDoc);
- out << nl << "public Ice.AsyncResult begin_" << p->name();
- writeParamList(out, getParamsAsyncLambda(p, package, true, true));
- out << ';';
+ out << "__os -> {";
+ out.inc();
+ writeMarshalProxyParams(out, package, p, true);
+ out.dec();
+ out << nl << '}';
}
-
- //
- // Type-safe begin methods.
- //
- string typeSafeCallbackParam;
-
- //
- // Get the name of the callback using the name of the class in which this
- // operation was defined.
- //
- ContainerPtr container = p->container();
- ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
- string opClassName = getAbsolute(cl, package, "Callback_", '_' + p->name());
- typeSafeCallbackParam = opClassName + " __cb";
-
- out << sp;
- writeDocCommentAMI(out, p, InParam, callbackDoc);
- out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << typeSafeCallbackParam
- << epar << ';';
-
- out << sp;
- writeDocCommentAMI(out, p, InParam, contextDoc, callbackDoc);
- out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << contextParam
- << typeSafeCallbackParam << epar << ';';
+ else
+ {
+ out << "null";
+ }
+ out << ", ";
+ if(returnsParams)
+ {
+ out << "__is -> {";
+ out.inc();
+ writeUnmarshalProxyResults(out, package, p);
+ out.dec();
+ out << nl << "}";
+ }
+ else
+ {
+ out << "null";
+ }
+ out.restoreIndent();
+ out << ");";
+ out << nl << "return __f;";
+ out << eb;
}
}
@@ -5970,14 +4806,14 @@ Slice::Gen::DispatcherVisitor::DispatcherVisitor(const string& dir) :
bool
Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- if(p->isLocal() || !p->isInterface())
+ if(p->isLocal() || p->isInterface() || p->allOperations().empty())
{
return false;
}
- string name = p->name();
- ClassList bases = p->bases();
- string absolute = getAbsolute(p, "", "_", "Disp");
+ const string name = p->name();
+ const string absolute = getAbsolute(p, "", "_", "Disp");
+ const string package = getPackage(p);
open(absolute, p->file());
@@ -5985,675 +4821,345 @@ Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sp;
writeDocComment(out, p, getDeprecateReason(p, 0, p->isInterface() ? "interface" : "class"));
- out << nl << "public abstract class _" << name << "Disp extends Ice.ObjectImpl implements " << fixKwd(name);
- out << sb;
+ out << nl << "public interface _" << name << "Disp";
- out << sp << nl << "protected void" << nl << "ice_copyStateFrom(Ice.Object __obj)";
- out.inc();
- out << nl << "throws java.lang.CloneNotSupportedException";
- out.dec();
+ //
+ // For dispatch purposes, we can ignore a base class if it has no operations.
+ //
+ ClassList bases = p->bases();
+ if(!bases.empty() && !bases.front()->isInterface() && bases.front()->allOperations().empty())
+ {
+ bases.pop_front();
+ }
+
+ if(bases.empty())
+ {
+ out << " extends com.zeroc.Ice.Object";
+ }
+ else
+ {
+ out << " extends ";
+ out.useCurrentPosAsIndent();
+ for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
+ {
+ if(q != bases.begin())
+ {
+ out << ',' << nl;
+ }
+ if(!(*q)->isInterface())
+ {
+ out << getAbsolute(*q, package, "_", "Disp");
+ }
+ else
+ {
+ out << getAbsolute(*q, package);
+ }
+ }
+ out.restoreIndent();
+ }
out << sb;
- out << nl << "throw new java.lang.CloneNotSupportedException();";
- out << eb;
- writeDispatchAndMarshalling(out, p);
+ writeDispatch(out, p);
- //
- // Avoid serialVersionUID warnings for dispatch classes.
- //
- out << sp << nl << "public static final long serialVersionUID = 0L;";
out << eb;
close();
return false;
}
-Slice::Gen::BaseImplVisitor::BaseImplVisitor(const string& dir) :
+Slice::Gen::ImplVisitor::ImplVisitor(const string& dir) :
JavaVisitor(dir)
{
}
-void
-Slice::Gen::BaseImplVisitor::writeDecl(Output& out, const string& package, const string& name, const TypePtr& type,
- const StringList& metaData, bool optional)
+bool
+Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
{
- string typeS = typeToString(type, TypeModeIn, package, metaData, true, optional);
- out << nl << typeS << ' ' << name;
+ if(!p->isAbstract())
+ {
+ return false;
+ }
- if(optional)
+ string name = p->name();
+ ClassList bases = p->bases();
+ string package = getPackage(p);
+ string absolute = getAbsolute(p, "", "", "I");
+
+ open(absolute, p->file());
+
+ Output& out = output();
+
+ out << sp << nl << "public final class " << name << 'I';
+ if(p->isInterface())
{
- out << " = new " << typeS << "();";
+ out << " implements " << fixKwd(name);
}
else
{
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if(builtin)
+ if(p->isLocal())
{
- switch(builtin->kind())
- {
- case Builtin::KindBool:
- {
- out << " = false";
- break;
- }
- case Builtin::KindByte:
- {
- out << " = (byte)0";
- break;
- }
- case Builtin::KindShort:
- {
- out << " = (short)0";
- break;
- }
- case Builtin::KindInt:
- case Builtin::KindLong:
- {
- out << " = 0";
- break;
- }
- case Builtin::KindFloat:
- {
- out << " = (float)0.0";
- break;
- }
- case Builtin::KindDouble:
- {
- out << " = 0.0";
- break;
- }
- case Builtin::KindString:
- {
- out << " = \"\"";
- break;
- }
- case Builtin::KindObject:
- case Builtin::KindObjectProxy:
- case Builtin::KindLocalObject:
- case Builtin::KindValue:
- {
- out << " = null";
- break;
- }
- }
+ out << " extends " << fixKwd(name);
}
else
{
- EnumPtr en = EnumPtr::dynamicCast(type);
- if(en)
- {
- EnumeratorList enumerators = en->getEnumerators();
- out << " = " << getAbsolute(en, package) << '.' << fixKwd(enumerators.front()->name());
- }
- else
- {
- out << " = null";
- }
+ out << " implements _" << name << "Disp";
}
+ }
+ out << sb;
- out << ';';
+ out << nl << "public " << name << "I()";
+ out << sb;
+ out << eb;
+
+ OperationList ops = p->allOperations();
+ for(OperationList::iterator r = ops.begin(); r != ops.end(); ++r)
+ {
+ writeOperation(out, package, *r, p->isLocal());
}
+
+ out << eb;
+ close();
+
+ return false;
}
-void
-Slice::Gen::BaseImplVisitor::writeReturn(Output& out, const TypePtr& type, bool optional)
+string
+Slice::Gen::ImplVisitor::getDefaultValue(const string& package, const TypePtr& type, bool optional)
{
+ const BuiltinPtr b = BuiltinPtr::dynamicCast(type);
if(optional)
{
- out << nl << "return null;";
+ if(b && b->kind() == Builtin::KindDouble)
+ {
+ return "java.util.OptionalDouble.empty()";
+ }
+ else if(b && b->kind() == Builtin::KindInt)
+ {
+ return "java.util.OptionalInt.empty()";
+ }
+ else if(b && b->kind() == Builtin::KindLong)
+ {
+ return "java.util.OptionalLong.empty()";
+ }
+ else
+ {
+ return "java.util.Optional.empty()";
+ }
}
else
{
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
- if(builtin)
+ if(b)
{
- switch(builtin->kind())
+ switch(b->kind())
{
case Builtin::KindBool:
{
- out << nl << "return false;";
+ return "false";
break;
}
case Builtin::KindByte:
{
- out << nl << "return (byte)0;";
+ return "(byte)0";
break;
}
case Builtin::KindShort:
{
- out << nl << "return (short)0;";
+ return "(short)0";
break;
}
case Builtin::KindInt:
case Builtin::KindLong:
{
- out << nl << "return 0;";
+ return "0";
break;
}
case Builtin::KindFloat:
{
- out << nl << "return (float)0.0;";
+ return "(float)0.0";
break;
}
case Builtin::KindDouble:
{
- out << nl << "return 0.0;";
+ return "0.0";
break;
}
case Builtin::KindString:
+ {
+ return "\"\"";
+ break;
+ }
case Builtin::KindObject:
case Builtin::KindObjectProxy:
case Builtin::KindLocalObject:
case Builtin::KindValue:
{
- out << nl << "return null;";
+ return "null";
break;
}
}
- return;
}
-
- out << nl << "return null;";
- }
-}
-
-void
-Slice::Gen::BaseImplVisitor::writeOperation(Output& out, const string& package, const OperationPtr& op, bool local)
-{
- string opName = op->name();
-
- const TypePtr ret = op->returnType();
- const bool optionalMapping = useOptionalMapping(op);
- const StringList opMetaData = op->getMetaData();
- const string retS = typeToString(ret, TypeModeReturn, package, opMetaData, true,
- optionalMapping && op->returnIsOptional());
- vector<string> params = getParams(op, package, false, optionalMapping);
-
- ContainerPtr container = op->container();
- ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
-
- if(!local && (cl->hasMetaData("amd") || op->hasMetaData("amd")))
- {
- vector<string> paramsAMD = getParamsAsync(op, package, true, true);
-
- out << sp << nl << "public void " << opName << "_async" << spar << paramsAMD << "Ice.Current __current"
- << epar;
-
- ExceptionList throws = op->throws();
- throws.sort();
- throws.unique();
-
- //
- // Arrange exceptions into most-derived to least-derived order. If we don't
- // do this, a base exception handler can appear before a derived exception
- // handler, causing compiler warnings and resulting in the base exception
- // being marshaled instead of the derived exception.
- //
-#if defined(__SUNPRO_CC)
- throws.sort(Slice::derivedToBaseCompare);
-#else
- throws.sort(Slice::DerivedToBaseCompare());
-#endif
- writeThrowsClause(package, throws);
-
- out << sb;
-
- string result = "__r";
- ParamDeclList paramList = op->parameters();
- for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
- {
- if((*q)->name() == result)
- {
- result = "_" + result;
- break;
- }
- }
- if(ret)
- {
- writeDecl(out, package, result, ret, opMetaData, optionalMapping && op->returnIsOptional());
- }
- for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
- {
- if((*q)->isOutParam())
- {
- writeDecl(out, package, fixKwd((*q)->name()), (*q)->type(), (*q)->getMetaData(),
- optionalMapping && (*q)->optional());
- }
- }
-
- out << nl << "__cb.ice_response(";
- if(ret)
- {
- out << result;
- }
- bool firstOutParam = true;
- for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
+ else
{
- if((*q)->isOutParam())
+ EnumPtr en = EnumPtr::dynamicCast(type);
+ if(en)
{
- if(ret || !firstOutParam)
- {
- out << ", ";
- }
- out << fixKwd((*q)->name());
- firstOutParam = false;
+ EnumeratorList enumerators = en->getEnumerators();
+ return getAbsolute(en, package) + '.' + fixKwd(enumerators.front()->name());
}
}
- out << ");";
-
- out << eb;
- }
- else
- {
- out << sp << nl << "public " << retS << nl << fixKwd(opName) << spar << params;
- if(!local)
- {
- out << "Ice.Current __current";
- }
- out << epar;
-
- ExceptionList throws = op->throws();
- throws.sort();
- throws.unique();
-
- if(op->hasMetaData("UserException"))
- {
- out.inc();
- out << nl << "throws Ice.UserException";
- out.dec();
- }
- else
- {
- writeThrowsClause(package, throws);
- }
-
- out << sb;
-
- //
- // Return value
- //
- if(ret)
- {
- writeReturn(out, ret, optionalMapping && op->returnIsOptional());
- }
-
- out << eb;
}
-}
-Slice::Gen::ImplVisitor::ImplVisitor(const string& dir) :
- BaseImplVisitor(dir)
-{
+ return "null";
}
bool
-Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
+Slice::Gen::ImplVisitor::initResult(Output& out, const string& package, const OperationPtr& op)
{
- if(!p->isAbstract())
- {
- return false;
- }
-
- string name = p->name();
- ClassList bases = p->bases();
- string package = getPackage(p);
- string absolute = getAbsolute(p, "", "", "I");
+ const string retS = getResultType(op, package, false, true);
- open(absolute, p->file());
-
- Output& out = output();
-
- out << sp << nl << "public final class " << name << 'I';
- if(p->isInterface())
+ if(op->hasMarshaledResult())
{
- if(p->isLocal())
+ out << nl << retS << " __r = new " << retS << spar;
+ const ParamDeclList outParams = op->outParameters();
+ if(op->returnType())
{
- out << " implements " << fixKwd(name);
+ out << getDefaultValue(package, op->returnType(), op->returnIsOptional());
}
- else
+ for(ParamDeclList::const_iterator p = outParams.begin(); p != outParams.end(); ++p)
{
- out << " extends _" << name << "Disp";
+ out << getDefaultValue(package, (*p)->type(), (*p)->optional());
}
+ out << "__current" << epar << ';';
}
- else
+ else if(op->returnsMultipleValues())
{
- out << " extends " << fixKwd(name);
- }
- out << sb;
-
- out << nl << "public" << nl << name << "I()";
- out << sb;
- out << eb;
-
- OperationList ops = p->allOperations();
- for(OperationList::iterator r = ops.begin(); r != ops.end(); ++r)
- {
- writeOperation(out, package, *r, p->isLocal());
- }
-
- out << eb;
- close();
-
- return false;
-}
-
-Slice::Gen::ImplTieVisitor::ImplTieVisitor(const string& dir) :
- BaseImplVisitor(dir)
-{
-}
-
-bool
-Slice::Gen::ImplTieVisitor::visitClassDefStart(const ClassDefPtr& p)
-{
- if(!p->isAbstract())
- {
- return false;
- }
-
- string name = p->name();
- ClassList bases = p->bases();
- string package = getPackage(p);
- string absolute = getAbsolute(p, "", "", "I");
-
- open(absolute, p->file());
-
- Output& out = output();
-
- //
- // Use implementation inheritance in the following situations:
- //
- // * if a class extends another class
- // * if a class implements a single interface
- // * if an interface extends only one interface
- //
- bool inheritImpl = (!p->isInterface() && !bases.empty() && !bases.front()->isInterface()) || (bases.size() == 1);
-
- out << sp << nl << "public class " << name << 'I';
- if(inheritImpl)
- {
- out << " extends ";
- if(bases.front()->isAbstract())
+ out << nl << retS << " __r = new " << retS << "();";
+ string retval = "returnValue";
+ const ParamDeclList outParams = op->outParameters();
+ for(ParamDeclList::const_iterator p = outParams.begin(); p != outParams.end(); ++p)
{
- out << bases.front()->name() << 'I';
+ out << nl << "__r." << fixKwd((*p)->name()) << " = "
+ << getDefaultValue(package, (*p)->type(), (*p)->optional()) << ';';
+ if((*p)->name() == "returnValue")
+ {
+ retval = "_returnValue";
+ }
}
- else
+ if(op->returnType())
{
- out << fixKwd(bases.front()->name());
+ out << nl << "__r." << retval << " = "
+ << getDefaultValue(package, op->returnType(), op->returnIsOptional()) << ';';
}
}
- out << " implements " << '_' << name << "Operations";
- if(p->isLocal())
- {
- out << "NC";
- }
- out << sb;
-
- out << nl << "public" << nl << name << "I()";
- out << sb;
- out << eb;
-
- OperationList ops = p->allOperations();
- ops.sort();
-
- OperationList baseOps;
- if(inheritImpl)
- {
- baseOps = bases.front()->allOperations();
- baseOps.sort();
- }
-
- for(OperationList::iterator r = ops.begin(); r != ops.end(); ++r)
+ else
{
- if(inheritImpl && binary_search(baseOps.begin(), baseOps.end(), *r))
+ TypePtr type = op->returnType();
+ bool optional = op->returnIsOptional();
+ if(!type)
{
- out << sp;
- out << nl << "/*";
- out << nl << " * Implemented by " << bases.front()->name() << 'I';
- out << nl << " *";
- writeOperation(out, package, *r, p->isLocal());
- out << sp;
- out << nl << "*/";
+ const ParamDeclList outParams = op->outParameters();
+ if(!outParams.empty())
+ {
+ assert(outParams.size() == 1);
+ type = outParams.front()->type();
+ optional = outParams.front()->optional();
+ }
+ }
+ if(type)
+ {
+ out << nl << retS << " __r = " << getDefaultValue(package, type, optional) << ';';
}
else
{
- writeOperation(out, package, *r, p->isLocal());
+ return false;
}
}
- out << eb;
- close();
-
- return false;
-}
-
-Slice::Gen::AsyncVisitor::AsyncVisitor(const string& dir) :
- JavaVisitor(dir)
-{
+ return true;
}
void
-Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
+Slice::Gen::ImplVisitor::writeOperation(Output& out, const string& package, const OperationPtr& op, bool local)
{
- ContainerPtr container = p->container();
- ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ string opName = op->name();
- if(cl->isLocal())
- {
- return;
- }
+ ExceptionList throws = op->throws();
+ throws.sort();
+ throws.unique();
- string name = p->name();
- string classPkg = getPackage(cl);
- StringList opMetaData = p->getMetaData();
+ const ContainerPtr container = op->container();
+ const ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ const vector<string> params = getParams(op, package);
- //
- // Generate new-style callback.
- //
+ if(local)
{
- TypePtr ret = p->returnType();
- ParamDeclList outParams;
- ParamDeclList paramList = p->parameters();
- for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
+ out << sp;
+ out << nl << "@Override";
+ out << nl << "public " << getResultType(op, package, false, false) << ' ' << fixKwd(opName) << spar << params
+ << epar;
+ if(op->hasMetaData("UserException"))
{
- if((*pli)->isOutParam())
- {
- outParams.push_back(*pli);
- }
+ out.inc();
+ out << nl << "throws com.zeroc.Ice.UserException";
+ out.dec();
}
-
- vector<string> params = getParamsAsyncCB(p, classPkg, false, true);
- vector<string> args = getInOutArgs(p, OutParam);
- ExceptionList throws = p->throws();
-
- //
- // If the operation has more than one return parameter we generate a Callback
- // interface to use in the method signatures.
- //
- if(p->returnsData() && ((ret && !outParams.empty()) || outParams.size() > 1))
+ else
{
- open(getAbsolute(cl, "", "_Callback_", "_" + name), p->file());
-
- Output& out = output();
-
- writeDocCommentOp(out, p);
- out << sp << nl << "public interface " << ("_Callback_" + cl->name()) << '_' << name
- << " extends " << (throws.empty() ? "Ice.TwowayCallback" : "Ice.TwowayCallbackUE");
- out << sb;
- out << nl << "public void response" << spar << params << epar << ';';
- out << eb;
-
- close();
+ writeThrowsClause(package, throws);
}
-
- string classNameAsync = "Callback_" + cl->name();
- string absoluteAsync = getAbsolute(cl, "", "Callback_", "_" + name);
-
- open(absoluteAsync, p->file());
-
- Output& out = output();
-
- writeDocCommentOp(out, p);
- out << sp << nl << "public abstract class " << classNameAsync << '_' << name;
-
- if(p->returnsData())
+ out << sb;
+ if(initResult(out, package, op))
{
- out.inc();
- out << nl << "extends " << getAsyncCallbackBaseClass(p, false);
- out.dec();
- out << sb;
-
- out << sp << nl << "public final void __completed(Ice.AsyncResult __result)";
- out << sb;
- out << nl << cl->name() << "PrxHelper.__" << p->name() << "_completed(this, __result);";
- out << eb;
-
- out << eb;
+ out << nl << "return __r;";
}
- else
+ out << eb;
+
+ if(cl->hasMetaData("async-oneway") || op->hasMetaData("async-oneway"))
{
- out << " extends Ice.OnewayCallback";
+ out << sp;
+ out << nl << "@Override";
+ out << nl << getFutureType(op, package) << ' ' << opName << "Async" << spar << params << epar;
out << sb;
+ out << nl << "return null;";
out << eb;
}
-
- close();
}
-
- if(cl->hasMetaData("amd") || p->hasMetaData("amd"))
+ else
{
- string classNameAMD = "AMD_" + cl->name();
- string absoluteAMD = getAbsolute(cl, "", "AMD_", "_" + name);
-
- string classNameAMDI = "_AMD_" + cl->name();
- string absoluteAMDI = getAbsolute(cl, "", "_AMD_", "_" + name);
-
- const bool optionalMapping = useOptionalMapping(p);
- vector<string> paramsAMD = getParamsAsyncCB(p, classPkg, true, optionalMapping);
+ const bool amd = cl->hasMetaData("amd") || op->hasMetaData("amd");
+ if(amd)
{
- open(absoluteAMD, p->file());
-
- Output& out = output();
-
- writeDocCommentOp(out, p);
- out << sp << nl << "public interface " << classNameAMD << '_' << name;
- out << " extends Ice.AMDCallback";
- out << sb;
+ const string retS = getResultType(op, package, true, true);
out << sp;
- writeDocCommentAsync(out, p, OutParam);
- out << nl << "void ice_response" << spar << paramsAMD << epar << ';';
-
- out << eb;
-
- close();
- }
-
- {
- open(absoluteAMDI, p->file());
-
- Output& out = output();
-
- TypePtr ret = p->returnType();
-
- ParamDeclList outParams;
- ParamDeclList paramList = p->parameters();
- for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
- {
- if((*pli)->isOutParam())
- {
- outParams.push_back(*pli);
- }
- }
-
- ExceptionList throws = p->throws();
- throws.sort();
- throws.unique();
-
- //
- // Arrange exceptions into most-derived to least-derived order. If we don't
- // do this, a base exception handler can appear before a derived exception
- // handler, causing compiler warnings and resulting in the base exception
- // being marshaled instead of the derived exception.
- //
-#if defined(__SUNPRO_CC)
- throws.sort(Slice::derivedToBaseCompare);
-#else
- throws.sort(Slice::DerivedToBaseCompare());
-#endif
-
- int iter;
-
- out << sp << nl << "final class " << classNameAMDI << '_' << name
- << " extends IceInternal.IncomingAsync implements " << classNameAMD << '_' << name;
- out << sb;
-
- out << sp << nl << "public " << classNameAMDI << '_' << name << "(IceInternal.Incoming in)";
- out << sb;
- out << nl << "super(in);";
- out << eb;
-
- out << sp << nl << "public void ice_response" << spar << paramsAMD << epar;
- out << sb;
- iter = 0;
- out << nl << "if(__validateResponse(true))";
+ out << nl << "@Override";
+ out << nl << "public java.util.concurrent.CompletionStage<" << retS << "> " << opName << "Async" << spar
+ << params << "com.zeroc.Ice.Current __current" << epar;
+ writeThrowsClause(package, throws);
out << sb;
- if(ret || !outParams.empty())
+ if(initResult(out, package, op))
{
- out << nl << "try";
- out << sb;
- out << nl << "Ice.OutputStream __os = this.__startWriteParams("
- << opFormatTypeToString(p) << ");";
- writeMarshalUnmarshalParams(out, classPkg, outParams, p, iter, true, optionalMapping, false);
- if(p->returnsClasses(false))
- {
- out << nl << "__os.writePendingValues();";
- }
- out << nl << "this.__endWriteParams(true);";
- out << eb;
- out << nl << "catch(Ice.LocalException __ex)";
- out << sb;
- out << nl << "__exception(__ex);";
- out << nl << "return;";
- out << eb;
+ out << nl << "return java.util.concurrent.CompletableFuture.completedFuture(__r);";
}
else
{
- out << nl << "__writeEmptyParams();";
+ out << nl << "return java.util.concurrent.CompletableFuture.completedFuture((Void)null);";
}
- out << nl << "__response();";
out << eb;
- out << eb;
-
- if(!throws.empty())
+ }
+ else
+ {
+ out << sp;
+ out << nl << "@Override";
+ out << nl << "public " << getResultType(op, package, false, true) << ' ' << fixKwd(opName) << spar << params
+ << "com.zeroc.Ice.Current __current" << epar;
+ writeThrowsClause(package, throws);
+ out << sb;
+ if(initResult(out, package, op))
{
- out << sp << nl << "public void ice_exception(java.lang.Exception ex)";
- out << sb;
- out << nl << "try";
- out << sb;
- out << nl << "throw ex;";
- out << eb;
- for(ExceptionList::const_iterator r = throws.begin(); r != throws.end(); ++r)
- {
- string exS = getAbsolute(*r, classPkg);
- out << nl << "catch(" << exS << " __ex)";
- out << sb;
- out << nl << "if(__validateResponse(false))";
- out << sb;
- out << nl << "__writeUserException(__ex, " << opFormatTypeToString(p) << ");";
- out << nl << "__response();";
- out << eb;
- out << eb;
- }
- out << nl << "catch(java.lang.Exception __ex)";
- out << sb;
- out << nl << "super.ice_exception(__ex);";
- out << eb;
- out << eb;
+ out << nl << "return __r;";
}
-
out << eb;
-
- close();
}
}
}
diff --git a/cpp/src/slice2java/Gen.h b/cpp/src/slice2java/Gen.h
index bbcd2cb8908..8aa2c46280d 100644
--- a/cpp/src/slice2java/Gen.h
+++ b/cpp/src/slice2java/Gen.h
@@ -29,38 +29,32 @@ protected:
enum ParamDir { InParam, OutParam };
-
- ParamDeclList getOutParams(const OperationPtr&);
-
+ std::string getResultType(const OperationPtr&, const std::string&, bool, bool);
+ void writeResultType(::IceUtilInternal::Output&, const OperationPtr&, const std::string&);
+ void writeMarshaledResultType(::IceUtilInternal::Output&, const OperationPtr&, const std::string&);
+
+ void allocatePatcher(::IceUtilInternal::Output&, const TypePtr&, const std::string&, const std::string&);
+ std::string getPatcher(const TypePtr&, const std::string&, const std::string&, bool);
+
+ std::string getFutureType(const OperationPtr&, const std::string&);
+ std::string getFutureImplType(const OperationPtr&, const std::string&);
+
//
// Compose the parameter lists for an operation.
//
- std::vector<std::string> getParams(const OperationPtr&, const std::string&, bool, bool);
- std::vector<std::string> getParamsProxy(const OperationPtr&, const std::string&, bool, bool);
- std::vector<std::string> getInOutParams(const OperationPtr&, const std::string&, ParamDir, bool, bool);
- std::vector<std::string> getParamsAsync(const OperationPtr&, const std::string&, bool, bool);
- std::vector<std::string> getParamsAsyncCB(const OperationPtr&, const std::string&, bool, bool);
-
- std::string getAsyncCallbackInterface(const OperationPtr&, const std::string&);
- std::string getAsyncCallbackBaseClass(const OperationPtr&, bool);
- std::string getLambdaResponseCB(const OperationPtr&, const std::string&);
- std::vector<std::string> getParamsAsyncLambda(const OperationPtr&, const std::string&,
- bool context = false, bool sentCB = false,
- bool optionalMapping = false,
- bool inParams = true);
- std::vector<std::string> getArgsAsyncLambda(const OperationPtr&, const std::string&,
- bool context = false, bool sentCB = false);
+ std::vector<std::string> getParams(const OperationPtr&, const std::string&);
+ std::vector<std::string> getParamsProxy(const OperationPtr&, const std::string&, bool);
//
// Compose the argument lists for an operation.
//
std::vector<std::string> getArgs(const OperationPtr&);
- std::vector<std::string> getInOutArgs(const OperationPtr&, ParamDir);
- std::vector<std::string> getArgsAsync(const OperationPtr&);
- std::vector<std::string> getArgsAsyncCB(const OperationPtr&);
+ std::vector<std::string> getInArgs(const OperationPtr&, bool = false);
- void writeMarshalUnmarshalParams(::IceUtilInternal::Output&, const std::string&, const ParamDeclList&,
- const OperationPtr&, int&, bool, bool, bool = false);
+ void writeMarshalProxyParams(::IceUtilInternal::Output&, const std::string&, const OperationPtr&, bool);
+ void writeUnmarshalProxyResults(::IceUtilInternal::Output&, const std::string&, const OperationPtr&);
+ void writeMarshalServantResults(::IceUtilInternal::Output&, const std::string&, const OperationPtr&,
+ const std::string&);
//
// Generate a throws clause containing only non-local exceptions.
@@ -77,21 +71,17 @@ protected:
// Marshal/unmarshal a data member.
//
void writeMarshalDataMember(::IceUtilInternal::Output&, const std::string&, const DataMemberPtr&, int&);
- void writeUnmarshalDataMember(::IceUtilInternal::Output&, const std::string&, const DataMemberPtr&, int&,
- bool, int&);
- void writeStreamMarshalDataMember(::IceUtilInternal::Output&, const std::string&, const DataMemberPtr&, int&);
- void writeStreamUnmarshalDataMember(::IceUtilInternal::Output&, const std::string&, const DataMemberPtr&, int&,
- bool, int&);
+ void writeUnmarshalDataMember(::IceUtilInternal::Output&, const std::string&, const DataMemberPtr&, int&);
//
- // Generate a patcher class.
+ // Generate dispatch methods for a class or interface.
//
- void writePatcher(::IceUtilInternal::Output&, const std::string&, const DataMemberList&, const DataMemberList&);
+ void writeDispatch(::IceUtilInternal::Output&, const ClassDefPtr&);
//
- // Generate dispatch and marshalling methods for a class or interface.
+ // Generate marshaling methods for a class or interface.
//
- void writeDispatchAndMarshalling(::IceUtilInternal::Output&, const ClassDefPtr&);
+ void writeMarshaling(::IceUtilInternal::Output&, const ClassDefPtr&);
//
// Write a constant or default value initializer.
@@ -108,17 +98,15 @@ protected:
// Write doc comments.
//
static StringList splitComment(const ContainedPtr&);
- static void writeDocComment(::IceUtilInternal::Output&, const ContainedPtr&,
- const std::string&, const std::string& = "");
- static void writeDocComment(::IceUtilInternal::Output&, const std::string&, const std::string&);
- static void writeDocCommentOp(::IceUtilInternal::Output&, const OperationPtr&);
-
- static void writeDocCommentAsync(::IceUtilInternal::Output&, const OperationPtr&,
- ParamDir, const std::string& = "");
- static void writeDocCommentAMI(::IceUtilInternal::Output&, const OperationPtr&, ParamDir, const std::string& = "",
- const std::string& = "", const std::string& = "", const std::string& = "",
- const std::string& = "");
- static void writeDocCommentParam(::IceUtilInternal::Output&, const OperationPtr&, ParamDir, bool = true);
+ void writeDocComment(::IceUtilInternal::Output&, const ContainedPtr&, const std::string&, const std::string& = "");
+ void writeDocComment(::IceUtilInternal::Output&, const std::string&, const std::string&);
+ void writeDocCommentOp(::IceUtilInternal::Output&, const OperationPtr&);
+
+ void writeDocCommentAsync(::IceUtilInternal::Output&, const OperationPtr&, ParamDir, const std::string& = "");
+ void writeDocCommentAMI(::IceUtilInternal::Output&, const OperationPtr&, ParamDir, const std::string& = "",
+ const std::string& = "", const std::string& = "", const std::string& = "",
+ const std::string& = "");
+ void writeDocCommentParam(::IceUtilInternal::Output&, const OperationPtr&, ParamDir, bool = true);
};
class Gen : private ::IceUtil::noncopyable
@@ -132,9 +120,7 @@ public:
~Gen();
void generate(const UnitPtr&);
- void generateTie(const UnitPtr&);
void generateImpl(const UnitPtr&);
- void generateImplTie(const UnitPtr&);
static void writeChecksumClass(const std::string&, const std::string&, const ChecksumMap&);
@@ -144,27 +130,6 @@ private:
std::vector<std::string> _includePaths;
std::string _dir;
- class OpsVisitor : public JavaVisitor
- {
- public:
-
- OpsVisitor(const std::string&);
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
-
- private:
- void writeOperations(const ClassDefPtr&, bool);
- };
-
- class TieVisitor : public JavaVisitor
- {
- public:
-
- TieVisitor(const std::string&);
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
- };
-
class PackageVisitor : public JavaVisitor
{
public:
@@ -182,6 +147,7 @@ private:
virtual bool visitClassDefStart(const ClassDefPtr&);
virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual void visitOperation(const OperationPtr&);
virtual bool visitExceptionStart(const ExceptionPtr&);
virtual void visitExceptionEnd(const ExceptionPtr&);
virtual bool visitStructStart(const StructPtr&);
@@ -207,36 +173,14 @@ private:
virtual bool visitClassDefStart(const ClassDefPtr&);
};
- class HolderVisitor : public JavaVisitor
- {
- public:
-
- HolderVisitor(const std::string&);
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual bool visitStructStart(const StructPtr&);
- virtual void visitSequence(const SequencePtr&);
- virtual void visitDictionary(const DictionaryPtr&);
- virtual void visitEnum(const EnumPtr&);
-
- private:
-
- void writeHolder(const TypePtr&);
- };
-
class HelperVisitor : public JavaVisitor
{
public:
HelperVisitor(const std::string&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
virtual void visitSequence(const SequencePtr&);
virtual void visitDictionary(const DictionaryPtr&);
-
- private:
-
- void writeOperation(const ClassDefPtr&, const std::string&, const OperationPtr&, bool);
};
class ProxyVisitor : public JavaVisitor
@@ -259,58 +203,31 @@ private:
virtual bool visitClassDefStart(const ClassDefPtr&);
};
- class BaseImplVisitor : public JavaVisitor
+ class ImplVisitor : public JavaVisitor
{
public:
- BaseImplVisitor(const std::string&);
+ ImplVisitor(const std::string&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
protected:
//
- // Generate code to emit a local variable declaration and initialize it
- // if necessary.
+ // Returns a default value for the type.
//
- void writeDecl(::IceUtilInternal::Output&, const std::string&, const std::string&, const TypePtr&,
- const StringList&, bool);
+ std::string getDefaultValue(const std::string&, const TypePtr&, bool);
//
- // Generate code to return a value.
+ // Generate code to initialize the operation result.
//
- void writeReturn(::IceUtilInternal::Output&, const TypePtr&, bool);
+ bool initResult(::IceUtilInternal::Output&, const std::string&, const OperationPtr&);
//
// Generate an operation.
//
void writeOperation(::IceUtilInternal::Output&, const std::string&, const OperationPtr&, bool);
};
-
- class ImplVisitor : public BaseImplVisitor
- {
- public:
-
- ImplVisitor(const std::string&);
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
- };
-
- class ImplTieVisitor : public BaseImplVisitor
- {
- public:
-
- ImplTieVisitor(const std::string&);
-
- virtual bool visitClassDefStart(const ClassDefPtr&);
- };
-
- class AsyncVisitor : public JavaVisitor
- {
- public:
-
- AsyncVisitor(const std::string&);
-
- virtual void visitOperation(const OperationPtr&);
- };
};
}
diff --git a/cpp/src/slice2java/GenCompat.cpp b/cpp/src/slice2java/GenCompat.cpp
new file mode 100644
index 00000000000..dc7c4b29a3a
--- /dev/null
+++ b/cpp/src/slice2java/GenCompat.cpp
@@ -0,0 +1,6664 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include <GenCompat.h>
+#include <Slice/Checksum.h>
+#include <Slice/Util.h>
+#include <IceUtil/Functional.h>
+#include <IceUtil/Iterator.h>
+#include <IceUtil/StringUtil.h>
+#include <IceUtil/InputUtil.h>
+#include <IceUtil/StringConverter.h>
+#include <cstring>
+
+#include <limits>
+
+using namespace std;
+using namespace Slice;
+using namespace IceUtil;
+using namespace IceUtilInternal;
+
+namespace
+{
+
+string
+u16CodePoint(unsigned short value)
+{
+ ostringstream s;
+ s << "\\u";
+ s << hex;
+ s.width(4);
+ s.fill('0');
+ s << value;
+ return s.str();
+}
+
+void
+writeU8Buffer(const vector<unsigned char>& u8buffer, ::IceUtilInternal::Output& out)
+{
+ vector<unsigned short> u16buffer = toUTF16(u8buffer);
+
+ for(vector<unsigned short>::const_iterator c = u16buffer.begin(); c != u16buffer.end(); ++c)
+ {
+ out << u16CodePoint(*c);
+ }
+}
+
+string
+sliceModeToIceMode(Operation::Mode opMode)
+{
+ string mode;
+ switch(opMode)
+ {
+ case Operation::Normal:
+ {
+ mode = "Ice.OperationMode.Normal";
+ break;
+ }
+ case Operation::Nonmutating:
+ {
+ mode = "Ice.OperationMode.Nonmutating";
+ break;
+ }
+ case Operation::Idempotent:
+ {
+ mode = "Ice.OperationMode.Idempotent";
+ break;
+ }
+ default:
+ {
+ assert(false);
+ break;
+ }
+ }
+ return mode;
+}
+
+string
+opFormatTypeToString(const OperationPtr& op)
+{
+ switch(op->format())
+ {
+ case DefaultFormat:
+ return "Ice.FormatType.DefaultFormat";
+ case CompactFormat:
+ return "Ice.FormatType.CompactFormat";
+ case SlicedFormat:
+ return "Ice.FormatType.SlicedFormat";
+ default:
+ assert(false);
+ }
+
+ return "???";
+}
+
+string
+getDeprecateReason(const ContainedPtr& p1, const ContainedPtr& p2, const string& type)
+{
+ string deprecateMetadata, deprecateReason;
+ if(p1->findMetaData("deprecate", deprecateMetadata) ||
+ (p2 != 0 && p2->findMetaData("deprecate", deprecateMetadata)))
+ {
+ deprecateReason = "This " + type + " has been deprecated.";
+ if(deprecateMetadata.find("deprecate:") == 0 && deprecateMetadata.size() > 10)
+ {
+ deprecateReason = deprecateMetadata.substr(10);
+ }
+ }
+ return deprecateReason;
+}
+
+string
+initValue(const TypePtr& p)
+{
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(p);
+ if(builtin)
+ {
+ switch(builtin->kind())
+ {
+ case Builtin::KindBool:
+ {
+ return "false";
+ }
+ case Builtin::KindByte:
+ {
+ return "(byte)0";
+ }
+ case Builtin::KindShort:
+ {
+ return "(short)0";
+ }
+ case Builtin::KindInt:
+ case Builtin::KindLong:
+ {
+ return "0";
+ }
+ case Builtin::KindFloat:
+ {
+ return "(float)0.0";
+ }
+ case Builtin::KindDouble:
+ {
+ return "0.0";
+ }
+ case Builtin::KindString:
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ case Builtin::KindLocalObject:
+ case Builtin::KindValue:
+ {
+ return "null";
+ }
+ }
+ }
+ return "null";
+}
+
+void
+writeParamList(Output& out, vector<string> params, bool end = true, bool newLine = true)
+{
+ out << "(";
+ out.useCurrentPosAsIndent();
+ for(vector<string>::const_iterator i = params.begin(); i != params.end();)
+ {
+ out << (*i);
+ if(++i != params.end() || !end)
+ {
+ out << ", ";
+ if(newLine)
+ {
+ out << nl;
+ }
+ }
+ }
+ if(end)
+ {
+ out << ")";
+ out.restoreIndent();
+ }
+}
+
+}
+
+Slice::JavaCompatVisitor::JavaCompatVisitor(const string& dir) :
+ JavaCompatGenerator(dir)
+{
+}
+
+Slice::JavaCompatVisitor::~JavaCompatVisitor()
+{
+}
+
+ParamDeclList
+Slice::JavaCompatVisitor::getOutParams(const OperationPtr& op)
+{
+ ParamDeclList outParams;
+ ParamDeclList paramList = op->parameters();
+ for(ParamDeclList::const_iterator i = paramList.begin(); i != paramList.end(); ++i)
+ {
+ if((*i)->isOutParam())
+ {
+ outParams.push_back(*i);
+ }
+ }
+ return outParams;
+}
+
+vector<string>
+Slice::JavaCompatVisitor::getParams(const OperationPtr& op, const string& package, bool local, bool optionalMapping)
+{
+ vector<string> params;
+
+ ParamDeclList paramList = op->parameters();
+ for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
+ {
+ StringList metaData = (*q)->getMetaData();
+ bool optional = (*q)->optional();
+ if(optional && (local || (*q)->isOutParam()))
+ {
+ optional = optionalMapping;
+ }
+ string typeString = typeToString((*q)->type(), (*q)->isOutParam() ? TypeModeOut : TypeModeIn, package,
+ metaData, true, optional);
+ params.push_back(typeString + ' ' + fixKwd((*q)->name()));
+ }
+
+ return params;
+}
+
+vector<string>
+Slice::JavaCompatVisitor::getParamsProxy(const OperationPtr& op, const string& package, bool final, bool optionalMapping)
+{
+ vector<string> params;
+
+ ParamDeclList paramList = op->parameters();
+ for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
+ {
+ bool optional;
+ if((*q)->optional())
+ {
+ optional = (*q)->isOutParam() ? true : optionalMapping;
+ }
+ else
+ {
+ optional = false;
+ }
+
+ StringList metaData = (*q)->getMetaData();
+ string typeString = typeToString((*q)->type(), (*q)->isOutParam() ? TypeModeOut : TypeModeIn, package,
+ metaData, true, optional);
+ if(final)
+ {
+ typeString = "final " + typeString;
+ }
+ params.push_back(typeString + ' ' + fixKwd((*q)->name()));
+ }
+
+ return params;
+}
+
+vector<string>
+Slice::JavaCompatVisitor::getInOutParams(const OperationPtr& op, const string& package, ParamDir paramType, bool /*proxy*/,
+ bool optionalMapping)
+{
+ vector<string> params;
+
+ ParamDeclList paramList = op->parameters();
+ for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
+ {
+ if((*q)->isOutParam() == (paramType == OutParam))
+ {
+ bool optional = optionalMapping && (*q)->optional();
+ string typeString = typeToString((*q)->type(), paramType == InParam ? TypeModeIn : TypeModeOut, package,
+ (*q)->getMetaData(), true, optional);
+ params.push_back(typeString + ' ' + fixKwd((*q)->name()));
+ }
+ }
+
+ return params;
+}
+
+vector<string>
+Slice::JavaCompatVisitor::getParamsAsync(const OperationPtr& op, const string& package, bool amd, bool optionalMapping)
+{
+ vector<string> params = getInOutParams(op, package, InParam, !amd, optionalMapping);
+
+ string name = op->name();
+ ContainerPtr container = op->container();
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ string classNameAsync = getAbsolute(cl, package, amd ? "AMD_" : "AMI_", '_' + name);
+ params.insert(params.begin(), classNameAsync + " __cb");
+
+ return params;
+}
+
+vector<string>
+Slice::JavaCompatVisitor::getParamsAsyncCB(const OperationPtr& op, const string& package, bool /*amd*/, bool optionalMapping)
+{
+ vector<string> params;
+
+ TypePtr ret = op->returnType();
+ if(ret)
+ {
+ string retS = typeToString(ret, TypeModeIn, package, op->getMetaData(), true,
+ optionalMapping && op->returnIsOptional());
+ params.push_back(retS + " __ret");
+ }
+
+ ParamDeclList paramList = op->parameters();
+ for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
+ {
+ if((*q)->isOutParam())
+ {
+ string typeString = typeToString((*q)->type(), TypeModeIn, package, (*q)->getMetaData(), true,
+ optionalMapping && (*q)->optional());
+ params.push_back(typeString + ' ' + fixKwd((*q)->name()));
+ }
+ }
+
+ return params;
+}
+
+namespace
+{
+
+const char* builtinAsyncCallbackTable[] =
+{
+ "TwowayCallbackByte",
+ "TwowayCallbackBool",
+ "TwowayCallbackShort",
+ "TwowayCallbackInt",
+ "TwowayCallbackLong",
+ "TwowayCallbackFloat",
+ "TwowayCallbackDouble"
+};
+
+}
+
+string
+Slice::JavaCompatVisitor::getAsyncCallbackInterface(const OperationPtr& op, const string& package)
+{
+ TypePtr ret = op->returnType();
+ ParamDeclList outParams = getOutParams(op);
+ bool throws = !op->throws().empty();
+ const string suffix = throws ? "UE" : "";
+
+ if(!ret && outParams.empty())
+ {
+ return throws ? "Ice.TwowayCallbackVoidUE" : "Ice.OnewayCallback";
+ }
+ else if((ret && outParams.empty()) || (!ret && outParams.size() == 1))
+ {
+ TypePtr t = ret ? ret : outParams.front()->type();
+ bool optional = ret ? op->returnIsOptional() : outParams.front()->optional();
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(t);
+ if(builtin && !optional)
+ {
+ const string prefix = "Ice.";
+ switch(builtin->kind())
+ {
+ case Builtin::KindByte:
+ case Builtin::KindBool:
+ case Builtin::KindShort:
+ case Builtin::KindInt:
+ case Builtin::KindLong:
+ case Builtin::KindFloat:
+ case Builtin::KindDouble:
+ {
+ return prefix + builtinAsyncCallbackTable[builtin->kind()] + suffix;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+
+ return "Ice.TwowayCallbackArg1" + suffix + "<" +
+ typeToString(t, TypeModeIn, package, op->getMetaData(), true, optional) + ">";
+ }
+ else
+ {
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
+ return "_Callback_" + cl->name() + "_" + op->name();
+ }
+}
+
+string
+Slice::JavaCompatVisitor::getAsyncCallbackBaseClass(const OperationPtr& op, bool functional)
+{
+ assert(op->returnsData());
+ TypePtr ret = op->returnType();
+ ParamDeclList outParams = getOutParams(op);
+
+ bool throws = !op->throws().empty();
+ const string suffix = throws ? "UE" : "";
+ if(!ret && outParams.empty())
+ {
+ assert(throws);
+ return functional ?
+ "IceInternal.Functional_TwowayCallbackVoidUE" :
+ "IceInternal.TwowayCallback implements Ice.TwowayCallbackVoidUE";
+ }
+ else if((ret && outParams.empty()) || (!ret && outParams.size() == 1))
+ {
+ TypePtr t = ret ? ret : outParams.front()->type();
+ bool optional = ret ? op->returnIsOptional() : outParams.front()->optional();
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(t);
+ if(builtin && !optional)
+ {
+ switch(builtin->kind())
+ {
+ case Builtin::KindByte:
+ case Builtin::KindBool:
+ case Builtin::KindShort:
+ case Builtin::KindInt:
+ case Builtin::KindLong:
+ case Builtin::KindFloat:
+ case Builtin::KindDouble:
+ {
+ ostringstream os;
+ os << (functional ? "IceInternal.Functional_" : "IceInternal.TwowayCallback implements Ice.")
+ << builtinAsyncCallbackTable[builtin->kind()] + suffix;
+ return os.str();
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+
+ ostringstream os;
+ if(functional)
+ {
+ os << "IceInternal.Functional_TwowayCallbackArg1";
+ }
+ else
+ {
+ os << "IceInternal.TwowayCallback implements Ice.TwowayCallbackArg1";
+ }
+ os << suffix << "<" << typeToString(t, TypeModeIn, getPackage(op), op->getMetaData(), true, optional) + ">";
+ return os.str();
+ }
+ else
+ {
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
+ ostringstream os;
+ if(functional)
+ {
+ os << "IceInternal.Functional_TwowayCallback" << suffix << " implements ";
+ }
+ else
+ {
+ os << "IceInternal.TwowayCallback implements ";
+ }
+ os << "_Callback_" << cl->name() << "_" << op->name();
+ return os.str();
+ }
+}
+
+string
+Slice::JavaCompatVisitor::getLambdaResponseCB(const OperationPtr& op, const string& package)
+{
+ TypePtr ret = op->returnType();
+ ParamDeclList outParams = getOutParams(op);
+ if(!ret && outParams.empty())
+ {
+ return "IceInternal.Functional_VoidCallback";
+ }
+ else if((ret && outParams.empty()) || (!ret && outParams.size() == 1))
+ {
+ TypePtr t = ret ? ret : outParams.front()->type();
+ bool optional = ret ? op->returnIsOptional() : outParams.front()->optional();
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(t);
+ if(builtin && !optional)
+ {
+ static const char* builtinTable[] =
+ {
+ "IceInternal.Functional_ByteCallback",
+ "IceInternal.Functional_BoolCallback",
+ "IceInternal.Functional_ShortCallback",
+ "IceInternal.Functional_IntCallback",
+ "IceInternal.Functional_LongCallback",
+ "IceInternal.Functional_FloatCallback",
+ "IceInternal.Functional_DoubleCallback"
+ };
+ switch(builtin->kind())
+ {
+ case Builtin::KindByte:
+ case Builtin::KindBool:
+ case Builtin::KindShort:
+ case Builtin::KindInt:
+ case Builtin::KindLong:
+ case Builtin::KindFloat:
+ case Builtin::KindDouble:
+ {
+ return builtinTable[builtin->kind()];
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+
+ return "IceInternal.Functional_GenericCallback1<" +
+ typeToString(t, TypeModeIn, package, op->getMetaData(), true, optional) + ">";
+ }
+ else
+ {
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
+ return "FunctionalCallback_" + cl->name() + "_" + op->name() + "_Response";
+ }
+}
+
+vector<string>
+Slice::JavaCompatVisitor::getParamsAsyncLambda(const OperationPtr& op, const string& package, bool context, bool sentCB,
+ bool optionalMapping, bool inParams)
+{
+ vector<string> params;
+
+ if(inParams)
+ {
+ params = getInOutParams(op, package, InParam, false, optionalMapping);
+ }
+
+ if(context)
+ {
+ params.push_back("java.util.Map<String, String> __ctx");
+ }
+
+ params.push_back(getLambdaResponseCB(op, package) + " __responseCb");
+
+ if(!op->throws().empty())
+ {
+ params.push_back("IceInternal.Functional_GenericCallback1<Ice.UserException> __userExceptionCb");
+ }
+
+ params.push_back("IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb");
+
+ if(sentCB)
+ {
+ params.push_back("IceInternal.Functional_BoolCallback __sentCb");
+ }
+
+ return params;
+}
+
+vector<string>
+Slice::JavaCompatVisitor::getArgsAsyncLambda(const OperationPtr& op, const string& package, bool context, bool sentCB)
+{
+ vector<string> args = getInOutArgs(op, InParam);
+ args.push_back(context ? "__ctx" : "null");
+ args.push_back(context ? "true" : "false");
+ args.push_back("false"); // __synchronous
+ args.push_back("__responseCb");
+ if(!op->throws().empty())
+ {
+ args.push_back("__userExceptionCb");
+ }
+ args.push_back("__exceptionCb");
+ args.push_back(sentCB ? "__sentCb" : "null");
+ return args;
+}
+
+vector<string>
+Slice::JavaCompatVisitor::getArgs(const OperationPtr& op)
+{
+ vector<string> args;
+
+ ParamDeclList paramList = op->parameters();
+ for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
+ {
+ args.push_back(fixKwd((*q)->name()));
+ }
+
+ return args;
+}
+
+vector<string>
+Slice::JavaCompatVisitor::getInOutArgs(const OperationPtr& op, ParamDir paramType)
+{
+ vector<string> args;
+
+ ParamDeclList paramList = op->parameters();
+ for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
+ {
+ if((*q)->isOutParam() == (paramType == OutParam))
+ {
+ args.push_back(fixKwd((*q)->name()));
+ }
+ }
+
+ return args;
+}
+
+vector<string>
+Slice::JavaCompatVisitor::getArgsAsync(const OperationPtr& op)
+{
+ vector<string> args = getInOutArgs(op, InParam);
+ args.insert(args.begin(), "__cb");
+ return args;
+}
+
+vector<string>
+Slice::JavaCompatVisitor::getArgsAsyncCB(const OperationPtr& op)
+{
+ vector<string> args;
+
+ TypePtr ret = op->returnType();
+ if(ret)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
+ {
+ args.push_back("__ret.value");
+ }
+ else
+ {
+ args.push_back("__ret");
+ }
+ }
+
+ ParamDeclList paramList = op->parameters();
+ for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
+ {
+ if((*q)->isOutParam())
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast((*q)->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*q)->type()))
+ {
+ args.push_back(fixKwd((*q)->name()) + ".value");
+ }
+ else
+ {
+ args.push_back(fixKwd((*q)->name()));
+ }
+ }
+ }
+
+ return args;
+}
+
+void
+Slice::JavaCompatVisitor::writeMarshalUnmarshalParams(Output& out, const string& package, const ParamDeclList& params,
+ const OperationPtr& op, int& iter, bool marshal, bool optionalMapping,
+ bool dispatch)
+{
+ ParamDeclList optionals;
+ for(ParamDeclList::const_iterator pli = params.begin(); pli != params.end(); ++pli)
+ {
+ if((*pli)->optional())
+ {
+ optionals.push_back(*pli);
+ }
+ else
+ {
+ string paramName = fixKwd((*pli)->name());
+ bool holder = marshal == dispatch;
+ string patchParams;
+ if(!marshal)
+ {
+ patchParams = paramName;
+ }
+ writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalNone, false, 0, paramName, marshal,
+ iter, holder, (*pli)->getMetaData(), patchParams);
+ }
+ }
+
+ TypePtr ret;
+ bool returnsObject = false;
+
+ if(op && op->returnType())
+ {
+ ret = op->returnType();
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
+ ClassDeclPtr cl = ClassDeclPtr::dynamicCast(ret);
+ returnsObject = (builtin && builtin->kind() == Builtin::KindObject) || cl;
+ const bool optional = optionalMapping && op->returnIsOptional();
+
+ string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData(), true, optional);
+ bool holder = false;
+
+ if(!marshal)
+ {
+ if(optional)
+ {
+ out << nl << retS << " __ret = new " << retS << "();";
+ }
+ else if(returnsObject)
+ {
+ out << nl << retS << "Holder __ret = new " << retS << "Holder();";
+ holder = true;
+ }
+ else if(StructPtr::dynamicCast(ret))
+ {
+ out << nl << retS << " __ret = null;";
+ }
+ else
+ {
+ out << nl << retS << " __ret;";
+ }
+ }
+
+ if(!op->returnIsOptional())
+ {
+ writeMarshalUnmarshalCode(out, package, ret, OptionalNone, false, 0, "__ret", marshal, iter, holder,
+ op->getMetaData());
+ }
+ }
+
+ //
+ // Sort optional parameters by tag.
+ //
+ class SortFn
+ {
+ public:
+ static bool compare(const ParamDeclPtr& lhs, const ParamDeclPtr& rhs)
+ {
+ return lhs->tag() < rhs->tag();
+ }
+ };
+ optionals.sort(SortFn::compare);
+
+ //
+ // Handle optional parameters.
+ //
+ bool checkReturnType = op && op->returnIsOptional();
+
+ for(ParamDeclList::const_iterator pli = optionals.begin(); pli != optionals.end(); ++pli)
+ {
+ if(checkReturnType && op->returnTag() < (*pli)->tag())
+ {
+ writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, optionalMapping, op->returnTag(),
+ "__ret", marshal, iter, false, op->getMetaData());
+ checkReturnType = false;
+ }
+
+ const bool holder = dispatch && (*pli)->isOutParam() && !optionalMapping;
+
+ writeMarshalUnmarshalCode(out, package, (*pli)->type(),
+ (*pli)->isOutParam() ? OptionalOutParam : OptionalInParam, optionalMapping,
+ (*pli)->tag(), fixKwd((*pli)->name()), marshal, iter, holder, (*pli)->getMetaData());
+ }
+
+ if(checkReturnType)
+ {
+ writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, optionalMapping, op->returnTag(), "__ret",
+ marshal, iter, false, op->getMetaData());
+ }
+}
+
+void
+Slice::JavaCompatVisitor::writeThrowsClause(const string& package, const ExceptionList& throws)
+{
+ Output& out = output();
+ if(throws.size() > 0)
+ {
+ out.inc();
+ out << nl << "throws ";
+ out.useCurrentPosAsIndent();
+ int count = 0;
+ for(ExceptionList::const_iterator r = throws.begin(); r != throws.end(); ++r)
+ {
+ if(count > 0)
+ {
+ out << "," << nl;
+ }
+ out << getAbsolute(*r, package);
+ count++;
+ }
+ out.restoreIndent();
+ out.dec();
+ }
+}
+
+void
+Slice::JavaCompatVisitor::writeMarshalDataMember(Output& out, const string& package, const DataMemberPtr& member, int& iter)
+{
+ if(!member->optional())
+ {
+ writeMarshalUnmarshalCode(out, package, member->type(), OptionalNone, false, 0, fixKwd(member->name()),
+ true, iter, false, member->getMetaData());
+ }
+ else
+ {
+ out << nl << "if(__has_" << member->name() << " && __os.writeOptional(" << member->tag() << ", "
+ << getOptionalFormat(member->type()) << "))";
+ out << sb;
+ writeMarshalUnmarshalCode(out, package, member->type(), OptionalMember, false, 0, fixKwd(member->name()), true,
+ iter, false, member->getMetaData());
+ out << eb;
+ }
+}
+
+void
+Slice::JavaCompatVisitor::writeUnmarshalDataMember(Output& out, const string& package, const DataMemberPtr& member,
+ int& iter, bool needPatcher, int& patchIter)
+{
+ string patchParams;
+ if(needPatcher)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(member->type());
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(member->type()))
+ {
+ ostringstream ostr;
+ ostr << "new Patcher(" << patchIter++ << ')';
+ patchParams = ostr.str();
+ }
+ }
+
+ if(!member->optional())
+ {
+ writeMarshalUnmarshalCode(out, package, member->type(), OptionalNone, false, 0, fixKwd(member->name()), false,
+ iter, false, member->getMetaData(), patchParams);
+ }
+ else
+ {
+ out << nl << "if(__has_" << member->name() << " = __is.readOptional(" << member->tag() << ", "
+ << getOptionalFormat(member->type()) << "))";
+ out << sb;
+ writeMarshalUnmarshalCode(out, package, member->type(), OptionalMember, false, 0, fixKwd(member->name()), false,
+ iter, false, member->getMetaData(), patchParams);
+ out << eb;
+ }
+}
+
+void
+Slice::JavaCompatVisitor::writePatcher(Output& out, const string& package, const DataMemberList& classMembers,
+ const DataMemberList& optionalMembers)
+{
+ out << sp << nl << "private class Patcher implements Ice.ReadValueCallback";
+ out << sb;
+ if(classMembers.size() > 1)
+ {
+ out << sp << nl << "Patcher(int member)";
+ out << sb;
+ out << nl << "__member = member;";
+ out << eb;
+ }
+
+ out << sp << nl << "public void" << nl << "valueReady(Ice.Object v)";
+ out << sb;
+ if(classMembers.size() > 1)
+ {
+ out << nl << "switch(__member)";
+ out << sb;
+ }
+ int memberCount = 0;
+ for(DataMemberList::const_iterator d = classMembers.begin(); d != classMembers.end(); ++d)
+ {
+ if((*d)->optional())
+ {
+ continue;
+ }
+
+ BuiltinPtr b = BuiltinPtr::dynamicCast((*d)->type());
+ if(b)
+ {
+ assert(b->kind() == Builtin::KindObject);
+ }
+
+ if(classMembers.size() > 1)
+ {
+ out.dec();
+ out << nl << "case " << memberCount << ":";
+ out.inc();
+ if(b)
+ {
+ out << nl << "__typeId = Ice.ObjectImpl.ice_staticId();";
+ }
+ else
+ {
+ out << nl << "__typeId = \"" << (*d)->type()->typeId() << "\";";
+ }
+ }
+
+ string memberName = fixKwd((*d)->name());
+ if(b)
+ {
+ out << nl << memberName << " = v;";
+ }
+ else
+ {
+ string memberType = typeToString((*d)->type(), TypeModeMember, package);
+ out << nl << "if(v == null || v instanceof " << memberType << ")";
+ out << sb;
+ out << nl << memberName << " = (" << memberType << ")v;";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << "IceInternal.Ex.throwUOE(type(), v);";
+ out << eb;
+ }
+
+ if(classMembers.size() > 1)
+ {
+ out << nl << "break;";
+ }
+
+ memberCount++;
+ }
+
+ for(DataMemberList::const_iterator d = optionalMembers.begin(); d != optionalMembers.end(); ++d)
+ {
+ BuiltinPtr b = BuiltinPtr::dynamicCast((*d)->type());
+ if(b && b->kind() != Builtin::KindObject)
+ {
+ continue;
+ }
+
+ TypePtr paramType = (*d)->type();
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
+ {
+
+ if(classMembers.size() > 1)
+ {
+ out.dec();
+ out << nl << "case " << memberCount << ":";
+ out.inc();
+ if(b)
+ {
+ out << nl << "__typeId = Ice.ObjectImpl.ice_staticId();";
+ }
+ else
+ {
+ out << nl << "__typeId = \"" << (*d)->type()->typeId() << "\";";
+ }
+ }
+
+ string capName = (*d)->name();
+ capName[0] = toupper(static_cast<unsigned char>(capName[0]));
+
+ if(b)
+ {
+ out << nl << "set" << capName << "(v);";
+ }
+ else
+ {
+ string memberType = typeToString((*d)->type(), TypeModeMember, package);
+ out << nl << "if(v == null || v instanceof " << memberType << ")";
+ out << sb;
+ out << nl << "set" << capName << "((" << memberType << ")v);";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << "IceInternal.Ex.throwUOE(type(), v);";
+ out << eb;
+ }
+
+ if(classMembers.size() > 1)
+ {
+ out << nl << "break;";
+ }
+
+ memberCount++;
+ }
+ }
+
+ if(classMembers.size() > 1)
+ {
+ out << eb;
+ }
+ out << eb;
+
+ out << sp << nl << "public String" << nl << "type()";
+ out << sb;
+ if(classMembers.size() > 1)
+ {
+ out << nl << "return __typeId;";
+ }
+ else
+ {
+ out << nl << "return \"" << (*classMembers.begin())->type()->typeId() << "\";";
+ }
+ out << eb;
+
+ if(classMembers.size() > 1)
+ {
+ out << sp << nl << "private int __member;";
+ out << nl << "private String __typeId;";
+ }
+
+ out << eb;
+}
+
+void
+Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr& p)
+{
+ string name = fixKwd(p->name());
+ string package = getPackage(p);
+ string scoped = p->scoped();
+ ClassList bases = p->bases();
+ ClassDefPtr base;
+ if(!bases.empty() && !bases.front()->isInterface())
+ {
+ base = bases.front();
+ }
+
+ ClassList allBases = p->allBases();
+ StringList ids;
+ transform(allBases.begin(), allBases.end(), back_inserter(ids), constMemFun(&Contained::scoped));
+ StringList other;
+ other.push_back(scoped);
+ other.push_back("::Ice::Object");
+ other.sort();
+ ids.merge(other);
+ ids.unique();
+ StringList::const_iterator firstIter = ids.begin();
+ StringList::const_iterator scopedIter = find(ids.begin(), ids.end(), scoped);
+ assert(scopedIter != ids.end());
+ StringList::difference_type scopedPos = ::IceUtilInternal::distance(firstIter, scopedIter);
+
+ out << sp << nl << "public static final String[] __ids =";
+ out << sb;
+
+ for(StringList::const_iterator q = ids.begin(); q != ids.end();)
+ {
+ out << nl << '"' << *q << '"';
+ if(++q != ids.end())
+ {
+ out << ',';
+ }
+ }
+ out << eb << ';';
+
+ out << sp << nl << "public boolean ice_isA(String s)";
+ out << sb;
+ out << nl << "return java.util.Arrays.binarySearch(__ids, s) >= 0;";
+ out << eb;
+
+ out << sp << nl << "public boolean ice_isA(String s, Ice.Current __current)";
+ out << sb;
+ out << nl << "return java.util.Arrays.binarySearch(__ids, s) >= 0;";
+ out << eb;
+
+ out << sp << nl << "public String[] ice_ids()";
+ out << sb;
+ out << nl << "return __ids;";
+ out << eb;
+
+ out << sp << nl << "public String[] ice_ids(Ice.Current __current)";
+ out << sb;
+ out << nl << "return __ids;";
+ out << eb;
+
+ out << sp << nl << "public String ice_id()";
+ out << sb;
+ out << nl << "return __ids[" << scopedPos << "];";
+ out << eb;
+
+ out << sp << nl << "public String ice_id(Ice.Current __current)";
+ out << sb;
+ out << nl << "return __ids[" << scopedPos << "];";
+ out << eb;
+
+ out << sp << nl << "public static String ice_staticId()";
+ out << sb;
+ out << nl << "return __ids[" << scopedPos << "];";
+ out << eb;
+
+ OperationList ops = p->allOperations();
+
+ //
+ // Write the "no Current" implementation of each operation.
+ //
+ for(OperationList::const_iterator r = ops.begin(); r != ops.end(); ++r)
+ {
+ OperationPtr op = *r;
+ string opName = op->name();
+
+ ContainerPtr container = op->container();
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ assert(cl);
+
+ string deprecateReason = getDeprecateReason(op, cl, "operation");
+
+ const bool amd = cl->hasMetaData("amd") || op->hasMetaData("amd");
+ const bool optionalMapping = useOptionalMapping(op);
+
+ vector<string> params;
+ vector<string> args;
+ TypePtr ret;
+
+ if(amd)
+ {
+ opName += "_async";
+ params = getParamsAsync(op, package, true, true);
+ args = getArgsAsync(op);
+ }
+ else
+ {
+ opName = fixKwd(opName);
+ ret = op->returnType();
+ params = getParams(op, package, false, optionalMapping);
+ args = getArgs(op);
+ }
+
+ ExceptionList throws = op->throws();
+ throws.sort();
+ throws.unique();
+
+ //
+ // Only generate a "no current" version of the operation if it hasn't been done in a base
+ // class already, because the "no current" version is final.
+ //
+ bool generateOperation = cl == p; // Generate if the operation is defined in this class.
+ if(!generateOperation)
+ {
+ //
+ // The operation is not defined in this class.
+ //
+ if(!bases.empty())
+ {
+ //
+ // Check if the operation is already implemented by a base class.
+ //
+ bool implementedByBase = false;
+ if(!bases.front()->isInterface())
+ {
+ OperationList baseOps = bases.front()->allOperations();
+ OperationList::const_iterator i;
+ for(i = baseOps.begin(); i != baseOps.end(); ++i)
+ {
+ if((*i)->name() == op->name())
+ {
+ implementedByBase = true;
+ break;
+ }
+ }
+ if(i == baseOps.end())
+ {
+ generateOperation = true;
+ }
+ }
+ if(!generateOperation && !implementedByBase)
+ {
+ //
+ // No base class defines the operation. Check if one of the
+ // interfaces defines it, in which case this class must provide it.
+ //
+ if(bases.front()->isInterface() || bases.size() > 1)
+ {
+ generateOperation = true;
+ }
+ }
+ }
+ }
+ if(generateOperation)
+ {
+ out << sp;
+ if(amd)
+ {
+ writeDocCommentAsync(out, op, InParam);
+ }
+ else
+ {
+ writeDocComment(out, op, deprecateReason);
+ }
+ out << nl << "public final "
+ << typeToString(ret, TypeModeReturn, package, op->getMetaData(), true,
+ optionalMapping && op->returnIsOptional())
+ << ' ' << opName << spar << params << epar;
+ if(op->hasMetaData("UserException"))
+ {
+ out.inc();
+ out << nl << "throws Ice.UserException";
+ out.dec();
+ }
+ else
+ {
+ writeThrowsClause(package, throws);
+ }
+ out << sb << nl;
+ if(ret)
+ {
+ out << "return ";
+ }
+ out << opName << spar << args << "null" << epar << ';';
+ out << eb;
+ }
+ }
+
+ //
+ // Dispatch operations. We only generate methods for operations
+ // defined in this ClassDef, because we reuse existing methods
+ // for inherited operations.
+ //
+ ops = p->operations();
+ for(OperationList::const_iterator r = ops.begin(); r != ops.end(); ++r)
+ {
+ OperationPtr op = *r;
+ StringList opMetaData = op->getMetaData();
+ ContainerPtr container = op->container();
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ assert(cl);
+ string deprecateReason = getDeprecateReason(op, cl, "operation");
+
+ string opName = op->name();
+ out << sp;
+ if(!deprecateReason.empty())
+ {
+ out << nl << "/** @deprecated **/";
+ }
+ out << nl << "public static Ice.DispatchStatus ___" << opName << '(' << name
+ << " __obj, IceInternal.Incoming __inS, Ice.Current __current)";
+ out << sb;
+
+ const bool amd = cl->hasMetaData("amd") || op->hasMetaData("amd");
+ const bool optionalMapping = useOptionalMapping(op);
+
+ if(!amd)
+ {
+ TypePtr ret = op->returnType();
+
+ ParamDeclList inParams;
+ ParamDeclList outParams;
+ ParamDeclList paramList = op->parameters();
+ for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if((*pli)->isOutParam())
+ {
+ outParams.push_back(*pli);
+ }
+ else
+ {
+ inParams.push_back(*pli);
+ }
+ }
+
+ ExceptionList throws = op->throws();
+ throws.sort();
+ throws.unique();
+
+ //
+ // Arrange exceptions into most-derived to least-derived order. If we don't
+ // do this, a base exception handler can appear before a derived exception
+ // handler, causing compiler warnings and resulting in the base exception
+ // being marshaled instead of the derived exception.
+ //
+#if defined(__SUNPRO_CC)
+ throws.sort(Slice::derivedToBaseCompare);
+#else
+ throws.sort(Slice::DerivedToBaseCompare());
+#endif
+
+ int iter;
+
+ out << nl << "__checkMode(" << sliceModeToIceMode(op->mode()) << ", __current.mode);";
+
+ if(!inParams.empty())
+ {
+ //
+ // Unmarshal 'in' parameters.
+ //
+ out << nl << "Ice.InputStream __is = __inS.startReadParams();";
+ for(ParamDeclList::const_iterator pli = inParams.begin(); pli != inParams.end(); ++pli)
+ {
+ TypePtr paramType = (*pli)->type();
+ string paramName = fixKwd((*pli)->name());
+ string typeS = typeToString(paramType, TypeModeIn, package, (*pli)->getMetaData(),
+ true, (*pli)->optional());
+ if((*pli)->optional())
+ {
+ out << nl << typeS << ' ' << paramName << " = new " << typeS << "();";
+ }
+ else
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
+ {
+ out << nl << typeS << "Holder " << paramName << " = new " << typeS << "Holder();";
+ }
+ else if(StructPtr::dynamicCast(paramType))
+ {
+ out << nl << typeS << ' ' << paramName << " = null;";
+ }
+ else
+ {
+ out << nl << typeS << ' ' << paramName << ';';
+ }
+ }
+ }
+ iter = 0;
+ writeMarshalUnmarshalParams(out, package, inParams, 0, iter, false, true, true);
+ if(op->sendsClasses(false))
+ {
+ out << nl << "__is.readPendingValues();";
+ }
+ out << nl << "__inS.endReadParams();";
+ }
+ else
+ {
+ out << nl << "__inS.readEmptyParams();";
+ }
+
+ //
+ // Declare 'out' parameters.
+ //
+ for(ParamDeclList::const_iterator pli = outParams.begin(); pli != outParams.end(); ++pli)
+ {
+ string typeS = typeToString((*pli)->type(), TypeModeOut, package, (*pli)->getMetaData(), true,
+ optionalMapping && (*pli)->optional());
+ out << nl << typeS << ' ' << fixKwd((*pli)->name()) << " = new " << typeS << "();";
+ }
+
+ //
+ // Call on the servant.
+ //
+ if(!throws.empty())
+ {
+ out << nl << "try";
+ out << sb;
+ }
+ out << nl;
+ if(ret)
+ {
+ string retS = typeToString(ret, TypeModeReturn, package, opMetaData, true,
+ optionalMapping && op->returnIsOptional());
+ out << retS << " __ret = ";
+ }
+ out << "__obj." << fixKwd(opName) << '(';
+ for(ParamDeclList::const_iterator pli = inParams.begin(); pli != inParams.end(); ++pli)
+ {
+ TypePtr paramType = (*pli)->type();
+ out << fixKwd((*pli)->name());
+ if(!(*pli)->optional())
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
+ {
+ out << ".value";
+ }
+ }
+ out << ", ";
+ }
+ for(ParamDeclList::const_iterator pli = outParams.begin(); pli != outParams.end(); ++pli)
+ {
+ out << fixKwd((*pli)->name()) << ", ";
+ }
+ out << "__current);";
+
+ //
+ // Marshal 'out' parameters and return value.
+ //
+ if(!outParams.empty() || ret)
+ {
+ out << nl << "Ice.OutputStream __os = __inS.__startWriteParams("
+ << opFormatTypeToString(op) << ");";
+ writeMarshalUnmarshalParams(out, package, outParams, op, iter, true, optionalMapping, true);
+ if(op->returnsClasses(false))
+ {
+ out << nl << "__os.writePendingValues();";
+ }
+ out << nl << "__inS.__endWriteParams(true);";
+ }
+ else
+ {
+ out << nl << "__inS.__writeEmptyParams();";
+ }
+ out << nl << "return Ice.DispatchStatus.DispatchOK;";
+
+ //
+ // Handle user exceptions.
+ //
+ if(!throws.empty())
+ {
+ out << eb;
+ for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t)
+ {
+ string exS = getAbsolute(*t, package);
+ out << nl << "catch(" << exS << " ex)";
+ out << sb;
+ out << nl << "__inS.__writeUserException(ex, " << opFormatTypeToString(op) << ");";
+ out << nl << "return Ice.DispatchStatus.DispatchUserException;";
+ out << eb;
+ }
+ }
+
+ out << eb;
+ }
+ else
+ {
+ ParamDeclList inParams;
+ ParamDeclList paramList = op->parameters();
+ for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if(!(*pli)->isOutParam())
+ {
+ inParams.push_back(*pli);
+ }
+ }
+
+ int iter;
+
+ out << nl << "__checkMode(" << sliceModeToIceMode(op->mode()) << ", __current.mode);";
+
+ if(!inParams.empty())
+ {
+ //
+ // Unmarshal 'in' parameters.
+ //
+ out << nl << "Ice.InputStream __is = __inS.startReadParams();";
+ iter = 0;
+ for(ParamDeclList::const_iterator pli = inParams.begin(); pli != inParams.end(); ++pli)
+ {
+ TypePtr paramType = (*pli)->type();
+ string paramName = fixKwd((*pli)->name());
+ string typeS = typeToString(paramType, TypeModeIn, package, (*pli)->getMetaData(),
+ true, (*pli)->optional());
+ if((*pli)->optional())
+ {
+ out << nl << typeS << ' ' << paramName << " = new " << typeS << "();";
+ }
+ else
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
+ {
+ out << nl << typeS << "Holder " << paramName << " = new " << typeS << "Holder();";
+ }
+ else if(StructPtr::dynamicCast(paramType))
+ {
+ out << nl << typeS << ' ' << paramName << " = null;";
+ }
+ else
+ {
+ out << nl << typeS << ' ' << paramName << ';';
+ }
+ }
+ }
+ writeMarshalUnmarshalParams(out, package, inParams, 0, iter, false, true, true);
+ if(op->sendsClasses(false))
+ {
+ out << nl << "__is.readPendingValues();";
+ }
+ out << nl << "__inS.endReadParams();";
+ }
+ else
+ {
+ out << nl << "__inS.readEmptyParams();";
+ }
+
+ //
+ // Call on the servant.
+ //
+ string classNameAMD = "AMD_" + p->name();
+ out << nl << classNameAMD << '_' << opName << " __cb = new _" << classNameAMD << '_' << opName
+ << "(__inS);";
+ out << nl << "try";
+ out << sb;
+ out << nl << "__obj." << (amd ? opName + "_async" : fixKwd(opName)) << (amd ? "(__cb, " : "(");
+ for(ParamDeclList::const_iterator pli = inParams.begin(); pli != inParams.end(); ++pli)
+ {
+ TypePtr paramType = (*pli)->type();
+ out << fixKwd((*pli)->name());
+ if(!(*pli)->optional())
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
+ if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType))
+ {
+ out << ".value";
+ }
+ }
+ out << ", ";
+ }
+ out << "__current);";
+ out << eb;
+ out << nl << "catch(java.lang.Exception ex)";
+ out << sb;
+ out << nl << "__cb.ice_exception(ex);";
+ out << eb;
+ out << nl << "return Ice.DispatchStatus.DispatchAsync;";
+
+ out << eb;
+ }
+ }
+
+ OperationList allOps = p->allOperations();
+ if(!allOps.empty())
+ {
+ StringList allOpNames;
+ transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), constMemFun(&Contained::name));
+ allOpNames.push_back("ice_id");
+ allOpNames.push_back("ice_ids");
+ allOpNames.push_back("ice_isA");
+ allOpNames.push_back("ice_ping");
+ allOpNames.sort();
+ allOpNames.unique();
+
+ out << sp << nl << "private final static String[] __all =";
+ out << sb;
+ for(StringList::const_iterator q = allOpNames.begin(); q != allOpNames.end();)
+ {
+ out << nl << '"' << *q << '"';
+ if(++q != allOpNames.end())
+ {
+ out << ',';
+ }
+ }
+ out << eb << ';';
+
+ out << sp;
+ for(OperationList::iterator r = allOps.begin(); r != allOps.end(); ++r)
+ {
+ //
+ // Suppress deprecation warnings if this method dispatches to a deprecated operation.
+ //
+ OperationPtr op = *r;
+ ContainerPtr container = op->container();
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ assert(cl);
+ string deprecateReason = getDeprecateReason(op, cl, "operation");
+ if(!deprecateReason.empty())
+ {
+ out << nl << "@SuppressWarnings(\"deprecation\")";
+ break;
+ }
+ }
+ out << nl << "public Ice.DispatchStatus __dispatch(IceInternal.Incoming in, Ice.Current __current)";
+ out << sb;
+ out << nl << "int pos = java.util.Arrays.binarySearch(__all, __current.operation);";
+ out << nl << "if(pos < 0)";
+ out << sb;
+ out << nl << "throw new Ice.OperationNotExistException(__current.id, __current.facet, __current.operation);";
+ out << eb;
+ out << sp << nl << "switch(pos)";
+ out << sb;
+ int i = 0;
+ for(StringList::const_iterator q = allOpNames.begin(); q != allOpNames.end(); ++q)
+ {
+ string opName = *q;
+
+ out << nl << "case " << i++ << ':';
+ out << sb;
+ if(opName == "ice_id")
+ {
+ out << nl << "return ___ice_id(this, in, __current);";
+ }
+ else if(opName == "ice_ids")
+ {
+ out << nl << "return ___ice_ids(this, in, __current);";
+ }
+ else if(opName == "ice_isA")
+ {
+ out << nl << "return ___ice_isA(this, in, __current);";
+ }
+ else if(opName == "ice_ping")
+ {
+ out << nl << "return ___ice_ping(this, in, __current);";
+ }
+ else
+ {
+ //
+ // There's probably a better way to do this.
+ //
+ for(OperationList::const_iterator t = allOps.begin(); t != allOps.end(); ++t)
+ {
+ if((*t)->name() == (*q))
+ {
+ ContainerPtr container = (*t)->container();
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ assert(cl);
+ if(cl->scoped() == p->scoped())
+ {
+ out << nl << "return ___" << opName << "(this, in, __current);";
+ }
+ else
+ {
+ string base;
+ if(cl->isInterface())
+ {
+ base = getAbsolute(cl, package, "_", "Disp");
+ }
+ else
+ {
+ base = getAbsolute(cl, package);
+ }
+ out << nl << "return " << base << ".___" << opName << "(this, in, __current);";
+ }
+ break;
+ }
+ }
+ }
+ out << eb;
+ }
+ out << eb;
+ out << sp << nl << "assert(false);";
+ out << nl << "throw new Ice.OperationNotExistException(__current.id, __current.facet, __current.operation);";
+ out << eb;
+
+ //
+ // Check if we need to generate ice_operationAttributes()
+ //
+
+ map<string, int> attributesMap;
+ for(OperationList::iterator r = allOps.begin(); r != allOps.end(); ++r)
+ {
+ int attributes = (*r)->attributes();
+ if(attributes != 0)
+ {
+ attributesMap.insert(map<string, int>::value_type((*r)->name(), attributes));
+ }
+ }
+
+ if(!attributesMap.empty())
+ {
+ out << sp << nl << "private final static int[] __operationAttributes =";
+ out << sb;
+ for(StringList::const_iterator q = allOpNames.begin(); q != allOpNames.end();)
+ {
+ int attributes = 0;
+ string opName = *q;
+ map<string, int>::iterator it = attributesMap.find(opName);
+ if(it != attributesMap.end())
+ {
+ attributes = it->second;
+ }
+ out << nl << attributes;
+ if(++q != allOpNames.end())
+ {
+ out << ',';
+ }
+ out << " // " << opName;
+ }
+ out << eb << ';';
+
+ out << sp << nl << "public int ice_operationAttributes(String operation)";
+ out << sb;
+ out << nl << "int pos = java.util.Arrays.binarySearch(__all, operation);";
+ out << nl << "if(pos < 0)";
+ out << sb;
+ out << nl << "return -1;";
+ out << eb;
+ out << sp << nl << "return __operationAttributes[pos];";
+ out << eb;
+ }
+ }
+
+ int iter;
+ DataMemberList members = p->dataMembers();
+ DataMemberList optionalMembers = p->orderedOptionalDataMembers();
+ bool basePreserved = p->inheritsMetaData("preserve-slice");
+ bool preserved = p->hasMetaData("preserve-slice");
+
+ if(preserved && !basePreserved)
+ {
+ out << sp << nl << "public void __write(Ice.OutputStream __os)";
+ out << sb;
+ out << nl << "__os.startValue(__slicedData);";
+ out << nl << "__writeImpl(__os);";
+ out << nl << "__os.endValue();";
+ out << eb;
+
+ out << sp << nl << "public void __read(Ice.InputStream __is)";
+ out << sb;
+ out << nl << "__is.startValue();";
+ out << nl << "__readImpl(__is);";
+ out << nl << "__slicedData = __is.endValue(true);";
+ out << eb;
+ }
+
+ out << sp << nl << "protected void __writeImpl(Ice.OutputStream __os)";
+ out << sb;
+ out << nl << "__os.startSlice(ice_staticId(), " << p->compactId() << (!base ? ", true" : ", false") << ");";
+ iter = 0;
+ for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
+ {
+ if(!(*d)->optional())
+ {
+ writeMarshalDataMember(out, package, *d, iter);
+ }
+ }
+ for(DataMemberList::const_iterator d = optionalMembers.begin(); d != optionalMembers.end(); ++d)
+ {
+ writeMarshalDataMember(out, package, *d, iter);
+ }
+ out << nl << "__os.endSlice();";
+ if(base)
+ {
+ out << nl << "super.__writeImpl(__os);";
+ }
+ out << eb;
+
+ DataMemberList classMembers = p->classDataMembers();
+ DataMemberList allClassMembers = p->allClassDataMembers();
+
+ if(classMembers.size() != 0)
+ {
+ writePatcher(out, package, classMembers, optionalMembers);
+ }
+
+ out << sp << nl << "protected void __readImpl(Ice.InputStream __is)";
+ out << sb;
+ out << nl << "__is.startSlice();";
+
+ int patchIter = 0;
+ const bool needCustomPatcher = classMembers.size() > 1;
+ iter = 0;
+ for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
+ {
+ if(!(*d)->optional())
+ {
+ writeUnmarshalDataMember(out, package, *d, iter, needCustomPatcher, patchIter);
+ }
+ }
+ for(DataMemberList::const_iterator d = optionalMembers.begin(); d != optionalMembers.end(); ++d)
+ {
+ writeUnmarshalDataMember(out, package, *d, iter, needCustomPatcher, patchIter);
+ }
+ out << nl << "__is.endSlice();";
+ if(base)
+ {
+ out << nl << "super.__readImpl(__is);";
+ }
+ out << eb;
+
+ if(preserved && !basePreserved)
+ {
+ out << sp << nl << "protected Ice.SlicedData __slicedData;";
+ }
+}
+
+void
+Slice::JavaCompatVisitor::writeConstantValue(Output& out, const TypePtr& type, const SyntaxTreeBasePtr& valueType,
+ const string& value, const string& package)
+{
+ ConstPtr constant = ConstPtr::dynamicCast(valueType);
+ if(constant)
+ {
+ out << getAbsolute(constant, package) << ".value";
+ }
+ else
+ {
+ BuiltinPtr bp;
+ EnumPtr ep;
+ if((bp = BuiltinPtr::dynamicCast(type)))
+ {
+ switch(bp->kind())
+ {
+ case Builtin::KindString:
+ {
+ //
+ // Expand strings into the basic source character set. We can't use isalpha() and the like
+ // here because they are sensitive to the current locale.
+ //
+ static const string basicSourceChars = "abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789"
+ "_{}[]#()<>%:;.?*+-/^&|~!=,\\\"' ";
+ static const set<char> charSet(basicSourceChars.begin(), basicSourceChars.end());
+ out << "\"";
+
+ vector<unsigned char> u8buffer; // Buffer to convert multibyte characters
+
+ for(size_t i = 0; i < value.size();)
+ {
+ if(charSet.find(value[i]) == charSet.end())
+ {
+ char c = value[i];
+ if(static_cast<unsigned char>(c) < 128) // Single byte character
+ {
+ //
+ // Print as unicode if not in basic source character set
+ //
+ switch(c)
+ {
+ //
+ // Java doesn't want '\n' or '\r\n' encoded as universal
+ // characters, that gives an error "unclosed string literal"
+ //
+ case '\r':
+ {
+ out << "\\r";
+ break;
+ }
+ case '\n':
+ {
+ out << "\\n";
+ break;
+ }
+ default:
+ {
+ out << u16CodePoint(c);
+ break;
+ }
+ }
+ }
+ else
+ {
+ u8buffer.push_back(value[i]);
+ }
+ }
+ else
+ {
+ //
+ // Write any pedding characters in the utf8 buffer
+ //
+ if(!u8buffer.empty())
+ {
+ writeU8Buffer(u8buffer, out);
+ u8buffer.clear();
+ }
+ switch(value[i])
+ {
+ case '\\':
+ {
+ string s = "\\";
+ size_t j = i + 1;
+ for(; j < value.size(); ++j)
+ {
+ if(value[j] != '\\')
+ {
+ break;
+ }
+ s += "\\";
+ }
+
+ //
+ // An even number of slash \ will escape the backslash and
+ // the codepoint will be interpreted as its charaters
+ //
+ // \\U00000041 - ['\\', 'U', '0', '0', '0', '0', '0', '0', '4', '1']
+ // \\\U00000041 - ['\\', 'A'] (41 is the codepoint for 'A')
+ //
+ if(s.size() % 2 != 0 && (value[j] == 'U' || value[j] == 'u'))
+ {
+ size_t sz = value[j] == 'U' ? 8 : 4;
+ out << s.substr(0, s.size() - 1);
+ i = j + 1;
+
+ string codepoint = value.substr(j + 1, sz);
+ assert(codepoint.size() == sz);
+
+ IceUtil::Int64 v = IceUtilInternal::strToInt64(codepoint.c_str(), 0, 16);
+
+
+ //
+ // Java doesn't like this special characters encoded as universal characters
+ //
+ if(v == 0x5c)
+ {
+ out << "\\\\";
+ }
+ else if(v == 0xa)
+ {
+ out << "\\n";
+ }
+ else if(v == 0xd)
+ {
+ out << "\\r";
+ }
+ else if(v == 0x22)
+ {
+ out << "\\\"";
+ }
+ //
+ // Unicode character in the range U+10000 to U+10FFFF is not permitted in a character literal
+ // and is represented using a Unicode surrogate pair.
+ //
+ else if(v > 0xFFFF)
+ {
+ unsigned int high = ((static_cast<unsigned int>(v) - 0x10000) / 0x400) + 0xD800;
+ unsigned int low = ((static_cast<unsigned int>(v) - 0x10000) % 0x400) + 0xDC00;
+ out << u16CodePoint(high);
+ out << u16CodePoint(low);
+ }
+ else
+ {
+ out << u16CodePoint(static_cast<unsigned int>(v));
+ }
+
+ i = j + 1 + sz;
+ }
+ else
+ {
+ out << s;
+ i = j;
+ }
+ continue;
+ }
+ case '"':
+ {
+ out << "\\";
+ break;
+ }
+ }
+ out << value[i]; // Print normally if in basic source character set
+ }
+ i++;
+ }
+
+ //
+ // Write any pedding characters in the utf8 buffer
+ //
+ if(!u8buffer.empty())
+ {
+ writeU8Buffer(u8buffer, out);
+ u8buffer.clear();
+ }
+
+ out << "\"";
+ break;
+ }
+ case Builtin::KindByte:
+ {
+ int i = atoi(value.c_str());
+ if(i > 127)
+ {
+ i -= 256;
+ }
+ out << i; // Slice byte runs from 0-255, Java byte runs from -128 - 127.
+ break;
+ }
+ case Builtin::KindLong:
+ {
+ out << value << "L"; // Need to append "L" modifier for long constants.
+ break;
+ }
+ case Builtin::KindBool:
+ case Builtin::KindShort:
+ case Builtin::KindInt:
+ case Builtin::KindDouble:
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ case Builtin::KindLocalObject:
+ case Builtin::KindValue:
+ {
+ out << value;
+ break;
+ }
+ case Builtin::KindFloat:
+ {
+ out << value << "F";
+ break;
+ }
+ }
+
+ }
+ else if((ep = EnumPtr::dynamicCast(type)))
+ {
+ string val = value;
+ string::size_type pos = val.rfind(':');
+ if(pos != string::npos)
+ {
+ val.erase(0, pos + 1);
+ }
+ out << getAbsolute(ep, package) << '.' << fixKwd(val);
+ }
+ else
+ {
+ out << value;
+ }
+ }
+}
+
+void
+Slice::JavaCompatVisitor::writeDataMemberInitializers(Output& out, const DataMemberList& members, const string& package)
+{
+ for(DataMemberList::const_iterator p = members.begin(); p != members.end(); ++p)
+ {
+ TypePtr t = (*p)->type();
+ if((*p)->defaultValueType())
+ {
+ if((*p)->optional())
+ {
+ string capName = (*p)->name();
+ capName[0] = toupper(static_cast<unsigned char>(capName[0]));
+ out << nl << "set" << capName << '(';
+ writeConstantValue(out, t, (*p)->defaultValueType(), (*p)->defaultValue(), package);
+ out << ");";
+ }
+ else
+ {
+ out << nl << fixKwd((*p)->name()) << " = ";
+ writeConstantValue(out, t, (*p)->defaultValueType(), (*p)->defaultValue(), package);
+ out << ';';
+ }
+ }
+ else
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(t);
+ if(builtin && builtin->kind() == Builtin::KindString)
+ {
+ out << nl << fixKwd((*p)->name()) << " = \"\";";
+ }
+
+ EnumPtr en = EnumPtr::dynamicCast(t);
+ if(en)
+ {
+ string firstEnum = fixKwd(en->getEnumerators().front()->name());
+ out << nl << fixKwd((*p)->name()) << " = " << getAbsolute(en, package) << '.' << firstEnum << ';';
+ }
+
+ StructPtr st = StructPtr::dynamicCast(t);
+ if(st)
+ {
+ string memberType = typeToString(st, TypeModeMember, package, (*p)->getMetaData());
+ out << nl << fixKwd((*p)->name()) << " = new " << memberType << "();";
+ }
+ }
+ }
+}
+
+StringList
+Slice::JavaCompatVisitor::splitComment(const ContainedPtr& p)
+{
+ StringList result;
+
+ string comment = p->comment();
+ string::size_type pos = 0;
+ string::size_type nextPos;
+ while((nextPos = comment.find_first_of('\n', pos)) != string::npos)
+ {
+ result.push_back(string(comment, pos, nextPos - pos));
+ pos = nextPos + 1;
+ }
+ string lastLine = string(comment, pos);
+ if(lastLine.find_first_not_of(" \t\n\r") != string::npos)
+ {
+ result.push_back(lastLine);
+ }
+
+ return result;
+}
+
+void
+Slice::JavaCompatVisitor::writeDocComment(Output& out, const ContainedPtr& p, const string& deprecateReason,
+ const string& extraParam)
+{
+ StringList lines = splitComment(p);
+ if(lines.empty())
+ {
+ if(!deprecateReason.empty())
+ {
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
+ }
+ return;
+ }
+
+ out << nl << "/**";
+
+ bool doneExtraParam = false;
+ for(StringList::const_iterator i = lines.begin(); i != lines.end(); ++i)
+ {
+ //
+ // @param must precede @return, so emit any extra parameter
+ // when @return is seen.
+ //
+ if(i->find("@return") != string::npos && !extraParam.empty())
+ {
+ out << nl << " * " << extraParam;
+ doneExtraParam = true;
+ }
+ out << nl << " *";
+ if(!(*i).empty())
+ {
+ out << " " << *i;
+ }
+ }
+
+ if(!doneExtraParam && !extraParam.empty())
+ {
+ //
+ // Above code doesn't emit the comment for the extra parameter
+ // if the operation returns a void or doesn't have an @return.
+ //
+ out << nl << " * " << extraParam;
+ }
+
+ if(!deprecateReason.empty())
+ {
+ out << nl << " * @deprecated " << deprecateReason;
+ }
+
+ out << nl << " **/";
+}
+
+void
+Slice::JavaCompatVisitor::writeDocComment(Output& out, const string& deprecateReason, const string& summary)
+{
+ vector<string> lines;
+ IceUtilInternal::splitString(summary, "\n", lines);
+
+ out << nl << "/**";
+ for(vector<string>::const_iterator i = lines.begin(); i != lines.end(); ++i)
+ {
+ out << nl << " *";
+ if(!(*i).empty())
+ {
+ out << " " << *i;
+ }
+ }
+
+ if(!deprecateReason.empty())
+ {
+ out << nl << " * @deprecated " << deprecateReason;
+ }
+
+ out << nl << " **/";
+}
+
+void
+Slice::JavaCompatVisitor::writeDocCommentOp(Output& out, const OperationPtr& p)
+{
+ ContainerPtr container = p->container();
+ ContainedPtr contained = ContainedPtr::dynamicCast(container);
+ string deprecateReason = getDeprecateReason(p, contained, "operation");
+
+ StringList lines = splitComment(p);
+
+ if(lines.empty() && deprecateReason.empty())
+ {
+ return;
+ }
+
+
+ out << sp << nl << "/**";
+
+ //
+ // Output the leading comment block up until the first @tag.
+ //
+ bool done = false;
+ for(StringList::const_iterator i = lines.begin(); i != lines.end() && !done; ++i)
+ {
+ if((*i)[0] == '@')
+ {
+ done = true;
+ }
+ else
+ {
+ out << nl << " * " << *i;
+ }
+ }
+
+ if(!deprecateReason.empty())
+ {
+ out << nl << " * @deprecated " << deprecateReason;
+ }
+
+ out << nl << " **/";
+}
+
+void
+Slice::JavaCompatVisitor::writeDocCommentAsync(Output& out, const OperationPtr& p, ParamDir paramType,
+ const string& extraParam)
+{
+ ContainerPtr container = p->container();
+ ClassDefPtr contained = ClassDefPtr::dynamicCast(container);
+ string deprecateReason = getDeprecateReason(p, contained, "operation");
+
+ StringList lines = splitComment(p);
+ if(lines.empty() && deprecateReason.empty())
+ {
+ return;
+ }
+
+ out << nl << "/**";
+
+ if(paramType == OutParam)
+ {
+ out << nl << " * ice_response indicates that";
+ out << nl << " * the operation completed successfully.";
+
+ //
+ // Find the comment for the return value (if any) and rewrite that as an @param comment.
+ //
+ const string returnTag = "@return";
+ bool doneReturn = false;
+ bool foundReturn = false;
+ for(StringList::const_iterator i = lines.begin(); i != lines.end() && !doneReturn; ++i)
+ {
+ if(!foundReturn)
+ {
+ if(i->find(returnTag) != string::npos)
+ {
+ foundReturn = true;
+ out << nl << " * @param __ret (return value)" << i->substr(returnTag.length());
+ }
+ }
+ else
+ {
+ if((*i)[0] == '@')
+ {
+ doneReturn = true;
+ }
+ else
+ {
+ out << nl << " * " << *i;
+ }
+ }
+ }
+ }
+ else
+ {
+ //
+ // Output the leading comment block up until the first @tag.
+ //
+ bool done = false;
+ for(StringList::const_iterator i = lines.begin(); i != lines.end() && !done; ++i)
+ {
+ if((*i)[0] == '@')
+ {
+ done = true;
+ }
+ else
+ {
+ out << nl << " * " << *i;
+ }
+ }
+ }
+
+ //
+ // Write the comments for the parameters.
+ //
+ writeDocCommentParam(out, p, paramType);
+
+ if(!extraParam.empty())
+ {
+ out << nl << " * " << extraParam;
+ }
+
+ if(paramType == InParam)
+ {
+ if(!deprecateReason.empty())
+ {
+ out << nl << " * @deprecated " << deprecateReason;
+ }
+ }
+
+ out << nl << " **/";
+}
+
+void
+Slice::JavaCompatVisitor::writeDocCommentAMI(Output& out, const OperationPtr& p, ParamDir paramType,
+ const string& extraParam1, const string& extraParam2, const string& extraParam3,
+ const string& extraParam4, const string& extraParam5)
+{
+ ContainerPtr container = p->container();
+ ClassDefPtr contained = ClassDefPtr::dynamicCast(container);
+ string deprecateReason = getDeprecateReason(p, contained, "operation");
+
+ StringList lines = splitComment(p);
+ if(lines.empty() && deprecateReason.empty())
+ {
+ return;
+ }
+
+ out << nl << "/**";
+
+ //
+ // Output the leading comment block up until the first @tag.
+ //
+ bool done = false;
+ for(StringList::const_iterator i = lines.begin(); i != lines.end() && !done; ++i)
+ {
+ if((*i)[0] == '@')
+ {
+ done = true;
+ }
+ else
+ {
+ out << nl << " * " << *i;
+ }
+ }
+
+ //
+ // Write the comments for the parameters.
+ //
+ writeDocCommentParam(out, p, paramType, false);
+
+ if(!extraParam1.empty())
+ {
+ out << nl << " * " << extraParam1;
+ }
+
+ if(!extraParam2.empty())
+ {
+ out << nl << " * " << extraParam2;
+ }
+
+ if(!extraParam3.empty())
+ {
+ out << nl << " * " << extraParam3;
+ }
+
+ if(!extraParam4.empty())
+ {
+ out << nl << " * " << extraParam4;
+ }
+
+ if(!extraParam5.empty())
+ {
+ out << nl << " * " << extraParam5;
+ }
+
+ if(paramType == InParam)
+ {
+ out << nl << " * @return The asynchronous result object.";
+ if(!deprecateReason.empty())
+ {
+ out << nl << " * @deprecated " << deprecateReason;
+ }
+ }
+ else
+ {
+ out << nl << " * @param __result The asynchronous result object.";
+ //
+ // Print @return, @throws, and @see tags.
+ //
+ const string returnTag = "@return";
+ const string throwsTag = "@throws";
+ const string seeTag = "@see";
+ bool found = false;
+ for(StringList::const_iterator i = lines.begin(); i != lines.end(); ++i)
+ {
+ if(!found)
+ {
+ if(i->find(returnTag) != string::npos || i->find(throwsTag) != string::npos ||
+ i->find(seeTag) != string::npos)
+ {
+ found = true;
+ }
+ }
+
+ if(found)
+ {
+ out << nl << " * " << *i;
+ }
+ }
+ }
+
+ out << nl << " **/";
+}
+
+void
+Slice::JavaCompatVisitor::writeDocCommentParam(Output& out, const OperationPtr& p, ParamDir paramType, bool cb)
+{
+ //
+ // Collect the names of the in- or -out parameters to be documented.
+ //
+ ParamDeclList tmp = p->parameters();
+ vector<string> params;
+ for(ParamDeclList::const_iterator q = tmp.begin(); q != tmp.end(); ++q)
+ {
+ if((*q)->isOutParam() && paramType == OutParam)
+ {
+ params.push_back((*q)->name());
+ }
+ else if(!(*q)->isOutParam() && paramType == InParam)
+ {
+ params.push_back((*q)->name());
+ }
+ }
+
+ //
+ // Print a comment for the callback parameter.
+ //
+ if(cb && paramType == InParam)
+ {
+ out << nl << " * @param __cb The callback object for the operation.";
+ }
+
+ //
+ // Print the comments for all the parameters that appear in the parameter list.
+ //
+ const string paramTag = "@param";
+ StringList lines = splitComment(p);
+ StringList::const_iterator i = lines.begin();
+ while(i != lines.end())
+ {
+ string line = *i++;
+ if(line.find(paramTag) != string::npos)
+ {
+ string::size_type paramNamePos = line.find_first_not_of(" \t\n\r", paramTag.length());
+ if(paramNamePos != string::npos)
+ {
+ string::size_type paramNameEndPos = line.find_first_of(" \t", paramNamePos);
+ string paramName = line.substr(paramNamePos, paramNameEndPos - paramNamePos);
+ if(std::find(params.begin(), params.end(), paramName) != params.end())
+ {
+ out << nl << " * " << line;
+ StringList::const_iterator j;
+ if (i == lines.end())
+ {
+ break;
+ }
+ j = i++;
+ while(j != lines.end())
+ {
+ if((*j)[0] != '@')
+ {
+ i = j;
+ out << nl << " * " << *j++;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+Slice::GenCompat::GenCompat(const string& /*name*/, const string& base, const vector<string>& includePaths, const string& dir) :
+ _base(base),
+ _includePaths(includePaths),
+ _dir(dir)
+{
+}
+
+Slice::GenCompat::~GenCompat()
+{
+}
+
+void
+Slice::GenCompat::generate(const UnitPtr& p)
+{
+ JavaGenerator::validateMetaData(p);
+
+ OpsVisitor opsVisitor(_dir);
+ p->visit(&opsVisitor, false);
+
+ PackageVisitor packageVisitor(_dir);
+ p->visit(&packageVisitor, false);
+
+ TypesVisitor typesVisitor(_dir);
+ p->visit(&typesVisitor, false);
+
+ CompactIdVisitor compactIdVisitor(_dir);
+ p->visit(&compactIdVisitor, false);
+
+ HolderVisitor holderVisitor(_dir);
+ p->visit(&holderVisitor, false);
+
+ HelperVisitor helperVisitor(_dir);
+ p->visit(&helperVisitor, false);
+
+ ProxyVisitor proxyVisitor(_dir);
+ p->visit(&proxyVisitor, false);
+
+ DispatcherVisitor dispatcherVisitor(_dir);
+ p->visit(&dispatcherVisitor, false);
+
+ AsyncVisitor asyncVisitor(_dir);
+ p->visit(&asyncVisitor, false);
+}
+
+void
+Slice::GenCompat::generateTie(const UnitPtr& p)
+{
+ TieVisitor tieVisitor(_dir);
+ p->visit(&tieVisitor, false);
+}
+
+void
+Slice::GenCompat::generateImpl(const UnitPtr& p)
+{
+ ImplVisitor implVisitor(_dir);
+ p->visit(&implVisitor, false);
+}
+
+void
+Slice::GenCompat::generateImplTie(const UnitPtr& p)
+{
+ ImplTieVisitor implTieVisitor(_dir);
+ p->visit(&implTieVisitor, false);
+}
+
+void
+Slice::GenCompat::writeChecksumClass(const string& checksumClass, const string& dir, const ChecksumMap& m)
+{
+ //
+ // Attempt to open the source file for the checksum class.
+ //
+ JavaOutput out;
+ out.openClass(checksumClass, dir);
+
+ //
+ // Get the class name.
+ //
+ string className;
+ string::size_type pos = checksumClass.rfind('.');
+ if(pos == string::npos)
+ {
+ className = checksumClass;
+ }
+ else
+ {
+ className = checksumClass.substr(pos + 1);
+ }
+
+ //
+ // Emit the class.
+ //
+ out << sp << nl << "public class " << className;
+ out << sb;
+
+ //
+ // Use a static initializer to populate the checksum map.
+ //
+ out << sp << nl << "public static final java.util.Map<String, String> checksums;";
+ out << sp << nl << "static";
+ out << sb;
+ out << nl << "java.util.Map<String, String> map = new java.util.HashMap<String, String>();";
+ for(ChecksumMap::const_iterator p = m.begin(); p != m.end(); ++p)
+ {
+ out << nl << "map.put(\"" << p->first << "\", \"";
+ ostringstream str;
+ str.flags(ios_base::hex);
+ str.fill('0');
+ for(vector<unsigned char>::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
+ {
+ str << static_cast<int>(*q);
+ }
+ out << str.str() << "\");";
+ }
+ out << nl << "checksums = java.util.Collections.unmodifiableMap(map);";
+
+ out << eb;
+ out << eb;
+ out << nl;
+}
+
+Slice::GenCompat::OpsVisitor::OpsVisitor(const string& dir) :
+ JavaCompatVisitor(dir)
+{
+}
+
+bool
+Slice::GenCompat::OpsVisitor::visitClassDefStart(const ClassDefPtr& p)
+{
+ //
+ // Don't generate an Operations interface for non-abstract classes
+ //
+ if(!p->isAbstract())
+ {
+ return false;
+ }
+
+ if(!p->isLocal())
+ {
+ writeOperations(p, false);
+ }
+ writeOperations(p, true);
+
+ return false;
+}
+
+void
+Slice::GenCompat::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent)
+{
+ string name = p->name();
+ ClassList bases = p->bases();
+ string package = getPackage(p);
+ string opIntfName = "Operations";
+ if(noCurrent || p->isLocal())
+ {
+ opIntfName += "NC";
+ }
+ string absolute = getAbsolute(p, "", "_", opIntfName);
+
+ open(absolute, p->file());
+
+ Output& out = output();
+
+ //
+ // Generate the operations interface
+ //
+ out << sp;
+ writeDocComment(out, p, getDeprecateReason(p, 0, p->isInterface() ? "interface" : "class"));
+ out << nl << "public interface " << '_' << name << opIntfName;
+ if((bases.size() == 1 && bases.front()->isAbstract()) || bases.size() > 1)
+ {
+ out << " extends ";
+ out.useCurrentPosAsIndent();
+ bool first = true;
+ for(ClassList::const_iterator q = bases.begin(); q != bases.end();)
+ {
+ if((*q)->isAbstract())
+ {
+ if(!first)
+ {
+ out << ',' << nl;
+ }
+ else
+ {
+ first = false;
+ }
+ out << getAbsolute(*q, package, "_", opIntfName);
+ }
+ ++q;
+ }
+ out.restoreIndent();
+ }
+ out << sb;
+
+ OperationList ops = p->operations();
+ for(OperationList::iterator r = ops.begin(); r != ops.end(); ++r)
+ {
+ OperationPtr op = *r;
+ ContainerPtr container = op->container();
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ string opname = op->name();
+
+ TypePtr ret;
+ vector<string> params;
+
+ const bool amd = !p->isLocal() && (cl->hasMetaData("amd") || op->hasMetaData("amd"));
+ const bool optionalMapping = useOptionalMapping(op);
+
+ if(amd)
+ {
+ params = getParamsAsync(op, package, true, true);
+ }
+ else
+ {
+ params = getParams(op, package, false, optionalMapping);
+ ret = op->returnType();
+ }
+
+ string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData(), true,
+ optionalMapping && op->returnIsOptional());
+ ExceptionList throws = op->throws();
+ throws.sort();
+ throws.unique();
+ out << sp;
+
+ string deprecateReason = getDeprecateReason(*r, p, "operation");
+ string extraCurrent;
+ if(!noCurrent && !p->isLocal())
+ {
+ extraCurrent = "@param __current The Current object for the invocation.";
+ }
+ if(amd)
+ {
+ writeDocCommentAsync(out, *r, InParam, extraCurrent);
+ }
+ else
+ {
+ writeDocComment(out, *r, deprecateReason, extraCurrent);
+ }
+ out << nl << retS << ' ' << (amd ? opname + "_async" : fixKwd(opname)) << spar << params;
+ if(!noCurrent && !p->isLocal())
+ {
+ out << "Ice.Current __current";
+ }
+ out << epar;
+ if(op->hasMetaData("UserException"))
+ {
+ out.inc();
+ out << nl << "throws Ice.UserException";
+ out.dec();
+ }
+ else
+ {
+ writeThrowsClause(package, throws);
+ }
+ out << ';';
+ }
+
+ out << eb;
+
+ close();
+}
+
+Slice::GenCompat::TieVisitor::TieVisitor(const string& dir) :
+ JavaCompatVisitor(dir)
+{
+}
+
+bool
+Slice::GenCompat::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
+{
+ string name = p->name();
+ ClassList bases = p->bases();
+ string package = getPackage(p);
+ string absolute = getAbsolute(p, "", "_", "Tie");
+ string opIntfName = "Operations";
+ if(p->isLocal())
+ {
+ opIntfName += "NC";
+ }
+
+ //
+ // Don't generate a TIE class for a non-abstract class
+ //
+ if(!p->isAbstract())
+ {
+ return false;
+ }
+
+ open(absolute, p->file());
+
+ Output& out = output();
+
+ //
+ // Generate the TIE class
+ //
+ out << sp << nl << "public class " << '_' << name << "Tie";
+ if(p->isInterface())
+ {
+ if(p->isLocal())
+ {
+ out << " implements " << fixKwd(name) << ", Ice.TieBase";
+ }
+ else
+ {
+ out << " extends " << '_' << name << "Disp implements Ice.TieBase";
+ }
+ }
+ else
+ {
+ out << " extends " << fixKwd(name) << " implements Ice.TieBase";
+ }
+
+ out << sb;
+
+ out << sp << nl << "public _" << name << "Tie()";
+ out << sb;
+ out << eb;
+
+ out << sp << nl << "public _" << name << "Tie(" << '_' << name << opIntfName << " delegate)";
+ out << sb;
+ out << nl << "_ice_delegate = delegate;";
+ out << eb;
+
+ out << sp << nl << "public java.lang.Object ice_delegate()";
+ out << sb;
+ out << nl << "return _ice_delegate;";
+ out << eb;
+
+ out << sp << nl << "public void ice_delegate(java.lang.Object delegate)";
+ out << sb;
+ out << nl << "_ice_delegate = (_" << name << opIntfName << ")delegate;";
+ out << eb;
+
+ out << sp << nl << "public boolean equals(java.lang.Object rhs)";
+ out << sb;
+ out << nl << "if(this == rhs)";
+ out << sb;
+ out << nl << "return true;";
+ out << eb;
+ out << nl << "if(!(rhs instanceof " << '_' << name << "Tie))";
+ out << sb;
+ out << nl << "return false;";
+ out << eb;
+ out << sp << nl << "return _ice_delegate.equals(((" << '_' << name << "Tie)rhs)._ice_delegate);";
+ out << eb;
+
+ out << sp << nl << "public int hashCode()";
+ out << sb;
+ out << nl << "return _ice_delegate.hashCode();";
+ out << eb;
+
+ if(p->isLocal())
+ {
+ out << sp << nl << "public _" << name << "Tie clone()";
+ out.inc();
+ out << nl << "throws java.lang.CloneNotSupportedException";
+ out.dec();
+ out << sb;
+ out << nl << "return (_" << name << "Tie)super.clone();";
+ out << eb;
+ }
+
+ OperationList ops = p->allOperations();
+ for(OperationList::iterator r = ops.begin(); r != ops.end(); ++r)
+ {
+ ContainerPtr container = (*r)->container();
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ const bool hasAMD = cl->hasMetaData("amd") || (*r)->hasMetaData("amd");
+ const bool optionalMapping = useOptionalMapping(*r);
+
+ string opName = hasAMD ? (*r)->name() + "_async" : fixKwd((*r)->name());
+
+ TypePtr ret = (*r)->returnType();
+ string retS = typeToString(ret, TypeModeReturn, package, (*r)->getMetaData(), true,
+ optionalMapping && (*r)->returnIsOptional());
+
+ vector<string> params;
+ vector<string> args;
+ if(hasAMD)
+ {
+ params = getParamsAsync((*r), package, true, true);
+ args = getArgsAsync(*r);
+ }
+ else
+ {
+ params = getParams((*r), package, false, optionalMapping);
+ args = getArgs(*r);
+ }
+
+ string deprecateReason = getDeprecateReason(*r, cl, "operation");
+
+ out << sp;
+ if(!deprecateReason.empty())
+ {
+ out << nl << "@Deprecated";
+ out << nl << "@SuppressWarnings(\"deprecation\")";
+ }
+ out << nl << "public " << (hasAMD ? string("void") : retS) << ' ' << opName << spar << params;
+ if(!p->isLocal())
+ {
+ out << "Ice.Current __current";
+ }
+ out << epar;
+
+ if((*r)->hasMetaData("UserException"))
+ {
+ out.inc();
+ out << nl << "throws Ice.UserException";
+ out.dec();
+ }
+ else
+ {
+ ExceptionList throws = (*r)->throws();
+ throws.sort();
+ throws.unique();
+ writeThrowsClause(package, throws);
+ }
+ out << sb;
+ out << nl;
+ if(ret && !hasAMD)
+ {
+ out << "return ";
+ }
+ out << "_ice_delegate." << opName << spar << args;
+ if(!p->isLocal())
+ {
+ out << "__current";
+ }
+ out << epar << ';';
+ out << eb;
+ }
+
+ out << sp << nl << "private " << '_' << name << opIntfName << " _ice_delegate;";
+ out << sp << nl << "public static final long serialVersionUID = ";
+ string serialVersionUID;
+ if(p->findMetaData("java:serialVersionUID", serialVersionUID))
+ {
+ string::size_type pos = serialVersionUID.rfind(":") + 1;
+ if(pos == string::npos)
+ {
+ ostringstream os;
+ os << "ignoring invalid serialVersionUID for class `" << p->scoped() << "'; generating default value";
+ emitWarning("", "", os.str());
+ out << computeSerialVersionUUID(p);
+ }
+ else
+ {
+ Int64 v = 0;
+ serialVersionUID = serialVersionUID.substr(pos);
+ if(serialVersionUID != "0")
+ {
+ if(!stringToInt64(serialVersionUID, v)) // conversion error
+ {
+ ostringstream os;
+ os << "ignoring invalid serialVersionUID for class `" << p->scoped()
+ << "'; generating default value";
+ emitWarning("", "", os.str());
+ out << computeSerialVersionUUID(p);
+ }
+ }
+ out << v;
+ }
+ }
+ else
+ {
+ out << computeSerialVersionUUID(p);
+ }
+ out << "L;";
+ out << eb;
+ close();
+
+ return false;
+}
+
+Slice::GenCompat::PackageVisitor::PackageVisitor(const string& dir) :
+ JavaCompatVisitor(dir)
+{
+}
+
+bool
+Slice::GenCompat::PackageVisitor::visitModuleStart(const ModulePtr& p)
+{
+ string prefix = getPackagePrefix(p);
+ if(!prefix.empty())
+ {
+ string markerClass = prefix + "." + fixKwd(p->name()) + "._Marker";
+ open(markerClass, p->file());
+
+ Output& out = output();
+
+ out << sp << nl << "interface _Marker";
+ out << sb;
+ out << eb;
+
+ close();
+ }
+ return false;
+}
+
+Slice::GenCompat::TypesVisitor::TypesVisitor(const string& dir) :
+ JavaCompatVisitor(dir)
+{
+}
+
+bool
+Slice::GenCompat::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
+{
+ string name = p->name();
+ ClassList bases = p->bases();
+ ClassDefPtr baseClass;
+ if(!bases.empty() && !bases.front()->isInterface())
+ {
+ baseClass = bases.front();
+ }
+
+ string package = getPackage(p);
+ string absolute = getAbsolute(p);
+ DataMemberList members = p->dataMembers();
+ DataMemberList allDataMembers = p->allDataMembers();
+
+ open(absolute, p->file());
+
+ Output& out = output();
+
+ //
+ // Slice interfaces map to Java interfaces.
+ //
+ out << sp;
+ writeDocComment(out, p, getDeprecateReason(p, 0, p->isInterface() ? "interface" : "class"));
+ if(p->isInterface())
+ {
+ out << nl << "public interface " << fixKwd(name);
+ if(!p->isLocal())
+ {
+ out << " extends ";
+ out.useCurrentPosAsIndent();
+ out << "Ice.Object";
+ out << "," << nl << '_' << name;
+ out << "Operations, _" << name << "OperationsNC";
+ }
+ else
+ {
+ if(!bases.empty())
+ {
+ out << " extends ";
+ }
+ out.useCurrentPosAsIndent();
+ }
+
+ ClassList::const_iterator q = bases.begin();
+ if(p->isLocal() && q != bases.end())
+ {
+ out << getAbsolute(*q++, package);
+ }
+ while(q != bases.end())
+ {
+ out << ',' << nl << getAbsolute(*q, package);
+ q++;
+ }
+ out.restoreIndent();
+ }
+ else
+ {
+ out << nl << "public ";
+ if(p->allOperations().size() > 0) // Don't use isAbstract() - see bug 3739
+ {
+ out << "abstract ";
+ }
+ out << "class " << fixKwd(name);
+ out.useCurrentPosAsIndent();
+
+ StringList implements;
+ bool implementsOnNewLine = true;
+
+ if(bases.empty() || bases.front()->isInterface())
+ {
+ if(p->isLocal())
+ {
+ implementsOnNewLine = false;
+ implements.push_back("java.lang.Cloneable");
+ }
+ else
+ {
+ out << " extends Ice.ObjectImpl";
+ }
+ }
+ else
+ {
+ out << " extends ";
+ out << getAbsolute(baseClass, package);
+ bases.pop_front();
+ }
+
+ //
+ // Implement interfaces
+ //
+
+ if(p->isAbstract())
+ {
+ if(!p->isLocal())
+ {
+ implements.push_back("_" + name + "Operations");
+ implements.push_back("_" + name + "OperationsNC");
+ }
+ }
+ if(!bases.empty())
+ {
+ for(ClassList::const_iterator q = bases.begin(); q != bases.end();)
+ {
+ implements.push_back(getAbsolute(*q, package));
+ q++;
+ }
+ }
+
+ if(!implements.empty())
+ {
+ if(implementsOnNewLine)
+ {
+ out << nl;
+ }
+
+ out << " implements ";
+ out.useCurrentPosAsIndent();
+
+ for(StringList::const_iterator q = implements.begin(); q != implements.end();)
+ {
+ if(q != implements.begin())
+ {
+ out << ',' << nl;
+ }
+ out << *q;
+ q++;
+ }
+
+ out.restoreIndent();
+ }
+
+ out.restoreIndent();
+ }
+
+ out << sb;
+
+ //
+ // For local classes and interfaces, we don't use the OperationsNC interface.
+ // Instead, we generate the operation signatures directly into the class
+ // or interface.
+ //
+ if(p->isLocal())
+ {
+ OperationList ops = p->operations();
+ for(OperationList::iterator r = ops.begin(); r != ops.end(); ++r)
+ {
+ OperationPtr op = *r;
+ const ContainerPtr container = op->container();
+ const ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ const string opname = op->name();
+ const bool optionalMapping = useOptionalMapping(op);
+
+ const TypePtr ret = op->returnType();
+ vector<string> params = getParams(op, package, true, optionalMapping);
+
+ string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData(), true,
+ optionalMapping && op->returnIsOptional());
+ ExceptionList throws = op->throws();
+ throws.sort();
+ throws.unique();
+ out << sp;
+
+ writeDocComment(out, *r, getDeprecateReason(*r, p, "operation"));
+ out << nl;
+ if(!p->isInterface())
+ {
+ out << "public abstract ";
+ }
+ out << retS << ' ' << fixKwd(opname) << spar << params << epar;
+ if(op->hasMetaData("UserException"))
+ {
+ out.inc();
+ out << nl << "throws Ice.UserException";
+ out.dec();
+ }
+ else
+ {
+ writeThrowsClause(package, throws);
+ }
+ out << ';';
+
+ //
+ // Generate asynchronous API for local operations marked with "async-oneway" metadata.
+ //
+ if(p->hasMetaData("async-oneway") || op->hasMetaData("async-oneway"))
+ {
+ vector<string> inParams = getInOutParams(op, package, InParam, true, true);
+
+ out << sp;
+ writeDocCommentAMI(out, op, InParam);
+ out << nl;
+ if(!p->isInterface())
+ {
+ out << "public abstract ";
+ }
+ out << "Ice.AsyncResult begin_" << opname << spar << inParams << epar << ';';
+
+ out << sp;
+ writeDocCommentAMI(out, op, InParam);
+ out << nl;
+ if(!p->isInterface())
+ {
+ out << "public abstract ";
+ }
+ out << "Ice.AsyncResult begin_" << opname << spar << inParams << "Ice.Callback __cb" << epar << ';';
+
+ out << sp;
+ writeDocCommentAMI(out, op, InParam);
+ out << nl;
+ if(!p->isInterface())
+ {
+ out << "public abstract ";
+ }
+ string cb = "Callback_" + name + "_" + opname + " __cb";
+ out << "Ice.AsyncResult begin_" << opname << spar << inParams << cb << epar << ';';
+
+
+ out << sp;
+ writeDocCommentAMI(out, op, InParam);
+ out << nl;
+ if(!p->isInterface())
+ {
+ out << "public abstract ";
+ }
+ out << nl << "Ice.AsyncResult begin_" << opname;
+ writeParamList(out, getParamsAsyncLambda(op, package, false, true));
+ out << ';';
+
+ vector<string> outParams = getInOutParams(op, package, OutParam, true, true);
+ out << sp;
+ writeDocCommentAMI(out, op, OutParam);
+ out << nl;
+ if(!p->isInterface())
+ {
+ out << "public abstract ";
+ }
+
+ out << retS << " end_" << opname << spar << outParams << "Ice.AsyncResult __result" << epar << ';';
+ }
+ }
+ }
+
+ if(!p->isInterface() && !allDataMembers.empty())
+ {
+ bool hasOptionalMembers = false;
+ bool hasRequiredMembers = false;
+
+ for(DataMemberList::const_iterator d = allDataMembers.begin(); d != allDataMembers.end(); ++d)
+ {
+ if((*d)->optional())
+ {
+ hasOptionalMembers = true;
+ }
+ else
+ {
+ hasRequiredMembers = true;
+ }
+ }
+
+ //
+ // Default constructor.
+ //
+ out << sp;
+ out << nl << "public " << fixKwd(name) << "()";
+ out << sb;
+ if(baseClass)
+ {
+ out << nl << "super();";
+ }
+ writeDataMemberInitializers(out, members, package);
+ out << eb;
+
+ //
+ // A method cannot have more than 255 parameters (including the implicit "this" argument).
+ //
+ if(allDataMembers.size() < 255)
+ {
+ DataMemberList baseDataMembers;
+ if(baseClass)
+ {
+ baseDataMembers = baseClass->allDataMembers();
+ }
+
+ if(hasRequiredMembers && hasOptionalMembers)
+ {
+ //
+ // Generate a constructor accepting parameters for just the required members.
+ //
+ out << sp << nl << "public " << fixKwd(name) << spar;
+ vector<string> paramDecl;
+ for(DataMemberList::const_iterator d = allDataMembers.begin(); d != allDataMembers.end(); ++d)
+ {
+ if(!(*d)->optional())
+ {
+ string memberName = fixKwd((*d)->name());
+ string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData());
+ paramDecl.push_back(memberType + " " + memberName);
+ }
+ }
+ out << paramDecl << epar;
+ out << sb;
+ if(!baseDataMembers.empty())
+ {
+ bool hasBaseRequired = false;
+ for(DataMemberList::const_iterator d = baseDataMembers.begin(); d != baseDataMembers.end(); ++d)
+ {
+ if(!(*d)->optional())
+ {
+ hasBaseRequired = true;
+ break;
+ }
+ }
+ if(hasBaseRequired)
+ {
+ out << nl << "super" << spar;
+ vector<string> baseParamNames;
+ for(DataMemberList::const_iterator d = baseDataMembers.begin(); d != baseDataMembers.end(); ++d)
+ {
+ if(!(*d)->optional())
+ {
+ baseParamNames.push_back(fixKwd((*d)->name()));
+ }
+ }
+ out << baseParamNames << epar << ';';
+ }
+ }
+
+ for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
+ {
+ if(!(*d)->optional())
+ {
+ string paramName = fixKwd((*d)->name());
+ out << nl << "this." << paramName << " = " << paramName << ';';
+ }
+ }
+ writeDataMemberInitializers(out, p->orderedOptionalDataMembers(), package);
+ out << eb;
+ }
+
+ //
+ // Generate a constructor accepting parameters for all members.
+ //
+ out << sp << nl << "public " << fixKwd(name) << spar;
+ vector<string> paramDecl;
+ for(DataMemberList::const_iterator d = allDataMembers.begin(); d != allDataMembers.end(); ++d)
+ {
+ string memberName = fixKwd((*d)->name());
+ string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData());
+ paramDecl.push_back(memberType + " " + memberName);
+ }
+ out << paramDecl << epar;
+ out << sb;
+ if(baseClass && allDataMembers.size() != members.size())
+ {
+ out << nl << "super" << spar;
+ vector<string> baseParamNames;
+ for(DataMemberList::const_iterator d = baseDataMembers.begin(); d != baseDataMembers.end(); ++d)
+ {
+ baseParamNames.push_back(fixKwd((*d)->name()));
+ }
+ out << baseParamNames << epar << ';';
+ }
+ for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
+ {
+ string paramName = fixKwd((*d)->name());
+ if((*d)->optional())
+ {
+ string capName = paramName;
+ capName[0] = toupper(static_cast<unsigned char>(capName[0]));
+ out << nl << "set" << capName << '(' << paramName << ");";
+ }
+ else
+ {
+ out << nl << "this." << paramName << " = " << paramName << ';';
+ }
+ }
+ out << eb;
+ }
+ }
+
+ //
+ // Default factory for non-abstract classes.
+ //
+ if(!p->isInterface() && p->allOperations().size() == 0 && !p->isLocal())
+ {
+ out << sp;
+ out << nl << "private static class __F implements Ice.ValueFactory";
+ out << sb;
+ out << nl << "public Ice.Object create(String type)";
+ out << sb;
+ out << nl << "assert(type.equals(ice_staticId()));";
+ out << nl << "return new " << fixKwd(name) << "();";
+ out << eb;
+ out << eb;
+ out << nl << "private static Ice.ValueFactory _factory = new __F();";
+ out << sp;
+ out << nl << "public static Ice.ValueFactory" << nl << "ice_factory()";
+ out << sb;
+ out << nl << "return _factory;";
+ out << eb;
+ }
+
+ //
+ // Marshalling & dispatch support.
+ //
+ if(!p->isInterface() && !p->isLocal())
+ {
+ writeDispatchAndMarshalling(out, p);
+ }
+
+ return true;
+}
+
+void
+Slice::GenCompat::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p)
+{
+ Output& out = output();
+
+ ClassList bases = p->bases();
+ ClassDefPtr baseClass;
+ if(!bases.empty() && !bases.front()->isInterface())
+ {
+ baseClass = bases.front();
+ }
+
+ string name = fixKwd(p->name());
+
+ if(!p->isInterface())
+ {
+ out << sp << nl << "public " << name << nl << "clone()";
+ out << sb;
+
+ if(p->isLocal() && !baseClass)
+ {
+ out << nl << name << " c = null;";
+ out << nl << "try";
+ out << sb;
+ out << nl << "c = (" << name << ")super.clone();";
+ out << eb;
+ out << nl << "catch(CloneNotSupportedException ex)";
+ out << sb;
+ out << nl << "assert false; // impossible";
+ out << eb;
+ out << nl << "return c;";
+
+ }
+ else
+ {
+ out << nl << "return (" << name << ")super.clone();";
+ }
+ out << eb;
+ }
+
+ if(p->isInterface() && !p->isLocal())
+ {
+ out << sp << nl << "public static final String ice_staticId = \"" << p->scoped() << "\";";
+ }
+
+ out << sp << nl << "public static final long serialVersionUID = ";
+ string serialVersionUID;
+ if(p->findMetaData("java:serialVersionUID", serialVersionUID))
+ {
+ string::size_type pos = serialVersionUID.rfind(":") + 1;
+ if(pos == string::npos)
+ {
+ ostringstream os;
+ os << "ignoring invalid serialVersionUID for class `" << p->scoped() << "'; generating default value";
+ emitWarning("", "", os.str());
+ out << computeSerialVersionUUID(p);
+ }
+ else
+ {
+ Int64 v = 0;
+ serialVersionUID = serialVersionUID.substr(pos);
+ if(serialVersionUID != "0")
+ {
+ if(!stringToInt64(serialVersionUID, v)) // conversion error
+ {
+ ostringstream os;
+ os << "ignoring invalid serialVersionUID for class `" << p->scoped()
+ << "'; generating default value";
+ emitWarning("", "", os.str());
+ out << computeSerialVersionUUID(p);
+ }
+ }
+ out << v;
+ }
+ }
+ else
+ {
+ out << computeSerialVersionUUID(p);
+ }
+ out << "L;";
+ out << eb;
+ close();
+}
+
+bool
+Slice::GenCompat::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
+{
+ string name = fixKwd(p->name());
+ string scoped = p->scoped();
+ ExceptionPtr base = p->base();
+ string package = getPackage(p);
+ string absolute = getAbsolute(p);
+ DataMemberList members = p->dataMembers();
+ DataMemberList allDataMembers = p->allDataMembers();
+
+ open(absolute, p->file());
+
+ Output& out = output();
+
+ out << sp;
+
+ writeDocComment(out, p, getDeprecateReason(p, 0, "type"));
+
+ out << nl << "public class " << name << " extends ";
+
+ if(!base)
+ {
+ if(p->isLocal())
+ {
+ out << "Ice.LocalException";
+ }
+ else
+ {
+ out << "Ice.UserException";
+ }
+ }
+ else
+ {
+ out << getAbsolute(base, package);
+ }
+ out << sb;
+
+ //
+ // Default constructor.
+ //
+ out << sp;
+ out << nl << "public " << name << "()";
+ out << sb;
+ if(base)
+ {
+ out << nl << "super();";
+ }
+ writeDataMemberInitializers(out, members, package);
+ out << eb;
+
+ out << sp;
+ out << nl << "public " << name << "(Throwable __cause)";
+ out << sb;
+ out << nl << "super(__cause);";
+ writeDataMemberInitializers(out, members, package);
+ out << eb;
+
+ bool hasOptionalMembers = false;
+ bool hasRequiredMembers = false;
+ for(DataMemberList::const_iterator d = allDataMembers.begin(); d != allDataMembers.end(); ++d)
+ {
+ if((*d)->optional())
+ {
+ hasOptionalMembers = true;
+ }
+ else
+ {
+ hasRequiredMembers = true;
+ }
+ }
+
+ if(!allDataMembers.empty())
+ {
+ DataMemberList baseDataMembers;
+ if(base)
+ {
+ baseDataMembers = base->allDataMembers();
+ }
+
+ //
+ // A method cannot have more than 255 parameters (including the implicit "this" argument).
+ //
+ if(allDataMembers.size() < 255)
+ {
+ if(hasRequiredMembers && hasOptionalMembers)
+ {
+ bool hasBaseRequired = false;
+ for(DataMemberList::const_iterator d = baseDataMembers.begin(); d != baseDataMembers.end(); ++d)
+ {
+ if(!(*d)->optional())
+ {
+ hasBaseRequired = true;
+ break;
+ }
+ }
+
+ DataMemberList optionalMembers = p->orderedOptionalDataMembers();
+
+ //
+ // Generate a constructor accepting parameters for just the required members.
+ //
+ out << sp << nl << "public " << name << spar;
+ vector<string> paramDecl;
+ for(DataMemberList::const_iterator d = allDataMembers.begin(); d != allDataMembers.end(); ++d)
+ {
+ if(!(*d)->optional())
+ {
+ string memberName = fixKwd((*d)->name());
+ string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData());
+ paramDecl.push_back(memberType + " " + memberName);
+ }
+ }
+ out << paramDecl << epar;
+ out << sb;
+ if(!baseDataMembers.empty())
+ {
+ if(hasBaseRequired)
+ {
+ out << nl << "super" << spar;
+ vector<string> baseParamNames;
+ for(DataMemberList::const_iterator d = baseDataMembers.begin(); d != baseDataMembers.end(); ++d)
+ {
+ if(!(*d)->optional())
+ {
+ baseParamNames.push_back(fixKwd((*d)->name()));
+ }
+ }
+ out << baseParamNames << epar << ';';
+ }
+ }
+
+ for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
+ {
+ if(!(*d)->optional())
+ {
+ string paramName = fixKwd((*d)->name());
+ out << nl << "this." << paramName << " = " << paramName << ';';
+ }
+ }
+ writeDataMemberInitializers(out, optionalMembers, package);
+ out << eb;
+
+ //
+ // Create constructor that takes all data members plus a Throwable.
+ //
+ if(allDataMembers.size() < 254)
+ {
+ paramDecl.push_back("Throwable __cause");
+ out << sp << nl << "public " << name << spar;
+ out << paramDecl << epar;
+ out << sb;
+ if(hasBaseRequired)
+ {
+ out << nl << "super" << spar;
+ vector<string> baseParamNames;
+ for(DataMemberList::const_iterator d = baseDataMembers.begin(); d != baseDataMembers.end(); ++d)
+ {
+ if(!(*d)->optional())
+ {
+ baseParamNames.push_back(fixKwd((*d)->name()));
+ }
+ }
+ baseParamNames.push_back("__cause");
+ out << baseParamNames << epar << ';';
+ }
+ else
+ {
+ out << nl << "super(__cause);";
+ }
+ for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
+ {
+ if(!(*d)->optional())
+ {
+ string paramName = fixKwd((*d)->name());
+ out << nl << "this." << paramName << " = " << paramName << ';';
+ }
+ }
+ writeDataMemberInitializers(out, optionalMembers, package);
+ out << eb;
+ }
+ }
+
+ out << sp << nl << "public " << name << spar;
+ vector<string> paramDecl;
+ for(DataMemberList::const_iterator d = allDataMembers.begin(); d != allDataMembers.end(); ++d)
+ {
+ string memberName = fixKwd((*d)->name());
+ string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData());
+ paramDecl.push_back(memberType + " " + memberName);
+ }
+ out << paramDecl << epar;
+ out << sb;
+ if(base && allDataMembers.size() != members.size())
+ {
+ out << nl << "super" << spar;
+ vector<string> baseParamNames;
+ DataMemberList baseDataMembers = base->allDataMembers();
+ for(DataMemberList::const_iterator d = baseDataMembers.begin(); d != baseDataMembers.end(); ++d)
+ {
+ baseParamNames.push_back(fixKwd((*d)->name()));
+ }
+
+ out << baseParamNames << epar << ';';
+ }
+ for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
+ {
+ string paramName = fixKwd((*d)->name());
+ if((*d)->optional())
+ {
+ string capName = paramName;
+ capName[0] = toupper(static_cast<unsigned char>(capName[0]));
+ out << nl << "set" << capName << '(' << paramName << ");";
+ }
+ else
+ {
+ out << nl << "this." << paramName << " = " << paramName << ';';
+ }
+ }
+ out << eb;
+
+ //
+ // Create constructor that takes all data members plus a Throwable
+ //
+ if(allDataMembers.size() < 254)
+ {
+ paramDecl.push_back("Throwable __cause");
+ out << sp << nl << "public " << name << spar;
+ out << paramDecl << epar;
+ out << sb;
+ if(!base)
+ {
+ out << nl << "super(__cause);";
+ }
+ else
+ {
+ out << nl << "super" << spar;
+ vector<string> baseParamNames;
+ DataMemberList baseDataMembers = base->allDataMembers();
+ for(DataMemberList::const_iterator d = baseDataMembers.begin(); d != baseDataMembers.end(); ++d)
+ {
+ baseParamNames.push_back(fixKwd((*d)->name()));
+ }
+ baseParamNames.push_back("__cause");
+ out << baseParamNames << epar << ';';
+ }
+ for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
+ {
+ string paramName = fixKwd((*d)->name());
+ if((*d)->optional())
+ {
+ string capName = paramName;
+ capName[0] = toupper(static_cast<unsigned char>(capName[0]));
+ out << nl << "set" << capName << '(' << paramName << ");";
+ }
+ else
+ {
+ out << nl << "this." << paramName << " = " << paramName << ';';
+ }
+ }
+ out << eb;
+ }
+ }
+ }
+
+ out << sp << nl << "public String" << nl << "ice_id()";
+ out << sb;
+ out << nl << "return \"" << scoped << "\";";
+ out << eb;
+
+ return true;
+}
+
+void
+Slice::GenCompat::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
+{
+ Output& out = output();
+
+ if(!p->isLocal())
+ {
+ string name = fixKwd(p->name());
+ string scoped = p->scoped();
+ string package = getPackage(p);
+ ExceptionPtr base = p->base();
+ bool basePreserved = p->inheritsMetaData("preserve-slice");
+ bool preserved = p->hasMetaData("preserve-slice");
+
+ DataMemberList members = p->dataMembers();
+ DataMemberList optionalMembers = p->orderedOptionalDataMembers();
+ int iter;
+
+ if(preserved && !basePreserved)
+ {
+
+ out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __os)";
+ out << sb;
+ out << nl << "__os.startException(__slicedData);";
+ out << nl << "__writeImpl(__os);";
+ out << nl << "__os.endException();";
+ out << eb;
+
+ out << sp << nl << "public void" << nl << "__read(Ice.InputStream __is)";
+ out << sb;
+ out << nl << "__is.startException();";
+ out << nl << "__readImpl(__is);";
+ out << nl << "__slicedData = __is.endException(true);";
+ out << eb;
+ }
+
+ out << sp << nl << "protected void" << nl << "__writeImpl(Ice.OutputStream __os)";
+ out << sb;
+ out << nl << "__os.startSlice(\"" << scoped << "\", -1, " << (!base ? "true" : "false") << ");";
+ iter = 0;
+ for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
+ {
+ if(!(*d)->optional())
+ {
+ writeMarshalDataMember(out, package, *d, iter);
+ }
+ }
+ for(DataMemberList::const_iterator d = optionalMembers.begin(); d != optionalMembers.end(); ++d)
+ {
+ writeMarshalDataMember(out, package, *d, iter);
+ }
+ out << nl << "__os.endSlice();";
+ if(base)
+ {
+ out << nl << "super.__writeImpl(__os);";
+ }
+ out << eb;
+
+ DataMemberList classMembers = p->classDataMembers();
+ DataMemberList allClassMembers = p->allClassDataMembers();
+
+ if(classMembers.size() != 0)
+ {
+ writePatcher(out, package, classMembers, optionalMembers);
+ }
+ out << sp << nl << "protected void" << nl << "__readImpl(Ice.InputStream __is)";
+ out << sb;
+ out << nl << "__is.startSlice();";
+ iter = 0;
+ int patchIter = 0;
+ const bool needCustomPatcher = classMembers.size() > 1;
+ for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
+ {
+ if(!(*d)->optional())
+ {
+ writeUnmarshalDataMember(out, package, *d, iter, needCustomPatcher, patchIter);
+ }
+ }
+ for(DataMemberList::const_iterator d = optionalMembers.begin(); d != optionalMembers.end(); ++d)
+ {
+ writeUnmarshalDataMember(out, package, *d, iter, needCustomPatcher, patchIter);
+ }
+ out << nl << "__is.endSlice();";
+ if(base)
+ {
+ out << nl << "super.__readImpl(__is);";
+ }
+ out << eb;
+
+ if(p->usesClasses(false))
+ {
+ if(!base || (base && !base->usesClasses(false)))
+ {
+ out << sp << nl << "public boolean" << nl << "__usesClasses()";
+ out << sb;
+ out << nl << "return true;";
+ out << eb;
+ }
+ }
+
+ if(preserved && !basePreserved)
+ {
+ out << sp << nl << "protected Ice.SlicedData __slicedData;";
+ }
+ }
+
+ out << sp << nl << "public static final long serialVersionUID = ";
+ string serialVersionUID;
+ if(p->findMetaData("java:serialVersionUID", serialVersionUID))
+ {
+ string::size_type pos = serialVersionUID.rfind(":") + 1;
+ if(pos == string::npos)
+ {
+ ostringstream os;
+ os << "ignoring invalid serialVersionUID for exception `" << p->scoped() << "'; generating default value";
+ emitWarning("", "", os.str());
+ out << computeSerialVersionUUID(p);
+ }
+ else
+ {
+ Int64 v = 0;
+ serialVersionUID = serialVersionUID.substr(pos);
+ if(serialVersionUID != "0")
+ {
+ if(!stringToInt64(serialVersionUID, v)) // conversion error
+ {
+ ostringstream os;
+ os << "ignoring invalid serialVersionUID for exception `" << p->scoped()
+ << "'; generating default value";
+ emitWarning("", "", os.str());
+ out << computeSerialVersionUUID(p);
+ }
+ }
+ out << v;
+ }
+ }
+ else
+ {
+ out << computeSerialVersionUUID(p);
+ }
+ out << "L;";
+
+ out << eb;
+ close();
+}
+
+bool
+Slice::GenCompat::TypesVisitor::visitStructStart(const StructPtr& p)
+{
+ string name = fixKwd(p->name());
+ string absolute = getAbsolute(p);
+
+ open(absolute, p->file());
+
+ Output& out = output();
+
+ out << sp;
+
+ writeDocComment(out, p, getDeprecateReason(p, 0, "type"));
+
+ out << nl << "public class " << name << " implements java.lang.Cloneable";
+ if(!p->isLocal())
+ {
+ out << ", java.io.Serializable";
+ }
+ out << sb;
+
+ return true;
+}
+
+void
+Slice::GenCompat::TypesVisitor::visitStructEnd(const StructPtr& p)
+{
+ string package = getPackage(p);
+
+ Output& out = output();
+
+ DataMemberList members = p->dataMembers();
+ int iter;
+
+ string name = fixKwd(p->name());
+ string typeS = typeToString(p, TypeModeIn, package);
+
+ out << sp << nl << "public " << name << "()";
+ out << sb;
+ writeDataMemberInitializers(out, members, package);
+ out << eb;
+
+ //
+ // A method cannot have more than 255 parameters (including the implicit "this" argument).
+ //
+ if(members.size() < 255)
+ {
+ vector<string> paramDecl;
+ vector<string> paramNames;
+ for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
+ {
+ string memberName = fixKwd((*d)->name());
+ string memberType = typeToString((*d)->type(), TypeModeMember, package, (*d)->getMetaData());
+ paramDecl.push_back(memberType + " " + memberName);
+ paramNames.push_back(memberName);
+ }
+
+ out << sp << nl << "public " << name << spar << paramDecl << epar;
+ out << sb;
+ for(vector<string>::const_iterator i = paramNames.begin(); i != paramNames.end(); ++i)
+ {
+ out << nl << "this." << *i << " = " << *i << ';';
+ }
+ out << eb;
+ }
+
+ out << sp << nl << "public boolean" << nl << "equals(java.lang.Object rhs)";
+ out << sb;
+ out << nl << "if(this == rhs)";
+ out << sb;
+ out << nl << "return true;";
+ out << eb;
+ out << nl << typeS << " _r = null;";
+ out << nl << "if(rhs instanceof " << typeS << ")";
+ out << sb;
+ out << nl << "_r = (" << typeS << ")rhs;";
+ out << eb;
+ out << sp << nl << "if(_r != null)";
+ out << sb;
+ for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
+ {
+ string memberName = fixKwd((*d)->name());
+ BuiltinPtr b = BuiltinPtr::dynamicCast((*d)->type());
+ if(b)
+ {
+ switch(b->kind())
+ {
+ case Builtin::KindByte:
+ case Builtin::KindBool:
+ case Builtin::KindShort:
+ case Builtin::KindInt:
+ case Builtin::KindLong:
+ case Builtin::KindFloat:
+ case Builtin::KindDouble:
+ {
+ out << nl << "if(" << memberName << " != _r." << memberName << ')';
+ out << sb;
+ out << nl << "return false;";
+ out << eb;
+ break;
+ }
+
+ case Builtin::KindString:
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ case Builtin::KindLocalObject:
+ case Builtin::KindValue:
+ {
+ out << nl << "if(" << memberName << " != _r." << memberName << ')';
+ out << sb;
+ out << nl << "if(" << memberName << " == null || _r." << memberName << " == null || !"
+ << memberName << ".equals(_r." << memberName << "))";
+ out << sb;
+ out << nl << "return false;";
+ out << eb;
+ out << eb;
+ break;
+ }
+ }
+ }
+ else
+ {
+ //
+ // We treat sequences differently because the native equals() method for
+ // a Java array does not perform a deep comparison. If the mapped type
+ // is not overridden via metadata, we use the helper method
+ // java.util.Arrays.equals() to compare native arrays.
+ //
+ // For all other types, we can use the native equals() method.
+ //
+ SequencePtr seq = SequencePtr::dynamicCast((*d)->type());
+ if(seq)
+ {
+ if(hasTypeMetaData(seq, (*d)->getMetaData()))
+ {
+ out << nl << "if(" << memberName << " != _r." << memberName << ')';
+ out << sb;
+ out << nl << "if(" << memberName << " == null || _r." << memberName << " == null || !"
+ << memberName << ".equals(_r." << memberName << "))";
+ out << sb;
+ out << nl << "return false;";
+ out << eb;
+ out << eb;
+ }
+ else
+ {
+ //
+ // Arrays.equals() handles null values.
+ //
+ out << nl << "if(!java.util.Arrays.equals(" << memberName << ", _r." << memberName << "))";
+ out << sb;
+ out << nl << "return false;";
+ out << eb;
+ }
+ }
+ else
+ {
+ out << nl << "if(" << memberName << " != _r." << memberName << ')';
+ out << sb;
+ out << nl << "if(" << memberName << " == null || _r." << memberName << " == null || !"
+ << memberName << ".equals(_r." << memberName << "))";
+ out << sb;
+ out << nl << "return false;";
+ out << eb;
+ out << eb;
+ }
+ }
+ }
+ out << sp << nl << "return true;";
+ out << eb;
+ out << sp << nl << "return false;";
+ out << eb;
+
+ out << sp << nl << "public int" << nl << "hashCode()";
+ out << sb;
+ out << nl << "int __h = 5381;";
+ out << nl << "__h = IceInternal.HashUtil.hashAdd(__h, \"" << p->scoped() << "\");";
+ iter = 0;
+ for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
+ {
+ string memberName = fixKwd((*d)->name());
+ out << nl << "__h = IceInternal.HashUtil.hashAdd(__h, " << memberName << ");";
+ }
+ out << nl << "return __h;";
+ out << eb;
+
+ out << sp << nl << "public " << name << nl << "clone()";
+ out << sb;
+ out << nl << name << " c = null;";
+ out << nl << "try";
+ out << sb;
+ out << nl << "c = (" << name << ")super.clone();";
+ out << eb;
+ out << nl << "catch(CloneNotSupportedException ex)";
+ out << sb;
+ out << nl << "assert false; // impossible";
+ out << eb;
+ out << nl << "return c;";
+ out << eb;
+
+ if(!p->isLocal())
+ {
+ out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __os)";
+ out << sb;
+ iter = 0;
+ for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
+ {
+ writeMarshalDataMember(out, package, *d, iter);
+ }
+ out << eb;
+
+ DataMemberList classMembers = p->classDataMembers();
+
+ if(classMembers.size() != 0)
+ {
+ writePatcher(out, package, classMembers, DataMemberList());
+ }
+
+ out << sp << nl << "public void" << nl << "__read(Ice.InputStream __is)";
+ out << sb;
+ iter = 0;
+ int patchIter = 0;
+ const bool needCustomPatcher = classMembers.size() > 1;
+ for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
+ {
+ writeUnmarshalDataMember(out, package, *d, iter, needCustomPatcher, patchIter);
+ }
+ out << eb;
+
+ out << sp << nl << "static public void" << nl << "write(Ice.OutputStream __os, " << name << " __v)";
+ out << sb;
+ out << nl << "if(__v == null)";
+ out << sb;
+ out << nl << "__nullMarshalValue.__write(__os);";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << "__v.__write(__os);";
+ out << eb;
+ out << eb;
+
+ out << sp << nl << "static public " << name << nl << "read(Ice.InputStream __is, " << name << " __v)";
+ out << sb;
+ out << nl << "if(__v == null)";
+ out << sb;
+ out << nl << " __v = new " << name << "();";
+ out << eb;
+ out << nl << "__v.__read(__is);";
+ out << nl << "return __v;";
+ out << eb;
+
+ out << nl << nl << "private static final " << name << " __nullMarshalValue = new " << name << "();";
+ }
+
+ out << sp << nl << "public static final long serialVersionUID = ";
+ string serialVersionUID;
+ if(p->findMetaData("java:serialVersionUID", serialVersionUID))
+ {
+ string::size_type pos = serialVersionUID.rfind(":") + 1;
+ if(pos == string::npos)
+ {
+ ostringstream os;
+ os << "ignoring invalid serialVersionUID for struct `" << p->scoped() << "'; generating default value";
+ emitWarning("", "", os.str());
+ out << computeSerialVersionUUID(p);
+ }
+ else
+ {
+ Int64 v = 0;
+ serialVersionUID = serialVersionUID.substr(pos);
+ if(serialVersionUID != "0")
+ {
+ if(!stringToInt64(serialVersionUID, v)) // conversion error
+ {
+ ostringstream os;
+ os << "ignoring invalid serialVersionUID for struct `" << p->scoped()
+ << "'; generating default value";
+ emitWarning("", "", os.str());
+ out << computeSerialVersionUUID(p);
+ }
+ }
+ out << v;
+ }
+ }
+ else
+ {
+ out << computeSerialVersionUUID(p);
+ }
+ out << "L;";
+
+ out << eb;
+ close();
+}
+
+void
+Slice::GenCompat::TypesVisitor::visitDataMember(const DataMemberPtr& p)
+{
+ string name = fixKwd(p->name());
+ ContainerPtr container = p->container();
+ ContainedPtr contained = ContainedPtr::dynamicCast(container);
+ StringList metaData = p->getMetaData();
+ TypePtr type = p->type();
+ string s = typeToString(type, TypeModeMember, getPackage(contained), metaData);
+ Output& out = output();
+ const bool optional = p->optional();
+ const bool getSet = p->hasMetaData(_getSetMetaData) || contained->hasMetaData(_getSetMetaData);
+
+ out << sp;
+
+ string deprecateReason = getDeprecateReason(p, contained, "member");
+ writeDocComment(out, p, deprecateReason);
+
+ //
+ // Access visibility for class data members can be controlled by metadata.
+ // If none is specified, the default is public.
+ //
+ if(contained->containedType() == Contained::ContainedTypeClass &&
+ (p->hasMetaData("protected") || contained->hasMetaData("protected")))
+ {
+ out << nl << "protected " << s << ' ' << name << ';';
+ }
+ else if(optional)
+ {
+ out << nl << "private " << s << ' ' << name << ';';
+ }
+ else
+ {
+ out << nl << "public " << s << ' ' << name << ';';
+ }
+
+ if(optional)
+ {
+ out << nl << "private boolean __has_" << p->name() << ';';
+ }
+
+ //
+ // Getter/Setter.
+ //
+ if(getSet || optional)
+ {
+ string capName = p->name();
+ capName[0] = toupper(static_cast<unsigned char>(capName[0]));
+
+ //
+ // If container is a class, get all of its operations so that we can check for conflicts.
+ //
+ OperationList ops;
+ string file, line;
+ ClassDefPtr cls = ClassDefPtr::dynamicCast(container);
+ if(cls)
+ {
+ ops = cls->allOperations();
+ file = p->file();
+ line = p->line();
+ if(!validateMethod(ops, "get" + capName, 0, file, line) ||
+ !validateMethod(ops, "set" + capName, 1, file, line))
+ {
+ return;
+ }
+ if(optional &&
+ (!validateMethod(ops, "has" + capName, 0, file, line) ||
+ !validateMethod(ops, "clear" + capName, 0, file, line) ||
+ !validateMethod(ops, "optional" + capName, 0, file, line)))
+ {
+ return;
+ }
+ }
+
+ //
+ // Getter.
+ //
+ out << sp;
+ writeDocComment(out, p, deprecateReason);
+ out << nl << "public " << s
+ << nl << "get" << capName << "()";
+ out << sb;
+ if(optional)
+ {
+ out << nl << "if(!__has_" << p->name() << ')';
+ out << sb;
+ out << nl << "throw new java.lang.IllegalStateException(\"" << name << " is not set\");";
+ out << eb;
+ }
+ out << nl << "return " << name << ';';
+ out << eb;
+
+ //
+ // Setter.
+ //
+ out << sp;
+ writeDocComment(out, p, deprecateReason);
+ out << nl << "public void"
+ << nl << "set" << capName << '(' << s << " _" << name << ')';
+ out << sb;
+ if(optional)
+ {
+ out << nl << "__has_" << p->name() << " = true;";
+ }
+ out << nl << name << " = _" << name << ';';
+ out << eb;
+
+ //
+ // Generate hasFoo and clearFoo for optional member.
+ //
+ if(optional)
+ {
+ out << sp;
+ writeDocComment(out, p, deprecateReason);
+ out << nl << "public boolean"
+ << nl << "has" << capName << "()";
+ out << sb;
+ out << nl << "return __has_" << p->name() << ';';
+ out << eb;
+
+ out << sp;
+ writeDocComment(out, p, deprecateReason);
+ out << nl << "public void"
+ << nl << "clear" << capName << "()";
+ out << sb;
+ out << nl << "__has_" << p->name() << " = false;";
+ out << eb;
+
+ const string optType = typeToString(type, TypeModeMember, getPackage(contained), metaData, true, true);
+
+ out << sp;
+ writeDocComment(out, p, deprecateReason);
+ out << nl << "public void"
+ << nl << "optional" << capName << '(' << optType << " __v)";
+ out << sb;
+ out << nl << "if(__v == null || !__v.isSet())";
+ out << sb;
+ out << nl << "__has_" << p->name() << " = false;";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << "__has_" << p->name() << " = true;";
+ out << nl << name << " = __v.get();";
+ out << eb;
+ out << eb;
+
+ out << sp;
+ writeDocComment(out, p, deprecateReason);
+ out << nl << "public " << optType
+ << nl << "optional" << capName << "()";
+ out << sb;
+ out << nl << "if(__has_" << p->name() << ')';
+ out << sb;
+ out << nl << "return new " << optType << '(' << name << ");";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << "return new " << optType << "();";
+ out << eb;
+ out << eb;
+ }
+
+ //
+ // Check for bool type.
+ //
+ BuiltinPtr b = BuiltinPtr::dynamicCast(type);
+ if(b && b->kind() == Builtin::KindBool)
+ {
+ if(cls && !validateMethod(ops, "is" + capName, 0, file, line))
+ {
+ return;
+ }
+ out << sp;
+ if(!deprecateReason.empty())
+ {
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
+ }
+ out << nl << "public boolean";
+ out << nl << "is" << capName << "()";
+ out << sb;
+ if(optional)
+ {
+ out << nl << "if(!__has_" << p->name() << ')';
+ out << sb;
+ out << nl << "throw new java.lang.IllegalStateException(\"" << name << " is not set\");";
+ out << eb;
+ }
+ out << nl << "return " << name << ';';
+ out << eb;
+ }
+
+ //
+ // Check for unmodified sequence type and emit indexing methods.
+ //
+ SequencePtr seq = SequencePtr::dynamicCast(type);
+ if(seq)
+ {
+ if(!hasTypeMetaData(seq, metaData))
+ {
+ if(cls &&
+ (!validateMethod(ops, "get" + capName, 1, file, line) ||
+ !validateMethod(ops, "set" + capName, 2, file, line)))
+ {
+ return;
+ }
+
+ string elem = typeToString(seq->type(), TypeModeMember, getPackage(contained));
+
+ //
+ // Indexed getter.
+ //
+ out << sp;
+ if(!deprecateReason.empty())
+ {
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
+ }
+ out << nl << "public " << elem;
+ out << nl << "get" << capName << "(int _index)";
+ out << sb;
+ if(optional)
+ {
+ out << nl << "if(!__has_" << p->name() << ')';
+ out << sb;
+ out << nl << "throw new java.lang.IllegalStateException(\"" << name << " is not set\");";
+ out << eb;
+ }
+ out << nl << "return " << name << "[_index];";
+ out << eb;
+
+ //
+ // Indexed setter.
+ //
+ out << sp;
+ if(!deprecateReason.empty())
+ {
+ out << nl << "/**";
+ out << nl << " * @deprecated " << deprecateReason;
+ out << nl << " **/";
+ }
+ out << nl << "public void";
+ out << nl << "set" << capName << "(int _index, " << elem << " _val)";
+ out << sb;
+ if(optional)
+ {
+ out << nl << "if(!__has_" << p->name() << ')';
+ out << sb;
+ out << nl << "throw new java.lang.IllegalStateException(\"" << name << " is not set\");";
+ out << eb;
+ }
+ out << nl << name << "[_index] = _val;";
+ out << eb;
+ }
+ }
+ }
+}
+
+void
+Slice::GenCompat::TypesVisitor::visitEnum(const EnumPtr& p)
+{
+ string name = fixKwd(p->name());
+ string absolute = getAbsolute(p);
+ EnumeratorList enumerators = p->getEnumerators();
+
+ open(absolute, p->file());
+
+ Output& out = output();
+
+ out << sp;
+
+ writeDocComment(out, p, getDeprecateReason(p, 0, "type"));
+
+ out << nl << "public enum " << name;
+ if(!p->isLocal())
+ {
+ out << " implements java.io.Serializable";
+ }
+ out << sb;
+
+ for(EnumeratorList::const_iterator en = enumerators.begin(); en != enumerators.end(); ++en)
+ {
+ if(en != enumerators.begin())
+ {
+ out << ',';
+ }
+ out << nl;
+ writeDocComment(out, *en, getDeprecateReason(*en, 0, "enumerator"));
+ out << nl << fixKwd((*en)->name()) << '(' << (*en)->value() << ')';
+ }
+ out << ';';
+
+ out << sp << nl << "public int"
+ << nl << "value()";
+ out << sb;
+ out << nl << "return __value;";
+ out << eb;
+
+ out << sp << nl << "public static " << name
+ << nl << "valueOf(int __v)";
+ out << sb;
+ out << nl << "switch(__v)";
+ out << sb;
+ out.dec();
+ for(EnumeratorList::const_iterator en = enumerators.begin(); en != enumerators.end(); ++en)
+ {
+ out << nl << "case " << (*en)->value() << ':';
+ out.inc();
+ out << nl << "return " << fixKwd((*en)->name()) << ';';
+ out.dec();
+ }
+ out.inc();
+ out << eb;
+ out << nl << "return null;";
+ out << eb;
+
+ out << sp << nl << "private"
+ << nl << name << "(int __v)";
+ out << sb;
+ out << nl << "__value = __v;";
+ out << eb;
+
+ if(!p->isLocal())
+ {
+ out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __os)";
+ out << sb;
+ out << nl << "__os.writeEnum(value(), " << p->maxValue() << ");";
+ out << eb;
+
+ out << sp << nl << "public static void" << nl << "write(Ice.OutputStream __os, " << name << " __v)";
+ out << sb;
+ out << nl << "if(__v == null)";
+ out << sb;
+ string firstEnum = fixKwd(enumerators.front()->name());
+ out << nl << "__os.writeEnum(" << absolute << '.' << firstEnum << ".value(), " << p->maxValue() << ");";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << "__os.writeEnum(__v.value(), " << p->maxValue() << ");";
+ out << eb;
+ out << eb;
+
+ out << sp << nl << "public static " << name << nl << "read(Ice.InputStream __is)";
+ out << sb;
+ out << nl << "int __v = __is.readEnum(" << p->maxValue() << ");";
+ out << nl << "return __validate(__v);";
+ out << eb;
+
+ out << sp << nl << "private static " << name
+ << nl << "__validate(int __v)";
+ out << sb;
+ out << nl << "final " << name << " __e = valueOf(__v);";
+ out << nl << "if(__e == null)";
+ out << sb;
+ out << nl << "throw new Ice.MarshalException(\"enumerator value \" + __v + \" is out of range\");";
+ out << eb;
+ out << nl << "return __e;";
+ out << eb;
+ }
+
+ out << sp << nl << "private final int __value;";
+
+ out << eb;
+ close();
+}
+
+void
+Slice::GenCompat::TypesVisitor::visitConst(const ConstPtr& p)
+{
+ string name = fixKwd(p->name());
+ string package = getPackage(p);
+ string absolute = getAbsolute(p);
+ TypePtr type = p->type();
+
+ open(absolute, p->file());
+
+ Output& out = output();
+
+ out << sp;
+ writeDocComment(out, p, getDeprecateReason(p, 0, "constant"));
+ out << nl << "public interface " << name;
+ out << sb;
+ out << nl << typeToString(type, TypeModeIn, package) << " value = ";
+ writeConstantValue(out, type, p->valueType(), p->value(), package);
+ out << ';' << eb;
+ close();
+}
+
+bool
+Slice::GenCompat::TypesVisitor::validateMethod(const OperationList& ops, const std::string& name, int numArgs,
+ const string& file, const string& line)
+{
+ for(OperationList::const_iterator i = ops.begin(); i != ops.end(); ++i)
+ {
+ if((*i)->name() == name)
+ {
+ int numParams = static_cast<int>((*i)->parameters().size());
+ if(numArgs >= numParams && numArgs - numParams <= 1)
+ {
+ ostringstream ostr;
+ ostr << "operation `" << name << "' conflicts with method for data member";
+ emitError(file, line, ostr.str());
+ return false;
+ }
+ break;
+ }
+ }
+ return true;
+}
+
+Slice::GenCompat::CompactIdVisitor::CompactIdVisitor(const string& dir) :
+ JavaCompatVisitor(dir)
+{
+}
+
+bool
+Slice::GenCompat::CompactIdVisitor::visitClassDefStart(const ClassDefPtr& p)
+{
+ string prefix = getPackagePrefix(p);
+ if(!prefix.empty())
+ {
+ prefix = prefix + ".";
+ }
+ if(p->compactId() >= 0)
+ {
+ ostringstream os;
+ os << prefix << "IceCompactId.TypeId_" << p->compactId();
+ open(os.str(), p->file());
+
+ Output& out = output();
+ out << sp << nl << "public class TypeId_" << p->compactId();
+ out << sb;
+ out << nl << "public final static String typeId = \"" << p->scoped() << "\";";
+ out << eb;
+
+ close();
+ }
+ return false;
+}
+
+Slice::GenCompat::HolderVisitor::HolderVisitor(const string& dir) :
+ JavaCompatVisitor(dir)
+{
+}
+
+bool
+Slice::GenCompat::HolderVisitor::visitClassDefStart(const ClassDefPtr& p)
+{
+ ClassDeclPtr decl = p->declaration();
+ writeHolder(decl);
+
+ if(!p->isLocal())
+ {
+ string name = p->name();
+ string absolute = getAbsolute(p, "", "", "PrxHolder");
+
+ open(absolute, p->file());
+ Output& out = output();
+
+ out << sp << nl << "public final class " << name << "PrxHolder";
+ out << sb;
+ out << sp << nl << "public" << nl << name << "PrxHolder()";
+ out << sb;
+ out << eb;
+ out << sp << nl << "public" << nl << name << "PrxHolder(" << name << "Prx value)";
+ out << sb;
+ out << nl << "this.value = value;";
+ out << eb;
+ out << sp << nl << "public " << name << "Prx value;";
+ out << eb;
+ close();
+ }
+
+ return false;
+}
+
+bool
+Slice::GenCompat::HolderVisitor::visitStructStart(const StructPtr& p)
+{
+ writeHolder(p);
+ return false;
+}
+
+void
+Slice::GenCompat::HolderVisitor::visitSequence(const SequencePtr& p)
+{
+ if(sequenceHasHolder(p))
+ {
+ writeHolder(p);
+ }
+}
+
+void
+Slice::GenCompat::HolderVisitor::visitDictionary(const DictionaryPtr& p)
+{
+ writeHolder(p);
+}
+
+void
+Slice::GenCompat::HolderVisitor::visitEnum(const EnumPtr& p)
+{
+ writeHolder(p);
+}
+
+void
+Slice::GenCompat::HolderVisitor::writeHolder(const TypePtr& p)
+{
+ ContainedPtr contained = ContainedPtr::dynamicCast(p);
+ assert(contained);
+ string name = contained->name();
+ string absolute = getAbsolute(contained, "", "", "Holder");
+
+
+ string file;
+ if(p->definitionContext())
+ {
+ file = p->definitionContext()->filename();
+ }
+
+ open(absolute, file);
+ Output& out = output();
+
+ string typeS = typeToString(p, TypeModeIn, getPackage(contained));
+ out << sp << nl << "public final class " << name << "Holder";
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(p);
+ ClassDeclPtr cl = ClassDeclPtr::dynamicCast(p);
+ if(!p->isLocal() && ((builtin && builtin->kind() == Builtin::KindObject) || cl))
+ {
+ out << " extends Ice.ObjectHolderBase<" << typeS << ">";
+ }
+ else {
+ out << " extends Ice.Holder<" << typeS << ">";
+ }
+ out << sb;
+ if(!p->isLocal() && ((builtin && builtin->kind() == Builtin::KindObject) || cl))
+ {
+ out << sp << nl << "public" << nl << name << "Holder()";
+ out << sb;
+ out << eb;
+ out << sp << nl << "public" << nl << name << "Holder(" << typeS << " value)";
+ out << sb;
+ out << nl << "this.value = value;";
+ out << eb;
+
+ out << sp << nl << "public void";
+ out << nl << "valueReady(Ice.Object v)";
+ out << sb;
+ out << nl << "if(v == null || v instanceof " << typeS << ")";
+ out << sb;
+ out << nl << "value = (" << typeS << ")v;";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << "IceInternal.Ex.throwUOE(type(), v);";
+ out << eb;
+ out << eb;
+ out << sp << nl << "public String" << nl << "type()";
+ out << sb;
+ if(cl)
+ {
+ if(cl->isInterface())
+ {
+ out << nl << "return _" << cl->name() << "Disp.ice_staticId();";
+ }
+ else
+ {
+ out << nl << "return " << typeS << ".ice_staticId();";
+ }
+ }
+ else
+ {
+ out << nl << "return \"" << p->typeId() << "\";";
+ }
+ out << eb;
+ }
+ else
+ {
+ out << sp << nl << "public" << nl << name << "Holder()";
+ out << sb;
+ out << eb;
+ out << sp << nl << "public" << nl << name << "Holder(" << typeS << " value)";
+ out << sb;
+ out << nl << "super(value);";
+ out << eb;
+ }
+ out << eb;
+ close();
+}
+
+Slice::GenCompat::HelperVisitor::HelperVisitor(const string& dir) :
+ JavaCompatVisitor(dir)
+{
+}
+
+bool
+Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
+{
+ if(p->isLocal())
+ {
+ return false;
+ }
+
+ //
+ // Proxy helper
+ //
+ string name = p->name();
+ string scoped = p->scoped();
+ string package = getPackage(p);
+ string absolute = getAbsolute(p);
+
+ open(getAbsolute(p, "", "", "PrxHelper"), p->file());
+ Output& out = output();
+
+ //
+ // A proxy helper class serves two purposes: it implements the
+ // proxy interface, and provides static helper methods for use
+ // by applications (e.g., checkedCast, etc.)
+ //
+ out << sp;
+ writeDocComment(out, getDeprecateReason(p, 0, p->isInterface() ? "interface" : "class"),
+ "Provides type-specific helper functions.");
+ out << nl << "public final class " << name << "PrxHelper extends Ice.ObjectPrxHelperBase implements " << name
+ << "Prx";
+
+ out << sb;
+
+ string contextParam = "java.util.Map<String, String> __ctx";
+ string explicitContextParam = "boolean __explicitCtx";
+
+ OperationList ops = p->allOperations();
+ for(OperationList::iterator r = ops.begin(); r != ops.end(); ++r)
+ {
+ OperationPtr op = *r;
+ const ContainerPtr container = op->container();
+ const ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+
+ out << sp;
+ out << nl << "private static final String __" << op->name() << "_name = \"" << op->name() << "\";";
+
+ //
+ // Use the optional mapping by default.
+ //
+ writeOperation(p, package, op, true);
+
+ //
+ // If the operation actually sends any optionals, we generated overloaded methods
+ // that use the required mapping.
+ //
+ if(op->sendsOptionals())
+ {
+ writeOperation(p, package, op, false);
+ }
+
+ //
+ // End method
+ //
+ vector<string> outParams = getInOutParams(op, package, OutParam, true, true);
+ int iter = 0;
+ ExceptionList throws = op->throws();
+ throws.sort();
+ throws.unique();
+ const TypePtr ret = op->returnType();
+ const string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData(), true, op->returnIsOptional());
+
+ out << sp;
+ out << nl << "public " << retS << " end_" << op->name() << spar << outParams << "Ice.AsyncResult __iresult"
+ << epar;
+ writeThrowsClause(package, throws);
+ out << sb;
+ if(op->returnsData())
+ {
+ out << nl << "IceInternal.OutgoingAsync __result = IceInternal.OutgoingAsync.check(__iresult, this, __"
+ << op->name() << "_name);";
+ out << nl << "try";
+ out << sb;
+
+ out << nl << "if(!__result.__wait())";
+ out << sb;
+ out << nl << "try";
+ out << sb;
+ out << nl << "__result.throwUserException();";
+ out << eb;
+ //
+ // Arrange exceptions into most-derived to least-derived order. If we don't
+ // do this, a base exception handler can appear before a derived exception
+ // handler, causing compiler warnings and resulting in the base exception
+ // being marshaled instead of the derived exception.
+ //
+#if defined(__SUNPRO_CC)
+ throws.sort(Slice::derivedToBaseCompare);
+#else
+ throws.sort(Slice::DerivedToBaseCompare());
+#endif
+ for(ExceptionList::const_iterator eli = throws.begin(); eli != throws.end(); ++eli)
+ {
+ out << nl << "catch(" << getAbsolute(*eli, package) << " __ex)";
+ out << sb;
+ out << nl << "throw __ex;";
+ out << eb;
+ }
+ out << nl << "catch(Ice.UserException __ex)";
+ out << sb;
+ out << nl << "throw new Ice.UnknownUserException(__ex.ice_id(), __ex);";
+ out << eb;
+ out << eb;
+
+ if(ret || !outParams.empty())
+ {
+ out << nl << "Ice.InputStream __is = __result.startReadParams();";
+ const ParamDeclList paramList = op->parameters();
+ ParamDeclList pl;
+ for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if((*pli)->isOutParam())
+ {
+ pl.push_back(*pli);
+ }
+ }
+ writeMarshalUnmarshalParams(out, package, pl, op, iter, false, true);
+ if(op->returnsClasses(false))
+ {
+ out << nl << "__is.readPendingValues();";
+ }
+ out << nl << "__result.endReadParams();";
+ }
+ else
+ {
+ out << nl << "__result.readEmptyParams();";
+ }
+
+ if(ret)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
+ if(!op->returnIsOptional() &&
+ ((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret)))
+ {
+ out << nl << "return __ret.value;";
+ }
+ else
+ {
+ out << nl << "return __ret;";
+ }
+ }
+
+ out << eb;
+ out << nl << "finally";
+ out << sb;
+ out << nl << "if(__result != null)";
+ out << sb;
+ out << nl << "__result.cacheMessageBuffers();";
+ out << eb;
+ out << eb;
+ }
+ else
+ {
+ out << nl << "__end(__iresult, __" << op->name() << "_name);";
+ }
+ out << eb;
+
+ //
+ // The async callbacks implementation of __completed method delegate to the static
+ // __<op-name>_completed method implemented bellow.
+ //
+ if(op->returnsData())
+ {
+ const ParamDeclList paramList = op->parameters();
+ ParamDeclList outParams;
+ for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if((*pli)->isOutParam())
+ {
+ outParams.push_back(*pli);
+ }
+ }
+
+ out << sp << nl << "static public void __" << op->name() << "_completed("
+ << getAsyncCallbackInterface(op, package) << " __cb, Ice.AsyncResult __result)";
+ out << sb;
+ out << nl << getAbsolute(cl, "", "", "Prx") << " __proxy = ("
+ << getAbsolute(cl, "", "", "Prx") << ")__result.getProxy();";
+
+ TypePtr ret = op->returnType();
+ if(ret)
+ {
+ out << nl << typeToString(ret, TypeModeIn, package, op->getMetaData(), true,
+ op->returnIsOptional())
+ << " __ret = " << (op->returnIsOptional() ? "null" : initValue(ret)) << ';';
+ }
+ for(ParamDeclList::const_iterator pli = outParams.begin(); pli != outParams.end(); ++pli)
+ {
+ string ts = typeToString((*pli)->type(), TypeModeOut, package, (*pli)->getMetaData(), true,
+ (*pli)->optional());
+ out << nl << ts << ' ' << fixKwd((*pli)->name()) << " = new " << ts << "();";
+ }
+ out << nl << "try";
+ out << sb;
+ out << nl;
+ if(op->returnType())
+ {
+ out << "__ret = ";
+ }
+ out << "__proxy.end_" << op->name() << spar << getInOutArgs(op, OutParam) << "__result" << epar
+ << ';';
+
+ out << eb;
+ if(!throws.empty())
+ {
+ out << nl << "catch(Ice.UserException __ex)";
+ out << sb;
+ out << nl << "__cb.exception(__ex);";
+ out << nl << "return;";
+ out << eb;
+ }
+ out << nl << "catch(Ice.LocalException __ex)";
+ out << sb;
+ out << nl << "__cb.exception(__ex);";
+ out << nl << "return;";
+ out << eb;
+ out << nl << "catch(Ice.SystemException __ex)";
+ out << sb;
+ out << nl << "__cb.exception(__ex);";
+ out << nl << "return;";
+ out << eb;
+
+ out << nl << "__cb.response" << spar;
+ if(op->returnType())
+ {
+ out << "__ret";
+ }
+ for(ParamDeclList::const_iterator pli = outParams.begin(); pli != outParams.end(); ++pli)
+ {
+ if((*pli)->optional())
+ {
+ out << fixKwd((*pli)->name());
+ }
+ else
+ {
+ out << fixKwd((*pli)->name()) + ".value";
+ }
+ }
+ out << epar << ';';
+
+ out << eb;
+ }
+ }
+
+ out << sp;
+ writeDocComment(out, "",
+ "Contacts the remote server to verify that the object implements this type.\n"
+ "Raises a local exception if a communication error occurs.\n"
+ "@param __obj The untyped proxy.\n"
+ "@return A proxy for this type, or null if the object does not support this type.");
+ out << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx __obj)";
+ out << sb;
+ out << nl << "return checkedCastImpl(__obj, ice_staticId(), " << name << "Prx.class, "
+ << name << "PrxHelper.class);";
+ out << eb;
+
+ out << sp;
+ writeDocComment(out, "",
+ "Contacts the remote server to verify that the object implements this type.\n"
+ "Raises a local exception if a communication error occurs.\n"
+ "@param __obj The untyped proxy.\n"
+ "@param __ctx The Context map to send with the invocation.\n"
+ "@return A proxy for this type, or null if the object does not support this type.");
+ out << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx __obj, " << contextParam << ')';
+ out << sb;
+ out << nl << "return checkedCastImpl(__obj, __ctx, ice_staticId(), " << name
+ << "Prx.class, " << name << "PrxHelper.class);";
+ out << eb;
+
+ out << sp;
+ writeDocComment(out, "",
+ "Contacts the remote server to verify that a facet of the object implements this type.\n"
+ "Raises a local exception if a communication error occurs.\n"
+ "@param __obj The untyped proxy.\n"
+ "@param __facet The name of the desired facet.\n"
+ "@return A proxy for this type, or null if the object does not support this type.");
+ out << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx __obj, String __facet)";
+ out << sb;
+ out << nl << "return checkedCastImpl(__obj, __facet, ice_staticId(), " << name
+ << "Prx.class, " << name << "PrxHelper.class);";
+ out << eb;
+
+ out << sp;
+ writeDocComment(out, "",
+ "Contacts the remote server to verify that a facet of the object implements this type.\n"
+ "Raises a local exception if a communication error occurs.\n"
+ "@param __obj The untyped proxy.\n"
+ "@param __facet The name of the desired facet.\n"
+ "@param __ctx The Context map to send with the invocation.\n"
+ "@return A proxy for this type, or null if the object does not support this type.");
+ out << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx __obj, String __facet, "
+ << contextParam << ')';
+ out << sb;
+ out << nl << "return checkedCastImpl(__obj, __facet, __ctx, ice_staticId(), " << name
+ << "Prx.class, " << name << "PrxHelper.class);";
+ out << eb;
+
+ out << sp;
+ writeDocComment(out, "",
+ "Downcasts the given proxy to this type without contacting the remote server.\n"
+ "@param __obj The untyped proxy.\n"
+ "@return A proxy for this type.");
+ out << nl << "public static " << name << "Prx uncheckedCast(Ice.ObjectPrx __obj)";
+ out << sb;
+ out << nl << "return uncheckedCastImpl(__obj, " << name << "Prx.class, " << name
+ << "PrxHelper.class);";
+ out << eb;
+
+ out << sp;
+ writeDocComment(out, "",
+ "Downcasts the given proxy to this type without contacting the remote server.\n"
+ "@param __obj The untyped proxy.\n"
+ "@param __facet The name of the desired facet.\n"
+ "@return A proxy for this type.");
+ out << nl << "public static " << name << "Prx uncheckedCast(Ice.ObjectPrx __obj, String __facet)";
+ out << sb;
+ out << nl << "return uncheckedCastImpl(__obj, __facet, " << name << "Prx.class, " << name
+ << "PrxHelper.class);";
+ out << eb;
+
+ ClassList allBases = p->allBases();
+ StringList ids;
+ transform(allBases.begin(), allBases.end(), back_inserter(ids), constMemFun(&Contained::scoped));
+ StringList other;
+ other.push_back(scoped);
+ other.push_back("::Ice::Object");
+ other.sort();
+ ids.merge(other);
+ ids.unique();
+ StringList::const_iterator firstIter = ids.begin();
+ StringList::const_iterator scopedIter = find(ids.begin(), ids.end(), scoped);
+ assert(scopedIter != ids.end());
+ StringList::difference_type scopedPos = ::IceUtilInternal::distance(firstIter, scopedIter);
+
+ out << sp << nl << "public static final String[] __ids =";
+ out << sb;
+
+ for(StringList::const_iterator q = ids.begin(); q != ids.end();)
+ {
+ out << nl << '"' << *q << '"';
+ if(++q != ids.end())
+ {
+ out << ',';
+ }
+ }
+
+ out << eb << ';';
+
+ out << sp;
+ writeDocComment(out, "",
+ "Provides the Slice type ID of this type.\n"
+ "@return The Slice type ID.");
+ out << nl << "public static String ice_staticId()";
+ out << sb;
+ out << nl << "return __ids[" << scopedPos << "];";
+ out << eb;
+
+ out << sp << nl << "public static void write(Ice.OutputStream __os, " << name << "Prx v)";
+ out << sb;
+ out << nl << "__os.writeProxy(v);";
+ out << eb;
+
+ out << sp << nl << "public static " << name << "Prx read(Ice.InputStream __is)";
+ out << sb;
+ out << nl << "Ice.ObjectPrx proxy = __is.readProxy();";
+ out << nl << "if(proxy != null)";
+ out << sb;
+ out << nl << name << "PrxHelper result = new " << name << "PrxHelper();";
+ out << nl << "result.__copyFrom(proxy);";
+ out << nl << "return result;";
+ out << eb;
+ out << nl << "return null;";
+ out << eb;
+
+ //
+ // Avoid serialVersionUID warnings for Proxy Helper classes.
+ //
+ out << sp << nl << "public static final long serialVersionUID = 0L;";
+ out << eb;
+
+ close();
+
+ return false;
+}
+
+void
+Slice::GenCompat::HelperVisitor::visitSequence(const SequencePtr& p)
+{
+ //
+ // Don't generate helper for a sequence of a local type.
+ //
+ if(p->isLocal())
+ {
+ return;
+ }
+
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(p->type());
+ if(builtin &&
+ (builtin->kind() == Builtin::KindByte || builtin->kind() == Builtin::KindShort ||
+ builtin->kind() == Builtin::KindInt || builtin->kind() == Builtin::KindLong ||
+ builtin->kind() == Builtin::KindFloat || builtin->kind() == Builtin::KindDouble))
+ {
+ string prefix = "java:buffer";
+ string meta;
+ if(p->findMetaData(prefix, meta))
+ {
+ return; // No holders for buffer types.
+ }
+ }
+
+ string name = p->name();
+ string absolute = getAbsolute(p);
+ string helper = getAbsolute(p, "", "", "Helper");
+ string package = getPackage(p);
+ string typeS = typeToString(p, TypeModeIn, package);
+
+ //
+ // We cannot allocate an array of a generic type, such as
+ //
+ // arr = new Map<String, String>[sz];
+ //
+ // Attempting to compile this code results in a "generic array creation" error
+ // message. This problem can occur when the sequence's element type is a
+ // dictionary, or when the element type is a nested sequence that uses a custom
+ // mapping.
+ //
+ // The solution is to rewrite the code as follows:
+ //
+ // arr = (Map<String, String>[])new Map[sz];
+ //
+ // Unfortunately, this produces an unchecked warning during compilation, so we
+ // annotate the read() method to suppress the warning.
+ //
+ // A simple test is to look for a "<" character in the content type, which
+ // indicates the use of a generic type.
+ //
+ bool suppressUnchecked = false;
+
+ string instanceType, formalType;
+ bool customType = getSequenceTypes(p, "", StringList(), instanceType, formalType);
+
+ if(!customType)
+ {
+ //
+ // Determine sequence depth.
+ //
+ int depth = 0;
+ TypePtr origContent = p->type();
+ SequencePtr s = SequencePtr::dynamicCast(origContent);
+ while(s)
+ {
+ //
+ // Stop if the inner sequence type has a custom, serializable or protobuf type.
+ //
+ if(hasTypeMetaData(s))
+ {
+ break;
+ }
+ depth++;
+ origContent = s->type();
+ s = SequencePtr::dynamicCast(origContent);
+ }
+
+ string origContentS = typeToString(origContent, TypeModeIn, package);
+ suppressUnchecked = origContentS.find('<') != string::npos;
+ }
+
+ open(helper, p->file());
+ Output& out = output();
+
+ int iter;
+
+ out << sp << nl << "public final class " << name << "Helper";
+ out << sb;
+
+ out << nl << "public static void" << nl << "write(Ice.OutputStream __os, " << typeS << " __v)";
+ out << sb;
+ iter = 0;
+ writeSequenceMarshalUnmarshalCode(out, package, p, "__v", true, iter, false);
+ out << eb;
+
+ out << sp;
+ if(suppressUnchecked)
+ {
+ out << nl << "@SuppressWarnings(\"unchecked\")";
+ }
+ out << nl << "public static " << typeS << nl << "read(Ice.InputStream __is)";
+ out << sb;
+ out << nl << typeS << " __v;";
+ iter = 0;
+ writeSequenceMarshalUnmarshalCode(out, package, p, "__v", false, iter, false);
+ out << nl << "return __v;";
+ out << eb;
+
+ out << eb;
+ close();
+}
+
+void
+Slice::GenCompat::HelperVisitor::visitDictionary(const DictionaryPtr& p)
+{
+ //
+ // Don't generate helper for a dictionary containing a local type
+ //
+ if(p->isLocal())
+ {
+ return;
+ }
+
+ TypePtr key = p->keyType();
+ TypePtr value = p->valueType();
+
+ string name = p->name();
+ string absolute = getAbsolute(p);
+ string helper = getAbsolute(p, "", "", "Helper");
+ string package = getPackage(p);
+ StringList metaData = p->getMetaData();
+ string formalType = typeToString(p, TypeModeIn, package, StringList(), true);
+
+ open(helper, p->file());
+ Output& out = output();
+
+ int iter;
+
+ out << sp << nl << "public final class " << name << "Helper";
+ out << sb;
+
+ out << nl << "public static void" << nl << "write(Ice.OutputStream __os, " << formalType << " __v)";
+ out << sb;
+ iter = 0;
+ writeDictionaryMarshalUnmarshalCode(out, package, p, "__v", true, iter, false);
+ out << eb;
+
+ out << sp << nl << "public static " << formalType
+ << nl << "read(Ice.InputStream __is)";
+ out << sb;
+ out << nl << formalType << " __v;";
+ iter = 0;
+ writeDictionaryMarshalUnmarshalCode(out, package, p, "__v", false, iter, false);
+ out << nl << "return __v;";
+ out << eb;
+
+ out << eb;
+ close();
+}
+
+void
+Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const string& package, const OperationPtr& op,
+ bool optionalMapping)
+{
+ const string name = p->name();
+ Output& out = output();
+
+ const string contextParam = "java.util.Map<String, String> __ctx";
+ const string explicitContextParam = "boolean __explicitCtx";
+
+ const ContainerPtr container = op->container();
+ const ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ const string opName = fixKwd(op->name());
+ const TypePtr ret = op->returnType();
+ const string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData(), true, op->returnIsOptional());
+
+ vector<string> params = getParamsProxy(op, package, false, optionalMapping);
+ vector<string> args = getArgs(op);
+
+ ParamDeclList inParams;
+ ParamDeclList outParams;
+ ParamDeclList paramList = op->parameters();
+ for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if((*pli)->isOutParam())
+ {
+ outParams.push_back(*pli);
+ }
+ else
+ {
+ inParams.push_back(*pli);
+ }
+ }
+
+ ExceptionList throws = op->throws();
+ throws.sort();
+ throws.unique();
+
+ //
+ // Write two synchronous versions of the operation - with and without a
+ // context parameter.
+ //
+ out << sp << nl << "public " << retS << ' ' << opName << spar << params << epar;
+ writeThrowsClause(package, throws);
+ out << sb;
+ out << nl;
+ if(ret)
+ {
+ out << "return ";
+ }
+ out << opName << spar << args << "null" << "false" << epar << ';';
+ out << eb;
+
+ out << sp << nl << "public " << retS << ' ' << opName << spar << params << contextParam << epar;
+ writeThrowsClause(package, throws);
+ out << sb;
+ out << nl;
+ if(ret)
+ {
+ out << "return ";
+ }
+ out << opName << spar << args << "__ctx" << "true" << epar << ';';
+ out << eb;
+
+ out << sp;
+ out << nl << "private " << retS << ' ' << opName << spar << params << contextParam
+ << explicitContextParam << epar;
+ writeThrowsClause(package, throws);
+ out << sb;
+
+ // This code replaces the synchronous calls with chained AMI calls.
+ if(op->returnsData())
+ {
+ out << nl << "__checkTwowayOnly(__" << op->name() << "_name);";
+ }
+
+ if(ret)
+ {
+ out << nl << "return ";
+ }
+ else
+ {
+ out << nl;
+ }
+
+ out << "end_" << op->name() << "(";
+ vector<string> inOutArgs = getInOutArgs(op, OutParam);
+ if(!inOutArgs.empty()) {
+ for(vector<string>::const_iterator p = inOutArgs.begin(); p != inOutArgs.end(); ++p) {
+ out << *p << ", ";
+ }
+ }
+ vector<string> inArgs = getInOutArgs(op, InParam);
+ out << "begin_" << op->name() << "(";
+ if(!inArgs.empty())
+ {
+ for(vector<string>::const_iterator p = inArgs.begin(); p != inArgs.end(); ++p) {
+ out << *p << ", ";
+ }
+ }
+ out << "__ctx, __explicitCtx, true, null));";
+ out << eb;
+
+ {
+ //
+ // Write the asynchronous begin methods.
+ //
+ vector<string> inParams = getInOutParams(op, package, InParam, true, optionalMapping);
+ vector<string> inArgs = getInOutArgs(op, InParam);
+ const string callbackParam = "Ice.Callback __cb";
+ const ParamDeclList paramList = op->parameters();
+ int iter;
+
+ //
+ // Type-unsafe begin methods
+ //
+ out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << epar;
+ out << sb;
+ out << nl << "return begin_" << op->name() << spar << inArgs << "null" << "false" << "false" << "null" << epar
+ << ';';
+ out << eb;
+
+ out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << contextParam << epar;
+ out << sb;
+ out << nl << "return begin_" << op->name() << spar << inArgs << "__ctx" << "true" << "false" << "null" << epar
+ << ';';
+ out << eb;
+
+ out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << callbackParam << epar;
+ out << sb;
+ out << nl << "return begin_" << op->name() << spar << inArgs << "null" << "false" << "false" << "__cb" << epar
+ << ';';
+ out << eb;
+
+ out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << contextParam
+ << callbackParam << epar;
+ out << sb;
+ out << nl << "return begin_" << op->name() << spar << inArgs << "__ctx" << "true" << "false" << "__cb" << epar
+ << ';';
+ out << eb;
+
+ //
+ // Type-safe begin methods
+ //
+ string typeSafeCallbackParam;
+
+ //
+ // Get the name of the callback using the name of the class in which this
+ // operation was defined.
+ //
+ ContainerPtr container = op->container();
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ string opClassName = getAbsolute(cl, package, "Callback_", '_' + op->name());
+ typeSafeCallbackParam = opClassName + " __cb";
+
+ out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << typeSafeCallbackParam
+ << epar;
+ out << sb;
+ out << nl << "return begin_" << op->name() << spar << inArgs << "null" << "false" << "false" << "__cb" << epar
+ << ';';
+ out << eb;
+
+ out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << contextParam
+ << typeSafeCallbackParam << epar;
+ out << sb;
+ out << nl << "return begin_" << op->name() << spar << inArgs << "__ctx" << "true" << "false" << "__cb" << epar
+ << ';';
+ out << eb;
+
+ //
+ // Async methods that accept Java 8 lambda callbacks.
+ //
+ out << sp;
+ out << nl << "public Ice.AsyncResult begin_" << op->name();
+ writeParamList(out, getParamsAsyncLambda(op, package, false, false, optionalMapping));
+ out << sb;
+ out << nl << "return begin_" << op->name() << spar << getArgsAsyncLambda(op, package) << epar << ';';
+ out << eb;
+
+ out << sp;
+ out << nl << "public Ice.AsyncResult begin_" << op->name();
+ writeParamList(out, getParamsAsyncLambda(op, package, false, true, optionalMapping));
+ out << sb;
+ out << nl << "return begin_" << op->name() << spar << getArgsAsyncLambda(op, package, false, true) << epar
+ << ';';
+ out << eb;
+
+ out << sp;
+ out << nl << "public Ice.AsyncResult begin_" << op->name();
+ writeParamList(out, getParamsAsyncLambda(op, package, true, false, optionalMapping));
+ out << sb;
+ out << nl << "return begin_" << op->name() << spar << getArgsAsyncLambda(op, package, true) << epar << ';';
+ out << eb;
+
+ out << sp;
+ out << nl << "public Ice.AsyncResult begin_" << op->name();
+ writeParamList(out, getParamsAsyncLambda(op, package, true, true, optionalMapping));
+ out << sb;
+ out << nl << "return begin_" << op->name() << spar << getArgsAsyncLambda(op, package, true, true) << epar
+ << ';';
+ out << eb;
+
+ vector<string> params = inParams;
+ params.push_back(contextParam);
+ params.push_back("boolean __explicitCtx");
+ params.push_back("boolean __synchronous");
+ vector<string> asyncParams = getParamsAsyncLambda(op, package, false, true, optionalMapping, false);
+ copy(asyncParams.begin(), asyncParams.end(), back_inserter(params));
+
+ out << sp;
+ out << nl << "private Ice.AsyncResult begin_" << op->name();
+ writeParamList(out, params);
+ out << sb;
+
+ ParamDeclList outParams = getOutParams(op);
+
+ if(!op->returnsData())
+ {
+ params = getInOutArgs(op, InParam);
+ params.push_back("__ctx");
+ params.push_back("__explicitCtx");
+ params.push_back("__synchronous");
+ params.push_back("new IceInternal.Functional_OnewayCallback(__responseCb, __exceptionCb, __sentCb)");
+ out << nl << "return begin_" << op->name();
+ writeParamList(out, params);
+ out << ';';
+ }
+ else if((ret && !outParams.empty()) || (outParams.size() > 1))
+ {
+ params.clear();
+ params.push_back(getLambdaResponseCB(op, package) + " responseCb");
+ if(!throws.empty())
+ {
+ params.push_back("IceInternal.Functional_GenericCallback1<Ice.UserException> userExceptionCb");
+ }
+ params.push_back("IceInternal.Functional_GenericCallback1<Ice.Exception> exceptionCb");
+ params.push_back("IceInternal.Functional_BoolCallback sentCb");
+
+ out << sp;
+ out << nl << "class CB extends " << getAsyncCallbackBaseClass(op, true);
+ out << sb;
+ out << nl << "public CB";
+ writeParamList(out, params);
+ out << sb;
+ out << nl << "super(responseCb != null, ";
+ if(!throws.empty())
+ {
+ out << "userExceptionCb, ";
+ }
+ out << "exceptionCb, sentCb);";
+ out << nl << "__responseCb = responseCb;";
+ out << eb;
+
+ out << sp;
+ out << nl << "public void response" << spar << getParamsAsyncCB(op, package, false, true) << epar;
+ out << sb;
+ out << nl << "if(__responseCb != null)";
+ out << sb;
+ out << nl << "__responseCb.apply" << spar;
+ if(ret)
+ {
+ out << "__ret";
+ }
+ out << getInOutArgs(op, OutParam) << epar << ';';
+ out << eb;
+ out << eb;
+
+ out << sp;
+ out << nl << "public final void __completed(Ice.AsyncResult __result)";
+ out << sb;
+ out << nl << p->name() << "PrxHelper.__" << op->name() << "_completed(this, __result);";
+ out << eb;
+ out << sp;
+ out << nl << "private final " << getLambdaResponseCB(op, package) << " __responseCb;";
+ out << eb;
+
+ out << nl << "return begin_" << op->name() << spar << getInOutArgs(op, InParam) << "__ctx"
+ << "__explicitCtx"
+ << "__synchronous"
+ << (throws.empty() ? "new CB(__responseCb, __exceptionCb, __sentCb)" :
+ "new CB(__responseCb, __userExceptionCb, __exceptionCb, __sentCb)")
+ << epar << ';';
+ }
+ else
+ {
+ params = getInOutArgs(op, InParam);
+ params.push_back("__ctx");
+ params.push_back("__explicitCtx");
+ params.push_back("__synchronous");
+
+ const string baseClass = getAsyncCallbackBaseClass(op, true);
+ out << nl << "return begin_" << op->name();
+ writeParamList(out, params, false, false);
+ out << nl
+ << (throws.empty() ? "new " + baseClass + "(__responseCb, __exceptionCb, __sentCb)" :
+ "new " + baseClass + "(__responseCb, __userExceptionCb, __exceptionCb, __sentCb)");
+ out.inc();
+ out << sb;
+ out << nl << "public final void __completed(Ice.AsyncResult __result)";
+ out << sb;
+ out << nl << p->name() << "PrxHelper.__" << op->name() << "_completed(this, __result);";
+ out << eb;
+ out << eb;
+ out << ");";
+ out.dec();
+ out.restoreIndent();
+ }
+ out << eb;
+
+ //
+ // Implementation of begin method
+ //
+ params = inParams;
+ params.push_back(contextParam);
+ params.push_back("boolean __explicitCtx");
+ params.push_back("boolean __synchronous");
+ params.push_back("IceInternal.CallbackBase __cb");
+
+ out << sp;
+ out << nl << "private Ice.AsyncResult begin_" << op->name();
+ writeParamList(out, params);
+ out << sb;
+ if(op->returnsData())
+ {
+ out << nl << "__checkAsyncTwowayOnly(__" << op->name() << "_name);";
+ }
+ out << nl << "IceInternal.OutgoingAsync __result = getOutgoingAsync(__" << op->name()
+ << "_name, __cb);";
+ out << nl << "try";
+ out << sb;
+
+ out << nl << "__result.prepare(__" << op->name() << "_name, " << sliceModeToIceMode(op->sendMode())
+ << ", __ctx, __explicitCtx, __synchronous);";
+
+ iter = 0;
+ if(!inArgs.empty())
+ {
+ out << nl << "Ice.OutputStream __os = __result.startWriteParams("
+ << opFormatTypeToString(op) << ");";
+ ParamDeclList pl;
+ for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if(!(*pli)->isOutParam())
+ {
+ pl.push_back(*pli);
+ }
+ }
+ writeMarshalUnmarshalParams(out, package, pl, 0, iter, true, optionalMapping);
+ if(op->sendsClasses(false))
+ {
+ out << nl << "__os.writePendingValues();";
+ }
+ out << nl << "__result.endWriteParams();";
+ }
+ else
+ {
+ out << nl << "__result.writeEmptyParams();";
+ }
+
+ out << nl << "__result.invoke();";
+ out << eb;
+ out << nl << "catch(Ice.Exception __ex)";
+ out << sb;
+ out << nl << "__result.abort(__ex);";
+ out << eb;
+ out << nl << "return __result;";
+ out << eb;
+ }
+}
+
+Slice::GenCompat::ProxyVisitor::ProxyVisitor(const string& dir) :
+ JavaCompatVisitor(dir)
+{
+}
+
+bool
+Slice::GenCompat::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
+{
+ if(p->isLocal())
+ {
+ return false;
+ }
+
+ string name = p->name();
+ ClassList bases = p->bases();
+ string package = getPackage(p);
+ string absolute = getAbsolute(p, "", "", "Prx");
+
+ open(absolute, p->file());
+
+ Output& out = output();
+
+ //
+ // Generate a Java interface as the user-visible type
+ //
+ out << sp;
+ writeDocComment(out, p, getDeprecateReason(p, 0, p->isInterface() ? "interface" : "class"));
+ out << nl << "public interface " << name << "Prx extends ";
+ if(bases.empty())
+ {
+ out << "Ice.ObjectPrx";
+ }
+ else
+ {
+ out.useCurrentPosAsIndent();
+ for(ClassList::const_iterator q = bases.begin(); q != bases.end();)
+ {
+ out << getAbsolute(*q, package, "", "Prx");
+ if(++q != bases.end())
+ {
+ out << ',' << nl;
+ }
+ }
+ out.restoreIndent();
+ }
+
+ out << sb;
+
+ return true;
+}
+
+void
+Slice::GenCompat::ProxyVisitor::visitClassDefEnd(const ClassDefPtr&)
+{
+ Output& out = output();
+ out << eb;
+ close();
+}
+
+void
+Slice::GenCompat::ProxyVisitor::visitOperation(const OperationPtr& p)
+{
+ string name = fixKwd(p->name());
+ ContainerPtr container = p->container();
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ string package = getPackage(cl);
+
+ Output& out = output();
+
+ TypePtr ret = p->returnType();
+ string retS = typeToString(ret, TypeModeReturn, package, p->getMetaData(), true, p->returnIsOptional());
+ vector<string> params = getParamsProxy(p, package, false, true);
+ ExceptionList throws = p->throws();
+ throws.sort();
+ throws.unique();
+
+ string deprecateReason = getDeprecateReason(p, cl, "operation");
+ string contextDoc = "@param __ctx The Context map to send with the invocation.";
+ string contextParam = "java.util.Map<String, String> __ctx";
+ string lambdaResponseDoc = "@param __responseCb The lambda response callback.";
+ string lambdaUserExDoc = "@param __userExceptionCb The lambda user exception callback.";
+ string lambdaExDoc = "@param __exceptionCb The lambda exception callback.";
+ string lambdaSentDoc = "@param __sentCb The lambda sent callback.";
+
+ const bool optional = p->sendsOptionals();
+
+ //
+ // Write two synchronous versions of the operation - with and without a context parameter.
+ //
+ out << sp;
+ writeDocComment(out, p, deprecateReason);
+
+ out << nl << "public " << retS << ' ' << name << spar << params << epar;
+ writeThrowsClause(package, throws);
+ out << ';';
+
+ out << sp;
+ writeDocComment(out, p, deprecateReason, contextDoc);
+
+ out << nl << "public " << retS << ' ' << name << spar << params << contextParam << epar;
+ writeThrowsClause(package, throws);
+ out << ';';
+
+ if(optional)
+ {
+ //
+ // Write overloaded versions of the methods using required params.
+ //
+ vector<string> reqParams = getParamsProxy(p, package, false, false);
+
+ out << sp;
+ writeDocComment(out, p, deprecateReason);
+ out << nl << "public " << retS << ' ' << name << spar << reqParams << epar;
+ writeThrowsClause(package, throws);
+ out << ';';
+
+ out << sp;
+ writeDocComment(out, p, deprecateReason, contextDoc);
+ out << nl << "public " << retS << ' ' << name << spar << reqParams << contextParam << epar;
+ writeThrowsClause(package, throws);
+ out << ';';
+ }
+
+ {
+ //
+ // Write the asynchronous begin/end methods.
+ //
+ // Start with the type-unsafe begin methods.
+ //
+ vector<string> inParams = getInOutParams(p, package, InParam, true, true);
+ string callbackParam = "Ice.Callback __cb";
+ string callbackDoc = "@param __cb The asynchronous callback object.";
+
+ out << sp;
+ writeDocCommentAMI(out, p, InParam);
+ out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << epar << ';';
+
+ out << sp;
+ writeDocCommentAMI(out, p, InParam, contextDoc);
+ out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << contextParam << epar << ';';
+
+ out << sp;
+ writeDocCommentAMI(out, p, InParam, callbackDoc);
+ out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << callbackParam << epar << ';';
+
+ out << sp;
+ writeDocCommentAMI(out, p, InParam, contextDoc, callbackDoc);
+ out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << contextParam << callbackParam
+ << epar << ';';
+
+ //
+ // Type-safe begin methods.
+ //
+ string typeSafeCallbackParam;
+
+ //
+ // Get the name of the callback using the name of the class in which this
+ // operation was defined.
+ //
+ ContainerPtr container = p->container();
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ string opClassName = getAbsolute(cl, package, "Callback_", '_' + p->name());
+ typeSafeCallbackParam = opClassName + " __cb";
+
+ out << sp;
+ writeDocCommentAMI(out, p, InParam, callbackDoc);
+ out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << typeSafeCallbackParam
+ << epar << ';';
+
+ out << sp;
+ writeDocCommentAMI(out, p, InParam, contextDoc, callbackDoc);
+ out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << contextParam
+ << typeSafeCallbackParam << epar << ';';
+
+ //
+ // Generate the Callback Response interface if the operation has more than one
+ // return parameter. Operations with just one return parameter use one of the
+ // builtin async callback interfaces.
+ //
+ {
+ ParamDeclList outParams = getOutParams(p);
+ if((ret && !outParams.empty()) || outParams.size() > 1)
+ {
+ vector<string> params = getParamsAsyncCB(p, package, false, true);
+ out << sp;
+ out << nl << "public interface " << getLambdaResponseCB(p, package);
+ out << sb;
+ out << nl << "void apply" << spar << params << epar << ';';
+ out << eb;
+ }
+ }
+
+ //
+ // Async methods that accept Java 8 lambda callbacks.
+ //
+ {
+ out << sp;
+ writeDocCommentAMI(out, p, InParam, lambdaResponseDoc, throws.empty() ? "" : lambdaUserExDoc, lambdaExDoc);
+ out << nl << "public Ice.AsyncResult begin_" << p->name();
+ writeParamList(out, getParamsAsyncLambda(p, package, false, false, true));
+ out << ';';
+
+ out << sp;
+ writeDocCommentAMI(out, p, InParam, lambdaResponseDoc, throws.empty() ? "" : lambdaUserExDoc, lambdaExDoc,
+ lambdaSentDoc);
+ out << nl << "public Ice.AsyncResult begin_" << p->name();
+ writeParamList(out, getParamsAsyncLambda(p, package, false, true, true));
+ out << ';';
+
+ out << sp;
+ writeDocCommentAMI(out, p, InParam, contextDoc, lambdaResponseDoc, throws.empty() ? "" : lambdaUserExDoc,
+ lambdaExDoc);
+ out << nl << "public Ice.AsyncResult begin_" << p->name();
+ writeParamList(out, getParamsAsyncLambda(p, package, true, false, true));
+ out << ';';
+
+ out << sp;
+ writeDocCommentAMI(out, p, InParam, contextDoc, lambdaResponseDoc, throws.empty() ? "" : lambdaUserExDoc,
+ lambdaExDoc, lambdaSentDoc);
+ out << nl << "public Ice.AsyncResult begin_" << p->name();
+ writeParamList(out, getParamsAsyncLambda(p, package, true, true, true));
+ out << ';';
+ }
+
+ vector<string> outParams = getInOutParams(p, package, OutParam, true, true);
+
+ out << sp;
+ writeDocCommentAMI(out, p, OutParam);
+ out << nl << "public " << retS << " end_" << p->name() << spar << outParams << "Ice.AsyncResult __result"
+ << epar;
+ writeThrowsClause(package, throws);
+ out << ';';
+ }
+
+ if(optional)
+ {
+ //
+ // Write overloaded versions of the methods using required params.
+ //
+ vector<string> inParams = getInOutParams(p, package, InParam, true, false);
+ string callbackParam = "Ice.Callback __cb";
+ string callbackDoc = "@param __cb The asynchronous callback object.";
+
+ out << sp;
+ writeDocCommentAMI(out, p, InParam);
+ out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << epar << ';';
+
+ out << sp;
+ writeDocCommentAMI(out, p, InParam, contextDoc);
+ out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << contextParam << epar << ';';
+
+ out << sp;
+ writeDocCommentAMI(out, p, InParam, callbackDoc);
+ out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << callbackParam << epar << ';';
+
+ out << sp;
+ writeDocCommentAMI(out, p, InParam, contextDoc, callbackDoc);
+ out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << contextParam << callbackParam
+ << epar << ';';
+
+ //
+ // Async methods that accept Java 8 lambda callbacks.
+ //
+ {
+ out << sp;
+ writeDocCommentAMI(out, p, InParam, lambdaResponseDoc, throws.empty() ? "" : lambdaUserExDoc, lambdaExDoc);
+ out << nl << "public Ice.AsyncResult begin_" << p->name();
+ writeParamList(out, getParamsAsyncLambda(p, package));
+ out << ';';
+
+ out << sp;
+ writeDocCommentAMI(out, p, InParam, lambdaResponseDoc, throws.empty() ? "" : lambdaUserExDoc, lambdaExDoc,
+ lambdaSentDoc);
+ out << nl << "public Ice.AsyncResult begin_" << p->name();
+ writeParamList(out, getParamsAsyncLambda(p, package, false, true));
+ out << ';';
+
+ out << sp;
+ writeDocCommentAMI(out, p, InParam, contextDoc, lambdaResponseDoc, throws.empty() ? "" : lambdaUserExDoc,
+ lambdaExDoc);
+ out << nl << "public Ice.AsyncResult begin_" << p->name();
+ writeParamList(out, getParamsAsyncLambda(p, package, true));
+ out << ';';
+
+ out << sp;
+ writeDocCommentAMI(out, p, InParam, contextDoc, lambdaResponseDoc, throws.empty() ? "" : lambdaUserExDoc,
+ lambdaExDoc, lambdaSentDoc);
+ out << nl << "public Ice.AsyncResult begin_" << p->name();
+ writeParamList(out, getParamsAsyncLambda(p, package, true, true));
+ out << ';';
+ }
+
+ //
+ // Type-safe begin methods.
+ //
+ string typeSafeCallbackParam;
+
+ //
+ // Get the name of the callback using the name of the class in which this
+ // operation was defined.
+ //
+ ContainerPtr container = p->container();
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ string opClassName = getAbsolute(cl, package, "Callback_", '_' + p->name());
+ typeSafeCallbackParam = opClassName + " __cb";
+
+ out << sp;
+ writeDocCommentAMI(out, p, InParam, callbackDoc);
+ out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << typeSafeCallbackParam
+ << epar << ';';
+
+ out << sp;
+ writeDocCommentAMI(out, p, InParam, contextDoc, callbackDoc);
+ out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << contextParam
+ << typeSafeCallbackParam << epar << ';';
+ }
+}
+
+Slice::GenCompat::DispatcherVisitor::DispatcherVisitor(const string& dir) :
+ JavaCompatVisitor(dir)
+{
+}
+
+bool
+Slice::GenCompat::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p)
+{
+ if(p->isLocal() || !p->isInterface())
+ {
+ return false;
+ }
+
+ string name = p->name();
+ ClassList bases = p->bases();
+ string absolute = getAbsolute(p, "", "_", "Disp");
+
+ open(absolute, p->file());
+
+ Output& out = output();
+
+ out << sp;
+ writeDocComment(out, p, getDeprecateReason(p, 0, p->isInterface() ? "interface" : "class"));
+ out << nl << "public abstract class _" << name << "Disp extends Ice.ObjectImpl implements " << fixKwd(name);
+ out << sb;
+
+ out << sp << nl << "protected void" << nl << "ice_copyStateFrom(Ice.Object __obj)";
+ out.inc();
+ out << nl << "throws java.lang.CloneNotSupportedException";
+ out.dec();
+ out << sb;
+ out << nl << "throw new java.lang.CloneNotSupportedException();";
+ out << eb;
+
+ writeDispatchAndMarshalling(out, p);
+
+ //
+ // Avoid serialVersionUID warnings for dispatch classes.
+ //
+ out << sp << nl << "public static final long serialVersionUID = 0L;";
+ out << eb;
+ close();
+
+ return false;
+}
+
+Slice::GenCompat::BaseImplVisitor::BaseImplVisitor(const string& dir) :
+ JavaCompatVisitor(dir)
+{
+}
+
+void
+Slice::GenCompat::BaseImplVisitor::writeDecl(Output& out, const string& package, const string& name, const TypePtr& type,
+ const StringList& metaData, bool optional)
+{
+ string typeS = typeToString(type, TypeModeIn, package, metaData, true, optional);
+ out << nl << typeS << ' ' << name;
+
+ if(optional)
+ {
+ out << " = new " << typeS << "();";
+ }
+ else
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
+ if(builtin)
+ {
+ switch(builtin->kind())
+ {
+ case Builtin::KindBool:
+ {
+ out << " = false";
+ break;
+ }
+ case Builtin::KindByte:
+ {
+ out << " = (byte)0";
+ break;
+ }
+ case Builtin::KindShort:
+ {
+ out << " = (short)0";
+ break;
+ }
+ case Builtin::KindInt:
+ case Builtin::KindLong:
+ {
+ out << " = 0";
+ break;
+ }
+ case Builtin::KindFloat:
+ {
+ out << " = (float)0.0";
+ break;
+ }
+ case Builtin::KindDouble:
+ {
+ out << " = 0.0";
+ break;
+ }
+ case Builtin::KindString:
+ {
+ out << " = \"\"";
+ break;
+ }
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ case Builtin::KindLocalObject:
+ case Builtin::KindValue:
+ {
+ out << " = null";
+ break;
+ }
+ }
+ }
+ else
+ {
+ EnumPtr en = EnumPtr::dynamicCast(type);
+ if(en)
+ {
+ EnumeratorList enumerators = en->getEnumerators();
+ out << " = " << getAbsolute(en, package) << '.' << fixKwd(enumerators.front()->name());
+ }
+ else
+ {
+ out << " = null";
+ }
+ }
+
+ out << ';';
+ }
+}
+
+void
+Slice::GenCompat::BaseImplVisitor::writeReturn(Output& out, const TypePtr& type, bool optional)
+{
+ if(optional)
+ {
+ out << nl << "return null;";
+ }
+ else
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
+ if(builtin)
+ {
+ switch(builtin->kind())
+ {
+ case Builtin::KindBool:
+ {
+ out << nl << "return false;";
+ break;
+ }
+ case Builtin::KindByte:
+ {
+ out << nl << "return (byte)0;";
+ break;
+ }
+ case Builtin::KindShort:
+ {
+ out << nl << "return (short)0;";
+ break;
+ }
+ case Builtin::KindInt:
+ case Builtin::KindLong:
+ {
+ out << nl << "return 0;";
+ break;
+ }
+ case Builtin::KindFloat:
+ {
+ out << nl << "return (float)0.0;";
+ break;
+ }
+ case Builtin::KindDouble:
+ {
+ out << nl << "return 0.0;";
+ break;
+ }
+ case Builtin::KindString:
+ case Builtin::KindObject:
+ case Builtin::KindObjectProxy:
+ case Builtin::KindLocalObject:
+ case Builtin::KindValue:
+ {
+ out << nl << "return null;";
+ break;
+ }
+ }
+ return;
+ }
+
+ out << nl << "return null;";
+ }
+}
+
+void
+Slice::GenCompat::BaseImplVisitor::writeOperation(Output& out, const string& package, const OperationPtr& op, bool local)
+{
+ string opName = op->name();
+
+ const TypePtr ret = op->returnType();
+ const bool optionalMapping = useOptionalMapping(op);
+ const StringList opMetaData = op->getMetaData();
+ const string retS = typeToString(ret, TypeModeReturn, package, opMetaData, true,
+ optionalMapping && op->returnIsOptional());
+ vector<string> params = getParams(op, package, false, optionalMapping);
+
+ ContainerPtr container = op->container();
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+
+ if(!local && (cl->hasMetaData("amd") || op->hasMetaData("amd")))
+ {
+ vector<string> paramsAMD = getParamsAsync(op, package, true, true);
+
+ out << sp << nl << "public void " << opName << "_async" << spar << paramsAMD << "Ice.Current __current"
+ << epar;
+
+ ExceptionList throws = op->throws();
+ throws.sort();
+ throws.unique();
+
+ //
+ // Arrange exceptions into most-derived to least-derived order. If we don't
+ // do this, a base exception handler can appear before a derived exception
+ // handler, causing compiler warnings and resulting in the base exception
+ // being marshaled instead of the derived exception.
+ //
+#if defined(__SUNPRO_CC)
+ throws.sort(Slice::derivedToBaseCompare);
+#else
+ throws.sort(Slice::DerivedToBaseCompare());
+#endif
+ writeThrowsClause(package, throws);
+
+ out << sb;
+
+ string result = "__r";
+ ParamDeclList paramList = op->parameters();
+ for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
+ {
+ if((*q)->name() == result)
+ {
+ result = "_" + result;
+ break;
+ }
+ }
+ if(ret)
+ {
+ writeDecl(out, package, result, ret, opMetaData, optionalMapping && op->returnIsOptional());
+ }
+ for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
+ {
+ if((*q)->isOutParam())
+ {
+ writeDecl(out, package, fixKwd((*q)->name()), (*q)->type(), (*q)->getMetaData(),
+ optionalMapping && (*q)->optional());
+ }
+ }
+
+ out << nl << "__cb.ice_response(";
+ if(ret)
+ {
+ out << result;
+ }
+ bool firstOutParam = true;
+ for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
+ {
+ if((*q)->isOutParam())
+ {
+ if(ret || !firstOutParam)
+ {
+ out << ", ";
+ }
+ out << fixKwd((*q)->name());
+ firstOutParam = false;
+ }
+ }
+ out << ");";
+
+ out << eb;
+ }
+ else
+ {
+ out << sp << nl << "public " << retS << nl << fixKwd(opName) << spar << params;
+ if(!local)
+ {
+ out << "Ice.Current __current";
+ }
+ out << epar;
+
+ ExceptionList throws = op->throws();
+ throws.sort();
+ throws.unique();
+
+ if(op->hasMetaData("UserException"))
+ {
+ out.inc();
+ out << nl << "throws Ice.UserException";
+ out.dec();
+ }
+ else
+ {
+ writeThrowsClause(package, throws);
+ }
+
+ out << sb;
+
+ //
+ // Return value
+ //
+ if(ret)
+ {
+ writeReturn(out, ret, optionalMapping && op->returnIsOptional());
+ }
+
+ out << eb;
+ }
+}
+
+Slice::GenCompat::ImplVisitor::ImplVisitor(const string& dir) :
+ BaseImplVisitor(dir)
+{
+}
+
+bool
+Slice::GenCompat::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
+{
+ if(!p->isAbstract())
+ {
+ return false;
+ }
+
+ string name = p->name();
+ ClassList bases = p->bases();
+ string package = getPackage(p);
+ string absolute = getAbsolute(p, "", "", "I");
+
+ open(absolute, p->file());
+
+ Output& out = output();
+
+ out << sp << nl << "public final class " << name << 'I';
+ if(p->isInterface())
+ {
+ if(p->isLocal())
+ {
+ out << " implements " << fixKwd(name);
+ }
+ else
+ {
+ out << " extends _" << name << "Disp";
+ }
+ }
+ else
+ {
+ out << " extends " << fixKwd(name);
+ }
+ out << sb;
+
+ out << nl << "public" << nl << name << "I()";
+ out << sb;
+ out << eb;
+
+ OperationList ops = p->allOperations();
+ for(OperationList::iterator r = ops.begin(); r != ops.end(); ++r)
+ {
+ writeOperation(out, package, *r, p->isLocal());
+ }
+
+ out << eb;
+ close();
+
+ return false;
+}
+
+Slice::GenCompat::ImplTieVisitor::ImplTieVisitor(const string& dir) :
+ BaseImplVisitor(dir)
+{
+}
+
+bool
+Slice::GenCompat::ImplTieVisitor::visitClassDefStart(const ClassDefPtr& p)
+{
+ if(!p->isAbstract())
+ {
+ return false;
+ }
+
+ string name = p->name();
+ ClassList bases = p->bases();
+ string package = getPackage(p);
+ string absolute = getAbsolute(p, "", "", "I");
+
+ open(absolute, p->file());
+
+ Output& out = output();
+
+ //
+ // Use implementation inheritance in the following situations:
+ //
+ // * if a class extends another class
+ // * if a class implements a single interface
+ // * if an interface extends only one interface
+ //
+ bool inheritImpl = (!p->isInterface() && !bases.empty() && !bases.front()->isInterface()) || (bases.size() == 1);
+
+ out << sp << nl << "public class " << name << 'I';
+ if(inheritImpl)
+ {
+ out << " extends ";
+ if(bases.front()->isAbstract())
+ {
+ out << bases.front()->name() << 'I';
+ }
+ else
+ {
+ out << fixKwd(bases.front()->name());
+ }
+ }
+ out << " implements " << '_' << name << "Operations";
+ if(p->isLocal())
+ {
+ out << "NC";
+ }
+ out << sb;
+
+ out << nl << "public" << nl << name << "I()";
+ out << sb;
+ out << eb;
+
+ OperationList ops = p->allOperations();
+ ops.sort();
+
+ OperationList baseOps;
+ if(inheritImpl)
+ {
+ baseOps = bases.front()->allOperations();
+ baseOps.sort();
+ }
+
+ for(OperationList::iterator r = ops.begin(); r != ops.end(); ++r)
+ {
+ if(inheritImpl && binary_search(baseOps.begin(), baseOps.end(), *r))
+ {
+ out << sp;
+ out << nl << "/*";
+ out << nl << " * Implemented by " << bases.front()->name() << 'I';
+ out << nl << " *";
+ writeOperation(out, package, *r, p->isLocal());
+ out << sp;
+ out << nl << "*/";
+ }
+ else
+ {
+ writeOperation(out, package, *r, p->isLocal());
+ }
+ }
+
+ out << eb;
+ close();
+
+ return false;
+}
+
+Slice::GenCompat::AsyncVisitor::AsyncVisitor(const string& dir) :
+ JavaCompatVisitor(dir)
+{
+}
+
+void
+Slice::GenCompat::AsyncVisitor::visitOperation(const OperationPtr& p)
+{
+ ContainerPtr container = p->container();
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+
+ if(cl->isLocal())
+ {
+ return;
+ }
+
+ string name = p->name();
+ string classPkg = getPackage(cl);
+ StringList opMetaData = p->getMetaData();
+
+ //
+ // Generate new-style callback.
+ //
+ {
+ TypePtr ret = p->returnType();
+ ParamDeclList outParams;
+ ParamDeclList paramList = p->parameters();
+ for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if((*pli)->isOutParam())
+ {
+ outParams.push_back(*pli);
+ }
+ }
+
+ vector<string> params = getParamsAsyncCB(p, classPkg, false, true);
+ vector<string> args = getInOutArgs(p, OutParam);
+ ExceptionList throws = p->throws();
+
+ //
+ // If the operation has more than one return parameter we generate a Callback
+ // interface to use in the method signatures.
+ //
+ if(p->returnsData() && ((ret && !outParams.empty()) || outParams.size() > 1))
+ {
+ open(getAbsolute(cl, "", "_Callback_", "_" + name), p->file());
+
+ Output& out = output();
+
+ writeDocCommentOp(out, p);
+ out << sp << nl << "public interface " << ("_Callback_" + cl->name()) << '_' << name
+ << " extends " << (throws.empty() ? "Ice.TwowayCallback" : "Ice.TwowayCallbackUE");
+ out << sb;
+ out << nl << "public void response" << spar << params << epar << ';';
+ out << eb;
+
+ close();
+ }
+
+ string classNameAsync = "Callback_" + cl->name();
+ string absoluteAsync = getAbsolute(cl, "", "Callback_", "_" + name);
+
+ open(absoluteAsync, p->file());
+
+ Output& out = output();
+
+ writeDocCommentOp(out, p);
+ out << sp << nl << "public abstract class " << classNameAsync << '_' << name;
+
+ if(p->returnsData())
+ {
+ out.inc();
+ out << nl << "extends " << getAsyncCallbackBaseClass(p, false);
+ out.dec();
+ out << sb;
+
+ out << sp << nl << "public final void __completed(Ice.AsyncResult __result)";
+ out << sb;
+ out << nl << cl->name() << "PrxHelper.__" << p->name() << "_completed(this, __result);";
+ out << eb;
+
+ out << eb;
+ }
+ else
+ {
+ out << " extends Ice.OnewayCallback";
+ out << sb;
+ out << eb;
+ }
+
+ close();
+ }
+
+ if(cl->hasMetaData("amd") || p->hasMetaData("amd"))
+ {
+ string classNameAMD = "AMD_" + cl->name();
+ string absoluteAMD = getAbsolute(cl, "", "AMD_", "_" + name);
+
+ string classNameAMDI = "_AMD_" + cl->name();
+ string absoluteAMDI = getAbsolute(cl, "", "_AMD_", "_" + name);
+
+ const bool optionalMapping = useOptionalMapping(p);
+ vector<string> paramsAMD = getParamsAsyncCB(p, classPkg, true, optionalMapping);
+
+ {
+ open(absoluteAMD, p->file());
+
+ Output& out = output();
+
+ writeDocCommentOp(out, p);
+ out << sp << nl << "public interface " << classNameAMD << '_' << name;
+ out << " extends Ice.AMDCallback";
+ out << sb;
+ out << sp;
+ writeDocCommentAsync(out, p, OutParam);
+ out << nl << "void ice_response" << spar << paramsAMD << epar << ';';
+
+ out << eb;
+
+ close();
+ }
+
+ {
+ open(absoluteAMDI, p->file());
+
+ Output& out = output();
+
+ TypePtr ret = p->returnType();
+
+ ParamDeclList outParams;
+ ParamDeclList paramList = p->parameters();
+ for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
+ {
+ if((*pli)->isOutParam())
+ {
+ outParams.push_back(*pli);
+ }
+ }
+
+ ExceptionList throws = p->throws();
+ throws.sort();
+ throws.unique();
+
+ //
+ // Arrange exceptions into most-derived to least-derived order. If we don't
+ // do this, a base exception handler can appear before a derived exception
+ // handler, causing compiler warnings and resulting in the base exception
+ // being marshaled instead of the derived exception.
+ //
+#if defined(__SUNPRO_CC)
+ throws.sort(Slice::derivedToBaseCompare);
+#else
+ throws.sort(Slice::DerivedToBaseCompare());
+#endif
+
+ int iter;
+
+ out << sp << nl << "final class " << classNameAMDI << '_' << name
+ << " extends IceInternal.IncomingAsync implements " << classNameAMD << '_' << name;
+ out << sb;
+
+ out << sp << nl << "public " << classNameAMDI << '_' << name << "(IceInternal.Incoming in)";
+ out << sb;
+ out << nl << "super(in);";
+ out << eb;
+
+ out << sp << nl << "public void ice_response" << spar << paramsAMD << epar;
+ out << sb;
+ iter = 0;
+ out << nl << "if(__validateResponse(true))";
+ out << sb;
+ if(ret || !outParams.empty())
+ {
+ out << nl << "try";
+ out << sb;
+ out << nl << "Ice.OutputStream __os = this.__startWriteParams("
+ << opFormatTypeToString(p) << ");";
+ writeMarshalUnmarshalParams(out, classPkg, outParams, p, iter, true, optionalMapping, false);
+ if(p->returnsClasses(false))
+ {
+ out << nl << "__os.writePendingValues();";
+ }
+ out << nl << "this.__endWriteParams(true);";
+ out << eb;
+ out << nl << "catch(Ice.LocalException __ex)";
+ out << sb;
+ out << nl << "__exception(__ex);";
+ out << nl << "return;";
+ out << eb;
+ }
+ else
+ {
+ out << nl << "__writeEmptyParams();";
+ }
+ out << nl << "__response();";
+ out << eb;
+ out << eb;
+
+ if(!throws.empty())
+ {
+ out << sp << nl << "public void ice_exception(java.lang.Exception ex)";
+ out << sb;
+ out << nl << "try";
+ out << sb;
+ out << nl << "throw ex;";
+ out << eb;
+ for(ExceptionList::const_iterator r = throws.begin(); r != throws.end(); ++r)
+ {
+ string exS = getAbsolute(*r, classPkg);
+ out << nl << "catch(" << exS << " __ex)";
+ out << sb;
+ out << nl << "if(__validateResponse(false))";
+ out << sb;
+ out << nl << "__writeUserException(__ex, " << opFormatTypeToString(p) << ");";
+ out << nl << "__response();";
+ out << eb;
+ out << eb;
+ }
+ out << nl << "catch(java.lang.Exception __ex)";
+ out << sb;
+ out << nl << "super.ice_exception(__ex);";
+ out << eb;
+ out << eb;
+ }
+
+ out << eb;
+
+ close();
+ }
+ }
+}
diff --git a/cpp/src/slice2java/GenCompat.h b/cpp/src/slice2java/GenCompat.h
new file mode 100644
index 00000000000..c03d491f380
--- /dev/null
+++ b/cpp/src/slice2java/GenCompat.h
@@ -0,0 +1,317 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef GEN_COMPAT_H
+#define GEN_COMPAT_H
+
+#include <Slice/Parser.h>
+#include <Slice/JavaUtil.h>
+#include <Slice/Checksum.h>
+
+namespace Slice
+{
+
+class JavaCompatVisitor : public JavaCompatGenerator, public ParserVisitor
+{
+public:
+
+ virtual ~JavaCompatVisitor();
+
+protected:
+
+ JavaCompatVisitor(const std::string&);
+
+ enum ParamDir { InParam, OutParam };
+
+ ParamDeclList getOutParams(const OperationPtr&);
+
+ //
+ // Compose the parameter lists for an operation.
+ //
+ std::vector<std::string> getParams(const OperationPtr&, const std::string&, bool, bool);
+ std::vector<std::string> getParamsProxy(const OperationPtr&, const std::string&, bool, bool);
+ std::vector<std::string> getInOutParams(const OperationPtr&, const std::string&, ParamDir, bool, bool);
+ std::vector<std::string> getParamsAsync(const OperationPtr&, const std::string&, bool, bool);
+ std::vector<std::string> getParamsAsyncCB(const OperationPtr&, const std::string&, bool, bool);
+
+ std::string getAsyncCallbackInterface(const OperationPtr&, const std::string&);
+ std::string getAsyncCallbackBaseClass(const OperationPtr&, bool);
+ std::string getLambdaResponseCB(const OperationPtr&, const std::string&);
+ std::vector<std::string> getParamsAsyncLambda(const OperationPtr&, const std::string&,
+ bool context = false, bool sentCB = false,
+ bool optionalMapping = false,
+ bool inParams = true);
+ std::vector<std::string> getArgsAsyncLambda(const OperationPtr&, const std::string&,
+ bool context = false, bool sentCB = false);
+
+ //
+ // Compose the argument lists for an operation.
+ //
+ std::vector<std::string> getArgs(const OperationPtr&);
+ std::vector<std::string> getInOutArgs(const OperationPtr&, ParamDir);
+ std::vector<std::string> getArgsAsync(const OperationPtr&);
+ std::vector<std::string> getArgsAsyncCB(const OperationPtr&);
+
+ void writeMarshalUnmarshalParams(::IceUtilInternal::Output&, const std::string&, const ParamDeclList&,
+ const OperationPtr&, int&, bool, bool, bool = false);
+
+ //
+ // Generate a throws clause containing only non-local exceptions.
+ //
+ void writeThrowsClause(const std::string&, const ExceptionList&);
+
+ //
+ // Generate code to compute a hash code for a type.
+ //
+ void writeHashCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, int&,
+ const std::list<std::string>& = std::list<std::string>());
+
+ //
+ // Marshal/unmarshal a data member.
+ //
+ void writeMarshalDataMember(::IceUtilInternal::Output&, const std::string&, const DataMemberPtr&, int&);
+ void writeUnmarshalDataMember(::IceUtilInternal::Output&, const std::string&, const DataMemberPtr&, int&,
+ bool, int&);
+ void writeStreamMarshalDataMember(::IceUtilInternal::Output&, const std::string&, const DataMemberPtr&, int&);
+ void writeStreamUnmarshalDataMember(::IceUtilInternal::Output&, const std::string&, const DataMemberPtr&, int&,
+ bool, int&);
+
+ //
+ // Generate a patcher class.
+ //
+ void writePatcher(::IceUtilInternal::Output&, const std::string&, const DataMemberList&, const DataMemberList&);
+
+ //
+ // Generate dispatch and marshalling methods for a class or interface.
+ //
+ void writeDispatchAndMarshalling(::IceUtilInternal::Output&, const ClassDefPtr&);
+
+ //
+ // Write a constant or default value initializer.
+ //
+ void writeConstantValue(::IceUtilInternal::Output&, const TypePtr&, const SyntaxTreeBasePtr&, const std::string&,
+ const std::string&);
+
+ //
+ // Generate assignment statements for those data members that have default values.
+ //
+ void writeDataMemberInitializers(::IceUtilInternal::Output&, const DataMemberList&, const std::string&);
+
+ //
+ // Write doc comments.
+ //
+ static StringList splitComment(const ContainedPtr&);
+ static void writeDocComment(::IceUtilInternal::Output&, const ContainedPtr&,
+ const std::string&, const std::string& = "");
+ static void writeDocComment(::IceUtilInternal::Output&, const std::string&, const std::string&);
+ static void writeDocCommentOp(::IceUtilInternal::Output&, const OperationPtr&);
+
+ static void writeDocCommentAsync(::IceUtilInternal::Output&, const OperationPtr&,
+ ParamDir, const std::string& = "");
+ static void writeDocCommentAMI(::IceUtilInternal::Output&, const OperationPtr&, ParamDir, const std::string& = "",
+ const std::string& = "", const std::string& = "", const std::string& = "",
+ const std::string& = "");
+ static void writeDocCommentParam(::IceUtilInternal::Output&, const OperationPtr&, ParamDir, bool = true);
+};
+
+class GenCompat : private ::IceUtil::noncopyable
+{
+public:
+
+ GenCompat(const std::string&,
+ const std::string&,
+ const std::vector<std::string>&,
+ const std::string&);
+ ~GenCompat();
+
+ void generate(const UnitPtr&);
+ void generateTie(const UnitPtr&);
+ void generateImpl(const UnitPtr&);
+ void generateImplTie(const UnitPtr&);
+
+ static void writeChecksumClass(const std::string&, const std::string&, const ChecksumMap&);
+
+private:
+
+ std::string _base;
+ std::vector<std::string> _includePaths;
+ std::string _dir;
+
+ class OpsVisitor : public JavaCompatVisitor
+ {
+ public:
+
+ OpsVisitor(const std::string&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+
+ private:
+ void writeOperations(const ClassDefPtr&, bool);
+ };
+
+ class TieVisitor : public JavaCompatVisitor
+ {
+ public:
+
+ TieVisitor(const std::string&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ };
+
+ class PackageVisitor : public JavaCompatVisitor
+ {
+ public:
+
+ PackageVisitor(const std::string&);
+
+ virtual bool visitModuleStart(const ModulePtr&);
+ };
+
+ class TypesVisitor : public JavaCompatVisitor
+ {
+ public:
+
+ TypesVisitor(const std::string&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual bool visitExceptionStart(const ExceptionPtr&);
+ virtual void visitExceptionEnd(const ExceptionPtr&);
+ virtual bool visitStructStart(const StructPtr&);
+ virtual void visitStructEnd(const StructPtr&);
+ virtual void visitDataMember(const DataMemberPtr&);
+ virtual void visitEnum(const EnumPtr&);
+ virtual void visitConst(const ConstPtr&);
+
+ private:
+
+ //
+ // Verifies that a data member method does not conflict with an operation.
+ //
+ bool validateMethod(const OperationList&, const std::string&, int, const std::string&, const std::string&);
+ };
+
+ class CompactIdVisitor : public JavaCompatVisitor
+ {
+ public:
+
+ CompactIdVisitor(const std::string&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ };
+
+ class HolderVisitor : public JavaCompatVisitor
+ {
+ public:
+
+ HolderVisitor(const std::string&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual bool visitStructStart(const StructPtr&);
+ virtual void visitSequence(const SequencePtr&);
+ virtual void visitDictionary(const DictionaryPtr&);
+ virtual void visitEnum(const EnumPtr&);
+
+ private:
+
+ void writeHolder(const TypePtr&);
+ };
+
+ class HelperVisitor : public JavaCompatVisitor
+ {
+ public:
+
+ HelperVisitor(const std::string&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitSequence(const SequencePtr&);
+ virtual void visitDictionary(const DictionaryPtr&);
+
+ private:
+
+ void writeOperation(const ClassDefPtr&, const std::string&, const OperationPtr&, bool);
+ };
+
+ class ProxyVisitor : public JavaCompatVisitor
+ {
+ public:
+
+ ProxyVisitor(const std::string&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ virtual void visitClassDefEnd(const ClassDefPtr&);
+ virtual void visitOperation(const OperationPtr&);
+ };
+
+ class DispatcherVisitor : public JavaCompatVisitor
+ {
+ public:
+
+ DispatcherVisitor(const std::string&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ };
+
+ class BaseImplVisitor : public JavaCompatVisitor
+ {
+ public:
+
+ BaseImplVisitor(const std::string&);
+
+ protected:
+
+ //
+ // Generate code to emit a local variable declaration and initialize it
+ // if necessary.
+ //
+ void writeDecl(::IceUtilInternal::Output&, const std::string&, const std::string&, const TypePtr&,
+ const StringList&, bool);
+
+ //
+ // Generate code to return a value.
+ //
+ void writeReturn(::IceUtilInternal::Output&, const TypePtr&, bool);
+
+ //
+ // Generate an operation.
+ //
+ void writeOperation(::IceUtilInternal::Output&, const std::string&, const OperationPtr&, bool);
+ };
+
+ class ImplVisitor : public BaseImplVisitor
+ {
+ public:
+
+ ImplVisitor(const std::string&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ };
+
+ class ImplTieVisitor : public BaseImplVisitor
+ {
+ public:
+
+ ImplTieVisitor(const std::string&);
+
+ virtual bool visitClassDefStart(const ClassDefPtr&);
+ };
+
+ class AsyncVisitor : public JavaCompatVisitor
+ {
+ public:
+
+ AsyncVisitor(const std::string&);
+
+ virtual void visitOperation(const OperationPtr&);
+ };
+};
+
+}
+
+#endif
diff --git a/cpp/src/slice2java/Main.cpp b/cpp/src/slice2java/Main.cpp
index 7b9737d98a2..aba738cfaa3 100644
--- a/cpp/src/slice2java/Main.cpp
+++ b/cpp/src/slice2java/Main.cpp
@@ -15,6 +15,7 @@
#include <Slice/FileTracker.h>
#include <Slice/Util.h>
#include <Gen.h>
+#include <GenCompat.h>
#include <iterator>
using namespace std;
@@ -81,6 +82,7 @@ usage(const char* n)
"--underscore Allow underscores in Slice identifiers.\n"
"--checksum CLASS Generate checksums for Slice definitions into CLASS.\n"
"--meta META Define global metadata directive META.\n"
+ "--compat Use the backward-compatible language mapping.\n"
;
}
@@ -108,7 +110,7 @@ compile(int argc, char* argv[])
opts.addOpt("", "underscore");
opts.addOpt("", "checksum", IceUtilInternal::Options::NeedArg);
opts.addOpt("", "meta", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat);
-
+ opts.addOpt("", "compat");
bool validate = false;
for(int i = 0; i < argc; ++i)
@@ -193,6 +195,8 @@ compile(int argc, char* argv[])
vector<string> v = opts.argVec("meta");
copy(v.begin(), v.end(), back_inserter(globalMetadata));
+ bool compat = opts.isSet("compat");
+
if(args.empty())
{
getErrorStream() << argv[0] << ": error: no input file" << endl;
@@ -213,6 +217,16 @@ compile(int argc, char* argv[])
return EXIT_FAILURE;
}
+ if(!compat && (tie || implTie))
+ {
+ getErrorStream() << argv[0] << ": error: TIE classes are only supported with the Java-Compat mapping" << endl;
+ if(!validate)
+ {
+ usage(argv[0]);
+ }
+ return EXIT_FAILURE;
+ }
+
if(depend && dependxml)
{
getErrorStream() << argv[0] << ": error: cannot specify both --depend and --depend-xml" << endl;
@@ -241,6 +255,13 @@ compile(int argc, char* argv[])
out.os() << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dependencies>" << endl;
}
+ vector<string> cppOpts;
+ cppOpts.push_back("-D__SLICE2JAVA__");
+ if(compat)
+ {
+ cppOpts.push_back("-D__SLICE2JAVA_COMPAT__");
+ }
+
for(vector<string>::const_iterator i = args.begin(); i != args.end(); ++i)
{
//
@@ -255,7 +276,7 @@ compile(int argc, char* argv[])
if(depend || dependxml)
{
PreprocessorPtr icecpp = Preprocessor::create(argv[0], *i, cppArgs);
- FILE* cppHandle = icecpp->preprocess(false, "-D__SLICE2JAVA__");
+ FILE* cppHandle = icecpp->preprocess(false, cppOpts);
if(cppHandle == 0)
{
@@ -273,8 +294,8 @@ compile(int argc, char* argv[])
return EXIT_FAILURE;
}
- if(!icecpp->printMakefileDependencies(out.os(), depend ? Preprocessor::Java : Preprocessor::SliceXML, includePaths,
- "-D__SLICE2JAVA__"))
+ if(!icecpp->printMakefileDependencies(out.os(), depend ? Preprocessor::Java : Preprocessor::SliceXML,
+ includePaths, cppOpts))
{
out.cleanup();
return EXIT_FAILURE;
@@ -297,7 +318,7 @@ compile(int argc, char* argv[])
FileTracker::instance()->setSource(*i);
PreprocessorPtr icecpp = Preprocessor::create(argv[0], *i, cppArgs);
- FILE* cppHandle = icecpp->preprocess(true, "-D__SLICE2JAVA__");
+ FILE* cppHandle = icecpp->preprocess(true, cppOpts);
if(cppHandle == 0)
{
@@ -348,31 +369,55 @@ compile(int argc, char* argv[])
{
try
{
- Gen gen(argv[0], icecpp->getBaseName(), includePaths, output);
- gen.generate(p);
- if(tie)
- {
- gen.generateTie(p);
- }
- if(impl)
+ if(compat)
{
- gen.generateImpl(p);
+ GenCompat gen(argv[0], icecpp->getBaseName(), includePaths, output);
+ gen.generate(p);
+ if(tie)
+ {
+ gen.generateTie(p);
+ }
+ if(impl)
+ {
+ gen.generateImpl(p);
+ }
+ if(implTie)
+ {
+ gen.generateImplTie(p);
+ }
+ if(!checksumClass.empty())
+ {
+ //
+ // Calculate checksums for the Slice definitions in the unit.
+ //
+ ChecksumMap m = createChecksums(p);
+ copy(m.begin(), m.end(), inserter(checksums, checksums.begin()));
+ }
+ if(listGenerated)
+ {
+ FileTracker::instance()->setOutput(os.str(), false);
+ }
}
- if(implTie)
- {
- gen.generateImplTie(p);
- }
- if(!checksumClass.empty())
- {
- //
- // Calculate checksums for the Slice definitions in the unit.
- //
- ChecksumMap m = createChecksums(p);
- copy(m.begin(), m.end(), inserter(checksums, checksums.begin()));
- }
- if(listGenerated)
+ else
{
- FileTracker::instance()->setOutput(os.str(), false);
+ Gen gen(argv[0], icecpp->getBaseName(), includePaths, output);
+ gen.generate(p);
+ if(impl)
+ {
+ gen.generateImpl(p);
+ }
+ if(!checksumClass.empty())
+ {
+ //
+ // Calculate checksums for the Slice definitions in the unit.
+ //
+ ChecksumMap m = createChecksums(p);
+ copy(m.begin(), m.end(), inserter(checksums, checksums.begin()));
+ }
+ if(listGenerated)
+ {
+ FileTracker::instance()->setOutput(os.str(), false);
+ }
}
}
catch(const Slice::FileException& ex)
@@ -423,8 +468,9 @@ compile(int argc, char* argv[])
}
catch(const Slice::FileException& ex)
{
- // If a file could not be created, then
- // cleanup any created files.
+ //
+ // If a file could not be created, then cleanup any created files.
+ //
FileTracker::instance()->cleanup();
getErrorStream() << argv[0] << ": error: " << ex.reason() << endl;
return EXIT_FAILURE;
diff --git a/java-compat/.externalToolBuilders/Slice.launch b/java-compat/.externalToolBuilders/Slice.launch
new file mode 100644
index 00000000000..6d425759550
--- /dev/null
+++ b/java-compat/.externalToolBuilders/Slice.launch
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
+<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AUTO_TARGETS" value="generate,freeze-generate,test-generate,"/>
+<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_CLEAN_TARGETS" value="clean-generated,"/>
+<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_MANUAL_TARGETS" value="generate,freeze-generate,test-generate,"/>
+<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
+<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
+<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/>
+<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="ice"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE" value="${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;resources&gt;&#10;&lt;item path=&quot;/ice/slice&quot; type=&quot;2&quot;/&gt;&#10;&lt;item path=&quot;/ice/slice.test&quot; type=&quot;2&quot;/&gt;&#10;&lt;item path=&quot;/ice/test/Slice&quot; type=&quot;2&quot;/&gt;&#10;&lt;/resources&gt;}"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/ice/build.xml}"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="incremental,auto,clean"/>
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
+</launchConfiguration>
diff --git a/java-compat/.gitignore b/java-compat/.gitignore
new file mode 100644
index 00000000000..e7d1999a61f
--- /dev/null
+++ b/java-compat/.gitignore
@@ -0,0 +1,4 @@
+build
+.gradle
+*.iml
+.idea
diff --git a/java-compat/.settings/org.eclipse.jdt.core.prefs b/java-compat/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..60617a4080a
--- /dev/null
+++ b/java-compat/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,384 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=8
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=120
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=space
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=false
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/java-compat/.settings/org.eclipse.jdt.ui.prefs b/java-compat/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000000..74e568e0217
--- /dev/null
+++ b/java-compat/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+formatter_profile=_ZeroC
+formatter_settings_version=12
diff --git a/java-compat/BuildInstructions.md b/java-compat/BuildInstructions.md
new file mode 100644
index 00000000000..7ef2eaa7401
--- /dev/null
+++ b/java-compat/BuildInstructions.md
@@ -0,0 +1,165 @@
+# Building Ice for Java
+
+This page describes how to build and install Ice for Java from source code. If
+you prefer, you can also download [binary distributions][1] for the supported
+platforms.
+
+## Build Requirements
+
+### Operating Systems
+
+Ice for Java is expected to build and run properly on Windows, OS X, and any
+recent Linux distribution for x86 and x86_64, and was extensively tested using
+the operating systems and compiler versions listed for our [supported
+platforms][2]. Due to the portability of Java, it is very likely that it will
+also work on other platforms for which a suitable Java implementation is
+available.
+
+### Slice to Java Translator
+
+You will need the Slice to Java translator. ZeroC provides translator binaries
+for our supported platforms. For other platforms, you will have to either port
+Ice for C++ (which contains the Slice to Java translator), or you will have to
+translate your Slice files to Java on a supported platform and then copy the
+generated Java files to your target platform.
+
+### Java Version
+
+Ice for Java requires J2SE 1.7.0 or later.
+
+Make sure that the `javac` and `java` commands are present in your PATH.
+
+### Gradle
+
+Ice for Java uses the [Gradle][3] build system, and includes the Gradle wrapper
+version 2.4 in the distribution. You cannot build the Ice for Java source
+distribution without an Internet connection. Gradle will download all required
+packages automatically. These packages are listed below. Gradle will
+automatically download any necessary build artifacts from ZeroC's Maven
+repository located at
+
+ http://repo.zeroc.com/nexus/content/repositories/thirdparty
+
+### Bzip2 Compression
+
+Ice for Java supports protocol compression using the bzip2 classes included
+with Apache Ant or available separately from [kohsuke.org]().
+
+The Maven package id for the bzip2 JAR file is as follows:
+
+ groupId=org.apache.tools, version=1.0, artifactId=bzip2
+
+The demos and tests are automatically setup to enable protocol compression by
+adding the bzip2 JAR to the manifest class path. For your own applications you
+must add the bzip2 JAR to the application CLASSPATH to enable protocol
+compression.
+
+> *These classes are a pure Java implementation of the bzip2 algorithm and
+therefore add significant latency to Ice requests.*
+
+## Compiling Ice for Java
+
+### Preparing to Build
+
+The build system requires the Slice translators from Ice for C++. If you have
+not built Ice for C++ in this source distribution, you must set the `ICE_HOME`
+environment variable with the path name of your Ice installation. For example,
+on Unix:
+
+ $ export ICE_HOME=/opt/Ice-3.7a3 (For local build)
+ $ export ICE_HOME=/usr (For RPM installation)
+
+On Windows:
+
+ > set ICE_HOME=C:\Program Files (x86)\ZeroC\Ice-3.7a3
+
+You will also need to set `CPP_PLATFORM` and `CPP_CONFIGURATION` to much your C++
+build configuration in order for gradle o locate the slice2java compiler
+
+For example if you build C++ sources for `x64` platform in `Release` mode set
+this properties as:
+
+ > set CPP_PLATFORM=x64
+ > set CPP_CONFIGURATION=Debug
+
+The supported values for `CPP_PLATFORM` are `Win32` and `x64`and the supported
+values for `CPP_CONFIGURATION` are `Debug` and `Release`
+
+Before building Ice for Java, review the settings in the file
+`gradle.properties` and edit as necessary.
+
+### Building Ice for Java
+
+To build Ice, all services, and tests, run
+
+ > gradlew build
+
+Upon completion, the Ice JAR and POM files are placed in the `lib` subdirectory.
+
+If at any time you wish to discard the current build and start a new one, use
+these commands:
+
+ > gradlew clean
+ > gradlew build
+
+## Installing Ice for Java
+
+To install Ice for Java in the directory specified by the `prefix` variable in
+`gradle.properties` run the following command
+
+ > gradlew install
+
+The installation installs the following JAR files to `<prefix>/lib`.
+
+ glacier2-3.7.0.jar
+ ice-3.7a3.jar
+ icebox-3.7.0.jar
+ icediscovery-3.7.0.jar
+ icegrid-3.7.0.jar
+ icegridgui.jar
+ icelocatordiscovery-3.7.0.jar
+ icepatch2-3.7.0.jar
+ icestorm-3.7.0.jar
+
+POM files are also installed for ease of deployment to a maven-based
+distribution system.
+
+## Running the Java Tests
+
+Some of the Ice for Java tests employ applications that are part of the Ice for
+C++ distribution. If you have not built Ice for C++ in this source distribution
+then you must set the `ICE_HOME` environment variable with the path name of your
+Ice installation. On Unix:
+
+ $ export ICE_HOME=/opt/Ice-3.7a3 (For local build)
+ $ export ICE_HOME=/usr (For RPM installation)
+
+On Windows:
+
+ > set ICE_HOME=c:\Program Files (x86)\ZeroC\Ice-3.7a3
+
+Python is required to run the test suite. To run the tests, open a command
+window and change to the top-level directory. At the command prompt, execute:
+
+ > python allTests.py
+
+You can also run tests individually by changing to the test directory and
+running this command:
+
+ > python run.py
+
+If everything worked out, you should see lots of `ok` messages. In case of a
+failure, the tests abort with `failed`.
+
+## Test Controller
+
+The test Controller is an Ice server that starts servers for languages that
+don't provide a full server side implementation. This is currently used by
+the JavaScript and WinRT test suites to start the required servers.
+
+ > gradlew :testController:assemble
+
+
+[1]: https://zeroc.com/download.html
+[2]: https://doc.zeroc.com/display/Ice37/Supported+Platforms+for+Ice+3.7.0
+[3]: http://gradle.org
diff --git a/java-compat/Makefile b/java-compat/Makefile
new file mode 100644
index 00000000000..c23f2f02c60
--- /dev/null
+++ b/java-compat/Makefile
@@ -0,0 +1,46 @@
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+ifneq ($(prefix),)
+INSTALL_FLAGS += -Pprefix=$(prefix)
+endif
+
+ifneq ($(install_javadir),)
+INSTALL_FLAGS += -Dorg.gradle.project.jarDir=$(install_javadir)
+endif
+
+ifneq ($(install_bindir),)
+INSTALL_FLAGS += -Dorg.gradle.project.binDir=$(install_bindir)
+endif
+
+ifneq ($(DESTDIR),)
+INSTALL_FLAGS += -PDESTDIR=$(DESTDIR)
+endif
+
+ifeq ($(GRADLE),)
+GRADLE = ./gradlew
+endif
+
+all:
+ $(GRADLE) $(BUILD_FLAGS) build
+
+tests:
+ $(GRADLE) $(BUILD_FLAGS) :test:assemble
+
+srcs:
+ $(GRADLE) $(BUILD_FLAGS) dist
+
+distclean clean:
+ $(GRADLE) clean
+
+install::
+ $(GRADLE) $(INSTALL_FLAGS) install
+
+test::
+ @python ./allTests.py
diff --git a/java-compat/allTests.py b/java-compat/allTests.py
new file mode 100755
index 00000000000..7ca52f7db4c
--- /dev/null
+++ b/java-compat/allTests.py
@@ -0,0 +1,86 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys, re, getopt
+
+path = [ ".", "..", "../..", "../../..", "../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+#
+# List of all basic tests.
+#
+tests = [
+ ("Slice/generation", ["once"]),
+ ("Slice/keyword", ["once"]),
+ ("Slice/macros", ["once"]),
+ ("Slice/structure", ["once"]),
+ ("IceUtil/inputUtil", ["once"]),
+ ("Ice/proxy", ["core"]),
+ ("Ice/operations", ["core"]),
+ ("Ice/seqMapping", ["core"]),
+ ("Ice/exceptions", ["core"]),
+ ("Ice/ami", ["core", "nocompress"]),
+ ("Ice/info", ["core", "noipv6", "nocompress", "nosocks"]),
+ ("Ice/inheritance", ["core"]),
+ ("Ice/facets", ["core"]),
+ ("Ice/objects", ["core"]),
+ ("Ice/binding", ["core"]),
+ ("Ice/faultTolerance", ["core"]),
+ ("Ice/location", ["core"]),
+ ("Ice/adapterDeactivation", ["core"]),
+ ("Ice/slicing/exceptions", ["core"]),
+ ("Ice/slicing/objects", ["core"]),
+ ("Ice/custom", ["core"]),
+ ("Ice/checksum", ["core"]),
+ ("Ice/dispatcher", ["core"]),
+ ("Ice/interrupt", ["core", "nocompress"]),
+ ("Ice/packagemd", ["core"]),
+ ("Ice/stream", ["core"]),
+ ("Ice/hold", ["core"]),
+ ("Ice/retry", ["core"]),
+ ("Ice/timeout", ["core", "nocompress"]),
+ ("Ice/acm", ["core"]),
+ ("Ice/background", ["core", "nosocks"]),
+ ("Ice/servantLocator", ["core"]),
+ ("Ice/interceptor", ["core"]),
+ ("Ice/udp", ["core"]),
+ ("Ice/serialize", ["core"]),
+ ("Ice/defaultServant", ["core"]),
+ ("Ice/defaultValue", ["core"]),
+ ("Ice/threadPoolPriority", ["core"]),
+ ("Ice/classLoader", ["core"]),
+ ("Ice/invoke", ["core"]),
+ ("Ice/properties", ["once"]),
+ ("Ice/plugin", ["core"]),
+ ("Ice/hash", ["once"]),
+ ("Ice/optional", ["once"]),
+ ("Ice/admin", ["core"]),
+ ("Ice/metrics", ["core", "nows", "noipv6", "nocompress", "nosocks"]),
+ ("Ice/enums", ["once"]),
+ ("Ice/networkProxy", ["core", "noipv6", "nosocks"]),
+ ("IceBox/admin", ["core", "noipv6", "nomx"]),
+ ("IceBox/configuration", ["core", "noipv6", "nomx"]),
+ ("Glacier2/router", ["service"]),
+ ("Glacier2/sessionHelper", ["core"]),
+ ("IceDiscovery/simple", ["service"]),
+ ("IceGrid/simple", ["service"]),
+ ("IceSSL/configuration", ["once"])
+ ]
+
+if __name__ == "__main__":
+ TestUtil.run(tests)
diff --git a/java-compat/build.gradle b/java-compat/build.gradle
new file mode 100644
index 00000000000..623a32c2b18
--- /dev/null
+++ b/java-compat/build.gradle
@@ -0,0 +1,73 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+subprojects {
+ project.version = iceVersion
+ project.group = "com.zeroc"
+
+ apply plugin: 'java'
+ apply plugin: 'idea'
+ apply from: "$rootProject.projectDir/../java/gradle/ice.gradle"
+
+ // We set this early so that slice.jarDir is correct
+ slice.compat = true
+
+ repositories {
+ if (slice.jarDir) {
+ flatDir {
+ name "local"
+ dirs slice.jarDir
+ }
+ }
+
+ if(new File("/usr/share/maven-repo").exists()) {
+ maven {
+ url "/usr/share/maven-repo"
+ }
+ }
+
+ mavenCentral()
+
+ maven {
+ url 'https://repo.zeroc.com/nexus/content/repositories/thirdparty'
+ }
+ }
+
+ jar {
+ manifest {
+ attributes("Built-By": "ZeroC, Inc.")
+ }
+ }
+
+ tasks.withType(JavaCompile) {
+ options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-Xlint:-options"
+ }
+
+ idea.module {
+ excludeDirs -= file(buildDir)
+ buildDir.listFiles({d, f ->f != 'generated-src'} as FilenameFilter).each { excludeDirs += it }
+ }
+}
+
+task dist()
+dist.dependsOn(project(":ice-compat").assemble)
+dist.dependsOn(project(":glacier2-compat").assemble)
+dist.dependsOn(project(":icegrid-compat").assemble)
+dist.dependsOn(project(":icebox-compat").assemble)
+dist.dependsOn(project(":icediscovery-compat").assemble)
+dist.dependsOn(project(":icepatch2-compat").assemble)
+dist.dependsOn(project(":icestorm-compat").assemble)
+
+//
+// Used to build the gradle wrapper to automatically download and install
+// the version of gradle needed to build Ice.
+//
+task wrapper(type: Wrapper) {
+ gradleVersion = "2.14"
+}
diff --git a/java-compat/gradle.properties b/java-compat/gradle.properties
new file mode 100644
index 00000000000..1655ea06b97
--- /dev/null
+++ b/java-compat/gradle.properties
@@ -0,0 +1,77 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+iceVersion = 3.7.0-alpha3
+
+//
+// Select an installation base directory. The directory will be created
+// if it does not exist. If this property is not set the default will be
+// used. Default values are:
+// - Windows: %SystemDrive%\Ice-${iceVersion}
+// - Non Windows /opt/Ice-${iceVersion}
+//
+prefix =
+
+//
+// Set to true if you want to add Class-Path entries to Ice JAR files
+// when installing the JARs. That is mostly usefull when building JAR
+// files to be used in system packages.
+//
+jarsClassPath = false
+
+//
+// Define debug as true if you want to build with debug information,
+// false otherwise.
+//
+debug = true
+
+//
+// Set the location of a local Ice Builder for Gradle source directory
+//
+iceBuilderHome =
+
+//
+// Windows specific options
+//
+
+//
+// The platform uses by the C++ builds, supported values are `x64` and `Win32`,
+// that is required to locate the slice2java compiler in the platform depend
+// directory.
+//
+cppPlatform =
+
+//
+// The configuration uses by the C++ builds, supported values are `Debug` and `Release`,
+// that is required to locate the slice2java compiler in the configuration depend
+// directory.
+//
+cppConfiguration =
+
+//
+// Gradle build properties
+//
+org.gradle.daemon = true
+org.gradle.parallel = true
+
+//
+// Package build properties
+//
+DESTDIR =
+
+//
+// The installation directory for Jar files, if not set, defaults to <prefix>/share
+// for /usr installation, <prefix>/lib otherwise.
+//
+jarDir =
+
+//
+// The installation directory for executable files, if not set, defaults to <prefix>/bin.
+//
+binDir =
diff --git a/java-compat/gradle/GRADLE_LICENSE b/java-compat/gradle/GRADLE_LICENSE
new file mode 100755
index 00000000000..80e31a864a8
--- /dev/null
+++ b/java-compat/gradle/GRADLE_LICENSE
@@ -0,0 +1,16 @@
+License Agreement for Gradle, including the Gradle Wrapper (gradlew)
+--------------------------------------------------------------------
+
+Copyright 2007-2011 the original author or authors
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/java-compat/gradle/wrapper/gradle-wrapper.jar b/java-compat/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 00000000000..d3b83982b9b
--- /dev/null
+++ b/java-compat/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/java-compat/gradle/wrapper/gradle-wrapper.properties b/java-compat/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 00000000000..df0b97f2e45
--- /dev/null
+++ b/java-compat/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Wed Jul 27 16:17:53 EDT 2016
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
diff --git a/java-compat/gradlew b/java-compat/gradlew
new file mode 100755
index 00000000000..27309d92314
--- /dev/null
+++ b/java-compat/gradlew
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/java-compat/gradlew.bat b/java-compat/gradlew.bat
new file mode 100755
index 00000000000..832fdb6079b
--- /dev/null
+++ b/java-compat/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/java-compat/settings.gradle b/java-compat/settings.gradle
new file mode 100644
index 00000000000..5877e31fab6
--- /dev/null
+++ b/java-compat/settings.gradle
@@ -0,0 +1,35 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Main source
+include ':ice-compat'
+project(':ice-compat').projectDir = new File('src/Ice')
+include ':icediscovery-compat'
+project(':icediscovery-compat').projectDir = new File('src/IceDiscovery')
+include ':icelocatordiscovery-compat'
+project(':icelocatordiscovery-compat').projectDir = new File('src/IceLocatorDiscovery')
+include ':icebt-compat'
+project(':icebt-compat').projectDir = new File('src/IceBT')
+include ':icebox-compat'
+project(':icebox-compat').projectDir = new File('src/IceBox')
+include ':glacier2-compat'
+project(':glacier2-compat').projectDir = new File('src/Glacier2')
+include ':icepatch2-compat'
+project(':icepatch2-compat').projectDir = new File('src/IcePatch2')
+include ':icestorm-compat'
+project(':icestorm-compat').projectDir = new File('src/IceStorm')
+include ':icegrid-compat'
+project(':icegrid-compat').projectDir = new File('src/IceGrid')
+
+// Tests
+include ':test'
+include ':testPlugins'
+project(':testPlugins').projectDir = new File('test/plugins')
+include ':testController'
+project(':testController').projectDir = new File('test/controller')
diff --git a/java-compat/src/Glacier2/build.gradle b/java-compat/src/Glacier2/build.gradle
new file mode 100644
index 00000000000..d087e401336
--- /dev/null
+++ b/java-compat/src/Glacier2/build.gradle
@@ -0,0 +1,29 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+sourceCompatibility = iceSourceCompatibility
+targetCompatibility = iceTargetCompatibility
+
+project.ext.displayName = "Glacier2 Compat"
+project.ext.description = "Firewall traversal for Ice"
+
+slice {
+ java {
+ set1 {
+ args = "--ice --tie --checksum Glacier2.SliceChecksums"
+ files = fileTree(dir: "${sliceDir}/Glacier2", includes:['*.ice'], excludes:["*F.ice"])
+ }
+ }
+}
+
+dependencies {
+ compile project(':ice-compat')
+}
+
+apply from: "$rootProject.projectDir/../java/gradle/library.gradle"
diff --git a/java/src/Glacier2/src/main/java/Glacier2/Application.java b/java-compat/src/Glacier2/src/main/java/Glacier2/Application.java
index 2d5768fdf1c..2d5768fdf1c 100644
--- a/java/src/Glacier2/src/main/java/Glacier2/Application.java
+++ b/java-compat/src/Glacier2/src/main/java/Glacier2/Application.java
diff --git a/java/src/Glacier2/src/main/java/Glacier2/SessionCallback.java b/java-compat/src/Glacier2/src/main/java/Glacier2/SessionCallback.java
index b1532e1fbd0..b1532e1fbd0 100644
--- a/java/src/Glacier2/src/main/java/Glacier2/SessionCallback.java
+++ b/java-compat/src/Glacier2/src/main/java/Glacier2/SessionCallback.java
diff --git a/java/src/Glacier2/src/main/java/Glacier2/SessionFactoryHelper.java b/java-compat/src/Glacier2/src/main/java/Glacier2/SessionFactoryHelper.java
index b7b086a8798..b7b086a8798 100644
--- a/java/src/Glacier2/src/main/java/Glacier2/SessionFactoryHelper.java
+++ b/java-compat/src/Glacier2/src/main/java/Glacier2/SessionFactoryHelper.java
diff --git a/java/src/Glacier2/src/main/java/Glacier2/SessionHelper.java b/java-compat/src/Glacier2/src/main/java/Glacier2/SessionHelper.java
index 70257c9f66d..70257c9f66d 100644
--- a/java/src/Glacier2/src/main/java/Glacier2/SessionHelper.java
+++ b/java-compat/src/Glacier2/src/main/java/Glacier2/SessionHelper.java
diff --git a/java-compat/src/Ice/build.gradle b/java-compat/src/Ice/build.gradle
new file mode 100644
index 00000000000..3edcb8df149
--- /dev/null
+++ b/java-compat/src/Ice/build.gradle
@@ -0,0 +1,26 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+sourceCompatibility = iceSourceCompatibility
+targetCompatibility = iceTargetCompatibility
+
+project.ext.displayName = "Ice Compat"
+project.ext.description = "Ice is a comprehensive RPC framework that helps you build distributed applications" +
+ " with minimal effort using familiar object-oriented idioms"
+
+slice {
+ java {
+ set1 {
+ args = "--ice"
+ files = fileTree(dir: "$sliceDir", includes:['Ice/*.ice', 'IceSSL/*.ice'], excludes:['Ice/*F.ice'])
+ }
+ }
+}
+
+apply from: "$rootProject.projectDir/../java/gradle/library.gradle"
diff --git a/java/src/Ice/src/main/java/Ice/AMDCallback.java b/java-compat/src/Ice/src/main/java/Ice/AMDCallback.java
index 9ece32a5899..9ece32a5899 100644
--- a/java/src/Ice/src/main/java/Ice/AMDCallback.java
+++ b/java-compat/src/Ice/src/main/java/Ice/AMDCallback.java
diff --git a/java/src/Ice/src/main/java/Ice/AMD_Object_ice_invoke.java b/java-compat/src/Ice/src/main/java/Ice/AMD_Object_ice_invoke.java
index 5fbeb9649c6..5fbeb9649c6 100644
--- a/java/src/Ice/src/main/java/Ice/AMD_Object_ice_invoke.java
+++ b/java-compat/src/Ice/src/main/java/Ice/AMD_Object_ice_invoke.java
diff --git a/java/src/Ice/src/main/java/Ice/Application.java b/java-compat/src/Ice/src/main/java/Ice/Application.java
index 3562445becb..3562445becb 100644
--- a/java/src/Ice/src/main/java/Ice/Application.java
+++ b/java-compat/src/Ice/src/main/java/Ice/Application.java
diff --git a/java/src/Ice/src/main/java/Ice/AsyncCallback.java b/java-compat/src/Ice/src/main/java/Ice/AsyncCallback.java
index 7ec2a2837ac..7ec2a2837ac 100644
--- a/java/src/Ice/src/main/java/Ice/AsyncCallback.java
+++ b/java-compat/src/Ice/src/main/java/Ice/AsyncCallback.java
diff --git a/java/src/Ice/src/main/java/Ice/AsyncResult.java b/java-compat/src/Ice/src/main/java/Ice/AsyncResult.java
index f62006ecc43..f62006ecc43 100644
--- a/java/src/Ice/src/main/java/Ice/AsyncResult.java
+++ b/java-compat/src/Ice/src/main/java/Ice/AsyncResult.java
diff --git a/java/src/Ice/src/main/java/Ice/BatchRequest.java b/java-compat/src/Ice/src/main/java/Ice/BatchRequest.java
index c18b6da917a..c18b6da917a 100644
--- a/java/src/Ice/src/main/java/Ice/BatchRequest.java
+++ b/java-compat/src/Ice/src/main/java/Ice/BatchRequest.java
diff --git a/java/src/Ice/src/main/java/Ice/BatchRequestInterceptor.java b/java-compat/src/Ice/src/main/java/Ice/BatchRequestInterceptor.java
index 148225cbd21..148225cbd21 100644
--- a/java/src/Ice/src/main/java/Ice/BatchRequestInterceptor.java
+++ b/java-compat/src/Ice/src/main/java/Ice/BatchRequestInterceptor.java
diff --git a/java/src/Ice/src/main/java/Ice/Blobject.java b/java-compat/src/Ice/src/main/java/Ice/Blobject.java
index 0a3fda4b795..0a3fda4b795 100644
--- a/java/src/Ice/src/main/java/Ice/Blobject.java
+++ b/java-compat/src/Ice/src/main/java/Ice/Blobject.java
diff --git a/java/src/Ice/src/main/java/Ice/BlobjectAsync.java b/java-compat/src/Ice/src/main/java/Ice/BlobjectAsync.java
index 4521de71e11..4521de71e11 100644
--- a/java/src/Ice/src/main/java/Ice/BlobjectAsync.java
+++ b/java-compat/src/Ice/src/main/java/Ice/BlobjectAsync.java
diff --git a/java/src/Ice/src/main/java/Ice/BooleanHolder.java b/java-compat/src/Ice/src/main/java/Ice/BooleanHolder.java
index 7233a0d27fc..7233a0d27fc 100644
--- a/java/src/Ice/src/main/java/Ice/BooleanHolder.java
+++ b/java-compat/src/Ice/src/main/java/Ice/BooleanHolder.java
diff --git a/java/src/Ice/src/main/java/Ice/BooleanOptional.java b/java-compat/src/Ice/src/main/java/Ice/BooleanOptional.java
index e6275db43ae..e6275db43ae 100644
--- a/java/src/Ice/src/main/java/Ice/BooleanOptional.java
+++ b/java-compat/src/Ice/src/main/java/Ice/BooleanOptional.java
diff --git a/java/src/Ice/src/main/java/Ice/ByteHolder.java b/java-compat/src/Ice/src/main/java/Ice/ByteHolder.java
index ac54599f84d..ac54599f84d 100644
--- a/java/src/Ice/src/main/java/Ice/ByteHolder.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ByteHolder.java
diff --git a/java/src/Ice/src/main/java/Ice/ByteOptional.java b/java-compat/src/Ice/src/main/java/Ice/ByteOptional.java
index 493bfaf34a4..493bfaf34a4 100644
--- a/java/src/Ice/src/main/java/Ice/ByteOptional.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ByteOptional.java
diff --git a/java/src/Ice/src/main/java/Ice/Callback.java b/java-compat/src/Ice/src/main/java/Ice/Callback.java
index 0d852d6d4c6..0d852d6d4c6 100644
--- a/java/src/Ice/src/main/java/Ice/Callback.java
+++ b/java-compat/src/Ice/src/main/java/Ice/Callback.java
diff --git a/java/src/Ice/src/main/java/Ice/Callback_Communicator_flushBatchRequests.java b/java-compat/src/Ice/src/main/java/Ice/Callback_Communicator_flushBatchRequests.java
index ef8fabded16..ef8fabded16 100644
--- a/java/src/Ice/src/main/java/Ice/Callback_Communicator_flushBatchRequests.java
+++ b/java-compat/src/Ice/src/main/java/Ice/Callback_Communicator_flushBatchRequests.java
diff --git a/java/src/Ice/src/main/java/Ice/Callback_Connection_flushBatchRequests.java b/java-compat/src/Ice/src/main/java/Ice/Callback_Connection_flushBatchRequests.java
index 0386c6c8abf..0386c6c8abf 100644
--- a/java/src/Ice/src/main/java/Ice/Callback_Connection_flushBatchRequests.java
+++ b/java-compat/src/Ice/src/main/java/Ice/Callback_Connection_flushBatchRequests.java
diff --git a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_flushBatchRequests.java b/java-compat/src/Ice/src/main/java/Ice/Callback_Object_ice_flushBatchRequests.java
index 2154e37cfa4..2154e37cfa4 100644
--- a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_flushBatchRequests.java
+++ b/java-compat/src/Ice/src/main/java/Ice/Callback_Object_ice_flushBatchRequests.java
diff --git a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_getConnection.java b/java-compat/src/Ice/src/main/java/Ice/Callback_Object_ice_getConnection.java
index f65533fdaf1..f65533fdaf1 100644
--- a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_getConnection.java
+++ b/java-compat/src/Ice/src/main/java/Ice/Callback_Object_ice_getConnection.java
diff --git a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_id.java b/java-compat/src/Ice/src/main/java/Ice/Callback_Object_ice_id.java
index 541989f45da..541989f45da 100644
--- a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_id.java
+++ b/java-compat/src/Ice/src/main/java/Ice/Callback_Object_ice_id.java
diff --git a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_ids.java b/java-compat/src/Ice/src/main/java/Ice/Callback_Object_ice_ids.java
index ab2ecbd5a95..ab2ecbd5a95 100644
--- a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_ids.java
+++ b/java-compat/src/Ice/src/main/java/Ice/Callback_Object_ice_ids.java
diff --git a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_invoke.java b/java-compat/src/Ice/src/main/java/Ice/Callback_Object_ice_invoke.java
index a60a22ce7ff..a60a22ce7ff 100644
--- a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_invoke.java
+++ b/java-compat/src/Ice/src/main/java/Ice/Callback_Object_ice_invoke.java
diff --git a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_isA.java b/java-compat/src/Ice/src/main/java/Ice/Callback_Object_ice_isA.java
index 8ccba433133..8ccba433133 100644
--- a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_isA.java
+++ b/java-compat/src/Ice/src/main/java/Ice/Callback_Object_ice_isA.java
diff --git a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_ping.java b/java-compat/src/Ice/src/main/java/Ice/Callback_Object_ice_ping.java
index 61be444f1bc..61be444f1bc 100644
--- a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_ping.java
+++ b/java-compat/src/Ice/src/main/java/Ice/Callback_Object_ice_ping.java
diff --git a/java/src/Ice/src/main/java/Ice/ClassResolver.java b/java-compat/src/Ice/src/main/java/Ice/ClassResolver.java
index 87be1d49ce3..87be1d49ce3 100644
--- a/java/src/Ice/src/main/java/Ice/ClassResolver.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ClassResolver.java
diff --git a/java/src/Ice/src/main/java/Ice/CommunicatorI.java b/java-compat/src/Ice/src/main/java/Ice/CommunicatorI.java
index 1713b0dc05e..5523f7663b4 100644
--- a/java/src/Ice/src/main/java/Ice/CommunicatorI.java
+++ b/java-compat/src/Ice/src/main/java/Ice/CommunicatorI.java
@@ -67,14 +67,14 @@ public final class CommunicatorI implements Communicator
return _instance.proxyFactory().proxyToProperty(proxy, prefix);
}
- @Override
+ @Override @SuppressWarnings("deprecation")
public Ice.Identity
stringToIdentity(String s)
{
return Ice.Util.stringToIdentity(s);
}
- @Override
+ @Override @SuppressWarnings("deprecation")
public String
identityToString(Ice.Identity ident)
{
diff --git a/java/src/Ice/src/main/java/Ice/CompactIdResolver.java b/java-compat/src/Ice/src/main/java/Ice/CompactIdResolver.java
index d959ab38904..d959ab38904 100644
--- a/java/src/Ice/src/main/java/Ice/CompactIdResolver.java
+++ b/java-compat/src/Ice/src/main/java/Ice/CompactIdResolver.java
diff --git a/java/src/Ice/src/main/java/Ice/ConnectionI.java b/java-compat/src/Ice/src/main/java/Ice/ConnectionI.java
index cac2a6fb3d2..cac2a6fb3d2 100644
--- a/java/src/Ice/src/main/java/Ice/ConnectionI.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ConnectionI.java
diff --git a/java/src/Ice/src/main/java/Ice/DispatchInterceptor.java b/java-compat/src/Ice/src/main/java/Ice/DispatchInterceptor.java
index d5cb1519f58..d5cb1519f58 100644
--- a/java/src/Ice/src/main/java/Ice/DispatchInterceptor.java
+++ b/java-compat/src/Ice/src/main/java/Ice/DispatchInterceptor.java
diff --git a/java/src/Ice/src/main/java/Ice/DispatchInterceptorAsyncCallback.java b/java-compat/src/Ice/src/main/java/Ice/DispatchInterceptorAsyncCallback.java
index fdbf42ebe06..fdbf42ebe06 100644
--- a/java/src/Ice/src/main/java/Ice/DispatchInterceptorAsyncCallback.java
+++ b/java-compat/src/Ice/src/main/java/Ice/DispatchInterceptorAsyncCallback.java
diff --git a/java/src/Ice/src/main/java/Ice/DispatchStatus.java b/java-compat/src/Ice/src/main/java/Ice/DispatchStatus.java
index beb91152d03..beb91152d03 100644
--- a/java/src/Ice/src/main/java/Ice/DispatchStatus.java
+++ b/java-compat/src/Ice/src/main/java/Ice/DispatchStatus.java
diff --git a/java/src/Ice/src/main/java/Ice/Dispatcher.java b/java-compat/src/Ice/src/main/java/Ice/Dispatcher.java
index 83975f9b8c9..83975f9b8c9 100644
--- a/java/src/Ice/src/main/java/Ice/Dispatcher.java
+++ b/java-compat/src/Ice/src/main/java/Ice/Dispatcher.java
diff --git a/java/src/Ice/src/main/java/Ice/DoubleHolder.java b/java-compat/src/Ice/src/main/java/Ice/DoubleHolder.java
index db51782dc22..db51782dc22 100644
--- a/java/src/Ice/src/main/java/Ice/DoubleHolder.java
+++ b/java-compat/src/Ice/src/main/java/Ice/DoubleHolder.java
diff --git a/java/src/Ice/src/main/java/Ice/DoubleOptional.java b/java-compat/src/Ice/src/main/java/Ice/DoubleOptional.java
index 7efd476babd..7efd476babd 100644
--- a/java/src/Ice/src/main/java/Ice/DoubleOptional.java
+++ b/java-compat/src/Ice/src/main/java/Ice/DoubleOptional.java
diff --git a/java/src/Ice/src/main/java/Ice/Exception.java b/java-compat/src/Ice/src/main/java/Ice/Exception.java
index 2cd7cd585c1..2cd7cd585c1 100644
--- a/java/src/Ice/src/main/java/Ice/Exception.java
+++ b/java-compat/src/Ice/src/main/java/Ice/Exception.java
diff --git a/java/src/Ice/src/main/java/Ice/FloatHolder.java b/java-compat/src/Ice/src/main/java/Ice/FloatHolder.java
index 4abd74438e5..4abd74438e5 100644
--- a/java/src/Ice/src/main/java/Ice/FloatHolder.java
+++ b/java-compat/src/Ice/src/main/java/Ice/FloatHolder.java
diff --git a/java/src/Ice/src/main/java/Ice/FloatOptional.java b/java-compat/src/Ice/src/main/java/Ice/FloatOptional.java
index 92f67c32071..92f67c32071 100644
--- a/java/src/Ice/src/main/java/Ice/FloatOptional.java
+++ b/java-compat/src/Ice/src/main/java/Ice/FloatOptional.java
diff --git a/java/src/Ice/src/main/java/Ice/FormatType.java b/java-compat/src/Ice/src/main/java/Ice/FormatType.java
index 7d421f259fd..7d421f259fd 100644
--- a/java/src/Ice/src/main/java/Ice/FormatType.java
+++ b/java-compat/src/Ice/src/main/java/Ice/FormatType.java
diff --git a/java/src/Ice/src/main/java/Ice/Holder.java b/java-compat/src/Ice/src/main/java/Ice/Holder.java
index bc086b1683b..bc086b1683b 100644
--- a/java/src/Ice/src/main/java/Ice/Holder.java
+++ b/java-compat/src/Ice/src/main/java/Ice/Holder.java
diff --git a/java/src/Ice/src/main/java/Ice/ImplicitContextI.java b/java-compat/src/Ice/src/main/java/Ice/ImplicitContextI.java
index 8dd39e414b9..8dd39e414b9 100644
--- a/java/src/Ice/src/main/java/Ice/ImplicitContextI.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ImplicitContextI.java
diff --git a/java/src/Ice/src/main/java/Ice/InitializationData.java b/java-compat/src/Ice/src/main/java/Ice/InitializationData.java
index 860557563e6..860557563e6 100644
--- a/java/src/Ice/src/main/java/Ice/InitializationData.java
+++ b/java-compat/src/Ice/src/main/java/Ice/InitializationData.java
diff --git a/java/src/Ice/src/main/java/Ice/InputStream.java b/java-compat/src/Ice/src/main/java/Ice/InputStream.java
index 2027f53d03b..2027f53d03b 100644
--- a/java/src/Ice/src/main/java/Ice/InputStream.java
+++ b/java-compat/src/Ice/src/main/java/Ice/InputStream.java
diff --git a/java/src/Ice/src/main/java/Ice/IntHolder.java b/java-compat/src/Ice/src/main/java/Ice/IntHolder.java
index c79285985d6..c79285985d6 100644
--- a/java/src/Ice/src/main/java/Ice/IntHolder.java
+++ b/java-compat/src/Ice/src/main/java/Ice/IntHolder.java
diff --git a/java/src/Ice/src/main/java/Ice/IntOptional.java b/java-compat/src/Ice/src/main/java/Ice/IntOptional.java
index 825ae76b1d7..825ae76b1d7 100644
--- a/java/src/Ice/src/main/java/Ice/IntOptional.java
+++ b/java-compat/src/Ice/src/main/java/Ice/IntOptional.java
diff --git a/java/src/Ice/src/main/java/Ice/LocalException.java b/java-compat/src/Ice/src/main/java/Ice/LocalException.java
index 2052b64a0c7..2052b64a0c7 100644
--- a/java/src/Ice/src/main/java/Ice/LocalException.java
+++ b/java-compat/src/Ice/src/main/java/Ice/LocalException.java
diff --git a/java/src/Ice/src/main/java/Ice/LocalObjectHolder.java b/java-compat/src/Ice/src/main/java/Ice/LocalObjectHolder.java
index 704aa31b234..704aa31b234 100644
--- a/java/src/Ice/src/main/java/Ice/LocalObjectHolder.java
+++ b/java-compat/src/Ice/src/main/java/Ice/LocalObjectHolder.java
diff --git a/java/src/Ice/src/main/java/Ice/LoggerI.java b/java-compat/src/Ice/src/main/java/Ice/LoggerI.java
index a1108e6df55..a1108e6df55 100644
--- a/java/src/Ice/src/main/java/Ice/LoggerI.java
+++ b/java-compat/src/Ice/src/main/java/Ice/LoggerI.java
diff --git a/java/src/Ice/src/main/java/Ice/LoggerPlugin.java b/java-compat/src/Ice/src/main/java/Ice/LoggerPlugin.java
index 90af9141202..90af9141202 100644
--- a/java/src/Ice/src/main/java/Ice/LoggerPlugin.java
+++ b/java-compat/src/Ice/src/main/java/Ice/LoggerPlugin.java
diff --git a/java/src/Ice/src/main/java/Ice/LongHolder.java b/java-compat/src/Ice/src/main/java/Ice/LongHolder.java
index 6027d071be6..6027d071be6 100644
--- a/java/src/Ice/src/main/java/Ice/LongHolder.java
+++ b/java-compat/src/Ice/src/main/java/Ice/LongHolder.java
diff --git a/java/src/Ice/src/main/java/Ice/LongOptional.java b/java-compat/src/Ice/src/main/java/Ice/LongOptional.java
index e7301ae8dc6..e7301ae8dc6 100644
--- a/java/src/Ice/src/main/java/Ice/LongOptional.java
+++ b/java-compat/src/Ice/src/main/java/Ice/LongOptional.java
diff --git a/java/src/Ice/src/main/java/Ice/NativePropertiesAdmin.java b/java-compat/src/Ice/src/main/java/Ice/NativePropertiesAdmin.java
index 1e5df346592..1e5df346592 100644
--- a/java/src/Ice/src/main/java/Ice/NativePropertiesAdmin.java
+++ b/java-compat/src/Ice/src/main/java/Ice/NativePropertiesAdmin.java
diff --git a/java/src/Ice/src/main/java/Ice/Object.java b/java-compat/src/Ice/src/main/java/Ice/Object.java
index e83fc29756f..e83fc29756f 100644
--- a/java/src/Ice/src/main/java/Ice/Object.java
+++ b/java-compat/src/Ice/src/main/java/Ice/Object.java
diff --git a/java/src/Ice/src/main/java/Ice/ObjectAdapterI.java b/java-compat/src/Ice/src/main/java/Ice/ObjectAdapterI.java
index 1aeef2206fa..1aeef2206fa 100644
--- a/java/src/Ice/src/main/java/Ice/ObjectAdapterI.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ObjectAdapterI.java
diff --git a/java/src/Ice/src/main/java/Ice/ObjectHolder.java b/java-compat/src/Ice/src/main/java/Ice/ObjectHolder.java
index c570288a292..c570288a292 100644
--- a/java/src/Ice/src/main/java/Ice/ObjectHolder.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ObjectHolder.java
diff --git a/java/src/Ice/src/main/java/Ice/ObjectHolderBase.java b/java-compat/src/Ice/src/main/java/Ice/ObjectHolderBase.java
index 62fa4ac1591..62fa4ac1591 100644
--- a/java/src/Ice/src/main/java/Ice/ObjectHolderBase.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ObjectHolderBase.java
diff --git a/java/src/Ice/src/main/java/Ice/ObjectImpl.java b/java-compat/src/Ice/src/main/java/Ice/ObjectImpl.java
index b6a253d13ef..b6a253d13ef 100644
--- a/java/src/Ice/src/main/java/Ice/ObjectImpl.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ObjectImpl.java
diff --git a/java/src/Ice/src/main/java/Ice/ObjectInputStream.java b/java-compat/src/Ice/src/main/java/Ice/ObjectInputStream.java
index 0d635b49b32..0d635b49b32 100644
--- a/java/src/Ice/src/main/java/Ice/ObjectInputStream.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ObjectInputStream.java
diff --git a/java/src/Ice/src/main/java/Ice/ObjectPrx.java b/java-compat/src/Ice/src/main/java/Ice/ObjectPrx.java
index ad077d2edb1..ad077d2edb1 100644
--- a/java/src/Ice/src/main/java/Ice/ObjectPrx.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ObjectPrx.java
diff --git a/java/src/Ice/src/main/java/Ice/ObjectPrxHelper.java b/java-compat/src/Ice/src/main/java/Ice/ObjectPrxHelper.java
index 77c758ef68e..77c758ef68e 100644
--- a/java/src/Ice/src/main/java/Ice/ObjectPrxHelper.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ObjectPrxHelper.java
diff --git a/java/src/Ice/src/main/java/Ice/ObjectPrxHelperBase.java b/java-compat/src/Ice/src/main/java/Ice/ObjectPrxHelperBase.java
index fa60f0a62f2..fa60f0a62f2 100644
--- a/java/src/Ice/src/main/java/Ice/ObjectPrxHelperBase.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ObjectPrxHelperBase.java
diff --git a/java/src/Ice/src/main/java/Ice/ObjectPrxHolder.java b/java-compat/src/Ice/src/main/java/Ice/ObjectPrxHolder.java
index eb61958e123..eb61958e123 100644
--- a/java/src/Ice/src/main/java/Ice/ObjectPrxHolder.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ObjectPrxHolder.java
diff --git a/java/src/Ice/src/main/java/Ice/ObjectReader.java b/java-compat/src/Ice/src/main/java/Ice/ObjectReader.java
index 488986f98af..488986f98af 100644
--- a/java/src/Ice/src/main/java/Ice/ObjectReader.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ObjectReader.java
diff --git a/java/src/Ice/src/main/java/Ice/ObjectWriter.java b/java-compat/src/Ice/src/main/java/Ice/ObjectWriter.java
index 91e474477a7..91e474477a7 100644
--- a/java/src/Ice/src/main/java/Ice/ObjectWriter.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ObjectWriter.java
diff --git a/java/src/Ice/src/main/java/Ice/OnewayCallback.java b/java-compat/src/Ice/src/main/java/Ice/OnewayCallback.java
index 76405d95605..76405d95605 100644
--- a/java/src/Ice/src/main/java/Ice/OnewayCallback.java
+++ b/java-compat/src/Ice/src/main/java/Ice/OnewayCallback.java
diff --git a/java/src/Ice/src/main/java/Ice/Optional.java b/java-compat/src/Ice/src/main/java/Ice/Optional.java
index b906e31def0..b906e31def0 100644
--- a/java/src/Ice/src/main/java/Ice/Optional.java
+++ b/java-compat/src/Ice/src/main/java/Ice/Optional.java
diff --git a/java/src/Ice/src/main/java/Ice/OptionalFormat.java b/java-compat/src/Ice/src/main/java/Ice/OptionalFormat.java
index 2c68b26ea4f..2c68b26ea4f 100644
--- a/java/src/Ice/src/main/java/Ice/OptionalFormat.java
+++ b/java-compat/src/Ice/src/main/java/Ice/OptionalFormat.java
diff --git a/java/src/Ice/src/main/java/Ice/OptionalObject.java b/java-compat/src/Ice/src/main/java/Ice/OptionalObject.java
index cbb1c27384c..cbb1c27384c 100644
--- a/java/src/Ice/src/main/java/Ice/OptionalObject.java
+++ b/java-compat/src/Ice/src/main/java/Ice/OptionalObject.java
diff --git a/java/src/Ice/src/main/java/Ice/OutputStream.java b/java-compat/src/Ice/src/main/java/Ice/OutputStream.java
index c2a028d15a6..c2a028d15a6 100644
--- a/java/src/Ice/src/main/java/Ice/OutputStream.java
+++ b/java-compat/src/Ice/src/main/java/Ice/OutputStream.java
diff --git a/java/src/Ice/src/main/java/Ice/PluginFactory.java b/java-compat/src/Ice/src/main/java/Ice/PluginFactory.java
index a92439a8d9e..a92439a8d9e 100644
--- a/java/src/Ice/src/main/java/Ice/PluginFactory.java
+++ b/java-compat/src/Ice/src/main/java/Ice/PluginFactory.java
diff --git a/java/src/Ice/src/main/java/Ice/PluginManagerI.java b/java-compat/src/Ice/src/main/java/Ice/PluginManagerI.java
index 6b40bb0f333..6b40bb0f333 100644
--- a/java/src/Ice/src/main/java/Ice/PluginManagerI.java
+++ b/java-compat/src/Ice/src/main/java/Ice/PluginManagerI.java
diff --git a/java/src/Ice/src/main/java/Ice/PropertiesAdminUpdateCallback.java b/java-compat/src/Ice/src/main/java/Ice/PropertiesAdminUpdateCallback.java
index d07b0dab83a..d07b0dab83a 100644
--- a/java/src/Ice/src/main/java/Ice/PropertiesAdminUpdateCallback.java
+++ b/java-compat/src/Ice/src/main/java/Ice/PropertiesAdminUpdateCallback.java
diff --git a/java/src/Ice/src/main/java/Ice/PropertiesI.java b/java-compat/src/Ice/src/main/java/Ice/PropertiesI.java
index 81cff7c62e5..81cff7c62e5 100644
--- a/java/src/Ice/src/main/java/Ice/PropertiesI.java
+++ b/java-compat/src/Ice/src/main/java/Ice/PropertiesI.java
diff --git a/java/src/Ice/src/main/java/Ice/ProxyIdentityFacetKey.java b/java-compat/src/Ice/src/main/java/Ice/ProxyIdentityFacetKey.java
index 21ff8089ba2..21ff8089ba2 100644
--- a/java/src/Ice/src/main/java/Ice/ProxyIdentityFacetKey.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ProxyIdentityFacetKey.java
diff --git a/java/src/Ice/src/main/java/Ice/ProxyIdentityKey.java b/java-compat/src/Ice/src/main/java/Ice/ProxyIdentityKey.java
index b8c85cf324b..b8c85cf324b 100644
--- a/java/src/Ice/src/main/java/Ice/ProxyIdentityKey.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ProxyIdentityKey.java
diff --git a/java/src/Ice/src/main/java/Ice/ReadValueCallback.java b/java-compat/src/Ice/src/main/java/Ice/ReadValueCallback.java
index 9a3132a9822..9a3132a9822 100644
--- a/java/src/Ice/src/main/java/Ice/ReadValueCallback.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ReadValueCallback.java
diff --git a/java/src/Ice/src/main/java/Ice/Request.java b/java-compat/src/Ice/src/main/java/Ice/Request.java
index 1be2ec37fbf..1be2ec37fbf 100644
--- a/java/src/Ice/src/main/java/Ice/Request.java
+++ b/java-compat/src/Ice/src/main/java/Ice/Request.java
diff --git a/java/src/Ice/src/main/java/Ice/ShortHolder.java b/java-compat/src/Ice/src/main/java/Ice/ShortHolder.java
index f960536349d..f960536349d 100644
--- a/java/src/Ice/src/main/java/Ice/ShortHolder.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ShortHolder.java
diff --git a/java/src/Ice/src/main/java/Ice/ShortOptional.java b/java-compat/src/Ice/src/main/java/Ice/ShortOptional.java
index 60b9228f1f0..60b9228f1f0 100644
--- a/java/src/Ice/src/main/java/Ice/ShortOptional.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ShortOptional.java
diff --git a/java/src/Ice/src/main/java/Ice/SignalPolicy.java b/java-compat/src/Ice/src/main/java/Ice/SignalPolicy.java
index b1bb328d199..b1bb328d199 100644
--- a/java/src/Ice/src/main/java/Ice/SignalPolicy.java
+++ b/java-compat/src/Ice/src/main/java/Ice/SignalPolicy.java
diff --git a/java/src/Ice/src/main/java/Ice/SliceInfo.java b/java-compat/src/Ice/src/main/java/Ice/SliceInfo.java
index 8297a4d447c..8297a4d447c 100644
--- a/java/src/Ice/src/main/java/Ice/SliceInfo.java
+++ b/java-compat/src/Ice/src/main/java/Ice/SliceInfo.java
diff --git a/java/src/Ice/src/main/java/Ice/SlicedData.java b/java-compat/src/Ice/src/main/java/Ice/SlicedData.java
index b747689687a..b747689687a 100644
--- a/java/src/Ice/src/main/java/Ice/SlicedData.java
+++ b/java-compat/src/Ice/src/main/java/Ice/SlicedData.java
diff --git a/java/src/Ice/src/main/java/Ice/StringHolder.java b/java-compat/src/Ice/src/main/java/Ice/StringHolder.java
index 46095138097..46095138097 100644
--- a/java/src/Ice/src/main/java/Ice/StringHolder.java
+++ b/java-compat/src/Ice/src/main/java/Ice/StringHolder.java
diff --git a/java/src/Ice/src/main/java/Ice/SysLoggerI.java b/java-compat/src/Ice/src/main/java/Ice/SysLoggerI.java
index 2938990276a..2938990276a 100644
--- a/java/src/Ice/src/main/java/Ice/SysLoggerI.java
+++ b/java-compat/src/Ice/src/main/java/Ice/SysLoggerI.java
diff --git a/java/src/Ice/src/main/java/Ice/SystemException.java b/java-compat/src/Ice/src/main/java/Ice/SystemException.java
index c6f063adfb8..c6f063adfb8 100644
--- a/java/src/Ice/src/main/java/Ice/SystemException.java
+++ b/java-compat/src/Ice/src/main/java/Ice/SystemException.java
diff --git a/java/src/Ice/src/main/java/Ice/ThreadHookPlugin.java b/java-compat/src/Ice/src/main/java/Ice/ThreadHookPlugin.java
index 8ce5943d638..8ce5943d638 100644
--- a/java/src/Ice/src/main/java/Ice/ThreadHookPlugin.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ThreadHookPlugin.java
diff --git a/java/src/Ice/src/main/java/Ice/ThreadNotification.java b/java-compat/src/Ice/src/main/java/Ice/ThreadNotification.java
index 3fae6f8930e..3fae6f8930e 100644
--- a/java/src/Ice/src/main/java/Ice/ThreadNotification.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ThreadNotification.java
diff --git a/java/src/Ice/src/main/java/Ice/TieBase.java b/java-compat/src/Ice/src/main/java/Ice/TieBase.java
index 0cbd8ff7c4e..0cbd8ff7c4e 100644
--- a/java/src/Ice/src/main/java/Ice/TieBase.java
+++ b/java-compat/src/Ice/src/main/java/Ice/TieBase.java
diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallback.java b/java-compat/src/Ice/src/main/java/Ice/TwowayCallback.java
index bedbe2970c6..bedbe2970c6 100644
--- a/java/src/Ice/src/main/java/Ice/TwowayCallback.java
+++ b/java-compat/src/Ice/src/main/java/Ice/TwowayCallback.java
diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackArg1.java b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackArg1.java
index 5149a2b4116..5149a2b4116 100644
--- a/java/src/Ice/src/main/java/Ice/TwowayCallbackArg1.java
+++ b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackArg1.java
diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackArg1UE.java b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackArg1UE.java
index f1a8e57995d..f1a8e57995d 100644
--- a/java/src/Ice/src/main/java/Ice/TwowayCallbackArg1UE.java
+++ b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackArg1UE.java
diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackBool.java b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackBool.java
index bcbdb51971f..bcbdb51971f 100644
--- a/java/src/Ice/src/main/java/Ice/TwowayCallbackBool.java
+++ b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackBool.java
diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackBoolUE.java b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackBoolUE.java
index 5a6492e4b63..5a6492e4b63 100644
--- a/java/src/Ice/src/main/java/Ice/TwowayCallbackBoolUE.java
+++ b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackBoolUE.java
diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackByte.java b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackByte.java
index 2c66deb95ab..2c66deb95ab 100644
--- a/java/src/Ice/src/main/java/Ice/TwowayCallbackByte.java
+++ b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackByte.java
diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackByteUE.java b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackByteUE.java
index cccbd04fe42..cccbd04fe42 100644
--- a/java/src/Ice/src/main/java/Ice/TwowayCallbackByteUE.java
+++ b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackByteUE.java
diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackDouble.java b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackDouble.java
index 042b35e2bc1..042b35e2bc1 100644
--- a/java/src/Ice/src/main/java/Ice/TwowayCallbackDouble.java
+++ b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackDouble.java
diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackDoubleUE.java b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackDoubleUE.java
index 3190a0b0d9b..3190a0b0d9b 100644
--- a/java/src/Ice/src/main/java/Ice/TwowayCallbackDoubleUE.java
+++ b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackDoubleUE.java
diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackFloat.java b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackFloat.java
index 37818f8e8c1..37818f8e8c1 100644
--- a/java/src/Ice/src/main/java/Ice/TwowayCallbackFloat.java
+++ b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackFloat.java
diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackFloatUE.java b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackFloatUE.java
index 26a14b83fe7..26a14b83fe7 100644
--- a/java/src/Ice/src/main/java/Ice/TwowayCallbackFloatUE.java
+++ b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackFloatUE.java
diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackInt.java b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackInt.java
index 3319fae792e..3319fae792e 100644
--- a/java/src/Ice/src/main/java/Ice/TwowayCallbackInt.java
+++ b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackInt.java
diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackIntUE.java b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackIntUE.java
index 7627bbb9ad6..7627bbb9ad6 100644
--- a/java/src/Ice/src/main/java/Ice/TwowayCallbackIntUE.java
+++ b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackIntUE.java
diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackLong.java b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackLong.java
index ea49ed2a7b4..ea49ed2a7b4 100644
--- a/java/src/Ice/src/main/java/Ice/TwowayCallbackLong.java
+++ b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackLong.java
diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackLongUE.java b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackLongUE.java
index 47ca9c303f3..47ca9c303f3 100644
--- a/java/src/Ice/src/main/java/Ice/TwowayCallbackLongUE.java
+++ b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackLongUE.java
diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackShort.java b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackShort.java
index 8f613175c92..8f613175c92 100644
--- a/java/src/Ice/src/main/java/Ice/TwowayCallbackShort.java
+++ b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackShort.java
diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackShortUE.java b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackShortUE.java
index 142993b319a..142993b319a 100644
--- a/java/src/Ice/src/main/java/Ice/TwowayCallbackShortUE.java
+++ b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackShortUE.java
diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackUE.java b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackUE.java
index ecd25e75edb..ecd25e75edb 100644
--- a/java/src/Ice/src/main/java/Ice/TwowayCallbackUE.java
+++ b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackUE.java
diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackVoidUE.java b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackVoidUE.java
index 24813fb7420..24813fb7420 100644
--- a/java/src/Ice/src/main/java/Ice/TwowayCallbackVoidUE.java
+++ b/java-compat/src/Ice/src/main/java/Ice/TwowayCallbackVoidUE.java
diff --git a/java/src/Ice/src/main/java/Ice/UnknownSlicedValue.java b/java-compat/src/Ice/src/main/java/Ice/UnknownSlicedValue.java
index 98d3d45260c..98d3d45260c 100644
--- a/java/src/Ice/src/main/java/Ice/UnknownSlicedValue.java
+++ b/java-compat/src/Ice/src/main/java/Ice/UnknownSlicedValue.java
diff --git a/java/src/Ice/src/main/java/Ice/UserException.java b/java-compat/src/Ice/src/main/java/Ice/UserException.java
index 1d78d42c722..1d78d42c722 100644
--- a/java/src/Ice/src/main/java/Ice/UserException.java
+++ b/java-compat/src/Ice/src/main/java/Ice/UserException.java
diff --git a/java/src/Ice/src/main/java/Ice/UserExceptionFactory.java b/java-compat/src/Ice/src/main/java/Ice/UserExceptionFactory.java
index 9e899e813ec..9e899e813ec 100644
--- a/java/src/Ice/src/main/java/Ice/UserExceptionFactory.java
+++ b/java-compat/src/Ice/src/main/java/Ice/UserExceptionFactory.java
diff --git a/java/src/Ice/src/main/java/Ice/Util.java b/java-compat/src/Ice/src/main/java/Ice/Util.java
index 565dab3588a..565dab3588a 100644
--- a/java/src/Ice/src/main/java/Ice/Util.java
+++ b/java-compat/src/Ice/src/main/java/Ice/Util.java
diff --git a/java/src/Ice/src/main/java/Ice/ValueFactoryManagerI.java b/java-compat/src/Ice/src/main/java/Ice/ValueFactoryManagerI.java
index 13e968f5cae..13e968f5cae 100644
--- a/java/src/Ice/src/main/java/Ice/ValueFactoryManagerI.java
+++ b/java-compat/src/Ice/src/main/java/Ice/ValueFactoryManagerI.java
diff --git a/java/src/Ice/src/main/java/Ice/_AMD_Object_ice_invoke.java b/java-compat/src/Ice/src/main/java/Ice/_AMD_Object_ice_invoke.java
index edc77cb14be..edc77cb14be 100644
--- a/java/src/Ice/src/main/java/Ice/_AMD_Object_ice_invoke.java
+++ b/java-compat/src/Ice/src/main/java/Ice/_AMD_Object_ice_invoke.java
diff --git a/java/src/Ice/src/main/java/Ice/_Callback_Object_ice_invoke.java b/java-compat/src/Ice/src/main/java/Ice/_Callback_Object_ice_invoke.java
index 6357f50555c..6357f50555c 100644
--- a/java/src/Ice/src/main/java/Ice/_Callback_Object_ice_invoke.java
+++ b/java-compat/src/Ice/src/main/java/Ice/_Callback_Object_ice_invoke.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ACMConfig.java b/java-compat/src/Ice/src/main/java/IceInternal/ACMConfig.java
index 291e9d1c59f..291e9d1c59f 100644
--- a/java/src/Ice/src/main/java/IceInternal/ACMConfig.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ACMConfig.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ACMMonitor.java b/java-compat/src/Ice/src/main/java/IceInternal/ACMMonitor.java
index 0265886b023..0265886b023 100644
--- a/java/src/Ice/src/main/java/IceInternal/ACMMonitor.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ACMMonitor.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Acceptor.java b/java-compat/src/Ice/src/main/java/IceInternal/Acceptor.java
index 628e147620a..628e147620a 100644
--- a/java/src/Ice/src/main/java/IceInternal/Acceptor.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Acceptor.java
diff --git a/java/src/Ice/src/main/java/IceInternal/AsyncResultI.java b/java-compat/src/Ice/src/main/java/IceInternal/AsyncResultI.java
index 41f49774a0e..41f49774a0e 100644
--- a/java/src/Ice/src/main/java/IceInternal/AsyncResultI.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/AsyncResultI.java
diff --git a/java/src/Ice/src/main/java/IceInternal/AsyncStatus.java b/java-compat/src/Ice/src/main/java/IceInternal/AsyncStatus.java
index 19fa9f28cb0..19fa9f28cb0 100644
--- a/java/src/Ice/src/main/java/IceInternal/AsyncStatus.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/AsyncStatus.java
diff --git a/java/src/Ice/src/main/java/IceInternal/BZip2.java b/java-compat/src/Ice/src/main/java/IceInternal/BZip2.java
index a29b7c30c32..a29b7c30c32 100644
--- a/java/src/Ice/src/main/java/IceInternal/BZip2.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/BZip2.java
diff --git a/java/src/Ice/src/main/java/IceInternal/BatchRequestQueue.java b/java-compat/src/Ice/src/main/java/IceInternal/BatchRequestQueue.java
index 3db2ac67177..3db2ac67177 100644
--- a/java/src/Ice/src/main/java/IceInternal/BatchRequestQueue.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/BatchRequestQueue.java
diff --git a/java/src/Ice/src/main/java/IceInternal/BufSizeWarnInfo.java b/java-compat/src/Ice/src/main/java/IceInternal/BufSizeWarnInfo.java
index 67e84387319..67e84387319 100644
--- a/java/src/Ice/src/main/java/IceInternal/BufSizeWarnInfo.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/BufSizeWarnInfo.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Buffer.java b/java-compat/src/Ice/src/main/java/IceInternal/Buffer.java
index 911d8df76d4..911d8df76d4 100644
--- a/java/src/Ice/src/main/java/IceInternal/Buffer.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Buffer.java
diff --git a/java/src/Ice/src/main/java/IceInternal/CallbackBase.java b/java-compat/src/Ice/src/main/java/IceInternal/CallbackBase.java
index b482e9a71cd..b482e9a71cd 100644
--- a/java/src/Ice/src/main/java/IceInternal/CallbackBase.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/CallbackBase.java
diff --git a/java/src/Ice/src/main/java/IceInternal/CancellationHandler.java b/java-compat/src/Ice/src/main/java/IceInternal/CancellationHandler.java
index 3085b41e3d0..3085b41e3d0 100644
--- a/java/src/Ice/src/main/java/IceInternal/CancellationHandler.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/CancellationHandler.java
diff --git a/java/src/Ice/src/main/java/IceInternal/CollocatedObserverI.java b/java-compat/src/Ice/src/main/java/IceInternal/CollocatedObserverI.java
index a29cc2ad237..a29cc2ad237 100644
--- a/java/src/Ice/src/main/java/IceInternal/CollocatedObserverI.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/CollocatedObserverI.java
diff --git a/java/src/Ice/src/main/java/IceInternal/CollocatedRequestHandler.java b/java-compat/src/Ice/src/main/java/IceInternal/CollocatedRequestHandler.java
index ad823f21319..ad823f21319 100644
--- a/java/src/Ice/src/main/java/IceInternal/CollocatedRequestHandler.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/CollocatedRequestHandler.java
diff --git a/java/src/Ice/src/main/java/IceInternal/CommunicatorFlushBatch.java b/java-compat/src/Ice/src/main/java/IceInternal/CommunicatorFlushBatch.java
index 309c9dd6a55..309c9dd6a55 100644
--- a/java/src/Ice/src/main/java/IceInternal/CommunicatorFlushBatch.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/CommunicatorFlushBatch.java
diff --git a/java/src/Ice/src/main/java/IceInternal/CommunicatorObserverI.java b/java-compat/src/Ice/src/main/java/IceInternal/CommunicatorObserverI.java
index 095948736e3..095948736e3 100644
--- a/java/src/Ice/src/main/java/IceInternal/CommunicatorObserverI.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/CommunicatorObserverI.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java b/java-compat/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java
index 4f50988102a..4f50988102a 100644
--- a/java/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ConnectionACMMonitor.java b/java-compat/src/Ice/src/main/java/IceInternal/ConnectionACMMonitor.java
index 7e4b1427c1f..7e4b1427c1f 100644
--- a/java/src/Ice/src/main/java/IceInternal/ConnectionACMMonitor.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ConnectionACMMonitor.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ConnectionFlushBatch.java b/java-compat/src/Ice/src/main/java/IceInternal/ConnectionFlushBatch.java
index 7824d3154c1..7824d3154c1 100644
--- a/java/src/Ice/src/main/java/IceInternal/ConnectionFlushBatch.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ConnectionFlushBatch.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ConnectionObserverI.java b/java-compat/src/Ice/src/main/java/IceInternal/ConnectionObserverI.java
index ebbf963aba9..ebbf963aba9 100644
--- a/java/src/Ice/src/main/java/IceInternal/ConnectionObserverI.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ConnectionObserverI.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ConnectionRequestHandler.java b/java-compat/src/Ice/src/main/java/IceInternal/ConnectionRequestHandler.java
index 6e098e1c6a4..6e098e1c6a4 100644
--- a/java/src/Ice/src/main/java/IceInternal/ConnectionRequestHandler.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ConnectionRequestHandler.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Connector.java b/java-compat/src/Ice/src/main/java/IceInternal/Connector.java
index 29638f0f138..29638f0f138 100644
--- a/java/src/Ice/src/main/java/IceInternal/Connector.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Connector.java
diff --git a/java/src/Ice/src/main/java/IceInternal/DefaultsAndOverrides.java b/java-compat/src/Ice/src/main/java/IceInternal/DefaultsAndOverrides.java
index b1b7fc5687d..b1b7fc5687d 100644
--- a/java/src/Ice/src/main/java/IceInternal/DefaultsAndOverrides.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/DefaultsAndOverrides.java
diff --git a/java/src/Ice/src/main/java/IceInternal/DictionaryPatcher.java b/java-compat/src/Ice/src/main/java/IceInternal/DictionaryPatcher.java
index 2f426ac4fa1..2f426ac4fa1 100644
--- a/java/src/Ice/src/main/java/IceInternal/DictionaryPatcher.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/DictionaryPatcher.java
diff --git a/java/src/Ice/src/main/java/IceInternal/DispatchObserverI.java b/java-compat/src/Ice/src/main/java/IceInternal/DispatchObserverI.java
index 1d4ce8be34e..1d4ce8be34e 100644
--- a/java/src/Ice/src/main/java/IceInternal/DispatchObserverI.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/DispatchObserverI.java
diff --git a/java/src/Ice/src/main/java/IceInternal/DispatchWorkItem.java b/java-compat/src/Ice/src/main/java/IceInternal/DispatchWorkItem.java
index 157cf841f78..157cf841f78 100644
--- a/java/src/Ice/src/main/java/IceInternal/DispatchWorkItem.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/DispatchWorkItem.java
diff --git a/java/src/Ice/src/main/java/IceInternal/EndpointFactory.java b/java-compat/src/Ice/src/main/java/IceInternal/EndpointFactory.java
index 350a9aa7e15..350a9aa7e15 100644
--- a/java/src/Ice/src/main/java/IceInternal/EndpointFactory.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/EndpointFactory.java
diff --git a/java/src/Ice/src/main/java/IceInternal/EndpointFactoryManager.java b/java-compat/src/Ice/src/main/java/IceInternal/EndpointFactoryManager.java
index 252baa39baf..252baa39baf 100644
--- a/java/src/Ice/src/main/java/IceInternal/EndpointFactoryManager.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/EndpointFactoryManager.java
diff --git a/java/src/Ice/src/main/java/IceInternal/EndpointHostResolver.java b/java-compat/src/Ice/src/main/java/IceInternal/EndpointHostResolver.java
index 89cc00f4a3a..89cc00f4a3a 100644
--- a/java/src/Ice/src/main/java/IceInternal/EndpointHostResolver.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/EndpointHostResolver.java
diff --git a/java/src/Ice/src/main/java/IceInternal/EndpointI.java b/java-compat/src/Ice/src/main/java/IceInternal/EndpointI.java
index d393916472d..d393916472d 100644
--- a/java/src/Ice/src/main/java/IceInternal/EndpointI.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/EndpointI.java
diff --git a/java/src/Ice/src/main/java/IceInternal/EndpointIHolder.java b/java-compat/src/Ice/src/main/java/IceInternal/EndpointIHolder.java
index 226664113f1..226664113f1 100644
--- a/java/src/Ice/src/main/java/IceInternal/EndpointIHolder.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/EndpointIHolder.java
diff --git a/java/src/Ice/src/main/java/IceInternal/EndpointI_connectors.java b/java-compat/src/Ice/src/main/java/IceInternal/EndpointI_connectors.java
index dfcdb479645..dfcdb479645 100644
--- a/java/src/Ice/src/main/java/IceInternal/EndpointI_connectors.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/EndpointI_connectors.java
diff --git a/java/src/Ice/src/main/java/IceInternal/EventHandler.java b/java-compat/src/Ice/src/main/java/IceInternal/EventHandler.java
index 06fab81e580..06fab81e580 100644
--- a/java/src/Ice/src/main/java/IceInternal/EventHandler.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/EventHandler.java
diff --git a/java/src/Ice/src/main/java/IceInternal/EventHandlerOpPair.java b/java-compat/src/Ice/src/main/java/IceInternal/EventHandlerOpPair.java
index 37deadd0ff4..37deadd0ff4 100644
--- a/java/src/Ice/src/main/java/IceInternal/EventHandlerOpPair.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/EventHandlerOpPair.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Ex.java b/java-compat/src/Ice/src/main/java/IceInternal/Ex.java
index dcffe92be76..dcffe92be76 100644
--- a/java/src/Ice/src/main/java/IceInternal/Ex.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Ex.java
diff --git a/java/src/Ice/src/main/java/IceInternal/FactoryACMMonitor.java b/java-compat/src/Ice/src/main/java/IceInternal/FactoryACMMonitor.java
index 1944656bcfa..1944656bcfa 100644
--- a/java/src/Ice/src/main/java/IceInternal/FactoryACMMonitor.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/FactoryACMMonitor.java
diff --git a/java/src/Ice/src/main/java/IceInternal/FixedReference.java b/java-compat/src/Ice/src/main/java/IceInternal/FixedReference.java
index 6ae5fe1b4c2..6ae5fe1b4c2 100644
--- a/java/src/Ice/src/main/java/IceInternal/FixedReference.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/FixedReference.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_BoolCallback.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_BoolCallback.java
index 71954017a36..71954017a36 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_BoolCallback.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_BoolCallback.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_ByteCallback.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_ByteCallback.java
index 06d44618159..06d44618159 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_ByteCallback.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_ByteCallback.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_CallbackBase.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_CallbackBase.java
index dc200518c10..dc200518c10 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_CallbackBase.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_CallbackBase.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_DoubleCallback.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_DoubleCallback.java
index 8aba3931756..8aba3931756 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_DoubleCallback.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_DoubleCallback.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_FloatCallback.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_FloatCallback.java
index 69deb3ff76d..69deb3ff76d 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_FloatCallback.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_FloatCallback.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_GenericCallback1.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_GenericCallback1.java
index aae63a7e35b..aae63a7e35b 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_GenericCallback1.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_GenericCallback1.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_IntCallback.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_IntCallback.java
index ab901b9cad8..ab901b9cad8 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_IntCallback.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_IntCallback.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_LongCallback.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_LongCallback.java
index ff64e28b35e..ff64e28b35e 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_LongCallback.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_LongCallback.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_OnewayCallback.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_OnewayCallback.java
index 7962cd4e336..7962cd4e336 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_OnewayCallback.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_OnewayCallback.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_ShortCallback.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_ShortCallback.java
index 32a1d925ce6..32a1d925ce6 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_ShortCallback.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_ShortCallback.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallback.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallback.java
index f88b2d64ca6..f88b2d64ca6 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallback.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallback.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackArg1.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackArg1.java
index c7b52ea9c52..c7b52ea9c52 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackArg1.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackArg1.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackArg1UE.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackArg1UE.java
index ed810994d8e..ed810994d8e 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackArg1UE.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackArg1UE.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackBool.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackBool.java
index 973b107f1ff..973b107f1ff 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackBool.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackBool.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackBoolUE.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackBoolUE.java
index 28d2a92777f..28d2a92777f 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackBoolUE.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackBoolUE.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackByte.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackByte.java
index 986163e8d80..986163e8d80 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackByte.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackByte.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackByteUE.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackByteUE.java
index 1c0fb9bb8bc..1c0fb9bb8bc 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackByteUE.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackByteUE.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackDouble.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackDouble.java
index 879014d73e5..879014d73e5 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackDouble.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackDouble.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackDoubleUE.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackDoubleUE.java
index a8d28cf12fe..a8d28cf12fe 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackDoubleUE.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackDoubleUE.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackFloat.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackFloat.java
index 7ea9b1f9753..7ea9b1f9753 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackFloat.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackFloat.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackFloatUE.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackFloatUE.java
index d5dc8141064..d5dc8141064 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackFloatUE.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackFloatUE.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackInt.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackInt.java
index 8c6fea2818e..8c6fea2818e 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackInt.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackInt.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackIntUE.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackIntUE.java
index b749b44b1ad..b749b44b1ad 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackIntUE.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackIntUE.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackLong.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackLong.java
index bc6c654643e..bc6c654643e 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackLong.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackLong.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackLongUE.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackLongUE.java
index 2eb6985fcb8..2eb6985fcb8 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackLongUE.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackLongUE.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackShort.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackShort.java
index f6c835f0721..f6c835f0721 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackShort.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackShort.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackShortUE.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackShortUE.java
index 47ff52de87c..47ff52de87c 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackShortUE.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackShortUE.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackUE.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackUE.java
index 5ae5d838274..5ae5d838274 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackUE.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackUE.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackVoidUE.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackVoidUE.java
index 080b4ad863a..080b4ad863a 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackVoidUE.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackVoidUE.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_VoidCallback.java b/java-compat/src/Ice/src/main/java/IceInternal/Functional_VoidCallback.java
index ca40c37cd7c..ca40c37cd7c 100644
--- a/java/src/Ice/src/main/java/IceInternal/Functional_VoidCallback.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Functional_VoidCallback.java
diff --git a/java/src/Ice/src/main/java/IceInternal/HTTPNetworkProxy.java b/java-compat/src/Ice/src/main/java/IceInternal/HTTPNetworkProxy.java
index 1214731fbea..1214731fbea 100644
--- a/java/src/Ice/src/main/java/IceInternal/HTTPNetworkProxy.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/HTTPNetworkProxy.java
diff --git a/java/src/Ice/src/main/java/IceInternal/HashUtil.java b/java-compat/src/Ice/src/main/java/IceInternal/HashUtil.java
index fc931e8294f..fc931e8294f 100644
--- a/java/src/Ice/src/main/java/IceInternal/HashUtil.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/HashUtil.java
diff --git a/java/src/Ice/src/main/java/IceInternal/HttpParser.java b/java-compat/src/Ice/src/main/java/IceInternal/HttpParser.java
index 999b2a62430..999b2a62430 100644
--- a/java/src/Ice/src/main/java/IceInternal/HttpParser.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/HttpParser.java
diff --git a/java/src/Ice/src/main/java/IceInternal/IPEndpointI.java b/java-compat/src/Ice/src/main/java/IceInternal/IPEndpointI.java
index 7a6057800c6..7a6057800c6 100644
--- a/java/src/Ice/src/main/java/IceInternal/IPEndpointI.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/IPEndpointI.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Incoming.java b/java-compat/src/Ice/src/main/java/IceInternal/Incoming.java
index 6a7babc0c36..6a7babc0c36 100644
--- a/java/src/Ice/src/main/java/IceInternal/Incoming.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Incoming.java
diff --git a/java/src/Ice/src/main/java/IceInternal/IncomingAsync.java b/java-compat/src/Ice/src/main/java/IceInternal/IncomingAsync.java
index 7abed77651d..7abed77651d 100644
--- a/java/src/Ice/src/main/java/IceInternal/IncomingAsync.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/IncomingAsync.java
diff --git a/java/src/Ice/src/main/java/IceInternal/IncomingBase.java b/java-compat/src/Ice/src/main/java/IceInternal/IncomingBase.java
index 93c853c9853..93c853c9853 100644
--- a/java/src/Ice/src/main/java/IceInternal/IncomingBase.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/IncomingBase.java
diff --git a/java/src/Ice/src/main/java/IceInternal/IncomingConnectionFactory.java b/java-compat/src/Ice/src/main/java/IceInternal/IncomingConnectionFactory.java
index 2a6b69935a3..2a6b69935a3 100644
--- a/java/src/Ice/src/main/java/IceInternal/IncomingConnectionFactory.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/IncomingConnectionFactory.java
diff --git a/java/src/Ice/src/main/java/IceInternal/InputStreamWrapper.java b/java-compat/src/Ice/src/main/java/IceInternal/InputStreamWrapper.java
index 8359235b692..8359235b692 100644
--- a/java/src/Ice/src/main/java/IceInternal/InputStreamWrapper.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/InputStreamWrapper.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Instance.java b/java-compat/src/Ice/src/main/java/IceInternal/Instance.java
index 30b78609ca8..30b78609ca8 100644
--- a/java/src/Ice/src/main/java/IceInternal/Instance.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Instance.java
diff --git a/java/src/Ice/src/main/java/IceInternal/InvocationObserverI.java b/java-compat/src/Ice/src/main/java/IceInternal/InvocationObserverI.java
index 93cb2fb906a..93cb2fb906a 100644
--- a/java/src/Ice/src/main/java/IceInternal/InvocationObserverI.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/InvocationObserverI.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ListPatcher.java b/java-compat/src/Ice/src/main/java/IceInternal/ListPatcher.java
index 56f3472d567..56f3472d567 100644
--- a/java/src/Ice/src/main/java/IceInternal/ListPatcher.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ListPatcher.java
diff --git a/java/src/Ice/src/main/java/IceInternal/LocatorInfo.java b/java-compat/src/Ice/src/main/java/IceInternal/LocatorInfo.java
index 82c4dea0e25..82c4dea0e25 100644
--- a/java/src/Ice/src/main/java/IceInternal/LocatorInfo.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/LocatorInfo.java
diff --git a/java/src/Ice/src/main/java/IceInternal/LocatorManager.java b/java-compat/src/Ice/src/main/java/IceInternal/LocatorManager.java
index 201dacf41b2..201dacf41b2 100644
--- a/java/src/Ice/src/main/java/IceInternal/LocatorManager.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/LocatorManager.java
diff --git a/java/src/Ice/src/main/java/IceInternal/LocatorTable.java b/java-compat/src/Ice/src/main/java/IceInternal/LocatorTable.java
index 0f2a13bda37..0f2a13bda37 100644
--- a/java/src/Ice/src/main/java/IceInternal/LocatorTable.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/LocatorTable.java
diff --git a/java/src/Ice/src/main/java/IceInternal/LoggerAdminI.java b/java-compat/src/Ice/src/main/java/IceInternal/LoggerAdminI.java
index 4a322318fad..4a322318fad 100644
--- a/java/src/Ice/src/main/java/IceInternal/LoggerAdminI.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/LoggerAdminI.java
diff --git a/java/src/Ice/src/main/java/IceInternal/LoggerAdminLogger.java b/java-compat/src/Ice/src/main/java/IceInternal/LoggerAdminLogger.java
index 1ae9f52faf1..1ae9f52faf1 100644
--- a/java/src/Ice/src/main/java/IceInternal/LoggerAdminLogger.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/LoggerAdminLogger.java
diff --git a/java/src/Ice/src/main/java/IceInternal/LoggerAdminLoggerI.java b/java-compat/src/Ice/src/main/java/IceInternal/LoggerAdminLoggerI.java
index b5743d72873..b5743d72873 100644
--- a/java/src/Ice/src/main/java/IceInternal/LoggerAdminLoggerI.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/LoggerAdminLoggerI.java
diff --git a/java/src/Ice/src/main/java/IceInternal/MetricsAdminI.java b/java-compat/src/Ice/src/main/java/IceInternal/MetricsAdminI.java
index 92b0cb139a6..92b0cb139a6 100644
--- a/java/src/Ice/src/main/java/IceInternal/MetricsAdminI.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/MetricsAdminI.java
diff --git a/java/src/Ice/src/main/java/IceInternal/MetricsMap.java b/java-compat/src/Ice/src/main/java/IceInternal/MetricsMap.java
index b4d6dfb10c2..b4d6dfb10c2 100644
--- a/java/src/Ice/src/main/java/IceInternal/MetricsMap.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/MetricsMap.java
diff --git a/java/src/Ice/src/main/java/IceInternal/MetricsViewI.java b/java-compat/src/Ice/src/main/java/IceInternal/MetricsViewI.java
index c45aedff457..c45aedff457 100644
--- a/java/src/Ice/src/main/java/IceInternal/MetricsViewI.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/MetricsViewI.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Network.java b/java-compat/src/Ice/src/main/java/IceInternal/Network.java
index 0e19cf0e0b0..0e19cf0e0b0 100644
--- a/java/src/Ice/src/main/java/IceInternal/Network.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Network.java
diff --git a/java/src/Ice/src/main/java/IceInternal/NetworkProxy.java b/java-compat/src/Ice/src/main/java/IceInternal/NetworkProxy.java
index 80dcce87d3e..80dcce87d3e 100644
--- a/java/src/Ice/src/main/java/IceInternal/NetworkProxy.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/NetworkProxy.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ObjectAdapterFactory.java b/java-compat/src/Ice/src/main/java/IceInternal/ObjectAdapterFactory.java
index bfec67de6a6..bfec67de6a6 100644
--- a/java/src/Ice/src/main/java/IceInternal/ObjectAdapterFactory.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ObjectAdapterFactory.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ObjectInputStream.java b/java-compat/src/Ice/src/main/java/IceInternal/ObjectInputStream.java
index ea1e7167f4c..ea1e7167f4c 100644
--- a/java/src/Ice/src/main/java/IceInternal/ObjectInputStream.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ObjectInputStream.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ObserverHelper.java b/java-compat/src/Ice/src/main/java/IceInternal/ObserverHelper.java
index 290be728304..290be728304 100644
--- a/java/src/Ice/src/main/java/IceInternal/ObserverHelper.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ObserverHelper.java
diff --git a/java/src/Ice/src/main/java/IceInternal/OpaqueEndpointI.java b/java-compat/src/Ice/src/main/java/IceInternal/OpaqueEndpointI.java
index c6c6b849ba5..c6c6b849ba5 100644
--- a/java/src/Ice/src/main/java/IceInternal/OpaqueEndpointI.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/OpaqueEndpointI.java
diff --git a/java/src/Ice/src/main/java/IceInternal/OutgoingAsync.java b/java-compat/src/Ice/src/main/java/IceInternal/OutgoingAsync.java
index 85e5522be77..85e5522be77 100644
--- a/java/src/Ice/src/main/java/IceInternal/OutgoingAsync.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/OutgoingAsync.java
diff --git a/java/src/Ice/src/main/java/IceInternal/OutgoingAsyncBase.java b/java-compat/src/Ice/src/main/java/IceInternal/OutgoingAsyncBase.java
index 7af12ad2912..7af12ad2912 100644
--- a/java/src/Ice/src/main/java/IceInternal/OutgoingAsyncBase.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/OutgoingAsyncBase.java
diff --git a/java/src/Ice/src/main/java/IceInternal/OutgoingConnectionFactory.java b/java-compat/src/Ice/src/main/java/IceInternal/OutgoingConnectionFactory.java
index 94b80c0e2fb..94b80c0e2fb 100644
--- a/java/src/Ice/src/main/java/IceInternal/OutgoingConnectionFactory.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/OutgoingConnectionFactory.java
diff --git a/java/src/Ice/src/main/java/IceInternal/OutputStreamWrapper.java b/java-compat/src/Ice/src/main/java/IceInternal/OutputStreamWrapper.java
index 6f9e2f9a9d6..6f9e2f9a9d6 100644
--- a/java/src/Ice/src/main/java/IceInternal/OutputStreamWrapper.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/OutputStreamWrapper.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ProcessI.java b/java-compat/src/Ice/src/main/java/IceInternal/ProcessI.java
index 516d5f03aa9..516d5f03aa9 100644
--- a/java/src/Ice/src/main/java/IceInternal/ProcessI.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ProcessI.java
diff --git a/java/src/Ice/src/main/java/IceInternal/PropertiesAdminI.java b/java-compat/src/Ice/src/main/java/IceInternal/PropertiesAdminI.java
index b6041ba4fd6..b6041ba4fd6 100644
--- a/java/src/Ice/src/main/java/IceInternal/PropertiesAdminI.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/PropertiesAdminI.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Property.java b/java-compat/src/Ice/src/main/java/IceInternal/Property.java
index 3d8395c0289..3d8395c0289 100644
--- a/java/src/Ice/src/main/java/IceInternal/Property.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Property.java
diff --git a/java/src/Ice/src/main/java/IceInternal/PropertyNames.java b/java-compat/src/Ice/src/main/java/IceInternal/PropertyNames.java
index 78fca903d04..78fca903d04 100644
--- a/java/src/Ice/src/main/java/IceInternal/PropertyNames.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/PropertyNames.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Protocol.java b/java-compat/src/Ice/src/main/java/IceInternal/Protocol.java
index 01b9a460b42..01b9a460b42 100644
--- a/java/src/Ice/src/main/java/IceInternal/Protocol.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Protocol.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ProtocolInstance.java b/java-compat/src/Ice/src/main/java/IceInternal/ProtocolInstance.java
index e88ec007887..e88ec007887 100644
--- a/java/src/Ice/src/main/java/IceInternal/ProtocolInstance.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ProtocolInstance.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ProtocolPluginFacade.java b/java-compat/src/Ice/src/main/java/IceInternal/ProtocolPluginFacade.java
index 7bfb91f3e04..7bfb91f3e04 100644
--- a/java/src/Ice/src/main/java/IceInternal/ProtocolPluginFacade.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ProtocolPluginFacade.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ProtocolPluginFacadeI.java b/java-compat/src/Ice/src/main/java/IceInternal/ProtocolPluginFacadeI.java
index fa510e2e6f9..fa510e2e6f9 100644
--- a/java/src/Ice/src/main/java/IceInternal/ProtocolPluginFacadeI.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ProtocolPluginFacadeI.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ProxyFactory.java b/java-compat/src/Ice/src/main/java/IceInternal/ProxyFactory.java
index ed3f1b81bd6..ed3f1b81bd6 100644
--- a/java/src/Ice/src/main/java/IceInternal/ProxyFactory.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ProxyFactory.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ProxyFlushBatch.java b/java-compat/src/Ice/src/main/java/IceInternal/ProxyFlushBatch.java
index eb49b24c6f1..eb49b24c6f1 100644
--- a/java/src/Ice/src/main/java/IceInternal/ProxyFlushBatch.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ProxyFlushBatch.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ProxyGetConnection.java b/java-compat/src/Ice/src/main/java/IceInternal/ProxyGetConnection.java
index f4da8e83e12..f4da8e83e12 100644
--- a/java/src/Ice/src/main/java/IceInternal/ProxyGetConnection.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ProxyGetConnection.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ProxyOutgoingAsyncBase.java b/java-compat/src/Ice/src/main/java/IceInternal/ProxyOutgoingAsyncBase.java
index a38c6c28c7a..a38c6c28c7a 100644
--- a/java/src/Ice/src/main/java/IceInternal/ProxyOutgoingAsyncBase.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ProxyOutgoingAsyncBase.java
diff --git a/java/src/Ice/src/main/java/IceInternal/QueueExecutorService.java b/java-compat/src/Ice/src/main/java/IceInternal/QueueExecutorService.java
index cb46d5dfe0b..cb46d5dfe0b 100644
--- a/java/src/Ice/src/main/java/IceInternal/QueueExecutorService.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/QueueExecutorService.java
diff --git a/java/src/Ice/src/main/java/IceInternal/QueueRequestHandler.java b/java-compat/src/Ice/src/main/java/IceInternal/QueueRequestHandler.java
index a77e67c0f9f..a77e67c0f9f 100644
--- a/java/src/Ice/src/main/java/IceInternal/QueueRequestHandler.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/QueueRequestHandler.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ReadyCallback.java b/java-compat/src/Ice/src/main/java/IceInternal/ReadyCallback.java
index e4c1482c5fb..e4c1482c5fb 100644
--- a/java/src/Ice/src/main/java/IceInternal/ReadyCallback.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ReadyCallback.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Reference.java b/java-compat/src/Ice/src/main/java/IceInternal/Reference.java
index b7ea1dd2f32..b7ea1dd2f32 100644
--- a/java/src/Ice/src/main/java/IceInternal/Reference.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Reference.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ReferenceFactory.java b/java-compat/src/Ice/src/main/java/IceInternal/ReferenceFactory.java
index ed36537017e..ed36537017e 100644
--- a/java/src/Ice/src/main/java/IceInternal/ReferenceFactory.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ReferenceFactory.java
diff --git a/java/src/Ice/src/main/java/IceInternal/RemoteObserverI.java b/java-compat/src/Ice/src/main/java/IceInternal/RemoteObserverI.java
index f7c35f706eb..f7c35f706eb 100644
--- a/java/src/Ice/src/main/java/IceInternal/RemoteObserverI.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/RemoteObserverI.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ReplyStatus.java b/java-compat/src/Ice/src/main/java/IceInternal/ReplyStatus.java
index 20b2cc32dd1..20b2cc32dd1 100644
--- a/java/src/Ice/src/main/java/IceInternal/ReplyStatus.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ReplyStatus.java
diff --git a/java/src/Ice/src/main/java/IceInternal/RequestHandler.java b/java-compat/src/Ice/src/main/java/IceInternal/RequestHandler.java
index 5fa3485400d..5fa3485400d 100644
--- a/java/src/Ice/src/main/java/IceInternal/RequestHandler.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/RequestHandler.java
diff --git a/java/src/Ice/src/main/java/IceInternal/RequestHandlerFactory.java b/java-compat/src/Ice/src/main/java/IceInternal/RequestHandlerFactory.java
index ff4022724a9..ff4022724a9 100644
--- a/java/src/Ice/src/main/java/IceInternal/RequestHandlerFactory.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/RequestHandlerFactory.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ResponseHandler.java b/java-compat/src/Ice/src/main/java/IceInternal/ResponseHandler.java
index 401d80e5451..401d80e5451 100644
--- a/java/src/Ice/src/main/java/IceInternal/ResponseHandler.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ResponseHandler.java
diff --git a/java/src/Ice/src/main/java/IceInternal/RetryException.java b/java-compat/src/Ice/src/main/java/IceInternal/RetryException.java
index 463a675b24a..463a675b24a 100644
--- a/java/src/Ice/src/main/java/IceInternal/RetryException.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/RetryException.java
diff --git a/java/src/Ice/src/main/java/IceInternal/RetryQueue.java b/java-compat/src/Ice/src/main/java/IceInternal/RetryQueue.java
index f495e6ecbcc..f495e6ecbcc 100644
--- a/java/src/Ice/src/main/java/IceInternal/RetryQueue.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/RetryQueue.java
diff --git a/java/src/Ice/src/main/java/IceInternal/RetryTask.java b/java-compat/src/Ice/src/main/java/IceInternal/RetryTask.java
index a9b4b1d1119..a9b4b1d1119 100644
--- a/java/src/Ice/src/main/java/IceInternal/RetryTask.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/RetryTask.java
diff --git a/java/src/Ice/src/main/java/IceInternal/RoutableReference.java b/java-compat/src/Ice/src/main/java/IceInternal/RoutableReference.java
index 688b2ca9935..688b2ca9935 100644
--- a/java/src/Ice/src/main/java/IceInternal/RoutableReference.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/RoutableReference.java
diff --git a/java/src/Ice/src/main/java/IceInternal/RouterInfo.java b/java-compat/src/Ice/src/main/java/IceInternal/RouterInfo.java
index 1de08e756fe..1de08e756fe 100644
--- a/java/src/Ice/src/main/java/IceInternal/RouterInfo.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/RouterInfo.java
diff --git a/java/src/Ice/src/main/java/IceInternal/RouterManager.java b/java-compat/src/Ice/src/main/java/IceInternal/RouterManager.java
index 217c5d86d5d..217c5d86d5d 100644
--- a/java/src/Ice/src/main/java/IceInternal/RouterManager.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/RouterManager.java
diff --git a/java/src/Ice/src/main/java/IceInternal/SOCKSNetworkProxy.java b/java-compat/src/Ice/src/main/java/IceInternal/SOCKSNetworkProxy.java
index c2843bdbf6e..c2843bdbf6e 100644
--- a/java/src/Ice/src/main/java/IceInternal/SOCKSNetworkProxy.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/SOCKSNetworkProxy.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Selector.java b/java-compat/src/Ice/src/main/java/IceInternal/Selector.java
index ecc4529845e..ecc4529845e 100644
--- a/java/src/Ice/src/main/java/IceInternal/Selector.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Selector.java
diff --git a/java/src/Ice/src/main/java/IceInternal/SequencePatcher.java b/java-compat/src/Ice/src/main/java/IceInternal/SequencePatcher.java
index ca11b14d21c..ca11b14d21c 100644
--- a/java/src/Ice/src/main/java/IceInternal/SequencePatcher.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/SequencePatcher.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ServantError.java b/java-compat/src/Ice/src/main/java/IceInternal/ServantError.java
index 8823aae9ea9..8823aae9ea9 100644
--- a/java/src/Ice/src/main/java/IceInternal/ServantError.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ServantError.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ServantManager.java b/java-compat/src/Ice/src/main/java/IceInternal/ServantManager.java
index 2789304f276..2789304f276 100644
--- a/java/src/Ice/src/main/java/IceInternal/ServantManager.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ServantManager.java
diff --git a/java/src/Ice/src/main/java/IceInternal/SocketOperation.java b/java-compat/src/Ice/src/main/java/IceInternal/SocketOperation.java
index 030d5d32bfd..030d5d32bfd 100644
--- a/java/src/Ice/src/main/java/IceInternal/SocketOperation.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/SocketOperation.java
diff --git a/java/src/Ice/src/main/java/IceInternal/StreamSocket.java b/java-compat/src/Ice/src/main/java/IceInternal/StreamSocket.java
index 03cd265e0e6..03cd265e0e6 100644
--- a/java/src/Ice/src/main/java/IceInternal/StreamSocket.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/StreamSocket.java
diff --git a/java/src/Ice/src/main/java/IceInternal/TcpAcceptor.java b/java-compat/src/Ice/src/main/java/IceInternal/TcpAcceptor.java
index 27418ca2bad..27418ca2bad 100644
--- a/java/src/Ice/src/main/java/IceInternal/TcpAcceptor.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/TcpAcceptor.java
diff --git a/java/src/Ice/src/main/java/IceInternal/TcpConnector.java b/java-compat/src/Ice/src/main/java/IceInternal/TcpConnector.java
index 64ab2c3b515..64ab2c3b515 100644
--- a/java/src/Ice/src/main/java/IceInternal/TcpConnector.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/TcpConnector.java
diff --git a/java/src/Ice/src/main/java/IceInternal/TcpEndpointFactory.java b/java-compat/src/Ice/src/main/java/IceInternal/TcpEndpointFactory.java
index 9211951ca59..9211951ca59 100644
--- a/java/src/Ice/src/main/java/IceInternal/TcpEndpointFactory.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/TcpEndpointFactory.java
diff --git a/java/src/Ice/src/main/java/IceInternal/TcpEndpointI.java b/java-compat/src/Ice/src/main/java/IceInternal/TcpEndpointI.java
index f038da63a2d..f038da63a2d 100644
--- a/java/src/Ice/src/main/java/IceInternal/TcpEndpointI.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/TcpEndpointI.java
diff --git a/java/src/Ice/src/main/java/IceInternal/TcpTransceiver.java b/java-compat/src/Ice/src/main/java/IceInternal/TcpTransceiver.java
index 069e79a3408..069e79a3408 100644
--- a/java/src/Ice/src/main/java/IceInternal/TcpTransceiver.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/TcpTransceiver.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ThreadObserverI.java b/java-compat/src/Ice/src/main/java/IceInternal/ThreadObserverI.java
index 553e46840bf..553e46840bf 100644
--- a/java/src/Ice/src/main/java/IceInternal/ThreadObserverI.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ThreadObserverI.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ThreadPool.java b/java-compat/src/Ice/src/main/java/IceInternal/ThreadPool.java
index 9dc5f1ec92a..9dc5f1ec92a 100644
--- a/java/src/Ice/src/main/java/IceInternal/ThreadPool.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ThreadPool.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ThreadPoolCurrent.java b/java-compat/src/Ice/src/main/java/IceInternal/ThreadPoolCurrent.java
index cdd5b9fe2bc..cdd5b9fe2bc 100644
--- a/java/src/Ice/src/main/java/IceInternal/ThreadPoolCurrent.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ThreadPoolCurrent.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ThreadPoolWorkItem.java b/java-compat/src/Ice/src/main/java/IceInternal/ThreadPoolWorkItem.java
index 27f06f9366b..27f06f9366b 100644
--- a/java/src/Ice/src/main/java/IceInternal/ThreadPoolWorkItem.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ThreadPoolWorkItem.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ThreadPoolWorkQueue.java b/java-compat/src/Ice/src/main/java/IceInternal/ThreadPoolWorkQueue.java
index ae838d61cdf..ae838d61cdf 100644
--- a/java/src/Ice/src/main/java/IceInternal/ThreadPoolWorkQueue.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ThreadPoolWorkQueue.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Time.java b/java-compat/src/Ice/src/main/java/IceInternal/Time.java
index e1547f9e552..e1547f9e552 100644
--- a/java/src/Ice/src/main/java/IceInternal/Time.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Time.java
diff --git a/java/src/Ice/src/main/java/IceInternal/TraceLevels.java b/java-compat/src/Ice/src/main/java/IceInternal/TraceLevels.java
index 8273966cdad..8273966cdad 100644
--- a/java/src/Ice/src/main/java/IceInternal/TraceLevels.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/TraceLevels.java
diff --git a/java/src/Ice/src/main/java/IceInternal/TraceUtil.java b/java-compat/src/Ice/src/main/java/IceInternal/TraceUtil.java
index 2ff165c475d..2ff165c475d 100644
--- a/java/src/Ice/src/main/java/IceInternal/TraceUtil.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/TraceUtil.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Transceiver.java b/java-compat/src/Ice/src/main/java/IceInternal/Transceiver.java
index c62c00984b6..c62c00984b6 100644
--- a/java/src/Ice/src/main/java/IceInternal/Transceiver.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Transceiver.java
diff --git a/java/src/Ice/src/main/java/IceInternal/TwowayCallback.java b/java-compat/src/Ice/src/main/java/IceInternal/TwowayCallback.java
index 713f965d848..713f965d848 100644
--- a/java/src/Ice/src/main/java/IceInternal/TwowayCallback.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/TwowayCallback.java
diff --git a/java/src/Ice/src/main/java/IceInternal/UdpConnector.java b/java-compat/src/Ice/src/main/java/IceInternal/UdpConnector.java
index ad91ec7fba2..ad91ec7fba2 100644
--- a/java/src/Ice/src/main/java/IceInternal/UdpConnector.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/UdpConnector.java
diff --git a/java/src/Ice/src/main/java/IceInternal/UdpEndpointFactory.java b/java-compat/src/Ice/src/main/java/IceInternal/UdpEndpointFactory.java
index 6683b57dcb9..6683b57dcb9 100644
--- a/java/src/Ice/src/main/java/IceInternal/UdpEndpointFactory.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/UdpEndpointFactory.java
diff --git a/java/src/Ice/src/main/java/IceInternal/UdpEndpointI.java b/java-compat/src/Ice/src/main/java/IceInternal/UdpEndpointI.java
index 8c1d0bc837d..8c1d0bc837d 100644
--- a/java/src/Ice/src/main/java/IceInternal/UdpEndpointI.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/UdpEndpointI.java
diff --git a/java/src/Ice/src/main/java/IceInternal/UdpTransceiver.java b/java-compat/src/Ice/src/main/java/IceInternal/UdpTransceiver.java
index 1f4899f7bce..1f4899f7bce 100644
--- a/java/src/Ice/src/main/java/IceInternal/UdpTransceiver.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/UdpTransceiver.java
diff --git a/java/src/Ice/src/main/java/IceInternal/Util.java b/java-compat/src/Ice/src/main/java/IceInternal/Util.java
index 46920d5d04d..46920d5d04d 100644
--- a/java/src/Ice/src/main/java/IceInternal/Util.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/Util.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ValueFactoryManagerI.java b/java-compat/src/Ice/src/main/java/IceInternal/ValueFactoryManagerI.java
index dfd51f0cbd5..dfd51f0cbd5 100644
--- a/java/src/Ice/src/main/java/IceInternal/ValueFactoryManagerI.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ValueFactoryManagerI.java
diff --git a/java/src/Ice/src/main/java/IceInternal/ValueWriter.java b/java-compat/src/Ice/src/main/java/IceInternal/ValueWriter.java
index 3184c250734..3184c250734 100644
--- a/java/src/Ice/src/main/java/IceInternal/ValueWriter.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/ValueWriter.java
diff --git a/java/src/Ice/src/main/java/IceInternal/WSAcceptor.java b/java-compat/src/Ice/src/main/java/IceInternal/WSAcceptor.java
index 4b87907a671..4b87907a671 100644
--- a/java/src/Ice/src/main/java/IceInternal/WSAcceptor.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/WSAcceptor.java
diff --git a/java/src/Ice/src/main/java/IceInternal/WSConnector.java b/java-compat/src/Ice/src/main/java/IceInternal/WSConnector.java
index 3c9ecc7e06b..3c9ecc7e06b 100644
--- a/java/src/Ice/src/main/java/IceInternal/WSConnector.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/WSConnector.java
diff --git a/java/src/Ice/src/main/java/IceInternal/WSEndpoint.java b/java-compat/src/Ice/src/main/java/IceInternal/WSEndpoint.java
index 91ea36d1a62..91ea36d1a62 100644
--- a/java/src/Ice/src/main/java/IceInternal/WSEndpoint.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/WSEndpoint.java
diff --git a/java/src/Ice/src/main/java/IceInternal/WSEndpointFactory.java b/java-compat/src/Ice/src/main/java/IceInternal/WSEndpointFactory.java
index 493cddfd5eb..493cddfd5eb 100644
--- a/java/src/Ice/src/main/java/IceInternal/WSEndpointFactory.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/WSEndpointFactory.java
diff --git a/java/src/Ice/src/main/java/IceInternal/WSTransceiver.java b/java-compat/src/Ice/src/main/java/IceInternal/WSTransceiver.java
index 8188ab322c8..8188ab322c8 100644
--- a/java/src/Ice/src/main/java/IceInternal/WSTransceiver.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/WSTransceiver.java
diff --git a/java/src/Ice/src/main/java/IceInternal/WebSocketException.java b/java-compat/src/Ice/src/main/java/IceInternal/WebSocketException.java
index cee046461cb..cee046461cb 100644
--- a/java/src/Ice/src/main/java/IceInternal/WebSocketException.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/WebSocketException.java
diff --git a/java/src/Ice/src/main/java/IceMX/MetricsHelper.java b/java-compat/src/Ice/src/main/java/IceMX/MetricsHelper.java
index 84dfc57d19f..84dfc57d19f 100644
--- a/java/src/Ice/src/main/java/IceMX/MetricsHelper.java
+++ b/java-compat/src/Ice/src/main/java/IceMX/MetricsHelper.java
diff --git a/java/src/Ice/src/main/java/IceMX/Observer.java b/java-compat/src/Ice/src/main/java/IceMX/Observer.java
index deec790deff..deec790deff 100644
--- a/java/src/Ice/src/main/java/IceMX/Observer.java
+++ b/java-compat/src/Ice/src/main/java/IceMX/Observer.java
diff --git a/java/src/Ice/src/main/java/IceMX/ObserverFactory.java b/java-compat/src/Ice/src/main/java/IceMX/ObserverFactory.java
index ca06b0a8c00..ca06b0a8c00 100644
--- a/java/src/Ice/src/main/java/IceMX/ObserverFactory.java
+++ b/java-compat/src/Ice/src/main/java/IceMX/ObserverFactory.java
diff --git a/java/src/Ice/src/main/java/IceMX/ObserverFactoryWithDelegate.java b/java-compat/src/Ice/src/main/java/IceMX/ObserverFactoryWithDelegate.java
index 9e0e01c2949..9e0e01c2949 100644
--- a/java/src/Ice/src/main/java/IceMX/ObserverFactoryWithDelegate.java
+++ b/java-compat/src/Ice/src/main/java/IceMX/ObserverFactoryWithDelegate.java
diff --git a/java/src/Ice/src/main/java/IceMX/ObserverWithDelegate.java b/java-compat/src/Ice/src/main/java/IceMX/ObserverWithDelegate.java
index 94b09bb9821..94b09bb9821 100644
--- a/java/src/Ice/src/main/java/IceMX/ObserverWithDelegate.java
+++ b/java-compat/src/Ice/src/main/java/IceMX/ObserverWithDelegate.java
diff --git a/java/src/Ice/src/main/java/IceMX/ObserverWithDelegateI.java b/java-compat/src/Ice/src/main/java/IceMX/ObserverWithDelegateI.java
index f146b9f9780..f146b9f9780 100644
--- a/java/src/Ice/src/main/java/IceMX/ObserverWithDelegateI.java
+++ b/java-compat/src/Ice/src/main/java/IceMX/ObserverWithDelegateI.java
diff --git a/java/src/Ice/src/main/java/IceSSL/AcceptorI.java b/java-compat/src/Ice/src/main/java/IceSSL/AcceptorI.java
index bf21888839e..bf21888839e 100644
--- a/java/src/Ice/src/main/java/IceSSL/AcceptorI.java
+++ b/java-compat/src/Ice/src/main/java/IceSSL/AcceptorI.java
diff --git a/java/src/Ice/src/main/java/IceSSL/CertificateVerifier.java b/java-compat/src/Ice/src/main/java/IceSSL/CertificateVerifier.java
index 4aaa6b91f11..4aaa6b91f11 100644
--- a/java/src/Ice/src/main/java/IceSSL/CertificateVerifier.java
+++ b/java-compat/src/Ice/src/main/java/IceSSL/CertificateVerifier.java
diff --git a/java/src/Ice/src/main/java/IceSSL/ConnectorI.java b/java-compat/src/Ice/src/main/java/IceSSL/ConnectorI.java
index d463a89bf3d..d463a89bf3d 100644
--- a/java/src/Ice/src/main/java/IceSSL/ConnectorI.java
+++ b/java-compat/src/Ice/src/main/java/IceSSL/ConnectorI.java
diff --git a/java/src/Ice/src/main/java/IceSSL/EndpointFactoryI.java b/java-compat/src/Ice/src/main/java/IceSSL/EndpointFactoryI.java
index ffe402c6193..ffe402c6193 100644
--- a/java/src/Ice/src/main/java/IceSSL/EndpointFactoryI.java
+++ b/java-compat/src/Ice/src/main/java/IceSSL/EndpointFactoryI.java
diff --git a/java/src/Ice/src/main/java/IceSSL/EndpointI.java b/java-compat/src/Ice/src/main/java/IceSSL/EndpointI.java
index 08de48c2f11..08de48c2f11 100644
--- a/java/src/Ice/src/main/java/IceSSL/EndpointI.java
+++ b/java-compat/src/Ice/src/main/java/IceSSL/EndpointI.java
diff --git a/java/src/Ice/src/main/java/IceSSL/Instance.java b/java-compat/src/Ice/src/main/java/IceSSL/Instance.java
index 53ffac5c29f..53ffac5c29f 100644
--- a/java/src/Ice/src/main/java/IceSSL/Instance.java
+++ b/java-compat/src/Ice/src/main/java/IceSSL/Instance.java
diff --git a/java/src/Ice/src/main/java/IceSSL/NativeConnectionInfo.java b/java-compat/src/Ice/src/main/java/IceSSL/NativeConnectionInfo.java
index 3e726309267..3e726309267 100644
--- a/java/src/Ice/src/main/java/IceSSL/NativeConnectionInfo.java
+++ b/java-compat/src/Ice/src/main/java/IceSSL/NativeConnectionInfo.java
diff --git a/java/src/Ice/src/main/java/IceSSL/PasswordCallback.java b/java-compat/src/Ice/src/main/java/IceSSL/PasswordCallback.java
index 227b7c41361..227b7c41361 100644
--- a/java/src/Ice/src/main/java/IceSSL/PasswordCallback.java
+++ b/java-compat/src/Ice/src/main/java/IceSSL/PasswordCallback.java
diff --git a/java/src/Ice/src/main/java/IceSSL/Plugin.java b/java-compat/src/Ice/src/main/java/IceSSL/Plugin.java
index 7301c37ed6a..7301c37ed6a 100644
--- a/java/src/Ice/src/main/java/IceSSL/Plugin.java
+++ b/java-compat/src/Ice/src/main/java/IceSSL/Plugin.java
diff --git a/java/src/Ice/src/main/java/IceSSL/PluginFactory.java b/java-compat/src/Ice/src/main/java/IceSSL/PluginFactory.java
index cb8063fe148..cb8063fe148 100644
--- a/java/src/Ice/src/main/java/IceSSL/PluginFactory.java
+++ b/java-compat/src/Ice/src/main/java/IceSSL/PluginFactory.java
diff --git a/java/src/Ice/src/main/java/IceSSL/PluginI.java b/java-compat/src/Ice/src/main/java/IceSSL/PluginI.java
index a57d6e31245..a57d6e31245 100644
--- a/java/src/Ice/src/main/java/IceSSL/PluginI.java
+++ b/java-compat/src/Ice/src/main/java/IceSSL/PluginI.java
diff --git a/java/src/Ice/src/main/java/IceSSL/RFC2253.java b/java-compat/src/Ice/src/main/java/IceSSL/RFC2253.java
index 3d88287ca1b..3d88287ca1b 100644
--- a/java/src/Ice/src/main/java/IceSSL/RFC2253.java
+++ b/java-compat/src/Ice/src/main/java/IceSSL/RFC2253.java
diff --git a/java/src/Ice/src/main/java/IceSSL/SSLEngine.java b/java-compat/src/Ice/src/main/java/IceSSL/SSLEngine.java
index e8da76b6b26..e8da76b6b26 100644
--- a/java/src/Ice/src/main/java/IceSSL/SSLEngine.java
+++ b/java-compat/src/Ice/src/main/java/IceSSL/SSLEngine.java
diff --git a/java/src/Ice/src/main/java/IceSSL/TransceiverI.java b/java-compat/src/Ice/src/main/java/IceSSL/TransceiverI.java
index d34a83acdae..d34a83acdae 100644
--- a/java/src/Ice/src/main/java/IceSSL/TransceiverI.java
+++ b/java-compat/src/Ice/src/main/java/IceSSL/TransceiverI.java
diff --git a/java/src/Ice/src/main/java/IceSSL/TrustManager.java b/java-compat/src/Ice/src/main/java/IceSSL/TrustManager.java
index ba17851dee8..ba17851dee8 100644
--- a/java/src/Ice/src/main/java/IceSSL/TrustManager.java
+++ b/java-compat/src/Ice/src/main/java/IceSSL/TrustManager.java
diff --git a/java/src/Ice/src/main/java/IceSSL/Util.java b/java-compat/src/Ice/src/main/java/IceSSL/Util.java
index 53a71e15896..53a71e15896 100644
--- a/java/src/Ice/src/main/java/IceSSL/Util.java
+++ b/java-compat/src/Ice/src/main/java/IceSSL/Util.java
diff --git a/java/src/Ice/src/main/java/IceSSL/X509KeyManagerI.java b/java-compat/src/Ice/src/main/java/IceSSL/X509KeyManagerI.java
index 70ca764bfa1..70ca764bfa1 100644
--- a/java/src/Ice/src/main/java/IceSSL/X509KeyManagerI.java
+++ b/java-compat/src/Ice/src/main/java/IceSSL/X509KeyManagerI.java
diff --git a/java/src/Ice/src/main/java/IceSSL/X509TrustManagerI.java b/java-compat/src/Ice/src/main/java/IceSSL/X509TrustManagerI.java
index 57d03e5200e..57d03e5200e 100644
--- a/java/src/Ice/src/main/java/IceSSL/X509TrustManagerI.java
+++ b/java-compat/src/Ice/src/main/java/IceSSL/X509TrustManagerI.java
diff --git a/java/src/Ice/src/main/java/IceUtilInternal/Assert.java b/java-compat/src/Ice/src/main/java/IceUtilInternal/Assert.java
index 545bed9c635..545bed9c635 100644
--- a/java/src/Ice/src/main/java/IceUtilInternal/Assert.java
+++ b/java-compat/src/Ice/src/main/java/IceUtilInternal/Assert.java
diff --git a/java/src/Ice/src/main/java/IceUtilInternal/Base64.java b/java-compat/src/Ice/src/main/java/IceUtilInternal/Base64.java
index 661a464649e..661a464649e 100644
--- a/java/src/Ice/src/main/java/IceUtilInternal/Base64.java
+++ b/java-compat/src/Ice/src/main/java/IceUtilInternal/Base64.java
diff --git a/java/src/Ice/src/main/java/IceUtilInternal/Options.java b/java-compat/src/Ice/src/main/java/IceUtilInternal/Options.java
index a16c0ed56ac..a16c0ed56ac 100644
--- a/java/src/Ice/src/main/java/IceUtilInternal/Options.java
+++ b/java-compat/src/Ice/src/main/java/IceUtilInternal/Options.java
diff --git a/java/src/Ice/src/main/java/IceUtilInternal/OutputBase.java b/java-compat/src/Ice/src/main/java/IceUtilInternal/OutputBase.java
index 7638be77c0b..7638be77c0b 100644
--- a/java/src/Ice/src/main/java/IceUtilInternal/OutputBase.java
+++ b/java-compat/src/Ice/src/main/java/IceUtilInternal/OutputBase.java
diff --git a/java/src/Ice/src/main/java/IceUtilInternal/StopWatch.java b/java-compat/src/Ice/src/main/java/IceUtilInternal/StopWatch.java
index 137a8cad364..137a8cad364 100644
--- a/java/src/Ice/src/main/java/IceUtilInternal/StopWatch.java
+++ b/java-compat/src/Ice/src/main/java/IceUtilInternal/StopWatch.java
diff --git a/java/src/Ice/src/main/java/IceUtilInternal/StringUtil.java b/java-compat/src/Ice/src/main/java/IceUtilInternal/StringUtil.java
index 953359c5c4b..953359c5c4b 100644
--- a/java/src/Ice/src/main/java/IceUtilInternal/StringUtil.java
+++ b/java-compat/src/Ice/src/main/java/IceUtilInternal/StringUtil.java
diff --git a/java/src/Ice/src/main/java/IceUtilInternal/XMLOutput.java b/java-compat/src/Ice/src/main/java/IceUtilInternal/XMLOutput.java
index 8d6f4ab9569..8d6f4ab9569 100644
--- a/java/src/Ice/src/main/java/IceUtilInternal/XMLOutput.java
+++ b/java-compat/src/Ice/src/main/java/IceUtilInternal/XMLOutput.java
diff --git a/java/src/IceBT/build.gradle b/java-compat/src/IceBT/build.gradle
index 1e7cfbe607b..190900f0f07 100644
--- a/java/src/IceBT/build.gradle
+++ b/java-compat/src/IceBT/build.gradle
@@ -10,7 +10,7 @@
sourceCompatibility = iceSourceCompatibility
targetCompatibility = iceTargetCompatibility
-project.ext.displayName = "IceBT"
+project.ext.displayName = "IceBT Compat"
project.ext.description = "Bluetooth support for Ice"
slice {
@@ -23,10 +23,10 @@ slice {
}
dependencies {
- compile project(':ice')
+ compile project(':ice-compat')
}
-apply from: "$rootProject.projectDir/gradle/library.gradle"
+apply from: "$rootProject.projectDir/../java/gradle/library.gradle"
jar {
//
diff --git a/java/src/IceBT/src/main/java/IceBT/AcceptorI.java b/java-compat/src/IceBT/src/main/java/IceBT/AcceptorI.java
index 553e13ae149..553e13ae149 100644
--- a/java/src/IceBT/src/main/java/IceBT/AcceptorI.java
+++ b/java-compat/src/IceBT/src/main/java/IceBT/AcceptorI.java
diff --git a/java/src/IceBT/src/main/java/IceBT/ConnectorI.java b/java-compat/src/IceBT/src/main/java/IceBT/ConnectorI.java
index e8c8e8d47f5..e8c8e8d47f5 100644
--- a/java/src/IceBT/src/main/java/IceBT/ConnectorI.java
+++ b/java-compat/src/IceBT/src/main/java/IceBT/ConnectorI.java
diff --git a/java/src/IceBT/src/main/java/IceBT/EndpointFactoryI.java b/java-compat/src/IceBT/src/main/java/IceBT/EndpointFactoryI.java
index 5ffc5141907..5ffc5141907 100644
--- a/java/src/IceBT/src/main/java/IceBT/EndpointFactoryI.java
+++ b/java-compat/src/IceBT/src/main/java/IceBT/EndpointFactoryI.java
diff --git a/java/src/IceBT/src/main/java/IceBT/EndpointI.java b/java-compat/src/IceBT/src/main/java/IceBT/EndpointI.java
index 7576f458fae..7576f458fae 100644
--- a/java/src/IceBT/src/main/java/IceBT/EndpointI.java
+++ b/java-compat/src/IceBT/src/main/java/IceBT/EndpointI.java
diff --git a/java/src/IceBT/src/main/java/IceBT/Instance.java b/java-compat/src/IceBT/src/main/java/IceBT/Instance.java
index db5d516adcb..db5d516adcb 100644
--- a/java/src/IceBT/src/main/java/IceBT/Instance.java
+++ b/java-compat/src/IceBT/src/main/java/IceBT/Instance.java
diff --git a/java/src/IceBT/src/main/java/IceBT/PluginFactory.java b/java-compat/src/IceBT/src/main/java/IceBT/PluginFactory.java
index fc523108cae..fc523108cae 100644
--- a/java/src/IceBT/src/main/java/IceBT/PluginFactory.java
+++ b/java-compat/src/IceBT/src/main/java/IceBT/PluginFactory.java
diff --git a/java/src/IceBT/src/main/java/IceBT/PluginI.java b/java-compat/src/IceBT/src/main/java/IceBT/PluginI.java
index bee179f55ca..bee179f55ca 100644
--- a/java/src/IceBT/src/main/java/IceBT/PluginI.java
+++ b/java-compat/src/IceBT/src/main/java/IceBT/PluginI.java
diff --git a/java/src/IceBT/src/main/java/IceBT/TransceiverI.java b/java-compat/src/IceBT/src/main/java/IceBT/TransceiverI.java
index fe6df651826..fe6df651826 100644
--- a/java/src/IceBT/src/main/java/IceBT/TransceiverI.java
+++ b/java-compat/src/IceBT/src/main/java/IceBT/TransceiverI.java
diff --git a/java/src/IceBT/src/main/java/IceBT/Util.java b/java-compat/src/IceBT/src/main/java/IceBT/Util.java
index ffb07e0a2f5..ffb07e0a2f5 100644
--- a/java/src/IceBT/src/main/java/IceBT/Util.java
+++ b/java-compat/src/IceBT/src/main/java/IceBT/Util.java
diff --git a/java/src/IceBT/src/main/java/android/bluetooth/BluetoothAdapter.java b/java-compat/src/IceBT/src/main/java/android/bluetooth/BluetoothAdapter.java
index 8d00d879d3b..8d00d879d3b 100644
--- a/java/src/IceBT/src/main/java/android/bluetooth/BluetoothAdapter.java
+++ b/java-compat/src/IceBT/src/main/java/android/bluetooth/BluetoothAdapter.java
diff --git a/java/src/IceBT/src/main/java/android/bluetooth/BluetoothDevice.java b/java-compat/src/IceBT/src/main/java/android/bluetooth/BluetoothDevice.java
index 7fbee8880de..7fbee8880de 100644
--- a/java/src/IceBT/src/main/java/android/bluetooth/BluetoothDevice.java
+++ b/java-compat/src/IceBT/src/main/java/android/bluetooth/BluetoothDevice.java
diff --git a/java/src/IceBT/src/main/java/android/bluetooth/BluetoothServerSocket.java b/java-compat/src/IceBT/src/main/java/android/bluetooth/BluetoothServerSocket.java
index c6e6f2a6978..c6e6f2a6978 100644
--- a/java/src/IceBT/src/main/java/android/bluetooth/BluetoothServerSocket.java
+++ b/java-compat/src/IceBT/src/main/java/android/bluetooth/BluetoothServerSocket.java
diff --git a/java/src/IceBT/src/main/java/android/bluetooth/BluetoothSocket.java b/java-compat/src/IceBT/src/main/java/android/bluetooth/BluetoothSocket.java
index 80470a11a52..80470a11a52 100644
--- a/java/src/IceBT/src/main/java/android/bluetooth/BluetoothSocket.java
+++ b/java-compat/src/IceBT/src/main/java/android/bluetooth/BluetoothSocket.java
diff --git a/java-compat/src/IceBox/build.gradle b/java-compat/src/IceBox/build.gradle
new file mode 100644
index 00000000000..19aac05e3d3
--- /dev/null
+++ b/java-compat/src/IceBox/build.gradle
@@ -0,0 +1,29 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+sourceCompatibility = iceSourceCompatibility
+targetCompatibility = iceTargetCompatibility
+
+project.ext.displayName = "IceBox Compat"
+project.ext.description = "IceBox is an easy-to-use framework for Ice application services"
+
+slice {
+ java {
+ set1 {
+ args = "--ice --tie --checksum IceBox.SliceChecksums"
+ files = fileTree(dir: "$sliceDir/IceBox", includes:['*.ice'], excludes:["*F.ice"])
+ }
+ }
+}
+
+dependencies {
+ compile project(':ice-compat')
+}
+
+apply from: "$rootProject.projectDir/../java/gradle/library.gradle"
diff --git a/java/src/IceBox/src/main/java/IceBox/Admin.java b/java-compat/src/IceBox/src/main/java/IceBox/Admin.java
index 52e39ee771e..52e39ee771e 100644
--- a/java/src/IceBox/src/main/java/IceBox/Admin.java
+++ b/java-compat/src/IceBox/src/main/java/IceBox/Admin.java
diff --git a/java/src/IceBox/src/main/java/IceBox/Server.java b/java-compat/src/IceBox/src/main/java/IceBox/Server.java
index f6147ea423b..f6147ea423b 100644
--- a/java/src/IceBox/src/main/java/IceBox/Server.java
+++ b/java-compat/src/IceBox/src/main/java/IceBox/Server.java
diff --git a/java/src/IceBox/src/main/java/IceBox/ServiceManagerI.java b/java-compat/src/IceBox/src/main/java/IceBox/ServiceManagerI.java
index ceefc3170ff..ceefc3170ff 100644
--- a/java/src/IceBox/src/main/java/IceBox/ServiceManagerI.java
+++ b/java-compat/src/IceBox/src/main/java/IceBox/ServiceManagerI.java
diff --git a/java-compat/src/IceDiscovery/build.gradle b/java-compat/src/IceDiscovery/build.gradle
new file mode 100644
index 00000000000..c64a33f1ccd
--- /dev/null
+++ b/java-compat/src/IceDiscovery/build.gradle
@@ -0,0 +1,27 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+sourceCompatibility = iceSourceCompatibility
+targetCompatibility = iceTargetCompatibility
+
+project.ext.displayName = "IceDiscovery Compat"
+project.ext.description = "Allow Ice applications to discover objects and object adapters"
+
+slice {
+ java {
+ args = "--ice"
+ files = fileTree(dir: "$sliceDir/IceDiscovery", includes:['*.ice'], excludes:["*F.ice"])
+ }
+}
+
+dependencies {
+ compile project(':ice-compat')
+}
+
+apply from: "$rootProject.projectDir/../java/gradle/library.gradle"
diff --git a/java/src/IceDiscovery/src/main/java/IceDiscovery/LocatorI.java b/java-compat/src/IceDiscovery/src/main/java/IceDiscovery/LocatorI.java
index 7061f168010..7061f168010 100644
--- a/java/src/IceDiscovery/src/main/java/IceDiscovery/LocatorI.java
+++ b/java-compat/src/IceDiscovery/src/main/java/IceDiscovery/LocatorI.java
diff --git a/java/src/IceDiscovery/src/main/java/IceDiscovery/LocatorRegistryI.java b/java-compat/src/IceDiscovery/src/main/java/IceDiscovery/LocatorRegistryI.java
index be8e0e6f220..be8e0e6f220 100644
--- a/java/src/IceDiscovery/src/main/java/IceDiscovery/LocatorRegistryI.java
+++ b/java-compat/src/IceDiscovery/src/main/java/IceDiscovery/LocatorRegistryI.java
diff --git a/java/src/IceDiscovery/src/main/java/IceDiscovery/LookupI.java b/java-compat/src/IceDiscovery/src/main/java/IceDiscovery/LookupI.java
index 003fe63c53b..003fe63c53b 100644
--- a/java/src/IceDiscovery/src/main/java/IceDiscovery/LookupI.java
+++ b/java-compat/src/IceDiscovery/src/main/java/IceDiscovery/LookupI.java
diff --git a/java/src/IceDiscovery/src/main/java/IceDiscovery/LookupReplyI.java b/java-compat/src/IceDiscovery/src/main/java/IceDiscovery/LookupReplyI.java
index c848d425630..c848d425630 100644
--- a/java/src/IceDiscovery/src/main/java/IceDiscovery/LookupReplyI.java
+++ b/java-compat/src/IceDiscovery/src/main/java/IceDiscovery/LookupReplyI.java
diff --git a/java/src/IceDiscovery/src/main/java/IceDiscovery/PluginFactory.java b/java-compat/src/IceDiscovery/src/main/java/IceDiscovery/PluginFactory.java
index 506746369a6..506746369a6 100644
--- a/java/src/IceDiscovery/src/main/java/IceDiscovery/PluginFactory.java
+++ b/java-compat/src/IceDiscovery/src/main/java/IceDiscovery/PluginFactory.java
diff --git a/java/src/IceDiscovery/src/main/java/IceDiscovery/PluginI.java b/java-compat/src/IceDiscovery/src/main/java/IceDiscovery/PluginI.java
index 4f45834c7ea..4f45834c7ea 100644
--- a/java/src/IceDiscovery/src/main/java/IceDiscovery/PluginI.java
+++ b/java-compat/src/IceDiscovery/src/main/java/IceDiscovery/PluginI.java
diff --git a/java-compat/src/IceGrid/build.gradle b/java-compat/src/IceGrid/build.gradle
new file mode 100644
index 00000000000..d2bd4fc5f70
--- /dev/null
+++ b/java-compat/src/IceGrid/build.gradle
@@ -0,0 +1,30 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+sourceCompatibility = iceSourceCompatibility
+targetCompatibility = iceTargetCompatibility
+
+project.ext.displayName = "IceGrid Compat"
+project.ext.description = "Locate, deploy, and manage Ice servers"
+
+slice {
+ java {
+ set1 {
+ args = "--ice --tie --checksum IceGrid.SliceChecksums"
+ files = fileTree(dir: "$sliceDir/IceGrid", includes:['*.ice'], excludes:["*F.ice"])
+ }
+ }
+}
+
+dependencies {
+ compile project(':ice-compat')
+ compile project(':glacier2-compat')
+}
+
+apply from: "$rootProject.projectDir/../java/gradle/library.gradle"
diff --git a/java-compat/src/IceLocatorDiscovery/build.gradle b/java-compat/src/IceLocatorDiscovery/build.gradle
new file mode 100644
index 00000000000..be398fe5e31
--- /dev/null
+++ b/java-compat/src/IceLocatorDiscovery/build.gradle
@@ -0,0 +1,27 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+sourceCompatibility = iceSourceCompatibility
+targetCompatibility = iceTargetCompatibility
+
+project.ext.displayName = "IceLocatorDiscovery Compat"
+project.ext.description = "Ice plug-in that enables the discovery of IceGrid and custom locators via UDP multicast"
+
+slice {
+ java {
+ args = "--ice"
+ files = fileTree(dir: "$sliceDir/IceLocatorDiscovery", includes:['*.ice'], excludes:["*F.ice"])
+ }
+}
+
+dependencies {
+ compile project(':ice-compat')
+}
+
+apply from: "$rootProject.projectDir/../java/gradle/library.gradle"
diff --git a/java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginFactory.java b/java-compat/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginFactory.java
index 89b2cbba771..89b2cbba771 100644
--- a/java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginFactory.java
+++ b/java-compat/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginFactory.java
diff --git a/java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java b/java-compat/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java
index b2fb41d7ced..b2fb41d7ced 100644
--- a/java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java
+++ b/java-compat/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java
diff --git a/java-compat/src/IcePatch2/build.gradle b/java-compat/src/IcePatch2/build.gradle
new file mode 100644
index 00000000000..31ede53de5a
--- /dev/null
+++ b/java-compat/src/IcePatch2/build.gradle
@@ -0,0 +1,29 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+sourceCompatibility = iceSourceCompatibility
+targetCompatibility = iceTargetCompatibility
+
+project.ext.displayName = "IcePatch2 Compat"
+project.ext.description = "File distribution and patching for Ice"
+
+slice {
+ java {
+ set1 {
+ args = "--ice --tie --checksum IcePatch2.SliceChecksums"
+ files = fileTree(dir: "$sliceDir/IcePatch2", includes:['*.ice'], excludes:["*F.ice"])
+ }
+ }
+}
+
+dependencies {
+ compile project(':ice-compat')
+}
+
+apply from: "$rootProject.projectDir/../java/gradle/library.gradle"
diff --git a/java-compat/src/IceStorm/build.gradle b/java-compat/src/IceStorm/build.gradle
new file mode 100644
index 00000000000..9ce6d131b0f
--- /dev/null
+++ b/java-compat/src/IceStorm/build.gradle
@@ -0,0 +1,29 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+sourceCompatibility = iceSourceCompatibility
+targetCompatibility = iceTargetCompatibility
+
+project.ext.displayName = "IceStorm Compat"
+project.ext.description = "Publish-subscribe event distribution service"
+
+slice {
+ java {
+ set1 {
+ args = "--ice --tie --checksum IceStorm.SliceChecksums"
+ files = fileTree(dir: "$sliceDir/IceStorm", includes:['*.ice'], excludes:["*F.ice"])
+ }
+ }
+}
+
+dependencies {
+ compile project(':ice-compat')
+}
+
+apply from: "$rootProject.projectDir/../java/gradle/library.gradle"
diff --git a/java-compat/test/Ice/translator/DoubleModuleNoPackage.ice b/java-compat/test/Ice/translator/DoubleModuleNoPackage.ice
new file mode 100644
index 00000000000..6a2276d36ae
--- /dev/null
+++ b/java-compat/test/Ice/translator/DoubleModuleNoPackage.ice
@@ -0,0 +1,66 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// dmnp = double module no package
+
+module M1
+{
+module M2
+{
+
+enum dmnpEnum { dmnpE1, dmnpE2 };
+
+const dmnpEnum dmnpConstant = dmnpE2;
+
+struct dmnpStruct
+{
+ dmnpEnum e;
+};
+
+sequence<dmnpStruct> dmnpStructSeq;
+
+dictionary<string, dmnpStruct> dmnpStringStructDict;
+
+interface dmnpBaseInterface
+{
+ void dmnpBaseInterfaceOp();
+};
+
+interface dmnpInterface extends dmnpBaseInterface
+{
+ void dmnpInterfaceOp();
+};
+
+class dmnpBaseClass
+{
+ dmnpEnum e;
+ dmnpStruct s;
+ dmnpStructSeq seq;
+ dmnpStringStructDict dict;
+};
+
+class dmnpClass extends dmnpBaseClass implements dmnpInterface
+{
+};
+
+exception dmnpBaseException
+{
+ dmnpEnum e;
+ dmnpStruct s;
+ dmnpStructSeq seq;
+ dmnpStringStructDict dict;
+ dmnpClass c;
+};
+
+exception dmnpException extends dmnpBaseException
+{
+};
+
+};
+};
diff --git a/java-compat/test/Ice/translator/DoubleModuleWithPackage.ice b/java-compat/test/Ice/translator/DoubleModuleWithPackage.ice
new file mode 100644
index 00000000000..a7a939265f2
--- /dev/null
+++ b/java-compat/test/Ice/translator/DoubleModuleWithPackage.ice
@@ -0,0 +1,68 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// dmwp = double module with package
+
+[["java:package:dmwp"]]
+
+module M1
+{
+module M2
+{
+
+enum dmwpEnum { dmwpE1, dmwpE2 };
+
+const dmwpEnum dmwpConstant = dmwpE2;
+
+struct dmwpStruct
+{
+ dmwpEnum e;
+};
+
+sequence<dmwpStruct> dmwpStructSeq;
+
+dictionary<string, dmwpStruct> dmwpStringStructDict;
+
+interface dmwpBaseInterface
+{
+ void dmwpBaseInterfaceOp();
+};
+
+interface dmwpInterface extends dmwpBaseInterface
+{
+ void dmwpInterfaceOp();
+};
+
+class dmwpBaseClass
+{
+ dmwpEnum e;
+ dmwpStruct s;
+ dmwpStructSeq seq;
+ dmwpStringStructDict dict;
+};
+
+class dmwpClass extends dmwpBaseClass implements dmwpInterface
+{
+};
+
+exception dmwpBaseException
+{
+ dmwpEnum e;
+ dmwpStruct s;
+ dmwpStructSeq seq;
+ dmwpStringStructDict dict;
+ dmwpClass c;
+};
+
+exception dmwpException extends dmwpBaseException
+{
+};
+
+};
+};
diff --git a/java-compat/test/Ice/translator/Metadata.ice b/java-compat/test/Ice/translator/Metadata.ice
new file mode 100644
index 00000000000..5b87b9eaf39
--- /dev/null
+++ b/java-compat/test/Ice/translator/Metadata.ice
@@ -0,0 +1,124 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+module MetadataTest
+{
+ sequence<int> IntSeq;
+ ["java:type:java.util.LinkedList<Integer>"] sequence<int> IntList;
+ ["java:type:java.util.LinkedList<int[]>"] sequence<IntSeq> IntSeqList;
+
+ sequence<Object> ObjectSeq;
+ ["java:type:java.util.LinkedList<Ice.Object>"] sequence<Object> ObjectList;
+ ["java:type:java.util.LinkedList<Ice.Object[]>"] sequence<ObjectSeq> ObjectSeqList;
+
+ dictionary<string, string> StringDict;
+ ["java:type:java.util.TreeMap<String, String>"] dictionary<string, string> StringMap;
+
+ dictionary<string, Object> ObjectDict;
+ ["java:type:java.util.TreeMap<String, Ice.Object>"] dictionary<string, Object> ObjectMap;
+
+ sequence<StringDict> StringDictSeq;
+ sequence<string> StringSeq;
+ ["java:type:java.util.ArrayList<String>"] sequence<string> StringList;
+ sequence<StringList> StringListSeq;
+ sequence<StringListSeq> StringListSeqSeq;
+
+ dictionary<string, StringSeq> StringSeqDict;
+ dictionary<string, StringList> StringListDict;
+ dictionary<string, StringListSeq> StringListSeqDict;
+
+ ["java:getset"] class C
+ {
+ IntSeq intSeqMember;
+ IntList intListMember;
+ ["java:type:java.util.ArrayList<Integer>"] IntSeq modifiedIntSeqMember;
+ ["java:type:Test.CustomList<Integer>"] IntList modifiedIntListMember;
+
+ ObjectSeq objectSeqMember;
+ ObjectList objectListMember;
+ ["java:type:java.util.ArrayList<Ice.Object>"] ObjectSeq modifiedObjectSeqMember;
+ ["java:type:Test.CustomList<Ice.Object>"] ObjectList modifiedObjectListMember;
+
+ StringDict stringDictMember;
+ StringMap stringMapMember;
+ ["java:type:java.util.TreeMap<String, String>"] StringDict modifiedStringDictMember;
+ ["java:type:java.util.IdentityHashMap<String, String>"] StringMap modifiedStringMapMember;
+
+ ObjectDict objectDictMember;
+ ObjectMap objectMapMember;
+ ["java:type:java.util.TreeMap<String, Ice.Object>"] ObjectDict modifiedObjectDictMember;
+ ["java:type:java.util.IdentityHashMap<String, Ice.Object>"] ObjectMap modifiedObjectMapMember;
+
+ IntSeq opIntSeq(IntSeq inArg, out IntSeq outArg);
+ IntList opIntList(IntList inArg, out IntList outArg);
+
+ ObjectSeq opObjectSeq(ObjectSeq inArg, out ObjectSeq outArg);
+ ObjectList opObjectList(ObjectList inArg, out ObjectList outArg);
+
+ StringDict opStringDict(StringDict inArg, out StringDict outArg);
+ StringMap opStringMap(StringMap inArg, out StringMap outArg);
+
+ ["amd"] IntSeq opIntSeqAMD(IntSeq inArg, out IntSeq outArg);
+ ["amd"] IntList opIntListAMD(IntList inArg, out IntList outArg);
+
+ ["amd"] ObjectSeq opObjectSeqAMD(ObjectSeq inArg, out ObjectSeq outArg);
+ ["amd"] ObjectList opObjectListAMD(ObjectList inArg, out ObjectList outArg);
+
+ ["amd"] StringDict opStringDictAMD(StringDict inArg, out StringDict outArg);
+ ["amd"] StringMap opStringMapAMD(StringMap inArg, out StringMap outArg);
+
+ ["java:type:java.util.LinkedList<Integer>"] IntSeq
+ opIntSeq2(["java:type:java.util.ArrayList<Integer>"] IntSeq inArg,
+ out ["java:type:Test.CustomList<Integer>"] IntSeq outArg);
+
+ ["java:type:java.util.ArrayList<Integer>"] IntList
+ opIntList2(["java:type:java.util.ArrayList<Integer>"] IntList inArg,
+ out ["java:type:Test.CustomList<Integer>"] IntList outArg);
+
+ ["java:type:java.util.LinkedList<Ice.Object>"] ObjectSeq
+ opObjectSeq2(["java:type:java.util.ArrayList<Ice.Object>"] ObjectSeq inArg,
+ out ["java:type:Test.CustomList<Ice.Object>"] ObjectSeq outArg);
+
+ ["java:type:java.util.ArrayList<Ice.Object>"] ObjectList
+ opObjectList2(["java:type:java.util.ArrayList<Ice.Object>"] ObjectList inArg,
+ out ["java:type:Test.CustomList<Ice.Object>"] ObjectList outArg);
+
+ ["java:type:java.util.IdentityHashMap<String, String>"] StringMap
+ opStringMap2(["java:type:java.util.IdentityHashMap<String, String>"] StringMap inArg,
+ out ["java:type:java.util.IdentityHashMap<String, String>"] StringMap outArg);
+
+ ["amd", "java:type:java.util.LinkedList<Integer>"] IntSeq
+ opIntSeq2AMD(["java:type:java.util.ArrayList<Integer>"] IntSeq inArg,
+ out ["java:type:Test.CustomList<Integer>"] IntSeq outArg);
+
+ ["amd", "java:type:java.util.ArrayList<Integer>"] IntList
+ opIntList2AMD(["java:type:java.util.ArrayList<Integer>"] IntList inArg,
+ out ["java:type:Test.CustomList<Integer>"] IntList outArg);
+
+ ["amd", "java:type:java.util.LinkedList<Ice.Object>"] ObjectSeq
+ opObjectSeq2AMD(["java:type:java.util.ArrayList<Ice.Object>"] ObjectSeq inArg,
+ out ["java:type:Test.CustomList<Ice.Object>"] ObjectSeq outArg);
+
+ ["amd", "java:type:java.util.ArrayList<Ice.Object>"] ObjectList
+ opObjectList2AMD(["java:type:java.util.ArrayList<Ice.Object>"] ObjectList inArg,
+ out ["java:type:Test.CustomList<Ice.Object>"] ObjectList outArg);
+ };
+
+ ["protected", "java:getset"] class C2
+ {
+ IntSeq intSeqMember;
+ ["java:type:java.util.ArrayList<Integer>"] IntSeq modifiedIntSeqMember;
+ };
+
+ class C3
+ {
+ ["protected"] IntSeq intSeqMember;
+ ["protected", "java:type:java.util.ArrayList<Integer>"] IntSeq modifiedIntSeqMember;
+ };
+};
diff --git a/java-compat/test/Ice/translator/SingleModuleNoPackage.ice b/java-compat/test/Ice/translator/SingleModuleNoPackage.ice
new file mode 100644
index 00000000000..177cec76b25
--- /dev/null
+++ b/java-compat/test/Ice/translator/SingleModuleNoPackage.ice
@@ -0,0 +1,63 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// smnp = single module no package
+
+module M
+{
+
+enum smnpEnum { smnpE1, smnpE2 };
+
+const smnpEnum smnpConstant = smnpE2;
+
+struct smnpStruct
+{
+ smnpEnum e;
+};
+
+sequence<smnpStruct> smnpStructSeq;
+
+dictionary<string, smnpStruct> smnpStringStructDict;
+
+interface smnpBaseInterface
+{
+ void smnpBaseInterfaceOp();
+};
+
+interface smnpInterface extends smnpBaseInterface
+{
+ void smnpInterfaceOp();
+};
+
+class smnpBaseClass
+{
+ smnpEnum e;
+ smnpStruct s;
+ smnpStructSeq seq;
+ smnpStringStructDict dict;
+};
+
+class smnpClass extends smnpBaseClass implements smnpInterface
+{
+};
+
+exception smnpBaseException
+{
+ smnpEnum e;
+ smnpStruct s;
+ smnpStructSeq seq;
+ smnpStringStructDict dict;
+ smnpClass c;
+};
+
+exception smnpException extends smnpBaseException
+{
+};
+
+};
diff --git a/java-compat/test/Ice/translator/SingleModuleWithPackage.ice b/java-compat/test/Ice/translator/SingleModuleWithPackage.ice
new file mode 100644
index 00000000000..430d1691f54
--- /dev/null
+++ b/java-compat/test/Ice/translator/SingleModuleWithPackage.ice
@@ -0,0 +1,65 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// smwp = single module with package
+
+[["java:package:smwp"]]
+
+module M
+{
+
+enum smwpEnum { smwpE1, smwpE2 };
+
+const smwpEnum smwpConstant = smwpE2;
+
+struct smwpStruct
+{
+ smwpEnum e;
+};
+
+sequence<smwpStruct> smwpStructSeq;
+
+dictionary<string, smwpStruct> smwpStringStructDict;
+
+interface smwpBaseInterface
+{
+ void smwpBaseInterfaceOp();
+};
+
+interface smwpInterface extends smwpBaseInterface
+{
+ void smwpInterfaceOp();
+};
+
+class smwpBaseClass
+{
+ smwpEnum e;
+ smwpStruct s;
+ smwpStructSeq seq;
+ smwpStringStructDict dict;
+};
+
+class smwpClass extends smwpBaseClass implements smwpInterface
+{
+};
+
+exception smwpBaseException
+{
+ smwpEnum e;
+ smwpStruct s;
+ smwpStructSeq seq;
+ smwpStringStructDict dict;
+ smwpClass c;
+};
+
+exception smwpException extends smwpBaseException
+{
+};
+
+};
diff --git a/java-compat/test/Ice/translator/Test/CustomList.java b/java-compat/test/Ice/translator/Test/CustomList.java
new file mode 100644
index 00000000000..462b1728718
--- /dev/null
+++ b/java-compat/test/Ice/translator/Test/CustomList.java
@@ -0,0 +1,5 @@
+package Test;
+
+public class CustomList<E> extends java.util.ArrayList<E>
+{
+}
diff --git a/java-compat/test/Ice/translator/TestDoubleModuleNoPackage4.ice b/java-compat/test/Ice/translator/TestDoubleModuleNoPackage4.ice
new file mode 100644
index 00000000000..a2c3b05978c
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestDoubleModuleNoPackage4.ice
@@ -0,0 +1,79 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use DoubleModuleNoPackage types from (same) single module definitions
+
+#include <DoubleModuleNoPackage.ice>
+
+module M1
+{
+
+const M1::M2::dmnpEnum dmnpTest4Constant = M1::M2::dmnpE1;
+
+struct dmnpTest4Struct
+{
+ M1::M2::dmnpEnum e;
+ M1::M2::dmnpStruct s;
+ M1::M2::dmnpStructSeq seq;
+ M1::M2::dmnpStringStructDict dict;
+ M1::M2::dmnpClass c;
+ M1::M2::dmnpInterface i;
+};
+
+sequence<M1::M2::dmnpStruct> dmnpTest4StructSeq;
+
+dictionary<M1::M2::dmnpStruct, M1::M2::dmnpBaseClass> dmnpTest4StructClassSeq;
+
+interface dmnpTest4Interface extends M1::M2::dmnpInterface {};
+
+exception dmnpTest4Exception extends M1::M2::dmnpException
+{
+ M1::M2::dmnpEnum e1;
+ M1::M2::dmnpStruct s1;
+ M1::M2::dmnpStructSeq seq1;
+ M1::M2::dmnpStringStructDict dict1;
+ M1::M2::dmnpClass c1;
+ M1::M2::dmnpInterface i1;
+};
+
+class dmnpTest4Class extends M1::M2::dmnpBaseClass implements M1::M2::dmnpBaseInterface
+{
+ M1::M2::dmnpStruct
+ dmnpTest4Op1(M1::M2::dmnpEnum i1,
+ M1::M2::dmnpStruct i2,
+ M1::M2::dmnpStructSeq i3,
+ M1::M2::dmnpStringStructDict i4,
+ M1::M2::dmnpInterface i5,
+ M1::M2::dmnpClass i6,
+ out M1::M2::dmnpEnum o1,
+ out M1::M2::dmnpStruct o2,
+ out M1::M2::dmnpStructSeq o3,
+ out M1::M2::dmnpStringStructDict o4,
+ out M1::M2::dmnpInterface o5,
+ out M1::M2::dmnpClass o6)
+ throws M1::M2::dmnpException;
+
+ ["amd"]
+ M1::M2::dmnpStruct
+ dmnpTest4Op3(M1::M2::dmnpEnum i1,
+ M1::M2::dmnpStruct i2,
+ M1::M2::dmnpStructSeq i3,
+ M1::M2::dmnpStringStructDict i4,
+ M1::M2::dmnpInterface i5,
+ M1::M2::dmnpClass i6,
+ out M1::M2::dmnpEnum o1,
+ out M1::M2::dmnpStruct o2,
+ out M1::M2::dmnpStructSeq o3,
+ out M1::M2::dmnpStringStructDict o4,
+ out M1::M2::dmnpInterface o5,
+ out M1::M2::dmnpClass o6)
+ throws M1::M2::dmnpException;
+};
+
+};
diff --git a/java-compat/test/Ice/translator/TestDoubleModuleNoPackage5.ice b/java-compat/test/Ice/translator/TestDoubleModuleNoPackage5.ice
new file mode 100644
index 00000000000..ad8792c25b9
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestDoubleModuleNoPackage5.ice
@@ -0,0 +1,82 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use DoubleModuleNoPackage types from (different) double module definitions
+
+#include <DoubleModuleNoPackage.ice>
+
+module T1
+{
+module T2
+{
+
+const ::M1::M2::dmnpEnum dmnpTest5Constant = ::M1::M2::dmnpE1;
+
+struct dmnpTest5Struct
+{
+ ::M1::M2::dmnpEnum e;
+ ::M1::M2::dmnpStruct s;
+ ::M1::M2::dmnpStructSeq seq;
+ ::M1::M2::dmnpStringStructDict dict;
+ ::M1::M2::dmnpClass c;
+ ::M1::M2::dmnpInterface i;
+};
+
+sequence<::M1::M2::dmnpStruct> dmnpTest5StructSeq;
+
+dictionary<::M1::M2::dmnpStruct, ::M1::M2::dmnpBaseClass> dmnpTest5StructClassSeq;
+
+interface dmnpTest5Interface extends ::M1::M2::dmnpInterface {};
+
+exception dmnpTest5Exception extends ::M1::M2::dmnpException
+{
+ ::M1::M2::dmnpEnum e1;
+ ::M1::M2::dmnpStruct s1;
+ ::M1::M2::dmnpStructSeq seq1;
+ ::M1::M2::dmnpStringStructDict dict1;
+ ::M1::M2::dmnpClass c1;
+ ::M1::M2::dmnpInterface i1;
+};
+
+class dmnpTest5Class extends ::M1::M2::dmnpBaseClass implements ::M1::M2::dmnpBaseInterface
+{
+ ::M1::M2::dmnpStruct
+ dmnpTest5Op1(::M1::M2::dmnpEnum i1,
+ ::M1::M2::dmnpStruct i2,
+ ::M1::M2::dmnpStructSeq i3,
+ ::M1::M2::dmnpStringStructDict i4,
+ ::M1::M2::dmnpInterface i5,
+ ::M1::M2::dmnpClass i6,
+ out ::M1::M2::dmnpEnum o1,
+ out ::M1::M2::dmnpStruct o2,
+ out ::M1::M2::dmnpStructSeq o3,
+ out ::M1::M2::dmnpStringStructDict o4,
+ out ::M1::M2::dmnpInterface o5,
+ out ::M1::M2::dmnpClass o6)
+ throws ::M1::M2::dmnpException;
+
+ ["amd"]
+ ::M1::M2::dmnpStruct
+ dmnpTest5Op3(::M1::M2::dmnpEnum i1,
+ ::M1::M2::dmnpStruct i2,
+ ::M1::M2::dmnpStructSeq i3,
+ ::M1::M2::dmnpStringStructDict i4,
+ ::M1::M2::dmnpInterface i5,
+ ::M1::M2::dmnpClass i6,
+ out ::M1::M2::dmnpEnum o1,
+ out ::M1::M2::dmnpStruct o2,
+ out ::M1::M2::dmnpStructSeq o3,
+ out ::M1::M2::dmnpStringStructDict o4,
+ out ::M1::M2::dmnpInterface o5,
+ out ::M1::M2::dmnpClass o6)
+ throws ::M1::M2::dmnpException;
+};
+
+};
+};
diff --git a/java-compat/test/Ice/translator/TestDoubleModuleNoPackage6.ice b/java-compat/test/Ice/translator/TestDoubleModuleNoPackage6.ice
new file mode 100644
index 00000000000..9e6c1364c85
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestDoubleModuleNoPackage6.ice
@@ -0,0 +1,82 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use DoubleModuleNoPackage types from (same) double module definitions
+
+#include <DoubleModuleNoPackage.ice>
+
+module M1
+{
+module M2
+{
+
+const dmnpEnum dmnpTest6Constant = dmnpE1;
+
+struct dmnpTest6Struct
+{
+ dmnpEnum e;
+ dmnpStruct s;
+ dmnpStructSeq seq;
+ dmnpStringStructDict dict;
+ dmnpClass c;
+ dmnpInterface i;
+};
+
+sequence<dmnpStruct> dmnpTest6StructSeq;
+
+dictionary<dmnpStruct, dmnpBaseClass> dmnpTest6StructClassSeq;
+
+interface dmnpTest6Interface extends dmnpInterface {};
+
+exception dmnpTest6Exception extends dmnpException
+{
+ dmnpEnum e1;
+ dmnpStruct s1;
+ dmnpStructSeq seq1;
+ dmnpStringStructDict dict1;
+ dmnpClass c1;
+ dmnpInterface i1;
+};
+
+class dmnpTest6Class extends dmnpBaseClass implements dmnpBaseInterface
+{
+ dmnpStruct
+ dmnpTest6Op1(dmnpEnum i1,
+ dmnpStruct i2,
+ dmnpStructSeq i3,
+ dmnpStringStructDict i4,
+ dmnpInterface i5,
+ dmnpClass i6,
+ out dmnpEnum o1,
+ out dmnpStruct o2,
+ out dmnpStructSeq o3,
+ out dmnpStringStructDict o4,
+ out dmnpInterface o5,
+ out dmnpClass o6)
+ throws dmnpException;
+
+ ["amd"]
+ dmnpStruct
+ dmnpTest6Op3(dmnpEnum i1,
+ dmnpStruct i2,
+ dmnpStructSeq i3,
+ dmnpStringStructDict i4,
+ dmnpInterface i5,
+ dmnpClass i6,
+ out dmnpEnum o1,
+ out dmnpStruct o2,
+ out dmnpStructSeq o3,
+ out dmnpStringStructDict o4,
+ out dmnpInterface o5,
+ out dmnpClass o6)
+ throws dmnpException;
+};
+
+};
+};
diff --git a/java-compat/test/Ice/translator/TestDoubleModuleNoPackage7.ice b/java-compat/test/Ice/translator/TestDoubleModuleNoPackage7.ice
new file mode 100644
index 00000000000..e4e27642ddd
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestDoubleModuleNoPackage7.ice
@@ -0,0 +1,84 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use DoubleModuleNoPackage types from (same) double module with package definitions
+
+#include <DoubleModuleNoPackage.ice>
+
+[["java:package:dmnpTest7"]]
+
+module M1
+{
+module M2
+{
+
+const dmnpEnum dmnpTest7Constant = dmnpE1;
+
+struct dmnpTest7Struct
+{
+ dmnpEnum e;
+ dmnpStruct s;
+ dmnpStructSeq seq;
+ dmnpStringStructDict dict;
+ dmnpClass c;
+ dmnpInterface i;
+};
+
+sequence<dmnpStruct> dmnpTest7StructSeq;
+
+dictionary<dmnpStruct, dmnpBaseClass> dmnpTest7StructClassSeq;
+
+interface dmnpTest7Interface extends dmnpInterface {};
+
+exception dmnpTest7Exception extends dmnpException
+{
+ dmnpEnum e1;
+ dmnpStruct s1;
+ dmnpStructSeq seq1;
+ dmnpStringStructDict dict1;
+ dmnpClass c1;
+ dmnpInterface i1;
+};
+
+class dmnpTest7Class extends dmnpBaseClass implements dmnpBaseInterface
+{
+ dmnpStruct
+ dmnpTest7Op1(dmnpEnum i1,
+ dmnpStruct i2,
+ dmnpStructSeq i3,
+ dmnpStringStructDict i4,
+ dmnpInterface i5,
+ dmnpClass i6,
+ out dmnpEnum o1,
+ out dmnpStruct o2,
+ out dmnpStructSeq o3,
+ out dmnpStringStructDict o4,
+ out dmnpInterface o5,
+ out dmnpClass o6)
+ throws dmnpException;
+
+ ["amd"]
+ dmnpStruct
+ dmnpTest7Op3(dmnpEnum i1,
+ dmnpStruct i2,
+ dmnpStructSeq i3,
+ dmnpStringStructDict i4,
+ dmnpInterface i5,
+ dmnpClass i6,
+ out dmnpEnum o1,
+ out dmnpStruct o2,
+ out dmnpStructSeq o3,
+ out dmnpStringStructDict o4,
+ out dmnpInterface o5,
+ out dmnpClass o6)
+ throws dmnpException;
+};
+
+};
+};
diff --git a/java-compat/test/Ice/translator/TestDoubleModuleWithPackage10.ice b/java-compat/test/Ice/translator/TestDoubleModuleWithPackage10.ice
new file mode 100644
index 00000000000..5f8624ce0b3
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestDoubleModuleWithPackage10.ice
@@ -0,0 +1,84 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use DoubleModuleWithPackage types from (same) double module with (different) package definitions
+
+#include <DoubleModuleWithPackage.ice>
+
+[["java:package:dmwpTest10"]]
+
+module M1
+{
+module M2
+{
+
+const dmwpEnum dmwpTest10Constant = dmwpE1;
+
+struct dmwpTest10Struct
+{
+ dmwpEnum e;
+ dmwpStruct s;
+ dmwpStructSeq seq;
+ dmwpStringStructDict dict;
+ dmwpClass c;
+ dmwpInterface i;
+};
+
+sequence<dmwpStruct> dmwpTest10StructSeq;
+
+dictionary<dmwpStruct, dmwpBaseClass> dmwpTest10StructClassSeq;
+
+interface dmwpTest10Interface extends dmwpInterface {};
+
+exception dmwpTest10Exception extends dmwpException
+{
+ dmwpEnum e1;
+ dmwpStruct s1;
+ dmwpStructSeq seq1;
+ dmwpStringStructDict dict1;
+ dmwpClass c1;
+ dmwpInterface i1;
+};
+
+class dmwpTest10Class extends dmwpBaseClass implements dmwpBaseInterface
+{
+ dmwpStruct
+ dmwpTest10Op1(dmwpEnum i1,
+ dmwpStruct i2,
+ dmwpStructSeq i3,
+ dmwpStringStructDict i4,
+ dmwpInterface i5,
+ dmwpClass i6,
+ out dmwpEnum o1,
+ out dmwpStruct o2,
+ out dmwpStructSeq o3,
+ out dmwpStringStructDict o4,
+ out dmwpInterface o5,
+ out dmwpClass o6)
+ throws dmwpException;
+
+ ["amd"]
+ dmwpStruct
+ dmwpTest10Op3(dmwpEnum i1,
+ dmwpStruct i2,
+ dmwpStructSeq i3,
+ dmwpStringStructDict i4,
+ dmwpInterface i5,
+ dmwpClass i6,
+ out dmwpEnum o1,
+ out dmwpStruct o2,
+ out dmwpStructSeq o3,
+ out dmwpStringStructDict o4,
+ out dmwpInterface o5,
+ out dmwpClass o6)
+ throws dmwpException;
+};
+
+};
+};
diff --git a/java-compat/test/Ice/translator/TestDoubleModuleWithPackage11.ice b/java-compat/test/Ice/translator/TestDoubleModuleWithPackage11.ice
new file mode 100644
index 00000000000..13b373de086
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestDoubleModuleWithPackage11.ice
@@ -0,0 +1,84 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use DoubleModuleWithPackage types from (same) double module with (same) package definitions
+
+#include <DoubleModuleWithPackage.ice>
+
+[["java:package:dmwp"]]
+
+module M1
+{
+module M2
+{
+
+const dmwpEnum dmwpTest10Constant = dmwpE1;
+
+struct dmwpTest10Struct
+{
+ dmwpEnum e;
+ dmwpStruct s;
+ dmwpStructSeq seq;
+ dmwpStringStructDict dict;
+ dmwpClass c;
+ dmwpInterface i;
+};
+
+sequence<dmwpStruct> dmwpTest10StructSeq;
+
+dictionary<dmwpStruct, dmwpBaseClass> dmwpTest10StructClassSeq;
+
+interface dmwpTest10Interface extends dmwpInterface {};
+
+exception dmwpTest10Exception extends dmwpException
+{
+ dmwpEnum e1;
+ dmwpStruct s1;
+ dmwpStructSeq seq1;
+ dmwpStringStructDict dict1;
+ dmwpClass c1;
+ dmwpInterface i1;
+};
+
+class dmwpTest10Class extends dmwpBaseClass implements dmwpBaseInterface
+{
+ dmwpStruct
+ dmwpTest10Op1(dmwpEnum i1,
+ dmwpStruct i2,
+ dmwpStructSeq i3,
+ dmwpStringStructDict i4,
+ dmwpInterface i5,
+ dmwpClass i6,
+ out dmwpEnum o1,
+ out dmwpStruct o2,
+ out dmwpStructSeq o3,
+ out dmwpStringStructDict o4,
+ out dmwpInterface o5,
+ out dmwpClass o6)
+ throws dmwpException;
+
+ ["amd"]
+ dmwpStruct
+ dmwpTest10Op3(dmwpEnum i1,
+ dmwpStruct i2,
+ dmwpStructSeq i3,
+ dmwpStringStructDict i4,
+ dmwpInterface i5,
+ dmwpClass i6,
+ out dmwpEnum o1,
+ out dmwpStruct o2,
+ out dmwpStructSeq o3,
+ out dmwpStringStructDict o4,
+ out dmwpInterface o5,
+ out dmwpClass o6)
+ throws dmwpException;
+};
+
+};
+};
diff --git a/java-compat/test/Ice/translator/TestDoubleModuleWithPackage4.ice b/java-compat/test/Ice/translator/TestDoubleModuleWithPackage4.ice
new file mode 100644
index 00000000000..3f963d64bb1
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestDoubleModuleWithPackage4.ice
@@ -0,0 +1,79 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use DoubleModuleWithPackage types from (different) single module definitions
+
+#include <DoubleModuleWithPackage.ice>
+
+module T1
+{
+
+const ::M1::M2::dmwpEnum dmwpTest4Constant = ::M1::M2::dmwpE1;
+
+struct dmwpTest4Struct
+{
+ ::M1::M2::dmwpEnum e;
+ ::M1::M2::dmwpStruct s;
+ ::M1::M2::dmwpStructSeq seq;
+ ::M1::M2::dmwpStringStructDict dict;
+ ::M1::M2::dmwpClass c;
+ ::M1::M2::dmwpInterface i;
+};
+
+sequence<::M1::M2::dmwpStruct> dmwpTest4StructSeq;
+
+dictionary<::M1::M2::dmwpStruct, ::M1::M2::dmwpBaseClass> dmwpTest4StructClassSeq;
+
+interface dmwpTest4Interface extends ::M1::M2::dmwpInterface {};
+
+exception dmwpTest4Exception extends ::M1::M2::dmwpException
+{
+ ::M1::M2::dmwpEnum e1;
+ ::M1::M2::dmwpStruct s1;
+ ::M1::M2::dmwpStructSeq seq1;
+ ::M1::M2::dmwpStringStructDict dict1;
+ ::M1::M2::dmwpClass c1;
+ ::M1::M2::dmwpInterface i1;
+};
+
+class dmwpTest4Class extends ::M1::M2::dmwpBaseClass implements ::M1::M2::dmwpBaseInterface
+{
+ ::M1::M2::dmwpStruct
+ dmwpTest4Op1(::M1::M2::dmwpEnum i1,
+ ::M1::M2::dmwpStruct i2,
+ ::M1::M2::dmwpStructSeq i3,
+ ::M1::M2::dmwpStringStructDict i4,
+ ::M1::M2::dmwpInterface i5,
+ ::M1::M2::dmwpClass i6,
+ out ::M1::M2::dmwpEnum o1,
+ out ::M1::M2::dmwpStruct o2,
+ out ::M1::M2::dmwpStructSeq o3,
+ out ::M1::M2::dmwpStringStructDict o4,
+ out ::M1::M2::dmwpInterface o5,
+ out ::M1::M2::dmwpClass o6)
+ throws ::M1::M2::dmwpException;
+
+ ["amd"]
+ ::M1::M2::dmwpStruct
+ dmwpTest4Op3(::M1::M2::dmwpEnum i1,
+ ::M1::M2::dmwpStruct i2,
+ ::M1::M2::dmwpStructSeq i3,
+ ::M1::M2::dmwpStringStructDict i4,
+ ::M1::M2::dmwpInterface i5,
+ ::M1::M2::dmwpClass i6,
+ out ::M1::M2::dmwpEnum o1,
+ out ::M1::M2::dmwpStruct o2,
+ out ::M1::M2::dmwpStructSeq o3,
+ out ::M1::M2::dmwpStringStructDict o4,
+ out ::M1::M2::dmwpInterface o5,
+ out ::M1::M2::dmwpClass o6)
+ throws ::M1::M2::dmwpException;
+};
+
+};
diff --git a/java-compat/test/Ice/translator/TestDoubleModuleWithPackage5.ice b/java-compat/test/Ice/translator/TestDoubleModuleWithPackage5.ice
new file mode 100644
index 00000000000..a8e0ddf424f
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestDoubleModuleWithPackage5.ice
@@ -0,0 +1,79 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use DoubleModuleWithPackage types from (same) single module definitions
+
+#include <DoubleModuleWithPackage.ice>
+
+module M1
+{
+
+const ::M1::M2::dmwpEnum dmwpTest5Constant = ::M1::M2::dmwpE1;
+
+struct dmwpTest5Struct
+{
+ ::M1::M2::dmwpEnum e;
+ ::M1::M2::dmwpStruct s;
+ ::M1::M2::dmwpStructSeq seq;
+ ::M1::M2::dmwpStringStructDict dict;
+ ::M1::M2::dmwpClass c;
+ ::M1::M2::dmwpInterface i;
+};
+
+sequence<::M1::M2::dmwpStruct> dmwpTest5StructSeq;
+
+dictionary<::M1::M2::dmwpStruct, ::M1::M2::dmwpBaseClass> dmwpTest5StructClassSeq;
+
+interface dmwpTest5Interface extends ::M1::M2::dmwpInterface {};
+
+exception dmwpTest5Exception extends ::M1::M2::dmwpException
+{
+ ::M1::M2::dmwpEnum e1;
+ ::M1::M2::dmwpStruct s1;
+ ::M1::M2::dmwpStructSeq seq1;
+ ::M1::M2::dmwpStringStructDict dict1;
+ ::M1::M2::dmwpClass c1;
+ ::M1::M2::dmwpInterface i1;
+};
+
+class dmwpTest5Class extends ::M1::M2::dmwpBaseClass implements ::M1::M2::dmwpBaseInterface
+{
+ ::M1::M2::dmwpStruct
+ dmwpTest5Op1(::M1::M2::dmwpEnum i1,
+ ::M1::M2::dmwpStruct i2,
+ ::M1::M2::dmwpStructSeq i3,
+ ::M1::M2::dmwpStringStructDict i4,
+ ::M1::M2::dmwpInterface i5,
+ ::M1::M2::dmwpClass i6,
+ out ::M1::M2::dmwpEnum o1,
+ out ::M1::M2::dmwpStruct o2,
+ out ::M1::M2::dmwpStructSeq o3,
+ out ::M1::M2::dmwpStringStructDict o4,
+ out ::M1::M2::dmwpInterface o5,
+ out ::M1::M2::dmwpClass o6)
+ throws ::M1::M2::dmwpException;
+
+ ["amd"]
+ ::M1::M2::dmwpStruct
+ dmwpTest5Op3(::M1::M2::dmwpEnum i1,
+ ::M1::M2::dmwpStruct i2,
+ ::M1::M2::dmwpStructSeq i3,
+ ::M1::M2::dmwpStringStructDict i4,
+ ::M1::M2::dmwpInterface i5,
+ ::M1::M2::dmwpClass i6,
+ out ::M1::M2::dmwpEnum o1,
+ out ::M1::M2::dmwpStruct o2,
+ out ::M1::M2::dmwpStructSeq o3,
+ out ::M1::M2::dmwpStringStructDict o4,
+ out ::M1::M2::dmwpInterface o5,
+ out ::M1::M2::dmwpClass o6)
+ throws ::M1::M2::dmwpException;
+};
+
+};
diff --git a/java-compat/test/Ice/translator/TestDoubleModuleWithPackage6.ice b/java-compat/test/Ice/translator/TestDoubleModuleWithPackage6.ice
new file mode 100644
index 00000000000..c67b05db394
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestDoubleModuleWithPackage6.ice
@@ -0,0 +1,81 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use DoubleModuleWithPackage types from (same) single module with (different) package definitions
+
+#include <DoubleModuleWithPackage.ice>
+
+[["java:package:dmwpTest6"]]
+
+module M1
+{
+
+const ::M1::M2::dmwpEnum dmwpTest6Constant = ::M1::M2::dmwpE1;
+
+struct dmwpTest6Struct
+{
+ ::M1::M2::dmwpEnum e;
+ ::M1::M2::dmwpStruct s;
+ ::M1::M2::dmwpStructSeq seq;
+ ::M1::M2::dmwpStringStructDict dict;
+ ::M1::M2::dmwpClass c;
+ ::M1::M2::dmwpInterface i;
+};
+
+sequence<::M1::M2::dmwpStruct> dmwpTest6StructSeq;
+
+dictionary<::M1::M2::dmwpStruct, ::M1::M2::dmwpBaseClass> dmwpTest6StructClassSeq;
+
+interface dmwpTest6Interface extends ::M1::M2::dmwpInterface {};
+
+exception dmwpTest6Exception extends ::M1::M2::dmwpException
+{
+ ::M1::M2::dmwpEnum e1;
+ ::M1::M2::dmwpStruct s1;
+ ::M1::M2::dmwpStructSeq seq1;
+ ::M1::M2::dmwpStringStructDict dict1;
+ ::M1::M2::dmwpClass c1;
+ ::M1::M2::dmwpInterface i1;
+};
+
+class dmwpTest6Class extends ::M1::M2::dmwpBaseClass implements ::M1::M2::dmwpBaseInterface
+{
+ ::M1::M2::dmwpStruct
+ dmwpTest6Op1(::M1::M2::dmwpEnum i1,
+ ::M1::M2::dmwpStruct i2,
+ ::M1::M2::dmwpStructSeq i3,
+ ::M1::M2::dmwpStringStructDict i4,
+ ::M1::M2::dmwpInterface i5,
+ ::M1::M2::dmwpClass i6,
+ out ::M1::M2::dmwpEnum o1,
+ out ::M1::M2::dmwpStruct o2,
+ out ::M1::M2::dmwpStructSeq o3,
+ out ::M1::M2::dmwpStringStructDict o4,
+ out ::M1::M2::dmwpInterface o5,
+ out ::M1::M2::dmwpClass o6)
+ throws ::M1::M2::dmwpException;
+
+ ["amd"]
+ ::M1::M2::dmwpStruct
+ dmwpTest6Op3(::M1::M2::dmwpEnum i1,
+ ::M1::M2::dmwpStruct i2,
+ ::M1::M2::dmwpStructSeq i3,
+ ::M1::M2::dmwpStringStructDict i4,
+ ::M1::M2::dmwpInterface i5,
+ ::M1::M2::dmwpClass i6,
+ out ::M1::M2::dmwpEnum o1,
+ out ::M1::M2::dmwpStruct o2,
+ out ::M1::M2::dmwpStructSeq o3,
+ out ::M1::M2::dmwpStringStructDict o4,
+ out ::M1::M2::dmwpInterface o5,
+ out ::M1::M2::dmwpClass o6)
+ throws ::M1::M2::dmwpException;
+};
+
+};
diff --git a/java-compat/test/Ice/translator/TestDoubleModuleWithPackage7.ice b/java-compat/test/Ice/translator/TestDoubleModuleWithPackage7.ice
new file mode 100644
index 00000000000..3fad9d9541b
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestDoubleModuleWithPackage7.ice
@@ -0,0 +1,81 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use DoubleModuleWithPackage types from (same) single module with (same) package definitions
+
+#include <DoubleModuleWithPackage.ice>
+
+[["java:package:dmwp"]]
+
+module M1
+{
+
+const ::M1::M2::dmwpEnum dmwpTest7Constant = ::M1::M2::dmwpE1;
+
+struct dmwpTest7Struct
+{
+ ::M1::M2::dmwpEnum e;
+ ::M1::M2::dmwpStruct s;
+ ::M1::M2::dmwpStructSeq seq;
+ ::M1::M2::dmwpStringStructDict dict;
+ ::M1::M2::dmwpClass c;
+ ::M1::M2::dmwpInterface i;
+};
+
+sequence<::M1::M2::dmwpStruct> dmwpTest7StructSeq;
+
+dictionary<::M1::M2::dmwpStruct, ::M1::M2::dmwpBaseClass> dmwpTest7StructClassSeq;
+
+interface dmwpTest7Interface extends ::M1::M2::dmwpInterface {};
+
+exception dmwpTest7Exception extends ::M1::M2::dmwpException
+{
+ ::M1::M2::dmwpEnum e1;
+ ::M1::M2::dmwpStruct s1;
+ ::M1::M2::dmwpStructSeq seq1;
+ ::M1::M2::dmwpStringStructDict dict1;
+ ::M1::M2::dmwpClass c1;
+ ::M1::M2::dmwpInterface i1;
+};
+
+class dmwpTest7Class extends ::M1::M2::dmwpBaseClass implements ::M1::M2::dmwpBaseInterface
+{
+ ::M1::M2::dmwpStruct
+ dmwpTest7Op1(::M1::M2::dmwpEnum i1,
+ ::M1::M2::dmwpStruct i2,
+ ::M1::M2::dmwpStructSeq i3,
+ ::M1::M2::dmwpStringStructDict i4,
+ ::M1::M2::dmwpInterface i5,
+ ::M1::M2::dmwpClass i6,
+ out ::M1::M2::dmwpEnum o1,
+ out ::M1::M2::dmwpStruct o2,
+ out ::M1::M2::dmwpStructSeq o3,
+ out ::M1::M2::dmwpStringStructDict o4,
+ out ::M1::M2::dmwpInterface o5,
+ out ::M1::M2::dmwpClass o6)
+ throws ::M1::M2::dmwpException;
+
+ ["amd"]
+ ::M1::M2::dmwpStruct
+ dmwpTest7Op3(::M1::M2::dmwpEnum i1,
+ ::M1::M2::dmwpStruct i2,
+ ::M1::M2::dmwpStructSeq i3,
+ ::M1::M2::dmwpStringStructDict i4,
+ ::M1::M2::dmwpInterface i5,
+ ::M1::M2::dmwpClass i6,
+ out ::M1::M2::dmwpEnum o1,
+ out ::M1::M2::dmwpStruct o2,
+ out ::M1::M2::dmwpStructSeq o3,
+ out ::M1::M2::dmwpStringStructDict o4,
+ out ::M1::M2::dmwpInterface o5,
+ out ::M1::M2::dmwpClass o6)
+ throws ::M1::M2::dmwpException;
+};
+
+};
diff --git a/java-compat/test/Ice/translator/TestDoubleModuleWithPackage8.ice b/java-compat/test/Ice/translator/TestDoubleModuleWithPackage8.ice
new file mode 100644
index 00000000000..89a86ffa874
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestDoubleModuleWithPackage8.ice
@@ -0,0 +1,82 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use DoubleModuleWithPackage types from (different) double module definitions
+
+#include <DoubleModuleWithPackage.ice>
+
+module T1
+{
+module T2
+{
+
+const ::M1::M2::dmwpEnum dmwpTest8Constant = ::M1::M2::dmwpE1;
+
+struct dmwpTest8Struct
+{
+ ::M1::M2::dmwpEnum e;
+ ::M1::M2::dmwpStruct s;
+ ::M1::M2::dmwpStructSeq seq;
+ ::M1::M2::dmwpStringStructDict dict;
+ ::M1::M2::dmwpClass c;
+ ::M1::M2::dmwpInterface i;
+};
+
+sequence<::M1::M2::dmwpStruct> dmwpTest8StructSeq;
+
+dictionary<::M1::M2::dmwpStruct, ::M1::M2::dmwpBaseClass> dmwpTest8StructClassSeq;
+
+interface dmwpTest8Interface extends ::M1::M2::dmwpInterface {};
+
+exception dmwpTest8Exception extends ::M1::M2::dmwpException
+{
+ ::M1::M2::dmwpEnum e1;
+ ::M1::M2::dmwpStruct s1;
+ ::M1::M2::dmwpStructSeq seq1;
+ ::M1::M2::dmwpStringStructDict dict1;
+ ::M1::M2::dmwpClass c1;
+ ::M1::M2::dmwpInterface i1;
+};
+
+class dmwpTest8Class extends ::M1::M2::dmwpBaseClass implements ::M1::M2::dmwpBaseInterface
+{
+ ::M1::M2::dmwpStruct
+ dmwpTest8Op1(::M1::M2::dmwpEnum i1,
+ ::M1::M2::dmwpStruct i2,
+ ::M1::M2::dmwpStructSeq i3,
+ ::M1::M2::dmwpStringStructDict i4,
+ ::M1::M2::dmwpInterface i5,
+ ::M1::M2::dmwpClass i6,
+ out ::M1::M2::dmwpEnum o1,
+ out ::M1::M2::dmwpStruct o2,
+ out ::M1::M2::dmwpStructSeq o3,
+ out ::M1::M2::dmwpStringStructDict o4,
+ out ::M1::M2::dmwpInterface o5,
+ out ::M1::M2::dmwpClass o6)
+ throws ::M1::M2::dmwpException;
+
+ ["amd"]
+ ::M1::M2::dmwpStruct
+ dmwpTest8Op3(::M1::M2::dmwpEnum i1,
+ ::M1::M2::dmwpStruct i2,
+ ::M1::M2::dmwpStructSeq i3,
+ ::M1::M2::dmwpStringStructDict i4,
+ ::M1::M2::dmwpInterface i5,
+ ::M1::M2::dmwpClass i6,
+ out ::M1::M2::dmwpEnum o1,
+ out ::M1::M2::dmwpStruct o2,
+ out ::M1::M2::dmwpStructSeq o3,
+ out ::M1::M2::dmwpStringStructDict o4,
+ out ::M1::M2::dmwpInterface o5,
+ out ::M1::M2::dmwpClass o6)
+ throws ::M1::M2::dmwpException;
+};
+
+};
+};
diff --git a/java-compat/test/Ice/translator/TestDoubleModuleWithPackage9.ice b/java-compat/test/Ice/translator/TestDoubleModuleWithPackage9.ice
new file mode 100644
index 00000000000..289970ace4d
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestDoubleModuleWithPackage9.ice
@@ -0,0 +1,82 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use DoubleModuleWithPackage types from (same) double module definitions
+
+#include <DoubleModuleWithPackage.ice>
+
+module M1
+{
+module M2
+{
+
+const dmwpEnum dmwpTest9Constant = dmwpE1;
+
+struct dmwpTest9Struct
+{
+ dmwpEnum e;
+ dmwpStruct s;
+ dmwpStructSeq seq;
+ dmwpStringStructDict dict;
+ dmwpClass c;
+ dmwpInterface i;
+};
+
+sequence<dmwpStruct> dmwpTest9StructSeq;
+
+dictionary<dmwpStruct, dmwpBaseClass> dmwpTest9StructClassSeq;
+
+interface dmwpTest9Interface extends dmwpInterface {};
+
+exception dmwpTest9Exception extends dmwpException
+{
+ dmwpEnum e1;
+ dmwpStruct s1;
+ dmwpStructSeq seq1;
+ dmwpStringStructDict dict1;
+ dmwpClass c1;
+ dmwpInterface i1;
+};
+
+class dmwpTest9Class extends dmwpBaseClass implements dmwpBaseInterface
+{
+ dmwpStruct
+ dmwpTest9Op1(dmwpEnum i1,
+ dmwpStruct i2,
+ dmwpStructSeq i3,
+ dmwpStringStructDict i4,
+ dmwpInterface i5,
+ dmwpClass i6,
+ out dmwpEnum o1,
+ out dmwpStruct o2,
+ out dmwpStructSeq o3,
+ out dmwpStringStructDict o4,
+ out dmwpInterface o5,
+ out dmwpClass o6)
+ throws dmwpException;
+
+ ["amd"]
+ dmwpStruct
+ dmwpTest9Op3(dmwpEnum i1,
+ dmwpStruct i2,
+ dmwpStructSeq i3,
+ dmwpStringStructDict i4,
+ dmwpInterface i5,
+ dmwpClass i6,
+ out dmwpEnum o1,
+ out dmwpStruct o2,
+ out dmwpStructSeq o3,
+ out dmwpStringStructDict o4,
+ out dmwpInterface o5,
+ out dmwpClass o6)
+ throws dmwpException;
+};
+
+};
+};
diff --git a/java-compat/test/Ice/translator/TestSingleModuleNoPackage4.ice b/java-compat/test/Ice/translator/TestSingleModuleNoPackage4.ice
new file mode 100644
index 00000000000..c21ad38d68b
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestSingleModuleNoPackage4.ice
@@ -0,0 +1,79 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use SingleModuleNoPackage types from (same) single module definitions
+
+#include <SingleModuleNoPackage.ice>
+
+module M
+{
+
+const smnpEnum smnpTest4Constant = smnpE1;
+
+struct smnpTest4Struct
+{
+ smnpEnum e;
+ smnpStruct s;
+ smnpStructSeq seq;
+ smnpStringStructDict dict;
+ smnpClass c;
+ smnpInterface i;
+};
+
+sequence<smnpStruct> smnpTest4StructSeq;
+
+dictionary<smnpStruct, smnpBaseClass> smnpTest4StructClassSeq;
+
+interface smnpTest4Interface extends smnpInterface {};
+
+exception smnpTest4Exception extends smnpException
+{
+ smnpEnum e1;
+ smnpStruct s1;
+ smnpStructSeq seq1;
+ smnpStringStructDict dict1;
+ smnpClass c1;
+ smnpInterface i1;
+};
+
+class smnpTest4Class extends smnpBaseClass implements smnpBaseInterface
+{
+ smnpStruct
+ smnpTest4Op1(smnpEnum i1,
+ smnpStruct i2,
+ smnpStructSeq i3,
+ smnpStringStructDict i4,
+ smnpInterface i5,
+ smnpClass i6,
+ out smnpEnum o1,
+ out smnpStruct o2,
+ out smnpStructSeq o3,
+ out smnpStringStructDict o4,
+ out smnpInterface o5,
+ out smnpClass o6)
+ throws smnpException;
+
+ ["amd"]
+ smnpStruct
+ smnpTest4Op3(smnpEnum i1,
+ smnpStruct i2,
+ smnpStructSeq i3,
+ smnpStringStructDict i4,
+ smnpInterface i5,
+ smnpClass i6,
+ out smnpEnum o1,
+ out smnpStruct o2,
+ out smnpStructSeq o3,
+ out smnpStringStructDict o4,
+ out smnpInterface o5,
+ out smnpClass o6)
+ throws smnpException;
+};
+
+};
diff --git a/java-compat/test/Ice/translator/TestSingleModuleNoPackage6.ice b/java-compat/test/Ice/translator/TestSingleModuleNoPackage6.ice
new file mode 100644
index 00000000000..c41ef3ea512
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestSingleModuleNoPackage6.ice
@@ -0,0 +1,82 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use SingleModuleNoPackage types from (different) double module definitions
+
+#include <SingleModuleNoPackage.ice>
+
+module T1
+{
+module T2
+{
+
+const M::smnpEnum smnpTest6Constant = M::smnpE1;
+
+struct smnpTest6Struct
+{
+ M::smnpEnum e;
+ M::smnpStruct s;
+ M::smnpStructSeq seq;
+ M::smnpStringStructDict dict;
+ M::smnpClass c;
+ M::smnpInterface i;
+};
+
+sequence<M::smnpStruct> smnpTest6StructSeq;
+
+dictionary<M::smnpStruct, M::smnpBaseClass> smnpTest6StructClassSeq;
+
+interface smnpTest6Interface extends M::smnpInterface {};
+
+exception smnpTest6Exception extends M::smnpException
+{
+ M::smnpEnum e1;
+ M::smnpStruct s1;
+ M::smnpStructSeq seq1;
+ M::smnpStringStructDict dict1;
+ M::smnpClass c1;
+ M::smnpInterface i1;
+};
+
+class smnpTest6Class extends M::smnpBaseClass implements M::smnpBaseInterface
+{
+ M::smnpStruct
+ smnpTest6Op1(M::smnpEnum i1,
+ M::smnpStruct i2,
+ M::smnpStructSeq i3,
+ M::smnpStringStructDict i4,
+ M::smnpInterface i5,
+ M::smnpClass i6,
+ out M::smnpEnum o1,
+ out M::smnpStruct o2,
+ out M::smnpStructSeq o3,
+ out M::smnpStringStructDict o4,
+ out M::smnpInterface o5,
+ out M::smnpClass o6)
+ throws M::smnpException;
+
+ ["amd"]
+ M::smnpStruct
+ smnpTest6Op3(M::smnpEnum i1,
+ M::smnpStruct i2,
+ M::smnpStructSeq i3,
+ M::smnpStringStructDict i4,
+ M::smnpInterface i5,
+ M::smnpClass i6,
+ out M::smnpEnum o1,
+ out M::smnpStruct o2,
+ out M::smnpStructSeq o3,
+ out M::smnpStringStructDict o4,
+ out M::smnpInterface o5,
+ out M::smnpClass o6)
+ throws M::smnpException;
+};
+
+};
+};
diff --git a/java-compat/test/Ice/translator/TestSingleModuleNoPackage7.ice b/java-compat/test/Ice/translator/TestSingleModuleNoPackage7.ice
new file mode 100644
index 00000000000..5720f7aadf9
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestSingleModuleNoPackage7.ice
@@ -0,0 +1,82 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use SingleModuleNoPackage types from (same) double module definitions
+
+#include <SingleModuleNoPackage.ice>
+
+module M
+{
+module N
+{
+
+const smnpEnum smnpTest7Constant = smnpE1;
+
+struct smnpTest7Struct
+{
+ smnpEnum e;
+ smnpStruct s;
+ smnpStructSeq seq;
+ smnpStringStructDict dict;
+ smnpClass c;
+ smnpInterface i;
+};
+
+sequence<smnpStruct> smnpTest7StructSeq;
+
+dictionary<smnpStruct, smnpBaseClass> smnpTest7StructClassSeq;
+
+interface smnpTest7Interface extends smnpInterface {};
+
+exception smnpTest7Exception extends smnpException
+{
+ smnpEnum e1;
+ smnpStruct s1;
+ smnpStructSeq seq1;
+ smnpStringStructDict dict1;
+ smnpClass c1;
+ smnpInterface i1;
+};
+
+class smnpTest7Class extends smnpBaseClass implements smnpBaseInterface
+{
+ smnpStruct
+ smnpTest7Op1(smnpEnum i1,
+ smnpStruct i2,
+ smnpStructSeq i3,
+ smnpStringStructDict i4,
+ smnpInterface i5,
+ smnpClass i6,
+ out smnpEnum o1,
+ out smnpStruct o2,
+ out smnpStructSeq o3,
+ out smnpStringStructDict o4,
+ out smnpInterface o5,
+ out smnpClass o6)
+ throws smnpException;
+
+ ["amd"]
+ smnpStruct
+ smnpTest7Op3(smnpEnum i1,
+ smnpStruct i2,
+ smnpStructSeq i3,
+ smnpStringStructDict i4,
+ smnpInterface i5,
+ smnpClass i6,
+ out smnpEnum o1,
+ out smnpStruct o2,
+ out smnpStructSeq o3,
+ out smnpStringStructDict o4,
+ out smnpInterface o5,
+ out smnpClass o6)
+ throws smnpException;
+};
+
+};
+};
diff --git a/java-compat/test/Ice/translator/TestSingleModuleWithPackage10.ice b/java-compat/test/Ice/translator/TestSingleModuleWithPackage10.ice
new file mode 100644
index 00000000000..063bdc8035b
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestSingleModuleWithPackage10.ice
@@ -0,0 +1,82 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use SingleModuleWithPackage types from (same) double module definitions
+
+#include <SingleModuleWithPackage.ice>
+
+module M
+{
+module N
+{
+
+const smwpEnum smwpTest10Constant = smwpE1;
+
+struct smwpTest10Struct
+{
+ smwpEnum e;
+ smwpStruct s;
+ smwpStructSeq seq;
+ smwpStringStructDict dict;
+ smwpClass c;
+ smwpInterface i;
+};
+
+sequence<smwpStruct> smwpTest10StructSeq;
+
+dictionary<smwpStruct, smwpBaseClass> smwpTest10StructClassSeq;
+
+interface smwpTest10Interface extends smwpInterface {};
+
+exception smwpTest10Exception extends smwpException
+{
+ smwpEnum e1;
+ smwpStruct s1;
+ smwpStructSeq seq1;
+ smwpStringStructDict dict1;
+ smwpClass c1;
+ smwpInterface i1;
+};
+
+class smwpTest10Class extends smwpBaseClass implements smwpBaseInterface
+{
+ smwpStruct
+ smwpTest10Op1(smwpEnum i1,
+ smwpStruct i2,
+ smwpStructSeq i3,
+ smwpStringStructDict i4,
+ smwpInterface i5,
+ smwpClass i6,
+ out smwpEnum o1,
+ out smwpStruct o2,
+ out smwpStructSeq o3,
+ out smwpStringStructDict o4,
+ out smwpInterface o5,
+ out smwpClass o6)
+ throws smwpException;
+
+ ["amd"]
+ smwpStruct
+ smwpTest10Op3(smwpEnum i1,
+ smwpStruct i2,
+ smwpStructSeq i3,
+ smwpStringStructDict i4,
+ smwpInterface i5,
+ smwpClass i6,
+ out smwpEnum o1,
+ out smwpStruct o2,
+ out smwpStructSeq o3,
+ out smwpStringStructDict o4,
+ out smwpInterface o5,
+ out smwpClass o6)
+ throws smwpException;
+};
+
+};
+};
diff --git a/java-compat/test/Ice/translator/TestSingleModuleWithPackage11.ice b/java-compat/test/Ice/translator/TestSingleModuleWithPackage11.ice
new file mode 100644
index 00000000000..9dd5bd01cbd
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestSingleModuleWithPackage11.ice
@@ -0,0 +1,84 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use SingleModuleWithPackage types from (different) double module with (different) package definitions
+
+#include <SingleModuleWithPackage.ice>
+
+[["java:package:smwpTest11"]]
+
+module T1
+{
+module T2
+{
+
+const M::smwpEnum smwpTest11Constant = M::smwpE1;
+
+struct smwpTest11Struct
+{
+ M::smwpEnum e;
+ M::smwpStruct s;
+ M::smwpStructSeq seq;
+ M::smwpStringStructDict dict;
+ M::smwpClass c;
+ M::smwpInterface i;
+};
+
+sequence<M::smwpStruct> smwpTest11StructSeq;
+
+dictionary<M::smwpStruct, M::smwpBaseClass> smwpTest11StructClassSeq;
+
+interface smwpTest11Interface extends M::smwpInterface {};
+
+exception smwpTest11Exception extends M::smwpException
+{
+ M::smwpEnum e1;
+ M::smwpStruct s1;
+ M::smwpStructSeq seq1;
+ M::smwpStringStructDict dict1;
+ M::smwpClass c1;
+ M::smwpInterface i1;
+};
+
+class smwpTest11Class extends M::smwpBaseClass implements M::smwpBaseInterface
+{
+ M::smwpStruct
+ smwpTest11Op1(M::smwpEnum i1,
+ M::smwpStruct i2,
+ M::smwpStructSeq i3,
+ M::smwpStringStructDict i4,
+ M::smwpInterface i5,
+ M::smwpClass i6,
+ out M::smwpEnum o1,
+ out M::smwpStruct o2,
+ out M::smwpStructSeq o3,
+ out M::smwpStringStructDict o4,
+ out M::smwpInterface o5,
+ out M::smwpClass o6)
+ throws M::smwpException;
+
+ ["amd"]
+ M::smwpStruct
+ smwpTest11Op3(M::smwpEnum i1,
+ M::smwpStruct i2,
+ M::smwpStructSeq i3,
+ M::smwpStringStructDict i4,
+ M::smwpInterface i5,
+ M::smwpClass i6,
+ out M::smwpEnum o1,
+ out M::smwpStruct o2,
+ out M::smwpStructSeq o3,
+ out M::smwpStringStructDict o4,
+ out M::smwpInterface o5,
+ out M::smwpClass o6)
+ throws M::smwpException;
+};
+
+};
+};
diff --git a/java-compat/test/Ice/translator/TestSingleModuleWithPackage12.ice b/java-compat/test/Ice/translator/TestSingleModuleWithPackage12.ice
new file mode 100644
index 00000000000..2aac64b680b
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestSingleModuleWithPackage12.ice
@@ -0,0 +1,84 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use SingleModuleWithPackage types from (different) double module with (same) package definitions
+
+#include <SingleModuleWithPackage.ice>
+
+[["java:package:smwp"]]
+
+module T1
+{
+module T2
+{
+
+const M::smwpEnum smwpTest12Constant = M::smwpE1;
+
+struct smwpTest12Struct
+{
+ M::smwpEnum e;
+ M::smwpStruct s;
+ M::smwpStructSeq seq;
+ M::smwpStringStructDict dict;
+ M::smwpClass c;
+ M::smwpInterface i;
+};
+
+sequence<M::smwpStruct> smwpTest12StructSeq;
+
+dictionary<M::smwpStruct, M::smwpBaseClass> smwpTest12StructClassSeq;
+
+interface smwpTest12Interface extends M::smwpInterface {};
+
+exception smwpTest12Exception extends M::smwpException
+{
+ M::smwpEnum e1;
+ M::smwpStruct s1;
+ M::smwpStructSeq seq1;
+ M::smwpStringStructDict dict1;
+ M::smwpClass c1;
+ M::smwpInterface i1;
+};
+
+class smwpTest12Class extends M::smwpBaseClass implements M::smwpBaseInterface
+{
+ M::smwpStruct
+ smwpTest12Op1(M::smwpEnum i1,
+ M::smwpStruct i2,
+ M::smwpStructSeq i3,
+ M::smwpStringStructDict i4,
+ M::smwpInterface i5,
+ M::smwpClass i6,
+ out M::smwpEnum o1,
+ out M::smwpStruct o2,
+ out M::smwpStructSeq o3,
+ out M::smwpStringStructDict o4,
+ out M::smwpInterface o5,
+ out M::smwpClass o6)
+ throws M::smwpException;
+
+ ["amd"]
+ M::smwpStruct
+ smwpTest12Op3(M::smwpEnum i1,
+ M::smwpStruct i2,
+ M::smwpStructSeq i3,
+ M::smwpStringStructDict i4,
+ M::smwpInterface i5,
+ M::smwpClass i6,
+ out M::smwpEnum o1,
+ out M::smwpStruct o2,
+ out M::smwpStructSeq o3,
+ out M::smwpStringStructDict o4,
+ out M::smwpInterface o5,
+ out M::smwpClass o6)
+ throws M::smwpException;
+};
+
+};
+};
diff --git a/java-compat/test/Ice/translator/TestSingleModuleWithPackage13.ice b/java-compat/test/Ice/translator/TestSingleModuleWithPackage13.ice
new file mode 100644
index 00000000000..693797cce33
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestSingleModuleWithPackage13.ice
@@ -0,0 +1,84 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use SingleModuleWithPackage types from (same) double module with (same) package definitions
+
+#include <SingleModuleWithPackage.ice>
+
+[["java:package:smwp"]]
+
+module M
+{
+module N
+{
+
+const smwpEnum smwpTest13Constant = smwpE1;
+
+struct smwpTest13Struct
+{
+ smwpEnum e;
+ smwpStruct s;
+ smwpStructSeq seq;
+ smwpStringStructDict dict;
+ smwpClass c;
+ smwpInterface i;
+};
+
+sequence<smwpStruct> smwpTest13StructSeq;
+
+dictionary<smwpStruct, smwpBaseClass> smwpTest13StructClassSeq;
+
+interface smwpTest13Interface extends smwpInterface {};
+
+exception smwpTest13Exception extends smwpException
+{
+ smwpEnum e1;
+ smwpStruct s1;
+ smwpStructSeq seq1;
+ smwpStringStructDict dict1;
+ smwpClass c1;
+ smwpInterface i1;
+};
+
+class smwpTest13Class extends smwpBaseClass implements smwpBaseInterface
+{
+ smwpStruct
+ smwpTest13Op1(smwpEnum i1,
+ smwpStruct i2,
+ smwpStructSeq i3,
+ smwpStringStructDict i4,
+ smwpInterface i5,
+ smwpClass i6,
+ out smwpEnum o1,
+ out smwpStruct o2,
+ out smwpStructSeq o3,
+ out smwpStringStructDict o4,
+ out smwpInterface o5,
+ out smwpClass o6)
+ throws smwpException;
+
+ ["amd"]
+ smwpStruct
+ smwpTest13Op3(smwpEnum i1,
+ smwpStruct i2,
+ smwpStructSeq i3,
+ smwpStringStructDict i4,
+ smwpInterface i5,
+ smwpClass i6,
+ out smwpEnum o1,
+ out smwpStruct o2,
+ out smwpStructSeq o3,
+ out smwpStringStructDict o4,
+ out smwpInterface o5,
+ out smwpClass o6)
+ throws smwpException;
+};
+
+};
+};
diff --git a/java-compat/test/Ice/translator/TestSingleModuleWithPackage4.ice b/java-compat/test/Ice/translator/TestSingleModuleWithPackage4.ice
new file mode 100644
index 00000000000..2a21da05e5e
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestSingleModuleWithPackage4.ice
@@ -0,0 +1,79 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use SingleModuleWithPackage types from (different) single module definitions
+
+#include <SingleModuleWithPackage.ice>
+
+module T1
+{
+
+const M::smwpEnum smwpTest4Constant = M::smwpE1;
+
+struct smwpTest4Struct
+{
+ M::smwpEnum e;
+ M::smwpStruct s;
+ M::smwpStructSeq seq;
+ M::smwpStringStructDict dict;
+ M::smwpClass c;
+ M::smwpInterface i;
+};
+
+sequence<M::smwpStruct> smwpTest4StructSeq;
+
+dictionary<M::smwpStruct, M::smwpBaseClass> smwpTest4StructClassSeq;
+
+interface smwpTest4Interface extends M::smwpInterface {};
+
+exception smwpTest4Exception extends M::smwpException
+{
+ M::smwpEnum e1;
+ M::smwpStruct s1;
+ M::smwpStructSeq seq1;
+ M::smwpStringStructDict dict1;
+ M::smwpClass c1;
+ M::smwpInterface i1;
+};
+
+class smwpTest4Class extends M::smwpBaseClass implements M::smwpBaseInterface
+{
+ M::smwpStruct
+ smwpTest4Op1(M::smwpEnum i1,
+ M::smwpStruct i2,
+ M::smwpStructSeq i3,
+ M::smwpStringStructDict i4,
+ M::smwpInterface i5,
+ M::smwpClass i6,
+ out M::smwpEnum o1,
+ out M::smwpStruct o2,
+ out M::smwpStructSeq o3,
+ out M::smwpStringStructDict o4,
+ out M::smwpInterface o5,
+ out M::smwpClass o6)
+ throws M::smwpException;
+
+ ["amd"]
+ M::smwpStruct
+ smwpTest4Op3(M::smwpEnum i1,
+ M::smwpStruct i2,
+ M::smwpStructSeq i3,
+ M::smwpStringStructDict i4,
+ M::smwpInterface i5,
+ M::smwpClass i6,
+ out M::smwpEnum o1,
+ out M::smwpStruct o2,
+ out M::smwpStructSeq o3,
+ out M::smwpStringStructDict o4,
+ out M::smwpInterface o5,
+ out M::smwpClass o6)
+ throws M::smwpException;
+};
+
+};
diff --git a/java-compat/test/Ice/translator/TestSingleModuleWithPackage5.ice b/java-compat/test/Ice/translator/TestSingleModuleWithPackage5.ice
new file mode 100644
index 00000000000..f035d20f669
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestSingleModuleWithPackage5.ice
@@ -0,0 +1,79 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use SingleModuleWithPackage types from (same) single module definitions
+
+#include <SingleModuleWithPackage.ice>
+
+module M
+{
+
+const smwpEnum smwpTest5Constant = smwpE1;
+
+struct smwpTest5Struct
+{
+ smwpEnum e;
+ smwpStruct s;
+ smwpStructSeq seq;
+ smwpStringStructDict dict;
+ smwpClass c;
+ smwpInterface i;
+};
+
+sequence<smwpStruct> smwpTest5StructSeq;
+
+dictionary<smwpStruct, smwpBaseClass> smwpTest5StructClassSeq;
+
+interface smwpTest5Interface extends smwpInterface {};
+
+exception smwpTest5Exception extends smwpException
+{
+ smwpEnum e1;
+ smwpStruct s1;
+ smwpStructSeq seq1;
+ smwpStringStructDict dict1;
+ smwpClass c1;
+ smwpInterface i1;
+};
+
+class smwpTest5Class extends smwpBaseClass implements smwpBaseInterface
+{
+ smwpStruct
+ smwpTest5Op1(smwpEnum i1,
+ smwpStruct i2,
+ smwpStructSeq i3,
+ smwpStringStructDict i4,
+ smwpInterface i5,
+ smwpClass i6,
+ out smwpEnum o1,
+ out smwpStruct o2,
+ out smwpStructSeq o3,
+ out smwpStringStructDict o4,
+ out smwpInterface o5,
+ out smwpClass o6)
+ throws smwpException;
+
+ ["amd"]
+ smwpStruct
+ smwpTest5Op3(smwpEnum i1,
+ smwpStruct i2,
+ smwpStructSeq i3,
+ smwpStringStructDict i4,
+ smwpInterface i5,
+ smwpClass i6,
+ out smwpEnum o1,
+ out smwpStruct o2,
+ out smwpStructSeq o3,
+ out smwpStringStructDict o4,
+ out smwpInterface o5,
+ out smwpClass o6)
+ throws smwpException;
+};
+
+};
diff --git a/java-compat/test/Ice/translator/TestSingleModuleWithPackage6.ice b/java-compat/test/Ice/translator/TestSingleModuleWithPackage6.ice
new file mode 100644
index 00000000000..a0ae4351786
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestSingleModuleWithPackage6.ice
@@ -0,0 +1,81 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use SingleModuleWithPackage types from (different) single module with (different) package definitions
+
+#include <SingleModuleWithPackage.ice>
+
+[["java:package:smwpTest6"]]
+
+module T1
+{
+
+const M::smwpEnum smwpTest6Constant = M::smwpE1;
+
+struct smwpTest6Struct
+{
+ M::smwpEnum e;
+ M::smwpStruct s;
+ M::smwpStructSeq seq;
+ M::smwpStringStructDict dict;
+ M::smwpClass c;
+ M::smwpInterface i;
+};
+
+sequence<M::smwpStruct> smwpTest6StructSeq;
+
+dictionary<M::smwpStruct, M::smwpBaseClass> smwpTest6StructClassSeq;
+
+interface smwpTest6Interface extends M::smwpInterface {};
+
+exception smwpTest6Exception extends M::smwpException
+{
+ M::smwpEnum e1;
+ M::smwpStruct s1;
+ M::smwpStructSeq seq1;
+ M::smwpStringStructDict dict1;
+ M::smwpClass c1;
+ M::smwpInterface i1;
+};
+
+class smwpTest6Class extends M::smwpBaseClass implements M::smwpBaseInterface
+{
+ M::smwpStruct
+ smwpTest6Op1(M::smwpEnum i1,
+ M::smwpStruct i2,
+ M::smwpStructSeq i3,
+ M::smwpStringStructDict i4,
+ M::smwpInterface i5,
+ M::smwpClass i6,
+ out M::smwpEnum o1,
+ out M::smwpStruct o2,
+ out M::smwpStructSeq o3,
+ out M::smwpStringStructDict o4,
+ out M::smwpInterface o5,
+ out M::smwpClass o6)
+ throws M::smwpException;
+
+ ["amd"]
+ M::smwpStruct
+ smwpTest6Op3(M::smwpEnum i1,
+ M::smwpStruct i2,
+ M::smwpStructSeq i3,
+ M::smwpStringStructDict i4,
+ M::smwpInterface i5,
+ M::smwpClass i6,
+ out M::smwpEnum o1,
+ out M::smwpStruct o2,
+ out M::smwpStructSeq o3,
+ out M::smwpStringStructDict o4,
+ out M::smwpInterface o5,
+ out M::smwpClass o6)
+ throws M::smwpException;
+};
+
+};
diff --git a/java-compat/test/Ice/translator/TestSingleModuleWithPackage7.ice b/java-compat/test/Ice/translator/TestSingleModuleWithPackage7.ice
new file mode 100644
index 00000000000..56ba5e062a1
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestSingleModuleWithPackage7.ice
@@ -0,0 +1,81 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use SingleModuleWithPackage types from (different) single module with (same) package definitions
+
+#include <SingleModuleWithPackage.ice>
+
+[["java:package:smwp"]]
+
+module T1
+{
+
+const M::smwpEnum smwpTest7Constant = M::smwpE1;
+
+struct smwpTest7Struct
+{
+ M::smwpEnum e;
+ M::smwpStruct s;
+ M::smwpStructSeq seq;
+ M::smwpStringStructDict dict;
+ M::smwpClass c;
+ M::smwpInterface i;
+};
+
+sequence<M::smwpStruct> smwpTest7StructSeq;
+
+dictionary<M::smwpStruct, M::smwpBaseClass> smwpTest7StructClassSeq;
+
+interface smwpTest7Interface extends M::smwpInterface {};
+
+exception smwpTest7Exception extends M::smwpException
+{
+ M::smwpEnum e1;
+ M::smwpStruct s1;
+ M::smwpStructSeq seq1;
+ M::smwpStringStructDict dict1;
+ M::smwpClass c1;
+ M::smwpInterface i1;
+};
+
+class smwpTest7Class extends M::smwpBaseClass implements M::smwpBaseInterface
+{
+ M::smwpStruct
+ smwpTest7Op1(M::smwpEnum i1,
+ M::smwpStruct i2,
+ M::smwpStructSeq i3,
+ M::smwpStringStructDict i4,
+ M::smwpInterface i5,
+ M::smwpClass i6,
+ out M::smwpEnum o1,
+ out M::smwpStruct o2,
+ out M::smwpStructSeq o3,
+ out M::smwpStringStructDict o4,
+ out M::smwpInterface o5,
+ out M::smwpClass o6)
+ throws M::smwpException;
+
+ ["amd"]
+ M::smwpStruct
+ smwpTest7Op3(M::smwpEnum i1,
+ M::smwpStruct i2,
+ M::smwpStructSeq i3,
+ M::smwpStringStructDict i4,
+ M::smwpInterface i5,
+ M::smwpClass i6,
+ out M::smwpEnum o1,
+ out M::smwpStruct o2,
+ out M::smwpStructSeq o3,
+ out M::smwpStringStructDict o4,
+ out M::smwpInterface o5,
+ out M::smwpClass o6)
+ throws M::smwpException;
+};
+
+};
diff --git a/java-compat/test/Ice/translator/TestSingleModuleWithPackage9.ice b/java-compat/test/Ice/translator/TestSingleModuleWithPackage9.ice
new file mode 100644
index 00000000000..26aca8cbb9e
--- /dev/null
+++ b/java-compat/test/Ice/translator/TestSingleModuleWithPackage9.ice
@@ -0,0 +1,82 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+// Test: use SingleModuleWithPackage types from (different) double module definitions
+
+#include <SingleModuleWithPackage.ice>
+
+module T1
+{
+module T2
+{
+
+const ::M::smwpEnum smwpTest9Constant = ::M::smwpE1;
+
+struct smwpTest9Struct
+{
+ ::M::smwpEnum e;
+ ::M::smwpStruct s;
+ ::M::smwpStructSeq seq;
+ ::M::smwpStringStructDict dict;
+ ::M::smwpClass c;
+ ::M::smwpInterface i;
+};
+
+sequence<::M::smwpStruct> smwpTest9StructSeq;
+
+dictionary<::M::smwpStruct, ::M::smwpBaseClass> smwpTest9StructClassSeq;
+
+interface smwpTest9Interface extends ::M::smwpInterface {};
+
+exception smwpTest9Exception extends ::M::smwpException
+{
+ ::M::smwpEnum e1;
+ ::M::smwpStruct s1;
+ ::M::smwpStructSeq seq1;
+ ::M::smwpStringStructDict dict1;
+ ::M::smwpClass c1;
+ ::M::smwpInterface i1;
+};
+
+class smwpTest9Class extends ::M::smwpBaseClass implements ::M::smwpBaseInterface
+{
+ ::M::smwpStruct
+ smwpTest9Op1(::M::smwpEnum i1,
+ ::M::smwpStruct i2,
+ ::M::smwpStructSeq i3,
+ ::M::smwpStringStructDict i4,
+ ::M::smwpInterface i5,
+ ::M::smwpClass i6,
+ out ::M::smwpEnum o1,
+ out ::M::smwpStruct o2,
+ out ::M::smwpStructSeq o3,
+ out ::M::smwpStringStructDict o4,
+ out ::M::smwpInterface o5,
+ out ::M::smwpClass o6)
+ throws ::M::smwpException;
+
+ ["amd"]
+ ::M::smwpStruct
+ smwpTest9Op3(::M::smwpEnum i1,
+ ::M::smwpStruct i2,
+ ::M::smwpStructSeq i3,
+ ::M::smwpStringStructDict i4,
+ ::M::smwpInterface i5,
+ ::M::smwpClass i6,
+ out ::M::smwpEnum o1,
+ out ::M::smwpStruct o2,
+ out ::M::smwpStructSeq o3,
+ out ::M::smwpStringStructDict o4,
+ out ::M::smwpInterface o5,
+ out ::M::smwpClass o6)
+ throws ::M::smwpException;
+};
+
+};
+};
diff --git a/java-compat/test/Ice/translator/Underscore.ice b/java-compat/test/Ice/translator/Underscore.ice
new file mode 100644
index 00000000000..7a080cd11c8
--- /dev/null
+++ b/java-compat/test/Ice/translator/Underscore.ice
@@ -0,0 +1,38 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+module Underscore_Test
+{
+ interface Test_Interface_A
+ {
+ void op_A();
+ };
+
+ class Test_Class_B implements Test_Interface_A
+ {
+ void op_B();
+
+ int int_member;
+ };
+
+ struct Test_Struct
+ {
+ string string_member;
+ };
+
+ exception Test_Exception
+ {
+ short short_member;
+ };
+
+ sequence<string> String_Sequence;
+ dictionary<string, string> String_Dictionary;
+
+ const int Const_Int = 99;
+};
diff --git a/java-compat/test/build.gradle b/java-compat/test/build.gradle
new file mode 100644
index 00000000000..e1e9e0d83d6
--- /dev/null
+++ b/java-compat/test/build.gradle
@@ -0,0 +1,52 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+ext.testDir = "${projectDir}/src/main/java/test"
+apply from: "slice.gradle"
+
+sourceSets {
+ main {
+ java {
+ exclude 'plugins'
+ exclude 'controller'
+ exclude 'ejb'
+ }
+ }
+}
+
+dependencies {
+ compile localDependency('ice-compat')
+ compile localDependency('icediscovery-compat')
+ compile localDependency('icelocatordiscovery-compat')
+ compile localDependency('icebox-compat')
+ compile localDependency('glacier2-compat')
+ compile localDependency('icestorm-compat')
+ compile localDependency('icegrid-compat')
+ compile project(':testPlugins')
+ compile project(':testController')
+ if(!gradle.startParameter.isOffline()) {
+ runtime "org.apache.tools:bzip2:1.0"
+ }
+}
+
+jar {
+ archiveName = "test.jar"
+ destinationDir = new File("$rootProject.projectDir/lib/")
+ manifest {
+ attributes("Class-Path": configurations.runtime.resolve().collect { it.toURI() }.join(' '))
+ }
+}
+
+clean {
+ delete("$rootProject.projectDir/lib/test.jar")
+ ['src/main/java/test/IceGrid/simple/db'].each {
+ delete fileTree(dir: it)
+ }
+ delete("src/main/java/test/Slice/generation/classes")
+}
diff --git a/java-compat/test/controller/build.gradle b/java-compat/test/controller/build.gradle
new file mode 100644
index 00000000000..29814b8a39f
--- /dev/null
+++ b/java-compat/test/controller/build.gradle
@@ -0,0 +1,22 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+sourceCompatibility = iceSourceCompatibility
+targetCompatibility = iceTargetCompatibility
+
+dependencies {
+ compile localDependency('ice-compat')
+}
+
+jar {
+ manifest {
+ attributes("Main-Class": "Test.Common.ControllerServer")
+ attributes("Class-Path": configurations.runtime.resolve().collect { it.toURI() }.join(' '))
+ }
+}
diff --git a/java-compat/test/controller/src/main/java/Test/Common/ControllerServer.java b/java-compat/test/controller/src/main/java/Test/Common/ControllerServer.java
new file mode 100644
index 00000000000..c90efc8e272
--- /dev/null
+++ b/java-compat/test/controller/src/main/java/Test/Common/ControllerServer.java
@@ -0,0 +1,325 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package Test.Common;
+
+import Test.Common._ControllerDisp;
+import Test.Common._ServerDisp;
+import Test.Common.ServerPrx;
+
+import java.io.File;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+
+import java.util.regex.Pattern;
+
+public class ControllerServer extends Ice.Application
+{
+ class ServerI extends _ServerDisp
+ {
+ public ServerI(Process process, String name)
+ {
+ _process = process;
+ _processOutput = new StringBuffer();
+ _name = name;
+ _started = 0;
+ _terminated = false;
+
+ class Reader extends Thread
+ {
+ Reader(java.io.InputStream is)
+ {
+ _is = is;
+ }
+
+ public void run()
+ {
+ try
+ {
+ final BufferedReader reader = new BufferedReader(new InputStreamReader(_is));
+
+ String line = reader.readLine();
+ while(line != null)
+ {
+ if(_started == 0)
+ {
+ _processOutput.append(line + "\n");
+ }
+
+ if(line.matches(Pattern.quote("starting server...") + ".*ok.*") ||
+ line.matches(Pattern.quote("starting serveramd...") + ".*ok.*") ||
+ line.matches(Pattern.quote("starting servertie...") + ".*ok.*") ||
+ line.matches(Pattern.quote("starting serveramdtie...") + ".*ok.*") ||
+ line.matches("starting test.*" + Pattern.quote("Server...") + ".*ok.*"))
+ {
+ synchronized(ServerI.this)
+ {
+ _started++;
+ ServerI.this.notifyAll();
+ }
+ }
+ else if(line.matches(Pattern.quote("starting server...") + ".*") ||
+ line.matches(Pattern.quote("starting serveramd...") + ".*") ||
+ line.matches(Pattern.quote("starting servertie...") + ".*") ||
+ line.matches(Pattern.quote("starting serveramdtie...") + ".*") ||
+ line.matches("starting test.*" + Pattern.quote("Server...") + ".*"))
+ {
+ String s = reader.readLine();
+ if(s == null)
+ {
+ System.out.println(line);
+ break;
+ }
+ line += s;
+ continue;
+ }
+ System.out.println(line);
+ line = reader.readLine();
+ }
+ }
+ catch(java.io.IOException ex)
+ {
+ System.out.println("server start failed!\n" + ex);
+ }
+
+ // Make sure to unblock thread waiting for server start.
+ synchronized(ServerI.this)
+ {
+ _terminated = true;
+ ServerI.this.notifyAll();
+ }
+ }
+
+ private java.io.InputStream _is;
+ }
+ new Reader(_process.getInputStream()).start();
+ }
+
+ public synchronized void terminate(Ice.Current current)
+ {
+ try
+ {
+ _process.exitValue();
+ return;
+ }
+ catch(IllegalThreadStateException ex)
+ {
+ //
+ // process is still running.
+ //
+ System.out.print("terminating " + _name + "... ");
+ System.out.flush();
+
+ _process.destroy();
+ while(true)
+ {
+ try
+ {
+ _process.waitFor();
+ break;
+ }
+ catch(InterruptedException e)
+ {
+ }
+ }
+ current.adapter.remove(current.id);
+ System.out.println("ok");
+ }
+ }
+
+ public void waitTestSuccess(Ice.Current current)
+ {
+ Process p = null;
+ synchronized(this)
+ {
+ p = _process;
+ }
+
+ if(p != null)
+ {
+ while(true)
+ {
+ try
+ {
+ p.waitFor();
+ break;
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+ }
+ }
+
+ public synchronized void waitForServer(Ice.Current current)
+ throws ServerFailedException
+ {
+ while(!_terminated)
+ {
+ try
+ {
+ if(_started > 0)
+ {
+ _started--;
+ break;
+ }
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ continue;
+ }
+ }
+ if(_terminated && _started == 0)
+ {
+ throw new ServerFailedException(_processOutput.toString());
+ }
+ }
+
+ private Process _process;
+ private StringBuffer _processOutput;
+ private String _name;
+ private int _started;
+ private boolean _terminated;
+ }
+
+ public class ControllerI extends _ControllerDisp
+ {
+ public ControllerI(String[] args)
+ {
+ _args = args;
+ }
+
+ @Override
+ public ServerPrx runServer(String lang, final String name, String protocol, String host,
+ boolean winrt, String configName, String[] options, Ice.Current current)
+ {
+ if(_server != null)
+ {
+ try
+ {
+ _server.terminate();
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ }
+
+ String script = lang + (lang.equals("java") ? "/test/src/main/java/" : "/") + "test/" + name + "/run.py";
+
+ java.util.List<String> args = new java.util.ArrayList<String>();
+ args.add("python");
+ args.add(script);
+ args.add("--server");
+ args.add("--protocol");
+ args.add(protocol);
+ if(!host.isEmpty())
+ {
+ args.add("--host");
+ args.add(host);
+ }
+
+ if(winrt)
+ {
+ args.add("--winrt");
+ }
+
+ if(!configName.isEmpty())
+ {
+ args.add("--configName");
+ args.add(configName);
+ }
+
+ for(String option : options)
+ {
+ args.add("--arg");
+ args.add(option);
+ }
+
+ for(String a : _args)
+ {
+ args.add(a);
+ }
+
+ try
+ {
+ System.out.print("starting " + name + "... ");
+ System.out.flush();
+
+ final Process process = new ProcessBuilder(args)
+ .directory(_toplevel)
+ .redirectErrorStream(true)
+ .start();
+ _server = ServerPrxHelper.uncheckedCast(current.adapter.addWithUUID(new ServerI(process, name)));
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new RuntimeException("failed to start server `" + name + "'", ex);
+ }
+ return _server;
+ }
+
+ private ServerPrx _server;
+ private String[] _args;
+ }
+
+ @Override
+ public int
+ run(String[] args)
+ {
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("ControllerAdapter");
+ adapter.add(new ControllerI(args), Ice.Util.stringToIdentity("controller"));
+ adapter.activate();
+ communicator().waitForShutdown();
+ return 0;
+ }
+
+ public ControllerServer(File toplevel)
+ {
+ _toplevel = toplevel;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ try
+ {
+ File toplevel = new File(
+ new File(ControllerServer.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getParent(),
+ "../../../../../");
+
+ ControllerServer app = new ControllerServer(toplevel);
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties(args);
+ initData.properties.setProperty("Ice.Plugin.IceSSL", "IceSSL.PluginFactory");
+ initData.properties.setProperty("IceSSL.DefaultDir", new File(toplevel, "certs").getCanonicalPath());
+ initData.properties.setProperty("IceSSL.Keystore", "server.jks");
+ initData.properties.setProperty("IceSSL.Password", "password");
+ initData.properties.setProperty("IceSSL.VerifyPeer", "0");
+ initData.properties.setProperty("Ice.ThreadPool.Server.SizeMax", "10");
+ initData.properties.setProperty("ControllerAdapter.Endpoints",
+ "tcp -p 15000:ssl -p 15001: ws -p 15002:wss -p 15003");
+
+ int status = app.main("ControllerServer", args, initData);
+ System.exit(status);
+ }
+ catch(java.net.URISyntaxException ex)
+ {
+ ex.printStackTrace();
+ System.exit(1);
+ }
+ catch(java.io.IOException ex)
+ {
+ ex.printStackTrace();
+ System.exit(1);
+ }
+ }
+
+ private final File _toplevel;
+}
diff --git a/java-compat/test/controller/src/main/slice/Controller.ice b/java-compat/test/controller/src/main/slice/Controller.ice
new file mode 100644
index 00000000000..edc11307013
--- /dev/null
+++ b/java-compat/test/controller/src/main/slice/Controller.ice
@@ -0,0 +1,38 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+module Test
+{
+
+module Common
+{
+
+exception ServerFailedException
+{
+ string reason;
+};
+
+interface Server
+{
+ void waitTestSuccess();
+ void waitForServer() throws ServerFailedException;
+ void terminate();
+};
+
+sequence<string> StringSeq;
+
+interface Controller
+{
+ Server* runServer(string lang, string name, string protocol, string host, bool winrt, string configName,
+ StringSeq options);
+};
+
+};
+
+};
diff --git a/java-compat/test/ejb/README.md b/java-compat/test/ejb/README.md
new file mode 100644
index 00000000000..5e2a1bbf883
--- /dev/null
+++ b/java-compat/test/ejb/README.md
@@ -0,0 +1,73 @@
+This test demonstrates the sharing of a single Ice object adapter for
+multiple EJBs.
+
+It setups 2 EJBs which both implement a similar service but with
+slightly different Slice types: the Account class in the first version
+has 1 string member and the second version has 2 string members:
+
+// Version 1
+class Account extends Base
+{
+ string id;
+};
+
+// Version 2
+class Account extends Base
+{
+ string id;
+ string foo;
+};
+
+The Base class is defined in a Jar shared by both EJBs and install in
+the lib directory of the application server.
+
+Each EJB registers servants using the IceAdapter helper class. This
+helper manages the shared Ice object adapter.
+
+The helper registers the servant with the object adapter and uses a
+dispatch interceptor to setup the thread context class loader to
+ensure the servant invocations are un-marhsalled with the EJB class
+loader.
+
+With Ice 3.5, this interceptor will no longer be necessary, the Ice
+core will provide a property to enable the setting of the thread
+context class loader from the Ice core directly.
+
+Building the test
+-----------------
+
+Set the JBOSS_HOME environment variable to your jboss-eap-5.1/jboss-as
+directory, for example:
+
+ $ export JBOSS_HOME=$HOME/EnterprisePlatform-5.1.2/jboss-eap-5.1/jboss-as/
+
+If Ice isn't installed in the default location set the ICE_HOME
+environment variable to your Ice 3.7.0 installation directory.
+
+Run ant to build and deploy the application:
+
+ $ ant deploy
+
+This will deploy the following Jars to your JBoss server default
+configuration:
+
+ $JBOSS_HOME/server/default/lib/Ice.jar
+ $JBOSS_HOME/server/default/lib/ice-ejb-test-common.jar
+ $JBOSS_HOME/server/default/deploy/ice-ejb-test-ejb1.jar
+ $JBOSS_HOME/server/default/deploy/ice-ejb-test-ejb2.jar
+
+Run the clients
+---------------
+
+To run the client for the first EJB version:
+
+ $ ant run.client1
+
+For the second EJB version:
+
+ $ ant run.client2
+
+Note that the clients uses the Java naming provier specified in
+src/resources/jndi.properties (jnp://127.0.0.1:1099) to obtain a
+reference on the initialization EJB of each service. The Ice object
+adapter listen on the port 10000 of the loopback interface.
diff --git a/java-compat/test/ejb/src/common/com/zeroc/ice/IceAdapter.java b/java-compat/test/ejb/src/common/com/zeroc/ice/IceAdapter.java
new file mode 100644
index 00000000000..61ea69ca263
--- /dev/null
+++ b/java-compat/test/ejb/src/common/com/zeroc/ice/IceAdapter.java
@@ -0,0 +1,52 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.ice;
+
+public class IceAdapter
+{
+ synchronized static public void
+ add(Ice.Object servant, Ice.Identity id)
+ {
+ if(_objectAdapter == null)
+ {
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties();
+ initData.properties.setProperty("Ice.Default.Package", "com.zeroc.ice");
+ initData.properties.setProperty("Ice.UseApplicationClassLoader", "1");
+ Ice.Communicator communicator = Ice.Util.initialize(initData);
+ _objectAdapter = communicator.createObjectAdapterWithEndpoints("EJB", "tcp -h localhost -p 10000");
+ _objectAdapter.activate();
+ }
+ ++_servantCount;
+ _objectAdapter.add(servant, id);
+ }
+
+ synchronized static public void
+ remove(Ice.Identity id)
+ {
+ assert _servantCount > 0;
+ _objectAdapter.remove(id);
+ if(--_servantCount == 0)
+ {
+ _objectAdapter.getCommunicator().destroy();
+ _objectAdapter = null;
+ }
+ }
+
+ synchronized static public Ice.ObjectPrx
+ stringToProxy(String str)
+ {
+ assert _objectAdapter != null;
+ return _objectAdapter.getCommunicator().stringToProxy(str);
+ }
+
+ static private Ice.ObjectAdapter _objectAdapter = null;
+ static private int _servantCount;
+};
diff --git a/java-compat/test/ejb/src/ejb1/META-INF/jboss.xml b/java-compat/test/ejb/src/ejb1/META-INF/jboss.xml
new file mode 100644
index 00000000000..8147b430d14
--- /dev/null
+++ b/java-compat/test/ejb/src/ejb1/META-INF/jboss.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<jboss>
+ <loader-repository>
+ com.zeroc.ejb1:loader=EJB1ClassLoader
+ <loader-repository-config>
+ java2ParentDelegation=false
+ </loader-repository-config>
+ </loader-repository>
+</jboss>
diff --git a/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/Client.java b/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/Client.java
new file mode 100644
index 00000000000..2b5c59e07e3
--- /dev/null
+++ b/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/Client.java
@@ -0,0 +1,68 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.ejb;
+
+import javax.naming.*;
+
+import com.zeroc.ice.Test.*;
+
+public class Client extends Ice.Application
+{
+ public int
+ run(String[] args)
+ {
+ System.out.print("initializing EJBs... ");
+ System.out.flush();
+ try
+ {
+ // Initialize the EJBs
+ InitialContext ic = new InitialContext();
+ Init init = (Init)ic.lookup("InitEJB1Service");
+ init.init();
+ }
+ catch(Exception ex)
+ {
+ System.err.println("couldn't resolve init bean:\n" + ex);
+ return 1;
+ }
+ System.out.println("ok");
+
+ System.out.print("setting and getting account... ");
+ System.out.flush();
+ String str = "ejb1/service:tcp -h localhost -p 10000";
+ ServicePrx proxy = ServicePrxHelper.checkedCast(communicator().stringToProxy(str));
+ proxy.addAccount(new Account("id1"));
+ Account s = proxy.getAccount("id1");
+ if(!s.id.equals("id1"))
+ {
+ throw new RuntimeException("invalid value: " + s.id);
+ }
+
+ s = proxy.getAccount("id2");
+ if(!s.id.equals("id2"))
+ {
+ throw new RuntimeException("invalid value: " + s.id);
+ }
+
+ System.out.println("ok");
+ return 0;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Client app = new Client();
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties();
+ initData.properties.setProperty("Ice.Default.Package", "com.zeroc.ice");
+ int status = app.main("Client", args, initData);
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/DatabaseI.java b/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/DatabaseI.java
new file mode 100644
index 00000000000..ccc7c2551d2
--- /dev/null
+++ b/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/DatabaseI.java
@@ -0,0 +1,35 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.ejb;
+
+import com.zeroc.ice.Test.*;
+
+public class DatabaseI extends _DatabaseDisp
+{
+ public final Account
+ getAccount(String id, Ice.Current current)
+ throws AccountNotExistException
+ {
+ Account account = accounts.get(id);
+ if(account == null)
+ {
+ throw new AccountNotExistException();
+ }
+ return account;
+ }
+
+ public final void
+ addAccount(Account s, Ice.Current current)
+ {
+ accounts.put(s.id, s);
+ }
+
+ private java.util.Map<String, Account> accounts = new java.util.HashMap<String, Account>();
+}
diff --git a/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/DatabaseServer.java b/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/DatabaseServer.java
new file mode 100644
index 00000000000..04cc84e9dbd
--- /dev/null
+++ b/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/DatabaseServer.java
@@ -0,0 +1,43 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.ejb;
+
+import com.zeroc.ice.Test.*;
+
+public class DatabaseServer extends Ice.Application
+{
+ public int
+ run(String[] args)
+ {
+ if(args.length > 0)
+ {
+ System.err.println(appName() + ": too many arguments");
+ return 1;
+ }
+
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapterWithEndpoints("DB", "tcp -h localhost -p 10001");
+ adapter.add(new DatabaseI(), Ice.Util.stringToIdentity("db"));
+ adapter.activate();
+ communicator().waitForShutdown();
+ return 0;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties();
+ initData.properties.setProperty("Ice.Default.Package", "com.zeroc.ice");
+
+ DatabaseServer app = new DatabaseServer();
+ int status = app.main("Server", args, initData);
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/Init.java b/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/Init.java
new file mode 100644
index 00000000000..0828932d46f
--- /dev/null
+++ b/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/Init.java
@@ -0,0 +1,18 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.ejb;
+
+import javax.ejb.*;
+
+@Remote
+public interface Init
+{
+ void init();
+}
diff --git a/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/InitBean.java b/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/InitBean.java
new file mode 100644
index 00000000000..09ab74f754f
--- /dev/null
+++ b/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/InitBean.java
@@ -0,0 +1,44 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.ejb;
+
+import javax.annotation.*;
+import javax.ejb.*;
+
+import com.zeroc.ice.IceAdapter;
+
+//
+// The initialization EJB is used to register Ice servants for each
+// the EJBs from this EJB3 Jar.
+//
+@Stateless(mappedName="InitEJB1Service", name="Init1")
+public class InitBean implements Init
+{
+ private @EJB Service service;
+
+ @PostConstruct
+ public void
+ create()
+ {
+ IceAdapter.add(new ServiceI(service), new Ice.Identity("service", "ejb1"));
+ }
+
+ @PreDestroy
+ public void
+ destroy()
+ {
+ IceAdapter.remove(new Ice.Identity("service", "ejb1"));
+ }
+
+ public void
+ init()
+ {
+ }
+} \ No newline at end of file
diff --git a/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/Service.java b/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/Service.java
new file mode 100644
index 00000000000..7548d40a6a8
--- /dev/null
+++ b/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/Service.java
@@ -0,0 +1,22 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.ejb;
+
+import javax.ejb.Local;
+import com.zeroc.ice.Test.Account;
+import com.zeroc.ice.Test.AccountNotExistException;
+
+@Local
+public interface Service
+{
+ Account getAccount(String id);
+
+ void addAccount(Account s);
+}
diff --git a/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/ServiceBean.java b/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/ServiceBean.java
new file mode 100644
index 00000000000..df983cdc455
--- /dev/null
+++ b/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/ServiceBean.java
@@ -0,0 +1,50 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.ejb;
+
+import javax.annotation.*;
+import javax.ejb.*;
+import com.zeroc.ice.IceAdapter;
+import com.zeroc.ice.Test.*;
+
+@Stateless(name="EJB1ServiceBean")
+public class ServiceBean implements Service
+{
+ @PostConstruct
+ public void
+ create()
+ {
+ Ice.ObjectPrx db = IceAdapter.stringToProxy("db:tcp -h localhost -p 10001");
+ database = DatabasePrxHelper.uncheckedCast(db);
+ }
+
+ public final Account
+ getAccount(String id)
+ {
+ try
+ {
+ return database.getAccount(id);
+ }
+ catch(AccountNotExistException ex)
+ {
+ Account a = new Account(id);
+ database.addAccount(a);
+ return a;
+ }
+ }
+
+ public final void
+ addAccount(Account s)
+ {
+ database.addAccount(s);
+ }
+
+ private DatabasePrx database;
+}
diff --git a/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/ServiceI.java b/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/ServiceI.java
new file mode 100644
index 00000000000..4140c7c8fd7
--- /dev/null
+++ b/java-compat/test/ejb/src/ejb1/com/zeroc/ejb/ServiceI.java
@@ -0,0 +1,41 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.ejb;
+
+import javax.ejb.*;
+
+import com.zeroc.ice.Test._ServiceDisp;
+import com.zeroc.ice.Test.Account;
+import com.zeroc.ice.Test.AccountNotExistException;
+
+//
+// This Ice servant delegates the calls to the Service EJB
+//
+public class ServiceI extends _ServiceDisp
+{
+ final private Service service;
+
+ public ServiceI(Service service)
+ {
+ this.service = service;
+ }
+
+ public final Account
+ getAccount(String id, Ice.Current current)
+ {
+ return service.getAccount(id);
+ }
+
+ public final void
+ addAccount(Account s, Ice.Current current)
+ {
+ service.addAccount(s);
+ }
+} \ No newline at end of file
diff --git a/java-compat/test/ejb/src/ejb2/META-INF/jboss.xml b/java-compat/test/ejb/src/ejb2/META-INF/jboss.xml
new file mode 100644
index 00000000000..23a2bb332a8
--- /dev/null
+++ b/java-compat/test/ejb/src/ejb2/META-INF/jboss.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<jboss>
+ <loader-repository>
+ com.zeroc.ejb2:loader=EJB2ClassLoader
+ <loader-repository-config>
+ java2ParentDelegation=false
+ </loader-repository-config>
+ </loader-repository>
+</jboss>
diff --git a/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/Client.java b/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/Client.java
new file mode 100644
index 00000000000..8bbcb0dbc62
--- /dev/null
+++ b/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/Client.java
@@ -0,0 +1,68 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.ejb;
+
+import javax.naming.*;
+
+import com.zeroc.ice.Test.*;
+
+public class Client extends Ice.Application
+{
+ public int
+ run(String[] args)
+ {
+ System.out.print("initializing EJBs... ");
+ System.out.flush();
+ try
+ {
+ // Initialize the EJBs
+ InitialContext ic = new InitialContext();
+ Init init = (Init)ic.lookup("InitEJB2Service");
+ init.init();
+ }
+ catch(Exception ex)
+ {
+ System.err.println("couldn't resolve init bean:\n" + ex);
+ return 1;
+ }
+ System.out.println("ok");
+
+ System.out.print("setting and getting account... ");
+ System.out.flush();
+ String str = "ejb2/service:tcp -h localhost -p 10000";
+ ServicePrx proxy = ServicePrxHelper.checkedCast(communicator().stringToProxy(str));
+ proxy.addAccount(new Account("id1", "foo"));
+ Account s = proxy.getAccount("id1");
+ if(!s.id.equals("id1") || !s.foo.equals("foo"))
+ {
+ throw new RuntimeException("invalid value: " + s.id);
+ }
+
+ s = proxy.getAccount("id2");
+ if(!s.id.equals("id2"))
+ {
+ throw new RuntimeException("invalid value: " + s.id);
+ }
+
+ System.out.println("ok");
+ return 0;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Client app = new Client();
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties();
+ initData.properties.setProperty("Ice.Default.Package", "com.zeroc.ice");
+ int status = app.main("Client", args, initData);
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/DatabaseI.java b/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/DatabaseI.java
new file mode 100644
index 00000000000..9787c5c4885
--- /dev/null
+++ b/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/DatabaseI.java
@@ -0,0 +1,35 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.ejb;
+
+import com.zeroc.ice.Test.*;
+
+public class DatabaseI extends _DatabaseDisp
+{
+ public final Account
+ getAccount(String id, Ice.Current current)
+ throws AccountNotExistException
+ {
+ Account account = accounts.get(id);
+ if(account == null)
+ {
+ throw new AccountNotExistException(id);
+ }
+ return account;
+ }
+
+ public final void
+ addAccount(Account s, Ice.Current current)
+ {
+ accounts.put(s.id, s);
+ }
+
+ private java.util.Map<String, Account> accounts = new java.util.HashMap<String, Account>();
+}
diff --git a/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/DatabaseServer.java b/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/DatabaseServer.java
new file mode 100644
index 00000000000..f7ad76bd657
--- /dev/null
+++ b/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/DatabaseServer.java
@@ -0,0 +1,43 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.ejb;
+
+import com.zeroc.ice.Test.*;
+
+public class DatabaseServer extends Ice.Application
+{
+ public int
+ run(String[] args)
+ {
+ if(args.length > 0)
+ {
+ System.err.println(appName() + ": too many arguments");
+ return 1;
+ }
+
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapterWithEndpoints("DB", "tcp -h localhost -p 10002");
+ adapter.add(new DatabaseI(), Ice.Util.stringToIdentity("db"));
+ adapter.activate();
+ communicator().waitForShutdown();
+ return 0;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties();
+ initData.properties.setProperty("Ice.Default.Package", "com.zeroc.ice");
+
+ DatabaseServer app = new DatabaseServer();
+ int status = app.main("Server", args, initData);
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/Init.java b/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/Init.java
new file mode 100644
index 00000000000..0828932d46f
--- /dev/null
+++ b/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/Init.java
@@ -0,0 +1,18 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.ejb;
+
+import javax.ejb.*;
+
+@Remote
+public interface Init
+{
+ void init();
+}
diff --git a/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/InitBean.java b/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/InitBean.java
new file mode 100644
index 00000000000..277f121cc79
--- /dev/null
+++ b/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/InitBean.java
@@ -0,0 +1,44 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.ejb;
+
+import javax.annotation.*;
+import javax.ejb.*;
+
+import com.zeroc.ice.IceAdapter;
+
+//
+// The initialization EJB is used to register Ice servants for each
+// the EJBs from this EJB3 Jar.
+//
+@Stateless(mappedName="InitEJB2Service", name="Init2")
+public class InitBean implements Init
+{
+ private @EJB Service service;
+
+ @PostConstruct
+ public void
+ create()
+ {
+ IceAdapter.add(new ServiceI(service), new Ice.Identity("service", "ejb2"));
+ }
+
+ @PreDestroy
+ public void
+ destroy()
+ {
+ IceAdapter.remove(new Ice.Identity("service", "ejb2"));
+ }
+
+ public void
+ init()
+ {
+ }
+} \ No newline at end of file
diff --git a/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/Service.java b/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/Service.java
new file mode 100644
index 00000000000..7548d40a6a8
--- /dev/null
+++ b/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/Service.java
@@ -0,0 +1,22 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.ejb;
+
+import javax.ejb.Local;
+import com.zeroc.ice.Test.Account;
+import com.zeroc.ice.Test.AccountNotExistException;
+
+@Local
+public interface Service
+{
+ Account getAccount(String id);
+
+ void addAccount(Account s);
+}
diff --git a/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/ServiceBean.java b/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/ServiceBean.java
new file mode 100644
index 00000000000..c3811e34a29
--- /dev/null
+++ b/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/ServiceBean.java
@@ -0,0 +1,86 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.ejb;
+
+import javax.annotation.*;
+import javax.ejb.*;
+import com.zeroc.ice.IceAdapter;
+import com.zeroc.ice.Test.*;
+
+@Stateless(name="EJB2ServiceBean")
+public class ServiceBean implements Service
+{
+ @PostConstruct
+ public void
+ create()
+ {
+ Ice.ObjectPrx db = IceAdapter.stringToProxy("db:tcp -h localhost -p 10002");
+ database = DatabasePrxHelper.uncheckedCast(db);
+ }
+
+ public final Account
+ getAccount(String id)
+ {
+ final AccountHolder holder = new AccountHolder();
+ database.begin_getAccount(id, new Callback_Database_getAccount() {
+ public void
+ response(Account a)
+ {
+ synchronized(holder)
+ {
+ holder.value = a;
+ holder.notify();
+ }
+ }
+
+ public void
+ exception(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ assert(false);
+ }
+
+ public void
+ exception(Ice.UserException ex)
+ {
+ Account a = new Account(((AccountNotExistException)ex).id, "");
+ database.begin_addAccount(a);
+ synchronized(holder)
+ {
+ holder.value = a;
+ holder.notify();
+ }
+ }
+ });
+
+ synchronized(holder)
+ {
+ while(holder.value == null)
+ {
+ try
+ {
+ holder.wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+ }
+ return holder.value;
+ }
+
+ public final void
+ addAccount(Account s)
+ {
+ database.addAccount(s);
+ }
+
+ private DatabasePrx database;
+}
diff --git a/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/ServiceI.java b/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/ServiceI.java
new file mode 100644
index 00000000000..4140c7c8fd7
--- /dev/null
+++ b/java-compat/test/ejb/src/ejb2/com/zeroc/ejb/ServiceI.java
@@ -0,0 +1,41 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.ejb;
+
+import javax.ejb.*;
+
+import com.zeroc.ice.Test._ServiceDisp;
+import com.zeroc.ice.Test.Account;
+import com.zeroc.ice.Test.AccountNotExistException;
+
+//
+// This Ice servant delegates the calls to the Service EJB
+//
+public class ServiceI extends _ServiceDisp
+{
+ final private Service service;
+
+ public ServiceI(Service service)
+ {
+ this.service = service;
+ }
+
+ public final Account
+ getAccount(String id, Ice.Current current)
+ {
+ return service.getAccount(id);
+ }
+
+ public final void
+ addAccount(Account s, Ice.Current current)
+ {
+ service.addAccount(s);
+ }
+} \ No newline at end of file
diff --git a/java-compat/test/ejb/src/resources/jndi.properties b/java-compat/test/ejb/src/resources/jndi.properties
new file mode 100644
index 00000000000..dbd97ecf182
--- /dev/null
+++ b/java-compat/test/ejb/src/resources/jndi.properties
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://127.0.0.1:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
diff --git a/java-compat/test/ejb/src/slice/common.ice b/java-compat/test/ejb/src/slice/common.ice
new file mode 100644
index 00000000000..4313e3cb17b
--- /dev/null
+++ b/java-compat/test/ejb/src/slice/common.ice
@@ -0,0 +1,18 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+[["java:package:com.zeroc.ice"]]
+module Test
+{
+
+class Base
+{
+};
+
+};
diff --git a/java-compat/test/ejb/src/slice/ejb1.ice b/java-compat/test/ejb/src/slice/ejb1.ice
new file mode 100644
index 00000000000..d90519ed3d4
--- /dev/null
+++ b/java-compat/test/ejb/src/slice/ejb1.ice
@@ -0,0 +1,40 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include "common.ice"
+
+[["java:package:com.zeroc.ice"]]
+module Test
+{
+
+exception AccountNotExistException
+{
+};
+
+class Account extends Base
+{
+ string id;
+};
+
+interface Database
+{
+ void addAccount(Account s);
+
+ Account getAccount(string id)
+ throws AccountNotExistException;
+};
+
+interface Service
+{
+ void addAccount(Account s);
+
+ Account getAccount(string id);
+};
+
+};
diff --git a/java-compat/test/ejb/src/slice/ejb2.ice b/java-compat/test/ejb/src/slice/ejb2.ice
new file mode 100644
index 00000000000..cdb112b22b0
--- /dev/null
+++ b/java-compat/test/ejb/src/slice/ejb2.ice
@@ -0,0 +1,42 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include "common.ice"
+
+[["java:package:com.zeroc.ice"]]
+module Test
+{
+
+exception AccountNotExistException
+{
+ string id;
+};
+
+class Account extends Base
+{
+ string id;
+ string foo;
+};
+
+interface Database
+{
+ void addAccount(Account s);
+
+ Account getAccount(string id)
+ throws AccountNotExistException;
+};
+
+interface Service
+{
+ void addAccount(Account s);
+
+ Account getAccount(string id);
+};
+
+};
diff --git a/java-compat/test/plugins/build.gradle b/java-compat/test/plugins/build.gradle
new file mode 100644
index 00000000000..b7b3e33e8cc
--- /dev/null
+++ b/java-compat/test/plugins/build.gradle
@@ -0,0 +1,30 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+sourceSets {
+ main {
+ java {
+ srcDirs "$rootProject.projectDir/test/plugins"
+ }
+ }
+}
+
+dependencies {
+ compile localDependency('ice-compat')
+}
+
+jar {
+ archiveName = "IceTestPlugins.jar"
+ destinationDir = new File("$rootProject.projectDir/lib/")
+}
+
+clean {
+ delete("$rootProject.projectDir/lib/IceTestPlugins.jar")
+}
+
diff --git a/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/BasePlugin.java b/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/BasePlugin.java
new file mode 100644
index 00000000000..5e896525b80
--- /dev/null
+++ b/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/BasePlugin.java
@@ -0,0 +1,41 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.plugin.plugins;
+
+public abstract class BasePlugin implements Ice.Plugin
+{
+ public BasePlugin(Ice.Communicator communicator)
+ {
+ _communicator = communicator;
+ }
+
+ public boolean isInitialized()
+ {
+ return _initialized;
+ }
+
+ public boolean isDestroyed()
+ {
+ return _destroyed;
+ }
+
+ protected static void test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ protected Ice.Communicator _communicator;
+ protected boolean _initialized = false;
+ protected boolean _destroyed = false;
+ protected BasePlugin _other = null;
+}
diff --git a/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/BasePluginFail.java b/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/BasePluginFail.java
new file mode 100644
index 00000000000..5305936ab38
--- /dev/null
+++ b/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/BasePluginFail.java
@@ -0,0 +1,45 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.plugin.plugins;
+
+public abstract class BasePluginFail implements Ice.Plugin
+{
+ public BasePluginFail(Ice.Communicator communicator)
+ {
+ _communicator = communicator;
+ _initialized = false;
+ _destroyed = false;
+ }
+
+ public boolean isInitialized()
+ {
+ return _initialized;
+ }
+
+ public boolean isDestroyed()
+ {
+ return _destroyed;
+ }
+
+ protected static void test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ protected Ice.Communicator _communicator;
+ protected boolean _initialized;
+ protected boolean _destroyed;
+ protected BasePluginFail _one;
+ protected BasePluginFail _two;
+ protected BasePluginFail _three;
+}
diff --git a/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginFactory.java b/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginFactory.java
new file mode 100644
index 00000000000..1cf88f4fafa
--- /dev/null
+++ b/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginFactory.java
@@ -0,0 +1,75 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.plugin.plugins;
+
+public class PluginFactory implements Ice.PluginFactory
+{
+ @Override
+ public Ice.Plugin create(Ice.Communicator communicator, String name, String[] args)
+ {
+ return new Plugin(args);
+ }
+
+ static class Plugin implements Ice.Plugin
+ {
+ public Plugin(String[] args)
+ {
+ _args = args;
+ }
+
+ @Override
+ public void initialize()
+ {
+ _initialized = true;
+ test(_args.length == 3);
+ test(_args[0].equals("C:\\Program Files\\"));
+ test(_args[1].equals("--DatabasePath"));
+ test(_args[2].equals("C:\\Program Files\\Application\\db"));
+ }
+
+ @Override
+ public void destroy()
+ {
+ _destroyed = true;
+ }
+
+ @Override
+ protected void finalize() throws Throwable
+ {
+ try
+ {
+ if(!_initialized)
+ {
+ System.out.println("test.Ice.plugin.plugins.Plugin not initialized");
+ }
+ if(!_destroyed)
+ {
+ System.out.println("test.Ice.plugin.plugins.Plugin not destroyed");
+ }
+ }
+ finally
+ {
+ super.finalize();
+ }
+ }
+
+ private static void test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private String[] _args;
+ private boolean _initialized = false;
+ private boolean _destroyed = false;
+ }
+}
diff --git a/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginInitializeFailException.java b/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginInitializeFailException.java
new file mode 100644
index 00000000000..0d376ff9e9f
--- /dev/null
+++ b/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginInitializeFailException.java
@@ -0,0 +1,18 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.plugin.plugins;
+
+public class PluginInitializeFailException extends java.lang.RuntimeException
+{
+ public PluginInitializeFailException()
+ {
+ super("PluginInitializeFailException");
+ }
+}
diff --git a/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginInitializeFailFactory.java b/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginInitializeFailFactory.java
new file mode 100644
index 00000000000..549932b96a0
--- /dev/null
+++ b/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginInitializeFailFactory.java
@@ -0,0 +1,42 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.plugin.plugins;
+
+public class PluginInitializeFailFactory implements Ice.PluginFactory
+{
+ @Override
+ public Ice.Plugin create(Ice.Communicator communicator, String name, String[] args)
+ {
+ return new PluginInitializeFail();
+ }
+
+ static class PluginInitializeFail implements Ice.Plugin
+ {
+ @Override
+ public void initialize()
+ {
+ throw new PluginInitializeFailException();
+ }
+
+ @Override
+ public void destroy()
+ {
+ test(false);
+ }
+
+ private static void test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+ }
+}
diff --git a/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginOneFactory.java b/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginOneFactory.java
new file mode 100644
index 00000000000..d9199835764
--- /dev/null
+++ b/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginOneFactory.java
@@ -0,0 +1,42 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.plugin.plugins;
+
+public class PluginOneFactory implements Ice.PluginFactory
+{
+ @Override
+ public Ice.Plugin create(Ice.Communicator communicator, String name, String[] args)
+ {
+ return new PluginOne(communicator);
+ }
+
+ static class PluginOne extends BasePlugin
+ {
+ public PluginOne(Ice.Communicator communicator)
+ {
+ super(communicator);
+ }
+
+ @Override
+ public void initialize()
+ {
+ _other = (BasePlugin)_communicator.getPluginManager().getPlugin("PluginTwo");
+ test(!_other.isInitialized());
+ _initialized = true;
+ }
+
+ @Override
+ public void destroy()
+ {
+ _destroyed = true;
+ test(_other.isDestroyed());
+ }
+ }
+}
diff --git a/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginOneFailFactory.java b/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginOneFailFactory.java
new file mode 100644
index 00000000000..120004ed73c
--- /dev/null
+++ b/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginOneFailFactory.java
@@ -0,0 +1,68 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.plugin.plugins;
+
+public class PluginOneFailFactory implements Ice.PluginFactory
+{
+ @Override
+ public Ice.Plugin create(Ice.Communicator communicator, String name, String[] args)
+ {
+ return new PluginOneFail(communicator);
+ }
+
+ static class PluginOneFail extends BasePluginFail
+ {
+ public PluginOneFail(Ice.Communicator communicator)
+ {
+ super(communicator);
+ }
+
+ @Override
+ public void initialize()
+ {
+ _two = (BasePluginFail)_communicator.getPluginManager().getPlugin("PluginTwoFail");
+ test(!_two.isInitialized());
+ _three = (BasePluginFail)_communicator.getPluginManager().getPlugin("PluginThreeFail");
+ test(!_three.isInitialized());
+ _initialized = true;
+ }
+
+ @Override
+ public void destroy()
+ {
+ test(_two.isDestroyed());
+ //
+ // Not destroyed because initialize fails.
+ //
+ test(!_three.isDestroyed());
+ _destroyed = true;
+ }
+
+ @Override
+ protected void finalize() throws Throwable
+ {
+ try
+ {
+ if(!_initialized)
+ {
+ System.out.println(getClass().getName() + " not initialized");
+ }
+ if(!_destroyed)
+ {
+ System.out.println(getClass().getName() + " not destroyed");
+ }
+ }
+ finally
+ {
+ super.finalize();
+ }
+ }
+ }
+}
diff --git a/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginThreeFactory.java b/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginThreeFactory.java
new file mode 100644
index 00000000000..983c595e2f7
--- /dev/null
+++ b/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginThreeFactory.java
@@ -0,0 +1,42 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.plugin.plugins;
+
+public class PluginThreeFactory implements Ice.PluginFactory
+{
+ @Override
+ public Ice.Plugin create(Ice.Communicator communicator, String name, String[] args)
+ {
+ return new PluginThree(communicator);
+ }
+
+ static class PluginThree extends BasePlugin
+ {
+ public PluginThree(Ice.Communicator communicator)
+ {
+ super(communicator);
+ }
+
+ @Override
+ public void initialize()
+ {
+ _other = (BasePlugin)_communicator.getPluginManager().getPlugin("PluginTwo");
+ test(_other.isInitialized());
+ _initialized = true;
+ }
+
+ @Override
+ public void destroy()
+ {
+ _destroyed = true;
+ test(!_other.isDestroyed());
+ }
+ }
+}
diff --git a/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginThreeFailFactory.java b/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginThreeFailFactory.java
new file mode 100644
index 00000000000..c0b139d9395
--- /dev/null
+++ b/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginThreeFailFactory.java
@@ -0,0 +1,59 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.plugin.plugins;
+
+public class PluginThreeFailFactory implements Ice.PluginFactory
+{
+ @Override
+ public Ice.Plugin create(Ice.Communicator communicator, String name, String[] args)
+ {
+ return new PluginThreeFail(communicator);
+ }
+
+ public class PluginThreeFail extends BasePluginFail
+ {
+ public PluginThreeFail(Ice.Communicator communicator)
+ {
+ super(communicator);
+ }
+
+ @Override
+ public void initialize()
+ {
+ throw new PluginInitializeFailException();
+ }
+
+ @Override
+ public void destroy()
+ {
+ test(false);
+ }
+
+ @Override
+ protected void finalize() throws Throwable
+ {
+ try
+ {
+ if(_initialized)
+ {
+ System.out.println(getClass().getName() + " was initialized");
+ }
+ if(_destroyed)
+ {
+ System.out.println(getClass().getName() + " was destroyed");
+ }
+ }
+ finally
+ {
+ super.finalize();
+ }
+ }
+ }
+}
diff --git a/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginTwoFactory.java b/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginTwoFactory.java
new file mode 100644
index 00000000000..40b4658abdc
--- /dev/null
+++ b/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginTwoFactory.java
@@ -0,0 +1,42 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.plugin.plugins;
+
+public class PluginTwoFactory implements Ice.PluginFactory
+{
+ @Override
+ public Ice.Plugin create(Ice.Communicator communicator, String name, String[] args)
+ {
+ return new PluginTwo(communicator);
+ }
+
+ static class PluginTwo extends BasePlugin
+ {
+ public PluginTwo(Ice.Communicator communicator)
+ {
+ super(communicator);
+ }
+
+ @Override
+ public void initialize()
+ {
+ _other = (BasePlugin)_communicator.getPluginManager().getPlugin("PluginOne");
+ test(_other.isInitialized());
+ _initialized = true;
+ }
+
+ @Override
+ public void destroy()
+ {
+ _destroyed = true;
+ test(!_other.isDestroyed());
+ }
+ }
+}
diff --git a/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginTwoFailFactory.java b/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginTwoFailFactory.java
new file mode 100644
index 00000000000..8d4928953ce
--- /dev/null
+++ b/java-compat/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginTwoFailFactory.java
@@ -0,0 +1,68 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.plugin.plugins;
+
+public class PluginTwoFailFactory implements Ice.PluginFactory
+{
+ @Override
+ public Ice.Plugin create(Ice.Communicator communicator, String name, String[] args)
+ {
+ return new PluginTwoFail(communicator);
+ }
+
+ static class PluginTwoFail extends BasePluginFail
+ {
+ public PluginTwoFail(Ice.Communicator communicator)
+ {
+ super(communicator);
+ }
+
+ @Override
+ public void initialize()
+ {
+ _one = (BasePluginFail)_communicator.getPluginManager().getPlugin("PluginOneFail");
+ test(_one.isInitialized());
+ _three = (BasePluginFail)_communicator.getPluginManager().getPlugin("PluginThreeFail");
+ test(!_three.isInitialized());
+ _initialized = true;
+ }
+
+ @Override
+ public void destroy()
+ {
+ test(!_one.isDestroyed());
+ //
+ // Not destroyed because initialize fails.
+ //
+ test(!_three.isDestroyed());
+ _destroyed = true;
+ }
+
+ @Override
+ protected void finalize() throws Throwable
+ {
+ try
+ {
+ if(!_initialized)
+ {
+ System.out.println(getClass().getName() + " not initialized");
+ }
+ if(!_destroyed)
+ {
+ System.out.println(getClass().getName() + " not destroyed");
+ }
+ }
+ finally
+ {
+ super.finalize();
+ }
+ }
+ }
+}
diff --git a/java-compat/test/slice.gradle b/java-compat/test/slice.gradle
new file mode 100644
index 00000000000..8ffeca59ed1
--- /dev/null
+++ b/java-compat/test/slice.gradle
@@ -0,0 +1,85 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+task testSliceTask {
+ slice {
+ java {
+ set1 {
+ files = fileTree(dir: testDir, includes:['Ice/adapterDeactivation/*.ice',
+ 'Ice/ami/*.ice',
+ 'Ice/admin/*.ice',
+ 'Ice/background/*.ice',
+ 'Ice/binding/*.ice',
+ 'Ice/classLoader/*.ice',
+ 'Ice/custom/*.ice',
+ 'Ice/defaultServant/*.ice',
+ 'Ice/defaultValue/*.ice',
+ 'Ice/dispatcher/*.ice',
+ 'Ice/echo/*.ice',
+ 'Ice/exceptions/*.ice',
+ 'Ice/facets/*.ice',
+ 'Ice/faultTolerance/*.ice',
+ 'Ice/hash/*.ice',
+ 'Ice/hold/*.ice',
+ 'Ice/info/*.ice',
+ 'Ice/inheritance/*.ice',
+ 'Ice/interceptor/*.ice',
+ 'Ice/interrupt/*.ice',
+ 'Ice/invoke/*.ice',
+ 'Ice/location/*.ice',
+ 'Ice/metrics/*.ice',
+ 'Ice/networkProxy/*.ice',
+ 'Ice/proxy/*.ice',
+ 'Ice/retry/*.ice',
+ 'Ice/seqMapping/*.ice',
+ 'Ice/servantLocator/*.ice',
+ 'Ice/serialize/*.ice',
+ 'Ice/slicing/exceptions/*.ice',
+ 'Ice/slicing/objects/*.ice',
+ 'Ice/timeout/*.ice',
+ 'Ice/acm/*.ice',
+ 'Ice/throughput/*.ice',
+ 'Ice/threadPoolPriority/*.ice',
+ 'Ice/udp/*.ice',
+ 'Ice/objects/*.ice',
+ 'Ice/optional/*.ice',
+ 'Ice/stream/*.ice',
+ 'Ice/enums/*.ice',
+ 'Glacier2/router/*.ice',
+ 'Glacier2/sessionHelper/*.ice',
+ 'IceDiscovery/simple/*.ice',
+ 'IceGrid/simple/*.ice',
+ 'IceBox/admin/*.ice',
+ 'IceBox/configuration/*.ice',
+ 'IceSSL/configuration/*.ice',
+ 'Slice/keyword/*.ice',
+ 'Slice/macros/*.ice',
+ 'Slice/structure/*.ice'])
+ }
+ set2 {
+ args = "--tie"
+ files = fileTree(dir: testDir, includes:['Ice/operations/*.ice'])
+ }
+ set4 {
+ args = "--checksum test.Ice.checksum.Test.SliceChecksums"
+ files = fileTree(dir: testDir, includes:['Ice/checksum/Test.ice',
+ 'Ice/checksum/Types.ice'])
+ }
+ set5 {
+ include = ["${testDir}/Ice/packagemd"]
+ files = fileTree(dir: testDir, includes:['Ice/packagemd/*.ice'])
+ }
+ set6 {
+ args = "--checksum test.Ice.checksum.server.Test.SliceChecksums"
+ files = fileTree(dir: testDir, includes:['Ice/checksum/TestServer.ice',
+ 'Ice/checksum/TypesServer.ice'])
+ }
+ }
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Glacier2/router/Callback.ice b/java-compat/test/src/main/java/test/Glacier2/router/Callback.ice
new file mode 100644
index 00000000000..95b9e99e8f7
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Glacier2/router/Callback.ice
@@ -0,0 +1,40 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Glacier2.router"]]
+module Test
+{
+
+exception CallbackException
+{
+ double someValue;
+ string someString;
+};
+
+interface CallbackReceiver
+{
+ void callback();
+
+ void callbackEx()
+ throws CallbackException;
+};
+
+interface Callback
+{
+ void initiateCallback(CallbackReceiver* proxy);
+
+ void initiateCallbackEx(CallbackReceiver* proxy)
+ throws CallbackException;
+
+ void shutdown();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Glacier2/router/CallbackI.java b/java-compat/test/src/main/java/test/Glacier2/router/CallbackI.java
new file mode 100644
index 00000000000..238b760b11f
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Glacier2/router/CallbackI.java
@@ -0,0 +1,40 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Glacier2.router;
+
+import test.Glacier2.router.Test.CallbackException;
+import test.Glacier2.router.Test.CallbackReceiverPrx;
+import test.Glacier2.router.Test._CallbackDisp;
+
+final class CallbackI extends _CallbackDisp
+{
+ CallbackI()
+ {
+ }
+
+ public void
+ initiateCallback(CallbackReceiverPrx proxy, Ice.Current current)
+ {
+ proxy.callback(current.ctx);
+ }
+
+ public void
+ initiateCallbackEx(CallbackReceiverPrx proxy, Ice.Current current)
+ throws CallbackException
+ {
+ proxy.callbackEx(current.ctx);
+ }
+
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Glacier2/router/CallbackReceiverI.java b/java-compat/test/src/main/java/test/Glacier2/router/CallbackReceiverI.java
new file mode 100644
index 00000000000..27c1778087d
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Glacier2/router/CallbackReceiverI.java
@@ -0,0 +1,59 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Glacier2.router;
+
+import test.Glacier2.router.Test.CallbackException;
+import test.Glacier2.router.Test._CallbackReceiverDisp;
+
+final class CallbackReceiverI extends _CallbackReceiverDisp
+{
+ CallbackReceiverI()
+ {
+ _callback = false;
+ }
+
+ public synchronized void
+ callback(Ice.Current current)
+ {
+ assert(!_callback);
+ _callback = true;
+ notify();
+ }
+
+ public void
+ callbackEx(Ice.Current current)
+ throws CallbackException
+ {
+ callback(current);
+ CallbackException ex = new CallbackException();
+ ex.someValue = 3.14;
+ ex.someString = "3.14";
+ throw ex;
+ }
+
+ synchronized void
+ callbackOK()
+ {
+ while(!_callback)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ _callback = false;
+ }
+
+ private boolean _callback;
+}
diff --git a/java-compat/test/src/main/java/test/Glacier2/router/Client.java b/java-compat/test/src/main/java/test/Glacier2/router/Client.java
new file mode 100644
index 00000000000..5bec46a2cec
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Glacier2/router/Client.java
@@ -0,0 +1,484 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Glacier2.router;
+
+import java.io.PrintWriter;
+
+import test.Glacier2.router.Test.CallbackException;
+import test.Glacier2.router.Test.CallbackPrx;
+import test.Glacier2.router.Test.CallbackPrxHelper;
+import test.Glacier2.router.Test.CallbackReceiverPrx;
+import test.Glacier2.router.Test.CallbackReceiverPrxHelper;
+
+
+public class Client extends test.Util.Application
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public int
+ run(String[] args)
+ {
+ Ice.ObjectPrx routerBase;
+
+ PrintWriter out = getWriter();
+ {
+ out.print("testing stringToProxy for router... ");
+ out.flush();
+ routerBase = communicator().stringToProxy("Glacier2/router:default -p 12347");
+ out.println("ok");
+ }
+
+ Glacier2.RouterPrx router;
+
+ {
+ out.print("testing checked cast for router... ");
+ out.flush();
+ router = Glacier2.RouterPrxHelper.checkedCast(routerBase);
+ test(router != null);
+ out.println("ok");
+ }
+
+ {
+ out.print("testing router finder... ");
+ out.flush();
+ Ice.RouterFinderPrx finder = Ice.RouterFinderPrxHelper.uncheckedCast(
+ communicator().stringToProxy("Ice/RouterFinder:default -p 12347"));
+ test(finder.getRouter().ice_getIdentity().equals(router.ice_getIdentity()));
+ out.println("ok");
+ }
+
+ {
+ out.print("installing router with communicator... ");
+ out.flush();
+ communicator().setDefaultRouter(router);
+ out.println("ok");
+ }
+
+ {
+ out.print("getting the session timeout... ");
+ out.flush();
+ long timeout = router.getSessionTimeout();
+ test(timeout == 30);
+ out.println("ok");
+ }
+
+ Ice.ObjectPrx base;
+
+ {
+ out.print("testing stringToProxy for server object... ");
+ out.flush();
+ base = communicator().stringToProxy("c1/callback:tcp -p 12010");
+ out.println("ok");
+ }
+
+ {
+ out.print("trying to ping server before session creation... ");
+ out.flush();
+ try
+ {
+ base.ice_ping();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ out.println("ok");
+ }
+ catch(Ice.SocketException ex)
+ {
+ //
+ // The JSSE implementation in the AIX JDK appears to have a
+ // bug that causes a "bad certificate" exception to be raised
+ // when the connection is forcefully dropped and a retry occurs.
+ //
+ if(System.getProperty("os.name").equals("AIX"))
+ {
+ out.println("ok");
+ }
+ else
+ {
+ test(false);
+ }
+ }
+ }
+
+ {
+ out.print("trying to create session with wrong password... ");
+ out.flush();
+ try
+ {
+ router.createSession("userid", "xxx");
+ test(false);
+ }
+ catch(Glacier2.PermissionDeniedException ex)
+ {
+ out.println("ok");
+ }
+ catch(Glacier2.CannotCreateSessionException ex)
+ {
+ test(false);
+ }
+ }
+
+ {
+ out.print("trying to destroy non-existing session... ");
+ out.flush();
+ try
+ {
+ router.destroySession();
+ test(false);
+ }
+ catch(Glacier2.SessionNotExistException ex)
+ {
+ out.println("ok");
+ }
+ }
+
+ {
+ out.print("creating session with correct password... ");
+ out.flush();
+ try
+ {
+ router.createSession("userid", "abc123");
+ }
+ catch(Glacier2.PermissionDeniedException ex)
+ {
+ test(false);
+ }
+ catch(Glacier2.CannotCreateSessionException ex)
+ {
+ test(false);
+ }
+ out.println("ok");
+ }
+
+ {
+ out.print("trying to create a second session... ");
+ out.flush();
+ try
+ {
+ router.createSession("userid", "abc123");
+ test(false);
+ }
+ catch(Glacier2.PermissionDeniedException ex)
+ {
+ test(false);
+ }
+ catch(Glacier2.CannotCreateSessionException ex)
+ {
+ out.println("ok");
+ }
+ }
+
+ {
+ out.print("pinging server after session creation... ");
+ out.flush();
+ base.ice_ping();
+ out.println("ok");
+ }
+
+ CallbackPrx twoway;
+
+ {
+ out.print("testing checked cast for server object... ");
+ out.flush();
+ twoway = CallbackPrxHelper.checkedCast(base);
+ test(twoway != null);
+ out.println("ok");
+ }
+
+ Ice.ObjectAdapter adapter;
+
+ {
+ out.print("creating and activating callback receiver adapter... ");
+ out.flush();
+ communicator().getProperties().setProperty("Ice.PrintAdapterReady", "0");
+ adapter = communicator().createObjectAdapterWithRouter("CallbackReceiverAdapter", router);
+ adapter.activate();
+ out.println("ok");
+ }
+
+ String category;
+
+ {
+ out.print("getting category from router... ");
+ out.flush();
+ category = router.getCategoryForClient();
+ out.println("ok");
+ }
+
+ CallbackReceiverI callbackReceiverImpl;
+ Ice.Object callbackReceiver;
+ CallbackReceiverPrx twowayR;
+ CallbackReceiverPrx fakeTwowayR;
+
+ {
+ out.print("creating and adding callback receiver object... ");
+ out.flush();
+ callbackReceiverImpl = new CallbackReceiverI();
+ callbackReceiver = callbackReceiverImpl;
+ Ice.Identity callbackReceiverIdent = new Ice.Identity();
+ callbackReceiverIdent.name = "callbackReceiver";
+ callbackReceiverIdent.category = category;
+ twowayR = CallbackReceiverPrxHelper.uncheckedCast(adapter.add(callbackReceiver, callbackReceiverIdent));
+ Ice.Identity fakeCallbackReceiverIdent = new Ice.Identity();
+ fakeCallbackReceiverIdent.name = "callbackReceiver";
+ fakeCallbackReceiverIdent.category = "dummy";
+ fakeTwowayR = CallbackReceiverPrxHelper.uncheckedCast(
+ adapter.add(callbackReceiver, fakeCallbackReceiverIdent));
+ out.println("ok");
+ }
+
+ {
+ out.print("testing oneway callback... ");
+ out.flush();
+ CallbackPrx oneway = CallbackPrxHelper.uncheckedCast(twoway.ice_oneway());
+ CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_oneway());
+ java.util.Map<String, String> context = new java.util.HashMap<String, String>();
+ context.put("_fwd", "o");
+ oneway.initiateCallback(onewayR, context);
+ callbackReceiverImpl.callbackOK();
+ out.println("ok");
+ }
+
+ {
+ out.print("testing twoway callback... ");
+ out.flush();
+ java.util.Map<String, String> context = new java.util.HashMap<String, String>();
+ context.put("_fwd", "t");
+ twoway.initiateCallback(twowayR, context);
+ callbackReceiverImpl.callbackOK();
+ out.println("ok");
+ }
+
+ {
+ out.print("ditto, but with user exception... ");
+ out.flush();
+ java.util.Map<String, String> context = new java.util.HashMap<String, String>();
+ context.put("_fwd", "t");
+ try
+ {
+ twoway.initiateCallbackEx(twowayR, context);
+ test(false);
+ }
+ catch(CallbackException ex)
+ {
+ test(ex.someValue == 3.14);
+ test(ex.someString.equals("3.14"));
+ }
+ callbackReceiverImpl.callbackOK();
+ out.println("ok");
+ }
+
+ {
+ out.print("trying twoway callback with fake category... ");
+ out.flush();
+ java.util.Map<String, String> context = new java.util.HashMap<String, String>();
+ context.put("_fwd", "t");
+ try
+ {
+ twoway.initiateCallback(fakeTwowayR, context);
+ test(false);
+ }
+ catch(Ice.ObjectNotExistException ex)
+ {
+ out.println("ok");
+ }
+ }
+
+ {
+ out.print("testing whether other allowed category is accepted... ");
+ out.flush();
+ java.util.Map<String, String> context = new java.util.HashMap<String, String>();
+ context.put("_fwd", "t");
+ CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast(
+ twoway.ice_identity(Ice.Util.stringToIdentity("c2/callback")));
+ otherCategoryTwoway.initiateCallback(twowayR, context);
+ callbackReceiverImpl.callbackOK();
+ out.println("ok");
+ }
+
+ {
+ out.print("testing whether disallowed category gets rejected... ");
+ out.flush();
+ java.util.Map<String, String> context = new java.util.HashMap<String, String>();
+ context.put("_fwd", "t");
+ try
+ {
+ CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast(
+ twoway.ice_identity(Ice.Util.stringToIdentity("c3/callback")));
+ otherCategoryTwoway.initiateCallback(twowayR, context);
+ test(false);
+ }
+ catch(Ice.ObjectNotExistException ex)
+ {
+ out.println("ok");
+ }
+ }
+
+ {
+ out.print("testing whether user-id as category is accepted... ");
+ out.flush();
+ java.util.Map<String, String> context = new java.util.HashMap<String, String>();
+ context.put("_fwd", "t");
+ CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast(
+ twoway.ice_identity(Ice.Util.stringToIdentity("_userid/callback")));
+ otherCategoryTwoway.initiateCallback(twowayR, context);
+ callbackReceiverImpl.callbackOK();
+ out.println("ok");
+ }
+
+ {
+ out.print("testing server shutdown... ");
+ out.flush();
+ twoway.shutdown();
+ // No ping, otherwise the router prints a warning message if it's
+ // started with --Ice.Warn.Connections.
+ out.println("ok");
+ /*
+ try
+ {
+ base.ice_ping();
+ test(false);
+ }
+ // If we use the glacier router, the exact exception reason gets
+ // lost.
+ catch(Ice.UnknownLocalException ex)
+ {
+ System.out.println("ok");
+ }
+ */
+ }
+
+ {
+ out.print("destroying session... ");
+ out.flush();
+ try
+ {
+ router.destroySession();
+ }
+ catch(Glacier2.SessionNotExistException ex)
+ {
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ out.println("ok");
+ }
+
+ {
+ out.print("trying to ping server after session destruction... ");
+ out.flush();
+ try
+ {
+ base.ice_ping();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ out.println("ok");
+ }
+ catch(Ice.SocketException ex)
+ {
+ //
+ // The JSSE implementation in the AIX JDK appears to have a
+ // bug that causes a "bad certificate" exception to be raised
+ // when the connection is forcefully dropped and a retry occurs.
+ //
+ if(System.getProperty("os.name").equals("AIX"))
+ {
+ out.println("ok");
+ }
+ else
+ {
+ test(false);
+ }
+ }
+ }
+
+ if(args.length >= 1 && args[0].equals("--shutdown"))
+ {
+ {
+ out.print("uninstalling router with communicator... ");
+ out.flush();
+ communicator().setDefaultRouter(null);
+ out.println("ok");
+ }
+
+ Ice.ObjectPrx processBase;
+
+ {
+ out.print("testing stringToProxy for process object... ");
+ processBase = communicator().stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348");
+ out.println("ok");
+ }
+
+/*
+ {
+ out.print("uninstalling router with process object... ");
+ processBase.ice_router(null);
+ out.println("ok");
+ }
+*/
+
+ Ice.ProcessPrx process;
+
+ {
+ out.print("testing checked cast for admin object... ");
+ process = Ice.ProcessPrxHelper.checkedCast(processBase);
+ test(process != null);
+ out.println("ok");
+ }
+
+ out.print("testing Glacier2 shutdown... ");
+ process.shutdown();
+ try
+ {
+ process.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ out.println("ok");
+ }
+ }
+
+ return 0;
+ }
+
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.Package.Test", "test.Glacier2.router");
+
+ return initData;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Glacier2/router/Server.java b/java-compat/test/src/main/java/test/Glacier2/router/Server.java
new file mode 100644
index 00000000000..562b8647b4e
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Glacier2/router/Server.java
@@ -0,0 +1,51 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Glacier2.router;
+
+public class Server extends test.Util.Application
+{
+ public int
+ run(String[] args)
+ {
+ communicator().getProperties().setProperty("CallbackAdapter.Endpoints", "tcp -p 12010");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter");
+ adapter.add(new CallbackI(),
+ Ice.Util.stringToIdentity("c1/callback")); // The test allows "c1" as category.
+ adapter.add(new CallbackI(),
+ Ice.Util.stringToIdentity("c2/callback")); // The test allows "c2" as category.
+ adapter.add(new CallbackI(),
+ Ice.Util.stringToIdentity("c3/callback")); // The test rejects "c3" as category.
+ adapter.add(new CallbackI(),
+ Ice.Util.stringToIdentity("_userid/callback")); // The test allows the prefixed userid.
+ adapter.activate();
+ communicator().waitForShutdown();
+ return 0;
+ }
+
+
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Glacier2.router");
+
+ return initData;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Server c = new Server();
+ int status = c.main("Server", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Glacier2/router/run.py b/java-compat/test/src/main/java/test/Glacier2/router/run.py
new file mode 100755
index 00000000000..dc815f8eed0
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Glacier2/router/run.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+router = os.path.join(TestUtil.getCppBinDir(), "glacier2router")
+
+#
+# Generate the crypt passwords file
+#
+TestUtil.hashPasswords(os.path.join(os.getcwd(), "passwords"), {"userid": "abc123"})
+
+args = ' --Ice.Warn.Dispatch=0' + \
+ ' --Ice.Warn.Connections=0' + \
+ ' --Glacier2.Filter.Category.Accept="c1 c2"' + \
+ ' --Glacier2.Filter.Category.AcceptUser="2"' + \
+ ' --Glacier2.SessionTimeout="30"' + \
+ ' --Glacier2.Client.Endpoints="default -p 12347"' + \
+ ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1"' \
+ ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348"' + \
+ ' --Ice.Admin.InstanceName=Glacier2' + \
+ ' --Glacier2.CryptPasswords="' + os.path.join(os.getcwd(), "passwords") + '"'
+
+sys.stdout.write("starting router... ")
+sys.stdout.flush()
+routerConfig = TestUtil.DriverConfig("server")
+routerConfig.lang = "cpp"
+starterProc = TestUtil.startServer(router, args, count=2, config=routerConfig)
+print("ok")
+
+TestUtil.clientServerTest()
+
+TestUtil.clientServerTest(additionalClientOptions=" --shutdown")
+
+starterProc.waitTestSuccess()
diff --git a/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Callback.ice b/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Callback.ice
new file mode 100644
index 00000000000..b72bf2bb1c1
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Callback.ice
@@ -0,0 +1,41 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Glacier2.sessionHelper"]]
+module Test
+{
+
+exception CallbackException
+{
+ double someValue;
+ string someString;
+};
+
+interface CallbackReceiver
+{
+ void callback();
+
+ void callbackEx()
+ throws CallbackException;
+};
+
+interface Callback
+{
+ void initiateCallback(CallbackReceiver* proxy);
+
+ void initiateCallbackEx(CallbackReceiver* proxy)
+ throws CallbackException;
+
+ void shutdown();
+};
+
+};
+
diff --git a/java-compat/test/src/main/java/test/Glacier2/sessionHelper/CallbackI.java b/java-compat/test/src/main/java/test/Glacier2/sessionHelper/CallbackI.java
new file mode 100644
index 00000000000..94826cf89dc
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Glacier2/sessionHelper/CallbackI.java
@@ -0,0 +1,40 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Glacier2.sessionHelper;
+
+import test.Glacier2.sessionHelper.Test.CallbackException;
+import test.Glacier2.sessionHelper.Test.CallbackReceiverPrx;
+import test.Glacier2.sessionHelper.Test._CallbackDisp;
+
+final class CallbackI extends _CallbackDisp
+{
+ CallbackI()
+ {
+ }
+
+ public void
+ initiateCallback(CallbackReceiverPrx proxy, Ice.Current current)
+ {
+ proxy.callback(current.ctx);
+ }
+
+ public void
+ initiateCallbackEx(CallbackReceiverPrx proxy, Ice.Current current)
+ throws CallbackException
+ {
+ proxy.callbackEx(current.ctx);
+ }
+
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Client.java b/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Client.java
new file mode 100644
index 00000000000..94325f9a9c7
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Client.java
@@ -0,0 +1,541 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Glacier2.sessionHelper;
+
+import javax.swing.SwingUtilities;
+import java.io.PrintWriter;
+import test.Glacier2.sessionHelper.Test.CallbackPrx;
+import test.Glacier2.sessionHelper.Test.CallbackPrxHelper;
+
+public class Client extends test.Util.Application
+{
+ Client()
+ {
+ out = getWriter();
+ me = this;
+ }
+
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ _initData = createInitializationData();
+ _initData.properties = Ice.Util.createProperties(argsH);
+ _initData.properties.setProperty("Ice.Default.Router", "Glacier2/router:default -p 12347");
+ _initData.dispatcher = new Ice.Dispatcher()
+ {
+ @Override
+ public void
+ dispatch(Runnable runnable, Ice.Connection connection)
+ {
+ SwingUtilities.invokeLater(runnable);
+ }
+ };
+
+ return _initData;
+ }
+
+ @Override
+ public int run(String[] args)
+ {
+ String protocol = communicator().getProperties().getPropertyWithDefault("Ice.Default.Protocol", "tcp");
+ String host = communicator().getProperties().getPropertyWithDefault("Ice.Default.Host", "127.0.0.1");
+
+ _factory = new Glacier2.SessionFactoryHelper(_initData, new Glacier2.SessionCallback()
+ {
+ @Override
+ public void
+ connected(Glacier2.SessionHelper session)
+ throws Glacier2.SessionNotExistException
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ disconnected(Glacier2.SessionHelper session)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ connectFailed(Glacier2.SessionHelper session, Throwable exception)
+ {
+ try
+ {
+ throw exception;
+ }
+ catch(Glacier2.PermissionDeniedException ex)
+ {
+ out.println("ok");
+ synchronized(test.Glacier2.sessionHelper.Client.this)
+ {
+ test.Glacier2.sessionHelper.Client.wakeUp();
+ }
+ }
+ catch(Throwable ex)
+ {
+ test(false);
+ }
+ }
+
+ @Override
+ public void
+ createdCommunicator(Glacier2.SessionHelper session)
+ {
+ test(session.communicator() != null);
+ }
+ });
+
+ //
+ // Test to create a session with wrong userid/password
+ //
+ synchronized(this)
+ {
+ out.print("testing SessionHelper connect with wrong userid/password... ");
+ out.flush();
+
+ _session = _factory.connect("userid", "xxx");
+ while(true)
+ {
+ try
+ {
+ wait();
+ break;
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+ }
+
+ _initData.properties.setProperty("Ice.Default.Router", "");
+ _factory = new Glacier2.SessionFactoryHelper(_initData, new Glacier2.SessionCallback()
+ {
+ @Override
+ public void
+ connected(Glacier2.SessionHelper session)
+ throws Glacier2.SessionNotExistException
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ disconnected(Glacier2.SessionHelper session)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ connectFailed(Glacier2.SessionHelper session, Throwable exception)
+ {
+ try
+ {
+ throw exception;
+ }
+ catch(Ice.CommunicatorDestroyedException ex)
+ {
+ out.println("ok");
+ synchronized(test.Glacier2.sessionHelper.Client.this)
+ {
+ test.Glacier2.sessionHelper.Client.wakeUp();
+ }
+ }
+ catch(Throwable ex)
+ {
+ test(false);
+ }
+ }
+
+ @Override
+ public void
+ createdCommunicator(Glacier2.SessionHelper session)
+ {
+ test(session.communicator() != null);
+ }
+ });
+
+ synchronized(this)
+ {
+ out.print("testing SessionHelper connect interrupt... ");
+ out.flush();
+ _factory.setRouterHost(host);
+ _factory.setPort(12011);
+ _factory.setProtocol(protocol);
+ _session = _factory.connect("userid", "abc123");
+
+ while(true)
+ {
+ try
+ {
+ Thread.sleep(100);
+ break;
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+ _session.destroy();
+
+ while(true)
+ {
+ try
+ {
+ wait();
+ break;
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+ };
+
+ _factory = new Glacier2.SessionFactoryHelper(_initData, new Glacier2.SessionCallback()
+ {
+ @Override
+ public void
+ connected(Glacier2.SessionHelper session)
+ throws Glacier2.SessionNotExistException
+ {
+ out.println("ok");
+ synchronized(test.Glacier2.sessionHelper.Client.this)
+ {
+ test.Glacier2.sessionHelper.Client.wakeUp();
+ }
+ }
+
+ @Override
+ public void
+ disconnected(Glacier2.SessionHelper session)
+ {
+ out.println("ok");
+ synchronized(test.Glacier2.sessionHelper.Client.this)
+ {
+ test.Glacier2.sessionHelper.Client.wakeUp();
+ }
+ }
+
+ @Override
+ public void
+ connectFailed(Glacier2.SessionHelper session, Throwable ex)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ createdCommunicator(Glacier2.SessionHelper session)
+ {
+ test(session.communicator() != null);
+ }
+ });
+
+ synchronized(this)
+ {
+ out.print("testing SessionHelper connect... ");
+ out.flush();
+ _factory.setRouterHost(host);
+ _factory.setPort(12347);
+ _factory.setProtocol(protocol);
+ _session = _factory.connect("userid", "abc123");
+ while(true)
+ {
+ try
+ {
+ wait();
+ break;
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+
+ out.print("testing SessionHelper isConnected after connect... ");
+ out.flush();
+ test(_session.isConnected());
+ out.println("ok");
+
+ out.print("testing SessionHelper categoryForClient after connect... ");
+ out.flush();
+ try
+ {
+ test(!_session.categoryForClient().equals(""));
+ }
+ catch(Glacier2.SessionNotExistException ex)
+ {
+ test(false);
+ }
+ out.println("ok");
+
+// try
+// {
+// test(_session.session() != null);
+// }
+// catch(Glacier2.SessionNotExistException ex)
+// {
+// test(false);
+// }
+
+ out.print("testing stringToProxy for server object... ");
+ out.flush();
+ Ice.ObjectPrx base = _session.communicator().stringToProxy("callback:default -p 12010");
+ out.println("ok");
+
+ out.print("pinging server after session creation... ");
+ out.flush();
+ base.ice_ping();
+ out.println("ok");
+
+ out.print("testing checked cast for server object... ");
+ out.flush();
+ CallbackPrx twoway = CallbackPrxHelper.checkedCast(base);
+ test(twoway != null);
+ out.println("ok");
+
+ out.print("testing server shutdown... ");
+ out.flush();
+ twoway.shutdown();
+ out.println("ok");
+
+ test(_session.communicator() != null);
+ out.print("testing SessionHelper destroy... ");
+ out.flush();
+ _session.destroy();
+ while(true)
+ {
+ try
+ {
+ wait();
+ break;
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+
+ out.print("testing SessionHelper isConnected after destroy... ");
+ out.flush();
+ test(_session.isConnected() == false);
+ out.println("ok");
+
+ out.print("testing SessionHelper categoryForClient after destroy... ");
+ out.flush();
+ try
+ {
+ test(!_session.categoryForClient().equals(""));
+ test(false);
+ }
+ catch(Glacier2.SessionNotExistException ex)
+ {
+ }
+ out.println("ok");
+
+ out.print("testing SessionHelper session after destroy... ");
+ try
+ {
+ _session.session();
+ test(false);
+ }
+ catch(Glacier2.SessionNotExistException ex)
+ {
+ }
+ out.println("ok");
+
+ out.print("testing SessionHelper communicator after destroy... ");
+ out.flush();
+ try
+ {
+ test(_session.communicator() != null);
+ _session.communicator().stringToProxy("dummy");
+ test(false);
+ }
+ catch(Ice.CommunicatorDestroyedException ex)
+ {
+ }
+ out.println("ok");
+
+
+ out.print("uninstalling router with communicator... ");
+ out.flush();
+ communicator().setDefaultRouter(null);
+ out.println("ok");
+
+ Ice.ObjectPrx processBase;
+ {
+ out.print("testing stringToProxy for process object... ");
+ processBase = communicator().stringToProxy("Glacier2/admin -f Process:default -h \"" + host + "\" -p 12348");
+ out.println("ok");
+ }
+
+
+ Ice.ProcessPrx process;
+ {
+ out.print("testing checked cast for admin object... ");
+ process = Ice.ProcessPrxHelper.checkedCast(processBase);
+ test(process != null);
+ out.println("ok");
+ }
+
+ out.print("testing Glacier2 shutdown... ");
+ process.shutdown();
+ try
+ {
+ process.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ out.println("ok");
+ }
+ }
+
+ _factory = new Glacier2.SessionFactoryHelper(_initData, new Glacier2.SessionCallback()
+ {
+ @Override
+ public void
+ connected(Glacier2.SessionHelper session)
+ throws Glacier2.SessionNotExistException
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ disconnected(Glacier2.SessionHelper session)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ connectFailed(Glacier2.SessionHelper session, Throwable exception)
+ {
+ try
+ {
+ throw exception;
+ }
+ catch(Ice.ConnectFailedException ex)
+ {
+ out.println("ok");
+ synchronized(test.Glacier2.sessionHelper.Client.this)
+ {
+ test.Glacier2.sessionHelper.Client.wakeUp();
+ }
+ }
+ catch(Throwable ex)
+ {
+ test(false);
+ }
+ }
+
+ @Override
+ public void
+ createdCommunicator(Glacier2.SessionHelper session)
+ {
+ test(session.communicator() != null);
+ }
+ });
+
+ //
+ // Wait a bit to ensure glaci2router has been shutdown.
+ //
+ while(true)
+ {
+ try
+ {
+ Thread.sleep(100);
+ break;
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+
+ synchronized(this)
+ {
+ out.print("testing SessionHelper connect after router shutdown... ");
+ out.flush();
+
+ _factory.setRouterHost(host);
+ _factory.setPort(12347);
+ _factory.setProtocol(protocol);
+ _session = _factory.connect("userid", "abc123");
+ while(true)
+ {
+ try
+ {
+ wait();
+ break;
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+
+ out.print("testing SessionHelper isConnect after connect failure... ");
+ out.flush();
+ test(_session.isConnected() == false);
+ out.println("ok");
+
+ out.print("testing SessionHelper communicator after connect failure... ");
+ out.flush();
+ try
+ {
+ test(_session.communicator() != null);
+ _session.communicator().stringToProxy("dummy");
+ test(false);
+ }
+ catch(Ice.CommunicatorDestroyedException ex)
+ {
+ }
+ out.println("ok");
+
+ out.print("testing SessionHelper destroy after connect failure... ");
+ out.flush();
+ _session.destroy();
+ out.println("ok");
+ }
+
+ return 0;
+ }
+
+ public static void
+ wakeUp()
+ {
+ me.notify();
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+
+ private Glacier2.SessionHelper _session;
+ private Glacier2.SessionFactoryHelper _factory;
+ private Ice.InitializationData _initData;
+ static public Client me;
+ final public PrintWriter out;
+}
diff --git a/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Server.java b/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Server.java
new file mode 100644
index 00000000000..5e2108c78e0
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Server.java
@@ -0,0 +1,47 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Glacier2.sessionHelper;
+
+public class Server extends test.Util.Application
+{
+ public int
+ run(String[] args)
+ {
+ communicator().getProperties().setProperty("DeactivatedAdapter.Endpoints", "default -p 12011");
+ communicator().createObjectAdapter("DeactivatedAdapter");
+
+ communicator().getProperties().setProperty("CallbackAdapter.Endpoints", "default -p 12010");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter");
+ adapter.add(new CallbackI(), Ice.Util.stringToIdentity("callback"));
+ adapter.activate();
+ communicator().waitForShutdown();
+ return 0;
+ }
+
+
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Glacier2.router");
+
+ return initData;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Server c = new Server();
+ int status = c.main("Server", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Glacier2/sessionHelper/run.py b/java-compat/test/src/main/java/test/Glacier2/sessionHelper/run.py
new file mode 100755
index 00000000000..6ce3382b360
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Glacier2/sessionHelper/run.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+router = os.path.join(TestUtil.getCppBinDir(), "glacier2router")
+
+#
+# Generate the crypt passwords file
+#
+TestUtil.hashPasswords(os.path.join(os.getcwd(), "passwords"), {"userid": "abc123"})
+
+args = ' --Ice.Warn.Dispatch=0' + \
+ ' --Ice.Warn.Connections=0' + \
+ ' --Glacier2.SessionTimeout="30"' + \
+ ' --Glacier2.Client.Endpoints="default -p 12347"' + \
+ ' --Glacier2.Server.Endpoints="default"' \
+ ' --Ice.Admin.Endpoints="default -p 12348"' + \
+ ' --Ice.Admin.InstanceName=Glacier2' + \
+ ' --Glacier2.CryptPasswords="' + os.path.join(os.getcwd(), "passwords") + '"'
+
+sys.stdout.write("starting router... ")
+sys.stdout.flush()
+routerConfig = TestUtil.DriverConfig("server")
+routerConfig.lang = "cpp"
+starterProc = TestUtil.startServer(router, args, count=2, config=routerConfig)
+print("ok")
+
+TestUtil.clientServerTest(additionalClientOptions=" --shutdown")
+
+starterProc.waitTestSuccess()
diff --git a/java-compat/test/src/main/java/test/Ice/acm/AllTests.java b/java-compat/test/src/main/java/test/Ice/acm/AllTests.java
new file mode 100644
index 00000000000..c68ba2166f5
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/acm/AllTests.java
@@ -0,0 +1,659 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.acm;
+
+import java.io.PrintWriter;
+
+import test.Ice.acm.Test.RemoteCommunicatorPrx;
+import test.Ice.acm.Test.RemoteCommunicatorPrxHelper;
+import test.Ice.acm.Test.RemoteObjectAdapterPrx;
+import test.Ice.acm.Test.TestIntfPrx;
+import test.Ice.acm.Test.TestIntfPrxHelper;
+import test.Util.Application;
+
+public class AllTests
+{
+ private static Ice.Communicator communicator;
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ static class LoggerI implements Ice.Logger
+ {
+ LoggerI(java.io.PrintWriter out)
+ {
+ _out = out;
+ }
+
+ public void start()
+ {
+ synchronized(this)
+ {
+ _started = true;
+ dump();
+ }
+ }
+
+ public void print(String msg)
+ {
+ synchronized(this)
+ {
+ _messages.add(msg);
+ if(_started)
+ {
+ dump();
+ }
+ }
+ }
+
+ public void trace(String category, String message)
+ {
+ synchronized(this)
+ {
+ _messages.add("[" + category + "] " + message);
+ if(_started)
+ {
+ dump();
+ }
+ }
+ }
+
+ public void warning(String message)
+ {
+ synchronized(this)
+ {
+ _messages.add("warning: " + message);
+ if(_started)
+ {
+ dump();
+ }
+ }
+ }
+
+ public void error(String message)
+ {
+ synchronized(this)
+ {
+ _messages.add("error: " + message);
+ if(_started)
+ {
+ dump();
+ }
+ }
+ }
+
+ public String getPrefix()
+ {
+ return "";
+ }
+
+ public Ice.Logger cloneWithPrefix(String prefix)
+ {
+ return this;
+ }
+
+ private void dump()
+ {
+ for(String line : _messages)
+ {
+ _out.println(line);
+ }
+ _messages.clear();
+ }
+
+ private boolean _started;
+ private java.util.List<String> _messages = new java.util.ArrayList<String>();
+ private java.io.PrintWriter _out;
+ };
+
+ static abstract class TestCase
+ {
+ public TestCase(Application app, String name, RemoteCommunicatorPrx com, PrintWriter out)
+ {
+ _app = app;
+ _name = name;
+ _com = com;
+ _logger = new LoggerI(out);
+
+ _clientACMTimeout = -1;
+ _clientACMClose = -1;
+ _clientACMHeartbeat = -1;
+
+ _serverACMTimeout = -1;
+ _serverACMClose = -1;
+ _serverACMHeartbeat = -1;
+
+ _heartbeat = 0;
+ _closed = false;
+ }
+
+ public void init()
+ {
+ _adapter = _com.createObjectAdapter(_serverACMTimeout, _serverACMClose, _serverACMHeartbeat);
+
+ Ice.InitializationData initData = _app.createInitializationData();
+ initData.properties = _app.communicator().getProperties()._clone();
+ initData.logger = _logger;
+ initData.properties.setProperty("Ice.ACM.Timeout", "1");
+ if(_clientACMTimeout >= 0)
+ {
+ initData.properties.setProperty("Ice.ACM.Client.Timeout", Integer.toString(_clientACMTimeout));
+ }
+ if(_clientACMClose >= 0)
+ {
+ initData.properties.setProperty("Ice.ACM.Client.Close", Integer.toString(_clientACMClose));
+ }
+ if(_clientACMHeartbeat >= 0)
+ {
+ initData.properties.setProperty("Ice.ACM.Client.Heartbeat", Integer.toString(_clientACMHeartbeat));
+ }
+ //initData.properties.setProperty("Ice.Trace.Protocol", "2");
+ //initData.properties.setProperty("Ice.Trace.Network", "2");
+ _communicator = _app.initialize(initData);
+
+ _thread = new Thread(
+ new Runnable()
+ {
+ public void
+ run()
+ {
+ TestCase.this.run();
+ }
+ });
+ }
+
+ public void start()
+ {
+ _thread.start();
+ }
+
+ public void destroy()
+ {
+ _adapter.deactivate();
+ _communicator.destroy();
+ }
+
+ public void join(PrintWriter out)
+ {
+ out.print("testing " + _name + "... ");
+ out.flush();
+ _logger.start();
+ try
+ {
+ _thread.join();
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ assert(false);
+ }
+ if(_msg == null)
+ {
+ out.println("ok");
+ }
+ else
+ {
+ out.println("failed! " + _msg);
+ test(false);
+ }
+ }
+
+ public void run()
+ {
+ TestIntfPrx proxy = TestIntfPrxHelper.uncheckedCast(_communicator.stringToProxy(
+ _adapter.getTestIntf().toString()));
+ try
+ {
+ proxy.ice_getConnection().setCloseCallback(new Ice.CloseCallback()
+ {
+ @Override
+ public void closed(Ice.Connection con)
+ {
+ synchronized(TestCase.this)
+ {
+ _closed = true;
+ TestCase.this.notify();
+ }
+ }
+ });
+
+ proxy.ice_getConnection().setHeartbeatCallback(new Ice.HeartbeatCallback()
+ {
+ @Override
+ public void heartbeat(Ice.Connection con)
+ {
+ synchronized(TestCase.this)
+ {
+ ++_heartbeat;
+ }
+ }
+ });
+
+ runTestCase(_adapter, proxy);
+ }
+ catch(Exception ex)
+ {
+ _msg = "unexpected exception:\n" + IceInternal.Ex.toString(ex);
+ }
+ }
+
+ public synchronized void waitForClosed()
+ {
+ while(!_closed)
+ {
+ long now = IceInternal.Time.currentMonotonicTimeMillis();
+ try
+ {
+ wait(1000);
+ if(IceInternal.Time.currentMonotonicTimeMillis() - now > 1000)
+ {
+ test(false); // Waited for more than 1s for close, something's wrong.
+ }
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+ }
+
+ public abstract void runTestCase(RemoteObjectAdapterPrx adapter, TestIntfPrx proxy);
+
+ public void setClientACM(int timeout, int close, int heartbeat)
+ {
+ _clientACMTimeout = timeout;
+ _clientACMClose = close;
+ _clientACMHeartbeat = heartbeat;
+ }
+
+ public void setServerACM(int timeout, int close, int heartbeat)
+ {
+ _serverACMTimeout = timeout;
+ _serverACMClose = close;
+ _serverACMHeartbeat = heartbeat;
+ }
+
+ private final Application _app;
+ private String _name;
+ private RemoteCommunicatorPrx _com;
+ private String _msg;
+ private LoggerI _logger;
+ private Thread _thread;
+
+ private Ice.Communicator _communicator;
+ private RemoteObjectAdapterPrx _adapter;
+
+ private int _clientACMTimeout;
+ private int _clientACMClose;
+ private int _clientACMHeartbeat;
+ private int _serverACMTimeout;
+ private int _serverACMClose;
+ private int _serverACMHeartbeat;
+
+ protected int _heartbeat;
+ protected boolean _closed;
+ };
+
+ static class InvocationHeartbeatTest extends TestCase
+ {
+ public InvocationHeartbeatTest(Application app, RemoteCommunicatorPrx com, java.io.PrintWriter out)
+ {
+ super(app, "invocation heartbeat", com, out);
+ }
+
+ public void runTestCase(RemoteObjectAdapterPrx adapter, TestIntfPrx proxy)
+ {
+ proxy.sleep(2);
+ test(_heartbeat >= 2);
+ }
+ }
+
+ static class InvocationHeartbeatOnHoldTest extends TestCase
+ {
+ public InvocationHeartbeatOnHoldTest(Application app, RemoteCommunicatorPrx com, java.io.PrintWriter out)
+ {
+ super(app, "invocation with heartbeat on hold", com, out);
+ // Use default ACM configuration.
+ }
+
+ public void runTestCase(RemoteObjectAdapterPrx adapter, TestIntfPrx proxy)
+ {
+ try
+ {
+ // When the OA is put on hold, connections shouldn't
+ // send heartbeats, the invocation should therefore
+ // fail.
+ proxy.sleepAndHold(10);
+ test(false);
+ }
+ catch(Ice.ConnectionTimeoutException ex)
+ {
+ adapter.activate();
+ proxy.interruptSleep();
+ waitForClosed();
+ }
+ }
+ }
+
+ static class InvocationNoHeartbeatTest extends TestCase
+ {
+ public InvocationNoHeartbeatTest(Application app, RemoteCommunicatorPrx com, java.io.PrintWriter out)
+ {
+ super(app, "invocation with no heartbeat", com, out);
+ setServerACM(1, 2, 0); // Disable heartbeat on invocations
+ }
+
+ public void runTestCase(RemoteObjectAdapterPrx adapter, TestIntfPrx proxy)
+ {
+ try
+ {
+ // Heartbeats are disabled on the server, the
+ // invocation should fail since heartbeats are
+ // expected.
+ proxy.sleep(10);
+ test(false);
+ }
+ catch(Ice.ConnectionTimeoutException ex)
+ {
+ proxy.interruptSleep();
+ waitForClosed();
+
+ synchronized(this)
+ {
+ test(_heartbeat == 0);
+ }
+ }
+ }
+ }
+
+ static class InvocationHeartbeatCloseOnIdleTest extends TestCase
+ {
+ public InvocationHeartbeatCloseOnIdleTest(Application app, RemoteCommunicatorPrx com, java.io.PrintWriter out)
+ {
+ super(app, "invocation with no heartbeat and close on idle", com, out);
+ setClientACM(1, 1, 0); // Only close on idle.
+ setServerACM(1, 2, 0); // Disable heartbeat on invocations
+ }
+
+ public void runTestCase(RemoteObjectAdapterPrx adapter, TestIntfPrx proxy)
+ {
+ // No close on invocation, the call should succeed this
+ // time.
+ proxy.sleep(2);
+
+ synchronized(this)
+ {
+ test(_heartbeat == 0);
+ test(!_closed);
+ }
+ }
+ }
+
+ static class CloseOnIdleTest extends TestCase
+ {
+ public CloseOnIdleTest(Application app, RemoteCommunicatorPrx com, java.io.PrintWriter out)
+ {
+ super(app, "close on idle", com, out);
+ setClientACM(1, 1, 0); // Only close on idle
+ }
+
+ public void runTestCase(RemoteObjectAdapterPrx adapter, TestIntfPrx proxy)
+ {
+ try
+ {
+ Thread.sleep(1500); // Idle for 1.5 second
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+
+ waitForClosed();
+
+ synchronized(this)
+ {
+ test(_heartbeat == 0);
+ }
+ }
+ }
+
+ static class CloseOnInvocationTest extends TestCase
+ {
+ public CloseOnInvocationTest(Application app, RemoteCommunicatorPrx com, java.io.PrintWriter out)
+ {
+ super(app, "close on invocation", com, out);
+ setClientACM(1, 2, 0); // Only close on invocation
+ }
+
+ public void runTestCase(RemoteObjectAdapterPrx adapter, TestIntfPrx proxy)
+ {
+ try
+ {
+ Thread.sleep(1500); // Idle for 1.5 second
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+
+ synchronized(this)
+ {
+ test(_heartbeat == 0);
+ test(!_closed);
+ }
+ }
+ }
+
+ static class CloseOnIdleAndInvocationTest extends TestCase
+ {
+ public CloseOnIdleAndInvocationTest(Application app, RemoteCommunicatorPrx com, java.io.PrintWriter out)
+ {
+ super(app, "close on idle and invocation", com, out);
+ setClientACM(1, 3, 0); // Only close on idle and invocation
+ }
+
+ public void runTestCase(RemoteObjectAdapterPrx adapter, TestIntfPrx proxy)
+ {
+ //
+ // Put the adapter on hold. The server will not respond to
+ // the graceful close. This allows to test whether or not
+ // the close is graceful or forceful.
+ //
+ adapter.hold();
+ try
+ {
+ Thread.sleep(1500); // Idle for 1.5 second
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+
+ synchronized(this)
+ {
+ test(_heartbeat == 0);
+ test(!_closed); // Not closed yet because of graceful close.
+ }
+
+ adapter.activate();
+ try
+ {
+ Thread.sleep(500);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+
+ waitForClosed();
+ }
+ }
+
+ static class ForcefulCloseOnIdleAndInvocationTest extends TestCase
+ {
+ public ForcefulCloseOnIdleAndInvocationTest(Application app, RemoteCommunicatorPrx com, java.io.PrintWriter out)
+ {
+ super(app, "forceful close on idle and invocation", com, out);
+ setClientACM(1, 4, 0); // Only close on idle and invocation
+ }
+
+ public void runTestCase(RemoteObjectAdapterPrx adapter, TestIntfPrx proxy)
+ {
+ adapter.hold();
+ try
+ {
+ Thread.sleep(1500); // Idle for 1.5 second
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ waitForClosed();
+ synchronized(this)
+ {
+ test(_heartbeat == 0);
+ }
+ }
+ }
+
+ static class HeartbeatOnIdleTest extends TestCase
+ {
+ public HeartbeatOnIdleTest(Application app, RemoteCommunicatorPrx com, java.io.PrintWriter out)
+ {
+ super(app, "heartbeat on idle", com, out);
+ setServerACM(1, -1, 2); // Enable server heartbeats.
+ }
+
+ public void runTestCase(RemoteObjectAdapterPrx adapter, TestIntfPrx proxy)
+ {
+ try
+ {
+ Thread.sleep(2000);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+
+ synchronized(this)
+ {
+ test(_heartbeat >= 3);
+ }
+ }
+ }
+
+ static class HeartbeatAlwaysTest extends TestCase
+ {
+ public HeartbeatAlwaysTest(Application app, RemoteCommunicatorPrx com, java.io.PrintWriter out)
+ {
+ super(app, "heartbeat always", com, out);
+ setServerACM(1, -1, 3); // Enable server heartbeats.
+ }
+
+ public void runTestCase(RemoteObjectAdapterPrx adapter, TestIntfPrx proxy)
+ {
+ for(int i = 0; i < 12; i++)
+ {
+ proxy.ice_ping();
+ try
+ {
+ Thread.sleep(200);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+
+ synchronized(this)
+ {
+ test(_heartbeat >= 3);
+ }
+ }
+ }
+
+ static class SetACMTest extends TestCase
+ {
+ public SetACMTest(Application app, RemoteCommunicatorPrx com, java.io.PrintWriter out)
+ {
+ super(app, "setACM/getACM", com, out);
+ setClientACM(15, 4, 0);
+ }
+
+ public void runTestCase(RemoteObjectAdapterPrx adapter, TestIntfPrx proxy)
+ {
+ Ice.ACM acm = new Ice.ACM();
+ acm = proxy.ice_getCachedConnection().getACM();
+ test(acm.timeout == 15);
+ test(acm.close == Ice.ACMClose.CloseOnIdleForceful);
+ test(acm.heartbeat == Ice.ACMHeartbeat.HeartbeatOff);
+
+ proxy.ice_getCachedConnection().setACM(null, null, null);
+ acm = proxy.ice_getCachedConnection().getACM();
+ test(acm.timeout == 15);
+ test(acm.close == Ice.ACMClose.CloseOnIdleForceful);
+ test(acm.heartbeat == Ice.ACMHeartbeat.HeartbeatOff);
+
+ proxy.ice_getCachedConnection().setACM(
+ new Ice.IntOptional(1),
+ new Ice.Optional<Ice.ACMClose>(Ice.ACMClose.CloseOnInvocationAndIdle),
+ new Ice.Optional<Ice.ACMHeartbeat>(Ice.ACMHeartbeat.HeartbeatAlways));
+ acm = proxy.ice_getCachedConnection().getACM();
+ test(acm.timeout == 1);
+ test(acm.close == Ice.ACMClose.CloseOnInvocationAndIdle);
+ test(acm.heartbeat == Ice.ACMHeartbeat.HeartbeatAlways);
+
+ // Make sure the client sends few heartbeats to the server
+ proxy.waitForHeartbeat(2);
+ }
+ }
+
+ public static void
+ allTests(test.Util.Application app, PrintWriter out)
+ {
+ Ice.Communicator communicator = app.communicator();
+ String ref = "communicator:default -p 12010";
+ RemoteCommunicatorPrx com = RemoteCommunicatorPrxHelper.uncheckedCast(communicator.stringToProxy(ref));
+
+ java.util.List<TestCase> tests = new java.util.ArrayList<TestCase>();
+
+ tests.add(new InvocationHeartbeatTest(app, com, out));
+ tests.add(new InvocationHeartbeatOnHoldTest(app, com, out));
+ tests.add(new InvocationNoHeartbeatTest(app, com, out));
+ tests.add(new InvocationHeartbeatCloseOnIdleTest(app, com, out));
+
+ tests.add(new CloseOnIdleTest(app, com, out));
+ tests.add(new CloseOnInvocationTest(app, com, out));
+ tests.add(new CloseOnIdleAndInvocationTest(app, com, out));
+ tests.add(new ForcefulCloseOnIdleAndInvocationTest(app, com, out));
+
+ tests.add(new HeartbeatOnIdleTest(app, com, out));
+ tests.add(new HeartbeatAlwaysTest(app, com, out));
+ tests.add(new SetACMTest(app, com, out));
+
+ for(TestCase test : tests)
+ {
+ test.init();
+ }
+ for(TestCase test : tests)
+ {
+ test.start();
+ }
+ for(TestCase test : tests)
+ {
+ test.join(out);
+ }
+ for(TestCase test : tests)
+ {
+ test.destroy();
+ }
+
+ out.print("shutting down... ");
+ out.flush();
+ com.shutdown();
+ out.println("ok");
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/acm/Client.java b/java-compat/test/src/main/java/test/Ice/acm/Client.java
new file mode 100644
index 00000000000..0b77fa4ff82
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/acm/Client.java
@@ -0,0 +1,36 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.acm;
+
+public class Client extends test.Util.Application
+{
+ public int run(String[] args)
+ {
+ AllTests.allTests(this, getWriter());
+ return 0;
+ }
+
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.acm");
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/acm/RemoteCommunicatorI.java b/java-compat/test/src/main/java/test/Ice/acm/RemoteCommunicatorI.java
new file mode 100644
index 00000000000..5c55f0f6b87
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/acm/RemoteCommunicatorI.java
@@ -0,0 +1,50 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.acm;
+
+import test.Ice.acm.Test.RemoteObjectAdapterPrx;
+import test.Ice.acm.Test.RemoteObjectAdapterPrxHelper;
+import test.Ice.acm.Test._RemoteCommunicatorDisp;
+
+public class RemoteCommunicatorI extends _RemoteCommunicatorDisp
+{
+ public RemoteObjectAdapterPrx
+ createObjectAdapter(int timeout, int close, int heartbeat, Ice.Current current)
+ {
+ Ice.Communicator com = current.adapter.getCommunicator();
+ Ice.Properties properties = com.getProperties();
+ String protocol = properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp");
+ String host = properties.getPropertyWithDefault("Ice.Default.Host", "127.0.0.1");
+
+ String name = java.util.UUID.randomUUID().toString();
+ if(timeout >= 0)
+ {
+ properties.setProperty(name + ".ACM.Timeout", Integer.toString(timeout));
+ }
+ if(close >= 0)
+ {
+ properties.setProperty(name + ".ACM.Close", Integer.toString(close));
+ }
+ if(heartbeat >= 0)
+ {
+ properties.setProperty(name + ".ACM.Heartbeat", Integer.toString(heartbeat));
+ }
+ properties.setProperty(name + ".ThreadPool.Size", "2");
+ Ice.ObjectAdapter adapter = com.createObjectAdapterWithEndpoints(name, protocol + " -h \"" + host + "\"");
+ return RemoteObjectAdapterPrxHelper.uncheckedCast(
+ current.adapter.addWithUUID(new RemoteObjectAdapterI(adapter)));
+ }
+
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+};
diff --git a/java-compat/test/src/main/java/test/Ice/acm/RemoteObjectAdapterI.java b/java-compat/test/src/main/java/test/Ice/acm/RemoteObjectAdapterI.java
new file mode 100644
index 00000000000..c3ef3dace67
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/acm/RemoteObjectAdapterI.java
@@ -0,0 +1,53 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.acm;
+
+import test.Ice.acm.Test.TestIntfPrx;
+import test.Ice.acm.Test.TestIntfPrxHelper;
+import test.Ice.acm.Test._RemoteObjectAdapterDisp;
+
+public class RemoteObjectAdapterI extends _RemoteObjectAdapterDisp
+{
+ public RemoteObjectAdapterI(Ice.ObjectAdapter adapter)
+ {
+ _adapter = adapter;
+ _testIntf = TestIntfPrxHelper.uncheckedCast(_adapter.add(new TestI(), Ice.Util.stringToIdentity("test")));
+ _adapter.activate();
+ }
+
+ public TestIntfPrx getTestIntf(Ice.Current current)
+ {
+ return _testIntf;
+ }
+
+ public void activate(Ice.Current current)
+ {
+ _adapter.activate();
+ }
+
+ public void hold(Ice.Current current)
+ {
+ _adapter.hold();
+ }
+
+ public void deactivate(Ice.Current current)
+ {
+ try
+ {
+ _adapter.destroy();
+ }
+ catch(Ice.ObjectAdapterDeactivatedException ex)
+ {
+ }
+ }
+
+ private Ice.ObjectAdapter _adapter;
+ private TestIntfPrx _testIntf;
+};
diff --git a/java-compat/test/src/main/java/test/Ice/acm/Server.java b/java-compat/test/src/main/java/test/Ice/acm/Server.java
new file mode 100644
index 00000000000..8df16e0f21a
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/acm/Server.java
@@ -0,0 +1,48 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.acm;
+
+public class Server extends test.Util.Application
+{
+ public int
+ run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.Identity id = Ice.Util.stringToIdentity("communicator");
+ adapter.add(new RemoteCommunicatorI(), id);
+ adapter.activate();
+
+ // Disable ready print for further adapters.
+ communicator.getProperties().setProperty("Ice.PrintAdapterReady", "0");
+
+ return WAIT;
+ }
+
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.acm");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.ACM.Timeout", "1");
+ return initData;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/acm/Test.ice b/java-compat/test/src/main/java/test/Ice/acm/Test.ice
new file mode 100644
index 00000000000..117192a2df8
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/acm/Test.ice
@@ -0,0 +1,39 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.acm"]]
+module Test
+{
+
+interface TestIntf
+{
+ void sleep(int seconds);
+ void sleepAndHold(int seconds);
+ void interruptSleep();
+ void waitForHeartbeat(int count);
+};
+
+interface RemoteObjectAdapter
+{
+ TestIntf* getTestIntf();
+ void activate();
+ void hold();
+ void deactivate();
+};
+
+interface RemoteCommunicator
+{
+ RemoteObjectAdapter* createObjectAdapter(int acmTimeout, int close, int heartbeat);
+ void shutdown();
+};
+
+};
+
diff --git a/java-compat/test/src/main/java/test/Ice/acm/TestI.java b/java-compat/test/src/main/java/test/Ice/acm/TestI.java
new file mode 100644
index 00000000000..00620c07dd0
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/acm/TestI.java
@@ -0,0 +1,80 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.acm;
+import test.Ice.acm.Test._TestIntfDisp;
+
+public class TestI extends _TestIntfDisp
+{
+ public void sleep(int delay, Ice.Current current)
+ {
+ synchronized(this)
+ {
+ try
+ {
+ wait(delay * 1000);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+ }
+
+ public void sleepAndHold(int delay, Ice.Current current)
+ {
+ synchronized(this)
+ {
+ try
+ {
+ current.adapter.hold();
+ wait(delay * 1000);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+ }
+
+ public void interruptSleep(Ice.Current current)
+ {
+ synchronized(this)
+ {
+ notifyAll();
+ }
+ }
+
+ public void waitForHeartbeat(int count, Ice.Current current)
+ {
+ final Ice.Holder<Integer> c = new Ice.Holder<Integer>(count);
+ Ice.HeartbeatCallback callback = new Ice.HeartbeatCallback()
+ {
+ synchronized public void heartbeat(Ice.Connection connection)
+ {
+ --c.value;
+ notifyAll();
+ }
+
+ };
+ current.con.setHeartbeatCallback(callback);
+
+ synchronized(callback)
+ {
+ while(c.value > 0)
+ {
+ try
+ {
+ callback.wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+ }
+ }
+};
diff --git a/java-compat/test/src/main/java/test/Ice/acm/run.py b/java-compat/test/src/main/java/test/Ice/acm/run.py
new file mode 100755
index 00000000000..0b375fb252f
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/acm/run.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys, getopt
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java
new file mode 100644
index 00000000000..d198d02414e
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java
@@ -0,0 +1,105 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.adapterDeactivation;
+
+import test.Ice.adapterDeactivation.Test.TestIntfPrx;
+import test.Ice.adapterDeactivation.Test.TestIntfPrxHelper;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static TestIntfPrx
+ allTests(test.Util.Application app, java.io.PrintWriter out)
+ {
+ Ice.Communicator communicator = app.communicator();
+ out.print("testing stringToProxy... ");
+ out.flush();
+ String ref = "test:default -p 12010";
+ Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ test(base != null);
+ out.println("ok");
+
+ out.print("testing checked cast... ");
+ out.flush();
+ TestIntfPrx obj = TestIntfPrxHelper.checkedCast(base);
+ test(obj != null);
+ test(obj.equals(base));
+ out.println("ok");
+
+ {
+ out.print("creating/destroying/recreating object adapter... ");
+ out.flush();
+ Ice.ObjectAdapter adapter =
+ communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default");
+ try
+ {
+ communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default");
+ test(false);
+ }
+ catch(Ice.AlreadyRegisteredException ex)
+ {
+ }
+ adapter.destroy();
+ //
+ // Use a different port than the first adapter to avoid an "address already in use" error.
+ //
+ adapter = communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default");
+ adapter.destroy();
+ out.println("ok");
+ }
+
+ out.print("creating/activating/deactivating object adapter in one operation... ");
+ out.flush();
+ obj._transient();
+ obj.end_transient(obj.begin_transient());
+ out.println("ok");
+
+ {
+ out.print("testing connection closure... ");
+ out.flush();
+ for(int i = 0; i < 10; ++i)
+ {
+ Ice.InitializationData initData = app.createInitializationData();
+ initData.properties = communicator.getProperties()._clone();
+ Ice.Communicator comm = app.initialize(initData);
+ comm.stringToProxy("test:default -p 12010").begin_ice_ping();
+ comm.destroy();
+ }
+ out.println("ok");
+ }
+
+ out.print("deactivating object adapter in the server... ");
+ out.flush();
+ obj.deactivate();
+ out.println("ok");
+
+ out.print("testing whether server is gone... ");
+ out.flush();
+ try
+ {
+ obj.ice_ping();
+ throw new RuntimeException();
+ }
+ catch(Ice.LocalException ex)
+ {
+ out.println("ok");
+ }
+
+ return obj;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Client.java b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Client.java
new file mode 100644
index 00000000000..df01944e4e8
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Client.java
@@ -0,0 +1,38 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.adapterDeactivation;
+
+public class Client extends test.Util.Application
+{
+ public int
+ run(String[] args)
+ {
+ AllTests.allTests(this, getWriter());
+ return 0;
+ }
+
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.adapterDeactivation");
+ return initData;
+ }
+
+
+ public static void
+ main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java
new file mode 100644
index 00000000000..c5c800aab52
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java
@@ -0,0 +1,49 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.adapterDeactivation;
+
+public class Collocated extends test.Util.Application
+{
+ public int
+ run(String[] args)
+ {
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.ServantLocator locator = new ServantLocatorI();
+ adapter.addServantLocator(locator, "");
+
+ AllTests.allTests(this, getWriter());
+
+ adapter.waitForDeactivate();
+ return 0;
+ }
+
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+
+ //
+ // 2 threads are necessary to dispatch the collocated transient() call with AMI
+ //
+ initData.properties.setProperty("TestAdapter.ThreadPool.Size", "2");
+
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.adapterDeactivation");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ return initData;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Collocated app = new Collocated();
+ int result = app.main("Collocated", args);
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/CookieI.java b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/CookieI.java
new file mode 100644
index 00000000000..5bf4a864299
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/CookieI.java
@@ -0,0 +1,21 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.adapterDeactivation;
+
+import test.Ice.adapterDeactivation.Test.Cookie;
+
+public final class CookieI extends Cookie
+{
+ public String
+ message()
+ {
+ return "blahblah";
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/ServantLocatorI.java b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/ServantLocatorI.java
new file mode 100644
index 00000000000..405004aae8c
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/ServantLocatorI.java
@@ -0,0 +1,78 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.adapterDeactivation;
+
+import test.Ice.adapterDeactivation.Test.Cookie;
+
+public final class ServantLocatorI implements Ice.ServantLocator
+{
+ public
+ ServantLocatorI()
+ {
+ _deactivated = false;
+ }
+
+ protected synchronized void
+ finalize()
+ throws Throwable
+ {
+ test(_deactivated);
+ }
+
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public Ice.Object
+ locate(Ice.Current current, Ice.LocalObjectHolder cookie)
+ {
+ synchronized(this)
+ {
+ test(!_deactivated);
+ }
+
+ test(current.id.category.length() == 0);
+ test(current.id.name.equals("test"));
+
+ cookie.value = new CookieI();
+
+ return new TestI();
+ }
+
+ public void
+ finished(Ice.Current current, Ice.Object servant, java.lang.Object cookie)
+ {
+ synchronized(this)
+ {
+ test(!_deactivated);
+ }
+
+ Cookie co = (Cookie)cookie;
+ test(co.message().equals("blahblah"));
+ }
+
+ public synchronized void
+ deactivate(String category)
+ {
+ synchronized(this)
+ {
+ test(!_deactivated);
+
+ _deactivated = true;
+ }
+ }
+
+ private boolean _deactivated;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Server.java b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Server.java
new file mode 100644
index 00000000000..4edeea0c554
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Server.java
@@ -0,0 +1,45 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.adapterDeactivation;
+
+public class Server extends test.Util.Application
+{
+ public int
+ run(String[] args)
+ {
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.ServantLocator locator = new ServantLocatorI();
+
+ adapter.addServantLocator(locator, "");
+ adapter.activate();
+ serverReady();
+ adapter.waitForDeactivate();
+ return 0;
+ }
+
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.adapterDeactivation");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ return initData;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Test.ice b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Test.ice
new file mode 100644
index 00000000000..348f48ed32b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Test.ice
@@ -0,0 +1,28 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.adapterDeactivation"]]
+module Test
+{
+
+interface TestIntf
+{
+ void transient();
+
+ void deactivate();
+};
+
+local class Cookie
+{
+ idempotent string message();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/TestI.java b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/TestI.java
new file mode 100644
index 00000000000..ad0f396c039
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/TestI.java
@@ -0,0 +1,39 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.adapterDeactivation;
+
+import test.Ice.adapterDeactivation.Test.*;
+
+public final class TestI extends _TestIntfDisp
+{
+ public void
+ _transient(Ice.Current current)
+ {
+ Ice.Communicator communicator = current.adapter.getCommunicator();
+
+ Ice.ObjectAdapter adapter =
+ communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999");
+ adapter.activate();
+ adapter.destroy();
+ }
+
+ public void
+ deactivate(Ice.Current current)
+ {
+ current.adapter.deactivate();
+ try
+ {
+ Thread.sleep(100);
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/run.py b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/run.py
new file mode 100755
index 00000000000..97eec95871b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/run.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.queueCollocatedTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/admin/AllTests.java b/java-compat/test/src/main/java/test/Ice/admin/AllTests.java
new file mode 100644
index 00000000000..b1e622947c8
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/admin/AllTests.java
@@ -0,0 +1,553 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.admin;
+
+import java.io.PrintWriter;
+import test.Ice.admin.Test.*;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ static void
+ testFacets(Ice.Communicator com, boolean builtInFacets)
+ {
+ if(builtInFacets)
+ {
+ test(com.findAdminFacet("Properties") != null);
+ test(com.findAdminFacet("Process") != null);
+ test(com.findAdminFacet("Logger") != null);
+ test(com.findAdminFacet("Metrics") != null);
+ }
+
+ TestFacet f1 = new TestFacetI();
+ TestFacet f2 = new TestFacetI();
+ TestFacet f3 = new TestFacetI();
+
+ com.addAdminFacet(f1, "Facet1");
+ com.addAdminFacet(f2, "Facet2");
+ com.addAdminFacet(f3, "Facet3");
+
+ test(com.findAdminFacet("Facet1") == f1);
+ test(com.findAdminFacet("Facet2") == f2);
+ test(com.findAdminFacet("Facet3") == f3);
+ test(com.findAdminFacet("Bogus") == null);
+
+ java.util.Map<String, Ice.Object> facetMap = com.findAllAdminFacets();
+ if(builtInFacets)
+ {
+ test(facetMap.size() == 7);
+ test(facetMap.containsKey("Properties"));
+ test(facetMap.containsKey("Process"));
+ test(facetMap.containsKey("Logger"));
+ test(facetMap.containsKey("Metrics"));
+ }
+ else
+ {
+ test(facetMap.size() >= 3);
+ }
+ test(facetMap.containsKey("Facet1"));
+ test(facetMap.containsKey("Facet2"));
+ test(facetMap.containsKey("Facet3"));
+
+ try
+ {
+ com.addAdminFacet(f1, "Facet1");
+ test(false);
+ }
+ catch(Ice.AlreadyRegisteredException ex)
+ {
+ // Expected
+ }
+
+ try
+ {
+ com.removeAdminFacet("Bogus");
+ test(false);
+ }
+ catch(Ice.NotRegisteredException ex)
+ {
+ // Expected
+ }
+
+ com.removeAdminFacet("Facet1");
+ com.removeAdminFacet("Facet2");
+ com.removeAdminFacet("Facet3");
+
+ try
+ {
+ com.removeAdminFacet("Facet1");
+ test(false);
+ }
+ catch(Ice.NotRegisteredException ex)
+ {
+ // Expected
+ }
+ }
+
+ public static void
+ allTests(test.Util.Application app, PrintWriter out)
+ {
+ out.print("testing communicator operations... ");
+ out.flush();
+ {
+ //
+ // Test: Exercise addAdminFacet, findAdminFacet, removeAdminFacet with a typical configuration.
+ //
+ Ice.InitializationData init = app.createInitializationData();
+ init.properties = Ice.Util.createProperties();
+ init.properties.setProperty("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
+ init.properties.setProperty("Ice.Admin.InstanceName", "Test");
+ Ice.Communicator com = Ice.Util.initialize(init);
+ testFacets(com, true);
+ com.destroy();
+ }
+ {
+ //
+ // Test: Verify that the operations work correctly in the presence of facet filters.
+ //
+ Ice.InitializationData init = app.createInitializationData();
+ init.properties = Ice.Util.createProperties();
+ init.properties.setProperty("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
+ init.properties.setProperty("Ice.Admin.InstanceName", "Test");
+ init.properties.setProperty("Ice.Admin.Facets", "Properties");
+ Ice.Communicator com = Ice.Util.initialize(init);
+ testFacets(com, false);
+ com.destroy();
+ }
+ {
+ //
+ // Test: Verify that the operations work correctly with the Admin object disabled.
+ //
+ Ice.Communicator com = Ice.Util.initialize();
+ testFacets(com, false);
+ com.destroy();
+ }
+ {
+ //
+ // Test: Verify that the operations work correctly when Ice.Admin.Enabled is set
+ //
+ Ice.InitializationData init = app.createInitializationData();
+ init.properties = Ice.Util.createProperties();
+ init.properties.setProperty("Ice.Admin.Enabled", "1");
+ Ice.Communicator com = Ice.Util.initialize(init);
+
+ test(com.getAdmin() == null);
+ Ice.Identity id = Ice.Util.stringToIdentity("test-admin");
+ try
+ {
+ com.createAdmin(null, id);
+ test(false);
+ }
+ catch(Ice.InitializationException ex)
+ {
+ }
+
+ Ice.ObjectAdapter adapter = com.createObjectAdapter("");
+ test(com.createAdmin(adapter, id) != null);
+ test(com.getAdmin() != null);
+ testFacets(com, true);
+ com.destroy();
+ }
+ {
+ //
+ // Test: Verify that the operations work correctly when creation of the Admin object is delayed.
+ //
+ Ice.InitializationData init = app.createInitializationData();
+ init.properties = Ice.Util.createProperties();
+ init.properties.setProperty("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
+ init.properties.setProperty("Ice.Admin.InstanceName", "Test");
+ init.properties.setProperty("Ice.Admin.DelayCreation", "1");
+ Ice.Communicator com = Ice.Util.initialize(init);
+ testFacets(com, true);
+ com.getAdmin();
+ testFacets(com, true);
+ com.destroy();
+ }
+ out.println("ok");
+
+ String ref = "factory:default -p 12010 -t 10000";
+ RemoteCommunicatorFactoryPrx factory =
+ RemoteCommunicatorFactoryPrxHelper.uncheckedCast(app.communicator().stringToProxy(ref));
+
+ out.print("testing process facet... ");
+ out.flush();
+ {
+ //
+ // Test: Verify that Process::shutdown() operation shuts down the communicator.
+ //
+ java.util.Map<String, String> props = new java.util.HashMap<String, String>();
+ props.put("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
+ props.put("Ice.Admin.InstanceName", "Test");
+ RemoteCommunicatorPrx com = factory.createCommunicator(props);
+ Ice.ObjectPrx obj = com.getAdmin();
+ Ice.ProcessPrx proc = Ice.ProcessPrxHelper.checkedCast(obj, "Process");
+ proc.shutdown();
+ com.waitForShutdown();
+ com.destroy();
+ }
+ out.println("ok");
+
+ out.print("testing properties facet... ");
+ out.flush();
+ {
+ java.util.Map<String, String> props = new java.util.HashMap<String, String>();
+ props.put("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
+ props.put("Ice.Admin.InstanceName", "Test");
+ props.put("Prop1", "1");
+ props.put("Prop2", "2");
+ props.put("Prop3", "3");
+ RemoteCommunicatorPrx com = factory.createCommunicator(props);
+ Ice.ObjectPrx obj = com.getAdmin();
+ Ice.PropertiesAdminPrx pa = Ice.PropertiesAdminPrxHelper.checkedCast(obj, "Properties");
+
+ //
+ // Test: PropertiesAdmin::getProperty()
+ //
+ test(pa.getProperty("Prop2").equals("2"));
+ test(pa.getProperty("Bogus").equals(""));
+
+ //
+ // Test: PropertiesAdmin::getProperties()
+ //
+ java.util.Map<String, String> pd = pa.getPropertiesForPrefix("");
+ test(pd.size() == 5);
+ test(pd.get("Ice.Admin.Endpoints").equals("tcp -h 127.0.0.1"));
+ test(pd.get("Ice.Admin.InstanceName").equals("Test"));
+ test(pd.get("Prop1").equals("1"));
+ test(pd.get("Prop2").equals("2"));
+ test(pd.get("Prop3").equals("3"));
+
+ java.util.Map<String, String> changes;
+
+ //
+ // Test: PropertiesAdmin::setProperties()
+ //
+ java.util.Map<String, String> setProps = new java.util.HashMap<String, String>();
+ setProps.put("Prop1", "10"); // Changed
+ setProps.put("Prop2", "20"); // Changed
+ setProps.put("Prop3", ""); // Removed
+ setProps.put("Prop4", "4"); // Added
+ setProps.put("Prop5", "5"); // Added
+ pa.setProperties(setProps);
+ test(pa.getProperty("Prop1").equals("10"));
+ test(pa.getProperty("Prop2").equals("20"));
+ test(pa.getProperty("Prop3").equals(""));
+ test(pa.getProperty("Prop4").equals("4"));
+ test(pa.getProperty("Prop5").equals("5"));
+ changes = com.getChanges();
+ test(changes.size() == 5);
+ test(changes.get("Prop1").equals("10"));
+ test(changes.get("Prop2").equals("20"));
+ test(changes.get("Prop3").equals(""));
+ test(changes.get("Prop4").equals("4"));
+ test(changes.get("Prop5").equals("5"));
+ pa.setProperties(setProps);
+ changes = com.getChanges();
+ test(changes.isEmpty());
+
+ com.destroy();
+ }
+ out.println("ok");
+
+ out.print("testing logger facet... ");
+ out.flush();
+ {
+ java.util.Map<String, String> props = new java.util.HashMap<String, String>();
+ props.put("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
+ props.put("Ice.Admin.InstanceName", "Test");
+ props.put("NullLogger", "1");
+ RemoteCommunicatorPrx com = factory.createCommunicator(props);
+
+ com.trace("testCat", "trace");
+ com.warning("warning");
+ com.error("error");
+ com.print("print");
+
+ Ice.ObjectPrx obj = com.getAdmin();
+ Ice.LoggerAdminPrx logger = Ice.LoggerAdminPrxHelper.checkedCast(obj, "Logger");
+ test(logger != null);
+
+ Ice.StringHolder prefix = new Ice.StringHolder();
+
+ //
+ // Get all
+ //
+ Ice.LogMessage[] logMessages = logger.getLog(null, null, -1, prefix);
+
+ test(logMessages.length == 4);
+ test(prefix.value.equals("NullLogger"));
+ test(logMessages[0].traceCategory.equals("testCat") && logMessages[0].message.equals("trace"));
+ test(logMessages[1].message.equals("warning"));
+ test(logMessages[2].message.equals("error"));
+ test(logMessages[3].message.equals("print"));
+
+ //
+ // Get only errors and warnings
+ //
+ com.error("error2");
+ com.print("print2");
+ com.trace("testCat", "trace2");
+ com.warning("warning2");
+
+ Ice.LogMessageType[] messageTypes = {Ice.LogMessageType.ErrorMessage, Ice.LogMessageType.WarningMessage};
+
+ logMessages = logger.getLog(messageTypes, null, -1, prefix);
+ test(logMessages.length == 4);
+ test(prefix.value.equals("NullLogger"));
+
+ for(Ice.LogMessage msg : java.util.Arrays.asList(logMessages))
+ {
+ test(msg.type == Ice.LogMessageType.ErrorMessage || msg.type == Ice.LogMessageType.WarningMessage);
+ }
+
+ //
+ // Get only errors and traces with Cat = "testCat"
+ //
+ com.trace("testCat2", "A");
+ com.trace("testCat", "trace3");
+ com.trace("testCat2", "B");
+
+ messageTypes = new Ice.LogMessageType[]{Ice.LogMessageType.ErrorMessage, Ice.LogMessageType.TraceMessage};
+ String[] categories = {"testCat"};
+ logMessages = logger.getLog(messageTypes, categories, -1, prefix);
+ test(logMessages.length == 5);
+ test(prefix.value.equals("NullLogger"));
+
+ for(Ice.LogMessage msg : java.util.Arrays.asList(logMessages))
+ {
+ test(msg.type == Ice.LogMessageType.ErrorMessage ||
+ (msg.type == Ice.LogMessageType.TraceMessage && msg.traceCategory.equals("testCat")));
+ }
+
+ //
+ // Same, but limited to last 2 messages (trace3 + error3)
+ //
+ com.error("error3");
+
+ logMessages = logger.getLog(messageTypes, categories, 2, prefix);
+ test(logMessages.length == 2);
+ test(prefix.value.equals("NullLogger"));
+
+ test(logMessages[0].message.equals("trace3"));
+ test(logMessages[1].message.equals("error3"));
+
+ //
+ // Now, test RemoteLogger
+ //
+ Ice.ObjectAdapter adapter =
+ app.communicator().createObjectAdapterWithEndpoints("RemoteLoggerAdapter", "tcp -h localhost");
+
+ RemoteLoggerI remoteLogger = new RemoteLoggerI();
+
+ Ice.RemoteLoggerPrx myProxy = Ice.RemoteLoggerPrxHelper.uncheckedCast(adapter.addWithUUID(remoteLogger));
+
+ adapter.activate();
+
+ //
+ // No filtering
+ //
+ logMessages = logger.getLog(null, null, -1, prefix);
+ remoteLogger.checkNextInit(prefix.value, logMessages);
+
+ try
+ {
+ logger.attachRemoteLogger(myProxy, null, null, -1);
+ }
+ catch(Ice.RemoteLoggerAlreadyAttachedException ex)
+ {
+ test(false);
+ }
+
+ remoteLogger.wait(1);
+
+ remoteLogger.checkNextLog(Ice.LogMessageType.TraceMessage, "rtrace", "testCat");
+ remoteLogger.checkNextLog(Ice.LogMessageType.WarningMessage, "rwarning", "");
+ remoteLogger.checkNextLog(Ice.LogMessageType.ErrorMessage, "rerror", "");
+ remoteLogger.checkNextLog(Ice.LogMessageType.PrintMessage, "rprint", "");
+
+ com.trace("testCat", "rtrace");
+ com.warning("rwarning");
+ com.error("rerror");
+ com.print("rprint");
+
+ remoteLogger.wait(4);
+
+ test(logger.detachRemoteLogger(myProxy));
+ test(!logger.detachRemoteLogger(myProxy));
+
+ //
+ // Use Error + Trace with "traceCat" filter with 4 limit
+ //
+ logMessages = logger.getLog(messageTypes, categories, 4, prefix);
+ test(logMessages.length == 4);
+ remoteLogger.checkNextInit(prefix.value, logMessages);
+
+ try
+ {
+ logger.attachRemoteLogger(myProxy, messageTypes, categories, 4);
+ }
+ catch(Ice.RemoteLoggerAlreadyAttachedException ex)
+ {
+ test(false);
+ }
+
+ remoteLogger.wait(1);
+
+ remoteLogger.checkNextLog(Ice.LogMessageType.TraceMessage, "rtrace2", "testCat");
+ remoteLogger.checkNextLog(Ice.LogMessageType.ErrorMessage, "rerror2", "");
+
+ com.warning("rwarning2");
+ com.trace("testCat", "rtrace2");
+ com.warning("rwarning3");
+ com.error("rerror2");
+ com.print("rprint2");
+
+ remoteLogger.wait(2);
+
+ //
+ // Attempt reconnection with slightly different proxy
+ //
+ try
+ {
+ logger.attachRemoteLogger(Ice.RemoteLoggerPrxHelper.uncheckedCast(myProxy.ice_oneway()),
+ messageTypes, categories, 4);
+ test(false);
+ }
+ catch(Ice.RemoteLoggerAlreadyAttachedException ex)
+ {
+ // expected
+ }
+
+ com.destroy();
+ }
+ out.println("ok");
+
+ out.print("testing custom facet... ");
+ out.flush();
+ {
+ //
+ // Test: Verify that the custom facet is present.
+ //
+ java.util.Map<String, String> props = new java.util.HashMap<String, String>();
+ props.put("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
+ props.put("Ice.Admin.InstanceName", "Test");
+ RemoteCommunicatorPrx com = factory.createCommunicator(props);
+ Ice.ObjectPrx obj = com.getAdmin();
+ TestFacetPrx tf = TestFacetPrxHelper.checkedCast(obj, "TestFacet");
+ tf.op();
+ com.destroy();
+ }
+ out.println("ok");
+
+ out.print("testing facet filtering... ");
+ out.flush();
+ {
+ //
+ // Test: Set Ice.Admin.Facets to expose only the Properties facet,
+ // meaning no other facet is available.
+ //
+ java.util.Map<String, String> props = new java.util.HashMap<String, String>();
+ props.put("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
+ props.put("Ice.Admin.InstanceName", "Test");
+ props.put("Ice.Admin.Facets", "Properties");
+ RemoteCommunicatorPrx com = factory.createCommunicator(props);
+ Ice.ObjectPrx obj = com.getAdmin();
+ Ice.ProcessPrx proc = Ice.ProcessPrxHelper.checkedCast(obj, "Process");
+ test(proc == null);
+ TestFacetPrx tf = TestFacetPrxHelper.checkedCast(obj, "TestFacet");
+ test(tf == null);
+ com.destroy();
+ }
+ {
+ //
+ // Test: Set Ice.Admin.Facets to expose only the Process facet,
+ // meaning no other facet is available.
+ //
+ java.util.Map<String, String> props = new java.util.HashMap<String, String>();
+ props.put("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
+ props.put("Ice.Admin.InstanceName", "Test");
+ props.put("Ice.Admin.Facets", "Process");
+ RemoteCommunicatorPrx com = factory.createCommunicator(props);
+ Ice.ObjectPrx obj = com.getAdmin();
+ Ice.PropertiesAdminPrx pa = Ice.PropertiesAdminPrxHelper.checkedCast(obj, "Properties");
+ test(pa == null);
+ TestFacetPrx tf = TestFacetPrxHelper.checkedCast(obj, "TestFacet");
+ test(tf == null);
+ com.destroy();
+ }
+ {
+ //
+ // Test: Set Ice.Admin.Facets to expose only the TestFacet facet,
+ // meaning no other facet is available.
+ //
+ java.util.Map<String, String> props = new java.util.HashMap<String, String>();
+ props.put("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
+ props.put("Ice.Admin.InstanceName", "Test");
+ props.put("Ice.Admin.Facets", "TestFacet");
+ RemoteCommunicatorPrx com = factory.createCommunicator(props);
+ Ice.ObjectPrx obj = com.getAdmin();
+ Ice.PropertiesAdminPrx pa = Ice.PropertiesAdminPrxHelper.checkedCast(obj, "Properties");
+ test(pa == null);
+ Ice.ProcessPrx proc = Ice.ProcessPrxHelper.checkedCast(obj, "Process");
+ test(proc == null);
+ com.destroy();
+ }
+ {
+ //
+ // Test: Set Ice.Admin.Facets to expose two facets. Use whitespace to separate the
+ // facet names.
+ //
+ java.util.Map<String, String> props = new java.util.HashMap<String, String>();
+ props.put("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
+ props.put("Ice.Admin.InstanceName", "Test");
+ props.put("Ice.Admin.Facets", "Properties TestFacet");
+ RemoteCommunicatorPrx com = factory.createCommunicator(props);
+ Ice.ObjectPrx obj = com.getAdmin();
+ Ice.PropertiesAdminPrx pa = Ice.PropertiesAdminPrxHelper.checkedCast(obj, "Properties");
+ test(pa.getProperty("Ice.Admin.InstanceName").equals("Test"));
+ TestFacetPrx tf = TestFacetPrxHelper.checkedCast(obj, "TestFacet");
+ tf.op();
+ Ice.ProcessPrx proc = Ice.ProcessPrxHelper.checkedCast(obj, "Process");
+ test(proc == null);
+ com.destroy();
+ }
+ {
+ //
+ // Test: Set Ice.Admin.Facets to expose two facets. Use a comma to separate the
+ // facet names.
+ //
+ java.util.Map<String, String> props = new java.util.HashMap<String, String>();
+ props.put("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
+ props.put("Ice.Admin.InstanceName", "Test");
+ props.put("Ice.Admin.Facets", "TestFacet, Process");
+ RemoteCommunicatorPrx com = factory.createCommunicator(props);
+ Ice.ObjectPrx obj = com.getAdmin();
+ Ice.PropertiesAdminPrx pa = Ice.PropertiesAdminPrxHelper.checkedCast(obj, "Properties");
+ test(pa == null);
+ TestFacetPrx tf = TestFacetPrxHelper.checkedCast(obj, "TestFacet");
+ tf.op();
+ Ice.ProcessPrx proc = Ice.ProcessPrxHelper.checkedCast(obj, "Process");
+ proc.shutdown();
+ com.waitForShutdown();
+ com.destroy();
+ }
+ out.println("ok");
+
+ factory.shutdown();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/admin/Client.java b/java-compat/test/src/main/java/test/Ice/admin/Client.java
new file mode 100644
index 00000000000..e3d4bbe677b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/admin/Client.java
@@ -0,0 +1,30 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.admin;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ AllTests.allTests(this, getWriter());
+
+ return 0;
+ }
+
+ public static void main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/admin/RemoteCommunicatorFactoryI.java b/java-compat/test/src/main/java/test/Ice/admin/RemoteCommunicatorFactoryI.java
new file mode 100644
index 00000000000..1bd6bb3ccfa
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/admin/RemoteCommunicatorFactoryI.java
@@ -0,0 +1,94 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.admin;
+
+import test.Ice.admin.Test.*;
+
+public class RemoteCommunicatorFactoryI extends _RemoteCommunicatorFactoryDisp
+{
+ @Override
+ public RemoteCommunicatorPrx createCommunicator(java.util.Map<String, String> props, Ice.Current current)
+ {
+ //
+ // Prepare the property set using the given properties.
+ //
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.classLoader = IceInternal.Util.getInstance(current.adapter.getCommunicator()).getClassLoader();
+ initData.properties = Ice.Util.createProperties();
+ for(java.util.Map.Entry<String, String> e : props.entrySet())
+ {
+ initData.properties.setProperty(e.getKey(), e.getValue());
+ }
+
+ if(initData.properties.getPropertyAsInt("NullLogger") > 0)
+ {
+ initData.logger = new Ice.Logger() {
+ @Override public void print(String message)
+ {
+ }
+
+ @Override public void trace(String category, String message)
+ {
+ }
+
+ @Override public void warning(String message)
+ {
+ }
+
+ @Override public void error(String message)
+ {
+ }
+
+ @Override public String getPrefix()
+ {
+ return "NullLogger";
+ }
+
+ @Override public Ice.Logger cloneWithPrefix(String prefix)
+ {
+ return this;
+ }
+ };
+ }
+
+ //
+ // Initialize a new communicator.
+ //
+ Ice.Communicator communicator = Ice.Util.initialize(initData);
+
+ //
+ // Install a custom admin facet.
+ //
+ communicator.addAdminFacet(new TestFacetI(), "TestFacet");
+
+ //
+ // The RemoteCommunicator servant also implements PropertiesAdminUpdateCallback.
+ // Set the callback on the admin facet.
+ //
+ RemoteCommunicatorI servant = new RemoteCommunicatorI(communicator);
+ Ice.Object propFacet = communicator.findAdminFacet("Properties");
+
+ if(propFacet != null)
+ {
+ Ice.NativePropertiesAdmin admin = (Ice.NativePropertiesAdmin)propFacet;
+ assert admin != null;
+ admin.addUpdateCallback(servant);
+ }
+
+ Ice.ObjectPrx proxy = current.adapter.addWithUUID(servant);
+ return RemoteCommunicatorPrxHelper.uncheckedCast(proxy);
+ }
+
+ @Override
+ public void shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/admin/RemoteCommunicatorI.java b/java-compat/test/src/main/java/test/Ice/admin/RemoteCommunicatorI.java
new file mode 100644
index 00000000000..a01444f01e5
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/admin/RemoteCommunicatorI.java
@@ -0,0 +1,111 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.admin;
+
+import test.Ice.admin.Test.*;
+
+public class RemoteCommunicatorI extends _RemoteCommunicatorDisp implements Ice.PropertiesAdminUpdateCallback
+{
+ RemoteCommunicatorI(Ice.Communicator communicator)
+ {
+ _communicator = communicator;
+ _called = false;
+ }
+
+ @Override
+ public Ice.ObjectPrx getAdmin(Ice.Current current)
+ {
+ return _communicator.getAdmin();
+ }
+
+ @Override
+ public synchronized java.util.Map<String, String> getChanges(Ice.Current current)
+ {
+ //
+ // The client calls PropertiesAdmin::setProperties() and then invokes
+ // this operation. Since setProperties() is implemented using AMD, the
+ // client might receive its reply and then call getChanges() before our
+ // updated() method is called. We block here to ensure that updated()
+ // gets called before we return the most recent set of changes.
+ //
+ while(!_called)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ _called = false;
+
+ return _changes;
+ }
+
+ @Override
+ public void print(String message, Ice.Current current)
+ {
+ _communicator.getLogger().print(message);
+ }
+
+ @Override
+ public void trace(String category, String message, Ice.Current current)
+ {
+ _communicator.getLogger().trace(category, message);
+ }
+
+ @Override
+ public void warning(String message, Ice.Current current)
+ {
+ _communicator.getLogger().warning(message);
+ }
+
+ @Override
+ public void error(String message, Ice.Current current)
+ {
+ _communicator.getLogger().error(message);
+ }
+
+ @Override
+ public void shutdown(Ice.Current current)
+ {
+ _communicator.shutdown();
+ }
+
+ @Override
+ public void waitForShutdown(Ice.Current current)
+ {
+ //
+ // Note that we are executing in a thread of the *main* communicator,
+ // not the one that is being shut down.
+ //
+ _communicator.waitForShutdown();
+ }
+
+ @Override
+ public void destroy(Ice.Current current)
+ {
+ _communicator.destroy();
+ }
+
+ @Override
+ public synchronized void updated(java.util.Map<String, String> changes)
+ {
+ _changes = changes;
+ _called = true;
+ notify();
+ }
+
+ private Ice.Communicator _communicator;
+ private java.util.Map<String, String> _changes;
+ private boolean _called;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/admin/RemoteLoggerI.java b/java-compat/test/src/main/java/test/Ice/admin/RemoteLoggerI.java
new file mode 100644
index 00000000000..8f93be0db91
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/admin/RemoteLoggerI.java
@@ -0,0 +1,77 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.admin;
+
+class RemoteLoggerI extends Ice._RemoteLoggerDisp
+{
+
+ @Override
+ public synchronized void init(String prefix, Ice.LogMessage[] logMessages, Ice.Current current)
+ {
+ test(prefix.equals(_expectedPrefix));
+ test(java.util.Arrays.equals(logMessages, _expectedInitMessages));
+ _receivedCalls++;
+ notifyAll();
+ }
+
+ @Override
+ public synchronized void log(Ice.LogMessage logMessage, Ice.Current current)
+ {
+ Ice.LogMessage front = _expectedLogMessages.pollFirst();
+ test(front.type == logMessage.type && front.message.equals(logMessage.message) &&
+ front.traceCategory.equals(logMessage.traceCategory));
+
+ _receivedCalls++;
+ notifyAll();
+ }
+
+ synchronized void checkNextInit(String prefix, Ice.LogMessage[] logMessages)
+ {
+ _expectedPrefix = prefix;
+ _expectedInitMessages = logMessages;
+ }
+
+ synchronized void checkNextLog(Ice.LogMessageType messageType, String message, String category)
+ {
+ Ice.LogMessage logMessage = new Ice.LogMessage(messageType, 0, category, message);
+ _expectedLogMessages.addLast(logMessage);
+ }
+
+ synchronized void wait(int calls)
+ {
+ _receivedCalls -= calls;
+
+ while(_receivedCalls < 0)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ break;
+ }
+ }
+ }
+
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private int _receivedCalls;
+ private String _expectedPrefix;
+ private Ice.LogMessage[] _expectedInitMessages;
+ private java.util.Deque<Ice.LogMessage> _expectedLogMessages = new java.util.ArrayDeque<Ice.LogMessage>();
+}
diff --git a/java-compat/test/src/main/java/test/Ice/admin/Server.java b/java-compat/test/src/main/java/test/Ice/admin/Server.java
new file mode 100644
index 00000000000..f9ca817d7c0
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/admin/Server.java
@@ -0,0 +1,42 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.admin;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new RemoteCommunicatorFactoryI(), Ice.Util.stringToIdentity("factory"));
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.admin");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/admin/Test.ice b/java-compat/test/src/main/java/test/Ice/admin/Test.ice
new file mode 100644
index 00000000000..ecf561a80df
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/admin/Test.ice
@@ -0,0 +1,54 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef TEST_ICE
+#define TEST_ICE
+
+#include <Ice/Properties.ice>
+
+[["java:package:test.Ice.admin"]]
+module Test
+{
+
+interface RemoteCommunicator
+{
+ Object* getAdmin();
+
+ Ice::PropertyDict getChanges();
+
+ //
+ // Logger operations
+ //
+ void print(string message);
+ void trace(string category, string message);
+ void warning(string message);
+ void error(string message);
+
+ void shutdown();
+
+ void waitForShutdown();
+
+ void destroy();
+};
+
+interface RemoteCommunicatorFactory
+{
+ RemoteCommunicator* createCommunicator(Ice::PropertyDict props);
+
+ void shutdown();
+};
+
+interface TestFacet
+{
+ void op();
+};
+
+};
+
+#endif
diff --git a/java-compat/test/src/main/java/test/Ice/admin/TestFacetI.java b/java-compat/test/src/main/java/test/Ice/admin/TestFacetI.java
new file mode 100644
index 00000000000..a421b5b95d2
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/admin/TestFacetI.java
@@ -0,0 +1,20 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.admin;
+
+import test.Ice.admin.Test.*;
+
+public class TestFacetI extends _TestFacetDisp
+{
+ @Override
+ public void op(Ice.Current current)
+ {
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/admin/run.py b/java-compat/test/src/main/java/test/Ice/admin/run.py
new file mode 100755
index 00000000000..97f9acd4094
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/admin/run.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/ami/AMI.java b/java-compat/test/src/main/java/test/Ice/ami/AMI.java
new file mode 100644
index 00000000000..c018ccb8c62
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/ami/AMI.java
@@ -0,0 +1,2648 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.ami;
+
+import java.io.PrintWriter;
+
+import test.Ice.ami.Test.TestIntfPrx;
+import test.Ice.ami.Test.TestIntfPrxHelper;
+import test.Ice.ami.Test.TestIntfControllerPrx;
+import test.Ice.ami.Test.TestIntfException;
+import test.Ice.ami.Test.Callback_TestIntf_op;
+import test.Ice.ami.Test.Callback_TestIntf_opWithResult;
+import test.Ice.ami.Test.Callback_TestIntf_opWithUE;
+import test.Ice.ami.Test.Callback_TestIntf_opWithPayload;
+import test.Util.Application;
+
+public class AMI
+{
+ private static class Counter
+ {
+ private int _count = 0;
+
+ synchronized void decrement()
+ {
+ --_count;
+ if(_count == 0)
+ {
+ notifyAll();
+ }
+ }
+
+ synchronized void increment()
+ {
+ ++_count;
+ }
+
+ synchronized void waitComplete() throws InterruptedException
+ {
+ while(_count > 0)
+ {
+ wait();
+ }
+ }
+ }
+
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private static class CallbackBase
+ {
+ CallbackBase()
+ {
+ _called = false;
+ }
+
+ public synchronized void check()
+ {
+ while(!_called)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ _called = false;
+ }
+
+ public synchronized void called()
+ {
+ assert(!_called);
+ _called = true;
+ notify();
+ }
+
+ private boolean _called;
+ }
+
+ static class AsyncCallback extends CallbackBase
+ {
+ public AsyncCallback()
+ {
+ }
+
+ public void
+ isA(Ice.AsyncResult result)
+ {
+ test(result.getProxy().end_ice_isA(result));
+ called();
+ }
+
+ public void
+ ping(Ice.AsyncResult result)
+ {
+ result.getProxy().end_ice_ping(result);
+ called();
+ }
+
+ public void
+ id(Ice.AsyncResult result)
+ {
+ test(result.getProxy().end_ice_id(result).equals("::Test::TestIntf"));
+ called();
+ }
+
+ public void
+ ids(Ice.AsyncResult result)
+ {
+ test(result.getProxy().end_ice_ids(result).length == 2);
+ called();
+ }
+
+ public void
+ connection(Ice.AsyncResult result)
+ {
+ test(result.getProxy().end_ice_getConnection(result) != null);
+ called();
+ }
+
+ public void
+ op(Ice.AsyncResult result)
+ {
+ TestIntfPrxHelper.uncheckedCast(result.getProxy()).end_op(result);
+ called();
+ }
+
+ public void
+ opWithResult(Ice.AsyncResult result)
+ {
+ test(TestIntfPrxHelper.uncheckedCast(result.getProxy()).end_opWithResult(result) == 15);
+ called();
+ }
+
+ public void
+ opWithUE(Ice.AsyncResult result)
+ {
+ try
+ {
+ TestIntfPrxHelper.uncheckedCast(result.getProxy()).end_opWithUE(result);
+ test(false);
+ }
+ catch(TestIntfException ex)
+ {
+ called();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ }
+
+ public void
+ isAEx(Ice.AsyncResult result)
+ {
+ try
+ {
+ result.getProxy().end_ice_isA(result);
+ test(false);
+ }
+ catch(Ice.NoEndpointException ex)
+ {
+ called();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ }
+
+ public void
+ pingEx(Ice.AsyncResult result)
+ {
+ try
+ {
+ result.getProxy().end_ice_ping(result);
+ test(false);
+ }
+ catch(Ice.NoEndpointException ex)
+ {
+ called();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ }
+
+ public void
+ idEx(Ice.AsyncResult result)
+ {
+ try
+ {
+ result.getProxy().end_ice_id(result);
+ test(false);
+ }
+ catch(Ice.NoEndpointException ex)
+ {
+ called();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ }
+
+ public void
+ idsEx(Ice.AsyncResult result)
+ {
+ try
+ {
+ result.getProxy().end_ice_ids(result);
+ test(false);
+ }
+ catch(Ice.NoEndpointException ex)
+ {
+ called();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ }
+
+ public void
+ connectionEx(Ice.AsyncResult result)
+ {
+ try
+ {
+ result.getProxy().end_ice_getConnection(result);
+ test(false);
+ }
+ catch(Ice.NoEndpointException ex)
+ {
+ called();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ }
+
+ public void
+ opEx(Ice.AsyncResult result)
+ {
+ try
+ {
+ TestIntfPrxHelper.uncheckedCast(result.getProxy()).end_op(result);
+ test(false);
+ }
+ catch(Ice.NoEndpointException ex)
+ {
+ called();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ }
+ }
+
+ static class ResponseCallback extends CallbackBase
+ {
+ ResponseCallback()
+ {
+ }
+
+ public void
+ isA(boolean r)
+ {
+ test(r);
+ called();
+ }
+
+ public void
+ ping()
+ {
+ called();
+ }
+
+ public void
+ id(String id)
+ {
+ test(id.equals("::Test::TestIntf"));
+ called();
+ }
+
+ public void
+ ids(String[] ids)
+ {
+ test(ids.length == 2);
+ called();
+ }
+
+ public void
+ connection(Ice.Connection conn)
+ {
+ test(conn != null);
+ called();
+ }
+
+ public void
+ op()
+ {
+ called();
+ }
+
+ public void
+ opWithResult(int r)
+ {
+ test(r == 15);
+ called();
+ }
+
+ public void
+ opWithUE(Ice.UserException e)
+ {
+ try
+ {
+ throw e;
+ }
+ catch(TestIntfException ex)
+ {
+ called();
+ }
+ catch(Ice.UserException ex)
+ {
+ test(false);
+ }
+ }
+ }
+
+ static class ExceptionCallback extends CallbackBase
+ {
+ public ExceptionCallback()
+ {
+ }
+
+ public void
+ isA(boolean r)
+ {
+ test(false);
+ }
+
+ public void
+ ping()
+ {
+ test(false);
+ }
+
+ public void
+ id(String id)
+ {
+ test(false);
+ }
+
+ public void
+ ids(String[] ids)
+ {
+ test(false);
+ }
+
+ public void
+ connection(Ice.Connection conn)
+ {
+ test(false);
+ }
+
+ public void
+ op()
+ {
+ test(false);
+ }
+
+ public void
+ ex(Ice.LocalException ex)
+ {
+ test(ex instanceof Ice.NoEndpointException);
+ called();
+ }
+
+ public void
+ noEx(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ }
+
+ static class SentCallback extends CallbackBase
+ {
+ SentCallback()
+ {
+ _thread = Thread.currentThread().getId();
+ }
+
+ public void
+ isA(boolean r)
+ {
+ }
+
+ public void
+ ping()
+ {
+ }
+
+ public void
+ id(String s)
+ {
+ }
+
+ public void
+ ids(String[] s)
+ {
+ }
+
+ public void
+ opAsync(Ice.AsyncResult r)
+ {
+ }
+
+ public void
+ op()
+ {
+ }
+
+ public void
+ ex(Ice.LocalException ex)
+ {
+ }
+
+ public void
+ sent(Ice.AsyncResult r)
+ {
+ test(r.sentSynchronously() && _thread == Thread.currentThread().getId() ||
+ !r.sentSynchronously() && _thread != Thread.currentThread().getId());
+ called();
+ }
+
+ public void
+ sent(boolean ss)
+ {
+ test(ss && _thread == Thread.currentThread().getId() ||
+ !ss && _thread != Thread.currentThread().getId());
+ called();
+ }
+
+ long _thread;
+ }
+
+ static class FlushCallback extends CallbackBase
+ {
+ FlushCallback()
+ {
+ _thread = Thread.currentThread().getId();
+ }
+
+ public void
+ completedAsync(Ice.AsyncResult r)
+ {
+ test(false);
+ }
+
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void
+ sentAsync(Ice.AsyncResult r)
+ {
+ test((r.sentSynchronously() && _thread == Thread.currentThread().getId()) ||
+ (!r.sentSynchronously() && _thread != Thread.currentThread().getId()));
+ called();
+ }
+
+ public void
+ sent(boolean sentSynchronously)
+ {
+ test((sentSynchronously && _thread == Thread.currentThread().getId()) ||
+ (!sentSynchronously && _thread != Thread.currentThread().getId()));
+ called();
+ }
+
+ long _thread;
+ }
+
+ static class FlushExCallback extends CallbackBase
+ {
+ FlushExCallback()
+ {
+ }
+
+ public void
+ completedAsync(Ice.AsyncResult r)
+ {
+ try
+ {
+ if(r.getConnection() != null)
+ {
+ r.getConnection().end_flushBatchRequests(r);
+ }
+ else
+ {
+ r.getProxy().end_ice_flushBatchRequests(r);
+ }
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ called();
+ }
+ }
+
+ public void
+ exception(Ice.LocalException ex)
+ {
+ called();
+ }
+
+ public void
+ sentAsync(Ice.AsyncResult r)
+ {
+ test(false);
+ }
+
+ public void
+ sent(boolean sentSynchronously)
+ {
+ test(false);
+ }
+ }
+
+ enum ThrowType { LocalException, OtherException };
+
+ static class Thrower extends CallbackBase
+ {
+ public Thrower(ThrowType t)
+ {
+ _t = t;
+ }
+
+ public void
+ opAsync(Ice.AsyncResult r)
+ {
+ called();
+ throwEx();
+ }
+
+ public void
+ op()
+ {
+ called();
+ throwEx();
+ }
+
+ public void
+ noOp()
+ {
+ }
+
+ public void
+ ex(Ice.LocalException ex)
+ {
+ called();
+ throwEx();
+ }
+
+ public void
+ sent(boolean ss)
+ {
+ called();
+ throwEx();
+ }
+
+ private void
+ throwEx()
+ {
+ switch(_t)
+ {
+ case LocalException:
+ {
+ throw new Ice.ObjectNotExistException();
+ }
+ case OtherException:
+ {
+ throw new RuntimeException();
+ }
+ default:
+ {
+ assert(false);
+ break;
+ }
+ }
+ }
+
+ ThrowType _t;
+ }
+
+ public static void
+ run(Application app, Ice.Communicator communicator, boolean collocated, TestIntfPrx p,
+ TestIntfControllerPrx testController)
+ {
+
+ PrintWriter out = app.getWriter();
+
+ out.print("testing begin/end invocation... ");
+ out.flush();
+ {
+ Ice.AsyncResult result;
+ java.util.Map<String, String> ctx = new java.util.HashMap<String, String>();
+
+ result = p.begin_ice_isA("::Test::TestIntf");
+ test(p.end_ice_isA(result));
+ result = p.begin_ice_isA("::Test::TestIntf", ctx);
+ test(p.end_ice_isA(result));
+
+ result = p.begin_ice_ping();
+ p.end_ice_ping(result);
+ result = p.begin_ice_ping(ctx);
+ p.end_ice_ping(result);
+
+ result = p.begin_ice_id();
+ test(p.end_ice_id(result).equals("::Test::TestIntf"));
+ result = p.begin_ice_id(ctx);
+ test(p.end_ice_id(result).equals("::Test::TestIntf"));
+
+ result = p.begin_ice_ids();
+ test(p.end_ice_ids(result).length == 2);
+ result = p.begin_ice_ids(ctx);
+ test(p.end_ice_ids(result).length == 2);
+
+ if(!collocated)
+ {
+ result = p.begin_ice_getConnection();
+ test(p.end_ice_getConnection(result) != null);
+ }
+
+ result = p.begin_op();
+ p.end_op(result);
+ result = p.begin_op(ctx);
+ p.end_op(result);
+
+ result = p.begin_opWithResult();
+ test(p.end_opWithResult(result) == 15);
+ result = p.begin_opWithResult(ctx);
+ test(p.end_opWithResult(result) == 15);
+
+ result = p.begin_opWithUE();
+ try
+ {
+ p.end_opWithUE(result);
+ test(false);
+ }
+ catch(TestIntfException ex)
+ {
+ }
+ result = p.begin_opWithUE(ctx);
+ try
+ {
+ p.end_opWithUE(result);
+ test(false);
+ }
+ catch(TestIntfException ex)
+ {
+ }
+
+ if(p.supportsFunctionalTests())
+ {
+ result = p.begin_opBool(true);
+ test(p.end_opBool(result));
+
+ result = p.begin_opByte((byte)0xff);
+ test(p.end_opByte(result) == (byte)0xff);
+
+ result = p.begin_opShort(Short.MIN_VALUE);
+ test(p.end_opShort(result) == Short.MIN_VALUE);
+
+ result = p.begin_opInt(Integer.MIN_VALUE);
+ test(p.end_opInt(result) == Integer.MIN_VALUE);
+
+ result = p.begin_opLong(Long.MIN_VALUE);
+ test(p.end_opLong(result) == Long.MIN_VALUE);
+
+ result = p.begin_opFloat(3.14f);
+ test(p.end_opFloat(result) == 3.14f);
+
+ result = p.begin_opDouble(1.1E10);
+ test(p.end_opDouble(result) == 1.1E10);
+ }
+ }
+ out.println("ok");
+
+ out.print("testing async callback... ");
+ out.flush();
+ {
+ final AsyncCallback cb = new AsyncCallback();
+ java.util.Map<String, String> ctx = new java.util.HashMap<String, String>();
+
+ p.begin_ice_isA("::Test::TestIntf", new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.isA(r);
+ }
+ });
+ cb.check();
+
+ p.begin_ice_isA("::Test::TestIntf", ctx, new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.isA(r);
+ }
+ });
+ cb.check();
+
+ p.begin_ice_ping(new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.ping(r);
+ }
+ });
+ cb.check();
+ p.begin_ice_ping(ctx, new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.ping(r);
+ }
+ });
+ cb.check();
+
+ p.begin_ice_id(new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.id(r);
+ }
+ });
+ cb.check();
+ p.begin_ice_id(ctx, new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.id(r);
+ }
+ });
+ cb.check();
+
+ p.begin_ice_ids(new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.ids(r);
+ }
+ });
+ cb.check();
+ p.begin_ice_ids(ctx, new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.ids(r);
+ }
+ });
+ cb.check();
+
+ if(!collocated)
+ {
+ p.begin_ice_getConnection(new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.connection(r);
+ }
+ });
+ cb.check();
+ }
+
+ p.begin_op(new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.op(r);
+ }
+ });
+ cb.check();
+ p.begin_op(ctx, new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.op(r);
+ }
+ });
+ cb.check();
+
+ p.begin_opWithResult(new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.opWithResult(r);
+ }
+ });
+ cb.check();
+ p.begin_opWithResult(ctx, new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.opWithResult(r);
+ }
+ });
+ cb.check();
+
+ p.begin_opWithUE(new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.opWithUE(r);
+ }
+ });
+ cb.check();
+ p.begin_opWithUE(ctx, new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.opWithUE(r);
+ }
+ });
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("testing response callback... ");
+ out.flush();
+ {
+ final ResponseCallback cb = new ResponseCallback();
+ java.util.Map<String, String> ctx = new java.util.HashMap<String, String>();
+
+ p.begin_ice_isA("::Test::TestIntf", new Ice.Callback_Object_ice_isA()
+ {
+ @Override
+ public void
+ response(boolean r)
+ {
+ cb.isA(r);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ });
+ cb.check();
+ p.begin_ice_isA("::Test::TestIntf", ctx, new Ice.Callback_Object_ice_isA()
+ {
+ @Override
+ public void
+ response(boolean r)
+ {
+ cb.isA(r);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ });
+ cb.check();
+
+ p.begin_ice_ping(new Ice.Callback_Object_ice_ping()
+ {
+ @Override
+ public void
+ response()
+ {
+ cb.ping();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ });
+ cb.check();
+ p.begin_ice_ping(ctx, new Ice.Callback_Object_ice_ping()
+ {
+ @Override
+ public void
+ response()
+ {
+ cb.ping();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ });
+ cb.check();
+
+ p.begin_ice_id(new Ice.Callback_Object_ice_id()
+ {
+ @Override
+ public void
+ response(String id)
+ {
+ cb.id(id);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ });
+ cb.check();
+ p.begin_ice_id(ctx, new Ice.Callback_Object_ice_id()
+ {
+ @Override
+ public void
+ response(String id)
+ {
+ cb.id(id);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ });
+ cb.check();
+
+ p.begin_ice_ids(new Ice.Callback_Object_ice_ids()
+ {
+ @Override
+ public void
+ response(String[] ids)
+ {
+ cb.ids(ids);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ });
+ cb.check();
+ p.begin_ice_ids(ctx, new Ice.Callback_Object_ice_ids()
+ {
+ @Override
+ public void
+ response(String[] ids)
+ {
+ cb.ids(ids);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ });
+ cb.check();
+
+ if(!collocated)
+ {
+ p.begin_ice_getConnection(new Ice.Callback_Object_ice_getConnection()
+ {
+ @Override
+ public void
+ response(Ice.Connection conn)
+ {
+ cb.connection(conn);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ });
+ cb.check();
+ }
+
+ p.begin_op(new Callback_TestIntf_op()
+ {
+ @Override
+ public void
+ response()
+ {
+ cb.op();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ });
+ cb.check();
+ p.begin_op(ctx, new Callback_TestIntf_op()
+ {
+ @Override
+ public void
+ response()
+ {
+ cb.op();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ });
+ cb.check();
+
+ p.begin_opWithResult(new Callback_TestIntf_opWithResult()
+ {
+ @Override
+ public void
+ response(int r)
+ {
+ cb.opWithResult(r);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ });
+ cb.check();
+ p.begin_opWithResult(ctx, new Callback_TestIntf_opWithResult()
+ {
+ @Override
+ public void
+ response(int r)
+ {
+ cb.opWithResult(r);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ });
+ cb.check();
+
+ p.begin_opWithUE(new Callback_TestIntf_opWithUE()
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.UserException ex)
+ {
+ cb.opWithUE(ex);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ });
+ cb.check();
+ p.begin_opWithUE(ctx, new Callback_TestIntf_opWithUE()
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.UserException ex)
+ {
+ cb.opWithUE(ex);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ });
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("testing local exceptions... ");
+ out.flush();
+ {
+ TestIntfPrx indirect = TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy"));
+ Ice.AsyncResult r;
+
+ r = indirect.begin_op();
+ try
+ {
+ indirect.end_op(r);
+ test(false);
+ }
+ catch(Ice.NoEndpointException ex)
+ {
+ }
+
+
+ try
+ {
+ r = ((TestIntfPrx)p.ice_oneway()).begin_opWithResult();
+ test(false);
+ }
+ catch(java.lang.IllegalArgumentException ex)
+ {
+ }
+
+ //
+ // Check that CommunicatorDestroyedException is raised directly.
+ //
+ if(p.ice_getConnection() != null)
+ {
+ Ice.InitializationData initData = app.createInitializationData();
+ initData.properties = communicator.getProperties()._clone();
+ Ice.Communicator ic = app.initialize(initData);
+ Ice.ObjectPrx o = ic.stringToProxy(p.toString());
+ TestIntfPrx p2 = TestIntfPrxHelper.checkedCast(o);
+ ic.destroy();
+
+ try
+ {
+ p2.begin_op();
+ test(false);
+ }
+ catch(Ice.CommunicatorDestroyedException ex)
+ {
+ // Expected.
+ }
+ }
+ }
+ out.println("ok");
+
+ out.print("testing local exceptions with async callback... ");
+ out.flush();
+ {
+ TestIntfPrx i = TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy"));
+ final AsyncCallback cb = new AsyncCallback();
+
+ i.begin_ice_isA("::Test::TestIntf", new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.isAEx(r);
+ }
+ });
+ cb.check();
+
+ i.begin_ice_ping(new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.pingEx(r);
+ }
+ });
+ cb.check();
+
+ i.begin_ice_id(new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.idEx(r);
+ }
+ });
+ cb.check();
+
+ i.begin_ice_ids(new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.idsEx(r);
+ }
+ });
+ cb.check();
+
+ if(!collocated)
+ {
+ i.begin_ice_getConnection(new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.connectionEx(r);
+ }
+ });
+ cb.check();
+ }
+
+ i.begin_op(new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult r)
+ {
+ cb.opEx(r);
+ }
+ });
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("testing local exceptions with response callback... ");
+ out.flush();
+ {
+ TestIntfPrx i = TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy"));
+ final ExceptionCallback cb = new ExceptionCallback();
+
+ i.begin_ice_isA("::Test::TestIntf", new Ice.Callback_Object_ice_isA()
+ {
+ @Override
+ public void
+ response(boolean r)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ cb.ex(ex);
+ }
+ });
+ cb.check();
+
+ i.begin_ice_ping(new Ice.Callback_Object_ice_ping()
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ cb.ex(ex);
+ }
+ });
+ cb.check();
+
+ i.begin_ice_id(new Ice.Callback_Object_ice_id()
+ {
+ @Override
+ public void
+ response(String id)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ cb.ex(ex);
+ }
+ });
+ cb.check();
+
+ i.begin_ice_ids(new Ice.Callback_Object_ice_ids()
+ {
+ @Override
+ public void
+ response(String[] ids)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ cb.ex(ex);
+ }
+ });
+ cb.check();
+
+ if(!collocated)
+ {
+ i.begin_ice_getConnection(new Ice.Callback_Object_ice_getConnection()
+ {
+ @Override
+ public void
+ response(Ice.Connection conn)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ cb.ex(ex);
+ }
+ });
+ cb.check();
+ }
+
+ i.begin_op(new Callback_TestIntf_op()
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ cb.ex(ex);
+ }
+ });
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("testing sent callback... ");
+ out.flush();
+ {
+ final SentCallback cb = new SentCallback();
+
+ p.begin_ice_isA("", new Ice.Callback_Object_ice_isA()
+ {
+ @Override
+ public void
+ response(boolean r)
+ {
+ cb.isA(r);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ cb.ex(ex);
+ }
+
+ @Override
+ public void
+ sent(boolean ss)
+ {
+ cb.sent(ss);
+ }
+ });
+ cb.check();
+
+ p.begin_ice_ping(new Ice.Callback_Object_ice_ping()
+ {
+ @Override
+ public void
+ response()
+ {
+ cb.ping();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ cb.ex(ex);
+ }
+
+ @Override
+ public void
+ sent(boolean ss)
+ {
+ cb.sent(ss);
+ }
+ });
+ cb.check();
+
+ p.begin_ice_id(new Ice.Callback_Object_ice_id()
+ {
+ @Override
+ public void
+ response(String id)
+ {
+ cb.id(id);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ cb.ex(ex);
+ }
+
+ @Override
+ public void
+ sent(boolean ss)
+ {
+ cb.sent(ss);
+ }
+ });
+ cb.check();
+
+ p.begin_ice_ids(new Ice.Callback_Object_ice_ids()
+ {
+ @Override
+ public void
+ response(String[] ids)
+ {
+ cb.ids(ids);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ cb.ex(ex);
+ }
+
+ @Override
+ public void
+ sent(boolean ss)
+ {
+ cb.sent(ss);
+ }
+ });
+ cb.check();
+
+ p.begin_op(new Callback_TestIntf_op()
+ {
+ @Override
+ public void
+ response()
+ {
+ cb.op();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ cb.ex(ex);
+ }
+
+ @Override
+ public void
+ sent(boolean ss)
+ {
+ cb.sent(ss);
+ }
+ });
+ cb.check();
+
+ p.begin_op(new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult result)
+ {
+ cb.opAsync(result);
+ }
+
+ @Override
+ public void
+ sent(Ice.AsyncResult result)
+ {
+ cb.sent(result);
+ }
+ });
+ cb.check();
+
+ java.util.List<SentCallback> cbs = new java.util.ArrayList<SentCallback>();
+ byte[] seq = new byte[10024];
+ Ice.AsyncResult r;
+ testController.holdAdapter();
+
+ final Counter counter = new Counter();
+ try
+ {
+ do
+ {
+ final SentCallback cb2 = new SentCallback();
+ r = p.begin_opWithPayload(seq, new Callback_TestIntf_opWithPayload()
+ {
+ @Override
+ public void
+ response()
+ {
+ counter.decrement();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ counter.decrement();
+ cb2.ex(ex);
+ }
+
+ @Override
+ public void
+ sent(boolean ss)
+ {
+ cb2.sent(ss);
+ }
+ });
+ counter.increment();
+ cbs.add(cb2);
+ }
+ while(r.sentSynchronously());
+ }
+ finally
+ {
+ testController.resumeAdapter();
+ }
+ for(SentCallback cb3 : cbs)
+ {
+ cb3.check();
+ }
+ try
+ {
+ counter.waitComplete();
+ }
+ catch(InterruptedException e)
+ {
+ }
+ }
+ out.println("ok");
+
+ out.print("testing illegal arguments... ");
+ out.flush();
+ {
+ Ice.AsyncResult result;
+
+ result = p.begin_op();
+ p.end_op(result);
+ try
+ {
+ p.end_op(result);
+ test(false);
+ }
+ catch(IllegalArgumentException ex)
+ {
+ }
+
+ result = p.begin_op();
+ try
+ {
+ p.end_opWithResult(result);
+ test(false);
+ }
+ catch(IllegalArgumentException ex)
+ {
+ }
+
+ try
+ {
+ p.end_op(null);
+ test(false);
+ }
+ catch(IllegalArgumentException ex)
+ {
+ }
+
+ // try
+// {
+// p.begin_op((Ice.Callback)null);
+// test(false);
+// }
+// catch(IllegalArgumentException ex)
+// {
+// }
+
+// try
+// {
+// p.begin_op((Callback_TestIntf_op)null);
+// test(false);
+// }
+// catch(IllegalArgumentException ex)
+// {
+// }
+ }
+ out.println("ok");
+
+ out.print("testing unexpected exceptions from callback... ");
+ out.flush();
+ {
+ TestIntfPrx q = TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy"));
+ ThrowType throwEx[] = { ThrowType.LocalException, ThrowType.OtherException };
+
+ for(int i = 0; i < 2; ++i)
+ {
+ final Thrower cb = new Thrower(throwEx[i]);
+
+ p.begin_op(new Ice.Callback()
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult result)
+ {
+ cb.opAsync(result);
+ }
+ });
+ cb.check();
+
+ p.begin_op(new Callback_TestIntf_op()
+ {
+ @Override
+ public void
+ response()
+ {
+ cb.op();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ }
+ });
+ cb.check();
+
+ q.begin_op(new Callback_TestIntf_op()
+ {
+ @Override
+ public void
+ response()
+ {
+ cb.op();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ cb.ex(ex);
+ }
+ });
+ cb.check();
+
+ p.begin_op(new Callback_TestIntf_op()
+ {
+ @Override
+ public void
+ response()
+ {
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ }
+
+ @Override
+ public void
+ sent(boolean ss)
+ {
+ cb.sent(ss);
+ }
+ });
+ cb.check();
+ }
+ }
+ out.println("ok");
+
+ out.print("testing batch requests with proxy... ");
+ out.flush();
+ {
+ test(p.ice_batchOneway().begin_ice_flushBatchRequests().sentSynchronously());
+
+ {
+ //
+ // AsyncResult.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ b1.opBatch();
+ b1.opBatch();
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = b1.begin_ice_flushBatchRequests(
+ new Ice.Callback()
+ {
+ @Override
+ public void completed(Ice.AsyncResult result)
+ {
+ cb.completedAsync(result);
+ }
+
+ @Override
+ public void sent(Ice.AsyncResult result)
+ {
+ cb.sentAsync(result);
+ }
+ });
+ cb.check();
+ test(r.isSent());
+ test(r.isCompleted());
+ test(p.waitForBatch(2));
+
+ final FlushCallback cb2 = new FlushCallback();
+ Ice.AsyncResult r2 = b1.begin_ice_flushBatchRequests(
+ new Ice.Callback()
+ {
+ @Override
+ public void completed(Ice.AsyncResult result)
+ {
+ cb2.completedAsync(result);
+ }
+
+ @Override
+ public void sent(Ice.AsyncResult result)
+ {
+ cb2.sentAsync(result);
+ }
+ });
+ cb2.check();
+ test(r2.isSent());
+ test(r2.isCompleted());
+ }
+
+ if(p.ice_getConnection() != null)
+ {
+ //
+ // AsyncResult exception.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ b1.opBatch();
+ b1.ice_getConnection().close(false);
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = b1.begin_ice_flushBatchRequests(
+ new Ice.Callback()
+ {
+ @Override
+ public void completed(Ice.AsyncResult result)
+ {
+ cb.completedAsync(result);
+ }
+
+ @Override
+ public void sent(Ice.AsyncResult result)
+ {
+ cb.sentAsync(result);
+ }
+ });
+ cb.check();
+ test(r.isSent());
+ test(r.isCompleted());
+ test(p.waitForBatch(1));
+ }
+
+ {
+ //
+ // Type-safe.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ b1.opBatch();
+ b1.opBatch();
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = b1.begin_ice_flushBatchRequests(
+ new Ice.Callback_Object_ice_flushBatchRequests()
+ {
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+
+ @Override
+ public void sent(boolean sentSynchronously)
+ {
+ cb.sent(sentSynchronously);
+ }
+ });
+ cb.check();
+ test(r.isSent());
+ test(r.isCompleted());
+ test(p.waitForBatch(2));
+ }
+
+ if(p.ice_getConnection() != null)
+ {
+ //
+ // Type-safe exception.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ b1.ice_getConnection();
+ b1.opBatch();
+ b1.ice_getConnection().close(false);
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = b1.begin_ice_flushBatchRequests(
+ new Ice.Callback_Object_ice_flushBatchRequests()
+ {
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+
+ @Override
+ public void sent(boolean sentSynchronously)
+ {
+ cb.sent(sentSynchronously);
+ }
+ });
+ cb.check();
+ test(r.isSent());
+ test(r.isCompleted());
+ test(p.waitForBatch(1));
+ }
+ }
+ out.println("ok");
+
+ if(p.ice_getConnection() != null)
+ {
+ out.print("testing batch requests with connection... ");
+ out.flush();
+ {
+ {
+ //
+ // AsyncResult.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy(
+ p.ice_getIdentity()).ice_batchOneway());
+ b1.opBatch();
+ b1.opBatch();
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(
+ new Ice.Callback()
+ {
+ @Override
+ public void completed(Ice.AsyncResult result)
+ {
+ cb.completedAsync(result);
+ }
+
+ @Override
+ public void sent(Ice.AsyncResult result)
+ {
+ cb.sentAsync(result);
+ }
+ });
+ cb.check();
+ test(r.isSent());
+ test(r.isCompleted());
+ test(p.waitForBatch(2));
+ }
+
+ {
+ //
+ // AsyncResult exception.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy(
+ p.ice_getIdentity()).ice_batchOneway());
+ b1.opBatch();
+ b1.ice_getConnection().close(false);
+ final FlushExCallback cb = new FlushExCallback();
+ Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(
+ new Ice.Callback()
+ {
+ @Override
+ public void completed(Ice.AsyncResult result)
+ {
+ cb.completedAsync(result);
+ }
+
+ @Override
+ public void sent(Ice.AsyncResult result)
+ {
+ cb.sentAsync(result);
+ }
+ });
+ cb.check();
+ test(!r.isSent());
+ test(r.isCompleted());
+ test(p.opBatchCount() == 0);
+ }
+
+ {
+ //
+ // Type-safe.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy(
+ p.ice_getIdentity()).ice_batchOneway());
+ b1.opBatch();
+ b1.opBatch();
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(
+ new Ice.Callback_Connection_flushBatchRequests()
+ {
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+
+ @Override
+ public void sent(boolean sentSynchronously)
+ {
+ cb.sent(sentSynchronously);
+ }
+ });
+ cb.check();
+ test(r.isSent());
+ test(r.isCompleted());
+ test(p.waitForBatch(2));
+ }
+
+ {
+ //
+ // Type-safe exception.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy(
+ p.ice_getIdentity()).ice_batchOneway());
+ b1.opBatch();
+ b1.ice_getConnection().close(false);
+ final FlushExCallback cb = new FlushExCallback();
+ Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(
+ new Ice.Callback_Connection_flushBatchRequests()
+ {
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+
+ @Override
+ public void sent(boolean sentSynchronously)
+ {
+ cb.sent(sentSynchronously);
+ }
+ });
+ cb.check();
+ test(!r.isSent());
+ test(r.isCompleted());
+ test(p.opBatchCount() == 0);
+ }
+ }
+ out.println("ok");
+
+ out.print("testing batch requests with communicator... ");
+ out.flush();
+ {
+ {
+ //
+ // AsyncResult - 1 connection.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy(
+ p.ice_getIdentity()).ice_batchOneway());
+ b1.opBatch();
+ b1.opBatch();
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ new Ice.Callback()
+ {
+ @Override
+ public void completed(Ice.AsyncResult result)
+ {
+ cb.completedAsync(result);
+ }
+
+ @Override
+ public void sent(Ice.AsyncResult result)
+ {
+ cb.sentAsync(result);
+ }
+ });
+ cb.check();
+ test(r.isSent());
+ test(r.isCompleted());
+ test(p.waitForBatch(2));
+ }
+
+ {
+ //
+ // AsyncResult exception - 1 connection.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy(
+ p.ice_getIdentity()).ice_batchOneway());
+ b1.opBatch();
+ b1.ice_getConnection().close(false);
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ new Ice.Callback()
+ {
+ @Override
+ public void completed(Ice.AsyncResult result)
+ {
+ cb.completedAsync(result);
+ }
+
+ @Override
+ public void sent(Ice.AsyncResult result)
+ {
+ cb.sentAsync(result);
+ }
+ });
+ cb.check();
+ test(r.isSent()); // Exceptions are ignored!
+ test(r.isCompleted());
+ test(p.opBatchCount() == 0);
+ }
+
+ {
+ //
+ // AsyncResult - 2 connections.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(
+ p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
+ TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast(
+ p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
+ b2.ice_getConnection(); // Ensure connection is established.
+ b1.opBatch();
+ b1.opBatch();
+ b2.opBatch();
+ b2.opBatch();
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ new Ice.Callback()
+ {
+ @Override
+ public void completed(Ice.AsyncResult result)
+ {
+ cb.completedAsync(result);
+ }
+
+ @Override
+ public void sent(Ice.AsyncResult result)
+ {
+ cb.sentAsync(result);
+ }
+ });
+ cb.check();
+ test(r.isSent());
+ test(r.isCompleted());
+ test(p.waitForBatch(4));
+ }
+
+ {
+ //
+ // AsyncResult exception - 2 connections - 1 failure.
+ //
+ // All connections should be flushed even if there are failures on some connections.
+ // Exceptions should not be reported.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(
+ p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
+ TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast(
+ p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
+ b2.ice_getConnection(); // Ensure connection is established.
+ b1.opBatch();
+ b2.opBatch();
+ b1.ice_getConnection().close(false);
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ new Ice.Callback()
+ {
+ @Override
+ public void completed(Ice.AsyncResult result)
+ {
+ cb.completedAsync(result);
+ }
+
+ @Override
+ public void sent(Ice.AsyncResult result)
+ {
+ cb.sentAsync(result);
+ }
+ });
+ cb.check();
+ test(r.isSent()); // Exceptions are ignored!
+ test(r.isCompleted());
+ test(p.waitForBatch(1));
+ }
+
+ {
+ //
+ // AsyncResult exception - 2 connections - 2 failures.
+ //
+ // The sent callback should be invoked even if all connections fail.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(
+ p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
+ TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast(
+ p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
+ b2.ice_getConnection(); // Ensure connection is established.
+ b1.opBatch();
+ b2.opBatch();
+ b1.ice_getConnection().close(false);
+ b2.ice_getConnection().close(false);
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ new Ice.Callback()
+ {
+ @Override
+ public void completed(Ice.AsyncResult result)
+ {
+ cb.completedAsync(result);
+ }
+
+ @Override
+ public void sent(Ice.AsyncResult result)
+ {
+ cb.sentAsync(result);
+ }
+ });
+ cb.check();
+ test(r.isSent()); // Exceptions are ignored!
+ test(r.isCompleted());
+ test(p.opBatchCount() == 0);
+ }
+
+ {
+ //
+ // Type-safe - 1 connection.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(
+ p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
+ b1.opBatch();
+ b1.opBatch();
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ new Ice.Callback_Communicator_flushBatchRequests()
+ {
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+
+ @Override
+ public void sent(boolean sentSynchronously)
+ {
+ cb.sent(sentSynchronously);
+ }
+ });
+ cb.check();
+ test(r.isSent());
+ test(r.isCompleted());
+ test(p.waitForBatch(2));
+ }
+
+ {
+ //
+ // Type-safe exception - 1 connection.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(
+ p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
+ b1.opBatch();
+ b1.ice_getConnection().close(false);
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ new Ice.Callback_Communicator_flushBatchRequests()
+ {
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+
+ @Override
+ public void sent(boolean sentSynchronously)
+ {
+ cb.sent(sentSynchronously);
+ }
+ });
+ cb.check();
+ test(r.isSent()); // Exceptions are ignored!
+ test(r.isCompleted());
+ test(p.opBatchCount() == 0);
+ }
+
+ {
+ //
+ // 2 connections.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(
+ p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
+ TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast(
+ p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
+ b2.ice_getConnection(); // Ensure connection is established.
+ b1.opBatch();
+ b1.opBatch();
+ b2.opBatch();
+ b2.opBatch();
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ new Ice.Callback_Communicator_flushBatchRequests()
+ {
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+
+ @Override
+ public void sent(boolean sentSynchronously)
+ {
+ cb.sent(sentSynchronously);
+ }
+ });
+ cb.check();
+ test(r.isSent());
+ test(r.isCompleted());
+ test(p.waitForBatch(4));
+ }
+
+ {
+ //
+ // Exception - 2 connections - 1 failure.
+ //
+ // All connections should be flushed even if there are failures on some connections.
+ // Exceptions should not be reported.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(
+ p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
+ TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast(
+ p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
+ b2.ice_getConnection(); // Ensure connection is established.
+ b1.opBatch();
+ b2.opBatch();
+ b1.ice_getConnection().close(false);
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ new Ice.Callback_Communicator_flushBatchRequests()
+ {
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+
+ @Override
+ public void sent(boolean sentSynchronously)
+ {
+ cb.sent(sentSynchronously);
+ }
+ });
+ cb.check();
+ test(r.isSent()); // Exceptions are ignored!
+ test(r.isCompleted());
+ test(p.waitForBatch(1));
+ }
+
+ {
+ //
+ // Exception - 2 connections - 2 failures.
+ //
+ // The sent callback should be invoked even if all connections fail.
+ //
+ test(p.opBatchCount() == 0);
+ TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(
+ p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
+ TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast(
+ p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
+ b2.ice_getConnection(); // Ensure connection is established.
+ b1.opBatch();
+ b2.opBatch();
+ b1.ice_getConnection().close(false);
+ b2.ice_getConnection().close(false);
+ final FlushCallback cb = new FlushCallback();
+ Ice.AsyncResult r = communicator.begin_flushBatchRequests(
+ new Ice.Callback_Communicator_flushBatchRequests()
+ {
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+
+ @Override
+ public void sent(boolean sentSynchronously)
+ {
+ cb.sent(sentSynchronously);
+ }
+ });
+ cb.check();
+ test(r.isSent()); // Exceptions are ignored!
+ test(r.isCompleted());
+ test(p.opBatchCount() == 0);
+ }
+ }
+ out.println("ok");
+ }
+
+ out.print("testing AsyncResult operations... ");
+ out.flush();
+ {
+ {
+ TestIntfPrx indirect = TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy"));
+ Ice.AsyncResult r = indirect.begin_op();
+ try
+ {
+ r.waitForCompleted();
+ r.throwLocalException();
+ test(false);
+ }
+ catch(Ice.NoEndpointException ex)
+ {
+ }
+
+ testController.holdAdapter();
+ Ice.AsyncResult r1;
+ Ice.AsyncResult r2;
+ try
+ {
+ r1 = p.begin_op();
+ byte[] seq = new byte[10024];
+ while((r2 = p.begin_opWithPayload(seq)).sentSynchronously());
+
+ if(p.ice_getConnection() != null)
+ {
+ test(r1.sentSynchronously() && r1.isSent() && !r1.isCompleted() ||
+ !r1.sentSynchronously() && !r1.isCompleted());
+
+ test(!r2.sentSynchronously() && !r2.isCompleted());
+ }
+ }
+ finally
+ {
+ testController.resumeAdapter();
+ }
+
+ r1.waitForSent();
+ test(r1.isSent());
+
+ r2.waitForSent();
+ test(r2.isSent());
+
+ r1.waitForCompleted();
+ test(r1.isCompleted());
+
+ r2.waitForCompleted();
+ test(r2.isCompleted());
+
+ test(r1.getOperation().equals("op"));
+ test(r2.getOperation().equals("opWithPayload"));
+ }
+
+ {
+ Ice.AsyncResult r;
+
+ //
+ // Twoway
+ //
+ r = p.begin_ice_ping();
+ test(r.getOperation().equals("ice_ping"));
+ test(r.getConnection() == null); // Expected
+ test(r.getCommunicator() == communicator);
+ test(r.getProxy() == p);
+ p.end_ice_ping(r);
+
+ TestIntfPrx p2;
+
+ //
+ // Oneway
+ //
+ p2 = (TestIntfPrx)p.ice_oneway();
+ r = p2.begin_ice_ping();
+ test(r.getOperation().equals("ice_ping"));
+ test(r.getConnection() == null); // Expected
+ test(r.getCommunicator() == communicator);
+ test(r.getProxy() == p2);
+
+ //
+ // Batch request via proxy
+ //
+ p2 = (TestIntfPrx)p.ice_batchOneway();
+ p2.ice_ping();
+ r = p2.begin_ice_flushBatchRequests();
+ test(r.getConnection() == null); // Expected
+ test(r.getCommunicator() == communicator);
+ test(r.getProxy() == p2);
+ p2.end_ice_flushBatchRequests(r);
+
+ if(p.ice_getConnection() != null)
+ {
+ //
+ // Batch request via connection
+ //
+ Ice.Connection con = p.ice_getConnection();
+ p2 = (TestIntfPrx)p.ice_batchOneway();
+ p2.ice_ping();
+ r = con.begin_flushBatchRequests();
+ test(r.getConnection() == con);
+ test(r.getCommunicator() == communicator);
+ test(r.getProxy() == null); // Expected
+ con.end_flushBatchRequests(r);
+
+ //
+ // Batch request via communicator
+ //
+ p2 = (TestIntfPrx)p.ice_batchOneway();
+ p2.ice_ping();
+ r = communicator.begin_flushBatchRequests();
+ test(r.getConnection() == null); // Expected
+ test(r.getCommunicator() == communicator);
+ test(r.getProxy() == null); // Expected
+ communicator.end_flushBatchRequests(r);
+ }
+ }
+
+ if(p.ice_getConnection() != null)
+ {
+ Ice.AsyncResult r1 = null;
+ Ice.AsyncResult r2 = null;
+
+ testController.holdAdapter();
+ try
+ {
+ Ice.AsyncResult r = null;
+ byte[] seq = new byte[10024];
+ for(int i = 0; i < 200; ++i) // 2MB
+ {
+ r = p.begin_opWithPayload(seq);
+ }
+
+ test(!r.isSent());
+
+ r1 = p.begin_ice_ping();
+ r2 = p.begin_ice_id();
+ r1.cancel();
+ r2.cancel();
+ try
+ {
+ p.end_ice_ping(r1);
+ test(false);
+ }
+ catch(Ice.InvocationCanceledException ex)
+ {
+ }
+ try
+ {
+ p.end_ice_id(r2);
+ test(false);
+ }
+ catch(Ice.InvocationCanceledException ex)
+ {
+ }
+ }
+ finally
+ {
+ testController.resumeAdapter();
+ }
+ p.ice_ping();
+ test(!r1.isSent() && r1.isCompleted());
+ test(!r2.isSent() && r2.isCompleted());
+
+ testController.holdAdapter();
+ try
+ {
+ r1 = p.begin_op();
+ r2 = p.begin_ice_id();
+ r1.waitForSent();
+ r2.waitForSent();
+ r1.cancel();
+ r2.cancel();
+ try
+ {
+ p.end_op(r1);
+ test(false);
+ }
+ catch(Ice.InvocationCanceledException ex)
+ {
+ }
+ try
+ {
+ p.end_ice_id(r2);
+ test(false);
+ }
+ catch(Ice.InvocationCanceledException ex)
+ {
+ }
+ }
+ finally
+ {
+ testController.resumeAdapter();
+ }
+ }
+ }
+ out.println("ok");
+
+ if(p.ice_getConnection() != null)
+ {
+ out.print("testing close connection with sending queue... ");
+ out.flush();
+ {
+ byte[] seq = new byte[1024 * 10];
+
+ //
+ // Send multiple opWithPayload, followed by a close and followed by multiple opWithPaylod.
+ // The goal is to make sure that none of the opWithPayload fail even if the server closes
+ // the connection gracefully in between.
+ //
+ int maxQueue = 2;
+ boolean done = false;
+ while(!done && maxQueue < 50)
+ {
+ done = true;
+ p.ice_ping();
+ java.util.List<Ice.AsyncResult> results = new java.util.ArrayList<Ice.AsyncResult>();
+ for(int i = 0; i < maxQueue; ++i)
+ {
+ results.add(p.begin_opWithPayload(seq));
+ }
+ if(!p.begin_close(false).isSent())
+ {
+ for(int i = 0; i < maxQueue; i++)
+ {
+ Ice.AsyncResult r = p.begin_opWithPayload(seq);
+ results.add(r);
+ if(r.isSent())
+ {
+ done = false;
+ maxQueue *= 2;
+ break;
+ }
+ }
+ }
+ else
+ {
+ maxQueue *= 2;
+ done = false;
+ }
+ for(Ice.AsyncResult q : results)
+ {
+ q.waitForCompleted();
+ try
+ {
+ q.throwLocalException();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ }
+ }
+ }
+ out.println("ok");
+ }
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/ami/AllTests.java b/java-compat/test/src/main/java/test/Ice/ami/AllTests.java
new file mode 100644
index 00000000000..c7dbc15a539
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/ami/AllTests.java
@@ -0,0 +1,90 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.ami;
+
+import java.io.PrintWriter;
+
+import test.Ice.ami.Test.TestIntfPrx;
+import test.Ice.ami.Test.TestIntfPrxHelper;
+import test.Ice.ami.Test.TestIntfControllerPrx;
+import test.Ice.ami.Test.TestIntfControllerPrxHelper;
+import test.Util.Application;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static void
+ allTests(Application app, boolean collocated)
+ {
+ Ice.Communicator communicator = app.communicator();
+ PrintWriter out = app.getWriter();
+
+ String sref = "test:default -p 12010";
+ Ice.ObjectPrx obj = communicator.stringToProxy(sref);
+ test(obj != null);
+
+ TestIntfPrx p = TestIntfPrxHelper.uncheckedCast(obj);
+
+ sref = "testController:default -p 12011";
+ obj = communicator.stringToProxy(sref);
+ test(obj != null);
+
+ TestIntfControllerPrx testController = TestIntfControllerPrxHelper.uncheckedCast(obj);
+
+ out.println("testing with new AMI mapping... ");
+ test.Ice.ami.AMI.run(app, communicator, collocated, p, testController);
+
+ //
+ // Use reflection to load TwowaysLambdaAMI as that is only supported with Java >= 1.8
+ //
+ try
+ {
+ Class<?> cls = IceInternal.Util.findClass("test.Ice.ami.lambda.AMI", null);
+ if(cls != null)
+ {
+ java.lang.reflect.Method run = cls.getDeclaredMethod(
+ "run",
+ new Class<?>[]
+ {
+ test.Util.Application.class,
+ Ice.Communicator.class,
+ boolean.class,
+ TestIntfPrx.class,
+ TestIntfControllerPrx.class
+ });
+ out.println("testing with lambda AMI mapping... ");
+ out.flush();
+ run.invoke(null, app, communicator, collocated, p, testController);
+ }
+ }
+ catch(java.lang.NoSuchMethodException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ catch(java.lang.IllegalAccessException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ catch(java.lang.reflect.InvocationTargetException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+
+ p.shutdown();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/ami/Client.java b/java-compat/test/src/main/java/test/Ice/ami/Client.java
new file mode 100644
index 00000000000..e08515e7d62
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/ami/Client.java
@@ -0,0 +1,45 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.ami;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ AllTests.allTests(this, false);
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami");
+ initData.properties.setProperty("Ice.Warn.AMICallback", "0");
+
+ //
+ // Limit the send buffer size, this test relies on the socket
+ // send() blocking after sending a given amount of data.
+ //
+ initData.properties.setProperty("Ice.TCP.SndSize", "50000");
+
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/ami/Collocated.java b/java-compat/test/src/main/java/test/Ice/ami/Collocated.java
new file mode 100644
index 00000000000..429d4ed2dfd
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/ami/Collocated.java
@@ -0,0 +1,49 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.ami;
+
+public class Collocated extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
+
+ adapter.add(new TestI(), Ice.Util.stringToIdentity("test"));
+ //adapter.activate(); // Collocated test doesn't need to activate the OA
+ adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController"));
+ //adapter2.activate(); // Collocated test doesn't need to activate the OA
+
+ AllTests.allTests(this, true);
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ initData.properties.setProperty("ControllerAdapter.Endpoints", "default -p 12011");
+ initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
+ initData.properties.setProperty("Ice.Warn.AMICallback", "0");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Collocated app = new Collocated();
+ int result = app.main("Collocated", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/ami/Server.java b/java-compat/test/src/main/java/test/Ice/ami/Server.java
new file mode 100644
index 00000000000..92c745419dd
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/ami/Server.java
@@ -0,0 +1,54 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.ami;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int
+ run(String[] args)
+ {
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
+
+ adapter.add(new TestI(), Ice.Util.stringToIdentity("test"));
+ adapter.activate();
+ adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController"));
+ adapter2.activate();
+
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ initData.properties.setProperty("ControllerAdapter.Endpoints", "default -p 12011");
+ initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
+ //
+ // Limit the recv buffer size, this test relies on the socket
+ // send() blocking after sending a given amount of data.
+ //
+ initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
+ return initData;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/ami/Test.ice b/java-compat/test/src/main/java/test/Ice/ami/Test.ice
new file mode 100644
index 00000000000..82b3fe6d383
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/ami/Test.ice
@@ -0,0 +1,52 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+#include <Ice/BuiltinSequences.ice>
+#include <Ice/Endpoint.ice>
+
+[["java:package:test.Ice.ami"]]
+module Test
+{
+
+exception TestIntfException
+{
+};
+
+interface TestIntf
+{
+ void op();
+ void opWithPayload(Ice::ByteSeq seq);
+ int opWithResult();
+ void opWithUE()
+ throws TestIntfException;
+ void opBatch();
+ int opBatchCount();
+ bool waitForBatch(int count);
+ void close(bool force);
+ void shutdown();
+
+ bool supportsFunctionalTests();
+ bool opBool(bool b);
+ byte opByte(byte b);
+ short opShort(short s);
+ int opInt(int i);
+ long opLong(long l);
+ float opFloat(float f);
+ double opDouble(double d);
+};
+
+interface TestIntfController
+{
+ void holdAdapter();
+ void resumeAdapter();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/ami/TestControllerI.java b/java-compat/test/src/main/java/test/Ice/ami/TestControllerI.java
new file mode 100644
index 00000000000..b27b82abda4
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/ami/TestControllerI.java
@@ -0,0 +1,36 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+package test.Ice.ami;
+
+import test.Ice.ami.Test._TestIntfControllerDisp;
+
+class TestControllerI extends _TestIntfControllerDisp
+{
+ @Override
+ public void
+ holdAdapter(Ice.Current current)
+ {
+ _adapter.hold();
+ }
+
+ @Override
+ public void
+ resumeAdapter(Ice.Current current)
+ {
+ _adapter.activate();
+ }
+
+ public
+ TestControllerI(Ice.ObjectAdapter adapter)
+ {
+ _adapter = adapter;
+ }
+
+ final private Ice.ObjectAdapter _adapter;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/ami/TestI.java b/java-compat/test/src/main/java/test/Ice/ami/TestI.java
new file mode 100644
index 00000000000..b0c6df0cf4a
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/ami/TestI.java
@@ -0,0 +1,145 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.ami;
+
+import test.Ice.ami.Test._TestIntfDisp;
+import test.Ice.ami.Test.TestIntfException;
+
+public class TestI extends _TestIntfDisp
+{
+ TestI()
+ {
+ }
+
+ @Override
+ public void
+ op(Ice.Current current)
+ {
+ }
+
+ @Override
+ public int
+ opWithResult(Ice.Current current)
+ {
+ return 15;
+ }
+
+ @Override
+ public void
+ opWithUE(Ice.Current current)
+ throws TestIntfException
+ {
+ throw new TestIntfException();
+ }
+
+ @Override
+ public void
+ opWithPayload(byte[] seq, Ice.Current current)
+ {
+ }
+
+ @Override
+ public synchronized void
+ opBatch(Ice.Current current)
+ {
+ ++_batchCount;
+ notify();
+ }
+
+ @Override
+ public synchronized int
+ opBatchCount(Ice.Current current)
+ {
+ return _batchCount;
+ }
+
+ @Override
+ public boolean supportsFunctionalTests(Ice.Current current)
+ {
+ return true;
+ }
+
+ @Override
+ public boolean opBool(boolean b, Ice.Current current)
+ {
+ return b;
+ }
+
+ @Override
+ public byte opByte(byte b, Ice.Current current)
+ {
+ return b;
+ }
+
+ @Override
+ public short opShort(short s, Ice.Current current)
+ {
+ return s;
+ }
+
+ @Override
+ public int opInt(int i, Ice.Current current)
+ {
+ return i;
+ }
+
+ @Override
+ public long opLong(long l, Ice.Current current)
+ {
+ return l;
+ }
+
+ @Override
+ public float opFloat(float f, Ice.Current current)
+ {
+ return f;
+ }
+
+ @Override
+ public double opDouble(double d, Ice.Current current)
+ {
+ return d;
+ }
+
+ @Override
+ public synchronized boolean
+ waitForBatch(int count, Ice.Current current)
+ {
+ while(_batchCount < count)
+ {
+ try
+ {
+ wait(5000);
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+ boolean result = count == _batchCount;
+ _batchCount = 0;
+ return result;
+ }
+
+ @Override
+ public void
+ close(boolean force, Ice.Current current)
+ {
+ current.con.close(force);
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+
+ private int _batchCount;
+}
diff --git a/java/test/src/main/java/test/Ice/ami/lambda/AMI.java b/java-compat/test/src/main/java/test/Ice/ami/lambda/AMI.java
index eb572f481e2..eb572f481e2 100644
--- a/java/test/src/main/java/test/Ice/ami/lambda/AMI.java
+++ b/java-compat/test/src/main/java/test/Ice/ami/lambda/AMI.java
diff --git a/java-compat/test/src/main/java/test/Ice/ami/run.py b/java-compat/test/src/main/java/test/Ice/ami/run.py
new file mode 100755
index 00000000000..97eec95871b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/ami/run.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.queueCollocatedTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/background/Acceptor.java b/java-compat/test/src/main/java/test/Ice/background/Acceptor.java
new file mode 100644
index 00000000000..c97479ec1b7
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/background/Acceptor.java
@@ -0,0 +1,86 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.background;
+
+class Acceptor implements IceInternal.Acceptor
+{
+ @Override
+ public java.nio.channels.ServerSocketChannel
+ fd()
+ {
+ return _acceptor.fd();
+ }
+
+ @Override
+ public void setReadyCallback(IceInternal.ReadyCallback callback)
+ {
+ // No need to for the ready callback.
+ }
+
+ @Override
+ public void
+ close()
+ {
+ _acceptor.close();
+ }
+
+ @Override
+ public IceInternal.EndpointI
+ listen()
+ {
+ _endpoint = _endpoint.endpoint(_acceptor.listen());
+ return _endpoint;
+ }
+
+ @Override
+ public IceInternal.Transceiver
+ accept()
+ {
+ return new Transceiver(_configuration, _acceptor.accept());
+ }
+
+ @Override
+ public String
+ protocol()
+ {
+ return _acceptor.protocol();
+ }
+
+ @Override
+ public String
+ toString()
+ {
+ return _acceptor.toString();
+ }
+
+ @Override
+ public String
+ toDetailedString()
+ {
+ return _acceptor.toDetailedString();
+ }
+
+ public IceInternal.Acceptor
+ delegate()
+ {
+ return _acceptor;
+ }
+
+ Acceptor(EndpointI endpoint, Configuration configuration, IceInternal.Acceptor acceptor)
+ {
+ _endpoint = endpoint;
+ _configuration = configuration;
+ _acceptor = acceptor;
+ }
+
+ private EndpointI _endpoint;
+ final private IceInternal.Acceptor _acceptor;
+ private Configuration _configuration;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/background/AllTests.java b/java-compat/test/src/main/java/test/Ice/background/AllTests.java
new file mode 100644
index 00000000000..627b2346744
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/background/AllTests.java
@@ -0,0 +1,1352 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+package test.Ice.background;
+
+import java.io.PrintWriter;
+
+import test.Ice.background.Test.BackgroundControllerPrx;
+import test.Ice.background.Test.BackgroundControllerPrxHelper;
+import test.Ice.background.Test.BackgroundPrx;
+import test.Ice.background.Test.BackgroundPrxHelper;
+import test.Ice.background.Test.Callback_Background_op;
+import test.Ice.background.Test.Callback_Background_opWithPayload;
+
+public class AllTests
+{
+ private static void test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private static class Callback
+ {
+ Callback()
+ {
+ _called = false;
+ }
+
+ public synchronized void check()
+ {
+ while(!_called)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+ _called = false;
+ }
+
+ public synchronized void called()
+ {
+ assert(!_called);
+ _called = true;
+ notify();
+ }
+
+ public synchronized boolean isCalled()
+ {
+ return _called;
+ }
+
+ private boolean _called;
+ }
+
+ private static class OpAMICallback extends Callback_Background_op
+ {
+ @Override
+ public void response()
+ {
+ _response.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ @Override
+ public void sent(boolean ss)
+ {
+ _sent.called();
+ }
+
+ public boolean response(boolean wait)
+ {
+ if(wait)
+ {
+ _response.check();
+ return true;
+ }
+ else
+ {
+ return _response.isCalled();
+ }
+ }
+
+ public void responseAndSent()
+ {
+ _sent.check();
+ _response.check();
+ }
+
+ private Callback _response = new Callback();
+ private Callback _sent = new Callback();
+ }
+
+ private static class OpAMICallbackEx extends Callback_Background_op
+ {
+ @Override
+ public void response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ _response.called();
+ }
+
+ @Override
+ public void sent(boolean ss)
+ {
+ _sent.called();
+ }
+
+ public boolean exception(boolean wait)
+ {
+ if(wait)
+ {
+ _response.check();
+ return true;
+ }
+ else
+ {
+ return _response.isCalled();
+ }
+ }
+
+ private Callback _response = new Callback();
+ private Callback _sent = new Callback();
+ }
+
+ private static class OpAMICallbackNoOp extends Callback_Background_op
+ {
+ @Override
+ public void response()
+ {
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ @Override
+ public void sent(boolean ss)
+ {
+ }
+ }
+
+ private static class NoResponse extends Callback_Background_opWithPayload
+ {
+ @Override
+ public void response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ }
+
+ /*
+ private static class OpWithPayloadOnewayAMICallback extends AMI_Background_opWithPayload
+ {
+ public void
+ ice_response()
+ {
+ test(false);
+ }
+
+ public void
+ ice_exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ }
+
+ private static class FlushBatchRequestsCallback extends Ice.AMI_Object_ice_flushBatchRequests
+ {
+ public void
+ ice_exception(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ }
+ */
+
+ static class OpThread extends Thread
+ {
+ OpThread(BackgroundPrx background)
+ {
+ _destroyed = false;
+ _background = BackgroundPrxHelper.uncheckedCast(background.ice_oneway());
+ start();
+ }
+
+ @Override
+ public void
+ run()
+ {
+ int count = 0;
+ while(true)
+ {
+ synchronized(this)
+ {
+ if(_destroyed)
+ {
+ return;
+ }
+ }
+
+ try
+ {
+ if(++count == 10) // Don't blast the connection with only oneway's
+ {
+ count = 0;
+ _background.ice_twoway().ice_ping();
+ }
+ _background.op();
+ try
+ {
+ Thread.sleep(1);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ }
+ }
+
+ public synchronized void
+ _destroy() // Thread.destroy is deprecated
+ {
+ _destroyed = true;
+ }
+
+ private boolean _destroyed;
+ private BackgroundPrx _background = null;
+ }
+
+ public static BackgroundPrx
+ allTests(Configuration configuration, Ice.Communicator communicator, PrintWriter out)
+ {
+ String sref = "background:default -p 12010";
+ Ice.ObjectPrx obj = communicator.stringToProxy(sref);
+ test(obj != null);
+
+ BackgroundPrx background = BackgroundPrxHelper.uncheckedCast(obj);
+
+ sref = "backgroundController:tcp -p 12011";
+ obj = communicator.stringToProxy(sref);
+ test(obj != null);
+
+ BackgroundControllerPrx backgroundController = BackgroundControllerPrxHelper.uncheckedCast(obj);
+
+ out.print("testing connect... ");
+ out.flush();
+ {
+ connectTests(configuration, background);
+ }
+ out.println("ok");
+
+ out.print("testing initialization... ");
+ out.flush();
+ {
+ initializeTests(configuration, background, backgroundController);
+ }
+ out.println("ok");
+
+ out.print("testing connection validation... ");
+ out.flush();
+ {
+ validationTests(configuration, background, backgroundController);
+ }
+ out.println("ok");
+
+ out.print("testing read/write... ");
+ out.flush();
+ {
+ readWriteTests(configuration, background, backgroundController);
+ }
+ out.println("ok");
+
+ out.print("testing locator... ");
+ out.flush();
+ {
+ Ice.LocatorPrx locator;
+ obj = communicator.stringToProxy("locator:default -p 12010").ice_invocationTimeout(250);
+ locator = Ice.LocatorPrxHelper.uncheckedCast(obj);
+ obj = communicator.stringToProxy("background@Test").ice_locator(locator).ice_oneway();
+
+ backgroundController.pauseCall("findAdapterById");
+ try
+ {
+ obj.ice_ping();
+ test(false);
+ }
+ catch(Ice.TimeoutException ex)
+ {
+ }
+ backgroundController.resumeCall("findAdapterById");
+
+ obj = communicator.stringToProxy("locator:default -p 12010");
+ locator = Ice.LocatorPrxHelper.uncheckedCast(obj);
+ obj = obj.ice_locator(locator);
+ obj.ice_ping();
+
+ obj = communicator.stringToProxy("background@Test").ice_locator(locator);
+ BackgroundPrx bg = BackgroundPrxHelper.uncheckedCast(obj);
+
+ backgroundController.pauseCall("findAdapterById");
+ Ice.AsyncResult r1 = bg.begin_op();
+ Ice.AsyncResult r2 = bg.begin_op();
+ test(!r1.isCompleted());
+ test(!r2.isCompleted());
+ backgroundController.resumeCall("findAdapterById");
+ bg.end_op(r1);
+ bg.end_op(r2);
+ test(r1.isCompleted());
+ test(r2.isCompleted());
+ }
+ out.println("ok");
+
+ out.print("testing router... ");
+ out.flush();
+ {
+ Ice.RouterPrx router;
+
+ obj = communicator.stringToProxy("router:default -p 12010").ice_invocationTimeout(250);
+ router = Ice.RouterPrxHelper.uncheckedCast(obj);
+ obj = communicator.stringToProxy("background@Test").ice_router(router).ice_oneway();
+
+ backgroundController.pauseCall("getClientProxy");
+ try
+ {
+ obj.ice_ping();
+ test(false);
+ }
+ catch(Ice.TimeoutException ex)
+ {
+ }
+ backgroundController.resumeCall("getClientProxy");
+
+ obj = communicator.stringToProxy("router:default -p 12010");
+ router = Ice.RouterPrxHelper.uncheckedCast(obj);
+ obj = communicator.stringToProxy("background@Test").ice_router(router);
+ BackgroundPrx bg = BackgroundPrxHelper.uncheckedCast(obj);
+ test(bg.ice_getRouter() != null);
+
+ backgroundController.pauseCall("getClientProxy");
+ Ice.AsyncResult r1 = bg.begin_op();
+ Ice.AsyncResult r2 = bg.begin_op();
+ test(!r1.isCompleted());
+ test(!r2.isCompleted());
+ backgroundController.resumeCall("getClientProxy");
+ bg.end_op(r1);
+ bg.end_op(r2);
+ test(r1.isCompleted());
+ test(r2.isCompleted());
+ }
+ out.println("ok");
+
+ final boolean ws = communicator.getProperties().getProperty("Ice.Default.Protocol").equals("test-ws");
+ final boolean wss = communicator.getProperties().getProperty("Ice.Default.Protocol").equals("test-wss");
+ if(!ws && !wss)
+ {
+ out.print("testing buffered transport... ");
+ out.flush();
+
+ configuration.buffered(true);
+ backgroundController.buffered(true);
+ background.begin_op();
+ background.ice_getCachedConnection().close(true);
+ background.begin_op();
+
+ OpAMICallbackNoOp cb = new OpAMICallbackNoOp();
+ java.util.List<Ice.AsyncResult> results = new java.util.ArrayList<Ice.AsyncResult>();
+ for(int i = 0; i < 10000; ++i)
+ {
+ Ice.AsyncResult r = background.begin_op(cb);
+ results.add(r);
+ if(i % 50 == 0)
+ {
+ backgroundController.holdAdapter();
+ backgroundController.resumeAdapter();
+ }
+ if(i % 100 == 0)
+ {
+ r.waitForCompleted();
+ }
+ }
+ for(Ice.AsyncResult r : results)
+ {
+ r.waitForCompleted();
+ }
+
+ out.println("ok");
+ }
+
+ return background;
+ }
+
+ private static void
+ connectTests(Configuration configuration, BackgroundPrx background)
+ {
+ try
+ {
+ background.op();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ background.ice_getConnection().close(false);
+
+ for(int i = 0; i < 4; ++i)
+ {
+ if(i == 0 || i == 2)
+ {
+ configuration.connectorsException(new Ice.DNSException());
+ }
+ else
+ {
+ configuration.connectException(new Ice.SocketException());
+ }
+ BackgroundPrx prx = (i == 1 || i == 3) ? background : (BackgroundPrx)background.ice_oneway();
+
+ try
+ {
+ prx.op();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+
+ Ice.AsyncResult r = prx.begin_op();
+ test(!r.sentSynchronously());
+ try
+ {
+ prx.end_op(r);
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ test(r.isCompleted());
+
+ OpAMICallbackEx cbEx = new OpAMICallbackEx();
+ r = prx.begin_op(cbEx);
+ test(!r.sentSynchronously());
+ cbEx.exception(true);
+ test(r.isCompleted());
+
+ if(i == 0 || i == 2)
+ {
+ configuration.connectorsException(null);
+ }
+ else
+ {
+ configuration.connectException(null);
+ }
+ }
+
+ OpThread thread1 = new OpThread(background);
+ OpThread thread2 = new OpThread(background);
+
+ for(int i = 0; i < 5; i++)
+ {
+ try
+ {
+ background.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ configuration.connectException(new Ice.SocketException());
+ background.ice_getCachedConnection().close(true);
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ configuration.connectException(null);
+ try
+ {
+ background.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ }
+
+ thread1._destroy();
+ thread2._destroy();
+
+ try
+ {
+ thread1.join();
+ thread2.join();
+ }
+ catch(InterruptedException e)
+ {
+ }
+ }
+
+ private static void
+ initializeTests(Configuration configuration, BackgroundPrx background, BackgroundControllerPrx ctl)
+ {
+ try
+ {
+ background.op();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ background.ice_getConnection().close(false);
+
+ for(int i = 0; i < 4; i++)
+ {
+ if(i == 0 || i == 2)
+ {
+ configuration.initializeException(new Ice.SocketException());
+ }
+ else
+ {
+ configuration.initializeSocketStatus(IceInternal.SocketOperation.Write);
+ configuration.initializeException(new Ice.SocketException());
+ }
+ BackgroundPrx prx = (i == 1 || i == 3) ? background : (BackgroundPrx)background.ice_oneway();
+
+ try
+ {
+ prx.op();
+ test(false);
+ }
+ catch(Ice.SocketException ex)
+ {
+ }
+
+ Ice.AsyncResult r = prx.begin_op();
+ test(!r.sentSynchronously());
+ try
+ {
+ prx.end_op(r);
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ test(r.isCompleted());
+
+ OpAMICallbackEx cbEx = new OpAMICallbackEx();
+ r = prx.begin_op(cbEx);
+ test(!r.sentSynchronously());
+ cbEx.exception(true);
+ test(r.isCompleted());
+
+ if(i == 0 || i == 2)
+ {
+ configuration.initializeException(null);
+ }
+ else
+ {
+ configuration.initializeSocketStatus(IceInternal.SocketOperation.None);
+ configuration.initializeException(null);
+ }
+ }
+
+ try
+ {
+ configuration.initializeSocketStatus(IceInternal.SocketOperation.Connect);
+ background.op();
+ configuration.initializeSocketStatus(IceInternal.SocketOperation.None);
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ background.ice_getConnection().close(false);
+
+ try
+ {
+ configuration.initializeSocketStatus(IceInternal.SocketOperation.Write);
+ background.op();
+ configuration.initializeSocketStatus(IceInternal.SocketOperation.None);
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ background.ice_getConnection().close(false);
+
+ try
+ {
+ configuration.initializeSocketStatus(IceInternal.SocketOperation.Write);
+ configuration.initializeException(new Ice.SocketException());
+ background.op();
+ test(false);
+ }
+ catch(Ice.SocketException ex)
+ {
+ configuration.initializeException(null);
+ configuration.initializeSocketStatus(IceInternal.SocketOperation.None);
+ }
+
+ //
+ // Now run the same tests with the server side.
+ //
+
+ try
+ {
+ ctl.initializeException(true);
+ background.op();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ ctl.initializeException(false);
+ }
+ catch(Ice.SecurityException ex)
+ {
+ ctl.initializeException(false);
+ }
+
+ try
+ {
+ ctl.initializeSocketStatus(IceInternal.SocketOperation.Write);
+ background.op();
+ ctl.initializeSocketStatus(IceInternal.SocketOperation.None);
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ background.ice_getConnection().close(false);
+
+ try
+ {
+ ctl.initializeSocketStatus(IceInternal.SocketOperation.Write);
+ ctl.initializeException(true);
+ background.op();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ ctl.initializeException(false);
+ ctl.initializeSocketStatus(IceInternal.SocketOperation.None);
+ }
+ catch(Ice.SecurityException ex)
+ {
+ ctl.initializeException(false);
+ ctl.initializeSocketStatus(IceInternal.SocketOperation.None);
+ }
+
+ OpThread thread1 = new OpThread(background);
+ OpThread thread2 = new OpThread(background);
+
+ for(int i = 0; i < 5; i++)
+ {
+ try
+ {
+ background.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ configuration.initializeException(new Ice.SocketException());
+ background.ice_getCachedConnection().close(true);
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ configuration.initializeException(null);
+ try
+ {
+ background.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ try
+ {
+ background.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ configuration.initializeSocketStatus(IceInternal.SocketOperation.Write);
+ background.ice_getCachedConnection().close(true);
+
+ try
+ {
+ background.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false); // Something's wrong with retries.
+ }
+
+ configuration.initializeSocketStatus(IceInternal.SocketOperation.None);
+
+ ctl.initializeException(true);
+ background.ice_getCachedConnection().close(true);
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ ctl.initializeException(false);
+ try
+ {
+ background.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ try
+ {
+ background.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ try
+ {
+ ctl.initializeSocketStatus(IceInternal.SocketOperation.Write);
+ background.ice_getCachedConnection().close(true);
+ background.op();
+ ctl.initializeSocketStatus(IceInternal.SocketOperation.None);
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ }
+
+ thread1._destroy();
+ thread2._destroy();
+
+ try
+ {
+ thread1.join();
+ thread2.join();
+ }
+ catch(InterruptedException e)
+ {
+ }
+ }
+
+ private static void
+ validationTests(Configuration configuration, BackgroundPrx background, BackgroundControllerPrx ctl)
+ {
+ try
+ {
+ background.op();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ background.ice_getConnection().close(false);
+
+ try
+ {
+ // Get the read() of connection validation to throw right away.
+ configuration.readException(new Ice.SocketException());
+ background.op();
+ test(false);
+ }
+ catch(Ice.SocketException ex)
+ {
+ configuration.readException(null);
+ }
+
+ for(int i = 0; i < 2; i++)
+ {
+ configuration.readException(new Ice.SocketException());
+ BackgroundPrx prx = i == 0 ? background : (BackgroundPrx)background.ice_oneway();
+ Ice.AsyncResult r = prx.begin_op();
+ test(!r.sentSynchronously());
+ try
+ {
+ prx.end_op(r);
+ test(false);
+ }
+ catch(Ice.SocketException ex)
+ {
+ }
+ test(r.isCompleted());
+ configuration.readException(null);
+ }
+
+ if(!background.ice_getCommunicator().getProperties().getProperty("Ice.Default.Protocol").equals("test-ssl"))
+ {
+ try
+ {
+ // Get the read() of the connection validation to return "would block"
+ configuration.readReady(false);
+ background.op();
+ configuration.readReady(true);
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ background.ice_getConnection().close(false);
+
+ try
+ {
+ // Get the read() of the connection validation to return "would block" and then throw.
+ configuration.readReady(false);
+ configuration.readException(new Ice.SocketException());
+ background.op();
+ test(false);
+ }
+ catch(Ice.SocketException ex)
+ {
+ configuration.readException(null);
+ configuration.readReady(true);
+ }
+
+ for(int i = 0; i < 2; i++)
+ {
+ configuration.readReady(false);
+ configuration.readException(new Ice.SocketException());
+ Ice.AsyncResult r = background.begin_op();
+ test(!r.sentSynchronously());
+ try
+ {
+ background.end_op(r);
+ test(false);
+ }
+ catch(Ice.SocketException ex)
+ {
+ }
+ test(r.isCompleted());
+ configuration.readException(null);
+ configuration.readReady(true);
+ }
+ }
+
+ ctl.holdAdapter(); // Hold to block in connection validation
+ Ice.AsyncResult r = background.begin_op();
+ Ice.AsyncResult r2 = background.begin_op();
+ test(!r.sentSynchronously() && !r2.sentSynchronously());
+ test(!r.isCompleted() && !r2.isCompleted());
+ ctl.resumeAdapter();
+ background.end_op(r);
+ background.end_op(r2);
+ test(r.isCompleted() && r2.isCompleted());
+
+ try
+ {
+ // Get the write() of connection validation to throw right away.
+ ctl.writeException(true);
+ background.op();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ ctl.writeException(false);
+ }
+
+ try
+ {
+ // Get the write() of the connection validation to return "would block"
+ ctl.writeReady(false);
+ background.op();
+ ctl.writeReady(true);
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ background.ice_getConnection().close(false);
+
+ try
+ {
+ // Get the write() of the connection validation to return "would block" and then throw.
+ ctl.writeReady(false);
+ ctl.writeException(true);
+ background.op();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ ctl.writeException(false);
+ ctl.writeReady(true);
+ }
+
+ byte[] seq = new byte[512 * 1024];
+
+ BackgroundPrx backgroundBatchOneway = BackgroundPrxHelper.uncheckedCast(background.ice_batchOneway());
+
+ //
+ // First send small requests to test without auto-flushing.
+ //
+ ctl.holdAdapter();
+ backgroundBatchOneway.op();
+ backgroundBatchOneway.op();
+ backgroundBatchOneway.op();
+ backgroundBatchOneway.op();
+ ctl.resumeAdapter();
+ backgroundBatchOneway.ice_flushBatchRequests();
+ backgroundBatchOneway.ice_getConnection().close(false);
+
+ //
+ // Send bigger requests to test with auto-flushing.
+ //
+ ctl.holdAdapter();
+ backgroundBatchOneway.opWithPayload(seq);
+ backgroundBatchOneway.opWithPayload(seq);
+ backgroundBatchOneway.opWithPayload(seq);
+ backgroundBatchOneway.opWithPayload(seq);
+ ctl.resumeAdapter();
+ backgroundBatchOneway.ice_flushBatchRequests();
+ backgroundBatchOneway.ice_getConnection().close(false);
+
+ //
+ // Then try the same thing with async flush.
+ //
+ ctl.holdAdapter();
+ backgroundBatchOneway.op();
+ backgroundBatchOneway.op();
+ backgroundBatchOneway.op();
+ backgroundBatchOneway.op();
+ ctl.resumeAdapter();
+ backgroundBatchOneway.begin_ice_flushBatchRequests();
+ backgroundBatchOneway.ice_getConnection().close(false);
+
+ ctl.holdAdapter();
+ backgroundBatchOneway.opWithPayload(seq);
+ backgroundBatchOneway.opWithPayload(seq);
+ backgroundBatchOneway.opWithPayload(seq);
+ backgroundBatchOneway.opWithPayload(seq);
+ ctl.resumeAdapter();
+ r = backgroundBatchOneway.begin_ice_flushBatchRequests();
+ backgroundBatchOneway.end_ice_flushBatchRequests(r);
+ backgroundBatchOneway.ice_getConnection().close(false);
+ }
+
+ private static void
+ readWriteTests(Configuration configuration, BackgroundPrx background, BackgroundControllerPrx ctl)
+ {
+ try
+ {
+ background.op();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ for(int i = 0; i < 2; i++)
+ {
+ BackgroundPrx prx = i == 0 ? background : (BackgroundPrx)background.ice_oneway();
+
+ try
+ {
+ background.ice_ping();
+ configuration.writeException(new Ice.SocketException());
+ prx.op();
+ test(false);
+ }
+ catch(Ice.SocketException ex)
+ {
+ configuration.writeException(null);
+ }
+
+ background.ice_ping();
+ configuration.writeException(new Ice.SocketException());
+ Ice.AsyncResult r = prx.begin_op();
+ test(!r.sentSynchronously());
+ try
+ {
+ prx.end_op(r);
+ test(false);
+ }
+ catch(Ice.SocketException ex)
+ {
+ }
+ test(r.isCompleted());
+ configuration.writeException(null);
+ }
+
+ try
+ {
+ background.ice_ping();
+ configuration.readException(new Ice.SocketException());
+ background.op();
+ test(false);
+ }
+ catch(Ice.SocketException ex)
+ {
+ configuration.readException(null);
+ }
+
+ background.ice_ping();
+ configuration.readReady(false); // Required in C# to make sure beginRead() doesn't throw too soon.
+ configuration.readException(new Ice.SocketException());
+ Ice.AsyncResult r = background.begin_op();
+ try
+ {
+ background.end_op(r);
+ test(false);
+ }
+ catch(Ice.SocketException ex)
+ {
+ }
+ test(r.isCompleted());
+ configuration.readException(null);
+ configuration.readReady(true);
+
+ try
+ {
+ background.ice_ping();
+ configuration.writeReady(false);
+ background.op();
+ configuration.writeReady(true);
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ try
+ {
+ background.ice_ping();
+ configuration.readReady(false);
+ background.op();
+ configuration.readReady(true);
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ try
+ {
+ background.ice_ping();
+ configuration.writeReady(false);
+ configuration.writeException(new Ice.SocketException());
+ background.op();
+ test(false);
+ }
+ catch(Ice.SocketException ex)
+ {
+ configuration.writeReady(true);
+ configuration.writeException(null);
+ }
+
+ for(int i = 0; i < 2; ++i)
+ {
+ BackgroundPrx prx = i == 0 ? background : (BackgroundPrx)background.ice_oneway();
+
+ background.ice_ping();
+ configuration.writeReady(false);
+ configuration.writeException(new Ice.SocketException());
+ r = prx.begin_op();
+ test(!r.sentSynchronously());
+ try
+ {
+ prx.end_op(r);
+ test(false);
+ }
+ catch(Ice.SocketException ex)
+ {
+ }
+ test(r.isCompleted());
+ configuration.writeReady(true);
+ configuration.writeException(null);
+ }
+
+ try
+ {
+ background.ice_ping();
+ configuration.readReady(false);
+ configuration.readException(new Ice.SocketException());
+ background.op();
+ test(false);
+ }
+ catch(Ice.SocketException ex)
+ {
+ configuration.readException(null);
+ configuration.readReady(true);
+ }
+
+ {
+ background.ice_ping();
+ configuration.readReady(false);
+ configuration.readException(new Ice.SocketException());
+ r = background.begin_op();
+ try
+ {
+ background.end_op(r);
+ test(false);
+ }
+ catch(Ice.SocketException ex)
+ {
+ }
+ test(r.isCompleted());
+ configuration.readReady(true);
+ configuration.readException(null);
+ }
+
+ {
+ background.ice_ping();
+ configuration.readReady(false);
+ configuration.writeReady(false);
+ configuration.readException(new Ice.SocketException());
+ r = background.begin_op();
+ // The read exception might propagate before the message send is seen as completed on IOCP.
+ r.waitForSent();
+ try
+ {
+ background.end_op(r);
+ test(false);
+ }
+ catch(Ice.SocketException ex)
+ {
+ }
+ test(r.isCompleted());
+ configuration.writeReady(true);
+ configuration.readReady(true);
+ configuration.readException(null);
+ }
+
+ background.ice_ping(); // Establish the connection
+
+ BackgroundPrx backgroundOneway = BackgroundPrxHelper.uncheckedCast(background.ice_oneway());
+ test(backgroundOneway.ice_getConnection() == background.ice_getConnection());
+
+ ctl.holdAdapter(); // Hold to block in request send.
+
+ byte[] seq = new byte[10024];
+ new java.util.Random().nextBytes(seq); // Make sure the request doesn't compress too well.
+
+ // Fill up the receive and send buffers
+ NoResponse noResponse = new NoResponse();
+ for(int i = 0; i < 200; ++i) // 2MB
+ {
+ backgroundOneway.begin_opWithPayload(seq, noResponse);
+ }
+
+ OpAMICallback cb = new OpAMICallback();
+ Ice.AsyncResult r1 = background.begin_op(cb);
+ test(!r1.sentSynchronously() && !r1.isSent());
+
+ OpAMICallback cb2 = new OpAMICallback();
+ Ice.AsyncResult r2 = background.begin_op(cb2);
+ test(!r2.sentSynchronously() && !r2.isSent());
+
+ test(!backgroundOneway.begin_opWithPayload(seq, noResponse).sentSynchronously());
+ test(!backgroundOneway.begin_opWithPayload(seq, noResponse).sentSynchronously());
+
+ test(!cb.response(false));
+ test(!cb2.response(false));
+ ctl.resumeAdapter();
+ cb.responseAndSent();
+ cb2.responseAndSent();
+ test(r1.isSent() && r1.isCompleted());
+ test(r2.isSent() && r2.isCompleted());
+
+ try
+ {
+ background.ice_ping();
+ ctl.writeException(true);
+ background.op();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ ctl.writeException(false);
+ }
+
+ try
+ {
+ background.ice_ping();
+ ctl.readException(true);
+ background.op();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ ctl.readException(false);
+ }
+
+ try
+ {
+ background.ice_ping();
+ ctl.writeReady(false);
+ background.op();
+ ctl.writeReady(true);
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ try
+ {
+ background.ice_ping();
+ ctl.readReady(false);
+ background.op();
+ ctl.readReady(true);
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ try
+ {
+ background.ice_ping();
+ ctl.writeReady(false);
+ ctl.writeException(true);
+ background.op();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ ctl.writeException(false);
+ ctl.writeReady(true);
+ }
+
+ try
+ {
+ background.ice_ping();
+ ctl.readReady(false);
+ ctl.readException(true);
+ background.op();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ ctl.readException(false);
+ ctl.readReady(true);
+ }
+
+ OpThread thread1 = new OpThread(background);
+ OpThread thread2 = new OpThread(background);
+
+ for(int i = 0; i < 5; i++)
+ {
+ try
+ {
+ background.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ configuration.writeException(new Ice.SocketException());
+ try
+ {
+ background.op();
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ configuration.writeException(null);
+
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+
+ background.ice_ping();
+ background.ice_getCachedConnection().close(true);
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+
+ background.ice_getCachedConnection().close(true);
+ }
+
+ thread1._destroy();
+ thread2._destroy();
+
+ try
+ {
+ thread1.join();
+ thread2.join();
+ }
+ catch(InterruptedException e)
+ {
+ }
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/background/BackgroundControllerI.java b/java-compat/test/src/main/java/test/Ice/background/BackgroundControllerI.java
new file mode 100644
index 00000000000..1724bbe77b9
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/background/BackgroundControllerI.java
@@ -0,0 +1,119 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+package test.Ice.background;
+
+import test.Ice.background.Test._BackgroundControllerDisp;
+
+class BackgroundControllerI extends _BackgroundControllerDisp
+{
+ @Override
+ synchronized public void
+ pauseCall(String opName, Ice.Current current)
+ {
+ _pausedCalls.add(opName);
+ }
+
+ @Override
+ synchronized public void
+ resumeCall(String opName, Ice.Current current)
+ {
+ _pausedCalls.remove(opName);
+ notifyAll();
+ }
+
+ synchronized public void
+ checkCallPause(Ice.Current current)
+ {
+ while(_pausedCalls.contains(current.operation))
+ {
+ try
+ {
+ wait();
+ break;
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+ }
+
+ @Override
+ public void
+ holdAdapter(Ice.Current current)
+ {
+ _adapter.hold();
+ }
+
+ @Override
+ public void
+ resumeAdapter(Ice.Current current)
+ {
+ _adapter.activate();
+ }
+
+ @Override
+ public void
+ initializeSocketStatus(int status, Ice.Current current)
+ {
+ _configuration.initializeSocketStatus(status);
+ }
+
+ @Override
+ public void
+ initializeException(boolean enable, Ice.Current current)
+ {
+ _configuration.initializeException(enable ? new Ice.SocketException() : null);
+ }
+
+ @Override
+ public void
+ readReady(boolean enable, Ice.Current current)
+ {
+ _configuration.readReady(enable);
+ }
+
+ @Override
+ public void
+ readException(boolean enable, Ice.Current current)
+ {
+ _configuration.readException(enable ? new Ice.SocketException() : null);
+ }
+
+ @Override
+ public void
+ writeReady(boolean enable, Ice.Current current)
+ {
+ _configuration.writeReady(enable);
+ }
+
+ @Override
+ public void
+ writeException(boolean enable, Ice.Current current)
+ {
+ _configuration.writeException(enable ? new Ice.SocketException() : null);
+ }
+
+ @Override
+ public void
+ buffered(boolean enable, Ice.Current current)
+ {
+ _configuration.buffered(enable);
+ }
+
+ public
+ BackgroundControllerI(Configuration configuration, Ice.ObjectAdapter adapter)
+ {
+ _adapter = adapter;
+ _configuration = configuration;
+ }
+
+ final private Ice.ObjectAdapter _adapter;
+ final private java.util.Set<String> _pausedCalls = new java.util.HashSet<String>();
+ final private Configuration _configuration;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/background/BackgroundI.java b/java-compat/test/src/main/java/test/Ice/background/BackgroundI.java
new file mode 100644
index 00000000000..411a04c4a61
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/background/BackgroundI.java
@@ -0,0 +1,42 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+package test.Ice.background;
+
+import test.Ice.background.Test._BackgroundDisp;
+
+class BackgroundI extends _BackgroundDisp
+{
+ @Override
+ public void
+ op(Ice.Current current)
+ {
+ _controller.checkCallPause(current);
+ }
+
+ @Override
+ public void
+ opWithPayload(byte[] seq, Ice.Current current)
+ {
+ _controller.checkCallPause(current);
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+
+ BackgroundI(BackgroundControllerI controller)
+ {
+ _controller = controller;
+ }
+
+ private final BackgroundControllerI _controller;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/background/Client.java b/java-compat/test/src/main/java/test/Ice/background/Client.java
new file mode 100644
index 00000000000..2a4dde11aa5
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/background/Client.java
@@ -0,0 +1,73 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+package test.Ice.background;
+
+import test.Ice.background.PluginFactory.PluginI;
+import test.Ice.background.Test.BackgroundPrx;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int
+ run(String[] args)
+ {
+ Configuration configuration = new Configuration();
+ PluginI plugin = (PluginI)communicator().getPluginManager().getPlugin("Test");
+ plugin.setConfiguration(configuration);
+ communicator().getPluginManager().initializePlugins();
+
+ BackgroundPrx background = AllTests.allTests(configuration, communicator(), getWriter());
+ background.shutdown();
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+
+ // For this test, we want to disable retries.
+ //
+ initData.properties.setProperty("Ice.RetryIntervals", "-1");
+
+ //
+ // This test kills connections, so we don't want warnings.
+ //
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.MessageSizeMax", "50000");
+
+ // This test relies on filling the TCP send/recv buffer, so
+ // we rely on a fixed value for these buffers.
+ initData.properties.setProperty("Ice.TCP.SndSize", "50000");
+
+ //
+ // Setup the test transport plug-in.
+ //
+ initData.properties.setProperty("Ice.Plugin.Test", "test.Ice.background.PluginFactory");
+ String defaultProtocol = initData.properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp");
+ initData.properties.setProperty("Ice.Default.Protocol", "test-" + defaultProtocol);
+
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.background");
+
+ // Don't initialize the plugin until I've set the configuration.
+ initData.properties.setProperty("Ice.InitPlugins", "0");
+
+ return initData;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/background/Collocated.java b/java-compat/test/src/main/java/test/Ice/background/Collocated.java
new file mode 100644
index 00000000000..6e4b5774ac9
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/background/Collocated.java
@@ -0,0 +1,99 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.background;
+
+public class Collocated extends test.Util.Application
+{
+ static Thread _clientThread;
+ static int result;
+
+ public static void main(String[] args)
+ {
+ Collocated app = new Collocated();
+ int result = app.main("Collocated", args);
+ System.gc();
+ System.exit(result);
+ }
+
+ @Override
+ public int
+ run(String[] args)
+ {
+ final Client client = new Client();
+ client.setClassLoader(getClassLoader());
+ client.setWriter(getWriter());
+ final Server server = new Server();
+ server.setClassLoader(getClassLoader());
+ server.setWriter(getWriter());
+ Thread t = new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ String[] args =
+ {
+ "--Ice.NullHandleAbort=1",
+ "--Ice.Warn.Connections=1",
+ "--Ice.ThreadPool.Server.Size=1",
+ "--Ice.ThreadPool.Server.SizeMax=3",
+ "--Ice.ThreadPool.Server.SizeWarn=0",
+ "--Ice.PrintAdapterReady=1",
+ "--Ice.ServerIdleTime=30",
+ "--Ice.Default.Host=127.0.0.1"
+ };
+ server.setServerReadyListener(new test.Util.Application.ServerReadyListener()
+ {
+ @Override
+ public void serverReady()
+ {
+ _clientThread = new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ String[] args =
+ {
+ "--Ice.NullHandleAbort=1", "--Ice.Warn.Connections=1", "--Ice.Default.Host=127.0.0.1"
+ };
+ client.main("Client", args);
+ }
+ });
+ _clientThread.start();
+ }
+ });
+
+ result = server.main("Server", args);
+ if(_clientThread != null)
+ {
+ while(_clientThread.isAlive())
+ {
+ try
+ {
+ _clientThread.join();
+ }
+ catch(InterruptedException e1)
+ {
+ }
+ }
+ }
+ }
+ });
+ t.start();
+ try
+ {
+ t.join();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+
+ return 0;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/background/Configuration.java b/java-compat/test/src/main/java/test/Ice/background/Configuration.java
new file mode 100644
index 00000000000..fe8bc145bb9
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/background/Configuration.java
@@ -0,0 +1,168 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.background;
+
+public final class Configuration
+{
+ public synchronized void
+ connectorsException(Ice.LocalException ex)
+ {
+ _connectorsException = ex;
+ }
+
+ public synchronized void
+ checkConnectorsException()
+ {
+ if(_connectorsException != null)
+ {
+ throw _connectorsException;
+ }
+ }
+
+ public synchronized void
+ connectException(Ice.LocalException ex)
+ {
+ _connectException = ex;
+ }
+
+ public synchronized void
+ checkConnectException()
+ {
+ if(_connectException != null)
+ {
+ throw _connectException;
+ }
+ }
+
+ public synchronized void
+ initializeSocketStatus(int status)
+ {
+ if(status == IceInternal.SocketOperation.None)
+ {
+ _initializeResetCount = 0;
+ return;
+ }
+ _initializeResetCount = 10;
+ _initializeSocketStatus = status;
+ }
+
+ public synchronized void
+ initializeException(Ice.LocalException ex)
+ {
+ _initializeException = ex;
+ }
+
+ public synchronized int
+ initializeSocketStatus()
+ {
+ if(_initializeResetCount == 0)
+ {
+ return IceInternal.SocketOperation.None;
+ }
+ --_initializeResetCount;
+ return _initializeSocketStatus;
+ }
+
+ public synchronized void
+ checkInitializeException()
+ {
+ if(_initializeException != null)
+ {
+ throw _initializeException;
+ }
+ }
+
+ public synchronized void
+ readReady(boolean ready)
+ {
+ _readReadyCount = ready ? 0 : 10;
+ }
+
+ public synchronized void
+ readException(Ice.LocalException ex)
+ {
+ _readException = ex;
+ }
+
+ public synchronized boolean
+ readReady()
+ {
+ if(_readReadyCount == 0)
+ {
+ return true;
+ }
+ --_readReadyCount;
+ return false;
+ }
+
+ public synchronized void
+ checkReadException()
+ {
+ if(_readException != null)
+ {
+ throw _readException;
+ }
+ }
+
+ public synchronized void
+ writeReady(boolean ready)
+ {
+ _writeReadyCount = ready ? 0 : 10;
+ }
+
+ public synchronized void
+ writeException(Ice.LocalException ex)
+ {
+ _writeException = ex;
+ }
+
+ public synchronized boolean
+ writeReady()
+ {
+ if(_writeReadyCount == 0)
+ {
+ return true;
+ }
+ --_writeReadyCount;
+ return false;
+ }
+
+ public synchronized void
+ checkWriteException()
+ {
+ if(_writeException != null)
+ {
+ throw _writeException;
+ }
+ }
+
+ public synchronized void
+ buffered(boolean b)
+ {
+ _buffered = b;
+ }
+
+ public synchronized boolean
+ buffered()
+ {
+ return _buffered;
+ }
+
+ private Ice.LocalException _connectorsException;
+ private Ice.LocalException _connectException;
+ private int _initializeSocketStatus;
+ private int _initializeResetCount;
+ private Ice.LocalException _initializeException;
+ private int _readReadyCount;
+ private Ice.LocalException _readException;
+ private int _writeReadyCount;
+ private Ice.LocalException _writeException;
+ private boolean _buffered;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/background/Connector.java b/java-compat/test/src/main/java/test/Ice/background/Connector.java
new file mode 100644
index 00000000000..14e710e2454
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/background/Connector.java
@@ -0,0 +1,76 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+package test.Ice.background;
+
+final class Connector implements IceInternal.Connector
+{
+ @Override
+ public IceInternal.Transceiver
+ connect()
+ {
+ _configuration.checkConnectException();
+ return new Transceiver(_configuration, _connector.connect());
+ }
+
+ @Override
+ public short
+ type()
+ {
+ return (short)(EndpointI.TYPE_BASE + _connector.type());
+ }
+
+ @Override
+ public String
+ toString()
+ {
+ return _connector.toString();
+ }
+
+ @Override
+ public int
+ hashCode()
+ {
+ return _connector.hashCode();
+ }
+
+ //
+ // Only for use by Endpoint
+ //
+ Connector(Configuration configuration, IceInternal.Connector connector)
+ {
+ _configuration = configuration;
+ _connector = connector;
+ }
+
+ @Override
+ public boolean
+ equals(java.lang.Object obj)
+ {
+ Connector p = null;
+
+ try
+ {
+ p = (Connector)obj;
+ }
+ catch(ClassCastException ex)
+ {
+ return false;
+ }
+
+ if(this == p)
+ {
+ return true;
+ }
+
+ return _connector.equals(p._connector);
+ }
+
+ final private IceInternal.Connector _connector;
+ final private Configuration _configuration;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/background/EndpointFactory.java b/java-compat/test/src/main/java/test/Ice/background/EndpointFactory.java
new file mode 100644
index 00000000000..279a7d9d6e3
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/background/EndpointFactory.java
@@ -0,0 +1,68 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+package test.Ice.background;
+
+final class EndpointFactory implements IceInternal.EndpointFactory
+{
+ EndpointFactory(Configuration configuration, IceInternal.EndpointFactory factory)
+ {
+ _configuration = configuration;
+ _factory = factory;
+ }
+
+ @Override
+ public short
+ type()
+ {
+ return (short)(EndpointI.TYPE_BASE + _factory.type());
+ }
+
+ @Override
+ public String
+ protocol()
+ {
+ return "test-" + _factory.protocol();
+ }
+
+ @Override
+ public IceInternal.EndpointI
+ create(java.util.ArrayList<String> args, boolean server)
+ {
+ return new EndpointI(_configuration, _factory.create(args, server));
+ }
+
+ @Override
+ public IceInternal.EndpointI
+ read(Ice.InputStream s)
+ {
+ short type = s.readShort();
+ assert(type == _factory.type());
+
+ s.startEncapsulation();
+ IceInternal.EndpointI endpoint = new EndpointI(_configuration, _factory.read(s));
+ s.endEncapsulation();
+ return endpoint;
+ }
+
+ @Override
+ public void
+ destroy()
+ {
+ }
+
+ @Override
+ public IceInternal.EndpointFactory
+ clone(IceInternal.ProtocolInstance instance, IceInternal.EndpointFactory del)
+ {
+ return this;
+ }
+
+ private Configuration _configuration;
+ private IceInternal.EndpointFactory _factory;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/background/EndpointI.java b/java-compat/test/src/main/java/test/Ice/background/EndpointI.java
new file mode 100644
index 00000000000..eb51c2d26f9
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/background/EndpointI.java
@@ -0,0 +1,294 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+package test.Ice.background;
+
+final class EndpointI extends IceInternal.EndpointI
+{
+ final static short TYPE_BASE = 100;
+
+ public
+ EndpointI(Configuration configuration, IceInternal.EndpointI endpoint)
+ {
+ _endpoint = endpoint;
+ _configuration = configuration;
+ }
+
+ @Override
+ public String
+ _toString()
+ {
+ return "test-" + _endpoint.toString();
+ }
+
+ @Override
+ public Ice.EndpointInfo
+ getInfo()
+ {
+ return _endpoint.getInfo();
+ }
+
+ @Override
+ public void
+ streamWriteImpl(Ice.OutputStream s)
+ {
+ s.writeShort(_endpoint.type());
+ _endpoint.streamWrite(s);
+ }
+
+ @Override
+ public short
+ type()
+ {
+ return (short)(TYPE_BASE + _endpoint.type());
+ }
+
+ @Override
+ public String
+ protocol()
+ {
+ return _endpoint.protocol();
+ }
+
+ @Override
+ public int
+ timeout()
+ {
+ return _endpoint.timeout();
+ }
+
+ @Override
+ public IceInternal.EndpointI
+ timeout(int timeout)
+ {
+ IceInternal.EndpointI endpoint = _endpoint.timeout(timeout);
+ if(endpoint == _endpoint)
+ {
+ return this;
+ }
+ else
+ {
+ return new EndpointI(_configuration, endpoint);
+ }
+ }
+
+ @Override
+ public String
+ connectionId()
+ {
+ return _endpoint.connectionId();
+ }
+
+ @Override
+ public IceInternal.EndpointI
+ connectionId(String connectionId)
+ {
+ IceInternal.EndpointI endpoint = _endpoint.connectionId(connectionId);
+ if(endpoint == _endpoint)
+ {
+ return this;
+ }
+ else
+ {
+ return new EndpointI(_configuration, endpoint);
+ }
+ }
+
+ @Override
+ public boolean
+ compress()
+ {
+ return _endpoint.compress();
+ }
+
+ @Override
+ public IceInternal.EndpointI
+ compress(boolean compress)
+ {
+ IceInternal.EndpointI endpoint = _endpoint.compress(compress);
+ if(endpoint == _endpoint)
+ {
+ return this;
+ }
+ else
+ {
+ return new EndpointI(_configuration, endpoint);
+ }
+ }
+
+ @Override
+ public boolean
+ datagram()
+ {
+ return _endpoint.datagram();
+ }
+
+ @Override
+ public boolean
+ secure()
+ {
+ return _endpoint.secure();
+ }
+
+ @Override
+ public IceInternal.Transceiver
+ transceiver()
+ {
+ IceInternal.Transceiver transceiver = _endpoint.transceiver();
+ if(transceiver != null)
+ {
+ return new Transceiver(_configuration, transceiver);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ @Override
+ public void
+ connectors_async(Ice.EndpointSelectionType selType, final IceInternal.EndpointI_connectors cb)
+ {
+ class Callback implements IceInternal.EndpointI_connectors
+ {
+ @Override
+ public void
+ connectors(java.util.List<IceInternal.Connector> cons)
+ {
+ java.util.List<IceInternal.Connector> connectors = new java.util.ArrayList<IceInternal.Connector>();
+ for(IceInternal.Connector p : cons)
+ {
+ connectors.add(new Connector(_configuration, p));
+ }
+ cb.connectors(connectors);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exception)
+ {
+ cb.exception(exception);
+ }
+ }
+
+ try
+ {
+ _configuration.checkConnectorsException();
+ _endpoint.connectors_async(selType, new Callback());
+ }
+ catch(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+ }
+
+ @Override
+ public IceInternal.Acceptor
+ acceptor(String adapterName)
+ {
+ return new Acceptor(this, _configuration, _endpoint.acceptor(adapterName));
+ }
+
+ public EndpointI
+ endpoint(IceInternal.EndpointI delEndp)
+ {
+ return new EndpointI(_configuration, delEndp);
+ }
+
+ @Override
+ public java.util.List<IceInternal.EndpointI>
+ expand()
+ {
+ java.util.List<IceInternal.EndpointI> endps = new java.util.ArrayList<IceInternal.EndpointI>();
+ for(IceInternal.EndpointI endpt : _endpoint.expand())
+ {
+ endps.add(endpt == _endpoint ? this : new EndpointI(_configuration, endpt));
+ }
+ return endps;
+ }
+
+ @Override
+ public boolean
+ equivalent(IceInternal.EndpointI endpoint)
+ {
+ EndpointI testEndpoint = null;
+ try
+ {
+ testEndpoint = (EndpointI)endpoint;
+ }
+ catch(ClassCastException ex)
+ {
+ return false;
+ }
+ return testEndpoint._endpoint.equivalent(_endpoint);
+ }
+
+ @Override
+ public String
+ options()
+ {
+ return _endpoint.options();
+ }
+
+ @Override
+ public int
+ hashCode()
+ {
+ return _endpoint.hashCode();
+ }
+
+ //
+ // Compare endpoints for sorting purposes
+ //
+ @Override
+ public boolean
+ equals(java.lang.Object obj)
+ {
+ try
+ {
+ return compareTo((IceInternal.EndpointI)obj) == 0;
+ }
+ catch(ClassCastException ee)
+ {
+ assert(false);
+ return false;
+ }
+ }
+
+ @Override
+ public int
+ compareTo(IceInternal.EndpointI obj) // From java.lang.Comparable
+ {
+ EndpointI p = null;
+
+ try
+ {
+ p = (EndpointI)obj;
+ }
+ catch(ClassCastException ex)
+ {
+ return type() < obj.type() ? -1 : 1;
+ }
+
+ if(this == p)
+ {
+ return 0;
+ }
+
+ return _endpoint.compareTo(p._endpoint);
+ }
+
+ public IceInternal.EndpointI
+ delegate()
+ {
+ return _endpoint;
+ }
+
+ private IceInternal.EndpointI _endpoint;
+ private Configuration _configuration;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/background/PluginFactory.java b/java-compat/test/src/main/java/test/Ice/background/PluginFactory.java
new file mode 100644
index 00000000000..8a6b5022b00
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/background/PluginFactory.java
@@ -0,0 +1,60 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.background;
+
+public class PluginFactory implements Ice.PluginFactory
+{
+ static public class PluginI implements Ice.Plugin
+ {
+ public
+ PluginI(Ice.Communicator communicator)
+ {
+ _communicator = communicator;
+ }
+
+ @Override
+ public void
+ initialize()
+ {
+ assert _configuration != null;
+ IceInternal.ProtocolPluginFacade facade = IceInternal.Util.getProtocolPluginFacade(_communicator);
+ for(short s = 0; s < 100; ++s)
+ {
+ IceInternal.EndpointFactory factory = facade.getEndpointFactory(s);
+ if(factory != null)
+ {
+ facade.addEndpointFactory(new EndpointFactory(_configuration, factory));
+ }
+ }
+ }
+
+ @Override
+ public void
+ destroy()
+ {
+ }
+
+ public void
+ setConfiguration(Configuration configuration)
+ {
+ _configuration = configuration;
+ }
+
+ private final Ice.Communicator _communicator;
+ private Configuration _configuration;
+ }
+
+ @Override
+ public Ice.Plugin
+ create(Ice.Communicator communicator, String name, String[] args)
+ {
+ return new PluginI(communicator);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/background/Server.java b/java-compat/test/src/main/java/test/Ice/background/Server.java
new file mode 100644
index 00000000000..d0e0d298506
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/background/Server.java
@@ -0,0 +1,152 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+package test.Ice.background;
+
+import test.Ice.background.PluginFactory.PluginI;
+
+public class Server extends test.Util.Application
+{
+ static public class LocatorI extends Ice._LocatorDisp
+ {
+ @Override
+ public void
+ findAdapterById_async(Ice.AMD_Locator_findAdapterById response, String adapter, Ice.Current current)
+ throws Ice.AdapterNotFoundException
+ {
+ _controller.checkCallPause(current);
+ Ice.Communicator communicator = current.adapter.getCommunicator();
+ response.ice_response(current.adapter.createDirectProxy(Ice.Util.stringToIdentity("dummy")));
+ }
+
+ @Override
+ public void
+ findObjectById_async(Ice.AMD_Locator_findObjectById response, Ice.Identity id, Ice.Current current)
+ throws Ice.ObjectNotFoundException
+ {
+ _controller.checkCallPause(current);
+ response.ice_response(current.adapter.createDirectProxy(id));
+ }
+
+ @Override
+ public Ice.LocatorRegistryPrx
+ getRegistry(Ice.Current current)
+ {
+ return null;
+ }
+
+ LocatorI(BackgroundControllerI controller)
+ {
+ _controller = controller;
+ }
+
+ final private BackgroundControllerI _controller;
+ }
+
+ static public class RouterI extends Ice._RouterDisp
+ {
+ @Override
+ public Ice.ObjectPrx
+ getClientProxy(Ice.Current current)
+ {
+ _controller.checkCallPause(current);
+ return null;
+ }
+
+ @Override
+ public Ice.ObjectPrx
+ getServerProxy(Ice.Current current)
+ {
+ _controller.checkCallPause(current);
+ return null;
+ }
+
+ @Override
+ public Ice.ObjectPrx[]
+ addProxies(Ice.ObjectPrx[] proxies, Ice.Current current)
+ {
+ return new Ice.ObjectPrx[0];
+ }
+
+ RouterI(BackgroundControllerI controller)
+ {
+ _controller = controller;
+ }
+
+ final private BackgroundControllerI _controller;
+ }
+
+ @Override
+ public int
+ run(String[] args)
+ {
+ Configuration configuration = new Configuration();
+ PluginI plugin = (PluginI)communicator().getPluginManager().getPlugin("Test");
+ plugin.setConfiguration(configuration);
+ communicator().getPluginManager().initializePlugins();
+
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
+
+ BackgroundControllerI backgroundController = new BackgroundControllerI(configuration, adapter);
+
+ adapter.add(new BackgroundI(backgroundController), Ice.Util.stringToIdentity("background"));
+ adapter.add(new LocatorI(backgroundController), Ice.Util.stringToIdentity("locator"));
+ adapter.add(new RouterI(backgroundController), Ice.Util.stringToIdentity("router"));
+ adapter.activate();
+
+ adapter2.add(backgroundController, Ice.Util.stringToIdentity("backgroundController"));
+ adapter2.activate();
+
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+
+ //
+ // This test kills connections, so we don't want warnings.
+ //
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.MessageSizeMax", "50000");
+
+ // This test relies on filling the TCP send/recv buffer, so
+ // we rely on a fixed value for these buffers.
+ initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
+
+ //
+ // Setup the test transport plug-in.
+ //
+ initData.properties.setProperty("Ice.Plugin.Test", "test.Ice.background.PluginFactory");
+ String defaultProtocol = initData.properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp");
+ initData.properties.setProperty("Ice.Default.Protocol", "test-" + defaultProtocol);
+
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.background");
+
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
+ initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
+
+ // Don't initialize the plugin until I've set the configuration.
+ initData.properties.setProperty("Ice.InitPlugins", "0");
+
+ return initData;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/background/Test.ice b/java-compat/test/src/main/java/test/Ice/background/Test.ice
new file mode 100644
index 00000000000..5239c5b7075
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/background/Test.ice
@@ -0,0 +1,47 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+#include <Ice/BuiltinSequences.ice>
+#include <Ice/Endpoint.ice>
+
+[["java:package:test.Ice.background"]]
+module Test
+{
+
+interface Background
+{
+ void op();
+ void opWithPayload(Ice::ByteSeq seq);
+
+ void shutdown();
+};
+
+interface BackgroundController
+{
+ void pauseCall(string call);
+ void resumeCall(string call);
+
+ void holdAdapter();
+ void resumeAdapter();
+
+ void initializeSocketStatus(int status);
+ void initializeException(bool enable);
+
+ void readReady(bool enable);
+ void readException(bool enable);
+
+ void writeReady(bool enable);
+ void writeException(bool enable);
+
+ void buffered(bool enable);
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/background/Transceiver.java b/java-compat/test/src/main/java/test/Ice/background/Transceiver.java
new file mode 100644
index 00000000000..5f21f4663f2
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/background/Transceiver.java
@@ -0,0 +1,223 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.background;
+
+final class Transceiver implements IceInternal.Transceiver
+{
+ @Override
+ public java.nio.channels.SelectableChannel
+ fd()
+ {
+ return _transceiver.fd();
+ }
+
+ @Override
+ public void setReadyCallback(IceInternal.ReadyCallback callback)
+ {
+ _transceiver.setReadyCallback(callback);
+ _readyCallback = callback;
+ }
+
+ @Override
+ public int
+ initialize(IceInternal.Buffer readBuffer, IceInternal.Buffer writeBuffer)
+ {
+ int status = _configuration.initializeSocketStatus();
+ if(status == IceInternal.SocketOperation.Connect)
+ {
+ return status;
+ }
+ else if(status == IceInternal.SocketOperation.Write)
+ {
+ if(!_initialized)
+ {
+ status = _transceiver.initialize(readBuffer, writeBuffer);
+ if(status != IceInternal.SocketOperation.None)
+ {
+ return status;
+ }
+ _initialized = true;
+ }
+ return IceInternal.SocketOperation.Write;
+ }
+ else if(status == IceInternal.SocketOperation.Read)
+ {
+ return status;
+ }
+
+ _configuration.checkInitializeException();
+ if(!_initialized)
+ {
+ status = _transceiver.initialize(readBuffer, writeBuffer);
+ if(status != IceInternal.SocketOperation.None)
+ {
+ return status;
+ }
+ _initialized = true;
+ }
+ return IceInternal.SocketOperation.None;
+ }
+
+ @Override
+ public int
+ closing(boolean initiator, Ice.LocalException ex)
+ {
+ return _transceiver.closing(initiator, ex);
+ }
+
+ @Override
+ public void
+ close()
+ {
+ _transceiver.close();
+ }
+
+ @Override
+ public IceInternal.EndpointI
+ bind()
+ {
+ return _transceiver.bind();
+ }
+
+ @Override
+ public int
+ write(IceInternal.Buffer buf)
+ {
+ if(!_configuration.writeReady() && buf.b.hasRemaining())
+ {
+ return IceInternal.SocketOperation.Write;
+ }
+
+ _configuration.checkWriteException();
+ return _transceiver.write(buf);
+ }
+
+ @Override
+ public int
+ read(IceInternal.Buffer buf)
+ {
+ if(!_configuration.readReady() && buf.b.hasRemaining())
+ {
+ return IceInternal.SocketOperation.Read;
+ }
+
+ _configuration.checkReadException();
+
+ if(_buffered)
+ {
+ while(buf.b.hasRemaining())
+ {
+ if(_readBufferPos == _readBuffer.b.position())
+ {
+ _readBufferPos = 0;
+ _readBuffer.b.position(0);
+ _transceiver.read(_readBuffer);
+ if(_readBufferPos == _readBuffer.b.position())
+ {
+ _readyCallback.ready(IceInternal.SocketOperation.Read, false);
+ return IceInternal.SocketOperation.Read;
+ }
+ }
+ final int pos = _readBuffer.b.position();
+ assert(pos > _readBufferPos);
+ final int requested = buf.b.remaining();
+ int available = pos - _readBufferPos;
+ assert(available > 0);
+ if(available >= requested)
+ {
+ available = requested;
+ }
+
+ byte[] arr = new byte[available];
+ _readBuffer.b.position(_readBufferPos);
+ _readBuffer.b.get(arr);
+ buf.b.put(arr);
+ _readBufferPos += available;
+ _readBuffer.b.position(pos);
+ }
+
+ _readyCallback.ready(IceInternal.SocketOperation.Read, _readBufferPos < _readBuffer.b.position());
+ return IceInternal.SocketOperation.None;
+ }
+ else
+ {
+ return _transceiver.read(buf);
+ }
+ }
+
+ @Override
+ public String
+ protocol()
+ {
+ return "test-" + _transceiver.protocol();
+ }
+
+ @Override
+ public String
+ toString()
+ {
+ return _transceiver.toString();
+ }
+
+ @Override
+ public String
+ toDetailedString()
+ {
+ return _transceiver.toDetailedString();
+ }
+
+ @Override
+ public Ice.ConnectionInfo
+ getInfo()
+ {
+ return _transceiver.getInfo();
+ }
+
+ @Override
+ public void
+ checkSendSize(IceInternal.Buffer buf)
+ {
+ _transceiver.checkSendSize(buf);
+ }
+
+ @Override
+ public void setBufferSize(int rcvSize, int sndSize)
+ {
+ _transceiver.setBufferSize(rcvSize, sndSize);
+ }
+
+ public IceInternal.Transceiver
+ delegate()
+ {
+ return _transceiver;
+ }
+
+ //
+ // Only for use by Connector, Acceptor
+ //
+ Transceiver(Configuration configuration, IceInternal.Transceiver transceiver)
+ {
+ _transceiver = transceiver;
+ _configuration = configuration;
+ _initialized = false;
+ _buffered = _configuration.buffered();
+ _readBuffer = new IceInternal.Buffer(false);
+ _readBuffer.resize(1024 * 8, true); // 8KB buffer
+ _readBufferPos = 0;
+ }
+
+ private final IceInternal.Transceiver _transceiver;
+ private final Configuration _configuration;
+ private IceInternal.ReadyCallback _readyCallback;
+ private boolean _initialized;
+ private final boolean _buffered;
+ private IceInternal.Buffer _readBuffer;
+ private int _readBufferPos;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/background/run.py b/java-compat/test/src/main/java/test/Ice/background/run.py
new file mode 100755
index 00000000000..97f9acd4094
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/background/run.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/binding/AllTests.java b/java-compat/test/src/main/java/test/Ice/binding/AllTests.java
new file mode 100644
index 00000000000..8e5f3a1d8ff
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/binding/AllTests.java
@@ -0,0 +1,982 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.binding;
+
+import java.io.PrintWriter;
+
+import test.Ice.binding.Test.RemoteCommunicatorPrx;
+import test.Ice.binding.Test.RemoteCommunicatorPrxHelper;
+import test.Ice.binding.Test.RemoteObjectAdapterPrx;
+import test.Ice.binding.Test.TestIntfPrx;
+import test.Ice.binding.Test.TestIntfPrxHelper;
+import test.Util.Application;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ static class GetAdapterNameCB extends Ice.Callback
+ {
+ @Override
+ synchronized public void
+ completed(Ice.AsyncResult result)
+ {
+ try
+ {
+ _name = TestIntfPrxHelper.uncheckedCast(result.getProxy()).end_getAdapterName(result);
+ notify();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ }
+
+ synchronized public String
+ getResult()
+ {
+ while(_name == null)
+ {
+ try
+ {
+ wait();
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+ return _name;
+ }
+
+ private String _name = null;
+ }
+
+ private static String
+ getAdapterNameWithAMI(TestIntfPrx test)
+ {
+ GetAdapterNameCB cb = new GetAdapterNameCB();
+ test.begin_getAdapterName(cb);
+ return cb.getResult();
+ }
+
+ private static TestIntfPrx
+ createTestIntfPrx(java.util.List<RemoteObjectAdapterPrx> adapters)
+ {
+ java.util.List<Ice.Endpoint> endpoints = new java.util.ArrayList<Ice.Endpoint>();
+ TestIntfPrx test = null;
+ for(RemoteObjectAdapterPrx p : adapters)
+ {
+ test = p.getTestIntf();
+ Ice.Endpoint[] edpts = test.ice_getEndpoints();
+ endpoints.addAll(java.util.Arrays.asList(edpts));
+ }
+ return TestIntfPrxHelper.uncheckedCast(
+ test.ice_endpoints(endpoints.toArray(new Ice.Endpoint[endpoints.size()])));
+ }
+
+ private static void
+ deactivate(RemoteCommunicatorPrx communicator, java.util.List<RemoteObjectAdapterPrx> adapters)
+ {
+ for(RemoteObjectAdapterPrx p : adapters)
+ {
+ communicator.deactivateObjectAdapter(p);
+ }
+ }
+
+ public static void
+ allTests(Application app)
+ {
+ Ice.Communicator communicator = app.communicator();
+ PrintWriter out = app.getWriter();
+
+ String ref = "communicator:default -p 12010";
+ RemoteCommunicatorPrx com = RemoteCommunicatorPrxHelper.uncheckedCast(communicator.stringToProxy(ref));
+
+ out.print("testing binding with single endpoint... ");
+ out.flush();
+ {
+ RemoteObjectAdapterPrx adapter = com.createObjectAdapter("Adapter", "default");
+
+ TestIntfPrx test1 = adapter.getTestIntf();
+ TestIntfPrx test2 = adapter.getTestIntf();
+ test(test1.ice_getConnection() == test2.ice_getConnection());
+
+ test1.ice_ping();
+ test2.ice_ping();
+
+ com.deactivateObjectAdapter(adapter);
+
+ TestIntfPrx test3 = TestIntfPrxHelper.uncheckedCast(test1);
+ test(test3.ice_getConnection() == test1.ice_getConnection());
+ test(test3.ice_getConnection() == test2.ice_getConnection());
+
+ try
+ {
+ test3.ice_ping();
+ test(false);
+ }
+ catch(Ice.ConnectFailedException ex)
+ {
+ //
+ // Usually the actual type of this exception is ConnectionRefusedException,
+ // but not always. See bug 3179.
+ //
+ }
+ }
+ out.println("ok");
+
+ out.print("testing binding with multiple endpoints... ");
+ out.flush();
+ {
+ java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>();
+ adapters.add(com.createObjectAdapter("Adapter11", "default"));
+ adapters.add(com.createObjectAdapter("Adapter12", "default"));
+ adapters.add(com.createObjectAdapter("Adapter13", "default"));
+
+ //
+ // Ensure that when a connection is opened it's reused for new
+ // proxies and that all endpoints are eventually tried.
+ //
+ java.util.Set<String> names = new java.util.HashSet<String>();
+ names.add("Adapter11");
+ names.add("Adapter12");
+ names.add("Adapter13");
+ while(!names.isEmpty())
+ {
+ java.util.List<RemoteObjectAdapterPrx> adpts =
+ new java.util.ArrayList<RemoteObjectAdapterPrx>(adapters);
+
+ TestIntfPrx test1 = createTestIntfPrx(adpts);
+ java.util.Collections.shuffle(adpts);
+ TestIntfPrx test2 = createTestIntfPrx(adpts);
+ java.util.Collections.shuffle(adpts);
+ TestIntfPrx test3 = createTestIntfPrx(adpts);
+
+ test(test1.ice_getConnection() == test2.ice_getConnection());
+ test(test2.ice_getConnection() == test3.ice_getConnection());
+
+ names.remove(test1.getAdapterName());
+ test1.ice_getConnection().close(false);
+ }
+
+ //
+ // Ensure that the proxy correctly caches the connection (we
+ // always send the request over the same connection.)
+ //
+ {
+ for(RemoteObjectAdapterPrx p : adapters)
+ {
+ p.getTestIntf().ice_ping();
+ }
+
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ String name = test.getAdapterName();
+ final int nRetry = 10;
+ int i;
+ for(i = 0; i < nRetry && test.getAdapterName().equals(name); i++);
+ test(i == nRetry);
+
+ for(RemoteObjectAdapterPrx p : adapters)
+ {
+ p.getTestIntf().ice_getConnection().close(false);
+ }
+ }
+
+ //
+ // Deactivate an adapter and ensure that we can still
+ // establish the connection to the remaining adapters.
+ //
+ com.deactivateObjectAdapter(adapters.get(0));
+ names.add("Adapter12");
+ names.add("Adapter13");
+ while(!names.isEmpty())
+ {
+ java.util.List<RemoteObjectAdapterPrx> adpts =
+ new java.util.ArrayList<RemoteObjectAdapterPrx>(adapters);
+
+ TestIntfPrx test1 = createTestIntfPrx(adpts);
+ java.util.Collections.shuffle(adpts);
+ TestIntfPrx test2 = createTestIntfPrx(adpts);
+ java.util.Collections.shuffle(adpts);
+ TestIntfPrx test3 = createTestIntfPrx(adpts);
+
+ test(test1.ice_getConnection() == test2.ice_getConnection());
+ test(test2.ice_getConnection() == test3.ice_getConnection());
+
+ names.remove(test1.getAdapterName());
+ test1.ice_getConnection().close(false);
+ }
+
+ //
+ // Deactivate an adapter and ensure that we can still
+ // establish the connection to the remaining adapter.
+ //
+ com.deactivateObjectAdapter(adapters.get(2));
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ test(test.getAdapterName().equals("Adapter12"));
+
+ deactivate(com, adapters);
+ }
+ out.println("ok");
+
+ out.print("testing binding with multiple random endpoints... ");
+ out.flush();
+ {
+ java.util.Random rand = new java.util.Random();
+
+ RemoteObjectAdapterPrx[] adapters = new RemoteObjectAdapterPrx[5];
+ adapters[0] = com.createObjectAdapter("AdapterRandom11", "default");
+ adapters[1] = com.createObjectAdapter("AdapterRandom12", "default");
+ adapters[2] = com.createObjectAdapter("AdapterRandom13", "default");
+ adapters[3] = com.createObjectAdapter("AdapterRandom14", "default");
+ adapters[4] = com.createObjectAdapter("AdapterRandom15", "default");
+
+ boolean shortenTest =
+ System.getProperty("os.name").startsWith("Windows") ||
+ System.getProperty("java.vendor").toLowerCase().indexOf("android") >= 0;
+
+ int count;
+ if(shortenTest)
+ {
+ count = 60;
+ }
+ else
+ {
+ count = 20;
+ }
+
+ int adapterCount = adapters.length;
+ while(--count > 0)
+ {
+ TestIntfPrx[] proxies;
+ if(shortenTest)
+ {
+ if(count == 10)
+ {
+ com.deactivateObjectAdapter(adapters[4]);
+ --adapterCount;
+ }
+ proxies = new TestIntfPrx[10];
+ }
+ else
+ {
+ if(count < 60 && count % 10 == 0)
+ {
+ com.deactivateObjectAdapter(adapters[count / 10 - 1]);
+ --adapterCount;
+ }
+ proxies = new TestIntfPrx[40];
+ }
+
+ int i;
+ for(i = 0; i < proxies.length; ++i)
+ {
+ RemoteObjectAdapterPrx[] adpts = new RemoteObjectAdapterPrx[rand.nextInt(adapters.length)];
+ if(adpts.length == 0)
+ {
+ adpts = new RemoteObjectAdapterPrx[1];
+ }
+ for(int j = 0; j < adpts.length; ++j)
+ {
+ adpts[j] = adapters[rand.nextInt(adapters.length)];
+ }
+ proxies[i] = createTestIntfPrx(java.util.Arrays.asList((adpts)));
+ }
+
+ for(TestIntfPrx p : proxies)
+ {
+ p.begin_getAdapterName();
+ }
+ for(TestIntfPrx p : proxies)
+ {
+ try
+ {
+ p.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ }
+
+ java.util.Set<Ice.Connection> connections = new java.util.HashSet<Ice.Connection>();
+ for(TestIntfPrx p : proxies)
+ {
+ if(p.ice_getCachedConnection() != null)
+ {
+ connections.add(p.ice_getCachedConnection());
+ }
+ }
+ test(connections.size() <= adapterCount);
+
+ for(RemoteObjectAdapterPrx a : adapters)
+ {
+ try
+ {
+ a.getTestIntf().ice_getConnection().close(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ // Expected if adapter is down.
+ }
+ }
+ }
+ }
+ out.println("ok");
+
+ out.print("testing binding with multiple endpoints and AMI... ");
+ out.flush();
+ {
+ java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>();
+ adapters.add(com.createObjectAdapter("AdapterAMI11", "default"));
+ adapters.add(com.createObjectAdapter("AdapterAMI12", "default"));
+ adapters.add(com.createObjectAdapter("AdapterAMI13", "default"));
+
+ //
+ // Ensure that when a connection is opened it's reused for new
+ // proxies and that all endpoints are eventually tried.
+ //
+ java.util.Set<String> names = new java.util.HashSet<String>();
+ names.add("AdapterAMI11");
+ names.add("AdapterAMI12");
+ names.add("AdapterAMI13");
+ while(!names.isEmpty())
+ {
+ java.util.List<RemoteObjectAdapterPrx> adpts =
+ new java.util.ArrayList<RemoteObjectAdapterPrx>(adapters);
+
+ TestIntfPrx test1 = createTestIntfPrx(adpts);
+ java.util.Collections.shuffle(adpts);
+ TestIntfPrx test2 = createTestIntfPrx(adpts);
+ java.util.Collections.shuffle(adpts);
+ TestIntfPrx test3 = createTestIntfPrx(adpts);
+
+ test(test1.ice_getConnection() == test2.ice_getConnection());
+ test(test2.ice_getConnection() == test3.ice_getConnection());
+
+ names.remove(getAdapterNameWithAMI(test1));
+ test1.ice_getConnection().close(false);
+ }
+
+ //
+ // Ensure that the proxy correctly caches the connection (we
+ // always send the request over the same connection.)
+ //
+ {
+ for(RemoteObjectAdapterPrx p : adapters)
+ {
+ p.getTestIntf().ice_ping();
+ }
+
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ String name = getAdapterNameWithAMI(test);
+ final int nRetry = 10;
+ int i;
+ for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals(name); i++);
+ test(i == nRetry);
+
+ for(RemoteObjectAdapterPrx p : adapters)
+ {
+ p.getTestIntf().ice_getConnection().close(false);
+ }
+ }
+
+ //
+ // Deactivate an adapter and ensure that we can still
+ // establish the connection to the remaining adapters.
+ //
+ com.deactivateObjectAdapter(adapters.get(0));
+ names.add("AdapterAMI12");
+ names.add("AdapterAMI13");
+ while(!names.isEmpty())
+ {
+ java.util.List<RemoteObjectAdapterPrx> adpts =
+ new java.util.ArrayList<RemoteObjectAdapterPrx>(adapters);
+
+ TestIntfPrx test1 = createTestIntfPrx(adpts);
+ java.util.Collections.shuffle(adpts);
+ TestIntfPrx test2 = createTestIntfPrx(adpts);
+ java.util.Collections.shuffle(adpts);
+ TestIntfPrx test3 = createTestIntfPrx(adpts);
+
+ test(test1.ice_getConnection() == test2.ice_getConnection());
+ test(test2.ice_getConnection() == test3.ice_getConnection());
+
+ names.remove(getAdapterNameWithAMI(test1));
+ test1.ice_getConnection().close(false);
+ }
+
+ //
+ // Deactivate an adapter and ensure that we can still
+ // establish the connection to the remaining adapter.
+ //
+ com.deactivateObjectAdapter(adapters.get(2));
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ test(getAdapterNameWithAMI(test).equals("AdapterAMI12"));
+
+ deactivate(com, adapters);
+ }
+ out.println("ok");
+
+ out.print("testing random endpoint selection... ");
+ out.flush();
+ {
+ java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>();
+ adapters.add(com.createObjectAdapter("Adapter21", "default"));
+ adapters.add(com.createObjectAdapter("Adapter22", "default"));
+ adapters.add(com.createObjectAdapter("Adapter23", "default"));
+
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ test(test.ice_getEndpointSelection() == Ice.EndpointSelectionType.Random);
+
+ java.util.Set<String> names = new java.util.HashSet<String>();
+ names.add("Adapter21");
+ names.add("Adapter22");
+ names.add("Adapter23");
+ while(!names.isEmpty())
+ {
+ names.remove(test.getAdapterName());
+ test.ice_getConnection().close(false);
+ }
+
+ test = TestIntfPrxHelper.uncheckedCast(test.ice_endpointSelection(Ice.EndpointSelectionType.Random));
+ test(test.ice_getEndpointSelection() == Ice.EndpointSelectionType.Random);
+
+ names.add("Adapter21");
+ names.add("Adapter22");
+ names.add("Adapter23");
+ while(!names.isEmpty())
+ {
+ names.remove(test.getAdapterName());
+ test.ice_getConnection().close(false);
+ }
+
+ deactivate(com, adapters);
+ }
+ out.println("ok");
+
+ out.print("testing ordered endpoint selection... ");
+ out.flush();
+ {
+ java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>();
+ adapters.add(com.createObjectAdapter("Adapter31", "default"));
+ adapters.add(com.createObjectAdapter("Adapter32", "default"));
+ adapters.add(com.createObjectAdapter("Adapter33", "default"));
+
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ test = TestIntfPrxHelper.uncheckedCast(test.ice_endpointSelection(Ice.EndpointSelectionType.Ordered));
+ test(test.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered);
+ int nRetry = 5;
+ int i;
+
+ //
+ // Ensure that endpoints are tried in order by deactiving the adapters
+ // one after the other.
+ //
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter31"); i++);
+ test(i == nRetry);
+ com.deactivateObjectAdapter(adapters.get(0));
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter32"); i++);
+ test(i == nRetry);
+ com.deactivateObjectAdapter(adapters.get(1));
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter33"); i++);
+ test(i == nRetry);
+ com.deactivateObjectAdapter(adapters.get(2));
+
+ try
+ {
+ test.getAdapterName();
+ }
+ catch(Ice.ConnectFailedException ex)
+ {
+ //
+ // Usually the actual type of this exception is ConnectionRefusedException,
+ // but not always. See bug 3179.
+ //
+ }
+
+ Ice.Endpoint[] endpoints = test.ice_getEndpoints();
+
+ adapters.clear();
+
+ //
+ // Now, re-activate the adapters with the same endpoints in the opposite
+ // order.
+ //
+ adapters.add(com.createObjectAdapter("Adapter36", endpoints[2].toString()));
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter36"); i++);
+ test(i == nRetry);
+ test.ice_getConnection().close(false);
+ adapters.add(com.createObjectAdapter("Adapter35", endpoints[1].toString()));
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter35"); i++);
+ test(i == nRetry);
+ test.ice_getConnection().close(false);
+ adapters.add(com.createObjectAdapter("Adapter34", endpoints[0].toString()));
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter34"); i++);
+ test(i == nRetry);
+
+ deactivate(com, adapters);
+ }
+ out.println("ok");
+
+ out.print("testing per request binding with single endpoint... ");
+ out.flush();
+ {
+ RemoteObjectAdapterPrx adapter = com.createObjectAdapter("Adapter41", "default");
+
+ TestIntfPrx test1 = TestIntfPrxHelper.uncheckedCast(adapter.getTestIntf().ice_connectionCached(false));
+ TestIntfPrx test2 = TestIntfPrxHelper.uncheckedCast(adapter.getTestIntf().ice_connectionCached(false));
+ test(!test1.ice_isConnectionCached());
+ test(!test2.ice_isConnectionCached());
+ test(test1.ice_getConnection() != null && test2.ice_getConnection() != null);
+ test(test1.ice_getConnection() == test2.ice_getConnection());
+
+ test1.ice_ping();
+
+ com.deactivateObjectAdapter(adapter);
+
+ TestIntfPrx test3 = TestIntfPrxHelper.uncheckedCast(test1);
+ try
+ {
+ test(test3.ice_getConnection() == test1.ice_getConnection());
+ test(false);
+ }
+ catch(Ice.ConnectFailedException ex)
+ {
+ //
+ // Usually the actual type of this exception is ConnectionRefusedException,
+ // but not always. See bug 3179.
+ //
+ }
+ }
+ out.println("ok");
+
+ out.print("testing per request binding with multiple endpoints... ");
+ out.flush();
+ {
+ java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>();
+ adapters.add(com.createObjectAdapter("Adapter51", "default"));
+ adapters.add(com.createObjectAdapter("Adapter52", "default"));
+ adapters.add(com.createObjectAdapter("Adapter53", "default"));
+
+ TestIntfPrx test = TestIntfPrxHelper.uncheckedCast(createTestIntfPrx(adapters).ice_connectionCached(false));
+ test(!test.ice_isConnectionCached());
+
+ java.util.Set<String> names = new java.util.HashSet<String>();
+ names.add("Adapter51");
+ names.add("Adapter52");
+ names.add("Adapter53");
+ while(!names.isEmpty())
+ {
+ names.remove(test.getAdapterName());
+ }
+
+ com.deactivateObjectAdapter(adapters.get(0));
+
+ names.add("Adapter52");
+ names.add("Adapter53");
+ while(!names.isEmpty())
+ {
+ names.remove(test.getAdapterName());
+ }
+
+ com.deactivateObjectAdapter(adapters.get(2));
+
+ test(test.getAdapterName().equals("Adapter52"));
+
+ deactivate(com, adapters);
+ }
+ out.println("ok");
+
+ out.print("testing per request binding with multiple endpoints and AMI... ");
+ out.flush();
+ {
+ java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>();
+ adapters.add(com.createObjectAdapter("AdapterAMI51", "default"));
+ adapters.add(com.createObjectAdapter("AdapterAMI52", "default"));
+ adapters.add(com.createObjectAdapter("AdapterAMI53", "default"));
+
+ TestIntfPrx test = TestIntfPrxHelper.uncheckedCast(createTestIntfPrx(adapters).ice_connectionCached(false));
+ test(!test.ice_isConnectionCached());
+
+ java.util.Set<String> names = new java.util.HashSet<String>();
+ names.add("AdapterAMI51");
+ names.add("AdapterAMI52");
+ names.add("AdapterAMI53");
+ while(!names.isEmpty())
+ {
+ names.remove(getAdapterNameWithAMI(test));
+ }
+
+ com.deactivateObjectAdapter(adapters.get(0));
+
+ names.add("AdapterAMI52");
+ names.add("AdapterAMI53");
+ while(!names.isEmpty())
+ {
+ names.remove(getAdapterNameWithAMI(test));
+ }
+
+ com.deactivateObjectAdapter(adapters.get(2));
+
+ test(getAdapterNameWithAMI(test).equals("AdapterAMI52"));
+
+ deactivate(com, adapters);
+ }
+ out.println("ok");
+
+ out.print("testing per request binding and ordered endpoint selection... ");
+ out.flush();
+ {
+ java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>();
+ adapters.add(com.createObjectAdapter("Adapter61", "default"));
+ adapters.add(com.createObjectAdapter("Adapter62", "default"));
+ adapters.add(com.createObjectAdapter("Adapter63", "default"));
+
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ test = TestIntfPrxHelper.uncheckedCast(test.ice_endpointSelection(Ice.EndpointSelectionType.Ordered));
+ test(test.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered);
+ test = TestIntfPrxHelper.uncheckedCast(test.ice_connectionCached(false));
+ test(!test.ice_isConnectionCached());
+ int nRetry = 5;
+ int i;
+
+ //
+ // Ensure that endpoints are tried in order by deactiving the adapters
+ // one after the other.
+ //
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter61"); i++);
+ test(i == nRetry);
+ com.deactivateObjectAdapter(adapters.get(0));
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter62"); i++);
+ test(i == nRetry);
+ com.deactivateObjectAdapter(adapters.get(1));
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter63"); i++);
+ test(i == nRetry);
+ com.deactivateObjectAdapter(adapters.get(2));
+
+ try
+ {
+ test.getAdapterName();
+ }
+ catch(Ice.ConnectFailedException ex)
+ {
+ //
+ // Usually the actual type of this exception is ConnectionRefusedException,
+ // but not always. See bug 3179.
+ //
+ }
+
+ Ice.Endpoint[] endpoints = test.ice_getEndpoints();
+
+ adapters.clear();
+
+ //
+ // Now, re-activate the adapters with the same endpoints in the opposite
+ // order.
+ //
+ adapters.add(com.createObjectAdapter("Adapter66", endpoints[2].toString()));
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter66"); i++);
+ test(i == nRetry);
+ adapters.add(com.createObjectAdapter("Adapter65", endpoints[1].toString()));
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter65"); i++);
+ test(i == nRetry);
+ adapters.add(com.createObjectAdapter("Adapter64", endpoints[0].toString()));
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter64"); i++);
+ test(i == nRetry);
+
+ deactivate(com, adapters);
+ }
+ out.println("ok");
+
+ out.print("testing per request binding and ordered endpoint selection and AMI... ");
+ out.flush();
+ {
+ java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>();
+ adapters.add(com.createObjectAdapter("AdapterAMI61", "default"));
+ adapters.add(com.createObjectAdapter("AdapterAMI62", "default"));
+ adapters.add(com.createObjectAdapter("AdapterAMI63", "default"));
+
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ test = TestIntfPrxHelper.uncheckedCast(test.ice_endpointSelection(Ice.EndpointSelectionType.Ordered));
+ test(test.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered);
+ test = TestIntfPrxHelper.uncheckedCast(test.ice_connectionCached(false));
+ test(!test.ice_isConnectionCached());
+ int nRetry = 5;
+ int i;
+
+ //
+ // Ensure that endpoints are tried in order by deactiving the adapters
+ // one after the other.
+ //
+ for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI61"); i++);
+ test(i == nRetry);
+ com.deactivateObjectAdapter(adapters.get(0));
+ for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI62"); i++);
+ test(i == nRetry);
+ com.deactivateObjectAdapter(adapters.get(1));
+ for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI63"); i++);
+ test(i == nRetry);
+ com.deactivateObjectAdapter(adapters.get(2));
+
+ try
+ {
+ test.getAdapterName();
+ }
+ catch(Ice.ConnectFailedException ex)
+ {
+ //
+ // Usually the actual type of this exception is ConnectionRefusedException,
+ // but not always. See bug 3179.
+ //
+ }
+
+ Ice.Endpoint[] endpoints = test.ice_getEndpoints();
+
+ adapters.clear();
+
+ //
+ // Now, re-activate the adapters with the same endpoints in the opposite
+ // order.
+ //
+ adapters.add(com.createObjectAdapter("AdapterAMI66", endpoints[2].toString()));
+ for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI66"); i++);
+ test(i == nRetry);
+ adapters.add(com.createObjectAdapter("AdapterAMI65", endpoints[1].toString()));
+ for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI65"); i++);
+ test(i == nRetry);
+ adapters.add(com.createObjectAdapter("AdapterAMI64", endpoints[0].toString()));
+ for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI64"); i++);
+ test(i == nRetry);
+
+ deactivate(com, adapters);
+ }
+ out.println("ok");
+
+ out.print("testing endpoint mode filtering... ");
+ out.flush();
+ {
+ java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>();
+ adapters.add(com.createObjectAdapter("Adapter71", "default"));
+ adapters.add(com.createObjectAdapter("Adapter72", "udp"));
+
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ test(test.getAdapterName().equals("Adapter71"));
+
+ TestIntfPrx testUDP = TestIntfPrxHelper.uncheckedCast(test.ice_datagram());
+ test(test.ice_getConnection() != testUDP.ice_getConnection());
+ try
+ {
+ testUDP.getAdapterName();
+ }
+ catch(Ice.TwowayOnlyException ex)
+ {
+ }
+ }
+ out.println("ok");
+
+ if(communicator.getProperties().getProperty("Ice.Plugin.IceSSL").length() > 0)
+ {
+ out.print("testing unsecure vs. secure endpoints... ");
+ out.flush();
+ {
+ java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>();
+ adapters.add(com.createObjectAdapter("Adapter81", "ssl"));
+ adapters.add(com.createObjectAdapter("Adapter82", "tcp"));
+
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ int i;
+ for(i = 0; i < 5; i++)
+ {
+ test(test.getAdapterName().equals("Adapter82"));
+ test.ice_getConnection().close(false);
+ }
+
+ TestIntfPrx testSecure = TestIntfPrxHelper.uncheckedCast(test.ice_secure(true));
+ test(testSecure.ice_isSecure());
+ testSecure = TestIntfPrxHelper.uncheckedCast(test.ice_secure(false));
+ test(!testSecure.ice_isSecure());
+ testSecure = TestIntfPrxHelper.uncheckedCast(test.ice_secure(true));
+ test(testSecure.ice_isSecure());
+ test(test.ice_getConnection() != testSecure.ice_getConnection());
+
+ com.deactivateObjectAdapter(adapters.get(1));
+
+ for(i = 0; i < 5; i++)
+ {
+ test(test.getAdapterName().equals("Adapter81"));
+ test.ice_getConnection().close(false);
+ }
+
+ com.createObjectAdapter("Adapter83", (test.ice_getEndpoints()[1]).toString()); // Reactive tcp OA.
+
+ for(i = 0; i < 5; i++)
+ {
+ test(test.getAdapterName().equals("Adapter83"));
+ test.ice_getConnection().close(false);
+ }
+
+ com.deactivateObjectAdapter(adapters.get(0));
+ try
+ {
+ testSecure.ice_ping();
+ test(false);
+ }
+ catch(Ice.ConnectFailedException ex)
+ {
+ //
+ // Usually the actual type of this exception is ConnectionRefusedException,
+ // but not always. See bug 3179.
+ //
+ }
+
+ deactivate(com, adapters);
+ }
+ out.println("ok");
+ }
+
+ {
+ out.print("testing ipv4 & ipv6 connections... ");
+ out.flush();
+
+ Ice.Properties ipv4 = Ice.Util.createProperties();
+ ipv4.setProperty("Ice.IPv4", "1");
+ ipv4.setProperty("Ice.IPv6", "0");
+ ipv4.setProperty("Adapter.Endpoints", "tcp -h localhost");
+
+ Ice.Properties ipv6 = Ice.Util.createProperties();
+ ipv6.setProperty("Ice.IPv4", "0");
+ ipv6.setProperty("Ice.IPv6", "1");
+ ipv6.setProperty("Adapter.Endpoints", "tcp -h localhost");
+
+ Ice.Properties bothPreferIPv4 = Ice.Util.createProperties();
+ bothPreferIPv4.setProperty("Ice.IPv4", "1");
+ bothPreferIPv4.setProperty("Ice.IPv6", "1");
+ bothPreferIPv4.setProperty("Ice.PreferIPv6Address", "0");
+ bothPreferIPv4.setProperty("Adapter.Endpoints", "tcp -h localhost");
+
+ Ice.Properties bothPreferIPv6 = Ice.Util.createProperties();
+ bothPreferIPv6.setProperty("Ice.IPv4", "1");
+ bothPreferIPv6.setProperty("Ice.IPv6", "1");
+ bothPreferIPv6.setProperty("Ice.PreferIPv6Address", "1");
+ bothPreferIPv6.setProperty("Adapter.Endpoints", "tcp -h localhost");
+
+ java.util.List<Ice.Properties> clientProps = new java.util.ArrayList<Ice.Properties>();
+ clientProps.add(ipv4);
+ clientProps.add(ipv6);
+ clientProps.add(bothPreferIPv4);
+ clientProps.add(bothPreferIPv6);
+
+ Ice.Properties anyipv4 = ipv4._clone();
+ anyipv4.setProperty("Adapter.Endpoints", "tcp -p 12012");
+ anyipv4.setProperty("Adapter.PublishedEndpoints", "tcp -h 127.0.0.1 -p 12012");
+
+ Ice.Properties anyipv6 = ipv6._clone();
+ anyipv6.setProperty("Adapter.Endpoints", "tcp -p 12012");
+ anyipv6.setProperty("Adapter.PublishedEndpoints", "tcp -h \".1\" -p 12012");
+
+ Ice.Properties anyboth = Ice.Util.createProperties();
+ anyboth.setProperty("Ice.IPv4", "1");
+ anyboth.setProperty("Ice.IPv6", "1");
+ anyboth.setProperty("Adapter.Endpoints", "tcp -p 12012");
+ anyboth.setProperty("Adapter.PublishedEndpoints", "tcp -h \"::1\" -p 12012:tcp -h 127.0.0.1 -p 12012");
+
+ Ice.Properties localipv4 = ipv4._clone();
+ localipv4.setProperty("Adapter.Endpoints", "tcp -h 127.0.0.1");
+
+ Ice.Properties localipv6 = ipv6._clone();
+ localipv6.setProperty("Adapter.Endpoints", "tcp -h \"::1\"");
+
+ java.util.List<Ice.Properties> serverProps = new java.util.ArrayList<Ice.Properties>(clientProps);
+ serverProps.add(anyipv4);
+ serverProps.add(anyipv6);
+ serverProps.add(anyboth);
+ serverProps.add(localipv4);
+ serverProps.add(localipv6);
+
+ boolean ipv6NotSupported = false;
+ for(Ice.Properties p : serverProps)
+ {
+ Ice.InitializationData serverInitData = app.createInitializationData();
+ serverInitData.properties = p;
+ Ice.Communicator serverCommunicator = app.initialize(serverInitData);
+ Ice.ObjectAdapter oa;
+ try
+ {
+ oa = serverCommunicator.createObjectAdapter("Adapter");
+ oa.activate();
+ }
+ catch(Ice.DNSException ex)
+ {
+ serverCommunicator.destroy();
+ continue; // IP version not supported.
+ }
+ catch(Ice.SocketException ex)
+ {
+ if(p == ipv6)
+ {
+ ipv6NotSupported = true;
+ }
+ serverCommunicator.destroy();
+ continue; // IP version not supported.
+ }
+
+ String strPrx = oa.createProxy(Ice.Util.stringToIdentity("dummy")).toString();
+ for(Ice.Properties q : clientProps)
+ {
+ Ice.InitializationData clientInitData = app.createInitializationData();
+ clientInitData.properties = q;
+ Ice.Communicator clientCommunicator = app.initialize(clientInitData);
+ Ice.ObjectPrx prx = clientCommunicator.stringToProxy(strPrx);
+ try
+ {
+ prx.ice_ping();
+ test(false);
+ }
+ catch(Ice.ObjectNotExistException ex)
+ {
+ // Expected, no object registered.
+ }
+ catch(Ice.DNSException ex)
+ {
+ // Expected if no IPv4 or IPv6 address is
+ // associated to localhost or if trying to connect
+ // to an any endpoint with the wrong IP version,
+ // e.g.: resolving an IPv4 address when only IPv6
+ // is enabled fails with a DNS exception.
+ }
+ catch(Ice.SocketException ex)
+ {
+ test((p == ipv4 && q == ipv6) || (p == ipv6 && q == ipv4) ||
+ (p == bothPreferIPv4 && q == ipv6) || (p == bothPreferIPv6 && q == ipv4) ||
+ (p == bothPreferIPv6 && q == ipv6 && ipv6NotSupported) ||
+ (p == anyipv4 && q == ipv6) || (p == anyipv6 && q == ipv4) ||
+ (p == localipv4 && q == ipv6) || (p == localipv6 && q == ipv4) ||
+ (p == ipv6 && q == bothPreferIPv4) || (p == bothPreferIPv6 && q == ipv6) ||
+ (p == ipv6 && q == bothPreferIPv4) || (p == ipv6 && q == bothPreferIPv6) ||
+ (p == bothPreferIPv6 && q == ipv6));
+ }
+ clientCommunicator.destroy();
+ }
+ serverCommunicator.destroy();
+ }
+
+ out.println("ok");
+ }
+
+ com.shutdown();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/binding/Client.java b/java-compat/test/src/main/java/test/Ice/binding/Client.java
new file mode 100644
index 00000000000..0610017ff98
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/binding/Client.java
@@ -0,0 +1,37 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.binding;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ AllTests.allTests(this);
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.binding");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java b/java-compat/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java
new file mode 100644
index 00000000000..5286442d092
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java
@@ -0,0 +1,52 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+package test.Ice.binding;
+import test.Ice.binding.Test.RemoteObjectAdapterPrx;
+import test.Ice.binding.Test.RemoteObjectAdapterPrxHelper;
+import test.Ice.binding.Test._RemoteCommunicatorDisp;
+
+public class RemoteCommunicatorI extends _RemoteCommunicatorDisp
+{
+ @Override
+ public RemoteObjectAdapterPrx
+ createObjectAdapter(String name, String endpts, Ice.Current current)
+ {
+ String endpoints = endpts;
+ if(endpoints.indexOf("-p") < 0)
+ {
+ // Use a fixed port if none is specified (bug 2896)
+ endpoints += " -h \"" +
+ (current.adapter.getCommunicator().getProperties().getPropertyWithDefault(
+ "Ice.Default.Host", "127.0.0.1")) +
+ "\" -p " + _nextPort++;
+ }
+
+ Ice.Communicator com = current.adapter.getCommunicator();
+ com.getProperties().setProperty(name + ".ThreadPool.Size", "1");
+ Ice.ObjectAdapter adapter = com.createObjectAdapterWithEndpoints(name, endpoints);
+ return RemoteObjectAdapterPrxHelper.uncheckedCast(
+ current.adapter.addWithUUID(new RemoteObjectAdapterI(adapter)));
+ }
+
+ @Override
+ public void
+ deactivateObjectAdapter(RemoteObjectAdapterPrx adapter, Ice.Current current)
+ {
+ adapter.deactivate(); // Collocated call.
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+
+ private int _nextPort = 10001;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/binding/RemoteObjectAdapterI.java b/java-compat/test/src/main/java/test/Ice/binding/RemoteObjectAdapterI.java
new file mode 100644
index 00000000000..5f392c94605
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/binding/RemoteObjectAdapterI.java
@@ -0,0 +1,48 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.binding;
+
+import test.Ice.binding.Test.TestIntfPrx;
+import test.Ice.binding.Test.TestIntfPrxHelper;
+import test.Ice.binding.Test._RemoteObjectAdapterDisp;
+
+public class RemoteObjectAdapterI extends _RemoteObjectAdapterDisp
+{
+ public
+ RemoteObjectAdapterI(Ice.ObjectAdapter adapter)
+ {
+ _adapter = adapter;
+ _testIntf = TestIntfPrxHelper.uncheckedCast(_adapter.add(new TestI(), Ice.Util.stringToIdentity("test")));
+ _adapter.activate();
+ }
+
+ @Override
+ public TestIntfPrx
+ getTestIntf(Ice.Current current)
+ {
+ return _testIntf;
+ }
+
+ @Override
+ public void
+ deactivate(Ice.Current current)
+ {
+ try
+ {
+ _adapter.destroy();
+ }
+ catch(Ice.ObjectAdapterDeactivatedException ex)
+ {
+ }
+ }
+
+ final Ice.ObjectAdapter _adapter;
+ final TestIntfPrx _testIntf;
+};
diff --git a/java-compat/test/src/main/java/test/Ice/binding/Server.java b/java-compat/test/src/main/java/test/Ice/binding/Server.java
new file mode 100644
index 00000000000..104b7e1eb03
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/binding/Server.java
@@ -0,0 +1,45 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.binding;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int
+ run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.Identity id = Ice.Util.stringToIdentity("communicator");
+ adapter.add(new RemoteCommunicatorI(), id);
+ adapter.activate();
+
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.binding");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ return initData;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/binding/Test.ice b/java-compat/test/src/main/java/test/Ice/binding/Test.ice
new file mode 100644
index 00000000000..602b324931c
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/binding/Test.ice
@@ -0,0 +1,37 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.binding"]]
+module Test
+{
+
+interface TestIntf
+{
+ string getAdapterName();
+};
+
+interface RemoteObjectAdapter
+{
+ TestIntf* getTestIntf();
+
+ void deactivate();
+};
+
+interface RemoteCommunicator
+{
+ RemoteObjectAdapter* createObjectAdapter(string name, string endpoints);
+
+ void deactivateObjectAdapter(RemoteObjectAdapter* adapter);
+
+ void shutdown();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/binding/TestI.java b/java-compat/test/src/main/java/test/Ice/binding/TestI.java
new file mode 100644
index 00000000000..2f9780da792
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/binding/TestI.java
@@ -0,0 +1,25 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.binding;
+import test.Ice.binding.Test._TestIntfDisp;
+
+public class TestI extends _TestIntfDisp
+{
+ TestI()
+ {
+ }
+
+ @Override
+ public String
+ getAdapterName(Ice.Current current)
+ {
+ return current.adapter.getName();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/binding/run.py b/java-compat/test/src/main/java/test/Ice/binding/run.py
new file mode 100755
index 00000000000..97f9acd4094
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/binding/run.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/checksum/AllTests.java b/java-compat/test/src/main/java/test/Ice/checksum/AllTests.java
new file mode 100644
index 00000000000..5145912b376
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/checksum/AllTests.java
@@ -0,0 +1,92 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.checksum;
+
+import java.io.PrintWriter;
+import test.Ice.checksum.Test.*;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static ChecksumPrx
+ allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out)
+ {
+ String ref = "test:default -p 12010";
+ Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ test(base != null);
+
+ ChecksumPrx checksum = ChecksumPrxHelper.checkedCast(base);
+ test(checksum != null);
+
+ //
+ // Verify that no checksums are present for local types.
+ //
+ out.print("testing checksums... ");
+ out.flush();
+ for(java.util.Map.Entry<String, String> p : SliceChecksums.checksums.entrySet())
+ {
+ String key = p.getKey();
+ int pos = key.indexOf("Local");
+ test(pos == -1);
+ }
+
+ //
+ // Get server's Slice checksums.
+ //
+ java.util.Map<String, String> d = checksum.getSliceChecksums();
+
+ //
+ // Compare the checksums. For a type FooN whose name ends in an integer N,
+ // we assume that the server's type does not change for N = 1, and does
+ // change for N > 1.
+ //
+ java.util.regex.Pattern patt = java.util.regex.Pattern.compile("\\d+");
+ for(java.util.Map.Entry<String, String> p : d.entrySet())
+ {
+ int n = 0;
+ String key = p.getKey();
+ java.util.regex.Matcher m = patt.matcher(key);
+ if(m.find())
+ {
+ try
+ {
+ n = Integer.parseInt(key.substring(m.start(), m.end()));
+ }
+ catch(NumberFormatException ex)
+ {
+ test(false);
+ }
+ }
+
+ String value = SliceChecksums.checksums.get(key);
+ test(value != null);
+
+ if(n <= 1)
+ {
+ test(value.equals(p.getValue()));
+ }
+ else
+ {
+ test(!value.equals(p.getValue()));
+ }
+ }
+ out.println("ok");
+
+ return checksum;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/checksum/ChecksumI.java b/java-compat/test/src/main/java/test/Ice/checksum/ChecksumI.java
new file mode 100644
index 00000000000..3ce9a475e0e
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/checksum/ChecksumI.java
@@ -0,0 +1,34 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.checksum;
+
+import test.Ice.checksum.server.Test.*;
+
+public final class ChecksumI extends _ChecksumDisp
+{
+ public
+ ChecksumI()
+ {
+ }
+
+ @Override
+ public java.util.Map<String, String>
+ getSliceChecksums(Ice.Current current)
+ {
+ return SliceChecksums.checksums;
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/checksum/Client.java b/java-compat/test/src/main/java/test/Ice/checksum/Client.java
new file mode 100644
index 00000000000..c98eacbdab3
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/checksum/Client.java
@@ -0,0 +1,45 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.checksum;
+
+import test.Ice.checksum.Test.ChecksumPrx;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int
+ run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ ChecksumPrx checksum = AllTests.allTests(communicator, false, getWriter());
+ checksum.shutdown();
+ return 0;
+ }
+
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.checksum");
+ return initData;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/checksum/Server.java b/java-compat/test/src/main/java/test/Ice/checksum/Server.java
new file mode 100644
index 00000000000..dffecaff213
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/checksum/Server.java
@@ -0,0 +1,45 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.checksum;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int
+ run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.Object object = new ChecksumI();
+ adapter.add(object, Ice.Util.stringToIdentity("test"));
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.checksum.server");
+ return initData;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Server c = new Server();
+ int status = c.main("Server", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/checksum/Test.ice b/java-compat/test/src/main/java/test/Ice/checksum/Test.ice
new file mode 100644
index 00000000000..848c96df97b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/checksum/Test.ice
@@ -0,0 +1,25 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+#include <Ice/SliceChecksumDict.ice>
+
+[["java:package:test.Ice.checksum"]]
+module Test
+{
+
+interface Checksum
+{
+ idempotent Ice::SliceChecksumDict getSliceChecksums();
+
+ void shutdown();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/checksum/TestServer.ice b/java-compat/test/src/main/java/test/Ice/checksum/TestServer.ice
new file mode 100644
index 00000000000..d13c1dd0c8d
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/checksum/TestServer.ice
@@ -0,0 +1,25 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+#include <Ice/SliceChecksumDict.ice>
+
+[["java:package:test.Ice.checksum.server"]]
+module Test
+{
+
+interface Checksum
+{
+ idempotent Ice::SliceChecksumDict getSliceChecksums();
+
+ void shutdown();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/checksum/Types.ice b/java-compat/test/src/main/java/test/Ice/checksum/Types.ice
new file mode 100644
index 00000000000..89c9eee01d3
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/checksum/Types.ice
@@ -0,0 +1,635 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.checksum"]]
+module Test
+{
+
+//
+// TEST: Same
+//
+const int IntConst1 = 100;
+
+//
+// TEST: Value changed
+//
+const int IntConst2 = 100;
+
+//
+// TEST: Type changed
+//
+const int IntConst3 = 100;
+
+//
+// TEST: Same
+//
+enum Enum1 { Enum11, Enum12, Enum13 };
+
+//
+// TEST: Add enumerator
+//
+enum Enum2 { Enum21, Enum22, Enum23 };
+
+//
+// TEST: Remove enumerator
+//
+enum Enum3 { Enum31, Enum32, Enum33 };
+
+//
+// TEST: Change to a different type
+//
+enum Enum4 { Enum41, Enum42, Enum43 };
+
+//
+// TEST: Enum with explicit values.
+//
+enum EnumExplicit0 { EnumExplicit01 = 1, EnumExplicit02 = 2, EnumExplicit03 = 3 };
+
+//
+// TEST: Enum with same explicit values, different order.
+//
+enum EnumExplicit1 { EnumExplicit11 = 1, EnumExplicit12 = 2, EnumExplicit13 = 3 };
+
+//
+// TEST: Enum with different explicit values.
+//
+enum EnumExplicit2 { EnumExplicit21 = 1, EnumExplicit22 = 2, EnumExplicit23 = 3};
+
+//
+// TEST: Enum with explicit values, removed enumerator.
+//
+enum EnumExplicit3 { EnumExplicit31 = 1, EnumExplicit32 = 2, EnumExplicit33 = 3};
+
+//
+// TEST: Same
+//
+sequence<int> Sequence1;
+
+//
+// TEST: Change sequence type
+//
+sequence<int> Sequence2;
+
+//
+// TEST: Change to a different type
+//
+sequence<int> Sequence3;
+
+//
+// TEST: Same
+//
+dictionary<string, int> Dictionary1;
+
+//
+// TEST: Change key type
+//
+dictionary<string, int> Dictionary2;
+
+//
+// TEST: Change value type
+//
+dictionary<string, int> Dictionary3;
+
+//
+// TEST: Change to a different type
+//
+dictionary<string, int> Dictionary4;
+
+//
+// TEST: Same
+//
+struct Struct1
+{
+ string str;
+ bool b;
+};
+
+//
+// TEST: Add member
+//
+struct Struct2
+{
+ string str;
+ bool b;
+};
+
+//
+// TEST: Change member type
+//
+struct Struct3
+{
+ string str;
+ bool b;
+};
+
+//
+// TEST: Remove member
+//
+struct Struct4
+{
+ string str;
+ bool b;
+};
+
+//
+// TEST: Change to a different type
+//
+struct Struct5
+{
+ string str;
+ bool b;
+};
+
+//
+// TEST: Same
+//
+interface Interface1
+{
+};
+
+//
+// TEST: Change interface to class
+//
+interface Interface2
+{
+};
+
+//
+// TEST: Add base interface
+//
+interface Interface3
+{
+};
+
+//
+// TEST: Add operation
+//
+interface Interface4
+{
+};
+
+//
+// TEST: Same
+//
+class EmptyClass1
+{
+};
+
+//
+// TEST: Add data member
+//
+class EmptyClass2
+{
+};
+
+//
+// TEST: Add operation
+//
+class EmptyClass3
+{
+};
+
+//
+// TEST: Add base class
+//
+class EmptyClass4
+{
+};
+
+//
+// TEST: Add interface
+//
+class EmptyClass5
+{
+};
+
+//
+// TEST: Same
+//
+class SimpleClass1
+{
+ string str;
+ float f;
+};
+
+//
+// TEST: Add operation
+//
+class SimpleClass2
+{
+ string str;
+ float f;
+};
+
+//
+// TEST: Rename member
+//
+class SimpleClass3
+{
+ string str;
+ float f;
+};
+
+//
+// TEST: Add member
+//
+class SimpleClass4
+{
+ string str;
+ float f;
+};
+
+//
+// TEST: Remove member
+//
+class SimpleClass5
+{
+ string str;
+ float f;
+};
+
+//
+// TEST: Reorder members
+//
+class SimpleClass6
+{
+ string str;
+ float f;
+};
+
+//
+// TEST: Change member type
+//
+class SimpleClass7
+{
+ string str;
+ float f;
+};
+
+//
+// TEST: Same
+//
+exception Exception1
+{
+ string str;
+ bool b;
+};
+
+//
+// TEST: Add member
+//
+exception Exception2
+{
+ string str;
+ bool b;
+};
+
+//
+// TEST: Change member type
+//
+exception Exception3
+{
+ string str;
+ bool b;
+};
+
+//
+// TEST: Remove member
+//
+exception Exception4
+{
+ string str;
+ bool b;
+};
+
+//
+// TEST: Add base exception
+//
+exception Exception5
+{
+};
+
+//
+// TEST: Change to a different type
+//
+exception Exception6
+{
+ string str;
+ bool b;
+};
+
+//
+// TEST: Exception with optional members.
+//
+exception OptionalEx0
+{
+ string firstName;
+ optional(1) string secondName;
+ optional(2) string emailAddress;
+};
+
+//
+// TEST: Exception with optional members, different order, same tags.
+//
+exception OptionalEx1
+{
+ string firstName;
+ optional(1) string secondName;
+ optional(2) string emailAddress;
+};
+
+//
+// TEST: Exception with different optional members.
+//
+exception OptionalEx2
+{
+ string firstName;
+ string secondName;
+ optional(1) string emailAddress;
+};
+
+//
+// TEST: Exception with different optional members.
+//
+exception OptionalEx3
+{
+ string firstName;
+ optional(1) string secondName;
+ optional(2) string emailAddress;
+};
+
+//
+// TEST: Exception with optional members using different tags.
+//
+exception OptionalEx4
+{
+ string firstName;
+ optional(1) string secondName;
+ optional(2) string emailAddress;
+};
+
+//
+// TEST: Same
+//
+class BaseClass1
+{
+ void baseOp1();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Change return type
+//
+class BaseClass2
+{
+ void baseOp();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Add parameter
+//
+class BaseClass3
+{
+ void baseOp();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Add exception
+//
+class BaseClass4
+{
+ void baseOp();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Change out parameter to in parameter
+//
+class BaseClass5
+{
+ void baseOp();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Remove parameter
+//
+class BaseClass6
+{
+ void baseOp();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Remove exception
+//
+class BaseClass7
+{
+ void baseOp();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Remove operation
+//
+class BaseClass8
+{
+ void baseOp();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Add base class
+//
+class BaseClass9
+{
+ void baseOp();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Add interface
+//
+class BaseClass10
+{
+ void baseOp();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Add base class and interface
+//
+class BaseClass11
+{
+ void baseOp();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Class with compact id
+//
+class Compact1(1)
+{
+ void baseOp();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Derived from class with compact id
+//
+class Derived1 extends Compact1
+{
+};
+
+//
+// TEST: Same class names but different compact id
+//
+class Compact2(2)
+{
+ void baseOp();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Class with optional members.
+//
+class Optional0
+{
+ string firstName;
+ optional(1) string secondName;
+ optional(2) string emailAddress;
+};
+
+//
+// TEST: Class with optional members, different order, same tags.
+//
+class Optional1
+{
+ string firstName;
+ optional(1) string secondName;
+ optional(2) string emailAddress;
+};
+
+//
+// TEST: Class with different optional members.
+//
+class Optional2
+{
+ string firstName;
+ string secondName;
+ optional(1) string emailAddress;
+};
+
+//
+// TEST: Class with different optional members.
+//
+class Optional3
+{
+ string firstName;
+ optional(1) string secondName;
+ optional(2) string emailAddress;
+};
+
+//
+// TEST: Class with optional members using different tags.
+//
+class Optional4
+{
+ string firstName;
+ optional(1) string secondName;
+ optional(2) string emailAddress;
+};
+
+//
+// TEST: Class with optional parameters.
+//
+class OptionalParameters0
+{
+ void op1(string firstName, optional(1) string secondName,
+ optional(2) string emailAddress);
+};
+
+//
+// TEST: Class with optional parameters, different order.
+//
+class OptionalParameters1
+{
+ void op1(string firstName, optional(1) string secondName,
+ optional(2) string emailAddress);
+};
+
+//
+// TEST: Class with optional parameters, different tags.
+//
+class OptionalParameters2
+{
+ void op1(string firstName, optional(1) string emailAddress,
+ optional(2) string secondName);
+};
+
+//
+// TEST: Class with different optional parameters.
+//
+class OptionalParameters3
+{
+ void op1(string firstName, optional(1) string emailAddress,
+ string secondName);
+};
+
+//
+// TEST: Class with optional return type.
+//
+class OptionalReturn0
+{
+ optional(1) int op();
+};
+
+//
+// TEST: Class that changes optional return type.
+//
+class OptionalReturn2
+{
+ optional(1) int op();
+};
+
+//
+// TEST: Local
+//
+local enum LocalEnum { LocalEnum1, LocalEnum2, LocalEnum3 };
+
+//
+// TEST: Local
+//
+local sequence<string> LocalSequence;
+
+//
+// TEST: Local
+//
+local dictionary<string, string> LocalDictionary;
+
+//
+// TEST: Local
+//
+local struct LocalStruct
+{
+ string str;
+};
+
+//
+// TEST: Local
+//
+local class LocalClass
+{
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/checksum/TypesServer.ice b/java-compat/test/src/main/java/test/Ice/checksum/TypesServer.ice
new file mode 100644
index 00000000000..0774d423249
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/checksum/TypesServer.ice
@@ -0,0 +1,632 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.checksum.server"]]
+module Test
+{
+
+//
+// TEST: Same
+//
+const int IntConst1 = 100;
+
+//
+// TEST: Value changed
+//
+const int IntConst2 = 1000;
+
+//
+// TEST: Type changed
+//
+const short IntConst3 = 100;
+
+//
+// TEST: Same
+//
+enum Enum1 { Enum11, Enum12, Enum13 };
+
+//
+// TEST: Add enumerator
+//
+enum Enum2 { Enum21, Enum22, Enum23, Enum24 };
+
+//
+// TEST: Remove enumerator
+//
+enum Enum3 { Enum32, Enum33 };
+
+//
+// TEST: Enum with explicit values.
+//
+enum EnumExplicit0 { EnumExplicit01 = 1, EnumExplicit02 = 2, EnumExplicit03 = 3 };
+
+//
+// TEST: Enum with same explicit values, different order.
+//
+enum EnumExplicit1 { EnumExplicit11 = 1, EnumExplicit13 = 3, EnumExplicit12 = 2 };
+
+//
+// TEST: Enum with different explicit values.
+//
+enum EnumExplicit2 { EnumExplicit21 = 1, EnumExplicit22 = 3, EnumExplicit23 };
+
+//
+// TEST: Enum with explicit values, removed enumerator.
+//
+enum EnumExplicit3 { EnumExplicit31 = 1, EnumExplicit32 = 2};
+
+//
+// TEST: Change to a different type
+//
+class Enum4 {};
+
+//
+// TEST: Same
+//
+sequence<int> Sequence1;
+
+//
+// TEST: Change sequence type
+//
+sequence<short> Sequence2;
+
+//
+// TEST: Change to a different type
+//
+class Sequence3 {};
+
+//
+// TEST: Same
+//
+dictionary<string, int> Dictionary1;
+
+//
+// TEST: Change key type
+//
+dictionary<long, int> Dictionary2;
+
+//
+// TEST: Change value type
+//
+dictionary<string, bool> Dictionary3;
+
+//
+// TEST: Change to a different type
+//
+class Dictionary4 {};
+
+//
+// TEST: Same
+//
+struct Struct1
+{
+ string str;
+ bool b;
+};
+
+//
+// TEST: Add member
+//
+struct Struct2
+{
+ string str;
+ bool b;
+ float f;
+};
+
+//
+// TEST: Change member type
+//
+struct Struct3
+{
+ string str;
+ double b;
+};
+
+//
+// TEST: Remove member
+//
+struct Struct4
+{
+ bool b;
+};
+
+//
+// TEST: Change to a different type
+//
+class Struct5 {};
+
+//
+// TEST: Same
+//
+interface Interface1
+{
+};
+
+//
+// TEST: Change interface to class
+//
+class Interface2
+{
+};
+
+//
+// TEST: Add base interface
+//
+interface Interface3 extends Interface1
+{
+};
+
+//
+// TEST: Add operation
+//
+interface Interface4
+{
+ void opInterface4();
+};
+
+//
+// TEST: Same
+//
+class EmptyClass1
+{
+};
+
+//
+// TEST: Add data member
+//
+class EmptyClass2
+{
+ double d;
+};
+
+//
+// TEST: Add operation
+//
+class EmptyClass3
+{
+ void newOp();
+};
+
+//
+// TEST: Add base class
+//
+class EmptyClass4 extends EmptyClass1
+{
+};
+
+//
+// TEST: Add interface
+//
+class EmptyClass5 implements Interface1
+{
+};
+
+//
+// TEST: Same
+//
+class SimpleClass1
+{
+ string str;
+ float f;
+};
+
+//
+// TEST: Add operation
+//
+class SimpleClass2
+{
+ string str;
+ float f;
+ void newOp();
+};
+
+//
+// TEST: Rename member
+//
+class SimpleClass3
+{
+ string str;
+ float g;
+};
+
+//
+// TEST: Add member
+//
+class SimpleClass4
+{
+ string str;
+ float f;
+ bool b;
+};
+
+//
+// TEST: Remove member
+//
+class SimpleClass5
+{
+ string str;
+};
+
+//
+// TEST: Reorder members
+//
+class SimpleClass6
+{
+ float f;
+ string str;
+};
+
+//
+// TEST: Change member type
+//
+class SimpleClass7
+{
+ string str;
+ double f;
+};
+
+//
+// TEST: Same
+//
+exception Exception1
+{
+ string str;
+ bool b;
+};
+
+//
+// TEST: Add member
+//
+exception Exception2
+{
+ string str;
+ bool b;
+ float f;
+};
+
+//
+// TEST: Change member type
+//
+exception Exception3
+{
+ string str;
+ double b;
+};
+
+//
+// TEST: Remove member
+//
+exception Exception4
+{
+ bool b;
+};
+
+//
+// TEST: Add base exception
+//
+exception Exception5 extends Exception1
+{
+};
+
+//
+// TEST: Change to a different type
+//
+class Exception6 {};
+
+//
+// TEST: Exception with optional members.
+//
+exception OptionalEx0
+{
+ string firstName;
+ optional(1) string secondName;
+ optional(2) string emailAddress;
+};
+
+//
+// TEST: Exception with optional members, different order, same tags.
+//
+exception OptionalEx1
+{
+ string firstName;
+ optional(2) string emailAddress;
+ optional(1) string secondName;
+};
+
+//
+// TEST: Exception with different optional members.
+//
+exception OptionalEx2
+{
+ string firstName;
+ optional(1) string secondName;
+ string emailAddress;
+};
+
+//
+// TEST: Exception with different optional members.
+//
+exception OptionalEx3
+{
+ string firstName;
+ optional(1) string secondName;
+ optional(2) string emailAddress;
+ optional(3) string phoneNumber;
+};
+
+//
+// TEST: Exception with optional members using different tags.
+//
+exception OptionalEx4
+{
+ string firstName;
+ optional(2) string secondName;
+ optional(1) string emailAddress;
+};
+
+//
+// TEST: Same
+//
+class BaseClass1
+{
+ void baseOp1();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Change return type
+//
+class BaseClass2
+{
+ int baseOp();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Add parameter
+//
+class BaseClass3
+{
+ void baseOp(Object o);
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Add exception
+//
+class BaseClass4
+{
+ void baseOp();
+ void baseOp2(int i, out string s) throws Exception1, Exception2;
+};
+
+//
+// TEST: Change out parameter to in parameter
+//
+class BaseClass5
+{
+ void baseOp();
+ void baseOp2(int i, string s) throws Exception1;
+};
+
+//
+// TEST: Remove parameter
+//
+class BaseClass6
+{
+ void baseOp();
+ void baseOp2(out string s) throws Exception1;
+};
+
+//
+// TEST: Remove exception
+//
+class BaseClass7
+{
+ void baseOp();
+ void baseOp2(int i, out string s);
+};
+
+//
+// TEST: Remove operation
+//
+class BaseClass8
+{
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Add base class
+//
+class BaseClass9 extends EmptyClass1
+{
+ void baseOp();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Add interface
+//
+class BaseClass10 implements Interface1
+{
+ void baseOp();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Add base class and interface
+//
+class BaseClass11 extends EmptyClass1 implements Interface1
+{
+ void baseOp();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Class with compact id
+//
+class Compact1(1)
+{
+ void baseOp();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Derived from class with compact id
+//
+class Derived1 extends Compact1
+{
+};
+
+//
+// TEST: Same class names but different compact id
+//
+class Compact2(3)
+{
+ void baseOp();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Class with optional members.
+//
+class Optional0
+{
+ string firstName;
+ optional(1) string secondName;
+ optional(2) string emailAddress;
+};
+
+//
+// TEST: Class with optional members, different order, same tags.
+//
+class Optional1
+{
+ string firstName;
+ optional(2) string emailAddress;
+ optional(1) string secondName;
+};
+
+//
+// TEST: Class with different optional members.
+//
+class Optional2
+{
+ string firstName;
+ optional(1) string secondName;
+ string emailAddress;
+};
+
+//
+// TEST: Class with different optional members.
+//
+class Optional3
+{
+ string firstName;
+ optional(1) string secondName;
+ optional(2) string emailAddress;
+ optional(3) string phoneNumber;
+};
+
+//
+// TEST: Class with optional members using different tags.
+//
+class Optional4
+{
+ string firstName;
+ optional(2) string secondName;
+ optional(1) string emailAddress;
+};
+
+//
+// TEST: Class with optional parameters.
+//
+class OptionalParameters0
+{
+ void op1(string firstName, optional(1) string secondName,
+ optional(2) string emailAddress);
+};
+
+//
+// TEST: Class with optional parameters, different order.
+//
+class OptionalParameters1
+{
+ void op1(string firstName, optional(2) string emailAddress,
+ optional(1) string secondName);
+};
+
+//
+// TEST: Class with optional parameters, different tags.
+//
+class OptionalParameters2
+{
+ void op1(string firstName, optional(2) string emailAddress,
+ optional(1) string secondName);
+};
+
+//
+// TEST: Class with different optional parameters.
+//
+class OptionalParameters3
+{
+ void op1(string firstName, string emailAddress,
+ optional(1) string secondName);
+};
+
+//
+// TEST: Class with optional return type.
+//
+class OptionalReturn0
+{
+ optional(1) int op();
+};
+
+//
+// TEST: Class that changes optional return type.
+//
+class OptionalReturn2
+{
+ int op();
+};
+
+//
+// TEST: Local
+//
+local enum LocalEnum { LocalEnum1, LocalEnum2, LocalEnum3 };
+
+//
+// TEST: Local
+//
+local sequence<string> LocalSequence;
+
+//
+// TEST: Local
+//
+local dictionary<string, string> LocalDictionary;
+
+//
+// TEST: Local
+//
+local struct LocalStruct
+{
+ string str;
+};
+
+//
+// TEST: Local
+//
+local class LocalClass
+{
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/checksum/run.py b/java-compat/test/src/main/java/test/Ice/checksum/run.py
new file mode 100755
index 00000000000..97f9acd4094
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/checksum/run.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/classLoader/AbstractClassI.java b/java-compat/test/src/main/java/test/Ice/classLoader/AbstractClassI.java
new file mode 100644
index 00000000000..5206642fb7c
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/classLoader/AbstractClassI.java
@@ -0,0 +1,21 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.classLoader;
+
+import test.Ice.classLoader.Test.AbstractClass;
+
+class AbstractClassI extends AbstractClass
+{
+ @Override
+ public void
+ op(Ice.Current current)
+ {
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/classLoader/AllTests.java b/java-compat/test/src/main/java/test/Ice/classLoader/AllTests.java
new file mode 100644
index 00000000000..f22fa4b816d
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/classLoader/AllTests.java
@@ -0,0 +1,215 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.classLoader;
+
+import java.io.PrintWriter;
+
+import test.Ice.classLoader.Test.AbstractClass;
+import test.Ice.classLoader.Test.ConcreteClass;
+import test.Ice.classLoader.Test.E;
+import test.Ice.classLoader.Test.InitialPrx;
+import test.Ice.classLoader.Test.InitialPrxHelper;
+import test.Util.Application;
+
+public class AllTests
+{
+ private static class MyValueFactory implements Ice.ValueFactory
+ {
+ @Override
+ public Ice.Object create(String type)
+ {
+ if(type.equals("::Test::AbstractClass"))
+ {
+ return new AbstractClassI();
+ }
+
+ assert (false); // Should never be reached
+ return null;
+ }
+ }
+
+ private static class MyClassLoader extends ClassLoader
+ {
+ MyClassLoader(ClassLoader parent) {
+ super(parent);
+ }
+
+ @Override
+ protected Class<?> loadClass(String name, boolean resolve)
+ throws ClassNotFoundException
+ {
+ _names.add(name);
+ return super.loadClass(name, resolve);
+ }
+
+ void reset()
+ {
+ _names.clear();
+ }
+
+ boolean check(String name)
+ {
+ return _names.contains(name);
+ }
+
+ private java.util.List<String> _names = new java.util.LinkedList<String>();
+ }
+
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static void
+ allTests(Application app, boolean collocated)
+ {
+ Ice.Communicator communicator = app.communicator();
+ PrintWriter out = app.getWriter();
+
+ //
+ // Verify that the class loader is used for Slice packages.
+ //
+ {
+ out.print("testing package... ");
+ out.flush();
+ Ice.InitializationData initData = app.createInitializationData();
+ initData.properties = communicator.getProperties()._clone();
+ MyClassLoader classLoader = new MyClassLoader(initData.classLoader);
+ initData.classLoader = classLoader;
+ Ice.Communicator ic = app.initialize(initData);
+ test(classLoader.check("test.Ice.classLoader.Test._Marker"));
+ ic.destroy();
+ out.println("ok");
+ }
+
+ //
+ // Verify that the class loader is used for Ice plug-ins.
+ //
+ {
+ out.print("testing plug-in... ");
+ out.flush();
+ Ice.InitializationData initData = app.createInitializationData();
+ initData.properties = communicator.getProperties()._clone();
+ initData.properties.setProperty("Ice.Plugin.Test", "test.Ice.classLoader.PluginFactoryI");
+ MyClassLoader classLoader = new MyClassLoader(initData.classLoader);
+ initData.classLoader = classLoader;
+ Ice.Communicator ic = app.initialize(initData);
+ test(classLoader.check("test.Ice.classLoader.PluginFactoryI"));
+ ic.destroy();
+ out.println("ok");
+ }
+
+ //
+ // Verify that the class loader is used for IceSSL certificate verifiers and password callbacks.
+ //
+ if(communicator.getProperties().getProperty("Ice.Default.Protocol").equals("ssl"))
+ {
+ out.print("testing IceSSL certificate verifier and password callback... ");
+ out.flush();
+ Ice.InitializationData initData = app.createInitializationData();
+ initData.properties = communicator.getProperties()._clone();
+ initData.properties.setProperty("IceSSL.CertVerifier", "test.Ice.classLoader.CertificateVerifierI");
+ initData.properties.setProperty("IceSSL.PasswordCallback", "test.Ice.classLoader.PasswordCallbackI");
+ MyClassLoader classLoader = new MyClassLoader(initData.classLoader);
+ initData.classLoader = classLoader;
+ Ice.Communicator ic = app.initialize(initData);
+ test(classLoader.check("test.Ice.classLoader.CertificateVerifierI"));
+ test(classLoader.check("test.Ice.classLoader.PasswordCallbackI"));
+ ic.destroy();
+ out.println("ok");
+ }
+
+ //
+ // Marshaling tests.
+ //
+ {
+ Ice.InitializationData initData = app.createInitializationData();
+ initData.properties = communicator.getProperties()._clone();
+ MyClassLoader classLoader = new MyClassLoader(initData.classLoader);
+ initData.classLoader = classLoader;
+ Ice.Communicator ic = app.initialize(initData);
+
+ String ref = "initial:default -p 12010";
+ Ice.ObjectPrx base = ic.stringToProxy(ref);
+ test(base != null);
+
+ InitialPrx initial = InitialPrxHelper.checkedCast(base);
+ test(initial != null);
+
+ //
+ // Verify that the class loader is used for concrete classes.
+ //
+ {
+ out.print("testing concrete class... ");
+ out.flush();
+ ConcreteClass cc = initial.getConcreteClass();
+ test(cc != null);
+ test(classLoader.check("Test.ConcreteClass"));
+ test(classLoader.check("test.Ice.classLoader.Test.ConcreteClass"));
+ classLoader.reset();
+ out.println("ok");
+ }
+
+ //
+ // Verify that the class loader is invoked when a factory is not installed, and is
+ // not invoked when a factory is installed.
+ //
+ {
+ out.print("testing abstract class... ");
+ out.flush();
+
+ try
+ {
+ initial.getAbstractClass();
+ }
+ catch(Ice.NoValueFactoryException ex)
+ {
+ // Expected.
+ }
+ test(classLoader.check("Test.AbstractClass"));
+ test(classLoader.check("test.Ice.classLoader.Test.AbstractClass"));
+ classLoader.reset();
+
+ ic.getValueFactoryManager().add(new MyValueFactory(), "::Test::AbstractClass");
+ AbstractClass ac = initial.getAbstractClass();
+ test(ac != null);
+ test(!classLoader.check("Test.AbstractClass"));
+ test(!classLoader.check("test.Ice.classLoader.Test.AbstractClass"));
+ classLoader.reset();
+
+ out.println("ok");
+ }
+
+ //
+ // Verify that the class loader is used for user exceptions.
+ //
+ out.print("testing user exception... ");
+ out.flush();
+ try
+ {
+ initial.throwException();
+ test(false);
+ }
+ catch(E ex)
+ {
+ }
+ test(classLoader.check("Test.E"));
+ test(classLoader.check("test.Ice.classLoader.Test.E"));
+ out.println("ok");
+
+ initial.shutdown();
+ ic.destroy();
+ }
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/classLoader/CertificateVerifierI.java b/java-compat/test/src/main/java/test/Ice/classLoader/CertificateVerifierI.java
new file mode 100644
index 00000000000..4555951c3b5
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/classLoader/CertificateVerifierI.java
@@ -0,0 +1,19 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.classLoader;
+
+public class CertificateVerifierI implements IceSSL.CertificateVerifier
+{
+ @Override
+ public boolean verify(IceSSL.NativeConnectionInfo info)
+ {
+ return true;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/classLoader/Client.java b/java-compat/test/src/main/java/test/Ice/classLoader/Client.java
new file mode 100644
index 00000000000..6bf2e795ca7
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/classLoader/Client.java
@@ -0,0 +1,39 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.classLoader;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ AllTests.allTests(this, false);
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ _initData = createInitializationData();
+ _initData.properties = Ice.Util.createProperties(argsH);
+ _initData.properties.setProperty("Ice.Package.Test", "test.Ice.classLoader");
+ return _initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+
+ private Ice.InitializationData _initData;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/classLoader/InitialI.java b/java-compat/test/src/main/java/test/Ice/classLoader/InitialI.java
new file mode 100644
index 00000000000..b360c3d84b1
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/classLoader/InitialI.java
@@ -0,0 +1,55 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.classLoader;
+
+import test.Ice.classLoader.Test.AbstractClass;
+import test.Ice.classLoader.Test.ConcreteClass;
+import test.Ice.classLoader.Test.E;
+import test.Ice.classLoader.Test._InitialDisp;
+
+public final class InitialI extends _InitialDisp
+{
+ public
+ InitialI(Ice.ObjectAdapter adapter)
+ {
+ _adapter = adapter;
+ }
+
+ @Override
+ public ConcreteClass
+ getConcreteClass(Ice.Current current)
+ {
+ return new ConcreteClass();
+ }
+
+ @Override
+ public AbstractClass
+ getAbstractClass(Ice.Current current)
+ {
+ return new AbstractClassI();
+ }
+
+ @Override
+ public void
+ throwException(Ice.Current current)
+ throws E
+ {
+ throw new E();
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ _adapter.getCommunicator().shutdown();
+ }
+
+ private Ice.ObjectAdapter _adapter;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/classLoader/PasswordCallbackI.java b/java-compat/test/src/main/java/test/Ice/classLoader/PasswordCallbackI.java
new file mode 100644
index 00000000000..48c7e6009b7
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/classLoader/PasswordCallbackI.java
@@ -0,0 +1,31 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.classLoader;
+
+public class PasswordCallbackI implements IceSSL.PasswordCallback
+{
+ @Override
+ public char[] getPassword(String alias)
+ {
+ return "password".toCharArray();
+ }
+
+ @Override
+ public char[] getTruststorePassword()
+ {
+ return "password".toCharArray();
+ }
+
+ @Override
+ public char[] getKeystorePassword()
+ {
+ return "password".toCharArray();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/classLoader/PluginFactoryI.java b/java-compat/test/src/main/java/test/Ice/classLoader/PluginFactoryI.java
new file mode 100644
index 00000000000..a6ff043bc85
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/classLoader/PluginFactoryI.java
@@ -0,0 +1,32 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.classLoader;
+
+public class PluginFactoryI implements Ice.PluginFactory
+{
+ static class PluginI implements Ice.Plugin
+ {
+ @Override
+ public void initialize()
+ {
+ }
+
+ @Override
+ public void destroy()
+ {
+ }
+ }
+
+ @Override
+ public Ice.Plugin create(Ice.Communicator communicator, String name, String[] args)
+ {
+ return new PluginI();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/classLoader/Server.java b/java-compat/test/src/main/java/test/Ice/classLoader/Server.java
new file mode 100644
index 00000000000..aef65c14aa3
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/classLoader/Server.java
@@ -0,0 +1,44 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.classLoader;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.Object object = new InitialI(adapter);
+ adapter.add(object, Ice.Util.stringToIdentity("initial"));
+ adapter.activate();
+
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.classLoader");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ initData.properties.setProperty("Ice.Default.SlicedFormat", "1");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/classLoader/Test.ice b/java-compat/test/src/main/java/test/Ice/classLoader/Test.ice
new file mode 100644
index 00000000000..551c600020f
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/classLoader/Test.ice
@@ -0,0 +1,36 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.classLoader"]]
+module Test
+{
+
+class ConcreteClass
+{
+ int i;
+};
+
+class AbstractClass
+{
+ void op();
+};
+
+exception E {};
+
+interface Initial
+{
+ ConcreteClass getConcreteClass();
+ AbstractClass getAbstractClass();
+ void throwException() throws E;
+ void shutdown();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/classLoader/run.py b/java-compat/test/src/main/java/test/Ice/classLoader/run.py
new file mode 100755
index 00000000000..97f9acd4094
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/classLoader/run.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/custom/AllTests.java b/java-compat/test/src/main/java/test/Ice/custom/AllTests.java
new file mode 100644
index 00000000000..a025deb4992
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/custom/AllTests.java
@@ -0,0 +1,354 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.custom;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.nio.ByteBuffer;
+import java.nio.ShortBuffer;
+import java.nio.IntBuffer;
+import java.nio.LongBuffer;
+import java.nio.FloatBuffer;
+import java.nio.DoubleBuffer;
+
+import test.Ice.custom.Test.BoolSeqHolder;
+import test.Ice.custom.Test.ByteSeqHolder;
+import test.Ice.custom.Test.C;
+import test.Ice.custom.Test.CArrayHolder;
+import test.Ice.custom.Test.CListHolder;
+import test.Ice.custom.Test.CSeqHolder;
+import test.Ice.custom.Test.DSeqHolder;
+import test.Ice.custom.Test.DoubleSeqHolder;
+import test.Ice.custom.Test.E;
+import test.Ice.custom.Test.ESeqHolder;
+import test.Ice.custom.Test.FloatSeqHolder;
+import test.Ice.custom.Test.IntSeqHolder;
+import test.Ice.custom.Test.LongSeqHolder;
+import test.Ice.custom.Test.S;
+import test.Ice.custom.Test.SSeqHolder;
+import test.Ice.custom.Test.ShortSeqHolder;
+import test.Ice.custom.Test.StringSeqHolder;
+import test.Ice.custom.Test.StringSeqSeqHolder;
+import test.Ice.custom.Test.TestIntfPrx;
+import test.Ice.custom.Test.TestIntfPrxHelper;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static TestIntfPrx
+ allTests(Ice.Communicator communicator, PrintWriter out)
+ {
+ out.print("testing stringToProxy... ");
+ out.flush();
+ String ref = "test:default -p 12010";
+ Ice.ObjectPrx obj = communicator.stringToProxy(ref);
+ test(obj != null);
+ out.println("ok");
+
+ out.print("testing checked cast... ");
+ out.flush();
+ TestIntfPrx t = TestIntfPrxHelper.checkedCast(obj);
+ test(t != null);
+ test(t.equals(obj));
+ out.println("ok");
+
+ out.print("testing custom sequences... ");
+ out.flush();
+
+ {
+ //
+ // Create a sequence of C instances, where elements 1..n simply point to element 0.
+ //
+ C[] seq = new C[5];
+ seq[0] = new C();
+ for(int i = 1; i < seq.length; i++)
+ {
+ seq[i] = seq[0];
+ }
+
+ //
+ // Invoke each operation and verify that the returned sequences have the same
+ // structure as the original.
+ //
+ CSeqHolder seqH = new CSeqHolder();
+ C[] seqR = t.opCSeq(seq, seqH);
+ test(seqR.length == seq.length);
+ test(seqH.value.length == seq.length);
+ for(int i = 1; i < seq.length; i++)
+ {
+ test(seqR[i] != null);
+ test(seqR[i] == seqR[0]);
+ test(seqR[i] == seqH.value[i]);
+ }
+
+ ArrayList<C> arr = new ArrayList<C>(Arrays.asList(seq));
+ CArrayHolder arrH = new CArrayHolder();
+ List<C> arrR = t.opCArray(arr, arrH);
+ test(arrR.size() == arr.size());
+ test(arrH.value.size() == arr.size());
+ for(int i = 1; i < arr.size(); i++)
+ {
+ test(arrR.get(i) != null);
+ test(arrR.get(i) == arrR.get(0));
+ test(arrR.get(i) == arrH.value.get(i));
+ }
+
+ LinkedList<C> list = new LinkedList<C>(Arrays.asList(seq));
+ CListHolder listH = new CListHolder();
+ List<C> listR = t.opCList(list, listH);
+ test(listR.size() == list.size());
+ test(listH.value.size() == list.size());
+ for(int i = 1; i < list.size(); i++)
+ {
+ test(listR.get(i) != null);
+ test(listR.get(i) == listR.get(0));
+ test(listR.get(i) == listH.value.get(i));
+ }
+ }
+
+ {
+ final Boolean[] seq = { Boolean.TRUE, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, Boolean.TRUE };
+ ArrayList<Boolean> list = new ArrayList<Boolean>(Arrays.asList(seq));
+ BoolSeqHolder listH = new BoolSeqHolder();
+ List<Boolean> listR = t.opBoolSeq(list, listH);
+ test(listH.value.equals(listR));
+ test(listH.value.equals(list));
+ }
+
+ {
+ final Byte[] seq = { new Byte((byte)0), new Byte((byte)1), new Byte((byte)2), new Byte((byte)3) };
+ ArrayList<Byte> list = new ArrayList<Byte>(Arrays.asList(seq));
+ ByteSeqHolder listH = new ByteSeqHolder();
+ List<Byte> listR = t.opByteSeq(list, listH);
+ test(listH.value.equals(listR));
+ test(listH.value.equals(list));
+ }
+
+ {
+ final Short[] seq = { new Short((short)0), new Short((short)1), new Short((short)2), new Short((short)3) };
+ ArrayList<Short> list = new ArrayList<Short>(Arrays.asList(seq));
+ ShortSeqHolder listH = new ShortSeqHolder();
+ List<Short> listR = t.opShortSeq(list, listH);
+ test(listH.value.equals(listR));
+ test(listH.value.equals(list));
+ }
+
+ {
+ final Integer[] seq = { new Integer(0), new Integer(1), new Integer(2), new Integer(3) };
+ ArrayList<Integer> list = new ArrayList<Integer>(Arrays.asList(seq));
+ IntSeqHolder listH = new IntSeqHolder();
+ List<Integer> listR = t.opIntSeq(list, listH);
+ test(listH.value.equals(listR));
+ test(listH.value.equals(list));
+ }
+
+ {
+ final Long[] seq = { new Long(0), new Long(1), new Long(2), new Long(3) };
+ ArrayList<Long> list = new ArrayList<Long>(Arrays.asList(seq));
+ LongSeqHolder listH = new LongSeqHolder();
+ List<Long> listR = t.opLongSeq(list, listH);
+ test(listH.value.equals(listR));
+ test(listH.value.equals(list));
+ }
+
+ {
+ final Float[] seq = { new Float(0), new Float(1), new Float(2), new Float(3) };
+ ArrayList<Float> list = new ArrayList<Float>(Arrays.asList(seq));
+ FloatSeqHolder listH = new FloatSeqHolder();
+ List<Float> listR = t.opFloatSeq(list, listH);
+ test(listH.value.equals(listR));
+ test(listH.value.equals(list));
+ }
+
+ {
+ final Double[] seq = { new Double(0), new Double(1), new Double(2), new Double(3) };
+ ArrayList<Double> list = new ArrayList<Double>(Arrays.asList(seq));
+ DoubleSeqHolder listH = new DoubleSeqHolder();
+ List<Double> listR = t.opDoubleSeq(list, listH);
+ test(listH.value.equals(listR));
+ test(listH.value.equals(list));
+ }
+
+ {
+ final String[] seq = { "0", "1", "2", "3", "4" };
+ ArrayList<String> list = new ArrayList<String>(Arrays.asList(seq));
+ StringSeqHolder listH = new StringSeqHolder();
+ List<String> listR = t.opStringSeq(list, listH);
+ test(listH.value.equals(listR));
+ test(listH.value.equals(list));
+ }
+
+ {
+ final E[] seq = { E.E1, E.E2, E.E3 };
+ ArrayList<E> list = new ArrayList<E>(Arrays.asList(seq));
+ ESeqHolder listH = new ESeqHolder();
+ List<E> listR = t.opESeq(list, listH);
+ test(listH.value.equals(listR));
+ test(listH.value.equals(list));
+ }
+
+ {
+ S[] seq = new S[5];
+ for(int i = 0; i < seq.length; i++)
+ {
+ seq[i] = new S();
+ seq[i].en = E.values()[i % 3];
+ }
+ ArrayList<S> list = new ArrayList<S>(Arrays.asList(seq));
+ SSeqHolder listH = new SSeqHolder();
+ List<S> listR = t.opSSeq(list, listH);
+ test(listH.value.equals(listR));
+ test(listH.value.equals(list));
+ }
+
+ {
+ ArrayList<Map<Integer, String>> list = new ArrayList<Map<Integer, String>>();
+ for(int i = 0; i < 5; i++)
+ {
+ Map<Integer, String> m = new HashMap<Integer, String>();
+ for(int j = 0; j < 4; j++)
+ {
+ m.put(j, "" + j);
+ }
+ list.add(m);
+ }
+ DSeqHolder listH = new DSeqHolder();
+ List<Map<Integer, String>> listR = t.opDSeq(list, listH);
+ test(listH.value.equals(listR));
+ test(listH.value.equals(list));
+ }
+
+ {
+ List<List<String>> seq = new LinkedList<List<String>>();
+ for(int i = 0; i < 5; i++)
+ {
+ final String[] arr = { "0", "1", "2", "3", "4" };
+ seq.add(new ArrayList<String>(Arrays.asList(arr)));
+ }
+ StringSeqSeqHolder listH = new StringSeqSeqHolder();
+ List<List<String>> listR = t.opStringSeqSeq(seq, listH);
+ test(listH.value.equals(listR));
+ test(listH.value.equals(seq));
+ }
+
+ {
+ final byte[] fullSeq = new byte[] {0, 1, 2, 3, 4, 5, 6, 7};
+ final byte[] usedSeq = new byte[] {2, 3, 4, 5};
+
+ ByteBuffer buffer = ByteBuffer.wrap(fullSeq, 2, 4);
+ Ice.Holder<ByteBuffer> bufferH = new Ice.Holder<ByteBuffer>();
+ ByteBuffer bufferR = t.opByteBufferSeq(buffer, bufferH);
+
+ byte[] arr = new byte[bufferH.value.limit()];
+ bufferH.value.get(arr, 0, bufferH.value.limit());
+ test(Arrays.equals(arr, usedSeq));
+ arr = new byte[bufferR.limit()];
+ bufferR.get(arr, 0, bufferR.limit());
+ test(Arrays.equals(arr, usedSeq));
+ }
+
+ {
+ final short[] fullSeq = new short[] {0, 1, 2, 3, 4, 5, 6, 7};
+ final short[] usedSeq = new short[] {2, 3, 4, 5};
+
+ ShortBuffer buffer = ShortBuffer.wrap(fullSeq, 2, 4);
+ Ice.Holder<ShortBuffer> bufferH = new Ice.Holder<ShortBuffer>();
+ ShortBuffer bufferR = t.opShortBufferSeq(buffer, bufferH);
+
+ short[] arr = new short[bufferH.value.limit()];
+ bufferH.value.get(arr, 0, bufferH.value.limit());
+ test(Arrays.equals(arr, usedSeq));
+ arr = new short[bufferR.limit()];
+ bufferR.get(arr, 0, bufferR.limit());
+ test(Arrays.equals(arr, usedSeq));
+ }
+
+ {
+ final int[] fullSeq = new int[] {0, 1, 2, 3, 4, 5, 6, 7};
+ final int[] usedSeq = new int[] {2, 3, 4, 5};
+
+ IntBuffer buffer = IntBuffer.wrap(fullSeq, 2, 4);
+ Ice.Holder<IntBuffer> bufferH = new Ice.Holder<IntBuffer>();
+ IntBuffer bufferR = t.opIntBufferSeq(buffer, bufferH);
+
+ int[] arr = new int[bufferH.value.limit()];
+ bufferH.value.get(arr, 0, bufferH.value.limit());
+ test(Arrays.equals(arr, usedSeq));
+ arr = new int[bufferR.limit()];
+ bufferR.get(arr, 0, bufferR.limit());
+ test(Arrays.equals(arr, usedSeq));
+ }
+
+ {
+ final long[] fullSeq = new long[] {0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L};
+ final long[] usedSeq = new long[] {2L, 3L, 4L, 5L};
+
+ LongBuffer buffer = LongBuffer.wrap(fullSeq, 2, 4);
+ Ice.Holder<LongBuffer> bufferH = new Ice.Holder<LongBuffer>();
+ LongBuffer bufferR = t.opLongBufferSeq(buffer, bufferH);
+
+ long[] arr = new long[bufferH.value.limit()];
+ bufferH.value.get(arr, 0, bufferH.value.limit());
+ test(Arrays.equals(arr, usedSeq));
+ arr = new long[bufferR.limit()];
+ bufferR.get(arr, 0, bufferR.limit());
+ test(Arrays.equals(arr, usedSeq));
+ }
+
+ {
+ final float[] fullSeq = new float[] {0, 1, 2, 3, 4, 5, 6, 7};
+ final float[] usedSeq = new float[] {2, 3, 4, 5};
+
+ FloatBuffer buffer = FloatBuffer.wrap(fullSeq, 2, 4);
+ Ice.Holder<FloatBuffer> bufferH = new Ice.Holder<FloatBuffer>();
+ FloatBuffer bufferR = t.opFloatBufferSeq(buffer, bufferH);
+
+ float[] arr = new float[bufferH.value.limit()];
+ bufferH.value.get(arr, 0, bufferH.value.limit());
+ test(Arrays.equals(arr, usedSeq));
+ arr = new float[bufferR.limit()];
+ bufferR.get(arr, 0, bufferR.limit());
+ test(Arrays.equals(arr, usedSeq));
+ }
+
+ {
+ final double[] fullSeq = new double[] {0, 1, 2, 3, 4, 5, 6, 7};
+ final double[] usedSeq = new double[] {2, 3, 4, 5};
+
+ DoubleBuffer buffer = DoubleBuffer.wrap(fullSeq, 2, 4);
+ Ice.Holder<DoubleBuffer> bufferH = new Ice.Holder<DoubleBuffer>();
+ DoubleBuffer bufferR = t.opDoubleBufferSeq(buffer, bufferH);
+
+ double[] arr = new double[bufferH.value.limit()];
+ bufferH.value.get(arr, 0, bufferH.value.limit());
+ test(Arrays.equals(arr, usedSeq));
+ arr = new double[bufferR.limit()];
+ bufferR.get(arr, 0, bufferR.limit());
+ test(Arrays.equals(arr, usedSeq));
+ }
+
+ out.println("ok");
+
+ return t;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/custom/Client.java b/java-compat/test/src/main/java/test/Ice/custom/Client.java
new file mode 100644
index 00000000000..90ec943086b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/custom/Client.java
@@ -0,0 +1,43 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.custom;
+
+import test.Ice.custom.Test.TestIntfPrx;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ TestIntfPrx test = AllTests.allTests(communicator, getWriter());
+ test.shutdown();
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom");
+ initData.properties.setProperty("Ice.CacheMessageBuffers", "0");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/custom/Collocated.java b/java-compat/test/src/main/java/test/Ice/custom/Collocated.java
new file mode 100644
index 00000000000..2c1e7b251f1
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/custom/Collocated.java
@@ -0,0 +1,46 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.custom;
+
+public class Collocated extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.Object test = new TestI(communicator);
+ adapter.add(test, Ice.Util.stringToIdentity("test"));
+
+ AllTests.allTests(communicator, getWriter());
+
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ initData.properties.setProperty("Ice.CacheMessageBuffers", "0");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Collocated c = new Collocated();
+ int status = c.main("Collocated", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/custom/Server.java b/java-compat/test/src/main/java/test/Ice/custom/Server.java
new file mode 100644
index 00000000000..8a4da565414
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/custom/Server.java
@@ -0,0 +1,46 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.custom;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.Object test = new TestI(communicator);
+ adapter.add(test, Ice.Util.stringToIdentity("test"));
+
+ adapter.activate();
+
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ initData.properties.setProperty("Ice.CacheMessageBuffers", "0");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server c = new Server();
+ int status = c.main("Server", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/custom/Test.ice b/java-compat/test/src/main/java/test/Ice/custom/Test.ice
new file mode 100644
index 00000000000..42d7faae656
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/custom/Test.ice
@@ -0,0 +1,84 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+#include <Ice/BuiltinSequences.ice>
+
+[["java:package:test.Ice.custom"]]
+module Test
+{
+
+class C {};
+
+sequence<C> CSeq;
+["java:type:java.util.ArrayList<C>"] sequence<C> CArray;
+["java:type:java.util.LinkedList<C>"] sequence<C> CList;
+
+["java:type:java.util.ArrayList<Boolean>"] sequence<bool> BoolSeq;
+["java:type:java.util.ArrayList<Byte>"] sequence<byte> ByteSeq;
+["java:type:java.util.ArrayList<Short>"] sequence<short> ShortSeq;
+["java:type:java.util.ArrayList<Integer>"] sequence<int> IntSeq;
+["java:type:java.util.ArrayList<Long>"] sequence<long> LongSeq;
+["java:type:java.util.ArrayList<Float>"] sequence<float> FloatSeq;
+["java:type:java.util.ArrayList<Double>"] sequence<double> DoubleSeq;
+["java:type:java.util.ArrayList<String>"] sequence<string> StringSeq;
+
+["java:buffer"] sequence<byte> ByteBuffer;
+["java:buffer"] sequence<short> ShortBuffer;
+["java:buffer"] sequence<int> IntBuffer;
+["java:buffer"] sequence<long> LongBuffer;
+["java:buffer"] sequence<float> FloatBuffer;
+["java:buffer"] sequence<double> DoubleBuffer;
+
+enum E { E1, E2, E3 };
+["java:type:java.util.ArrayList<E>"] sequence<E> ESeq;
+
+struct S
+{
+ E en;
+};
+["java:type:java.util.ArrayList<S>"] sequence<S> SSeq;
+
+dictionary<int, string> D;
+["java:type:java.util.ArrayList<java.util.Map<Integer,String>>"] sequence<D> DSeq;
+
+["java:type:java.util.LinkedList<java.util.List<String>>"] sequence<StringSeq> StringSeqSeq;
+
+class TestIntf
+{
+ CSeq opCSeq(CSeq inSeq, out CSeq outSeq);
+ CArray opCArray(CArray inSeq, out CArray outSeq);
+ CList opCList(CList inSeq, out CList outSeq);
+ BoolSeq opBoolSeq(BoolSeq inSeq, out BoolSeq outSeq);
+ ByteSeq opByteSeq(ByteSeq inSeq, out ByteSeq outSeq);
+ ShortSeq opShortSeq(ShortSeq inSeq, out ShortSeq outSeq);
+ IntSeq opIntSeq(IntSeq inSeq, out IntSeq outSeq);
+ LongSeq opLongSeq(LongSeq inSeq, out LongSeq outSeq);
+ FloatSeq opFloatSeq(FloatSeq inSeq, out FloatSeq outSeq);
+ DoubleSeq opDoubleSeq(DoubleSeq inSeq, out DoubleSeq outSeq);
+ StringSeq opStringSeq(StringSeq inSeq, out StringSeq outSeq);
+ ESeq opESeq(ESeq inSeq, out ESeq outSeq);
+ SSeq opSSeq(SSeq inSeq, out SSeq outSeq);
+ DSeq opDSeq(DSeq inSeq, out DSeq outSeq);
+ StringSeqSeq opStringSeqSeq(StringSeqSeq inSeq, out StringSeqSeq outSeq);
+
+ ByteBuffer opByteBufferSeq(ByteBuffer inSeq, out ByteBuffer outSeq);
+ ShortBuffer opShortBufferSeq(ShortBuffer inSeq, out ShortBuffer outSeq);
+ IntBuffer opIntBufferSeq(IntBuffer inSeq, out IntBuffer outSeq);
+ LongBuffer opLongBufferSeq(LongBuffer inSeq, out LongBuffer outSeq);
+ FloatBuffer opFloatBufferSeq(FloatBuffer inSeq, out FloatBuffer outSeq);
+ DoubleBuffer opDoubleBufferSeq(DoubleBuffer inSeq, out DoubleBuffer outSeq);
+
+ void shutdown();
+
+ ["java:type:java.util.ArrayList<C>"] CSeq seq;
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/custom/TestI.java b/java-compat/test/src/main/java/test/Ice/custom/TestI.java
new file mode 100644
index 00000000000..6ce5451516f
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/custom/TestI.java
@@ -0,0 +1,241 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.custom;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.nio.ByteBuffer;
+import java.nio.ShortBuffer;
+import java.nio.IntBuffer;
+import java.nio.LongBuffer;
+import java.nio.FloatBuffer;
+import java.nio.DoubleBuffer;
+
+import test.Ice.custom.Test.BoolSeqHolder;
+import test.Ice.custom.Test.ByteSeqHolder;
+import test.Ice.custom.Test.C;
+import test.Ice.custom.Test.CArrayHolder;
+import test.Ice.custom.Test.CListHolder;
+import test.Ice.custom.Test.CSeqHolder;
+import test.Ice.custom.Test.DSeqHolder;
+import test.Ice.custom.Test.DoubleSeqHolder;
+import test.Ice.custom.Test.E;
+import test.Ice.custom.Test.ESeqHolder;
+import test.Ice.custom.Test.FloatSeqHolder;
+import test.Ice.custom.Test.IntSeqHolder;
+import test.Ice.custom.Test.LongSeqHolder;
+import test.Ice.custom.Test.S;
+import test.Ice.custom.Test.SSeqHolder;
+import test.Ice.custom.Test.ShortSeqHolder;
+import test.Ice.custom.Test.StringSeqHolder;
+import test.Ice.custom.Test.StringSeqSeqHolder;
+import test.Ice.custom.Test.TestIntf;
+
+public final class TestI extends TestIntf
+{
+ public
+ TestI(Ice.Communicator communicator)
+ {
+ _communicator = communicator;
+ }
+
+ @Override
+ public List<C>
+ opCArray(List<C> inSeq, CArrayHolder outSeq, Ice.Current current)
+ {
+ outSeq.value = inSeq;
+ return inSeq;
+ }
+
+ @Override
+ public List<C>
+ opCList(List<C> inSeq, CListHolder outSeq, Ice.Current current)
+ {
+ outSeq.value = inSeq;
+ return inSeq;
+ }
+
+ @Override
+ public C[]
+ opCSeq(C[] inSeq, CSeqHolder outSeq, Ice.Current current)
+ {
+ seq = new ArrayList<C>(Arrays.asList(inSeq));
+ outSeq.value = new C[seq.size()];
+ seq.toArray(outSeq.value);
+ return outSeq.value;
+ }
+
+ @Override
+ public List<Boolean>
+ opBoolSeq(List<Boolean> inSeq, BoolSeqHolder outSeq, Ice.Current current)
+ {
+ outSeq.value = inSeq;
+ return inSeq;
+ }
+
+ @Override
+ public List<Byte>
+ opByteSeq(List<Byte> inSeq, ByteSeqHolder outSeq, Ice.Current current)
+ {
+ outSeq.value = inSeq;
+ return inSeq;
+ }
+
+ @Override
+ public List<Map<Integer,String>>
+ opDSeq(List<Map<Integer,String>> inSeq, DSeqHolder outSeq, Ice.Current current)
+ {
+ outSeq.value = inSeq;
+ return inSeq;
+ }
+
+ @Override
+ public List<Double>
+ opDoubleSeq(List<Double> inSeq, DoubleSeqHolder outSeq, Ice.Current current)
+ {
+ outSeq.value = inSeq;
+ return inSeq;
+ }
+
+ @Override
+ public List<E>
+ opESeq(List<E> inSeq, ESeqHolder outSeq, Ice.Current current)
+ {
+ outSeq.value = inSeq;
+ return inSeq;
+ }
+
+ @Override
+ public List<Float>
+ opFloatSeq(List<Float> inSeq, FloatSeqHolder outSeq, Ice.Current current)
+ {
+ outSeq.value = inSeq;
+ return inSeq;
+ }
+
+ @Override
+ public List<Integer>
+ opIntSeq(List<Integer> inSeq, IntSeqHolder outSeq, Ice.Current current)
+ {
+ outSeq.value = inSeq;
+ return inSeq;
+ }
+
+ @Override
+ public List<Long>
+ opLongSeq(List<Long> inSeq, LongSeqHolder outSeq, Ice.Current current)
+ {
+ outSeq.value = inSeq;
+ return inSeq;
+ }
+
+ @Override
+ public List<S>
+ opSSeq(List<S> inSeq, SSeqHolder outSeq, Ice.Current current)
+ {
+ outSeq.value = inSeq;
+ return inSeq;
+ }
+
+ @Override
+ public List<Short>
+ opShortSeq(List<Short> inSeq, ShortSeqHolder outSeq, Ice.Current current)
+ {
+ outSeq.value = inSeq;
+ return inSeq;
+ }
+
+ @Override
+ public List<String>
+ opStringSeq(List<String> inSeq, StringSeqHolder outSeq, Ice.Current current)
+ {
+ outSeq.value = inSeq;
+ return inSeq;
+ }
+
+ @Override
+ public List<List<String>>
+ opStringSeqSeq(List<List<String>> inSeq, StringSeqSeqHolder outSeq, Ice.Current current)
+ {
+ outSeq.value = inSeq;
+ return inSeq;
+ }
+
+ @Override
+ public ByteBuffer
+ opByteBufferSeq(ByteBuffer inSeq, Ice.Holder<ByteBuffer> outSeq, Ice.Current current)
+ {
+ byte[] arr = new byte[inSeq.limit()];
+ inSeq.get(arr);
+ outSeq.value = ByteBuffer.wrap(arr);
+ return ByteBuffer.wrap(arr);
+ }
+
+ @Override
+ public ShortBuffer
+ opShortBufferSeq(ShortBuffer inSeq, Ice.Holder<ShortBuffer> outSeq, Ice.Current current)
+ {
+ short[] arr = new short[inSeq.limit()];
+ inSeq.get(arr);
+ outSeq.value = ShortBuffer.wrap(arr);
+ return ShortBuffer.wrap(arr);
+ }
+
+ @Override
+ public IntBuffer
+ opIntBufferSeq(IntBuffer inSeq, Ice.Holder<IntBuffer> outSeq, Ice.Current current)
+ {
+ int[] arr = new int[inSeq.limit()];
+ inSeq.get(arr);
+ outSeq.value = IntBuffer.wrap(arr);
+ return IntBuffer.wrap(arr);
+ }
+
+ @Override
+ public LongBuffer
+ opLongBufferSeq(LongBuffer inSeq, Ice.Holder<LongBuffer> outSeq, Ice.Current current)
+ {
+ long[] arr = new long[inSeq.limit()];
+ inSeq.get(arr);
+ outSeq.value = LongBuffer.wrap(arr);
+ return LongBuffer.wrap(arr);
+ }
+
+ @Override
+ public FloatBuffer
+ opFloatBufferSeq(FloatBuffer inSeq, Ice.Holder<FloatBuffer> outSeq, Ice.Current current)
+ {
+ float[] arr = new float[inSeq.limit()];
+ inSeq.get(arr);
+ outSeq.value = FloatBuffer.wrap(arr);
+ return FloatBuffer.wrap(arr);
+ }
+
+ @Override
+ public DoubleBuffer
+ opDoubleBufferSeq(DoubleBuffer inSeq, Ice.Holder<DoubleBuffer> outSeq, Ice.Current current)
+ {
+ double[] arr = new double[inSeq.limit()];
+ inSeq.get(arr);
+ outSeq.value = DoubleBuffer.wrap(arr);
+ return DoubleBuffer.wrap(arr);
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ _communicator.shutdown();
+ }
+
+ private Ice.Communicator _communicator;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/custom/run.py b/java-compat/test/src/main/java/test/Ice/custom/run.py
new file mode 100755
index 00000000000..97eec95871b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/custom/run.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.queueCollocatedTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/defaultServant/AllTests.java b/java-compat/test/src/main/java/test/Ice/defaultServant/AllTests.java
new file mode 100644
index 00000000000..d841881da63
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/defaultServant/AllTests.java
@@ -0,0 +1,171 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.defaultServant;
+import java.io.PrintWriter;
+import test.Ice.defaultServant.Test.MyObjectPrx;
+import test.Ice.defaultServant.Test.MyObjectPrxHelper;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static void
+ allTests(test.Util.Application app, PrintWriter out)
+ {
+ Ice.Communicator communicator = app.communicator();
+ Ice.ObjectAdapter oa = communicator.createObjectAdapterWithEndpoints("MyOA", "tcp -h localhost");
+ oa.activate();
+
+ Ice.Object servant = new MyObjectI();
+
+ //
+ // Register default servant with category "foo"
+ //
+ oa.addDefaultServant(servant, "foo");
+
+ //
+ // Start test
+ //
+ out.print("testing single category... ");
+ out.flush();
+
+ Ice.Object r = oa.findDefaultServant("foo");
+ test(r == servant);
+
+ r = oa.findDefaultServant("bar");
+ test(r == null);
+
+ Ice.Identity identity = new Ice.Identity();
+ identity.category = "foo";
+
+ String names[] = { "foo", "bar", "x", "y", "abcdefg" };
+
+ for(int idx = 0; idx < 5; ++idx)
+ {
+ identity.name = names[idx];
+ MyObjectPrx prx = MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity));
+ prx.ice_ping();
+ test(prx.getName().equals(names[idx]));
+ }
+
+ identity.name = "ObjectNotExist";
+ MyObjectPrx prx = MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity));
+ try
+ {
+ prx.ice_ping();
+ test(false);
+ }
+ catch(Ice.ObjectNotExistException ex)
+ {
+ // Expected
+ }
+
+ try
+ {
+ prx.getName();
+ test(false);
+ }
+ catch(Ice.ObjectNotExistException ex)
+ {
+ // Expected
+ }
+
+ identity.name = "FacetNotExist";
+ prx = MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity));
+ try
+ {
+ prx.ice_ping();
+ test(false);
+ }
+ catch(Ice.FacetNotExistException ex)
+ {
+ // Expected
+ }
+
+ try
+ {
+ prx.getName();
+ test(false);
+ }
+ catch(Ice.FacetNotExistException ex)
+ {
+ // Expected
+ }
+
+ identity.category = "bar";
+ for(int idx = 0; idx < 5; idx++)
+ {
+ identity.name = names[idx];
+ prx = MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity));
+
+ try
+ {
+ prx.ice_ping();
+ test(false);
+ }
+ catch(Ice.ObjectNotExistException ex)
+ {
+ // Expected
+ }
+
+ try
+ {
+ prx.getName();
+ test(false);
+ }
+ catch(Ice.ObjectNotExistException ex)
+ {
+ // Expected
+ }
+ }
+
+ oa.removeDefaultServant("foo");
+ identity.category = "foo";
+ prx = MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity));
+ try
+ {
+ prx.ice_ping();
+ }
+ catch(Ice.ObjectNotExistException ex)
+ {
+ // Expected
+ }
+
+ out.println("ok");
+
+ out.print("testing default category... ");
+ out.flush();
+
+ oa.addDefaultServant(servant, "");
+
+ r = oa.findDefaultServant("bar");
+ test(r == null);
+
+ r = oa.findDefaultServant("");
+ test(r == servant);
+
+ for(int idx = 0; idx < 5; ++idx)
+ {
+ identity.name = names[idx];
+ prx = MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity));
+ prx.ice_ping();
+ test(prx.getName().equals(names[idx]));
+ }
+
+ out.println("ok");
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/defaultServant/Client.java b/java-compat/test/src/main/java/test/Ice/defaultServant/Client.java
new file mode 100644
index 00000000000..f5956bead6b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/defaultServant/Client.java
@@ -0,0 +1,30 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.defaultServant;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ AllTests.allTests(this, getWriter());
+
+ return 0;
+ }
+
+ public static void main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/defaultServant/MyObjectI.java b/java-compat/test/src/main/java/test/Ice/defaultServant/MyObjectI.java
new file mode 100644
index 00000000000..055576ef5cd
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/defaultServant/MyObjectI.java
@@ -0,0 +1,48 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.defaultServant;
+import test.Ice.defaultServant.Test.*;
+
+public final class MyObjectI extends _MyObjectDisp
+{
+ @Override
+ public void
+ ice_ping(Ice.Current current)
+ {
+ String name = current.id.name;
+
+ if(name.equals("ObjectNotExist"))
+ {
+ throw new Ice.ObjectNotExistException();
+ }
+ else if(name.equals("FacetNotExist"))
+ {
+ throw new Ice.FacetNotExistException();
+ }
+ }
+
+ @Override
+ public String
+ getName(Ice.Current current)
+ {
+ String name = current.id.name;
+
+ if(name.equals("ObjectNotExist"))
+ {
+ throw new Ice.ObjectNotExistException();
+ }
+ else if(name.equals("FacetNotExist"))
+ {
+ throw new Ice.FacetNotExistException();
+ }
+
+ return name;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/defaultServant/Test.ice b/java-compat/test/src/main/java/test/Ice/defaultServant/Test.ice
new file mode 100644
index 00000000000..ff0a445d506
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/defaultServant/Test.ice
@@ -0,0 +1,21 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.defaultServant"]]
+module Test
+{
+
+interface MyObject
+{
+ string getName();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/defaultServant/run.py b/java-compat/test/src/main/java/test/Ice/defaultServant/run.py
new file mode 100755
index 00000000000..86b25876539
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/defaultServant/run.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+sys.stdout.write("starting client... ")
+sys.stdout.flush()
+clientProc = TestUtil.startClient("test.Ice.defaultServant.Client", "--Ice.Warn.Dispatch=0",startReader=False)
+print("ok")
+clientProc.startReader()
+
+clientProc.waitTestSuccess()
diff --git a/java-compat/test/src/main/java/test/Ice/defaultValue/AllTests.java b/java-compat/test/src/main/java/test/Ice/defaultValue/AllTests.java
new file mode 100644
index 00000000000..3c669e17b5b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/defaultValue/AllTests.java
@@ -0,0 +1,205 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.defaultValue;
+
+import java.io.PrintWriter;
+import test.Ice.defaultValue.Test.*;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static void
+ allTests(test.Util.Application app, PrintWriter out)
+ {
+ out.print("testing default values... ");
+ out.flush();
+
+ {
+ Struct1 v = new Struct1();
+ test(!v.boolFalse);
+ test(v.boolTrue);
+ test(v.b == (byte)254);
+ test(v.s == 16000);
+ test(v.i == 3);
+ test(v.l == 4);
+ test(v.f == 5.1F);
+ test(v.d == 6.2);
+ test(v.str == "foo \\ \"bar\n \r\n\t\u000b\f\u0007\b? \u0007 \u0007");
+ test(v.c1 == Color.red);
+ test(v.c2 == Color.green);
+ test(v.c3 == Color.blue);
+ test(v.nc1 == test.Ice.defaultValue.Test.Nested.Color.red);
+ test(v.nc2 == test.Ice.defaultValue.Test.Nested.Color.green);
+ test(v.nc3 == test.Ice.defaultValue.Test.Nested.Color.blue);
+ test(v.noDefault.equals(""));
+ test(v.zeroI == 0);
+ test(v.zeroL == 0);
+ test(v.zeroF == 0);
+ test(v.zeroDotF == 0);
+ test(v.zeroD == 0);
+ test(v.zeroDotD == 0);
+ }
+
+ {
+ Struct2 v = new Struct2();
+ test(v.boolTrue == ConstBool.value);
+ test(v.b == ConstByte.value);
+ test(v.s == ConstShort.value);
+ test(v.i == ConstInt.value);
+ test(v.l == ConstLong.value);
+ test(v.f == ConstFloat.value);
+ test(v.d == ConstDouble.value);
+ test(v.str.equals(ConstString.value));
+ test(v.c1 == ConstColor1.value);
+ test(v.c2 == ConstColor2.value);
+ test(v.c3 == ConstColor3.value);
+ test(v.nc1 == ConstNestedColor1.value);
+ test(v.nc2 == ConstNestedColor2.value);
+ test(v.nc3 == ConstNestedColor3.value);
+ }
+
+ {
+ Base v = new Base();
+ test(!v.boolFalse);
+ test(v.boolTrue);
+ test(v.b == 1);
+ test(v.s == 2);
+ test(v.i == 3);
+ test(v.l == 4);
+ test(v.f == 5.1F);
+ test(v.d == 6.2);
+ test(v.str.equals("foo \\ \"bar\n \r\n\t\u000b\f\u0007\b? \007 \u0007"));
+ test(v.noDefault.equals(""));
+ test(v.zeroI == 0);
+ test(v.zeroL == 0);
+ test(v.zeroF == 0);
+ test(v.zeroDotF == 0);
+ test(v.zeroD == 0);
+ test(v.zeroDotD == 0);
+ }
+
+ {
+ Derived v = new Derived();
+ test(!v.boolFalse);
+ test(v.boolTrue);
+ test(v.b == 1);
+ test(v.s == 2);
+ test(v.i == 3);
+ test(v.l == 4);
+ test(v.f == 5.1F);
+ test(v.d == 6.2);
+ test(v.str.equals("foo \\ \"bar\n \r\n\t\u000b\f\u0007\b? \007 \u0007"));
+ test(v.c1 == Color.red);
+ test(v.c2 == Color.green);
+ test(v.c3 == Color.blue);
+ test(v.nc1 == test.Ice.defaultValue.Test.Nested.Color.red);
+ test(v.nc2 == test.Ice.defaultValue.Test.Nested.Color.green);
+ test(v.nc3 == test.Ice.defaultValue.Test.Nested.Color.blue);
+ test(v.noDefault.equals(""));
+ test(v.zeroI == 0);
+ test(v.zeroL == 0);
+ test(v.zeroF == 0);
+ test(v.zeroDotF == 0);
+ test(v.zeroD == 0);
+ test(v.zeroDotD == 0);
+ }
+
+ {
+ BaseEx v = new BaseEx();
+ test(!v.boolFalse);
+ test(v.boolTrue);
+ test(v.b == 1);
+ test(v.s == 2);
+ test(v.i == 3);
+ test(v.l == 4);
+ test(v.f == 5.1F);
+ test(v.d == 6.2);
+ test(v.str == "foo \\ \"bar\n \r\n\t\u000b\f\u0007\b? \007 \u0007");
+ test(v.noDefault.equals(""));
+ test(v.zeroI == 0);
+ test(v.zeroL == 0);
+ test(v.zeroF == 0);
+ test(v.zeroDotF == 0);
+ test(v.zeroD == 0);
+ test(v.zeroDotD == 0);
+ }
+
+ {
+ DerivedEx v = new DerivedEx();
+ test(!v.boolFalse);
+ test(v.boolTrue);
+ test(v.b == 1);
+ test(v.s == 2);
+ test(v.i == 3);
+ test(v.l == 4);
+ test(v.f == 5.1F);
+ test(v.d == 6.2);
+ test(v.str == "foo \\ \"bar\n \r\n\t\u000b\f\u0007\b? \007 \u0007");
+ test(v.noDefault.equals(""));
+ test(v.c1 == Color.red);
+ test(v.c2 == Color.green);
+ test(v.c3 == Color.blue);
+ test(v.nc1 == test.Ice.defaultValue.Test.Nested.Color.red);
+ test(v.nc2 == test.Ice.defaultValue.Test.Nested.Color.green);
+ test(v.nc3 == test.Ice.defaultValue.Test.Nested.Color.blue);
+ test(v.zeroI == 0);
+ test(v.zeroL == 0);
+ test(v.zeroF == 0);
+ test(v.zeroDotF == 0);
+ test(v.zeroD == 0);
+ test(v.zeroDotD == 0);
+ }
+
+ out.println("ok");
+
+ out.write("testing default constructor... ");
+ out.flush();
+ {
+ test.Ice.defaultValue.Test.StructNoDefaults v = new test.Ice.defaultValue.Test.StructNoDefaults();
+ test(v.bo == false);
+ test(v.b == 0);
+ test(v.s == 0);
+ test(v.i == 0);
+ test(v.l == 0);
+ test(v.f == 0.0);
+ test(v.d == 0.0);
+ test(v.str.equals(""));
+ test(v.c1 == test.Ice.defaultValue.Test.Color.red);
+ test(v.bs == null);
+ test(v.is == null);
+ test(v.st != null);
+ test(v.dict == null);
+
+ test.Ice.defaultValue.Test.ExceptionNoDefaults e = new test.Ice.defaultValue.Test.ExceptionNoDefaults();
+ test(e.str.equals(""));
+ test(e.c1 == test.Ice.defaultValue.Test.Color.red);
+ test(e.bs == null);
+ test(e.st != null);
+ test(e.dict == null);
+
+ test.Ice.defaultValue.Test.ClassNoDefaults cl = new test.Ice.defaultValue.Test.ClassNoDefaults();
+ test(cl.str.equals(""));
+ test(cl.c1 == test.Ice.defaultValue.Test.Color.red);
+ test(cl.bs == null);
+ test(cl.st != null);
+ test(cl.dict == null);
+ }
+
+ out.println("ok");
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/defaultValue/Client.java b/java-compat/test/src/main/java/test/Ice/defaultValue/Client.java
new file mode 100644
index 00000000000..7d13b0c7645
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/defaultValue/Client.java
@@ -0,0 +1,29 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.defaultValue;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ AllTests.allTests(this, getWriter());
+ return 0;
+ }
+
+ public static void main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/defaultValue/Test.ice b/java-compat/test/src/main/java/test/Ice/defaultValue/Test.ice
new file mode 100644
index 00000000000..c2c885f9d21
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/defaultValue/Test.ice
@@ -0,0 +1,208 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.defaultValue"]]
+module Test
+{
+
+enum Color { red, green, blue };
+
+module Nested
+{
+
+enum Color { red, green, blue };
+
+};
+
+struct Struct1
+{
+ bool boolFalse = false;
+ bool boolTrue = true;
+ byte b = 254;
+ short s = 16000;
+ int i = 3;
+ long l = 4;
+ float f = 5.1;
+ double d = 6.2;
+ string str = "foo \\ \"bar\n \r\n\t\v\f\a\b\? \007 \x07";
+ Color c1 = ::Test::red;
+ Color c2 = Test::green;
+ Color c3 = blue;
+ Nested::Color nc1 = ::Test::Nested::red;
+ Nested::Color nc2 = Nested::green;
+ Nested::Color nc3 = Nested::blue;
+ string noDefault;
+ int zeroI = 0;
+ long zeroL = 0;
+ float zeroF = 0;
+ float zeroDotF = 0.0;
+ double zeroD = 0;
+ double zeroDotD = 0;
+};
+
+const bool ConstBool = true;
+const byte ConstByte = 254;
+const short ConstShort = 16000;
+const int ConstInt = 3;
+const long ConstLong = 4;
+const float ConstFloat = 5.1;
+const double ConstDouble = 6.2;
+const string ConstString = "foo \\ \"bar\n \r\n\t\v\f\a\b\? \007 \x07";
+const Color ConstColor1 = ::Test::red;
+const Color ConstColor2 = Test::green;
+const Color ConstColor3 = blue;
+const Nested::Color ConstNestedColor1 = ::Test::Nested::red;
+const Nested::Color ConstNestedColor2 = Test::Nested::green;
+const Nested::Color ConstNestedColor3 = Nested::blue;
+const int ConstZeroI = 0;
+const long ConstZeroL = 0;
+const float ConstZeroF = 0;
+const float ConstZeroDotF = 0.0;
+const double ConstZeroD = 0;
+const double ConstZeroDotD = 0;
+
+struct Struct2
+{
+ bool boolTrue = ConstBool;
+ byte b = ConstByte;
+ short s = ConstShort;
+ int i = ConstInt;
+ long l = ConstLong;
+ float f = ConstFloat;
+ double d = ConstDouble;
+ string str = ConstString;
+ Color c1 = ConstColor1;
+ Color c2 = ConstColor2;
+ Color c3 = ConstColor3;
+ Nested::Color nc1 = ConstNestedColor1;
+ Nested::Color nc2 = ConstNestedColor2;
+ Nested::Color nc3 = ConstNestedColor3;
+ int zeroI = ConstZeroI;
+ long zeroL = ConstZeroL;
+ float zeroF = ConstZeroF;
+ float zeroDotF = ConstZeroDotF;
+ double zeroD = ConstZeroD;
+ double zeroDotD = ConstZeroDotD;
+};
+
+class Base
+{
+ bool boolFalse = false;
+ bool boolTrue = true;
+ byte b = 1;
+ short s = 2;
+ int i = 3;
+ long l = 4;
+ float f = 5.1;
+ double d = 6.2;
+ string str = "foo \\ \"bar\n \r\n\t\v\f\a\b\? \007 \x07";
+ string noDefault;
+ int zeroI = 0;
+ long zeroL = 0;
+ float zeroF = 0;
+ float zeroDotF = 0.0;
+ double zeroD = 0;
+ double zeroDotD = 0;
+};
+
+class Derived extends Base
+{
+ Color c1 = ::Test::red;
+ Color c2 = Test::green;
+ Color c3 = blue;
+ Nested::Color nc1 = ::Test::Nested::red;
+ Nested::Color nc2 = Nested::green;
+ Nested::Color nc3 = Nested::blue;
+};
+
+exception BaseEx
+{
+ bool boolFalse = false;
+ bool boolTrue = true;
+ byte b = 1;
+ short s = 2;
+ int i = 3;
+ long l = 4;
+ float f = 5.1;
+ double d = 6.2;
+ string str = "foo \\ \"bar\n \r\n\t\v\f\a\b\? \007 \x07";
+ string noDefault;
+ int zeroI = 0;
+ long zeroL = 0;
+ float zeroF = 0;
+ float zeroDotF = 0.0;
+ double zeroD = 0;
+ double zeroDotD = 0;
+};
+
+exception DerivedEx extends BaseEx
+{
+ Color c1 = ConstColor1;
+ Color c2 = ConstColor2;
+ Color c3 = ConstColor3;
+ Nested::Color nc1 = ConstNestedColor1;
+ Nested::Color nc2 = ConstNestedColor2;
+ Nested::Color nc3 = ConstNestedColor3;
+};
+
+sequence<byte> ByteSeq;
+sequence<int> IntSeq;
+dictionary<int, string> IntStringDict;
+
+struct InnerStruct
+{
+ int a;
+};
+
+struct StructNoDefaults
+{
+ bool bo;
+ byte b;
+ short s;
+ int i;
+ long l;
+ float f;
+ double d;
+ string str;
+ Color c1;
+ ByteSeq bs;
+ IntSeq is;
+ InnerStruct st;
+ IntStringDict dict;
+};
+
+exception ExceptionNoDefaultsBase
+{
+ string str;
+ Color c1;
+ ByteSeq bs;
+};
+
+exception ExceptionNoDefaults extends ExceptionNoDefaultsBase
+{
+ InnerStruct st;
+ IntStringDict dict;
+};
+
+class ClassNoDefaultsBase
+{
+ string str;
+ Color c1;
+ ByteSeq bs;
+};
+
+class ClassNoDefaults extends ClassNoDefaultsBase
+{
+ InnerStruct st;
+ IntStringDict dict;
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/defaultValue/run.py b/java-compat/test/src/main/java/test/Ice/defaultValue/run.py
new file mode 100755
index 00000000000..06a587612d9
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/defaultValue/run.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+sys.stdout.write("starting client... ")
+sys.stdout.flush()
+clientProc = TestUtil.startClient("test.Ice.defaultValue.Client",startReader=False)
+print("ok")
+clientProc.startReader()
+clientProc.waitTestSuccess()
diff --git a/java-compat/test/src/main/java/test/Ice/dispatcher/AllTests.java b/java-compat/test/src/main/java/test/Ice/dispatcher/AllTests.java
new file mode 100644
index 00000000000..31116ccb013
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/dispatcher/AllTests.java
@@ -0,0 +1,229 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.dispatcher;
+
+import java.io.PrintWriter;
+
+import test.Ice.dispatcher.Test.TestIntfPrx;
+import test.Ice.dispatcher.Test.TestIntfPrxHelper;
+import test.Ice.dispatcher.Test.TestIntfControllerPrx;
+import test.Ice.dispatcher.Test.TestIntfControllerPrxHelper;
+import test.Ice.dispatcher.Test.Callback_TestIntf_op;
+import test.Ice.dispatcher.Test.Callback_TestIntf_opWithPayload;
+import test.Ice.dispatcher.Test.Callback_TestIntf_sleep;
+
+public class AllTests
+{
+ private static abstract class OpCallback extends Callback_TestIntf_op
+ {
+ OpCallback()
+ {
+ _called = false;
+ }
+
+ public synchronized void check()
+ {
+ while(!_called)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ _called = false;
+ }
+
+ public synchronized void called()
+ {
+ assert(!_called);
+ _called = true;
+ notify();
+ }
+
+ private boolean _called;
+ }
+
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static void
+ allTests(Ice.Communicator communicator, PrintWriter out, final Dispatcher dispatcher)
+ {
+ String sref = "test:default -p 12010";
+ Ice.ObjectPrx obj = communicator.stringToProxy(sref);
+ test(obj != null);
+
+ int mult = 1;
+ if(!communicator.getProperties().getPropertyWithDefault("Ice.Default.Protocol", "tcp").equals("tcp"))
+ {
+ mult = 4;
+ }
+
+ TestIntfPrx p = TestIntfPrxHelper.uncheckedCast(obj);
+
+ sref = "testController:tcp -p 12011";
+ obj = communicator.stringToProxy(sref);
+ test(obj != null);
+
+ TestIntfControllerPrx testController = TestIntfControllerPrxHelper.uncheckedCast(obj);
+
+ out.print("testing dispatcher... ");
+ out.flush();
+ {
+ p.op();
+
+ OpCallback cb = new OpCallback()
+ {
+ @Override
+ public void
+ response()
+ {
+ test(dispatcher.isDispatcherThread());
+ called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ };
+ p.begin_op(cb);
+ cb.check();
+
+ TestIntfPrx i = (TestIntfPrx)p.ice_adapterId("dummy");
+ cb = new OpCallback()
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(ex instanceof Ice.NoEndpointException);
+ test(dispatcher.isDispatcherThread());
+ called();
+ }
+ };
+ i.begin_op(cb);
+ cb.check();
+
+ {
+ //
+ // Expect InvocationTimeoutException.
+ //
+ TestIntfPrx to = TestIntfPrxHelper.uncheckedCast(p.ice_invocationTimeout(250));
+ class Callback_TestIntf_sleepImpl extends Callback_TestIntf_sleep
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(ex instanceof Ice.InvocationTimeoutException);
+ test(dispatcher.isDispatcherThread());
+ called();
+ }
+
+ @Override
+ public void
+ sent(boolean sentSynchronously)
+ {
+ test(sentSynchronously || dispatcher.isDispatcherThread());
+ }
+
+ public synchronized void check()
+ {
+ while(!_called)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ _called = false;
+ }
+ private synchronized void called()
+ {
+ assert(!_called);
+ _called = true;
+ notify();
+ }
+ private boolean _called;
+ };
+ Callback_TestIntf_sleepImpl callback = new Callback_TestIntf_sleepImpl();
+ to.begin_sleep(500 * mult, callback);
+ callback.check();
+ }
+
+ testController.holdAdapter();
+ Callback_TestIntf_opWithPayload callback = new Callback_TestIntf_opWithPayload()
+ {
+ @Override
+ public void
+ response()
+ {
+ test(dispatcher.isDispatcherThread());
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(ex instanceof Ice.CommunicatorDestroyedException);
+ }
+
+ @Override
+ public void
+ sent(boolean sentSynchronously)
+ {
+ test(sentSynchronously || dispatcher.isDispatcherThread());
+ }
+ };
+
+ byte[] seq = new byte[10 * 1024];
+ new java.util.Random().nextBytes(seq); // Make sure the request doesn't compress too well.
+ Ice.AsyncResult r;
+ while((r = p.begin_opWithPayload(seq, callback)).sentSynchronously());
+ testController.resumeAdapter();
+ r.waitForCompleted();
+ }
+ out.println("ok");
+
+ p.shutdown();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/dispatcher/Client.java b/java-compat/test/src/main/java/test/Ice/dispatcher/Client.java
new file mode 100644
index 00000000000..3cfb7a56697
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/dispatcher/Client.java
@@ -0,0 +1,61 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.dispatcher;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ AllTests.allTests(communicator(), getWriter(), _dispatcher);
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ assert(_dispatcher == null);
+ _dispatcher = new Dispatcher();
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.dispatcher");
+
+ //
+ // Limit the send buffer size, this test relies on the socket
+ // send() blocking after sending a given amount of data.
+ //
+ initData.properties.setProperty("Ice.TCP.SndSize", "50000");
+
+ initData.dispatcher = _dispatcher;
+ return initData;
+ }
+
+ Dispatcher getDispatcher()
+ {
+ return _dispatcher;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ app.getDispatcher().terminate();
+ System.gc();
+ System.exit(result);
+ }
+
+ //
+ // The Dispatcher class uses a static "_instance" member in other language
+ // mappings. In Java, we avoid the use of static members because we need to
+ // maintain support for Android (in which the client and server run in the
+ // same process).
+ //
+ private Dispatcher _dispatcher;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/dispatcher/Collocated.java b/java-compat/test/src/main/java/test/Ice/dispatcher/Collocated.java
new file mode 100644
index 00000000000..230321ada51
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/dispatcher/Collocated.java
@@ -0,0 +1,66 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.dispatcher;
+
+public class Collocated extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
+
+ assert(_dispatcher != null);
+ adapter.add(new TestI(_dispatcher), Ice.Util.stringToIdentity("test"));
+ //adapter.activate(); // Don't activate OA to ensure collocation is used.
+ adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController"));
+ //adapter2.activate(); // Don't activate OA to ensure collocation is used.
+
+ AllTests.allTests(communicator(), getWriter(), _dispatcher);
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ assert(_dispatcher == null);
+ _dispatcher = new Dispatcher();
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.dispatcher");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
+ initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
+ initData.dispatcher = _dispatcher;
+ return initData;
+ }
+
+ Dispatcher getDispatcher()
+ {
+ return _dispatcher;
+ }
+
+ public static void main(String[] args)
+ {
+ Collocated app = new Collocated();
+ int result = app.main("Collocated", args);
+ app.getDispatcher().terminate();
+ System.gc();
+ System.exit(result);
+ }
+
+ //
+ // The Dispatcher class uses a static "_instance" member in other language
+ // mappings. In Java, we avoid the use of static members because we need to
+ // maintain support for Android (in which the client and server run in the
+ // same process).
+ //
+ private Dispatcher _dispatcher;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/dispatcher/Dispatcher.java b/java-compat/test/src/main/java/test/Ice/dispatcher/Dispatcher.java
new file mode 100644
index 00000000000..1db9c2c7317
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/dispatcher/Dispatcher.java
@@ -0,0 +1,117 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.dispatcher;
+
+public class Dispatcher implements Runnable, Ice.Dispatcher
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public Dispatcher()
+ {
+ _thread = new Thread(this);
+ _thread.start();
+ }
+
+ @Override
+ public void
+ run()
+ {
+ while(true)
+ {
+ Runnable call = null;
+ synchronized(this)
+ {
+ if(!_terminated && _calls.isEmpty())
+ {
+ try
+ {
+ wait();
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+
+ if(!_calls.isEmpty())
+ {
+ call = _calls.poll();
+ }
+ else if(_terminated)
+ {
+ // Terminate only once all calls are dispatched.
+ return;
+ }
+ }
+
+ if(call != null)
+ {
+ try
+ {
+ call.run();
+ }
+ catch(Exception ex)
+ {
+ // Exceptions should never propagate here.
+ test(false);
+ }
+ }
+ }
+ }
+
+ @Override
+ synchronized public void
+ dispatch(Runnable call, Ice.Connection con)
+ {
+ boolean added = _calls.offer(call);
+ assert(added);
+ if(_calls.size() == 1)
+ {
+ notify();
+ }
+ }
+
+ public void
+ terminate()
+ {
+ synchronized(this)
+ {
+ _terminated = true;
+ notify();
+ }
+ while(true)
+ {
+ try
+ {
+ _thread.join();
+ break;
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+ }
+
+ public boolean
+ isDispatcherThread()
+ {
+ return Thread.currentThread() == _thread;
+ }
+
+ private java.util.Queue<Runnable> _calls = new java.util.LinkedList<Runnable>();
+ private Thread _thread;
+ private boolean _terminated = false;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/dispatcher/Server.java b/java-compat/test/src/main/java/test/Ice/dispatcher/Server.java
new file mode 100644
index 00000000000..d962bbe1e28
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/dispatcher/Server.java
@@ -0,0 +1,75 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.dispatcher;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int
+ run(String[] args)
+ {
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
+
+ assert(_dispatcher != null);
+ adapter.add(new TestI(_dispatcher), Ice.Util.stringToIdentity("test"));
+ adapter.activate();
+ adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController"));
+ adapter2.activate();
+
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ assert(_dispatcher == null);
+ _dispatcher = new Dispatcher();
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.dispatcher");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
+ initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
+ //
+ // Limit the recv buffer size, this test relies on the socket
+ // send() blocking after sending a given amount of data.
+ //
+ initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
+ initData.dispatcher = _dispatcher;
+ return initData;
+ }
+
+ public void terminate()
+ {
+ if(_dispatcher != null)
+ {
+ _dispatcher.terminate();
+ }
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ app.terminate();
+ System.gc();
+ System.exit(result);
+ }
+
+ //
+ // The Dispatcher class uses a static "_instance" member in other language
+ // mappings. In Java, we avoid the use of static members because we need to
+ // maintain support for Android (in which the client and server run in the
+ // same process).
+ //
+ private Dispatcher _dispatcher;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/dispatcher/Test.ice b/java-compat/test/src/main/java/test/Ice/dispatcher/Test.ice
new file mode 100644
index 00000000000..3223a82a2d6
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/dispatcher/Test.ice
@@ -0,0 +1,32 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+#include <Ice/BuiltinSequences.ice>
+
+[["java:package:test.Ice.dispatcher"]]
+module Test
+{
+
+interface TestIntf
+{
+ void op();
+ void sleep(int to);
+ void opWithPayload(Ice::ByteSeq seq);
+ void shutdown();
+};
+
+interface TestIntfController
+{
+ void holdAdapter();
+ void resumeAdapter();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/dispatcher/TestControllerI.java b/java-compat/test/src/main/java/test/Ice/dispatcher/TestControllerI.java
new file mode 100644
index 00000000000..df5e6cd258f
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/dispatcher/TestControllerI.java
@@ -0,0 +1,37 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.dispatcher;
+
+import test.Ice.dispatcher.Test._TestIntfControllerDisp;
+
+class TestControllerI extends _TestIntfControllerDisp
+{
+ @Override
+ public void
+ holdAdapter(Ice.Current current)
+ {
+ _adapter.hold();
+ }
+
+ @Override
+ public void
+ resumeAdapter(Ice.Current current)
+ {
+ _adapter.activate();
+ }
+
+ public
+ TestControllerI(Ice.ObjectAdapter adapter)
+ {
+ _adapter = adapter;
+ }
+
+ final private Ice.ObjectAdapter _adapter;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/dispatcher/TestI.java b/java-compat/test/src/main/java/test/Ice/dispatcher/TestI.java
new file mode 100644
index 00000000000..c04d5bf44c8
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/dispatcher/TestI.java
@@ -0,0 +1,66 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.dispatcher;
+
+import test.Ice.dispatcher.Test._TestIntfDisp;
+
+public class TestI extends _TestIntfDisp
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ TestI(Dispatcher dispatcher)
+ {
+ _dispatcher = dispatcher;
+ }
+
+ @Override
+ public void
+ op(Ice.Current current)
+ {
+ test(_dispatcher.isDispatcherThread());
+ }
+
+ @Override
+ public void
+ sleep(int to, Ice.Current current)
+ {
+ try
+ {
+ Thread.currentThread();
+ Thread.sleep(to);
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ @Override
+ public void
+ opWithPayload(byte[] seq, Ice.Current current)
+ {
+ test(_dispatcher.isDispatcherThread());
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+
+ private Dispatcher _dispatcher;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/dispatcher/run.py b/java-compat/test/src/main/java/test/Ice/dispatcher/run.py
new file mode 100755
index 00000000000..97eec95871b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/dispatcher/run.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.queueCollocatedTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/echo/BlobjectI.java b/java-compat/test/src/main/java/test/Ice/echo/BlobjectI.java
new file mode 100644
index 00000000000..6c6e9a832ff
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/echo/BlobjectI.java
@@ -0,0 +1,109 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.echo;
+
+public class BlobjectI extends Ice.BlobjectAsync
+{
+ class Callback extends Ice.Callback_Object_ice_invoke
+ {
+ public Callback(Ice.AMD_Object_ice_invoke cb, boolean twoway)
+ {
+ _cb = cb;
+ _twoway = twoway;
+ }
+
+ @Override
+ public void response(boolean ok, byte[] encaps)
+ {
+ _cb.ice_response(ok, encaps);
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ _cb.ice_exception(ex);
+ }
+
+ @Override
+ public void sent(boolean sync)
+ {
+ if(!_twoway)
+ {
+ _cb.ice_response(true, new byte[0]);
+ }
+ }
+
+ final Ice.AMD_Object_ice_invoke _cb;
+ final boolean _twoway;
+ };
+
+ public void startBatch()
+ {
+ assert(_batchProxy == null);
+ _startBatch = true;
+ }
+
+ public void flushBatch()
+ {
+ assert(_batchProxy != null);
+ _batchProxy.ice_flushBatchRequests();
+ _batchProxy = null;
+ }
+
+ @Override
+ public void
+ ice_invoke_async(Ice.AMD_Object_ice_invoke amdCb, byte[] inEncaps, Ice.Current current)
+ {
+ boolean twoway = current.requestId > 0;
+ Ice.ObjectPrx obj = current.con.createProxy(current.id);
+ if(!twoway)
+ {
+ if(_startBatch)
+ {
+ _startBatch = false;
+ _batchProxy = obj.ice_batchOneway();
+ }
+ if(_batchProxy != null)
+ {
+ obj = _batchProxy;
+ }
+
+ if(!current.facet.isEmpty())
+ {
+ obj = obj.ice_facet(current.facet);
+ }
+
+ if(_batchProxy != null)
+ {
+ Ice.ByteSeqHolder out = new Ice.ByteSeqHolder();
+ obj.ice_invoke(current.operation, current.mode, inEncaps, out, current.ctx);
+ amdCb.ice_response(true, new byte[0]);
+ }
+ else
+ {
+ Callback cb = new Callback(amdCb, false);
+ obj.ice_oneway().begin_ice_invoke(current.operation, current.mode, inEncaps, current.ctx, cb);
+ }
+ }
+ else
+ {
+ if(!current.facet.isEmpty())
+ {
+ obj = obj.ice_facet(current.facet);
+ }
+
+ Callback cb = new Callback(amdCb, true);
+ obj.begin_ice_invoke(current.operation, current.mode, inEncaps, current.ctx, cb);
+ }
+ }
+
+ private Ice.ObjectPrx _batchProxy;
+ private boolean _startBatch;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/echo/Server.java b/java-compat/test/src/main/java/test/Ice/echo/Server.java
new file mode 100644
index 00000000000..07648551d38
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/echo/Server.java
@@ -0,0 +1,71 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.echo;
+
+public class Server extends test.Util.Application
+{
+ class EchoI extends test.Ice.echo.Test._EchoDisp
+ {
+ public EchoI(BlobjectI blob)
+ {
+ _blob = blob;
+ }
+
+ @Override
+ public void startBatch(Ice.Current current)
+ {
+ _blob.startBatch();
+ }
+
+ @Override
+ public void flushBatch(Ice.Current current)
+ {
+ _blob.flushBatch();
+ }
+
+ @Override
+ public void shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+
+ final private BlobjectI _blob;
+ };
+
+ @Override
+ public int run(String[] args)
+ {
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ BlobjectI blob = new BlobjectI();
+ adapter.addDefaultServant(blob, "");
+ adapter.add(new EchoI(blob), Ice.Util.stringToIdentity("__echo"));
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.echo");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server c = new Server();
+ int status = c.main("Server", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/echo/Test.ice b/java-compat/test/src/main/java/test/Ice/echo/Test.ice
new file mode 100644
index 00000000000..ae203a2e52c
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/echo/Test.ice
@@ -0,0 +1,26 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.echo"]]
+module Test
+{
+
+//
+// This object is available with the identity "__echo".
+//
+interface Echo
+{
+ void startBatch();
+ void flushBatch();
+ void shutdown();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/echo/run.py b/java-compat/test/src/main/java/test/Ice/echo/run.py
new file mode 100755
index 00000000000..3f861533410
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/echo/run.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+sys.stdout.write("starting server... ")
+sys.stdout.flush()
+p = TestUtil.startServer("test.Ice.echo.Server")
+print("ok")
+sys.stdout.flush()
+
+p.waitTestSuccess()
diff --git a/java-compat/test/src/main/java/test/Ice/enums/AllTests.java b/java-compat/test/src/main/java/test/Ice/enums/AllTests.java
new file mode 100644
index 00000000000..ea044f068ab
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/enums/AllTests.java
@@ -0,0 +1,336 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.enums;
+
+import test.Ice.enums.Test.*;
+import java.io.PrintWriter;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static TestIntfPrx
+ allTests(Ice.Communicator communicator, PrintWriter out)
+ {
+ String ref = "test:default -p 12010";
+ Ice.ObjectPrx obj = communicator.stringToProxy(ref);
+ test(obj != null);
+ TestIntfPrx proxy = TestIntfPrxHelper.checkedCast(obj);
+ test(proxy != null);
+
+ out.print("testing enum values... ");
+ out.flush();
+
+ test(ByteEnum.benum1.value() == 0);
+ test(ByteEnum.benum2.value() == 1);
+ test(ByteEnum.benum3.value() == ByteConst1.value);
+ test(ByteEnum.benum4.value() == ByteConst1.value + 1);
+ test(ByteEnum.benum5.value() == ShortConst1.value);
+ test(ByteEnum.benum6.value() == ShortConst1.value + 1);
+ test(ByteEnum.benum7.value() == IntConst1.value);
+ test(ByteEnum.benum8.value() == IntConst1.value + 1);
+ test(ByteEnum.benum9.value() == LongConst1.value);
+ test(ByteEnum.benum10.value() == LongConst1.value + 1);
+ test(ByteEnum.benum11.value() == ByteConst2.value);
+
+ test(ByteEnum.valueOf(0) == ByteEnum.benum1);
+ test(ByteEnum.valueOf(1) == ByteEnum.benum2);
+ test(ByteEnum.valueOf(ByteConst1.value) == ByteEnum.benum3);
+ test(ByteEnum.valueOf(ByteConst1.value + 1) == ByteEnum.benum4);
+ test(ByteEnum.valueOf(ShortConst1.value) == ByteEnum.benum5);
+ test(ByteEnum.valueOf(ShortConst1.value + 1) == ByteEnum.benum6);
+ test(ByteEnum.valueOf(IntConst1.value) == ByteEnum.benum7);
+ test(ByteEnum.valueOf(IntConst1.value + 1) == ByteEnum.benum8);
+ test(ByteEnum.valueOf((int)LongConst1.value) == ByteEnum.benum9);
+ test(ByteEnum.valueOf((int)LongConst1.value + 1) == ByteEnum.benum10);
+ test(ByteEnum.valueOf(ByteConst2.value) == ByteEnum.benum11);
+
+ test(ShortEnum.senum1.value() == 3);
+ test(ShortEnum.senum2.value() == 4);
+ test(ShortEnum.senum3.value() == ByteConst1.value);
+ test(ShortEnum.senum4.value() == ByteConst1.value + 1);
+ test(ShortEnum.senum5.value() == ShortConst1.value);
+ test(ShortEnum.senum6.value() == ShortConst1.value + 1);
+ test(ShortEnum.senum7.value() == IntConst1.value);
+ test(ShortEnum.senum8.value() == IntConst1.value + 1);
+ test(ShortEnum.senum9.value() == LongConst1.value);
+ test(ShortEnum.senum10.value() == LongConst1.value + 1);
+ test(ShortEnum.senum11.value() == ShortConst2.value);
+
+ test(ShortEnum.valueOf(3) == ShortEnum.senum1);
+ test(ShortEnum.valueOf(4) == ShortEnum.senum2);
+ test(ShortEnum.valueOf(ByteConst1.value) == ShortEnum.senum3);
+ test(ShortEnum.valueOf(ByteConst1.value + 1) == ShortEnum.senum4);
+ test(ShortEnum.valueOf(ShortConst1.value) == ShortEnum.senum5);
+ test(ShortEnum.valueOf(ShortConst1.value + 1) == ShortEnum.senum6);
+ test(ShortEnum.valueOf(IntConst1.value) == ShortEnum.senum7);
+ test(ShortEnum.valueOf(IntConst1.value + 1) == ShortEnum.senum8);
+ test(ShortEnum.valueOf((int)LongConst1.value) == ShortEnum.senum9);
+ test(ShortEnum.valueOf((int)LongConst1.value + 1) == ShortEnum.senum10);
+ test(ShortEnum.valueOf(ShortConst2.value) == ShortEnum.senum11);
+
+ test(IntEnum.ienum1.value() == 0);
+ test(IntEnum.ienum2.value() == 1);
+ test(IntEnum.ienum3.value() == ByteConst1.value);
+ test(IntEnum.ienum4.value() == ByteConst1.value + 1);
+ test(IntEnum.ienum5.value() == ShortConst1.value);
+ test(IntEnum.ienum6.value() == ShortConst1.value + 1);
+ test(IntEnum.ienum7.value() == IntConst1.value);
+ test(IntEnum.ienum8.value() == IntConst1.value + 1);
+ test(IntEnum.ienum9.value() == LongConst1.value);
+ test(IntEnum.ienum10.value() == LongConst1.value + 1);
+ test(IntEnum.ienum11.value() == IntConst2.value);
+ test(IntEnum.ienum12.value() == LongConst2.value);
+
+ test(IntEnum.valueOf(0) == IntEnum.ienum1);
+ test(IntEnum.valueOf(1) == IntEnum.ienum2);
+ test(IntEnum.valueOf(ByteConst1.value) == IntEnum.ienum3);
+ test(IntEnum.valueOf(ByteConst1.value + 1) == IntEnum.ienum4);
+ test(IntEnum.valueOf(ShortConst1.value) == IntEnum.ienum5);
+ test(IntEnum.valueOf(ShortConst1.value + 1) == IntEnum.ienum6);
+ test(IntEnum.valueOf(IntConst1.value) == IntEnum.ienum7);
+ test(IntEnum.valueOf(IntConst1.value + 1) == IntEnum.ienum8);
+ test(IntEnum.valueOf((int)LongConst1.value) == IntEnum.ienum9);
+ test(IntEnum.valueOf((int)LongConst1.value + 1) == IntEnum.ienum10);
+ test(IntEnum.valueOf(IntConst2.value) == IntEnum.ienum11);
+ test(IntEnum.valueOf((int)LongConst2.value) == IntEnum.ienum12);
+
+ test(SimpleEnum.red.value() == 0);
+ test(SimpleEnum.green.value() == 1);
+ test(SimpleEnum.blue.value() == 2);
+
+ test(SimpleEnum.valueOf(0) == SimpleEnum.red);
+ test(SimpleEnum.valueOf(1) == SimpleEnum.green);
+ test(SimpleEnum.valueOf(2) == SimpleEnum.blue);
+
+ out.println("ok");
+
+ out.print("testing enum streaming... ");
+ out.flush();
+
+ Ice.OutputStream os;
+ byte[] bytes;
+
+ final boolean encoding_1_0 =
+ communicator.getProperties().getProperty("Ice.Default.EncodingVersion").equals("1.0");
+
+ os = new Ice.OutputStream(communicator);
+ ByteEnum.write(os, ByteEnum.benum11);
+ bytes = os.finished();
+ test(bytes.length == 1); // ByteEnum should require one byte
+
+ os = new Ice.OutputStream(communicator);
+ ShortEnum.write(os, ShortEnum.senum11);
+ bytes = os.finished();
+ test(bytes.length == (encoding_1_0 ? 2 : 5));
+
+ os = new Ice.OutputStream(communicator);
+ IntEnum.write(os, IntEnum.ienum11);
+ bytes = os.finished();
+ test(bytes.length == (encoding_1_0 ? 4 : 5));
+
+ os = new Ice.OutputStream(communicator);
+ SimpleEnum.write(os, SimpleEnum.blue);
+ bytes = os.finished();
+ test(bytes.length == 1); // SimpleEnum should require one byte
+
+ out.println("ok");
+
+ out.print("testing enum operations... ");
+ out.flush();
+
+ ByteEnumHolder byteEnum = new ByteEnumHolder();
+ test(proxy.opByte(ByteEnum.benum1, byteEnum) == ByteEnum.benum1);
+ test(byteEnum.value == ByteEnum.benum1);
+ test(proxy.opByte(ByteEnum.benum11, byteEnum) == ByteEnum.benum11);
+ test(byteEnum.value == ByteEnum.benum11);
+
+ ShortEnumHolder shortEnum = new ShortEnumHolder();
+ test(proxy.opShort(ShortEnum.senum1, shortEnum) == ShortEnum.senum1);
+ test(shortEnum.value == ShortEnum.senum1);
+ test(proxy.opShort(ShortEnum.senum11, shortEnum) == ShortEnum.senum11);
+ test(shortEnum.value == ShortEnum.senum11);
+
+ IntEnumHolder intEnum = new IntEnumHolder();
+ test(proxy.opInt(IntEnum.ienum1, intEnum) == IntEnum.ienum1);
+ test(intEnum.value == IntEnum.ienum1);
+ test(proxy.opInt(IntEnum.ienum11, intEnum) == IntEnum.ienum11);
+ test(intEnum.value == IntEnum.ienum11);
+ test(proxy.opInt(IntEnum.ienum12, intEnum) == IntEnum.ienum12);
+ test(intEnum.value == IntEnum.ienum12);
+
+ SimpleEnumHolder s = new SimpleEnumHolder();
+ test(proxy.opSimple(SimpleEnum.green, s) == SimpleEnum.green);
+ test(s.value == SimpleEnum.green);
+
+ out.println("ok");
+
+ out.print("testing enum sequences operations... ");
+ out.flush();
+
+ {
+ ByteEnum b1[] = { ByteEnum.benum1, ByteEnum.benum2, ByteEnum.benum3, ByteEnum.benum4, ByteEnum.benum5,
+ ByteEnum.benum6, ByteEnum.benum7, ByteEnum.benum8, ByteEnum.benum9, ByteEnum.benum10,
+ ByteEnum.benum11};
+
+ ByteEnumSeqHolder b2 = new ByteEnumSeqHolder();
+ ByteEnum b3[] = proxy.opByteSeq(b1, b2);
+
+ for(int i = 0; i < b1.length; ++i)
+ {
+ test(b1[i] == b2.value[i]);
+ test(b1[i] == b3[i]);
+ }
+ }
+
+ {
+ ShortEnum s1[] = { ShortEnum.senum1, ShortEnum.senum2, ShortEnum.senum3, ShortEnum.senum4, ShortEnum.senum5,
+ ShortEnum.senum6, ShortEnum.senum7, ShortEnum.senum8, ShortEnum.senum9, ShortEnum.senum10,
+ ShortEnum.senum11};
+
+ ShortEnumSeqHolder s2 = new ShortEnumSeqHolder();
+ ShortEnum s3[] = proxy.opShortSeq(s1, s2);
+
+ for(int i = 0; i < s1.length; ++i)
+ {
+ test(s1[i] == s2.value[i]);
+ test(s1[i] == s3[i]);
+ }
+ }
+
+ {
+ IntEnum i1[] = { IntEnum.ienum1, IntEnum.ienum2, IntEnum.ienum3, IntEnum.ienum4, IntEnum.ienum5,
+ IntEnum.ienum6, IntEnum.ienum7, IntEnum.ienum8, IntEnum.ienum9, IntEnum.ienum10,
+ IntEnum.ienum11};
+
+ IntEnumSeqHolder i2 = new IntEnumSeqHolder();
+ IntEnum i3[] = proxy.opIntSeq(i1, i2);
+
+ for(int i = 0; i < i1.length; ++i)
+ {
+ test(i1[i] == i2.value[i]);
+ test(i1[i] == i3[i]);
+ }
+ }
+
+ {
+ SimpleEnum s1[] = { SimpleEnum.red, SimpleEnum.green, SimpleEnum.blue };
+
+ SimpleEnumSeqHolder s2 = new SimpleEnumSeqHolder();
+ SimpleEnum s3[] = proxy.opSimpleSeq(s1, s2);
+
+ for(int i = 0; i < s1.length; ++i)
+ {
+ test(s1[i] == s2.value[i]);
+ test(s1[i] == s3[i]);
+ }
+ }
+
+ out.println("ok");
+
+ out.print("testing enum exceptions... ");
+ out.flush();
+
+ try
+ {
+ os = new Ice.OutputStream(communicator);
+ os.writeByte((byte)2); // Invalid enumerator
+ Ice.InputStream in = new Ice.InputStream(communicator, os.finished());
+ ByteEnum.read(in);
+ test(false);
+ }
+ catch(Ice.MarshalException ex)
+ {
+ }
+
+ try
+ {
+ os = new Ice.OutputStream(communicator);
+ os.writeByte((byte)128); // Invalid enumerator
+ Ice.InputStream in = new Ice.InputStream(communicator, os.finished());
+ ByteEnum.read(in);
+ test(false);
+ }
+ catch(Ice.MarshalException ex)
+ {
+ }
+
+ try
+ {
+ os = new Ice.OutputStream(communicator);
+ os.writeShort((short)-1); // Negative enumerators are not supported
+ Ice.InputStream in = new Ice.InputStream(communicator, os.finished());
+ ShortEnum.read(in);
+ test(false);
+ }
+ catch(Ice.MarshalException ex)
+ {
+ }
+
+ try
+ {
+ os = new Ice.OutputStream(communicator);
+ os.writeShort((short)0); // Invalid enumerator
+ Ice.InputStream in = new Ice.InputStream(communicator, os.finished());
+ ShortEnum.read(in);
+ test(false);
+ }
+ catch(Ice.MarshalException ex)
+ {
+ }
+
+ try
+ {
+ os = new Ice.OutputStream(communicator);
+ os.writeShort((short)32767); // Invalid enumerator
+ Ice.InputStream in = new Ice.InputStream(communicator, os.finished());
+ ShortEnum.read(in);
+ test(false);
+ }
+ catch(Ice.MarshalException ex)
+ {
+ }
+
+ try
+ {
+ os = new Ice.OutputStream(communicator);
+ os.writeInt(-1); // Negative enumerators are not supported
+ Ice.InputStream in = new Ice.InputStream(communicator, os.finished());
+ IntEnum.read(in);
+ test(false);
+ }
+ catch(Ice.MarshalException ex)
+ {
+ }
+
+ try
+ {
+ os = new Ice.OutputStream(communicator);
+ os.writeInt(2); // Invalid enumerator
+ Ice.InputStream in = new Ice.InputStream(communicator, os.finished());
+ IntEnum.read(in);
+ test(false);
+ }
+ catch(Ice.MarshalException ex)
+ {
+ }
+
+ out.println("ok");
+
+ return proxy;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/enums/Client.java b/java-compat/test/src/main/java/test/Ice/enums/Client.java
new file mode 100644
index 00000000000..a27198b8b66
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/enums/Client.java
@@ -0,0 +1,42 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.enums;
+
+import test.Ice.enums.Test.TestIntfPrx;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ TestIntfPrx test = AllTests.allTests(communicator, getWriter());
+ test.shutdown();
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.enums");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/enums/Server.java b/java-compat/test/src/main/java/test/Ice/enums/Server.java
new file mode 100644
index 00000000000..69c4bf6459e
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/enums/Server.java
@@ -0,0 +1,45 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.enums;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.Object test = new TestIntfI();
+ adapter.add(test, Ice.Util.stringToIdentity("test"));
+
+ adapter.activate();
+
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.enums");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server c = new Server();
+ int status = c.main("Server", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/enums/Test.ice b/java-compat/test/src/main/java/test/Ice/enums/Test.ice
new file mode 100644
index 00000000000..79f366b5c8e
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/enums/Test.ice
@@ -0,0 +1,98 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.enums"]]
+module Test
+{
+
+const byte ByteConst1 = 10;
+const short ShortConst1 = 20;
+const int IntConst1 = 30;
+const long LongConst1 = 40;
+
+const byte ByteConst2 = 126;
+const short ShortConst2 = 32766;
+const int IntConst2 = 2147483647;
+const long LongConst2 = 2147483646;
+
+enum ByteEnum
+{
+ benum1,
+ benum2,
+ benum3 = ByteConst1,
+ benum4,
+ benum5 = ShortConst1,
+ benum6,
+ benum7 = IntConst1,
+ benum8,
+ benum9 = LongConst1,
+ benum10,
+ benum11 = ByteConst2
+};
+sequence<ByteEnum> ByteEnumSeq;
+
+enum ShortEnum
+{
+ senum1 = 3,
+ senum2,
+ senum3 = ByteConst1,
+ senum4,
+ senum5 = ShortConst1,
+ senum6,
+ senum7 = IntConst1,
+ senum8,
+ senum9 = LongConst1,
+ senum10,
+ senum11 = ShortConst2
+};
+sequence<ShortEnum> ShortEnumSeq;
+
+enum IntEnum
+{
+ ienum1,
+ ienum2,
+ ienum3 = ByteConst1,
+ ienum4,
+ ienum5 = ShortConst1,
+ ienum6,
+ ienum7 = IntConst1,
+ ienum8,
+ ienum9 = LongConst1,
+ ienum10,
+ ienum11 = IntConst2,
+ ienum12 = LongConst2
+};
+sequence<IntEnum> IntEnumSeq;
+
+enum SimpleEnum
+{
+ red,
+ green,
+ blue
+};
+sequence<SimpleEnum> SimpleEnumSeq;
+
+interface TestIntf
+{
+ ByteEnum opByte(ByteEnum b1, out ByteEnum b2);
+ ShortEnum opShort(ShortEnum s1, out ShortEnum s2);
+ IntEnum opInt(IntEnum i1, out IntEnum i2);
+ SimpleEnum opSimple(SimpleEnum s1, out SimpleEnum s2);
+
+ ByteEnumSeq opByteSeq(ByteEnumSeq b1, out ByteEnumSeq b2);
+ ShortEnumSeq opShortSeq(ShortEnumSeq s1, out ShortEnumSeq s2);
+ IntEnumSeq opIntSeq(IntEnumSeq i1, out IntEnumSeq i2);
+ SimpleEnumSeq opSimpleSeq(SimpleEnumSeq s1, out SimpleEnumSeq s2);
+
+ void shutdown();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/enums/TestIntfI.java b/java-compat/test/src/main/java/test/Ice/enums/TestIntfI.java
new file mode 100644
index 00000000000..811c40a00ce
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/enums/TestIntfI.java
@@ -0,0 +1,86 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.enums;
+
+import test.Ice.enums.Test.*;
+
+public final class TestIntfI extends _TestIntfDisp
+{
+ @Override
+ public ByteEnum
+ opByte(ByteEnum b1, ByteEnumHolder b2, Ice.Current current)
+ {
+ b2.value = b1;
+ return b1;
+ }
+
+ @Override
+ public ShortEnum
+ opShort(ShortEnum s1, ShortEnumHolder s2, Ice.Current current)
+ {
+ s2.value = s1;
+ return s1;
+ }
+
+ @Override
+ public IntEnum
+ opInt(IntEnum i1, IntEnumHolder i2, Ice.Current current)
+ {
+ i2.value = i1;
+ return i1;
+ }
+
+ @Override
+ public SimpleEnum
+ opSimple(SimpleEnum s1, SimpleEnumHolder s2, Ice.Current current)
+ {
+ s2.value = s1;
+ return s1;
+ }
+
+ @Override
+ public ByteEnum[]
+ opByteSeq(ByteEnum[] b1, ByteEnumSeqHolder b2, Ice.Current current)
+ {
+ b2.value = b1;
+ return b1;
+ }
+
+ @Override
+ public ShortEnum[]
+ opShortSeq(ShortEnum[] s1, ShortEnumSeqHolder s2, Ice.Current current)
+ {
+ s2.value = s1;
+ return s1;
+ }
+
+ @Override
+ public IntEnum[]
+ opIntSeq(IntEnum[] i1, IntEnumSeqHolder i2, Ice.Current current)
+ {
+ i2.value = i1;
+ return i1;
+ }
+
+ @Override
+ public SimpleEnum[]
+ opSimpleSeq(SimpleEnum[] s1, SimpleEnumSeqHolder s2, Ice.Current current)
+ {
+ s2.value = s1;
+ return s1;
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/enums/run.py b/java-compat/test/src/main/java/test/Ice/enums/run.py
new file mode 100755
index 00000000000..1b234c88804
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/enums/run.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.",
+ additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
+ additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
+
+TestUtil.queueClientServerTest(configName = "1.1", message = "Running test with 1.1 encoding.")
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/AMDServer.java b/java-compat/test/src/main/java/test/Ice/exceptions/AMDServer.java
new file mode 100644
index 00000000000..e7d8f9b0d1e
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/exceptions/AMDServer.java
@@ -0,0 +1,62 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.exceptions;
+
+public class AMDServer extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("TestAdapter2");
+ Ice.ObjectAdapter adapter3 = communicator.createObjectAdapter("TestAdapter3");
+ Ice.Object object = new ThrowerI();
+ adapter.add(object, Ice.Util.stringToIdentity("thrower"));
+ adapter2.add(object, Ice.Util.stringToIdentity("thrower"));
+ adapter3.add(object, Ice.Util.stringToIdentity("thrower"));
+ adapter.activate();
+ adapter2.activate();
+ adapter3.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ //
+ // For this test, we need a dummy logger, otherwise the
+ // assertion test will print an error message.
+ //
+ initData.logger = new DummyLogger();
+
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions.AMD");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max
+ initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011");
+ initData.properties.setProperty("TestAdapter2.MessageSizeMax", "0");
+ initData.properties.setProperty("TestAdapter3.Endpoints", "default -p 12012");
+ initData.properties.setProperty("TestAdapter3.MessageSizeMax", "1");
+
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ AMDServer app = new AMDServer();
+ int result = app.main("AMDServer", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/AMDThrowerI.java b/java-compat/test/src/main/java/test/Ice/exceptions/AMDThrowerI.java
new file mode 100644
index 00000000000..1b7066269a2
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/exceptions/AMDThrowerI.java
@@ -0,0 +1,240 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.exceptions;
+
+import test.Ice.exceptions.AMD.Test.A;
+import test.Ice.exceptions.AMD.Test.AMD_Thrower_shutdown;
+import test.Ice.exceptions.AMD.Test.AMD_Thrower_supportsAssertException;
+import test.Ice.exceptions.AMD.Test.AMD_Thrower_supportsUndeclaredExceptions;
+import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwAasA;
+import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwAorDasAorD;
+import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwAssertException;
+import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwMemoryLimitException;
+import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwBasA;
+import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwBasB;
+import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwCasA;
+import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwCasB;
+import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwCasC;
+import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwLocalException;
+import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwLocalExceptionIdempotent;
+import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwNonIceException;
+import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwUndeclaredA;
+import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwUndeclaredB;
+import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwUndeclaredC;
+import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwAfterResponse;
+import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwAfterException;
+import test.Ice.exceptions.AMD.Test.B;
+import test.Ice.exceptions.AMD.Test.C;
+import test.Ice.exceptions.AMD.Test.D;
+import test.Ice.exceptions.AMD.Test._ThrowerDisp;
+
+public final class AMDThrowerI extends _ThrowerDisp
+{
+ public
+ AMDThrowerI()
+ {
+ }
+
+ @Override
+ public void
+ shutdown_async(AMD_Thrower_shutdown cb, Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ supportsUndeclaredExceptions_async(AMD_Thrower_supportsUndeclaredExceptions cb, Ice.Current current)
+ {
+ cb.ice_response(true);
+ }
+
+ @Override
+ public void
+ supportsAssertException_async(AMD_Thrower_supportsAssertException cb, Ice.Current current)
+ {
+ cb.ice_response(true);
+ }
+
+ @Override
+ public void
+ throwAasA_async(AMD_Thrower_throwAasA cb, int a, Ice.Current current)
+ throws A
+ {
+ A ex = new A();
+ ex.aMem = a;
+ cb.ice_exception(ex);
+ }
+
+ @Override
+ public void
+ throwAorDasAorD_async(AMD_Thrower_throwAorDasAorD cb, int a, Ice.Current current)
+ throws A,
+ D
+ {
+ if(a > 0)
+ {
+ A ex = new A();
+ ex.aMem = a;
+ cb.ice_exception(ex);
+ }
+ else
+ {
+ D ex = new D();
+ ex.dMem = a;
+ cb.ice_exception(ex);
+ }
+ }
+
+ @Override
+ public void
+ throwBasA_async(AMD_Thrower_throwBasA cb, int a, int b, Ice.Current current)
+ throws A
+ {
+ B ex = new B();
+ ex.aMem = a;
+ ex.bMem = b;
+ throw ex;
+ //cb.ice_exception(ex);
+ }
+
+ @Override
+ public void
+ throwBasB_async(AMD_Thrower_throwBasB cb, int a, int b, Ice.Current current)
+ throws B
+ {
+ B ex = new B();
+ ex.aMem = a;
+ ex.bMem = b;
+ throw ex;
+ //cb.ice_exception(ex);
+ }
+
+ @Override
+ public void
+ throwCasA_async(AMD_Thrower_throwCasA cb, int a, int b, int c, Ice.Current current)
+ throws A
+ {
+ C ex = new C();
+ ex.aMem = a;
+ ex.bMem = b;
+ ex.cMem = c;
+ cb.ice_exception(ex);
+ }
+
+ @Override
+ public void
+ throwCasB_async(AMD_Thrower_throwCasB cb, int a, int b, int c, Ice.Current current)
+ throws B
+ {
+ C ex = new C();
+ ex.aMem = a;
+ ex.bMem = b;
+ ex.cMem = c;
+ cb.ice_exception(ex);
+ }
+
+ @Override
+ public void
+ throwCasC_async(AMD_Thrower_throwCasC cb, int a, int b, int c, Ice.Current current)
+ throws C
+ {
+ C ex = new C();
+ ex.aMem = a;
+ ex.bMem = b;
+ ex.cMem = c;
+ cb.ice_exception(ex);
+ }
+
+ @Override
+ public void
+ throwUndeclaredA_async(AMD_Thrower_throwUndeclaredA cb, int a, Ice.Current current)
+ {
+ A ex = new A();
+ ex.aMem = a;
+ cb.ice_exception(ex);
+ }
+
+ @Override
+ public void
+ throwUndeclaredB_async(AMD_Thrower_throwUndeclaredB cb, int a, int b, Ice.Current current)
+ {
+ B ex = new B();
+ ex.aMem = a;
+ ex.bMem = b;
+ cb.ice_exception(ex);
+ }
+
+ @Override
+ public void
+ throwUndeclaredC_async(AMD_Thrower_throwUndeclaredC cb, int a, int b, int c, Ice.Current current)
+ {
+ C ex = new C();
+ ex.aMem = a;
+ ex.bMem = b;
+ ex.cMem = c;
+ cb.ice_exception(ex);
+ }
+
+ @Override
+ public void
+ throwLocalException_async(AMD_Thrower_throwLocalException cb, Ice.Current current)
+ {
+ cb.ice_exception(new Ice.TimeoutException());
+ }
+
+ @Override
+ public void
+ throwNonIceException_async(AMD_Thrower_throwNonIceException cb, Ice.Current current)
+ {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public void
+ throwAssertException_async(AMD_Thrower_throwAssertException cb, Ice.Current current)
+ {
+ throw new java.lang.AssertionError();
+ }
+
+ @Override
+ public void
+ throwMemoryLimitException_async(AMD_Thrower_throwMemoryLimitException cb, byte[] seq, Ice.Current current)
+ {
+ cb.ice_response(new byte[1024 * 20]); // 20KB is over the configured 10KB message size max.
+ }
+
+ @Override
+ public void
+ throwLocalExceptionIdempotent_async(AMD_Thrower_throwLocalExceptionIdempotent cb, Ice.Current current)
+ {
+ cb.ice_exception(new Ice.TimeoutException());
+ }
+
+ @Override
+ public void
+ throwAfterResponse_async(AMD_Thrower_throwAfterResponse cb, Ice.Current current)
+ {
+ cb.ice_response();
+
+ throw new RuntimeException();
+ }
+
+ @Override
+ public void
+ throwAfterException_async(AMD_Thrower_throwAfterException cb, Ice.Current current)
+ throws A
+ {
+ cb.ice_exception(new A());
+
+ throw new RuntimeException();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/AllTests.java b/java-compat/test/src/main/java/test/Ice/exceptions/AllTests.java
new file mode 100644
index 00000000000..b417b1a427d
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/exceptions/AllTests.java
@@ -0,0 +1,1502 @@
+// **********************************************************************
+//
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.exceptions;
+
+import java.io.PrintWriter;
+
+import test.Ice.exceptions.Test.A;
+import test.Ice.exceptions.Test.B;
+import test.Ice.exceptions.Test.C;
+import test.Ice.exceptions.Test.D;
+import test.Ice.exceptions.Test.ThrowerPrx;
+import test.Ice.exceptions.Test.ThrowerPrxHelper;
+import test.Ice.exceptions.Test.WrongOperationPrx;
+import test.Ice.exceptions.Test.WrongOperationPrxHelper;
+import test.Ice.exceptions.Test.Callback_Thrower_throwAasA;
+import test.Ice.exceptions.Test.Callback_Thrower_throwAorDasAorD;
+import test.Ice.exceptions.Test.Callback_Thrower_throwAssertException;
+import test.Ice.exceptions.Test.Callback_Thrower_throwBasA;
+import test.Ice.exceptions.Test.Callback_Thrower_throwBasB;
+import test.Ice.exceptions.Test.Callback_Thrower_throwCasA;
+import test.Ice.exceptions.Test.Callback_Thrower_throwCasB;
+import test.Ice.exceptions.Test.Callback_Thrower_throwCasC;
+import test.Ice.exceptions.Test.Callback_Thrower_throwLocalException;
+import test.Ice.exceptions.Test.Callback_Thrower_throwLocalExceptionIdempotent;
+import test.Ice.exceptions.Test.Callback_Thrower_throwNonIceException;
+import test.Ice.exceptions.Test.Callback_Thrower_throwUndeclaredA;
+import test.Ice.exceptions.Test.Callback_Thrower_throwUndeclaredB;
+import test.Ice.exceptions.Test.Callback_Thrower_throwUndeclaredC;
+import test.Ice.exceptions.Test.Callback_WrongOperation_noSuchOperation;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private static class Callback
+ {
+ Callback()
+ {
+ _called = false;
+ }
+
+ public synchronized void check()
+ {
+ while(!_called)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ _called = false;
+ }
+
+ public synchronized void called()
+ {
+ assert(!_called);
+ _called = true;
+ notify();
+ }
+
+ private boolean _called;
+ }
+
+ private static class Callback_Thrower_throwAasAI extends Callback_Thrower_throwAasA
+ {
+ @Override
+ public void response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.LocalException exc)
+ {
+ exc.printStackTrace();
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.UserException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(A ex)
+ {
+ test(ex.aMem == 1);
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_Thrower_throwAasAObjectNotExistI extends Callback_Thrower_throwAasA
+ {
+ Callback_Thrower_throwAasAObjectNotExistI(Ice.Communicator communicator)
+ {
+ _communicator = communicator;
+ }
+
+ @Override
+ public void response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.LocalException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(Ice.ObjectNotExistException ex)
+ {
+ Ice.Identity id = Ice.Util.stringToIdentity("does not exist");
+ test(ex.id.equals(id));
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.UserException exc)
+ {
+ exc.printStackTrace();
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ private Ice.Communicator _communicator;
+ }
+
+ private static class Callback_Thrower_throwAasAFacetNotExistI extends Callback_Thrower_throwAasA
+ {
+ @Override
+ public void response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.LocalException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(Ice.FacetNotExistException ex)
+ {
+ test(ex.facet.equals("no such facet"));
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.UserException exc)
+ {
+ exc.printStackTrace();
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_Thrower_throwAorDasAorDI extends Callback_Thrower_throwAorDasAorD
+ {
+ @Override
+ public void response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.LocalException exc)
+ {
+ exc.printStackTrace();
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.UserException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(A ex)
+ {
+ test(ex.aMem == 1);
+ }
+ catch(D ex)
+ {
+ test(ex.dMem == -1);
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_Thrower_throwBasAI extends Callback_Thrower_throwBasA
+ {
+ @Override
+ public void response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.LocalException exc)
+ {
+ exc.printStackTrace();
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.UserException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(B ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_Thrower_throwCasAI extends Callback_Thrower_throwCasA
+ {
+ @Override
+ public void response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.LocalException exc)
+ {
+ exc.printStackTrace();
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.UserException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(C ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_Thrower_throwBasBI extends Callback_Thrower_throwBasB
+ {
+ @Override
+ public void response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.LocalException exc)
+ {
+ exc.printStackTrace();
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.UserException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(B ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_Thrower_throwCasBI extends Callback_Thrower_throwCasB
+ {
+ @Override
+ public void response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.LocalException exc)
+ {
+ exc.printStackTrace();
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.UserException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(C ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_Thrower_throwCasCI extends Callback_Thrower_throwCasC
+ {
+ @Override
+ public void response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.LocalException exc)
+ {
+ exc.printStackTrace();
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.UserException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(C ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_Thrower_throwUndeclaredAI extends Callback_Thrower_throwUndeclaredA
+ {
+ @Override
+ public void response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.LocalException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(Ice.UnknownUserException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_Thrower_throwUndeclaredBI extends Callback_Thrower_throwUndeclaredB
+ {
+ @Override
+ public void response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.LocalException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(Ice.UnknownUserException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_Thrower_throwUndeclaredCI extends Callback_Thrower_throwUndeclaredC
+ {
+ @Override
+ public void response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.LocalException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(Ice.UnknownUserException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_Thrower_throwLocalExceptionI extends Callback_Thrower_throwLocalException
+ {
+ @Override
+ public void response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.LocalException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(Ice.UnknownLocalException ex)
+ {
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_Thrower_throwNonIceExceptionI extends Callback_Thrower_throwNonIceException
+ {
+ @Override
+ public void response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.LocalException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(Ice.UnknownException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_Thrower_throwAssertExceptionI extends Callback_Thrower_throwAssertException
+ {
+ @Override
+ public void response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.LocalException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ }
+ catch(Ice.UnknownException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_WrongOperation_noSuchOperationI extends Callback_WrongOperation_noSuchOperation
+ {
+ @Override
+ public void response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.LocalException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ test(ex.operation.equals("noSuchOperation"));
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ public static ThrowerPrx
+ allTests(Ice.Communicator communicator, PrintWriter out)
+ {
+ {
+ out.print("testing object adapter registration exceptions... ");
+ Ice.ObjectAdapter first;
+ try
+ {
+ first = communicator.createObjectAdapter("TestAdapter0");
+ }
+ catch(Ice.InitializationException ex)
+ {
+ // Expected
+ }
+
+ communicator.getProperties().setProperty("TestAdapter0.Endpoints", "default");
+ first = communicator.createObjectAdapter("TestAdapter0");
+ try
+ {
+ communicator.createObjectAdapter("TestAdapter0");
+ test(false);
+ }
+ catch(Ice.AlreadyRegisteredException ex)
+ {
+ // Expected
+ }
+
+ try
+ {
+ communicator.createObjectAdapterWithEndpoints("TestAdapter0", "ssl -h foo -p 12011");
+ test(false);
+ }
+ catch(Ice.AlreadyRegisteredException ex)
+ {
+ // Expected
+ }
+ first.deactivate();
+ out.println("ok");
+ }
+
+ {
+ out.print("testing servant registration exceptions... ");
+ communicator.getProperties().setProperty("TestAdapter1.Endpoints", "default");
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter1");
+ Ice.Object obj = new EmptyI();
+ adapter.add(obj, Ice.Util.stringToIdentity("x"));
+ try
+ {
+ adapter.add(obj, Ice.Util.stringToIdentity("x"));
+ test(false);
+ }
+ catch(Ice.AlreadyRegisteredException ex)
+ {
+ }
+
+ try
+ {
+ adapter.add(obj, Ice.Util.stringToIdentity(""));
+ test(false);
+ }
+ catch(Ice.IllegalIdentityException ex)
+ {
+ test(ex.id.name.equals(""));
+ }
+ try
+ {
+ adapter.add(null, Ice.Util.stringToIdentity("x"));
+ test(false);
+ }
+ catch(Ice.IllegalServantException ex)
+ {
+ }
+
+ adapter.remove(Ice.Util.stringToIdentity("x"));
+ try
+ {
+ adapter.remove(Ice.Util.stringToIdentity("x"));
+ test(false);
+ }
+ catch(Ice.NotRegisteredException ex)
+ {
+ }
+ adapter.deactivate();
+ out.println("ok");
+ }
+
+ {
+ out.print("testing servant locator registration exceptions... ");
+ communicator.getProperties().setProperty("TestAdapter2.Endpoints", "default");
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter2");
+ Ice.ServantLocator loc = new ServantLocatorI();
+ adapter.addServantLocator(loc, "x");
+ try
+ {
+ adapter.addServantLocator(loc, "x");
+ test(false);
+ }
+ catch(Ice.AlreadyRegisteredException ex)
+ {
+ }
+
+ adapter.deactivate();
+ out.println("ok");
+ }
+
+ {
+ out.print("testing value factory registration exception... ");
+ Ice.ValueFactory of = new ValueFactoryI();
+ communicator.getValueFactoryManager().add(of, "::x");
+ try
+ {
+ communicator.getValueFactoryManager().add(of, "::x");
+ test(false);
+ }
+ catch(Ice.AlreadyRegisteredException ex)
+ {
+ }
+ out.println("ok");
+ }
+
+ out.print("testing stringToProxy... ");
+ out.flush();
+ String ref = "thrower:default -p 12010";
+ Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ test(base != null);
+ out.println("ok");
+
+ out.print("testing checked cast... ");
+ out.flush();
+ ThrowerPrx thrower = ThrowerPrxHelper.checkedCast(base);
+ test(thrower != null);
+ test(thrower.equals(base));
+ out.println("ok");
+
+ out.print("catching exact types... ");
+ out.flush();
+
+ try
+ {
+ thrower.throwAasA(1);
+ test(false);
+ }
+ catch(A ex)
+ {
+ test(ex.aMem == 1);
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ try
+ {
+ thrower.throwAorDasAorD(1);
+ test(false);
+ }
+ catch(A ex)
+ {
+ test(ex.aMem == 1);
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ try
+ {
+ thrower.throwAorDasAorD(-1);
+ test(false);
+ }
+ catch(D ex)
+ {
+ test(ex.dMem == -1);
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ try
+ {
+ thrower.throwBasB(1, 2);
+ test(false);
+ }
+ catch(B ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ try
+ {
+ thrower.throwCasC(1, 2, 3);
+ test(false);
+ }
+ catch(C ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ out.println("ok");
+
+ out.print("catching base types... ");
+ out.flush();
+
+ try
+ {
+ thrower.throwBasB(1, 2);
+ test(false);
+ }
+ catch(A ex)
+ {
+ test(ex.aMem == 1);
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ try
+ {
+ thrower.throwCasC(1, 2, 3);
+ test(false);
+ }
+ catch(B ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ out.println("ok");
+
+ out.print("catching derived types... ");
+ out.flush();
+
+ try
+ {
+ thrower.throwBasA(1, 2);
+ test(false);
+ }
+ catch(B ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ try
+ {
+ thrower.throwCasA(1, 2, 3);
+ test(false);
+ }
+ catch(C ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ try
+ {
+ thrower.throwCasB(1, 2, 3);
+ test(false);
+ }
+ catch(C ex)
+ {
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ out.println("ok");
+
+ if(thrower.supportsUndeclaredExceptions())
+ {
+ out.print("catching unknown user exception... ");
+ out.flush();
+
+ try
+ {
+ thrower.throwUndeclaredA(1);
+ test(false);
+ }
+ catch(Ice.UnknownUserException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ try
+ {
+ thrower.throwUndeclaredB(1, 2);
+ test(false);
+ }
+ catch(Ice.UnknownUserException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ try
+ {
+ thrower.throwUndeclaredC(1, 2, 3);
+ test(false);
+ }
+ catch(Ice.UnknownUserException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ out.println("ok");
+ }
+
+ if(thrower.supportsAssertException())
+ {
+ out.print("testing assert in the server... ");
+ out.flush();
+
+ try
+ {
+ thrower.throwAssertException();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ }
+ catch(Ice.UnknownException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ out.println("ok");
+ }
+
+ if(thrower.ice_getConnection() != null)
+ {
+ out.print("testing memory limit marshal exception...");
+ out.flush();
+ try
+ {
+ thrower.throwMemoryLimitException(null);
+ test(false);
+ }
+ catch(Ice.MemoryLimitException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ try
+ {
+ thrower.throwMemoryLimitException(new byte[20 * 1024]); // 20KB
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ }
+ catch(Ice.SocketException ex)
+ {
+ // This can be raised if the connection is closed during the client's call to write().
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(
+ communicator.stringToProxy("thrower:default -p 12011"));
+ try
+ {
+ thrower2.throwMemoryLimitException(new byte[2 * 1024 * 1024]); // 2MB (no limits)
+ }
+ catch(Ice.MemoryLimitException ex)
+ {
+ }
+ ThrowerPrx thrower3 = ThrowerPrxHelper.uncheckedCast(
+ communicator.stringToProxy("thrower:default -p 12012"));
+ try
+ {
+ thrower3.throwMemoryLimitException(new byte[1024]); // 1KB limit
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ }
+
+ out.println("ok");
+ }
+
+ out.print("catching object not exist exception... ");
+ out.flush();
+
+ {
+ Ice.Identity id = Ice.Util.stringToIdentity("does not exist");
+ try
+ {
+ ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id));
+ thrower2.ice_ping();
+ test(false);
+ }
+ catch(Ice.ObjectNotExistException ex)
+ {
+ test(ex.id.equals(id));
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ }
+
+ out.println("ok");
+
+ out.print("catching facet not exist exception... ");
+ out.flush();
+
+ try
+ {
+ ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower, "no such facet");
+ try
+ {
+ thrower2.ice_ping();
+ test(false);
+ }
+ catch(Ice.FacetNotExistException ex)
+ {
+ test(ex.facet.equals("no such facet"));
+ }
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ out.println("ok");
+
+ out.print("catching operation not exist exception... ");
+ out.flush();
+
+ try
+ {
+ WrongOperationPrx thrower2 = WrongOperationPrxHelper.uncheckedCast(thrower);
+ thrower2.noSuchOperation();
+ test(false);
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ test(ex.operation.equals("noSuchOperation"));
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ out.println("ok");
+
+ out.print("catching unknown local exception... ");
+ out.flush();
+
+ try
+ {
+ thrower.throwLocalException();
+ test(false);
+ }
+ catch(Ice.UnknownLocalException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ try
+ {
+ thrower.throwLocalExceptionIdempotent();
+ test(false);
+ }
+ catch(Ice.UnknownLocalException ex)
+ {
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ out.println("ok");
+
+ out.print("catching unknown non-Ice exception... ");
+ out.flush();
+
+ try
+ {
+ thrower.throwNonIceException();
+ test(false);
+ }
+ catch(Ice.UnknownException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ out.println(ex);
+ test(false);
+ }
+
+ out.println("ok");
+
+ out.print("testing asynchronous exceptions... ");
+ out.flush();
+
+ try
+ {
+ thrower.throwAfterResponse();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ catch(Throwable ex)
+ {
+ out.println(ex);
+ test(false);
+ }
+
+ try
+ {
+ thrower.throwAfterException();
+ test(false);
+ }
+ catch(A ex)
+ {
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ catch(Throwable ex)
+ {
+ out.println(ex);
+ test(false);
+ }
+
+ out.println("ok");
+
+ out.print("catching exact types with AMI mapping... ");
+ out.flush();
+
+ {
+ Callback_Thrower_throwAasAI cb = new Callback_Thrower_throwAasAI();
+ thrower.begin_throwAasA(1, cb);
+ cb.check();
+ }
+
+ {
+ Callback_Thrower_throwAorDasAorDI cb = new Callback_Thrower_throwAorDasAorDI();
+ thrower.begin_throwAorDasAorD(1, cb);
+ cb.check();
+ }
+
+ {
+ Callback_Thrower_throwAorDasAorDI cb = new Callback_Thrower_throwAorDasAorDI();
+ thrower.begin_throwAorDasAorD(-1, cb);
+ cb.check();
+ }
+
+ {
+ Callback_Thrower_throwBasBI cb = new Callback_Thrower_throwBasBI();
+ thrower.begin_throwBasB(1, 2, cb);
+ cb.check();
+ }
+
+ {
+ Callback_Thrower_throwCasCI cb = new Callback_Thrower_throwCasCI();
+ thrower.begin_throwCasC(1, 2, 3, cb);
+ cb.check();
+ }
+
+ out.println("ok");
+
+ out.print("catching derived types with mapping... ");
+ out.flush();
+
+ {
+ Callback_Thrower_throwBasAI cb = new Callback_Thrower_throwBasAI();
+ thrower.begin_throwBasA(1, 2, cb);
+ cb.check();
+ }
+
+ {
+ Callback_Thrower_throwCasAI cb = new Callback_Thrower_throwCasAI();
+ thrower.begin_throwCasA(1, 2, 3, cb);
+ cb.check();
+ }
+
+ {
+ Callback_Thrower_throwCasBI cb = new Callback_Thrower_throwCasBI();
+ thrower.begin_throwCasB(1, 2, 3, cb);
+ cb.check();
+ }
+
+ out.println("ok");
+
+ if(thrower.supportsUndeclaredExceptions())
+ {
+ out.print("catching unknown user exception with mapping... ");
+ out.flush();
+
+ {
+ Callback_Thrower_throwUndeclaredAI cb = new Callback_Thrower_throwUndeclaredAI();
+ thrower.begin_throwUndeclaredA(1, cb);
+ cb.check();
+ }
+
+ {
+ Callback_Thrower_throwUndeclaredBI cb = new Callback_Thrower_throwUndeclaredBI();
+ thrower.begin_throwUndeclaredB(1, 2, cb);
+ cb.check();
+ }
+
+ {
+ Callback_Thrower_throwUndeclaredCI cb = new Callback_Thrower_throwUndeclaredCI();
+ thrower.begin_throwUndeclaredC(1, 2, 3, cb);
+ cb.check();
+ }
+
+ out.println("ok");
+ }
+
+ if(thrower.supportsAssertException())
+ {
+ out.print("catching assert in the server with mapping... ");
+ out.flush();
+
+ Callback_Thrower_throwAssertExceptionI cb = new Callback_Thrower_throwAssertExceptionI();
+ thrower.begin_throwAssertException(cb);
+ cb.check();
+
+ out.println("ok");
+ }
+
+ out.print("catching object not exist exception with mapping... ");
+ out.flush();
+
+ {
+ Ice.Identity id = Ice.Util.stringToIdentity("does not exist");
+ ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id));
+ Callback_Thrower_throwAasAObjectNotExistI cb = new Callback_Thrower_throwAasAObjectNotExistI(communicator);
+ thrower2.begin_throwAasA(1, cb);
+ cb.check();
+ }
+
+ out.println("ok");
+
+ out.print("catching facet not exist exception with mapping... ");
+ out.flush();
+
+ {
+ ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower, "no such facet");
+ Callback_Thrower_throwAasAFacetNotExistI cb = new Callback_Thrower_throwAasAFacetNotExistI();
+ thrower2.begin_throwAasA(1, cb);
+ cb.check();
+ }
+
+ out.println("ok");
+
+ out.print("catching operation not exist exception with mapping... ");
+ out.flush();
+
+ {
+ Callback_WrongOperation_noSuchOperationI cb = new Callback_WrongOperation_noSuchOperationI();
+ WrongOperationPrx thrower2 = WrongOperationPrxHelper.uncheckedCast(thrower);
+ thrower2.begin_noSuchOperation(cb);
+ cb.check();
+ }
+
+ out.println("ok");
+
+ out.print("catching unknown local exception with mapping... ");
+ out.flush();
+
+ {
+ Callback_Thrower_throwLocalExceptionI cb = new Callback_Thrower_throwLocalExceptionI();
+ thrower.begin_throwLocalException(cb);
+ cb.check();
+ }
+
+ {
+ final Callback_Thrower_throwLocalExceptionI cb = new Callback_Thrower_throwLocalExceptionI();
+ thrower.begin_throwLocalExceptionIdempotent(new Callback_Thrower_throwLocalExceptionIdempotent()
+ {
+ @Override
+ public void response()
+ {
+ cb.response();
+ }
+
+ @Override
+ public void exception(Ice.LocalException exc)
+ {
+ cb.exception(exc);
+ }
+ });
+ cb.check();
+ }
+
+ out.println("ok");
+
+ out.print("catching unknown non-Ice exception with mapping... ");
+ out.flush();
+
+ {
+ Callback_Thrower_throwNonIceExceptionI cb = new Callback_Thrower_throwNonIceExceptionI();
+ thrower.begin_throwNonIceException(cb);
+ cb.check();
+ }
+
+ out.println("ok");
+
+ return thrower;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/Client.java b/java-compat/test/src/main/java/test/Ice/exceptions/Client.java
new file mode 100644
index 00000000000..741de95a736
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/exceptions/Client.java
@@ -0,0 +1,43 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.exceptions;
+
+import test.Ice.exceptions.Test.ThrowerPrx;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ ThrowerPrx thrower = AllTests.allTests(communicator, getWriter());
+ thrower.shutdown();
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions");
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/Collocated.java b/java-compat/test/src/main/java/test/Ice/exceptions/Collocated.java
new file mode 100644
index 00000000000..87f9e730a2d
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/exceptions/Collocated.java
@@ -0,0 +1,56 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.exceptions;
+
+public class Collocated extends test.Util.Application
+{
+ @Override
+ public int
+ run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.Object object = new ThrowerI();
+ adapter.add(object, Ice.Util.stringToIdentity("thrower"));
+
+ AllTests.allTests(communicator, getWriter());
+
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ //
+ // For this test, we need a dummy logger, otherwise the
+ // assertion test will print an error message.
+ //
+ initData.logger = new DummyLogger();
+
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions");
+ initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+
+ return initData;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Collocated app = new Collocated();
+ int result = app.main("Collocated", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/DummyLogger.java b/java-compat/test/src/main/java/test/Ice/exceptions/DummyLogger.java
new file mode 100644
index 00000000000..2a946e09eec
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/exceptions/DummyLogger.java
@@ -0,0 +1,66 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.exceptions;
+
+
+public final class DummyLogger implements Ice.Logger
+{
+ @Override
+ public void
+ print(String message)
+ {
+ _logger.print(message);
+ }
+
+ @Override
+ public void
+ trace(String category, String message)
+ {
+ _logger.trace(category, message);
+ }
+
+ @Override
+ public void
+ warning(String message)
+ {
+ if(!message.contains("test.Ice.exceptions.ThrowerI.throwAssertException") &&
+ !message.contains("test.Ice.exceptions.AMDThrowerI.throwAssertException_async"))
+ {
+ _logger.warning(message);
+ }
+ }
+
+ @Override
+ public void
+ error(String message)
+ {
+ if(!message.contains("test.Ice.exceptions.ThrowerI.throwAssertException") &&
+ !message.contains("test.Ice.exceptions.AMDThrowerI.throwAssertException_async"))
+ {
+ _logger.error(message);
+ }
+ }
+
+ @Override
+ public String
+ getPrefix()
+ {
+ return "";
+ }
+
+ @Override
+ public Ice.Logger
+ cloneWithPrefix(String prefix)
+ {
+ return new DummyLogger();
+ }
+
+ private Ice.Logger _logger = new Ice.LoggerI("", "");
+}
diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/EmptyI.java b/java-compat/test/src/main/java/test/Ice/exceptions/EmptyI.java
new file mode 100644
index 00000000000..445b4548a0b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/exceptions/EmptyI.java
@@ -0,0 +1,17 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.exceptions;
+
+import test.Ice.exceptions.Test._EmptyDisp;
+
+
+public final class EmptyI extends _EmptyDisp
+{
+}
diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/ServantLocatorI.java b/java-compat/test/src/main/java/test/Ice/exceptions/ServantLocatorI.java
new file mode 100644
index 00000000000..c4ea0e40952
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/exceptions/ServantLocatorI.java
@@ -0,0 +1,30 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.exceptions;
+
+
+public final class ServantLocatorI implements Ice.ServantLocator
+{
+ @Override
+ public Ice.Object locate(Ice.Current curr, Ice.LocalObjectHolder cookie)
+ {
+ return null;
+ }
+
+ @Override
+ public void finished(Ice.Current curr, Ice.Object servant, java.lang.Object cookie)
+ {
+ }
+
+ @Override
+ public void deactivate(String category)
+ {
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/Server.java b/java-compat/test/src/main/java/test/Ice/exceptions/Server.java
new file mode 100644
index 00000000000..d510ac1216f
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/exceptions/Server.java
@@ -0,0 +1,62 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.exceptions;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("TestAdapter2");
+ Ice.ObjectAdapter adapter3 = communicator.createObjectAdapter("TestAdapter3");
+ Ice.Object object = new ThrowerI();
+ adapter.add(object, Ice.Util.stringToIdentity("thrower"));
+ adapter2.add(object, Ice.Util.stringToIdentity("thrower"));
+ adapter3.add(object, Ice.Util.stringToIdentity("thrower"));
+ adapter.activate();
+ adapter2.activate();
+ adapter3.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ //
+ // For this test, we need a dummy logger, otherwise the
+ // assertion test will print an error message.
+ //
+ initData.logger = new DummyLogger();
+
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max
+ initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011");
+ initData.properties.setProperty("TestAdapter2.MessageSizeMax", "0");
+ initData.properties.setProperty("TestAdapter3.Endpoints", "default -p 12012");
+ initData.properties.setProperty("TestAdapter3.MessageSizeMax", "1");
+
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/Test.ice b/java-compat/test/src/main/java/test/Ice/exceptions/Test.ice
new file mode 100644
index 00000000000..c9146df6eee
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/exceptions/Test.ice
@@ -0,0 +1,77 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+#include <Ice/BuiltinSequences.ice>
+
+[["java:package:test.Ice.exceptions"]]
+module Test
+{
+
+interface Empty
+{
+};
+
+interface Thrower;
+
+exception A
+{
+ int aMem;
+};
+
+exception B extends A
+{
+ int bMem;
+};
+
+exception C extends B
+{
+ int cMem;
+};
+
+exception D
+{
+ int dMem;
+};
+
+interface Thrower
+{
+ void shutdown();
+ bool supportsUndeclaredExceptions();
+ bool supportsAssertException();
+
+ void throwAasA(int a) throws A;
+ void throwAorDasAorD(int a) throws A, D;
+ void throwBasA(int a, int b) throws A;
+ void throwCasA(int a, int b, int c) throws A;
+ void throwBasB(int a, int b) throws B;
+ void throwCasB(int a, int b, int c) throws B;
+ void throwCasC(int a, int b, int c) throws C;
+
+ void throwUndeclaredA(int a);
+ void throwUndeclaredB(int a, int b);
+ void throwUndeclaredC(int a, int b, int c);
+ void throwLocalException();
+ void throwNonIceException();
+ void throwAssertException();
+ Ice::ByteSeq throwMemoryLimitException(Ice::ByteSeq seq);
+
+ idempotent void throwLocalExceptionIdempotent();
+
+ void throwAfterResponse();
+ void throwAfterException() throws A;
+};
+
+interface WrongOperation
+{
+ void noSuchOperation();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/TestAMD.ice b/java-compat/test/src/main/java/test/Ice/exceptions/TestAMD.ice
new file mode 100644
index 00000000000..d03c7ed7aba
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/exceptions/TestAMD.ice
@@ -0,0 +1,72 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+#include <Ice/BuiltinSequences.ice>
+
+[["java:package:test.Ice.exceptions.AMD"]]
+module Test
+{
+
+interface Thrower;
+
+exception A
+{
+ int aMem;
+};
+
+exception B extends A
+{
+ int bMem;
+};
+
+exception C extends B
+{
+ int cMem;
+};
+
+exception D
+{
+ int dMem;
+};
+
+["amd"] interface Thrower
+{
+ void shutdown();
+ bool supportsUndeclaredExceptions();
+ bool supportsAssertException();
+
+ void throwAasA(int a) throws A;
+ void throwAorDasAorD(int a) throws A, D;
+ void throwBasA(int a, int b) throws A;
+ void throwCasA(int a, int b, int c) throws A;
+ void throwBasB(int a, int b) throws B;
+ void throwCasB(int a, int b, int c) throws B;
+ void throwCasC(int a, int b, int c) throws C;
+ void throwUndeclaredA(int a);
+ void throwUndeclaredB(int a, int b);
+ void throwUndeclaredC(int a, int b, int c);
+ void throwLocalException();
+ void throwNonIceException();
+ void throwAssertException();
+ Ice::ByteSeq throwMemoryLimitException(Ice::ByteSeq seq);
+
+ idempotent void throwLocalExceptionIdempotent();
+
+ void throwAfterResponse();
+ void throwAfterException() throws A;
+};
+
+["amd"] interface WrongOperation
+{
+ void noSuchOperation();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/ThrowerI.java b/java-compat/test/src/main/java/test/Ice/exceptions/ThrowerI.java
new file mode 100644
index 00000000000..ead93773148
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/exceptions/ThrowerI.java
@@ -0,0 +1,201 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.exceptions;
+
+import test.Ice.exceptions.Test.A;
+import test.Ice.exceptions.Test.B;
+import test.Ice.exceptions.Test.C;
+import test.Ice.exceptions.Test.D;
+import test.Ice.exceptions.Test._ThrowerDisp;
+
+public final class ThrowerI extends _ThrowerDisp
+{
+ public
+ ThrowerI()
+ {
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+
+ @Override
+ public boolean
+ supportsUndeclaredExceptions(Ice.Current current)
+ {
+ return false;
+ }
+
+ @Override
+ public boolean
+ supportsAssertException(Ice.Current current)
+ {
+ return true;
+ }
+
+ @Override
+ public void
+ throwAasA(int a, Ice.Current current)
+ throws A
+ {
+ A ex = new A();
+ ex.aMem = a;
+ throw ex;
+ }
+
+ @Override
+ public void
+ throwAorDasAorD(int a, Ice.Current current)
+ throws A,
+ D
+ {
+ if(a > 0)
+ {
+ A ex = new A();
+ ex.aMem = a;
+ throw ex;
+ }
+ else
+ {
+ D ex = new D();
+ ex.dMem = a;
+ throw ex;
+ }
+ }
+
+ @Override
+ public void
+ throwBasA(int a, int b, Ice.Current current)
+ throws A
+ {
+ throwBasB(a, b, current);
+ }
+
+ @Override
+ public void
+ throwBasB(int a, int b, Ice.Current current)
+ throws B
+ {
+ B ex = new B();
+ ex.aMem = a;
+ ex.bMem = b;
+ throw ex;
+ }
+
+ @Override
+ public void
+ throwCasA(int a, int b, int c, Ice.Current current)
+ throws A
+ {
+ throwCasC(a, b, c, current);
+ }
+
+ @Override
+ public void
+ throwCasB(int a, int b, int c, Ice.Current current)
+ throws B
+ {
+ throwCasC(a, b, c, current);
+ }
+
+ @Override
+ public void
+ throwCasC(int a, int b, int c, Ice.Current current)
+ throws C
+ {
+ C ex = new C();
+ ex.aMem = a;
+ ex.bMem = b;
+ ex.cMem = c;
+ throw ex;
+ }
+
+ @Override
+ public void
+ throwUndeclaredA(int a, Ice.Current current)
+ {
+ // Not possible in Java.
+ throw new Ice.UnknownUserException();
+ }
+
+ @Override
+ public void
+ throwUndeclaredB(int a, int b, Ice.Current current)
+ {
+ // Not possible in Java.
+ throw new Ice.UnknownUserException();
+ }
+
+ @Override
+ public void
+ throwUndeclaredC(int a, int b, int c, Ice.Current current)
+ {
+ // Not possible in Java.
+ throw new Ice.UnknownUserException();
+ }
+
+ @Override
+ public void
+ throwLocalException(Ice.Current current)
+ {
+ throw new Ice.TimeoutException();
+ }
+
+ @Override
+ public void
+ throwLocalExceptionIdempotent(Ice.Current current)
+ {
+ throw new Ice.TimeoutException();
+ }
+
+ @Override
+ public void
+ throwNonIceException(Ice.Current current)
+ {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public void
+ throwAssertException(Ice.Current current)
+ {
+ throw new java.lang.AssertionError();
+ }
+
+ @Override
+ public byte[]
+ throwMemoryLimitException(byte[] seq, Ice.Current current)
+ {
+ return new byte[1024 * 20]; // 20KB is over the configured 10KB message size max.
+ }
+
+ @Override
+ public void
+ throwAfterResponse(Ice.Current current)
+ {
+ //
+ // Only relevant for AMD.
+ //
+ }
+
+ @Override
+ public void
+ throwAfterException(Ice.Current current)
+ throws A
+ {
+ //
+ // Only relevant for AMD.
+ //
+ throw new A();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/ValueFactoryI.java b/java-compat/test/src/main/java/test/Ice/exceptions/ValueFactoryI.java
new file mode 100644
index 00000000000..c027b58d883
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/exceptions/ValueFactoryI.java
@@ -0,0 +1,21 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.exceptions;
+
+
+public final class ValueFactoryI implements Ice.ValueFactory
+{
+ @Override
+ public Ice.Object create(String s)
+ {
+ return null;
+ }
+
+}
diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/run.py b/java-compat/test/src/main/java/test/Ice/exceptions/run.py
new file mode 100755
index 00000000000..65b4b4d0e93
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/exceptions/run.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest(configName = "compact", message = "Running test with compact (default) format.")
+
+TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.",
+ additionalClientOptions="--Ice.Default.SlicedFormat",
+ additionalServerOptions="--Ice.Default.SlicedFormat")
+
+TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.",
+ additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
+ additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
+
+TestUtil.queueClientServerTest(configName = "compactAMD", localOnly = True,
+ message = "Running test with compact (default) format and AMD server.",
+ server="test.Ice.exceptions.AMDServer")
+
+TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True,
+ message = "Running test with sliced format and AMD server.",
+ server="test.Ice.exceptions.AMDServer",
+ additionalClientOptions="--Ice.Default.SlicedFormat",
+ additionalServerOptions="--Ice.Default.SlicedFormat")
+
+TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True,
+ message = "Running test with 1.0 encoding and AMD server.",
+ server="test.Ice.exceptions.AMDServer",
+ additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
+ additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
+
+TestUtil.queueCollocatedTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/facets/AI.java b/java-compat/test/src/main/java/test/Ice/facets/AI.java
new file mode 100644
index 00000000000..c3450f404fe
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/facets/AI.java
@@ -0,0 +1,27 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.facets;
+
+import test.Ice.facets.Test._ADisp;
+
+public final class AI extends _ADisp
+{
+ public
+ AI()
+ {
+ }
+
+ @Override
+ public String
+ callA(Ice.Current current)
+ {
+ return "A";
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/facets/AllTests.java b/java-compat/test/src/main/java/test/Ice/facets/AllTests.java
new file mode 100644
index 00000000000..6292a77109f
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/facets/AllTests.java
@@ -0,0 +1,206 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.facets;
+
+import java.io.PrintWriter;
+
+import test.Ice.facets.Test.DPrx;
+import test.Ice.facets.Test.DPrxHelper;
+import test.Ice.facets.Test.FPrx;
+import test.Ice.facets.Test.FPrxHelper;
+import test.Ice.facets.Test.GPrx;
+import test.Ice.facets.Test.GPrxHelper;
+import test.Ice.facets.Test.HPrx;
+import test.Ice.facets.Test.HPrxHelper;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static GPrx
+ allTests(Ice.Communicator communicator, PrintWriter out)
+ {
+ out.print("testing Ice.Admin.Facets property... ");
+ test(communicator.getProperties().getPropertyAsList("Ice.Admin.Facets").length == 0);
+ communicator.getProperties().setProperty("Ice.Admin.Facets", "foobar");
+ String[] facetFilter = communicator.getProperties().getPropertyAsList("Ice.Admin.Facets");
+ test(facetFilter.length == 1 && facetFilter[0].equals("foobar"));
+ communicator.getProperties().setProperty("Ice.Admin.Facets", "foo\\'bar");
+ facetFilter = communicator.getProperties().getPropertyAsList("Ice.Admin.Facets");
+ test(facetFilter.length == 1 && facetFilter[0].equals("foo'bar"));
+ communicator.getProperties().setProperty("Ice.Admin.Facets", "'foo bar' toto 'titi'");
+ facetFilter = communicator.getProperties().getPropertyAsList("Ice.Admin.Facets");
+ test(facetFilter.length == 3 && facetFilter[0].equals("foo bar") && facetFilter[1].equals("toto")
+ && facetFilter[2].equals("titi"));
+ communicator.getProperties().setProperty("Ice.Admin.Facets", "'foo bar\\' toto' 'titi'");
+ facetFilter = communicator.getProperties().getPropertyAsList("Ice.Admin.Facets");
+ test(facetFilter.length == 2 && facetFilter[0].equals("foo bar' toto") && facetFilter[1].equals("titi"));
+ // communicator.getProperties().setProperty("Ice.Admin.Facets", "'foo bar' 'toto titi");
+ // facetFilter = communicator.getProperties().getPropertyAsList("Ice.Admin.Facets");
+ // test(facetFilter.length == 0);
+ communicator.getProperties().setProperty("Ice.Admin.Facets", "");
+ out.println("ok");
+
+ out.print("testing facet registration exceptions... ");
+ communicator.getProperties().setProperty("FacetExceptionTestAdapter.Endpoints", "default");
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("FacetExceptionTestAdapter");
+ Ice.Object obj = new EmptyI();
+ adapter.add(obj, Ice.Util.stringToIdentity("d"));
+ adapter.addFacet(obj, Ice.Util.stringToIdentity("d"), "facetABCD");
+ try
+ {
+ adapter.addFacet(obj, Ice.Util.stringToIdentity("d"), "facetABCD");
+ test(false);
+ }
+ catch(Ice.AlreadyRegisteredException ex)
+ {
+ }
+ adapter.removeFacet(Ice.Util.stringToIdentity("d"), "facetABCD");
+ try
+ {
+ adapter.removeFacet(Ice.Util.stringToIdentity("d"), "facetABCD");
+ test(false);
+ }
+ catch(Ice.NotRegisteredException ex)
+ {
+ }
+ out.println("ok");
+
+ out.print("testing removeAllFacets... ");
+ Ice.Object obj1 = new EmptyI();
+ Ice.Object obj2 = new EmptyI();
+ adapter.addFacet(obj1, Ice.Util.stringToIdentity("id1"), "f1");
+ adapter.addFacet(obj2, Ice.Util.stringToIdentity("id1"), "f2");
+ Ice.Object obj3 = new EmptyI();
+ adapter.addFacet(obj1, Ice.Util.stringToIdentity("id2"), "f1");
+ adapter.addFacet(obj2, Ice.Util.stringToIdentity("id2"), "f2");
+ adapter.addFacet(obj3, Ice.Util.stringToIdentity("id2"), "");
+ java.util.Map<String, Ice.Object> fm = adapter.removeAllFacets(Ice.Util.stringToIdentity("id1"));
+ test(fm.size() == 2);
+ test(fm.get("f1") == obj1);
+ test(fm.get("f2") == obj2);
+ try
+ {
+ adapter.removeAllFacets(Ice.Util.stringToIdentity("id1"));
+ test(false);
+ }
+ catch(Ice.NotRegisteredException ex)
+ {
+ }
+ fm = adapter.removeAllFacets(Ice.Util.stringToIdentity("id2"));
+ test(fm.size() == 3);
+ test(fm.get("f1") == obj1);
+ test(fm.get("f2") == obj2);
+ test(fm.get("") == obj3);
+ out.println("ok");
+
+ adapter.deactivate();
+
+ out.print("testing stringToProxy... ");
+ out.flush();
+ String ref = "d:default -p 12010";
+ Ice.ObjectPrx db = communicator.stringToProxy(ref);
+ test(db != null);
+ out.println("ok");
+
+ out.print("testing unchecked cast... ");
+ out.flush();
+ Ice.ObjectPrx prx = Ice.ObjectPrxHelper.uncheckedCast(db);
+ test(prx.ice_getFacet().length() == 0);
+ prx = Ice.ObjectPrxHelper.uncheckedCast(db, "facetABCD");
+ test(prx.ice_getFacet() == "facetABCD");
+ Ice.ObjectPrx prx2 = Ice.ObjectPrxHelper.uncheckedCast(prx);
+ test(prx2.ice_getFacet() == "facetABCD");
+ Ice.ObjectPrx prx3 = Ice.ObjectPrxHelper.uncheckedCast(prx, "");
+ test(prx3.ice_getFacet().length() == 0);
+ DPrx d = DPrxHelper.uncheckedCast(db);
+ test(d.ice_getFacet().length() == 0);
+ DPrx df = DPrxHelper.uncheckedCast(db, "facetABCD");
+ test(df.ice_getFacet() == "facetABCD");
+ DPrx df2 = DPrxHelper.uncheckedCast(df);
+ test(df2.ice_getFacet() == "facetABCD");
+ DPrx df3 = DPrxHelper.uncheckedCast(df, "");
+ test(df3.ice_getFacet().length() == 0);
+ out.println("ok");
+
+ out.print("testing checked cast... ");
+ out.flush();
+ prx = Ice.ObjectPrxHelper.checkedCast(db);
+ test(prx.ice_getFacet().length() == 0);
+ prx = Ice.ObjectPrxHelper.checkedCast(db, "facetABCD");
+ test(prx.ice_getFacet() == "facetABCD");
+ prx2 = Ice.ObjectPrxHelper.checkedCast(prx);
+ test(prx2.ice_getFacet() == "facetABCD");
+ prx3 = Ice.ObjectPrxHelper.checkedCast(prx, "");
+ test(prx3.ice_getFacet().length() == 0);
+ d = DPrxHelper.checkedCast(db);
+ test(d.ice_getFacet().length() == 0);
+ df = DPrxHelper.checkedCast(db, "facetABCD");
+ test(df.ice_getFacet() == "facetABCD");
+ df2 = DPrxHelper.checkedCast(df);
+ test(df2.ice_getFacet() == "facetABCD");
+ df3 = DPrxHelper.checkedCast(df, "");
+ test(df3.ice_getFacet().length() == 0);
+ out.println("ok");
+
+ out.print("testing non-facets A, B, C, and D... ");
+ out.flush();
+ d = DPrxHelper.checkedCast(db);
+ test(d != null);
+ test(d.equals(db));
+ test(d.callA().equals("A"));
+ test(d.callB().equals("B"));
+ test(d.callC().equals("C"));
+ test(d.callD().equals("D"));
+ out.println("ok");
+
+ out.print("testing facets A, B, C, and D... ");
+ out.flush();
+ df = DPrxHelper.checkedCast(d, "facetABCD");
+ test(df != null);
+ test(df.callA().equals("A"));
+ test(df.callB().equals("B"));
+ test(df.callC().equals("C"));
+ test(df.callD().equals("D"));
+ out.println("ok");
+
+ out.print("testing facets E and F... ");
+ out.flush();
+ FPrx ff = FPrxHelper.checkedCast(d, "facetEF");
+ test(ff != null);
+ test(ff.callE().equals("E"));
+ test(ff.callF().equals("F"));
+ out.println("ok");
+
+ out.print("testing facet G... ");
+ out.flush();
+ GPrx gf = GPrxHelper.checkedCast(ff, "facetGH");
+ test(gf != null);
+ test(gf.callG().equals("G"));
+ out.println("ok");
+
+ out.print("testing whether casting preserves the facet... ");
+ out.flush();
+ HPrx hf = HPrxHelper.checkedCast(gf);
+ test(hf != null);
+ test(hf.callG().equals("G"));
+ test(hf.callH().equals("H"));
+ out.println("ok");
+
+ return gf;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/facets/BI.java b/java-compat/test/src/main/java/test/Ice/facets/BI.java
new file mode 100644
index 00000000000..6bdd538def3
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/facets/BI.java
@@ -0,0 +1,34 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.facets;
+
+import test.Ice.facets.Test._BDisp;
+
+public final class BI extends _BDisp
+{
+ public
+ BI()
+ {
+ }
+
+ @Override
+ public String
+ callA(Ice.Current current)
+ {
+ return "A";
+ }
+
+ @Override
+ public String
+ callB(Ice.Current current)
+ {
+ return "B";
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/facets/CI.java b/java-compat/test/src/main/java/test/Ice/facets/CI.java
new file mode 100644
index 00000000000..66330520219
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/facets/CI.java
@@ -0,0 +1,34 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.facets;
+
+import test.Ice.facets.Test._CDisp;
+
+public final class CI extends _CDisp
+{
+ public
+ CI()
+ {
+ }
+
+ @Override
+ public String
+ callA(Ice.Current current)
+ {
+ return "A";
+ }
+
+ @Override
+ public String
+ callC(Ice.Current current)
+ {
+ return "C";
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/facets/Client.java b/java-compat/test/src/main/java/test/Ice/facets/Client.java
new file mode 100644
index 00000000000..a67a11d734f
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/facets/Client.java
@@ -0,0 +1,41 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.facets;
+
+import test.Ice.facets.Test.GPrx;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ GPrx g = AllTests.allTests(communicator, getWriter());
+ g.shutdown();
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.facets");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/facets/Collocated.java b/java-compat/test/src/main/java/test/Ice/facets/Collocated.java
new file mode 100644
index 00000000000..4d72172d030
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/facets/Collocated.java
@@ -0,0 +1,49 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.facets;
+
+public class Collocated extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.Object d = new DI();
+ adapter.add(d, Ice.Util.stringToIdentity("d"));
+ adapter.addFacet(d, Ice.Util.stringToIdentity("d"), "facetABCD");
+ Ice.Object f = new FI();
+ adapter.addFacet(f, Ice.Util.stringToIdentity("d"), "facetEF");
+ Ice.Object h = new HI(communicator);
+ adapter.addFacet(h, Ice.Util.stringToIdentity("d"), "facetGH");
+
+ AllTests.allTests(communicator, getWriter());
+
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.facets");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Collocated app = new Collocated();
+ int result = app.main("Collocated", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/facets/DI.java b/java-compat/test/src/main/java/test/Ice/facets/DI.java
new file mode 100644
index 00000000000..97b44b0c51d
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/facets/DI.java
@@ -0,0 +1,48 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.facets;
+
+import test.Ice.facets.Test._DDisp;
+
+public final class DI extends _DDisp
+{
+ public
+ DI()
+ {
+ }
+
+ @Override
+ public String
+ callA(Ice.Current current)
+ {
+ return "A";
+ }
+
+ @Override
+ public String
+ callB(Ice.Current current)
+ {
+ return "B";
+ }
+
+ @Override
+ public String
+ callC(Ice.Current current)
+ {
+ return "C";
+ }
+
+ @Override
+ public String
+ callD(Ice.Current current)
+ {
+ return "D";
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/facets/EI.java b/java-compat/test/src/main/java/test/Ice/facets/EI.java
new file mode 100644
index 00000000000..9bb15e5c89b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/facets/EI.java
@@ -0,0 +1,27 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.facets;
+
+import test.Ice.facets.Test._EDisp;
+
+public final class EI extends _EDisp
+{
+ public
+ EI()
+ {
+ }
+
+ @Override
+ public String
+ callE(Ice.Current current)
+ {
+ return "E";
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/facets/EmptyI.java b/java-compat/test/src/main/java/test/Ice/facets/EmptyI.java
new file mode 100644
index 00000000000..bdf78b9c893
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/facets/EmptyI.java
@@ -0,0 +1,16 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.facets;
+
+import test.Ice.facets.Test._EmptyDisp;
+
+public final class EmptyI extends _EmptyDisp
+{
+}
diff --git a/java-compat/test/src/main/java/test/Ice/facets/FI.java b/java-compat/test/src/main/java/test/Ice/facets/FI.java
new file mode 100644
index 00000000000..a5a52615ebe
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/facets/FI.java
@@ -0,0 +1,34 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.facets;
+
+import test.Ice.facets.Test._FDisp;
+
+public final class FI extends _FDisp
+{
+ public
+ FI()
+ {
+ }
+
+ @Override
+ public String
+ callE(Ice.Current current)
+ {
+ return "E";
+ }
+
+ @Override
+ public String
+ callF(Ice.Current current)
+ {
+ return "F";
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/facets/GI.java b/java-compat/test/src/main/java/test/Ice/facets/GI.java
new file mode 100644
index 00000000000..3dcc2575a5e
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/facets/GI.java
@@ -0,0 +1,37 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.facets;
+
+import test.Ice.facets.Test._GDisp;
+
+public final class GI extends _GDisp
+{
+ public
+ GI(Ice.Communicator communicator)
+ {
+ _communicator = communicator;
+ }
+
+ @Override
+ public String
+ callG(Ice.Current current)
+ {
+ return "G";
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ _communicator.shutdown();
+ }
+
+ private Ice.Communicator _communicator;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/facets/HI.java b/java-compat/test/src/main/java/test/Ice/facets/HI.java
new file mode 100644
index 00000000000..760f52b6a70
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/facets/HI.java
@@ -0,0 +1,44 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.facets;
+
+import test.Ice.facets.Test._HDisp;
+
+public final class HI extends _HDisp
+{
+ public
+ HI(Ice.Communicator communicator)
+ {
+ _communicator = communicator;
+ }
+
+ @Override
+ public String
+ callG(Ice.Current current)
+ {
+ return "G";
+ }
+
+ @Override
+ public String
+ callH(Ice.Current current)
+ {
+ return "H";
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ _communicator.shutdown();
+ }
+
+ private Ice.Communicator _communicator;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/facets/Server.java b/java-compat/test/src/main/java/test/Ice/facets/Server.java
new file mode 100644
index 00000000000..533db9e28e3
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/facets/Server.java
@@ -0,0 +1,49 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.facets;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.Object d = new DI();
+ adapter.add(d, Ice.Util.stringToIdentity("d"));
+ adapter.addFacet(d, Ice.Util.stringToIdentity("d"), "facetABCD");
+ Ice.Object f = new FI();
+ adapter.addFacet(f, Ice.Util.stringToIdentity("d"), "facetEF");
+ Ice.Object h = new HI(communicator);
+ adapter.addFacet(h, Ice.Util.stringToIdentity("d"), "facetGH");
+
+ adapter.activate();
+
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.facets");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/facets/Test.ice b/java-compat/test/src/main/java/test/Ice/facets/Test.ice
new file mode 100644
index 00000000000..2dbd24c1fda
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/facets/Test.ice
@@ -0,0 +1,61 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.facets"]]
+module Test
+{
+
+interface Empty
+{
+};
+
+interface A
+{
+ string callA();
+};
+
+interface B extends A
+{
+ string callB();
+};
+
+interface C extends A
+{
+ string callC();
+};
+
+interface D extends B, C
+{
+ string callD();
+};
+
+interface E
+{
+ string callE();
+};
+
+interface F extends E
+{
+ string callF();
+};
+
+interface G
+{
+ void shutdown();
+ string callG();
+};
+
+interface H extends G
+{
+ string callH();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/facets/run.py b/java-compat/test/src/main/java/test/Ice/facets/run.py
new file mode 100755
index 00000000000..97eec95871b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/facets/run.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.queueCollocatedTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/faultTolerance/AllTests.java b/java-compat/test/src/main/java/test/Ice/faultTolerance/AllTests.java
new file mode 100644
index 00000000000..30550745185
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/faultTolerance/AllTests.java
@@ -0,0 +1,328 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.faultTolerance;
+
+import java.io.PrintWriter;
+
+import test.Ice.faultTolerance.Test.TestIntfPrx;
+import test.Ice.faultTolerance.Test.TestIntfPrxHelper;
+import test.Ice.faultTolerance.Test.Callback_TestIntf_pid;
+import test.Ice.faultTolerance.Test.Callback_TestIntf_shutdown;
+
+public class AllTests
+{
+ public static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private static class Callback
+ {
+ Callback()
+ {
+ _called = false;
+ }
+
+ public synchronized void
+ check()
+ {
+ while(!_called)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ _called = false;
+ }
+
+ public synchronized void
+ called()
+ {
+ assert(!_called);
+ _called = true;
+ notify();
+ }
+
+ private boolean _called;
+ }
+
+ private static class Callback_TestIntf_pidI extends Callback_TestIntf_pid
+ {
+ @Override
+ public void
+ response(int pid)
+ {
+ _pid = pid;
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public int
+ pid()
+ {
+ return _pid;
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private int _pid;
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_shutdownI extends Callback_TestIntf_shutdown
+ {
+ @Override
+ public void
+ response()
+ {
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class AbortCallback extends Ice.Callback
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult result)
+ {
+ try
+ {
+ TestIntfPrx p = TestIntfPrxHelper.uncheckedCast(result.getProxy());
+ if(result.getOperation().equals("abort"))
+ {
+ p.end_abort(result);
+ }
+ else if(result.getOperation().equals("idempotentAbort"))
+ {
+ p.end_idempotentAbort(result);
+ }
+ test(false);
+ }
+ catch(Ice.ConnectionLostException exc)
+ {
+ }
+ catch(Ice.ConnectFailedException exc)
+ {
+ }
+ catch(Ice.SocketException exc)
+ {
+ }
+ catch(Exception exc)
+ {
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ public static void
+ allTests(Ice.Communicator communicator, int[] ports, PrintWriter out)
+ {
+ out.print("testing stringToProxy... ");
+ out.flush();
+ String ref = "test";
+ for(int port : ports)
+ {
+ ref += ":default -p " + port;
+ }
+ Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ test(base != null);
+ out.println("ok");
+
+ out.print("testing checked cast... ");
+ out.flush();
+ TestIntfPrx obj = TestIntfPrxHelper.checkedCast(base);
+ test(obj != null);
+ test(obj.equals(base));
+ out.println("ok");
+
+ int oldPid = 0;
+ boolean ami = false;
+ for(int i = 1, j = 0; i <= ports.length; ++i, ++j)
+ {
+ if(j > 3)
+ {
+ j = 0;
+ ami = !ami;
+ }
+
+ if(!ami)
+ {
+ out.print("testing server #" + i + "... ");
+ out.flush();
+ int pid = obj.pid();
+ test(pid != oldPid);
+ out.println("ok");
+ oldPid = pid;
+ }
+ else
+ {
+ out.print("testing server #" + i + " with AMI... ");
+ out.flush();
+ Callback_TestIntf_pidI cb = new Callback_TestIntf_pidI();
+ obj.begin_pid(cb);
+ cb.check();
+ int pid = cb.pid();
+ test(pid != oldPid);
+ out.println("ok");
+ oldPid = pid;
+ }
+
+ if(j == 0)
+ {
+ if(!ami)
+ {
+ out.print("shutting down server #" + i + "... ");
+ out.flush();
+ obj.shutdown();
+ out.println("ok");
+ }
+ else
+ {
+ out.print("shutting down server #" + i + " with AMI... ");
+ out.flush();
+ Callback_TestIntf_shutdownI cb = new Callback_TestIntf_shutdownI();
+ obj.begin_shutdown(cb);
+ cb.check();
+ out.println("ok");
+ }
+ }
+ else if(j == 1 || i + 1 > ports.length)
+ {
+ if(!ami)
+ {
+ out.print("aborting server #" + i + "... ");
+ out.flush();
+ try
+ {
+ obj.abort();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ out.println("ok");
+ }
+ catch(Ice.ConnectFailedException exc)
+ {
+ out.println("ok");
+ }
+ catch(Ice.SocketException ex)
+ {
+ out.println("ok");
+ }
+ }
+ else
+ {
+ out.print("aborting server #" + i + " with AMI... ");
+ out.flush();
+ AbortCallback cb = new AbortCallback();
+ obj.begin_abort(cb);
+ cb.check();
+ out.println("ok");
+ }
+ }
+ else if(j == 2 || j == 3)
+ {
+ if(!ami)
+ {
+ out.print("aborting server #" + i + " and #" + (i + 1) + " with idempotent call... ");
+ out.flush();
+ try
+ {
+ obj.idempotentAbort();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ out.println("ok");
+ }
+ catch(Ice.ConnectFailedException exc)
+ {
+ out.println("ok");
+ }
+ catch(Ice.SocketException ex)
+ {
+ out.println("ok");
+ }
+ }
+ else
+ {
+ out.print("aborting server #" + i + " and #" + (i + 1) + " with idempotent AMI call... ");
+ out.flush();
+ AbortCallback cb = new AbortCallback();
+ obj.begin_idempotentAbort(cb);
+ cb.check();
+ out.println("ok");
+ }
+
+ ++i;
+ }
+ else
+ {
+ assert(false);
+ }
+ }
+
+ out.print("testing whether all servers are gone... ");
+ out.flush();
+ try
+ {
+ obj.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ out.println("ok");
+ }
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/faultTolerance/Client.java b/java-compat/test/src/main/java/test/Ice/faultTolerance/Client.java
new file mode 100644
index 00000000000..9a350872820
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/faultTolerance/Client.java
@@ -0,0 +1,105 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.faultTolerance;
+
+import java.io.PrintWriter;
+
+
+public class Client extends test.Util.Application
+{
+ private static void
+ usage()
+ {
+ System.err.println("Usage: Client port...");
+ }
+
+ @Override
+ public int
+ run(String[] args)
+ {
+ PrintWriter out = getWriter();
+
+ Ice.Communicator communicator = communicator();
+ java.util.List<Integer> ports = new java.util.ArrayList<Integer>(args.length);
+ for(String arg : args)
+ {
+ if(arg.charAt(0) == '-')
+ {
+ //
+ // TODO: Arguments recognized by the communicator are not
+ // removed from the argument list.
+ //
+ //System.err.println("Client: unknown option `" + arg + "'");
+ //usage();
+ //return 1;
+ continue;
+ }
+
+ int port = 0;
+ try
+ {
+ port = Integer.parseInt(arg);
+ }
+ catch(NumberFormatException ex)
+ {
+ ex.printStackTrace();
+ return 1;
+ }
+ ports.add(port);
+ }
+
+ if(ports.isEmpty())
+ {
+ out.println("Client: no ports specified");
+ usage();
+ return 1;
+ }
+
+ int[] arr = new int[ports.size()];
+ for(int i = 0; i < arr.length; i++)
+ {
+ arr[i] = ports.get(i).intValue();
+ }
+
+ try
+ {
+ AllTests.allTests(communicator, arr, out);
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ AllTests.test(false);
+ }
+
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.faultTolerance");
+ //
+ // This test aborts servers, so we don't want warnings.
+ //
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/faultTolerance/Server.java b/java-compat/test/src/main/java/test/Ice/faultTolerance/Server.java
new file mode 100644
index 00000000000..56e4041a168
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/faultTolerance/Server.java
@@ -0,0 +1,91 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.faultTolerance;
+
+import java.io.PrintWriter;
+
+public class Server extends test.Util.Application
+{
+ private static void
+ usage()
+ {
+ System.err.println("Usage: Server port");
+ }
+
+ @Override
+ public int
+ run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ int port = 0;
+ PrintWriter out = getWriter();
+ for(String arg : args)
+ {
+ if(arg.charAt(0) == '-')
+ {
+ out.println("Server: unknown option `" + arg + "'");
+ usage();
+ return 1;
+ }
+
+ if(port > 0)
+ {
+ out.println("Server: only one port can be specified");
+ usage();
+ return 1;
+ }
+
+ try
+ {
+ port = Integer.parseInt(arg);
+ }
+ catch(NumberFormatException ex)
+ {
+ out.println("Server: invalid port");
+ usage();
+ return 1;
+ }
+ }
+
+ if(port <= 0)
+ {
+ out.println("Server: no port specified");
+ usage();
+ return 1;
+ }
+
+ // Don't move this, it needs the port.
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p " + port + ":udp");
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.Object object = new TestI(port);
+ adapter.add(object, Ice.Util.stringToIdentity("test"));
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.faultTolerance");
+ // Two minutes.
+ initData.properties.setProperty("Ice.ServerIdleTime", "120");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/faultTolerance/Test.ice b/java-compat/test/src/main/java/test/Ice/faultTolerance/Test.ice
new file mode 100644
index 00000000000..ec83025357c
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/faultTolerance/Test.ice
@@ -0,0 +1,24 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.faultTolerance"]]
+module Test
+{
+
+interface TestIntf
+{
+ void shutdown();
+ void abort();
+ idempotent void idempotentAbort();
+ idempotent int pid();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/faultTolerance/TestI.java b/java-compat/test/src/main/java/test/Ice/faultTolerance/TestI.java
new file mode 100644
index 00000000000..65db720e938
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/faultTolerance/TestI.java
@@ -0,0 +1,51 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.faultTolerance;
+
+import test.Ice.faultTolerance.Test._TestIntfDisp;
+
+public final class TestI extends _TestIntfDisp
+{
+ public
+ TestI(int port)
+ {
+ _pseudoPid = port; // We use the port number instead of the process ID in Java.
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+
+ @Override
+ public void
+ abort(Ice.Current current)
+ {
+ Runtime.getRuntime().halt(0);
+ }
+
+ @Override
+ public void
+ idempotentAbort(Ice.Current current)
+ {
+ Runtime.getRuntime().halt(0);
+ }
+
+ @Override
+ public int
+ pid(Ice.Current current)
+ {
+ return _pseudoPid;
+ }
+
+ private int _pseudoPid;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/faultTolerance/run.py b/java-compat/test/src/main/java/test/Ice/faultTolerance/run.py
new file mode 100755
index 00000000000..f3e808802b0
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/faultTolerance/run.py
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+num = 12
+base = 12340
+
+serverProc = []
+for i in range(0, num):
+ sys.stdout.write("starting server #%d... " % (i + 1))
+ sys.stdout.flush()
+ serverProc.append(TestUtil.startServer("test.Ice.faultTolerance.Server", " %d" % (base + i)))
+ print("ok")
+
+ports = ""
+for i in range(0, num):
+ ports = "%s %d" % (ports, base + i)
+sys.stdout.write("starting client... ")
+sys.stdout.flush()
+clientProc = TestUtil.startClient("test.Ice.faultTolerance.Client", ports, startReader=False)
+print("ok")
+clientProc.startReader()
+
+clientProc.waitTestSuccess()
+for p in serverProc:
+ p.waitTestSuccess()
diff --git a/java-compat/test/src/main/java/test/Ice/hash/Client.java b/java-compat/test/src/main/java/test/Ice/hash/Client.java
new file mode 100644
index 00000000000..7859559f9ad
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/hash/Client.java
@@ -0,0 +1,445 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.hash;
+
+import java.io.PrintWriter;
+
+import test.Ice.hash.Test.*;
+
+public class Client extends test.Util.Application
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+
+ @Override
+ public int run(String[] args)
+ {
+ PrintWriter out = getWriter();
+ int status = 0;
+ try
+ {
+ java.util.Map<Integer, Ice.ObjectPrx> seenProxy = new java.util.HashMap<Integer, Ice.ObjectPrx>();
+ java.util.Map<Integer, Ice.Endpoint> seenEndpoint = new java.util.HashMap<Integer, Ice.Endpoint>();
+ int proxyCollisions = 0;
+ int endpointCollisions = 0;
+ int i = 0;
+ int maxCollisions = 10;
+ int maxIterations = 10000;
+
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(args);
+ initData.properties.setProperty("Ice.Plugin.IceSSL", "IceSSL.PluginFactory");
+ Ice.Communicator communicator = Ice.Util.initialize(args, initData);
+
+ out.print("testing proxy & endpoint hash algorithm collisions... ");
+ out.flush();
+ {
+ java.util.Random rand = new java.util.Random();
+ for(i = 0; proxyCollisions < maxCollisions &&
+ endpointCollisions < maxCollisions &&
+ i < maxIterations; ++i)
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ sw.write(Integer.toString(i));
+ sw.write(":tcp -p ");
+ sw.write(Integer.toString(rand.nextInt(65536)));
+ sw.write(" -t 10");
+ sw.write(Integer.toString(rand.nextInt(1000000)));
+ sw.write(":udp -p ");
+ sw.write(Integer.toString(rand.nextInt(65536)));
+ sw.write(" -h ");
+ sw.write(Integer.toString(rand.nextInt(100)));
+
+ Ice.ObjectPrx obj = communicator.stringToProxy(sw.toString());
+ java.util.List<Ice.Endpoint> endpoints = new java.util.ArrayList<Ice.Endpoint>(java.util.Arrays.asList(obj.ice_getEndpoints()));
+ if(seenProxy.containsKey(obj.hashCode()))
+ {
+ if(obj.equals(seenProxy.get(obj.hashCode())))
+ {
+ continue; // Same object
+ }
+ ++proxyCollisions;
+ }
+ else
+ {
+ seenProxy.put(obj.hashCode(), obj);
+ }
+
+ java.util.Iterator<Ice.Endpoint> j = endpoints.iterator();
+ while(j.hasNext())
+ {
+ Ice.Endpoint endpoint = j.next();
+ if(seenEndpoint.containsKey(endpoint.hashCode()))
+ {
+ if(endpoint.equals(seenEndpoint.get(endpoint.hashCode())))
+ {
+ continue; // Same endpoint
+ }
+ ++endpointCollisions;
+ }
+ else
+ {
+ seenEndpoint.put(endpoint.hashCode(), endpoint);
+ }
+ //
+ // Check the same endpoint produce always the same hash
+ //
+ test(endpoint.hashCode() == endpoint.hashCode());
+ }
+ //
+ // Check the same proxy produce always the same hash
+ //
+ test(obj.hashCode() == obj.hashCode());
+ }
+ test(proxyCollisions < maxCollisions);
+ test(endpointCollisions < maxCollisions);
+
+ proxyCollisions = 0;
+ seenProxy = new java.util.HashMap<Integer, Ice.ObjectPrx>();
+ for(i = 0; proxyCollisions < maxCollisions &&
+ endpointCollisions < maxCollisions &&
+ i < maxIterations; ++i)
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ sw.write(Integer.toString(i));
+ sw.write(":tcp -p ");
+ sw.write(Integer.toString(rand.nextInt(65536)));
+ sw.write(" -t 10");
+ sw.write(Integer.toString(rand.nextInt(1000000)));
+ sw.write(":udp -p ");
+ sw.write(Integer.toString(rand.nextInt(65536)));
+ sw.write(" -h ");
+ sw.write(Integer.toString(rand.nextInt(100)));
+
+ Ice.ProxyIdentityKey obj = new Ice.ProxyIdentityKey(communicator.stringToProxy(sw.toString()));
+ if(seenProxy.containsKey(obj.hashCode()))
+ {
+ ++proxyCollisions;
+ }
+ else
+ {
+ seenProxy.put(obj.hashCode(), obj.getProxy());
+ }
+ //
+ // Check the same proxy produce always the same hash
+ //
+ test(obj.hashCode() == obj.hashCode());
+ }
+ test(proxyCollisions < maxCollisions);
+
+ proxyCollisions = 0;
+ seenProxy = new java.util.HashMap<Integer, Ice.ObjectPrx>();
+ for(i = 0; proxyCollisions < maxCollisions &&
+ endpointCollisions < maxCollisions &&
+ i < maxIterations; ++i)
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ sw.write(Integer.toString(i));
+ sw.write(":tcp -p ");
+ sw.write(Integer.toString(rand.nextInt(65536)));
+ sw.write(" -t 10");
+ sw.write(Integer.toString(rand.nextInt(1000000)));
+ sw.write(":udp -p ");
+ sw.write(Integer.toString(rand.nextInt(65536)));
+ sw.write(" -h ");
+ sw.write(Integer.toString(rand.nextInt(100)));
+
+ Ice.ProxyIdentityFacetKey obj = new Ice.ProxyIdentityFacetKey(communicator.stringToProxy(sw.toString()));
+ if(seenProxy.containsKey(obj.hashCode()))
+ {
+ ++proxyCollisions;
+ }
+ else
+ {
+ seenProxy.put(obj.hashCode(), obj.getProxy());
+ }
+ //
+ // Check the same proxy produce always the same hash
+ //
+ test(obj.hashCode() == obj.hashCode());
+ }
+ test(proxyCollisions < maxCollisions);
+
+ Ice.ObjectPrx prx1 = communicator.stringToProxy("Glacier2/router:tcp -p 10010");
+ Ice.ObjectPrx prx2 = communicator.stringToProxy("Glacier2/router:ssl -p 10011");
+ Ice.ObjectPrx prx3 = communicator.stringToProxy("Glacier2/router:udp -p 10012");
+ Ice.ObjectPrx prx4 = communicator.stringToProxy("Glacier2/router:tcp -h zeroc.com -p 10010");
+ Ice.ObjectPrx prx5 = communicator.stringToProxy("Glacier2/router:ssl -h zeroc.com -p 10011");
+ Ice.ObjectPrx prx6 = communicator.stringToProxy("Glacier2/router:udp -h zeroc.com -p 10012");
+ Ice.ObjectPrx prx7 = communicator.stringToProxy("Glacier2/router:tcp -p 10010 -t 10000");
+ Ice.ObjectPrx prx8 = communicator.stringToProxy("Glacier2/router:ssl -p 10011 -t 10000");
+ Ice.ObjectPrx prx9 = communicator.stringToProxy("Glacier2/router:tcp -h zeroc.com -p 10010 -t 10000");
+ Ice.ObjectPrx prx10 = communicator.stringToProxy("Glacier2/router:ssl -h zeroc.com -p 10011 -t 10000");
+
+ java.util.Map<String, Integer> proxyMap = new java.util.HashMap<String, Integer>();
+ proxyMap.put("prx1", prx1.hashCode());
+ proxyMap.put("prx2", prx2.hashCode());
+ proxyMap.put("prx3", prx3.hashCode());
+ proxyMap.put("prx4", prx4.hashCode());
+ proxyMap.put("prx5", prx5.hashCode());
+ proxyMap.put("prx6", prx6.hashCode());
+ proxyMap.put("prx7", prx7.hashCode());
+ proxyMap.put("prx8", prx8.hashCode());
+ proxyMap.put("prx9", prx9.hashCode());
+ proxyMap.put("prx10", prx10.hashCode());
+
+ test(communicator.stringToProxy("Glacier2/router:tcp -p 10010").hashCode() == proxyMap.get("prx1"));
+ test(communicator.stringToProxy("Glacier2/router:ssl -p 10011").hashCode() == proxyMap.get("prx2"));
+ test(communicator.stringToProxy("Glacier2/router:udp -p 10012").hashCode() == proxyMap.get("prx3"));
+ test(communicator.stringToProxy("Glacier2/router:tcp -h zeroc.com -p 10010").hashCode() == proxyMap.get("prx4"));
+ test(communicator.stringToProxy("Glacier2/router:ssl -h zeroc.com -p 10011").hashCode() == proxyMap.get("prx5"));
+ test(communicator.stringToProxy("Glacier2/router:udp -h zeroc.com -p 10012").hashCode() == proxyMap.get("prx6"));
+ test(communicator.stringToProxy("Glacier2/router:tcp -p 10010 -t 10000").hashCode() == proxyMap.get("prx7"));
+ test(communicator.stringToProxy("Glacier2/router:ssl -p 10011 -t 10000").hashCode() == proxyMap.get("prx8"));
+ test(communicator.stringToProxy("Glacier2/router:tcp -h zeroc.com -p 10010 -t 10000").hashCode() == proxyMap.get("prx9"));
+ test(communicator.stringToProxy("Glacier2/router:ssl -h zeroc.com -p 10011 -t 10000").hashCode() == proxyMap.get("prx10"));
+
+ test(new Ice.ProxyIdentityKey(prx1).hashCode() == new Ice.ProxyIdentityKey(prx1).hashCode());
+ test(new Ice.ProxyIdentityFacetKey(prx1).hashCode() == new Ice.ProxyIdentityFacetKey(prx1).hashCode());
+
+ test(new Ice.ProxyIdentityKey(prx1).hashCode() == new Ice.ProxyIdentityKey(prx2).hashCode());
+ test(new Ice.ProxyIdentityFacetKey(prx1).hashCode() == new Ice.ProxyIdentityFacetKey(prx2).hashCode());
+
+ test(new Ice.ProxyIdentityKey(prx1).hashCode() == new Ice.ProxyIdentityKey(prx3).hashCode());
+ test(new Ice.ProxyIdentityFacetKey(prx1).hashCode() == new Ice.ProxyIdentityFacetKey(prx3).hashCode());
+
+ test(new Ice.ProxyIdentityKey(prx1).hashCode() == new Ice.ProxyIdentityKey(prx4).hashCode());
+ test(new Ice.ProxyIdentityFacetKey(prx1).hashCode() == new Ice.ProxyIdentityFacetKey(prx4).hashCode());
+
+ test(new Ice.ProxyIdentityKey(prx1).hashCode() == new Ice.ProxyIdentityKey(prx5).hashCode());
+ test(new Ice.ProxyIdentityFacetKey(prx1).hashCode() == new Ice.ProxyIdentityFacetKey(prx5).hashCode());
+
+ test(new Ice.ProxyIdentityKey(prx1).hashCode() == new Ice.ProxyIdentityKey(prx6).hashCode());
+ test(new Ice.ProxyIdentityFacetKey(prx1).hashCode() == new Ice.ProxyIdentityFacetKey(prx6).hashCode());
+
+ test(new Ice.ProxyIdentityKey(prx1).hashCode() == new Ice.ProxyIdentityKey(prx7).hashCode());
+ test(new Ice.ProxyIdentityFacetKey(prx1).hashCode() == new Ice.ProxyIdentityFacetKey(prx7).hashCode());
+
+ test(new Ice.ProxyIdentityKey(prx1).hashCode() == new Ice.ProxyIdentityKey(prx8).hashCode());
+ test(new Ice.ProxyIdentityFacetKey(prx1).hashCode() == new Ice.ProxyIdentityFacetKey(prx8).hashCode());
+
+ test(new Ice.ProxyIdentityKey(prx1).hashCode() == new Ice.ProxyIdentityKey(prx9).hashCode());
+ test(new Ice.ProxyIdentityFacetKey(prx1).hashCode() == new Ice.ProxyIdentityFacetKey(prx9).hashCode());
+
+ test(new Ice.ProxyIdentityKey(prx1).hashCode() == new Ice.ProxyIdentityKey(prx10).hashCode());
+ test(new Ice.ProxyIdentityFacetKey(prx1).hashCode() == new Ice.ProxyIdentityFacetKey(prx10).hashCode());
+ }
+
+ out.println("ok");
+
+ out.print("testing struct hash algorithm collisions... ");
+ out.flush();
+ {
+ java.util.Map<Integer, PointF> seenPointF = new java.util.HashMap<Integer, PointF>();
+ java.util.Random rand = new java.util.Random();
+ int structCollisions = 0;
+ for(i = 0; i < maxIterations && structCollisions < maxCollisions; ++i)
+ {
+ PointF pf = new PointF(rand.nextFloat(), rand.nextFloat(), rand.nextFloat());
+ if(seenPointF.containsKey(pf.hashCode()))
+ {
+ if(pf.equals(seenPointF.get(pf.hashCode())))
+ {
+ continue; // same object
+ }
+ structCollisions++;
+ }
+ else
+ {
+ seenPointF.put(pf.hashCode(), pf);
+ }
+ //
+ // Check the same struct produce always the same hash
+ //
+ test(pf.hashCode() == pf.hashCode());
+ }
+ test(structCollisions < maxCollisions);
+
+ java.util.Map<Integer, PointD> seenPointD = new java.util.HashMap<Integer, PointD>();
+ rand = new java.util.Random();
+ structCollisions = 0;
+ for(i = 0; i < maxIterations && structCollisions < maxCollisions; ++i)
+ {
+ PointD pd = new PointD(rand.nextDouble(), rand.nextDouble(), rand.nextDouble());
+ if(seenPointD.containsKey(pd.hashCode()))
+ {
+ if(pd.equals(seenPointF.get(pd.hashCode())))
+ {
+ continue; // same object
+ }
+ structCollisions++;
+ }
+ else
+ {
+ seenPointD.put(pd.hashCode(), pd);
+ }
+ //
+ // Check the same struct produce always the same hash
+ //
+ test(pd.hashCode() == pd.hashCode());
+ }
+ test(structCollisions < maxCollisions);
+
+ java.util.Map<Integer, Polyline> seenPolyline = new java.util.HashMap<Integer, Polyline>();
+ structCollisions = 0;
+ for(i = 0; i < maxIterations && structCollisions < maxCollisions; ++i)
+ {
+ Polyline polyline = new Polyline();
+ java.util.List<Point> vertices = new java.util.ArrayList<Point>();
+ for(int j = 0; j < 100; ++j)
+ {
+ vertices.add(new Point(rand.nextInt(100), rand.nextInt(100)));
+ }
+ polyline.vertices = new Point[vertices.size()];
+ vertices.toArray(polyline.vertices);
+
+ if(seenPolyline.containsKey(polyline.hashCode()))
+ {
+ if(polyline.equals(seenPolyline.get(polyline.hashCode())))
+ {
+ continue; // same object
+ }
+ structCollisions++;
+ }
+ else
+ {
+ seenPolyline.put(polyline.hashCode(), polyline);
+ }
+ //
+ // Check the same struct produce always the same hash
+ //
+ test(polyline.hashCode() == polyline.hashCode());
+ }
+ test(structCollisions < maxCollisions);
+
+ java.util.Map<Integer, ColorPalette> seenColorPalette = new java.util.HashMap<Integer, ColorPalette>();
+ structCollisions = 0;
+ for(i = 0; i < maxIterations && structCollisions < maxCollisions; ++i)
+ {
+ ColorPalette colorPalette = new ColorPalette();
+ colorPalette.colors = new java.util.HashMap<Integer, Color>();
+ for(int j = 0; j < 100; ++j)
+ {
+ colorPalette.colors.put(j, new Color(rand.nextInt(255), rand.nextInt(255), rand.nextInt(255), rand.nextInt(255)));
+ }
+
+ if(seenColorPalette.containsKey(colorPalette.hashCode()))
+ {
+ if(colorPalette.equals(seenColorPalette.get(colorPalette.hashCode())))
+ {
+ continue; // same object
+ }
+ structCollisions++;
+ }
+ else
+ {
+ seenColorPalette.put(colorPalette.hashCode(), colorPalette);
+ }
+ //
+ // Check the same struct produce always the same hash
+ //
+ test(colorPalette.hashCode() == colorPalette.hashCode());
+ }
+ test(structCollisions < maxCollisions);
+
+ java.util.Map<Integer, Color> seenColor = new java.util.HashMap<Integer, Color>();
+ rand = new java.util.Random();
+ structCollisions = 0;
+ for(i = 0; i < maxIterations && structCollisions < maxCollisions; ++i)
+ {
+ Color c = new Color(rand.nextInt(255), rand.nextInt(255), rand.nextInt(255), rand.nextInt(255));
+ if(seenColor.containsKey(c.hashCode()))
+ {
+ if(c.equals(seenColor.get(c.hashCode())))
+ {
+ continue; // same object
+ }
+ structCollisions++;
+ }
+ else
+ {
+ seenColor.put(c.hashCode(), c);
+ }
+ //
+ // Check the same struct produce always the same hash
+ //
+ test(c.hashCode() == c.hashCode());
+ }
+ test(structCollisions < maxCollisions);
+
+ structCollisions = 0;
+ java.util.Map<Integer, Draw> seenDraw = new java.util.HashMap<Integer, Draw>();
+ structCollisions = 0;
+ for(i = 0; i < maxIterations && structCollisions < maxCollisions; ++i)
+ {
+ Draw draw = new Draw(
+ new Color(rand.nextInt(255), rand.nextInt(255), rand.nextInt(255), rand.nextInt(255)),
+ new Pen(rand.nextInt(10),
+ new Color(rand.nextInt(255), rand.nextInt(255), rand.nextInt(255), rand.nextInt(255))),
+ false);
+
+ if(seenDraw.containsKey(draw.hashCode()))
+ {
+ if(draw.equals(seenDraw.get(draw.hashCode())))
+ {
+ continue; // same object
+ }
+ structCollisions++;
+ }
+ else
+ {
+ seenDraw.put(draw.hashCode(), draw);
+ }
+ //
+ // Check the same struct produce always the same hash
+ //
+ test(draw.hashCode() == draw.hashCode());
+ }
+ test(structCollisions < maxCollisions);
+ }
+ out.println("ok");
+
+ if(communicator != null)
+ {
+ try
+ {
+ communicator.destroy();
+ }
+ catch(Ice.LocalException ex)
+ {
+ System.out.println(ex.toString());
+ status = 1;
+ }
+ }
+ }
+ catch(Exception ex)
+ {
+ System.out.println(ex.toString());
+ status = 1;
+ }
+ return status;
+ }
+}
+
diff --git a/java-compat/test/src/main/java/test/Ice/hash/Test.ice b/java-compat/test/src/main/java/test/Ice/hash/Test.ice
new file mode 100644
index 00000000000..39ec6015c24
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/hash/Test.ice
@@ -0,0 +1,72 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.hash"]]
+module Test
+{
+
+struct PointF
+{
+ float x;
+ float y;
+ float z;
+};
+
+struct PointD
+{
+ double x;
+ double y;
+ double z;
+};
+
+struct Point
+{
+ int x;
+ int y;
+};
+sequence<Point> Points;
+
+struct Polyline
+{
+ Points vertices;
+};
+
+struct Color
+{
+ int r;
+ int g;
+ int b;
+ int a;
+};
+
+
+dictionary<int, Color> StringColorMap;
+
+struct ColorPalette
+{
+ StringColorMap colors;
+};
+
+class Pen
+{
+ int thickness;
+ Test::Color color;
+};
+
+struct Draw
+{
+ Test::Color backgroundColor;
+ Test::Pen pen;
+ bool shared;
+};
+
+};
+
diff --git a/java-compat/test/src/main/java/test/Ice/hash/run.py b/java-compat/test/src/main/java/test/Ice/hash/run.py
new file mode 100755
index 00000000000..5175a3d1877
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/hash/run.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+TestUtil.simpleTest("test.Ice.hash.Client")
+
diff --git a/java-compat/test/src/main/java/test/Ice/hold/AllTests.java b/java-compat/test/src/main/java/test/Ice/hold/AllTests.java
new file mode 100644
index 00000000000..1086e9a5875
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/hold/AllTests.java
@@ -0,0 +1,239 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.hold;
+
+import java.io.PrintWriter;
+
+import test.Ice.hold.Test.HoldPrx;
+import test.Ice.hold.Test.HoldPrxHelper;
+import test.Ice.hold.Test.Callback_Hold_set;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ static class Condition
+ {
+ public Condition(boolean value)
+ {
+ _value = value;
+ }
+
+ synchronized public void
+ set(boolean value)
+ {
+ _value = value;
+ }
+
+ synchronized boolean
+ value()
+ {
+ return _value;
+ }
+
+ private boolean _value;
+ };
+
+ static class AMICheckSetValue extends Callback_Hold_set
+ {
+ public
+ AMICheckSetValue(Condition condition, int expected)
+ {
+ _condition = condition;
+ _expected = expected;
+ }
+
+ @Override
+ public void
+ response(int value)
+ {
+ if(value != _expected)
+ {
+ _condition.set(false);
+ }
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ }
+
+ @Override
+ synchronized public void
+ sent(boolean sync)
+ {
+ }
+
+ private Condition _condition;
+ private int _expected;
+ };
+
+ public static void
+ allTests(test.Util.Application app, PrintWriter out)
+ {
+ Ice.Communicator communicator = app.communicator();
+ out.print("testing stringToProxy... ");
+ out.flush();
+ String ref = "hold:default -p 12010";
+ Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ test(base != null);
+ String refSerialized = "hold:default -p 12011";
+ Ice.ObjectPrx baseSerialized = communicator.stringToProxy(refSerialized);
+ test(baseSerialized != null);
+ out.println("ok");
+
+ out.print("testing checked cast... ");
+ out.flush();
+ HoldPrx hold = HoldPrxHelper.checkedCast(base);
+ HoldPrx holdOneway = HoldPrxHelper.uncheckedCast(base.ice_oneway());
+ test(hold != null);
+ test(hold.equals(base));
+ HoldPrx holdSerialized = HoldPrxHelper.checkedCast(baseSerialized);
+ HoldPrx holdSerializedOneway = HoldPrxHelper.uncheckedCast(baseSerialized.ice_oneway());
+ test(holdSerialized != null);
+ test(holdSerialized.equals(baseSerialized));
+ out.println("ok");
+
+ out.print("changing state between active and hold rapidly... ");
+ out.flush();
+ for(int i = 0; i < 100; ++i)
+ {
+ hold.putOnHold(0);
+ }
+ for(int i = 0; i < 100; ++i)
+ {
+ holdOneway.putOnHold(0);
+ }
+ for(int i = 0; i < 100; ++i)
+ {
+ holdSerialized.putOnHold(0);
+ }
+ for(int i = 0; i < 100; ++i)
+ {
+ holdSerializedOneway.putOnHold(0);
+ }
+ out.println("ok");
+
+ out.print("testing without serialize mode... ");
+ out.flush();
+ java.util.Random random = new java.util.Random();
+ {
+ Condition cond = new Condition(true);
+ int value = 0;
+ Ice.AsyncResult result = null;
+ while(cond.value())
+ {
+ result = hold.begin_set(value + 1, random.nextInt(5), new AMICheckSetValue(cond, value));
+ ++value;
+ if(value % 100 == 0)
+ {
+ result.waitForSent();
+ }
+
+ if(value > 1000000)
+ {
+ // Don't continue, it's possible that out-of-order dispatch doesn't occur
+ // after 100000 iterations and we don't want the test to last for too long
+ // when this occurs.
+ break;
+ }
+ }
+ test(value > 100000 || !cond.value());
+ result.waitForCompleted();
+ }
+ out.println("ok");
+
+ out.print("testing with serialize mode... ");
+ out.flush();
+ {
+ Condition cond = new Condition(true);
+ int value = 0;
+ Ice.AsyncResult result = null;
+ while(value < 3000 && cond.value())
+ {
+ result = holdSerialized.begin_set(value + 1, random.nextInt(1), new AMICheckSetValue(cond, value));
+ ++value;
+ if(value % 100 == 0)
+ {
+ result.waitForSent();
+ }
+ }
+ result.waitForCompleted();
+ test(cond.value());
+
+ for(int i = 0; i < 10000; ++i)
+ {
+ holdSerializedOneway.setOneway(value + 1, value);
+ ++value;
+ if((i % 100) == 0)
+ {
+ holdSerializedOneway.putOnHold(1);
+ }
+ }
+ }
+ out.println("ok");
+
+ out.print("testing serialization... ");
+ out.flush();
+ {
+ int value = 0;
+ holdSerialized.set(value, 0);
+ Ice.AsyncResult result = null;
+ int max = app.isAndroid() ? 5000 : 10000;
+ for(int i = 0; i < max; ++i)
+ {
+ // Create a new proxy for each request
+ result = ((HoldPrx)holdSerialized.ice_oneway()).begin_setOneway(value + 1, value);
+ ++value;
+ if((i % 100) == 0)
+ {
+ result.waitForSent();
+ holdSerialized.ice_ping(); // Ensure everything's dispatched
+ holdSerialized.ice_getConnection().close(false);
+ }
+ }
+ result.waitForCompleted();
+ }
+ out.println("ok");
+
+ out.print("testing waitForHold... ");
+ out.flush();
+ {
+ hold.waitForHold();
+ hold.waitForHold();
+ for(int i = 0; i < 1000; ++i)
+ {
+ holdOneway.ice_ping();
+ if((i % 20) == 0)
+ {
+ hold.putOnHold(0);
+ }
+ }
+ hold.putOnHold(-1);
+ hold.ice_ping();
+ hold.putOnHold(-1);
+ hold.ice_ping();
+ }
+ out.println("ok");
+
+ out.print("changing state to hold and shutting down server... ");
+ out.flush();
+ hold.shutdown();
+ out.println("ok");
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/hold/Client.java b/java-compat/test/src/main/java/test/Ice/hold/Client.java
new file mode 100644
index 00000000000..28c45f9aa08
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/hold/Client.java
@@ -0,0 +1,37 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.hold;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ AllTests.allTests(this, getWriter());
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.hold");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/hold/HoldI.java b/java-compat/test/src/main/java/test/Ice/hold/HoldI.java
new file mode 100644
index 00000000000..6fbef57a5d5
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/hold/HoldI.java
@@ -0,0 +1,133 @@
+
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.hold;
+
+import test.Ice.hold.Test._HoldDisp;
+
+public final class HoldI extends _HoldDisp
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ HoldI(java.util.Timer timer, Ice.ObjectAdapter adapter)
+ {
+ _timer = timer;
+ _adapter = adapter;
+ _last = 0;
+ }
+
+ @Override
+ public void
+ putOnHold(int milliSeconds, Ice.Current current)
+ {
+ if(milliSeconds < 0)
+ {
+ _adapter.hold();
+ }
+ else if(milliSeconds == 0)
+ {
+ _adapter.hold();
+ _adapter.activate();
+ }
+ else
+ {
+ _timer.schedule(new java.util.TimerTask()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ putOnHold(0, null);
+ }
+ catch(Ice.ObjectAdapterDeactivatedException ex)
+ {
+ }
+ }
+ }, milliSeconds);
+ }
+ }
+
+ @Override
+ public void
+ waitForHold(final Ice.Current current)
+ {
+ _timer.schedule(new java.util.TimerTask()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ current.adapter.waitForHold();
+
+ current.adapter.activate();
+ }
+ catch(Ice.ObjectAdapterDeactivatedException ex)
+ {
+ //
+ // This shouldn't occur. The test ensures all the
+ // waitForHold timers are
+ // finished before shutting down the communicator.
+ //
+ test(false);
+ }
+ }
+ }, 0);
+ }
+
+
+ @Override
+ public int
+ set(int value, int delay, Ice.Current current)
+ {
+ try
+ {
+ Thread.sleep(delay);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+
+ synchronized(this)
+ {
+ int tmp = _last;
+ _last = value;
+ return tmp;
+ }
+ }
+
+ @Override
+ synchronized public void
+ setOneway(int value, int expected, Ice.Current current)
+ {
+ test(_last == expected);
+ _last = value;
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ _adapter.hold();
+ _adapter.getCommunicator().shutdown();
+ }
+
+ final private java.util.Timer _timer;
+ final private Ice.ObjectAdapter _adapter;
+ int _last = 0;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/hold/Server.java b/java-compat/test/src/main/java/test/Ice/hold/Server.java
new file mode 100644
index 00000000000..2d3a1cf9652
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/hold/Server.java
@@ -0,0 +1,64 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.hold;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ java.util.Timer timer = new java.util.Timer();
+
+ Ice.ObjectAdapter adapter1 = communicator.createObjectAdapter("TestAdapter1");
+ adapter1.add(new HoldI(timer, adapter1), Ice.Util.stringToIdentity("hold"));
+
+ Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("TestAdapter2");
+ adapter2.add(new HoldI(timer, adapter2), Ice.Util.stringToIdentity("hold"));
+
+ adapter1.activate();
+ adapter2.activate();
+
+ serverReady();
+ communicator.waitForShutdown();
+
+ timer.cancel();
+
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.hold");
+ initData.properties.setProperty("TestAdapter1.Endpoints", "default -p 12010:udp");
+ initData.properties.setProperty("TestAdapter1.ThreadPool.Size", "5");
+ initData.properties.setProperty("TestAdapter1.ThreadPool.SizeMax", "5");
+ initData.properties.setProperty("TestAdapter1.ThreadPool.SizeWarn", "0");
+ initData.properties.setProperty("TestAdapter1.ThreadPool.Serialize", "0");
+
+ initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011:udp");
+ initData.properties.setProperty("TestAdapter2.ThreadPool.Size", "5");
+ initData.properties.setProperty("TestAdapter2.ThreadPool.SizeMax", "5");
+ initData.properties.setProperty("TestAdapter2.ThreadPool.SizeWarn", "0");
+ initData.properties.setProperty("TestAdapter2.ThreadPool.Serialize", "1");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/hold/Test.ice b/java-compat/test/src/main/java/test/Ice/hold/Test.ice
new file mode 100644
index 00000000000..d1a1f09e947
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/hold/Test.ice
@@ -0,0 +1,25 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.hold"]]
+module Test
+{
+
+interface Hold
+{
+ void putOnHold(int seconds);
+ void waitForHold();
+ int set(int value, int delay);
+ void setOneway(int value, int expected);
+ void shutdown();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/hold/run.py b/java-compat/test/src/main/java/test/Ice/hold/run.py
new file mode 100755
index 00000000000..97f9acd4094
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/hold/run.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/info/AllTests.java b/java-compat/test/src/main/java/test/Ice/info/AllTests.java
new file mode 100644
index 00000000000..c2e3b3022f2
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/info/AllTests.java
@@ -0,0 +1,240 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.info;
+
+import java.io.PrintWriter;
+
+import test.Ice.info.Test.TestIntfPrx;
+import test.Ice.info.Test.TestIntfPrxHelper;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private static Ice.TCPEndpointInfo
+ getTCPEndpointInfo(Ice.EndpointInfo info)
+ {
+ for(Ice.EndpointInfo p = info; p != null; p = p.underlying)
+ {
+ if(p instanceof Ice.TCPEndpointInfo)
+ {
+ return (Ice.TCPEndpointInfo)p;
+ }
+ }
+ return null;
+ }
+
+ private static Ice.TCPConnectionInfo
+ getTCPConnectionInfo(Ice.ConnectionInfo info)
+ {
+ for(Ice.ConnectionInfo p = info; p != null; p = p.underlying)
+ {
+ if(p instanceof Ice.TCPConnectionInfo)
+ {
+ return (Ice.TCPConnectionInfo)p;
+ }
+ }
+ return null;
+ }
+
+ public static void
+ allTests(Ice.Communicator communicator, PrintWriter out)
+ {
+ out.print("testing proxy endpoint information... ");
+ out.flush();
+ {
+ Ice.ObjectPrx p1 = communicator.stringToProxy(
+ "test -t:default -h tcphost -p 10000 -t 1200 -z --sourceAddress 10.10.10.10:" +
+ "udp -h udphost -p 10001 --interface eth0 --ttl 5 --sourceAddress 10.10.10.10:" +
+ "opaque -e 1.8 -t 100 -v ABCD");
+
+ Ice.Endpoint[] endps = p1.ice_getEndpoints();
+ Ice.EndpointInfo info = endps[0].getInfo();
+ Ice.TCPEndpointInfo tcpEndpoint = (Ice.TCPEndpointInfo)getTCPEndpointInfo(info);
+ test(tcpEndpoint.host.equals("tcphost"));
+ test(tcpEndpoint.port == 10000);
+ test(tcpEndpoint.timeout == 1200);
+ test(tcpEndpoint.sourceAddress.equals("10.10.10.10"));
+ test(tcpEndpoint.compress);
+ test(!tcpEndpoint.datagram());
+ test(tcpEndpoint.type() == Ice.TCPEndpointType.value && !tcpEndpoint.secure() ||
+ tcpEndpoint.type() == Ice.SSLEndpointType.value && tcpEndpoint.secure() ||
+ tcpEndpoint.type() == Ice.WSEndpointType.value && !tcpEndpoint.secure() ||
+ tcpEndpoint.type() == Ice.WSSEndpointType.value && tcpEndpoint.secure());
+
+ test(tcpEndpoint.type() == Ice.TCPEndpointType.value && info instanceof Ice.TCPEndpointInfo ||
+ tcpEndpoint.type() == Ice.SSLEndpointType.value && info instanceof IceSSL.EndpointInfo ||
+ tcpEndpoint.type() == Ice.WSEndpointType.value && info instanceof Ice.WSEndpointInfo ||
+ tcpEndpoint.type() == Ice.WSSEndpointType.value && info instanceof Ice.WSEndpointInfo);
+
+ Ice.UDPEndpointInfo udpEndpoint = (Ice.UDPEndpointInfo)endps[1].getInfo();
+ test(udpEndpoint.host.equals("udphost"));
+ test(udpEndpoint.port == 10001);
+ test(udpEndpoint.mcastInterface.equals("eth0"));
+ test(udpEndpoint.mcastTtl == 5);
+ test(udpEndpoint.sourceAddress.equals("10.10.10.10"));
+ test(udpEndpoint.timeout == -1);
+ test(!udpEndpoint.compress);
+ test(!udpEndpoint.secure());
+ test(udpEndpoint.datagram());
+ test(udpEndpoint.type() == Ice.UDPEndpointType.value);
+
+ Ice.OpaqueEndpointInfo opaqueEndpoint = (Ice.OpaqueEndpointInfo)endps[2].getInfo();
+ test(opaqueEndpoint.rawEncoding.equals(new Ice.EncodingVersion((byte)1, (byte)8)));
+ }
+ out.println("ok");
+
+ String defaultHost = communicator.getProperties().getProperty("Ice.Default.Host");
+ out.print("test object adapter endpoint information... ");
+ out.flush();
+ {
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -t 15000:udp");
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+
+ Ice.Endpoint[] endpoints = adapter.getEndpoints();
+ test(endpoints.length == 2);
+ Ice.Endpoint[] publishedEndpoints = adapter.getPublishedEndpoints();
+ test(java.util.Arrays.equals(endpoints, publishedEndpoints));
+
+ Ice.TCPEndpointInfo tcpEndpoint = getTCPEndpointInfo(endpoints[0].getInfo());
+ test(tcpEndpoint.type() == Ice.TCPEndpointType.value || tcpEndpoint.type() == Ice.SSLEndpointType.value ||
+ tcpEndpoint.type() == Ice.WSEndpointType.value || tcpEndpoint.type() == Ice.WSSEndpointType.value);
+ test(tcpEndpoint.host.equals(defaultHost));
+ test(tcpEndpoint.port > 0);
+ test(tcpEndpoint.timeout == 15000);
+
+ Ice.UDPEndpointInfo udpEndpoint = (Ice.UDPEndpointInfo)endpoints[1].getInfo();
+ test(udpEndpoint.host.equals(defaultHost));
+ test(udpEndpoint.datagram());
+ test(udpEndpoint.port > 0);
+
+ adapter.destroy();
+
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -h * -p 12020");
+ communicator.getProperties().setProperty("TestAdapter.PublishedEndpoints", "default -h 127.0.0.1 -p 12020");
+ adapter = communicator.createObjectAdapter("TestAdapter");
+
+ endpoints = adapter.getEndpoints();
+ test(endpoints.length >= 1);
+ publishedEndpoints = adapter.getPublishedEndpoints();
+ test(publishedEndpoints.length == 1);
+
+ for(Ice.Endpoint endpoint : endpoints)
+ {
+ tcpEndpoint = getTCPEndpointInfo(endpoint.getInfo());
+ test(tcpEndpoint.port == 12020);
+ }
+
+ tcpEndpoint = getTCPEndpointInfo(publishedEndpoints[0].getInfo());
+ test(tcpEndpoint.host.equals("127.0.0.1"));
+ test(tcpEndpoint.port == 12020);
+
+ adapter.destroy();
+ }
+ out.println("ok");
+
+ Ice.ObjectPrx base = communicator.stringToProxy("test:default -p 12010:udp -p 12010");
+ TestIntfPrx testIntf = TestIntfPrxHelper.checkedCast(base);
+
+ out.print("test connection endpoint information... ");
+ out.flush();
+ {
+ Ice.EndpointInfo info = base.ice_getConnection().getEndpoint().getInfo();
+ Ice.TCPEndpointInfo tcpinfo = getTCPEndpointInfo(info);
+ test(tcpinfo.port == 12010);
+ test(!tcpinfo.compress);
+ test(tcpinfo.host.equals(defaultHost));
+
+ java.util.Map<String, String> ctx = testIntf.getEndpointInfoAsContext();
+ test(ctx.get("host").equals(tcpinfo.host));
+ test(ctx.get("compress").equals("false"));
+ int port = Integer.parseInt(ctx.get("port"));
+ test(port > 0);
+
+ info = base.ice_datagram().ice_getConnection().getEndpoint().getInfo();
+ Ice.UDPEndpointInfo udp = (Ice.UDPEndpointInfo)info;
+ test(udp.port == 12010);
+ test(udp.host.equals(defaultHost));
+ }
+ out.println("ok");
+
+ out.print("testing connection information... ");
+ out.flush();
+ {
+ Ice.Connection connection = base.ice_getConnection();
+ connection.setBufferSize(1024, 2048);
+
+ Ice.TCPConnectionInfo info = getTCPConnectionInfo(connection.getInfo());
+ test(!info.incoming);
+ test(info.adapterName.length() == 0);
+ test(info.localPort > 0);
+ test(info.remotePort == 12010);
+ if(defaultHost.equals("127.0.0.1"))
+ {
+ test(info.remoteAddress.equals(defaultHost));
+ test(info.localAddress.equals(defaultHost));
+ }
+ test(info.rcvSize >= 1024);
+ test(info.sndSize >= 2048);
+
+ java.util.Map<String, String> ctx = testIntf.getConnectionInfoAsContext();
+ test(ctx.get("incoming").equals("true"));
+ test(ctx.get("adapterName").equals("TestAdapter"));
+ test(ctx.get("remoteAddress").equals(info.localAddress));
+ test(ctx.get("localAddress").equals(info.remoteAddress));
+ test(ctx.get("remotePort").equals(Integer.toString(info.localPort)));
+ test(ctx.get("localPort").equals(Integer.toString(info.remotePort)));
+
+ if(base.ice_getConnection().type().equals("ws") || base.ice_getConnection().type().equals("wss"))
+ {
+ java.util.Map<String, String> headers = ((Ice.WSConnectionInfo)connection.getInfo()).headers;
+ test(headers.get("Upgrade").equals("websocket"));
+ test(headers.get("Connection").equals("Upgrade"));
+ test(headers.get("Sec-WebSocket-Protocol").equals("ice.zeroc.com"));
+ test(headers.get("Sec-WebSocket-Accept") != null);
+
+ test(ctx.get("ws.Upgrade").equals("websocket"));
+ test(ctx.get("ws.Connection").equals("Upgrade"));
+ test(ctx.get("ws.Sec-WebSocket-Protocol").equals("ice.zeroc.com"));
+ test(ctx.get("ws.Sec-WebSocket-Version").equals("13"));
+ test(ctx.get("ws.Sec-WebSocket-Key") != null);
+ }
+
+ connection = base.ice_datagram().ice_getConnection();
+ connection.setBufferSize(2048, 1024);
+
+ Ice.UDPConnectionInfo udpinfo = (Ice.UDPConnectionInfo)connection.getInfo();
+ test(!udpinfo.incoming);
+ test(udpinfo.adapterName.length() == 0);
+ test(udpinfo.localPort > 0);
+ test(udpinfo.remotePort == 12010);
+ if(defaultHost.equals("127.0.0.1"))
+ {
+ test(udpinfo.remoteAddress.equals(defaultHost));
+ test(udpinfo.localAddress.equals(defaultHost));
+ }
+ test(udpinfo.rcvSize >= 2048);
+ test(udpinfo.sndSize >= 1024);
+ }
+ out.println("ok");
+
+ testIntf.shutdown();
+
+ communicator.shutdown();
+ communicator.waitForShutdown();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/info/Client.java b/java-compat/test/src/main/java/test/Ice/info/Client.java
new file mode 100644
index 00000000000..600b5008bd4
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/info/Client.java
@@ -0,0 +1,37 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.info;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ AllTests.allTests(communicator(), getWriter());
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.info");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/info/Server.java b/java-compat/test/src/main/java/test/Ice/info/Server.java
new file mode 100644
index 00000000000..455e21046d0
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/info/Server.java
@@ -0,0 +1,41 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.info;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new TestI(), Ice.Util.stringToIdentity("test"));
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp -p 12010");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/info/Test.ice b/java-compat/test/src/main/java/test/Ice/info/Test.ice
new file mode 100644
index 00000000000..66c205123ea
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/info/Test.ice
@@ -0,0 +1,27 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+#include <Ice/Current.ice>
+
+[["java:package:test.Ice.info"]]
+module Test
+{
+
+interface TestIntf
+{
+ void shutdown();
+
+ Ice::Context getEndpointInfoAsContext();
+
+ Ice::Context getConnectionInfoAsContext();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/info/TestI.java b/java-compat/test/src/main/java/test/Ice/info/TestI.java
new file mode 100644
index 00000000000..71daea00326
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/info/TestI.java
@@ -0,0 +1,101 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.info;
+import test.Ice.info.Test._TestIntfDisp;
+
+public class TestI extends _TestIntfDisp
+{
+ private static Ice.IPEndpointInfo
+ getIPEndpointInfo(Ice.EndpointInfo info)
+ {
+ for(Ice.EndpointInfo p = info; p != null; p = p.underlying)
+ {
+ if(p instanceof Ice.IPEndpointInfo)
+ {
+ return (Ice.IPEndpointInfo)p;
+ }
+ }
+ return null;
+ }
+
+ private static Ice.IPConnectionInfo
+ getIPConnectionInfo(Ice.ConnectionInfo info)
+ {
+ for(Ice.ConnectionInfo p = info; p != null; p = p.underlying)
+ {
+ if(p instanceof Ice.IPConnectionInfo)
+ {
+ return (Ice.IPConnectionInfo)p;
+ }
+ }
+ return null;
+ }
+
+ TestI()
+ {
+ }
+
+ @Override
+ public void shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+
+ @Override
+ public java.util.Map<String, String> getEndpointInfoAsContext(Ice.Current c)
+ {
+ java.util.Map<String, String> ctx = new java.util.HashMap<String, String>();
+ Ice.EndpointInfo info = c.con.getEndpoint().getInfo();
+ ctx.put("timeout", Integer.toString(info.timeout));
+ ctx.put("compress", info.compress ? "true" : "false");
+ ctx.put("datagram", info.datagram() ? "true" : "false");
+ ctx.put("secure", info.datagram() ? "true" : "false");
+ ctx.put("type", Integer.toString(info.type()));
+
+ Ice.IPEndpointInfo ipinfo = getIPEndpointInfo(info);
+ ctx.put("host", ipinfo.host);
+ ctx.put("port", Integer.toString(ipinfo.port));
+
+ if(ipinfo instanceof Ice.UDPEndpointInfo)
+ {
+ Ice.UDPEndpointInfo udp = (Ice.UDPEndpointInfo)ipinfo;
+ ctx.put("mcastInterface", udp.mcastInterface);
+ ctx.put("mcastTtl", Integer.toString(udp.mcastTtl));
+ }
+
+ return ctx;
+ }
+
+ @Override
+ public java.util.Map<String, String> getConnectionInfoAsContext(Ice.Current c)
+ {
+ java.util.Map<String, String> ctx = new java.util.HashMap<String, String>();
+ Ice.ConnectionInfo info = c.con.getInfo();
+ ctx.put("adapterName", info.adapterName);
+ ctx.put("incoming", info.incoming ? "true" : "false");
+
+ Ice.IPConnectionInfo ipinfo = getIPConnectionInfo(info);
+ ctx.put("localAddress", ipinfo.localAddress);
+ ctx.put("localPort", Integer.toString(ipinfo.localPort));
+ ctx.put("remoteAddress", ipinfo.remoteAddress);
+ ctx.put("remotePort", Integer.toString(ipinfo.remotePort));
+
+ if(info instanceof Ice.WSConnectionInfo)
+ {
+ Ice.WSConnectionInfo wsinfo = (Ice.WSConnectionInfo)info;
+ for(java.util.Map.Entry<String, String> e : wsinfo.headers.entrySet())
+ {
+ ctx.put("ws." + e.getKey(), e.getValue());
+ }
+ }
+
+ return ctx;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/info/run.py b/java-compat/test/src/main/java/test/Ice/info/run.py
new file mode 100755
index 00000000000..97f9acd4094
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/info/run.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/AllTests.java b/java-compat/test/src/main/java/test/Ice/inheritance/AllTests.java
new file mode 100644
index 00000000000..360cc09b725
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/inheritance/AllTests.java
@@ -0,0 +1,248 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.inheritance;
+
+import java.io.PrintWriter;
+
+import test.Ice.inheritance.Test.InitialPrx;
+import test.Ice.inheritance.Test.InitialPrxHelper;
+import test.Ice.inheritance.Test.MA.CAPrx;
+import test.Ice.inheritance.Test.MA.CCPrx;
+import test.Ice.inheritance.Test.MA.CDPrx;
+import test.Ice.inheritance.Test.MA.IAPrx;
+import test.Ice.inheritance.Test.MA.ICPrx;
+import test.Ice.inheritance.Test.MB.CBPrx;
+import test.Ice.inheritance.Test.MB.IB1Prx;
+import test.Ice.inheritance.Test.MB.IB2Prx;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static InitialPrx
+ allTests(Ice.Communicator communicator, PrintWriter out)
+ {
+ out.print("testing stringToProxy... ");
+ out.flush();
+ String ref = "initial:default -p 12010";
+ Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ test(base != null);
+ out.println("ok");
+
+ out.print("testing checked cast... ");
+ out.flush();
+ InitialPrx initial = InitialPrxHelper.checkedCast(base);
+ test(initial != null);
+ test(initial.equals(base));
+ out.println("ok");
+
+ out.print("getting proxies for class hierarchy... ");
+ out.flush();
+ CAPrx ca = initial.caop();
+ CBPrx cb = initial.cbop();
+ CCPrx cc = initial.ccop();
+ CDPrx cd = initial.cdop();
+ test(ca != cb);
+ test(ca != cc);
+ test(ca != cd);
+ test(cb != cc);
+ test(cb != cd);
+ test(cc != cd);
+ out.println("ok");
+
+ out.print("getting proxies for interface hierarchy... ");
+ out.flush();
+ IAPrx ia = initial.iaop();
+ IB1Prx ib1 = initial.ib1op();
+ IB2Prx ib2 = initial.ib2op();
+ ICPrx ic = initial.icop();
+ test(ia != ib1);
+ test(ia != ib2);
+ test(ia != ic);
+ test(ib1 != ic);
+ test(ib2 != ic);
+ out.println("ok");
+
+ out.print("invoking proxy operations on class hierarchy... ");
+ out.flush();
+ CAPrx cao;
+ CBPrx cbo;
+ CCPrx cco;
+
+ cao = ca.caop(ca);
+ test(cao.equals(ca));
+ cao = ca.caop(cb);
+ test(cao.equals(cb));
+ cao = ca.caop(cc);
+ test(cao.equals(cc));
+ cao = cb.caop(ca);
+ test(cao.equals(ca));
+ cao = cb.caop(cb);
+ test(cao.equals(cb));
+ cao = cb.caop(cc);
+ test(cao.equals(cc));
+ cao = cc.caop(ca);
+ test(cao.equals(ca));
+ cao = cc.caop(cb);
+ test(cao.equals(cb));
+ cao = cc.caop(cc);
+ test(cao.equals(cc));
+
+ cao = cb.cbop(cb);
+ test(cao.equals(cb));
+ cbo = cb.cbop(cb);
+ test(cbo.equals(cb));
+ cao = cb.cbop(cc);
+ test(cao.equals(cc));
+ cbo = cb.cbop(cc);
+ test(cbo.equals(cc));
+ cao = cc.cbop(cb);
+ test(cao.equals(cb));
+ cbo = cc.cbop(cb);
+ test(cbo.equals(cb));
+ cao = cc.cbop(cc);
+ test(cao.equals(cc));
+ cbo = cc.cbop(cc);
+ test(cbo.equals(cc));
+
+ cao = cc.ccop(cc);
+ test(cao.equals(cc));
+ cbo = cc.ccop(cc);
+ test(cbo.equals(cc));
+ cco = cc.ccop(cc);
+ test(cco.equals(cc));
+ out.println("ok");
+
+ out.print("ditto, but for interface hierarchy... ");
+ out.flush();
+ IAPrx iao;
+ IB1Prx ib1o;
+ IB2Prx ib2o;
+ ICPrx ico;
+
+ iao = ia.iaop(ia);
+ test(iao.equals(ia));
+ iao = ia.iaop(ib1);
+ test(iao.equals(ib1));
+ iao = ia.iaop(ib2);
+ test(iao.equals(ib2));
+ iao = ia.iaop(ic);
+ test(iao.equals(ic));
+ iao = ib1.iaop(ia);
+ test(iao.equals(ia));
+ iao = ib1.iaop(ib1);
+ test(iao.equals(ib1));
+ iao = ib1.iaop(ib2);
+ test(iao.equals(ib2));
+ iao = ib1.iaop(ic);
+ test(iao.equals(ic));
+ iao = ib2.iaop(ia);
+ test(iao.equals(ia));
+ iao = ib2.iaop(ib1);
+ test(iao.equals(ib1));
+ iao = ib2.iaop(ib2);
+ test(iao.equals(ib2));
+ iao = ib2.iaop(ic);
+ test(iao.equals(ic));
+ iao = ic.iaop(ia);
+ test(iao.equals(ia));
+ iao = ic.iaop(ib1);
+ test(iao.equals(ib1));
+ iao = ic.iaop(ib2);
+ test(iao.equals(ib2));
+ iao = ic.iaop(ic);
+ test(iao.equals(ic));
+
+ iao = ib1.ib1op(ib1);
+ test(iao.equals(ib1));
+ ib1o = ib1.ib1op(ib1);
+ test(ib1o.equals(ib1));
+ iao = ib1.ib1op(ic);
+ test(iao.equals(ic));
+ ib1o = ib1.ib1op(ic);
+ test(ib1o.equals(ic));
+ iao = ic.ib1op(ib1);
+ test(iao.equals(ib1));
+ ib1o = ic.ib1op(ib1);
+ test(ib1o.equals(ib1));
+ iao = ic.ib1op(ic);
+ test(iao.equals(ic));
+ ib1o = ic.ib1op(ic);
+ test(ib1o.equals(ic));
+
+ iao = ib2.ib2op(ib2);
+ test(iao.equals(ib2));
+ ib2o = ib2.ib2op(ib2);
+ test(ib2o.equals(ib2));
+ iao = ib2.ib2op(ic);
+ test(iao.equals(ic));
+ ib2o = ib2.ib2op(ic);
+ test(ib2o.equals(ic));
+ iao = ic.ib2op(ib2);
+ test(iao.equals(ib2));
+ ib2o = ic.ib2op(ib2);
+ test(ib2o.equals(ib2));
+ iao = ic.ib2op(ic);
+ test(iao.equals(ic));
+ ib2o = ic.ib2op(ic);
+ test(ib2o.equals(ic));
+
+ iao = ic.icop(ic);
+ test(iao.equals(ic));
+ ib1o = ic.icop(ic);
+ test(ib1o.equals(ic));
+ ib2o = ic.icop(ic);
+ test(ib2o.equals(ic));
+ ico = ic.icop(ic);
+ test(ico.equals(ic));
+ out.println("ok");
+
+ out.print("ditto, but for class implementing interfaces... ");
+ out.flush();
+
+ cao = cd.caop(cd);
+ test(cao.equals(cd));
+ cbo = cd.cbop(cd);
+ test(cbo.equals(cd));
+ cco = cd.ccop(cd);
+ test(cco.equals(cd));
+
+ iao = cd.iaop(cd);
+ test(iao.equals(cd));
+ ib1o = cd.ib1op(cd);
+ test(ib1o.equals(cd));
+ ib2o = cd.ib2op(cd);
+ test(ib2o.equals(cd));
+
+ cao = cd.cdop(cd);
+ test(cao.equals(cd));
+ cbo = cd.cdop(cd);
+ test(cbo.equals(cd));
+ cco = cd.cdop(cd);
+ test(cco.equals(cd));
+
+ iao = cd.cdop(cd);
+ test(iao.equals(cd));
+ ib1o = cd.cdop(cd);
+ test(ib1o.equals(cd));
+ ib2o = cd.cdop(cd);
+ test(ib2o.equals(cd));
+ out.println("ok");
+
+ return initial;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/CAI.java b/java-compat/test/src/main/java/test/Ice/inheritance/CAI.java
new file mode 100644
index 00000000000..9c7fbcf2ca6
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/inheritance/CAI.java
@@ -0,0 +1,28 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.inheritance;
+
+import test.Ice.inheritance.Test.MA.CA;
+import test.Ice.inheritance.Test.MA.CAPrx;
+
+public final class CAI extends CA
+{
+ public
+ CAI()
+ {
+ }
+
+ @Override
+ public CAPrx
+ caop(CAPrx p, Ice.Current current)
+ {
+ return p;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/CBI.java b/java-compat/test/src/main/java/test/Ice/inheritance/CBI.java
new file mode 100644
index 00000000000..8496a14b7cd
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/inheritance/CBI.java
@@ -0,0 +1,36 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.inheritance;
+
+import test.Ice.inheritance.Test.MA.CAPrx;
+import test.Ice.inheritance.Test.MB.CB;
+import test.Ice.inheritance.Test.MB.CBPrx;
+
+public final class CBI extends CB
+{
+ public
+ CBI()
+ {
+ }
+
+ @Override
+ public CAPrx
+ caop(CAPrx p, Ice.Current current)
+ {
+ return p;
+ }
+
+ @Override
+ public CBPrx
+ cbop(CBPrx p, Ice.Current current)
+ {
+ return p;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/CCI.java b/java-compat/test/src/main/java/test/Ice/inheritance/CCI.java
new file mode 100644
index 00000000000..eb5f905f28a
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/inheritance/CCI.java
@@ -0,0 +1,44 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.inheritance;
+
+import test.Ice.inheritance.Test.MA.CAPrx;
+import test.Ice.inheritance.Test.MA.CC;
+import test.Ice.inheritance.Test.MA.CCPrx;
+import test.Ice.inheritance.Test.MB.CBPrx;
+
+public final class CCI extends CC
+{
+ public
+ CCI()
+ {
+ }
+
+ @Override
+ public CAPrx
+ caop(CAPrx p, Ice.Current current)
+ {
+ return p;
+ }
+
+ @Override
+ public CCPrx
+ ccop(CCPrx p, Ice.Current current)
+ {
+ return p;
+ }
+
+ @Override
+ public CBPrx
+ cbop(CBPrx p, Ice.Current current)
+ {
+ return p;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/CDI.java b/java-compat/test/src/main/java/test/Ice/inheritance/CDI.java
new file mode 100644
index 00000000000..af80144cae2
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/inheritance/CDI.java
@@ -0,0 +1,76 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.inheritance;
+
+import test.Ice.inheritance.Test.MA.CAPrx;
+import test.Ice.inheritance.Test.MA.CCPrx;
+import test.Ice.inheritance.Test.MA.CD;
+import test.Ice.inheritance.Test.MA.CDPrx;
+import test.Ice.inheritance.Test.MA.IAPrx;
+import test.Ice.inheritance.Test.MB.CBPrx;
+import test.Ice.inheritance.Test.MB.IB1Prx;
+import test.Ice.inheritance.Test.MB.IB2Prx;
+
+public final class CDI extends CD
+{
+ public
+ CDI()
+ {
+ }
+
+ @Override
+ public CAPrx
+ caop(CAPrx p, Ice.Current current)
+ {
+ return p;
+ }
+
+ @Override
+ public CCPrx
+ ccop(CCPrx p, Ice.Current current)
+ {
+ return p;
+ }
+
+ @Override
+ public CDPrx
+ cdop(CDPrx p, Ice.Current current)
+ {
+ return p;
+ }
+
+ @Override
+ public IAPrx
+ iaop(IAPrx p, Ice.Current current)
+ {
+ return p;
+ }
+
+ @Override
+ public CBPrx
+ cbop(CBPrx p, Ice.Current current)
+ {
+ return p;
+ }
+
+ @Override
+ public IB1Prx
+ ib1op(IB1Prx p, Ice.Current current)
+ {
+ return p;
+ }
+
+ @Override
+ public IB2Prx
+ ib2op(IB2Prx p, Ice.Current current)
+ {
+ return p;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/Client.java b/java-compat/test/src/main/java/test/Ice/inheritance/Client.java
new file mode 100644
index 00000000000..704cf503752
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/inheritance/Client.java
@@ -0,0 +1,42 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.inheritance;
+
+import test.Ice.inheritance.Test.InitialPrx;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ InitialPrx initial = AllTests.allTests(communicator, getWriter());
+ initial.shutdown();
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.inheritance");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/Collocated.java b/java-compat/test/src/main/java/test/Ice/inheritance/Collocated.java
new file mode 100644
index 00000000000..ac600d8f32c
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/inheritance/Collocated.java
@@ -0,0 +1,46 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.inheritance;
+
+public class Collocated extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.Object object = new InitialI(adapter);
+ adapter.add(object, Ice.Util.stringToIdentity("initial"));
+
+ AllTests.allTests(communicator, getWriter());
+
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.inheritance");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Collocated c = new Collocated();
+ int status = c.main("Collocated", args);
+
+ System.gc();
+ System.exit(status);
+ }
+
+}
diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/IAI.java b/java-compat/test/src/main/java/test/Ice/inheritance/IAI.java
new file mode 100644
index 00000000000..d1262ed5165
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/inheritance/IAI.java
@@ -0,0 +1,28 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.inheritance;
+
+import test.Ice.inheritance.Test.MA.IAPrx;
+import test.Ice.inheritance.Test.MA._IADisp;
+
+public final class IAI extends _IADisp
+{
+ public
+ IAI()
+ {
+ }
+
+ @Override
+ public IAPrx
+ iaop(IAPrx p, Ice.Current current)
+ {
+ return p;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/IB1I.java b/java-compat/test/src/main/java/test/Ice/inheritance/IB1I.java
new file mode 100644
index 00000000000..317662cf423
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/inheritance/IB1I.java
@@ -0,0 +1,36 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.inheritance;
+
+import test.Ice.inheritance.Test.MA.IAPrx;
+import test.Ice.inheritance.Test.MB.IB1Prx;
+import test.Ice.inheritance.Test.MB._IB1Disp;
+
+public final class IB1I extends _IB1Disp
+{
+ public
+ IB1I()
+ {
+ }
+
+ @Override
+ public IAPrx
+ iaop(IAPrx p, Ice.Current current)
+ {
+ return p;
+ }
+
+ @Override
+ public IB1Prx
+ ib1op(IB1Prx p, Ice.Current current)
+ {
+ return p;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/IB2I.java b/java-compat/test/src/main/java/test/Ice/inheritance/IB2I.java
new file mode 100644
index 00000000000..0a446b7cb99
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/inheritance/IB2I.java
@@ -0,0 +1,36 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.inheritance;
+
+import test.Ice.inheritance.Test.MA.IAPrx;
+import test.Ice.inheritance.Test.MB.IB2Prx;
+import test.Ice.inheritance.Test.MB._IB2Disp;
+
+public final class IB2I extends _IB2Disp
+{
+ public
+ IB2I()
+ {
+ }
+
+ @Override
+ public IAPrx
+ iaop(IAPrx p, Ice.Current current)
+ {
+ return p;
+ }
+
+ @Override
+ public IB2Prx
+ ib2op(IB2Prx p, Ice.Current current)
+ {
+ return p;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/ICI.java b/java-compat/test/src/main/java/test/Ice/inheritance/ICI.java
new file mode 100644
index 00000000000..af14684d8d2
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/inheritance/ICI.java
@@ -0,0 +1,52 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.inheritance;
+
+import test.Ice.inheritance.Test.MA.IAPrx;
+import test.Ice.inheritance.Test.MA.ICPrx;
+import test.Ice.inheritance.Test.MA._ICDisp;
+import test.Ice.inheritance.Test.MB.IB1Prx;
+import test.Ice.inheritance.Test.MB.IB2Prx;
+
+public final class ICI extends _ICDisp
+{
+ public
+ ICI()
+ {
+ }
+
+ @Override
+ public IAPrx
+ iaop(IAPrx p, Ice.Current current)
+ {
+ return p;
+ }
+
+ @Override
+ public ICPrx
+ icop(ICPrx p, Ice.Current current)
+ {
+ return p;
+ }
+
+ @Override
+ public IB1Prx
+ ib1op(IB1Prx p, Ice.Current current)
+ {
+ return p;
+ }
+
+ @Override
+ public IB2Prx
+ ib2op(IB2Prx p, Ice.Current current)
+ {
+ return p;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/InitialI.java b/java-compat/test/src/main/java/test/Ice/inheritance/InitialI.java
new file mode 100644
index 00000000000..429c467d569
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/inheritance/InitialI.java
@@ -0,0 +1,116 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.inheritance;
+
+import test.Ice.inheritance.Test._InitialDisp;
+import test.Ice.inheritance.Test.MA.CAPrx;
+import test.Ice.inheritance.Test.MA.CAPrxHelper;
+import test.Ice.inheritance.Test.MA.CCPrx;
+import test.Ice.inheritance.Test.MA.CCPrxHelper;
+import test.Ice.inheritance.Test.MA.CDPrx;
+import test.Ice.inheritance.Test.MA.CDPrxHelper;
+import test.Ice.inheritance.Test.MA.IAPrx;
+import test.Ice.inheritance.Test.MA.IAPrxHelper;
+import test.Ice.inheritance.Test.MA.ICPrx;
+import test.Ice.inheritance.Test.MA.ICPrxHelper;
+import test.Ice.inheritance.Test.MB.CBPrx;
+import test.Ice.inheritance.Test.MB.CBPrxHelper;
+import test.Ice.inheritance.Test.MB.IB1Prx;
+import test.Ice.inheritance.Test.MB.IB1PrxHelper;
+import test.Ice.inheritance.Test.MB.IB2Prx;
+import test.Ice.inheritance.Test.MB.IB2PrxHelper;
+
+public final class InitialI extends _InitialDisp
+{
+ public
+ InitialI(Ice.ObjectAdapter adapter)
+ {
+ _ca = CAPrxHelper.uncheckedCast(adapter.addWithUUID(new CAI()));
+ _cb = CBPrxHelper.uncheckedCast(adapter.addWithUUID(new CBI()));
+ _cc = CCPrxHelper.uncheckedCast(adapter.addWithUUID(new CCI()));
+ _cd = CDPrxHelper.uncheckedCast(adapter.addWithUUID(new CDI()));
+ _ia = IAPrxHelper.uncheckedCast(adapter.addWithUUID(new IAI()));
+ _ib1 = IB1PrxHelper.uncheckedCast(adapter.addWithUUID(new IB1I()));
+ _ib2 = IB2PrxHelper.uncheckedCast(adapter.addWithUUID(new IB2I()));
+ _ic = ICPrxHelper.uncheckedCast(adapter.addWithUUID(new ICI()));
+ }
+
+ @Override
+ public CAPrx
+ caop(Ice.Current current)
+ {
+ return _ca;
+ }
+
+ @Override
+ public CBPrx
+ cbop(Ice.Current current)
+ {
+ return _cb;
+ }
+
+ @Override
+ public CCPrx
+ ccop(Ice.Current current)
+ {
+ return _cc;
+ }
+
+ @Override
+ public CDPrx
+ cdop(Ice.Current current)
+ {
+ return _cd;
+ }
+
+ @Override
+ public IAPrx
+ iaop(Ice.Current current)
+ {
+ return _ia;
+ }
+
+ @Override
+ public IB1Prx
+ ib1op(Ice.Current current)
+ {
+ return _ib1;
+ }
+
+ @Override
+ public IB2Prx
+ ib2op(Ice.Current current)
+ {
+ return _ib2;
+ }
+
+ @Override
+ public ICPrx
+ icop(Ice.Current current)
+ {
+ return _ic;
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+
+ private CAPrx _ca;
+ private CBPrx _cb;
+ private CCPrx _cc;
+ private CDPrx _cd;
+ private IAPrx _ia;
+ private IB1Prx _ib1;
+ private IB2Prx _ib2;
+ private ICPrx _ic;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/Server.java b/java-compat/test/src/main/java/test/Ice/inheritance/Server.java
new file mode 100644
index 00000000000..a826ae1ec2f
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/inheritance/Server.java
@@ -0,0 +1,43 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.inheritance;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.Object object = new InitialI(adapter);
+ adapter.add(object, Ice.Util.stringToIdentity("initial"));
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.inheritance");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server c = new Server();
+ int status = c.main("Server", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/Test.ice b/java-compat/test/src/main/java/test/Ice/inheritance/Test.ice
new file mode 100644
index 00000000000..83f212381cb
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/inheritance/Test.ice
@@ -0,0 +1,84 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.inheritance"]]
+module Test
+{
+
+module MA
+{
+
+interface IA
+{
+ IA* iaop(IA* p);
+};
+
+class CA
+{
+ CA* caop(CA* p);
+};
+
+};
+
+module MB
+{
+
+interface IB1 extends MA::IA
+{
+ IB1* ib1op(IB1* p);
+};
+
+interface IB2 extends MA::IA
+{
+ IB2* ib2op(IB2* p);
+};
+
+class CB extends MA::CA
+{
+ CB* cbop(CB* p);
+};
+
+};
+
+module MA
+{
+
+interface IC extends MB::IB1, MB::IB2
+{
+ IC* icop(IC* p);
+};
+
+class CC extends MB::CB
+{
+ CC* ccop(CC* p);
+};
+
+class CD extends CC implements MB::IB1, MB::IB2
+{
+ CD* cdop(CD* p);
+};
+
+};
+
+interface Initial
+{
+ void shutdown();
+ MA::CA* caop();
+ MB::CB* cbop();
+ MA::CC* ccop();
+ MA::CD* cdop();
+ MA::IA* iaop();
+ MB::IB1* ib1op();
+ MB::IB2* ib2op();
+ MA::IC* icop();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/run.py b/java-compat/test/src/main/java/test/Ice/inheritance/run.py
new file mode 100755
index 00000000000..97eec95871b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/inheritance/run.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.queueCollocatedTest()
+TestUtil.runQueuedTests()
diff --git a/java/test/src/main/java/test/Ice/interceptor/AMDInterceptorI.java b/java-compat/test/src/main/java/test/Ice/interceptor/AMDInterceptorI.java
index df053f54578..df053f54578 100644
--- a/java/test/src/main/java/test/Ice/interceptor/AMDInterceptorI.java
+++ b/java-compat/test/src/main/java/test/Ice/interceptor/AMDInterceptorI.java
diff --git a/java-compat/test/src/main/java/test/Ice/interceptor/Client.java b/java-compat/test/src/main/java/test/Ice/interceptor/Client.java
new file mode 100644
index 00000000000..1173b5f8f47
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/interceptor/Client.java
@@ -0,0 +1,270 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.interceptor;
+
+import java.io.PrintWriter;
+
+import test.Ice.interceptor.Test.InvalidInputException;
+import test.Ice.interceptor.Test.MyObjectPrx;
+import test.Ice.interceptor.Test.MyObjectPrxHelper;
+
+public class Client extends test.Util.Application
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private int
+ run(MyObjectPrx prx, InterceptorI interceptor)
+ {
+ PrintWriter out = getWriter();
+ out.print("testing simple interceptor... ");
+ out.flush();
+ test(interceptor.getLastOperation() == null);
+ test(interceptor.getLastStatus() == null);
+ prx.ice_ping();
+ test(interceptor.getLastOperation().equals("ice_ping"));
+ test(interceptor.getLastStatus() == Ice.DispatchStatus.DispatchOK);
+ String typeId = prx.ice_id();
+ test(interceptor.getLastOperation().equals("ice_id"));
+ test(interceptor.getLastStatus() == Ice.DispatchStatus.DispatchOK);
+ test(prx.ice_isA(typeId));
+ test(interceptor.getLastOperation().equals("ice_isA"));
+ test(interceptor.getLastStatus() == Ice.DispatchStatus.DispatchOK);
+ test(prx.add(33, 12) == 45);
+ test(interceptor.getLastOperation().equals("add"));
+ test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchOK));
+ out.println("ok");
+ out.print("testing retry... ");
+ out.flush();
+ test(prx.addWithRetry(33, 12) == 45);
+ test(interceptor.getLastOperation().equals("addWithRetry"));
+ test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchOK));
+ out.println("ok");
+ out.print("testing user exception... ");
+ out.flush();
+ try
+ {
+ prx.badAdd(33, 12);
+ test(false);
+ }
+ catch(InvalidInputException e)
+ {
+ // expected
+ }
+ test(interceptor.getLastOperation().equals("badAdd"));
+ test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchUserException));
+ out.println("ok");
+ out.print("testing ONE... ");
+ out.flush();
+ interceptor.clear();
+ try
+ {
+ prx.notExistAdd(33, 12);
+ test(false);
+ }
+ catch(Ice.ObjectNotExistException e)
+ {
+ // expected
+ }
+ test(interceptor.getLastOperation().equals("notExistAdd"));
+ test(interceptor.getLastStatus() == null);
+ out.println("ok");
+ out.print("testing system exception... ");
+ out.flush();
+ interceptor.clear();
+ try
+ {
+ prx.badSystemAdd(33, 12);
+ test(false);
+ }
+ catch(Ice.UnknownException e)
+ {
+ test(!prx.ice_isCollocationOptimized());
+ }
+ catch(MySystemException e)
+ {
+ test(prx.ice_isCollocationOptimized());
+ }
+ catch(Throwable ex)
+ {
+ test(false);
+ }
+ test(interceptor.getLastOperation().equals("badSystemAdd"));
+ test(interceptor.getLastStatus() == null);
+ out.println("ok");
+
+ out.print("testing simple AMD... ");
+ out.flush();
+ test(prx.amdAdd(33, 12) == 45);
+ test(interceptor.getLastOperation().equals("amdAdd"));
+ test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchAsync));
+ out.println("ok");
+
+ return 0;
+ }
+
+ private int
+ runAmd(MyObjectPrx prx, AMDInterceptorI interceptor, PrintWriter out)
+ {
+ out.print("testing simple interceptor... ");
+ out.flush();
+ test(interceptor.getLastOperation() == null);
+ test(interceptor.getLastStatus() == null);
+ test(prx.amdAdd(33, 12) == 45);
+ test(interceptor.getLastOperation().equals("amdAdd"));
+ test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchAsync));
+ test(interceptor.getActualStatus().equals(Ice.DispatchStatus.DispatchOK));
+ out.println("ok");
+ out.print("testing retry... ");
+ out.flush();
+ test(prx.amdAddWithRetry(33, 12) == 45);
+ test(interceptor.getLastOperation().equals("amdAddWithRetry"));
+ test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchAsync));
+ test(interceptor.getActualStatus().equals(Ice.DispatchStatus.DispatchOK));
+ out.println("ok");
+ out.print("testing user exception... ");
+ out.flush();
+ try
+ {
+ prx.amdBadAdd(33, 12);
+ test(false);
+ }
+ catch(InvalidInputException e)
+ {
+ // expected
+ }
+ test(interceptor.getLastOperation().equals("amdBadAdd"));
+ test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchAsync));
+ test(interceptor.getActualStatus().equals(Ice.DispatchStatus.DispatchUserException));
+ out.println("ok");
+ out.print("testing ONE... ");
+ out.flush();
+ interceptor.clear();
+ try
+ {
+ prx.amdNotExistAdd(33, 12);
+ test(false);
+ }
+ catch(Ice.ObjectNotExistException e)
+ {
+ // expected
+ }
+ test(interceptor.getLastOperation().equals("amdNotExistAdd"));
+ test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchAsync));
+ test(interceptor.getActualStatus() == null);
+ test(interceptor.getException() instanceof Ice.ObjectNotExistException);
+ out.println("ok");
+ out.print("testing system exception... ");
+ out.flush();
+ interceptor.clear();
+ try
+ {
+ prx.amdBadSystemAdd(33, 12);
+ test(false);
+ }
+ catch(Ice.UnknownException e)
+ {
+ test(!prx.ice_isCollocationOptimized());
+ }
+ catch(MySystemException e)
+ {
+ test(prx.ice_isCollocationOptimized());
+ }
+ catch(Throwable ex)
+ {
+ test(false);
+ }
+ test(interceptor.getLastOperation().equals("amdBadSystemAdd"));
+ test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchAsync));
+ test(interceptor.getActualStatus() == null);
+ test(interceptor.getException() instanceof MySystemException);
+ out.println("ok");
+ return 0;
+ }
+
+ @Override
+ public int
+ run(String[] args)
+ {
+ //
+ // Create OA and servants
+ //
+ communicator().getProperties().setProperty("MyOA.AdapterId", "myOA");
+
+ Ice.ObjectAdapter oa = communicator().createObjectAdapterWithEndpoints("MyOA2", "tcp -h localhost");
+
+ Ice.Object servant = new MyObjectI();
+ InterceptorI interceptor = new InterceptorI(servant);
+ AMDInterceptorI amdInterceptor = new AMDInterceptorI(servant);
+
+ MyObjectPrx prx = MyObjectPrxHelper.uncheckedCast(oa.addWithUUID(interceptor));
+ MyObjectPrx prxForAMD = MyObjectPrxHelper.uncheckedCast(oa.addWithUUID(amdInterceptor));
+
+ PrintWriter out = getWriter();
+ out.println("Collocation optimization on");
+ int rs = run(prx, interceptor);
+ if(rs != 0)
+ {
+ return rs;
+ }
+
+ out.println("Now with AMD");
+ rs = runAmd(prxForAMD, amdInterceptor, out);
+ if(rs != 0)
+ {
+ return rs;
+ }
+
+ oa.activate(); // Only necessary for non-collocation optimized tests
+
+ out.println("Collocation optimization off");
+ interceptor.clear();
+ prx = MyObjectPrxHelper.uncheckedCast(prx.ice_collocationOptimized(false));
+ rs = run(prx, interceptor);
+ if(rs != 0)
+ {
+ return rs;
+ }
+
+ out.println("Now with AMD");
+ amdInterceptor.clear();
+ prxForAMD = MyObjectPrxHelper.uncheckedCast(prxForAMD.ice_collocationOptimized(false));
+ rs = runAmd(prxForAMD, amdInterceptor, out);
+
+ return rs;
+ }
+
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.interceptor");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int status = app.main("Interceptor", args);
+ System.gc();
+ System.exit(status);
+ }
+}
+
+
+
diff --git a/java-compat/test/src/main/java/test/Ice/interceptor/InterceptorI.java b/java-compat/test/src/main/java/test/Ice/interceptor/InterceptorI.java
new file mode 100644
index 00000000000..9eb3e69f324
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/interceptor/InterceptorI.java
@@ -0,0 +1,84 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.interceptor;
+
+import test.Ice.interceptor.Test.RetryException;
+
+class InterceptorI extends Ice.DispatchInterceptor
+{
+ InterceptorI(Ice.Object servant)
+ {
+ _servant = servant;
+ }
+
+ protected static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+
+ @Override
+ public Ice.DispatchStatus
+ dispatch(Ice.Request request)
+ {
+ Ice.Current current = request.getCurrent();
+ _lastOperation = current.operation;
+
+ if(_lastOperation.equals("addWithRetry"))
+ {
+ for(int i = 0; i < 10; ++i)
+ {
+ try
+ {
+ _servant.ice_dispatch(request);
+ test(false);
+ }
+ catch(RetryException re)
+ {
+ //
+ // Expected, retry
+ //
+ }
+ }
+
+ current.ctx.put("retry", "no");
+ }
+
+ _lastStatus = _servant.ice_dispatch(request);
+ return _lastStatus;
+ }
+
+ Ice.DispatchStatus
+ getLastStatus()
+ {
+ return _lastStatus;
+ }
+
+ String
+ getLastOperation()
+ {
+ return _lastOperation;
+ }
+
+ void
+ clear()
+ {
+ _lastOperation = null;
+ _lastStatus = null;
+ }
+
+ protected final Ice.Object _servant;
+ protected String _lastOperation;
+ protected Ice.DispatchStatus _lastStatus;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/interceptor/MyObjectI.java b/java-compat/test/src/main/java/test/Ice/interceptor/MyObjectI.java
new file mode 100644
index 00000000000..c3427f98686
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/interceptor/MyObjectI.java
@@ -0,0 +1,201 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.interceptor;
+
+import test.Ice.interceptor.Test.AMD_MyObject_amdAdd;
+import test.Ice.interceptor.Test.AMD_MyObject_amdAddWithRetry;
+import test.Ice.interceptor.Test.AMD_MyObject_amdBadAdd;
+import test.Ice.interceptor.Test.AMD_MyObject_amdBadSystemAdd;
+import test.Ice.interceptor.Test.AMD_MyObject_amdNotExistAdd;
+import test.Ice.interceptor.Test.InvalidInputException;
+import test.Ice.interceptor.Test.RetryException;
+import test.Ice.interceptor.Test._MyObjectDisp;
+
+class MyObjectI extends _MyObjectDisp
+{
+
+ @Override
+ public int
+ add(int x, int y, Ice.Current current)
+ {
+ return x + y;
+ }
+
+ @Override
+ public int
+ addWithRetry(int x, int y, Ice.Current current)
+ {
+ String val = current.ctx.get("retry");
+
+ if(val == null || !val.equals("no"))
+ {
+ throw new RetryException();
+ }
+ return x + y;
+ }
+
+ @Override
+ public int
+ badAdd(int x, int y, Ice.Current current) throws InvalidInputException
+ {
+ throw new InvalidInputException();
+ }
+
+ @Override
+ public int
+ notExistAdd(int x, int y, Ice.Current current)
+ {
+ throw new Ice.ObjectNotExistException();
+ }
+
+ @Override
+ public int
+ badSystemAdd(int x, int y, Ice.Current current)
+ {
+ throw new MySystemException();
+ }
+
+
+ //
+ // AMD
+ //
+
+ @Override
+ public void
+ amdAdd_async(final AMD_MyObject_amdAdd cb, final int x, final int y, Ice.Current current)
+ {
+ Thread thread = new Thread()
+ {
+ @Override
+ public void
+ run()
+ {
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(InterruptedException e)
+ {
+ }
+ cb.ice_response(x + y);
+ }
+ };
+
+ thread.setDaemon(true);
+ thread.start();
+ }
+
+ @Override
+ public void
+ amdAddWithRetry_async(final AMD_MyObject_amdAddWithRetry cb, final int x, final int y, Ice.Current current)
+ {
+ Thread thread = new Thread()
+ {
+ @Override
+ public void
+ run()
+ {
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(InterruptedException e)
+ {
+ }
+ cb.ice_response(x + y);
+ }
+ };
+
+ thread.setDaemon(true);
+ thread.start();
+
+ String val = current.ctx.get("retry");
+
+ if(val == null || !val.equals("no"))
+ {
+ throw new RetryException();
+ }
+ }
+
+ @Override
+ public void
+ amdBadAdd_async(final AMD_MyObject_amdBadAdd cb, int x, int y, Ice.Current current)
+ {
+ Thread thread = new Thread()
+ {
+ @Override
+ public void
+ run()
+ {
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(InterruptedException e)
+ {
+ }
+ cb.ice_exception(new InvalidInputException());
+ }
+ };
+
+ thread.setDaemon(true);
+ thread.start();
+ }
+
+ @Override
+ public void
+ amdNotExistAdd_async(final AMD_MyObject_amdNotExistAdd cb, int x, int y, Ice.Current current)
+ {
+ Thread thread = new Thread()
+ {
+ @Override
+ public void
+ run()
+ {
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(InterruptedException e)
+ {
+ }
+ cb.ice_exception(new Ice.ObjectNotExistException());
+ }
+ };
+
+ thread.setDaemon(true);
+ thread.start();
+ }
+
+ @Override
+ public void
+ amdBadSystemAdd_async(final AMD_MyObject_amdBadSystemAdd cb, int x, int y, Ice.Current current)
+ {
+ Thread thread = new Thread()
+ {
+ @Override
+ public void
+ run()
+ {
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(InterruptedException e)
+ {
+ }
+ cb.ice_exception(new MySystemException());
+ }
+ };
+
+ thread.setDaemon(true);
+ thread.start();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/interceptor/MySystemException.java b/java-compat/test/src/main/java/test/Ice/interceptor/MySystemException.java
new file mode 100644
index 00000000000..9b91678ad97
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/interceptor/MySystemException.java
@@ -0,0 +1,25 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.interceptor;
+
+
+public class MySystemException extends Ice.SystemException
+{
+ public MySystemException()
+ {
+ }
+
+ @Override
+ public String
+ ice_id()
+ {
+ return "::MySystemException";
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/interceptor/Test.ice b/java-compat/test/src/main/java/test/Ice/interceptor/Test.ice
new file mode 100644
index 00000000000..324f5f612fa
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/interceptor/Test.ice
@@ -0,0 +1,84 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.interceptor"]]
+module Test
+{
+
+exception InvalidInputException
+{
+ string message;
+};
+
+local exception RetryException
+{
+};
+
+interface MyObject
+{
+ //
+ // A simple addition
+ //
+ int add(int x, int y);
+
+ //
+ // Will throw RetryException until current.ctx["retry"] is "no"
+ //
+ int addWithRetry(int x, int y);
+
+ //
+ // Raise user exception
+ //
+ int badAdd(int x, int y) throws InvalidInputException;
+
+ //
+ // Raise ONE
+ //
+ int notExistAdd(int x, int y);
+
+ //
+ // Raise system exception
+ //
+ int badSystemAdd(int x, int y);
+
+ //
+ // AMD version of the above:
+ //
+
+ //
+ // Simple add
+ //
+ ["amd"] int amdAdd(int x, int y);
+
+ //
+ // Will throw RetryException until current.ctx["retry"] is "no"
+ //
+ ["amd"] int amdAddWithRetry(int x, int y);
+
+ //
+ // Raise user exception
+ //
+ ["amd"] int amdBadAdd(int x, int y) throws InvalidInputException;
+
+ //
+ // Raise ONE
+ //
+ ["amd"] int amdNotExistAdd(int x, int y);
+
+ //
+ // Raise system exception
+ //
+ ["amd"] int amdBadSystemAdd(int x, int y);
+
+};
+
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/interceptor/run.py b/java-compat/test/src/main/java/test/Ice/interceptor/run.py
new file mode 100755
index 00000000000..99d35706c32
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/interceptor/run.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+sys.stdout.write("starting client... ")
+sys.stdout.flush()
+clientProc = TestUtil.startClient("test.Ice.interceptor.Client", "--Ice.Warn.Dispatch=0",startReader=False)
+print("ok")
+clientProc.startReader()
+
+clientProc.waitTestSuccess()
diff --git a/java-compat/test/src/main/java/test/Ice/interrupt/AllTests.java b/java-compat/test/src/main/java/test/Ice/interrupt/AllTests.java
new file mode 100644
index 00000000000..0644cf92fef
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/interrupt/AllTests.java
@@ -0,0 +1,820 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.interrupt;
+
+import java.io.PrintWriter;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import test.Ice.interrupt.Test.Callback_TestIntf_op;
+import test.Ice.interrupt.Test.Callback_TestIntf_sleep;
+import test.Ice.interrupt.Test.CannotInterruptException;
+import test.Ice.interrupt.Test.TestIntfControllerPrx;
+import test.Ice.interrupt.Test.TestIntfControllerPrxHelper;
+import test.Ice.interrupt.Test.TestIntfPrx;
+import test.Ice.interrupt.Test.TestIntfPrxHelper;
+import Ice.AsyncResult;
+import Ice.Callback_Communicator_flushBatchRequests;
+import Ice.Callback_Connection_flushBatchRequests;
+import Ice.Callback_Object_ice_flushBatchRequests;
+import Ice.Callback_Object_ice_getConnection;
+import Ice.Connection;
+import Ice.LocalException;
+
+public class AllTests
+{
+ private static class CallbackBase
+ {
+ CallbackBase()
+ {
+ }
+
+ public synchronized void check()
+ {
+ while(!_called)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ _called = false;
+ }
+
+ public synchronized void called()
+ {
+ assert(!_called);
+ _called = true;
+ notify();
+ }
+
+ private boolean _called = false;
+ }
+
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private static void failIfNotInterrupted()
+ {
+ if(Thread.currentThread().isInterrupted())
+ {
+ Thread.interrupted();
+ }
+ else
+ {
+ test(false);
+ }
+ }
+
+ public static void
+ allTests(test.Util.Application app)
+ throws InterruptedException
+ {
+ Ice.Communicator communicator = app.communicator();
+ PrintWriter out = app.getWriter();
+ String sref = "test:default -p 12010";
+ Ice.ObjectPrx obj = communicator.stringToProxy(sref);
+ test(obj != null);
+
+ final TestIntfPrx p = TestIntfPrxHelper.uncheckedCast(obj);
+
+ sref = "testController:tcp -p 12011";
+ obj = communicator.stringToProxy(sref);
+ test(obj != null);
+
+ TestIntfControllerPrx testController = TestIntfControllerPrxHelper.uncheckedCast(obj);
+
+ out.print("testing client interrupt... ");
+ out.flush();
+ {
+ final Thread mainThread = Thread.currentThread();
+ mainThread.interrupt();
+ try
+ {
+ // Synchronous invocations are interruption points. If the
+ // interrupt flag is set at the start of the operation
+ // OperationInterruptedException must be thrown.
+ p.op();
+ test(false);
+ }
+ catch(Ice.OperationInterruptedException ex)
+ {
+ // Expected
+ test(!mainThread.isInterrupted());
+ }
+
+ // Same test with the AMI API.
+ try
+ {
+ Ice.AsyncResult r = p.begin_op();
+ mainThread.interrupt();
+ p.end_op(r);
+ test(false);
+ }
+ catch(Ice.OperationInterruptedException ex)
+ {
+ // Expected
+ test(!mainThread.isInterrupted());
+ }
+
+ final CallbackBase cb = new CallbackBase();
+ mainThread.interrupt();
+ p.begin_op(new Callback_TestIntf_op()
+ {
+ @Override
+ public void response()
+ {
+ cb.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ });
+ test(Thread.interrupted());
+ cb.check();
+
+ p.begin_op(new Ice.Callback()
+ {
+ @Override
+ public void completed(AsyncResult r)
+ {
+ try
+ {
+ Thread.currentThread().interrupt();
+ p.end_op(r);
+ test(false);
+ }
+ catch(Ice.OperationInterruptedException ex)
+ {
+ // Expected
+ test(!Thread.currentThread().isInterrupted());
+ }
+ }
+ });
+
+ ExecutorService executor = java.util.concurrent.Executors.newFixedThreadPool(1);
+ executor.submit(new Runnable() {
+ @Override
+ public void run()
+ {
+ try
+ {
+ Thread.sleep(500);
+ }
+ catch(InterruptedException e)
+ {
+ test(false);
+ }
+ mainThread.interrupt();
+ }
+ });
+
+ try
+ {
+ test(!mainThread.isInterrupted());
+ p.sleep(2000);
+ test(false);
+ }
+ catch(Ice.OperationInterruptedException ex)
+ {
+ // Expected
+ }
+ catch(test.Ice.interrupt.Test.InterruptedException e)
+ {
+ test(false);
+ }
+
+ executor.submit(new Runnable() {
+ @Override
+ public void run()
+ {
+ try
+ {
+ Thread.sleep(500);
+ }
+ catch(InterruptedException e)
+ {
+ test(false);
+ }
+ mainThread.interrupt();
+ }
+ });
+
+ try
+ {
+ test(!mainThread.isInterrupted());
+ Ice.AsyncResult r = p.begin_sleep(2000);
+ p.end_sleep(r);
+ test(false);
+ }
+ catch(Ice.OperationInterruptedException ex)
+ {
+ // Expected
+ }
+ catch(test.Ice.interrupt.Test.InterruptedException e)
+ {
+ test(false);
+ }
+
+ executor.submit(new Runnable() {
+ @Override
+ public void run()
+ {
+ try
+ {
+ Thread.sleep(500);
+ }
+ catch(InterruptedException e)
+ {
+ test(false);
+ }
+ mainThread.interrupt();
+ }
+ });
+
+ try
+ {
+ test(!mainThread.isInterrupted());
+ p.opIdempotent();
+ test(false);
+ }
+ catch(Ice.OperationInterruptedException ex)
+ {
+ // Expected
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ test(false);
+ }
+
+ // Test waitForCompleted is an interruption point.
+ try
+ {
+ Ice.AsyncResult r = p.begin_op();
+ try
+ {
+ Thread.currentThread().interrupt();
+ r.waitForCompleted();
+ test(false);
+ }
+ catch(Ice.OperationInterruptedException ex)
+ {
+ // Expected
+ }
+
+ // end_ should still work.
+ p.end_op(r);
+ }
+ catch(Ice.OperationInterruptedException ex)
+ {
+ test(false);
+ }
+
+ // Test waitForSent is an interruption point.
+ try
+ {
+ Ice.AsyncResult r = p.begin_op();
+ try
+ {
+ Thread.currentThread().interrupt();
+ r.waitForSent();
+ test(false);
+ }
+ catch(Ice.OperationInterruptedException ex)
+ {
+ // Expected
+ }
+
+ // end_ should still work.
+ p.end_op(r);
+ }
+ catch(Ice.OperationInterruptedException ex)
+ {
+ test(false);
+ }
+
+ // This section of the test doesn't run when collocated.
+ if(p.ice_getConnection() != null)
+ {
+ //
+ // Test interrupt of waitForSent. Here hold the adapter and send a large payload. The
+ // thread is interrupted in 500ms which should result in a operation interrupted exception.
+ //
+ executor.submit(new Runnable() {
+ @Override
+ public void run()
+ {
+ try
+ {
+ Thread.sleep(500);
+ }
+ catch(InterruptedException e)
+ {
+ test(false);
+ }
+ mainThread.interrupt();
+ }
+ });
+
+ testController.holdAdapter();
+ Ice.AsyncResult r = null;
+
+ // The sequence needs to be large enough to fill the write/recv buffers
+ int bufSize = 2000000;
+ byte[] seq = new byte[bufSize];
+ r = p.begin_opWithPayload(seq);
+ try
+ {
+ r.waitForSent();
+ test(false);
+ }
+ catch(Ice.OperationInterruptedException ex)
+ {
+ // Expected
+ }
+ //
+ // Resume the adapter.
+ //
+ testController.resumeAdapter();
+ r.waitForSent();
+ r.waitForCompleted();
+ p.end_opWithPayload(r);
+ }
+
+ //
+ // The executor is all done.
+ //
+ executor.shutdown();
+ while(!executor.isTerminated())
+ {
+ executor.awaitTermination(1000, TimeUnit.SECONDS);
+ }
+ }
+ out.println("ok");
+
+ if(p.ice_getCachedConnection() != null)
+ {
+ out.print("testing getConnection interrupt... ");
+ out.flush();
+ {
+ final Thread mainThread = Thread.currentThread();
+
+ p.ice_getConnection().close(false);
+
+ AsyncResult r = p.begin_ice_getConnection();
+ mainThread.interrupt();
+ try
+ {
+ p.end_ice_getConnection(r);
+ test(false);
+ }
+ catch(Ice.OperationInterruptedException ex)
+ {
+ // Expected
+ }
+
+ p.ice_getConnection().close(false);
+
+ final CallbackBase cb = new CallbackBase();
+ mainThread.interrupt();
+ p.begin_ice_getConnection(new Callback_Object_ice_getConnection()
+ {
+ @Override
+ public void exception(LocalException ex)
+ {
+ test(false);
+ }
+
+ @Override
+ public void response(Connection con)
+ {
+ cb.called();
+ }
+ });
+ test(Thread.interrupted());
+ cb.check();
+ }
+ out.println("ok");
+ }
+
+ out.print("testing batch proxy flush interrupt... ");
+ out.flush();
+ {
+ final TestIntfPrx p2 = TestIntfPrxHelper.uncheckedCast(p.ice_batchOneway());
+ final Thread mainThread = Thread.currentThread();
+
+ p2.op();
+ p2.op();
+ p2.op();
+
+ AsyncResult r = p2.begin_ice_flushBatchRequests();
+ mainThread.interrupt();
+ try
+ {
+ p2.end_ice_flushBatchRequests(r);
+ test(false);
+ }
+ catch(Ice.OperationInterruptedException ex)
+ {
+ // Expected
+ }
+
+ p2.op();
+ p2.op();
+ p2.op();
+
+ final CallbackBase cb = new CallbackBase();
+ mainThread.interrupt();
+ p2.begin_ice_flushBatchRequests(new Callback_Object_ice_flushBatchRequests()
+ {
+ @Override
+ public void sent(boolean sentSynchronously)
+ {
+ cb.called();
+ }
+
+ @Override
+ public void exception(LocalException ex)
+ {
+ test(false);
+ }
+ });
+ test(Thread.interrupted());
+ cb.check();
+ }
+ out.println("ok");
+
+ if(p.ice_getCachedConnection() != null)
+ {
+ out.print("testing batch connection flush interrupt... ");
+ out.flush();
+ {
+ final TestIntfPrx p2 = TestIntfPrxHelper.uncheckedCast(p.ice_batchOneway());
+ final Thread mainThread = Thread.currentThread();
+
+ p2.op();
+ p2.op();
+ p2.op();
+
+ AsyncResult r = p2.ice_getConnection().begin_flushBatchRequests();
+ mainThread.interrupt();
+ try
+ {
+ p2.ice_getCachedConnection().end_flushBatchRequests(r);
+ test(false);
+ }
+ catch(Ice.OperationInterruptedException ex)
+ {
+ // Expected
+ }
+
+ p2.op();
+ p2.op();
+ p2.op();
+
+ final CallbackBase cb = new CallbackBase();
+ Ice.Connection con = p2.ice_getConnection();
+ mainThread.interrupt();
+ con.begin_flushBatchRequests(new Callback_Connection_flushBatchRequests()
+ {
+ @Override
+ public void sent(boolean sentSynchronously)
+ {
+ cb.called();
+ }
+
+ @Override
+ public void exception(LocalException ex)
+ {
+ test(false);
+ }
+ });
+ test(Thread.interrupted());
+ cb.check();
+ }
+ out.println("ok");
+ }
+
+ out.print("testing batch communicator flush interrupt... ");
+ out.flush();
+ {
+ final TestIntfPrx p2 = TestIntfPrxHelper.uncheckedCast(p.ice_batchOneway());
+ final Thread mainThread = Thread.currentThread();
+
+ p2.op();
+ p2.op();
+ p2.op();
+
+ AsyncResult r = communicator.begin_flushBatchRequests();
+ mainThread.interrupt();
+ try
+ {
+ communicator.end_flushBatchRequests(r);
+ test(false);
+ }
+ catch(Ice.OperationInterruptedException ex)
+ {
+ // Expected
+ }
+
+ p2.op();
+ p2.op();
+ p2.op();
+
+ final CallbackBase cb = new CallbackBase();
+ mainThread.interrupt();
+ communicator.begin_flushBatchRequests(new Callback_Communicator_flushBatchRequests()
+ {
+ @Override
+ public void sent(boolean sentSynchronously)
+ {
+ cb.called();
+ }
+
+ @Override
+ public void exception(LocalException ex)
+ {
+ test(false);
+ }
+ });
+ test(Thread.interrupted());
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("testing Communicator.destroy interrupt... ");
+ out.flush();
+ if(p.ice_getConnection() != null)
+ {
+ //
+ // Check that CommunicatorDestroyedException is raised directly.
+ //
+ Ice.InitializationData initData = app.createInitializationData();
+ initData.properties = communicator.getProperties()._clone();
+ Ice.Communicator ic = app.initialize(initData);
+
+ Thread.currentThread().interrupt();
+ try
+ {
+ ic.destroy();
+ failIfNotInterrupted();
+ }
+ catch(Ice.OperationInterruptedException ex)
+ {
+ // Expected
+ }
+ ic.destroy();
+
+ ExecutorService executor = java.util.concurrent.Executors.newFixedThreadPool(2);
+
+ ic = app.initialize(initData);
+ Ice.ObjectPrx o = ic.stringToProxy(p.toString());
+
+ final Thread[] thread = new Thread[1];
+
+ final CallbackBase cb = new CallbackBase();
+ final TestIntfPrx p2 = TestIntfPrxHelper.checkedCast(o);
+ final CountDownLatch waitSignal = new CountDownLatch(1);
+ p2.begin_op(new Callback_TestIntf_op()
+ {
+ @Override
+ public void response()
+ {
+ try
+ {
+ Thread.sleep(250);
+ }
+ catch(InterruptedException e1)
+ {
+ test(false);
+ }
+ thread[0] = Thread.currentThread();
+ waitSignal.countDown();
+ try
+ {
+ Thread.sleep(10000);
+ test(false);
+ }
+ catch(InterruptedException e)
+ {
+ // Expected
+ }
+ cb.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+
+ }
+ });
+ executor.submit(new Runnable() {
+ @Override
+ public void run()
+ {
+ try
+ {
+ waitSignal.await();
+ }
+ catch(InterruptedException e)
+ {
+ test(false);
+ }
+ thread[0].interrupt();
+ }
+ });
+
+ try
+ {
+ waitSignal.await();
+ }
+ catch(InterruptedException e)
+ {
+ test(false);
+ }
+ ic.destroy();
+
+ cb.check();
+
+ executor.shutdown();
+ while(!executor.isTerminated())
+ {
+ executor.awaitTermination(1000, TimeUnit.SECONDS);
+ }
+ }
+ out.println("ok");
+
+ out.print("testing server interrupt... ");
+ out.flush();
+ {
+ final CallbackBase cb = new CallbackBase();
+ p.begin_sleep(2000, new Callback_TestIntf_sleep()
+ {
+ @Override
+ public void response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ @Override
+ public void exception(Ice.UserException ex)
+ {
+ test(ex instanceof test.Ice.interrupt.Test.InterruptedException);
+ cb.called();
+ }
+ });
+ try
+ {
+ Thread.sleep(250);
+ }
+ catch(InterruptedException e)
+ {
+ test(false);
+ }
+ try
+ {
+ testController.interrupt();
+ }
+ catch(CannotInterruptException e)
+ {
+ test(false);
+ }
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("testing wait methods... ");
+ out.flush();
+ {
+ final Thread mainThread = Thread.currentThread();
+ ExecutorService executor = java.util.concurrent.Executors.newFixedThreadPool(1);
+ Ice.InitializationData initData = app.createInitializationData();
+ initData.properties = communicator.getProperties()._clone();
+ initData.properties.setProperty("ClientTestAdapter.Endpoints", "default -p 12030");
+ Ice.Communicator ic = app.initialize(initData);
+ final Ice.ObjectAdapter adapter = ic.createObjectAdapter("ClientTestAdapter");
+ adapter.activate();
+
+ try
+ {
+ mainThread.interrupt();
+ adapter.waitForHold();
+ test(false);
+ }
+ catch(Ice.OperationInterruptedException e)
+ {
+ // Expected.
+ }
+
+ try
+ {
+ mainThread.interrupt();
+ adapter.waitForDeactivate();
+ test(false);
+ }
+ catch(Ice.OperationInterruptedException e)
+ {
+ // Expected.
+ }
+
+ try
+ {
+ mainThread.interrupt();
+ ic.waitForShutdown();
+ test(false);
+ }
+ catch(Ice.OperationInterruptedException e)
+ {
+ // Expected.
+ }
+
+ Runnable interruptMainThread = new Runnable() {
+ @Override
+ public void run()
+ {
+ try
+ {
+ Thread.sleep(250);
+ }
+ catch(InterruptedException e)
+ {
+ test(false);
+ }
+ mainThread.interrupt();
+ }
+ };
+
+ executor.execute(interruptMainThread);
+ try
+ {
+ adapter.waitForHold();
+ test(false);
+ }
+ catch(Ice.OperationInterruptedException e)
+ {
+ // Expected.
+ }
+
+ executor.execute(interruptMainThread);
+ try
+ {
+ adapter.waitForDeactivate();
+ test(false);
+ }
+ catch(Ice.OperationInterruptedException e)
+ {
+ // Expected.
+ }
+
+ executor.execute(interruptMainThread);
+ try
+ {
+ ic.waitForShutdown();
+ test(false);
+ }
+ catch(Ice.OperationInterruptedException e)
+ {
+ // Expected.
+ }
+
+ ic.destroy();
+
+ executor.shutdown();
+ while(!executor.isTerminated())
+ {
+ executor.awaitTermination(1000, TimeUnit.SECONDS);
+ }
+ }
+ out.println("ok");
+
+ p.shutdown();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/interrupt/Client.java b/java-compat/test/src/main/java/test/Ice/interrupt/Client.java
new file mode 100644
index 00000000000..371286e2b20
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/interrupt/Client.java
@@ -0,0 +1,65 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.interrupt;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ try
+ {
+ AllTests.allTests(this);
+ }
+ catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ throw new RuntimeException();
+ }
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.interrupt");
+ //
+ // We need to enable the ThreadInterruptSafe property so that Ice is
+ // interrupt safe for this test.
+ //
+ initData.properties.setProperty("Ice.ThreadInterruptSafe", "1");
+ //
+ // We need to send messages large enough to cause the transport
+ // buffers to fill up.
+ //
+ initData.properties.setProperty("Ice.MessageSizeMax", "20000");
+ //
+ // Retry up to 2 times, sleep 1s for the last retry. This is
+ // useful to test interrupting the retry sleep
+ //
+ initData.properties.setProperty("Ice.RetryIntervals", "0 1000");
+ //
+ // Limit the send buffer size, this test relies on the socket
+ // send() blocking after sending a given amount of data.
+ //
+ initData.properties.setProperty("Ice.TCP.SndSize", "50000");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/interrupt/Collocated.java b/java-compat/test/src/main/java/test/Ice/interrupt/Collocated.java
new file mode 100644
index 00000000000..61d24074a80
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/interrupt/Collocated.java
@@ -0,0 +1,71 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.interrupt;
+
+public class Collocated extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
+ TestControllerI controller = new TestControllerI(adapter);
+ adapter.add(new TestI(controller), Ice.Util.stringToIdentity("test"));
+ //adapter.activate(); // Don't activate OA to ensure collocation is used.
+ adapter2.add(controller, Ice.Util.stringToIdentity("testController"));
+ //adapter2.activate(); // Don't activate OA to ensure collocation is used.
+
+ try
+ {
+ AllTests.allTests(this);
+ }
+ catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ throw new RuntimeException();
+ }
+
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.interrupt");
+ //
+ // We need to enable the ThreadInterruptSafe property so that Ice is
+ // interrupt safe for this test.
+ //
+ initData.properties.setProperty("Ice.ThreadInterruptSafe", "1");
+ //
+ // We need to send messages large enough to cause the transport
+ // buffers to fill up.
+ //
+ initData.properties.setProperty("Ice.MessageSizeMax", "20000");
+
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
+ initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
+
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Collocated c = new Collocated();
+ int status = c.main("Collocated", args);
+
+ System.gc();
+ System.exit(status);
+ }
+
+}
diff --git a/java-compat/test/src/main/java/test/Ice/interrupt/Server.java b/java-compat/test/src/main/java/test/Ice/interrupt/Server.java
new file mode 100644
index 00000000000..0ab16417b99
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/interrupt/Server.java
@@ -0,0 +1,71 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.interrupt;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int
+ run(String[] args)
+ {
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
+
+ TestControllerI controller = new TestControllerI(adapter);
+ adapter.add(new TestI(controller), Ice.Util.stringToIdentity("test"));
+ adapter.activate();
+ adapter2.add(controller, Ice.Util.stringToIdentity("testController"));
+ adapter2.activate();
+
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.interrupt");
+ //
+ // We need to enable the ThreadInterruptSafe property so that Ice is
+ // interrupt safe for this test.
+ //
+ initData.properties.setProperty("Ice.ThreadInterruptSafe", "1");
+ //
+ // We need to send messages large enough to cause the transport
+ // buffers to fill up.
+ //
+ initData.properties.setProperty("Ice.MessageSizeMax", "20000");
+ //
+ // opIndempotent raises UnknownException, we disable dispatch
+ // warnings to prevent warnings.
+ //
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
+ initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
+ //
+ // Limit the recv buffer size, this test relies on the socket
+ // send() blocking after sending a given amount of data.
+ //
+ initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
+ return initData;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/interrupt/Test.ice b/java-compat/test/src/main/java/test/Ice/interrupt/Test.ice
new file mode 100644
index 00000000000..8e46433c66c
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/interrupt/Test.ice
@@ -0,0 +1,44 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+#include <Ice/BuiltinSequences.ice>
+
+[["java:package:test.Ice.interrupt"]]
+module Test
+{
+
+exception InterruptedException
+{
+};
+
+interface TestIntf
+{
+ void op();
+ idempotent void opIdempotent();
+ void sleep(int to)
+ throws InterruptedException;
+ void opWithPayload(Ice::ByteSeq seq);
+ void shutdown();
+};
+
+exception CannotInterruptException
+{
+};
+
+interface TestIntfController
+{
+ void holdAdapter();
+ void resumeAdapter();
+ void interrupt()
+ throws CannotInterruptException;
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/interrupt/TestControllerI.java b/java-compat/test/src/main/java/test/Ice/interrupt/TestControllerI.java
new file mode 100644
index 00000000000..8c63779681c
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/interrupt/TestControllerI.java
@@ -0,0 +1,69 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.interrupt;
+
+import java.util.ArrayList;
+import java.util.List;
+
+class TestControllerI extends test.Ice.interrupt.Test._TestIntfControllerDisp
+{
+ synchronized void
+ addUpcallThread()
+ {
+ _threads.add(Thread.currentThread());
+ }
+
+ synchronized void
+ removeUpcallThread()
+ {
+ _threads.remove(Thread.currentThread());
+ //
+ // Clear the interrupted state after removing the thread.
+ //
+ Thread.interrupted();
+ }
+
+ @Override
+ synchronized public void
+ interrupt(Ice.Current __current)
+ throws test.Ice.interrupt.Test.CannotInterruptException
+ {
+ if(_threads.isEmpty())
+ {
+ throw new test.Ice.interrupt.Test.CannotInterruptException();
+ }
+ for(Thread t : _threads)
+ {
+ t.interrupt();
+ }
+ }
+
+ @Override
+ public void
+ holdAdapter(Ice.Current current)
+ {
+ _adapter.hold();
+ }
+
+ @Override
+ public void
+ resumeAdapter(Ice.Current current)
+ {
+ _adapter.activate();
+ }
+
+ TestControllerI(Ice.ObjectAdapter adapter)
+ {
+ _adapter = adapter;
+ }
+
+ final private Ice.ObjectAdapter _adapter;
+ final private List<Thread> _threads = new ArrayList<Thread>();
+}
diff --git a/java-compat/test/src/main/java/test/Ice/interrupt/TestI.java b/java-compat/test/src/main/java/test/Ice/interrupt/TestI.java
new file mode 100644
index 00000000000..4442e8f4690
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/interrupt/TestI.java
@@ -0,0 +1,67 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.interrupt;
+
+public class TestI extends test.Ice.interrupt.Test._TestIntfDisp
+{
+ TestI(TestControllerI controller)
+ {
+ _controller = controller;
+ }
+
+ @Override
+ public void
+ op(Ice.Current current)
+ {
+ }
+
+ @Override
+ public void
+ opIdempotent(Ice.Current current)
+ {
+ throw new Ice.UnknownException();
+ }
+
+
+ @Override
+ public void
+ sleep(int to, Ice.Current current)
+ throws test.Ice.interrupt.Test.InterruptedException
+ {
+ _controller.addUpcallThread();
+ try
+ {
+ Thread.sleep(to);
+ }
+ catch(InterruptedException ex)
+ {
+ throw new test.Ice.interrupt.Test.InterruptedException();
+ }
+ finally
+ {
+ _controller.removeUpcallThread();
+ }
+ }
+
+ @Override
+ public void
+ opWithPayload(byte[] seq, Ice.Current current)
+ {
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+
+ private TestControllerI _controller;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/interrupt/run.py b/java-compat/test/src/main/java/test/Ice/interrupt/run.py
new file mode 100755
index 00000000000..97eec95871b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/interrupt/run.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.queueCollocatedTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/invoke/AllTests.java b/java-compat/test/src/main/java/test/Ice/invoke/AllTests.java
new file mode 100644
index 00000000000..e8815255312
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/invoke/AllTests.java
@@ -0,0 +1,394 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.invoke;
+import java.io.PrintWriter;
+
+import test.Ice.invoke.Test.MyClassPrx;
+import test.Ice.invoke.Test.MyClassPrxHelper;
+import test.Ice.invoke.Test.MyException;
+
+public class AllTests
+{
+ final static String testString = "This is a test string";
+
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private static class Callback
+ {
+ Callback()
+ {
+ _called = false;
+ }
+
+ public synchronized void check()
+ {
+ while(!_called)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ _called = false;
+ }
+
+ public synchronized void called()
+ {
+ assert(!_called);
+ _called = true;
+ notify();
+ }
+
+ private boolean _called;
+ }
+
+ private static class opStringI extends Ice.Callback
+ {
+ public opStringI(Ice.Communicator communicator)
+ {
+ _communicator = communicator;
+ }
+
+ @Override
+ public void completed(Ice.AsyncResult result)
+ {
+ Ice.ByteSeqHolder outEncaps = new Ice.ByteSeqHolder();
+ if(result.getProxy().end_ice_invoke(outEncaps, result))
+ {
+ Ice.InputStream inS = new Ice.InputStream(_communicator, outEncaps.value);
+ inS.startEncapsulation();
+ String s = inS.readString();
+ test(s.equals(testString));
+ s = inS.readString();
+ test(s.equals(testString));
+ inS.endEncapsulation();
+ callback.called();
+ }
+ else
+ {
+ test(false);
+ }
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Ice.Communicator _communicator;
+ private Callback callback = new Callback();
+ }
+
+ private static class opExceptionI extends Ice.Callback
+ {
+ public opExceptionI(Ice.Communicator communicator)
+ {
+ _communicator = communicator;
+ }
+
+ @Override
+ public void completed(Ice.AsyncResult result)
+ {
+ Ice.ByteSeqHolder outEncaps = new Ice.ByteSeqHolder();
+ if(result.getProxy().end_ice_invoke(outEncaps, result))
+ {
+ test(false);
+ }
+ else
+ {
+ Ice.InputStream inS = new Ice.InputStream(_communicator, outEncaps.value);
+ inS.startEncapsulation();
+ try
+ {
+ inS.throwException();
+ }
+ catch(MyException ex)
+ {
+ inS.endEncapsulation();
+ callback.called();
+ }
+ catch(java.lang.Exception ex)
+ {
+ test(false);
+ }
+ }
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Ice.Communicator _communicator;
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_Object_opStringI extends Ice.Callback_Object_ice_invoke
+ {
+ public Callback_Object_opStringI(Ice.Communicator communicator)
+ {
+ _communicator = communicator;
+ }
+
+ @Override
+ public void response(boolean ok, byte[] outEncaps)
+ {
+ if(ok)
+ {
+ Ice.InputStream inS = new Ice.InputStream(_communicator, outEncaps);
+ inS.startEncapsulation();
+ String s = inS.readString();
+ test(s.equals(testString));
+ s = inS.readString();
+ test(s.equals(testString));
+ inS.endEncapsulation();
+ callback.called();
+ }
+ else
+ {
+ test(false);
+ }
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Ice.Communicator _communicator;
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_Object_opExceptionI extends Ice.Callback_Object_ice_invoke
+ {
+ public Callback_Object_opExceptionI(Ice.Communicator communicator)
+ {
+ _communicator = communicator;
+ }
+
+ @Override
+ public void response(boolean ok, byte[] outEncaps)
+ {
+ if(ok)
+ {
+ test(false);
+ }
+ else
+ {
+ Ice.InputStream inS = new Ice.InputStream(_communicator, outEncaps);
+ inS.startEncapsulation();
+ try
+ {
+ inS.throwException();
+ }
+ catch(MyException ex)
+ {
+ inS.endEncapsulation();
+ callback.called();
+ }
+ catch(java.lang.Exception ex)
+ {
+ test(false);
+ }
+ }
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Ice.Communicator _communicator;
+ private Callback callback = new Callback();
+ }
+
+ public static MyClassPrx
+ allTests(Ice.Communicator communicator, PrintWriter out)
+ {
+ String ref = "test:default -p 12010";
+ Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ MyClassPrx cl = MyClassPrxHelper.checkedCast(base);
+ MyClassPrx oneway = MyClassPrxHelper.uncheckedCast(cl.ice_oneway());
+ MyClassPrx batchOneway = MyClassPrxHelper.uncheckedCast(cl.ice_batchOneway());
+
+ out.print("testing ice_invoke... ");
+ out.flush();
+
+ {
+ if(!oneway.ice_invoke("opOneway", Ice.OperationMode.Normal, null, null))
+ {
+ test(false);
+ }
+
+ test(batchOneway.ice_invoke("opOneway", Ice.OperationMode.Normal, null, null));
+ test(batchOneway.ice_invoke("opOneway", Ice.OperationMode.Normal, null, null));
+ test(batchOneway.ice_invoke("opOneway", Ice.OperationMode.Normal, null, null));
+ test(batchOneway.ice_invoke("opOneway", Ice.OperationMode.Normal, null, null));
+ batchOneway.ice_flushBatchRequests();
+
+ Ice.OutputStream outS = new Ice.OutputStream(communicator);
+ outS.startEncapsulation();
+ outS.writeString(testString);
+ outS.endEncapsulation();
+ byte[] inEncaps = outS.finished();
+ Ice.ByteSeqHolder outEncaps = new Ice.ByteSeqHolder();
+ if(cl.ice_invoke("opString", Ice.OperationMode.Normal, inEncaps, outEncaps))
+ {
+ Ice.InputStream inS = new Ice.InputStream(communicator, outEncaps.value);
+ inS.startEncapsulation();
+ String s = inS.readString();
+ test(s.equals(testString));
+ s = inS.readString();
+ inS.endEncapsulation();
+ test(s.equals(testString));
+ }
+ else
+ {
+ test(false);
+ }
+ }
+
+ {
+ Ice.ByteSeqHolder outEncaps = new Ice.ByteSeqHolder();
+ if(cl.ice_invoke("opException", Ice.OperationMode.Normal, null, outEncaps))
+ {
+ test(false);
+ }
+ else
+ {
+ Ice.InputStream inS = new Ice.InputStream(communicator, outEncaps.value);
+ inS.startEncapsulation();
+ try
+ {
+ inS.throwException();
+ }
+ catch(MyException ex)
+ {
+ }
+ catch(java.lang.Exception ex)
+ {
+ test(false);
+ }
+ inS.endEncapsulation();
+ }
+ }
+
+ out.println("ok");
+
+ out.print("testing asynchronous ice_invoke... ");
+ out.flush();
+
+ {
+ Ice.AsyncResult result = oneway.begin_ice_invoke("opOneway", Ice.OperationMode.Normal, null);
+ Ice.ByteSeqHolder outEncaps = new Ice.ByteSeqHolder();
+ if(!oneway.end_ice_invoke(outEncaps, result))
+ {
+ test(false);
+ }
+
+ Ice.OutputStream outS = new Ice.OutputStream(communicator);
+ outS.startEncapsulation();
+ outS.writeString(testString);
+ outS.endEncapsulation();
+ byte[] inEncaps = outS.finished();
+
+ // begin_ice_invoke with no callback
+ result = cl.begin_ice_invoke("opString", Ice.OperationMode.Normal, inEncaps);
+ if(cl.end_ice_invoke(outEncaps, result))
+ {
+ Ice.InputStream inS = new Ice.InputStream(communicator, outEncaps.value);
+ inS.startEncapsulation();
+ String s = inS.readString();
+ test(s.equals(testString));
+ s = inS.readString();
+ inS.endEncapsulation();
+ test(s.equals(testString));
+ }
+ else
+ {
+ test(false);
+ }
+
+ // begin_ice_invoke with Callback
+ opStringI cb1 = new opStringI(communicator);
+ cl.begin_ice_invoke("opString", Ice.OperationMode.Normal, inEncaps, cb1);
+ cb1.check();
+
+ // begin_ice_invoke with Callback_Object_ice_invoke
+ Callback_Object_opStringI cb2 = new Callback_Object_opStringI(communicator);
+ cl.begin_ice_invoke("opString", Ice.OperationMode.Normal, inEncaps, cb2);
+ cb2.check();
+ }
+
+ {
+ // begin_ice_invoke with no callback
+ Ice.AsyncResult result = cl.begin_ice_invoke("opException", Ice.OperationMode.Normal, null);
+ Ice.ByteSeqHolder outEncaps = new Ice.ByteSeqHolder();
+ if(cl.end_ice_invoke(outEncaps, result))
+ {
+ test(false);
+ }
+ else
+ {
+ Ice.InputStream inS = new Ice.InputStream(communicator, outEncaps.value);
+ inS.startEncapsulation();
+ try
+ {
+ inS.throwException();
+ }
+ catch(MyException ex)
+ {
+ }
+ catch(java.lang.Exception ex)
+ {
+ test(false);
+ }
+ inS.endEncapsulation();
+ }
+
+ // begin_ice_invoke with Callback
+ opExceptionI cb1 = new opExceptionI(communicator);
+ cl.begin_ice_invoke("opException", Ice.OperationMode.Normal, null, cb1);
+ cb1.check();
+
+ // begin_ice_invoke with Callback_Object_ice_invoke
+ Callback_Object_opExceptionI cb2 = new Callback_Object_opExceptionI(communicator);
+ cl.begin_ice_invoke("opException", Ice.OperationMode.Normal, null, cb2);
+ cb2.check();
+ }
+
+ out.println("ok");
+
+ return cl;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/invoke/BlobjectAsyncI.java b/java-compat/test/src/main/java/test/Ice/invoke/BlobjectAsyncI.java
new file mode 100644
index 00000000000..baf14b2a5fb
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/invoke/BlobjectAsyncI.java
@@ -0,0 +1,72 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.invoke;
+
+import test.Ice.invoke.Test.MyException;
+
+public class BlobjectAsyncI extends Ice.BlobjectAsync
+{
+ @Override
+ public void
+ ice_invoke_async(Ice.AMD_Object_ice_invoke cb, byte[] inParams, Ice.Current current)
+ {
+ Ice.Communicator communicator = current.adapter.getCommunicator();
+ Ice.InputStream in = new Ice.InputStream(communicator, inParams);
+ in.startEncapsulation();
+ Ice.OutputStream out = new Ice.OutputStream(communicator);
+ out.startEncapsulation();
+ if(current.operation.equals("opOneway"))
+ {
+ cb.ice_response(true, new byte[0]);
+ }
+ else if(current.operation.equals("opString"))
+ {
+ String s = in.readString();
+ out.writeString(s);
+ out.writeString(s);
+ out.endEncapsulation();
+ cb.ice_response(true, out.finished());
+ }
+ else if(current.operation.equals("opException"))
+ {
+ MyException ex = new MyException();
+ out.writeException(ex);
+ out.endEncapsulation();
+ cb.ice_response(false, out.finished());
+ }
+ else if(current.operation.equals("shutdown"))
+ {
+ communicator.shutdown();
+ cb.ice_response(true, null);
+ }
+ else if(current.operation.equals("ice_isA"))
+ {
+ String s = in.readString();
+ if(s.equals("::Test::MyClass"))
+ {
+ out.writeBool(true);
+ }
+ else
+ {
+ out.writeBool(false);
+ }
+ out.endEncapsulation();
+ cb.ice_response(true, out.finished());
+ }
+ else
+ {
+ Ice.OperationNotExistException ex = new Ice.OperationNotExistException();
+ ex.id = current.id;
+ ex.facet = current.facet;
+ ex.operation = current.operation;
+ throw ex;
+ }
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/invoke/BlobjectI.java b/java-compat/test/src/main/java/test/Ice/invoke/BlobjectI.java
new file mode 100644
index 00000000000..8d7d90e71db
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/invoke/BlobjectI.java
@@ -0,0 +1,76 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.invoke;
+
+import test.Ice.invoke.Test.MyException;
+
+public class BlobjectI extends Ice.Blobject
+{
+ @Override
+ public boolean
+ ice_invoke(byte[] inParams, Ice.ByteSeqHolder outParams, Ice.Current current)
+ {
+ Ice.Communicator communicator = current.adapter.getCommunicator();
+ Ice.InputStream in = new Ice.InputStream(communicator, inParams);
+ in.startEncapsulation();
+ Ice.OutputStream out = new Ice.OutputStream(communicator);
+ out.startEncapsulation();
+ if(current.operation.equals("opOneway"))
+ {
+ outParams.value = new byte[0];
+ return true;
+ }
+ else if(current.operation.equals("opString"))
+ {
+ String s = in.readString();
+ out.writeString(s);
+ out.writeString(s);
+ out.endEncapsulation();
+ outParams.value = out.finished();
+ return true;
+ }
+ else if(current.operation.equals("opException"))
+ {
+ MyException ex = new MyException();
+ out.writeException(ex);
+ out.endEncapsulation();
+ outParams.value = out.finished();
+ return false;
+ }
+ else if(current.operation.equals("shutdown"))
+ {
+ communicator.shutdown();
+ return true;
+ }
+ else if(current.operation.equals("ice_isA"))
+ {
+ String s = in.readString();
+ if(s.equals("::Test::MyClass"))
+ {
+ out.writeBool(true);
+ }
+ else
+ {
+ out.writeBool(false);
+ }
+ out.endEncapsulation();
+ outParams.value = out.finished();
+ return true;
+ }
+ else
+ {
+ Ice.OperationNotExistException ex = new Ice.OperationNotExistException();
+ ex.id = current.id;
+ ex.facet = current.facet;
+ ex.operation = current.operation;
+ throw ex;
+ }
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/invoke/Client.java b/java-compat/test/src/main/java/test/Ice/invoke/Client.java
new file mode 100644
index 00000000000..dc376487ffe
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/invoke/Client.java
@@ -0,0 +1,69 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.invoke;
+
+import test.Ice.invoke.Test.MyClassPrx;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ MyClassPrx myClass = AllTests.allTests(communicator(), getWriter());
+
+ //
+ // Use reflection to load lambda.AllTests as that is only supported with Java >= 1.8
+ //
+ try
+ {
+ Class<?> cls = IceInternal.Util.findClass("test.Ice.invoke.lambda.AllTests", null);
+ if(cls != null)
+ {
+ java.lang.reflect.Method allTests = cls.getDeclaredMethod("allTests",
+ new Class<?>[]{Ice.Communicator.class, java.io.PrintWriter.class});
+ allTests.invoke(null, communicator(), getWriter());
+ }
+ }
+ catch(java.lang.NoSuchMethodException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ catch(java.lang.IllegalAccessException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ catch(java.lang.reflect.InvocationTargetException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+
+ myClass.shutdown();
+
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.invoke");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/invoke/ServantLocatorI.java b/java-compat/test/src/main/java/test/Ice/invoke/ServantLocatorI.java
new file mode 100644
index 00000000000..93b96a648ff
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/invoke/ServantLocatorI.java
@@ -0,0 +1,46 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.invoke;
+
+public class ServantLocatorI implements Ice.ServantLocator
+{
+ public ServantLocatorI( boolean async)
+ {
+ if(async)
+ {
+ _blobject = new BlobjectAsyncI();
+ }
+ else
+ {
+ _blobject = new BlobjectI();
+ }
+ }
+
+ @Override
+ public Ice.Object
+ locate(Ice.Current current, Ice.LocalObjectHolder cookie)
+ {
+ return _blobject;
+ }
+
+ @Override
+ public void
+ finished(Ice.Current current, Ice.Object servant, java.lang.Object cookie)
+ {
+ }
+
+ @Override
+ public void
+ deactivate(String category)
+ {
+ }
+
+ private Ice.Object _blobject;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/invoke/Server.java b/java-compat/test/src/main/java/test/Ice/invoke/Server.java
new file mode 100644
index 00000000000..9ce06acc55b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/invoke/Server.java
@@ -0,0 +1,50 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.invoke;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ boolean async = false;
+ for(int i = 0; i < args.length; ++i)
+ {
+ if(args[i].equals("--async"))
+ {
+ async = true;
+ }
+ }
+
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.addServantLocator(new ServantLocatorI(async), "");
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.invoke");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server c = new Server();
+ int status = c.main("Server", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/invoke/Test.ice b/java-compat/test/src/main/java/test/Ice/invoke/Test.ice
new file mode 100644
index 00000000000..aca42de1940
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/invoke/Test.ice
@@ -0,0 +1,31 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.invoke"]]
+module Test
+{
+
+exception MyException
+{
+};
+
+class MyClass
+{
+ void opOneway();
+
+ string opString(string s1, out string s2);
+
+ void opException() throws MyException;
+
+ void shutdown();
+};
+
+};
diff --git a/java/test/src/main/java/test/Ice/invoke/lambda/AllTests.java b/java-compat/test/src/main/java/test/Ice/invoke/lambda/AllTests.java
index 49af565024c..49af565024c 100644
--- a/java/test/src/main/java/test/Ice/invoke/lambda/AllTests.java
+++ b/java-compat/test/src/main/java/test/Ice/invoke/lambda/AllTests.java
diff --git a/java-compat/test/src/main/java/test/Ice/invoke/run.py b/java-compat/test/src/main/java/test/Ice/invoke/run.py
new file mode 100755
index 00000000000..cc257835523
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/invoke/run.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest(configName = "blobject", message = "Running test with Blobject server.")
+TestUtil.queueClientServerTest(configName = "blobjectAsync", message = "Running test with BlobjectAsync server.",
+ additionalServerOptions = "--async")
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/location/AllTests.java b/java-compat/test/src/main/java/test/Ice/location/AllTests.java
new file mode 100644
index 00000000000..33bada684a8
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/location/AllTests.java
@@ -0,0 +1,696 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.location;
+
+import java.io.PrintWriter;
+
+import test.Ice.location.Test.Callback_Hello_sayHello;
+import test.Ice.location.Test.HelloPrx;
+import test.Ice.location.Test.HelloPrxHelper;
+import test.Ice.location.Test.ServerManagerPrx;
+import test.Ice.location.Test.ServerManagerPrxHelper;
+import test.Ice.location.Test.TestIntfPrx;
+import test.Ice.location.Test.TestIntfPrxHelper;
+import test.Ice.location.Test.TestLocatorPrx;
+import test.Ice.location.Test.TestLocatorPrxHelper;
+import test.Ice.location.Test.TestLocatorRegistryPrx;
+import test.Ice.location.Test.TestLocatorRegistryPrxHelper;
+import test.Util.Application;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static void
+ allTests(Application app)
+ throws Ice.AdapterAlreadyActiveException, Ice.AdapterNotFoundException, InterruptedException
+ {
+ Ice.Communicator communicator = app.communicator();
+ PrintWriter out = app.getWriter();
+
+ ServerManagerPrx manager = ServerManagerPrxHelper.checkedCast(
+ communicator.stringToProxy("ServerManager :default -p 12010"));
+ test(manager != null);
+
+ TestLocatorPrx locator = TestLocatorPrxHelper.uncheckedCast(communicator.getDefaultLocator());
+ test(locator != null);
+
+ TestLocatorRegistryPrx registry = TestLocatorRegistryPrxHelper.checkedCast(locator.getRegistry());
+ test(registry != null);
+
+ out.print("testing stringToProxy... ");
+ out.flush();
+ Ice.ObjectPrx base = communicator.stringToProxy("test @ TestAdapter");
+ Ice.ObjectPrx base2 = communicator.stringToProxy("test @ TestAdapter");
+ Ice.ObjectPrx base3 = communicator.stringToProxy("test");
+ Ice.ObjectPrx base4 = communicator.stringToProxy("ServerManager");
+ Ice.ObjectPrx base5 = communicator.stringToProxy("test2");
+ Ice.ObjectPrx base6 = communicator.stringToProxy("test @ ReplicatedAdapter");
+ out.println("ok");
+
+ out.print("testing ice_locator and ice_getLocator... ");
+ test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), communicator.getDefaultLocator()) == 0);
+ Ice.LocatorPrx anotherLocator =
+ Ice.LocatorPrxHelper.uncheckedCast(communicator.stringToProxy("anotherLocator"));
+ base = base.ice_locator(anotherLocator);
+ test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), anotherLocator) == 0);
+ communicator.setDefaultLocator(null);
+ base = communicator.stringToProxy("test @ TestAdapter");
+ test(base.ice_getLocator() == null);
+ base = base.ice_locator(anotherLocator);
+ test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), anotherLocator) == 0);
+ communicator.setDefaultLocator(locator);
+ base = communicator.stringToProxy("test @ TestAdapter");
+ test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), communicator.getDefaultLocator()) == 0);
+
+ //
+ // We also test ice_router/ice_getRouter (perhaps we should add a
+ // test/Ice/router test?)
+ //
+ test(base.ice_getRouter() == null);
+ Ice.RouterPrx anotherRouter = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("anotherRouter"));
+ base = base.ice_router(anotherRouter);
+ test(Ice.Util.proxyIdentityCompare(base.ice_getRouter(), anotherRouter) == 0);
+ Ice.RouterPrx router = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("dummyrouter"));
+ communicator.setDefaultRouter(router);
+ base = communicator.stringToProxy("test @ TestAdapter");
+ test(Ice.Util.proxyIdentityCompare(base.ice_getRouter(), communicator.getDefaultRouter()) == 0);
+ communicator.setDefaultRouter(null);
+ base = communicator.stringToProxy("test @ TestAdapter");
+ test(base.ice_getRouter() == null);
+ out.println("ok");
+
+ out.print("starting server... ");
+ out.flush();
+ manager.startServer();
+ out.println("ok");
+
+ out.print("testing checked cast... ");
+ out.flush();
+ TestIntfPrx obj = TestIntfPrxHelper.checkedCast(base);
+ test(obj != null);
+ TestIntfPrx obj2 = TestIntfPrxHelper.checkedCast(base2);
+ test(obj2 != null);
+ TestIntfPrx obj3 = TestIntfPrxHelper.checkedCast(base3);
+ test(obj3 != null);
+ ServerManagerPrx obj4 = ServerManagerPrxHelper.checkedCast(base4);
+ test(obj4 != null);
+ TestIntfPrx obj5 = TestIntfPrxHelper.checkedCast(base5);
+ test(obj5 != null);
+ TestIntfPrx obj6 = TestIntfPrxHelper.checkedCast(base6);
+ test(obj6 != null);
+ out.println("ok");
+
+ out.print("testing id@AdapterId indirect proxy... ");
+ out.flush();
+ obj.shutdown();
+ manager.startServer();
+ try
+ {
+ obj2.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ out.println("ok");
+
+ out.print("testing id@ReplicaGroupId indirect proxy... ");
+ out.flush();
+ obj.shutdown();
+ manager.startServer();
+ try
+ {
+ obj6.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ out.println("ok");
+
+ out.print("testing identity indirect proxy... ");
+ out.flush();
+ obj.shutdown();
+ manager.startServer();
+ try
+ {
+ obj3.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ try
+ {
+ obj2.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ obj.shutdown();
+ manager.startServer();
+ try
+ {
+ obj2.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ try
+ {
+ obj3.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ obj.shutdown();
+ manager.startServer();
+
+ try
+ {
+ obj2.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ obj.shutdown();
+ manager.startServer();
+ try
+ {
+ obj3.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ obj.shutdown();
+ manager.startServer();
+ try
+ {
+ obj2.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ obj.shutdown();
+ manager.startServer();
+
+ try
+ {
+ obj5.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ out.println("ok");
+
+ out.print("testing proxy with unknown identity... ");
+ out.flush();
+ try
+ {
+ base = communicator.stringToProxy("unknown/unknown");
+ base.ice_ping();
+ test(false);
+ }
+ catch(Ice.NotRegisteredException ex)
+ {
+ test(ex.kindOfObject.equals("object"));
+ test(ex.id.equals("unknown/unknown"));
+ }
+ out.println("ok");
+
+ out.print("testing proxy with unknown adapter... ");
+ out.flush();
+ try
+ {
+ base = communicator.stringToProxy("test @ TestAdapterUnknown");
+ base.ice_ping();
+ test(false);
+ }
+ catch(Ice.NotRegisteredException ex)
+ {
+ test(ex.kindOfObject.equals("object adapter"));
+ test(ex.id.equals("TestAdapterUnknown"));
+ }
+ out.println("ok");
+
+ out.print("testing locator cache timeout... ");
+ out.flush();
+
+ int count = locator.getRequestCount();
+ communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache.
+ test(++count == locator.getRequestCount());
+ communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache.
+ test(++count == locator.getRequestCount());
+ communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout.
+ test(count == locator.getRequestCount());
+ Thread.sleep(1200);
+ communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout.
+ test(++count == locator.getRequestCount());
+
+ communicator.stringToProxy("test").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache.
+ count += 2;
+ test(count == locator.getRequestCount());
+ communicator.stringToProxy("test").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout
+ test(count == locator.getRequestCount());
+ Thread.sleep(1200);
+ communicator.stringToProxy("test").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout
+ count += 2;
+ test(count == locator.getRequestCount());
+
+ communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(-1).ice_ping();
+ test(count == locator.getRequestCount());
+ communicator.stringToProxy("test").ice_locatorCacheTimeout(-1).ice_ping();
+ test(count == locator.getRequestCount());
+ communicator.stringToProxy("test@TestAdapter").ice_ping();
+ test(count == locator.getRequestCount());
+ communicator.stringToProxy("test").ice_ping();
+ test(count == locator.getRequestCount());
+
+ test(communicator.stringToProxy("test").ice_locatorCacheTimeout(99).ice_getLocatorCacheTimeout() == 99);
+
+ out.println("ok");
+
+ out.print("testing proxy from server... ");
+ out.flush();
+ obj = TestIntfPrxHelper.checkedCast(communicator.stringToProxy("test@TestAdapter"));
+ HelloPrx hello = obj.getHello();
+ test(hello.ice_getAdapterId().equals("TestAdapter"));
+ hello = obj.getReplicatedHello();
+ test(hello.ice_getAdapterId().equals("ReplicatedAdapter"));
+ hello.sayHello();
+ out.println("ok");
+
+ out.print("testing proxy from server after shutdown... ");
+ out.flush();
+ obj.shutdown();
+ manager.startServer();
+ hello.sayHello();
+ out.println("ok");
+
+ out.print("testing locator request queuing... ");
+ out.flush();
+ hello = (HelloPrx)obj.getReplicatedHello().ice_locatorCacheTimeout(0).ice_connectionCached(false);
+ count = locator.getRequestCount();
+ hello.ice_ping();
+ test(++count == locator.getRequestCount());
+ java.util.List<Ice.AsyncResult> results = new java.util.LinkedList<Ice.AsyncResult>();
+ for(int i = 0; i < 1000; i++)
+ {
+ class AMICallback extends Callback_Hello_sayHello
+ {
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ @Override
+ public void
+ response()
+ {
+ }
+ };
+ Ice.AsyncResult result = hello.begin_sayHello(new AMICallback());
+ results.add(result);
+ }
+ while(!results.isEmpty())
+ {
+ Ice.AsyncResult result = results.remove(0);
+ result.waitForCompleted();
+ }
+ test(locator.getRequestCount() > count && locator.getRequestCount() < count + 999);
+ if(locator.getRequestCount() > count + 800)
+ {
+ out.print("queuing = " + (locator.getRequestCount() - count));
+ }
+ count = locator.getRequestCount();
+ hello = (HelloPrx)hello.ice_adapterId("unknown");
+ for(int i = 0; i < 1000; i++)
+ {
+ class AMICallback extends Callback_Hello_sayHello
+ {
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ if(ex instanceof Ice.CommunicatorDestroyedException)
+ {
+ ex.printStackTrace();
+ assert false;
+ }
+ test(ex instanceof Ice.NotRegisteredException);
+ }
+
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+ };
+ Ice.AsyncResult result = hello.begin_sayHello(new AMICallback());
+ results.add(result);
+ }
+ while(!results.isEmpty())
+ {
+ Ice.AsyncResult result = results.remove(0);
+ result.waitForCompleted();
+ }
+ // Take into account the retries.
+ test(locator.getRequestCount() > count && locator.getRequestCount() < count + 1999);
+ if(locator.getRequestCount() > count + 800)
+ {
+ out.print("queuing = " + (locator.getRequestCount() - count));
+ }
+ out.println("ok");
+
+ out.print("testing adapter locator cache... ");
+ out.flush();
+ try
+ {
+ communicator.stringToProxy("test@TestAdapter3").ice_ping();
+ test(false);
+ }
+ catch(Ice.NotRegisteredException ex)
+ {
+ test(ex.kindOfObject == "object adapter");
+ test(ex.id.equals("TestAdapter3"));
+ }
+ registry.setAdapterDirectProxy("TestAdapter3", locator.findAdapterById("TestAdapter"));
+ try
+ {
+ communicator.stringToProxy("test@TestAdapter3").ice_ping();
+ registry.setAdapterDirectProxy("TestAdapter3", communicator.stringToProxy("dummy:tcp"));
+ communicator.stringToProxy("test@TestAdapter3").ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ try
+ {
+ communicator.stringToProxy("test@TestAdapter3").ice_locatorCacheTimeout(0).ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ try
+ {
+ communicator.stringToProxy("test@TestAdapter3").ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ registry.setAdapterDirectProxy("TestAdapter3", locator.findAdapterById("TestAdapter"));
+ try
+ {
+ communicator.stringToProxy("test@TestAdapter3").ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ out.println("ok");
+
+ out.print("testing well-known object locator cache... ");
+ out.flush();
+
+ registry.addObject(communicator.stringToProxy("test3@TestUnknown"));
+ try
+ {
+ communicator.stringToProxy("test3").ice_ping();
+ test(false);
+ }
+ catch(Ice.NotRegisteredException ex)
+ {
+ test(ex.kindOfObject == "object adapter");
+ test(ex.id.equals("TestUnknown"));
+ }
+ registry.addObject(communicator.stringToProxy("test3@TestAdapter4")); // Update
+ registry.setAdapterDirectProxy("TestAdapter4", communicator.stringToProxy("dummy:tcp"));
+
+ try
+ {
+ communicator.stringToProxy("test3").ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ registry.setAdapterDirectProxy("TestAdapter4", locator.findAdapterById("TestAdapter"));
+ try
+ {
+ communicator.stringToProxy("test3").ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ registry.setAdapterDirectProxy("TestAdapter4", communicator.stringToProxy("dummy:tcp"));
+ try
+ {
+ communicator.stringToProxy("test3").ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+
+ try
+ {
+ communicator.stringToProxy("test@TestAdapter4").ice_locatorCacheTimeout(0).ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ try
+ {
+ communicator.stringToProxy("test@TestAdapter4").ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ try
+ {
+ communicator.stringToProxy("test3").ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ registry.addObject(communicator.stringToProxy("test3@TestAdapter"));
+ try
+ {
+ communicator.stringToProxy("test3").ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ registry.addObject(communicator.stringToProxy("test4"));
+ try
+ {
+ communicator.stringToProxy("test4").ice_ping();
+ test(false);
+ }
+ catch(Ice.NoEndpointException ex)
+ {
+ }
+ out.println("ok");
+
+ out.print("testing locator cache background updates... ");
+ out.flush();
+ {
+ Ice.InitializationData initData = app.createInitializationData();
+ initData.properties = communicator.getProperties()._clone();
+ initData.properties.setProperty("Ice.BackgroundLocatorCacheUpdates", "1");
+ Ice.Communicator ic = app.initialize(initData);
+
+ registry.setAdapterDirectProxy("TestAdapter5", locator.findAdapterById("TestAdapter"));
+ registry.addObject(communicator.stringToProxy("test3@TestAdapter"));
+
+ count = locator.getRequestCount();
+ ic.stringToProxy("test@TestAdapter5").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache.
+ ic.stringToProxy("test3").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache.
+ count += 3;
+ test(count == locator.getRequestCount());
+ registry.setAdapterDirectProxy("TestAdapter5", null);
+ registry.addObject(communicator.stringToProxy("test3:tcp"));
+ ic.stringToProxy("test@TestAdapter5").ice_locatorCacheTimeout(10).ice_ping(); // 10s timeout.
+ ic.stringToProxy("test3").ice_locatorCacheTimeout(10).ice_ping(); // 10s timeout.
+ test(count == locator.getRequestCount());
+ Thread.sleep(1200);
+
+ // The following request should trigger the background updates but still use the cached endpoints
+ // and therefore succeed.
+ ic.stringToProxy("test@TestAdapter5").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout.
+ ic.stringToProxy("test3").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout.
+
+ try
+ {
+ while(true)
+ {
+ ic.stringToProxy("test@TestAdapter5").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout.
+ Thread.sleep(10);
+ }
+ }
+ catch(Ice.LocalException ex)
+ {
+ // Expected to fail once they endpoints have been updated in the background.
+ }
+ try
+ {
+ while(true)
+ {
+ ic.stringToProxy("test3").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout.
+ Thread.sleep(10);
+ }
+ }
+ catch(Ice.LocalException ex)
+ {
+ // Expected to fail once they endpoints have been updated in the background.
+ }
+ ic.destroy();
+ }
+ out.println("ok");
+
+ out.print("testing proxy from server after shutdown... ");
+ out.flush();
+ hello = obj.getReplicatedHello();
+ obj.shutdown();
+ manager.startServer();
+ hello.sayHello();
+ out.println("ok");
+
+ out.print("testing object migration...");
+ out.flush();
+ hello = HelloPrxHelper.checkedCast(communicator.stringToProxy("hello"));
+ obj.migrateHello();
+ hello.ice_getConnection().close(false);
+ hello.sayHello();
+ obj.migrateHello();
+ hello.sayHello();
+ obj.migrateHello();
+ hello.sayHello();
+ out.println("ok");
+
+ out.print("testing locator encoding resolution... ");
+ out.flush();
+ hello = HelloPrxHelper.checkedCast(communicator.stringToProxy("hello"));
+ count = locator.getRequestCount();
+ communicator.stringToProxy("test@TestAdapter").ice_encodingVersion(Ice.Util.Encoding_1_1).ice_ping();
+ test(count == locator.getRequestCount());
+ communicator.stringToProxy("test@TestAdapter10").ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping();
+ test(++count == locator.getRequestCount());
+ communicator.stringToProxy("test -e 1.0@TestAdapter10-2").ice_ping();
+ test(++count == locator.getRequestCount());
+ out.println("ok");
+
+ out.print("shutdown server... ");
+ out.flush();
+ obj.shutdown();
+ out.println("ok");
+
+ out.print("testing whether server is gone... ");
+ out.flush();
+ try
+ {
+ obj2.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ try
+ {
+ obj3.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ try
+ {
+ obj5.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ out.println("ok");
+
+ out.print("testing indirect proxies to collocated objects... ");
+ //
+ // Set up test for calling a collocated object through an
+ // indirect, adapterless reference.
+ //
+ Ice.Properties properties = communicator.getProperties();
+ properties.setProperty("Ice.PrintAdapterReady", "0");
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("Hello", "default");
+ adapter.setLocator(locator);
+
+ Ice.Identity id = new Ice.Identity();
+ id.name = java.util.UUID.randomUUID().toString();
+ registry.addObject(adapter.add(new HelloI(), id));
+ adapter.activate();
+
+ // Note the quotes are necessary here due to ":" in the
+ // java generated UUID.
+ HelloPrx helloPrx = HelloPrxHelper.checkedCast(
+ communicator.stringToProxy("\"" + Ice.Util.identityToString(id) + "\""));
+ test(helloPrx.ice_getConnection() == null);
+
+ adapter.deactivate();
+ out.println("ok");
+
+ out.print("shutdown server manager... ");
+ out.flush();
+ manager.shutdown();
+ out.println("ok");
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/location/Client.java b/java-compat/test/src/main/java/test/Ice/location/Client.java
new file mode 100644
index 00000000000..e792640fb08
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/location/Client.java
@@ -0,0 +1,57 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.location;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ try
+ {
+ AllTests.allTests(this);
+ }
+ catch(Ice.AdapterAlreadyActiveException ex)
+ {
+ ex.printStackTrace();
+ throw new RuntimeException();
+ }
+ catch(Ice.AdapterNotFoundException ex)
+ {
+ ex.printStackTrace();
+ throw new RuntimeException();
+ }
+ catch(InterruptedException ex)
+ {
+ ex.printStackTrace();
+ throw new RuntimeException();
+ }
+
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.location");
+ initData.properties.setProperty("Ice.Default.Locator", "locator:default -p 12010");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/location/HelloI.java b/java-compat/test/src/main/java/test/Ice/location/HelloI.java
new file mode 100644
index 00000000000..2e3d94da141
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/location/HelloI.java
@@ -0,0 +1,22 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.location;
+
+import test.Ice.location.Test._HelloDisp;
+
+
+public class HelloI extends _HelloDisp
+{
+ @Override
+ public void
+ sayHello(Ice.Current current)
+ {
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/location/Server.java b/java-compat/test/src/main/java/test/Ice/location/Server.java
new file mode 100644
index 00000000000..1a3a98351be
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/location/Server.java
@@ -0,0 +1,70 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.location;
+
+public class Server extends test.Util.Application
+{
+ private Ice.InitializationData _initData;
+
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+
+ //
+ // Register the server manager. The server manager creates a new
+ // 'server' (a server isn't a different process, it's just a new
+ // communicator and object adapter).
+ //
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ServerManagerAdapter");
+
+ //
+ // We also register a sample server locator which implements the
+ // locator interface, this locator is used by the clients and the
+ // 'servers' created with the server manager interface.
+ //
+ ServerLocatorRegistry registry = new ServerLocatorRegistry();
+ registry.addObject(adapter.createProxy(Ice.Util.stringToIdentity("ServerManager")));
+ Ice.Object object = new ServerManagerI(registry, _initData, this);
+ adapter.add(object, Ice.Util.stringToIdentity("ServerManager"));
+
+ Ice.LocatorRegistryPrx registryPrx = Ice.LocatorRegistryPrxHelper.uncheckedCast(adapter.add(registry,
+ Ice.Util.stringToIdentity("registry")));
+
+ ServerLocator locator = new ServerLocator(registry, registryPrx);
+ adapter.add(locator, Ice.Util.stringToIdentity("locator"));
+
+ adapter.activate();
+
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.location");
+ initData.properties.setProperty("Ice.ThreadPool.Server.Size", "2");
+ initData.properties.setProperty("Ice.ThreadPool.Server.SizeWarn", "0");
+ initData.properties.setProperty("ServerManagerAdapter.Endpoints", "default -p 12010:udp");
+
+ _initData = initData;
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/location/ServerLocator.java b/java-compat/test/src/main/java/test/Ice/location/ServerLocator.java
new file mode 100644
index 00000000000..fd1ca307e42
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/location/ServerLocator.java
@@ -0,0 +1,86 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.location;
+
+import test.Ice.location.Test._TestLocatorDisp;
+
+public class ServerLocator extends _TestLocatorDisp
+{
+ public
+ ServerLocator(ServerLocatorRegistry registry, Ice.LocatorRegistryPrx registryPrx)
+ {
+ _registry = registry;
+ _registryPrx = registryPrx;
+ _requestCount = 0;
+ }
+
+ @Override
+ public void
+ findAdapterById_async(Ice.AMD_Locator_findAdapterById response, String adapter, Ice.Current current)
+ throws Ice.AdapterNotFoundException
+ {
+ ++_requestCount;
+ if(adapter.equals("TestAdapter10") || adapter.equals("TestAdapter10-2"))
+ {
+ assert(current.encoding.equals(Ice.Util.Encoding_1_0));
+ response.ice_response(_registry.getAdapter("TestAdapter"));
+ return;
+ }
+
+ // We add a small delay to make sure locator request queuing gets tested when
+ // running the test on a fast machine
+ try
+ {
+ Thread.sleep(1);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ response.ice_response(_registry.getAdapter(adapter));
+ }
+
+ @Override
+ public void
+ findObjectById_async(Ice.AMD_Locator_findObjectById response, Ice.Identity id, Ice.Current current)
+ throws Ice.ObjectNotFoundException
+ {
+ ++_requestCount;
+ // We add a small delay to make sure locator request queuing gets tested when
+ // running the test on a fast machine
+ try
+ {
+ Thread.sleep(1);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ response.ice_response(_registry.getObject(id));
+ }
+
+ @Override
+ public Ice.LocatorRegistryPrx
+ getRegistry(Ice.Current current)
+ {
+ return _registryPrx;
+ }
+
+ @Override
+ public int
+ getRequestCount(Ice.Current current)
+ {
+ return _requestCount;
+ }
+
+ private ServerLocatorRegistry _registry;
+ private Ice.LocatorRegistryPrx _registryPrx;
+ private int _requestCount;
+
+}
+
diff --git a/java-compat/test/src/main/java/test/Ice/location/ServerLocatorRegistry.java b/java-compat/test/src/main/java/test/Ice/location/ServerLocatorRegistry.java
new file mode 100644
index 00000000000..3d61e5046f4
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/location/ServerLocatorRegistry.java
@@ -0,0 +1,91 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.location;
+
+import test.Ice.location.Test._TestLocatorRegistryDisp;
+
+public class ServerLocatorRegistry extends _TestLocatorRegistryDisp
+{
+ @Override
+ public void
+ setAdapterDirectProxy_async(Ice.AMD_LocatorRegistry_setAdapterDirectProxy cb, String adapter,
+ Ice.ObjectPrx object, Ice.Current current)
+ {
+ if(object != null)
+ {
+ _adapters.put(adapter, object);
+ }
+ else
+ {
+ _adapters.remove(adapter);
+ }
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ setReplicatedAdapterDirectProxy_async(Ice.AMD_LocatorRegistry_setReplicatedAdapterDirectProxy cb, String adapter,
+ String replica, Ice.ObjectPrx object, Ice.Current current)
+ {
+ if(object != null)
+ {
+ _adapters.put(adapter, object);
+ _adapters.put(replica, object);
+ }
+ else
+ {
+ _adapters.remove(adapter);
+ _adapters.remove(replica);
+ }
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ setServerProcessProxy_async(Ice.AMD_LocatorRegistry_setServerProcessProxy cb, String id, Ice.ProcessPrx proxy,
+ Ice.Current current)
+ {
+ }
+
+ @Override
+ public void
+ addObject(Ice.ObjectPrx object, Ice.Current current)
+ {
+ _objects.put(object.ice_getIdentity(), object);
+ }
+
+ public Ice.ObjectPrx
+ getAdapter(String adapter)
+ throws Ice.AdapterNotFoundException
+ {
+ Ice.ObjectPrx obj = _adapters.get(adapter);
+ if(obj == null)
+ {
+ throw new Ice.AdapterNotFoundException();
+ }
+ return obj;
+ }
+
+ public Ice.ObjectPrx
+ getObject(Ice.Identity id)
+ throws Ice.ObjectNotFoundException
+ {
+ Ice.ObjectPrx obj = _objects.get(id);
+ if(obj == null)
+ {
+ throw new Ice.ObjectNotFoundException();
+ }
+ return obj;
+ }
+
+ private java.util.HashMap<String, Ice.ObjectPrx> _adapters = new java.util.HashMap<String, Ice.ObjectPrx>();
+ private java.util.HashMap<Ice.Identity, Ice.ObjectPrx> _objects =
+ new java.util.HashMap<Ice.Identity, Ice.ObjectPrx>();
+}
diff --git a/java-compat/test/src/main/java/test/Ice/location/ServerManagerI.java b/java-compat/test/src/main/java/test/Ice/location/ServerManagerI.java
new file mode 100644
index 00000000000..293b9dcfb97
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/location/ServerManagerI.java
@@ -0,0 +1,92 @@
+
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.location;
+
+import test.Ice.location.Test._ServerManagerDisp;
+
+
+public class ServerManagerI extends _ServerManagerDisp
+{
+ ServerManagerI(ServerLocatorRegistry registry, Ice.InitializationData initData, test.Util.Application app)
+ {
+ _registry = registry;
+ _communicators = new java.util.ArrayList<Ice.Communicator>();
+
+ _app = app;
+ _initData = initData;
+
+ _initData.properties.setProperty("TestAdapter.AdapterId", "TestAdapter");
+ _initData.properties.setProperty("TestAdapter.ReplicaGroupId", "ReplicatedAdapter");
+ _initData.properties.setProperty("TestAdapter2.AdapterId", "TestAdapter2");
+ }
+
+ @Override
+ public void
+ startServer(Ice.Current current)
+ {
+ for(Ice.Communicator c : _communicators)
+ {
+ c.waitForShutdown();
+ c.destroy();
+ }
+ _communicators.clear();
+
+ //
+ // Simulate a server: create a new communicator and object
+ // adapter. The object adapter is started on a system allocated
+ // port. The configuration used here contains the Ice.Locator
+ // configuration variable. The new object adapter will register
+ // its endpoints with the locator and create references containing
+ // the adapter id instead of the endpoints.
+ //
+ Ice.Communicator serverCommunicator = _app.initialize(_initData);
+ _communicators.add(serverCommunicator);
+
+ //
+ // Use fixed port to ensure that OA re-activation doesn't re-use previous port from
+ // another OA (e.g.: TestAdapter2 is re-activated using port of TestAdapter).
+ //
+ serverCommunicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p " + _nextPort++);
+ serverCommunicator.getProperties().setProperty("TestAdapter2.Endpoints", "default -p " + _nextPort++);
+
+ Ice.ObjectAdapter adapter = serverCommunicator.createObjectAdapter("TestAdapter");
+ Ice.ObjectAdapter adapter2 = serverCommunicator.createObjectAdapter("TestAdapter2");
+
+ Ice.ObjectPrx locator = serverCommunicator.stringToProxy("locator:default -p 12010");
+ adapter.setLocator(Ice.LocatorPrxHelper.uncheckedCast(locator));
+ adapter2.setLocator(Ice.LocatorPrxHelper.uncheckedCast(locator));
+
+ Ice.Object object = new TestI(adapter, adapter2, _registry);
+ _registry.addObject(adapter.add(object, Ice.Util.stringToIdentity("test")));
+ _registry.addObject(adapter.add(object, Ice.Util.stringToIdentity("test2")));
+ adapter.add(object, Ice.Util.stringToIdentity("test3"));
+
+ adapter.activate();
+ adapter2.activate();
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ for(Ice.Communicator c : _communicators)
+ {
+ c.destroy();
+ }
+ current.adapter.getCommunicator().shutdown();
+ }
+
+ private ServerLocatorRegistry _registry;
+ private java.util.List<Ice.Communicator> _communicators;
+ private Ice.InitializationData _initData;
+ private test.Util.Application _app;
+ private int _nextPort = 12011;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/location/Test.ice b/java-compat/test/src/main/java/test/Ice/location/Test.ice
new file mode 100644
index 00000000000..40e294492e8
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/location/Test.ice
@@ -0,0 +1,56 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+#include <Ice/Locator.ice>
+
+[["java:package:test.Ice.location"]]
+module Test
+{
+
+interface TestLocatorRegistry extends ::Ice::LocatorRegistry
+{
+ //
+ // Allow remote addition of objects to the locator registry.
+ //
+ void addObject(Object* obj);
+};
+
+interface TestLocator extends ::Ice::Locator
+{
+ //
+ // Returns the number of request on the locator interface.
+ //
+ idempotent int getRequestCount();
+};
+
+interface ServerManager
+{
+ void startServer();
+ void shutdown();
+};
+
+interface Hello
+{
+ void sayHello();
+};
+
+interface TestIntf
+{
+ void shutdown();
+
+ Hello* getHello();
+
+ Hello* getReplicatedHello();
+
+ void migrateHello();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/location/TestI.java b/java-compat/test/src/main/java/test/Ice/location/TestI.java
new file mode 100644
index 00000000000..24dcbdb55a3
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/location/TestI.java
@@ -0,0 +1,67 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.location;
+
+import test.Ice.location.Test.HelloPrx;
+import test.Ice.location.Test.HelloPrxHelper;
+import test.Ice.location.Test._TestIntfDisp;
+
+
+public class TestI extends _TestIntfDisp
+{
+ TestI(Ice.ObjectAdapter adapter1, Ice.ObjectAdapter adapter2, ServerLocatorRegistry registry)
+ {
+ _adapter1 = adapter1;
+ _adapter2 = adapter2;
+ _registry = registry;
+
+ _registry.addObject(_adapter1.add(new HelloI(), Ice.Util.stringToIdentity("hello")));
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ _adapter1.getCommunicator().shutdown();
+ }
+
+ @Override
+ public HelloPrx
+ getHello(Ice.Current current)
+ {
+ return HelloPrxHelper.uncheckedCast(_adapter1.createIndirectProxy(Ice.Util.stringToIdentity("hello")));
+ }
+
+ @Override
+ public HelloPrx
+ getReplicatedHello(Ice.Current current)
+ {
+ return HelloPrxHelper.uncheckedCast(_adapter1.createProxy(Ice.Util.stringToIdentity("hello")));
+ }
+
+ @Override
+ public void
+ migrateHello(Ice.Current current)
+ {
+ final Ice.Identity id = Ice.Util.stringToIdentity("hello");
+ try
+ {
+ _registry.addObject(_adapter2.add(_adapter1.remove(id), id));
+ }
+ catch(Ice.NotRegisteredException ex)
+ {
+ _registry.addObject(_adapter1.add(_adapter2.remove(id), id));
+ }
+ }
+
+ private ServerLocatorRegistry _registry;
+ private Ice.ObjectAdapter _adapter1;
+ private Ice.ObjectAdapter _adapter2;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/location/run.py b/java-compat/test/src/main/java/test/Ice/location/run.py
new file mode 100755
index 00000000000..97f9acd4094
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/location/run.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/metrics/AMDMetricsI.java b/java-compat/test/src/main/java/test/Ice/metrics/AMDMetricsI.java
new file mode 100644
index 00000000000..865db0c83ef
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/metrics/AMDMetricsI.java
@@ -0,0 +1,84 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.metrics;
+import test.Ice.metrics.AMD.Test.*;
+
+public final class AMDMetricsI extends _MetricsDisp
+{
+ public
+ AMDMetricsI()
+ {
+ }
+
+ @Override
+ public void
+ op_async(AMD_Metrics_op cb, Ice.Current current)
+ {
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ fail_async(AMD_Metrics_fail cb, Ice.Current current)
+ {
+ current.con.close(true);
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ opWithUserException_async(AMD_Metrics_opWithUserException cb, Ice.Current current)
+ throws UserEx
+ {
+ cb.ice_exception(new UserEx());
+ }
+
+ @Override
+ public void
+ opWithRequestFailedException_async(AMD_Metrics_opWithRequestFailedException cb, Ice.Current current)
+ {
+ cb.ice_exception(new Ice.ObjectNotExistException());
+ }
+
+ @Override
+ public void
+ opWithLocalException_async(AMD_Metrics_opWithLocalException cb, Ice.Current current)
+ {
+ cb.ice_exception(new Ice.SyscallException());
+ }
+
+ @Override
+ public void
+ opWithUnknownException_async(AMD_Metrics_opWithUnknownException cb, Ice.Current current)
+ {
+ cb.ice_exception(new IllegalArgumentException());
+ }
+
+ @Override
+ public void
+ opByteS_async(AMD_Metrics_opByteS cb, byte[] bs, Ice.Current current)
+ {
+ cb.ice_response();
+ }
+
+ @Override
+ public Ice.ObjectPrx
+ getAdmin(Ice.Current current)
+ {
+ return current.adapter.getCommunicator().getAdmin();
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/metrics/AMDServer.java b/java-compat/test/src/main/java/test/Ice/metrics/AMDServer.java
new file mode 100644
index 00000000000..c936ca8d989
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/metrics/AMDServer.java
@@ -0,0 +1,52 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.metrics;
+
+public class AMDServer extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new AMDMetricsI(), Ice.Util.stringToIdentity("metrics"));
+ adapter.activate();
+
+ communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011");
+ Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter");
+ controllerAdapter.add(new ControllerI(adapter), Ice.Util.stringToIdentity("controller"));
+ controllerAdapter.activate();
+
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ initData.properties.setProperty("Ice.Admin.Endpoints", "tcp");
+ initData.properties.setProperty("Ice.Admin.InstanceName", "server");
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties.setProperty("Ice.MessageSizeMax", "50000");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ AMDServer app = new AMDServer();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/metrics/AllTests.java b/java-compat/test/src/main/java/test/Ice/metrics/AllTests.java
new file mode 100644
index 00000000000..52f450eca64
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/metrics/AllTests.java
@@ -0,0 +1,1301 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.metrics;
+
+import java.io.PrintWriter;
+import java.util.Map;
+
+import test.Ice.metrics.Test.*;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ static IceMX.ConnectionMetrics
+ getServerConnectionMetrics(IceMX.MetricsAdminPrx metrics, long expected)
+ {
+ try
+ {
+ IceMX.ConnectionMetrics s;
+ Ice.LongHolder timestamp = new Ice.LongHolder();
+ s = (IceMX.ConnectionMetrics)metrics.getMetricsView("View", timestamp).get("Connection")[0];
+ int nRetry = 30;
+ while(s.sentBytes != expected && nRetry-- > 0)
+ {
+ // On some platforms, it's necessary to wait a little before obtaining the server metrics
+ // to get an accurate sentBytes metric. The sentBytes metric is updated before the response
+ // to the operation is sent and getMetricsView can be dispatched before the metric is really
+ // updated.
+ try
+ {
+ Thread.sleep(100);
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ s = (IceMX.ConnectionMetrics)metrics.getMetricsView("View", timestamp).get("Connection")[0];
+ }
+ return s;
+ }
+ catch(IceMX.UnknownMetricsView ex)
+ {
+ assert(false);
+ return null;
+ }
+ }
+
+ static void waitForObserverCurrent(ObserverI observer, int value)
+ {
+ for(int i = 0; i < 10; ++i)
+ {
+ if(observer.getCurrent() != value)
+ {
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+
+ static class Callback extends Ice.Callback
+ {
+ public Callback()
+ {
+ _wait = true;
+ }
+
+ @Override
+ synchronized public void completed(Ice.AsyncResult result)
+ {
+ _wait = false;
+ notify();
+ }
+
+ synchronized public void waitForResponse()
+ {
+ while(_wait)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+ _wait = true;
+ }
+
+ private boolean _wait;
+ };
+
+ static private Map<String, String>
+ getClientProps(Ice.PropertiesAdminPrx p, Map<String, String> orig, String m)
+ {
+ Map<String, String> props = p.getPropertiesForPrefix("IceMX.Metrics");
+ for(Map.Entry<String, String> e : props.entrySet())
+ {
+ e.setValue("");
+ }
+ for(Map.Entry<String, String> e : orig.entrySet())
+ {
+ props.put(e.getKey(), e.getValue());
+ }
+ String map = "";
+ if(!m.isEmpty())
+ {
+ map += "Map." + m + '.';
+ }
+ props.put("IceMX.Metrics.View." + map + "Reject.parent", "Ice\\.Admin");
+ props.put("IceMX.Metrics.View." + map + "Accept.endpointPort", "12010");
+ props.put("IceMX.Metrics.View." + map + "Reject.identity", ".*/admin|controller");
+ return props;
+ }
+
+ static private Map<String, String>
+ getServerProps(Ice.PropertiesAdminPrx p, Map<String, String> orig , String m)
+ {
+ Map<String, String> props = p.getPropertiesForPrefix("IceMX.Metrics");
+ for(Map.Entry<String, String> e : props.entrySet())
+ {
+ e.setValue("");
+ }
+ for(Map.Entry<String, String> e : orig.entrySet())
+ {
+ props.put(e.getKey(), e.getValue());
+ }
+ String map = "";
+ if(!m.isEmpty())
+ {
+ map += "Map." + m + '.';
+ }
+ props.put("IceMX.Metrics.View." + map + "Reject.parent", "Ice\\.Admin|Controller");
+ props.put("IceMX.Metrics.View." + map + "Accept.endpointPort", "12010");
+ return props;
+ }
+
+ static class UpdateCallbackI implements Ice.PropertiesAdminUpdateCallback
+ {
+ public UpdateCallbackI(Ice.PropertiesAdminPrx serverProps)
+ {
+ _updated = false;
+ _serverProps = serverProps;
+ }
+
+ public void
+ waitForUpdate()
+ {
+ synchronized(this)
+ {
+ while(!_updated)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+ }
+ // Ensure that the previous updates were committed, the setProperties call returns before
+ // notifying the callbacks so to ensure all the update callbacks have be notified we call
+ // a second time, this will block until all the notifications from the first update have
+ // completed.
+ _serverProps.setProperties(new java.util.HashMap<String, String>());
+ synchronized(this)
+ {
+ _updated = false;
+ }
+ }
+
+ @Override
+ public synchronized void
+ updated(Map<String, String> dict)
+ {
+ _updated = true;
+ notify();
+ }
+
+ private boolean _updated;
+ private Ice.PropertiesAdminPrx _serverProps;
+ };
+
+ static void
+ waitForCurrent(IceMX.MetricsAdminPrx metrics, String viewName, String map, int value)
+ throws IceMX.UnknownMetricsView
+ {
+ while(true)
+ {
+ Ice.LongHolder timestamp = new Ice.LongHolder();
+ Map<String, IceMX.Metrics[]> view = metrics.getMetricsView(viewName, timestamp);
+ test(view.containsKey(map));
+ boolean ok = true;
+ for(IceMX.Metrics m : view.get(map))
+ {
+ if(m.current != value)
+ {
+ ok = false;
+ break;
+ }
+ }
+ if(ok)
+ {
+ break;
+ }
+ try
+ {
+ Thread.sleep(50);
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+ }
+
+ static void
+ testAttribute(IceMX.MetricsAdminPrx metrics,
+ Ice.PropertiesAdminPrx props,
+ UpdateCallbackI update,
+ String map,
+ String attr,
+ String value,
+ Runnable func,
+ PrintWriter out)
+ throws IceMX.UnknownMetricsView
+ {
+ Map<String, String> dict = new java.util.HashMap<String, String>();
+ dict.put("IceMX.Metrics.View.Map." + map + ".GroupBy", attr);
+ if(props.ice_getIdentity().category.equals("client"))
+ {
+ props.setProperties(getClientProps(props, dict, map));
+ update.waitForUpdate();
+ }
+ else
+ {
+ props.setProperties(getServerProps(props, dict, map));
+ props.setProperties(new java.util.HashMap<String, String>());
+ }
+
+ func.run();
+ Ice.LongHolder timestamp = new Ice.LongHolder();
+ Map<String, IceMX.Metrics[]> view = metrics.getMetricsView("View", timestamp);
+ if(!view.containsKey(map) || view.get(map).length == 0)
+ {
+ if(!value.isEmpty())
+ {
+ out.println("no map `" + map + "' for group by = `" + attr + "'");
+ test(false);
+ }
+ }
+ else if(!view.get(map)[0].id.equals(value))
+ {
+ out.println("invalid attribute value: " + attr + " = " + value + " got " + view.get(map)[0].id);
+ test(false);
+ }
+
+ dict.clear();
+ if(props.ice_getIdentity().category.equals("client"))
+ {
+ props.setProperties(getClientProps(props, dict, map));
+ update.waitForUpdate();
+ }
+ else
+ {
+ props.setProperties(getServerProps(props, dict, map));
+ props.setProperties(new java.util.HashMap<String, String>());
+ }
+ }
+
+ static class Void implements Runnable
+ {
+ @Override
+ public void run()
+ {
+ }
+ };
+
+ static class Connect implements Runnable
+ {
+ public Connect(Ice.ObjectPrx proxy)
+ {
+ this.proxy = proxy;
+ }
+
+ @Override
+ public void run()
+ {
+ if(proxy.ice_getCachedConnection() != null)
+ {
+ proxy.ice_getCachedConnection().close(false);
+ }
+
+ try
+ {
+ proxy.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+
+ if(proxy.ice_getCachedConnection() != null)
+ {
+ proxy.ice_getCachedConnection().close(false);
+ }
+ }
+
+ final private Ice.ObjectPrx proxy;
+ };
+
+ static class InvokeOp implements Runnable
+ {
+ public InvokeOp(MetricsPrx proxy)
+ {
+ this.proxy = proxy;
+ }
+
+ @Override
+ public void run()
+ {
+ Map<String, String> ctx = new java.util.HashMap<String, String>();
+ ctx.put("entry1", "test");
+ ctx.put("entry2", "");
+ proxy.op(ctx);
+ }
+
+ final private MetricsPrx proxy;
+ };
+
+ static void
+ testAttribute(IceMX.MetricsAdminPrx metrics,
+ Ice.PropertiesAdminPrx props,
+ UpdateCallbackI update,
+ String map,
+ String attr,
+ String value,
+ PrintWriter out)
+ throws IceMX.UnknownMetricsView
+ {
+ testAttribute(metrics, props, update, map, attr, value, new Void(), out);
+ }
+
+ static void
+ updateProps(Ice.PropertiesAdminPrx cprops,
+ Ice.PropertiesAdminPrx sprops,
+ UpdateCallbackI callback,
+ Map<String, String> props,
+ String map)
+ {
+ if(sprops.ice_getConnection() != null)
+ {
+ cprops.setProperties(getClientProps(cprops, props, map));
+ sprops.setProperties(getServerProps(sprops, props, map));
+ }
+ else
+ {
+ Map<String, String> clientProps = getClientProps(cprops, props, map);
+ Map<String, String> serverProps = getServerProps(sprops, props, map);
+ serverProps.putAll(clientProps);
+ cprops.setProperties(serverProps);
+ }
+ callback.waitForUpdate();
+ }
+
+ static void
+ clearView(Ice.PropertiesAdminPrx cprops, Ice.PropertiesAdminPrx sprops, UpdateCallbackI callback)
+ {
+ Map<String, String> dict;
+
+ dict = cprops.getPropertiesForPrefix("IceMX.Metrics");
+ dict.put("IceMX.Metrics.View.Disabled", "1");
+ cprops.setProperties(dict);
+
+ dict = sprops.getPropertiesForPrefix("IceMX.Metrics");
+ dict.put("IceMX.Metrics.View.Disabled", "1");
+ sprops.setProperties(dict);
+
+ callback.waitForUpdate();
+
+ dict = cprops.getPropertiesForPrefix("IceMX.Metrics");
+ dict.put("IceMX.Metrics.View.Disabled", "");
+ cprops.setProperties(dict);
+
+ dict = sprops.getPropertiesForPrefix("IceMX.Metrics");
+ dict.put("IceMX.Metrics.View.Disabled", "");
+ sprops.setProperties(dict);
+
+ callback.waitForUpdate();
+ }
+
+ static void
+ checkFailure(IceMX.MetricsAdminPrx m, String map, String id, String failure, int count, PrintWriter out)
+ throws IceMX.UnknownMetricsView
+ {
+ IceMX.MetricsFailures f = m.getMetricsFailures("View", map, id);
+ if(!f.failures.containsKey(failure))
+ {
+ out.println("couldn't find failure `" + failure + "' for `" + id + "'");
+ test(false);
+ }
+ if(count > 0 && f.failures.get(failure) != count)
+ {
+ out.print("count for failure `" + failure + "' of `" + id + "' is different from expected: ");
+ out.println(count + " != " + f.failures.get(failure));
+ test(false);
+ }
+ }
+
+ static Map<String, IceMX.Metrics>
+ toMap(IceMX.Metrics[] mmap)
+ {
+ Map<String, IceMX.Metrics> m = new java.util.HashMap<String, IceMX.Metrics>();
+ for(IceMX.Metrics e : mmap)
+ {
+ m.put(e.id, e);
+ }
+ return m;
+ }
+
+ static MetricsPrx
+ allTests(Ice.Communicator communicator, PrintWriter out, CommunicatorObserverI obsv)
+ throws IceMX.UnknownMetricsView
+ {
+ MetricsPrx metrics = MetricsPrxHelper.checkedCast(communicator.stringToProxy("metrics:default -p 12010"));
+ boolean collocated = metrics.ice_getConnection() == null;
+
+ int threadCount = 4;
+ if(collocated && communicator.getProperties().getPropertyAsInt("Ice.ThreadInterruptSafe") > 0)
+ {
+ threadCount = 6;
+ }
+
+ out.print("testing metrics admin facet checkedCast... ");
+ out.flush();
+ Ice.ObjectPrx admin = communicator.getAdmin();
+ Ice.PropertiesAdminPrx clientProps = Ice.PropertiesAdminPrxHelper.checkedCast(admin, "Properties");
+ IceMX.MetricsAdminPrx clientMetrics = IceMX.MetricsAdminPrxHelper.checkedCast(admin, "Metrics");
+ test(clientProps != null && clientMetrics != null);
+
+ admin = metrics.getAdmin();
+ Ice.PropertiesAdminPrx serverProps = Ice.PropertiesAdminPrxHelper.checkedCast(admin, "Properties");
+ IceMX.MetricsAdminPrx serverMetrics = IceMX.MetricsAdminPrxHelper.checkedCast(admin, "Metrics");
+ test(serverProps != null && serverMetrics != null);
+
+ UpdateCallbackI update = new UpdateCallbackI(serverProps);
+ ((Ice.NativePropertiesAdmin)communicator.findAdminFacet("Properties")).addUpdateCallback(update);
+
+ out.println("ok");
+
+ Map<String, String> props = new java.util.HashMap<String, String>();
+
+ out.print("testing group by none...");
+ out.flush();
+
+ props.put("IceMX.Metrics.View.GroupBy", "none");
+ updateProps(clientProps, serverProps, update, props, "");
+ Ice.LongHolder timestamp = new Ice.LongHolder();
+ Map<String, IceMX.Metrics[]> view = clientMetrics.getMetricsView("View", timestamp);
+ if(!collocated)
+ {
+ test(view.get("Connection").length == 1 && view.get("Connection")[0].current == 1 &&
+ view.get("Connection")[0].total == 1);
+ }
+ test(view.get("Thread").length == 1 && view.get("Thread")[0].current == threadCount &&
+ view.get("Thread")[0].total == threadCount);
+ out.println("ok");
+
+ out.print("testing group by id...");
+ out.flush();
+
+ props.put("IceMX.Metrics.View.GroupBy", "id");
+ updateProps(clientProps, serverProps, update, props, "");
+
+ metrics.ice_ping();
+ metrics.ice_ping();
+ metrics.ice_connectionId("Con1").ice_ping();
+ metrics.ice_connectionId("Con1").ice_ping();
+ metrics.ice_connectionId("Con1").ice_ping();
+
+ waitForCurrent(clientMetrics, "View", "Invocation", 0);
+
+ view = clientMetrics.getMetricsView("View", timestamp);
+ test(view.get("Thread").length == threadCount);
+ if(!collocated)
+ {
+ test(view.get("Connection").length == 2);
+ }
+ test(view.get("Invocation").length == 1);
+
+ IceMX.InvocationMetrics invoke = (IceMX.InvocationMetrics)view.get("Invocation")[0];
+ test(invoke.id.indexOf("[ice_ping]") > 0 && invoke.current == 0 && invoke.total == 5);
+ if(!collocated)
+ {
+ test(invoke.remotes.length == 2);
+ test(invoke.remotes[0].total >= 2 && invoke.remotes[1].total >= 2);
+ test((invoke.remotes[0].total + invoke.remotes[1].total) == 5);
+ }
+ else
+ {
+ test(invoke.collocated.length == 1);
+ test(invoke.collocated[0].total == 5);
+ }
+ view = serverMetrics.getMetricsView("View", timestamp);
+ if(!collocated)
+ {
+ test(view.get("Thread").length > 3);
+ test(view.get("Connection").length == 2);
+ }
+ test(view.get("Dispatch").length == 1);
+ test(view.get("Dispatch")[0].current <= 1 && view.get("Dispatch")[0].total == 5);
+ test(view.get("Dispatch")[0].id.indexOf("[ice_ping]") > 0);
+
+ if(!collocated)
+ {
+ metrics.ice_getConnection().close(false);
+ metrics.ice_connectionId("Con1").ice_getConnection().close(false);
+
+ waitForCurrent(clientMetrics, "View", "Connection", 0);
+ waitForCurrent(serverMetrics, "View", "Connection", 0);
+ }
+ clearView(clientProps, serverProps, update);
+
+ out.println("ok");
+
+ String endpoint = communicator.getProperties().getPropertyWithDefault("Ice.Default.Protocol", "tcp") +
+ " -h 127.0.0.1 -p 12010";
+ String type = "";
+ String isSecure = "";
+ if(!collocated)
+ {
+ Ice.EndpointInfo endpointInfo = metrics.ice_getConnection().getEndpoint().getInfo();
+ type = Short.toString(endpointInfo.type());
+ isSecure = endpointInfo.secure() ? "true": "false";
+ }
+
+ Map<String, IceMX.Metrics> map;
+
+ if(!collocated)
+ {
+ out.print("testing connection metrics... ");
+ out.flush();
+
+ props.put("IceMX.Metrics.View.Map.Connection.GroupBy", "none");
+ updateProps(clientProps, serverProps, update, props, "Connection");
+
+ test(clientMetrics.getMetricsView("View", timestamp).get("Connection").length == 0);
+ test(serverMetrics.getMetricsView("View", timestamp).get("Connection").length == 0);
+
+ metrics.ice_ping();
+
+ IceMX.ConnectionMetrics cm1, sm1, cm2, sm2;
+ cm1 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
+ sm1 = getServerConnectionMetrics(serverMetrics, 25);
+ test(cm1.total == 1 && sm1.total == 1);
+
+ metrics.ice_ping();
+
+ cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
+ sm2 = getServerConnectionMetrics(serverMetrics, 50);
+
+ test(cm2.sentBytes - cm1.sentBytes == 45); // 45 for ice_ping request
+ test(cm2.receivedBytes - cm1.receivedBytes == 25); // 25 bytes for ice_ping response
+ test(sm2.receivedBytes - sm1.receivedBytes == 45);
+ test(sm2.sentBytes - sm1.sentBytes == 25);
+
+ cm1 = cm2;
+ sm1 = sm2;
+
+ byte[] bs = new byte[0];
+ metrics.opByteS(bs);
+
+ cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
+ sm2 = getServerConnectionMetrics(serverMetrics, sm1.sentBytes + cm2.receivedBytes - cm1.receivedBytes);
+ long requestSz = cm2.sentBytes - cm1.sentBytes;
+ long replySz = cm2.receivedBytes - cm1.receivedBytes;
+
+ cm1 = cm2;
+ sm1 = sm2;
+
+ bs = new byte[456];
+ metrics.opByteS(bs);
+
+ cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
+ sm2 = getServerConnectionMetrics(serverMetrics, sm1.sentBytes + replySz);
+
+ test(cm2.sentBytes - cm1.sentBytes == requestSz + bs.length + 4); // 4 is for the seq variable size
+ test(cm2.receivedBytes - cm1.receivedBytes == replySz);
+ test(sm2.receivedBytes - sm1.receivedBytes == requestSz + bs.length + 4);
+ test(sm2.sentBytes - sm1.sentBytes == replySz);
+
+ cm1 = cm2;
+ sm1 = sm2;
+
+ bs = new byte[1024 * 1024 * 10]; // Try with large amount of data which should be sent in several chunks
+ metrics.opByteS(bs);
+
+ cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
+ sm2 = getServerConnectionMetrics(serverMetrics, sm1.sentBytes + replySz);
+
+ test((cm2.sentBytes - cm1.sentBytes) == (requestSz + bs.length + 4)); // 4 is for the seq variable size
+ test((cm2.receivedBytes - cm1.receivedBytes) == replySz);
+ test((sm2.receivedBytes - sm1.receivedBytes) == (requestSz + bs.length + 4));
+ test((sm2.sentBytes - sm1.sentBytes) == replySz);
+
+ props.put("IceMX.Metrics.View.Map.Connection.GroupBy", "state");
+ updateProps(clientProps, serverProps, update, props, "Connection");
+
+ map = toMap(serverMetrics.getMetricsView("View", timestamp).get("Connection"));
+
+ test(map.get("active").current == 1);
+
+ ControllerPrx controller = ControllerPrxHelper.checkedCast(
+ communicator.stringToProxy("controller:default -p 12011"));
+ controller.hold();
+
+ map = toMap(clientMetrics.getMetricsView("View", timestamp).get("Connection"));
+ test(map.get("active").current == 1);
+ map = toMap(serverMetrics.getMetricsView("View", timestamp).get("Connection"));
+ test(map.get("holding").current == 1);
+
+ metrics.ice_getConnection().close(false);
+
+ map = toMap(clientMetrics.getMetricsView("View", timestamp).get("Connection"));
+ test(map.get("closing").current == 1);
+ map = toMap(serverMetrics.getMetricsView("View", timestamp).get("Connection"));
+ test(map.get("holding").current == 1);
+
+ controller.resume();
+
+ map = toMap(serverMetrics.getMetricsView("View", timestamp).get("Connection"));
+ test(map.get("holding").current == 0);
+
+ props.put("IceMX.Metrics.View.Map.Connection.GroupBy", "none");
+ updateProps(clientProps, serverProps, update, props, "Connection");
+
+ metrics.ice_getConnection().close(false);
+
+ metrics.ice_timeout(500).ice_ping();
+ controller.hold();
+ try
+ {
+ ((MetricsPrx)metrics.ice_timeout(500)).opByteS(new byte[10000000]);
+ test(false);
+ }
+ catch(Ice.TimeoutException ex)
+ {
+ }
+ controller.resume();
+
+ cm1 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
+ while(true)
+ {
+ sm1 = (IceMX.ConnectionMetrics)serverMetrics.getMetricsView("View", timestamp).get("Connection")[0];
+ if(sm1.failures >= 2)
+ {
+ break;
+ }
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+ test(cm1.failures == 2 && sm1.failures >= 2);
+
+ checkFailure(clientMetrics, "Connection", cm1.id, "::Ice::TimeoutException", 1, out);
+ checkFailure(clientMetrics, "Connection", cm1.id, "::Ice::ConnectTimeoutException", 1, out);
+ checkFailure(serverMetrics, "Connection", sm1.id, "::Ice::ConnectionLostException", 0, out);
+
+ MetricsPrx m = (MetricsPrx)metrics.ice_timeout(500).ice_connectionId("Con1");
+ m.ice_ping();
+
+ testAttribute(clientMetrics, clientProps, update, "Connection", "parent", "Communicator", out);
+ //testAttribute(clientMetrics, clientProps, update, "Connection", "id", "");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpoint",
+ endpoint + " -t 500", out);
+
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointType", type, out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsDatagram", "false", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsSecure", isSecure, out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointTimeout", "500", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointCompress", "false", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointHost", "127.0.0.1", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointPort", "12010", out);
+
+ testAttribute(clientMetrics, clientProps, update, "Connection", "incoming", "false", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "adapterName", "", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "connectionId", "Con1", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "localHost", "127.0.0.1", out);
+ //testAttribute(clientMetrics, clientProps, update, "Connection", "localPort", "", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "remoteHost", "127.0.0.1", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "remotePort", "12010", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "mcastHost", "", out);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "mcastPort", "", out);
+
+ m.ice_getConnection().close(false);
+
+ waitForCurrent(clientMetrics, "View", "Connection", 0);
+ waitForCurrent(serverMetrics, "View", "Connection", 0);
+
+ out.println("ok");
+
+ out.print("testing connection establishment metrics... ");
+ out.flush();
+
+ props.put("IceMX.Metrics.View.Map.ConnectionEstablishment.GroupBy", "id");
+ updateProps(clientProps, serverProps, update, props, "ConnectionEstablishment");
+ test(clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment").length == 0);
+
+ metrics.ice_ping();
+
+ test(clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment").length == 1);
+ IceMX.Metrics m1 = clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment")[0];
+ test(m1.current == 0 && m1.total == 1 && m1.id.equals("127.0.0.1:12010"));
+
+ metrics.ice_getConnection().close(false);
+ controller.hold();
+ try
+ {
+ communicator.stringToProxy("test:tcp -p 12010 -h 127.0.0.1").ice_timeout(10).ice_ping();
+ test(false);
+ }
+ catch(Ice.ConnectTimeoutException ex)
+ {
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ controller.resume();
+ test(clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment").length == 1);
+ m1 = clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment")[0];
+ test(m1.id.equals("127.0.0.1:12010") && m1.total == 3 && m1.failures == 2);
+
+ checkFailure(clientMetrics, "ConnectionEstablishment", m1.id, "::Ice::ConnectTimeoutException", 2, out);
+
+ Connect c = new Connect(metrics);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "parent", "Communicator", c,
+ out);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "id", "127.0.0.1:12010", c,
+ out);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpoint",
+ endpoint + " -t 60000", c, out);
+
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointType", type, c, out);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointIsDatagram", "false",
+ c, out);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointIsSecure", isSecure, c,
+ out);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointTimeout", "60000", c,
+ out);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointCompress", "false", c,
+ out);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointHost", "127.0.0.1", c,
+ out);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointPort", "12010", c,
+ out);
+
+ out.println("ok");
+
+ out.print("testing endpoint lookup metrics... ");
+ out.flush();
+
+ props.put("IceMX.Metrics.View.Map.ConnectionEstablishment.GroupBy", "id");
+ updateProps(clientProps, serverProps, update, props, "EndpointLookup");
+ test(clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup").length == 0);
+
+ Ice.ObjectPrx prx = communicator.stringToProxy("metrics:default -p 12010 -h localhost -t infinite");
+ prx.ice_ping();
+
+ test(clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup").length == 1);
+ m1 = clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup")[0];
+ test(m1.current <= 1 && m1.total == 1 && m1.id.equals(prx.ice_getConnection().getEndpoint().toString()));
+
+ prx.ice_getConnection().close(false);
+
+ boolean dnsException = false;
+ try
+ {
+ communicator.stringToProxy("test:tcp -t 500 -p 12010 -h unknownfoo.zeroc.com").ice_ping();
+ test(false);
+ }
+ catch(Ice.DNSException ex)
+ {
+ dnsException = true;
+ }
+ catch(Ice.LocalException ex)
+ {
+ // Some DNS servers don't fail on unknown DNS names.
+ }
+ test(clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup").length == 2);
+ m1 = clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup")[0];
+ if(!m1.id.equals("tcp -h unknownfoo.zeroc.com -p 12010 -t 500"))
+ {
+ m1 = clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup")[1];
+ }
+ test(m1.id.equals("tcp -h unknownfoo.zeroc.com -p 12010 -t 500") && m1.total == 2 &&
+ (!dnsException || m1.failures == 2));
+ if(dnsException)
+ {
+ checkFailure(clientMetrics, "EndpointLookup", m1.id, "::Ice::DNSException", 2, out);
+ }
+
+ c = new Connect(prx);
+
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "parent", "Communicator", c, out);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "id",
+ prx.ice_getConnection().getEndpoint().toString(), c, out);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpoint",
+ prx.ice_getConnection().getEndpoint().toString(), c, out);
+
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointType", type, c, out);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsDatagram", "false", c, out);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsSecure", isSecure, c, out);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointTimeout", "-1", c, out);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointCompress", "false", c, out);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointHost", "localhost", c, out);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointPort", "12010", c, out);
+
+ out.println("ok");
+ }
+
+ out.print("testing dispatch metrics... ");
+ out.flush();
+
+ props.put("IceMX.Metrics.View.Map.Dispatch.GroupBy", "operation");
+ updateProps(clientProps, serverProps, update, props, "Dispatch");
+ test(serverMetrics.getMetricsView("View", timestamp).get("Dispatch").length == 0);
+
+ metrics.op();
+ try
+ {
+ metrics.opWithUserException();
+ test(false);
+ }
+ catch(UserEx ex)
+ {
+ }
+ try
+ {
+ metrics.opWithRequestFailedException();
+ test(false);
+ }
+ catch(Ice.RequestFailedException ex)
+ {
+ }
+ try
+ {
+ metrics.opWithLocalException();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ try
+ {
+ metrics.opWithUnknownException();
+ test(false);
+ }
+ catch(Ice.UnknownException ex)
+ {
+ }
+ if(!collocated)
+ {
+ try
+ {
+ metrics.fail();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ }
+ }
+ map = toMap(serverMetrics.getMetricsView("View", timestamp).get("Dispatch"));
+ test(map.size() == (!collocated ? 6 : 5));
+
+ IceMX.DispatchMetrics dm1 = (IceMX.DispatchMetrics)map.get("op");
+ test(dm1.current <= 1 && dm1.total == 1 && dm1.failures == 0 && dm1.userException == 0);
+ test(dm1.size == 21 && dm1.replySize == 7);
+
+ dm1 = (IceMX.DispatchMetrics)map.get("opWithUserException");
+ test(dm1.current <= 1 &dm1.total == 1 && dm1.failures == 0 && dm1.userException == 1);
+ test(dm1.size == 38 && dm1.replySize == 23);
+
+ dm1 = (IceMX.DispatchMetrics)map.get("opWithLocalException");
+ test(dm1.current <= 1 && dm1.total == 1 && dm1.failures == 1 && dm1.userException == 0);
+ checkFailure(serverMetrics, "Dispatch", dm1.id, "::Ice::SyscallException", 1, out);
+ test(dm1.size == 39 && dm1.replySize > 7); // Reply contains the exception stack depending on the OS.
+
+ dm1 = (IceMX.DispatchMetrics)map.get("opWithRequestFailedException");
+ test(dm1.current <= 1 && dm1.total == 1 && dm1.failures == 1 && dm1.userException == 0);
+ checkFailure(serverMetrics, "Dispatch", dm1.id, "::Ice::ObjectNotExistException", 1, out);
+ test(dm1.size == 47 && dm1.replySize == 40);
+
+ dm1 = (IceMX.DispatchMetrics)map.get("opWithUnknownException");
+ test(dm1.current <= 1 && dm1.total == 1 && dm1.failures == 1 && dm1.userException == 0);
+ checkFailure(serverMetrics, "Dispatch", dm1.id, "java.lang.IllegalArgumentException", 1, out);
+ test(dm1.size == 41 && dm1.replySize > 7); // Reply contains the exception stack depending on the OS.
+
+ InvokeOp op = new InvokeOp(metrics);
+
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "parent", "TestAdapter", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "id", "metrics [op]", op, out);
+ if(!collocated)
+ {
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpoint",
+ endpoint + " -t 60000", op, out);
+ //testAttribute(serverMetrics, serverProps, update, "Dispatch", "connection", "", op);
+
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointType", type, op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsDatagram", "false", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsSecure", isSecure, op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointTimeout", "60000", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointCompress", "false", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointHost", "127.0.0.1", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointPort", "12010", op, out);
+
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "incoming", "true", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "adapterName", "TestAdapter", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "connectionId", "", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "localHost", "127.0.0.1", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "localPort", "12010", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "remoteHost", "127.0.0.1", op, out);
+ //testAttribute(serverMetrics, serverProps, update, "Dispatch", "remotePort", "12010", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "mcastHost", "", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "mcastPort", "", op, out);
+ }
+
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "operation", "op", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "identity", "metrics", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "facet", "", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "mode", "twoway", op, out);
+
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "context.entry1", "test", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "context.entry2", "", op, out);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "context.entry3", "", op, out);
+
+ out.println("ok");
+
+ out.print("testing invocation metrics... ");
+ out.flush();
+
+ props.put("IceMX.Metrics.View.Map.Invocation.GroupBy", "operation");
+ props.put("IceMX.Metrics.View.Map.Invocation.Map.Remote.GroupBy", "localPort");
+ props.put("IceMX.Metrics.View.Map.Invocation.Map.Collocated.GroupBy", "id");
+ updateProps(clientProps, serverProps, update, props, "Invocation");
+ test(serverMetrics.getMetricsView("View", timestamp).get("Invocation").length == 0);
+
+ Callback cb = new Callback();
+
+ //
+ // Twoway tests
+ //
+ metrics.op();
+ metrics.end_op(metrics.begin_op());
+ metrics.begin_op(cb);
+ cb.waitForResponse();
+
+ try
+ {
+ metrics.opWithUserException();
+ test(false);
+ }
+ catch(UserEx ex)
+ {
+ }
+ try
+ {
+ metrics.end_opWithUserException(metrics.begin_opWithUserException());
+ test(false);
+ }
+ catch(UserEx ex)
+ {
+ }
+ metrics.begin_opWithUserException(cb);
+ cb.waitForResponse();
+
+ try
+ {
+ metrics.opWithRequestFailedException();
+ test(false);
+ }
+ catch(Ice.RequestFailedException ex)
+ {
+ }
+ try
+ {
+ metrics.end_opWithRequestFailedException(metrics.begin_opWithRequestFailedException());
+ test(false);
+ }
+ catch(Ice.RequestFailedException ex)
+ {
+ }
+ metrics.begin_opWithRequestFailedException(cb);
+ cb.waitForResponse();
+
+ try
+ {
+ metrics.opWithLocalException();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ try
+ {
+ metrics.end_opWithLocalException(metrics.begin_opWithLocalException());
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ metrics.begin_opWithLocalException(cb);
+ cb.waitForResponse();
+
+ try
+ {
+ metrics.opWithUnknownException();
+ test(false);
+ }
+ catch(Ice.UnknownException ex)
+ {
+ }
+ try
+ {
+ metrics.end_opWithUnknownException(metrics.begin_opWithUnknownException());
+ test(false);
+ }
+ catch(Ice.UnknownException ex)
+ {
+ }
+ metrics.begin_opWithUnknownException(cb);
+ cb.waitForResponse();
+
+ if(!collocated)
+ {
+ try
+ {
+ metrics.fail();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ }
+ try
+ {
+ metrics.end_fail(metrics.begin_fail());
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ }
+ metrics.begin_fail(cb);
+ cb.waitForResponse();
+ }
+
+ map = toMap(clientMetrics.getMetricsView("View", timestamp).get("Invocation"));
+ test(map.size() == (!collocated ? 6 : 5));
+
+ IceMX.InvocationMetrics im1;
+ IceMX.ChildInvocationMetrics rim1;
+ im1 = (IceMX.InvocationMetrics)map.get("op");
+ test(im1.current <= 1 && im1.total == 3 && im1.failures == 0 && im1.retry == 0);
+ test(!collocated ? im1.remotes.length == 1 : im1.collocated.length == 1);
+ rim1 = (IceMX.ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
+ test(rim1.current == 0 && rim1.total == 3 && rim1.failures == 0);
+ test(rim1.size == 63 && rim1.replySize == 21);
+
+ im1 = (IceMX.InvocationMetrics)map.get("opWithUserException");
+ test(im1.current == 0 && im1.total == 3 && im1.failures == 0 && im1.retry == 0);
+ test(!collocated ? im1.remotes.length == 1 : im1.collocated.length == 1);
+ rim1 = (IceMX.ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
+ test(rim1.current == 0 && rim1.total == 3 && rim1.failures == 0);
+ test(rim1.size == 114 && rim1.replySize == 69);
+ test(im1.userException == 3);
+
+ im1 = (IceMX.InvocationMetrics)map.get("opWithLocalException");
+ test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 0);
+ test(!collocated ? im1.remotes.length == 1 : im1.collocated.length == 1);
+ rim1 = (IceMX.ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
+ test(rim1.current == 0 && rim1.total == 3 && rim1.failures == 0);
+ test(rim1.size == 117 && rim1.replySize > 7);
+ checkFailure(clientMetrics, "Invocation", im1.id, "::Ice::UnknownLocalException", 3, out);
+
+ im1 = (IceMX.InvocationMetrics)map.get("opWithRequestFailedException");
+ test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 0);
+ test(!collocated ? im1.remotes.length == 1 : im1.collocated.length == 1);
+ rim1 = (IceMX.ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
+ test(rim1.current == 0 && rim1.total == 3 && rim1.failures == 0);
+ test(rim1.size == 141 && rim1.replySize == 120);
+ checkFailure(clientMetrics, "Invocation", im1.id, "::Ice::ObjectNotExistException", 3, out);
+
+ im1 = (IceMX.InvocationMetrics)map.get("opWithUnknownException");
+ test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 0);
+ test(!collocated ? im1.remotes.length == 1 : im1.collocated.length == 1);
+ rim1 = (IceMX.ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
+ test(rim1.current == 0 && rim1.total == 3 && rim1.failures == 0);
+ test(rim1.size == 123 && rim1.replySize > 7);
+ checkFailure(clientMetrics, "Invocation", im1.id, "::Ice::UnknownException", 3, out);
+
+ if(!collocated)
+ {
+ im1 = (IceMX.InvocationMetrics)map.get("fail");
+ test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 3 && im1.remotes.length == 6);
+ test(im1.remotes[0].current == 0 && im1.remotes[0].total == 1 && im1.remotes[0].failures == 1);
+ test(im1.remotes[1].current == 0 && im1.remotes[1].total == 1 && im1.remotes[1].failures == 1);
+ test(im1.remotes[2].current == 0 && im1.remotes[2].total == 1 && im1.remotes[2].failures == 1);
+ test(im1.remotes[3].current == 0 && im1.remotes[3].total == 1 && im1.remotes[3].failures == 1);
+ test(im1.remotes[4].current == 0 && im1.remotes[4].total == 1 && im1.remotes[4].failures == 1);
+ test(im1.remotes[5].current == 0 && im1.remotes[5].total == 1 && im1.remotes[5].failures == 1);
+ checkFailure(clientMetrics, "Invocation", im1.id, "::Ice::ConnectionLostException", 3, out);
+ }
+
+ testAttribute(clientMetrics, clientProps, update, "Invocation", "parent", "Communicator", op, out);
+ testAttribute(clientMetrics, clientProps, update, "Invocation", "id", "metrics -t -e 1.1 [op]", op, out);
+
+ testAttribute(clientMetrics, clientProps, update, "Invocation", "operation", "op", op, out);
+ testAttribute(clientMetrics, clientProps, update, "Invocation", "identity", "metrics", op, out);
+ testAttribute(clientMetrics, clientProps, update, "Invocation", "facet", "", op, out);
+ testAttribute(clientMetrics, clientProps, update, "Invocation", "encoding", "1.1", op, out);
+ testAttribute(clientMetrics, clientProps, update, "Invocation", "mode", "twoway", op, out);
+ testAttribute(clientMetrics, clientProps, update, "Invocation", "proxy",
+ "metrics -t -e 1.1:" + endpoint + " -t 60000", op, out);
+
+ testAttribute(clientMetrics, clientProps, update, "Invocation", "context.entry1", "test", op, out);
+ testAttribute(clientMetrics, clientProps, update, "Invocation", "context.entry2", "", op, out);
+ testAttribute(clientMetrics, clientProps, update, "Invocation", "context.entry3", "", op, out);
+
+ //
+ // Oneway tests
+ //
+ clearView(clientProps, serverProps, update);
+ props.put("IceMX.Metrics.View.Map.Invocation.GroupBy", "operation");
+ props.put("IceMX.Metrics.View.Map.Invocation.Map.Remote.GroupBy", "localPort");
+ updateProps(clientProps, serverProps, update, props, "Invocation");
+
+ MetricsPrx metricsOneway = (MetricsPrx)metrics.ice_oneway();
+ metricsOneway.op();
+ metricsOneway.end_op(metricsOneway.begin_op());
+ metricsOneway.begin_op(cb).waitForSent();
+
+ map = toMap(clientMetrics.getMetricsView("View", timestamp).get("Invocation"));
+ test(map.size() == 1);
+
+ im1 = (IceMX.InvocationMetrics)map.get("op");
+ test(im1.current <= 1 && im1.total == 3 && im1.failures == 0 && im1.retry == 0);
+ test(!collocated ? (im1.remotes.length == 1) : (im1.collocated.length == 1));
+ rim1 = (IceMX.ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
+ test(rim1.current <= 1 && rim1.total == 3 && rim1.failures == 0);
+ test(rim1.size == 63 && rim1.replySize == 0);
+
+ testAttribute(clientMetrics, clientProps, update, "Invocation", "mode", "oneway", new InvokeOp(metricsOneway),
+ out);
+
+ //
+ // Batch oneway tests
+ //
+ props.put("IceMX.Metrics.View.Map.Invocation.GroupBy", "operation");
+ props.put("IceMX.Metrics.View.Map.Invocation.Map.Remote.GroupBy", "localPort");
+ updateProps(clientProps, serverProps, update, props, "Invocation");
+
+ MetricsPrx metricsBatchOneway = (MetricsPrx)metrics.ice_batchOneway();
+ metricsBatchOneway.op();
+ metricsBatchOneway.end_op(metricsBatchOneway.begin_op());
+ //metricsBatchOneway.begin_op(cb).waitForSent();
+
+ map = toMap(clientMetrics.getMetricsView("View", timestamp).get("Invocation"));
+ test(map.size() == 1);
+
+ im1 = (IceMX.InvocationMetrics)map.get("op");
+ test(im1.current == 0 && im1.total == 2 && im1.failures == 0 && im1.retry == 0);
+ test(im1.remotes.length == 0);
+
+ testAttribute(clientMetrics, clientProps, update, "Invocation", "mode", "batch-oneway",
+ new InvokeOp(metricsBatchOneway), out);
+
+ out.println("ok");
+
+ out.print("testing metrics view enable/disable...");
+ out.flush();
+
+ Ice.StringSeqHolder disabledViews = new Ice.StringSeqHolder();
+ props.put("IceMX.Metrics.View.GroupBy", "none");
+ props.put("IceMX.Metrics.View.Disabled", "0");
+ updateProps(clientProps, serverProps, update, props, "Thread");
+ test(clientMetrics.getMetricsView("View", timestamp).get("Thread").length != 0);
+ test(clientMetrics.getMetricsViewNames(disabledViews).length == 1 && disabledViews.value.length == 0);
+
+ props.put("IceMX.Metrics.View.Disabled", "1");
+ updateProps(clientProps, serverProps, update, props, "Thread");
+ test(clientMetrics.getMetricsView("View", timestamp).get("Thread") == null);
+ test(clientMetrics.getMetricsViewNames(disabledViews).length == 0 && disabledViews.value.length == 1);
+
+ clientMetrics.enableMetricsView("View");
+ test(clientMetrics.getMetricsView("View", timestamp).get("Thread").length != 0);
+ test(clientMetrics.getMetricsViewNames(disabledViews).length == 1 && disabledViews.value.length == 0);
+
+ clientMetrics.disableMetricsView("View");
+ test(clientMetrics.getMetricsView("View", timestamp).get("Thread") == null);
+ test(clientMetrics.getMetricsViewNames(disabledViews).length == 0 && disabledViews.value.length == 1);
+
+ try
+ {
+ clientMetrics.enableMetricsView("UnknownView");
+ }
+ catch(IceMX.UnknownMetricsView ex)
+ {
+ }
+
+ out.println("ok");
+
+ out.print("testing instrumentation observer delegate... ");
+ out.flush();
+
+ test(obsv.threadObserver.getTotal() > 0);
+ if(!collocated)
+ {
+ test(obsv.connectionObserver.getTotal() > 0);
+ test(obsv.connectionEstablishmentObserver.getTotal() > 0);
+ test(obsv.endpointLookupObserver.getTotal() > 0);
+ test(obsv.invocationObserver.remoteObserver.getTotal() > 0);
+ }
+ else
+ {
+ test(obsv.invocationObserver.collocatedObserver.getTotal() > 0);
+ }
+ test(obsv.dispatchObserver.getTotal() > 0);
+ test(obsv.invocationObserver.getTotal() > 0);
+
+ test(obsv.threadObserver.getCurrent() > 0);
+ if(!collocated)
+ {
+ test(obsv.connectionObserver.getCurrent() > 0);
+ test(obsv.connectionEstablishmentObserver.getCurrent() == 0);
+ test(obsv.endpointLookupObserver.getCurrent() == 0);
+ waitForObserverCurrent(obsv.invocationObserver.remoteObserver, 0);
+ test(obsv.invocationObserver.remoteObserver.getCurrent() == 0);
+ }
+ else
+ {
+ waitForObserverCurrent(obsv.invocationObserver.collocatedObserver, 0);
+ test(obsv.invocationObserver.collocatedObserver.getCurrent() == 0);
+ }
+ waitForObserverCurrent(obsv.dispatchObserver, 0);
+ test(obsv.dispatchObserver.getCurrent() == 0);
+ waitForObserverCurrent(obsv.invocationObserver, 0);
+ test(obsv.invocationObserver.getCurrent() == 0);
+
+ test(obsv.threadObserver.getFailedCount() == 0);
+ if(!collocated)
+ {
+ test(obsv.connectionObserver.getFailedCount() > 0);
+ test(obsv.connectionEstablishmentObserver.getFailedCount() > 0);
+ test(obsv.endpointLookupObserver.getFailedCount() > 0);
+ test(obsv.invocationObserver.remoteObserver.getFailedCount() > 0);
+ }
+ //test(obsv.dispatchObserver.getFailedCount() > 0);
+ test(obsv.invocationObserver.getFailedCount() > 0);
+
+ if(!collocated)
+ {
+ test(obsv.threadObserver.states > 0);
+ test(obsv.connectionObserver.received > 0 && obsv.connectionObserver.sent > 0);
+ test(obsv.invocationObserver.retriedCount > 0);
+ test(obsv.invocationObserver.remoteObserver.replySize > 0);
+ }
+ else
+ {
+ test(obsv.invocationObserver.collocatedObserver.replySize > 0);
+ }
+ //test(obsv.dispatchObserver.userExceptionCount > 0);
+ test(obsv.invocationObserver.userExceptionCount > 0);
+
+ out.println("ok");
+
+ return metrics;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/metrics/ChildInvocationObserverI.java b/java-compat/test/src/main/java/test/Ice/metrics/ChildInvocationObserverI.java
new file mode 100644
index 00000000000..326fe35f269
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/metrics/ChildInvocationObserverI.java
@@ -0,0 +1,31 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.metrics;
+
+class ChildInvocationObserverI extends ObserverI implements Ice.Instrumentation.ChildInvocationObserver
+{
+ @Override
+ public synchronized void
+ reset()
+ {
+ super.reset();
+ replySize = 0;
+ }
+
+ @Override
+ public synchronized void
+ reply(int s)
+ {
+ replySize += s;
+ }
+
+ int replySize;
+};
+
diff --git a/java-compat/test/src/main/java/test/Ice/metrics/Client.java b/java-compat/test/src/main/java/test/Ice/metrics/Client.java
new file mode 100644
index 00000000000..e2cc47bbdfc
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/metrics/Client.java
@@ -0,0 +1,60 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.metrics;
+
+import test.Ice.metrics.Test.MetricsPrx;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ try
+ {
+ MetricsPrx metrics = AllTests.allTests(communicator, getWriter(), _observer);
+ metrics.shutdown();
+ }
+ catch(Ice.UserException ex)
+ {
+ ex.printStackTrace();
+ assert(false);
+ return 1;
+ }
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.metrics");
+ initData.properties.setProperty("Ice.Admin.Endpoints", "tcp");
+ initData.properties.setProperty("Ice.Admin.InstanceName", "client");
+ initData.properties.setProperty("Ice.Admin.DelayCreation", "1");
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.MessageSizeMax", "50000");
+ initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
+
+ initData.observer = _observer;
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+
+ private CommunicatorObserverI _observer = new CommunicatorObserverI();
+}
diff --git a/java-compat/test/src/main/java/test/Ice/metrics/Collocated.java b/java-compat/test/src/main/java/test/Ice/metrics/Collocated.java
new file mode 100644
index 00000000000..98320001330
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/metrics/Collocated.java
@@ -0,0 +1,78 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.metrics;
+
+import test.Ice.metrics.Test.MetricsPrx;
+
+public class Collocated extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new MetricsI(), Ice.Util.stringToIdentity("metrics"));
+ //adapter.activate(); // Don't activate OA to ensure collocation is used.
+
+ communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011");
+ Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter");
+ controllerAdapter.add(new ControllerI(adapter), Ice.Util.stringToIdentity("controller"));
+ //controllerAdapter.activate(); // Don't activate OA to ensure collocation is used.
+
+ try
+ {
+ MetricsPrx metrics = AllTests.allTests(communicator, getWriter(), _observer);
+ metrics.shutdown();
+ }
+ catch(Ice.UserException ex)
+ {
+ ex.printStackTrace();
+ assert(false);
+ return 1;
+ }
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ if(initData.properties.getPropertyAsInt("Ice.ThreadInterruptSafe") > 0)
+ {
+ // With background IO, collocated invocations are
+ // dispatched on the server thread pool. This test needs
+ // at least 3 threads in the server thread pool to work.
+ initData.properties.setProperty("Ice.ThreadPool.Server.Size", "3");
+ }
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.metrics");
+ initData.properties.setProperty("Ice.Admin.Endpoints", "tcp");
+ initData.properties.setProperty("Ice.Admin.InstanceName", "client");
+ initData.properties.setProperty("Ice.Admin.DelayCreation", "1");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties.setProperty("Ice.MessageSizeMax", "50000");
+ initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
+ initData.observer = _observer;
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Collocated app = new Collocated();
+ int result = app.main("Collocated", args);
+ System.gc();
+ System.exit(result);
+ }
+
+ private CommunicatorObserverI _observer = new CommunicatorObserverI();
+}
diff --git a/java-compat/test/src/main/java/test/Ice/metrics/CollocatedObserverI.java b/java-compat/test/src/main/java/test/Ice/metrics/CollocatedObserverI.java
new file mode 100644
index 00000000000..52e92df22ac
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/metrics/CollocatedObserverI.java
@@ -0,0 +1,15 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.metrics;
+
+class CollocatedObserverI extends ChildInvocationObserverI implements Ice.Instrumentation.CollocatedObserver
+{
+};
+
diff --git a/java-compat/test/src/main/java/test/Ice/metrics/CommunicatorObserverI.java b/java-compat/test/src/main/java/test/Ice/metrics/CommunicatorObserverI.java
new file mode 100644
index 00000000000..fe33c7a60cc
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/metrics/CommunicatorObserverI.java
@@ -0,0 +1,147 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.metrics;
+
+class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorObserver
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ @Override
+ public void
+ setObserverUpdater(Ice.Instrumentation.ObserverUpdater u)
+ {
+ updater = u;
+ }
+
+ @Override
+ synchronized public Ice.Instrumentation.Observer
+ getConnectionEstablishmentObserver(Ice.Endpoint e, String s)
+ {
+ if(connectionEstablishmentObserver == null)
+ {
+ connectionEstablishmentObserver = new ObserverI();
+ connectionEstablishmentObserver.reset();
+ }
+ return connectionEstablishmentObserver;
+ }
+
+
+ @Override
+ synchronized public Ice.Instrumentation.Observer
+ getEndpointLookupObserver(Ice.Endpoint e)
+ {
+ if(endpointLookupObserver == null)
+ {
+ endpointLookupObserver = new ObserverI();
+ endpointLookupObserver.reset();
+ }
+ return endpointLookupObserver;
+ }
+
+ @Override
+ synchronized public Ice.Instrumentation.ConnectionObserver
+ getConnectionObserver(Ice.ConnectionInfo c,
+ Ice.Endpoint e,
+ Ice.Instrumentation.ConnectionState s,
+ Ice.Instrumentation.ConnectionObserver old)
+ {
+ test(old == null || old instanceof ConnectionObserverI);
+ if(connectionObserver == null)
+ {
+ connectionObserver = new ConnectionObserverI();
+ connectionObserver.reset();
+ }
+ return connectionObserver;
+ }
+
+ @Override
+ synchronized public Ice.Instrumentation.ThreadObserver
+ getThreadObserver(String p, String id, Ice.Instrumentation.ThreadState s,
+ Ice.Instrumentation.ThreadObserver old)
+ {
+ test(old == null || old instanceof ThreadObserverI);
+ if(threadObserver == null)
+ {
+ threadObserver = new ThreadObserverI();
+ threadObserver.reset();
+ }
+ return threadObserver;
+ }
+
+ @Override
+ synchronized public Ice.Instrumentation.InvocationObserver
+ getInvocationObserver(Ice.ObjectPrx p, String op, java.util.Map<String, String> ctx)
+ {
+ if(invocationObserver == null)
+ {
+ invocationObserver = new InvocationObserverI();
+ invocationObserver.reset();
+ }
+ return invocationObserver;
+ }
+
+ @Override
+ synchronized public Ice.Instrumentation.DispatchObserver
+ getDispatchObserver(Ice.Current current, int s)
+ {
+ if(dispatchObserver == null)
+ {
+ dispatchObserver = new DispatchObserverI();
+ dispatchObserver.reset();
+ }
+ return dispatchObserver;
+ }
+
+ synchronized void
+ reset()
+ {
+ if(connectionEstablishmentObserver != null)
+ {
+ connectionEstablishmentObserver.reset();
+ }
+ if(endpointLookupObserver != null)
+ {
+ endpointLookupObserver.reset();
+ }
+ if(connectionObserver != null)
+ {
+ connectionObserver.reset();
+ }
+ if(threadObserver != null)
+ {
+ threadObserver.reset();
+ }
+ if(invocationObserver != null)
+ {
+ invocationObserver.reset();
+ }
+ if(dispatchObserver != null)
+ {
+ dispatchObserver.reset();
+ }
+ }
+
+ Ice.Instrumentation.ObserverUpdater updater;
+
+ ObserverI connectionEstablishmentObserver;
+ ObserverI endpointLookupObserver;
+ ConnectionObserverI connectionObserver;
+ ThreadObserverI threadObserver;
+ InvocationObserverI invocationObserver;
+ DispatchObserverI dispatchObserver;
+};
+
diff --git a/java-compat/test/src/main/java/test/Ice/metrics/ConnectionObserverI.java b/java-compat/test/src/main/java/test/Ice/metrics/ConnectionObserverI.java
new file mode 100644
index 00000000000..c163bd6209d
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/metrics/ConnectionObserverI.java
@@ -0,0 +1,40 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.metrics;
+
+class ConnectionObserverI extends ObserverI implements Ice.Instrumentation.ConnectionObserver
+{
+ @Override
+ public synchronized void
+ reset()
+ {
+ super.reset();
+ received = 0;
+ sent = 0;
+ }
+
+ @Override
+ public synchronized void
+ sentBytes(int s)
+ {
+ sent += s;
+ }
+
+ @Override
+ public synchronized void
+ receivedBytes(int s)
+ {
+ received += s;
+ }
+
+ int sent;
+ int received;
+};
+
diff --git a/java-compat/test/src/main/java/test/Ice/metrics/ControllerI.java b/java-compat/test/src/main/java/test/Ice/metrics/ControllerI.java
new file mode 100644
index 00000000000..e40d04ece62
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/metrics/ControllerI.java
@@ -0,0 +1,34 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.metrics;
+import test.Ice.metrics.Test._ControllerDisp;
+
+public final class ControllerI extends _ControllerDisp
+{
+ public ControllerI(Ice.ObjectAdapter adapter)
+ {
+ _adapter = adapter;
+ }
+
+ @Override
+ public void hold(Ice.Current current)
+ {
+ _adapter.hold();
+ _adapter.waitForHold();
+ }
+
+ @Override
+ public void resume(Ice.Current current)
+ {
+ _adapter.activate();
+ }
+
+ final private Ice.ObjectAdapter _adapter;
+};
diff --git a/java-compat/test/src/main/java/test/Ice/metrics/DispatchObserverI.java b/java-compat/test/src/main/java/test/Ice/metrics/DispatchObserverI.java
new file mode 100644
index 00000000000..783fcea2791
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/metrics/DispatchObserverI.java
@@ -0,0 +1,40 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.metrics;
+
+class DispatchObserverI extends ObserverI implements Ice.Instrumentation.DispatchObserver
+{
+ @Override
+ public synchronized void
+ reset()
+ {
+ super.reset();
+ userExceptionCount = 0;
+ replySize = 0;
+ }
+
+ @Override
+ public synchronized void
+ userException()
+ {
+ ++userExceptionCount;
+ }
+
+ @Override
+ public synchronized void
+ reply(int s)
+ {
+ replySize += s;
+ }
+
+ int userExceptionCount;
+ int replySize;
+};
+
diff --git a/java-compat/test/src/main/java/test/Ice/metrics/InvocationObserverI.java b/java-compat/test/src/main/java/test/Ice/metrics/InvocationObserverI.java
new file mode 100644
index 00000000000..91661e43a0e
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/metrics/InvocationObserverI.java
@@ -0,0 +1,75 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.metrics;
+
+class InvocationObserverI extends ObserverI implements Ice.Instrumentation.InvocationObserver
+{
+ @Override
+ public synchronized void
+ reset()
+ {
+ super.reset();
+ retriedCount = 0;
+ userExceptionCount = 0;
+ if(remoteObserver != null)
+ {
+ remoteObserver.reset();
+ }
+ if(collocatedObserver != null)
+ {
+ collocatedObserver.reset();
+ }
+ }
+
+ @Override
+ public synchronized void
+ retried()
+ {
+ ++retriedCount;
+ }
+
+ @Override
+ public synchronized void
+ userException()
+ {
+ ++userExceptionCount;
+ }
+
+ @Override
+ public synchronized Ice.Instrumentation.RemoteObserver
+ getRemoteObserver(Ice.ConnectionInfo c, Ice.Endpoint e, int a, int b)
+ {
+ if(remoteObserver == null)
+ {
+ remoteObserver = new RemoteObserverI();
+ remoteObserver.reset();
+ }
+ return remoteObserver;
+ }
+
+
+ @Override
+ public synchronized Ice.Instrumentation.CollocatedObserver
+ getCollocatedObserver(Ice.ObjectAdapter adapter, int a, int b)
+ {
+ if(collocatedObserver == null)
+ {
+ collocatedObserver = new CollocatedObserverI();
+ collocatedObserver.reset();
+ }
+ return collocatedObserver;
+ }
+
+ int userExceptionCount;
+ int retriedCount;
+
+ RemoteObserverI remoteObserver = null;
+ CollocatedObserverI collocatedObserver = null;
+};
diff --git a/java-compat/test/src/main/java/test/Ice/metrics/MetricsI.java b/java-compat/test/src/main/java/test/Ice/metrics/MetricsI.java
new file mode 100644
index 00000000000..a7cf0f3dccf
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/metrics/MetricsI.java
@@ -0,0 +1,81 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.metrics;
+import test.Ice.metrics.Test.*;
+
+public final class MetricsI extends _MetricsDisp
+{
+ public
+ MetricsI()
+ {
+ }
+
+ @Override
+ public void
+ op(Ice.Current current)
+ {
+ }
+
+ @Override
+ public void
+ fail(Ice.Current current)
+ {
+ current.con.close(true);
+ }
+
+ @Override
+ public void
+ opWithUserException(Ice.Current current)
+ throws UserEx
+ {
+ throw new UserEx();
+ }
+
+ @Override
+ public void
+ opWithRequestFailedException(Ice.Current current)
+ {
+ throw new Ice.ObjectNotExistException();
+ }
+
+ @Override
+ public void
+ opWithLocalException(Ice.Current current)
+ {
+ throw new Ice.SyscallException();
+ }
+
+ @Override
+ public void
+ opWithUnknownException(Ice.Current current)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ @Override
+ public void
+ opByteS(byte[] bs, Ice.Current current)
+ {
+ }
+
+ @Override
+ public Ice.ObjectPrx
+ getAdmin(Ice.Current current)
+ {
+ return current.adapter.getCommunicator().getAdmin();
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/metrics/ObserverI.java b/java-compat/test/src/main/java/test/Ice/metrics/ObserverI.java
new file mode 100644
index 00000000000..083c6613570
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/metrics/ObserverI.java
@@ -0,0 +1,63 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.metrics;
+
+class ObserverI implements Ice.Instrumentation.Observer
+{
+ synchronized public void
+ reset()
+ {
+ total = 0;
+ current = 0;
+ failedCount = 0;
+ }
+
+ @Override
+ synchronized public void
+ attach()
+ {
+ ++total;
+ ++current;
+ }
+ @Override
+ synchronized public void
+ detach()
+ {
+ --current;
+ }
+ @Override
+ synchronized public void
+ failed(String s)
+ {
+ ++failedCount;
+ }
+
+ synchronized int
+ getTotal()
+ {
+ return total;
+ }
+
+ synchronized int
+ getCurrent()
+ {
+ return current;
+ }
+
+ synchronized int
+ getFailedCount()
+ {
+ return failedCount;
+ }
+
+ int total;
+ int current;
+ int failedCount;
+};
diff --git a/java-compat/test/src/main/java/test/Ice/metrics/RemoveObserverI.java b/java-compat/test/src/main/java/test/Ice/metrics/RemoveObserverI.java
new file mode 100644
index 00000000000..52e0e6f7011
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/metrics/RemoveObserverI.java
@@ -0,0 +1,15 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.metrics;
+
+class RemoteObserverI extends ChildInvocationObserverI implements Ice.Instrumentation.RemoteObserver
+{
+};
+
diff --git a/java-compat/test/src/main/java/test/Ice/metrics/Server.java b/java-compat/test/src/main/java/test/Ice/metrics/Server.java
new file mode 100644
index 00000000000..b4512bfdc4b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/metrics/Server.java
@@ -0,0 +1,53 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.metrics;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new MetricsI(), Ice.Util.stringToIdentity("metrics"));
+ adapter.activate();
+
+ communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011");
+ Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter");
+ controllerAdapter.add(new ControllerI(adapter), Ice.Util.stringToIdentity("controller"));
+ controllerAdapter.activate();
+
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ initData.properties.setProperty("Ice.Admin.Endpoints", "tcp");
+ initData.properties.setProperty("Ice.Admin.InstanceName", "server");
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties.setProperty("Ice.MessageSizeMax", "50000");
+ initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/metrics/Test.ice b/java-compat/test/src/main/java/test/Ice/metrics/Test.ice
new file mode 100644
index 00000000000..03c7477c120
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/metrics/Test.ice
@@ -0,0 +1,51 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.metrics"]]
+module Test
+{
+
+exception UserEx
+{
+};
+
+sequence<byte> ByteSeq;
+
+interface Metrics
+{
+ void op();
+
+ idempotent void fail();
+
+ void opWithUserException()
+ throws UserEx;
+
+ void opWithRequestFailedException();
+
+ void opWithLocalException();
+
+ void opWithUnknownException();
+
+ void opByteS(ByteSeq bs);
+
+ Object* getAdmin();
+
+ void shutdown();
+};
+
+interface Controller
+{
+ void hold();
+
+ void resume();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/metrics/TestAMD.ice b/java-compat/test/src/main/java/test/Ice/metrics/TestAMD.ice
new file mode 100644
index 00000000000..f70916e22a9
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/metrics/TestAMD.ice
@@ -0,0 +1,51 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.metrics.AMD"]]
+module Test
+{
+
+exception UserEx
+{
+};
+
+sequence<byte> ByteSeq;
+
+interface Metrics
+{
+ ["amd"] void op();
+
+ ["amd"] idempotent void fail();
+
+ ["amd"] void opWithUserException()
+ throws UserEx;
+
+ ["amd"] void opWithRequestFailedException();
+
+ ["amd"] void opWithLocalException();
+
+ ["amd"] void opWithUnknownException();
+
+ ["amd"] void opByteS(ByteSeq bs);
+
+ Object* getAdmin();
+
+ void shutdown();
+};
+
+interface Controller
+{
+ void hold();
+
+ void resume();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/metrics/ThreadObserverI.java b/java-compat/test/src/main/java/test/Ice/metrics/ThreadObserverI.java
new file mode 100644
index 00000000000..218363d72dc
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/metrics/ThreadObserverI.java
@@ -0,0 +1,31 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.metrics;
+
+class ThreadObserverI extends ObserverI implements Ice.Instrumentation.ThreadObserver
+{
+ @Override
+ public synchronized void
+ reset()
+ {
+ super.reset();
+ states = 0;
+ }
+
+ @Override
+ public synchronized void
+ stateChanged(Ice.Instrumentation.ThreadState o, Ice.Instrumentation.ThreadState n)
+ {
+ ++states;
+ }
+
+ int states;
+};
+
diff --git a/java-compat/test/src/main/java/test/Ice/metrics/run.py b/java-compat/test/src/main/java/test/Ice/metrics/run.py
new file mode 100755
index 00000000000..88b29abdfd1
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/metrics/run.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.",
+ server="test.Ice.metrics.AMDServer")
+TestUtil.queueCollocatedTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/networkProxy/AllTests.java b/java-compat/test/src/main/java/test/Ice/networkProxy/AllTests.java
new file mode 100644
index 00000000000..4ec21083e4a
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/networkProxy/AllTests.java
@@ -0,0 +1,84 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.networkProxy;
+
+import java.io.PrintWriter;
+
+import test.Ice.networkProxy.Test.TestIntfPrx;
+import test.Ice.networkProxy.Test.TestIntfPrxHelper;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static void
+ allTests(test.Util.Application app)
+ {
+ Ice.Communicator communicator = app.communicator();
+ PrintWriter out = app.getWriter();
+
+ String sref = "test:default -p 12010";
+ Ice.ObjectPrx obj = communicator.stringToProxy(sref);
+ test(obj != null);
+
+ TestIntfPrx test = TestIntfPrxHelper.checkedCast(obj);
+ test(test != null);
+
+ out.print("testing connection... ");
+ out.flush();
+ {
+ test.ice_ping();
+ }
+ out.println("ok");
+
+ out.print("testing connection information... ");
+ out.flush();
+ {
+ Ice.IPConnectionInfo info = null;
+ for(Ice.ConnectionInfo p = test.ice_getConnection().getInfo(); p != null; p = p.underlying)
+ {
+ if(p instanceof Ice.IPConnectionInfo)
+ {
+ info = (Ice.IPConnectionInfo)p;
+ }
+ }
+ test(info.remotePort == 12030 || info.remotePort == 12031); // make sure we are connected to the proxy port.
+ }
+ out.println("ok");
+
+ out.print("shutting down server... ");
+ out.flush();
+ {
+ test.shutdown();
+ }
+ out.println("ok");
+
+ out.print("testing connection failure... ");
+ out.flush();
+ {
+ try
+ {
+ test.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ }
+ out.println("ok");
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/networkProxy/Client.java b/java-compat/test/src/main/java/test/Ice/networkProxy/Client.java
new file mode 100644
index 00000000000..a3972a06b9b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/networkProxy/Client.java
@@ -0,0 +1,39 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.networkProxy;
+
+import test.Ice.networkProxy.Test.TestIntfPrx;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ AllTests.allTests(this);
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.networkProxy");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/networkProxy/Server.java b/java-compat/test/src/main/java/test/Ice/networkProxy/Server.java
new file mode 100644
index 00000000000..1c0838f37a3
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/networkProxy/Server.java
@@ -0,0 +1,51 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.networkProxy;
+
+import test.Ice.networkProxy.Test._TestIntfDisp;
+
+public class Server extends test.Util.Application
+{
+ static public class TestI extends _TestIntfDisp
+ {
+ public void shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+ }
+
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new TestI(), Ice.Util.stringToIdentity("test"));
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.networkProxy");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/networkProxy/Test.ice b/java-compat/test/src/main/java/test/Ice/networkProxy/Test.ice
new file mode 100644
index 00000000000..2144af2c5cf
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/networkProxy/Test.ice
@@ -0,0 +1,21 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.networkProxy"]]
+module Test
+{
+
+interface TestIntf
+{
+ void shutdown();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/networkProxy/run.py b/java-compat/test/src/main/java/test/Ice/networkProxy/run.py
new file mode 100755
index 00000000000..fa8d2fcbb15
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/networkProxy/run.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil, NetworkProxy
+
+sys.stdout.write("starting SOCKS proxy... ")
+sys.stdout.flush()
+socksProxy = NetworkProxy.SocksProxy(12030)
+print("ok")
+
+TestUtil.clientServerTest(additionalClientOptions="--Ice.SOCKSProxyHost=localhost --Ice.SOCKSProxyPort=12030")
+
+sys.stdout.write("terminating SOCKS proxy... ")
+sys.stdout.flush()
+socksProxy.terminate()
+print("ok")
+
+sys.stdout.write("starting HTTP proxy... ")
+sys.stdout.flush()
+httpProxy = NetworkProxy.HttpProxy(12031)
+print("ok")
+
+TestUtil.clientServerTest(additionalClientOptions="--Ice.HTTPProxyHost=localhost --Ice.HTTPProxyPort=12031")
+
+sys.stdout.write("terminating HTTP proxy... ")
+sys.stdout.flush()
+httpProxy.terminate()
+print("ok")
diff --git a/java-compat/test/src/main/java/test/Ice/objects/AllTests.java b/java-compat/test/src/main/java/test/Ice/objects/AllTests.java
new file mode 100644
index 00000000000..a3dccf190db
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/objects/AllTests.java
@@ -0,0 +1,297 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.objects;
+
+import java.io.PrintWriter;
+
+import test.Ice.objects.Test.B;
+import test.Ice.objects.Test.BHolder;
+import test.Ice.objects.Test.C;
+import test.Ice.objects.Test.CHolder;
+import test.Ice.objects.Test.D;
+import test.Ice.objects.Test.DHolder;
+import test.Ice.objects.Test.E;
+import test.Ice.objects.Test.F;
+import test.Ice.objects.Test.H;
+import test.Ice.objects.Test.I;
+import test.Ice.objects.Test.A1;
+import test.Ice.objects.Test.B1;
+import test.Ice.objects.Test.D1;
+import test.Ice.objects.Test.EDerived;
+import test.Ice.objects.Test.Base;
+import test.Ice.objects.Test.S;
+import test.Ice.objects.Test.BaseSeqHolder;
+import test.Ice.objects.Test.InitialPrx;
+import test.Ice.objects.Test.InitialPrxHelper;
+import test.Ice.objects.Test.J;
+import test.Ice.objects.Test.UnexpectedObjectExceptionTestPrx;
+import test.Ice.objects.Test.UnexpectedObjectExceptionTestPrxHelper;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static InitialPrx
+ allTests(Ice.Communicator communicator, PrintWriter out)
+ {
+ out.print("testing stringToProxy... ");
+ out.flush();
+ String ref = "initial:default -p 12010";
+ Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ test(base != null);
+ out.println("ok");
+
+ out.print("testing checked cast... ");
+ out.flush();
+ InitialPrx initial = InitialPrxHelper.checkedCast(base);
+ test(initial != null);
+ test(initial.equals(base));
+ out.println("ok");
+
+ out.print("getting B1... ");
+ out.flush();
+ B b1 = initial.getB1();
+ test(b1 != null);
+ out.println("ok");
+
+ out.print("getting B2... ");
+ out.flush();
+ B b2 = initial.getB2();
+ test(b2 != null);
+ out.println("ok");
+
+ out.print("getting C... ");
+ out.flush();
+ C c = initial.getC();
+ test(c != null);
+ out.println("ok");
+
+ out.print("getting D... ");
+ out.flush();
+ D d = initial.getD();
+ test(d != null);
+ out.println("ok");
+
+ out.print("checking consistency... ");
+ out.flush();
+ test(b1 != b2);
+ //test(b1 != c);
+ //test(b1 != d);
+ //test(b2 != c);
+ //test(b2 != d);
+ //test(c != d);
+ test(b1.theB == b1);
+ test(b1.theC == null);
+ test(b1.theA instanceof B);
+ test(((B)b1.theA).theA == b1.theA);
+ test(((B)b1.theA).theB == b1);
+ test(((B)b1.theA).theC instanceof C);
+ test((((B)b1.theA).theC).theB == b1.theA);
+ test(b1.preMarshalInvoked);
+ test(b1.postUnmarshalInvoked(null));
+ test(b1.theA.preMarshalInvoked);
+ test(b1.theA.postUnmarshalInvoked(null));
+ test(((B)b1.theA).theC.preMarshalInvoked);
+ test(((B)b1.theA).theC.postUnmarshalInvoked(null));
+
+ // More tests possible for b2 and d, but I think this is already
+ // sufficient.
+ test(b2.theA == b2);
+ test(d.theC == null);
+ out.println("ok");
+
+ out.print("getting B1, B2, C, and D all at once... ");
+ out.flush();
+ BHolder b1H = new BHolder();
+ BHolder b2H = new BHolder();
+ CHolder cH = new CHolder();
+ DHolder dH = new DHolder();
+ initial.getAll(b1H, b2H, cH, dH);
+ b1 = b1H.value;
+ b2 = b2H.value;
+ c = cH.value;
+ d = dH.value;
+ test(b1 != null);
+ test(b2 != null);
+ test(c != null);
+ test(d != null);
+ out.println("ok");
+
+ out.print("checking consistency... ");
+ out.flush();
+ test(b1 != b2);
+ //test(b1 != c);
+ //test(b1 != d);
+ //test(b2 != c);
+ //test(b2 != d);
+ //test(c != d);
+ test(b1.theA == b2);
+ test(b1.theB == b1);
+ test(b1.theC == null);
+ test(b2.theA == b2);
+ test(b2.theB == b1);
+ test(b2.theC == c);
+ test(c.theB == b2);
+ test(d.theA == b1);
+ test(d.theB == b2);
+ test(d.theC == null);
+ test(d.preMarshalInvoked);
+ test(d.postUnmarshalInvoked(null));
+ test(d.theA.preMarshalInvoked);
+ test(d.theA.postUnmarshalInvoked(null));
+ test(d.theB.preMarshalInvoked);
+ test(d.theB.postUnmarshalInvoked(null));
+ test(d.theB.theC.preMarshalInvoked);
+ test(d.theB.theC.postUnmarshalInvoked(null));
+
+ out.println("ok");
+
+ out.print("testing protected members... ");
+ out.flush();
+ E e = initial.getE();
+ test(e.checkValues());
+ try
+ {
+ test((E.class.getDeclaredField("i").getModifiers() & java.lang.reflect.Modifier.PROTECTED) != 0);
+ test((E.class.getDeclaredField("s").getModifiers() & java.lang.reflect.Modifier.PROTECTED) != 0);
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ F f = initial.getF();
+ test(f.checkValues());
+ test(f.e2.checkValues());
+ try
+ {
+ test((F.class.getDeclaredField("e1").getModifiers() & java.lang.reflect.Modifier.PROTECTED) != 0);
+ test((F.class.getDeclaredField("e2").getModifiers() & java.lang.reflect.Modifier.PROTECTED) == 0);
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ out.println("ok");
+
+ out.print("getting I, J and H... ");
+ out.flush();
+ I i = initial.getI();
+ test(i != null);
+ I j = initial.getJ();
+ test(j != null && ((J)j) != null);
+ I h = initial.getH();
+ test(h != null && ((H)h) != null);
+ out.println("ok");
+
+ out.print("getting D1... ");
+ out.flush();
+ D1 d1 = new D1(new A1("a1"), new A1("a2"), new A1("a3"), new A1("a4"));
+ d1 = initial.getD1(d1);
+ test(d1.a1.name.equals("a1"));
+ test(d1.a2.name.equals("a2"));
+ test(d1.a3.name.equals("a3"));
+ test(d1.a4.name.equals("a4"));
+ out.println("ok");
+
+ out.print("throw EDerived... ");
+ out.flush();
+ try
+ {
+ initial.throwEDerived();
+ test(false);
+ }
+ catch(EDerived ederived)
+ {
+ test(ederived.a1.name.equals("a1"));
+ test(ederived.a2.name.equals("a2"));
+ test(ederived.a3.name.equals("a3"));
+ test(ederived.a4.name.equals("a4"));
+ }
+ out.println("ok");
+
+ out.print("setting I... ");
+ out.flush();
+ initial.setI(i);
+ initial.setI(j);
+ initial.setI(h);
+ out.println("ok");
+
+ out.print("testing sequences...");
+ try
+ {
+ out.flush();
+ Base[] inS = new Base[0];
+ BaseSeqHolder outS = new BaseSeqHolder();
+ Base[] retS;
+ retS = initial.opBaseSeq(inS, outS);
+
+ inS = new Base[1];
+ inS[0] = new Base(new S(), "");
+ retS = initial.opBaseSeq(inS, outS);
+ test(retS.length == 1 && outS.value.length == 1);
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+ out.println("ok");
+
+ out.print("testing compact ID...");
+ out.flush();
+ try
+ {
+ test(initial.getCompact() != null);
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+ out.println("ok");
+
+ out.print("testing UnexpectedObjectException...");
+ out.flush();
+ ref = "uoet:default -p 12010";
+ base = communicator.stringToProxy(ref);
+ test(base != null);
+ UnexpectedObjectExceptionTestPrx uoet = UnexpectedObjectExceptionTestPrxHelper.uncheckedCast(base);
+ test(uoet != null);
+ try
+ {
+ uoet.op();
+ test(false);
+ }
+ catch(Ice.UnexpectedObjectException ex)
+ {
+ test(ex.type.equals("::Test::AlsoEmpty"));
+ test(ex.expectedType.equals("::Test::Empty"));
+ }
+ catch(java.lang.Exception ex)
+ {
+ out.println(ex);
+ test(false);
+ }
+ out.println("ok");
+
+ out.print("testing getting ObjectFactory...");
+ out.flush();
+ test(communicator.findObjectFactory("TestOF") != null);
+ out.println("ok");
+ out.print("testing getting ObjectFactory as ValueFactory...");
+ test(communicator.getValueFactoryManager().find("TestOF") != null);
+ out.println("ok");
+
+ return initial;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/objects/BI.java b/java-compat/test/src/main/java/test/Ice/objects/BI.java
new file mode 100644
index 00000000000..ae2b86912d4
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/objects/BI.java
@@ -0,0 +1,44 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.objects;
+
+import test.Ice.objects.Test.B;
+
+public final class BI extends B
+{
+ public
+ BI()
+ {
+ _postUnmarshalInvoked = false;
+ }
+
+ @Override
+ public boolean
+ postUnmarshalInvoked(Ice.Current current)
+ {
+ return _postUnmarshalInvoked;
+ }
+
+ @Override
+ public void
+ ice_preMarshal()
+ {
+ preMarshalInvoked = true;
+ }
+
+ @Override
+ public void
+ ice_postUnmarshal()
+ {
+ _postUnmarshalInvoked = true;
+ }
+
+ private boolean _postUnmarshalInvoked;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/objects/CI.java b/java-compat/test/src/main/java/test/Ice/objects/CI.java
new file mode 100644
index 00000000000..f49e25a8459
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/objects/CI.java
@@ -0,0 +1,45 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.objects;
+
+import test.Ice.objects.Test.C;
+
+
+public final class CI extends C
+{
+ public
+ CI()
+ {
+ _postUnmarshalInvoked = false;
+ }
+
+ @Override
+ public boolean
+ postUnmarshalInvoked(Ice.Current current)
+ {
+ return _postUnmarshalInvoked;
+ }
+
+ @Override
+ public void
+ ice_preMarshal()
+ {
+ preMarshalInvoked = true;
+ }
+
+ @Override
+ public void
+ ice_postUnmarshal()
+ {
+ _postUnmarshalInvoked = true;
+ }
+
+ private boolean _postUnmarshalInvoked;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/objects/Client.java b/java-compat/test/src/main/java/test/Ice/objects/Client.java
new file mode 100644
index 00000000000..aa1039edb9f
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/objects/Client.java
@@ -0,0 +1,112 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.objects;
+
+import test.Ice.objects.Test.InitialPrx;
+
+public class Client extends test.Util.Application
+{
+ private static class MyValueFactory implements Ice.ValueFactory
+ {
+ @Override
+ public Ice.Object create(String type)
+ {
+ if(type.equals("::Test::B"))
+ {
+ return new BI();
+ }
+ else if(type.equals("::Test::C"))
+ {
+ return new CI();
+ }
+ else if(type.equals("::Test::D"))
+ {
+ return new DI();
+ }
+ else if(type.equals("::Test::E"))
+ {
+ return new EI();
+ }
+ else if(type.equals("::Test::F"))
+ {
+ return new FI();
+ }
+ else if(type.equals("::Test::I"))
+
+ {
+ return new II();
+ }
+ else if(type.equals("::Test::J"))
+ {
+ return new JI();
+ }
+ else if(type.equals("::Test::H"))
+ {
+ return new HI();
+ }
+
+ assert (false); // Should never be reached
+ return null;
+ }
+ }
+
+ private static class MyObjectFactory implements Ice.ObjectFactory
+ {
+ @Override
+ public Ice.Object create(String type)
+ {
+ return null;
+ }
+
+ @Override
+ public void destroy()
+ {
+ //
+ }
+ }
+
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ValueFactory factory = new MyValueFactory();
+ communicator.getValueFactoryManager().add(factory, "::Test::B");
+ communicator.getValueFactoryManager().add(factory, "::Test::C");
+ communicator.getValueFactoryManager().add(factory, "::Test::D");
+ communicator.getValueFactoryManager().add(factory, "::Test::E");
+ communicator.getValueFactoryManager().add(factory, "::Test::F");
+ communicator.getValueFactoryManager().add(factory, "::Test::I");
+ communicator.getValueFactoryManager().add(factory, "::Test::J");
+ communicator.getValueFactoryManager().add(factory, "::Test::H");
+
+ communicator.addObjectFactory(new MyObjectFactory(), "TestOF");
+
+ InitialPrx initial = AllTests.allTests(communicator, getWriter());
+ initial.shutdown();
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.objects");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/objects/Collocated.java b/java-compat/test/src/main/java/test/Ice/objects/Collocated.java
new file mode 100644
index 00000000000..3540ad70b0a
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/objects/Collocated.java
@@ -0,0 +1,119 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.objects;
+
+import test.Ice.objects.Test.Initial;
+
+public class Collocated extends test.Util.Application
+{
+ private static class MyValueFactory implements Ice.ValueFactory
+ {
+ @Override
+ public Ice.Object create(String type)
+ {
+ if(type.equals("::Test::B"))
+ {
+ return new BI();
+ }
+ else if(type.equals("::Test::C"))
+ {
+ return new CI();
+ }
+ else if(type.equals("::Test::D"))
+ {
+ return new DI();
+ }
+ else if(type.equals("::Test::E"))
+ {
+ return new EI();
+ }
+ else if(type.equals("::Test::F"))
+ {
+ return new FI();
+ }
+ else if(type.equals("::Test::I"))
+ {
+ return new II();
+ }
+ else if(type.equals("::Test::J"))
+ {
+ return new JI();
+ }
+ else if(type.equals("::Test::H"))
+ {
+ return new HI();
+ }
+
+ assert (false); // Should never be reached
+ return null;
+ }
+ }
+
+ private static class MyObjectFactory implements Ice.ObjectFactory
+ {
+ @Override
+ public Ice.Object create(String type)
+ {
+ return null;
+ }
+
+ @Override
+ public void destroy()
+ {
+ //
+ }
+ }
+
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ValueFactory factory = new MyValueFactory();
+ communicator.getValueFactoryManager().add(factory, "::Test::B");
+ communicator.getValueFactoryManager().add(factory, "::Test::C");
+ communicator.getValueFactoryManager().add(factory, "::Test::D");
+ communicator.getValueFactoryManager().add(factory, "::Test::E");
+ communicator.getValueFactoryManager().add(factory, "::Test::F");
+ communicator.getValueFactoryManager().add(factory, "::Test::I");
+ communicator.getValueFactoryManager().add(factory, "::Test::J");
+ communicator.getValueFactoryManager().add(factory, "::Test::H");
+
+ communicator.addObjectFactory(new MyObjectFactory(), "TestOF");
+
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Initial initial = new InitialI(adapter);
+ adapter.add(initial, Ice.Util.stringToIdentity("initial"));
+ UnexpectedObjectExceptionTestI object = new UnexpectedObjectExceptionTestI();
+ adapter.add(object, Ice.Util.stringToIdentity("uoet"));
+ AllTests.allTests(communicator, getWriter());
+ // We must call shutdown even in the collocated case for cyclic
+ // dependency cleanup
+ initial.shutdown();
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.objects");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Collocated app = new Collocated();
+ int result = app.main("Collocated", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/objects/DI.java b/java-compat/test/src/main/java/test/Ice/objects/DI.java
new file mode 100644
index 00000000000..d7e81fb4228
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/objects/DI.java
@@ -0,0 +1,45 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.objects;
+
+import test.Ice.objects.Test.D;
+
+
+public final class DI extends D
+{
+ public
+ DI()
+ {
+ _postUnmarshalInvoked = false;
+ }
+
+ @Override
+ public boolean
+ postUnmarshalInvoked(Ice.Current current)
+ {
+ return _postUnmarshalInvoked;
+ }
+
+ @Override
+ public void
+ ice_preMarshal()
+ {
+ preMarshalInvoked = true;
+ }
+
+ @Override
+ public void
+ ice_postUnmarshal()
+ {
+ _postUnmarshalInvoked = true;
+ }
+
+ private boolean _postUnmarshalInvoked;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/objects/EI.java b/java-compat/test/src/main/java/test/Ice/objects/EI.java
new file mode 100644
index 00000000000..19da1c0fb9c
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/objects/EI.java
@@ -0,0 +1,29 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.objects;
+
+import test.Ice.objects.Test.E;
+
+
+public final class EI extends E
+{
+ public
+ EI()
+ {
+ super(1, "hello");
+ }
+
+ @Override
+ public boolean
+ checkValues(Ice.Current current)
+ {
+ return i == 1 && s.equals("hello");
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/objects/FI.java b/java-compat/test/src/main/java/test/Ice/objects/FI.java
new file mode 100644
index 00000000000..386910cbba5
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/objects/FI.java
@@ -0,0 +1,35 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.objects;
+
+import test.Ice.objects.Test.E;
+import test.Ice.objects.Test.F;
+
+
+public final class FI extends F
+{
+ public
+ FI()
+ {
+ }
+
+ public
+ FI(E e)
+ {
+ super(e, e);
+ }
+
+ @Override
+ public boolean
+ checkValues(Ice.Current current)
+ {
+ return e1 != null && e1 == e2;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/objects/HI.java b/java-compat/test/src/main/java/test/Ice/objects/HI.java
new file mode 100644
index 00000000000..b351561baec
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/objects/HI.java
@@ -0,0 +1,17 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.objects;
+
+import test.Ice.objects.Test.H;
+
+
+public final class HI extends H
+{
+}
diff --git a/java-compat/test/src/main/java/test/Ice/objects/II.java b/java-compat/test/src/main/java/test/Ice/objects/II.java
new file mode 100644
index 00000000000..4f8bfcdc43f
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/objects/II.java
@@ -0,0 +1,16 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.objects;
+
+import test.Ice.objects.Test._IDisp;
+
+public final class II extends _IDisp
+{
+}
diff --git a/java-compat/test/src/main/java/test/Ice/objects/InitialI.java b/java-compat/test/src/main/java/test/Ice/objects/InitialI.java
new file mode 100644
index 00000000000..c551d7f3a09
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/objects/InitialI.java
@@ -0,0 +1,225 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.objects;
+
+import test.Ice.objects.Test.B;
+import test.Ice.objects.Test.BHolder;
+import test.Ice.objects.Test.C;
+import test.Ice.objects.Test.CHolder;
+import test.Ice.objects.Test.D;
+import test.Ice.objects.Test.DHolder;
+import test.Ice.objects.Test.E;
+import test.Ice.objects.Test.F;
+import test.Ice.objects.Test.I;
+import test.Ice.objects.Test.A1;
+import test.Ice.objects.Test.D1;
+import test.Ice.objects.Test.EDerived;
+import test.Ice.objects.Test.Base;
+import test.Ice.objects.Test.BaseSeqHolder;
+import test.Ice.objects.Test.Initial;
+import test.Ice.objects.Test.Compact;
+import test.Ice.objects.Test.CompactExt;
+
+public final class InitialI extends Initial
+{
+ public
+ InitialI(Ice.ObjectAdapter adapter)
+ {
+ _adapter = adapter;
+ _b1 = new BI();
+ _b2 = new BI();
+ _c = new CI();
+ _d = new DI();
+ _e = new EI();
+ _f = new FI(_e);
+
+ _b1.theA = _b2; // Cyclic reference to another B
+ _b1.theB = _b1; // Self reference.
+ _b1.theC = null; // Null reference.
+
+ _b2.theA = _b2; // Self reference, using base.
+ _b2.theB = _b1; // Cyclic reference to another B
+ _b2.theC = _c; // Cyclic reference to a C.
+
+ _c.theB = _b2; // Cyclic reference to a B.
+
+ _d.theA = _b1; // Reference to a B.
+ _d.theB = _b2; // Reference to a B.
+ _d.theC = null; // Reference to a C.
+ }
+
+ @Override
+ public void
+ getAll(BHolder b1, BHolder b2, CHolder c, DHolder d, Ice.Current current)
+ {
+ _b1.preMarshalInvoked = false;
+ _b2.preMarshalInvoked = false;
+ _c.preMarshalInvoked = false;
+ _d.preMarshalInvoked = false;
+ b1.value = _b1;
+ b2.value = _b2;
+ c.value = _c;
+ d.value = _d;
+ }
+
+ @Override
+ public B
+ getB1(Ice.Current current)
+ {
+ _b1.preMarshalInvoked = false;
+ _b2.preMarshalInvoked = false;
+ _c.preMarshalInvoked = false;
+ return _b1;
+ }
+
+ @Override
+ public B
+ getB2(Ice.Current current)
+ {
+ _b1.preMarshalInvoked = false;
+ _b2.preMarshalInvoked = false;
+ _c.preMarshalInvoked = false;
+ return _b2;
+ }
+
+ @Override
+ public C
+ getC(Ice.Current current)
+ {
+ _b1.preMarshalInvoked = false;
+ _b2.preMarshalInvoked = false;
+ _c.preMarshalInvoked = false;
+ return _c;
+ }
+
+ @Override
+ public D
+ getD(Ice.Current current)
+ {
+ _b1.preMarshalInvoked = false;
+ _b2.preMarshalInvoked = false;
+ _c.preMarshalInvoked = false;
+ _d.preMarshalInvoked = false;
+ return _d;
+ }
+
+ @Override
+ public E
+ getE(Ice.Current current)
+ {
+ return _e;
+ }
+
+ @Override
+ public F
+ getF(Ice.Current current)
+ {
+ return _f;
+ }
+
+ @Override
+ public I
+ getI(Ice.Current current)
+ {
+ return new II();
+ }
+
+ @Override
+ public I
+ getJ(Ice.Current current)
+ {
+ return new JI();
+ }
+
+ @Override
+ public I
+ getH(Ice.Current current)
+ {
+ return new HI();
+ }
+
+ @Override
+ public D1
+ getD1(D1 d1, Ice.Current current)
+ {
+ return d1;
+ }
+
+ @Override
+ public void
+ throwEDerived(Ice.Current current) throws EDerived
+ {
+ throw new EDerived(new A1("a1"), new A1("a2"), new A1("a3"), new A1("a4"));
+ }
+
+ @Override
+ public void
+ setI(I theI, Ice.Current current)
+ {
+ }
+
+ @Override
+ public Base[]
+ opBaseSeq(Base[] inS, BaseSeqHolder outS, Ice.Current current)
+ {
+ outS.value = inS;
+ return inS;
+ }
+
+ @Override
+ public Compact
+ getCompact(Ice.Current current)
+ {
+ return new CompactExt();
+ }
+
+ @Override
+ public test.Ice.objects.Test.Inner.A
+ getInnerA(Ice.Current current)
+ {
+ return new test.Ice.objects.Test.Inner.A(_b1);
+ }
+
+ @Override
+ public test.Ice.objects.Test.Inner.Sub.A
+ getInnerSubA(Ice.Current current)
+ {
+ return new test.Ice.objects.Test.Inner.Sub.A(new test.Ice.objects.Test.Inner.A(_b1));
+ }
+
+ @Override
+ public void throwInnerEx(Ice.Current current)
+ throws test.Ice.objects.Test.Inner.Ex
+ {
+ throw new test.Ice.objects.Test.Inner.Ex("Inner::Ex");
+ }
+
+ @Override
+ public void throwInnerSubEx(Ice.Current current)
+ throws test.Ice.objects.Test.Inner.Sub.Ex
+ {
+ throw new test.Ice.objects.Test.Inner.Sub.Ex("Inner::Sub::Ex");
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ _adapter.getCommunicator().shutdown();
+ }
+
+ private Ice.ObjectAdapter _adapter;
+ private B _b1;
+ private B _b2;
+ private C _c;
+ private D _d;
+ private E _e;
+ private F _f;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/objects/JI.java b/java-compat/test/src/main/java/test/Ice/objects/JI.java
new file mode 100644
index 00000000000..ea8f072ed40
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/objects/JI.java
@@ -0,0 +1,17 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.objects;
+
+import test.Ice.objects.Test._JDisp;
+
+
+public final class JI extends _JDisp
+{
+}
diff --git a/java-compat/test/src/main/java/test/Ice/objects/Server.java b/java-compat/test/src/main/java/test/Ice/objects/Server.java
new file mode 100644
index 00000000000..49a7c0fa174
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/objects/Server.java
@@ -0,0 +1,73 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.objects;
+
+public class Server extends test.Util.Application
+{
+ private static class MyValueFactory implements Ice.ValueFactory
+ {
+ @Override
+ public Ice.Object create(String type)
+ {
+ if(type.equals("::Test::I"))
+ {
+ return new II();
+ }
+ else if(type.equals("::Test::J"))
+ {
+ return new JI();
+ }
+ else if(type.equals("::Test::H"))
+ {
+ return new HI();
+ }
+
+ assert (false); // Should never be reached
+ return null;
+ }
+ }
+
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ValueFactory factory = new MyValueFactory();
+ communicator.getValueFactoryManager().add(factory, "::Test::I");
+ communicator.getValueFactoryManager().add(factory, "::Test::J");
+ communicator.getValueFactoryManager().add(factory, "::Test::H");
+
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.Object object = new InitialI(adapter);
+ adapter.add(object, Ice.Util.stringToIdentity("initial"));
+ object = new UnexpectedObjectExceptionTestI();
+ adapter.add(object, Ice.Util.stringToIdentity("uoet"));
+ adapter.activate();
+
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.objects");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/objects/Test.ice b/java-compat/test/src/main/java/test/Ice/objects/Test.ice
new file mode 100644
index 00000000000..a51cf073b9f
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/objects/Test.ice
@@ -0,0 +1,253 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.objects"]]
+module Test
+{
+
+struct S
+{
+ string str;
+};
+
+class Base
+{
+ S theS;
+ string str;
+};
+
+class AbstractBase extends Base
+{
+ void op();
+};
+
+class B;
+class C;
+
+class A
+{
+ B theB;
+ C theC;
+
+ bool preMarshalInvoked;
+ bool postUnmarshalInvoked();
+};
+
+class B extends A
+{
+ A theA;
+};
+
+class C
+{
+ B theB;
+
+ bool preMarshalInvoked;
+ bool postUnmarshalInvoked();
+};
+
+class D
+{
+ A theA;
+ B theB;
+ C theC;
+
+ bool preMarshalInvoked;
+ bool postUnmarshalInvoked();
+};
+
+["protected"] class E
+{
+ int i;
+ string s;
+
+ bool checkValues();
+};
+
+class F
+{
+ ["protected"] E e1;
+ E e2;
+
+ bool checkValues();
+};
+
+interface I
+{
+};
+
+interface J extends I
+{
+};
+
+class H implements I
+{
+};
+
+sequence<Base> BaseSeq;
+
+class CompactExt;
+
+class Compact(1)
+{
+};
+
+const int CompactExtId = 789;
+
+class CompactExt(CompactExtId) extends Compact
+{
+};
+
+module Inner
+{
+
+class A
+{
+ ::Test::A theA;
+};
+
+exception Ex
+{
+ string reason;
+};
+
+module Sub
+{
+
+class A
+{
+ ::Test::Inner::A theA;
+};
+
+exception Ex
+{
+ string reason;
+};
+
+};
+
+};
+
+class A1
+{
+ string name;
+};
+
+class B1
+{
+ A1 a1;
+ A1 a2;
+};
+
+class D1 extends B1
+{
+ A1 a3;
+ A1 a4;
+};
+
+exception EBase
+{
+ A1 a1;
+ A1 a2;
+};
+
+exception EDerived extends EBase
+{
+ A1 a3;
+ A1 a4;
+};
+
+class Initial
+{
+ void shutdown();
+ B getB1();
+ B getB2();
+ C getC();
+ D getD();
+ E getE();
+ F getF();
+
+ void getAll(out B b1, out B b2, out C theC, out D theD);
+
+ I getI();
+ I getJ();
+ I getH();
+
+ D1 getD1(D1 d1);
+ void throwEDerived() throws EDerived;
+
+ void setI(I theI);
+
+ BaseSeq opBaseSeq(BaseSeq inSeq, out BaseSeq outSeq);
+
+ Compact getCompact();
+
+ Inner::A getInnerA();
+ Inner::Sub::A getInnerSubA();
+
+ void throwInnerEx() throws Inner::Ex;
+ void throwInnerSubEx() throws Inner::Sub::Ex;
+};
+
+class Empty
+{
+};
+
+class AlsoEmpty
+{
+};
+
+interface UnexpectedObjectExceptionTest
+{
+ Empty op();
+};
+
+//
+// Remaining definitions are here to ensure that the generated code compiles.
+//
+
+class COneMember
+{
+ Empty e;
+};
+
+class CTwoMembers
+{
+ Empty e1;
+ Empty e2;
+};
+
+exception EOneMember
+{
+ Empty e;
+};
+
+exception ETwoMembers
+{
+ Empty e1;
+ Empty e2;
+};
+
+struct SOneMember
+{
+ Empty e;
+};
+
+struct STwoMembers
+{
+ Empty e1;
+ Empty e2;
+};
+
+dictionary<int, COneMember> DOneMember;
+dictionary<int, CTwoMembers> DTwoMembers;
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/objects/UnexpectedObjectExceptionTestI.java b/java-compat/test/src/main/java/test/Ice/objects/UnexpectedObjectExceptionTestI.java
new file mode 100644
index 00000000000..62a2be9b817
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/objects/UnexpectedObjectExceptionTestI.java
@@ -0,0 +1,29 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.objects;
+
+import test.Ice.objects.Test.AlsoEmpty;
+
+public final class UnexpectedObjectExceptionTestI extends Ice.Blobject
+{
+ @Override
+ public boolean
+ ice_invoke(byte[] inParams, Ice.ByteSeqHolder outParams, Ice.Current current)
+ {
+ Ice.Communicator communicator = current.adapter.getCommunicator();
+ Ice.OutputStream out = new Ice.OutputStream(communicator);
+ out.startEncapsulation(current.encoding, Ice.FormatType.DefaultFormat);
+ out.writeValue(new AlsoEmpty());
+ out.writePendingValues();
+ out.endEncapsulation();
+ outParams.value = out.finished();
+ return true;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/objects/run.py b/java-compat/test/src/main/java/test/Ice/objects/run.py
new file mode 100755
index 00000000000..c0e22437de7
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/objects/run.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest(configName = "compact", message = "Running test with compact (default) format.")
+
+TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.",
+ additionalClientOptions="--Ice.Default.SlicedFormat",
+ additionalServerOptions="--Ice.Default.SlicedFormat")
+
+TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.",
+ additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
+ additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
+
+TestUtil.queueCollocatedTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/operations/AMDMyDerivedClassI.java b/java-compat/test/src/main/java/test/Ice/operations/AMDMyDerivedClassI.java
new file mode 100644
index 00000000000..6243298e8aa
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/operations/AMDMyDerivedClassI.java
@@ -0,0 +1,999 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.operations;
+
+import Ice.Current;
+import test.Ice.operations.AMD.Test.*;
+
+import java.util.*;
+
+public final class AMDMyDerivedClassI extends MyDerivedClass
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ static class Thread_opVoid extends Thread
+ {
+ public Thread_opVoid(AMD_MyClass_opVoid cb)
+ {
+ _cb = cb;
+ }
+
+ @Override
+ public void
+ run()
+ {
+ _cb.ice_response();
+ }
+
+ private AMD_MyClass_opVoid _cb;
+ }
+
+ //
+ // Override the Object "pseudo" operations to verify the operation mode.
+ //
+
+ @Override
+ public boolean
+ ice_isA(String id, Ice.Current current)
+ {
+ test(current.mode == Ice.OperationMode.Nonmutating);
+ return super.ice_isA(id, current);
+ }
+
+ @Override
+ public void
+ ice_ping(Ice.Current current)
+ {
+ test(current.mode == Ice.OperationMode.Nonmutating);
+ super.ice_ping(current);
+ }
+
+ @Override
+ public String[]
+ ice_ids(Ice.Current current)
+ {
+ test(current.mode == Ice.OperationMode.Nonmutating);
+ return super.ice_ids(current);
+ }
+
+ @Override
+ public String
+ ice_id(Ice.Current current)
+ {
+ test(current.mode == Ice.OperationMode.Nonmutating);
+ return super.ice_id(current);
+ }
+
+ @Override
+ synchronized public void
+ shutdown_async(AMD_MyClass_shutdown cb,
+ Ice.Current current)
+ {
+ while(_opVoidThread != null)
+ {
+ try
+ {
+ _opVoidThread.join();
+ _opVoidThread = null;
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+
+ current.adapter.getCommunicator().shutdown();
+ cb.ice_response();
+ }
+
+ @Override
+ synchronized public void
+ opVoid_async(AMD_MyClass_opVoid cb,
+ Ice.Current current)
+ {
+ test(current.mode == Ice.OperationMode.Normal);
+
+ while(_opVoidThread != null)
+ {
+ try
+ {
+ _opVoidThread.join();
+ _opVoidThread = null;
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+
+ _opVoidThread = new Thread_opVoid(cb);
+ _opVoidThread.start();
+ }
+
+ @Override
+ public void
+ opBool_async(AMD_MyClass_opBool cb,
+ boolean p1, boolean p2,
+ Ice.Current current)
+ {
+ cb.ice_response(p2, p1);
+ }
+
+ @Override
+ public void
+ opBoolS_async(AMD_MyClass_opBoolS cb,
+ boolean[] p1, boolean[] p2,
+ Ice.Current current)
+ {
+ boolean[] p3 = new boolean[p1.length + p2.length];
+ System.arraycopy(p1, 0, p3, 0, p1.length);
+ System.arraycopy(p2, 0, p3, p1.length, p2.length);
+
+ boolean[] r = new boolean[p1.length];
+ for(int i = 0; i < p1.length; i++)
+ {
+ r[i] = p1[p1.length - (i + 1)];
+ }
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void
+ opBoolSS_async(AMD_MyClass_opBoolSS cb,
+ boolean[][] p1, boolean[][] p2,
+ Ice.Current current)
+ {
+ boolean[][] p3 = new boolean[p1.length + p2.length][];
+ System.arraycopy(p1, 0, p3, 0, p1.length);
+ System.arraycopy(p2, 0, p3, p1.length, p2.length);
+
+ boolean[][] r = new boolean[p1.length][];
+ for(int i = 0; i < p1.length; i++)
+ {
+ r[i] = p1[p1.length - (i + 1)];
+ }
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void
+ opByte_async(AMD_MyClass_opByte cb,
+ byte p1, byte p2,
+ Ice.Current current)
+ {
+ cb.ice_response(p1, (byte) (p1 ^ p2));
+ }
+
+ @Override
+ public void
+ opByteBoolD_async(AMD_MyClass_opByteBoolD cb,
+ java.util.Map<Byte, Boolean> p1, java.util.Map<Byte, Boolean> p2,
+ Ice.Current current)
+ {
+ java.util.Map<Byte, Boolean> p3 = p1;
+ java.util.Map<Byte, Boolean> r = new java.util.HashMap<Byte, Boolean>();
+ r.putAll(p1);
+ r.putAll(p2);
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void
+ opByteS_async(AMD_MyClass_opByteS cb,
+ byte[] p1, byte[] p2,
+ Ice.Current current)
+ {
+ byte[] p3 = new byte[p1.length];
+ for(int i = 0; i < p1.length; i++)
+ {
+ p3[i] = p1[p1.length - (i + 1)];
+ }
+
+ byte[] r = new byte[p1.length + p2.length];
+ System.arraycopy(p1, 0, r, 0, p1.length);
+ System.arraycopy(p2, 0, r, p1.length, p2.length);
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void
+ opByteSS_async(AMD_MyClass_opByteSS cb,
+ byte[][] p1, byte[][] p2,
+ Ice.Current current)
+ {
+ byte[][] p3 = new byte[p1.length][];
+ for(int i = 0; i < p1.length; i++)
+ {
+ p3[i] = p1[p1.length - (i + 1)];
+ }
+
+ byte[][] r = new byte[p1.length + p2.length][];
+ System.arraycopy(p1, 0, r, 0, p1.length);
+ System.arraycopy(p2, 0, r, p1.length, p2.length);
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void
+ opFloatDouble_async(AMD_MyClass_opFloatDouble cb,
+ float p1, double p2,
+ Ice.Current current)
+ {
+ cb.ice_response(p2, p1, p2);
+ }
+
+ @Override
+ public void
+ opFloatDoubleS_async(AMD_MyClass_opFloatDoubleS cb,
+ float[] p1, double[] p2,
+ Ice.Current current)
+ {
+ float[] p3 = p1;
+ double[] p4 = new double[p2.length];
+ for(int i = 0; i < p2.length; i++)
+ {
+ p4[i] = p2[p2.length - (i + 1)];
+ }
+ double[] r = new double[p2.length + p1.length];
+ System.arraycopy(p2, 0, r, 0, p2.length);
+ for(int i = 0; i < p1.length; i++)
+ {
+ r[p2.length + i] = p1[i];
+ }
+ cb.ice_response(r, p3, p4);
+ }
+
+ @Override
+ public void
+ opFloatDoubleSS_async(AMD_MyClass_opFloatDoubleSS cb,
+ float[][] p1, double[][] p2,
+ Ice.Current current)
+ {
+ float[][] p3 = p1;
+ double[][] p4 = new double[p2.length][];
+ for(int i = 0; i < p2.length; i++)
+ {
+ p4[i] = p2[p2.length - (i + 1)];
+ }
+ double[][] r = new double[p2.length * 2][];
+ System.arraycopy(p2, 0, r, 0, p2.length);
+ System.arraycopy(p2, 0, r, p2.length, p2.length);
+ cb.ice_response(r, p3, p4);
+ }
+
+ @Override
+ public void
+ opLongFloatD_async(AMD_MyClass_opLongFloatD cb,
+ java.util.Map<Long, Float> p1, java.util.Map<Long, Float> p2,
+ Ice.Current current)
+ {
+ java.util.Map<Long, Float> p3 = p1;
+ java.util.Map<Long, Float> r = new java.util.HashMap<Long, Float>();
+ r.putAll(p1);
+ r.putAll(p2);
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void
+ opMyClass_async(AMD_MyClass_opMyClass cb,
+ MyClassPrx p1,
+ Ice.Current current)
+ {
+ MyClassPrx p2 = p1;
+ MyClassPrx p3 = MyClassPrxHelper.uncheckedCast(
+ current.adapter.createProxy(Ice.Util.stringToIdentity("noSuchIdentity")));
+ cb.ice_response(MyClassPrxHelper.uncheckedCast(current.adapter.createProxy(current.id)), p2, p3);
+ }
+
+ @Override
+ public void
+ opMyEnum_async(AMD_MyClass_opMyEnum cb,
+ MyEnum p1,
+ Ice.Current current)
+ {
+ cb.ice_response(MyEnum.enum3, p1);
+ }
+
+ @Override
+ public void
+ opShortIntD_async(AMD_MyClass_opShortIntD cb,
+ java.util.Map<Short, Integer> p1, java.util.Map<Short, Integer> p2,
+ Ice.Current current)
+ {
+ java.util.Map<Short, Integer> p3 = p1;
+ java.util.Map<Short, Integer> r = new java.util.HashMap<Short, Integer>();
+ r.putAll(p1);
+ r.putAll(p2);
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void
+ opShortIntLong_async(AMD_MyClass_opShortIntLong cb,
+ short p1, int p2, long p3,
+ Ice.Current current)
+ {
+ cb.ice_response(p3, p1, p2, p3);
+ }
+
+ @Override
+ public void
+ opShortIntLongS_async(AMD_MyClass_opShortIntLongS cb,
+ short[] p1, int[] p2, long[] p3,
+ Ice.Current current)
+ {
+ short[] p4 = p1;
+ int[] p5 = new int[p2.length];
+ for(int i = 0; i < p2.length; i++)
+ {
+ p5[i] = p2[p2.length - (i + 1)];
+ }
+ long[] p6 = new long[p3.length * 2];
+ System.arraycopy(p3, 0, p6, 0, p3.length);
+ System.arraycopy(p3, 0, p6, p3.length, p3.length);
+ cb.ice_response(p3, p4, p5, p6);
+ }
+
+ @Override
+ public void
+ opShortIntLongSS_async(AMD_MyClass_opShortIntLongSS cb,
+ short[][] p1, int[][] p2, long[][] p3,
+ Ice.Current current)
+ {
+ short[][] p4 = p1;
+ int[][] p5 = new int[p2.length][];
+ for(int i = 0; i < p2.length; i++)
+ {
+ p5[i] = p2[p2.length - (i + 1)];
+ }
+ long[][] p6 = new long[p3.length * 2][];
+ System.arraycopy(p3, 0, p6, 0, p3.length);
+ System.arraycopy(p3, 0, p6, p3.length, p3.length);
+ cb.ice_response(p3, p4, p5, p6);
+ }
+
+ @Override
+ public void
+ opString_async(AMD_MyClass_opString cb,
+ String p1, String p2,
+ Ice.Current current)
+ {
+ cb.ice_response(p1 + " " + p2, p2 + " " + p1);
+ }
+
+ @Override
+ public void
+ opStringMyEnumD_async(AMD_MyClass_opStringMyEnumD cb,
+ java.util.Map<String, MyEnum> p1, java.util.Map<String, MyEnum> p2,
+ Ice.Current current)
+ {
+ java.util.Map<String, MyEnum> p3 = p1;
+ java.util.Map<String, MyEnum> r = new java.util.HashMap<String, MyEnum>();
+ r.putAll(p1);
+ r.putAll(p2);
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void
+ opMyEnumStringD_async(AMD_MyClass_opMyEnumStringD cb,
+ java.util.Map<MyEnum, String> p1, java.util.Map<MyEnum, String> p2,
+ Ice.Current current)
+ {
+ java.util.Map<MyEnum, String> p3 = p1;
+ java.util.Map<MyEnum, String> r = new java.util.HashMap<MyEnum, String>();
+ r.putAll(p1);
+ r.putAll(p2);
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void
+ opMyStructMyEnumD_async(AMD_MyClass_opMyStructMyEnumD cb,
+ java.util.Map<MyStruct, MyEnum> p1, java.util.Map<MyStruct, MyEnum> p2,
+ Ice.Current current)
+ {
+ java.util.Map<MyStruct, MyEnum> p3 = p1;
+ java.util.Map<MyStruct, MyEnum> r = new java.util.HashMap<MyStruct, MyEnum>();
+ r.putAll(p1);
+ r.putAll(p2);
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void opByteBoolDS_async(AMD_MyClass_opByteBoolDS cb,
+ List<Map<Byte, Boolean>> p1,
+ List<Map<Byte, Boolean>> p2,
+ Ice.Current current)
+ {
+
+ ArrayList<Map<Byte, Boolean>> p3= new ArrayList<>();
+ p3.addAll(p2);
+ p3.addAll(p1);
+
+ List<Map<Byte, Boolean>> r = new ArrayList<>(p1);
+ Collections.reverse(r);
+
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void opShortIntDS_async(AMD_MyClass_opShortIntDS cb,
+ List<Map<Short, Integer>> p1,
+ List<Map<Short, Integer>> p2,
+ Ice.Current current)
+ {
+ List<Map<Short, Integer>> p3= new ArrayList<>();
+ p3.addAll(p2);
+ p3.addAll(p1);
+
+ List<Map<Short, Integer>> r = new ArrayList<>(p1);
+ Collections.reverse(r);
+
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void opLongFloatDS_async(AMD_MyClass_opLongFloatDS cb,
+ List<Map<Long, Float>> p1,
+ List<Map<Long, Float>> p2,
+ Ice.Current current)
+ {
+ List<Map<Long, Float>> p3= new ArrayList<>();
+ p3.addAll(p2);
+ p3.addAll(p1);
+
+ List<Map<Long, Float>> r = new ArrayList<>(p1);
+ Collections.reverse(r);
+
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void opStringStringDS_async(AMD_MyClass_opStringStringDS cb,
+ List<Map<String, String>> p1,
+ List<Map<String, String>> p2,
+ Ice.Current current)
+ {
+ List<Map<String, String>> p3= new ArrayList<>();
+ p3.addAll(p2);
+ p3.addAll(p1);
+
+ List<Map<String, String>> r = new ArrayList<>(p1);
+ Collections.reverse(r);
+
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void opStringMyEnumDS_async(AMD_MyClass_opStringMyEnumDS cb,
+ List<Map<String, MyEnum>> p1,
+ List<Map<String, MyEnum>> p2,
+ Ice.Current current)
+ {
+ List<Map<String, MyEnum>> p3= new ArrayList<>();
+ p3.addAll(p2);
+ p3.addAll(p1);
+
+ List<Map<String, MyEnum>> r = new ArrayList<>(p1);
+ Collections.reverse(r);
+
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void opMyEnumStringDS_async(AMD_MyClass_opMyEnumStringDS cb,
+ List<Map<MyEnum, String>> p1,
+ List<Map<MyEnum, String>> p2,
+ Ice.Current current)
+ {
+ List<Map<MyEnum, String>> p3= new ArrayList<>();
+ p3.addAll(p2);
+ p3.addAll(p1);
+
+ List<Map<MyEnum, String>> r = new ArrayList<>(p1);
+ Collections.reverse(r);
+
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void opMyStructMyEnumDS_async(AMD_MyClass_opMyStructMyEnumDS cb,
+ List<Map<MyStruct, MyEnum>> p1,
+ List<Map<MyStruct, MyEnum>> p2,
+ Ice.Current current)
+ {
+ List<Map<MyStruct, MyEnum>> p3= new ArrayList<>();
+ p3.addAll(p2);
+ p3.addAll(p1);
+
+ List<Map<MyStruct, MyEnum>> r = new ArrayList<>(p1);
+ Collections.reverse(r);
+
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void opByteByteSD_async(AMD_MyClass_opByteByteSD cb,
+ Map<Byte, byte[]> p1,
+ Map<Byte, byte[]> p2,
+ Ice.Current current)
+ {
+ Map<Byte, byte[]> p3 = p2;
+ Map<Byte, byte[]> r = new HashMap<>();
+ r.putAll(p1);
+ r.putAll(p2);
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void opBoolBoolSD_async(AMD_MyClass_opBoolBoolSD cb,
+ Map<Boolean, boolean[]> p1,
+ Map<Boolean, boolean[]> p2,
+ Ice.Current current)
+ {
+ Map<Boolean, boolean[]> p3 = p2;
+ Map<Boolean, boolean[]> r = new HashMap<>();
+ r.putAll(p1);
+ r.putAll(p2);
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void opShortShortSD_async(AMD_MyClass_opShortShortSD cb,
+ Map<Short, short[]> p1,
+ Map<Short, short[]> p2,
+ Ice.Current current)
+ {
+ Map<Short, short[]> p3 = p2;
+ Map<Short, short[]> r = new HashMap<>();
+ r.putAll(p1);
+ r.putAll(p2);
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void opIntIntSD_async(AMD_MyClass_opIntIntSD cb,
+ Map<Integer, int[]> p1,
+ Map<Integer, int[]> p2,
+ Ice.Current current)
+ {
+ Map<Integer, int[]> p3 = p2;
+ Map<Integer, int[]> r = new HashMap<>();
+ r.putAll(p1);
+ r.putAll(p2);
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void opLongLongSD_async(AMD_MyClass_opLongLongSD cb,
+ Map<Long, long[]> p1,
+ Map<Long, long[]> p2,
+ Ice.Current current)
+ {
+ Map<Long, long[]> p3 = p2;
+ Map<Long, long[]> r = new HashMap<>();
+ r.putAll(p1);
+ r.putAll(p2);
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void opStringFloatSD_async(AMD_MyClass_opStringFloatSD cb,
+ Map<String, float[]> p1,
+ Map<String, float[]> p2,
+ Ice.Current current)
+ {
+ Map<String, float[]> p3 = p2;
+ Map<String, float[]> r = new HashMap<>();
+ r.putAll(p1);
+ r.putAll(p2);
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void opStringDoubleSD_async(AMD_MyClass_opStringDoubleSD cb,
+ Map<String, double[]> p1,
+ Map<String, double[]> p2,
+ Ice.Current current)
+ {
+ Map<String, double[]> p3 = p2;
+ Map<String, double[]> r = new HashMap<>();
+ r.putAll(p1);
+ r.putAll(p2);
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void opStringStringSD_async(AMD_MyClass_opStringStringSD cb,
+ Map<String, String[]> p1,
+ Map<String, String[]> p2,
+ Ice.Current current)
+ {
+ Map<String, String[]> p3 = p2;
+ Map<String, String[]> r = new HashMap<>();
+ r.putAll(p1);
+ r.putAll(p2);
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void opMyEnumMyEnumSD_async(AMD_MyClass_opMyEnumMyEnumSD cb,
+ Map<MyEnum, MyEnum[]> p1,
+ Map<MyEnum, MyEnum[]> p2,
+ Ice.Current current)
+ {
+ Map<MyEnum, MyEnum[]> p3 = p2;
+ Map<MyEnum, MyEnum[]> r = new HashMap<>();
+ r.putAll(p1);
+ r.putAll(p2);
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void
+ opIntS_async(AMD_MyClass_opIntS cb, int[] s, Ice.Current current)
+ {
+ int[] r = new int[s.length];
+ for(int i = 0; i < r.length; ++i)
+ {
+ r[i] = -s[i];
+ }
+ cb.ice_response(r);
+ }
+
+ @Override
+ public synchronized void
+ opByteSOneway_async(AMD_MyClass_opByteSOneway cb, byte[] s, Ice.Current current)
+ {
+ ++_opByteSOnewayCallCount;
+ cb.ice_response();
+ }
+
+ @Override
+ public synchronized void
+ opByteSOnewayCallCount_async(AMD_MyClass_opByteSOnewayCallCount cb, Ice.Current current)
+ {
+ int count = _opByteSOnewayCallCount;
+ _opByteSOnewayCallCount = 0;
+ cb.ice_response(count);
+ }
+
+ @Override
+ public void
+ opContext_async(AMD_MyClass_opContext cb, Ice.Current current)
+ {
+ cb.ice_response(current.ctx);
+ }
+
+ @Override
+ public void
+ opDoubleMarshaling_async(AMD_MyClass_opDoubleMarshaling cb, double p1, double[] p2, Ice.Current current)
+ {
+ double d = 1278312346.0 / 13.0;
+ test(p1 == d);
+ for(int i = 0; i < p2.length; ++i)
+ {
+ test(p2[i] == d);
+ }
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ opStringS_async(AMD_MyClass_opStringS cb,
+ String[] p1, String[] p2,
+ Ice.Current current)
+ {
+ String[] p3 = new String[p1.length + p2.length];
+ System.arraycopy(p1, 0, p3, 0, p1.length);
+ System.arraycopy(p2, 0, p3, p1.length, p2.length);
+
+ String[] r = new String[p1.length];
+ for(int i = 0; i < p1.length; i++)
+ {
+ r[i] = p1[p1.length - (i + 1)];
+ }
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void
+ opStringSS_async(AMD_MyClass_opStringSS cb,
+ String[][] p1, String[][] p2,
+ Ice.Current current)
+ {
+ String[][] p3 = new String[p1.length + p2.length][];
+ System.arraycopy(p1, 0, p3, 0, p1.length);
+ System.arraycopy(p2, 0, p3, p1.length, p2.length);
+
+ String[][] r = new String[p2.length][];
+ for(int i = 0; i < p2.length; i++)
+ {
+ r[i] = p2[p2.length - (i + 1)];
+ }
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void
+ opStringSSS_async(AMD_MyClass_opStringSSS cb,
+ String[][][] p1, String[][][] p2,
+ Ice.Current current)
+ {
+ String[][][] p3 = new String[p1.length + p2.length][][];
+ System.arraycopy(p1, 0, p3, 0, p1.length);
+ System.arraycopy(p2, 0, p3, p1.length, p2.length);
+
+ String[][][] r = new String[p2.length][][];
+ for(int i = 0; i < p2.length; i++)
+ {
+ r[i] = p2[p2.length - (i + 1)];
+ }
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void
+ opStringStringD_async(AMD_MyClass_opStringStringD cb,
+ java.util.Map<String, String> p1, java.util.Map<String, String> p2,
+ Ice.Current current)
+ {
+ java.util.Map<String, String> p3 = p1;
+ java.util.Map<String, String> r = new java.util.HashMap<String, String>();
+ r.putAll(p1);
+ r.putAll(p2);
+ cb.ice_response(r, p3);
+ }
+
+ @Override
+ public void
+ opStruct_async(AMD_MyClass_opStruct cb,
+ Structure p1, Structure p2,
+ Ice.Current current)
+ {
+ Structure p3 = p1;
+ p3.s.s = "a new string";
+ cb.ice_response(p2, p3);
+ }
+
+ @Override
+ public void
+ opIdempotent_async(AMD_MyClass_opIdempotent cb,
+ Ice.Current current)
+ {
+ test(current.mode == Ice.OperationMode.Idempotent);
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ opNonmutating_async(AMD_MyClass_opNonmutating cb,
+ Ice.Current current)
+ {
+ test(current.mode == Ice.OperationMode.Nonmutating);
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ opDerived_async(AMD_MyDerivedClass_opDerived cb,
+ Ice.Current current)
+ {
+ cb.ice_response();
+ }
+
+ @Override
+ public void opByte1_async(AMD_MyClass_opByte1 cb, byte value, Ice.Current current)
+ {
+ cb.ice_response(value);
+ }
+
+ @Override
+ public void opShort1_async(AMD_MyClass_opShort1 cb, short value, Ice.Current current)
+ {
+ cb.ice_response(value);
+ }
+
+ @Override
+ public void opInt1_async(AMD_MyClass_opInt1 cb, int value, Ice.Current current)
+ {
+ cb.ice_response(value);
+ }
+
+ @Override
+ public void opLong1_async(AMD_MyClass_opLong1 cb, long value, Ice.Current current)
+ {
+ cb.ice_response(value);
+ }
+
+ @Override
+ public void opFloat1_async(AMD_MyClass_opFloat1 cb, float value, Ice.Current current)
+ {
+ cb.ice_response(value);
+ }
+
+ @Override
+ public void opDouble1_async(AMD_MyClass_opDouble1 cb, double value, Ice.Current current)
+ {
+ cb.ice_response(value);
+ }
+
+ @Override
+ public void opString1_async(AMD_MyClass_opString1 cb, String value, Ice.Current current)
+ {
+ cb.ice_response(value);
+ }
+
+ @Override
+ public void opStringS1_async(AMD_MyClass_opStringS1 cb, String[] value, Ice.Current current)
+ {
+ cb.ice_response(value);
+ }
+
+ @Override
+ public void opByteBoolD1_async(AMD_MyClass_opByteBoolD1 cb, Map<Byte, Boolean> value, Ice.Current current)
+ {
+ cb.ice_response(value);
+ }
+
+ @Override
+ public void opStringS2_async(AMD_MyClass_opStringS2 cb, String[] value, Ice.Current current)
+ {
+ cb.ice_response(value);
+ }
+
+ @Override
+ public void opByteBoolD2_async(AMD_MyClass_opByteBoolD2 cb, Map<Byte, Boolean> value, Ice.Current current)
+ {
+ cb.ice_response(value);
+ }
+
+ @Override
+ public void opMyClass1_async(AMD_MyDerivedClass_opMyClass1 cb, MyClass1 value, Ice.Current current)
+ {
+ cb.ice_response(value);
+ }
+
+ @Override
+ public void opMyStruct1_async(AMD_MyDerivedClass_opMyStruct1 cb, MyStruct1 value, Ice.Current current)
+ {
+ cb.ice_response(value);
+ }
+
+ @Override
+ public void opStringLiterals_async(AMD_MyClass_opStringLiterals cb, Ice.Current current)
+ {
+ cb.ice_response(new String[]
+ {
+ s0.value,
+ s1.value,
+ s2.value,
+ s3.value,
+ s4.value,
+ s5.value,
+ s6.value,
+ s7.value,
+ s8.value,
+ s9.value,
+ s10.value,
+
+ sw0.value,
+ sw1.value,
+ sw2.value,
+ sw3.value,
+ sw4.value,
+ sw5.value,
+ sw6.value,
+ sw7.value,
+ sw8.value,
+ sw9.value,
+ sw10.value,
+
+ ss0.value,
+ ss1.value,
+ ss2.value,
+ ss3.value,
+ ss4.value,
+ ss5.value,
+
+ su0.value,
+ su1.value,
+ su2.value
+ });
+ }
+
+ @Override
+ public void opWStringLiterals_async(AMD_MyClass_opWStringLiterals cb, Ice.Current current)
+ {
+ cb.ice_response(new String[]
+ {
+ s0.value,
+ s1.value,
+ s2.value,
+ s3.value,
+ s4.value,
+ s5.value,
+ s6.value,
+ s7.value,
+ s8.value,
+ s9.value,
+ s10.value,
+
+ sw0.value,
+ sw1.value,
+ sw2.value,
+ sw3.value,
+ sw4.value,
+ sw5.value,
+ sw6.value,
+ sw7.value,
+ sw8.value,
+ sw9.value,
+ sw10.value,
+
+ ss0.value,
+ ss1.value,
+ ss2.value,
+ ss3.value,
+ ss4.value,
+ ss5.value,
+
+ su0.value,
+ su1.value,
+ su2.value
+ });
+ }
+
+ @Override
+ public void opMStruct1_async(AMD_MyClass_opMStruct1 cb, Ice.Current current)
+ {
+ cb.ice_response(new Structure());
+ }
+
+ @Override
+ public void opMStruct2_async(AMD_MyClass_opMStruct2 cb, Structure p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void opMSeq1_async(AMD_MyClass_opMSeq1 cb, Ice.Current current)
+ {
+ cb.ice_response(new String[0]);
+ }
+
+ @Override
+ public void opMSeq2_async(AMD_MyClass_opMSeq2 cb, String[] p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void opMDict1_async(AMD_MyClass_opMDict1 cb, Ice.Current current)
+ {
+ cb.ice_response(new java.util.HashMap<String, String>());
+ }
+
+ @Override
+ public void opMDict2_async(AMD_MyClass_opMDict2 cb, java.util.Map<String, String> p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ private Thread _opVoidThread;
+ private int _opByteSOnewayCallCount = 0;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/operations/AMDServer.java b/java-compat/test/src/main/java/test/Ice/operations/AMDServer.java
new file mode 100644
index 00000000000..25437cbe39b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/operations/AMDServer.java
@@ -0,0 +1,48 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.operations;
+
+public class AMDServer extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.add(new AMDMyDerivedClassI(), Ice.Util.stringToIdentity("test"));
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ //
+ // It's possible to have batch oneway requests dispatched
+ // after the adapter is deactivated due to thread
+ // scheduling so we suppress this warning.
+ //
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.operations.AMD");
+
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ AMDServer c = new AMDServer();
+ int status = c.main("AMDServer", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java/test/src/main/java/test/Ice/operations/AMDTieMyDerivedClassI.java b/java-compat/test/src/main/java/test/Ice/operations/AMDTieMyDerivedClassI.java
index e8f296cf58b..e8f296cf58b 100644
--- a/java/test/src/main/java/test/Ice/operations/AMDTieMyDerivedClassI.java
+++ b/java-compat/test/src/main/java/test/Ice/operations/AMDTieMyDerivedClassI.java
diff --git a/java/test/src/main/java/test/Ice/operations/AMDTieServer.java b/java-compat/test/src/main/java/test/Ice/operations/AMDTieServer.java
index 1e18aa3fa0d..1e18aa3fa0d 100644
--- a/java/test/src/main/java/test/Ice/operations/AMDTieServer.java
+++ b/java-compat/test/src/main/java/test/Ice/operations/AMDTieServer.java
diff --git a/java-compat/test/src/main/java/test/Ice/operations/AllTests.java b/java-compat/test/src/main/java/test/Ice/operations/AllTests.java
new file mode 100644
index 00000000000..59e6e065ba1
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/operations/AllTests.java
@@ -0,0 +1,127 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.operations;
+import java.io.PrintWriter;
+
+import test.Ice.operations.Test.MyClassPrx;
+import test.Ice.operations.Test.MyClassPrxHelper;
+import test.Ice.operations.Test.MyDerivedClassPrx;
+import test.Ice.operations.Test.MyDerivedClassPrxHelper;
+
+public class AllTests
+{
+ public static MyClassPrx
+ allTests(test.Util.Application app, PrintWriter out)
+ {
+ Ice.Communicator communicator = app.communicator();
+ String ref = "test:default -p 12010";
+ Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ MyClassPrx cl = MyClassPrxHelper.checkedCast(base);
+ MyDerivedClassPrx derived = MyDerivedClassPrxHelper.checkedCast(cl);
+
+ out.print("testing twoway operations... ");
+ out.flush();
+ Twoways.twoways(app, cl);
+ Twoways.twoways(app, derived);
+ derived.opDerived();
+ out.println("ok");
+
+ out.print("testing oneway operations... ");
+ out.flush();
+ Oneways.oneways(app, cl);
+ out.println("ok");
+
+ out.print("testing twoway operations with AMI... ");
+ out.flush();
+ TwowaysAMI.twowaysAMI(app, cl);
+ TwowaysAMI.twowaysAMI(app, derived);
+ out.println("ok");
+
+ //
+ // Use reflection to load TwowaysLambdaAMI as that is only supported with Java >= 1.8
+ //
+ try
+ {
+ Class<?> cls = IceInternal.Util.findClass("test.Ice.operations.lambda.TwowaysLambdaAMI", null);
+ if(cls != null)
+ {
+ java.lang.reflect.Method twowaysLambdaAMI =
+ cls.getDeclaredMethod("twowaysLambdaAMI",
+ new Class<?>[]{test.Util.Application.class, MyClassPrx.class});
+ out.print("testing twoway operations with lambda AMI mapping... ");
+ out.flush();
+ twowaysLambdaAMI.invoke(null, app, cl);
+ twowaysLambdaAMI.invoke(null, app, derived);
+ out.println("ok");
+ }
+ }
+ catch(java.lang.NoSuchMethodException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ catch(java.lang.IllegalAccessException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ catch(java.lang.reflect.InvocationTargetException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+
+ out.print("testing oneway operations with AMI... ");
+ out.flush();
+ OnewaysAMI.onewaysAMI(app, cl);
+ out.println("ok");
+
+ //
+ // Use reflection to load OnewaysLambdaAMI as that is only supported with Java >= 1.8
+ //
+ try
+ {
+ Class<?> cls = IceInternal.Util.findClass("test.Ice.operations.lambda.OnewaysLambdaAMI", null);
+ if(cls != null)
+ {
+ java.lang.reflect.Method onewaysLambdaAMI =
+ cls.getDeclaredMethod("onewaysLambdaAMI",
+ new Class<?>[]{test.Util.Application.class, MyClassPrx.class});
+ out.print("testing twoway operations with lambda AMI mapping... ");
+ out.flush();
+ onewaysLambdaAMI.invoke(null, app, cl);
+ onewaysLambdaAMI.invoke(null, app, derived);
+ out.println("ok");
+ }
+ }
+ catch(java.lang.NoSuchMethodException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ catch(java.lang.IllegalAccessException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ catch(java.lang.reflect.InvocationTargetException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+
+ out.print("testing batch oneway operations... ");
+ out.flush();
+ BatchOneways.batchOneways(app, cl, out);
+ BatchOneways.batchOneways(app, derived, out);
+ out.println("ok");
+
+ out.print("testing batch AMI oneway operations... ");
+ out.flush();
+ BatchOnewaysAMI.batchOneways(cl, out);
+ BatchOnewaysAMI.batchOneways(derived, out);
+ out.println("ok");
+ return cl;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/operations/BatchOneways.java b/java-compat/test/src/main/java/test/Ice/operations/BatchOneways.java
new file mode 100644
index 00000000000..75ed24a392e
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/operations/BatchOneways.java
@@ -0,0 +1,181 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.operations;
+
+import java.io.PrintWriter;
+
+import test.Ice.operations.Test.MyClassPrx;
+import test.Ice.operations.Test.MyClassPrxHelper;
+
+class BatchOneways
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ static class BatchRequestInterceptorI implements Ice.BatchRequestInterceptor
+ {
+ public void
+ enqueue(Ice.BatchRequest request, int count, int size)
+ {
+ test(request.getOperation().equals("opByteSOneway") || request.getOperation().equals("ice_ping"));
+ test(request.getProxy().ice_isBatchOneway());
+
+ if(count > 0)
+ {
+ test(_lastRequestSize + _size == size);
+ }
+ _count = count;
+ _size = size;
+
+ if(_size + request.getSize() > 25000)
+ {
+ request.getProxy().begin_ice_flushBatchRequests();
+ _size = 18; // header
+ }
+
+ if(_enabled)
+ {
+ _lastRequestSize = request.getSize();
+ ++_count;
+ request.enqueue();
+ }
+ }
+
+ public void
+ setEnqueue(boolean enabled)
+ {
+ _enabled = enabled;
+ }
+
+ public int
+ count()
+ {
+ return _count;
+ }
+
+ private boolean _enabled;
+ private int _count;
+ private int _size;
+ private int _lastRequestSize;
+ };
+
+ static void
+ batchOneways(test.Util.Application app, MyClassPrx p, PrintWriter out)
+ {
+ final byte[] bs1 = new byte[10 * 1024];
+
+ MyClassPrx batch = MyClassPrxHelper.uncheckedCast(p.ice_batchOneway());
+ batch.ice_flushBatchRequests(); // Empty flush
+
+ p.opByteSOnewayCallCount(); // Reset the call count
+
+ for(int i = 0 ; i < 30 ; ++i)
+ {
+ try
+ {
+ batch.opByteSOneway(bs1);
+ }
+ catch(Ice.MemoryLimitException ex)
+ {
+ test(false);
+ }
+ }
+
+ int count = 0;
+ while(count < 27) // 3 * 9 requests auto-flushed.
+ {
+ count += p.opByteSOnewayCallCount();
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ if(batch.ice_getConnection() != null)
+ {
+ MyClassPrx batch1 = (MyClassPrx)p.ice_batchOneway();
+ MyClassPrx batch2 = (MyClassPrx)p.ice_batchOneway();
+
+ batch1.ice_ping();
+ batch2.ice_ping();
+ batch1.ice_flushBatchRequests();
+ batch1.ice_getConnection().close(false);
+ batch1.ice_ping();
+ batch2.ice_ping();
+
+ batch1.ice_getConnection();
+ batch2.ice_getConnection();
+
+ batch1.ice_ping();
+ batch1.ice_getConnection().close(false);
+ batch1.ice_ping();
+ batch2.ice_ping();
+ }
+
+ Ice.Identity identity = new Ice.Identity();
+ identity.name = "invalid";
+ Ice.ObjectPrx batch3 = batch.ice_identity(identity);
+ batch3.ice_ping();
+ batch3.ice_flushBatchRequests();
+
+ // Make sure that a bogus batch request doesn't cause troubles to other ones.
+ batch3.ice_ping();
+ batch.ice_ping();
+ batch.ice_flushBatchRequests();
+ batch.ice_ping();
+
+ if(batch.ice_getConnection() != null)
+ {
+ Ice.InitializationData initData = app.createInitializationData();
+ initData.properties = p.ice_getCommunicator().getProperties()._clone();
+ BatchRequestInterceptorI interceptor = new BatchRequestInterceptorI();
+ initData.batchRequestInterceptor = interceptor;
+ Ice.Communicator ic = app.initialize(initData);
+
+ batch = MyClassPrxHelper.uncheckedCast(ic.stringToProxy(p.toString()).ice_batchOneway());
+
+ test(interceptor.count() == 0);
+ batch.ice_ping();
+ batch.ice_ping();
+ batch.ice_ping();
+ test(interceptor.count() == 0);
+
+ interceptor.setEnqueue(true);
+ batch.ice_ping();
+ batch.ice_ping();
+ batch.ice_ping();
+ test(interceptor.count() == 3);
+
+ batch.ice_flushBatchRequests();
+ batch.ice_ping();
+ test(interceptor.count() == 1);
+
+ batch.opByteSOneway(bs1);
+ test(interceptor.count() == 2);
+ batch.opByteSOneway(bs1);
+ test(interceptor.count() == 3);
+
+ batch.opByteSOneway(bs1); // This should trigger the flush
+ batch.ice_ping();
+ test(interceptor.count() == 2);
+
+ ic.destroy();
+ }
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/operations/BatchOnewaysAMI.java b/java-compat/test/src/main/java/test/Ice/operations/BatchOnewaysAMI.java
new file mode 100644
index 00000000000..34d0cc00a43
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/operations/BatchOnewaysAMI.java
@@ -0,0 +1,136 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.operations;
+
+import java.io.PrintWriter;
+
+import Ice.LocalException;
+import test.Ice.operations.Test.Callback_MyClass_opByteSOneway;
+import test.Ice.operations.Test.MyClassPrx;
+import test.Ice.operations.Test.MyClassPrxHelper;
+
+class BatchOnewaysAMI
+{
+ private static class Callback
+ {
+ Callback()
+ {
+ _called = false;
+ }
+
+ public synchronized void check()
+ {
+ while(!_called)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ _called = false;
+ }
+
+ public synchronized void called()
+ {
+ assert (!_called);
+ _called = true;
+ notify();
+ }
+
+ private boolean _called;
+ }
+
+ private static void test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ static void batchOneways(MyClassPrx p, PrintWriter out)
+ {
+ final byte[] bs1 = new byte[10 * 1024];
+
+ MyClassPrx batch = MyClassPrxHelper.uncheckedCast(p.ice_batchOneway());
+ batch.end_ice_flushBatchRequests(batch.begin_ice_flushBatchRequests()); // Empty flush
+
+ test(batch.begin_ice_flushBatchRequests().isCompleted()); // Empty flush
+ test(batch.begin_ice_flushBatchRequests().isSent()); // Empty flush
+ test(batch.begin_ice_flushBatchRequests().sentSynchronously()); // Empty flush
+
+ for(int i = 0; i < 30; ++i)
+ {
+ batch.begin_opByteSOneway(bs1, new Callback_MyClass_opByteSOneway()
+ {
+ @Override
+ public void exception(LocalException ex)
+ {
+ test(false);
+ }
+
+ @Override
+ public void response()
+ {
+ }
+ });
+ }
+
+ int count = 0;
+ while(count < 27) // 3 * 9 requests auto-flushed.
+ {
+ count += p.opByteSOnewayCallCount();
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ if(batch.ice_getConnection() != null)
+ {
+ MyClassPrx batch2 = MyClassPrxHelper.uncheckedCast(p.ice_batchOneway());
+
+ batch.begin_ice_ping();
+ batch2.begin_ice_ping();
+ batch.end_ice_flushBatchRequests(batch.begin_ice_flushBatchRequests());
+ batch.ice_getConnection().close(false);
+ batch.begin_ice_ping();
+ batch2.begin_ice_ping();
+
+ batch.ice_getConnection();
+ batch2.ice_getConnection();
+
+ batch.begin_ice_ping();
+ batch.ice_getConnection().close(false);
+ batch.begin_ice_ping().throwLocalException();
+ batch2.begin_ice_ping().throwLocalException();
+ }
+
+ Ice.Identity identity = new Ice.Identity();
+ identity.name = "invalid";
+ Ice.ObjectPrx batch3 = batch.ice_identity(identity);
+ batch3.begin_ice_ping();
+ batch3.end_ice_flushBatchRequests(batch3.begin_ice_flushBatchRequests());
+
+ // Make sure that a bogus batch request doesn't cause troubles to other
+ // ones.
+ batch3.begin_ice_ping();
+ batch.begin_ice_ping();
+ batch.end_ice_flushBatchRequests(batch.begin_ice_flushBatchRequests());
+ batch.begin_ice_ping();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/operations/Client.java b/java-compat/test/src/main/java/test/Ice/operations/Client.java
new file mode 100644
index 00000000000..d5f0d7713b5
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/operations/Client.java
@@ -0,0 +1,58 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.operations;
+
+import test.Ice.operations.Test.MyClassPrx;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ java.io.PrintWriter out = getWriter();
+ MyClassPrx myClass = AllTests.allTests(this, out);
+
+ out.print("testing server shutdown... ");
+ out.flush();
+ myClass.shutdown();
+ try
+ {
+ myClass.opVoid();
+ throw new RuntimeException();
+ }
+ catch(Ice.LocalException ex)
+ {
+ out.println("ok");
+ }
+
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2");
+ initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0");
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.operations");
+ initData.properties.setProperty("Ice.BatchAutoFlushSize", "100");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/operations/Collocated.java b/java-compat/test/src/main/java/test/Ice/operations/Collocated.java
new file mode 100644
index 00000000000..b10f13a54e0
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/operations/Collocated.java
@@ -0,0 +1,64 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.operations;
+
+public class Collocated extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ java.io.PrintWriter out = getWriter();
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.ObjectPrx prx = adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test"));
+ //adapter.activate(); // Don't activate OA to ensure collocation is used.
+
+ if(prx.ice_getConnection() != null)
+ {
+ throw new RuntimeException();
+ }
+
+ AllTests.allTests(this, out);
+
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ if(initData.properties.getPropertyAsInt("Ice.ThreadInterruptSafe") > 0 || isAndroid())
+ {
+ initData.properties.setProperty("Ice.ThreadPool.Server.Size", "2");
+ }
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.operations");
+
+ initData.properties.setProperty("Ice.BatchAutoFlushSize", "100");
+
+ //
+ // Its possible to have batch oneway requests dispatched
+ // after the adapter is deactivated due to thread
+ // scheduling so we supress this warning.
+ //
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Collocated c = new Collocated();
+ int status = c.main("Collocated", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/operations/MyDerivedClassI.java b/java-compat/test/src/main/java/test/Ice/operations/MyDerivedClassI.java
new file mode 100644
index 00000000000..73cf592f958
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/operations/MyDerivedClassI.java
@@ -0,0 +1,911 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.operations;
+
+import Ice.Current;
+import test.Ice.operations.Test.*;
+
+import java.util.*;
+
+public final class MyDerivedClassI extends MyDerivedClass
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ //
+ // Override the Object "pseudo" operations to verify the operation mode.
+ //
+
+ @Override
+ public boolean
+ ice_isA(String id, Ice.Current current)
+ {
+ test(current.mode == Ice.OperationMode.Nonmutating);
+ return super.ice_isA(id, current);
+ }
+
+ @Override
+ public void
+ ice_ping(Ice.Current current)
+ {
+ test(current.mode == Ice.OperationMode.Nonmutating);
+ super.ice_ping(current);
+ }
+
+ @Override
+ public String[]
+ ice_ids(Ice.Current current)
+ {
+ test(current.mode == Ice.OperationMode.Nonmutating);
+ return super.ice_ids(current);
+ }
+
+ @Override
+ public String
+ ice_id(Ice.Current current)
+ {
+ test(current.mode == Ice.OperationMode.Nonmutating);
+ return super.ice_id(current);
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+
+ @Override
+ public void
+ opVoid(Ice.Current current)
+ {
+ test(current.mode == Ice.OperationMode.Normal);
+ }
+
+ @Override
+ public boolean
+ opBool(boolean p1, boolean p2,
+ Ice.BooleanHolder p3,
+ Ice.Current current)
+ {
+ p3.value = p1;
+ return p2;
+ }
+
+ @Override
+ public boolean[]
+ opBoolS(boolean[] p1, boolean[] p2,
+ BoolSHolder p3,
+ Ice.Current current)
+ {
+ p3.value = new boolean[p1.length + p2.length];
+ System.arraycopy(p1, 0, p3.value, 0, p1.length);
+ System.arraycopy(p2, 0, p3.value, p1.length, p2.length);
+
+ boolean[] r = new boolean[p1.length];
+ for(int i = 0; i < p1.length; i++)
+ {
+ r[i] = p1[p1.length - (i + 1)];
+ }
+ return r;
+ }
+
+ @Override
+ public boolean[][]
+ opBoolSS(boolean[][] p1, boolean[][] p2,
+ BoolSSHolder p3,
+ Ice.Current current)
+ {
+ p3.value = new boolean[p1.length + p2.length][];
+ System.arraycopy(p1, 0, p3.value, 0, p1.length);
+ System.arraycopy(p2, 0, p3.value, p1.length, p2.length);
+
+ boolean[][] r = new boolean[p1.length][];
+ for(int i = 0; i < p1.length; i++)
+ {
+ r[i] = p1[p1.length - (i + 1)];
+ }
+ return r;
+ }
+
+ @Override
+ public byte
+ opByte(byte p1, byte p2,
+ Ice.ByteHolder p3,
+ Ice.Current current)
+ {
+ p3.value = (byte) (p1 ^ p2);
+ return p1;
+ }
+
+ @Override
+ public java.util.Map<Byte, Boolean>
+ opByteBoolD(java.util.Map<Byte, Boolean> p1, java.util.Map<Byte, Boolean> p2, ByteBoolDHolder p3,
+ Ice.Current current)
+ {
+ p3.value = p1;
+ java.util.Map<Byte, Boolean> r = new java.util.HashMap<Byte, Boolean>();
+ r.putAll(p1);
+ r.putAll(p2);
+ return r;
+ }
+
+ @Override
+ public byte[]
+ opByteS(byte[] p1, byte[] p2,
+ ByteSHolder p3,
+ Ice.Current current)
+ {
+ p3.value = new byte[p1.length];
+ for(int i = 0; i < p1.length; i++)
+ {
+ p3.value[i] = p1[p1.length - (i + 1)];
+ }
+
+ byte[] r = new byte[p1.length + p2.length];
+ System.arraycopy(p1, 0, r, 0, p1.length);
+ System.arraycopy(p2, 0, r, p1.length, p2.length);
+ return r;
+ }
+
+ @Override
+ public byte[][]
+ opByteSS(byte[][] p1, byte[][] p2,
+ ByteSSHolder p3,
+ Ice.Current current)
+ {
+ p3.value = new byte[p1.length][];
+ for(int i = 0; i < p1.length; i++)
+ {
+ p3.value[i] = p1[p1.length - (i + 1)];
+ }
+
+ byte[][] r = new byte[p1.length + p2.length][];
+ System.arraycopy(p1, 0, r, 0, p1.length);
+ System.arraycopy(p2, 0, r, p1.length, p2.length);
+ return r;
+ }
+
+ @Override
+ public double
+ opFloatDouble(float p1, double p2,
+ Ice.FloatHolder p3, Ice.DoubleHolder p4,
+ Ice.Current current)
+ {
+ p3.value = p1;
+ p4.value = p2;
+ return p2;
+ }
+
+ @Override
+ public double[]
+ opFloatDoubleS(float[] p1, double[] p2,
+ FloatSHolder p3, DoubleSHolder p4,
+ Ice.Current current)
+ {
+ p3.value = p1;
+ p4.value = new double[p2.length];
+ for(int i = 0; i < p2.length; i++)
+ {
+ p4.value[i] = p2[p2.length - (i + 1)];
+ }
+ double[] r = new double[p2.length + p1.length];
+ System.arraycopy(p2, 0, r, 0, p2.length);
+ for(int i = 0; i < p1.length; i++)
+ {
+ r[p2.length + i] = p1[i];
+ }
+ return r;
+ }
+
+ @Override
+ public double[][]
+ opFloatDoubleSS(float[][] p1, double[][] p2,
+ FloatSSHolder p3, DoubleSSHolder p4,
+ Ice.Current current)
+ {
+ p3.value = p1;
+ p4.value = new double[p2.length][];
+ for(int i = 0; i < p2.length; i++)
+ {
+ p4.value[i] = p2[p2.length - (i + 1)];
+ }
+ double[][] r = new double[p2.length * 2][];
+ System.arraycopy(p2, 0, r, 0, p2.length);
+ System.arraycopy(p2, 0, r, p2.length, p2.length);
+ return r;
+ }
+
+ @Override
+ public java.util.Map<Long, Float>
+ opLongFloatD(java.util.Map<Long, Float> p1, java.util.Map<Long, Float> p2, LongFloatDHolder p3,
+ Ice.Current current)
+ {
+ p3.value = p1;
+ java.util.Map<Long, Float> r = new java.util.HashMap<Long, Float>();
+ r.putAll(p1);
+ r.putAll(p2);
+ return r;
+ }
+
+ @Override
+ public MyClassPrx
+ opMyClass(MyClassPrx p1,
+ MyClassPrxHolder p2, MyClassPrxHolder p3,
+ Ice.Current current)
+ {
+ p2.value = p1;
+ p3.value = MyClassPrxHelper.uncheckedCast(
+ current.adapter.createProxy(Ice.Util.stringToIdentity("noSuchIdentity")));
+ return MyClassPrxHelper.uncheckedCast(current.adapter.createProxy(current.id));
+ }
+
+ @Override
+ public MyEnum
+ opMyEnum(MyEnum p1,
+ MyEnumHolder p2,
+ Ice.Current current)
+ {
+ p2.value = p1;
+ return MyEnum.enum3;
+ }
+
+ @Override
+ public java.util.Map<Short, Integer>
+ opShortIntD(java.util.Map<Short, Integer> p1, java.util.Map<Short, Integer> p2, ShortIntDHolder p3,
+ Ice.Current current)
+ {
+ p3.value = p1;
+ java.util.Map<Short, Integer> r = new java.util.HashMap<Short, Integer>();
+ r.putAll(p1);
+ r.putAll(p2);
+ return r;
+ }
+
+ @Override
+ public long
+ opShortIntLong(short p1, int p2, long p3,
+ Ice.ShortHolder p4, Ice.IntHolder p5, Ice.LongHolder p6,
+ Ice.Current current)
+ {
+ p4.value = p1;
+ p5.value = p2;
+ p6.value = p3;
+ return p3;
+ }
+
+ @Override
+ public long[]
+ opShortIntLongS(short[] p1, int[] p2, long[] p3,
+ ShortSHolder p4, IntSHolder p5, LongSHolder p6,
+ Ice.Current current)
+ {
+ p4.value = p1;
+ p5.value = new int[p2.length];
+ for(int i = 0; i < p2.length; i++)
+ {
+ p5.value[i] = p2[p2.length - (i + 1)];
+ }
+ p6.value = new long[p3.length * 2];
+ System.arraycopy(p3, 0, p6.value, 0, p3.length);
+ System.arraycopy(p3, 0, p6.value, p3.length, p3.length);
+ return p3;
+ }
+
+ @Override
+ public long[][]
+ opShortIntLongSS(short[][] p1, int[][] p2, long[][] p3,
+ ShortSSHolder p4, IntSSHolder p5, LongSSHolder p6,
+ Ice.Current current)
+ {
+ p4.value = p1;
+ p5.value = new int[p2.length][];
+ for(int i = 0; i < p2.length; i++)
+ {
+ p5.value[i] = p2[p2.length - (i + 1)];
+ }
+ p6.value = new long[p3.length * 2][];
+ System.arraycopy(p3, 0, p6.value, 0, p3.length);
+ System.arraycopy(p3, 0, p6.value, p3.length, p3.length);
+ return p3;
+ }
+
+ @Override
+ public String
+ opString(String p1, String p2,
+ Ice.StringHolder p3,
+ Ice.Current current)
+ {
+ p3.value = p2 + " " + p1;
+ return p1 + " " + p2;
+ }
+
+ @Override
+ public java.util.Map<String, MyEnum>
+ opStringMyEnumD(java.util.Map<String, MyEnum> p1, java.util.Map<String, MyEnum> p2, StringMyEnumDHolder p3,
+ Ice.Current current)
+ {
+ p3.value = p1;
+ java.util.Map<String, MyEnum> r = new java.util.HashMap<String, MyEnum>();
+ r.putAll(p1);
+ r.putAll(p2);
+ return r;
+ }
+
+ @Override
+ public java.util.Map<MyEnum, String>
+ opMyEnumStringD(java.util.Map<MyEnum, String> p1, java.util.Map<MyEnum, String> p2, MyEnumStringDHolder p3,
+ Ice.Current current)
+ {
+ p3.value = p1;
+ java.util.Map<MyEnum, String> r = new java.util.HashMap<MyEnum, String>();
+ r.putAll(p1);
+ r.putAll(p2);
+ return r;
+ }
+
+ @Override
+ public java.util.Map<MyStruct, MyEnum>
+ opMyStructMyEnumD(java.util.Map<MyStruct, MyEnum> p1, java.util.Map<MyStruct, MyEnum> p2, MyStructMyEnumDHolder p3,
+ Ice.Current current)
+ {
+ p3.value = p1;
+ java.util.Map<MyStruct, MyEnum> r = new java.util.HashMap<MyStruct, MyEnum>();
+ r.putAll(p1);
+ r.putAll(p2);
+ return r;
+ }
+
+ @Override
+ public List<Map<Byte, Boolean>> opByteBoolDS(List<Map<Byte, Boolean>> p1,
+ List<Map<Byte, Boolean>> p2,
+ ByteBoolDSHolder p3,
+ Ice.Current current)
+ {
+ p3.value = new ArrayList<>();
+ p3.value.addAll(p2);
+ p3.value.addAll(p1);
+
+ List<Map<Byte, Boolean>> r = new ArrayList<>(p1);
+ Collections.reverse(r);
+
+ return r;
+ }
+
+ @Override
+ public List<Map<Short, Integer>> opShortIntDS(List<Map<Short, Integer>> p1,
+ List<Map<Short, Integer>> p2,
+ ShortIntDSHolder p3,
+ Ice.Current current)
+ {
+ p3.value = new ArrayList<>();
+ p3.value.addAll(p2);
+ p3.value.addAll(p1);
+
+ List<Map<Short, Integer>> r = new ArrayList<>(p1);
+ Collections.reverse(r);
+
+ return r;
+ }
+
+ @Override
+ public List<Map<Long, Float>> opLongFloatDS(List<Map<Long, Float>> p1,
+ List<Map<Long, Float>> p2,
+ LongFloatDSHolder p3,
+ Ice.Current current)
+ {
+ p3.value = new ArrayList<>();
+ p3.value.addAll(p2);
+ p3.value.addAll(p1);
+
+ List<Map<Long, Float>> r = new ArrayList<>(p1);
+ Collections.reverse(r);
+
+ return r;
+ }
+
+ @Override
+ public List<Map<String, String>> opStringStringDS(List<Map<String, String>> p1,
+ List<Map<String, String>> p2,
+ StringStringDSHolder p3,
+ Ice.Current current)
+ {
+ p3.value = new ArrayList<>();
+ p3.value.addAll(p2);
+ p3.value.addAll(p1);
+
+ List<Map<String, String>> r = new ArrayList<>(p1);
+ Collections.reverse(r);
+
+ return r;
+ }
+
+ @Override
+ public List<Map<String, MyEnum>> opStringMyEnumDS(List<Map<String, MyEnum>> p1,
+ List<Map<String, MyEnum>> p2,
+ StringMyEnumDSHolder p3,
+ Ice.Current current)
+ {
+ p3.value = new ArrayList<>();
+ p3.value.addAll(p2);
+ p3.value.addAll(p1);
+
+ List<Map<String, MyEnum>> r = new ArrayList<>(p1);
+ Collections.reverse(r);
+
+ return r;
+ }
+
+ @Override
+ public List<Map<MyEnum, String>> opMyEnumStringDS(List<Map<MyEnum, String>> p1,
+ List<Map<MyEnum, String>> p2,
+ MyEnumStringDSHolder p3,
+ Ice.Current current)
+ {
+ p3.value = new ArrayList<>();
+ p3.value.addAll(p2);
+ p3.value.addAll(p1);
+
+ List<Map<MyEnum, String>> r = new ArrayList<>(p1);
+ Collections.reverse(r);
+
+ return r;
+ }
+
+ @Override
+ public List<Map<MyStruct, MyEnum>> opMyStructMyEnumDS(List<Map<MyStruct, MyEnum>> p1,
+ List<Map<MyStruct, MyEnum>> p2,
+ MyStructMyEnumDSHolder p3,
+ Ice.Current current)
+ {
+ p3.value = new ArrayList<>();
+ p3.value.addAll(p2);
+ p3.value.addAll(p1);
+
+ List<Map<MyStruct, MyEnum>> r = new ArrayList<>(p1);
+ Collections.reverse(r);
+
+ return r;
+ }
+
+ @Override
+ public Map<Byte, byte[]> opByteByteSD(Map<Byte, byte[]> p1,
+ Map<Byte, byte[]> p2,
+ ByteByteSDHolder p3,
+ Ice.Current current)
+ {
+ p3.value = p2;
+ Map<Byte, byte[]> r = new HashMap<>();
+ r.putAll(p1);
+ r.putAll(p2);
+ return r;
+ }
+
+ @Override
+ public Map<Boolean, boolean[]> opBoolBoolSD(Map<Boolean, boolean[]> p1,
+ Map<Boolean, boolean[]> p2,
+ BoolBoolSDHolder p3,
+ Ice.Current current)
+ {
+ p3.value = p2;
+ Map<Boolean, boolean[]> r = new HashMap<>();
+ r.putAll(p1);
+ r.putAll(p2);
+ return r;
+ }
+
+ @Override
+ public Map<Short, short[]> opShortShortSD(Map<Short, short[]> p1,
+ Map<Short, short[]> p2,
+ ShortShortSDHolder p3,
+ Ice.Current current)
+ {
+ p3.value = p2;
+ Map<Short, short[]> r = new HashMap<>();
+ r.putAll(p1);
+ r.putAll(p2);
+ return r;
+ }
+
+ @Override
+ public Map<Integer, int[]> opIntIntSD(Map<Integer, int[]> p1,
+ Map<Integer, int[]> p2,
+ IntIntSDHolder p3,
+ Ice.Current current)
+ {
+ p3.value = p2;
+ Map<Integer, int[]> r = new HashMap<>();
+ r.putAll(p1);
+ r.putAll(p2);
+ return r;
+ }
+
+ @Override
+ public Map<Long, long[]> opLongLongSD(Map<Long, long[]> p1,
+ Map<Long, long[]> p2,
+ LongLongSDHolder p3,
+ Ice.Current current)
+ {
+ p3.value = p2;
+ Map<Long, long[]> r = new HashMap<>();
+ r.putAll(p1);
+ r.putAll(p2);
+ return r;
+ }
+
+ @Override
+ public Map<String, float[]> opStringFloatSD(Map<String, float[]> p1,
+ Map<String, float[]> p2,
+ StringFloatSDHolder p3,
+ Ice.Current current)
+ {
+ p3.value = p2;
+ Map<String, float[]> r = new HashMap<>();
+ r.putAll(p1);
+ r.putAll(p2);
+ return r;
+ }
+
+ @Override
+ public Map<String, double[]> opStringDoubleSD(Map<String, double[]> p1,
+ Map<String, double[]> p2,
+ StringDoubleSDHolder p3,
+ Ice.Current current)
+ {
+ p3.value = p2;
+ Map<String, double[]> r = new HashMap<>();
+ r.putAll(p1);
+ r.putAll(p2);
+ return r;
+ }
+
+ @Override
+ public Map<String, String[]> opStringStringSD(Map<String, String[]> p1,
+ Map<String, String[]> p2,
+ StringStringSDHolder p3,
+ Ice.Current current)
+ {
+ p3.value = p2;
+ Map<String, String[]> r = new HashMap<>();
+ r.putAll(p1);
+ r.putAll(p2);
+ return r;
+ }
+
+ @Override
+ public Map<MyEnum, MyEnum[]> opMyEnumMyEnumSD(Map<MyEnum, MyEnum[]> p1,
+ Map<MyEnum, MyEnum[]> p2,
+ MyEnumMyEnumSDHolder p3,
+ Ice.Current current)
+ {
+ p3.value = p2;
+ Map<MyEnum, MyEnum[]> r = new HashMap<>();
+ r.putAll(p1);
+ r.putAll(p2);
+ return r;
+ }
+
+ @Override
+ public int[]
+ opIntS(int[] s, Ice.Current current)
+ {
+ int[] r = new int[s.length];
+ for(int i = 0; i < r.length; ++i)
+ {
+ r[i] = -s[i];
+ }
+ return r;
+ }
+
+ @Override
+ public synchronized void
+ opByteSOneway(byte[] s, Ice.Current current)
+ {
+ ++_opByteSOnewayCallCount;
+ }
+
+ @Override
+ public synchronized int
+ opByteSOnewayCallCount(Ice.Current current)
+ {
+ int count = _opByteSOnewayCallCount;
+ _opByteSOnewayCallCount = 0;
+ return count;
+ }
+
+ @Override
+ public java.util.Map<String, String>
+ opContext(Ice.Current current)
+ {
+ return current.ctx;
+ }
+
+ @Override
+ public void
+ opDoubleMarshaling(double p1, double[] p2, Ice.Current current)
+ {
+ double d = 1278312346.0 / 13.0;
+ test(p1 == d);
+ for(int i = 0; i < p2.length; ++i)
+ {
+ test(p2[i] == d);
+ }
+ }
+
+ @Override
+ public String[]
+ opStringS(String[] p1, String[] p2,
+ StringSHolder p3,
+ Ice.Current current)
+ {
+ p3.value = new String[p1.length + p2.length];
+ System.arraycopy(p1, 0, p3.value, 0, p1.length);
+ System.arraycopy(p2, 0, p3.value, p1.length, p2.length);
+
+ String[] r = new String[p1.length];
+ for(int i = 0; i < p1.length; i++)
+ {
+ r[i] = p1[p1.length - (i + 1)];
+ }
+ return r;
+ }
+
+ @Override
+ public String[][]
+ opStringSS(String[][] p1, String[][] p2,
+ StringSSHolder p3,
+ Ice.Current current)
+ {
+ p3.value = new String[p1.length + p2.length][];
+ System.arraycopy(p1, 0, p3.value, 0, p1.length);
+ System.arraycopy(p2, 0, p3.value, p1.length, p2.length);
+
+ String[][] r = new String[p2.length][];
+ for(int i = 0; i < p2.length; i++)
+ {
+ r[i] = p2[p2.length - (i + 1)];
+ }
+ return r;
+ }
+
+ @Override
+ public String[][][]
+ opStringSSS(String[][][] p1, String[][][] p2,
+ StringSSSHolder p3,
+ Ice.Current current)
+ {
+ p3.value = new String[p1.length + p2.length][][];
+ System.arraycopy(p1, 0, p3.value, 0, p1.length);
+ System.arraycopy(p2, 0, p3.value, p1.length, p2.length);
+
+ String[][][] r = new String[p2.length][][];
+ for(int i = 0; i < p2.length; i++)
+ {
+ r[i] = p2[p2.length - (i + 1)];
+ }
+ return r;
+ }
+
+ @Override
+ public java.util.Map<String, String>
+ opStringStringD(java.util.Map<String, String> p1, java.util.Map<String, String> p2, StringStringDHolder p3,
+ Ice.Current current)
+ {
+ p3.value = p1;
+ java.util.Map<String, String> r = new java.util.HashMap<String, String>();
+ r.putAll(p1);
+ r.putAll(p2);
+ return r;
+ }
+
+ @Override
+ public Structure
+ opStruct(Structure p1, Structure p2,
+ StructureHolder p3,
+ Ice.Current current)
+ {
+ p3.value = p1;
+ p3.value.s.s = "a new string";
+ return p2;
+ }
+
+ @Override
+ public void
+ opIdempotent(Ice.Current current)
+ {
+ test(current.mode == Ice.OperationMode.Idempotent);
+ }
+
+ @Override
+ public void
+ opNonmutating(Ice.Current current)
+ {
+ test(current.mode == Ice.OperationMode.Nonmutating);
+ }
+
+ @Override
+ public void
+ opDerived(Ice.Current current)
+ {
+ }
+
+ @Override
+ public byte opByte1(byte value, Ice.Current current)
+ {
+ return value;
+ }
+
+ @Override
+ public short opShort1(short value, Ice.Current current)
+ {
+ return value;
+ }
+
+ @Override
+ public int opInt1(int value, Ice.Current current)
+ {
+ return value;
+ }
+
+ @Override
+ public long opLong1(long value, Ice.Current current)
+ {
+ return value;
+ }
+
+ @Override
+ public float opFloat1(float value, Ice.Current current)
+ {
+ return value;
+ }
+
+ @Override
+ public double opDouble1(double value, Ice.Current current)
+ {
+ return value;
+ }
+
+ @Override
+ public String opString1(String value, Ice.Current current)
+ {
+ return value;
+ }
+
+ @Override
+ public String[] opStringS1(String[] value, Ice.Current current)
+ {
+ return value;
+ }
+
+ @Override
+ public Map<Byte, Boolean> opByteBoolD1(Map<Byte, Boolean> value, Ice.Current current)
+ {
+ return value;
+ }
+
+ @Override
+ public String[] opStringS2(String[] value, Ice.Current current)
+ {
+ return value;
+ }
+
+ @Override
+ public Map<Byte, Boolean> opByteBoolD2(Map<Byte, Boolean> value, Ice.Current current)
+ {
+ return value;
+ }
+
+ @Override
+ public MyClass1 opMyClass1(MyClass1 value, Ice.Current current)
+ {
+ return value;
+ }
+
+ @Override
+ public MyStruct1 opMyStruct1(MyStruct1 value, Ice.Current current)
+ {
+ return value;
+ }
+
+ @Override
+ public String[] opStringLiterals(Ice.Current current)
+ {
+ return new String[]
+ {
+ s0.value,
+ s1.value,
+ s2.value,
+ s3.value,
+ s4.value,
+ s5.value,
+ s6.value,
+ s7.value,
+ s8.value,
+ s9.value,
+ s10.value,
+
+ sw0.value,
+ sw1.value,
+ sw2.value,
+ sw3.value,
+ sw4.value,
+ sw5.value,
+ sw6.value,
+ sw7.value,
+ sw8.value,
+ sw9.value,
+ sw10.value,
+
+ ss0.value,
+ ss1.value,
+ ss2.value,
+ ss3.value,
+ ss4.value,
+ ss5.value,
+
+ su0.value,
+ su1.value,
+ su2.value
+ };
+ }
+
+ @Override
+ public String[] opWStringLiterals(Ice.Current current)
+ {
+ return opStringLiterals(current);
+ }
+
+ @Override
+ public Structure opMStruct1(Ice.Current current)
+ {
+ return new Structure();
+ }
+
+ @Override
+ public Structure opMStruct2(Structure p1, StructureHolder p2, Ice.Current current)
+ {
+ p2.value = p1;
+ return p1;
+ }
+
+ @Override
+ public String[] opMSeq1(Ice.Current current)
+ {
+ return new String[0];
+ }
+
+ @Override
+ public String[] opMSeq2(String[] p1, StringSHolder p2, Ice.Current current)
+ {
+ p2.value = p1;
+ return p1;
+ }
+
+ @Override
+ public Map<String, String> opMDict1(Ice.Current current)
+ {
+ return new HashMap<String, String>();
+ }
+
+ @Override
+ public Map<String, String> opMDict2(Map<String, String> p1, StringStringDHolder p2, Ice.Current current)
+ {
+ p2.value = p1;
+ return p1;
+ }
+
+ private int _opByteSOnewayCallCount = 0;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/operations/Oneways.java b/java-compat/test/src/main/java/test/Ice/operations/Oneways.java
new file mode 100644
index 00000000000..7e0badc7326
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/operations/Oneways.java
@@ -0,0 +1,60 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.operations;
+
+import test.Ice.operations.Test.MyClassPrx;
+import test.Ice.operations.Test.MyClassPrxHelper;
+
+class Oneways
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ static void
+ oneways(test.Util.Application app, MyClassPrx p)
+ {
+ p = MyClassPrxHelper.uncheckedCast(p.ice_oneway());
+
+ {
+ p.ice_ping();
+ }
+
+ {
+ p.opVoid();
+ }
+
+ {
+ p.opIdempotent();
+ }
+
+ {
+ p.opNonmutating();
+ }
+
+ {
+
+ Ice.ByteHolder b = new Ice.ByteHolder();
+ try
+ {
+ p.opByte((byte)0xff, (byte)0x0f, b);
+ test(false);
+ }
+ catch(Ice.TwowayOnlyException ex)
+ {
+ }
+ }
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/operations/OnewaysAMI.java b/java-compat/test/src/main/java/test/Ice/operations/OnewaysAMI.java
new file mode 100644
index 00000000000..4750d584e44
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/operations/OnewaysAMI.java
@@ -0,0 +1,244 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.operations;
+
+import test.Ice.operations.Test.Callback_MyClass_opIdempotent;
+import test.Ice.operations.Test.Callback_MyClass_opNonmutating;
+import test.Ice.operations.Test.Callback_MyClass_opVoid;
+import test.Ice.operations.Test.MyClassPrx;
+
+class OnewaysAMI
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private static class CallbackBase
+ {
+ CallbackBase()
+ {
+ _called = false;
+ }
+
+ public synchronized void check()
+ {
+ while(!_called)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ _called = false;
+ }
+
+ public synchronized void called()
+ {
+ assert(!_called);
+ _called = true;
+ notify();
+ }
+
+ private boolean _called;
+ }
+
+ static class Callback extends CallbackBase
+ {
+ public Callback()
+ {
+ }
+
+ public void
+ sent(boolean sentSynchronously)
+ {
+ called();
+ }
+
+ void noException(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ }
+
+ static void
+ onewaysAMI(test.Util.Application app, MyClassPrx proxy)
+ {
+ MyClassPrx p = (MyClassPrx)proxy.ice_oneway();
+
+ {
+ final Callback cb = new Callback();
+ Ice.Callback_Object_ice_ping callback = new Ice.Callback_Object_ice_ping()
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ cb.noException(ex);
+ }
+
+ @Override
+ public void
+ sent(boolean sentSynchronously)
+ {
+ cb.sent(sentSynchronously);
+ }
+ };
+ p.begin_ice_ping(callback);
+ cb.check();
+ }
+
+ {
+ try
+ {
+ p.begin_ice_isA("::Test::MyClass");
+ test(false);
+ }
+ catch(java.lang.IllegalArgumentException ex)
+ {
+ }
+ }
+
+ {
+ try
+ {
+ p.begin_ice_id();
+ test(false);
+ }
+ catch(java.lang.IllegalArgumentException ex)
+ {
+ }
+ }
+
+ {
+ try
+ {
+ p.begin_ice_ids();
+ test(false);
+ }
+ catch(java.lang.IllegalArgumentException ex)
+ {
+ }
+ }
+
+ {
+ final Callback cb = new Callback();
+ Callback_MyClass_opVoid callback = new Callback_MyClass_opVoid()
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ cb.noException(ex);
+ }
+
+ @Override
+ public void
+ sent(boolean sentSynchronously)
+ {
+ cb.sent(sentSynchronously);
+ }
+ };
+ p.begin_opVoid(callback);
+ cb.check();
+ }
+
+ {
+ final Callback cb = new Callback();
+ Callback_MyClass_opIdempotent callback = new Callback_MyClass_opIdempotent()
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ cb.noException(ex);
+ }
+
+ @Override
+ public void
+ sent(boolean sentSynchronously)
+ {
+ cb.sent(sentSynchronously);
+ }
+ };
+ p.begin_opIdempotent(callback);
+ cb.check();
+ }
+
+ {
+ final Callback cb = new Callback();
+ Callback_MyClass_opNonmutating callback = new Callback_MyClass_opNonmutating()
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ cb.noException(ex);
+ }
+
+ @Override
+ public void
+ sent(boolean sentSynchronously)
+ {
+ cb.sent(sentSynchronously);
+ }
+ };
+ p.begin_opNonmutating(callback);
+ cb.check();
+ }
+
+ {
+ try
+ {
+ p.begin_opByte((byte)0xff, (byte)0x0f);
+ test(false);
+ }
+ catch(java.lang.IllegalArgumentException ex)
+ {
+ }
+ }
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/operations/Server.java b/java-compat/test/src/main/java/test/Ice/operations/Server.java
new file mode 100644
index 00000000000..ae7d1de57bd
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/operations/Server.java
@@ -0,0 +1,47 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.operations;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test"));
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ //
+ // It's possible to have batch oneway requests dispatched
+ // after the adapter is deactivated due to thread
+ // scheduling so we suppress this warning.
+ //
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.operations");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server c = new Server();
+ int status = c.main("Server", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/operations/Test.ice b/java-compat/test/src/main/java/test/Ice/operations/Test.ice
new file mode 100644
index 00000000000..d76fff55db0
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/operations/Test.ice
@@ -0,0 +1,354 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+#include <Ice/Current.ice>
+
+[["java:package:test.Ice.operations"]]
+module Test
+{
+
+enum MyEnum
+{
+ enum1,
+ enum2,
+ enum3
+};
+
+class MyClass;
+
+struct AnotherStruct
+{
+ string s;
+};
+
+struct Structure
+{
+ MyClass* p;
+ MyEnum e;
+ AnotherStruct s;
+};
+
+sequence<byte> ByteS;
+sequence<bool> BoolS;
+sequence<short> ShortS;
+sequence<int> IntS;
+sequence<long> LongS;
+sequence<float> FloatS;
+sequence<double> DoubleS;
+sequence<string> StringS;
+sequence<MyEnum> MyEnumS;
+sequence<MyClass*> MyClassS;
+
+sequence<ByteS> ByteSS;
+sequence<BoolS> BoolSS;
+sequence<ShortS> ShortSS;
+sequence<IntS> IntSS;
+sequence<LongS> LongSS;
+sequence<FloatS> FloatSS;
+sequence<DoubleS> DoubleSS;
+sequence<StringS> StringSS;
+sequence<MyEnumS> MyEnumSS;
+sequence<MyClassS> MyClassSS;
+
+sequence<StringSS> StringSSS;
+
+struct MyStruct
+{
+ int i;
+ int j;
+};
+
+dictionary<byte, bool> ByteBoolD;
+dictionary<short, int> ShortIntD;
+dictionary<long, float> LongFloatD;
+dictionary<string, string> StringStringD;
+dictionary<string, MyEnum> StringMyEnumD;
+dictionary<MyEnum, string> MyEnumStringD;
+dictionary<MyStruct, MyEnum> MyStructMyEnumD;
+
+["java:type:java.util.ArrayList<java.util.Map<Byte,Boolean>>"] sequence<ByteBoolD> ByteBoolDS;
+["java:type:java.util.ArrayList<java.util.Map<Short,Integer>>"] sequence<ShortIntD> ShortIntDS;
+["java:type:java.util.ArrayList<java.util.Map<Long,Float>>"]sequence<LongFloatD> LongFloatDS;
+["java:type:java.util.ArrayList<java.util.Map<String,String>>"]sequence<StringStringD> StringStringDS;
+["java:type:java.util.ArrayList<java.util.Map<String,MyEnum>>"]sequence<StringMyEnumD> StringMyEnumDS;
+["java:type:java.util.ArrayList<java.util.Map<MyEnum,String>>"]sequence<MyEnumStringD> MyEnumStringDS;
+["java:type:java.util.ArrayList<java.util.Map<MyStruct,MyEnum>>"]sequence<MyStructMyEnumD> MyStructMyEnumDS;
+
+dictionary<byte, ByteS> ByteByteSD;
+dictionary<bool, BoolS> BoolBoolSD;
+dictionary<short, ShortS> ShortShortSD;
+dictionary<int, IntS> IntIntSD;
+dictionary<long, LongS> LongLongSD;
+dictionary<string, FloatS> StringFloatSD;
+dictionary<string, DoubleS> StringDoubleSD;
+dictionary<string, StringS> StringStringSD;
+dictionary<MyEnum, MyEnumS> MyEnumMyEnumSD;
+
+class MyClass
+{
+ void shutdown();
+
+ void opVoid();
+
+ byte opByte(byte p1, byte p2,
+ out byte p3);
+
+ bool opBool(bool p1, bool p2,
+ out bool p3);
+
+ long opShortIntLong(short p1, int p2, long p3,
+ out short p4, out int p5, out long p6);
+
+ double opFloatDouble(float p1, double p2,
+ out float p3, out double p4);
+
+ string opString(string p1, string p2,
+ out string p3);
+
+ MyEnum opMyEnum(MyEnum p1, out MyEnum p2);
+
+ MyClass* opMyClass(MyClass* p1, out MyClass* p2, out MyClass* p3);
+
+ Structure opStruct(Structure p1, Structure p2,
+ out Structure p3);
+
+ ByteS opByteS(ByteS p1, ByteS p2,
+ out ByteS p3);
+
+ BoolS opBoolS(BoolS p1, BoolS p2,
+ out BoolS p3);
+
+ LongS opShortIntLongS(Test::ShortS p1, IntS p2, LongS p3,
+ out ::Test::ShortS p4, out IntS p5, out LongS p6);
+
+ DoubleS opFloatDoubleS(FloatS p1, DoubleS p2,
+ out FloatS p3, out DoubleS p4);
+
+ StringS opStringS(StringS p1, StringS p2,
+ out StringS p3);
+
+ ByteSS opByteSS(ByteSS p1, ByteSS p2,
+ out ByteSS p3);
+
+ BoolSS opBoolSS(BoolSS p1, BoolSS p2,
+ out BoolSS p3);
+
+ LongSS opShortIntLongSS(ShortSS p1, IntSS p2, LongSS p3,
+ out ShortSS p4, out IntSS p5, out LongSS p6);
+
+
+ DoubleSS opFloatDoubleSS(FloatSS p1, DoubleSS p2,
+ out FloatSS p3, out DoubleSS p4);
+
+ StringSS opStringSS(StringSS p1, StringSS p2,
+ out StringSS p3);
+
+ StringSSS opStringSSS(StringSSS p1, StringSSS p2,
+ out StringSSS p3);
+
+ ByteBoolD opByteBoolD(ByteBoolD p1, ByteBoolD p2,
+ out ByteBoolD p3);
+
+ ShortIntD opShortIntD(ShortIntD p1, ShortIntD p2,
+ out ShortIntD p3);
+
+ LongFloatD opLongFloatD(LongFloatD p1, LongFloatD p2,
+ out LongFloatD p3);
+
+ StringStringD opStringStringD(StringStringD p1, StringStringD p2,
+ out StringStringD p3);
+
+ StringMyEnumD opStringMyEnumD(StringMyEnumD p1, StringMyEnumD p2,
+ out StringMyEnumD p3);
+
+ MyEnumStringD opMyEnumStringD(MyEnumStringD p1, MyEnumStringD p2,
+ out MyEnumStringD p3);
+
+ MyStructMyEnumD opMyStructMyEnumD(MyStructMyEnumD p1, MyStructMyEnumD p2,
+ out MyStructMyEnumD p3);
+
+ ByteBoolDS opByteBoolDS(ByteBoolDS p1, ByteBoolDS p2,
+ out ByteBoolDS p3);
+
+ ShortIntDS opShortIntDS(ShortIntDS p1, ShortIntDS p2,
+ out ShortIntDS p3);
+
+ LongFloatDS opLongFloatDS(LongFloatDS p1, LongFloatDS p2,
+ out LongFloatDS p3);
+
+ StringStringDS opStringStringDS(StringStringDS p1, StringStringDS p2,
+ out StringStringDS p3);
+
+ StringMyEnumDS opStringMyEnumDS(StringMyEnumDS p1, StringMyEnumDS p2,
+ out StringMyEnumDS p3);
+
+ MyEnumStringDS opMyEnumStringDS(MyEnumStringDS p1, MyEnumStringDS p2,
+ out MyEnumStringDS p3);
+
+ MyStructMyEnumDS opMyStructMyEnumDS(MyStructMyEnumDS p1, MyStructMyEnumDS p2,
+ out MyStructMyEnumDS p3);
+
+ ByteByteSD opByteByteSD(ByteByteSD p1, ByteByteSD p2,
+ out ByteByteSD p3);
+
+ BoolBoolSD opBoolBoolSD(BoolBoolSD p1, BoolBoolSD p2,
+ out BoolBoolSD p3);
+
+ ShortShortSD opShortShortSD(ShortShortSD p1, ShortShortSD p2,
+ out ShortShortSD p3);
+
+ IntIntSD opIntIntSD(IntIntSD p1, IntIntSD p2,
+ out IntIntSD p3);
+
+ LongLongSD opLongLongSD(LongLongSD p1, LongLongSD p2,
+ out LongLongSD p3);
+
+ StringFloatSD opStringFloatSD(StringFloatSD p1, StringFloatSD p2,
+ out StringFloatSD p3);
+
+ StringDoubleSD opStringDoubleSD(StringDoubleSD p1, StringDoubleSD p2,
+ out StringDoubleSD p3);
+
+ StringStringSD opStringStringSD(StringStringSD p1, StringStringSD p2,
+ out StringStringSD p3);
+
+ MyEnumMyEnumSD opMyEnumMyEnumSD(MyEnumMyEnumSD p1, MyEnumMyEnumSD p2,
+ out MyEnumMyEnumSD p3);
+
+ IntS opIntS(IntS s);
+
+ void opByteSOneway(ByteS s);
+
+ int opByteSOnewayCallCount();
+
+ Ice::Context opContext();
+
+ void opDoubleMarshaling(double p1, DoubleS p2);
+
+ idempotent void opIdempotent();
+
+ ["nonmutating"] idempotent void opNonmutating();
+
+ byte opByte1(byte opByte1);
+ short opShort1(short opShort1);
+ int opInt1(int opInt1);
+ long opLong1(long opLong1);
+ float opFloat1(float opFloat1);
+ double opDouble1(double opDouble1);
+ string opString1(string opString1);
+ StringS opStringS1(StringS opStringS1);
+ ByteBoolD opByteBoolD1(ByteBoolD opByteBoolD1);
+ StringS opStringS2(StringS stringS);
+ ByteBoolD opByteBoolD2(ByteBoolD byteBoolD);
+
+ StringS opStringLiterals();
+ StringS opWStringLiterals();
+
+ ["marshaled-result"] Structure opMStruct1();
+ ["marshaled-result"] Structure opMStruct2(Structure p1, out Structure p2);
+
+ ["marshaled-result"] StringS opMSeq1();
+ ["marshaled-result"] StringS opMSeq2(StringS p1, out StringS p2);
+
+ ["marshaled-result"] StringStringD opMDict1();
+ ["marshaled-result"] StringStringD opMDict2(StringStringD p1, out StringStringD p2);
+};
+
+struct MyStruct1
+{
+ string tesT; // Same name as the enclosing module
+ MyClass myClass; // Same name as an already defined class
+ string myStruct1; // Same name as the enclosing struct
+};
+
+class MyClass1
+{
+ string tesT; // Same name as the enclosing module
+ MyClass myClass; // Same name as an already defined class
+ string myClass1; // Same name as the enclosing class
+};
+
+class MyDerivedClass extends MyClass
+{
+ void opDerived();
+ MyClass1 opMyClass1(MyClass1 opMyClass1);
+ MyStruct1 opMyStruct1(MyStruct1 opMyStruct1);
+};
+
+//
+// String literals
+//
+
+const string s0 = "\u005c"; // backslash
+const string s1 = "\u0041"; // A
+const string s2 = "\u0049\u0063\u0065"; // Ice
+const string s3 = "\u004121"; // A21
+const string s4 = "\\u0041 \\U00000041"; // \\u0041 \\U00000041
+const string s5 = "\u00FF"; // ÿ
+const string s6 = "\u03FF"; // GREEK CAPITAL REVERSED DOTTED LUNATE SIGMA SYMBOL (U+03FF)
+const string s7 = "\u05F0"; // HEBREW LIGATURE YIDDISH DOUBLE VAV (U+05F0)
+const string s8 = "\U00010000"; // LINEAR B SYLLABLE B008 A (U+10000)
+const string s9 = "\U0001F34C"; // BANANA (U+1F34C)
+const string s10 = "\u0DA7"; // Sinhala Letter Alpapraana Ttayanna
+
+const string sw0 = "\U0000005c"; // backslash
+const string sw1 = "\U00000041"; // A
+const string sw2 = "\U00000049\U00000063\U00000065"; // Ice
+const string sw3 = "\U0000004121"; // A21
+const string sw4 = "\\u0041 \\U00000041"; // \\u0041 \\U00000041
+const string sw5 = "\U000000FF"; // ÿ
+const string sw6 = "\U000003FF"; // GREEK CAPITAL REVERSED DOTTED LUNATE SIGMA SYMBOL (U+03FF)
+const string sw7 = "\U000005F0"; // HEBREW LIGATURE YIDDISH DOUBLE VAV (U+05F0)
+const string sw8 = "\U00010000"; // LINEAR B SYLLABLE B008 A (U+10000)
+const string sw9 = "\U0001F34C"; // BANANA (U+1F34C)
+const string sw10 = "\U00000DA7"; // Sinhala Letter Alpapraana Ttayanna
+
+/**
+\' single quote byte 0x27 in ASCII encoding
+\" double quote byte 0x22 in ASCII encoding
+\? question mark byte 0x3f in ASCII encoding
+\\ backslash byte 0x5c in ASCII encoding
+\a audible bell byte 0x07 in ASCII encoding
+\b backspace byte 0x08 in ASCII encoding
+\f form feed - new page byte 0x0c in ASCII encoding
+\n line feed - new line byte 0x0a in ASCII encoding
+\r carriage return byte 0x0d in ASCII encoding
+\t horizontal tab byte 0x09 in ASCII encoding
+\v vertical tab byte 0x0b in ASCII encoding
+**/
+
+const string ss0 = "\'\"\?\\\a\b\f\n\r\t\v";
+const string ss1 = "\u0027\u0022\u003f\u005c\u0007\u0008\u000c\u000a\u000d\u0009\u000b";
+const string ss2 = "\U00000027\U00000022\U0000003f\U0000005c\U00000007\U00000008\U0000000c\U0000000a\U0000000d\U00000009\U0000000b";
+
+const string ss3 = "\\\\U\\u\\"; /* \\U\u\ */
+const string ss4 = "\\\u0041\\"; /* \A\ */
+const string ss5 = "\\u0041\\"; /* \u0041\ */
+
+//
+// Ĩ - Unicode Character 'LATIN CAPITAL LETTER I WITH TILDE' (U+0128)
+// Ÿ - Unicode Character 'LATIN CAPITAL LETTER Y WITH DIAERESIS' (U+0178)
+// ÿ - Unicode Character 'LATIN SMALL LETTER Y WITH DIAERESIS' (U+00FF)
+// Ā - Unicode Character 'LATIN CAPITAL LETTER A WITH MACRON' (U+0100)
+// ἀ - Unicode Character 'GREEK SMALL LETTER ALPHA WITH PSILI' (U+1F00)
+// 𐆔 - Unicode Character 'ROMAN DIMIDIA SEXTULA SIGN' (U+10194)
+// 𐅪 - Unicode Character 'GREEK ACROPHONIC THESPIAN ONE HUNDRED' (U+1016A)
+// 𐆘 - Unicode Character 'ROMAN SESTERTIUS SIGN' (U+10198)
+// 🍀 - Unicode Character 'FOUR LEAF CLOVER' (U+1F340)
+// 🍁 - Unicode Character 'MAPLE LEAF' (U+1F341)
+// 🍂 - Unicode Character 'FALLEN LEAF' (U+1F342)
+// 🍃 - Unicode Character 'LEAF FLUTTERING IN WIND' (U+1F343)
+//
+const string su0 = "ĨŸÿĀἀ𐆔𐅪𐆘🍀🍁🍂🍃";
+const string su1 = "\u0128\u0178\u00FF\u0100\u1F00\U00010194\U0001016A\U00010198\U0001F340\U0001F341\U0001F342\U0001F343";
+const string su2 = "\U00000128\U00000178\U000000FF\U00000100\U00001F00\U00010194\U0001016A\U00010198\U0001F340\U0001F341\U0001F342\U0001F343";
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/operations/TestAMD.ice b/java-compat/test/src/main/java/test/Ice/operations/TestAMD.ice
new file mode 100644
index 00000000000..b160a741cf1
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/operations/TestAMD.ice
@@ -0,0 +1,354 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+#include <Ice/Current.ice>
+
+[["java:package:test.Ice.operations.AMD"]]
+module Test
+{
+
+enum MyEnum
+{
+ enum1,
+ enum2,
+ enum3
+};
+
+class MyClass;
+
+struct AnotherStruct
+{
+ string s;
+};
+
+struct Structure
+{
+ MyClass* p;
+ MyEnum e;
+ AnotherStruct s;
+};
+
+sequence<byte> ByteS;
+sequence<bool> BoolS;
+sequence<short> ShortS;
+sequence<int> IntS;
+sequence<long> LongS;
+sequence<float> FloatS;
+sequence<double> DoubleS;
+sequence<string> StringS;
+sequence<MyEnum> MyEnumS;
+sequence<MyClass*> MyClassS;
+
+sequence<ByteS> ByteSS;
+sequence<BoolS> BoolSS;
+sequence<ShortS> ShortSS;
+sequence<IntS> IntSS;
+sequence<LongS> LongSS;
+sequence<FloatS> FloatSS;
+sequence<DoubleS> DoubleSS;
+sequence<StringS> StringSS;
+sequence<MyEnumS> MyEnumSS;
+sequence<MyClassS> MyClassSS;
+
+sequence<StringSS> StringSSS;
+
+struct MyStruct
+{
+ int i;
+ int j;
+};
+
+dictionary<byte, bool> ByteBoolD;
+dictionary<short, int> ShortIntD;
+dictionary<long, float> LongFloatD;
+dictionary<string, string> StringStringD;
+dictionary<string, MyEnum> StringMyEnumD;
+dictionary<MyEnum, string> MyEnumStringD;
+dictionary<MyStruct, MyEnum> MyStructMyEnumD;
+
+["java:type:java.util.ArrayList<java.util.Map<Byte,Boolean>>"] sequence<ByteBoolD> ByteBoolDS;
+["java:type:java.util.ArrayList<java.util.Map<Short,Integer>>"] sequence<ShortIntD> ShortIntDS;
+["java:type:java.util.ArrayList<java.util.Map<Long,Float>>"]sequence<LongFloatD> LongFloatDS;
+["java:type:java.util.ArrayList<java.util.Map<String,String>>"]sequence<StringStringD> StringStringDS;
+["java:type:java.util.ArrayList<java.util.Map<String,MyEnum>>"]sequence<StringMyEnumD> StringMyEnumDS;
+["java:type:java.util.ArrayList<java.util.Map<MyEnum,String>>"]sequence<MyEnumStringD> MyEnumStringDS;
+["java:type:java.util.ArrayList<java.util.Map<MyStruct,MyEnum>>"]sequence<MyStructMyEnumD> MyStructMyEnumDS;
+
+dictionary<byte, ByteS> ByteByteSD;
+dictionary<bool, BoolS> BoolBoolSD;
+dictionary<short, ShortS> ShortShortSD;
+dictionary<int, IntS> IntIntSD;
+dictionary<long, LongS> LongLongSD;
+dictionary<string, FloatS> StringFloatSD;
+dictionary<string, DoubleS> StringDoubleSD;
+dictionary<string, StringS> StringStringSD;
+dictionary<MyEnum, MyEnumS> MyEnumMyEnumSD;
+
+["amd"] class MyClass
+{
+ void shutdown();
+
+ void opVoid();
+
+ byte opByte(byte p1, byte p2,
+ out byte p3);
+
+ bool opBool(bool p1, bool p2,
+ out bool p3);
+
+ long opShortIntLong(short p1, int p2, long p3,
+ out short p4, out int p5, out long p6);
+
+ double opFloatDouble(float p1, double p2,
+ out float p3, out double p4);
+
+ string opString(string p1, string p2,
+ out string p3);
+
+ MyEnum opMyEnum(MyEnum p1, out MyEnum p2);
+
+ MyClass* opMyClass(MyClass* p1, out MyClass* p2, out MyClass* p3);
+
+ Structure opStruct(Structure p1, Structure p2,
+ out Structure p3);
+
+ ByteS opByteS(ByteS p1, ByteS p2,
+ out ByteS p3);
+
+ BoolS opBoolS(BoolS p1, BoolS p2,
+ out BoolS p3);
+
+ LongS opShortIntLongS(Test::ShortS p1, IntS p2, LongS p3,
+ out ::Test::ShortS p4, out IntS p5, out LongS p6);
+
+ DoubleS opFloatDoubleS(FloatS p1, DoubleS p2,
+ out FloatS p3, out DoubleS p4);
+
+ StringS opStringS(StringS p1, StringS p2,
+ out StringS p3);
+
+ ByteSS opByteSS(ByteSS p1, ByteSS p2,
+ out ByteSS p3);
+
+ BoolSS opBoolSS(BoolSS p1, BoolSS p2,
+ out BoolSS p3);
+
+ LongSS opShortIntLongSS(ShortSS p1, IntSS p2, LongSS p3,
+ out ShortSS p4, out IntSS p5, out LongSS p6);
+
+
+ DoubleSS opFloatDoubleSS(FloatSS p1, DoubleSS p2,
+ out FloatSS p3, out DoubleSS p4);
+
+ StringSS opStringSS(StringSS p1, StringSS p2,
+ out StringSS p3);
+
+ StringSSS opStringSSS(StringSSS p1, StringSSS p2,
+ out StringSSS p3);
+
+ ByteBoolD opByteBoolD(ByteBoolD p1, ByteBoolD p2,
+ out ByteBoolD p3);
+
+ ShortIntD opShortIntD(ShortIntD p1, ShortIntD p2,
+ out ShortIntD p3);
+
+ LongFloatD opLongFloatD(LongFloatD p1, LongFloatD p2,
+ out LongFloatD p3);
+
+ StringStringD opStringStringD(StringStringD p1, StringStringD p2,
+ out StringStringD p3);
+
+ StringMyEnumD opStringMyEnumD(StringMyEnumD p1, StringMyEnumD p2,
+ out StringMyEnumD p3);
+
+ MyEnumStringD opMyEnumStringD(MyEnumStringD p1, MyEnumStringD p2,
+ out MyEnumStringD p3);
+
+ MyStructMyEnumD opMyStructMyEnumD(MyStructMyEnumD p1, MyStructMyEnumD p2,
+ out MyStructMyEnumD p3);
+
+ ByteBoolDS opByteBoolDS(ByteBoolDS p1, ByteBoolDS p2,
+ out ByteBoolDS p3);
+
+ ShortIntDS opShortIntDS(ShortIntDS p1, ShortIntDS p2,
+ out ShortIntDS p3);
+
+ LongFloatDS opLongFloatDS(LongFloatDS p1, LongFloatDS p2,
+ out LongFloatDS p3);
+
+ StringStringDS opStringStringDS(StringStringDS p1, StringStringDS p2,
+ out StringStringDS p3);
+
+ StringMyEnumDS opStringMyEnumDS(StringMyEnumDS p1, StringMyEnumDS p2,
+ out StringMyEnumDS p3);
+
+ MyEnumStringDS opMyEnumStringDS(MyEnumStringDS p1, MyEnumStringDS p2,
+ out MyEnumStringDS p3);
+
+ MyStructMyEnumDS opMyStructMyEnumDS(MyStructMyEnumDS p1, MyStructMyEnumDS p2,
+ out MyStructMyEnumDS p3);
+
+ ByteByteSD opByteByteSD(ByteByteSD p1, ByteByteSD p2,
+ out ByteByteSD p3);
+
+ BoolBoolSD opBoolBoolSD(BoolBoolSD p1, BoolBoolSD p2,
+ out BoolBoolSD p3);
+
+ ShortShortSD opShortShortSD(ShortShortSD p1, ShortShortSD p2,
+ out ShortShortSD p3);
+
+ IntIntSD opIntIntSD(IntIntSD p1, IntIntSD p2,
+ out IntIntSD p3);
+
+ LongLongSD opLongLongSD(LongLongSD p1, LongLongSD p2,
+ out LongLongSD p3);
+
+ StringFloatSD opStringFloatSD(StringFloatSD p1, StringFloatSD p2,
+ out StringFloatSD p3);
+
+ StringDoubleSD opStringDoubleSD(StringDoubleSD p1, StringDoubleSD p2,
+ out StringDoubleSD p3);
+
+ StringStringSD opStringStringSD(StringStringSD p1, StringStringSD p2,
+ out StringStringSD p3);
+
+ MyEnumMyEnumSD opMyEnumMyEnumSD(MyEnumMyEnumSD p1, MyEnumMyEnumSD p2,
+ out MyEnumMyEnumSD p3);
+
+ IntS opIntS(IntS s);
+
+ void opByteSOneway(ByteS s);
+
+ int opByteSOnewayCallCount();
+
+ Ice::Context opContext();
+
+ void opDoubleMarshaling(double p1, DoubleS p2);
+
+ idempotent void opIdempotent();
+
+ ["nonmutating"] idempotent void opNonmutating();
+
+ byte opByte1(byte opByte1);
+ short opShort1(short opShort1);
+ int opInt1(int opInt1);
+ long opLong1(long opLong1);
+ float opFloat1(float opFloat1);
+ double opDouble1(double opDouble1);
+ string opString1(string opString1);
+ StringS opStringS1(StringS opStringS1);
+ ByteBoolD opByteBoolD1(ByteBoolD opByteBoolD1);
+ StringS opStringS2(StringS stringS);
+ ByteBoolD opByteBoolD2(ByteBoolD byteBoolD);
+
+ StringS opStringLiterals();
+ StringS opWStringLiterals();
+
+ ["marshaled-result"] Structure opMStruct1();
+ ["marshaled-result"] Structure opMStruct2(Structure p1, out Structure p2);
+
+ ["marshaled-result"] StringS opMSeq1();
+ ["marshaled-result"] StringS opMSeq2(StringS p1, out StringS p2);
+
+ ["marshaled-result"] StringStringD opMDict1();
+ ["marshaled-result"] StringStringD opMDict2(StringStringD p1, out StringStringD p2);
+};
+
+struct MyStruct1
+{
+ string tesT; // Same name as the enclosing module
+ MyClass myClass; // Same name as an already defined class
+ string myStruct1; // Same name as the enclosing struct
+};
+
+class MyClass1
+{
+ string tesT; // Same name as the enclosing module
+ MyClass myClass; // Same name as an already defined class
+ string myClass1; // Same name as the enclosing class
+};
+
+["amd"] class MyDerivedClass extends MyClass
+{
+ void opDerived();
+ MyClass1 opMyClass1(MyClass1 opMyClass1);
+ MyStruct1 opMyStruct1(MyStruct1 opMyStruct1);
+};
+
+//
+// String literals
+//
+
+const string s0 = "\u005c"; // backslash
+const string s1 = "\u0041"; // A
+const string s2 = "\u0049\u0063\u0065"; // Ice
+const string s3 = "\u004121"; // A21
+const string s4 = "\\u0041 \\U00000041"; // \\u0041 \\U00000041
+const string s5 = "\u00FF"; // ÿ
+const string s6 = "\u03FF"; // GREEK CAPITAL REVERSED DOTTED LUNATE SIGMA SYMBOL (U+03FF)
+const string s7 = "\u05F0"; // HEBREW LIGATURE YIDDISH DOUBLE VAV (U+05F0)
+const string s8 = "\U00010000"; // LINEAR B SYLLABLE B008 A (U+10000)
+const string s9 = "\U0001F34C"; // BANANA (U+1F34C)
+const string s10 = "\u0DA7"; // Sinhala Letter Alpapraana Ttayanna
+
+const string sw0 = "\U0000005c"; // backslash
+const string sw1 = "\U00000041"; // A
+const string sw2 = "\U00000049\U00000063\U00000065"; // Ice
+const string sw3 = "\U0000004121"; // A21
+const string sw4 = "\\u0041 \\U00000041"; // \\u0041 \\U00000041
+const string sw5 = "\U000000FF"; // ÿ
+const string sw6 = "\U000003FF"; // GREEK CAPITAL REVERSED DOTTED LUNATE SIGMA SYMBOL (U+03FF)
+const string sw7 = "\U000005F0"; // HEBREW LIGATURE YIDDISH DOUBLE VAV (U+05F0)
+const string sw8 = "\U00010000"; // LINEAR B SYLLABLE B008 A (U+10000)
+const string sw9 = "\U0001F34C"; // BANANA (U+1F34C)
+const string sw10 = "\U00000DA7"; // Sinhala Letter Alpapraana Ttayanna
+
+/**
+\' single quote byte 0x27 in ASCII encoding
+\" double quote byte 0x22 in ASCII encoding
+\? question mark byte 0x3f in ASCII encoding
+\\ backslash byte 0x5c in ASCII encoding
+\a audible bell byte 0x07 in ASCII encoding
+\b backspace byte 0x08 in ASCII encoding
+\f form feed - new page byte 0x0c in ASCII encoding
+\n line feed - new line byte 0x0a in ASCII encoding
+\r carriage return byte 0x0d in ASCII encoding
+\t horizontal tab byte 0x09 in ASCII encoding
+\v vertical tab byte 0x0b in ASCII encoding
+**/
+
+const string ss0 = "\'\"\?\\\a\b\f\n\r\t\v";
+const string ss1 = "\u0027\u0022\u003f\u005c\u0007\u0008\u000c\u000a\u000d\u0009\u000b";
+const string ss2 = "\U00000027\U00000022\U0000003f\U0000005c\U00000007\U00000008\U0000000c\U0000000a\U0000000d\U00000009\U0000000b";
+
+const string ss3 = "\\\\U\\u\\"; /* \\U\u\ */
+const string ss4 = "\\\u0041\\"; /* \A\ */
+const string ss5 = "\\u0041\\"; /* \u0041\ */
+
+//
+// Ĩ - Unicode Character 'LATIN CAPITAL LETTER I WITH TILDE' (U+0128)
+// Ÿ - Unicode Character 'LATIN CAPITAL LETTER Y WITH DIAERESIS' (U+0178)
+// ÿ - Unicode Character 'LATIN SMALL LETTER Y WITH DIAERESIS' (U+00FF)
+// Ā - Unicode Character 'LATIN CAPITAL LETTER A WITH MACRON' (U+0100)
+// ἀ - Unicode Character 'GREEK SMALL LETTER ALPHA WITH PSILI' (U+1F00)
+// 𐆔 - Unicode Character 'ROMAN DIMIDIA SEXTULA SIGN' (U+10194)
+// 𐅪 - Unicode Character 'GREEK ACROPHONIC THESPIAN ONE HUNDRED' (U+1016A)
+// 𐆘 - Unicode Character 'ROMAN SESTERTIUS SIGN' (U+10198)
+// 🍀 - Unicode Character 'FOUR LEAF CLOVER' (U+1F340)
+// 🍁 - Unicode Character 'MAPLE LEAF' (U+1F341)
+// 🍂 - Unicode Character 'FALLEN LEAF' (U+1F342)
+// 🍃 - Unicode Character 'LEAF FLUTTERING IN WIND' (U+1F343)
+//
+const string su0 = "ĨŸÿĀἀ𐆔𐅪𐆘🍀🍁🍂🍃";
+const string su1 = "\u0128\u0178\u00FF\u0100\u1F00\U00010194\U0001016A\U00010198\U0001F340\U0001F341\U0001F342\U0001F343";
+const string su2 = "\U00000128\U00000178\U000000FF\U00000100\U00001F00\U00010194\U0001016A\U00010198\U0001F340\U0001F341\U0001F342\U0001F343";
+
+};
diff --git a/java/test/src/main/java/test/Ice/operations/TieMyDerivedClassI.java b/java-compat/test/src/main/java/test/Ice/operations/TieMyDerivedClassI.java
index c1d793cbe94..c1d793cbe94 100644
--- a/java/test/src/main/java/test/Ice/operations/TieMyDerivedClassI.java
+++ b/java-compat/test/src/main/java/test/Ice/operations/TieMyDerivedClassI.java
diff --git a/java/test/src/main/java/test/Ice/operations/TieServer.java b/java-compat/test/src/main/java/test/Ice/operations/TieServer.java
index 189fe433be7..189fe433be7 100644
--- a/java/test/src/main/java/test/Ice/operations/TieServer.java
+++ b/java-compat/test/src/main/java/test/Ice/operations/TieServer.java
diff --git a/java-compat/test/src/main/java/test/Ice/operations/Twoways.java b/java-compat/test/src/main/java/test/Ice/operations/Twoways.java
new file mode 100644
index 00000000000..cea51fc11c9
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/operations/Twoways.java
@@ -0,0 +1,1606 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.operations;
+
+import Ice.*;
+import Ice.Object;
+import test.Ice.operations.Test.*;
+import test.Util.Application;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+class Twoways
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ static class PerThreadContextInvokeThread extends Thread
+ {
+ public PerThreadContextInvokeThread(MyClassPrx proxy)
+ {
+ _proxy = proxy;
+ }
+
+ @Override
+ public void
+ run()
+ {
+ java.util.Map<String, String> ctx = _proxy.ice_getCommunicator().getImplicitContext().getContext();
+ test(ctx.isEmpty());
+ ctx.put("one", "ONE");
+ _proxy.ice_getCommunicator().getImplicitContext().setContext(ctx);
+ test(_proxy.opContext().equals(ctx));
+ }
+
+ final private MyClassPrx _proxy;
+ }
+
+ static void
+ twoways(Application app, MyClassPrx p)
+ {
+ Communicator communicator = app.communicator();
+
+ String[] literals = p.opStringLiterals();
+
+ test(s0.value.equals("\\") &&
+ s0.value.equals(sw0.value) &&
+ s0.value.equals(literals[0]) &&
+ s0.value.equals(literals[11]));
+
+ test(s1.value.equals("A") &&
+ s1.value.equals(sw1.value) &&
+ s1.value.equals(literals[1]) &&
+ s1.value.equals(literals[12]));
+
+ test(s2.value.equals("Ice") &&
+ s2.value.equals(sw2.value) &&
+ s2.value.equals(literals[2]) &&
+ s2.value.equals(literals[13]));
+
+ test(s3.value.equals("A21") &&
+ s3.value.equals(sw3.value) &&
+ s3.value.equals(literals[3]) &&
+ s3.value.equals(literals[14]));
+
+ test(s4.value.equals("\\u0041 \\U00000041") &&
+ s4.value.equals(sw4.value) &&
+ s4.value.equals(literals[4]) &&
+ s4.value.equals(literals[15]));
+
+ test(s5.value.equals("\u00FF") &&
+ s5.value.equals(sw5.value) &&
+ s5.value.equals(literals[5]) &&
+ s5.value.equals(literals[16]));
+
+ test(s6.value.equals("\u03FF") &&
+ s6.value.equals(sw6.value) &&
+ s6.value.equals(literals[6]) &&
+ s6.value.equals(literals[17]));
+
+ test(s7.value.equals("\u05F0") &&
+ s7.value.equals(sw7.value) &&
+ s7.value.equals(literals[7]) &&
+ s7.value.equals(literals[18]));
+
+ test(s8.value.equals("\uD800\uDC00") &&
+ s8.value.equals(sw8.value) &&
+ s8.value.equals(literals[8]) &&
+ s8.value.equals(literals[19]));
+
+ test(s9.value.equals("\uD83C\uDF4C") &&
+ s9.value.equals(sw9.value) &&
+ s9.value.equals(literals[9]) &&
+ s9.value.equals(literals[20]));
+
+ test(s10.value.equals("\u0DA7") &&
+ s10.value.equals(sw10.value) &&
+ s10.value.equals(literals[10]) &&
+ s10.value.equals(literals[21]));
+
+ test(ss0.value.equals("\'\"\u003f\\\u0007\b\f\n\r\t\u000b") &&
+ ss0.value.equals(ss1.value) &&
+ ss0.value.equals(ss2.value) &&
+ ss0.value.equals(literals[22]) &&
+ ss0.value.equals(literals[23]) &&
+ ss0.value.equals(literals[24]));
+
+ test(ss3.value.equals("\\\\U\\u\\") &&
+ ss3.value.equals(literals[25]));
+
+ test(ss4.value.equals("\\A\\") &&
+ ss4.value.equals(literals[26]));
+
+ test(ss5.value.equals("\\u0041\\") &&
+ ss5.value.equals(literals[27]));
+
+ test(su0.value.equals(su1.value) &&
+ su0.value.equals(su2.value) &&
+ su0.value.equals(literals[28]) &&
+ su0.value.equals(literals[29]) &&
+ su0.value.equals(literals[30]));
+
+ p.ice_ping();
+
+ test(p.ice_isA(MyClass.ice_staticId()));
+
+ test(p.ice_id().equals(MyDerivedClass.ice_staticId()));
+
+ test(MyDerivedClassPrxHelper.ice_staticId().equals(MyDerivedClass.ice_staticId()));
+ test(ObjectPrxHelper.ice_staticId().equals(Object.ice_staticId));
+ test(LocatorPrxHelper.ice_staticId().equals(Locator.ice_staticId));
+
+ {
+ String[] ids = p.ice_ids();
+ test(ids.length == 3);
+ test(ids[0].equals("::Ice::Object"));
+ test(ids[1].equals("::Test::MyClass"));
+ test(ids[2].equals("::Test::MyDerivedClass"));
+ }
+
+ {
+ p.opVoid();
+ }
+
+ {
+ ByteHolder b = new ByteHolder();
+ byte r;
+
+ r = p.opByte((byte) 0xff, (byte) 0x0f, b);
+ test(b.value == (byte) 0xf0);
+ test(r == (byte) 0xff);
+ }
+
+ {
+ BooleanHolder b = new BooleanHolder();
+ boolean r;
+
+ r = p.opBool(true, false, b);
+ test(b.value);
+ test(!r);
+ }
+
+ {
+ ShortHolder s = new ShortHolder();
+ IntHolder i = new IntHolder();
+ LongHolder l = new LongHolder();
+ long r;
+
+ r = p.opShortIntLong((short) 10, 11, 12L, s, i, l);
+ test(s.value == 10);
+ test(i.value == 11);
+ test(l.value == 12);
+ test(r == 12L);
+
+ r = p.opShortIntLong(Short.MIN_VALUE, Integer.MIN_VALUE,
+ Long.MIN_VALUE, s, i, l);
+ test(s.value == Short.MIN_VALUE);
+ test(i.value == Integer.MIN_VALUE);
+ test(l.value == Long.MIN_VALUE);
+ test(r == Long.MIN_VALUE);
+
+ r = p.opShortIntLong(Short.MAX_VALUE, Integer.MAX_VALUE,
+ Long.MAX_VALUE, s, i, l);
+ test(s.value == Short.MAX_VALUE);
+ test(i.value == Integer.MAX_VALUE);
+ test(l.value == Long.MAX_VALUE);
+ test(r == Long.MAX_VALUE);
+ }
+
+ {
+ FloatHolder f = new FloatHolder();
+ DoubleHolder d = new DoubleHolder();
+ double r;
+
+ r = p.opFloatDouble(3.14f, 1.1E10, f, d);
+ test(f.value == 3.14f);
+ test(d.value == 1.1E10);
+ test(r == 1.1E10);
+
+ r = p.opFloatDouble(Float.MIN_VALUE, Double.MIN_VALUE, f, d);
+ test(f.value == Float.MIN_VALUE);
+ test(d.value == Double.MIN_VALUE);
+ test(r == Double.MIN_VALUE);
+
+ r = p.opFloatDouble(Float.MAX_VALUE, Double.MAX_VALUE, f, d);
+ test(f.value == Float.MAX_VALUE);
+ test(d.value == Double.MAX_VALUE);
+ test(r == Double.MAX_VALUE);
+ }
+
+ {
+ StringHolder s = new StringHolder();
+ String r;
+
+ r = p.opString("hello", "world", s);
+ test(s.value.equals("world hello"));
+ test(r.equals("hello world"));
+ }
+
+ {
+ MyEnumHolder e = new MyEnumHolder();
+ MyEnum r;
+
+ r = p.opMyEnum(MyEnum.enum2, e);
+ test(e.value == MyEnum.enum2);
+ test(r == MyEnum.enum3);
+
+ //
+ // Test marshalling of null enum (firt enum value is
+ // marshalled in this case).
+ //
+ r = p.opMyEnum(null, e);
+ test(e.value == MyEnum.enum1);
+ test(r == MyEnum.enum3);
+ }
+
+ {
+ MyClassPrxHolder c1 = new MyClassPrxHolder();
+ MyClassPrxHolder c2 = new MyClassPrxHolder();
+ MyClassPrx r;
+
+ r = p.opMyClass(p, c1, c2);
+ test(Util.proxyIdentityAndFacetCompare(c1.value, p) == 0);
+ test(Util.proxyIdentityAndFacetCompare(c2.value, p) != 0);
+ test(Util.proxyIdentityAndFacetCompare(r, p) == 0);
+ test(c1.value.ice_getIdentity().equals(Ice.Util.stringToIdentity("test")));
+ test(c2.value.ice_getIdentity().equals(Ice.Util.stringToIdentity("noSuchIdentity")));
+ test(r.ice_getIdentity().equals(Ice.Util.stringToIdentity("test")));
+ r.opVoid();
+ c1.value.opVoid();
+ try
+ {
+ c2.value.opVoid();
+ test(false);
+ }
+ catch(ObjectNotExistException ex)
+ {
+ }
+
+ r = p.opMyClass(null, c1, c2);
+ test(c1.value == null);
+ test(c2.value != null);
+ test(Util.proxyIdentityAndFacetCompare(r, p) == 0);
+ r.opVoid();
+ }
+
+ {
+ Structure si1 = new Structure();
+ si1.p = p;
+ si1.e = MyEnum.enum3;
+ si1.s = new AnotherStruct();
+ si1.s.s = "abc";
+ Structure si2 = new Structure();
+ si2.p = null;
+ si2.e = MyEnum.enum2;
+ si2.s = new AnotherStruct();
+ si2.s.s = "def";
+
+ StructureHolder so = new StructureHolder();
+ Structure rso = p.opStruct(si1, si2, so);
+ test(rso.p == null);
+ test(rso.e == MyEnum.enum2);
+ test(rso.s.s.equals("def"));
+ test(so.value.p.equals(p));
+ test(so.value.e == MyEnum.enum3);
+ test(so.value.s.s.equals("a new string"));
+ so.value.p.opVoid();
+
+ //
+ // Test marshalling of null structs and structs with null members.
+ //
+ si1 = new Structure();
+ si2 = null;
+
+ so = new StructureHolder();
+ rso = p.opStruct(si1, si2, so);
+ test(rso.p == null);
+ test(rso.e == MyEnum.enum1);
+ test(rso.s.s.equals(""));
+ test(so.value.p == null);
+ test(so.value.e == MyEnum.enum1);
+ test(so.value.s.s.equals("a new string"));
+ }
+
+ {
+ final byte[] bsi1 =
+ {
+ (byte) 0x01,
+ (byte) 0x11,
+ (byte) 0x12,
+ (byte) 0x22
+ };
+ final byte[] bsi2 =
+ {
+ (byte) 0xf1,
+ (byte) 0xf2,
+ (byte) 0xf3,
+ (byte) 0xf4
+ };
+
+ ByteSHolder bso = new ByteSHolder();
+ byte[] rso;
+
+ rso = p.opByteS(bsi1, bsi2, bso);
+ test(bso.value.length == 4);
+ test(bso.value[0] == (byte) 0x22);
+ test(bso.value[1] == (byte) 0x12);
+ test(bso.value[2] == (byte) 0x11);
+ test(bso.value[3] == (byte) 0x01);
+ test(rso.length == 8);
+ test(rso[0] == (byte) 0x01);
+ test(rso[1] == (byte) 0x11);
+ test(rso[2] == (byte) 0x12);
+ test(rso[3] == (byte) 0x22);
+ test(rso[4] == (byte) 0xf1);
+ test(rso[5] == (byte) 0xf2);
+ test(rso[6] == (byte) 0xf3);
+ test(rso[7] == (byte) 0xf4);
+ }
+
+ {
+ final boolean[] bsi1 = {true, true, false};
+ final boolean[] bsi2 = {false};
+
+ BoolSHolder bso = new BoolSHolder();
+ boolean[] rso;
+
+ rso = p.opBoolS(bsi1, bsi2, bso);
+ test(bso.value.length == 4);
+ test(bso.value[0]);
+ test(bso.value[1]);
+ test(!bso.value[2]);
+ test(!bso.value[3]);
+ test(rso.length == 3);
+ test(!rso[0]);
+ test(rso[1]);
+ test(rso[2]);
+ }
+
+ {
+ final short[] ssi = {1, 2, 3};
+ final int[] isi = {5, 6, 7, 8};
+ final long[] lsi = {10, 30, 20};
+
+ ShortSHolder sso = new ShortSHolder();
+ IntSHolder iso = new IntSHolder();
+ LongSHolder lso = new LongSHolder();
+ long[] rso;
+
+ rso = p.opShortIntLongS(ssi, isi, lsi, sso, iso, lso);
+ test(sso.value.length == 3);
+ test(sso.value[0] == 1);
+ test(sso.value[1] == 2);
+ test(sso.value[2] == 3);
+ test(iso.value.length == 4);
+ test(iso.value[0] == 8);
+ test(iso.value[1] == 7);
+ test(iso.value[2] == 6);
+ test(iso.value[3] == 5);
+ test(lso.value.length == 6);
+ test(lso.value[0] == 10);
+ test(lso.value[1] == 30);
+ test(lso.value[2] == 20);
+ test(lso.value[3] == 10);
+ test(lso.value[4] == 30);
+ test(lso.value[5] == 20);
+ test(rso.length == 3);
+ test(rso[0] == 10);
+ test(rso[1] == 30);
+ test(rso[2] == 20);
+ }
+
+ {
+ final float[] fsi = {3.14f, 1.11f};
+ final double[] dsi = {1.1E10, 1.2E10, 1.3E10};
+
+ FloatSHolder fso = new FloatSHolder();
+ DoubleSHolder dso = new DoubleSHolder();
+ double[] rso;
+
+ rso = p.opFloatDoubleS(fsi, dsi, fso, dso);
+ test(fso.value.length == 2);
+ test(fso.value[0] == 3.14f);
+ test(fso.value[1] == 1.11f);
+ test(dso.value.length == 3);
+ test(dso.value[0] == 1.3E10);
+ test(dso.value[1] == 1.2E10);
+ test(dso.value[2] == 1.1E10);
+ test(rso.length == 5);
+ test(rso[0] == 1.1E10);
+ test(rso[1] == 1.2E10);
+ test(rso[2] == 1.3E10);
+ test((float) rso[3] == 3.14f);
+ test((float) rso[4] == 1.11f);
+ }
+
+ {
+ final String[] ssi1 = {"abc", "de", "fghi"};
+ final String[] ssi2 = {"xyz"};
+
+ StringSHolder sso = new StringSHolder();
+ String[] rso;
+
+ rso = p.opStringS(ssi1, ssi2, sso);
+ test(sso.value.length == 4);
+ test(sso.value[0].equals("abc"));
+ test(sso.value[1].equals("de"));
+ test(sso.value[2].equals("fghi"));
+ test(sso.value[3].equals("xyz"));
+ test(rso.length == 3);
+ test(rso[0].equals("fghi"));
+ test(rso[1].equals("de"));
+ test(rso[2].equals("abc"));
+ }
+
+ {
+ final byte[][] bsi1 =
+ {
+ {(byte) 0x01, (byte) 0x11, (byte) 0x12},
+ {(byte) 0xff}
+ };
+ final byte[][] bsi2 =
+ {
+ {(byte) 0x0e},
+ {(byte) 0xf2, (byte) 0xf1}
+ };
+
+ ByteSSHolder bso = new ByteSSHolder();
+ byte[][] rso;
+
+ rso = p.opByteSS(bsi1, bsi2, bso);
+ test(bso.value.length == 2);
+ test(bso.value[0].length == 1);
+ test(bso.value[0][0] == (byte) 0xff);
+ test(bso.value[1].length == 3);
+ test(bso.value[1][0] == (byte) 0x01);
+ test(bso.value[1][1] == (byte) 0x11);
+ test(bso.value[1][2] == (byte) 0x12);
+ test(rso.length == 4);
+ test(rso[0].length == 3);
+ test(rso[0][0] == (byte) 0x01);
+ test(rso[0][1] == (byte) 0x11);
+ test(rso[0][2] == (byte) 0x12);
+ test(rso[1].length == 1);
+ test(rso[1][0] == (byte) 0xff);
+ test(rso[2].length == 1);
+ test(rso[2][0] == (byte) 0x0e);
+ test(rso[3].length == 2);
+ test(rso[3][0] == (byte) 0xf2);
+ test(rso[3][1] == (byte) 0xf1);
+ }
+
+ {
+ final boolean[][] bsi1 =
+ {
+ {true},
+ {false},
+ {true, true}
+ };
+
+ final boolean[][] bsi2 =
+ {
+ {false, false, true}
+ };
+
+ BoolSSHolder bso = new BoolSSHolder();
+ boolean[][] rso;
+
+ rso = p.opBoolSS(bsi1, bsi2, bso);
+ test(bso.value.length == 4);
+ test(bso.value[0].length == 1);
+ test(bso.value[0][0]);
+ test(bso.value[1].length == 1);
+ test(!bso.value[1][0]);
+ test(bso.value[2].length == 2);
+ test(bso.value[2][0]);
+ test(bso.value[2][1]);
+ test(bso.value[3].length == 3);
+ test(!bso.value[3][0]);
+ test(!bso.value[3][1]);
+ test(bso.value[3][2]);
+ test(rso.length == 3);
+ test(rso[0].length == 2);
+ test(rso[0][0]);
+ test(rso[0][1]);
+ test(rso[1].length == 1);
+ test(!rso[1][0]);
+ test(rso[2].length == 1);
+ test(rso[2][0]);
+ }
+
+ {
+ final short[][] ssi =
+ {
+ {1, 2, 5},
+ {13},
+ {}
+ };
+ final int[][] isi =
+ {
+ {24, 98},
+ {42}
+ };
+ final long[][] lsi =
+ {
+ {496, 1729},
+ };
+
+ ShortSSHolder sso = new ShortSSHolder();
+ IntSSHolder iso = new IntSSHolder();
+ LongSSHolder lso = new LongSSHolder();
+ long[][] rso;
+
+ rso = p.opShortIntLongSS(ssi, isi, lsi, sso, iso, lso);
+ test(rso.length == 1);
+ test(rso[0].length == 2);
+ test(rso[0][0] == 496);
+ test(rso[0][1] == 1729);
+ test(sso.value.length == 3);
+ test(sso.value[0].length == 3);
+ test(sso.value[0][0] == 1);
+ test(sso.value[0][1] == 2);
+ test(sso.value[0][2] == 5);
+ test(sso.value[1].length == 1);
+ test(sso.value[1][0] == 13);
+ test(sso.value[2].length == 0);
+ test(iso.value.length == 2);
+ test(iso.value[0].length == 1);
+ test(iso.value[0][0] == 42);
+ test(iso.value[1].length == 2);
+ test(iso.value[1][0] == 24);
+ test(iso.value[1][1] == 98);
+ test(lso.value.length == 2);
+ test(lso.value[0].length == 2);
+ test(lso.value[0][0] == 496);
+ test(lso.value[0][1] == 1729);
+ test(lso.value[1].length == 2);
+ test(lso.value[1][0] == 496);
+ test(lso.value[1][1] == 1729);
+ }
+
+ {
+ final float[][] fsi =
+ {
+ {3.14f},
+ {1.11f},
+ {},
+ };
+ final double[][] dsi =
+ {
+ {1.1E10, 1.2E10, 1.3E10}
+ };
+
+ FloatSSHolder fso = new FloatSSHolder();
+ DoubleSSHolder dso = new DoubleSSHolder();
+ double[][] rso;
+
+ rso = p.opFloatDoubleSS(fsi, dsi, fso, dso);
+ test(fso.value.length == 3);
+ test(fso.value[0].length == 1);
+ test(fso.value[0][0] == 3.14f);
+ test(fso.value[1].length == 1);
+ test(fso.value[1][0] == 1.11f);
+ test(fso.value[2].length == 0);
+ test(dso.value.length == 1);
+ test(dso.value[0].length == 3);
+ test(dso.value[0][0] == 1.1E10);
+ test(dso.value[0][1] == 1.2E10);
+ test(dso.value[0][2] == 1.3E10);
+ test(rso.length == 2);
+ test(rso[0].length == 3);
+ test(rso[0][0] == 1.1E10);
+ test(rso[0][1] == 1.2E10);
+ test(rso[0][2] == 1.3E10);
+ test(rso[1].length == 3);
+ test(rso[1][0] == 1.1E10);
+ test(rso[1][1] == 1.2E10);
+ test(rso[1][2] == 1.3E10);
+ }
+
+ {
+ final String[][] ssi1 =
+ {
+ {"abc"},
+ {"de", "fghi"}
+ };
+ final String[][] ssi2 =
+ {
+ {},
+ {},
+ {"xyz"}
+ };
+
+ StringSSHolder sso = new StringSSHolder();
+ String[][] rso;
+
+ rso = p.opStringSS(ssi1, ssi2, sso);
+ test(sso.value.length == 5);
+ test(sso.value[0].length == 1);
+ test(sso.value[0][0].equals("abc"));
+ test(sso.value[1].length == 2);
+ test(sso.value[1][0].equals("de"));
+ test(sso.value[1][1].equals("fghi"));
+ test(sso.value[2].length == 0);
+ test(sso.value[3].length == 0);
+ test(sso.value[4].length == 1);
+ test(sso.value[4][0].equals("xyz"));
+ test(rso.length == 3);
+ test(rso[0].length == 1);
+ test(rso[0][0].equals("xyz"));
+ test(rso[1].length == 0);
+ test(rso[2].length == 0);
+ }
+
+ {
+ final String[][][] sssi1 =
+ {
+ {
+ {
+ "abc", "de"
+ },
+ {
+ "xyz"
+ }
+ },
+ {
+ {
+ "hello"
+ }
+ }
+ };
+
+ final String[][][] sssi2 =
+ {
+ {
+ {
+ "", ""
+ },
+ {
+ "abcd"
+ }
+ },
+ {
+ {
+ ""
+ }
+ },
+ {
+ }
+ };
+
+ StringSSSHolder ssso = new StringSSSHolder();
+ String rsso[][][];
+
+ rsso = p.opStringSSS(sssi1, sssi2, ssso);
+ test(ssso.value.length == 5);
+ test(ssso.value[0].length == 2);
+ test(ssso.value[0][0].length == 2);
+ test(ssso.value[0][1].length == 1);
+ test(ssso.value[1].length == 1);
+ test(ssso.value[1][0].length == 1);
+ test(ssso.value[2].length == 2);
+ test(ssso.value[2][0].length == 2);
+ test(ssso.value[2][1].length == 1);
+ test(ssso.value[3].length == 1);
+ test(ssso.value[3][0].length == 1);
+ test(ssso.value[4].length == 0);
+ test(ssso.value[0][0][0].equals("abc"));
+ test(ssso.value[0][0][1].equals("de"));
+ test(ssso.value[0][1][0].equals("xyz"));
+ test(ssso.value[1][0][0].equals("hello"));
+ test(ssso.value[2][0][0].equals(""));
+ test(ssso.value[2][0][1].equals(""));
+ test(ssso.value[2][1][0].equals("abcd"));
+ test(ssso.value[3][0][0].equals(""));
+
+ test(rsso.length == 3);
+ test(rsso[0].length == 0);
+ test(rsso[1].length == 1);
+ test(rsso[1][0].length == 1);
+ test(rsso[2].length == 2);
+ test(rsso[2][0].length == 2);
+ test(rsso[2][1].length == 1);
+ test(rsso[1][0][0].equals(""));
+ test(rsso[2][0][0].equals(""));
+ test(rsso[2][0][1].equals(""));
+ test(rsso[2][1][0].equals("abcd"));
+ }
+
+ {
+ Map<Byte, Boolean> di1 = new HashMap<>();
+ di1.put((byte) 10, Boolean.TRUE);
+ di1.put((byte) 100, Boolean.FALSE);
+ Map<Byte, Boolean> di2 = new HashMap<>();
+ di2.put((byte) 10, Boolean.TRUE);
+ di2.put((byte) 11, Boolean.FALSE);
+ di2.put((byte) 101, Boolean.TRUE);
+
+ ByteBoolDHolder _do = new ByteBoolDHolder();
+ Map<Byte, Boolean> ro = p.opByteBoolD(di1, di2, _do);
+
+ test(_do.value.equals(di1));
+ test(ro.size() == 4);
+ test(ro.get((byte) 10));
+ test(!ro.get((byte) 11));
+ test(!ro.get((byte) 100));
+ test(ro.get((byte) 101));
+ }
+
+ {
+ Map<Short, Integer> di1 = new HashMap<>();
+ di1.put((short) 110, -1);
+ di1.put((short) 1100, 123123);
+ Map<Short, Integer> di2 = new HashMap<>();
+ di2.put((short) 110, -1);
+ di2.put((short) 111, -100);
+ di2.put((short) 1101, 0);
+
+ ShortIntDHolder _do = new ShortIntDHolder();
+ Map<Short, Integer> ro = p.opShortIntD(di1, di2, _do);
+
+ test(_do.value.equals(di1));
+ test(ro.size() == 4);
+ test(ro.get((short) 110) == -1);
+ test(ro.get((short) 111) == -100);
+ test(ro.get((short) 1100) == 123123);
+ test(ro.get((short) 1101) == 0);
+ }
+
+ {
+ Map<Long, Float> di1 = new HashMap<>();
+ di1.put(999999110L, -1.1f);
+ di1.put(999999111L, 123123.2f);
+ Map<Long, Float> di2 = new HashMap<>();
+ di2.put(999999110L, -1.1f);
+ di2.put(999999120L, -100.4f);
+ di2.put(999999130L, 0.5f);
+
+ LongFloatDHolder _do = new LongFloatDHolder();
+ Map<Long, Float> ro = p.opLongFloatD(di1, di2, _do);
+
+ test(_do.value.equals(di1));
+ test(ro.size() == 4);
+ test(ro.get(999999110L) == -1.1f);
+ test(ro.get(999999120L) == -100.4f);
+ test(ro.get(999999111L) == 123123.2f);
+ test(ro.get(999999130L) == 0.5f);
+ }
+
+ {
+ Map<String, String> di1 = new HashMap<>();
+ di1.put("foo", "abc -1.1");
+ di1.put("bar", "abc 123123.2");
+ Map<String, String> di2 = new HashMap<>();
+ di2.put("foo", "abc -1.1");
+ di2.put("FOO", "abc -100.4");
+ di2.put("BAR", "abc 0.5");
+
+ StringStringDHolder _do = new StringStringDHolder();
+ Map<String, String> ro = p.opStringStringD(di1, di2, _do);
+
+ test(_do.value.equals(di1));
+ test(ro.size() == 4);
+ test(ro.get("foo").equals("abc -1.1"));
+ test(ro.get("FOO").equals("abc -100.4"));
+ test(ro.get("bar").equals("abc 123123.2"));
+ test(ro.get("BAR").equals("abc 0.5"));
+ }
+
+ {
+ Map<String, MyEnum> di1 = new HashMap<>();
+ di1.put("abc", MyEnum.enum1);
+ di1.put("", MyEnum.enum2);
+ Map<String, MyEnum> di2 = new HashMap<>();
+ di2.put("abc", MyEnum.enum1);
+ di2.put("qwerty", MyEnum.enum3);
+ di2.put("Hello!!", MyEnum.enum2);
+
+ StringMyEnumDHolder _do = new StringMyEnumDHolder();
+ Map<String, MyEnum> ro = p.opStringMyEnumD(di1, di2, _do);
+
+ test(_do.value.equals(di1));
+ test(ro.size() == 4);
+ test(ro.get("abc") == MyEnum.enum1);
+ test(ro.get("qwerty") == MyEnum.enum3);
+ test(ro.get("") == MyEnum.enum2);
+ test(ro.get("Hello!!") == MyEnum.enum2);
+ }
+
+ {
+ Map<MyEnum, String> di1 = new HashMap<>();
+ di1.put(MyEnum.enum1, "abc");
+ Map<MyEnum, String> di2 = new HashMap<>();
+ di2.put(MyEnum.enum2, "Hello!!");
+ di2.put(MyEnum.enum3, "qwerty");
+
+ MyEnumStringDHolder _do = new MyEnumStringDHolder();
+ Map<MyEnum, String> ro = p.opMyEnumStringD(di1, di2, _do);
+
+ test(_do.value.equals(di1));
+ test(ro.size() == 3);
+ test(ro.get(MyEnum.enum1).equals("abc"));
+ test(ro.get(MyEnum.enum2).equals("Hello!!"));
+ test(ro.get(MyEnum.enum3).equals("qwerty"));
+ }
+
+ {
+ MyStruct s11 = new MyStruct(1, 1);
+ MyStruct s12 = new MyStruct(1, 2);
+ Map<MyStruct, MyEnum> di1 = new HashMap<>();
+ di1.put(s11, MyEnum.enum1);
+ di1.put(s12, MyEnum.enum2);
+
+ MyStruct s22 = new MyStruct(2, 2);
+ MyStruct s23 = new MyStruct(2, 3);
+ Map<MyStruct, MyEnum> di2 = new HashMap<>();
+ di2.put(s11, MyEnum.enum1);
+ di2.put(s22, MyEnum.enum3);
+ di2.put(s23, MyEnum.enum2);
+
+ MyStructMyEnumDHolder _do = new MyStructMyEnumDHolder();
+ Map<MyStruct, MyEnum> ro = p.opMyStructMyEnumD(di1, di2, _do);
+
+ test(_do.value.equals(di1));
+ test(ro.size() == 4);
+ test(ro.get(s11) == MyEnum.enum1);
+ test(ro.get(s12) == MyEnum.enum2);
+ test(ro.get(s22) == MyEnum.enum3);
+ test(ro.get(s23) == MyEnum.enum2);
+ }
+
+ {
+ List<Map<Byte, Boolean>> dsi1 = new ArrayList<>();
+ List<Map<Byte, Boolean>> dsi2 = new ArrayList<>();
+
+ Map<Byte, Boolean> di1 = new HashMap<>();
+ di1.put((byte) 10, Boolean.TRUE);
+ di1.put((byte) 100, Boolean.FALSE);
+ Map<Byte, Boolean> di2 = new HashMap<>();
+ di2.put((byte) 10, Boolean.TRUE);
+ di2.put((byte) 11, Boolean.FALSE);
+ di2.put((byte) 101, Boolean.TRUE);
+ Map<Byte, Boolean> di3 = new HashMap<>();
+ di3.put((byte) 100, Boolean.FALSE);
+ di3.put((byte) 101, Boolean.FALSE);
+
+ dsi1.add(di1);
+ dsi1.add(di2);
+ dsi2.add(di3);
+
+ ByteBoolDSHolder _do = new ByteBoolDSHolder();
+ List<Map<Byte, Boolean>> ro = p.opByteBoolDS(dsi1, dsi2, _do);
+
+ test(ro.size() == 2);
+ test(ro.get(0).size() == 3);
+ test(ro.get(0).get((byte) 10));
+ test(!ro.get(0).get((byte) 11));
+ test(ro.get(0).get((byte) 101));
+ test(ro.get(1).size() == 2);
+ test(ro.get(1).get((byte) 10));
+ test(!ro.get(1).get((byte) 100));
+
+ test(_do.value.size() == 3);
+ test(_do.value.get(0).size() == 2);
+ test(!_do.value.get(0).get((byte) 100));
+ test(!_do.value.get(0).get((byte) 101));
+ test(_do.value.get(1).size() == 2);
+ test(_do.value.get(1).get((byte) 10));
+ test(!_do.value.get(1).get((byte) 100));
+ test(_do.value.get(2).size() == 3);
+ test(_do.value.get(2).get((byte) 10));
+ test(!_do.value.get(2).get((byte) 11));
+ test(_do.value.get(2).get((byte) 101));
+ }
+
+ {
+ List<Map<Short, Integer>> dsi1 = new ArrayList<>();
+ List<Map<Short, Integer>> dsi2 = new ArrayList<>();
+
+ Map<Short, Integer> di1 = new HashMap<>();
+ di1.put((short) 110, -1);
+ di1.put((short) 1100, 123123);
+ Map<Short, Integer> di2 = new HashMap<>();
+ di2.put((short) 110, -1);
+ di2.put((short) 111, -100);
+ di2.put((short) 1101, 0);
+ Map<Short, Integer> di3 = new HashMap<>();
+ di3.put((short) 100, -1001);
+
+ dsi1.add(di1);
+ dsi1.add(di2);
+ dsi2.add(di3);
+
+ ShortIntDSHolder _do = new ShortIntDSHolder();
+ List<Map<Short, Integer>> ro = p.opShortIntDS(dsi1, dsi2, _do);
+
+ test(ro.size() == 2);
+ test(ro.get(0).size() == 3);
+ test(ro.get(0).get((short) 110) == -1);
+ test(ro.get(0).get((short) 111) == -100);
+ test(ro.get(0).get((short) 1101) == 0);
+ test(ro.get(1).size() == 2);
+ test(ro.get(1).get((short) 110) == -1);
+ test(ro.get(1).get((short) 1100) == 123123);
+
+ test(_do.value.size() == 3);
+ test(_do.value.get(0).size() == 1);
+ test(_do.value.get(0).get((short) 100) == -1001);
+ test(_do.value.get(1).size() == 2);
+ test(_do.value.get(1).get((short) 110) == -1);
+ test(_do.value.get(1).get((short) 1100) == 123123);
+ test(_do.value.get(2).size() == 3);
+ test(_do.value.get(2).get((short) 110) == -1);
+ test(_do.value.get(2).get((short) 111) == -100);
+ test(_do.value.get(2).get((short) 1101) == 0);
+ }
+
+ {
+ List<Map<Long, Float>> dsi1 = new ArrayList<>();
+ List<Map<Long, Float>> dsi2 = new ArrayList<>();
+
+ Map<Long, Float> di1 = new HashMap<>();
+ di1.put(999999110L, new Float(-1.1));
+ di1.put(999999111L, new Float(123123.2));
+ Map<Long, Float> di2 = new HashMap<>();
+ di2.put(999999110L, new Float(-1.1));
+ di2.put(999999120L, new Float(-100.4));
+ di2.put(999999130L, new Float(0.5));
+ Map<Long, Float> di3 = new HashMap<>();
+ di3.put(999999140L, new Float(3.14));
+
+ dsi1.add(di1);
+ dsi1.add(di2);
+ dsi2.add(di3);
+
+ LongFloatDSHolder _do = new LongFloatDSHolder();
+ List<Map<Long, Float>> ro = p.opLongFloatDS(dsi1, dsi2, _do);
+
+ test(ro.size() == 2);
+ test(ro.get(0).size() == 3);
+ test(ro.get(0).get(999999110L) == -1.1f);
+ test(ro.get(0).get(999999120L) == -100.4f);
+ test(ro.get(0).get(999999130L) == 0.5f);
+ test(ro.get(1).size() == 2);
+ test(ro.get(1).get(999999110L) == -1.1f);
+ test(ro.get(1).get(999999111L) == 123123.2f);
+
+ test(_do.value.size() == 3);
+ test(_do.value.get(0).size() == 1);
+ test(_do.value.get(0).get(999999140L) == 3.14f);
+ test(_do.value.get(1).size() == 2);
+ test(_do.value.get(1).get(999999110L) == -1.1f);
+ test(_do.value.get(1).get(999999111L) == 123123.2f);
+ test(_do.value.get(2).size() == 3);
+ test(_do.value.get(2).get(999999110L) == -1.1f);
+ test(_do.value.get(2).get(999999120L) == -100.4f);
+ test(_do.value.get(2).get(999999130L) == 0.5f);
+ }
+
+ {
+ List<Map<String, String>> dsi1 = new ArrayList<>();
+ List<Map<String, String>> dsi2 = new ArrayList<>();
+
+ java.util.Map<String, String> di1 = new HashMap<>();
+ di1.put("foo", "abc -1.1");
+ di1.put("bar", "abc 123123.2");
+ java.util.Map<String, String> di2 = new HashMap<>();
+ di2.put("foo", "abc -1.1");
+ di2.put("FOO", "abc -100.4");
+ di2.put("BAR", "abc 0.5");
+ java.util.Map<String, String> di3 = new HashMap<>();
+ di3.put("f00", "ABC -3.14");
+
+ dsi1.add(di1);
+ dsi1.add(di2);
+ dsi2.add(di3);
+
+ StringStringDSHolder _do = new StringStringDSHolder();
+ List<Map<String, String>> ro = p.opStringStringDS(dsi1, dsi2, _do);
+
+ test(ro.size() == 2);
+ test(ro.get(0).size() == 3);
+ test(ro.get(0).get("foo").equals("abc -1.1"));
+ test(ro.get(0).get("FOO").equals("abc -100.4"));
+ test(ro.get(0).get("BAR").equals("abc 0.5"));
+ test(ro.get(1).size() == 2);
+ test(ro.get(1).get("foo").equals("abc -1.1"));
+ test(ro.get(1).get("bar").equals("abc 123123.2"));
+
+ test(_do.value.size() == 3);
+ test(_do.value.get(0).size() == 1);
+ test(_do.value.get(0).get("f00").equals("ABC -3.14"));
+ test(_do.value.get(1).size() == 2);
+ test(_do.value.get(1).get("foo").equals("abc -1.1"));
+ test(_do.value.get(1).get("bar").equals("abc 123123.2"));
+ test(_do.value.get(2).size() == 3);
+ test(_do.value.get(2).get("foo").equals("abc -1.1"));
+ test(_do.value.get(2).get("FOO").equals("abc -100.4"));
+ test(_do.value.get(2).get("BAR").equals("abc 0.5"));
+ }
+
+ {
+ List<Map<String, MyEnum>> dsi1 = new ArrayList<>();
+ List<Map<String, MyEnum>> dsi2 = new ArrayList<>();
+
+ java.util.Map<String, MyEnum> di1 = new HashMap<>();
+ di1.put("abc", MyEnum.enum1);
+ di1.put("", MyEnum.enum2);
+ java.util.Map<String, MyEnum> di2 = new HashMap<>();
+ di2.put("abc", MyEnum.enum1);
+ di2.put("qwerty", MyEnum.enum3);
+ di2.put("Hello!!", MyEnum.enum2);
+ java.util.Map<String, MyEnum> di3 = new HashMap<>();
+ di3.put("Goodbye", MyEnum.enum1);
+
+ dsi1.add(di1);
+ dsi1.add(di2);
+ dsi2.add(di3);
+
+ StringMyEnumDSHolder _do = new StringMyEnumDSHolder();
+ List<Map<String, MyEnum>> ro = p.opStringMyEnumDS(dsi1, dsi2, _do);
+
+ test(ro.size() == 2);
+ test(ro.get(0).size() == 3);
+ test(ro.get(0).get("abc") == MyEnum.enum1);
+ test(ro.get(0).get("qwerty") == MyEnum.enum3);
+ test(ro.get(0).get("Hello!!") == MyEnum.enum2);
+ test(ro.get(1).size() == 2);
+ test(ro.get(1).get("abc") == MyEnum.enum1);
+ test(ro.get(1).get("") == MyEnum.enum2);
+
+ test(_do.value.size() == 3);
+ test(_do.value.get(0).size() == 1);
+ test(_do.value.get(0).get("Goodbye") == MyEnum.enum1);
+ test(_do.value.get(1).size() == 2);
+ test(_do.value.get(1).get("abc") == MyEnum.enum1);
+ test(_do.value.get(1).get("") == MyEnum.enum2);
+ test(_do.value.get(2).size() == 3);
+ test(_do.value.get(2).get("abc") == MyEnum.enum1);
+ test(_do.value.get(2).get("qwerty") == MyEnum.enum3);
+ test(_do.value.get(2).get("Hello!!") == MyEnum.enum2);
+ }
+
+ {
+ List<Map<MyEnum, String>> dsi1 = new ArrayList<>();
+ List<Map<MyEnum, String>> dsi2 = new ArrayList<>();
+
+ java.util.Map<MyEnum, String> di1 = new HashMap<>();
+ di1.put(MyEnum.enum1, "abc");
+ java.util.Map<MyEnum, String> di2 = new HashMap<>();
+ di2.put(MyEnum.enum2, "Hello!!");
+ di2.put(MyEnum.enum3, "qwerty");
+ java.util.Map<MyEnum, String> di3 = new HashMap<>();
+ di3.put(MyEnum.enum1, "Goodbye");
+
+ dsi1.add(di1);
+ dsi1.add(di2);
+ dsi2.add(di3);
+
+ MyEnumStringDSHolder _do = new MyEnumStringDSHolder();
+ List<Map<MyEnum, String>> ro = p.opMyEnumStringDS(dsi1, dsi2, _do);
+
+ test(ro.size() == 2);
+ test(ro.get(0).size() == 2);
+ test(ro.get(0).get(MyEnum.enum2).equals("Hello!!"));
+ test(ro.get(0).get(MyEnum.enum3).equals("qwerty"));
+ test(ro.get(1).size() == 1);
+ test(ro.get(1).get(MyEnum.enum1).equals("abc"));
+
+ test(_do.value.size() == 3);
+ test(_do.value.get(0).size() == 1);
+ test(_do.value.get(0).get(MyEnum.enum1).equals("Goodbye"));
+ test(_do.value.get(1).size() == 1);
+ test(_do.value.get(1).get(MyEnum.enum1).equals("abc"));
+ test(_do.value.get(2).size() == 2);
+ test(_do.value.get(2).get(MyEnum.enum2).equals("Hello!!"));
+ test(_do.value.get(2).get(MyEnum.enum3).equals("qwerty"));
+ }
+
+ {
+ List<Map<MyStruct, MyEnum>> dsi1 = new ArrayList<>();
+ List<Map<MyStruct, MyEnum>> dsi2 = new ArrayList<>();
+
+ MyStruct s11 = new MyStruct(1, 1);
+ MyStruct s12 = new MyStruct(1, 2);
+ java.util.Map<MyStruct, MyEnum> di1 = new HashMap<>();
+ di1.put(s11, MyEnum.enum1);
+ di1.put(s12, MyEnum.enum2);
+
+ MyStruct s22 = new MyStruct(2, 2);
+ MyStruct s23 = new MyStruct(2, 3);
+ java.util.Map<MyStruct, MyEnum> di2 = new HashMap<>();
+ di2.put(s11, MyEnum.enum1);
+ di2.put(s22, MyEnum.enum3);
+ di2.put(s23, MyEnum.enum2);
+
+ java.util.Map<MyStruct, MyEnum> di3 = new HashMap<>();
+ di3.put(s23, MyEnum.enum3);
+
+ dsi1.add(di1);
+ dsi1.add(di2);
+ dsi2.add(di3);
+
+ MyStructMyEnumDSHolder _do = new MyStructMyEnumDSHolder();
+ List<Map<MyStruct, MyEnum>> ro = p.opMyStructMyEnumDS(dsi1, dsi2, _do);
+
+ test(ro.size() == 2);
+ test(ro.get(0).size() == 3);
+ test(ro.get(0).get(s11) == MyEnum.enum1);
+ test(ro.get(0).get(s22) == MyEnum.enum3);
+ test(ro.get(0).get(s23) == MyEnum.enum2);
+ test(ro.get(1).size() == 2);
+ test(ro.get(1).get(s11) == MyEnum.enum1);
+ test(ro.get(1).get(s12) == MyEnum.enum2);
+
+ test(_do.value.size() == 3);
+ test(_do.value.get(0).size() == 1);
+ test(_do.value.get(0).get(s23) == MyEnum.enum3);
+ test(_do.value.get(1).size() == 2);
+ test(_do.value.get(1).get(s11) == MyEnum.enum1);
+ test(_do.value.get(1).get(s12) == MyEnum.enum2);
+ test(_do.value.get(2).size() == 3);
+ test(_do.value.get(2).get(s11) == MyEnum.enum1);
+ test(_do.value.get(2).get(s22) == MyEnum.enum3);
+ test(_do.value.get(2).get(s23) == MyEnum.enum2);
+ }
+
+ {
+ java.util.Map<Byte, byte[]> sdi1 = new java.util.HashMap<>();
+ java.util.Map<Byte, byte[]> sdi2 = new java.util.HashMap<>();
+
+ final byte[] si1 = {(byte) 0x01, (byte) 0x11};
+ final byte[] si2 = {(byte) 0x12};
+ final byte[] si3 = {(byte) 0xf2, (byte) 0xf3};
+
+ sdi1.put((byte) 0x01, si1);
+ sdi1.put((byte) 0x22, si2);
+ sdi2.put((byte) 0xf1, si3);
+
+ ByteByteSDHolder _do = new ByteByteSDHolder();
+ java.util.Map<Byte, byte[]> ro = p.opByteByteSD(sdi1, sdi2, _do);
+
+ test(_do.value.size() == 1);
+ test(_do.value.get((byte) 0xf1).length == 2);
+ test(_do.value.get((byte) 0xf1)[0] == (byte) 0xf2);
+ test(_do.value.get((byte) 0xf1)[1] == (byte) 0xf3);
+ test(ro.size() == 3);
+ test(ro.get((byte) 0x01).length == 2);
+ test(ro.get((byte) 0x01)[0] == (byte) 0x01);
+ test(ro.get((byte) 0x01)[1] == (byte) 0x11);
+ test(ro.get((byte) 0x22).length == 1);
+ test(ro.get((byte) 0x22)[0] == (byte) 0x12);
+ test(ro.get((byte) 0xf1).length == 2);
+ test(ro.get((byte) 0xf1)[0] == (byte) 0xf2);
+ test(ro.get((byte) 0xf1)[1] == (byte) 0xf3);
+ }
+
+ {
+ java.util.Map<Boolean, boolean[]> sdi1 = new java.util.HashMap<>();
+ java.util.Map<Boolean, boolean[]> sdi2 = new java.util.HashMap<>();
+
+ final boolean[] si1 = {true, false};
+ final boolean[] si2 = {false, true, true};
+
+ sdi1.put(false, si1);
+ sdi1.put(true, si2);
+ sdi2.put(false, si1);
+
+ BoolBoolSDHolder _do = new BoolBoolSDHolder();
+ java.util.Map<Boolean, boolean[]> ro = p.opBoolBoolSD(sdi1, sdi2, _do);
+
+ test(_do.value.size() == 1);
+ test(_do.value.get(false).length == 2);
+ test(_do.value.get(false)[0]);
+ test(!_do.value.get(false)[1]);
+ test(ro.size() == 2);
+ test(ro.get(false).length == 2);
+ test(ro.get(false)[0]);
+ test(!ro.get(false)[1]);
+ test(ro.get(true).length == 3);
+ test(!ro.get(true)[0]);
+ test(ro.get(true)[1]);
+ test(ro.get(true)[2]);
+ }
+
+ {
+ java.util.Map<Short, short[]> sdi1 = new java.util.HashMap<>();
+ java.util.Map<Short, short[]> sdi2 = new java.util.HashMap<>();
+
+ final short[] si1 = {1, 2, 3};
+ final short[] si2 = {4, 5};
+ final short[] si3 = {6, 7};
+
+ sdi1.put((short) 1, si1);
+ sdi1.put((short) 2, si2);
+ sdi2.put((short) 4, si3);
+
+ ShortShortSDHolder _do = new ShortShortSDHolder();
+ java.util.Map<Short, short[]> ro = p.opShortShortSD(sdi1, sdi2, _do);
+
+ test(_do.value.size() == 1);
+ test(_do.value.get((short) 4).length == 2);
+ test(_do.value.get((short) 4)[0] == 6);
+ test(_do.value.get((short) 4)[1] == 7);
+ test(ro.size() == 3);
+ test(ro.get((short) 1).length == 3);
+ test(ro.get((short) 1)[0] == 1);
+ test(ro.get((short) 1)[1] == 2);
+ test(ro.get((short) 1)[2] == 3);
+ test(ro.get((short) 2).length == 2);
+ test(ro.get((short) 2)[0] == 4);
+ test(ro.get((short) 2)[1] == 5);
+ test(ro.get((short) 4).length == 2);
+ test(ro.get((short) 4)[0] == 6);
+ test(ro.get((short) 4)[1] == 7);
+ }
+
+ {
+ java.util.Map<Integer, int[]> sdi1 = new java.util.HashMap<>();
+ java.util.Map<Integer, int[]> sdi2 = new java.util.HashMap<>();
+
+ final int[] si1 = {100, 200, 300};
+ final int[] si2 = {400, 500};
+ final int[] si3 = {600, 700};
+
+ sdi1.put(100, si1);
+ sdi1.put(200, si2);
+ sdi2.put(400, si3);
+
+ IntIntSDHolder _do = new IntIntSDHolder();
+ java.util.Map<Integer, int[]> ro = p.opIntIntSD(sdi1, sdi2, _do);
+
+ test(_do.value.size() == 1);
+ test(_do.value.get(400).length == 2);
+ test(_do.value.get(400)[0] == 600);
+ test(_do.value.get(400)[1] == 700);
+ test(ro.size() == 3);
+ test(ro.get(100).length == 3);
+ test(ro.get(100)[0] == 100);
+ test(ro.get(100)[1] == 200);
+ test(ro.get(100)[2] == 300);
+ test(ro.get(200).length == 2);
+ test(ro.get(200)[0] == 400);
+ test(ro.get(200)[1] == 500);
+ test(ro.get(400).length == 2);
+ test(ro.get(400)[0] == 600);
+ test(ro.get(400)[1] == 700);
+ }
+
+ {
+ java.util.Map<Long, long[]> sdi1 = new java.util.HashMap<>();
+ java.util.Map<Long, long[]> sdi2 = new java.util.HashMap<>();
+
+ final long[] si1 = {999999110L, 999999111L, 999999110L};
+ final long[] si2 = {999999120L, 999999130L};
+ final long[] si3 = {999999110L, 999999120L};
+
+ sdi1.put(999999990L, si1);
+ sdi1.put(999999991L, si2);
+ sdi2.put(999999992L, si3);
+
+ LongLongSDHolder _do = new LongLongSDHolder();
+ java.util.Map<Long, long[]> ro = p.opLongLongSD(sdi1, sdi2, _do);
+
+ test(_do.value.size() == 1);
+ test(_do.value.get(999999992L).length == 2);
+ test(_do.value.get(999999992L)[0] == 999999110L);
+ test(_do.value.get(999999992L)[1] == 999999120L);
+ test(ro.size() == 3);
+ test(ro.get(999999990L).length == 3);
+ test(ro.get(999999990L)[0] == 999999110L);
+ test(ro.get(999999990L)[1] == 999999111L);
+ test(ro.get(999999990L)[2] == 999999110L);
+ test(ro.get(999999991L).length == 2);
+ test(ro.get(999999991L)[0] == 999999120L);
+ test(ro.get(999999991L)[1] == 999999130L);
+ test(ro.get(999999992L).length == 2);
+ test(ro.get(999999992L)[0] == 999999110L);
+ test(ro.get(999999992L)[1] == 999999120L);
+ }
+
+ {
+ java.util.Map<String, float[]> sdi1 = new java.util.HashMap<>();
+ java.util.Map<String, float[]> sdi2 = new java.util.HashMap<>();
+
+ final float[] si1 = {-1.1f, 123123.2f, 100.0f};
+ final float[] si2 = {42.24f, -1.61f};
+ final float[] si3 = {-3.14f, 3.14f};
+
+ sdi1.put("abc", si1);
+ sdi1.put("ABC", si2);
+ sdi2.put("aBc", si3);
+
+ StringFloatSDHolder _do = new StringFloatSDHolder();
+ java.util.Map<String, float[]> ro = p.opStringFloatSD(sdi1, sdi2, _do);
+
+ test(_do.value.size() == 1);
+ test(_do.value.get("aBc").length == 2);
+ test(_do.value.get("aBc")[0] == -3.14f);
+ test(_do.value.get("aBc")[1] == 3.14f);
+ test(ro.size() == 3);
+ test(ro.get("abc").length == 3);
+ test(ro.get("abc")[0] == -1.1f);
+ test(ro.get("abc")[1] == 123123.2f);
+ test(ro.get("abc")[2] == 100.0f);
+ test(ro.get("ABC").length == 2);
+ test(ro.get("ABC")[0] == 42.24f);
+ test(ro.get("ABC")[1] == -1.61f);
+ test(ro.get("aBc").length == 2);
+ test(ro.get("aBc")[0] == -3.14f);
+ test(ro.get("aBc")[1] == 3.14f);
+ }
+
+ {
+ java.util.Map<String, double[]> sdi1 = new java.util.HashMap<>();
+ java.util.Map<String, double[]> sdi2 = new java.util.HashMap<>();
+
+ double[] si1 = new double[] { 1.1E10, 1.2E10, 1.3E10 };
+ double[] si2 = new double[] { 1.4E10, 1.5E10 };
+ double[] si3 = new double[] { 1.6E10, 1.7E10 };
+
+ sdi1.put("Hello!!", si1);
+ sdi1.put("Goodbye", si2);
+ sdi2.put("", si3);
+
+ StringDoubleSDHolder _do = new StringDoubleSDHolder();
+ java.util.Map<String, double[]> ro = p.opStringDoubleSD(sdi1, sdi2, _do);
+
+ test(_do.value.size() == 1);
+ test(_do.value.get("").length == 2);
+ test(_do.value.get("")[0] == 1.6E10);
+ test(_do.value.get("")[1] == 1.7E10);
+ test(ro.size()== 3);
+ test(ro.get("Hello!!").length == 3);
+ test(ro.get("Hello!!")[0] == 1.1E10);
+ test(ro.get("Hello!!")[1] == 1.2E10);
+ test(ro.get("Hello!!")[2] == 1.3E10);
+ test(ro.get("Goodbye").length == 2);
+ test(ro.get("Goodbye")[0] == 1.4E10);
+ test(ro.get("Goodbye")[1] == 1.5E10);
+ test(ro.get("").length== 2);
+ test(ro.get("")[0] == 1.6E10);
+ test(ro.get("")[1] == 1.7E10);
+ }
+
+ {
+ java.util.Map<String, String[]> sdi1 = new java.util.HashMap<String, String[]>();
+ java.util.Map<String, String[]> sdi2 = new java.util.HashMap<String, String[]>();
+
+ String[] si1 = new String[] { "abc", "de", "fghi" };
+ String[] si2 = new String[] { "xyz", "or" };
+ String[] si3 = new String[] { "and", "xor" };
+
+ sdi1.put("abc", si1);
+ sdi1.put("def", si2);
+ sdi2.put("ghi", si3);
+
+ StringStringSDHolder _do = new StringStringSDHolder();
+ java.util.Map<String, String[]> ro = p.opStringStringSD(sdi1, sdi2, _do);
+
+
+ test(_do.value.size() == 1);
+ test(_do.value.get("ghi").length== 2);
+ test(_do.value.get("ghi")[0].equals("and"));
+ test(_do.value.get("ghi")[1].equals("xor"));
+ test(ro.size()== 3);
+ test(ro.get("abc").length == 3);
+ test(ro.get("abc")[0].equals("abc"));
+ test(ro.get("abc")[1].equals("de"));
+ test(ro.get("abc")[2].equals("fghi"));
+ test(ro.get("def").length == 2);
+ test(ro.get("def")[0].equals("xyz"));
+ test(ro.get("def")[1].equals("or"));
+ test(ro.get("ghi").length == 2);
+ test(ro.get("ghi")[0].equals("and"));
+ test(ro.get("ghi")[1].equals("xor"));
+ }
+
+ {
+ java.util.Map<MyEnum, MyEnum[]> sdi1 = new java.util.HashMap<>();
+ java.util.Map<MyEnum, MyEnum[]> sdi2 = new java.util.HashMap<>();
+
+ final MyEnum[] si1 = new MyEnum[] { MyEnum.enum1, MyEnum.enum1, MyEnum.enum2 };
+ final MyEnum[] si2 = new MyEnum[] { MyEnum.enum1, MyEnum.enum2 };
+ final MyEnum[] si3 = new MyEnum[] { MyEnum.enum3, MyEnum.enum3 };
+
+ sdi1.put(MyEnum.enum3, si1);
+ sdi1.put(MyEnum.enum2, si2);
+ sdi2.put(MyEnum.enum1, si3);
+
+ MyEnumMyEnumSDHolder _do = new MyEnumMyEnumSDHolder();
+ java.util.Map<MyEnum, MyEnum[]> ro = p.opMyEnumMyEnumSD(sdi1, sdi2, _do);
+
+ test(_do.value.size() == 1);
+ test(_do.value.get(MyEnum.enum1).length == 2);
+ test(_do.value.get(MyEnum.enum1)[0] == MyEnum.enum3);
+ test(_do.value.get(MyEnum.enum1)[1] == MyEnum.enum3);
+ test(ro.size()== 3);
+ test(ro.get(MyEnum.enum3).length == 3);
+ test(ro.get(MyEnum.enum3)[0] == MyEnum.enum1);
+ test(ro.get(MyEnum.enum3)[1] == MyEnum.enum1);
+ test(ro.get(MyEnum.enum3)[2] == MyEnum.enum2);
+ test(ro.get(MyEnum.enum2).length == 2);
+ test(ro.get(MyEnum.enum2)[0] == MyEnum.enum1);
+ test(ro.get(MyEnum.enum2)[1] == MyEnum.enum2);
+ test(ro.get(MyEnum.enum1).length == 2);
+ test(ro.get(MyEnum.enum1)[0] == MyEnum.enum3);
+ test(ro.get(MyEnum.enum1)[1] == MyEnum.enum3);
+ }
+
+ {
+ int[] lengths = {0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000};
+
+ for(int l : lengths)
+ {
+ int[] s = new int[l];
+ for(int i = 0; i < l; ++i)
+ {
+ s[i] = i;
+ }
+ int[] r = p.opIntS(s);
+ test(r.length == l);
+ for(int j = 0; j < r.length; ++j)
+ {
+ test(r[j] == -j);
+ }
+ }
+ }
+
+ {
+ Map<String, String> ctx = new HashMap<>();
+ ctx.put("one", "ONE");
+ ctx.put("two", "TWO");
+ ctx.put("three", "THREE");
+ {
+ test(p.ice_getContext().isEmpty());
+ Map<String, String> r = p.opContext();
+ test(!r.equals(ctx));
+ }
+ {
+ Map<String, String> r = p.opContext(ctx);
+ test(p.ice_getContext().isEmpty());
+ test(r.equals(ctx));
+ }
+ {
+ MyClassPrx p2 = MyClassPrxHelper.checkedCast(p.ice_context(ctx));
+ test(p2.ice_getContext().equals(ctx));
+ Map<String, String> r = p2.opContext();
+ test(r.equals(ctx));
+ r = p2.opContext(ctx);
+ test(r.equals(ctx));
+ }
+ }
+
+ if(p.ice_getConnection() != null)
+ {
+ //
+ // Test implicit context propagation
+ //
+
+ String[] impls = {"Shared", "PerThread"};
+ for(int i = 0; i < 2; i++)
+ {
+ InitializationData initData = app.createInitializationData();
+ initData.properties = communicator.getProperties()._clone();
+ initData.properties.setProperty("Ice.ImplicitContext", impls[i]);
+
+ Communicator ic = app.initialize(initData);
+
+ Map<String, String> ctx = new HashMap<>();
+ ctx.put("one", "ONE");
+ ctx.put("two", "TWO");
+ ctx.put("three", "THREE");
+
+ MyClassPrx p3 = MyClassPrxHelper.uncheckedCast(ic.stringToProxy("test:default -p 12010"));
+
+ ic.getImplicitContext().setContext(ctx);
+ test(ic.getImplicitContext().getContext().equals(ctx));
+ test(p3.opContext().equals(ctx));
+
+ test(!ic.getImplicitContext().containsKey("zero"));
+ String r = ic.getImplicitContext().put("zero", "ZERO");
+ test(r.equals(""));
+ test(ic.getImplicitContext().containsKey("zero"));
+ test(ic.getImplicitContext().get("zero").equals("ZERO"));
+
+ ctx = ic.getImplicitContext().getContext();
+ test(p3.opContext().equals(ctx));
+
+ Map<String, String> prxContext = new HashMap<>();
+ prxContext.put("one", "UN");
+ prxContext.put("four", "QUATRE");
+
+ Map<String, String> combined = new HashMap<>(ctx);
+ combined.putAll(prxContext);
+ test(combined.get("one").equals("UN"));
+
+ p3 = MyClassPrxHelper.uncheckedCast(p3.ice_context(prxContext));
+
+ ic.getImplicitContext().setContext(null);
+ test(p3.opContext().equals(prxContext));
+
+ ic.getImplicitContext().setContext(ctx);
+ test(p3.opContext().equals(combined));
+
+ test(ic.getImplicitContext().remove("one").equals("ONE"));
+
+ if(impls[i].equals("PerThread"))
+ {
+ Thread thread = new PerThreadContextInvokeThread(
+ MyClassPrxHelper.uncheckedCast(p3.ice_context(null)));
+ thread.start();
+ try
+ {
+ thread.join();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ ic.destroy();
+ }
+ }
+
+ {
+ double d = 1278312346.0 / 13.0;
+ double[] ds = new double[5];
+ for(int i = 0; i < 5; i++)
+ {
+ ds[i] = d;
+ }
+ p.opDoubleMarshaling(d, ds);
+ }
+
+ p.opIdempotent();
+
+ p.opNonmutating();
+
+ test(p.opByte1((byte)0xFF) == (byte)0xFF);
+ test(p.opShort1((short)0x7FFF) == (short)0x7FFF);
+ test(p.opInt1(0x7FFFFFFF) == 0x7FFFFFFF);
+ //test(p.opLong1(0x7FFFFFFFFFFFFFFF) == 0x7FFFFFFFFFFFFFFF);
+ test(p.opFloat1(1.0f) == 1.0f);
+ test(p.opDouble1(1.0d) == 1.0d);
+ test(p.opString1("opString1").equals("opString1"));
+ test(p.opStringS1(null).length == 0);
+ test(p.opByteBoolD1(null).size() == 0);
+ test(p.opStringS2(null).length == 0);
+ test(p.opByteBoolD2(null).size() == 0);
+
+
+ MyDerivedClassPrx d = MyDerivedClassPrxHelper.uncheckedCast(p);
+ MyStruct1 s = new MyStruct1();
+ s.tesT = "Test.MyStruct1.s";
+ s.myClass = null;
+ s.myStruct1 = "Test.MyStruct1.myStruct1";
+ s = d.opMyStruct1(s);
+ test(s.tesT.equals("Test.MyStruct1.s"));
+ test(s.myClass == null);
+ test(s.myStruct1.equals("Test.MyStruct1.myStruct1"));
+ MyClass1 c = new MyClass1();
+ c.tesT = "Test.MyClass1.testT";
+ c.myClass = null;
+ c.myClass1 = "Test.MyClass1.myClass1";
+ c = d.opMyClass1(c);
+ test(c.tesT.equals("Test.MyClass1.testT"));
+ test(c.myClass == null);
+ test(c.myClass1.equals("Test.MyClass1.myClass1"));
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/operations/TwowaysAMI.java b/java-compat/test/src/main/java/test/Ice/operations/TwowaysAMI.java
new file mode 100644
index 00000000000..bd9701c27c5
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/operations/TwowaysAMI.java
@@ -0,0 +1,2936 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.operations;
+
+import Ice.LocalException;
+import test.Ice.operations.AMD.Test.*;
+import test.Ice.operations.Test.*;
+import test.Ice.operations.Test.AnotherStruct;
+import test.Ice.operations.Test.ByteBoolDSHolder;
+import test.Ice.operations.Test.Callback_MyClass_opBool;
+import test.Ice.operations.Test.Callback_MyClass_opBoolBoolSD;
+import test.Ice.operations.Test.Callback_MyClass_opBoolS;
+import test.Ice.operations.Test.Callback_MyClass_opBoolSS;
+import test.Ice.operations.Test.Callback_MyClass_opByte;
+import test.Ice.operations.Test.Callback_MyClass_opByteBoolD;
+import test.Ice.operations.Test.Callback_MyClass_opByteBoolDS;
+import test.Ice.operations.Test.Callback_MyClass_opByteByteSD;
+import test.Ice.operations.Test.Callback_MyClass_opByteS;
+import test.Ice.operations.Test.Callback_MyClass_opByteSS;
+import test.Ice.operations.Test.Callback_MyClass_opDoubleMarshaling;
+import test.Ice.operations.Test.Callback_MyClass_opFloatDouble;
+import test.Ice.operations.Test.Callback_MyClass_opFloatDoubleS;
+import test.Ice.operations.Test.Callback_MyClass_opFloatDoubleSS;
+import test.Ice.operations.Test.Callback_MyClass_opIdempotent;
+import test.Ice.operations.Test.Callback_MyClass_opIntIntSD;
+import test.Ice.operations.Test.Callback_MyClass_opIntS;
+import test.Ice.operations.Test.Callback_MyClass_opLongFloatD;
+import test.Ice.operations.Test.Callback_MyClass_opLongFloatDS;
+import test.Ice.operations.Test.Callback_MyClass_opLongLongSD;
+import test.Ice.operations.Test.Callback_MyClass_opMyClass;
+import test.Ice.operations.Test.Callback_MyClass_opMyEnum;
+import test.Ice.operations.Test.Callback_MyClass_opMyEnumMyEnumSD;
+import test.Ice.operations.Test.Callback_MyClass_opMyEnumStringD;
+import test.Ice.operations.Test.Callback_MyClass_opMyEnumStringDS;
+import test.Ice.operations.Test.Callback_MyClass_opMyStructMyEnumD;
+import test.Ice.operations.Test.Callback_MyClass_opMyStructMyEnumDS;
+import test.Ice.operations.Test.Callback_MyClass_opNonmutating;
+import test.Ice.operations.Test.Callback_MyClass_opShortIntD;
+import test.Ice.operations.Test.Callback_MyClass_opShortIntDS;
+import test.Ice.operations.Test.Callback_MyClass_opShortIntLong;
+import test.Ice.operations.Test.Callback_MyClass_opShortIntLongS;
+import test.Ice.operations.Test.Callback_MyClass_opShortIntLongSS;
+import test.Ice.operations.Test.Callback_MyClass_opShortShortSD;
+import test.Ice.operations.Test.Callback_MyClass_opString;
+import test.Ice.operations.Test.Callback_MyClass_opStringDoubleSD;
+import test.Ice.operations.Test.Callback_MyClass_opStringFloatSD;
+import test.Ice.operations.Test.Callback_MyClass_opStringMyEnumD;
+import test.Ice.operations.Test.Callback_MyClass_opStringMyEnumDS;
+import test.Ice.operations.Test.Callback_MyClass_opStringS;
+import test.Ice.operations.Test.Callback_MyClass_opStringSS;
+import test.Ice.operations.Test.Callback_MyClass_opStringSSS;
+import test.Ice.operations.Test.Callback_MyClass_opStringStringD;
+import test.Ice.operations.Test.Callback_MyClass_opStringStringDS;
+import test.Ice.operations.Test.Callback_MyClass_opStringStringSD;
+import test.Ice.operations.Test.Callback_MyClass_opStruct;
+import test.Ice.operations.Test.Callback_MyClass_opVoid;
+import test.Ice.operations.Test.Callback_MyDerivedClass_opDerived;
+import test.Ice.operations.Test.MyClass;
+import test.Ice.operations.Test.MyClassPrx;
+import test.Ice.operations.Test.MyClassPrxHelper;
+import test.Ice.operations.Test.MyDerivedClass;
+import test.Ice.operations.Test.MyDerivedClassPrx;
+import test.Ice.operations.Test.MyDerivedClassPrxHelper;
+import test.Ice.operations.Test.MyEnum;
+import test.Ice.operations.Test.MyStruct;
+import test.Ice.operations.Test.Structure;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+class TwowaysAMI
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private static class Callback
+ {
+ Callback()
+ {
+ _called = false;
+ }
+
+ public synchronized void check()
+ {
+ while(!_called)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ _called = false;
+ }
+
+ public synchronized void called()
+ {
+ assert(!_called);
+ _called = true;
+ notify();
+ }
+
+ private boolean _called;
+ }
+
+ private static class GenericCallback<T> extends Callback
+ {
+ public GenericCallback(T value)
+ {
+ _value = value;
+ }
+
+ public void response(T value)
+ {
+ _value = value;
+ _succeeded = true;
+ called();
+ }
+
+ public void exception(Ice.LocalException ex)
+ {
+ _succeeded = false;
+ called();
+ }
+
+ public boolean succeeded()
+ {
+ check();
+ return _succeeded;
+ }
+
+ public T value()
+ {
+ return _value;
+ }
+
+ private T _value;
+ private boolean _succeeded = false;
+ }
+
+ private static class pingI extends Ice.Callback_Object_ice_ping
+ {
+ @Override
+ public void response()
+ {
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class isAI extends Ice.Callback_Object_ice_isA
+ {
+ @Override
+ public void response(boolean r)
+ {
+ test(r);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class idI extends Ice.Callback_Object_ice_id
+ {
+ @Override
+ public void response(String id)
+ {
+ test(id.equals(MyDerivedClass.ice_staticId()));
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class idsI extends Ice.Callback_Object_ice_ids
+ {
+ @Override
+ public void response(String[] ids)
+ {
+ test(ids.length == 3);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opVoidI extends Callback_MyClass_opVoid
+ {
+ @Override
+ public void response()
+ {
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opByteI extends Callback_MyClass_opByte
+ {
+ @Override
+ public void response(byte r, byte b)
+ {
+ test(b == (byte)0xf0);
+ test(r == (byte)0xff);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opBoolI extends Callback_MyClass_opBool
+ {
+ @Override
+ public void response(boolean r, boolean b)
+ {
+ test(b);
+ test(!r);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opShortIntLongI extends Callback_MyClass_opShortIntLong
+ {
+ @Override
+ public void response(long r, short s, int i, long l)
+ {
+ test(s == 10);
+ test(i == 11);
+ test(l == 12);
+ test(r == 12);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opFloatDoubleI extends Callback_MyClass_opFloatDouble
+ {
+ @Override
+ public void response(double r, float f, double d)
+ {
+ test(f == 3.14f);
+ test(d == 1.1E10);
+ test(r == 1.1E10);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opStringI extends Callback_MyClass_opString
+ {
+ @Override
+ public void response(String r, String s)
+ {
+ test(s.equals("world hello"));
+ test(r.equals("hello world"));
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opMyEnumI extends Callback_MyClass_opMyEnum
+ {
+ @Override
+ public void response(MyEnum r, MyEnum e)
+ {
+ test(e == MyEnum.enum2);
+ test(r == MyEnum.enum3);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opMyClassI extends Callback_MyClass_opMyClass
+ {
+ opMyClassI(Ice.Communicator communicator)
+ {
+ _communicator = communicator;
+ }
+
+ @Override
+ public void response(MyClassPrx r, MyClassPrx c1, MyClassPrx c2)
+ {
+ test(c1.ice_getIdentity().equals(Ice.Util.stringToIdentity("test")));
+ test(c2.ice_getIdentity().equals(Ice.Util.stringToIdentity("noSuchIdentity")));
+ test(r.ice_getIdentity().equals(Ice.Util.stringToIdentity("test")));
+ // We can't do the callbacks below in connection serialization mode.
+ if(_communicator.getProperties().getPropertyAsInt("Ice.ThreadPool.Client.Serialize") == 0)
+ {
+ r.opVoid();
+ c1.opVoid();
+ try
+ {
+ c2.opVoid();
+ test(false);
+ }
+ catch(Ice.ObjectNotExistException ex)
+ {
+ }
+ }
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ private Ice.Communicator _communicator;
+ }
+
+ private static class opStructI extends Callback_MyClass_opStruct
+ {
+ opStructI(Ice.Communicator communicator)
+ {
+ _communicator = communicator;
+ }
+
+ @Override
+ public void response(Structure rso, Structure so)
+ {
+ test(rso.p == null);
+ test(rso.e == MyEnum.enum2);
+ test(rso.s.s.equals("def"));
+ test(so.e == MyEnum.enum3);
+ test(so.s.s.equals("a new string"));
+ // We can't do the callbacks below in connection serialization mode.
+ if(_communicator.getProperties().getPropertyAsInt("Ice.ThreadPool.Client.Serialize") == 0)
+ {
+ so.p.opVoid();
+ }
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ private Ice.Communicator _communicator;
+ }
+
+ private static class opByteSI extends Callback_MyClass_opByteS
+ {
+ @Override
+ public void response(byte[] rso, byte[] bso)
+ {
+ test(bso.length == 4);
+ test(bso[0] == (byte)0x22);
+ test(bso[1] == (byte)0x12);
+ test(bso[2] == (byte)0x11);
+ test(bso[3] == (byte)0x01);
+ test(rso.length == 8);
+ test(rso[0] == (byte)0x01);
+ test(rso[1] == (byte)0x11);
+ test(rso[2] == (byte)0x12);
+ test(rso[3] == (byte)0x22);
+ test(rso[4] == (byte)0xf1);
+ test(rso[5] == (byte)0xf2);
+ test(rso[6] == (byte)0xf3);
+ test(rso[7] == (byte)0xf4);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opBoolSI extends Callback_MyClass_opBoolS
+ {
+ @Override
+ public void response(boolean[] rso, boolean[] bso)
+ {
+ test(bso.length == 4);
+ test(bso[0]);
+ test(bso[1]);
+ test(!bso[2]);
+ test(!bso[3]);
+ test(rso.length == 3);
+ test(!rso[0]);
+ test(rso[1]);
+ test(rso[2]);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opShortIntLongSI extends Callback_MyClass_opShortIntLongS
+ {
+ @Override
+ public void response(long[] rso, short[] sso, int[] iso, long[] lso)
+ {
+ test(sso.length == 3);
+ test(sso[0] == 1);
+ test(sso[1] == 2);
+ test(sso[2] == 3);
+ test(iso.length == 4);
+ test(iso[0] == 8);
+ test(iso[1] == 7);
+ test(iso[2] == 6);
+ test(iso[3] == 5);
+ test(lso.length == 6);
+ test(lso[0] == 10);
+ test(lso[1] == 30);
+ test(lso[2] == 20);
+ test(lso[3] == 10);
+ test(lso[4] == 30);
+ test(lso[5] == 20);
+ test(rso.length == 3);
+ test(rso[0] == 10);
+ test(rso[1] == 30);
+ test(rso[2] == 20);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opFloatDoubleSI extends Callback_MyClass_opFloatDoubleS
+ {
+ @Override
+ public void response(double[] rso, float[] fso, double[] dso)
+ {
+ test(fso.length == 2);
+ test(fso[0] == 3.14f);
+ test(fso[1] == 1.11f);
+ test(dso.length == 3);
+ test(dso[0] == 1.3E10);
+ test(dso[1] == 1.2E10);
+ test(dso[2] == 1.1E10);
+ test(rso.length == 5);
+ test(rso[0] == 1.1E10);
+ test(rso[1] == 1.2E10);
+ test(rso[2] == 1.3E10);
+ test((float)rso[3] == 3.14f);
+ test((float)rso[4] == 1.11f);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opStringSI extends Callback_MyClass_opStringS
+ {
+ @Override
+ public void response(String[] rso, String[] sso)
+ {
+ test(sso.length == 4);
+ test(sso[0].equals("abc"));
+ test(sso[1].equals("de"));
+ test(sso[2].equals("fghi"));
+ test(sso[3].equals("xyz"));
+ test(rso.length == 3);
+ test(rso[0].equals("fghi"));
+ test(rso[1].equals("de"));
+ test(rso[2].equals("abc"));
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opByteSSI extends Callback_MyClass_opByteSS
+ {
+ @Override
+ public void response(byte[][] rso, byte[][] bso)
+ {
+ test(bso.length == 2);
+ test(bso[0].length == 1);
+ test(bso[0][0] == (byte)0xff);
+ test(bso[1].length == 3);
+ test(bso[1][0] == (byte)0x01);
+ test(bso[1][1] == (byte)0x11);
+ test(bso[1][2] == (byte)0x12);
+ test(rso.length == 4);
+ test(rso[0].length == 3);
+ test(rso[0][0] == (byte)0x01);
+ test(rso[0][1] == (byte)0x11);
+ test(rso[0][2] == (byte)0x12);
+ test(rso[1].length == 1);
+ test(rso[1][0] == (byte)0xff);
+ test(rso[2].length == 1);
+ test(rso[2][0] == (byte)0x0e);
+ test(rso[3].length == 2);
+ test(rso[3][0] == (byte)0xf2);
+ test(rso[3][1] == (byte)0xf1);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opBoolSSI extends Callback_MyClass_opBoolSS
+ {
+ @Override
+ public void
+ response(boolean[][] rso, boolean[][] bso)
+ {
+ test(bso.length == 4);
+ test(bso[0].length == 1);
+ test(bso[0][0]);
+ test(bso[1].length == 1);
+ test(!bso[1][0]);
+ test(bso[2].length == 2);
+ test(bso[2][0]);
+ test(bso[2][1]);
+ test(bso[3].length == 3);
+ test(!bso[3][0]);
+ test(!bso[3][1]);
+ test(bso[3][2]);
+ test(rso.length == 3);
+ test(rso[0].length == 2);
+ test(rso[0][0]);
+ test(rso[0][1]);
+ test(rso[1].length == 1);
+ test(!rso[1][0]);
+ test(rso[2].length == 1);
+ test(rso[2][0]);
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opShortIntLongSSI extends Callback_MyClass_opShortIntLongSS
+ {
+ @Override
+ public void
+ response(long[][] rso, short[][] sso, int[][] iso, long[][] lso)
+ {
+ test(rso.length == 1);
+ test(rso[0].length == 2);
+ test(rso[0][0] == 496);
+ test(rso[0][1] == 1729);
+ test(sso.length == 3);
+ test(sso[0].length == 3);
+ test(sso[0][0] == 1);
+ test(sso[0][1] == 2);
+ test(sso[0][2] == 5);
+ test(sso[1].length == 1);
+ test(sso[1][0] == 13);
+ test(sso[2].length == 0);
+ test(iso.length == 2);
+ test(iso[0].length == 1);
+ test(iso[0][0] == 42);
+ test(iso[1].length == 2);
+ test(iso[1][0] == 24);
+ test(iso[1][1] == 98);
+ test(lso.length == 2);
+ test(lso[0].length == 2);
+ test(lso[0][0] == 496);
+ test(lso[0][1] == 1729);
+ test(lso[1].length == 2);
+ test(lso[1][0] == 496);
+ test(lso[1][1] == 1729);
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opFloatDoubleSSI extends Callback_MyClass_opFloatDoubleSS
+ {
+ @Override
+ public void response(double[][] rso, float[][] fso, double[][] dso)
+ {
+ test(fso.length == 3);
+ test(fso[0].length == 1);
+ test(fso[0][0] == 3.14f);
+ test(fso[1].length == 1);
+ test(fso[1][0] == 1.11f);
+ test(fso[2].length == 0);
+ test(dso.length == 1);
+ test(dso[0].length == 3);
+ test(dso[0][0] == 1.1E10);
+ test(dso[0][1] == 1.2E10);
+ test(dso[0][2] == 1.3E10);
+ test(rso.length == 2);
+ test(rso[0].length == 3);
+ test(rso[0][0] == 1.1E10);
+ test(rso[0][1] == 1.2E10);
+ test(rso[0][2] == 1.3E10);
+ test(rso[1].length == 3);
+ test(rso[1][0] == 1.1E10);
+ test(rso[1][1] == 1.2E10);
+ test(rso[1][2] == 1.3E10);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opStringSSI extends Callback_MyClass_opStringSS
+ {
+ @Override
+ public void response(String[][] rso, String[][] sso)
+ {
+ test(sso.length == 5);
+ test(sso[0].length == 1);
+ test(sso[0][0].equals("abc"));
+ test(sso[1].length == 2);
+ test(sso[1][0].equals("de"));
+ test(sso[1][1].equals("fghi"));
+ test(sso[2].length == 0);
+ test(sso[3].length == 0);
+ test(sso[4].length == 1);
+ test(sso[4][0].equals("xyz"));
+ test(rso.length == 3);
+ test(rso[0].length == 1);
+ test(rso[0][0].equals("xyz"));
+ test(rso[1].length == 0);
+ test(rso[2].length == 0);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opStringSSSI extends Callback_MyClass_opStringSSS
+ {
+ @Override
+ public void response(String[][][] rsso, String[][][] ssso)
+ {
+ test(ssso.length == 5);
+ test(ssso[0].length == 2);
+ test(ssso[0][0].length == 2);
+ test(ssso[0][1].length == 1);
+ test(ssso[1].length == 1);
+ test(ssso[1][0].length == 1);
+ test(ssso[2].length == 2);
+ test(ssso[2][0].length == 2);
+ test(ssso[2][1].length == 1);
+ test(ssso[3].length == 1);
+ test(ssso[3][0].length == 1);
+ test(ssso[4].length == 0);
+ test(ssso[0][0][0].equals("abc"));
+ test(ssso[0][0][1].equals("de"));
+ test(ssso[0][1][0].equals("xyz"));
+ test(ssso[1][0][0].equals("hello"));
+ test(ssso[2][0][0].equals(""));
+ test(ssso[2][0][1].equals(""));
+ test(ssso[2][1][0].equals("abcd"));
+ test(ssso[3][0][0].equals(""));
+
+ test(rsso.length == 3);
+ test(rsso[0].length == 0);
+ test(rsso[1].length == 1);
+ test(rsso[1][0].length == 1);
+ test(rsso[2].length == 2);
+ test(rsso[2][0].length == 2);
+ test(rsso[2][1].length == 1);
+ test(rsso[1][0][0].equals(""));
+ test(rsso[2][0][0].equals(""));
+ test(rsso[2][0][1].equals(""));
+ test(rsso[2][1][0].equals("abcd"));
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opByteBoolDI extends Callback_MyClass_opByteBoolD
+ {
+ @Override
+ public void response(java.util.Map<Byte, Boolean> ro, java.util.Map<Byte, Boolean> _do)
+ {
+ java.util.Map<Byte, Boolean> di1 = new java.util.HashMap<>();
+ di1.put((byte)10, Boolean.TRUE);
+ di1.put((byte)100, Boolean.FALSE);
+ test(_do.equals(di1));
+ test(ro.size() == 4);
+ test(ro.get((byte) 10));
+ test(!ro.get((byte) 11));
+ test(!ro.get((byte) 100));
+ test(ro.get((byte) 101));
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opShortIntDI extends Callback_MyClass_opShortIntD
+ {
+ @Override
+ public void response(java.util.Map<Short, Integer> ro, java.util.Map<Short, Integer> _do)
+ {
+ java.util.Map<Short, Integer> di1 = new java.util.HashMap<>();
+ di1.put((short)110, -1);
+ di1.put((short)1100, 123123);
+ test(_do.equals(di1));
+ test(ro.size() == 4);
+ test(ro.get((short) 110) == -1);
+ test(ro.get((short) 111) == -100);
+ test(ro.get((short) 1100) == 123123);
+ test(ro.get((short) 1101) == 0);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opLongFloatDI extends Callback_MyClass_opLongFloatD
+ {
+ @Override
+ public void response(java.util.Map<Long, Float> ro, java.util.Map<Long, Float> _do)
+ {
+ java.util.Map<Long, Float> di1 = new java.util.HashMap<>();
+ di1.put(999999110L, -1.1f);
+ di1.put(999999111L, 123123.2f);
+ test(_do.equals(di1));
+ test(ro.size() == 4);
+ test(ro.get(999999110L) == -1.1f);
+ test(ro.get(999999120L) == -100.4f);
+ test(ro.get(999999111L) == 123123.2f);
+ test(ro.get(999999130L) == 0.5f);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opStringStringDI extends Callback_MyClass_opStringStringD
+ {
+ @Override
+ public void response(java.util.Map<String, String> ro, java.util.Map<String, String> _do)
+ {
+ java.util.Map<String, String> di1 = new java.util.HashMap<>();
+ di1.put("foo", "abc -1.1");
+ di1.put("bar", "abc 123123.2");
+ test(_do.equals(di1));
+ test(ro.size() == 4);
+ test(ro.get("foo").equals("abc -1.1"));
+ test(ro.get("FOO").equals("abc -100.4"));
+ test(ro.get("bar").equals("abc 123123.2"));
+ test(ro.get("BAR").equals("abc 0.5"));
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opStringMyEnumDI extends Callback_MyClass_opStringMyEnumD
+ {
+ @Override
+ public void response(java.util.Map<String, MyEnum> ro, java.util.Map<String, MyEnum> _do)
+ {
+ java.util.Map<String, MyEnum> di1 = new java.util.HashMap<>();
+ di1.put("abc", MyEnum.enum1);
+ di1.put("", MyEnum.enum2);
+ test(_do.equals(di1));
+ test(ro.size() == 4);
+ test(ro.get("abc") == MyEnum.enum1);
+ test(ro.get("qwerty") == MyEnum.enum3);
+ test(ro.get("") == MyEnum.enum2);
+ test(ro.get("Hello!!") == MyEnum.enum2);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opMyEnumStringDI extends Callback_MyClass_opMyEnumStringD
+ {
+ @Override
+ public void response(java.util.Map<MyEnum, String> ro, java.util.Map<MyEnum, String> _do)
+ {
+ java.util.Map<MyEnum, String> di1 = new java.util.HashMap<>();
+ di1.put(MyEnum.enum1, "abc");
+ test(_do.equals(di1));
+ test(ro.size() == 3);
+ test(ro.get(MyEnum.enum1).equals("abc"));
+ test(ro.get(MyEnum.enum2).equals("Hello!!"));
+ test(ro.get(MyEnum.enum3).equals("qwerty"));
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opMyStructMyEnumDI extends Callback_MyClass_opMyStructMyEnumD
+ {
+ @Override
+ public void response(java.util.Map<MyStruct, MyEnum> ro, java.util.Map<MyStruct, MyEnum> _do)
+ {
+ MyStruct s11 = new MyStruct(1, 1);
+ MyStruct s12 = new MyStruct(1, 2);
+ java.util.Map<MyStruct, MyEnum> di1 = new java.util.HashMap<>();
+ di1.put(s11, MyEnum.enum1);
+ di1.put(s12, MyEnum.enum2);
+ test(_do.equals(di1));
+ MyStruct s22 = new MyStruct(2, 2);
+ MyStruct s23 = new MyStruct(2, 3);
+ test(ro.size() == 4);
+ test(ro.get(s11) == MyEnum.enum1);
+ test(ro.get(s12) == MyEnum.enum2);
+ test(ro.get(s22) == MyEnum.enum3);
+ test(ro.get(s23) == MyEnum.enum2);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opByteBoolDS extends Callback_MyClass_opByteBoolDS
+ {
+
+ @Override
+ public void response(List<Map<Byte, Boolean>> ro, List<Map<Byte, Boolean>> _do)
+ {
+ test(ro.size() == 2);
+ test(ro.get(0).size() == 3);
+ test(ro.get(0).get((byte) 10));
+ test(!ro.get(0).get((byte) 11));
+ test(ro.get(0).get((byte) 101));
+ test(ro.get(1).size() == 2);
+ test(ro.get(1).get((byte) 10));
+ test(!ro.get(1).get((byte) 100));
+
+ test(_do.size() == 3);
+ test(_do.get(0).size() == 2);
+ test(!_do.get(0).get((byte) 100));
+ test(!_do.get(0).get((byte) 101));
+ test(_do.get(1).size() == 2);
+ test(_do.get(1).get((byte) 10));
+ test(!_do.get(1).get((byte) 100));
+ test(_do.get(2).size() == 3);
+ test(_do.get(2).get((byte) 10));
+ test(!_do.get(2).get((byte) 11));
+ test(_do.get(2).get((byte) 101));
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opShortIntDS extends Callback_MyClass_opShortIntDS
+ {
+
+ @Override
+ public void response(List<Map<Short, Integer>> ro, List<Map<Short, Integer>> _do)
+ {
+ test(ro.size() == 2);
+ test(ro.get(0).size() == 3);
+ test(ro.get(0).get((short) 110) == -1);
+ test(ro.get(0).get((short) 111) == -100);
+ test(ro.get(0).get((short) 1101) == 0);
+ test(ro.get(1).size() == 2);
+ test(ro.get(1).get((short) 110) == -1);
+ test(ro.get(1).get((short) 1100) == 123123);
+
+ test(_do.size() == 3);
+ test(_do.get(0).size() == 1);
+ test(_do.get(0).get((short) 100) == -1001);
+ test(_do.get(1).size() == 2);
+ test(_do.get(1).get((short) 110) == -1);
+ test(_do.get(1).get((short) 1100) == 123123);
+ test(_do.get(2).size() == 3);
+ test(_do.get(2).get((short) 110) == -1);
+ test(_do.get(2).get((short) 111) == -100);
+ test(_do.get(2).get((short) 1101) == 0);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opLongFloatDS extends Callback_MyClass_opLongFloatDS
+ {
+
+ @Override
+ public void response(List<Map<Long, Float>> ro, List<Map<Long, Float>> _do)
+ {
+ test(ro.size() == 2);
+ test(ro.get(0).size() == 3);
+ test(ro.get(0).get(999999110L) == -1.1f);
+ test(ro.get(0).get(999999120L) == -100.4f);
+ test(ro.get(0).get(999999130L) == 0.5f);
+ test(ro.get(1).size() == 2);
+ test(ro.get(1).get(999999110L) == -1.1f);
+ test(ro.get(1).get(999999111L) == 123123.2f);
+
+ test(_do.size() == 3);
+ test(_do.get(0).size() == 1);
+ test(_do.get(0).get(999999140L) == 3.14f);
+ test(_do.get(1).size() == 2);
+ test(_do.get(1).get(999999110L) == -1.1f);
+ test(_do.get(1).get(999999111L) == 123123.2f);
+ test(_do.get(2).size() == 3);
+ test(_do.get(2).get(999999110L) == -1.1f);
+ test(_do.get(2).get(999999120L) == -100.4f);
+ test(_do.get(2).get(999999130L) == 0.5f);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opStringStringDS extends Callback_MyClass_opStringStringDS
+ {
+
+ @Override
+ public void response(List<Map<String, String>> ro, List<Map<String, String>> _do)
+ {
+ test(ro.size() == 2);
+ test(ro.get(0).size() == 3);
+ test(ro.get(0).get("foo").equals("abc -1.1"));
+ test(ro.get(0).get("FOO").equals("abc -100.4"));
+ test(ro.get(0).get("BAR").equals("abc 0.5"));
+ test(ro.get(1).size() == 2);
+ test(ro.get(1).get("foo").equals("abc -1.1"));
+ test(ro.get(1).get("bar").equals("abc 123123.2"));
+
+ test(_do.size() == 3);
+ test(_do.get(0).size() == 1);
+ test(_do.get(0).get("f00").equals("ABC -3.14"));
+ test(_do.get(1).size() == 2);
+ test(_do.get(1).get("foo").equals("abc -1.1"));
+ test(_do.get(1).get("bar").equals("abc 123123.2"));
+ test(_do.get(2).size() == 3);
+ test(_do.get(2).get("foo").equals("abc -1.1"));
+ test(_do.get(2).get("FOO").equals("abc -100.4"));
+ test(_do.get(2).get("BAR").equals("abc 0.5"));
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opStringMyEnumDS extends Callback_MyClass_opStringMyEnumDS
+ {
+
+ @Override
+ public void response(List<Map<String, MyEnum>> ro, List<Map<String, MyEnum>> _do)
+ {
+ test(ro.size() == 2);
+ test(ro.get(0).size() == 3);
+ test(ro.get(0).get("abc") == MyEnum.enum1);
+ test(ro.get(0).get("qwerty") == MyEnum.enum3);
+ test(ro.get(0).get("Hello!!") == MyEnum.enum2);
+ test(ro.get(1).size() == 2);
+ test(ro.get(1).get("abc") == MyEnum.enum1);
+ test(ro.get(1).get("") == MyEnum.enum2);
+
+ test(_do.size() == 3);
+ test(_do.get(0).size() == 1);
+ test(_do.get(0).get("Goodbye") == MyEnum.enum1);
+ test(_do.get(1).size() == 2);
+ test(_do.get(1).get("abc") == MyEnum.enum1);
+ test(_do.get(1).get("") == MyEnum.enum2);
+ test(_do.get(2).size() == 3);
+ test(_do.get(2).get("abc") == MyEnum.enum1);
+ test(_do.get(2).get("qwerty") == MyEnum.enum3);
+ test(_do.get(2).get("Hello!!") == MyEnum.enum2);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opMyEnumStringDS extends Callback_MyClass_opMyEnumStringDS
+ {
+
+ @Override
+ public void response(List<Map<MyEnum, String>> ro, List<Map<MyEnum, String>> _do)
+ {
+ test(ro.size() == 2);
+ test(ro.get(0).size() == 2);
+ test(ro.get(0).get(MyEnum.enum2).equals("Hello!!"));
+ test(ro.get(0).get(MyEnum.enum3).equals("qwerty"));
+ test(ro.get(1).size() == 1);
+ test(ro.get(1).get(MyEnum.enum1).equals("abc"));
+
+ test(_do.size() == 3);
+ test(_do.get(0).size() == 1);
+ test(_do.get(0).get(MyEnum.enum1).equals("Goodbye"));
+ test(_do.get(1).size() == 1);
+ test(_do.get(1).get(MyEnum.enum1).equals("abc"));
+ test(_do.get(2).size() == 2);
+ test(_do.get(2).get(MyEnum.enum2).equals("Hello!!"));
+ test(_do.get(2).get(MyEnum.enum3).equals("qwerty"));
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opMyStructMyEnumDS extends Callback_MyClass_opMyStructMyEnumDS
+ {
+
+ @Override
+ public void response(List<Map<MyStruct, MyEnum>> ro, List<Map<MyStruct, MyEnum>> _do)
+ {
+ MyStruct s11 = new MyStruct(1, 1);
+ MyStruct s12 = new MyStruct(1, 2);
+ MyStruct s22 = new MyStruct(2, 2);
+ MyStruct s23 = new MyStruct(2, 3);
+
+ test(ro.size() == 2);
+ test(ro.get(0).size() == 3);
+ test(ro.get(0).get(s11) == MyEnum.enum1);
+ test(ro.get(0).get(s22) == MyEnum.enum3);
+ test(ro.get(0).get(s23) == MyEnum.enum2);
+ test(ro.get(1).size() == 2);
+ test(ro.get(1).get(s11) == MyEnum.enum1);
+ test(ro.get(1).get(s12) == MyEnum.enum2);
+
+ test(_do.size() == 3);
+ test(_do.get(0).size() == 1);
+ test(_do.get(0).get(s23) == MyEnum.enum3);
+ test(_do.get(1).size() == 2);
+ test(_do.get(1).get(s11) == MyEnum.enum1);
+ test(_do.get(1).get(s12) == MyEnum.enum2);
+ test(_do.get(2).size() == 3);
+ test(_do.get(2).get(s11) == MyEnum.enum1);
+ test(_do.get(2).get(s22) == MyEnum.enum3);
+ test(_do.get(2).get(s23) == MyEnum.enum2);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opByteByteSD extends Callback_MyClass_opByteByteSD
+ {
+
+ @Override
+ public void response(Map<Byte, byte[]> ro, Map<Byte, byte[]> _do)
+ {
+ test(_do.size() == 1);
+ test(_do.get((byte) 0xf1).length == 2);
+ test(_do.get((byte) 0xf1)[0] == (byte) 0xf2);
+ test(_do.get((byte) 0xf1)[1] == (byte) 0xf3);
+ test(ro.size() == 3);
+ test(ro.get((byte) 0x01).length == 2);
+ test(ro.get((byte) 0x01)[0] == (byte) 0x01);
+ test(ro.get((byte) 0x01)[1] == (byte) 0x11);
+ test(ro.get((byte) 0x22).length == 1);
+ test(ro.get((byte) 0x22)[0] == (byte) 0x12);
+ test(ro.get((byte) 0xf1).length == 2);
+ test(ro.get((byte) 0xf1)[0] == (byte) 0xf2);
+ test(ro.get((byte) 0xf1)[1] == (byte) 0xf3);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+ private static class opBoolBoolSD extends Callback_MyClass_opBoolBoolSD
+ {
+
+ @Override
+ public void response(Map<Boolean, boolean[]> ro, Map<Boolean, boolean[]> _do)
+ {
+ test(_do.size() == 1);
+ test(_do.get(false).length == 2);
+ test(_do.get(false)[0]);
+ test(!_do.get(false)[1]);
+ test(ro.size() == 2);
+ test(ro.get(false).length == 2);
+ test(ro.get(false)[0]);
+ test(!ro.get(false)[1]);
+ test(ro.get(true).length == 3);
+ test(!ro.get(true)[0]);
+ test(ro.get(true)[1]);
+ test(ro.get(true)[2]);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+ private static class opShortShortSD extends Callback_MyClass_opShortShortSD
+ {
+
+ @Override
+ public void response(Map<Short, short[]> ro, Map<Short, short[]> _do)
+ {
+ test(_do.size() == 1);
+ test(_do.get((short) 4).length == 2);
+ test(_do.get((short) 4)[0] == 6);
+ test(_do.get((short) 4)[1] == 7);
+ test(ro.size() == 3);
+ test(ro.get((short) 1).length == 3);
+ test(ro.get((short) 1)[0] == 1);
+ test(ro.get((short) 1)[1] == 2);
+ test(ro.get((short) 1)[2] == 3);
+ test(ro.get((short) 2).length == 2);
+ test(ro.get((short) 2)[0] == 4);
+ test(ro.get((short) 2)[1] == 5);
+ test(ro.get((short) 4).length == 2);
+ test(ro.get((short) 4)[0] == 6);
+ test(ro.get((short) 4)[1] == 7);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+ private static class opIntIntSD extends Callback_MyClass_opIntIntSD
+ {
+
+ @Override
+ public void response(Map<Integer, int[]> ro, Map<Integer, int[]> _do)
+ {
+ test(_do.size() == 1);
+ test(_do.get(400).length == 2);
+ test(_do.get(400)[0] == 600);
+ test(_do.get(400)[1] == 700);
+ test(ro.size() == 3);
+ test(ro.get(100).length == 3);
+ test(ro.get(100)[0] == 100);
+ test(ro.get(100)[1] == 200);
+ test(ro.get(100)[2] == 300);
+ test(ro.get(200).length == 2);
+ test(ro.get(200)[0] == 400);
+ test(ro.get(200)[1] == 500);
+ test(ro.get(400).length == 2);
+ test(ro.get(400)[0] == 600);
+ test(ro.get(400)[1] == 700);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+ private static class opLongLongSD extends Callback_MyClass_opLongLongSD
+ {
+
+ @Override
+ public void response(Map<Long, long[]> ro, Map<Long, long[]> _do)
+ {
+ test(_do.size() == 1);
+ test(_do.get(999999992L).length == 2);
+ test(_do.get(999999992L)[0] == 999999110L);
+ test(_do.get(999999992L)[1] == 999999120);
+ test(ro.size() == 3);
+ test(ro.get(999999990L).length == 3);
+ test(ro.get(999999990L)[0] == 999999110);
+ test(ro.get(999999990L)[1] == 999999111);
+ test(ro.get(999999990L)[2] == 999999110);
+ test(ro.get(999999991L).length == 2);
+ test(ro.get(999999991L)[0] == 999999120);
+ test(ro.get(999999991L)[1] == 999999130);
+ test(ro.get(999999992L).length == 2);
+ test(ro.get(999999992L)[0] == 999999110);
+ test(ro.get(999999992L)[1] == 999999120);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+ private static class opStringFloatSD extends Callback_MyClass_opStringFloatSD
+ {
+
+ @Override
+ public void response(Map<String, float[]> ro, Map<String, float[]> _do)
+ {
+ test(_do.size() == 1);
+ test(_do.get("aBc").length == 2);
+ test(_do.get("aBc")[0] == -3.14f);
+ test(_do.get("aBc")[1] == 3.14f);
+ test(ro.size() == 3);
+ test(ro.get("abc").length == 3);
+ test(ro.get("abc")[0] == -1.1f);
+ test(ro.get("abc")[1] == 123123.2f);
+ test(ro.get("abc")[2] == 100.0f);
+ test(ro.get("ABC").length == 2);
+ test(ro.get("ABC")[0] == 42.24f);
+ test(ro.get("ABC")[1] == -1.61f);
+ test(ro.get("aBc").length == 2);
+ test(ro.get("aBc")[0] == -3.14f);
+ test(ro.get("aBc")[1] == 3.14f);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+ private static class opStringDoubleSD extends Callback_MyClass_opStringDoubleSD
+ {
+
+ @Override
+ public void response(Map<String, double[]> ro, Map<String, double[]> _do)
+ {
+ test(_do.size() == 1);
+ test(_do.get("").length == 2);
+ test(_do.get("")[0] == 1.6E10);
+ test(_do.get("")[1] == 1.7E10);
+ test(ro.size()== 3);
+ test(ro.get("Hello!!").length == 3);
+ test(ro.get("Hello!!")[0] == 1.1E10);
+ test(ro.get("Hello!!")[1] == 1.2E10);
+ test(ro.get("Hello!!")[2] == 1.3E10);
+ test(ro.get("Goodbye").length == 2);
+ test(ro.get("Goodbye")[0] == 1.4E10);
+ test(ro.get("Goodbye")[1] == 1.5E10);
+ test(ro.get("").length== 2);
+ test(ro.get("")[0] == 1.6E10);
+ test(ro.get("")[1] == 1.7E10);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+ private static class opStringStringSD extends Callback_MyClass_opStringStringSD
+ {
+
+ @Override
+ public void response(Map<String, String[]> ro, Map<String, String[]> _do)
+ {
+ test(_do.size() == 1);
+ test(_do.get("ghi").length== 2);
+ test(_do.get("ghi")[0].equals("and"));
+ test(_do.get("ghi")[1].equals("xor"));
+ test(ro.size()== 3);
+ test(ro.get("abc").length == 3);
+ test(ro.get("abc")[0].equals("abc"));
+ test(ro.get("abc")[1].equals("de"));
+ test(ro.get("abc")[2].equals("fghi"));
+ test(ro.get("def").length == 2);
+ test(ro.get("def")[0].equals("xyz"));
+ test(ro.get("def")[1].equals("or"));
+ test(ro.get("ghi").length == 2);
+ test(ro.get("ghi")[0].equals("and"));
+ test(ro.get("ghi")[1].equals("xor"));
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+ private static class opMyEnumMyEnumSD extends Callback_MyClass_opMyEnumMyEnumSD
+ {
+
+ @Override
+ public void response(Map<MyEnum, MyEnum[]> ro, Map<MyEnum, MyEnum[]> _do)
+ {
+ test(_do.size() == 1);
+ test(_do.get(MyEnum.enum1).length == 2);
+ test(_do.get(MyEnum.enum1)[0] == MyEnum.enum3);
+ test(_do.get(MyEnum.enum1)[1] == MyEnum.enum3);
+ test(ro.size()== 3);
+ test(ro.get(MyEnum.enum3).length == 3);
+ test(ro.get(MyEnum.enum3)[0] == MyEnum.enum1);
+ test(ro.get(MyEnum.enum3)[1] == MyEnum.enum1);
+ test(ro.get(MyEnum.enum3)[2] == MyEnum.enum2);
+ test(ro.get(MyEnum.enum2).length == 2);
+ test(ro.get(MyEnum.enum2)[0] == MyEnum.enum1);
+ test(ro.get(MyEnum.enum2)[1] == MyEnum.enum2);
+ test(ro.get(MyEnum.enum1).length == 2);
+ test(ro.get(MyEnum.enum1)[0] == MyEnum.enum3);
+ test(ro.get(MyEnum.enum1)[1] == MyEnum.enum3);
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opIntSI extends Callback_MyClass_opIntS
+ {
+ opIntSI(int l)
+ {
+ _l = l;
+ }
+
+ @Override
+ public void response(int[] r)
+ {
+ test(r.length == _l);
+ for(int j = 0; j < r.length; ++j)
+ {
+ test(r[j] == -j);
+ }
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private int _l;
+ private Callback callback = new Callback();
+ }
+
+ private static class opDerivedI extends Callback_MyDerivedClass_opDerived
+ {
+ @Override
+ public void response()
+ {
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opDoubleMarshalingI extends Callback_MyClass_opDoubleMarshaling
+ {
+ @Override
+ public void response()
+ {
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opIdempotentI extends Callback_MyClass_opIdempotent
+ {
+ @Override
+ public void response()
+ {
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class opNonmutatingI extends Callback_MyClass_opNonmutating
+ {
+ @Override
+ public void response()
+ {
+ callback.called();
+ }
+
+ @Override
+ public void exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ static void
+ twowaysAMI(test.Util.Application app, MyClassPrx p)
+ {
+ Ice.Communicator communicator = app.communicator();
+
+ {
+ pingI cb = new pingI();
+ p.begin_ice_ping(cb);
+ cb.check();
+ }
+
+ {
+ isAI cb = new isAI();
+ p.begin_ice_isA(MyClass.ice_staticId(), cb);
+ cb.check();
+ }
+
+ {
+ idI cb = new idI();
+ p.begin_ice_id(cb);
+ cb.check();
+ }
+
+ {
+ idsI cb = new idsI();
+ p.begin_ice_ids(cb);
+ cb.check();
+ }
+
+ {
+ Ice.AsyncResult r = p.begin_opVoid();
+ p.end_opVoid(r);
+ }
+
+ {
+ opVoidI cb = new opVoidI();
+ p.begin_opVoid(cb);
+ cb.check();
+ }
+
+ {
+ Ice.AsyncResult r = p.begin_opByte((byte)0xff, (byte)0x0f);
+ Ice.ByteHolder p3 = new Ice.ByteHolder();
+ byte ret = p.end_opByte(p3, r);
+ test(p3.value == (byte)0xf0);
+ test(ret == (byte)0xff);
+ }
+
+ {
+ opByteI cb = new opByteI();
+ p.begin_opByte((byte)0xff, (byte)0x0f, cb);
+ cb.check();
+ }
+
+ {
+ opBoolI cb = new opBoolI();
+ p.begin_opBool(true, false, cb);
+ cb.check();
+ }
+
+ {
+ opShortIntLongI cb = new opShortIntLongI();
+ p.begin_opShortIntLong((short)10, 11, 12L, cb);
+ cb.check();
+ }
+
+ {
+ opFloatDoubleI cb = new opFloatDoubleI();
+ p.begin_opFloatDouble(3.14f, 1.1E10, cb);
+ cb.check();
+ }
+
+ {
+ opStringI cb = new opStringI();
+ p.begin_opString("hello", "world", cb);
+ cb.check();
+ }
+
+ {
+ opMyEnumI cb = new opMyEnumI();
+ p.begin_opMyEnum(MyEnum.enum2, cb);
+ cb.check();
+ }
+
+ {
+ opMyClassI cb = new opMyClassI(communicator);
+ p.begin_opMyClass(p, cb);
+ cb.check();
+ }
+
+ {
+ Structure si1 = new Structure();
+ si1.p = p;
+ si1.e = MyEnum.enum3;
+ si1.s = new AnotherStruct();
+ si1.s.s = "abc";
+ Structure si2 = new Structure();
+ si2.p = null;
+ si2.e = MyEnum.enum2;
+ si2.s = new AnotherStruct();
+ si2.s.s = "def";
+
+ opStructI cb = new opStructI(communicator);
+ p.begin_opStruct(si1, si2, cb);
+ cb.check();
+ }
+
+ {
+ final byte[] bsi1 =
+ {
+ (byte)0x01,
+ (byte)0x11,
+ (byte)0x12,
+ (byte)0x22
+ };
+ final byte[] bsi2 =
+ {
+ (byte)0xf1,
+ (byte)0xf2,
+ (byte)0xf3,
+ (byte)0xf4
+ };
+
+ opByteSI cb = new opByteSI();
+ p.begin_opByteS(bsi1, bsi2, cb);
+ cb.check();
+ }
+
+ {
+ final boolean[] bsi1 = { true, true, false };
+ final boolean[] bsi2 = { false };
+
+ opBoolSI cb = new opBoolSI();
+ p.begin_opBoolS(bsi1, bsi2, cb);
+ cb.check();
+ }
+
+ {
+ final short[] ssi = { 1, 2, 3 };
+ final int[] isi = { 5, 6, 7, 8 };
+ final long[] lsi = { 10, 30, 20 };
+
+ opShortIntLongSI cb = new opShortIntLongSI();
+ p.begin_opShortIntLongS(ssi, isi, lsi, cb);
+ cb.check();
+ }
+
+ {
+ final float[] fsi = { 3.14f, 1.11f };
+ final double[] dsi = { 1.1E10, 1.2E10, 1.3E10 };
+
+ opFloatDoubleSI cb = new opFloatDoubleSI();
+ p.begin_opFloatDoubleS(fsi, dsi, cb);
+ cb.check();
+ }
+
+ {
+ final String[] ssi1 = { "abc", "de", "fghi" };
+ final String[] ssi2 = { "xyz" };
+
+ opStringSI cb = new opStringSI();
+ p.begin_opStringS(ssi1, ssi2, cb);
+ cb.check();
+ }
+
+ {
+ final byte[][] bsi1 =
+ {
+ { (byte)0x01, (byte)0x11, (byte)0x12 },
+ { (byte)0xff }
+ };
+ final byte[][] bsi2 =
+ {
+ { (byte)0x0e },
+ { (byte)0xf2, (byte)0xf1 }
+ };
+
+ opByteSSI cb = new opByteSSI();
+ p.begin_opByteSS(bsi1, bsi2, cb);
+ cb.check();
+ }
+
+ {
+ final boolean[][] bsi1 =
+ {
+ { true },
+ { false },
+ { true, true}
+ };
+
+ final boolean[][] bsi2 =
+ {
+ { false, false, true }
+ };
+
+ opBoolSSI cb = new opBoolSSI();
+ p.begin_opBoolSS(bsi1, bsi2, cb);
+ cb.check();
+ }
+
+ {
+ final short[][] ssi=
+ {
+ {1, 2, 5},
+ {13},
+ {}
+ };
+ final int[][] isi =
+ {
+ {24, 98},
+ {42}
+ };
+ final long[][] lsi =
+ {
+ {496, 1729},
+ };
+
+ opShortIntLongSSI cb = new opShortIntLongSSI();
+ p.begin_opShortIntLongSS(ssi, isi, lsi, cb);
+ cb.check();
+ }
+
+ {
+ final float[][] fsi =
+ {
+ { 3.14f },
+ { 1.11f },
+ { },
+ };
+ final double[][] dsi =
+ {
+ { 1.1E10, 1.2E10, 1.3E10 }
+ };
+
+ opFloatDoubleSSI cb = new opFloatDoubleSSI();
+ p.begin_opFloatDoubleSS(fsi, dsi, cb);
+ cb.check();
+ }
+
+ {
+ final String[][] ssi1 =
+ {
+ { "abc" },
+ { "de", "fghi" }
+ };
+ final String[][] ssi2 =
+ {
+ { },
+ { },
+ { "xyz" }
+ };
+
+ opStringSSI cb = new opStringSSI();
+ p.begin_opStringSS(ssi1, ssi2, cb);
+ cb.check();
+ }
+
+ {
+ final String[][][] sssi1 =
+ {
+ {
+ {
+ "abc", "de"
+ },
+ {
+ "xyz"
+ }
+ },
+ {
+ {
+ "hello"
+ }
+ }
+ };
+
+ final String[][][] sssi2 =
+ {
+ {
+ {
+ "", ""
+ },
+ {
+ "abcd"
+ }
+ },
+ {
+ {
+ ""
+ }
+ },
+ {
+ }
+ };
+
+ opStringSSSI cb = new opStringSSSI();
+ p.begin_opStringSSS(sssi1, sssi2, cb);
+ cb.check();
+ }
+
+ {
+ java.util.Map<Byte, Boolean> di1 = new java.util.HashMap<>();
+ di1.put((byte)10, Boolean.TRUE);
+ di1.put((byte)100, Boolean.FALSE);
+ java.util.Map<Byte, Boolean> di2 = new java.util.HashMap<>();
+ di2.put((byte)10, Boolean.TRUE);
+ di2.put((byte)11, Boolean.FALSE);
+ di2.put((byte)101, Boolean.TRUE);
+
+ opByteBoolDI cb = new opByteBoolDI();
+ p.begin_opByteBoolD(di1, di2, cb);
+ cb.check();
+ }
+
+ {
+ java.util.Map<Short, Integer> di1 = new java.util.HashMap<>();
+ di1.put((short)110, -1);
+ di1.put((short)1100, 123123);
+ java.util.Map<Short, Integer> di2 = new java.util.HashMap<>();
+ di2.put((short)110, -1);
+ di2.put((short)111, -100);
+ di2.put((short)1101, 0);
+
+ opShortIntDI cb = new opShortIntDI();
+ p.begin_opShortIntD(di1, di2, cb);
+ cb.check();
+ }
+
+ {
+ java.util.Map<Long, Float> di1 = new java.util.HashMap<>();
+ di1.put(999999110L, -1.1f);
+ di1.put(999999111L, 123123.2f);
+ java.util.Map<Long, Float> di2 = new java.util.HashMap<>();
+ di2.put(999999110L, -1.1f);
+ di2.put(999999120L, -100.4f);
+ di2.put(999999130L, 0.5f);
+
+ opLongFloatDI cb = new opLongFloatDI();
+ p.begin_opLongFloatD(di1, di2, cb);
+ cb.check();
+ }
+
+ {
+ java.util.Map<String, String> di1 = new java.util.HashMap<>();
+ di1.put("foo", "abc -1.1");
+ di1.put("bar", "abc 123123.2");
+ java.util.Map<String, String> di2 = new java.util.HashMap<>();
+ di2.put("foo", "abc -1.1");
+ di2.put("FOO", "abc -100.4");
+ di2.put("BAR", "abc 0.5");
+
+ opStringStringDI cb = new opStringStringDI();
+ p.begin_opStringStringD(di1, di2, cb);
+ cb.check();
+ }
+
+ {
+ java.util.Map<String, MyEnum> di1 = new java.util.HashMap<>();
+ di1.put("abc", MyEnum.enum1);
+ di1.put("", MyEnum.enum2);
+ java.util.Map<String, MyEnum> di2 = new java.util.HashMap<>();
+ di2.put("abc", MyEnum.enum1);
+ di2.put("qwerty", MyEnum.enum3);
+ di2.put("Hello!!", MyEnum.enum2);
+
+ opStringMyEnumDI cb = new opStringMyEnumDI();
+ p.begin_opStringMyEnumD(di1, di2, cb);
+ cb.check();
+ }
+
+ {
+ java.util.Map<MyEnum, String> di1 = new java.util.HashMap<>();
+ di1.put(MyEnum.enum1, "abc");
+ java.util.Map<MyEnum, String> di2 = new java.util.HashMap<>();
+ di2.put(MyEnum.enum2, "Hello!!");
+ di2.put(MyEnum.enum3, "qwerty");
+
+ opMyEnumStringDI cb = new opMyEnumStringDI();
+ p.begin_opMyEnumStringD(di1, di2, cb);
+ cb.check();
+ }
+
+ {
+ MyStruct s11 = new MyStruct(1, 1);
+ MyStruct s12 = new MyStruct(1, 2);
+ java.util.Map<MyStruct, MyEnum> di1 = new java.util.HashMap<>();
+ di1.put(s11, MyEnum.enum1);
+ di1.put(s12, MyEnum.enum2);
+ MyStruct s22 = new MyStruct(2, 2);
+ MyStruct s23 = new MyStruct(2, 3);
+ java.util.Map<MyStruct, MyEnum> di2 = new java.util.HashMap<>();
+ di2.put(s11, MyEnum.enum1);
+ di2.put(s22, MyEnum.enum3);
+ di2.put(s23, MyEnum.enum2);
+
+ opMyStructMyEnumDI cb = new opMyStructMyEnumDI();
+ p.begin_opMyStructMyEnumD(di1, di2, cb);
+ cb.check();
+ }
+
+ {
+ List<Map<Byte, Boolean>> dsi1 = new ArrayList<>();
+ List<Map<Byte, Boolean>> dsi2 = new ArrayList<>();
+
+ Map<Byte, Boolean> di1 = new HashMap<>();
+ di1.put((byte) 10, Boolean.TRUE);
+ di1.put((byte) 100, Boolean.FALSE);
+ Map<Byte, Boolean> di2 = new HashMap<>();
+ di2.put((byte) 10, Boolean.TRUE);
+ di2.put((byte) 11, Boolean.FALSE);
+ di2.put((byte) 101, Boolean.TRUE);
+ Map<Byte, Boolean> di3 = new HashMap<>();
+ di3.put((byte) 100, Boolean.FALSE);
+ di3.put((byte) 101, Boolean.FALSE);
+
+ dsi1.add(di1);
+ dsi1.add(di2);
+ dsi2.add(di3);
+
+ opByteBoolDS cb = new opByteBoolDS();
+ p.begin_opByteBoolDS(dsi1, dsi2, cb);
+ cb.check();
+ }
+
+ {
+ List<Map<Short, Integer>> dsi1 = new ArrayList<>();
+ List<Map<Short, Integer>> dsi2 = new ArrayList<>();
+
+ Map<Short, Integer> di1 = new HashMap<>();
+ di1.put((short) 110, -1);
+ di1.put((short) 1100, 123123);
+ Map<Short, Integer> di2 = new HashMap<>();
+ di2.put((short) 110, -1);
+ di2.put((short) 111, -100);
+ di2.put((short) 1101, 0);
+ Map<Short, Integer> di3 = new HashMap<>();
+ di3.put((short) 100, -1001);
+
+ dsi1.add(di1);
+ dsi1.add(di2);
+ dsi2.add(di3);
+
+ opShortIntDS cb = new opShortIntDS();
+ p.begin_opShortIntDS(dsi1, dsi2, cb);
+ cb.check();
+ }
+
+ {
+ List<Map<Long, Float>> dsi1 = new ArrayList<>();
+ List<Map<Long, Float>> dsi2 = new ArrayList<>();
+
+ Map<Long, Float> di1 = new HashMap<>();
+ di1.put(999999110L, new Float(-1.1));
+ di1.put(999999111L, new Float(123123.2));
+ Map<Long, Float> di2 = new HashMap<>();
+ di2.put(999999110L, new Float(-1.1));
+ di2.put(999999120L, new Float(-100.4));
+ di2.put(999999130L, new Float(0.5));
+ Map<Long, Float> di3 = new HashMap<>();
+ di3.put(999999140L, new Float(3.14));
+
+ dsi1.add(di1);
+ dsi1.add(di2);
+ dsi2.add(di3);
+
+ opLongFloatDS cb = new opLongFloatDS();
+ p.begin_opLongFloatDS(dsi1, dsi2, cb);
+ cb.check();
+ }
+
+ {
+ List<Map<String, String>> dsi1 = new ArrayList<>();
+ List<Map<String, String>> dsi2 = new ArrayList<>();
+
+ java.util.Map<String, String> di1 = new HashMap<>();
+ di1.put("foo", "abc -1.1");
+ di1.put("bar", "abc 123123.2");
+ java.util.Map<String, String> di2 = new HashMap<>();
+ di2.put("foo", "abc -1.1");
+ di2.put("FOO", "abc -100.4");
+ di2.put("BAR", "abc 0.5");
+ java.util.Map<String, String> di3 = new HashMap<>();
+ di3.put("f00", "ABC -3.14");
+
+ dsi1.add(di1);
+ dsi1.add(di2);
+ dsi2.add(di3);
+
+ opStringStringDS cb = new opStringStringDS();
+ p.begin_opStringStringDS(dsi1, dsi2, cb);
+ cb.check();
+ }
+
+ {
+ List<Map<String, MyEnum>> dsi1 = new ArrayList<>();
+ List<Map<String, MyEnum>> dsi2 = new ArrayList<>();
+
+ java.util.Map<String, MyEnum> di1 = new HashMap<>();
+ di1.put("abc", MyEnum.enum1);
+ di1.put("", MyEnum.enum2);
+ java.util.Map<String, MyEnum> di2 = new HashMap<>();
+ di2.put("abc", MyEnum.enum1);
+ di2.put("qwerty", MyEnum.enum3);
+ di2.put("Hello!!", MyEnum.enum2);
+ java.util.Map<String, MyEnum> di3 = new HashMap<>();
+ di3.put("Goodbye", MyEnum.enum1);
+
+ dsi1.add(di1);
+ dsi1.add(di2);
+ dsi2.add(di3);
+
+ opStringMyEnumDS cb = new opStringMyEnumDS();
+ p.begin_opStringMyEnumDS(dsi1, dsi2, cb);
+ cb.check();
+ }
+
+ {
+ List<Map<MyEnum, String>> dsi1 = new ArrayList<>();
+ List<Map<MyEnum, String>> dsi2 = new ArrayList<>();
+
+ java.util.Map<MyEnum, String> di1 = new HashMap<>();
+ di1.put(MyEnum.enum1, "abc");
+ java.util.Map<MyEnum, String> di2 = new HashMap<>();
+ di2.put(MyEnum.enum2, "Hello!!");
+ di2.put(MyEnum.enum3, "qwerty");
+ java.util.Map<MyEnum, String> di3 = new HashMap<>();
+ di3.put(MyEnum.enum1, "Goodbye");
+
+ dsi1.add(di1);
+ dsi1.add(di2);
+ dsi2.add(di3);
+
+ opMyEnumStringDS cb = new opMyEnumStringDS();
+ p.begin_opMyEnumStringDS(dsi1, dsi2, cb);
+ cb.check();
+ }
+
+ {
+ List<Map<MyStruct, MyEnum>> dsi1 = new ArrayList<>();
+ List<Map<MyStruct, MyEnum>> dsi2 = new ArrayList<>();
+
+ MyStruct s11 = new MyStruct(1, 1);
+ MyStruct s12 = new MyStruct(1, 2);
+ java.util.Map<MyStruct, MyEnum> di1 = new HashMap<>();
+ di1.put(s11, MyEnum.enum1);
+ di1.put(s12, MyEnum.enum2);
+
+ MyStruct s22 = new MyStruct(2, 2);
+ MyStruct s23 = new MyStruct(2, 3);
+ java.util.Map<MyStruct, MyEnum> di2 = new HashMap<>();
+ di2.put(s11, MyEnum.enum1);
+ di2.put(s22, MyEnum.enum3);
+ di2.put(s23, MyEnum.enum2);
+
+ java.util.Map<MyStruct, MyEnum> di3 = new HashMap<>();
+ di3.put(s23, MyEnum.enum3);
+
+ dsi1.add(di1);
+ dsi1.add(di2);
+ dsi2.add(di3);
+
+ opMyStructMyEnumDS cb = new opMyStructMyEnumDS();
+ p.begin_opMyStructMyEnumDS(dsi1, dsi2, cb);
+ cb.check();
+ }
+
+ {
+ java.util.Map<Byte, byte[]> sdi1 = new java.util.HashMap<>();
+ java.util.Map<Byte, byte[]> sdi2 = new java.util.HashMap<>();
+
+ final byte[] si1 = {(byte) 0x01, (byte) 0x11};
+ final byte[] si2 = {(byte) 0x12};
+ final byte[] si3 = {(byte) 0xf2, (byte) 0xf3};
+
+ sdi1.put((byte) 0x01, si1);
+ sdi1.put((byte) 0x22, si2);
+ sdi2.put((byte) 0xf1, si3);
+
+ opByteByteSD cb = new opByteByteSD();
+ p.begin_opByteByteSD(sdi1, sdi2, cb);
+ cb.check();
+ }
+
+ {
+ java.util.Map<Boolean, boolean[]> sdi1 = new java.util.HashMap<>();
+ java.util.Map<Boolean, boolean[]> sdi2 = new java.util.HashMap<>();
+
+ final boolean[] si1 = {true, false};
+ final boolean[] si2 = {false, true, true};
+
+ sdi1.put(false, si1);
+ sdi1.put(true, si2);
+ sdi2.put(false, si1);
+
+ opBoolBoolSD cb = new opBoolBoolSD();
+ p.begin_opBoolBoolSD(sdi1, sdi2, cb);
+ cb.check();
+ }
+
+ {
+ java.util.Map<Short, short[]> sdi1 = new java.util.HashMap<>();
+ java.util.Map<Short, short[]> sdi2 = new java.util.HashMap<>();
+
+ final short[] si1 = {1, 2, 3};
+ final short[] si2 = {4, 5};
+ final short[] si3 = {6, 7};
+
+ sdi1.put((short) 1, si1);
+ sdi1.put((short) 2, si2);
+ sdi2.put((short) 4, si3);
+
+ opShortShortSD cb = new opShortShortSD();
+ p.begin_opShortShortSD(sdi1, sdi2, cb);
+ cb.check();
+ }
+
+ {
+ java.util.Map<Integer, int[]> sdi1 = new java.util.HashMap<>();
+ java.util.Map<Integer, int[]> sdi2 = new java.util.HashMap<>();
+
+ final int[] si1 = {100, 200, 300};
+ final int[] si2 = {400, 500};
+ final int[] si3 = {600, 700};
+
+ sdi1.put(100, si1);
+ sdi1.put(200, si2);
+ sdi2.put(400, si3);
+
+ opIntIntSD cb = new opIntIntSD();
+ p.begin_opIntIntSD(sdi1, sdi2, cb);
+ cb.check();
+ }
+
+ {
+ java.util.Map<Long, long[]> sdi1 = new java.util.HashMap<>();
+ java.util.Map<Long, long[]> sdi2 = new java.util.HashMap<>();
+
+ final long[] si1 = {999999110L, 999999111L, 999999110L};
+ final long[] si2 = {999999120L, 999999130L};
+ final long[] si3 = {999999110L, 999999120};
+
+ sdi1.put(999999990L, si1);
+ sdi1.put(999999991L, si2);
+ sdi2.put(999999992L, si3);
+
+ opLongLongSD cb = new opLongLongSD();
+ p.begin_opLongLongSD(sdi1, sdi2, cb);
+ cb.check();
+ }
+
+ {
+ java.util.Map<String, float[]> sdi1 = new java.util.HashMap<>();
+ java.util.Map<String, float[]> sdi2 = new java.util.HashMap<>();
+
+ final float[] si1 = {-1.1f, 123123.2f, 100.0f};
+ final float[] si2 = {42.24f, -1.61f};
+ final float[] si3 = {-3.14f, 3.14f};
+
+ sdi1.put("abc", si1);
+ sdi1.put("ABC", si2);
+ sdi2.put("aBc", si3);
+
+ opStringFloatSD cb = new opStringFloatSD();
+ p.begin_opStringFloatSD(sdi1, sdi2, cb);
+ cb.check();
+ }
+
+ {
+ java.util.Map<String, double[]> sdi1 = new java.util.HashMap<>();
+ java.util.Map<String, double[]> sdi2 = new java.util.HashMap<>();
+
+ double[] si1 = new double[]{1.1E10, 1.2E10, 1.3E10};
+ double[] si2 = new double[]{1.4E10, 1.5E10};
+ double[] si3 = new double[]{1.6E10, 1.7E10};
+
+ sdi1.put("Hello!!", si1);
+ sdi1.put("Goodbye", si2);
+ sdi2.put("", si3);
+
+ opStringDoubleSD cb = new opStringDoubleSD();
+ p.begin_opStringDoubleSD(sdi1, sdi2, cb);
+ cb.check();
+ }
+
+ {
+ java.util.Map<String, String[]> sdi1 = new java.util.HashMap<>();
+ java.util.Map<String, String[]> sdi2 = new java.util.HashMap<>();
+
+ String[] si1 = new String[] { "abc", "de", "fghi" };
+ String[] si2 = new String[] { "xyz", "or" };
+ String[] si3 = new String[] { "and", "xor" };
+
+ sdi1.put("abc", si1);
+ sdi1.put("def", si2);
+ sdi2.put("ghi", si3);
+
+ opStringStringSD cb = new opStringStringSD();
+ p.begin_opStringStringSD(sdi1, sdi2, cb);
+ cb.check();
+ }
+
+ {
+ java.util.Map<MyEnum, MyEnum[]> sdi1 = new java.util.HashMap<>();
+ java.util.Map<MyEnum, MyEnum[]> sdi2 = new java.util.HashMap<>();
+
+ final MyEnum[] si1 = new MyEnum[] { MyEnum.enum1, MyEnum.enum1, MyEnum.enum2 };
+ final MyEnum[] si2 = new MyEnum[] { MyEnum.enum1, MyEnum.enum2 };
+ final MyEnum[] si3 = new MyEnum[] { MyEnum.enum3, MyEnum.enum3 };
+
+ sdi1.put(MyEnum.enum3, si1);
+ sdi1.put(MyEnum.enum2, si2);
+ sdi2.put(MyEnum.enum1, si3);
+
+ opMyEnumMyEnumSD cb = new opMyEnumMyEnumSD();
+ p.begin_opMyEnumMyEnumSD(sdi1, sdi2, cb);
+ cb.check();
+ }
+
+ {
+ int[] lengths = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 };
+
+ for(int l : lengths)
+ {
+ int[] s = new int[l];
+ for(int i = 0; i < s.length; ++i)
+ {
+ s[i] = i;
+ }
+ opIntSI cb = new opIntSI(l);
+ p.begin_opIntS(s, cb);
+ cb.check();
+ }
+ }
+
+ {
+ java.util.Map<String, String> ctx = new java.util.HashMap<>();
+ ctx.put("one", "ONE");
+ ctx.put("two", "TWO");
+ ctx.put("three", "THREE");
+ {
+ test(p.ice_getContext().isEmpty());
+ Ice.AsyncResult r = p.begin_opContext();
+ java.util.Map<String, String> c = p.end_opContext(r);
+ test(!c.equals(ctx));
+ }
+ {
+ test(p.ice_getContext().isEmpty());
+ Ice.AsyncResult r = p.begin_opContext(ctx);
+ java.util.Map<String, String> c = p.end_opContext(r);
+ test(c.equals(ctx));
+ }
+ MyClassPrx p2 = MyClassPrxHelper.checkedCast(p.ice_context(ctx));
+ test(p2.ice_getContext().equals(ctx));
+ {
+ Ice.AsyncResult r = p2.begin_opContext();
+ java.util.Map<String, String> c = p2.end_opContext(r);
+ test(c.equals(ctx));
+ }
+ {
+ Ice.AsyncResult r = p2.begin_opContext(ctx);
+ java.util.Map<String, String> c = p2.end_opContext(r);
+ test(c.equals(ctx));
+ }
+ }
+
+ if(p.ice_getConnection() != null)
+ {
+ //
+ // Test implicit context propagation
+ //
+
+ String[] impls = {"Shared", "PerThread"};
+ for(int i = 0; i < 2; i++)
+ {
+ Ice.InitializationData initData = app.createInitializationData();
+ initData.properties = communicator.getProperties()._clone();
+ initData.properties.setProperty("Ice.ImplicitContext", impls[i]);
+
+ Ice.Communicator ic = app.initialize(initData);
+
+ java.util.Map<String, String> ctx = new java.util.HashMap<>();
+ ctx.put("one", "ONE");
+ ctx.put("two", "TWO");
+ ctx.put("three", "THREE");
+
+ MyClassPrx p3 = MyClassPrxHelper.uncheckedCast(ic.stringToProxy("test:default -p 12010"));
+
+ ic.getImplicitContext().setContext(ctx);
+ test(ic.getImplicitContext().getContext().equals(ctx));
+ {
+ Ice.AsyncResult r = p3.begin_opContext();
+ java.util.Map<String, String> c = p3.end_opContext(r);
+ test(c.equals(ctx));
+ }
+
+ ic.getImplicitContext().put("zero", "ZERO");
+
+ ctx = ic.getImplicitContext().getContext();
+ {
+ Ice.AsyncResult r = p3.begin_opContext();
+ java.util.Map<String, String> c = p3.end_opContext(r);
+ test(c.equals(ctx));
+ }
+
+ java.util.Map<String, String> prxContext = new java.util.HashMap<>();
+ prxContext.put("one", "UN");
+ prxContext.put("four", "QUATRE");
+
+ java.util.Map<String, String> combined = new java.util.HashMap<>(ctx);
+ combined.putAll(prxContext);
+ test(combined.get("one").equals("UN"));
+
+ p3 = MyClassPrxHelper.uncheckedCast(p3.ice_context(prxContext));
+
+ ic.getImplicitContext().setContext(null);
+ {
+ Ice.AsyncResult r = p3.begin_opContext();
+ java.util.Map<String, String> c = p3.end_opContext(r);
+ test(c.equals(prxContext));
+ }
+
+ ic.getImplicitContext().setContext(ctx);
+ {
+ Ice.AsyncResult r = p3.begin_opContext();
+ java.util.Map<String, String> c = p3.end_opContext(r);
+ test(c.equals(combined));
+ }
+
+ ic.destroy();
+ }
+ }
+
+ {
+ double d = 1278312346.0 / 13.0;
+ double[] ds = new double[5];
+ for(int i = 0; i < 5; i++)
+ {
+ ds[i] = d;
+ }
+ opDoubleMarshalingI cb = new opDoubleMarshalingI();
+ p.begin_opDoubleMarshaling(d, ds, cb);
+ cb.check();
+ }
+
+ {
+ opIdempotentI cb = new opIdempotentI();
+ p.begin_opIdempotent(cb);
+ cb.check();
+ }
+
+ {
+ opNonmutatingI cb = new opNonmutatingI();
+ p.begin_opNonmutating(cb);
+ cb.check();
+ }
+
+ {
+ MyDerivedClassPrx derived = MyDerivedClassPrxHelper.checkedCast(p);
+ test(derived != null);
+ opDerivedI cb = new opDerivedI();
+ derived.begin_opDerived(cb);
+ cb.check();
+ }
+
+ {
+ final GenericCallback<Byte> cb = new GenericCallback<Byte>((byte)0);
+ p.begin_opByte1((byte)0xFF,
+ new test.Ice.operations.Test.Callback_MyClass_opByte1()
+ {
+ public void response(byte value)
+ {
+ cb.response(value);
+ }
+
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+ });
+ test(cb.succeeded() && cb.value() == (byte)0xFF);
+ }
+
+ {
+ final GenericCallback<Short> cb = new GenericCallback<Short>((short)0);
+ p.begin_opShort1((short)0x7FFF,
+ new test.Ice.operations.Test.Callback_MyClass_opShort1()
+ {
+ public void response(short value)
+ {
+ cb.response(value);
+ }
+
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+ });
+ test(cb.succeeded() && cb.value() == 0x7FFF);
+ }
+
+ {
+ final GenericCallback<Integer> cb = new GenericCallback<Integer>(0);
+ p.begin_opInt1(0x7FFFFFFF,
+ new test.Ice.operations.Test.Callback_MyClass_opInt1()
+ {
+ public void response(int value)
+ {
+ cb.response(value);
+ }
+
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+ });
+ test(cb.succeeded() && cb.value() == 0x7FFFFFFF);
+ }
+
+ {
+ final GenericCallback<Long> cb = new GenericCallback<Long>((long)0);
+ p.begin_opLong1(0x7FFFFFFF,
+ new test.Ice.operations.Test.Callback_MyClass_opLong1()
+ {
+ public void response(long value)
+ {
+ cb.response(value);
+ }
+
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+ });
+ test(cb.succeeded() && cb.value() == 0x7FFFFFFF);
+ }
+
+ {
+ final GenericCallback<Float> cb = new GenericCallback<Float>(0.0f);
+ p.begin_opFloat1(1.0f,
+ new test.Ice.operations.Test.Callback_MyClass_opFloat1()
+ {
+ public void response(float value)
+ {
+ cb.response(value);
+ }
+
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+ });
+ test(cb.succeeded() && cb.value() == 1.0f);
+ }
+
+ {
+ final GenericCallback<Double> cb = new GenericCallback<Double>(0.0);
+ p.begin_opDouble1(1.0,
+ new test.Ice.operations.Test.Callback_MyClass_opDouble1()
+ {
+ public void response(double value)
+ {
+ cb.response(value);
+ }
+
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+ });
+ test(cb.succeeded() && cb.value() == 1.0);
+ }
+
+ {
+ final GenericCallback<String> cb = new GenericCallback<String>("");
+ p.begin_opString1("opString1",
+ new test.Ice.operations.Test.Callback_MyClass_opString1()
+ {
+ public void response(String value)
+ {
+ cb.response(value);
+ }
+
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+ });
+ test(cb.succeeded() && cb.value().equals("opString1"));
+ }
+
+ {
+ final GenericCallback<String[]> cb = new GenericCallback<String[]>(null);
+ p.begin_opStringS1(null,
+ new test.Ice.operations.Test.Callback_MyClass_opStringS1()
+ {
+ public void response(String[] value)
+ {
+ cb.response(value);
+ }
+
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+ });
+ test(cb.succeeded() && cb.value().length == 0);
+ }
+
+ {
+ final GenericCallback<Map<Byte, Boolean>> cb = new GenericCallback<Map<Byte, Boolean>>(null);
+ p.begin_opByteBoolD1(null,
+ new test.Ice.operations.Test.Callback_MyClass_opByteBoolD1()
+ {
+ public void response(Map<Byte, Boolean> value)
+ {
+ cb.response(value);
+ }
+
+ public void exception(Ice.LocalException ex)
+ {
+ cb.exception(ex);
+ }
+ });
+ test(cb.succeeded() && cb.value().size() == 0);
+ }
+ }
+}
diff --git a/java/test/src/main/java/test/Ice/operations/lambda/OnewaysLambdaAMI.java b/java-compat/test/src/main/java/test/Ice/operations/lambda/OnewaysLambdaAMI.java
index cb67d265e56..cb67d265e56 100644
--- a/java/test/src/main/java/test/Ice/operations/lambda/OnewaysLambdaAMI.java
+++ b/java-compat/test/src/main/java/test/Ice/operations/lambda/OnewaysLambdaAMI.java
diff --git a/java/test/src/main/java/test/Ice/operations/lambda/TwowaysLambdaAMI.java b/java-compat/test/src/main/java/test/Ice/operations/lambda/TwowaysLambdaAMI.java
index 204790269c7..204790269c7 100644
--- a/java/test/src/main/java/test/Ice/operations/lambda/TwowaysLambdaAMI.java
+++ b/java-compat/test/src/main/java/test/Ice/operations/lambda/TwowaysLambdaAMI.java
diff --git a/java-compat/test/src/main/java/test/Ice/operations/run.py b/java-compat/test/src/main/java/test/Ice/operations/run.py
new file mode 100755
index 00000000000..83401d7a990
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/operations/run.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest(additionalClientOptions = "--Ice.Warn.AMICallback=0")
+
+TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.",
+ additionalClientOptions = "--Ice.Warn.AMICallback=0",
+ server="test.Ice.operations.AMDServer")
+
+TestUtil.queueClientServerTest(configName = "tie", localOnly = True, message = "Running test with TIE server.",
+ additionalClientOptions = "--Ice.Warn.AMICallback=0",
+ server="test.Ice.operations.TieServer")
+
+TestUtil.queueClientServerTest(configName = "amdTie", localOnly = True, message = "Running test with AMD TIE server.",
+ additionalClientOptions = "--Ice.Warn.AMICallback=0",
+ server="test.Ice.operations.AMDTieServer")
+
+TestUtil.queueCollocatedTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/optional/AMDInitialI.java b/java-compat/test/src/main/java/test/Ice/optional/AMDInitialI.java
new file mode 100644
index 00000000000..b282d958571
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/optional/AMDInitialI.java
@@ -0,0 +1,625 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.optional;
+
+import test.Ice.optional.AMD.Test.*;
+
+public final class AMDInitialI extends Initial
+{
+ @Override
+ public void
+ shutdown_async(AMD_Initial_shutdown cb, Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ pingPong_async(AMD_Initial_pingPong cb, Ice.Object obj, Ice.Current current)
+ {
+ cb.ice_response(obj);
+ }
+
+ @Override
+ public void
+ opOptionalException_async(AMD_Initial_opOptionalException cb, Ice.IntOptional a, Ice.Optional<String> b,
+ Ice.Optional<OneOptional> o, Ice.Current current)
+ throws OptionalException
+ {
+ OptionalException ex = new OptionalException();
+ if(a.isSet())
+ {
+ ex.setA(a.get());
+ }
+ else
+ {
+ ex.clearA(); // The member "a" has a default value.
+ }
+ if(b.isSet())
+ {
+ ex.setB(b.get());
+ }
+ if(o.isSet())
+ {
+ ex.setO(o.get());
+ }
+ cb.ice_exception(ex);
+ }
+
+ @Override
+ public void
+ opDerivedException_async(AMD_Initial_opDerivedException cb, Ice.IntOptional a, Ice.Optional<String> b,
+ Ice.Optional<OneOptional> o, Ice.Current current)
+ throws OptionalException
+ {
+ DerivedException ex = new DerivedException();
+ if(a.isSet())
+ {
+ ex.setA(a.get());
+ }
+ else
+ {
+ ex.clearA(); // The member "a" has a default value.
+ }
+ if(b.isSet())
+ {
+ ex.setB(b.get());
+ ex.setSs(b.get());
+ }
+ else
+ {
+ ex.clearSs(); // The member "ss" has a default value.
+ }
+ if(o.isSet())
+ {
+ ex.setO(o.get());
+ ex.setO2(o.get());
+ }
+ cb.ice_exception(ex);
+ }
+
+ @Override
+ public void
+ opRequiredException_async(AMD_Initial_opRequiredException cb, Ice.IntOptional a, Ice.Optional<String> b,
+ Ice.Optional<OneOptional> o, Ice.Current current)
+ throws OptionalException
+ {
+ RequiredException ex = new RequiredException();
+ if(a.isSet())
+ {
+ ex.setA(a.get());
+ }
+ else
+ {
+ ex.clearA(); // The member "a" has a default value.
+ }
+ if(b.isSet())
+ {
+ ex.setB(b.get());
+ ex.ss = b.get();
+ }
+ if(o.isSet())
+ {
+ ex.setO(o.get());
+ ex.o2 = o.get();
+ }
+ cb.ice_exception(ex);
+ }
+
+ @Override
+ public void
+ opByte_async(AMD_Initial_opByte cb, Ice.ByteOptional p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opByteReq_async(AMD_Initial_opByteReq cb, Ice.ByteOptional p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opBool_async(AMD_Initial_opBool cb, Ice.BooleanOptional p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opBoolReq_async(AMD_Initial_opBoolReq cb, Ice.BooleanOptional p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opShort_async(AMD_Initial_opShort cb, Ice.ShortOptional p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opShortReq_async(AMD_Initial_opShortReq cb, Ice.ShortOptional p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opInt_async(AMD_Initial_opInt cb, Ice.IntOptional p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opIntReq_async(AMD_Initial_opIntReq cb, Ice.IntOptional p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opLong_async(AMD_Initial_opLong cb, Ice.LongOptional p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opLongReq_async(AMD_Initial_opLongReq cb, Ice.LongOptional p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opFloat_async(AMD_Initial_opFloat cb, Ice.FloatOptional p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opFloatReq_async(AMD_Initial_opFloatReq cb, Ice.FloatOptional p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opDouble_async(AMD_Initial_opDouble cb, Ice.DoubleOptional p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opDoubleReq_async(AMD_Initial_opDoubleReq cb, Ice.DoubleOptional p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opString_async(AMD_Initial_opString cb, Ice.Optional<String> p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opStringReq_async(AMD_Initial_opStringReq cb, Ice.Optional<String> p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opMyEnum_async(AMD_Initial_opMyEnum cb, Ice.Optional<MyEnum> p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opMyEnumReq_async(AMD_Initial_opMyEnumReq cb, Ice.Optional<MyEnum> p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opSmallStruct_async(AMD_Initial_opSmallStruct cb, Ice.Optional<SmallStruct> p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opSmallStructReq_async(AMD_Initial_opSmallStructReq cb, Ice.Optional<SmallStruct> p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opFixedStruct_async(AMD_Initial_opFixedStruct cb, Ice.Optional<FixedStruct> p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opFixedStructReq_async(AMD_Initial_opFixedStructReq cb, Ice.Optional<FixedStruct> p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opVarStruct_async(AMD_Initial_opVarStruct cb, Ice.Optional<VarStruct> p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opVarStructReq_async(AMD_Initial_opVarStructReq cb, Ice.Optional<VarStruct> p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opOneOptional_async(AMD_Initial_opOneOptional cb, Ice.Optional<OneOptional> p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opOneOptionalReq_async(AMD_Initial_opOneOptionalReq cb, Ice.Optional<OneOptional> p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opOneOptionalProxy_async(AMD_Initial_opOneOptionalProxy cb, Ice.Optional<OneOptionalPrx> p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opOneOptionalProxyReq_async(AMD_Initial_opOneOptionalProxyReq cb, Ice.Optional<OneOptionalPrx> p1,
+ Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opByteSeq_async(AMD_Initial_opByteSeq cb, Ice.Optional<byte[]> p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opByteSeqReq_async(AMD_Initial_opByteSeqReq cb, Ice.Optional<byte[]> p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opBoolSeq_async(AMD_Initial_opBoolSeq cb, Ice.Optional<boolean[]> p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opBoolSeqReq_async(AMD_Initial_opBoolSeqReq cb, Ice.Optional<boolean[]> p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opShortSeq_async(AMD_Initial_opShortSeq cb, Ice.Optional<short[]> p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opShortSeqReq_async(AMD_Initial_opShortSeqReq cb, Ice.Optional<short[]> p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opIntSeq_async(AMD_Initial_opIntSeq cb, Ice.Optional<int[]> p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opIntSeqReq_async(AMD_Initial_opIntSeqReq cb, Ice.Optional<int[]> p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opLongSeq_async(AMD_Initial_opLongSeq cb, Ice.Optional<long[]> p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opLongSeqReq_async(AMD_Initial_opLongSeqReq cb, Ice.Optional<long[]> p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opFloatSeq_async(AMD_Initial_opFloatSeq cb, Ice.Optional<float[]> p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opFloatSeqReq_async(AMD_Initial_opFloatSeqReq cb, Ice.Optional<float[]> p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opDoubleSeq_async(AMD_Initial_opDoubleSeq cb, Ice.Optional<double[]> p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opDoubleSeqReq_async(AMD_Initial_opDoubleSeqReq cb, Ice.Optional<double[]> p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opStringSeq_async(AMD_Initial_opStringSeq cb, Ice.Optional<String[]> p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opStringSeqReq_async(AMD_Initial_opStringSeqReq cb, Ice.Optional<String[]> p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opSmallStructSeq_async(AMD_Initial_opSmallStructSeq cb, Ice.Optional<SmallStruct[]> p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opSmallStructSeqReq_async(AMD_Initial_opSmallStructSeqReq cb, Ice.Optional<SmallStruct[]> p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opSmallStructList_async(AMD_Initial_opSmallStructList cb, Ice.Optional<java.util.List<SmallStruct>> p1,
+ Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opSmallStructListReq_async(AMD_Initial_opSmallStructListReq cb, Ice.Optional<java.util.List<SmallStruct>> p1,
+ Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opFixedStructSeq_async(AMD_Initial_opFixedStructSeq cb, Ice.Optional<FixedStruct[]> p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opFixedStructSeqReq_async(AMD_Initial_opFixedStructSeqReq cb, Ice.Optional<FixedStruct[]> p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opFixedStructList_async(AMD_Initial_opFixedStructList cb, Ice.Optional<java.util.List<FixedStruct>> p1,
+ Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opFixedStructListReq_async(AMD_Initial_opFixedStructListReq cb, Ice.Optional<java.util.List<FixedStruct>> p1,
+ Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opVarStructSeq_async(AMD_Initial_opVarStructSeq cb, Ice.Optional<VarStruct[]> p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opVarStructSeqReq_async(AMD_Initial_opVarStructSeqReq cb, Ice.Optional<VarStruct[]> p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opSerializable_async(AMD_Initial_opSerializable cb, Ice.Optional<SerializableClass> p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opSerializableReq_async(AMD_Initial_opSerializableReq cb, Ice.Optional<SerializableClass> p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opIntIntDict_async(AMD_Initial_opIntIntDict cb, Ice.Optional<java.util.Map<Integer, Integer>> p1,
+ Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opIntIntDictReq_async(AMD_Initial_opIntIntDictReq cb, Ice.Optional<java.util.Map<Integer, Integer>> p1,
+ Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opStringIntDict_async(AMD_Initial_opStringIntDict cb, Ice.Optional<java.util.Map<String, Integer>> p1,
+ Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opStringIntDictReq_async(AMD_Initial_opStringIntDictReq cb, Ice.Optional<java.util.Map<String, Integer>> p1,
+ Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opIntOneOptionalDict_async(AMD_Initial_opIntOneOptionalDict cb,
+ Ice.Optional<java.util.Map<Integer, OneOptional>> p1, Ice.Current current)
+ {
+ cb.ice_response(p1, p1);
+ }
+
+ @Override
+ public void
+ opIntOneOptionalDictReq_async(AMD_Initial_opIntOneOptionalDictReq cb,
+ Ice.Optional<java.util.Map<Integer, OneOptional>> p1, Ice.Current current)
+ {
+ cb.ice_response(p1.get(), p1.get());
+ }
+
+ @Override
+ public void
+ opClassAndUnknownOptional_async(AMD_Initial_opClassAndUnknownOptional cb, A p, Ice.Current current)
+ {
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ sendOptionalClass_async(AMD_Initial_sendOptionalClass cb, boolean req, Ice.Optional<OneOptional> o,
+ Ice.Current current)
+ {
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ returnOptionalClass_async(AMD_Initial_returnOptionalClass cb, boolean req, Ice.Current current)
+ {
+ cb.ice_response(new Ice.Optional<OneOptional>(new OneOptional(53)));
+ }
+
+ @Override
+ public void
+ opG_async(AMD_Initial_opG cb, G g, Ice.Current current)
+ {
+ cb.ice_response(g);
+ }
+
+ @Override
+ public void
+ opVoid_async(AMD_Initial_opVoid cb, Ice.Current current)
+ {
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ supportsRequiredParams_async(AMD_Initial_supportsRequiredParams cb, Ice.Current current)
+ {
+ cb.ice_response(true);
+ }
+
+ @Override
+ public void
+ supportsJavaSerializable_async(AMD_Initial_supportsJavaSerializable cb, Ice.Current current)
+ {
+ cb.ice_response(true);
+ }
+
+ @Override
+ public void
+ supportsCsharpSerializable_async(AMD_Initial_supportsCsharpSerializable cb, Ice.Current current)
+ {
+ cb.ice_response(false);
+ }
+
+ @Override
+ public void
+ supportsCppStringView_async(AMD_Initial_supportsCppStringView cb, Ice.Current current)
+ {
+ cb.ice_response(false);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/optional/AMDServer.java b/java-compat/test/src/main/java/test/Ice/optional/AMDServer.java
new file mode 100644
index 00000000000..99cab219be1
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/optional/AMDServer.java
@@ -0,0 +1,41 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.optional;
+
+public class AMDServer extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.add(new AMDInitialI(), Ice.Util.stringToIdentity("initial"));
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.optional.AMD");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ AMDServer c = new AMDServer();
+ int status = c.main("Server", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/optional/AllTests.java b/java-compat/test/src/main/java/test/Ice/optional/AllTests.java
new file mode 100644
index 00000000000..fdfa3ff0f6d
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/optional/AllTests.java
@@ -0,0 +1,2580 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.optional;
+import java.io.PrintWriter;
+
+import test.Ice.optional.Test.*;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static InitialPrx
+ allTests(test.Util.Application app, boolean collocated, PrintWriter out)
+ {
+ Ice.Communicator communicator = app.communicator();
+
+ FactoryI factory = new FactoryI();
+ communicator.getValueFactoryManager().add(factory, "");
+
+ out.print("testing stringToProxy... ");
+ out.flush();
+ String ref = "initial:default -p 12010";
+ Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ test(base != null);
+ out.println("ok");
+
+ out.print("testing checked cast... ");
+ out.flush();
+ InitialPrx initial = InitialPrxHelper.checkedCast(base);
+ test(initial != null);
+ test(initial.equals(base));
+ out.println("ok");
+
+ out.print("testing optional data members... ");
+ out.flush();
+
+ OneOptional oo1 = new OneOptional();
+ test(!oo1.hasA());
+ oo1.setA(15);
+ test(oo1.hasA() && oo1.getA() == 15);
+
+ OneOptional oo2 = new OneOptional(16);
+ test(oo2.hasA() && oo2.getA() == 16);
+
+ MultiOptional mo1 = new MultiOptional();
+ mo1.setA((byte)15);
+ mo1.setB(true);
+ mo1.setC((short)19);
+ mo1.setD(78);
+ mo1.setE(99);
+ mo1.setF((float)5.5);
+ mo1.setG(1.0);
+ mo1.setH("test");
+ mo1.setI(MyEnum.MyEnumMember);
+ mo1.setJ(MultiOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test")));
+ mo1.setK(mo1);
+ mo1.setBs(new byte[] { (byte)5 });
+ mo1.setSs(new String[] { "test", "test2" });
+ mo1.setIid(new java.util.HashMap<Integer, Integer>());
+ mo1.getIid().put(4, 3);
+ mo1.setSid(new java.util.HashMap<String, Integer>());
+ mo1.getSid().put("test", 10);
+ FixedStruct fs = new FixedStruct();
+ fs.m = 78;
+ mo1.setFs(fs);
+ VarStruct vs = new VarStruct();
+ vs.m = "hello";
+ mo1.setVs(vs);
+
+ mo1.setShs(new short[] { (short)1 });
+ mo1.setEs(new MyEnum[] { MyEnum.MyEnumMember, MyEnum.MyEnumMember });
+ mo1.setFss(new FixedStruct[] { fs });
+ mo1.setVss(new VarStruct[] { vs });
+ mo1.setOos(new OneOptional[] { oo1 });
+ mo1.setOops(new OneOptionalPrx[] { OneOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test")) });
+
+ mo1.setIed(new java.util.HashMap<Integer, MyEnum>());
+ mo1.getIed().put(4, MyEnum.MyEnumMember);
+ mo1.setIfsd(new java.util.HashMap<Integer, FixedStruct>());
+ mo1.getIfsd().put(4, fs);
+ mo1.setIvsd(new java.util.HashMap<Integer, VarStruct>());
+ mo1.getIvsd().put(5, vs);
+ mo1.setIood(new java.util.HashMap<Integer, OneOptional>());
+ mo1.getIood().put(5, new OneOptional(15));
+ mo1.setIoopd(new java.util.HashMap<Integer, OneOptionalPrx>());
+ mo1.getIoopd().put(5, OneOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test")));
+
+ mo1.setBos(new boolean[] { false, true, false });
+
+ mo1.setSer(new SerializableClass(58));
+
+ test(mo1.getA() == (byte)15);
+ test(mo1.getB());
+ test(mo1.isB());
+ test(mo1.getC() == (short)19);
+ test(mo1.getD() == 78);
+ test(mo1.getE() == 99);
+ test(mo1.getF() == (float)5.5);
+ test(mo1.getG() == 1.0);
+ test(mo1.getH().equals("test"));
+ test(mo1.getI() == MyEnum.MyEnumMember);
+ test(mo1.getJ().equals(MultiOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test"))));
+ test(mo1.getK() == mo1);
+ test(java.util.Arrays.equals(mo1.getBs(), new byte[] { (byte)5 }));
+ test(java.util.Arrays.equals(mo1.getSs(), new String[] { "test", "test2" }));
+ test(mo1.getIid().get(4) == 3);
+ test(mo1.getSid().get("test") == 10);
+ test(mo1.getFs().equals(new FixedStruct(78)));
+ test(mo1.getVs().equals(new VarStruct("hello")));
+
+ test(mo1.getShs()[0] == (short)1);
+ test(mo1.getEs()[0] == MyEnum.MyEnumMember && mo1.getEs()[1] == MyEnum.MyEnumMember);
+ test(mo1.getFss()[0].equals(new FixedStruct(78)));
+ test(mo1.getVss()[0].equals(new VarStruct("hello")));
+ test(mo1.getOos()[0] == oo1);
+ test(mo1.getOops()[0].equals(OneOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test"))));
+
+ test(mo1.getIed().get(4) == MyEnum.MyEnumMember);
+ test(mo1.getIfsd().get(4).equals(new FixedStruct(78)));
+ test(mo1.getIvsd().get(5).equals(new VarStruct("hello")));
+ test(mo1.getIood().get(5).getA() == 15);
+ test(mo1.getIoopd().get(5).equals(OneOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test"))));
+
+ test(java.util.Arrays.equals(mo1.getBos(), new boolean[] { false, true, false }));
+
+ test(mo1.getSer().equals(new SerializableClass(58)));
+
+ out.println("ok");
+
+ out.print("testing marshaling... ");
+ out.flush();
+
+ OneOptional oo4 = (OneOptional)initial.pingPong(new OneOptional());
+ test(!oo4.hasA());
+
+ OneOptional oo5 = (OneOptional)initial.pingPong(oo1);
+ test(oo1.getA() == oo5.getA());
+
+ MultiOptional mo4 = (MultiOptional)initial.pingPong(new MultiOptional());
+ test(!mo4.hasA());
+ test(!mo4.hasB());
+ test(!mo4.hasC());
+ test(!mo4.hasD());
+ test(!mo4.hasE());
+ test(!mo4.hasF());
+ test(!mo4.hasG());
+ test(!mo4.hasH());
+ test(!mo4.hasI());
+ test(!mo4.hasJ());
+ test(!mo4.hasK());
+ test(!mo4.hasBs());
+ test(!mo4.hasSs());
+ test(!mo4.hasIid());
+ test(!mo4.hasSid());
+ test(!mo4.hasFs());
+ test(!mo4.hasVs());
+
+ test(!mo4.hasShs());
+ test(!mo4.hasEs());
+ test(!mo4.hasFss());
+ test(!mo4.hasVss());
+ test(!mo4.hasOos());
+ test(!mo4.hasOops());
+
+ test(!mo4.hasIed());
+ test(!mo4.hasIfsd());
+ test(!mo4.hasIvsd());
+ test(!mo4.hasIood());
+ test(!mo4.hasIoopd());
+
+ test(!mo4.hasBos());
+
+ test(!mo4.hasSer());
+
+ final boolean supportsJavaSerializable = initial.supportsJavaSerializable();
+ if(!supportsJavaSerializable)
+ {
+ mo1.clearSer();
+ }
+
+ MultiOptional mo5 = (MultiOptional)initial.pingPong(mo1);
+ test(mo5.getA() == mo1.getA());
+ test(mo5.getB() == mo1.getB());
+ test(mo5.getC() == mo1.getC());
+ test(mo5.getD() == mo1.getD());
+ test(mo5.getE() == mo1.getE());
+ test(mo5.getF() == mo1.getF());
+ test(mo5.getG() == mo1.getG());
+ test(mo5.getH().equals(mo1.getH()));
+ test(mo5.getI() == mo1.getI());
+ test(mo5.getJ().equals(mo1.getJ()));
+ test(mo5.getK() == mo5);
+ test(java.util.Arrays.equals(mo5.getBs(), mo1.getBs()));
+ test(java.util.Arrays.equals(mo5.getSs(), mo1.getSs()));
+ test(mo5.getIid().get(4) == 3);
+ test(mo5.getSid().get("test") == 10);
+ test(mo5.getFs().equals(mo1.getFs()));
+ test(mo5.getVs().equals(mo1.getVs()));
+ test(java.util.Arrays.equals(mo5.getShs(), mo1.getShs()));
+ test(mo5.getEs()[0] == MyEnum.MyEnumMember && mo1.getEs()[1] == MyEnum.MyEnumMember);
+ test(mo5.getFss()[0].equals(new FixedStruct(78)));
+ test(mo5.getVss()[0].equals(new VarStruct("hello")));
+ test(mo5.getOos()[0].getA() == 15);
+ test(mo5.getOops()[0].equals(OneOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test"))));
+
+ test(mo5.getIed().get(4) == MyEnum.MyEnumMember);
+ test(mo5.getIfsd().get(4).equals(new FixedStruct(78)));
+ test(mo5.getIvsd().get(5).equals(new VarStruct("hello")));
+ test(mo5.getIood().get(5).getA() == 15);
+ test(mo5.getIoopd().get(5).equals(OneOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test"))));
+
+ test(java.util.Arrays.equals(mo5.getBos(), new boolean[] { false, true, false }));
+
+ if(supportsJavaSerializable)
+ {
+ test(mo5.getSer().equals(mo1.getSer()));
+ }
+
+ // Clear the first half of the optional parameters
+ MultiOptional mo6 = new MultiOptional();
+ mo6.setB(mo5.getB());
+ mo6.setD(mo5.getD());
+ mo6.setF(mo5.getF());
+ mo6.setH(mo5.getH());
+ mo6.setJ(mo5.getJ());
+ mo6.setBs(mo5.getBs());
+ mo6.setIid(mo5.getIid());
+ mo6.setFs(mo5.getFs());
+ mo6.setShs(mo5.getShs());
+ mo6.setFss(mo5.getFss());
+ mo6.setOos(mo5.getOos());
+ mo6.setIfsd(mo5.getIfsd());
+ mo6.setIood(mo5.getIood());
+ mo6.setBos(mo5.getBos());
+
+ MultiOptional mo7 = (MultiOptional)initial.pingPong(mo6);
+ test(!mo7.hasA());
+ test(mo7.getB() == mo1.getB());
+ test(!mo7.hasC());
+ test(mo7.getD() == mo1.getD());
+ test(!mo7.hasE());
+ test(mo7.getF() == mo1.getF());
+ test(!mo7.hasG());
+ test(mo7.getH().equals(mo1.getH()));
+ test(!mo7.hasI());
+ test(mo7.getJ().equals(mo1.getJ()));
+ test(!mo7.hasK());
+ test(java.util.Arrays.equals(mo7.getBs(), mo1.getBs()));
+ test(!mo7.hasSs());
+ test(mo7.getIid().get(4) == 3);
+ test(!mo7.hasSid());
+ test(mo7.getFs().equals(mo1.getFs()));
+ test(!mo7.hasVs());
+
+ test(java.util.Arrays.equals(mo7.getShs(), mo1.getShs()));
+ test(!mo7.hasEs());
+ test(mo7.getFss()[0].equals(new FixedStruct(78)));
+ test(!mo7.hasVss());
+ test(mo7.getOos()[0].getA() == 15);
+ test(!mo7.hasOops());
+
+ test(!mo7.hasIed());
+ test(mo7.getIfsd().get(4).equals(new FixedStruct(78)));
+ test(!mo7.hasIvsd());
+ test(mo7.getIood().get(5).getA() == 15);
+ test(!mo7.hasIoopd());
+
+ test(java.util.Arrays.equals(mo7.getBos(), new boolean[] { false, true, false }));
+
+ // Clear the second half of the optional parameters
+ MultiOptional mo8 = new MultiOptional();
+ mo8.setA(mo5.getA());
+ mo8.setC(mo5.getC());
+ mo8.setE(mo5.getE());
+ mo8.setG(mo5.getG());
+ mo8.setI(mo5.getI());
+ mo8.setK(mo8);
+ mo8.setSs(mo5.getSs());
+ mo8.setSid(mo5.getSid());
+ mo8.setVs(mo5.getVs());
+
+ mo8.setEs(mo5.getEs());
+ mo8.setVss(mo5.getVss());
+ mo8.setOops(mo5.getOops());
+
+ mo8.setIed(mo5.getIed());
+ mo8.setIvsd(mo5.getIvsd());
+ mo8.setIoopd(mo5.getIoopd());
+
+ MultiOptional mo9 = (MultiOptional)initial.pingPong(mo8);
+ test(mo9.getA() == mo1.getA());
+ test(!mo9.hasB());
+ test(mo9.getC() == mo1.getC());
+ test(!mo9.hasD());
+ test(mo9.getE() == mo1.getE());
+ test(!mo9.hasF());
+ test(mo9.getG() == mo1.getG());
+ test(!mo9.hasH());
+ test(mo9.getI() == mo1.getI());
+ test(!mo9.hasJ());
+ test(mo9.getK() == mo9);
+ test(!mo9.hasBs());
+ test(java.util.Arrays.equals(mo9.getSs(), mo1.getSs()));
+ test(!mo9.hasIid());
+ test(mo9.getSid().get("test") == 10);
+ test(!mo9.hasFs());
+ test(mo9.getVs().equals(mo1.getVs()));
+
+ test(!mo9.hasShs());
+ test(mo9.getEs()[0] == MyEnum.MyEnumMember && mo1.getEs()[1] == MyEnum.MyEnumMember);
+ test(!mo9.hasFss());
+ test(mo9.getVss()[0].equals(new VarStruct("hello")));
+ test(!mo9.hasOos());
+ test(mo9.getOops()[0].equals(OneOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test"))));
+
+ test(mo9.getIed().get(4) == MyEnum.MyEnumMember);
+ test(!mo9.hasIfsd());
+ test(mo9.getIvsd().get(5).equals(new VarStruct("hello")));
+ test(!mo9.hasIood());
+ test(mo9.getIoopd().get(5).equals(OneOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test"))));
+
+ test(!mo9.hasBos());
+
+ {
+ OptionalWithCustom owc1 = new OptionalWithCustom();
+ java.util.ArrayList<SmallStruct> l = new java.util.ArrayList<SmallStruct>();
+ l.add(new SmallStruct((byte)5));
+ l.add(new SmallStruct((byte)6));
+ l.add(new SmallStruct((byte)7));
+ owc1.setL(l);
+ owc1.setS(new ClassVarStruct(5));
+ OptionalWithCustom owc2 = (OptionalWithCustom)initial.pingPong(owc1);
+ test(owc2.hasL());
+ test(owc2.getL().equals(l));
+ test(owc2.hasS());
+ test(owc2.getS().a == 5);
+ }
+
+ //
+ // Send a request using blobjects. Upon receival, we don't read
+ // any of the optional members. This ensures the optional members
+ // are skipped even if the receiver knows nothing about them.
+ //
+ factory.setEnabled(true);
+ Ice.OutputStream os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeValue(oo1);
+ os.endEncapsulation();
+ byte[] inEncaps = os.finished();
+ Ice.ByteSeqHolder outEncaps = new Ice.ByteSeqHolder();
+ test(initial.ice_invoke("pingPong", Ice.OperationMode.Normal, inEncaps, outEncaps));
+ Ice.InputStream in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ ReadValueCallbackI cb = new ReadValueCallbackI();
+ in.readValue(cb);
+ in.endEncapsulation();
+ test(cb.obj != null && cb.obj instanceof TestObjectReader);
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeValue(mo1);
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ test(initial.ice_invoke("pingPong", Ice.OperationMode.Normal, inEncaps, outEncaps));
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.readValue(cb);
+ in.endEncapsulation();
+ test(cb.obj != null && cb.obj instanceof TestObjectReader);
+ factory.setEnabled(false);
+
+ //
+ // Use the 1.0 encoding with operations whose only class parameters are optional.
+ //
+ Ice.Optional<OneOptional> oo = new Ice.Optional<OneOptional>(new OneOptional(53));
+ initial.sendOptionalClass(true, oo);
+ InitialPrx initial2 = (InitialPrx)initial.ice_encodingVersion(Ice.Util.Encoding_1_0);
+ initial2.sendOptionalClass(true, oo);
+
+ initial.returnOptionalClass(true, oo);
+ test(oo.isSet());
+ initial2.returnOptionalClass(true, oo);
+ test(!oo.isSet());
+
+ Recursive[] recursive1 = new Recursive[1];
+ recursive1[0] = new Recursive();
+ Recursive[] recursive2 = new Recursive[1];
+ recursive2[0] = new Recursive();
+ recursive1[0].setValue(recursive2);
+ Recursive outer = new Recursive();
+ outer.setValue(recursive1);
+ initial.pingPong(outer);
+
+ G g = new G();
+ g.setGg1Opt(new G1("gg1Opt"));
+ g.gg2 = new G2(10);
+ g.setGg2Opt(new G2(20));
+ g.gg1 = new G1("gg1");
+ g = initial.opG(g);
+ test("gg1Opt".equals(g.getGg1Opt().a));
+ test(10 == g.gg2.a);
+ test(20 == g.getGg2Opt().a);
+ test("gg1".equals(g.gg1.a));
+
+ initial.opVoid();
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(1, Ice.OptionalFormat.F4);
+ os.writeInt(15);
+ os.writeOptional(1, Ice.OptionalFormat.VSize);
+ os.writeString("test");
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ test(initial.ice_invoke("opVoid", Ice.OperationMode.Normal, inEncaps, outEncaps));
+
+ out.println("ok");
+
+ out.print("testing marshaling of large containers with fixed size elements... ");
+ out.flush();
+ MultiOptional mc = new MultiOptional();
+
+ mc.setBs(new byte[1000]);
+ mc.setShs(new short[300]);
+
+ mc.setFss(new FixedStruct[300]);
+ for(int i = 0; i < 300; ++i)
+ {
+ mc.getFss()[i] = new FixedStruct();
+ }
+
+ mc.setIfsd(new java.util.HashMap<Integer, FixedStruct>());
+ for(int i = 0; i < 300; ++i)
+ {
+ mc.getIfsd().put(i, new FixedStruct());
+ }
+
+ mc = (MultiOptional)initial.pingPong(mc);
+ test(mc.getBs().length == 1000);
+ test(mc.getShs().length == 300);
+ test(mc.getFss().length == 300);
+ test(mc.getIfsd().size() == 300);
+
+ factory.setEnabled(true);
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeValue(mc);
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ outEncaps = new Ice.ByteSeqHolder();
+ test(initial.ice_invoke("pingPong", Ice.OperationMode.Normal, inEncaps, outEncaps));
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.readValue(cb);
+ in.endEncapsulation();
+ test(cb.obj != null && cb.obj instanceof TestObjectReader);
+ factory.setEnabled(false);
+
+ out.println("ok");
+
+ out.print("testing tag marshaling... ");
+ out.flush();
+ {
+ B b = new B();
+ B b2 = (B)initial.pingPong(b);
+ test(!b2.hasMa());
+ test(!b2.hasMb());
+ test(!b2.hasMc());
+
+ b.setMa(10);
+ b.setMb(11);
+ b.setMc(12);
+ b.setMd(13);
+
+ b2 = (B)initial.pingPong(b);
+ test(b2.getMa() == 10);
+ test(b2.getMb() == 11);
+ test(b2.getMc() == 12);
+ test(b2.getMd() == 13);
+
+ factory.setEnabled(true);
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeValue(b);
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ outEncaps = new Ice.ByteSeqHolder();
+ test(initial.ice_invoke("pingPong", Ice.OperationMode.Normal, inEncaps, outEncaps));
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.readValue(cb);
+ in.endEncapsulation();
+ test(cb.obj != null);
+ factory.setEnabled(false);
+ }
+ out.println("ok");
+
+ out.print("testing marshalling of objects with optional objects...");
+ out.flush();
+ {
+ F f = new F();
+
+ f.setAf(new A());
+ f.ae = f.getAf();
+
+ F rf = (F)initial.pingPong(f);
+ test(rf.ae == rf.getAf());
+
+ factory.setEnabled(true);
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeValue(f);
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ in = new Ice.InputStream(communicator, inEncaps);
+ in.startEncapsulation();
+ final FHolder fholder = new FHolder();
+ in.readValue(new Ice.ReadValueCallback()
+ {
+ @Override
+ public void valueReady(Ice.Object obj)
+ {
+ fholder.value = ((FObjectReader)obj).getF();
+ }
+ });
+ in.endEncapsulation();
+ factory.setEnabled(false);
+ rf = fholder.value;
+ test(rf.ae != null && !rf.hasAf());
+ }
+ out.println("ok");
+
+ out.print("testing optional with default values... ");
+ out.flush();
+ {
+ WD wd = (WD)initial.pingPong(new WD());
+ test(wd.getA() == 5);
+ test(wd.getS().equals("test"));
+ wd.clearA();
+ wd.clearS();
+ wd = (WD)initial.pingPong(wd);
+ test(!wd.hasA());
+ test(!wd.hasS());
+ }
+ out.println("ok");
+
+ if(communicator.getProperties().getPropertyAsInt("Ice.Default.SlicedFormat") > 0)
+ {
+ out.print("testing marshaling with unknown class slices... ");
+ out.flush();
+ {
+ C c = new C();
+ c.ss = "test";
+ c.setMs("testms");
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeValue(c);
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ factory.setEnabled(true);
+ test(initial.ice_invoke("pingPong", Ice.OperationMode.Normal, inEncaps, outEncaps));
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.readValue(cb);
+ in.endEncapsulation();
+ test(cb.obj instanceof CObjectReader);
+ factory.setEnabled(false);
+
+ factory.setEnabled(true);
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ Ice.Object d = new DObjectWriter();
+ os.writeValue(d);
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ test(initial.ice_invoke("pingPong", Ice.OperationMode.Normal, inEncaps, outEncaps));
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.readValue(cb);
+ in.endEncapsulation();
+ test(cb.obj != null && cb.obj instanceof DObjectReader);
+ ((DObjectReader)cb.obj).check();
+ factory.setEnabled(false);
+ }
+ out.println("ok");
+
+ out.print("testing optionals with unknown classes...");
+ out.flush();
+ {
+ A a = new A();
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeValue(a);
+ os.writeOptional(1, Ice.OptionalFormat.Class);
+ os.writeValue(new DObjectWriter());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ test(initial.ice_invoke("opClassAndUnknownOptional", Ice.OperationMode.Normal, inEncaps, outEncaps));
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ out.println("ok");
+ }
+
+ out.print("testing optional parameters... ");
+ out.flush();
+ final boolean reqParams = initial.supportsRequiredParams();
+
+ {
+
+ Ice.ByteOptional p1 = new Ice.ByteOptional();
+ Ice.ByteOptional p3 = new Ice.ByteOptional();
+ Ice.ByteOptional p2 = initial.opByte(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set((byte)56);
+ p2 = initial.opByte(p1, p3);
+ test(p2.get() == (byte)56 && p3.get() == (byte)56);
+ Ice.AsyncResult r = initial.begin_opByte(p1);
+ p2 = initial.end_opByte(p3, r);
+ test(p2.get() == (byte)56 && p3.get() == (byte)56);
+ p2 = initial.opByte(new Ice.ByteOptional(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opByteReq(p1.get(), p3);
+ test(p2.get() == (byte)56 && p3.get() == (byte)56);
+ r = initial.begin_opByteReq(p1.get());
+ p2 = initial.end_opByteReq(p3, r);
+ test(p2.get() == (byte)56 && p3.get() == (byte)56);
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.F1);
+ os.writeByte(p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opByteReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.F1));
+ test(in.readByte() == (byte)56);
+ test(in.readOptional(3, Ice.OptionalFormat.F1));
+ test(in.readByte() == (byte)56);
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.BooleanOptional p1 = new Ice.BooleanOptional();
+ Ice.BooleanOptional p3 = new Ice.BooleanOptional();
+ Ice.BooleanOptional p2 = initial.opBool(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(true);
+ p2 = initial.opBool(p1, p3);
+ test(p2.get() == true && p3.get() == true);
+ Ice.AsyncResult r = initial.begin_opBool(p1);
+ p2 = initial.end_opBool(p3, r);
+ test(p2.get() == true && p3.get() == true);
+ p2 = initial.opBool(new Ice.BooleanOptional(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opBoolReq(true, p3);
+ test(p2.get() == true && p3.get() == true);
+ r = initial.begin_opBoolReq(true);
+ p2 = initial.end_opBoolReq(p3, r);
+ test(p2.get() == true && p3.get() == true);
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.F1);
+ os.writeBool(p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opBoolReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.F1));
+ test(in.readBool() == true);
+ test(in.readOptional(3, Ice.OptionalFormat.F1));
+ test(in.readBool() == true);
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.ShortOptional p1 = new Ice.ShortOptional();
+ Ice.ShortOptional p3 = new Ice.ShortOptional();
+ Ice.ShortOptional p2 = initial.opShort(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set((short)56);
+ p2 = initial.opShort(p1, p3);
+ test(p2.get() == 56 && p3.get() == 56);
+ Ice.AsyncResult r = initial.begin_opShort(p1);
+ p2 = initial.end_opShort(p3, r);
+ test(p2.get() == 56 && p3.get() == 56);
+ p2 = initial.opShort(new Ice.ShortOptional(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opShortReq(p1.get(), p3);
+ test(p2.get() == 56 && p3.get() == 56);
+ r = initial.begin_opShortReq(p1.get());
+ p2 = initial.end_opShortReq(p3, r);
+ test(p2.get() == 56 && p3.get() == 56);
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.F2);
+ os.writeShort(p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opShortReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.F2));
+ test(in.readShort() == 56);
+ test(in.readOptional(3, Ice.OptionalFormat.F2));
+ test(in.readShort() == 56);
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.IntOptional p1 = new Ice.IntOptional();
+ Ice.IntOptional p3 = new Ice.IntOptional();
+ Ice.IntOptional p2 = initial.opInt(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(56);
+ p2 = initial.opInt(p1, p3);
+ test(p2.get() == 56 && p3.get() == 56);
+ Ice.AsyncResult r = initial.begin_opInt(p1);
+ p2 = initial.end_opInt(p3, r);
+ test(p2.get() == 56 && p3.get() == 56);
+ p2 = initial.opInt(new Ice.IntOptional(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opIntReq(p1.get(), p3);
+ test(p2.get() == 56 && p3.get() == 56);
+ r = initial.begin_opIntReq(p1.get());
+ p2 = initial.end_opIntReq(p3, r);
+ test(p2.get() == 56 && p3.get() == 56);
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.F4);
+ os.writeInt(p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opIntReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.F4));
+ test(in.readInt() == 56);
+ test(in.readOptional(3, Ice.OptionalFormat.F4));
+ test(in.readInt() == 56);
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.LongOptional p1 = new Ice.LongOptional();
+ Ice.LongOptional p3 = new Ice.LongOptional();
+ Ice.LongOptional p2 = initial.opLong(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(56);
+ p2 = initial.opLong(p1, p3);
+ test(p2.get() == 56 && p3.get() == 56);
+ Ice.AsyncResult r = initial.begin_opLong(p1);
+ p2 = initial.end_opLong(p3, r);
+ test(p2.get() == 56 && p3.get() == 56);
+ p2 = initial.opLong(new Ice.LongOptional(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opLongReq(p1.get(), p3);
+ test(p2.get() == 56 && p3.get() == 56);
+ r = initial.begin_opLongReq(p1.get());
+ p2 = initial.end_opLongReq(p3, r);
+ test(p2.get() == 56 && p3.get() == 56);
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(1, Ice.OptionalFormat.F8);
+ os.writeLong(p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opLongReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(2, Ice.OptionalFormat.F8));
+ test(in.readLong() == 56);
+ test(in.readOptional(3, Ice.OptionalFormat.F8));
+ test(in.readLong() == 56);
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.FloatOptional p1 = new Ice.FloatOptional();
+ Ice.FloatOptional p3 = new Ice.FloatOptional();
+ Ice.FloatOptional p2 = initial.opFloat(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set((float)1.0);
+ p2 = initial.opFloat(p1, p3);
+ test(p2.get() == 1.0 && p3.get() == 1.0);
+ Ice.AsyncResult r = initial.begin_opFloat(p1);
+ p2 = initial.end_opFloat(p3, r);
+ test(p2.get() == 1.0 && p3.get() == 1.0);
+ p2 = initial.opFloat(new Ice.FloatOptional(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opFloatReq(p1.get(), p3);
+ test(p2.get() == 1.0 && p3.get() == 1.0);
+ r = initial.begin_opFloatReq(p1.get());
+ p2 = initial.end_opFloatReq(p3, r);
+ test(p2.get() == 1.0 && p3.get() == 1.0);
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.F4);
+ os.writeFloat(p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opFloatReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.F4));
+ test(in.readFloat() == 1.0);
+ test(in.readOptional(3, Ice.OptionalFormat.F4));
+ test(in.readFloat() == 1.0);
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.DoubleOptional p1 = new Ice.DoubleOptional();
+ Ice.DoubleOptional p3 = new Ice.DoubleOptional();
+ Ice.DoubleOptional p2 = initial.opDouble(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(1.0);
+ p2 = initial.opDouble(p1, p3);
+ test(p2.get() == 1.0 && p3.get() == 1.0);
+ Ice.AsyncResult r = initial.begin_opDouble(p1);
+ p2 = initial.end_opDouble(p3, r);
+ test(p2.get() == 1.0 && p3.get() == 1.0);
+ p2 = initial.opDouble(new Ice.DoubleOptional(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opDoubleReq(p1.get(), p3);
+ test(p2.get() == 1.0 && p3.get() == 1.0);
+ r = initial.begin_opDoubleReq(p1.get());
+ p2 = initial.end_opDoubleReq(p3, r);
+ test(p2.get() == 1.0 && p3.get() == 1.0);
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.F8);
+ os.writeDouble(p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opDoubleReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.F8));
+ test(in.readDouble() == 1.0);
+ test(in.readOptional(3, Ice.OptionalFormat.F8));
+ test(in.readDouble() == 1.0);
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.Optional<String> p1 = new Ice.Optional<String>();
+ Ice.Optional<String> p3 = new Ice.Optional<String>();
+ Ice.Optional<String> p2 = initial.opString(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set("test");
+ p2 = initial.opString(p1, p3);
+ test(p2.get().equals("test") && p3.get().equals("test"));
+ Ice.AsyncResult r = initial.begin_opString(p1);
+ p2 = initial.end_opString(p3, r);
+ test(p2.get().equals("test") && p3.get().equals("test"));
+ p2 = initial.opString(new Ice.Optional<String>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opStringReq(p1.get(), p3);
+ test(p2.get().equals("test") && p3.get().equals("test"));
+ r = initial.begin_opStringReq(p1.get());
+ p2 = initial.end_opStringReq(p3, r);
+ test(p2.get().equals("test") && p3.get().equals("test"));
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeString(p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opStringReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ test(in.readString().equals("test"));
+ test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ test(in.readString().equals("test"));
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.Optional<MyEnum> p1 = new Ice.Optional<MyEnum>();
+ Ice.Optional<MyEnum> p3 = new Ice.Optional<MyEnum>();
+ Ice.Optional<MyEnum> p2 = initial.opMyEnum(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(MyEnum.MyEnumMember);
+ p2 = initial.opMyEnum(p1, p3);
+ test(p2.get() == MyEnum.MyEnumMember && p3.get() == MyEnum.MyEnumMember);
+ p1.set(MyEnum.MyEnumMember);
+ p2 = initial.opMyEnum(new Ice.Optional<MyEnum>((MyEnum)null), p3); // Test null enum
+ test(p2.get() == MyEnum.MyEnumMember && p3.get() == MyEnum.MyEnumMember);
+ Ice.AsyncResult r = initial.begin_opMyEnum(p1);
+ p2 = initial.end_opMyEnum(p3, r);
+ test(p2.get() == MyEnum.MyEnumMember && p3.get() == MyEnum.MyEnumMember);
+ p2 = initial.opMyEnum(new Ice.Optional<MyEnum>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opMyEnumReq(p1.get(), p3);
+ test(p2.get() == MyEnum.MyEnumMember && p3.get() == MyEnum.MyEnumMember);
+ r = initial.begin_opMyEnumReq(p1.get());
+ p2 = initial.end_opMyEnumReq(p3, r);
+ test(p2.get() == MyEnum.MyEnumMember && p3.get() == MyEnum.MyEnumMember);
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.Size);
+ MyEnum.write(os, p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opMyEnumReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.Size));
+ test(MyEnum.read(in) == MyEnum.MyEnumMember);
+ test(in.readOptional(3, Ice.OptionalFormat.Size));
+ test(MyEnum.read(in) == MyEnum.MyEnumMember);
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.Optional<SmallStruct> p1 = new Ice.Optional<SmallStruct>();
+ Ice.Optional<SmallStruct> p3 = new Ice.Optional<SmallStruct>();
+ Ice.Optional<SmallStruct> p2 = initial.opSmallStruct(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(new SmallStruct((byte)56));
+ p2 = initial.opSmallStruct(p1, p3);
+ test(p2.get().m == (byte)56 && p3.get().m == (byte)56);
+ p2 = initial.opSmallStruct(new Ice.Optional<SmallStruct>((SmallStruct)null), p3); // Test null struct
+ test(p2.get().m == (byte)0 && p3.get().m == (byte)0);
+ Ice.AsyncResult r = initial.begin_opSmallStruct(p1);
+ p2 = initial.end_opSmallStruct(p3, r);
+ test(p2.get().m == (byte)56 && p3.get().m == (byte)56);
+ p2 = initial.opSmallStruct(new Ice.Optional<SmallStruct>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opSmallStructReq(p1.get(), p3);
+ test(p2.get().m == (byte)56 && p3.get().m == (byte)56);
+ r = initial.begin_opSmallStructReq(p1.get());
+ p2 = initial.end_opSmallStructReq(p3, r);
+ test(p2.get().m == (byte)56 && p3.get().m == (byte)56);
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeSize(1);
+ SmallStruct.write(os, p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opSmallStructReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ SmallStruct f = SmallStruct.read(in, null);
+ test(f.m == (byte)56);
+ test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ SmallStruct.read(in, f);
+ test(f.m == (byte)56);
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.Optional<FixedStruct> p1 = new Ice.Optional<FixedStruct>();
+ Ice.Optional<FixedStruct> p3 = new Ice.Optional<FixedStruct>();
+ Ice.Optional<FixedStruct> p2 = initial.opFixedStruct(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(new FixedStruct(56));
+ p2 = initial.opFixedStruct(p1, p3);
+ test(p2.get().m == 56 && p3.get().m == 56);
+ Ice.AsyncResult r = initial.begin_opFixedStruct(p1);
+ p2 = initial.end_opFixedStruct(p3, r);
+ test(p2.get().m == 56 && p3.get().m == 56);
+ p2 = initial.opFixedStruct(new Ice.Optional<FixedStruct>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opFixedStructReq(p1.get(), p3);
+ test(p2.get().m == 56 && p3.get().m == 56);
+ r = initial.begin_opFixedStructReq(p1.get());
+ p2 = initial.end_opFixedStructReq(p3, r);
+ test(p2.get().m == 56 && p3.get().m == 56);
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeSize(4);
+ FixedStruct.write(os, p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opFixedStructReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ FixedStruct f = FixedStruct.read(in, null);
+ test(f.m == 56);
+ test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ FixedStruct.read(in, f);
+ test(f.m == 56);
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.Optional<VarStruct> p1 = new Ice.Optional<VarStruct>();
+ Ice.Optional<VarStruct> p3 = new Ice.Optional<VarStruct>();
+ Ice.Optional<VarStruct> p2 = initial.opVarStruct(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(new VarStruct("test"));
+ p2 = initial.opVarStruct(p1, p3);
+ test(p2.get().m.equals("test") && p3.get().m.equals("test"));
+ Ice.AsyncResult r = initial.begin_opVarStruct(p1);
+ p2 = initial.end_opVarStruct(p3, r);
+ test(p2.get().m.equals("test") && p3.get().m.equals("test"));
+ p2 = initial.opVarStruct(new Ice.Optional<VarStruct>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opVarStructReq(p1.get(), p3);
+ test(p2.get().m.equals("test") && p3.get().m.equals("test"));
+ r = initial.begin_opVarStructReq(p1.get());
+ p2 = initial.end_opVarStructReq(p3, r);
+ test(p2.get().m.equals("test") && p3.get().m.equals("test"));
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.FSize);
+ int pos = os.startSize();
+ VarStruct.write(os, p1.get());
+ os.endSize(pos);
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opVarStructReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.FSize));
+ in.skip(4);
+ VarStruct v = VarStruct.read(in, null);
+ test(v.m.equals("test"));
+ test(in.readOptional(3, Ice.OptionalFormat.FSize));
+ in.skip(4);
+ VarStruct.read(in, v);
+ test(v.m.equals("test"));
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.Optional<OneOptional> p1 = new Ice.Optional<OneOptional>();
+ Ice.Optional<OneOptional> p3 = new Ice.Optional<OneOptional>();
+ Ice.Optional<OneOptional> p2 = initial.opOneOptional(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(new OneOptional(58));
+ p2 = initial.opOneOptional(p1, p3);
+ test(p2.get().getA() == 58 && p3.get().getA() == 58);
+ Ice.AsyncResult r = initial.begin_opOneOptional(p1);
+ p2 = initial.end_opOneOptional(p3, r);
+ test(p2.get().getA() == 58 && p3.get().getA() == 58);
+ p2 = initial.opOneOptional(new Ice.Optional<OneOptional>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opOneOptionalReq(p1.get(), p3);
+ test(p2.get().getA() == 58 && p3.get().getA() == 58);
+ r = initial.begin_opOneOptionalReq(p1.get());
+ p2 = initial.end_opOneOptionalReq(p3, r);
+ test(p2.get().getA() == 58 && p3.get().getA() == 58);
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.Class);
+ os.writeValue(p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opOneOptionalReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.Class));
+ ReadValueCallbackI p2cb = new ReadValueCallbackI();
+ in.readValue(p2cb);
+ test(in.readOptional(3, Ice.OptionalFormat.Class));
+ ReadValueCallbackI p3cb = new ReadValueCallbackI();
+ in.readValue(p3cb);
+ in.endEncapsulation();
+ test(((OneOptional)p2cb.obj).getA() == 58 && ((OneOptional)p3cb.obj).getA() == 58);
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.Optional<OneOptionalPrx> p1 = new Ice.Optional<OneOptionalPrx>();
+ Ice.Optional<OneOptionalPrx> p3 = new Ice.Optional<OneOptionalPrx>();
+ Ice.Optional<OneOptionalPrx> p2 = initial.opOneOptionalProxy(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(OneOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test")));
+ p2 = initial.opOneOptionalProxy(p1, p3);
+ test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
+ Ice.AsyncResult r = initial.begin_opOneOptionalProxy(p1);
+ p2 = initial.end_opOneOptionalProxy(p3, r);
+ test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
+ p2 = initial.opOneOptionalProxy(new Ice.Optional<OneOptionalPrx>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opOneOptionalProxyReq(p1.get(), p3);
+ test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
+ r = initial.begin_opOneOptionalProxyReq(p1.get());
+ p2 = initial.end_opOneOptionalProxyReq(p3, r);
+ test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.FSize);
+ int pos = os.startSize();
+ os.writeProxy(p1.get());
+ os.endSize(pos);
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opOneOptionalProxyReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.FSize));
+ in.skip(4);
+ test(in.readProxy().equals(p1.get()));
+ test(in.readOptional(3, Ice.OptionalFormat.FSize));
+ in.skip(4);
+ test(in.readProxy().equals(p1.get()));
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+ out.println("ok");
+
+ out.print("testing optional parameters and sequences... ");
+ out.flush();
+ {
+ Ice.Optional<byte[]> p1 = new Ice.Optional<byte[]>();
+ Ice.Optional<byte[]> p3 = new Ice.Optional<byte[]>();
+ Ice.Optional<byte[]> p2 = initial.opByteSeq(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(new byte[100]);
+ java.util.Arrays.fill(p1.get(), (byte)56);
+ p2 = initial.opByteSeq(p1, p3);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ Ice.AsyncResult r = initial.begin_opByteSeq(p1);
+ p2 = initial.end_opByteSeq(p3, r);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ p2 = initial.opByteSeq(new Ice.Optional<byte[]>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opByteSeqReq(p1.get(), p3);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ r = initial.begin_opByteSeqReq(p1.get());
+ p2 = initial.end_opByteSeqReq(p3, r);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeByteSeq(p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opByteSeqReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ test(java.util.Arrays.equals(in.readByteSeq(), p1.get()));
+ test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ test(java.util.Arrays.equals(in.readByteSeq(), p1.get()));
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.Optional<boolean[]> p1 = new Ice.Optional<boolean[]>();
+ Ice.Optional<boolean[]> p3 = new Ice.Optional<boolean[]>();
+ Ice.Optional<boolean[]> p2 = initial.opBoolSeq(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(new boolean[100]);
+ p2 = initial.opBoolSeq(p1, p3);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ Ice.AsyncResult r = initial.begin_opBoolSeq(p1);
+ p2 = initial.end_opBoolSeq(p3, r);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ p2 = initial.opBoolSeq(new Ice.Optional<boolean[]>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opBoolSeqReq(p1.get(), p3);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ r = initial.begin_opBoolSeqReq(p1.get());
+ p2 = initial.end_opBoolSeqReq(p3, r);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeBoolSeq(p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opBoolSeqReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ test(java.util.Arrays.equals(in.readBoolSeq(), p1.get()));
+ test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ test(java.util.Arrays.equals(in.readBoolSeq(), p1.get()));
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.Optional<short[]> p1 = new Ice.Optional<short[]>();
+ Ice.Optional<short[]> p3 = new Ice.Optional<short[]>();
+ Ice.Optional<short[]> p2 = initial.opShortSeq(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(new short[100]);
+ java.util.Arrays.fill(p1.get(), (short)56);
+ p2 = initial.opShortSeq(p1, p3);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ Ice.AsyncResult r = initial.begin_opShortSeq(p1);
+ p2 = initial.end_opShortSeq(p3, r);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ p2 = initial.opShortSeq(new Ice.Optional<short[]>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opShortSeqReq(p1.get(), p3);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ r = initial.begin_opShortSeqReq(p1.get());
+ p2 = initial.end_opShortSeqReq(p3, r);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeSize(p1.get().length * 2 + (p1.get().length > 254 ? 5 : 1));
+ os.writeShortSeq(p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opShortSeqReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ test(java.util.Arrays.equals(in.readShortSeq(), p1.get()));
+ test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ test(java.util.Arrays.equals(in.readShortSeq(), p1.get()));
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.Optional<int[]> p1 = new Ice.Optional<int[]>();
+ Ice.Optional<int[]> p3 = new Ice.Optional<int[]>();
+ Ice.Optional<int[]> p2 = initial.opIntSeq(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(new int[100]);
+ java.util.Arrays.fill(p1.get(), 56);
+ p2 = initial.opIntSeq(p1, p3);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ Ice.AsyncResult r = initial.begin_opIntSeq(p1);
+ p2 = initial.end_opIntSeq(p3, r);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ p2 = initial.opIntSeq(new Ice.Optional<int[]>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opIntSeqReq(p1.get(), p3);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ r = initial.begin_opIntSeqReq(p1.get());
+ p2 = initial.end_opIntSeqReq(p3, r);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeSize(p1.get().length * 4 + (p1.get().length > 254 ? 5 : 1));
+ os.writeIntSeq(p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opIntSeqReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ test(java.util.Arrays.equals(in.readIntSeq(), p1.get()));
+ test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ test(java.util.Arrays.equals(in.readIntSeq(), p1.get()));
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.Optional<long[]> p1 = new Ice.Optional<long[]>();
+ Ice.Optional<long[]> p3 = new Ice.Optional<long[]>();
+ Ice.Optional<long[]> p2 = initial.opLongSeq(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(new long[100]);
+ java.util.Arrays.fill(p1.get(), 56);
+ p2 = initial.opLongSeq(p1, p3);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ Ice.AsyncResult r = initial.begin_opLongSeq(p1);
+ p2 = initial.end_opLongSeq(p3, r);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ p2 = initial.opLongSeq(new Ice.Optional<long[]>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opLongSeqReq(p1.get(), p3);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ r = initial.begin_opLongSeqReq(p1.get());
+ p2 = initial.end_opLongSeqReq(p3, r);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeSize(p1.get().length * 8 + (p1.get().length > 254 ? 5 : 1));
+ os.writeLongSeq(p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opLongSeqReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ test(java.util.Arrays.equals(in.readLongSeq(), p1.get()));
+ test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ test(java.util.Arrays.equals(in.readLongSeq(), p1.get()));
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.Optional<float[]> p1 = new Ice.Optional<float[]>();
+ Ice.Optional<float[]> p3 = new Ice.Optional<float[]>();
+ Ice.Optional<float[]> p2 = initial.opFloatSeq(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(new float[100]);
+ java.util.Arrays.fill(p1.get(), (float)1.0);
+ p2 = initial.opFloatSeq(p1, p3);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ Ice.AsyncResult r = initial.begin_opFloatSeq(p1);
+ p2 = initial.end_opFloatSeq(p3, r);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ p2 = initial.opFloatSeq(new Ice.Optional<float[]>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opFloatSeqReq(p1.get(), p3);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ r = initial.begin_opFloatSeqReq(p1.get());
+ p2 = initial.end_opFloatSeqReq(p3, r);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeSize(p1.get().length * 4 + (p1.get().length > 254 ? 5 : 1));
+ os.writeFloatSeq(p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opFloatSeqReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ test(java.util.Arrays.equals(in.readFloatSeq(), p1.get()));
+ test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ test(java.util.Arrays.equals(in.readFloatSeq(), p1.get()));
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.Optional<double[]> p1 = new Ice.Optional<double[]>();
+ Ice.Optional<double[]> p3 = new Ice.Optional<double[]>();
+ Ice.Optional<double[]> p2 = initial.opDoubleSeq(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(new double[100]);
+ java.util.Arrays.fill(p1.get(), 1.0);
+ p2 = initial.opDoubleSeq(p1, p3);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ Ice.AsyncResult r = initial.begin_opDoubleSeq(p1);
+ p2 = initial.end_opDoubleSeq(p3, r);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ p2 = initial.opDoubleSeq(new Ice.Optional<double[]>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opDoubleSeqReq(p1.get(), p3);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ r = initial.begin_opDoubleSeqReq(p1.get());
+ p2 = initial.end_opDoubleSeqReq(p3, r);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeSize(p1.get().length * 8 + (p1.get().length > 254 ? 5 : 1));
+ os.writeDoubleSeq(p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opDoubleSeqReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ test(java.util.Arrays.equals(in.readDoubleSeq(), p1.get()));
+ test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ test(java.util.Arrays.equals(in.readDoubleSeq(), p1.get()));
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.Optional<String[]> p1 = new Ice.Optional<String[]>();
+ Ice.Optional<String[]> p3 = new Ice.Optional<String[]>();
+ Ice.Optional<String[]> p2 = initial.opStringSeq(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(new String[10]);
+ java.util.Arrays.fill(p1.get(), "test1");
+ p2 = initial.opStringSeq(p1, p3);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ Ice.AsyncResult r = initial.begin_opStringSeq(p1);
+ p2 = initial.end_opStringSeq(p3, r);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ p2 = initial.opStringSeq(new Ice.Optional<String[]>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opStringSeqReq(p1.get(), p3);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ r = initial.begin_opStringSeqReq(p1.get());
+ p2 = initial.end_opStringSeqReq(p3, r);
+ test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.FSize);
+ int pos = os.startSize();
+ os.writeStringSeq(p1.get());
+ os.endSize(pos);
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opStringSeqReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.FSize));
+ in.skip(4);
+ test(java.util.Arrays.equals(in.readStringSeq(), p1.get()));
+ test(in.readOptional(3, Ice.OptionalFormat.FSize));
+ in.skip(4);
+ test(java.util.Arrays.equals(in.readStringSeq(), p1.get()));
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.Optional<SmallStruct[]> p1 = new Ice.Optional<SmallStruct[]>();
+ Ice.Optional<SmallStruct[]> p3 = new Ice.Optional<SmallStruct[]>();
+ Ice.Optional<SmallStruct[]> p2 = initial.opSmallStructSeq(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(new SmallStruct[10]);
+ for(int i = 0; i < p1.get().length; ++i)
+ {
+ p1.get()[i] = new SmallStruct();
+ }
+ p2 = initial.opSmallStructSeq(p1, p3);
+ for(int i = 0; i < p1.get().length; ++i)
+ {
+ test(p2.get()[i].equals(p1.get()[i]));
+ }
+ Ice.AsyncResult r = initial.begin_opSmallStructSeq(p1);
+ p2 = initial.end_opSmallStructSeq(p3, r);
+ for(int i = 0; i < p1.get().length; ++i)
+ {
+ test(p2.get()[i].equals(p1.get()[i]));
+ }
+ p2 = initial.opSmallStructSeq(new Ice.Optional<SmallStruct[]>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opSmallStructSeqReq(p1.get(), p3);
+ for(int i = 0; i < p1.get().length; ++i)
+ {
+ test(p2.get()[i].equals(p1.get()[i]));
+ }
+ r = initial.begin_opSmallStructSeqReq(p1.get());
+ p2 = initial.end_opSmallStructSeqReq(p3, r);
+ for(int i = 0; i < p1.get().length; ++i)
+ {
+ test(p2.get()[i].equals(p1.get()[i]));
+ }
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeSize(p1.get().length + (p1.get().length > 254 ? 5 : 1));
+ SmallStructSeqHelper.write(os, p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opSmallStructSeqReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ SmallStruct[] arr = SmallStructSeqHelper.read(in);
+ for(int i = 0; i < p1.get().length; ++i)
+ {
+ test(arr[i].equals(p1.get()[i]));
+ }
+ test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ arr = SmallStructSeqHelper.read(in);
+ for(int i = 0; i < p1.get().length; ++i)
+ {
+ test(arr[i].equals(p1.get()[i]));
+ }
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.Optional<java.util.List<SmallStruct>> p1 = new Ice.Optional<java.util.List<SmallStruct>>();
+ Ice.Optional<java.util.List<SmallStruct>> p3 = new Ice.Optional<java.util.List<SmallStruct>>();
+ Ice.Optional<java.util.List<SmallStruct>> p2 = initial.opSmallStructList(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(new java.util.ArrayList<SmallStruct>());
+ for(int i = 0; i < 10; ++i)
+ {
+ p1.get().add(new SmallStruct());
+ }
+ p2 = initial.opSmallStructList(p1, p3);
+ test(p2.get().equals(p1.get()));
+ Ice.AsyncResult r = initial.begin_opSmallStructList(p1);
+ p2 = initial.end_opSmallStructList(p3, r);
+ test(p2.get().equals(p1.get()));
+ p2 = initial.opSmallStructList(new Ice.Optional<java.util.List<SmallStruct>>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opSmallStructListReq(p1.get(), p3);
+ test(p2.get().equals(p1.get()));
+ r = initial.begin_opSmallStructListReq(p1.get());
+ p2 = initial.end_opSmallStructListReq(p3, r);
+ test(p2.get().equals(p1.get()));
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeSize(p1.get().size() + (p1.get().size() > 254 ? 5 : 1));
+ SmallStructListHelper.write(os, p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opSmallStructListReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ java.util.List<SmallStruct> arr = SmallStructListHelper.read(in);
+ test(arr.equals(p1.get()));
+ test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ arr = SmallStructListHelper.read(in);
+ test(arr.equals(p1.get()));
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.Optional<FixedStruct[]> p1 = new Ice.Optional<FixedStruct[]>();
+ Ice.Optional<FixedStruct[]> p3 = new Ice.Optional<FixedStruct[]>();
+ Ice.Optional<FixedStruct[]> p2 = initial.opFixedStructSeq(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(new FixedStruct[10]);
+ for(int i = 0; i < p1.get().length; ++i)
+ {
+ p1.get()[i] = new FixedStruct();
+ }
+ p2 = initial.opFixedStructSeq(p1, p3);
+ for(int i = 0; i < p1.get().length; ++i)
+ {
+ test(p2.get()[i].equals(p1.get()[i]));
+ }
+ Ice.AsyncResult r = initial.begin_opFixedStructSeq(p1);
+ p2 = initial.end_opFixedStructSeq(p3, r);
+ for(int i = 0; i < p1.get().length; ++i)
+ {
+ test(p2.get()[i].equals(p1.get()[i]));
+ }
+ p2 = initial.opFixedStructSeq(new Ice.Optional<FixedStruct[]>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opFixedStructSeqReq(p1.get(), p3);
+ for(int i = 0; i < p1.get().length; ++i)
+ {
+ test(p2.get()[i].equals(p1.get()[i]));
+ }
+ r = initial.begin_opFixedStructSeqReq(p1.get());
+ p2 = initial.end_opFixedStructSeqReq(p3, r);
+ for(int i = 0; i < p1.get().length; ++i)
+ {
+ test(p2.get()[i].equals(p1.get()[i]));
+ }
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeSize(p1.get().length * 4 + (p1.get().length > 254 ? 5 : 1));
+ FixedStructSeqHelper.write(os, p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opFixedStructSeqReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ FixedStruct[] arr = FixedStructSeqHelper.read(in);
+ for(int i = 0; i < p1.get().length; ++i)
+ {
+ test(arr[i].equals(p1.get()[i]));
+ }
+ test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ arr = FixedStructSeqHelper.read(in);
+ for(int i = 0; i < p1.get().length; ++i)
+ {
+ test(arr[i].equals(p1.get()[i]));
+ }
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.Optional<java.util.List<FixedStruct>> p1 = new Ice.Optional<java.util.List<FixedStruct>>();
+ Ice.Optional<java.util.List<FixedStruct>> p3 = new Ice.Optional<java.util.List<FixedStruct>>();
+ Ice.Optional<java.util.List<FixedStruct>> p2 = initial.opFixedStructList(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(new java.util.ArrayList<FixedStruct>());
+ for(int i = 0; i < 10; ++i)
+ {
+ p1.get().add(new FixedStruct());
+ }
+ p2 = initial.opFixedStructList(p1, p3);
+ test(p2.get().equals(p1.get()));
+ Ice.AsyncResult r = initial.begin_opFixedStructList(p1);
+ p2 = initial.end_opFixedStructList(p3, r);
+ test(p2.get().equals(p1.get()));
+ p2 = initial.opFixedStructList(new Ice.Optional<java.util.List<FixedStruct>>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opFixedStructListReq(p1.get(), p3);
+ test(p2.get().equals(p1.get()));
+ r = initial.begin_opFixedStructListReq(p1.get());
+ p2 = initial.end_opFixedStructListReq(p3, r);
+ test(p2.get().equals(p1.get()));
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeSize(p1.get().size() * 4 + (p1.get().size() > 254 ? 5 : 1));
+ FixedStructListHelper.write(os, p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opFixedStructListReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ java.util.List<FixedStruct> arr = FixedStructListHelper.read(in);
+ test(arr.equals(p1.get()));
+ test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ arr = FixedStructListHelper.read(in);
+ test(arr.equals(p1.get()));
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.Optional<VarStruct[]> p1 = new Ice.Optional<VarStruct[]>();
+ Ice.Optional<VarStruct[]> p3 = new Ice.Optional<VarStruct[]>();
+ Ice.Optional<VarStruct[]> p2 = initial.opVarStructSeq(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(new VarStruct[10]);
+ for(int i = 0; i < p1.get().length; ++i)
+ {
+ p1.get()[i] = new VarStruct("");
+ }
+ p2 = initial.opVarStructSeq(p1, p3);
+ for(int i = 0; i < p1.get().length; ++i)
+ {
+ test(p2.get()[i].equals(p1.get()[i]));
+ }
+ Ice.AsyncResult r = initial.begin_opVarStructSeq(p1);
+ p2 = initial.end_opVarStructSeq(p3, r);
+ for(int i = 0; i < p1.get().length; ++i)
+ {
+ test(p2.get()[i].equals(p1.get()[i]));
+ }
+ p2 = initial.opVarStructSeq(new Ice.Optional<VarStruct[]>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opVarStructSeqReq(p1.get(), p3);
+ for(int i = 0; i < p1.get().length; ++i)
+ {
+ test(p2.get()[i].equals(p1.get()[i]));
+ }
+ r = initial.begin_opVarStructSeqReq(p1.get());
+ p2 = initial.end_opVarStructSeqReq(p3, r);
+ for(int i = 0; i < p1.get().length; ++i)
+ {
+ test(p2.get()[i].equals(p1.get()[i]));
+ }
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.FSize);
+ int pos = os.startSize();
+ VarStructSeqHelper.write(os, p1.get());
+ os.endSize(pos);
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opVarStructSeqReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.FSize));
+ in.skip(4);
+ VarStruct[] arr = VarStructSeqHelper.read(in);
+ for(int i = 0; i < p1.get().length; ++i)
+ {
+ test(arr[i].equals(p1.get()[i]));
+ }
+ test(in.readOptional(3, Ice.OptionalFormat.FSize));
+ in.skip(4);
+ arr = VarStructSeqHelper.read(in);
+ for(int i = 0; i < p1.get().length; ++i)
+ {
+ test(arr[i].equals(p1.get()[i]));
+ }
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ if(supportsJavaSerializable)
+ {
+ Ice.Optional<SerializableClass> p1 = new Ice.Optional<SerializableClass>();
+ Ice.Optional<SerializableClass> p3 = new Ice.Optional<SerializableClass>();
+ Ice.Optional<SerializableClass> p2 = initial.opSerializable(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(new SerializableClass(58));
+ p2 = initial.opSerializable(p1, p3);
+ test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
+ Ice.AsyncResult r = initial.begin_opSerializable(p1);
+ p2 = initial.end_opSerializable(p3, r);
+ test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
+ p2 = initial.opSerializable(new Ice.Optional<SerializableClass>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opSerializableReq(p1.get(), p3);
+ test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
+ r = initial.begin_opSerializableReq(p1.get());
+ p2 = initial.end_opSerializableReq(p3, r);
+ test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeSerializable(p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opSerializableReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ SerializableClass sc = SerializableHelper.read(in);
+ test(sc.equals(p1.get()));
+ test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ sc = SerializableHelper.read(in);
+ test(sc.equals(p1.get()));
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+ out.println("ok");
+
+ out.print("testing optional parameters and dictionaries... ");
+ out.flush();
+ {
+ Ice.Optional<java.util.Map<Integer, Integer>> p1 = new Ice.Optional<java.util.Map<Integer, Integer>>();
+ Ice.Optional<java.util.Map<Integer, Integer>> p3 = new Ice.Optional<java.util.Map<Integer, Integer>>();
+ Ice.Optional<java.util.Map<Integer, Integer>> p2 = initial.opIntIntDict(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(new java.util.HashMap<Integer, Integer>());
+ p1.get().put(1, 2);
+ p1.get().put(2, 3);
+ p2 = initial.opIntIntDict(p1, p3);
+ test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
+ Ice.AsyncResult r = initial.begin_opIntIntDict(p1);
+ p2 = initial.end_opIntIntDict(p3, r);
+ test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
+ p2 = initial.opIntIntDict(new Ice.Optional<java.util.Map<Integer, Integer>>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opIntIntDictReq(p1.get(), p3);
+ test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
+ r = initial.begin_opIntIntDictReq(p1.get());
+ p2 = initial.end_opIntIntDictReq(p3, r);
+ test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeSize(p1.get().size() * 8 + (p1.get().size() > 254 ? 5 : 1));
+ IntIntDictHelper.write(os, p1.get());
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opIntIntDictReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ java.util.Map<Integer, Integer> m = IntIntDictHelper.read(in);
+ test(m.equals(p1.get()));
+ test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ in.skipSize();
+ m = IntIntDictHelper.read(in);
+ test(m.equals(p1.get()));
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.Optional<java.util.Map<String, Integer>> p1 = new Ice.Optional<java.util.Map<String, Integer>>();
+ Ice.Optional<java.util.Map<String, Integer>> p3 = new Ice.Optional<java.util.Map<String, Integer>>();
+ Ice.Optional<java.util.Map<String, Integer>> p2 = initial.opStringIntDict(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(new java.util.HashMap<String, Integer>());
+ p1.get().put("1", 1);
+ p1.get().put("2", 2);
+ p2 = initial.opStringIntDict(p1, p3);
+ test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
+ Ice.AsyncResult r = initial.begin_opStringIntDict(p1);
+ p2 = initial.end_opStringIntDict(p3, r);
+ test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
+ p2 = initial.opStringIntDict(new Ice.Optional<java.util.Map<String, Integer>>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opStringIntDictReq(p1.get(), p3);
+ test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
+ r = initial.begin_opStringIntDictReq(p1.get());
+ p2 = initial.end_opStringIntDictReq(p3, r);
+ test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.FSize);
+ int pos = os.startSize();
+ StringIntDictHelper.write(os, p1.get());
+ os.endSize(pos);
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opStringIntDictReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.FSize));
+ in.skip(4);
+ java.util.Map<String, Integer> m = StringIntDictHelper.read(in);
+ test(m.equals(p1.get()));
+ test(in.readOptional(3, Ice.OptionalFormat.FSize));
+ in.skip(4);
+ m = StringIntDictHelper.read(in);
+ test(m.equals(p1.get()));
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ Ice.Optional<java.util.Map<Integer, OneOptional>> p1 = new Ice.Optional<java.util.Map<Integer, OneOptional>>();
+ Ice.Optional<java.util.Map<Integer, OneOptional>> p3 = new Ice.Optional<java.util.Map<Integer, OneOptional>>();
+ Ice.Optional<java.util.Map<Integer, OneOptional>> p2 = initial.opIntOneOptionalDict(p1, p3);
+ test(!p2.isSet() && !p3.isSet());
+
+ p1.set(new java.util.HashMap<Integer, OneOptional>());
+ p1.get().put(1, new OneOptional(15));
+ p1.get().put(2, new OneOptional(12));
+ p2 = initial.opIntOneOptionalDict(p1, p3);
+ test(p2.get().get(1).getA() == 15 && p3.get().get(1).getA() == 15);
+ test(p2.get().get(2).getA() == 12 && p3.get().get(2).getA() == 12);
+ Ice.AsyncResult r = initial.begin_opIntOneOptionalDict(p1);
+ p2 = initial.end_opIntOneOptionalDict(p3, r);
+ test(p2.get().get(1).getA() == 15 && p3.get().get(1).getA() == 15);
+ test(p2.get().get(2).getA() == 12 && p3.get().get(2).getA() == 12);
+ p2 = initial.opIntOneOptionalDict(new Ice.Optional<java.util.Map<Integer, OneOptional>>(), p3);
+ test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+
+ if(reqParams)
+ {
+ p2 = initial.opIntOneOptionalDictReq(p1.get(), p3);
+ test(p2.get().get(1).getA() == 15 && p3.get().get(1).getA() == 15);
+ test(p2.get().get(2).getA() == 12 && p3.get().get(2).getA() == 12);
+ r = initial.begin_opIntOneOptionalDictReq(p1.get());
+ p2 = initial.end_opIntOneOptionalDictReq(p3, r);
+ test(p2.get().get(1).getA() == 15 && p3.get().get(1).getA() == 15);
+ test(p2.get().get(2).getA() == 12 && p3.get().get(2).getA() == 12);
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(2, Ice.OptionalFormat.FSize);
+ int pos = os.startSize();
+ IntOneOptionalDictHelper.write(os, p1.get());
+ os.endSize(pos);
+ os.endEncapsulation();
+ inEncaps = os.finished();
+ initial.ice_invoke("opIntOneOptionalDictReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ test(in.readOptional(1, Ice.OptionalFormat.FSize));
+ in.skip(4);
+ java.util.Map<Integer, OneOptional> m = IntOneOptionalDictHelper.read(in);
+ test(m.get(1).getA() == 15 && m.get(2).getA() == 12);
+ test(in.readOptional(3, Ice.OptionalFormat.FSize));
+ in.skip(4);
+ m = IntOneOptionalDictHelper.read(in);
+ test(m.get(1).getA() == 15 && m.get(2).getA() == 12);
+ in.endEncapsulation();
+
+ in = new Ice.InputStream(communicator, outEncaps.value);
+ in.startEncapsulation();
+ in.endEncapsulation();
+ }
+ }
+
+ {
+ F f = new F();
+ f.setAf(new A());
+ f.getAf().requiredA = 56;
+ f.ae = f.getAf();
+
+ os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.writeOptional(1, Ice.OptionalFormat.Class);
+ os.writeValue(f);
+ os.writeOptional(2, Ice.OptionalFormat.Class);
+ os.writeValue(f.ae);
+ os.endEncapsulation();
+ inEncaps = os.finished();
+
+ in = new Ice.InputStream(communicator, inEncaps);
+ in.startEncapsulation();
+ test(in.readOptional(2, Ice.OptionalFormat.Class));
+ final AHolder a = new AHolder();
+ in.readValue(new Ice.ReadValueCallback()
+ {
+ @Override
+ public void valueReady(Ice.Object obj)
+ {
+ a.value = (A)obj;
+ }
+ });
+ in.endEncapsulation();
+ test(a.value != null && a.value.requiredA == 56);
+ }
+ out.println("ok");
+
+ out.print("testing exception optionals... ");
+ out.flush();
+ {
+ try
+ {
+ Ice.IntOptional a = new Ice.IntOptional();
+ Ice.Optional<String> b = new Ice.Optional<String>();
+ Ice.Optional<OneOptional> o = new Ice.Optional<OneOptional>();
+ initial.opOptionalException(a, b, o);
+ }
+ catch(OptionalException ex)
+ {
+ test(!ex.hasA());
+ test(!ex.hasB());
+ test(!ex.hasO());
+ }
+
+ try
+ {
+ Ice.IntOptional a = new Ice.IntOptional(30);
+ Ice.Optional<String> b = new Ice.Optional<String>("test");
+ Ice.Optional<OneOptional> o = new Ice.Optional<OneOptional>(new OneOptional(53));
+ initial.opOptionalException(a, b, o);
+ }
+ catch(OptionalException ex)
+ {
+ test(ex.getA() == 30);
+ test(ex.getB().equals("test"));
+ test(ex.getO().getA() == 53);
+ }
+
+ try
+ {
+ //
+ // Use the 1.0 encoding with an exception whose only class members are optional.
+ //
+ Ice.IntOptional a = new Ice.IntOptional(30);
+ Ice.Optional<String> b = new Ice.Optional<String>("test");
+ Ice.Optional<OneOptional> o = new Ice.Optional<OneOptional>(new OneOptional(53));
+ initial2.opOptionalException(a, b, o);
+ }
+ catch(OptionalException ex)
+ {
+ test(!ex.hasA());
+ test(!ex.hasB());
+ test(!ex.hasO());
+ }
+
+ try
+ {
+ Ice.IntOptional a = new Ice.IntOptional();
+ Ice.Optional<String> b = new Ice.Optional<String>();
+ Ice.Optional<OneOptional> o = new Ice.Optional<OneOptional>();
+ initial.opDerivedException(a, b, o);
+ }
+ catch(DerivedException ex)
+ {
+ test(!ex.hasA());
+ test(!ex.hasB());
+ test(!ex.hasO());
+ test(!ex.hasSs());
+ test(!ex.hasO2());
+ }
+ catch(OptionalException ex)
+ {
+ test(false);
+ }
+
+ try
+ {
+ Ice.IntOptional a = new Ice.IntOptional(30);
+ Ice.Optional<String> b = new Ice.Optional<String>("test2");
+ Ice.Optional<OneOptional> o = new Ice.Optional<OneOptional>(new OneOptional(53));
+ initial.opDerivedException(a, b, o);
+ }
+ catch(DerivedException ex)
+ {
+ test(ex.getA() == 30);
+ test(ex.getB().equals("test2"));
+ test(ex.getO().getA() == 53);
+ test(ex.getSs().equals("test2"));
+ test(ex.getO2().getA() == 53);
+ }
+ catch(OptionalException ex)
+ {
+ test(false);
+ }
+
+ try
+ {
+ Ice.IntOptional a = new Ice.IntOptional();
+ Ice.Optional<String> b = new Ice.Optional<String>();
+ Ice.Optional<OneOptional> o = new Ice.Optional<OneOptional>();
+ initial.opRequiredException(a, b, o);
+ }
+ catch(RequiredException ex)
+ {
+ test(!ex.hasA());
+ test(!ex.hasB());
+ test(!ex.hasO());
+ test(ex.ss.equals("test"));
+ test(ex.o2 == null);
+ }
+ catch(OptionalException ex)
+ {
+ test(false);
+ }
+
+ try
+ {
+ Ice.IntOptional a = new Ice.IntOptional(30);
+ Ice.Optional<String> b = new Ice.Optional<String>("test2");
+ Ice.Optional<OneOptional> o = new Ice.Optional<OneOptional>(new OneOptional(53));
+ initial.opRequiredException(a, b, o);
+ }
+ catch(RequiredException ex)
+ {
+ test(ex.getA() == 30);
+ test(ex.getB().equals("test2"));
+ test(ex.getO().getA() == 53);
+ test(ex.ss.equals("test2"));
+ test(ex.o2.getA() == 53);
+ }
+ catch(OptionalException ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ //
+ // Use reflection to load TwowaysLambdaAMI as that is only supported with Java >= 1.8
+ //
+ try
+ {
+ Class<?> cls = IceInternal.Util.findClass("test.Ice.optional.lambda.AllTests", null);
+ if(cls != null)
+ {
+ java.lang.reflect.Method allTests = cls.getDeclaredMethod("allTests",
+ new Class<?>[]{test.Util.Application.class, java.io.PrintWriter.class});
+ allTests.invoke(null, app, out);
+ }
+ }
+ catch(java.lang.NoSuchMethodException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ catch(java.lang.IllegalAccessException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ catch(java.lang.reflect.InvocationTargetException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+
+ return initial;
+ }
+
+ private static class TestObjectReader extends Ice.ObjectReader
+ {
+ @Override
+ public void read(Ice.InputStream in)
+ {
+ in.startValue();
+ in.startSlice();
+ in.endSlice();
+ in.endValue(false);
+ }
+ }
+
+ private static class BObjectReader extends Ice.ObjectReader
+ {
+ @Override
+ public void read(Ice.InputStream in)
+ {
+ in.startValue();
+ // ::Test::B
+ in.startSlice();
+ in.readInt();
+ in.endSlice();
+ // ::Test::A
+ in.startSlice();
+ in.readInt();
+ in.endSlice();
+ in.endValue(false);
+ }
+ }
+
+ private static class CObjectReader extends Ice.ObjectReader
+ {
+ @Override
+ public void read(Ice.InputStream in)
+ {
+ in.startValue();
+ // ::Test::C
+ in.startSlice();
+ in.skipSlice();
+ // ::Test::B
+ in.startSlice();
+ in.readInt();
+ in.endSlice();
+ // ::Test::A
+ in.startSlice();
+ in.readInt();
+ in.endSlice();
+ in.endValue(false);
+ }
+ }
+
+ private static class DObjectWriter extends Ice.ObjectWriter
+ {
+ @Override
+ public void write(Ice.OutputStream out)
+ {
+ out.startValue(null);
+ // ::Test::D
+ out.startSlice("::Test::D", -1, false);
+ out.writeString("test");
+ out.writeOptional(1, Ice.OptionalFormat.FSize);
+ String[] o = { "test1", "test2", "test3", "test4" };
+ int pos = out.startSize();
+ out.writeStringSeq(o);
+ out.endSize(pos);
+ A a = new A();
+ a.setMc(18);
+ out.writeOptional(1000, Ice.OptionalFormat.Class);
+ out.writeValue(a);
+ out.endSlice();
+ // ::Test::B
+ out.startSlice(B.ice_staticId(), -1, false);
+ int v = 14;
+ out.writeInt(v);
+ out.endSlice();
+ // ::Test::A
+ out.startSlice(A.ice_staticId(), -1, true);
+ out.writeInt(v);
+ out.endSlice();
+ out.endValue();
+ }
+ }
+
+ private static class DObjectReader extends Ice.ObjectReader
+ {
+ @Override
+ public void read(Ice.InputStream in)
+ {
+ in.startValue();
+ // ::Test::D
+ in.startSlice();
+ String s = in.readString();
+ test(s.equals("test"));
+ test(in.readOptional(1, Ice.OptionalFormat.FSize));
+ in.skip(4);
+ String[] o = in.readStringSeq();
+ test(o.length == 4 &&
+ o[0].equals("test1") && o[1].equals("test2") && o[2].equals("test3") && o[3].equals("test4"));
+ test(in.readOptional(1000, Ice.OptionalFormat.Class));
+ in.readValue(a);
+ in.endSlice();
+ // ::Test::B
+ in.startSlice();
+ in.readInt();
+ in.endSlice();
+ // ::Test::A
+ in.startSlice();
+ in.readInt();
+ in.endSlice();
+ in.endValue(false);
+ }
+
+ void check()
+ {
+ test(((A)a.obj).getMc() == 18);
+ }
+
+ private ReadValueCallbackI a = new ReadValueCallbackI();
+ }
+
+ private static class FObjectReader extends Ice.ObjectReader
+ {
+ @Override
+ public void read(Ice.InputStream in)
+ {
+ _f = new F();
+ in.startValue();
+ in.startSlice();
+ // Don't read af on purpose
+ //in.read(1, _f.af);
+ in.endSlice();
+ in.startSlice();
+ in.readValue(new Ice.ReadValueCallback()
+ {
+ @Override
+ public void valueReady(Ice.Object obj)
+ {
+ _f.ae = (A)obj;
+ }
+ });
+ in.endSlice();
+ in.endValue(false);
+ }
+
+ F getF()
+ {
+ return _f;
+ }
+
+ private F _f;
+ }
+
+ private static class FactoryI implements Ice.ValueFactory
+ {
+ @Override
+ public Ice.Object create(String typeId)
+ {
+ if(!_enabled)
+ {
+ return null;
+ }
+
+ if(typeId.equals(OneOptional.ice_staticId()))
+ {
+ return new TestObjectReader();
+ }
+ else if(typeId.equals(MultiOptional.ice_staticId()))
+ {
+ return new TestObjectReader();
+ }
+ else if(typeId.equals(B.ice_staticId()))
+ {
+ return new BObjectReader();
+ }
+ else if(typeId.equals(C.ice_staticId()))
+ {
+ return new CObjectReader();
+ }
+ else if(typeId.equals("::Test::D"))
+ {
+ return new DObjectReader();
+ }
+ else if(typeId.equals("::Test::F"))
+ {
+ return new FObjectReader();
+ }
+
+ return null;
+ }
+
+ void setEnabled(boolean enabled)
+ {
+ _enabled = enabled;
+ }
+
+ private boolean _enabled;
+ }
+
+ private static class ReadValueCallbackI implements Ice.ReadValueCallback
+ {
+ @Override
+ public void valueReady(Ice.Object obj)
+ {
+ this.obj = obj;
+ }
+
+ Ice.Object obj;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/optional/Client.java b/java-compat/test/src/main/java/test/Ice/optional/Client.java
new file mode 100644
index 00000000000..8714a642be3
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/optional/Client.java
@@ -0,0 +1,42 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.optional;
+
+import test.Ice.optional.Test.InitialPrx;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ java.io.PrintWriter out = getWriter();
+ InitialPrx initial = AllTests.allTests(this, false, out);
+ initial.shutdown();
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.optional");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/optional/InitialI.java b/java-compat/test/src/main/java/test/Ice/optional/InitialI.java
new file mode 100644
index 00000000000..cdae8291a0b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/optional/InitialI.java
@@ -0,0 +1,674 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.optional;
+
+import test.Ice.optional.Test.*;
+
+public final class InitialI extends Initial
+{
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+
+ @Override
+ public Ice.Object
+ pingPong(Ice.Object obj, Ice.Current current)
+ {
+ return obj;
+ }
+
+ @Override
+ public void
+ opOptionalException(Ice.IntOptional a, Ice.Optional<String> b, Ice.Optional<OneOptional> o, Ice.Current current)
+ throws OptionalException
+ {
+ OptionalException ex = new OptionalException();
+ if(a.isSet())
+ {
+ ex.setA(a.get());
+ }
+ else
+ {
+ ex.clearA(); // The member "a" has a default value.
+ }
+ if(b.isSet())
+ {
+ ex.setB(b.get());
+ }
+ if(o.isSet())
+ {
+ ex.setO(o.get());
+ }
+ throw ex;
+ }
+
+ @Override
+ public void
+ opDerivedException(Ice.IntOptional a, Ice.Optional<String> b, Ice.Optional<OneOptional> o, Ice.Current current)
+ throws OptionalException
+ {
+ DerivedException ex = new DerivedException();
+ if(a.isSet())
+ {
+ ex.setA(a.get());
+ }
+ else
+ {
+ ex.clearA(); // The member "a" has a default value.
+ }
+ if(b.isSet())
+ {
+ ex.setB(b.get());
+ ex.setSs(b.get());
+ }
+ else
+ {
+ ex.clearSs(); // The member "ss" has a default value.
+ }
+ if(o.isSet())
+ {
+ ex.setO(o.get());
+ ex.setO2(o.get());
+ }
+ throw ex;
+ }
+
+ @Override
+ public void
+ opRequiredException(Ice.IntOptional a, Ice.Optional<String> b, Ice.Optional<OneOptional> o, Ice.Current current)
+ throws OptionalException
+ {
+ RequiredException ex = new RequiredException();
+ if(a.isSet())
+ {
+ ex.setA(a.get());
+ }
+ else
+ {
+ ex.clearA(); // The member "a" has a default value.
+ }
+ if(b.isSet())
+ {
+ ex.setB(b.get());
+ ex.ss = b.get();
+ }
+ if(o.isSet())
+ {
+ ex.setO(o.get());
+ ex.o2 = o.get();
+ }
+ throw ex;
+ }
+
+ @Override
+ public Ice.ByteOptional
+ opByte(Ice.ByteOptional p1, Ice.ByteOptional p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public byte
+ opByteReq(Ice.ByteOptional p1, Ice.ByteHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.BooleanOptional
+ opBool(Ice.BooleanOptional p1, Ice.BooleanOptional p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public boolean
+ opBoolReq(Ice.BooleanOptional p1, Ice.BooleanHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.ShortOptional
+ opShort(Ice.ShortOptional p1, Ice.ShortOptional p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public short
+ opShortReq(Ice.ShortOptional p1, Ice.ShortHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.IntOptional
+ opInt(Ice.IntOptional p1, Ice.IntOptional p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public int
+ opIntReq(Ice.IntOptional p1, Ice.IntHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.LongOptional
+ opLong(Ice.LongOptional p1, Ice.LongOptional p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public long
+ opLongReq(Ice.LongOptional p1, Ice.LongHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.FloatOptional
+ opFloat(Ice.FloatOptional p1, Ice.FloatOptional p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public float
+ opFloatReq(Ice.FloatOptional p1, Ice.FloatHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.DoubleOptional
+ opDouble(Ice.DoubleOptional p1, Ice.DoubleOptional p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public double
+ opDoubleReq(Ice.DoubleOptional p1, Ice.DoubleHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<String>
+ opString(Ice.Optional<String> p1, Ice.Optional<String> p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public String
+ opStringReq(Ice.Optional<String> p1, Ice.StringHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<MyEnum>
+ opMyEnum(Ice.Optional<MyEnum> p1, Ice.Optional<MyEnum> p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public MyEnum
+ opMyEnumReq(Ice.Optional<MyEnum> p1, MyEnumHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<SmallStruct>
+ opSmallStruct(Ice.Optional<SmallStruct> p1, Ice.Optional<SmallStruct> p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public SmallStruct
+ opSmallStructReq(Ice.Optional<SmallStruct> p1, SmallStructHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<FixedStruct>
+ opFixedStruct(Ice.Optional<FixedStruct> p1, Ice.Optional<FixedStruct> p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public FixedStruct
+ opFixedStructReq(Ice.Optional<FixedStruct> p1, FixedStructHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<VarStruct>
+ opVarStruct(Ice.Optional<VarStruct> p1, Ice.Optional<VarStruct> p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public VarStruct
+ opVarStructReq(Ice.Optional<VarStruct> p1, VarStructHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<OneOptional>
+ opOneOptional(Ice.Optional<OneOptional> p1, Ice.Optional<OneOptional> p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public OneOptional
+ opOneOptionalReq(Ice.Optional<OneOptional> p1, OneOptionalHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<OneOptionalPrx>
+ opOneOptionalProxy(Ice.Optional<OneOptionalPrx> p1, Ice.Optional<OneOptionalPrx> p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public OneOptionalPrx
+ opOneOptionalProxyReq(Ice.Optional<OneOptionalPrx> p1, OneOptionalPrxHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<byte[]>
+ opByteSeq(Ice.Optional<byte[]> p1, Ice.Optional<byte[]> p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public byte[]
+ opByteSeqReq(Ice.Optional<byte[]> p1, ByteSeqHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<boolean[]>
+ opBoolSeq(Ice.Optional<boolean[]> p1, Ice.Optional<boolean[]> p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public boolean[]
+ opBoolSeqReq(Ice.Optional<boolean[]> p1, BoolSeqHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<short[]>
+ opShortSeq(Ice.Optional<short[]> p1, Ice.Optional<short[]> p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public short[]
+ opShortSeqReq(Ice.Optional<short[]> p1, ShortSeqHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<int[]>
+ opIntSeq(Ice.Optional<int[]> p1, Ice.Optional<int[]> p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public int[]
+ opIntSeqReq(Ice.Optional<int[]> p1, IntSeqHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<long[]>
+ opLongSeq(Ice.Optional<long[]> p1, Ice.Optional<long[]> p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public long[]
+ opLongSeqReq(Ice.Optional<long[]> p1, LongSeqHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<float[]>
+ opFloatSeq(Ice.Optional<float[]> p1, Ice.Optional<float[]> p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public float[]
+ opFloatSeqReq(Ice.Optional<float[]> p1, FloatSeqHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<double[]>
+ opDoubleSeq(Ice.Optional<double[]> p1, Ice.Optional<double[]> p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public double[]
+ opDoubleSeqReq(Ice.Optional<double[]> p1, DoubleSeqHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<String[]>
+ opStringSeq(Ice.Optional<String[]> p1, Ice.Optional<String[]> p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public String[]
+ opStringSeqReq(Ice.Optional<String[]> p1, StringSeqHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<SmallStruct[]>
+ opSmallStructSeq(Ice.Optional<SmallStruct[]> p1, Ice.Optional<SmallStruct[]> p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public SmallStruct[]
+ opSmallStructSeqReq(Ice.Optional<SmallStruct[]> p1, SmallStructSeqHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<java.util.List<SmallStruct>>
+ opSmallStructList(Ice.Optional<java.util.List<SmallStruct>> p1,
+ Ice.Optional<java.util.List<SmallStruct>> p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public java.util.List<SmallStruct>
+ opSmallStructListReq(Ice.Optional<java.util.List<SmallStruct>> p1, SmallStructListHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<FixedStruct[]>
+ opFixedStructSeq(Ice.Optional<FixedStruct[]> p1, Ice.Optional<FixedStruct[]> p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public FixedStruct[]
+ opFixedStructSeqReq(Ice.Optional<FixedStruct[]> p1, FixedStructSeqHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<java.util.List<FixedStruct>>
+ opFixedStructList(Ice.Optional<java.util.List<FixedStruct>> p1,
+ Ice.Optional<java.util.List<FixedStruct>> p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public java.util.List<FixedStruct>
+ opFixedStructListReq(Ice.Optional<java.util.List<FixedStruct>> p1, FixedStructListHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<VarStruct[]>
+ opVarStructSeq(Ice.Optional<VarStruct[]> p1, Ice.Optional<VarStruct[]> p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public VarStruct[]
+ opVarStructSeqReq(Ice.Optional<VarStruct[]> p1, VarStructSeqHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<SerializableClass>
+ opSerializable(Ice.Optional<SerializableClass> p1, Ice.Optional<SerializableClass> p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public SerializableClass
+ opSerializableReq(Ice.Optional<SerializableClass> p1, Ice.Holder<SerializableClass> p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<java.util.Map<Integer, Integer>>
+ opIntIntDict(Ice.Optional<java.util.Map<Integer, Integer>> p1, Ice.Optional<java.util.Map<Integer, Integer>> p3,
+ Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public java.util.Map<Integer, Integer>
+ opIntIntDictReq(Ice.Optional<java.util.Map<Integer, Integer>> p1, IntIntDictHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<java.util.Map<String, Integer>>
+ opStringIntDict(Ice.Optional<java.util.Map<String, Integer>> p1, Ice.Optional<java.util.Map<String, Integer>> p3,
+ Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public java.util.Map<String, Integer>
+ opStringIntDictReq(Ice.Optional<java.util.Map<String, Integer>> p1, StringIntDictHolder p3, Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public Ice.Optional<java.util.Map<Integer, OneOptional>>
+ opIntOneOptionalDict(Ice.Optional<java.util.Map<Integer, OneOptional>> p1,
+ Ice.Optional<java.util.Map<Integer, OneOptional>> p3, Ice.Current current)
+ {
+ p3.set(p1);
+ return p1;
+ }
+
+ @Override
+ public java.util.Map<Integer, OneOptional>
+ opIntOneOptionalDictReq(Ice.Optional<java.util.Map<Integer, OneOptional>> p1, IntOneOptionalDictHolder p3,
+ Ice.Current current)
+ {
+ p3.value = p1.get();
+ return p1.get();
+ }
+
+ @Override
+ public void
+ opClassAndUnknownOptional(A p, Ice.Current current)
+ {
+ }
+
+ @Override
+ public void
+ sendOptionalClass(boolean req, Ice.Optional<OneOptional> o, Ice.Current current)
+ {
+ }
+
+ @Override
+ public void
+ returnOptionalClass(boolean req, Ice.Optional<OneOptional> o, Ice.Current current)
+ {
+ o.set(new OneOptional(53));
+ }
+
+ @Override
+ public G
+ opG(G g, Ice.Current current)
+ {
+ return g;
+ }
+
+ @Override
+ public void
+ opVoid(Ice.Current current)
+ {
+ }
+
+ @Override
+ public boolean
+ supportsRequiredParams(Ice.Current current)
+ {
+ return true;
+ }
+
+ @Override
+ public boolean
+ supportsJavaSerializable(Ice.Current current)
+ {
+ return true;
+ }
+
+ @Override
+ public boolean
+ supportsCsharpSerializable(Ice.Current current)
+ {
+ return false;
+ }
+
+ @Override
+ public boolean
+ supportsCppStringView(Ice.Current current)
+ {
+ return false;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/optional/SerializableClass.java b/java-compat/test/src/main/java/test/Ice/optional/SerializableClass.java
new file mode 100644
index 00000000000..2c93b0bd1a9
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/optional/SerializableClass.java
@@ -0,0 +1,32 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.optional;
+
+public class SerializableClass implements java.io.Serializable
+{
+ public SerializableClass(int v)
+ {
+ _v = v;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if(obj instanceof SerializableClass)
+ {
+ return _v == ((SerializableClass)obj)._v;
+ }
+
+ return false;
+ }
+
+ private int _v;
+ public static final long serialVersionUID = 1;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/optional/Server.java b/java-compat/test/src/main/java/test/Ice/optional/Server.java
new file mode 100644
index 00000000000..d4429d5a94d
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/optional/Server.java
@@ -0,0 +1,41 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.optional;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.add(new InitialI(), Ice.Util.stringToIdentity("initial"));
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.optional");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server c = new Server();
+ int status = c.main("Server", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/optional/Test.ice b/java-compat/test/src/main/java/test/Ice/optional/Test.ice
new file mode 100644
index 00000000000..01d4fa6e795
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/optional/Test.ice
@@ -0,0 +1,339 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.optional"]]
+module Test
+{
+
+class OneOptional
+{
+ optional(1) int a;
+};
+
+enum MyEnum
+{
+ MyEnumMember
+};
+
+struct SmallStruct
+{
+ byte m;
+};
+
+struct FixedStruct
+{
+ int m;
+};
+
+struct VarStruct
+{
+ string m;
+};
+
+struct ClassVarStruct
+{
+ int a;
+};
+
+sequence<byte> ByteSeq;
+sequence<bool> BoolSeq;
+sequence<short> ShortSeq;
+sequence<int> IntSeq;
+sequence<long> LongSeq;
+sequence<float> FloatSeq;
+sequence<double> DoubleSeq;
+sequence<string> StringSeq;
+sequence<MyEnum> MyEnumSeq;
+sequence<SmallStruct> SmallStructSeq;
+["java:type:java.util.ArrayList<SmallStruct>"] sequence<SmallStruct> SmallStructList;
+sequence<FixedStruct> FixedStructSeq;
+["java:type:java.util.ArrayList<FixedStruct>"] sequence<FixedStruct> FixedStructList;
+sequence<VarStruct> VarStructSeq;
+sequence<OneOptional> OneOptionalSeq;
+sequence<OneOptional*> OneOptionalPrxSeq;
+
+["java:serializable:test.Ice.optional.SerializableClass"] sequence<byte> Serializable;
+
+dictionary<int, int> IntIntDict;
+dictionary<string, int> StringIntDict;
+dictionary<int, MyEnum> IntEnumDict;
+dictionary<int, FixedStruct> IntFixedStructDict;
+dictionary<int, VarStruct> IntVarStructDict;
+dictionary<int, OneOptional> IntOneOptionalDict;
+dictionary<int, OneOptional*> IntOneOptionalPrxDict;
+
+class MultiOptional
+{
+ optional(1) byte a;
+ optional(2) bool b;
+ optional(3) short c;
+ optional(4) int d;
+ optional(5) long e;
+ optional(6) float f;
+ optional(7) double g;
+ optional(8) string h;
+ optional(9) MyEnum i;
+ optional(10) MultiOptional* j;
+ optional(11) MultiOptional k;
+ optional(12) ByteSeq bs;
+ optional(13) StringSeq ss;
+ optional(14) IntIntDict iid;
+ optional(15) StringIntDict sid;
+ optional(16) FixedStruct fs;
+ optional(17) VarStruct vs;
+
+ optional(18) ShortSeq shs;
+ optional(19) MyEnumSeq es;
+ optional(20) FixedStructSeq fss;
+ optional(21) VarStructSeq vss;
+ optional(22) OneOptionalSeq oos;
+ optional(23) OneOptionalPrxSeq oops;
+
+ optional(24) IntEnumDict ied;
+ optional(25) IntFixedStructDict ifsd;
+ optional(26) IntVarStructDict ivsd;
+ optional(27) IntOneOptionalDict iood;
+ optional(28) IntOneOptionalPrxDict ioopd;
+
+ optional(29) BoolSeq bos;
+
+ optional(30) Serializable ser;
+};
+
+class A
+{
+ int requiredA;
+ optional(1) int ma;
+ optional(50) int mb;
+ optional(500) int mc;
+};
+
+["preserve-slice"]
+class B extends A
+{
+ int requiredB;
+ optional(10) int md;
+};
+
+class C extends B
+{
+ string ss;
+ optional(890) string ms;
+};
+
+class WD
+{
+ optional(1) int a = 5;
+ optional(2) string s = "test";
+};
+
+exception OptionalException
+{
+ bool req = false;
+ optional(1) int a = 5;
+ optional(2) string b;
+ optional(50) OneOptional o;
+};
+
+exception DerivedException extends OptionalException
+{
+ optional(600) string ss = "test";
+ optional(601) OneOptional o2;
+};
+
+exception RequiredException extends OptionalException
+{
+ string ss = "test";
+ OneOptional o2;
+};
+
+class OptionalWithCustom
+{
+ optional(1) SmallStructList l;
+ ["protected"] optional(2) SmallStructList lp;
+ optional(3) ClassVarStruct s;
+};
+
+class E
+{
+ A ae;
+};
+
+class F extends E
+{
+ optional(1) A af;
+};
+
+class G1
+{
+ string a;
+};
+
+class G2
+{
+ long a;
+};
+
+class G
+{
+ optional(1) G1 gg1Opt;
+ G2 gg2;
+ optional(0) G2 gg2Opt;
+ G1 gg1;
+};
+
+class Recursive;
+sequence<Recursive> RecursiveSeq;
+
+class Recursive {
+ optional(0) RecursiveSeq value;
+};
+
+class Initial
+{
+ void shutdown();
+
+ Object pingPong(Object o);
+
+ void opOptionalException(optional(1) int a, optional(2) string b, optional(3) OneOptional o)
+ throws OptionalException;
+
+ void opDerivedException(optional(1) int a, optional(2) string b, optional(3) OneOptional o)
+ throws OptionalException;
+
+ void opRequiredException(optional(1) int a, optional(2) string b, optional(3) OneOptional o)
+ throws OptionalException;
+
+ ["java:optional"] optional(1) byte opByte(optional(2) byte p1, out optional(3) byte p3);
+ optional(1) byte opByteReq(optional(2) byte p1, out optional(3) byte p3);
+
+ ["java:optional"] optional(1) bool opBool(optional(2) bool p1, out optional(3) bool p3);
+ optional(1) bool opBoolReq(optional(2) bool p1, out optional(3) bool p3);
+
+ ["java:optional"] optional(1) short opShort(optional(2) short p1, out optional(3) short p3);
+ optional(1) short opShortReq(optional(2) short p1, out optional(3) short p3);
+
+ ["java:optional"] optional(1) int opInt(optional(2) int p1, out optional(3) int p3);
+ optional(1) int opIntReq(optional(2) int p1, out optional(3) int p3);
+
+ ["java:optional"] optional(3) long opLong(optional(1) long p1, out optional(2) long p3);
+ optional(3) long opLongReq(optional(1) long p1, out optional(2) long p3);
+
+ ["java:optional"] optional(1) float opFloat(optional(2) float p1, out optional(3) float p3);
+ optional(1) float opFloatReq(optional(2) float p1, out optional(3) float p3);
+
+ ["java:optional"] optional(1) double opDouble(optional(2) double p1, out optional(3) double p3);
+ optional(1) double opDoubleReq(optional(2) double p1, out optional(3) double p3);
+
+ ["java:optional"] optional(1) string opString(optional(2) string p1, out optional(3) string p3);
+ optional(1) string opStringReq(optional(2) string p1, out optional(3) string p3);
+
+ ["java:optional"] optional(1) MyEnum opMyEnum(optional(2) MyEnum p1, out optional(3) MyEnum p3);
+ optional(1) MyEnum opMyEnumReq(optional(2) MyEnum p1, out optional(3) MyEnum p3);
+
+ ["java:optional"] optional(1) SmallStruct opSmallStruct(optional(2) SmallStruct p1, out optional(3) SmallStruct p3);
+ optional(1) SmallStruct opSmallStructReq(optional(2) SmallStruct p1, out optional(3) SmallStruct p3);
+
+ ["java:optional"] optional(1) FixedStruct opFixedStruct(optional(2) FixedStruct p1, out optional(3) FixedStruct p3);
+ optional(1) FixedStruct opFixedStructReq(optional(2) FixedStruct p1, out optional(3) FixedStruct p3);
+
+ ["java:optional"] optional(1) VarStruct opVarStruct(optional(2) VarStruct p1, out optional(3) VarStruct p3);
+ optional(1) VarStruct opVarStructReq(optional(2) VarStruct p1, out optional(3) VarStruct p3);
+
+ ["java:optional"] optional(1) OneOptional opOneOptional(optional(2) OneOptional p1, out optional(3) OneOptional p3);
+ optional(1) OneOptional opOneOptionalReq(optional(2) OneOptional p1, out optional(3) OneOptional p3);
+
+ ["java:optional"] optional(1) OneOptional* opOneOptionalProxy(optional(2) OneOptional* p1,
+ out optional(3) OneOptional* p3);
+ optional(1) OneOptional* opOneOptionalProxyReq(optional(2) OneOptional* p1, out optional(3) OneOptional* p3);
+
+ ["java:optional"] optional(1) ByteSeq opByteSeq(optional(2) ByteSeq p1, out optional(3) ByteSeq p3);
+ optional(1) ByteSeq opByteSeqReq(optional(2) ByteSeq p1, out optional(3) ByteSeq p3);
+
+ ["java:optional"] optional(1) BoolSeq opBoolSeq(optional(2) BoolSeq p1, out optional(3) BoolSeq p3);
+ optional(1) BoolSeq opBoolSeqReq(optional(2) BoolSeq p1, out optional(3) BoolSeq p3);
+
+ ["java:optional"] optional(1) ShortSeq opShortSeq(optional(2) ShortSeq p1, out optional(3) ShortSeq p3);
+ optional(1) ShortSeq opShortSeqReq(optional(2) ShortSeq p1, out optional(3) ShortSeq p3);
+
+ ["java:optional"] optional(1) IntSeq opIntSeq(optional(2) IntSeq p1, out optional(3) IntSeq p3);
+ optional(1) IntSeq opIntSeqReq(optional(2) IntSeq p1, out optional(3) IntSeq p3);
+
+ ["java:optional"] optional(1) LongSeq opLongSeq(optional(2) LongSeq p1, out optional(3) LongSeq p3);
+ optional(1) LongSeq opLongSeqReq(optional(2) LongSeq p1, out optional(3) LongSeq p3);
+
+ ["java:optional"] optional(1) FloatSeq opFloatSeq(optional(2) FloatSeq p1, out optional(3) FloatSeq p3);
+ optional(1) FloatSeq opFloatSeqReq(optional(2) FloatSeq p1, out optional(3) FloatSeq p3);
+
+ ["java:optional"] optional(1) DoubleSeq opDoubleSeq(optional(2) DoubleSeq p1, out optional(3) DoubleSeq p3);
+ optional(1) DoubleSeq opDoubleSeqReq(optional(2) DoubleSeq p1, out optional(3) DoubleSeq p3);
+
+ ["java:optional"] optional(1) StringSeq opStringSeq(optional(2) StringSeq p1, out optional(3) StringSeq p3);
+ optional(1) StringSeq opStringSeqReq(optional(2) StringSeq p1, out optional(3) StringSeq p3);
+
+ ["java:optional"] optional(1) SmallStructSeq opSmallStructSeq(optional(2) SmallStructSeq p1,
+ out optional(3) SmallStructSeq p3);
+ optional(1) SmallStructSeq opSmallStructSeqReq(optional(2) SmallStructSeq p1, out optional(3) SmallStructSeq p3);
+
+ ["java:optional"] optional(1) SmallStructList opSmallStructList(optional(2) SmallStructList p1,
+ out optional(3) SmallStructList p3);
+ optional(1) SmallStructList opSmallStructListReq(optional(2) SmallStructList p1,
+ out optional(3) SmallStructList p3);
+
+ ["java:optional"] optional(1) FixedStructSeq opFixedStructSeq(optional(2) FixedStructSeq p1,
+ out optional(3) FixedStructSeq p3);
+ optional(1) FixedStructSeq opFixedStructSeqReq(optional(2) FixedStructSeq p1, out optional(3) FixedStructSeq p3);
+
+ ["java:optional"] optional(1) FixedStructList opFixedStructList(optional(2) FixedStructList p1,
+ out optional(3) FixedStructList p3);
+ optional(1) FixedStructList opFixedStructListReq(optional(2) FixedStructList p1,
+ out optional(3) FixedStructList p3);
+
+ ["java:optional"] optional(1) VarStructSeq opVarStructSeq(optional(2) VarStructSeq p1,
+ out optional(3) VarStructSeq p3);
+ optional(1) VarStructSeq opVarStructSeqReq(optional(2) VarStructSeq p1, out optional(3) VarStructSeq p3);
+
+ ["java:optional"] optional(1) Serializable opSerializable(optional(2) Serializable p1,
+ out optional(3) Serializable p3);
+ optional(1) Serializable opSerializableReq(optional(2) Serializable p1, out optional(3) Serializable p3);
+
+ ["java:optional"] optional(1) IntIntDict opIntIntDict(optional(2) IntIntDict p1, out optional(3) IntIntDict p3);
+ optional(1) IntIntDict opIntIntDictReq(optional(2) IntIntDict p1, out optional(3) IntIntDict p3);
+
+ ["java:optional"] optional(1) StringIntDict opStringIntDict(optional(2) StringIntDict p1,
+ out optional(3) StringIntDict p3);
+ optional(1) StringIntDict opStringIntDictReq(optional(2) StringIntDict p1, out optional(3) StringIntDict p3);
+
+ ["java:optional"] optional(1) IntOneOptionalDict opIntOneOptionalDict(optional(2) IntOneOptionalDict p1, out optional(3) IntOneOptionalDict p3);
+
+ optional(1) IntOneOptionalDict opIntOneOptionalDictReq(optional(2) IntOneOptionalDict p1, out optional(3) IntOneOptionalDict p3);
+
+ void opClassAndUnknownOptional(A p);
+
+ void sendOptionalClass(bool req, optional(1) OneOptional o);
+
+ ["java:optional"]
+ void returnOptionalClass(bool req, out optional(1) OneOptional o);
+
+ G opG(G g);
+
+ void opVoid();
+
+ bool supportsRequiredParams();
+
+ bool supportsJavaSerializable();
+
+ bool supportsCsharpSerializable();
+
+ bool supportsCppStringView();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/optional/TestAMD.ice b/java-compat/test/src/main/java/test/Ice/optional/TestAMD.ice
new file mode 100644
index 00000000000..207550b5d77
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/optional/TestAMD.ice
@@ -0,0 +1,342 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.optional.AMD"]]
+module Test
+{
+
+class OneOptional
+{
+ optional(1) int a;
+};
+
+enum MyEnum
+{
+ MyEnumMember
+};
+
+struct SmallStruct
+{
+ byte m;
+};
+
+struct FixedStruct
+{
+ int m;
+};
+
+struct VarStruct
+{
+ string m;
+};
+
+struct ClassVarStruct
+{
+ int a;
+};
+
+sequence<byte> ByteSeq;
+sequence<bool> BoolSeq;
+sequence<short> ShortSeq;
+sequence<int> IntSeq;
+sequence<long> LongSeq;
+sequence<float> FloatSeq;
+sequence<double> DoubleSeq;
+sequence<string> StringSeq;
+sequence<MyEnum> MyEnumSeq;
+sequence<SmallStruct> SmallStructSeq;
+["java:type:java.util.ArrayList<SmallStruct>"] sequence<SmallStruct> SmallStructList;
+sequence<FixedStruct> FixedStructSeq;
+["java:type:java.util.ArrayList<FixedStruct>"] sequence<FixedStruct> FixedStructList;
+sequence<VarStruct> VarStructSeq;
+sequence<OneOptional> OneOptionalSeq;
+sequence<OneOptional*> OneOptionalPrxSeq;
+
+["java:serializable:test.Ice.optional.SerializableClass"] sequence<byte> Serializable;
+
+dictionary<int, int> IntIntDict;
+dictionary<string, int> StringIntDict;
+dictionary<int, MyEnum> IntEnumDict;
+dictionary<int, FixedStruct> IntFixedStructDict;
+dictionary<int, VarStruct> IntVarStructDict;
+dictionary<int, OneOptional> IntOneOptionalDict;
+dictionary<int, OneOptional*> IntOneOptionalPrxDict;
+
+class MultiOptional
+{
+ optional(1) byte a;
+ optional(2) bool b;
+ optional(3) short c;
+ optional(4) int d;
+ optional(5) long e;
+ optional(6) float f;
+ optional(7) double g;
+ optional(8) string h;
+ optional(9) MyEnum i;
+ optional(10) MultiOptional* j;
+ optional(11) MultiOptional k;
+ optional(12) ByteSeq bs;
+ optional(13) StringSeq ss;
+ optional(14) IntIntDict iid;
+ optional(15) StringIntDict sid;
+ optional(16) FixedStruct fs;
+ optional(17) VarStruct vs;
+
+ optional(18) ShortSeq shs;
+ optional(19) MyEnumSeq es;
+ optional(20) FixedStructSeq fss;
+ optional(21) VarStructSeq vss;
+ optional(22) OneOptionalSeq oos;
+ optional(23) OneOptionalPrxSeq oops;
+
+ optional(24) IntEnumDict ied;
+ optional(25) IntFixedStructDict ifsd;
+ optional(26) IntVarStructDict ivsd;
+ optional(27) IntOneOptionalDict iood;
+ optional(28) IntOneOptionalPrxDict ioopd;
+
+ optional(29) BoolSeq bos;
+
+ optional(30) Serializable ser;
+};
+
+class A
+{
+ int requiredA;
+ optional(1) int ma;
+ optional(50) int mb;
+ optional(500) int mc;
+};
+
+["preserve-slice"]
+class B extends A
+{
+ int requiredB;
+ optional(10) int md;
+};
+
+class C extends B
+{
+ string ss;
+ optional(890) string ms;
+};
+
+class WD
+{
+ optional(1) int a = 5;
+ optional(2) string s = "test";
+};
+
+exception OptionalException
+{
+ bool req = false;
+ optional(1) int a = 5;
+ optional(2) string b;
+ optional(50) OneOptional o;
+};
+
+exception DerivedException extends OptionalException
+{
+ optional(600) string ss = "test";
+ optional(601) OneOptional o2;
+};
+
+exception RequiredException extends OptionalException
+{
+ string ss = "test";
+ OneOptional o2;
+};
+
+class OptionalWithCustom
+{
+ optional(1) SmallStructList l;
+ ["protected"] optional(2) SmallStructList lp;
+ optional(3) ClassVarStruct s;
+};
+
+class E
+{
+ A ae;
+};
+
+class F extends E
+{
+ optional(1) A af;
+};
+
+class G1
+{
+ string a;
+};
+
+class G2
+{
+ long a;
+};
+
+class G
+{
+ optional(1) G1 gg1Opt;
+ G2 gg2;
+ optional(0) G2 gg2Opt;
+ G1 gg1;
+};
+
+class Recursive;
+sequence<Recursive> RecursiveSeq;
+
+class Recursive {
+ optional(0) RecursiveSeq value;
+};
+
+["amd"]
+class Initial
+{
+ void shutdown();
+
+ Object pingPong(Object o);
+
+ void opOptionalException(optional(1) int a, optional(2) string b, optional(3) OneOptional o)
+ throws OptionalException;
+
+ void opDerivedException(optional(1) int a, optional(2) string b, optional(3) OneOptional o)
+ throws OptionalException;
+
+ void opRequiredException(optional(1) int a, optional(2) string b, optional(3) OneOptional o)
+ throws OptionalException;
+
+ ["java:optional"] optional(1) byte opByte(optional(2) byte p1, out optional(3) byte p3);
+ optional(1) byte opByteReq(optional(2) byte p1, out optional(3) byte p3);
+
+ ["java:optional"] optional(1) bool opBool(optional(2) bool p1, out optional(3) bool p3);
+ optional(1) bool opBoolReq(optional(2) bool p1, out optional(3) bool p3);
+
+ ["java:optional"] optional(1) short opShort(optional(2) short p1, out optional(3) short p3);
+ optional(1) short opShortReq(optional(2) short p1, out optional(3) short p3);
+
+ ["java:optional"] optional(1) int opInt(optional(2) int p1, out optional(3) int p3);
+ optional(1) int opIntReq(optional(2) int p1, out optional(3) int p3);
+
+ ["java:optional"] optional(3) long opLong(optional(1) long p1, out optional(2) long p3);
+ optional(3) long opLongReq(optional(1) long p1, out optional(2) long p3);
+
+ ["java:optional"] optional(1) float opFloat(optional(2) float p1, out optional(3) float p3);
+ optional(1) float opFloatReq(optional(2) float p1, out optional(3) float p3);
+
+ ["java:optional"] optional(1) double opDouble(optional(2) double p1, out optional(3) double p3);
+ optional(1) double opDoubleReq(optional(2) double p1, out optional(3) double p3);
+
+ ["java:optional"] optional(1) string opString(optional(2) string p1, out optional(3) string p3);
+ optional(1) string opStringReq(optional(2) string p1, out optional(3) string p3);
+
+ ["java:optional"] optional(1) MyEnum opMyEnum(optional(2) MyEnum p1, out optional(3) MyEnum p3);
+ optional(1) MyEnum opMyEnumReq(optional(2) MyEnum p1, out optional(3) MyEnum p3);
+
+ ["java:optional"] optional(1) SmallStruct opSmallStruct(optional(2) SmallStruct p1, out optional(3) SmallStruct p3);
+ optional(1) SmallStruct opSmallStructReq(optional(2) SmallStruct p1, out optional(3) SmallStruct p3);
+
+ ["java:optional"] optional(1) FixedStruct opFixedStruct(optional(2) FixedStruct p1, out optional(3) FixedStruct p3);
+ optional(1) FixedStruct opFixedStructReq(optional(2) FixedStruct p1, out optional(3) FixedStruct p3);
+
+ ["java:optional"] optional(1) VarStruct opVarStruct(optional(2) VarStruct p1, out optional(3) VarStruct p3);
+ optional(1) VarStruct opVarStructReq(optional(2) VarStruct p1, out optional(3) VarStruct p3);
+
+ ["java:optional"] optional(1) OneOptional opOneOptional(optional(2) OneOptional p1, out optional(3) OneOptional p3);
+ optional(1) OneOptional opOneOptionalReq(optional(2) OneOptional p1, out optional(3) OneOptional p3);
+
+ ["java:optional"] optional(1) OneOptional* opOneOptionalProxy(optional(2) OneOptional* p1,
+ out optional(3) OneOptional* p3);
+ optional(1) OneOptional* opOneOptionalProxyReq(optional(2) OneOptional* p1, out optional(3) OneOptional* p3);
+
+ ["java:optional"] optional(1) ByteSeq opByteSeq(optional(2) ByteSeq p1, out optional(3) ByteSeq p3);
+ optional(1) ByteSeq opByteSeqReq(optional(2) ByteSeq p1, out optional(3) ByteSeq p3);
+
+ ["java:optional"] optional(1) BoolSeq opBoolSeq(optional(2) BoolSeq p1, out optional(3) BoolSeq p3);
+ optional(1) BoolSeq opBoolSeqReq(optional(2) BoolSeq p1, out optional(3) BoolSeq p3);
+
+ ["java:optional"] optional(1) ShortSeq opShortSeq(optional(2) ShortSeq p1, out optional(3) ShortSeq p3);
+ optional(1) ShortSeq opShortSeqReq(optional(2) ShortSeq p1, out optional(3) ShortSeq p3);
+
+ ["java:optional"] optional(1) IntSeq opIntSeq(optional(2) IntSeq p1, out optional(3) IntSeq p3);
+ optional(1) IntSeq opIntSeqReq(optional(2) IntSeq p1, out optional(3) IntSeq p3);
+
+ ["java:optional"] optional(1) LongSeq opLongSeq(optional(2) LongSeq p1, out optional(3) LongSeq p3);
+ optional(1) LongSeq opLongSeqReq(optional(2) LongSeq p1, out optional(3) LongSeq p3);
+
+ ["java:optional"] optional(1) FloatSeq opFloatSeq(optional(2) FloatSeq p1, out optional(3) FloatSeq p3);
+ optional(1) FloatSeq opFloatSeqReq(optional(2) FloatSeq p1, out optional(3) FloatSeq p3);
+
+ ["java:optional"] optional(1) DoubleSeq opDoubleSeq(optional(2) DoubleSeq p1, out optional(3) DoubleSeq p3);
+ optional(1) DoubleSeq opDoubleSeqReq(optional(2) DoubleSeq p1, out optional(3) DoubleSeq p3);
+
+ ["java:optional"] optional(1) StringSeq opStringSeq(optional(2) StringSeq p1, out optional(3) StringSeq p3);
+ optional(1) StringSeq opStringSeqReq(optional(2) StringSeq p1, out optional(3) StringSeq p3);
+
+ ["java:optional"] optional(1) SmallStructSeq opSmallStructSeq(optional(2) SmallStructSeq p1,
+ out optional(3) SmallStructSeq p3);
+ optional(1) SmallStructSeq opSmallStructSeqReq(optional(2) SmallStructSeq p1, out optional(3) SmallStructSeq p3);
+
+ ["java:optional"] optional(1) SmallStructList opSmallStructList(optional(2) SmallStructList p1,
+ out optional(3) SmallStructList p3);
+ optional(1) SmallStructList opSmallStructListReq(optional(2) SmallStructList p1,
+ out optional(3) SmallStructList p3);
+
+ ["java:optional"] optional(1) FixedStructSeq opFixedStructSeq(optional(2) FixedStructSeq p1,
+ out optional(3) FixedStructSeq p3);
+ optional(1) FixedStructSeq opFixedStructSeqReq(optional(2) FixedStructSeq p1, out optional(3) FixedStructSeq p3);
+
+ ["java:optional"] optional(1) FixedStructList opFixedStructList(optional(2) FixedStructList p1,
+ out optional(3) FixedStructList p3);
+ optional(1) FixedStructList opFixedStructListReq(optional(2) FixedStructList p1,
+ out optional(3) FixedStructList p3);
+
+ ["java:optional"] optional(1) VarStructSeq opVarStructSeq(optional(2) VarStructSeq p1,
+ out optional(3) VarStructSeq p3);
+ optional(1) VarStructSeq opVarStructSeqReq(optional(2) VarStructSeq p1, out optional(3) VarStructSeq p3);
+
+ ["java:optional"] optional(1) Serializable opSerializable(optional(2) Serializable p1,
+ out optional(3) Serializable p3);
+ optional(1) Serializable opSerializableReq(optional(2) Serializable p1, out optional(3) Serializable p3);
+
+ ["java:optional"] optional(1) IntIntDict opIntIntDict(optional(2) IntIntDict p1, out optional(3) IntIntDict p3);
+ optional(1) IntIntDict opIntIntDictReq(optional(2) IntIntDict p1, out optional(3) IntIntDict p3);
+
+ ["java:optional"] optional(1) StringIntDict opStringIntDict(optional(2) StringIntDict p1,
+ out optional(3) StringIntDict p3);
+ optional(1) StringIntDict opStringIntDictReq(optional(2) StringIntDict p1, out optional(3) StringIntDict p3);
+
+ ["java:optional"] optional(1) IntOneOptionalDict opIntOneOptionalDict(optional(2) IntOneOptionalDict p1,
+ out optional(3) IntOneOptionalDict p3);
+
+ optional(1) IntOneOptionalDict opIntOneOptionalDictReq(optional(2) IntOneOptionalDict p1,
+ out optional(3) IntOneOptionalDict p3);
+
+ void opClassAndUnknownOptional(A p);
+
+ void sendOptionalClass(bool req, optional(1) OneOptional o);
+
+ ["java:optional"]
+ void returnOptionalClass(bool req, out optional(1) OneOptional o);
+
+ G opG(G g);
+
+ void opVoid();
+
+ bool supportsRequiredParams();
+
+ bool supportsJavaSerializable();
+
+ bool supportsCsharpSerializable();
+
+ bool supportsCppStringView();
+};
+
+};
diff --git a/java/test/src/main/java/test/Ice/optional/lambda/AllTests.java b/java-compat/test/src/main/java/test/Ice/optional/lambda/AllTests.java
index 19fa4e7b2a9..19fa4e7b2a9 100644
--- a/java/test/src/main/java/test/Ice/optional/lambda/AllTests.java
+++ b/java-compat/test/src/main/java/test/Ice/optional/lambda/AllTests.java
diff --git a/java-compat/test/src/main/java/test/Ice/optional/run.py b/java-compat/test/src/main/java/test/Ice/optional/run.py
new file mode 100755
index 00000000000..6c82786dc7f
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/optional/run.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest(configName = "compact", message = "Running test with compact (default) format.")
+TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.",
+ additionalClientOptions="--Ice.Default.SlicedFormat",
+ additionalServerOptions="--Ice.Default.SlicedFormat")
+TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.",
+ server="test.Ice.optional.AMDServer")
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/packagemd/AllTests.java b/java-compat/test/src/main/java/test/Ice/packagemd/AllTests.java
new file mode 100644
index 00000000000..d2a9afed7b0
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/packagemd/AllTests.java
@@ -0,0 +1,196 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.packagemd;
+
+import java.io.PrintWriter;
+
+import test.Ice.packagemd.Test.InitialPrx;
+import test.Ice.packagemd.Test.InitialPrxHelper;
+import test.Ice.packagemd.Test1.C1;
+import test.Ice.packagemd.Test1.C2;
+import test.Ice.packagemd.Test1.E1;
+import test.Ice.packagemd.Test1.E2;
+import test.Ice.packagemd.Test1._notify;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static InitialPrx
+ allTests(Ice.Communicator communicator, PrintWriter out)
+ {
+ out.print("testing stringToProxy... ");
+ out.flush();
+ String ref = "initial:default -p 12010";
+ Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ test(base != null);
+ out.println("ok");
+
+ out.print("testing checked cast... ");
+ out.flush();
+ InitialPrx initial = InitialPrxHelper.checkedCast(base);
+ test(initial != null);
+ test(initial.equals(base));
+ out.println("ok");
+
+ {
+ out.print("testing types without package... ");
+ out.flush();
+ C1 c1 = initial.getTest1C2AsC1();
+ test(c1 != null);
+ test(c1 instanceof C2);
+ C2 c2 = initial.getTest1C2AsC2();
+ test(c2 != null);
+ try
+ {
+ initial.throwTest1E2AsE1();
+ test(false);
+ }
+ catch(E1 ex)
+ {
+ test(ex instanceof E2);
+ }
+ try
+ {
+ initial.throwTest1E2AsE2();
+ test(false);
+ }
+ catch(E2 ex)
+ {
+ // Expected
+ }
+ try
+ {
+ initial.throwTest1Notify();
+ test(false);
+ }
+ catch(_notify ex)
+ {
+ // Expected
+ }
+ out.println("ok");
+ }
+
+ {
+ out.print("testing types with package... ");
+ out.flush();
+
+ {
+ try
+ {
+ initial.throwTest2E2AsE1();
+ test(false);
+ }
+ catch(Ice.UnknownUserException ex)
+ {
+ // Expected
+ }
+ catch(Ice.MarshalException ex)
+ {
+ // Expected
+ }
+ catch(test.Ice.packagemd.testpkg.Test2.E1 ex)
+ {
+ test(false);
+ }
+ try
+ {
+ initial.throwTest2E2AsE2();
+ test(false);
+ }
+ catch(Ice.UnknownUserException ex)
+ {
+ // Expected
+ }
+ catch(Ice.MarshalException ex)
+ {
+ // Expected
+ }
+ catch(test.Ice.packagemd.testpkg.Test2.E1 ex)
+ {
+ test(false);
+ }
+ }
+
+ {
+ //
+ // Define Ice.Package.Test2=testpkg and try again.
+ //
+ communicator.getProperties().setProperty("Ice.Package.Test2", "test.Ice.packagemd.testpkg");
+ test.Ice.packagemd.testpkg.Test2.C1 c1 = initial.getTest2C2AsC1();
+ test(c1 != null);
+ test(c1 instanceof test.Ice.packagemd.testpkg.Test2.C2);
+ test.Ice.packagemd.testpkg.Test2.C2 c2 = initial.getTest2C2AsC2();
+ test(c2 != null);
+ try
+ {
+ initial.throwTest2E2AsE1();
+ test(false);
+ }
+ catch(test.Ice.packagemd.testpkg.Test2.E1 ex)
+ {
+ test(ex instanceof test.Ice.packagemd.testpkg.Test2.E2);
+ }
+ try
+ {
+ initial.throwTest2E2AsE2();
+ test(false);
+ }
+ catch(test.Ice.packagemd.testpkg.Test2.E2 ex)
+ {
+ // Expected
+ }
+ }
+
+ {
+ //
+ // Define Ice.Default.Package=testpkg and try again. We can't retrieve
+ // the Test2.* types again (with this communicator) because factories
+ // have already been cached for them, so now we use the Test3.* types.
+ //
+ communicator.getProperties().setProperty("Ice.Default.Package", "test.Ice.packagemd.testpkg");
+ test.Ice.packagemd.testpkg.Test3.C1 c1 = initial.getTest3C2AsC1();
+ test(c1 != null);
+ test(c1 instanceof test.Ice.packagemd.testpkg.Test3.C2);
+ test.Ice.packagemd.testpkg.Test3.C2 c2 = initial.getTest3C2AsC2();
+ test(c2 != null);
+ try
+ {
+ initial.throwTest3E2AsE1();
+ test(false);
+ }
+ catch(test.Ice.packagemd.testpkg.Test3.E1 ex)
+ {
+ test(ex instanceof test.Ice.packagemd.testpkg.Test3.E2);
+ }
+ try
+ {
+ initial.throwTest3E2AsE2();
+ test(false);
+ }
+ catch(test.Ice.packagemd.testpkg.Test3.E2 ex)
+ {
+ // Expected
+ }
+ }
+
+ out.println("ok");
+ }
+
+ return initial;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/packagemd/Client.java b/java-compat/test/src/main/java/test/Ice/packagemd/Client.java
new file mode 100644
index 00000000000..bf5c86e5fb7
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/packagemd/Client.java
@@ -0,0 +1,43 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.packagemd;
+
+import test.Ice.packagemd.Test.InitialPrx;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ InitialPrx initial = AllTests.allTests(communicator(), getWriter());
+ initial.shutdown();
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.packagemd");
+ initData.properties.setProperty("Ice.Package.Test1", "test.Ice.packagemd");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/packagemd/InitialI.java b/java-compat/test/src/main/java/test/Ice/packagemd/InitialI.java
new file mode 100644
index 00000000000..4c006512435
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/packagemd/InitialI.java
@@ -0,0 +1,143 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.packagemd;
+
+import test.Ice.packagemd.Test._InitialDisp;
+import test.Ice.packagemd.Test1.C1;
+import test.Ice.packagemd.Test1.C2;
+import test.Ice.packagemd.Test1.E1;
+import test.Ice.packagemd.Test1.E2;
+import test.Ice.packagemd.Test1._notify;
+
+public final class InitialI extends _InitialDisp
+{
+ public Ice.Object
+ getTest1C2AsObject(Ice.Current __current)
+ {
+ return new C2();
+ }
+
+ @Override
+ public C1
+ getTest1C2AsC1(Ice.Current __current)
+ {
+ return new C2();
+ }
+
+ @Override
+ public C2
+ getTest1C2AsC2(Ice.Current __current)
+ {
+ return new C2();
+ }
+
+ @Override
+ public void
+ throwTest1E2AsE1(Ice.Current __current)
+ throws E1
+ {
+ throw new E2();
+ }
+
+ @Override
+ public void
+ throwTest1E2AsE2(Ice.Current __current)
+ throws E2
+ {
+ throw new E2();
+ }
+
+ @Override
+ public void
+ throwTest1Notify(Ice.Current __current)
+ throws _notify
+ {
+ throw new _notify();
+ }
+
+ public Ice.Object
+ getTest2C2AsObject(Ice.Current __current)
+ {
+ return new test.Ice.packagemd.testpkg.Test2.C2();
+ }
+
+ @Override
+ public test.Ice.packagemd.testpkg.Test2.C1
+ getTest2C2AsC1(Ice.Current __current)
+ {
+ return new test.Ice.packagemd.testpkg.Test2.C2();
+ }
+
+ @Override
+ public test.Ice.packagemd.testpkg.Test2.C2
+ getTest2C2AsC2(Ice.Current __current)
+ {
+ return new test.Ice.packagemd.testpkg.Test2.C2();
+ }
+
+ @Override
+ public void
+ throwTest2E2AsE1(Ice.Current __current)
+ throws test.Ice.packagemd.testpkg.Test2.E1
+ {
+ throw new test.Ice.packagemd.testpkg.Test2.E2();
+ }
+
+ @Override
+ public void
+ throwTest2E2AsE2(Ice.Current __current)
+ throws test.Ice.packagemd.testpkg.Test2.E2
+ {
+ throw new test.Ice.packagemd.testpkg.Test2.E2();
+ }
+
+ public Ice.Object
+ getTest3C2AsObject(Ice.Current __current)
+ {
+ return new test.Ice.packagemd.testpkg.Test3.C2();
+ }
+
+ @Override
+ public test.Ice.packagemd.testpkg.Test3.C1
+ getTest3C2AsC1(Ice.Current __current)
+ {
+ return new test.Ice.packagemd.testpkg.Test3.C2();
+ }
+
+ @Override
+ public test.Ice.packagemd.testpkg.Test3.C2
+ getTest3C2AsC2(Ice.Current __current)
+ {
+ return new test.Ice.packagemd.testpkg.Test3.C2();
+ }
+
+ @Override
+ public void
+ throwTest3E2AsE1(Ice.Current __current)
+ throws test.Ice.packagemd.testpkg.Test3.E1
+ {
+ throw new test.Ice.packagemd.testpkg.Test3.E2();
+ }
+
+ @Override
+ public void
+ throwTest3E2AsE2(Ice.Current __current)
+ throws test.Ice.packagemd.testpkg.Test3.E2
+ {
+ throw new test.Ice.packagemd.testpkg.Test3.E2();
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current __current)
+ {
+ __current.adapter.getCommunicator().shutdown();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/packagemd/NoPackage.ice b/java-compat/test/src/main/java/test/Ice/packagemd/NoPackage.ice
new file mode 100644
index 00000000000..20f02bd3e2b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/packagemd/NoPackage.ice
@@ -0,0 +1,39 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.packagemd"]]
+module Test1
+{
+class C1
+{
+ int i;
+};
+
+class C2 extends C1
+{
+ long l;
+};
+
+exception E1
+{
+ int i;
+};
+
+exception E2 extends E1
+{
+ long l;
+};
+
+exception notify /* Test keyword escape. */
+{
+ int i;
+};
+};
diff --git a/java-compat/test/src/main/java/test/Ice/packagemd/Package.ice b/java-compat/test/src/main/java/test/Ice/packagemd/Package.ice
new file mode 100644
index 00000000000..5e4c575f3d7
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/packagemd/Package.ice
@@ -0,0 +1,57 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.packagemd.testpkg"]]
+module Test2
+{
+class C1
+{
+ int i;
+};
+
+class C2 extends C1
+{
+ long l;
+};
+
+exception E1
+{
+ int i;
+};
+
+exception E2 extends E1
+{
+ long l;
+};
+};
+
+module Test3
+{
+class C1
+{
+ int i;
+};
+
+class C2 extends C1
+{
+ long l;
+};
+
+exception E1
+{
+ int i;
+};
+
+exception E2 extends E1
+{
+ long l;
+};
+};
diff --git a/java-compat/test/src/main/java/test/Ice/packagemd/Server.java b/java-compat/test/src/main/java/test/Ice/packagemd/Server.java
new file mode 100644
index 00000000000..2f7abf04cf4
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/packagemd/Server.java
@@ -0,0 +1,44 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.packagemd;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.Object object = new InitialI();
+ adapter.add(object, Ice.Util.stringToIdentity("initial"));
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.packagemd");
+ initData.properties.setProperty("Ice.Package.Test1", "test.Ice.packagemd");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server c = new Server();
+ int status = c.main("Server", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/packagemd/Test.ice b/java-compat/test/src/main/java/test/Ice/packagemd/Test.ice
new file mode 100644
index 00000000000..e4fe018d8ff
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/packagemd/Test.ice
@@ -0,0 +1,40 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+#include <Package.ice>
+#include <NoPackage.ice>
+
+[["java:package:test.Ice.packagemd"]]
+module Test
+{
+
+interface Initial
+{
+ Test1::C1 getTest1C2AsC1();
+ Test1::C2 getTest1C2AsC2();
+ void throwTest1E2AsE1() throws Test1::E1;
+ void throwTest1E2AsE2() throws Test1::E2;
+ void throwTest1Notify() throws Test1::notify;
+
+ Test2::C1 getTest2C2AsC1();
+ Test2::C2 getTest2C2AsC2();
+ void throwTest2E2AsE1() throws Test2::E1;
+ void throwTest2E2AsE2() throws Test2::E2;
+
+ Test3::C1 getTest3C2AsC1();
+ Test3::C2 getTest3C2AsC2();
+ void throwTest3E2AsE1() throws Test3::E1;
+ void throwTest3E2AsE2() throws Test3::E2;
+
+ void shutdown();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/packagemd/run.py b/java-compat/test/src/main/java/test/Ice/packagemd/run.py
new file mode 100755
index 00000000000..97f9acd4094
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/packagemd/run.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/plugin/Client.java b/java-compat/test/src/main/java/test/Ice/plugin/Client.java
new file mode 100644
index 00000000000..1cb30d326a1
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/plugin/Client.java
@@ -0,0 +1,219 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.plugin;
+
+import java.io.PrintWriter;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ // Under Android the class comes from the communicators classloader which
+ // is setup in the android test driver.
+ String jarFile;
+ if(isAndroid())
+ {
+ jarFile = "";
+ }
+ else
+ {
+ jarFile = "../../../../../../../lib/IceTestPlugins.jar";
+ }
+
+ Ice.Communicator communicator = communicator();
+ PrintWriter printWriter = getWriter();
+ printWriter.print("testing a simple plug-in... ");
+ printWriter.flush();
+ try
+ {
+ Ice.InitializationData initData = createInitData();
+ initData.properties.setProperty("Ice.Plugin.Test",
+ jarFile + ":test.Ice.plugin.plugins.PluginFactory " +
+ "'C:\\Program Files\\' --DatabasePath 'C:\\Program Files\\Application\\db'");
+ communicator = Ice.Util.initialize(args, initData);
+ communicator.destroy();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ printWriter.println("ok");
+
+ printWriter.print("testing a simple plug-in that fails to initialize... ");
+ printWriter.flush();
+ communicator = null;
+ try
+ {
+ Ice.InitializationData initData = createInitData();
+ initData.properties.setProperty("Ice.Plugin.Test",
+ jarFile + ":test.Ice.plugin.plugins.PluginInitializeFailFactory");
+ communicator = Ice.Util.initialize(args, initData);
+ test(false);
+ }
+ catch(Ice.PluginInitializationException ex)
+ {
+ test(ex.getCause().getMessage().equals("PluginInitializeFailException"));
+ }
+ test(communicator == null);
+ printWriter.println("ok");
+
+ printWriter.print("testing plug-in load order... ");
+ printWriter.flush();
+ try
+ {
+ Ice.InitializationData initData = createInitData();
+ initData.properties.setProperty("Ice.Plugin.PluginOne",
+ jarFile + ":test.Ice.plugin.plugins.PluginOneFactory");
+ initData.properties.setProperty("Ice.Plugin.PluginTwo",
+ jarFile + ":test.Ice.plugin.plugins.PluginTwoFactory");
+ initData.properties.setProperty("Ice.Plugin.PluginThree",
+ jarFile + ":test.Ice.plugin.plugins.PluginThreeFactory");
+ initData.properties.setProperty("Ice.PluginLoadOrder", "PluginOne, PluginTwo"); // Exclude PluginThree
+ communicator = Ice.Util.initialize(args, initData);
+ communicator.destroy();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ printWriter.println("ok");
+
+ printWriter.print("testing plug-in manager... ");
+ printWriter.flush();
+ try
+ {
+ Ice.InitializationData initData = createInitData();
+ initData.properties.setProperty("Ice.Plugin.PluginOne",
+ jarFile + ":test.Ice.plugin.plugins.PluginOneFactory");
+ initData.properties.setProperty("Ice.Plugin.PluginTwo",
+ jarFile + ":test.Ice.plugin.plugins.PluginTwoFactory");
+ initData.properties.setProperty("Ice.Plugin.PluginThree",
+ jarFile + ":test.Ice.plugin.plugins.PluginThreeFactory");
+ initData.properties.setProperty("Ice.PluginLoadOrder", "PluginOne, PluginTwo");
+ initData.properties.setProperty("Ice.InitPlugins", "0");
+ communicator = Ice.Util.initialize(args, initData);
+
+ Ice.PluginManager pm = communicator.getPluginManager();
+ test(pm.getPlugin("PluginOne") != null);
+ test(pm.getPlugin("PluginTwo") != null);
+ test(pm.getPlugin("PluginThree") != null);
+
+ MyPlugin p4 = new MyPlugin();
+ pm.addPlugin("PluginFour", p4);
+ test(pm.getPlugin("PluginFour") != null);
+
+ pm.initializePlugins();
+
+ test(p4.isInitialized());
+
+ communicator.destroy();
+
+ test(p4.isDestroyed());
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ printWriter.println("ok");
+
+ printWriter.print("testing destroy when a plug-in fails to initialize... ");
+ printWriter.flush();
+ communicator = null;
+ try
+ {
+ Ice.InitializationData initData = createInitData();
+ initData.properties.setProperty("Ice.Plugin.PluginOneFail",
+ jarFile + ":test.Ice.plugin.plugins.PluginOneFailFactory");
+ initData.properties.setProperty("Ice.Plugin.PluginTwoFail",
+ jarFile + ":test.Ice.plugin.plugins.PluginTwoFailFactory");
+ initData.properties.setProperty("Ice.Plugin.PluginThreeFail",
+ jarFile + ":test.Ice.plugin.plugins.PluginThreeFailFactory");
+ initData.properties.setProperty("Ice.PluginLoadOrder", "PluginOneFail, PluginTwoFail, PluginThreeFail");
+ communicator = Ice.Util.initialize(args, initData);
+ }
+ catch(Ice.PluginInitializationException ex)
+ {
+ test(ex.getCause().getMessage().equals("PluginInitializeFailException"));
+ }
+ test(communicator == null);
+ printWriter.println("ok");
+
+ System.gc();
+ System.runFinalization();
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ return initData;
+ }
+
+ private Ice.InitializationData createInitData()
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ if(classLoader() != null)
+ {
+ initData.classLoader = classLoader();
+ }
+ initData.properties = Ice.Util.createProperties();
+ return initData;
+ }
+
+ private static void test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+
+ static class MyPlugin implements Ice.Plugin
+ {
+ public boolean isInitialized()
+ {
+ return _initialized;
+ }
+
+ public boolean isDestroyed()
+ {
+ return _destroyed;
+ }
+
+ @Override
+ public void initialize()
+ {
+ _initialized = true;
+ }
+
+ @Override
+ public void destroy()
+ {
+ _destroyed = true;
+ }
+
+ private boolean _initialized = false;
+ private boolean _destroyed = false;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/plugin/run.py b/java-compat/test/src/main/java/test/Ice/plugin/run.py
new file mode 100755
index 00000000000..7f28bf562d9
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/plugin/run.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+sys.stdout.write("starting test... ")
+sys.stdout.flush()
+clientProc = TestUtil.startClient("test.Ice.plugin.Client",startReader=False)
+print("ok")
+clientProc.startReader()
+
+clientProc.waitTestSuccess()
+
diff --git a/java-compat/test/src/main/java/test/Ice/properties/Client.java b/java-compat/test/src/main/java/test/Ice/properties/Client.java
new file mode 100644
index 00000000000..522ec06d7a5
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/properties/Client.java
@@ -0,0 +1,116 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.properties;
+
+public class Client extends test.Util.Application
+{
+ public static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ class PropertiesClient extends Ice.Application
+ {
+ @Override
+ public int
+ run(String[] args)
+ {
+ Ice.Properties properties = communicator().getProperties();
+ test(properties.getProperty("Ice.Trace.Network").equals("1"));
+ test(properties.getProperty("Ice.Trace.Protocol").equals("1"));
+ test(properties.getProperty("Config.Path").equals(configPath));
+ test(properties.getProperty("Ice.ProgramName").equals("PropertiesClient"));
+ test(appName().equals(properties.getProperty("Ice.ProgramName")));
+ return 0;
+ };
+ };
+
+ @Override
+ public int run(String[] args)
+ {
+ {
+ System.out.print("testing load properties from UTF-8 path... ");
+ Ice.Properties properties = Ice.Util.createProperties();
+ properties.load(configPath);
+ test(properties.getProperty("Ice.Trace.Network").equals("1"));
+ test(properties.getProperty("Ice.Trace.Protocol").equals("1"));
+ test(properties.getProperty("Config.Path").equals(configPath));
+ test(properties.getProperty("Ice.ProgramName").equals("PropertiesClient"));
+ System.out.println("ok");
+ System.out.print("testing load properties from UTF-8 path using Ice::Application... ");
+ PropertiesClient c = new PropertiesClient();
+ c.main("", args, configPath);
+ System.out.println("ok");
+ }
+ {
+ //
+ // Try to load multiple config files.
+ //
+ System.out.print("testing using Ice.Config with multiple config files... ");
+ String[] args1 = new String[]{"--Ice.Config=config/config.1, config/config.2, config/config.3"};
+ Ice.Properties properties = Ice.Util.createProperties(args1);
+ test(properties.getProperty("Config1").equals("Config1"));
+ test(properties.getProperty("Config2").equals("Config2"));
+ test(properties.getProperty("Config3").equals("Config3"));
+ System.out.println("ok");
+ }
+
+ {
+ System.out.print("testing configuration file escapes... ");
+ String[] args1 = new String[]{"--Ice.Config=config/escapes.cfg"};
+ Ice.Properties properties = Ice.Util.createProperties(args1);
+
+ String[] props = new String[]{"Foo\tBar", "3",
+ "Foo\\tBar", "4",
+ "Escape\\ Space", "2",
+ "Prop1", "1",
+ "Prop2", "2",
+ "Prop3", "3",
+ "My Prop1", "1",
+ "My Prop2", "2",
+ "My.Prop1", "a property",
+ "My.Prop2", "a property",
+ "My.Prop3", " a property ",
+ "My.Prop4", " a property ",
+ "My.Prop5", "a \\ property",
+ "foo=bar", "1",
+ "foo#bar", "2",
+ "foo bar", "3",
+ "A", "1",
+ "B", "2 3 4",
+ "C", "5=#6",
+ "AServer", "\\\\server\\dir",
+ "BServer", "\\server\\dir",
+ ""};
+
+ for(int i = 0; !props[i].isEmpty(); i += 2)
+ {
+ test(properties.getProperty(props[i]).equals(props[i + 1]));
+ }
+ System.out.println("ok");
+ }
+
+ return 0;
+ }
+
+ public static void main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+ System.gc();
+ System.exit(status);
+ }
+
+ private static String configPath = "./config/\u4E2D\u56FD_client.config";
+}
diff --git a/java-compat/test/src/main/java/test/Ice/properties/config/.gitignore b/java-compat/test/src/main/java/test/Ice/properties/config/.gitignore
new file mode 100644
index 00000000000..143c64680f3
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/properties/config/.gitignore
@@ -0,0 +1 @@
+*.config
diff --git a/java-compat/test/src/main/java/test/Ice/properties/config/config.1 b/java-compat/test/src/main/java/test/Ice/properties/config/config.1
new file mode 100644
index 00000000000..2a20653e4c5
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/properties/config/config.1
@@ -0,0 +1 @@
+Config1=Config1 \ No newline at end of file
diff --git a/java-compat/test/src/main/java/test/Ice/properties/config/config.2 b/java-compat/test/src/main/java/test/Ice/properties/config/config.2
new file mode 100644
index 00000000000..be276df6602
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/properties/config/config.2
@@ -0,0 +1 @@
+Config2=Config2 \ No newline at end of file
diff --git a/java-compat/test/src/main/java/test/Ice/properties/config/config.3 b/java-compat/test/src/main/java/test/Ice/properties/config/config.3
new file mode 100644
index 00000000000..55c1e1123f6
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/properties/config/config.3
@@ -0,0 +1 @@
+Config3=Config3 \ No newline at end of file
diff --git a/java-compat/test/src/main/java/test/Ice/properties/config/escapes.cfg b/java-compat/test/src/main/java/test/Ice/properties/config/escapes.cfg
new file mode 100644
index 00000000000..f438d2b59c8
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/properties/config/escapes.cfg
@@ -0,0 +1,35 @@
+Foo Bar=3 #tab
+Foo\tBar=4 # embedded\t
+Escape\\ Space=2
+
+#
+# From Ice manual:
+#
+
+Prop1 = 1 # Key is "Prop1"
+ Prop2 = 2 # Key is "Prop2"
+\ Prop3 \ = 3 # Key is "Prop3"
+My Prop1 = 1 # Key is "My Prop1"
+My\ Prop2 = 2 # Key is "My Prop2"
+
+My.Prop1 = a property # Value is "a property"
+My.Prop2 = a property # Value is "a property"
+My.Prop3 = \ \ a property\ \ # Value is " a property "
+My.Prop4 = \ \ a \ \ property\ \ # Value is " a property "
+My.Prop5 = a \\ property # Value is "a \ property"
+
+foo\=bar=1 # Name is "foo=bar", value is "1"
+foo\#bar = 2 # Name is "foo#bar", value is "2"
+foo bar =3 # Name is "foo bar", value is "3"
+
+
+A=1 # Name is "A", value is "1"
+B= 2 3 4 # Name is "B", value is "2 3 4"
+C=5=\#6 # 7 # Name is "C", value is "5=#6"
+
+AServer=\\\\server\dir # Value is "\\server\dir"
+BServer=\\server\\dir # Value is "\server\dir"
+
+
+
+
diff --git a/java-compat/test/src/main/java/test/Ice/properties/run.py b/java-compat/test/src/main/java/test/Ice/properties/run.py
new file mode 100755
index 00000000000..4dd7c78e98d
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/properties/run.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+#
+# Write config
+#
+if sys.version_info[0] == 2:
+ configPath = "./config/\xe4\xb8\xad\xe5\x9b\xbd_client.config"
+ decodedPath = configPath.decode("utf-8")
+else:
+ configPath = "./config/\u4e2d\u56fd_client.config"
+ decodedPath = configPath # No need to decode with Python3, strings are already Unicode
+
+TestUtil.createConfig(decodedPath,
+ ["# Automatically generated by Ice test driver.",
+ "Ice.Trace.Protocol=1",
+ "Ice.Trace.Network=1",
+ "Ice.ProgramName=PropertiesClient",
+ "Config.Path=" + configPath],
+ "utf-8")
+
+sys.stdout.write("starting client... ")
+sys.stdout.flush()
+clientProc = TestUtil.startClient("test.Ice.properties.Client",startReader=False)
+print("ok")
+clientProc.startReader()
+clientProc.waitTestSuccess()
+
+if os.path.exists(decodedPath):
+ os.remove(decodedPath)
diff --git a/java-compat/test/src/main/java/test/Ice/proxy/AMDMyDerivedClassI.java b/java-compat/test/src/main/java/test/Ice/proxy/AMDMyDerivedClassI.java
new file mode 100644
index 00000000000..68886fa161c
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/proxy/AMDMyDerivedClassI.java
@@ -0,0 +1,57 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.proxy;
+import test.Ice.proxy.AMD.Test.AMD_MyClass_getContext;
+import test.Ice.proxy.AMD.Test.AMD_MyClass_shutdown;
+import test.Ice.proxy.AMD.Test.AMD_MyDerivedClass_echo;
+import test.Ice.proxy.AMD.Test.MyDerivedClass;
+
+public final class AMDMyDerivedClassI extends MyDerivedClass
+{
+ public
+ AMDMyDerivedClassI()
+ {
+ }
+
+ @Override
+ public void
+ echo_async(AMD_MyDerivedClass_echo cb,
+ Ice.ObjectPrx obj,
+ Ice.Current c)
+ {
+ cb.ice_response(obj);
+ }
+
+ @Override
+ public void
+ shutdown_async(AMD_MyClass_shutdown cb,
+ Ice.Current c)
+ {
+ c.adapter.getCommunicator().shutdown();
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ getContext_async(AMD_MyClass_getContext cb, Ice.Current current)
+ {
+ cb.ice_response(_ctx);
+ }
+
+ @Override
+ public boolean
+ ice_isA(String s, Ice.Current current)
+ {
+ _ctx = current.ctx;
+ return super.ice_isA(s, current);
+ }
+
+ private java.util.Map<String, String> _ctx;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/proxy/AMDServer.java b/java-compat/test/src/main/java/test/Ice/proxy/AMDServer.java
new file mode 100644
index 00000000000..82defd2909a
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/proxy/AMDServer.java
@@ -0,0 +1,43 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.proxy;
+
+public class AMDServer extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new AMDMyDerivedClassI(), Ice.Util.stringToIdentity("test"));
+ adapter.activate();
+
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy.AMD");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ AMDServer app = new AMDServer();
+ int result = app.main("AMDServer", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/proxy/AllTests.java b/java-compat/test/src/main/java/test/Ice/proxy/AllTests.java
new file mode 100644
index 00000000000..1b92d902a92
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/proxy/AllTests.java
@@ -0,0 +1,981 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.proxy;
+import java.io.PrintWriter;
+
+import test.Ice.proxy.Test.MyClassPrx;
+import test.Ice.proxy.Test.MyClassPrxHelper;
+import test.Ice.proxy.Test.MyDerivedClassPrx;
+import test.Ice.proxy.Test.MyDerivedClassPrxHelper;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static MyClassPrx
+ allTests(Ice.Communicator communicator, PrintWriter out)
+ {
+ out.print("testing stringToProxy... ");
+ out.flush();
+ String ref = "test:default -p 12010";
+ Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ test(base != null);
+
+ Ice.ObjectPrx b1 = communicator.stringToProxy("test");
+ test(b1.ice_getIdentity().name.equals("test") && b1.ice_getIdentity().category.length() == 0 &&
+ b1.ice_getAdapterId().length() == 0 && b1.ice_getFacet().length() == 0);
+ b1 = communicator.stringToProxy("test ");
+ test(b1.ice_getIdentity().name.equals("test") && b1.ice_getIdentity().category.length() == 0 &&
+ b1.ice_getFacet().length() == 0);
+ b1 = communicator.stringToProxy(" test ");
+ test(b1.ice_getIdentity().name.equals("test") && b1.ice_getIdentity().category.length() == 0 &&
+ b1.ice_getFacet().length() == 0);
+ b1 = communicator.stringToProxy(" test");
+ test(b1.ice_getIdentity().name.equals("test") && b1.ice_getIdentity().category.length() == 0 &&
+ b1.ice_getFacet().length() == 0);
+ b1 = communicator.stringToProxy("'test -f facet'");
+ test(b1.ice_getIdentity().name.equals("test -f facet") && b1.ice_getIdentity().category.length() == 0 &&
+ b1.ice_getFacet().length() == 0);
+ try
+ {
+ b1 = communicator.stringToProxy("\"test -f facet'");
+ test(false);
+ }
+ catch(Ice.ProxyParseException ex)
+ {
+ }
+ b1 = communicator.stringToProxy("\"test -f facet\"");
+ test(b1.ice_getIdentity().name.equals("test -f facet") && b1.ice_getIdentity().category.length() == 0 &&
+ b1.ice_getFacet().length() == 0);
+ b1 = communicator.stringToProxy("\"test -f facet@test\"");
+ test(b1.ice_getIdentity().name.equals("test -f facet@test") && b1.ice_getIdentity().category.length() == 0 &&
+ b1.ice_getFacet().length() == 0);
+ b1 = communicator.stringToProxy("\"test -f facet@test @test\"");
+ test(b1.ice_getIdentity().name.equals("test -f facet@test @test") && b1.ice_getIdentity().category.length() == 0 &&
+ b1.ice_getFacet().length() == 0);
+ try
+ {
+ b1 = communicator.stringToProxy("test test");
+ test(false);
+ }
+ catch(Ice.ProxyParseException ex)
+ {
+ }
+ b1 = communicator.stringToProxy("test\\040test");
+ test(b1.ice_getIdentity().name.equals("test test") && b1.ice_getIdentity().category.length() == 0);
+ try
+ {
+ b1 = communicator.stringToProxy("test\\777");
+ test(false);
+ }
+ catch(Ice.IdentityParseException ex)
+ {
+ }
+ b1 = communicator.stringToProxy("test\\40test");
+ test(b1.ice_getIdentity().name.equals("test test"));
+
+ // Test some octal and hex corner cases.
+ b1 = communicator.stringToProxy("test\\4test");
+ test(b1.ice_getIdentity().name.equals("test\4test"));
+ b1 = communicator.stringToProxy("test\\04test");
+ test(b1.ice_getIdentity().name.equals("test\4test"));
+ b1 = communicator.stringToProxy("test\\004test");
+ test(b1.ice_getIdentity().name.equals("test\4test"));
+ b1 = communicator.stringToProxy("test\\1114test");
+ test(b1.ice_getIdentity().name.equals("test\1114test"));
+
+ b1 = communicator.stringToProxy("test\\b\\f\\n\\r\\t\\'\\\"\\\\test");
+ test(b1.ice_getIdentity().name.equals("test\b\f\n\r\t\'\"\\test") &&
+ b1.ice_getIdentity().category.length() == 0);
+
+ b1 = communicator.stringToProxy("category/test");
+ test(b1.ice_getIdentity().name.equals("test") && b1.ice_getIdentity().category.equals("category") &&
+ b1.ice_getAdapterId().length() == 0);
+
+ b1 = communicator.stringToProxy("");
+ test(b1 == null);
+ b1 = communicator.stringToProxy("\"\"");
+ test(b1 == null);
+ try
+ {
+ b1 = communicator.stringToProxy("\"\" test"); // Invalid trailing characters.
+ test(false);
+ }
+ catch(Ice.ProxyParseException ex)
+ {
+ }
+ try
+ {
+ b1 = communicator.stringToProxy("test:"); // Missing endpoint.
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ b1 = communicator.stringToProxy("test@adapter");
+ test(b1.ice_getIdentity().name.equals("test") && b1.ice_getIdentity().category.length() == 0 &&
+ b1.ice_getAdapterId().equals("adapter"));
+ try
+ {
+ b1 = communicator.stringToProxy("id@adapter test");
+ test(false);
+ }
+ catch(Ice.ProxyParseException ex)
+ {
+ }
+ b1 = communicator.stringToProxy("category/test@adapter");
+ test(b1.ice_getIdentity().name.equals("test") && b1.ice_getIdentity().category.equals("category") &&
+ b1.ice_getAdapterId().equals("adapter"));
+ b1 = communicator.stringToProxy("category/test@adapter:tcp");
+ test(b1.ice_getIdentity().name.equals("test") && b1.ice_getIdentity().category.equals("category") &&
+ b1.ice_getAdapterId().equals("adapter:tcp"));
+ b1 = communicator.stringToProxy("'category 1/test'@adapter");
+ test(b1.ice_getIdentity().name.equals("test") && b1.ice_getIdentity().category.equals("category 1") &&
+ b1.ice_getAdapterId().equals("adapter"));
+ b1 = communicator.stringToProxy("'category/test 1'@adapter");
+ test(b1.ice_getIdentity().name.equals("test 1") && b1.ice_getIdentity().category.equals("category") &&
+ b1.ice_getAdapterId().equals("adapter"));
+ b1 = communicator.stringToProxy("'category/test'@'adapter 1'");
+ test(b1.ice_getIdentity().name.equals("test") && b1.ice_getIdentity().category.equals("category") &&
+ b1.ice_getAdapterId().equals("adapter 1"));
+ b1 = communicator.stringToProxy("\"category \\/test@foo/test\"@adapter");
+ test(b1.ice_getIdentity().name.equals("test") && b1.ice_getIdentity().category.equals("category /test@foo") &&
+ b1.ice_getAdapterId().equals("adapter"));
+ b1 = communicator.stringToProxy("\"category \\/test@foo/test\"@\"adapter:tcp\"");
+ test(b1.ice_getIdentity().name.equals("test") && b1.ice_getIdentity().category.equals("category /test@foo") &&
+ b1.ice_getAdapterId().equals("adapter:tcp"));
+
+ b1 = communicator.stringToProxy("id -f facet");
+ test(b1.ice_getIdentity().name.equals("id") && b1.ice_getIdentity().category.length() == 0 &&
+ b1.ice_getFacet().equals("facet"));
+ b1 = communicator.stringToProxy("id -f 'facet x'");
+ test(b1.ice_getIdentity().name.equals("id") && b1.ice_getIdentity().category.length() == 0 &&
+ b1.ice_getFacet().equals("facet x"));
+ b1 = communicator.stringToProxy("id -f \"facet x\"");
+ test(b1.ice_getIdentity().name.equals("id") && b1.ice_getIdentity().category.length() == 0 &&
+ b1.ice_getFacet().equals("facet x"));
+ try
+ {
+ b1 = communicator.stringToProxy("id -f \"facet x");
+ test(false);
+ }
+ catch(Ice.ProxyParseException ex)
+ {
+ }
+ try
+ {
+ b1 = communicator.stringToProxy("id -f \'facet x");
+ test(false);
+ }
+ catch(Ice.ProxyParseException ex)
+ {
+ }
+ b1 = communicator.stringToProxy("test -f facet:tcp");
+ test(b1.ice_getIdentity().name.equals("test") && b1.ice_getIdentity().category.length() == 0 &&
+ b1.ice_getFacet().equals("facet") && b1.ice_getAdapterId().length() == 0);
+ b1 = communicator.stringToProxy("test -f \"facet:tcp\"");
+ test(b1.ice_getIdentity().name.equals("test") && b1.ice_getIdentity().category.length() == 0 &&
+ b1.ice_getFacet().equals("facet:tcp") && b1.ice_getAdapterId().length() == 0);
+ b1 = communicator.stringToProxy("test -f facet@test");
+ test(b1.ice_getIdentity().name.equals("test") && b1.ice_getIdentity().category.length() == 0 &&
+ b1.ice_getFacet().equals("facet") && b1.ice_getAdapterId().equals("test"));
+ b1 = communicator.stringToProxy("test -f 'facet@test'");
+ test(b1.ice_getIdentity().name.equals("test") && b1.ice_getIdentity().category.length() == 0 &&
+ b1.ice_getFacet().equals("facet@test") && b1.ice_getAdapterId().length() == 0);
+ b1 = communicator.stringToProxy("test -f 'facet@test'@test");
+ test(b1.ice_getIdentity().name.equals("test") && b1.ice_getIdentity().category.length() == 0 &&
+ b1.ice_getFacet().equals("facet@test") && b1.ice_getAdapterId().equals("test"));
+ try
+ {
+ b1 = communicator.stringToProxy("test -f facet@test @test");
+ test(false);
+ }
+ catch(Ice.ProxyParseException ex)
+ {
+ }
+ b1 = communicator.stringToProxy("test");
+ test(b1.ice_isTwoway());
+ b1 = communicator.stringToProxy("test -t");
+ test(b1.ice_isTwoway());
+ b1 = communicator.stringToProxy("test -o");
+ test(b1.ice_isOneway());
+ b1 = communicator.stringToProxy("test -O");
+ test(b1.ice_isBatchOneway());
+ b1 = communicator.stringToProxy("test -d");
+ test(b1.ice_isDatagram());
+ b1 = communicator.stringToProxy("test -D");
+ test(b1.ice_isBatchDatagram());
+ b1 = communicator.stringToProxy("test");
+ test(!b1.ice_isSecure());
+ b1 = communicator.stringToProxy("test -s");
+ test(b1.ice_isSecure());
+
+ test(b1.ice_getEncodingVersion().equals(Ice.Util.currentEncoding()));
+
+ b1 = communicator.stringToProxy("test -e 1.0");
+ test(b1.ice_getEncodingVersion().major == 1 && b1.ice_getEncodingVersion().minor == 0);
+
+ b1 = communicator.stringToProxy("test -e 6.5");
+ test(b1.ice_getEncodingVersion().major == 6 && b1.ice_getEncodingVersion().minor == 5);
+
+ b1 = communicator.stringToProxy("test -p 1.0 -e 1.0");
+ test(b1.toString().equals("test -t -e 1.0"));
+
+ b1 = communicator.stringToProxy("test -p 6.5 -e 1.0");
+ test(b1.toString().equals("test -t -p 6.5 -e 1.0"));
+
+ try
+ {
+ b1 = communicator.stringToProxy("test:tcp@adapterId");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+ // This is an unknown endpoint warning, not a parse exception.
+ //
+ //try
+ //{
+ // b1 = communicator.stringToProxy("test -f the:facet:tcp");
+ // test(false);
+ //}
+ //catch(Ice.EndpointParseException ex)
+ //{
+ //}
+ try
+ {
+ b1 = communicator.stringToProxy("test::tcp");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ //
+ // Test for bug ICE-5543: escaped escapes in stringToIdentity
+ //
+ Ice.Identity id = new Ice.Identity("test", ",X2QNUAzSBcJ_e$AV;E\\");
+ Ice.Identity id2 = Ice.Util.stringToIdentity(Ice.Util.identityToString(id));
+ test(id.equals(id2));
+
+ id = new Ice.Identity("test", ",X2QNUAz\\SB\\/cJ_e$AV;E\\\\");
+ id2 = Ice.Util.stringToIdentity(Ice.Util.identityToString(id));
+ test(id.equals(id2));
+
+ out.println("ok");
+
+ out.print("testing propertyToProxy... ");
+ out.flush();
+ Ice.Properties prop = communicator.getProperties();
+ String propertyPrefix = "Foo.Proxy";
+ prop.setProperty(propertyPrefix, "test:default -p 12010");
+ b1 = communicator.propertyToProxy(propertyPrefix);
+ test(b1.ice_getIdentity().name.equals("test") && b1.ice_getIdentity().category.length() == 0 &&
+ b1.ice_getAdapterId().length() == 0 && b1.ice_getFacet().length() == 0);
+
+ String property;
+
+ property = propertyPrefix + ".Locator";
+ test(b1.ice_getLocator() == null);
+ prop.setProperty(property, "locator:default -p 10000");
+ b1 = communicator.propertyToProxy(propertyPrefix);
+ test(b1.ice_getLocator() != null && b1.ice_getLocator().ice_getIdentity().name.equals("locator"));
+ prop.setProperty(property, "");
+
+ property = propertyPrefix + ".LocatorCacheTimeout";
+ test(b1.ice_getLocatorCacheTimeout() == -1);
+ prop.setProperty(property, "1");
+ b1 = communicator.propertyToProxy(propertyPrefix);
+ test(b1.ice_getLocatorCacheTimeout() == 1);
+ prop.setProperty(property, "");
+
+ // Now retest with an indirect proxy.
+ prop.setProperty(propertyPrefix, "test");
+ property = propertyPrefix + ".Locator";
+ prop.setProperty(property, "locator:default -p 10000");
+ b1 = communicator.propertyToProxy(propertyPrefix);
+ test(b1.ice_getLocator() != null && b1.ice_getLocator().ice_getIdentity().name.equals("locator"));
+ prop.setProperty(property, "");
+
+ property = propertyPrefix + ".LocatorCacheTimeout";
+ test(b1.ice_getLocatorCacheTimeout() == -1);
+ prop.setProperty(property, "1");
+ b1 = communicator.propertyToProxy(propertyPrefix);
+ test(b1.ice_getLocatorCacheTimeout() == 1);
+ prop.setProperty(property, "");
+
+ // This cannot be tested so easily because the property is cached
+ // on communicator initialization.
+ //
+ //prop.setProperty("Ice.Default.LocatorCacheTimeout", "60");
+ //b1 = communicator.propertyToProxy(propertyPrefix);
+ //test(b1.ice_getLocatorCacheTimeout() == 60);
+ //prop.setProperty("Ice.Default.LocatorCacheTimeout", "");
+
+ prop.setProperty(propertyPrefix, "test:default -p 12010");
+
+ property = propertyPrefix + ".Router";
+ test(b1.ice_getRouter() == null);
+ prop.setProperty(property, "router:default -p 10000");
+ b1 = communicator.propertyToProxy(propertyPrefix);
+ test(b1.ice_getRouter() != null && b1.ice_getRouter().ice_getIdentity().name.equals("router"));
+ prop.setProperty(property, "");
+
+ property = propertyPrefix + ".PreferSecure";
+ test(!b1.ice_isPreferSecure());
+ prop.setProperty(property, "1");
+ b1 = communicator.propertyToProxy(propertyPrefix);
+ test(b1.ice_isPreferSecure());
+ prop.setProperty(property, "");
+
+ property = propertyPrefix + ".ConnectionCached";
+ test(b1.ice_isConnectionCached());
+ prop.setProperty(property, "0");
+ b1 = communicator.propertyToProxy(propertyPrefix);
+ test(!b1.ice_isConnectionCached());
+ prop.setProperty(property, "");
+
+ property = propertyPrefix + ".InvocationTimeout";
+ test(b1.ice_getInvocationTimeout() == -1);
+ prop.setProperty(property, "1000");
+ b1 = communicator.propertyToProxy(propertyPrefix);
+ test(b1.ice_getInvocationTimeout() == 1000);
+ prop.setProperty(property, "");
+
+ property = propertyPrefix + ".EndpointSelection";
+ test(b1.ice_getEndpointSelection() == Ice.EndpointSelectionType.Random);
+ prop.setProperty(property, "Random");
+ b1 = communicator.propertyToProxy(propertyPrefix);
+ test(b1.ice_getEndpointSelection() == Ice.EndpointSelectionType.Random);
+ prop.setProperty(property, "Ordered");
+ b1 = communicator.propertyToProxy(propertyPrefix);
+ test(b1.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered);
+ prop.setProperty(property, "");
+
+ property = propertyPrefix + ".CollocationOptimized";
+ test(b1.ice_isCollocationOptimized());
+ prop.setProperty(property, "0");
+ b1 = communicator.propertyToProxy(propertyPrefix);
+ test(!b1.ice_isCollocationOptimized());
+ prop.setProperty(property, "");
+
+ property = propertyPrefix + ".Context.c1";
+ test(b1.ice_getContext().get("c1") == null);
+ prop.setProperty(property, "TEST");
+ b1 = communicator.propertyToProxy(propertyPrefix);
+ test(b1.ice_getContext().get("c1").equals("TEST"));
+
+ property = propertyPrefix + ".Context.c2";
+ test(b1.ice_getContext().get("c2") == null);
+ prop.setProperty(property, "TEST");
+ b1 = communicator.propertyToProxy(propertyPrefix);
+ test(b1.ice_getContext().get("c2").equals("TEST"));
+
+ prop.setProperty(propertyPrefix + ".Context.c1", "");
+ prop.setProperty(propertyPrefix + ".Context.c2", "");
+
+ out.println("ok");
+
+ out.print("testing proxyToProperty... ");
+ out.flush();
+
+ b1 = communicator.stringToProxy("test");
+ b1 = b1.ice_collocationOptimized(true);
+ b1 = b1.ice_connectionCached(true);
+ b1 = b1.ice_preferSecure(false);
+ b1 = b1.ice_endpointSelection(Ice.EndpointSelectionType.Ordered);
+ b1 = b1.ice_locatorCacheTimeout(100);
+ b1 = b1.ice_invocationTimeout(1234);
+ b1 = b1.ice_encodingVersion(new Ice.EncodingVersion((byte)1, (byte)0));
+
+ Ice.ObjectPrx router = communicator.stringToProxy("router");
+ router = router.ice_collocationOptimized(false);
+ router = router.ice_connectionCached(true);
+ router = router.ice_preferSecure(true);
+ router = router.ice_endpointSelection(Ice.EndpointSelectionType.Random);
+ router = router.ice_locatorCacheTimeout(200);
+ router = router.ice_invocationTimeout(1500);
+
+ Ice.ObjectPrx locator = communicator.stringToProxy("locator");
+ locator = locator.ice_collocationOptimized(true);
+ locator = locator.ice_connectionCached(false);
+ locator = locator.ice_preferSecure(true);
+ locator = locator.ice_endpointSelection(Ice.EndpointSelectionType.Random);
+ locator = locator.ice_locatorCacheTimeout(300);
+ locator = locator.ice_invocationTimeout(1500);
+
+ locator = locator.ice_router(Ice.RouterPrxHelper.uncheckedCast(router));
+ b1 = b1.ice_locator(Ice.LocatorPrxHelper.uncheckedCast(locator));
+
+ java.util.Map<String, String> proxyProps = communicator.proxyToProperty(b1, "Test");
+ test(proxyProps.size() == 21);
+
+ test(proxyProps.get("Test").equals("test -t -e 1.0"));
+ test(proxyProps.get("Test.CollocationOptimized").equals("1"));
+ test(proxyProps.get("Test.ConnectionCached").equals("1"));
+ test(proxyProps.get("Test.PreferSecure").equals("0"));
+ test(proxyProps.get("Test.EndpointSelection").equals("Ordered"));
+ test(proxyProps.get("Test.LocatorCacheTimeout").equals("100"));
+ test(proxyProps.get("Test.InvocationTimeout").equals("1234"));
+
+ test(proxyProps.get("Test.Locator").equals(
+ "locator -t -e " + Ice.Util.encodingVersionToString(Ice.Util.currentEncoding())));
+ // Locator collocation optimization is always disabled.
+ //test(proxyProps.get("Test.Locator.CollocationOptimized").equals("1"));
+ test(proxyProps.get("Test.Locator.ConnectionCached").equals("0"));
+ test(proxyProps.get("Test.Locator.PreferSecure").equals("1"));
+ test(proxyProps.get("Test.Locator.EndpointSelection").equals("Random"));
+ test(proxyProps.get("Test.Locator.LocatorCacheTimeout").equals("300"));
+ test(proxyProps.get("Test.Locator.InvocationTimeout").equals("1500"));
+
+ test(proxyProps.get("Test.Locator.Router").equals(
+ "router -t -e " + Ice.Util.encodingVersionToString(Ice.Util.currentEncoding())));
+ test(proxyProps.get("Test.Locator.Router.CollocationOptimized").equals("0"));
+ test(proxyProps.get("Test.Locator.Router.ConnectionCached").equals("1"));
+ test(proxyProps.get("Test.Locator.Router.PreferSecure").equals("1"));
+ test(proxyProps.get("Test.Locator.Router.EndpointSelection").equals("Random"));
+ test(proxyProps.get("Test.Locator.Router.LocatorCacheTimeout").equals("200"));
+ test(proxyProps.get("Test.Locator.Router.InvocationTimeout").equals("1500"));
+
+ out.println("ok");
+
+ out.print("testing ice_getCommunicator... ");
+ out.flush();
+ test(base.ice_getCommunicator() == communicator);
+ out.println("ok");
+
+ out.print("testing proxy methods... ");
+ out.flush();
+ test(Ice.Util.identityToString(
+ base.ice_identity(Ice.Util.stringToIdentity("other")).ice_getIdentity()).equals("other"));
+ test(base.ice_facet("facet").ice_getFacet().equals("facet"));
+ test(base.ice_adapterId("id").ice_getAdapterId().equals("id"));
+ test(base.ice_twoway().ice_isTwoway());
+ test(base.ice_oneway().ice_isOneway());
+ test(base.ice_batchOneway().ice_isBatchOneway());
+ test(base.ice_datagram().ice_isDatagram());
+ test(base.ice_batchDatagram().ice_isBatchDatagram());
+ test(base.ice_secure(true).ice_isSecure());
+ test(!base.ice_secure(false).ice_isSecure());
+ test(base.ice_collocationOptimized(true).ice_isCollocationOptimized());
+ test(!base.ice_collocationOptimized(false).ice_isCollocationOptimized());
+ test(base.ice_preferSecure(true).ice_isPreferSecure());
+ test(!base.ice_preferSecure(false).ice_isPreferSecure());
+ test(base.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0));
+ test(base.ice_encodingVersion(Ice.Util.Encoding_1_1).ice_getEncodingVersion().equals(Ice.Util.Encoding_1_1));
+ test(!base.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_getEncodingVersion().equals(Ice.Util.Encoding_1_1));
+
+ try
+ {
+ base.ice_timeout(0);
+ test(false);
+ }
+ catch(IllegalArgumentException e)
+ {
+ }
+
+ try
+ {
+ base.ice_timeout(-1);
+ }
+ catch(IllegalArgumentException e)
+ {
+ test(false);
+ }
+
+ try
+ {
+ base.ice_timeout(-2);
+ test(false);
+ }
+ catch(IllegalArgumentException e)
+ {
+ }
+
+ try
+ {
+ base.ice_invocationTimeout(0);
+ test(false);
+ }
+ catch(IllegalArgumentException e)
+ {
+ }
+
+ try
+ {
+ base.ice_invocationTimeout(-1);
+ base.ice_invocationTimeout(-2);
+ }
+ catch(IllegalArgumentException e)
+ {
+ test(false);
+ }
+
+ try
+ {
+ base.ice_invocationTimeout(-3);
+ test(false);
+ }
+ catch(IllegalArgumentException e)
+ {
+ }
+
+ try
+ {
+ base.ice_locatorCacheTimeout(0);
+ }
+ catch(IllegalArgumentException e)
+ {
+ test(false);
+ }
+
+ try
+ {
+ base.ice_locatorCacheTimeout(-1);
+ }
+ catch(IllegalArgumentException e)
+ {
+ test(false);
+ }
+
+ try
+ {
+ base.ice_locatorCacheTimeout(-2);
+ test(false);
+ }
+ catch(IllegalArgumentException e)
+ {
+ }
+
+ out.println("ok");
+
+ out.print("testing proxy comparison... ");
+ out.flush();
+
+ test(communicator.stringToProxy("foo").equals(communicator.stringToProxy("foo")));
+ test(!communicator.stringToProxy("foo").equals(communicator.stringToProxy("foo2")));
+
+ Ice.ObjectPrx compObj = communicator.stringToProxy("foo");
+
+ test(compObj.ice_facet("facet").equals(compObj.ice_facet("facet")));
+ test(!compObj.ice_facet("facet").equals(compObj.ice_facet("facet1")));
+
+ test(compObj.ice_oneway().equals(compObj.ice_oneway()));
+ test(!compObj.ice_oneway().equals(compObj.ice_twoway()));
+
+ test(compObj.ice_secure(true).equals(compObj.ice_secure(true)));
+ test(!compObj.ice_secure(false).equals(compObj.ice_secure(true)));
+
+ test(compObj.ice_collocationOptimized(true).equals(compObj.ice_collocationOptimized(true)));
+ test(!compObj.ice_collocationOptimized(false).equals(compObj.ice_collocationOptimized(true)));
+
+ test(compObj.ice_connectionCached(true).equals(compObj.ice_connectionCached(true)));
+ test(!compObj.ice_connectionCached(false).equals(compObj.ice_connectionCached(true)));
+
+ test(compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random).equals(
+ compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random)));
+ test(!compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random).equals(
+ compObj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered)));
+
+ test(compObj.ice_connectionId("id2").equals(compObj.ice_connectionId("id2")));
+ test(!compObj.ice_connectionId("id1").equals(compObj.ice_connectionId("id2")));
+
+ test(compObj.ice_connectionId("id1").ice_getConnectionId().equals("id1"));
+ test(compObj.ice_connectionId("id2").ice_getConnectionId().equals("id2"));
+
+ test(compObj.ice_compress(true).equals(compObj.ice_compress(true)));
+ test(!compObj.ice_compress(false).equals(compObj.ice_compress(true)));
+
+ test(compObj.ice_timeout(20).equals(compObj.ice_timeout(20)));
+ test(!compObj.ice_timeout(10).equals(compObj.ice_timeout(20)));
+
+ Ice.LocatorPrx loc1 = Ice.LocatorPrxHelper.uncheckedCast(communicator.stringToProxy("loc1:default -p 10000"));
+ Ice.LocatorPrx loc2 = Ice.LocatorPrxHelper.uncheckedCast(communicator.stringToProxy("loc2:default -p 10000"));
+ test(compObj.ice_locator(null).equals(compObj.ice_locator(null)));
+ test(compObj.ice_locator(loc1).equals(compObj.ice_locator(loc1)));
+ test(!compObj.ice_locator(loc1).equals(compObj.ice_locator(null)));
+ test(!compObj.ice_locator(null).equals(compObj.ice_locator(loc2)));
+ test(!compObj.ice_locator(loc1).equals(compObj.ice_locator(loc2)));
+
+ Ice.RouterPrx rtr1 = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("rtr1:default -p 10000"));
+ Ice.RouterPrx rtr2 = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("rtr2:default -p 10000"));
+ test(compObj.ice_router(null).equals(compObj.ice_router(null)));
+ test(compObj.ice_router(rtr1).equals(compObj.ice_router(rtr1)));
+ test(!compObj.ice_router(rtr1).equals(compObj.ice_router(null)));
+ test(!compObj.ice_router(null).equals(compObj.ice_router(rtr2)));
+ test(!compObj.ice_router(rtr1).equals(compObj.ice_router(rtr2)));
+
+ java.util.Map<String, String> ctx1 = new java.util.HashMap<String, String>();
+ ctx1.put("ctx1", "v1");
+ java.util.Map<String, String> ctx2 = new java.util.HashMap<String, String>();
+ ctx2.put("ctx2", "v2");
+ test(compObj.ice_context(null).equals(compObj.ice_context(null)));
+ test(compObj.ice_context(ctx1).equals(compObj.ice_context(ctx1)));
+ test(!compObj.ice_context(ctx1).equals(compObj.ice_context(null)));
+ test(!compObj.ice_context(null).equals(compObj.ice_context(ctx2)));
+ test(!compObj.ice_context(ctx1).equals(compObj.ice_context(ctx2)));
+
+ test(compObj.ice_preferSecure(true).equals(compObj.ice_preferSecure(true)));
+ test(!compObj.ice_preferSecure(true).equals(compObj.ice_preferSecure(false)));
+
+ Ice.ObjectPrx compObj1 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10000");
+ Ice.ObjectPrx compObj2 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10001");
+ test(!compObj1.equals(compObj2));
+
+ compObj1 = communicator.stringToProxy("foo@MyAdapter1");
+ compObj2 = communicator.stringToProxy("foo@MyAdapter2");
+ test(!compObj1.equals(compObj2));
+
+ test(compObj1.ice_locatorCacheTimeout(20).equals(compObj1.ice_locatorCacheTimeout(20)));
+ test(!compObj1.ice_locatorCacheTimeout(10).equals(compObj1.ice_locatorCacheTimeout(20)));
+
+ test(compObj1.ice_invocationTimeout(20).equals(compObj1.ice_invocationTimeout(20)));
+ test(!compObj1.ice_invocationTimeout(10).equals(compObj1.ice_invocationTimeout(20)));
+
+ compObj1 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 1000");
+ compObj2 = communicator.stringToProxy("foo@MyAdapter1");
+ test(!compObj1.equals(compObj2));
+
+ Ice.Endpoint[] endpts1 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10000").ice_getEndpoints();
+ Ice.Endpoint[] endpts2 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10001").ice_getEndpoints();
+ test(!endpts1[0].equals(endpts2[0]));
+ test(endpts1[0].equals(communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10000").ice_getEndpoints()[0]));
+
+ test(compObj1.ice_encodingVersion(Ice.Util.Encoding_1_0).equals(
+ compObj1.ice_encodingVersion(Ice.Util.Encoding_1_0)));
+ test(!compObj1.ice_encodingVersion(Ice.Util.Encoding_1_0).equals(
+ compObj1.ice_encodingVersion(Ice.Util.Encoding_1_1)));
+
+ //
+ // TODO: Ideally we should also test comparison of fixed proxies.
+ //
+ out.println("ok");
+
+ out.print("testing checked cast... ");
+ out.flush();
+ MyClassPrx cl = MyClassPrxHelper.checkedCast(base);
+ test(cl != null);
+ MyDerivedClassPrx derived = MyDerivedClassPrxHelper.checkedCast(cl);
+ test(derived != null);
+ test(cl.equals(base));
+ test(derived.equals(base));
+ test(cl.equals(derived));
+ out.println("ok");
+
+ out.print("testing checked cast with context... ");
+ out.flush();
+
+ java.util.Map<String, String> c = cl.getContext();
+ test(c == null || c.size() == 0);
+
+ c = new java.util.HashMap<String, String>();
+ c.put("one", "hello");
+ c.put("two", "world");
+ cl = MyClassPrxHelper.checkedCast(base, c);
+ java.util.Map<String, String> c2 = cl.getContext();
+ test(c.equals(c2));
+ out.println("ok");
+
+ out.print("testing encoding versioning... ");
+ out.flush();
+ String ref20 = "test -e 2.0:default -p 12010";
+ MyClassPrx cl20 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref20));
+ try
+ {
+ cl20.ice_ping();
+ test(false);
+ }
+ catch(Ice.UnsupportedEncodingException ex)
+ {
+ // Server 2.0 endpoint doesn't support 1.1 version.
+ }
+
+ String ref10 = "test -e 1.0:default -p 12010";
+ MyClassPrx cl10 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref10));
+ cl10.ice_ping();
+ cl10.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping();
+ cl.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping();
+
+ // 1.3 isn't supported but since a 1.3 proxy supports 1.1, the
+ // call will use the 1.1 encoding
+ String ref13 = "test -e 1.3:default -p 12010";
+ MyClassPrx cl13 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref13));
+ cl13.ice_ping();
+ cl13.end_ice_ping(cl13.begin_ice_ping());
+
+ try
+ {
+ // Send request with bogus 1.2 encoding.
+ Ice.EncodingVersion version = new Ice.EncodingVersion((byte)1, (byte)2);
+ Ice.OutputStream os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.endEncapsulation();
+ byte[] inEncaps = os.finished();
+ inEncaps[4] = version.major;
+ inEncaps[5] = version.minor;
+ Ice.ByteSeqHolder outEncaps = new Ice.ByteSeqHolder();
+ cl.ice_invoke("ice_ping", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ test(false);
+ }
+ catch(Ice.UnknownLocalException ex)
+ {
+ // The server thrown an UnsupportedEncodingException
+ test(ex.unknown.indexOf("UnsupportedEncodingException") > 0);
+ }
+
+ try
+ {
+ // Send request with bogus 2.0 encoding.
+ Ice.EncodingVersion version = new Ice.EncodingVersion((byte)2, (byte)0);
+ Ice.OutputStream os = new Ice.OutputStream(communicator);
+ os.startEncapsulation();
+ os.endEncapsulation();
+ byte[] inEncaps = os.finished();
+ inEncaps[4] = version.major;
+ inEncaps[5] = version.minor;
+ Ice.ByteSeqHolder outEncaps = new Ice.ByteSeqHolder();
+ cl.ice_invoke("ice_ping", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ test(false);
+ }
+ catch(Ice.UnknownLocalException ex)
+ {
+ // The server thrown an UnsupportedEncodingException
+ test(ex.unknown.indexOf("UnsupportedEncodingException") > 0);
+ }
+
+ out.println("ok");
+
+ out.print("testing protocol versioning... ");
+ out.flush();
+ ref20 = "test -p 2.0:default -p 12010";
+ cl20 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref20));
+ try
+ {
+ cl20.ice_ping();
+ test(false);
+ }
+ catch(Ice.UnsupportedProtocolException ex)
+ {
+ // Server 2.0 proxy doesn't support 1.0 version.
+ }
+
+ ref10 = "test -p 1.0:default -p 12010";
+ cl10 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref10));
+ cl10.ice_ping();
+
+ // 1.3 isn't supported but since a 1.3 proxy supports 1.1, the
+ // call will use the 1.1 protocol
+ ref13 = "test -p 1.3:default -p 12010";
+ cl13 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref13));
+ cl13.ice_ping();
+ cl13.end_ice_ping(cl13.begin_ice_ping());
+ out.println("ok");
+
+ out.print("testing opaque endpoints... ");
+ out.flush();
+
+ try
+ {
+ // Invalid -x option
+ communicator.stringToProxy("id:opaque -t 99 -v abc -x abc");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ // Missing -t and -v
+ communicator.stringToProxy("id:opaque");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ // Repeated -t
+ communicator.stringToProxy("id:opaque -t 1 -t 1 -v abc");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ // Repeated -v
+ communicator.stringToProxy("id:opaque -t 1 -v abc -v abc");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ // Missing -t
+ communicator.stringToProxy("id:opaque -v abc");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ // Missing -v
+ communicator.stringToProxy("id:opaque -t 1");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ // Missing arg for -t
+ communicator.stringToProxy("id:opaque -t -v abc");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ // Missing arg for -v
+ communicator.stringToProxy("id:opaque -t 1 -v");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ // Not a number for -t
+ communicator.stringToProxy("id:opaque -t x -v abc");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ // < 0 for -t
+ communicator.stringToProxy("id:opaque -t -1 -v abc");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ try
+ {
+ // Invalid char for -v
+ communicator.stringToProxy("id:opaque -t 99 -v x?c");
+ test(false);
+ }
+ catch(Ice.EndpointParseException ex)
+ {
+ }
+
+ // Legal TCP endpoint expressed as opaque endpoint
+ Ice.ObjectPrx p1 = communicator.stringToProxy("test -e 1.1:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==");
+ String pstr = communicator.proxyToString(p1);
+ test(pstr.equals("test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000"));
+
+ // Opaque endpoint encoded with 1.1 encoding.
+ Ice.ObjectPrx p2 = communicator.stringToProxy("test:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==");
+ test(communicator.proxyToString(p2).equals("test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000"));
+
+ if(communicator.getProperties().getPropertyAsInt("Ice.IPv6") == 0)
+ {
+ // Working?
+ boolean ssl = communicator.getProperties().getProperty("Ice.Default.Protocol").equals("ssl");
+ boolean tcp = communicator.getProperties().getProperty("Ice.Default.Protocol").equals("tcp");
+ if(tcp)
+ {
+ p1.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping();
+ }
+
+ // Two legal TCP endpoints expressed as opaque endpoints
+ p1 = communicator.stringToProxy("test -e 1.0:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA==");
+ pstr = communicator.proxyToString(p1);
+ test(pstr.equals("test -t -e 1.0:tcp -h 127.0.0.1 -p 12010 -t 10000:tcp -h 127.0.0.2 -p 12011 -t 10000"));
+
+ //
+ // Test that an SSL endpoint and a nonsense endpoint get
+ // written back out as an opaque endpoint.
+ //
+ p1 = communicator.stringToProxy("test -e 1.0:opaque -e 1.0 -t 2 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch");
+ pstr = communicator.proxyToString(p1);
+ if(ssl)
+ {
+ test(pstr.equals("test -t -e 1.0:ssl -h 127.0.0.1 -p 10001 -t infinite:opaque -t 99 -e 1.0 -v abch"));
+ }
+ else if(tcp)
+ {
+ test(pstr.equals("test -t -e 1.0:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch"));
+ }
+
+ //
+ // Try to invoke on the SSL endpoint to verify that we get a
+ // NoEndpointException (or ConnectFailedException when
+ // running with SSL).
+ //
+ if(ssl)
+ {
+ try
+ {
+ p1.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping();
+ test(false);
+ }
+ catch(Ice.ConnectFailedException ex)
+ {
+ }
+ }
+
+ //
+ // Test that the proxy with an SSL endpoint and a nonsense
+ // endpoint (which the server doesn't understand either) can
+ // be sent over the wire and returned by the server without
+ // losing the opaque endpoints.
+ //
+ p2 = derived.echo(p1);
+ pstr = communicator.proxyToString(p2);
+ if(ssl)
+ {
+ test(pstr.equals("test -t -e 1.0:ssl -h 127.0.0.1 -p 10001 -t infinite:opaque -t 99 -e 1.0 -v abch"));
+ }
+ else if(tcp)
+ {
+ test(pstr.equals(
+ "test -t -e 1.0:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch"));
+ }
+
+ }
+ out.println("ok");
+
+ return cl;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/proxy/Client.java b/java-compat/test/src/main/java/test/Ice/proxy/Client.java
new file mode 100644
index 00000000000..a3c40117591
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/proxy/Client.java
@@ -0,0 +1,41 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.proxy;
+
+import test.Ice.proxy.Test.MyClassPrx;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ MyClassPrx myClass = AllTests.allTests(communicator, getWriter());
+ myClass.shutdown();
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/proxy/Collocated.java b/java-compat/test/src/main/java/test/Ice/proxy/Collocated.java
new file mode 100644
index 00000000000..5823e8d25c5
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/proxy/Collocated.java
@@ -0,0 +1,45 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.proxy;
+
+public class Collocated extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test"));
+ //adapter.activate(); // Don't activate OA to ensure collocation is used.
+
+ AllTests.allTests(communicator, getWriter());
+
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Collocated app = new Collocated();
+ int result = app.main(" extends", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/proxy/MyDerivedClassI.java b/java-compat/test/src/main/java/test/Ice/proxy/MyDerivedClassI.java
new file mode 100644
index 00000000000..ed8036499b0
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/proxy/MyDerivedClassI.java
@@ -0,0 +1,50 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.proxy;
+import test.Ice.proxy.Test.MyDerivedClass;
+
+public final class MyDerivedClassI extends MyDerivedClass
+{
+ public
+ MyDerivedClassI()
+ {
+ }
+
+ @Override
+ public Ice.ObjectPrx
+ echo(Ice.ObjectPrx obj, Ice.Current c)
+ {
+ return obj;
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current c)
+ {
+ c.adapter.getCommunicator().shutdown();
+ }
+
+ @Override
+ public java.util.Map<String, String>
+ getContext(Ice.Current current)
+ {
+ return _ctx;
+ }
+
+ @Override
+ public boolean
+ ice_isA(String s, Ice.Current current)
+ {
+ _ctx = current.ctx;
+ return super.ice_isA(s, current);
+ }
+
+ private java.util.Map<String, String> _ctx;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/proxy/Server.java b/java-compat/test/src/main/java/test/Ice/proxy/Server.java
new file mode 100644
index 00000000000..fd6252a37d1
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/proxy/Server.java
@@ -0,0 +1,42 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.proxy;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test"));
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/proxy/Test.ice b/java-compat/test/src/main/java/test/Ice/proxy/Test.ice
new file mode 100644
index 00000000000..b902f6868d7
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/proxy/Test.ice
@@ -0,0 +1,30 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+#include <Ice/Current.ice>
+
+[["java:package:test.Ice.proxy"]]
+module Test
+{
+
+class MyClass
+{
+ void shutdown();
+
+ Ice::Context getContext();
+};
+
+class MyDerivedClass extends MyClass
+{
+ Object* echo(Object* obj);
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/proxy/TestAMD.ice b/java-compat/test/src/main/java/test/Ice/proxy/TestAMD.ice
new file mode 100644
index 00000000000..1cda6a8c5f9
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/proxy/TestAMD.ice
@@ -0,0 +1,30 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+#include<Ice/Current.ice>
+
+[["java:package:test.Ice.proxy.AMD"]]
+module Test
+{
+
+["amd"] class MyClass
+{
+ void shutdown();
+
+ Ice::Context getContext();
+};
+
+["amd"] class MyDerivedClass extends MyClass
+{
+ Object* echo(Object* obj);
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/proxy/run.py b/java-compat/test/src/main/java/test/Ice/proxy/run.py
new file mode 100755
index 00000000000..78cfe699505
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/proxy/run.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.",
+ server="test.Ice.proxy.AMDServer")
+TestUtil.queueCollocatedTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/retry/AllTests.java b/java-compat/test/src/main/java/test/Ice/retry/AllTests.java
new file mode 100644
index 00000000000..1324853a0fb
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/retry/AllTests.java
@@ -0,0 +1,297 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.retry;
+
+import java.io.PrintWriter;
+
+import test.Ice.retry.Test.Callback_Retry_op;
+import test.Ice.retry.Test.RetryPrx;
+import test.Ice.retry.Test.RetryPrxHelper;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private static class Callback
+ {
+ Callback()
+ {
+ _called = false;
+ }
+
+ public synchronized void
+ check()
+ {
+ while(!_called)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ _called = false;
+ }
+
+ public synchronized void
+ called()
+ {
+ assert(!_called);
+ _called = true;
+ notify();
+ }
+
+ private boolean _called;
+ }
+
+ private static class AMIRegular extends Callback_Retry_op
+ {
+ @Override
+ public void
+ response()
+ {
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class AMIException extends Callback_Retry_op
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(ex instanceof Ice.ConnectionLostException || ex instanceof Ice.UnknownLocalException);
+ callback.called();
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ public static RetryPrx
+ allTests(Ice.Communicator communicator, Ice.Communicator communicator2, PrintWriter out,
+ Instrumentation instrumentation, String ref)
+ {
+ out.print("testing stringToProxy... ");
+ out.flush();
+ Ice.ObjectPrx base1 = communicator.stringToProxy(ref);
+ test(base1 != null);
+ Ice.ObjectPrx base2 = communicator.stringToProxy(ref);
+ test(base2 != null);
+ out.println("ok");
+
+ out.print("testing checked cast... ");
+ out.flush();
+ RetryPrx retry1 = RetryPrxHelper.checkedCast(base1);
+ test(retry1 != null);
+ test(retry1.equals(base1));
+ RetryPrx retry2 = RetryPrxHelper.checkedCast(base2);
+ test(retry2 != null);
+ test(retry2.equals(base2));
+ out.println("ok");
+
+ out.print("calling regular operation with first proxy... ");
+ out.flush();
+ retry1.op(false);
+ out.println("ok");
+
+ instrumentation.testInvocationCount(3);
+
+ out.print("calling operation to kill connection with second proxy... ");
+ out.flush();
+ try
+ {
+ retry2.op(true);
+ test(false);
+ }
+ catch(Ice.UnknownLocalException ex)
+ {
+ // Expected with collocation
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ }
+ instrumentation.testInvocationCount(1);
+ instrumentation.testFailureCount(1);
+ instrumentation.testRetryCount(0);
+ out.println("ok");
+
+ out.print("calling regular operation with first proxy again... ");
+ out.flush();
+ retry1.op(false);
+ instrumentation.testInvocationCount(1);
+ instrumentation.testFailureCount(0);
+ instrumentation.testRetryCount(0);
+ out.println("ok");
+
+ AMIRegular cb1 = new AMIRegular();
+ AMIException cb2 = new AMIException();
+
+ out.print("calling regular AMI operation with first proxy... ");
+ retry1.begin_op(false, cb1);
+ cb1.check();
+ instrumentation.testInvocationCount(1);
+ instrumentation.testFailureCount(0);
+ instrumentation.testRetryCount(0);
+ out.println("ok");
+
+ out.print("calling AMI operation to kill connection with second proxy... ");
+ retry2.begin_op(true, cb2);
+ cb2.check();
+ instrumentation.testInvocationCount(1);
+ instrumentation.testFailureCount(1);
+ instrumentation.testRetryCount(0);
+ out.println("ok");
+
+ out.print("calling regular AMI operation with first proxy again... ");
+ retry1.begin_op(false, cb1);
+ cb1.check();
+ instrumentation.testInvocationCount(1);
+ instrumentation.testFailureCount(0);
+ instrumentation.testRetryCount(0);
+ out.println("ok");
+
+ out.print("testing idempotent operation... ");
+ test(retry1.opIdempotent(4) == 4);
+ instrumentation.testInvocationCount(1);
+ instrumentation.testFailureCount(0);
+ instrumentation.testRetryCount(4);
+ test(retry1.end_opIdempotent(retry1.begin_opIdempotent(4)) == 4);
+ instrumentation.testInvocationCount(1);
+ instrumentation.testFailureCount(0);
+ instrumentation.testRetryCount(4);
+ out.println("ok");
+
+ out.print("testing non-idempotent operation... ");
+ try
+ {
+ retry1.opNotIdempotent();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ instrumentation.testInvocationCount(1);
+ instrumentation.testFailureCount(1);
+ instrumentation.testRetryCount(0);
+ try
+ {
+ retry1.end_opNotIdempotent(retry1.begin_opNotIdempotent());
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ instrumentation.testInvocationCount(1);
+ instrumentation.testFailureCount(1);
+ instrumentation.testRetryCount(0);
+ out.println("ok");
+
+ if(retry1.ice_getConnection() == null)
+ {
+ instrumentation.testInvocationCount(1);
+
+ out.print("testing system exception... ");
+ try
+ {
+ retry1.opSystemException();
+ test(false);
+ }
+ catch(SystemFailure ex)
+ {
+ }
+ instrumentation.testInvocationCount(1);
+ instrumentation.testFailureCount(1);
+ instrumentation.testRetryCount(0);
+ try
+ {
+ retry1.end_opSystemException(retry1.begin_opSystemException());
+ test(false);
+ }
+ catch(SystemFailure ex)
+ {
+ }
+ instrumentation.testInvocationCount(1);
+ instrumentation.testFailureCount(1);
+ instrumentation.testRetryCount(0);
+ out.println("ok");
+ }
+
+ out.print("testing invocation timeout and retries... ");
+ out.flush();
+
+ retry2 = RetryPrxHelper.checkedCast(communicator2.stringToProxy(retry1.toString()));
+ try
+ {
+ // No more than 2 retries before timeout kicks-in
+ ((RetryPrx)retry2.ice_invocationTimeout(500)).opIdempotent(4);
+ test(false);
+ }
+ catch(Ice.InvocationTimeoutException ex)
+ {
+ instrumentation.testRetryCount(2);
+ retry2.opIdempotent(-1); // Reset the counter
+ instrumentation.testRetryCount(-1);
+ }
+ try
+ {
+ // No more than 2 retries before timeout kicks-in
+ RetryPrx prx = (RetryPrx)retry2.ice_invocationTimeout(500);
+ prx.end_opIdempotent(prx.begin_opIdempotent(4));
+ test(false);
+ }
+ catch(Ice.InvocationTimeoutException ex)
+ {
+ instrumentation.testRetryCount(2);
+ retry2.opIdempotent(-1); // Reset the counter
+ instrumentation.testRetryCount(-1);
+ }
+ out.println("ok");
+
+ return retry1;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/retry/Client.java b/java-compat/test/src/main/java/test/Ice/retry/Client.java
new file mode 100644
index 00000000000..37048d507c3
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/retry/Client.java
@@ -0,0 +1,73 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.retry;
+
+import test.Ice.retry.Test.RetryPrx;
+
+public class Client extends test.Util.Application
+{
+ private Instrumentation instrumentation = new Instrumentation();
+
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+
+ //
+ // Configure a second communicator for the invocation timeout
+ // + retry test, we need to configure a large retry interval
+ // to avoid time-sensitive failures.
+ //
+ Ice.InitializationData initData2 = createInitializationData();
+ initData2.properties = communicator.getProperties()._clone();
+ initData2.properties.setProperty("Ice.RetryIntervals", "0 1 10000");
+ initData2.observer = instrumentation.getObserver();
+ Ice.Communicator communicator2 = initialize(initData2);
+
+ try
+ {
+ RetryPrx retry = AllTests.allTests(communicator, communicator2, getWriter(), instrumentation,
+ "retry:default -p 12010");
+ retry.shutdown();
+ return 0;
+ }
+ finally
+ {
+ communicator2.destroy();
+ }
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.observer = instrumentation.getObserver();
+
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry");
+
+ initData.properties.setProperty("Ice.RetryIntervals", "0 1 400 1");
+
+ //
+ // We don't want connection warnings because of the timeout
+ //
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/retry/Collocated.java b/java-compat/test/src/main/java/test/Ice/retry/Collocated.java
new file mode 100644
index 00000000000..1faf02f0889
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/retry/Collocated.java
@@ -0,0 +1,85 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.retry;
+
+import test.Ice.retry.Test.RetryPrx;
+
+public class Collocated extends test.Util.Application
+{
+ private Instrumentation instrumentation = new Instrumentation();
+
+ private void
+ setupObjectAdapter(Ice.Communicator communicator)
+ {
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("");
+ adapter.add(new RetryI(), Ice.Util.stringToIdentity("retry"));
+ //adapter.activate(); // Don't activate OA to ensure collocation is used.
+ }
+
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+
+ //
+ // Configure a second communicator for the invocation timeout
+ // + retry test, we need to configure a large retry interval
+ // to avoid time-sensitive failures.
+ //
+ Ice.InitializationData initData2 = createInitializationData();
+ initData2.properties = communicator.getProperties()._clone();
+ initData2.properties.setProperty("Ice.RetryIntervals", "0 1 10000");
+ initData2.observer = instrumentation.getObserver();
+ Ice.Communicator communicator2 = initialize(initData2);
+
+ setupObjectAdapter(communicator);
+ setupObjectAdapter(communicator2);
+
+ try
+ {
+ RetryPrx retry = AllTests.allTests(communicator, communicator2, getWriter(), instrumentation, "retry");
+ retry.shutdown();
+ return 0;
+ }
+ finally
+ {
+ communicator2.destroy();
+ }
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.observer = instrumentation.getObserver();
+
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry");
+
+ initData.properties.setProperty("Ice.RetryIntervals", "0 1 10 1");
+
+ //
+ // We don't want connection warnings because of the timeout
+ //
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Collocated app = new Collocated();
+ int result = app.main("Collocated", args);
+ System.gc();
+ System.exit(result);
+ }
+}
+
diff --git a/java-compat/test/src/main/java/test/Ice/retry/Instrumentation.java b/java-compat/test/src/main/java/test/Ice/retry/Instrumentation.java
new file mode 100644
index 00000000000..8b5ecf06a79
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/retry/Instrumentation.java
@@ -0,0 +1,205 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.retry;
+
+public class Instrumentation
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ class InvocationObserverI implements Ice.Instrumentation.InvocationObserver
+ {
+ @Override
+ public void
+ attach()
+ {
+ }
+
+ @Override
+ public void
+ detach()
+ {
+ synchronized(Instrumentation.class)
+ {
+ ++nInvocation.value;
+ }
+ }
+
+ @Override
+ public void
+ failed(String msg)
+ {
+ synchronized(Instrumentation.class)
+ {
+ ++nFailure.value;
+ }
+ }
+
+ @Override
+ public void
+ retried()
+ {
+ synchronized(Instrumentation.class)
+ {
+ ++nRetry.value;
+ }
+ }
+
+ @Override
+ public void
+ userException()
+ {
+ }
+
+ @Override
+ public Ice.Instrumentation.RemoteObserver
+ getRemoteObserver(Ice.ConnectionInfo ci, Ice.Endpoint ei, int i, int j)
+ {
+ return null;
+ }
+
+ @Override
+ public Ice.Instrumentation.CollocatedObserver
+ getCollocatedObserver(Ice.ObjectAdapter adapter, int i , int j)
+ {
+ return null;
+ }
+
+ };
+ private Ice.Instrumentation.InvocationObserver invocationObserver = new InvocationObserverI();
+
+ class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorObserver
+ {
+ @Override
+ public Ice.Instrumentation.Observer
+ getConnectionEstablishmentObserver(Ice.Endpoint e, String s)
+ {
+ return null;
+ }
+
+ @Override
+ public Ice.Instrumentation.Observer
+ getEndpointLookupObserver(Ice.Endpoint e)
+ {
+ return null;
+ }
+
+ @Override
+ public Ice.Instrumentation.ConnectionObserver
+ getConnectionObserver(Ice.ConnectionInfo ci,
+ Ice.Endpoint ei,
+ Ice.Instrumentation.ConnectionState s,
+ Ice.Instrumentation.ConnectionObserver o)
+ {
+ return null;
+ }
+
+ @Override
+ public Ice.Instrumentation.ThreadObserver
+ getThreadObserver(String p,
+ String n,
+ Ice.Instrumentation.ThreadState s,
+ Ice.Instrumentation.ThreadObserver o)
+ {
+ return null;
+ }
+
+ @Override
+ public Ice.Instrumentation.InvocationObserver
+ getInvocationObserver(Ice.ObjectPrx p, String o, java.util.Map<String, String> c)
+ {
+ return invocationObserver;
+ }
+
+ @Override
+ public Ice.Instrumentation.DispatchObserver
+ getDispatchObserver(Ice.Current c, int i)
+ {
+ return null;
+ }
+
+ @Override
+ public void
+ setObserverUpdater(Ice.Instrumentation.ObserverUpdater u)
+ {
+ }
+ };
+
+ private Ice.Instrumentation.CommunicatorObserver communicatorObserver = new CommunicatorObserverI();
+
+ public Ice.Instrumentation.CommunicatorObserver
+ getObserver()
+ {
+ return communicatorObserver;
+ }
+
+ static private void
+ testEqual(Ice.IntHolder value, int expected)
+ {
+ if(expected < 0)
+ {
+ value.value = 0;
+ return;
+ }
+
+ int retry = 0;
+ while(++retry < 100)
+ {
+ synchronized(Instrumentation.class)
+ {
+ if(value.value == expected)
+ {
+ break;
+ }
+ }
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+ if(value.value != expected)
+ {
+ System.err.println("value = " + value.value + ", expected = " + expected);
+ test(false);
+ }
+ value.value = 0;
+ }
+
+ public void
+ testRetryCount(int expected)
+ {
+ testEqual(nRetry, expected);
+ }
+
+ public void
+ testFailureCount(int expected)
+ {
+ testEqual(nFailure, expected);
+ }
+
+ public void
+ testInvocationCount(int expected)
+ {
+ testEqual(nInvocation, expected);
+ }
+
+ private Ice.IntHolder nRetry = new Ice.IntHolder(0);
+ private Ice.IntHolder nFailure = new Ice.IntHolder(0);
+ private Ice.IntHolder nInvocation = new Ice.IntHolder(0);
+};
diff --git a/java-compat/test/src/main/java/test/Ice/retry/RetryI.java b/java-compat/test/src/main/java/test/Ice/retry/RetryI.java
new file mode 100644
index 00000000000..453b1ddd2c7
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/retry/RetryI.java
@@ -0,0 +1,80 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.retry;
+import test.Ice.retry.Test._RetryDisp;
+
+public final class RetryI extends _RetryDisp
+{
+ public
+ RetryI()
+ {
+ }
+
+ @Override
+ public void
+ op(boolean kill, Ice.Current current)
+ {
+ if(kill)
+ {
+ if(current.con != null)
+ {
+ current.con.close(true);
+ }
+ else
+ {
+ throw new Ice.ConnectionLostException();
+ }
+ }
+ }
+
+ @Override
+ public int
+ opIdempotent(int nRetry, Ice.Current current)
+ {
+ if(nRetry < 0)
+ {
+ _counter = 0;
+ return 0;
+ }
+
+ if(nRetry > _counter)
+ {
+ ++_counter;
+ throw new Ice.ConnectionLostException();
+ }
+
+ int counter = _counter;
+ _counter = 0;
+ return counter;
+ }
+
+ @Override
+ public void
+ opNotIdempotent(Ice.Current current)
+ {
+ throw new Ice.ConnectionLostException();
+ }
+
+ @Override
+ public void
+ opSystemException(Ice.Current c)
+ {
+ throw new SystemFailure();
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+
+ private int _counter;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/retry/Server.java b/java-compat/test/src/main/java/test/Ice/retry/Server.java
new file mode 100644
index 00000000000..8d4a4f6209e
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/retry/Server.java
@@ -0,0 +1,42 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.retry;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new RetryI(), Ice.Util.stringToIdentity("retry"));
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/retry/SystemFailure.java b/java-compat/test/src/main/java/test/Ice/retry/SystemFailure.java
new file mode 100644
index 00000000000..6355a7ea240
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/retry/SystemFailure.java
@@ -0,0 +1,20 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.retry;
+
+class SystemFailure extends Ice.SystemException
+{
+ @Override
+ public String
+ ice_id()
+ {
+ return "::SystemFailure";
+ }
+};
diff --git a/java-compat/test/src/main/java/test/Ice/retry/Test.ice b/java-compat/test/src/main/java/test/Ice/retry/Test.ice
new file mode 100644
index 00000000000..398ceec4d10
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/retry/Test.ice
@@ -0,0 +1,27 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.retry"]]
+module Test
+{
+
+interface Retry
+{
+ void op(bool kill);
+
+ idempotent int opIdempotent(int c);
+ void opNotIdempotent();
+ void opSystemException();
+
+ idempotent void shutdown();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/retry/run.py b/java-compat/test/src/main/java/test/Ice/retry/run.py
new file mode 100755
index 00000000000..97eec95871b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/retry/run.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.queueCollocatedTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/AMDMyClassI.java b/java-compat/test/src/main/java/test/Ice/seqMapping/AMDMyClassI.java
new file mode 100644
index 00000000000..7f5ea811728
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/seqMapping/AMDMyClassI.java
@@ -0,0 +1,44 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.seqMapping;
+
+import test.Ice.seqMapping.AMD.Test.*;
+import test.Ice.seqMapping.Serialize.*;
+
+public final class AMDMyClassI extends MyClass
+{
+ @Override
+ public void
+ shutdown_async(AMD_MyClass_shutdown cb, Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ opSerialSmallJava_async(AMD_MyClass_opSerialSmallJava cb, Small i, Ice.Current current)
+ {
+ cb.ice_response(i, i);
+ }
+
+ @Override
+ public void
+ opSerialLargeJava_async(AMD_MyClass_opSerialLargeJava cb, Large i, Ice.Current current)
+ {
+ cb.ice_response(i, i);
+ }
+
+ @Override
+ public void opSerialStructJava_async(AMD_MyClass_opSerialStructJava cb, Struct i, Ice.Current current)
+ {
+ cb.ice_response(i, i);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/AMDServer.java b/java-compat/test/src/main/java/test/Ice/seqMapping/AMDServer.java
new file mode 100644
index 00000000000..e19857ff333
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/seqMapping/AMDServer.java
@@ -0,0 +1,43 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.seqMapping;
+
+public class AMDServer extends test.Util.Application
+{
+ @Override
+ public int
+ run(String[] args)
+ {
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.add(new AMDMyClassI(), Ice.Util.stringToIdentity("test"));
+ adapter.activate();
+
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping.AMD");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ AMDServer c = new AMDServer();
+ int status = c.main("AMDServer", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/AllTests.java b/java-compat/test/src/main/java/test/Ice/seqMapping/AllTests.java
new file mode 100644
index 00000000000..dd47cd787d0
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/seqMapping/AllTests.java
@@ -0,0 +1,40 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.seqMapping;
+
+import java.io.PrintWriter;
+
+import test.Ice.seqMapping.Test.*;
+
+public class AllTests
+{
+ public static MyClassPrx
+ allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out)
+ {
+ String ref = "test:default -p 12010";
+ Ice.ObjectPrx baseProxy = communicator.stringToProxy(ref);
+ MyClassPrx cl = MyClassPrxHelper.checkedCast(baseProxy);
+
+ out.print("testing twoway operations... ");
+ out.flush();
+ Twoways.twoways(cl);
+ out.println("ok");
+
+ if(!collocated)
+ {
+ out.print("testing twoway operations with AMI... ");
+ out.flush();
+ TwowaysAMI.twowaysAMI(cl);
+ out.println("ok");
+ }
+
+ return cl;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/Client.java b/java-compat/test/src/main/java/test/Ice/seqMapping/Client.java
new file mode 100644
index 00000000000..293f3ea0b9d
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/seqMapping/Client.java
@@ -0,0 +1,49 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.seqMapping;
+
+import test.Ice.seqMapping.Test.*;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int
+ run(String[] args)
+ {
+ java.io.PrintWriter out = getWriter();
+
+ MyClassPrx myClass = AllTests.allTests(communicator(), false, out);
+
+ out.print("shutting down server... ");
+ out.flush();
+ myClass.shutdown();
+ out.println("ok");
+
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/Collocated.java b/java-compat/test/src/main/java/test/Ice/seqMapping/Collocated.java
new file mode 100644
index 00000000000..755e0248197
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/seqMapping/Collocated.java
@@ -0,0 +1,46 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.seqMapping;
+
+public class Collocated extends test.Util.Application
+{
+ @Override
+ public int
+ run(String[] args)
+ {
+ java.io.PrintWriter out = getWriter();
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.add(new MyClassI(), Ice.Util.stringToIdentity("test"));
+ //adapter.activate(); // Don't activate OA to ensure collocation is used.
+
+ AllTests.allTests(communicator(), true, out);
+
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Collocated c = new Collocated();
+ int status = c.main("Collocated", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/MyClassI.java b/java-compat/test/src/main/java/test/Ice/seqMapping/MyClassI.java
new file mode 100644
index 00000000000..ced4817bdb5
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/seqMapping/MyClassI.java
@@ -0,0 +1,44 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.seqMapping;
+
+import test.Ice.seqMapping.Test.*;
+import test.Ice.seqMapping.Serialize.*;
+
+public final class MyClassI extends MyClass
+{
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+
+ @Override
+ public Small opSerialSmallJava(Small i, Ice.Holder<Small> o, Ice.Current current)
+ {
+ o.value = i;
+ return i;
+ }
+
+ @Override
+ public Large opSerialLargeJava(Large i, Ice.Holder<Large> o, Ice.Current current)
+ {
+ o.value = i;
+ return i;
+ }
+
+ @Override
+ public Struct opSerialStructJava(Struct i, Ice.Holder<Struct> o, Ice.Current current)
+ {
+ o.value = i;
+ return i;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/Serialize/Large.java b/java-compat/test/src/main/java/test/Ice/seqMapping/Serialize/Large.java
new file mode 100644
index 00000000000..140460024f4
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/seqMapping/Serialize/Large.java
@@ -0,0 +1,24 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.seqMapping.Serialize;
+
+public class Large implements java.io.Serializable // More than 254 bytes when serialized.
+{
+ public double d1;
+ public double d2;
+ public double d3;
+ public double d4;
+ public double d5;
+ public double d6;
+ public double d7;
+ public double d8;
+ public double d9;
+ public double d10;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/Serialize/Small.java b/java-compat/test/src/main/java/test/Ice/seqMapping/Serialize/Small.java
new file mode 100644
index 00000000000..9e60ee61a5d
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/seqMapping/Serialize/Small.java
@@ -0,0 +1,15 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.seqMapping.Serialize;
+
+public class Small implements java.io.Serializable // Fewer than 254 bytes when serialized.
+{
+ public int i;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/Serialize/SmallHolder.java b/java-compat/test/src/main/java/test/Ice/seqMapping/Serialize/SmallHolder.java
new file mode 100644
index 00000000000..772efd85cf1
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/seqMapping/Serialize/SmallHolder.java
@@ -0,0 +1,15 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.seqMapping.Serialize;
+
+public class SmallHolder
+{
+ public Small value;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/Serialize/Struct.java b/java-compat/test/src/main/java/test/Ice/seqMapping/Serialize/Struct.java
new file mode 100644
index 00000000000..1c0ffde6735
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/seqMapping/Serialize/Struct.java
@@ -0,0 +1,18 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.seqMapping.Serialize;
+
+public class Struct implements java.io.Serializable // Used to test that null members marshal correctly.
+{
+ public Object o;
+ public Object o2;
+ public String s;
+ public String s2;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/Serialize/StructHolder.java b/java-compat/test/src/main/java/test/Ice/seqMapping/Serialize/StructHolder.java
new file mode 100644
index 00000000000..0c7976c081c
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/seqMapping/Serialize/StructHolder.java
@@ -0,0 +1,15 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.seqMapping.Serialize;
+
+public class StructHolder
+{
+ public Struct value;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/Server.java b/java-compat/test/src/main/java/test/Ice/seqMapping/Server.java
new file mode 100644
index 00000000000..21eff24ab1c
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/seqMapping/Server.java
@@ -0,0 +1,43 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.seqMapping;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int
+ run(String[] args)
+ {
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.add(new MyClassI(), Ice.Util.stringToIdentity("test"));
+ adapter.activate();
+
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server c = new Server();
+ int status = c.main("Server", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/Test.ice b/java-compat/test/src/main/java/test/Ice/seqMapping/Test.ice
new file mode 100644
index 00000000000..df46b2e5d47
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/seqMapping/Test.ice
@@ -0,0 +1,54 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.seqMapping"]]
+module Test
+{
+
+["java:serializable:test.Ice.seqMapping.Serialize.Small"] sequence<byte> SerialSmall;
+["java:serializable:test.Ice.seqMapping.Serialize.Large"] sequence<byte> SerialLarge;
+["java:serializable:test.Ice.seqMapping.Serialize.Struct"] sequence<byte> SerialStruct;
+
+class MyClass
+{
+ void shutdown();
+
+ SerialSmall opSerialSmallJava(SerialSmall i, out SerialSmall o);
+ SerialLarge opSerialLargeJava(SerialLarge i, out SerialLarge o);
+ SerialStruct opSerialStructJava(SerialStruct i, out SerialStruct o);
+};
+
+// Remaining type definitions are there to verify that the generated
+// code compiles correctly.
+
+sequence<SerialLarge> SLS;
+sequence<SLS> SLSS;
+dictionary<int, SerialLarge> SLD;
+dictionary<int, SLS> SLSD;
+struct Foo
+{
+ SerialLarge SLmem;
+ SLS SLSmem;
+};
+
+exception Bar
+{
+ SerialLarge SLmem;
+ SLS SLSmem;
+};
+
+class Baz
+{
+ SerialLarge SLmem;
+ SLS SLSmem;
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/TestAMD.ice b/java-compat/test/src/main/java/test/Ice/seqMapping/TestAMD.ice
new file mode 100644
index 00000000000..f01c1f80e18
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/seqMapping/TestAMD.ice
@@ -0,0 +1,54 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.seqMapping.AMD"]]
+module Test
+{
+
+["java:serializable:test.Ice.seqMapping.Serialize.Small"] sequence<byte> SerialSmall;
+["java:serializable:test.Ice.seqMapping.Serialize.Large"] sequence<byte> SerialLarge;
+["java:serializable:test.Ice.seqMapping.Serialize.Struct"] sequence<byte> SerialStruct;
+
+["amd"] class MyClass
+{
+ void shutdown();
+
+ SerialSmall opSerialSmallJava(SerialSmall i, out SerialSmall o);
+ SerialLarge opSerialLargeJava(SerialLarge i, out SerialLarge o);
+ SerialStruct opSerialStructJava(SerialStruct i, out SerialStruct o);
+};
+
+// Remaining type definitions are there to verify that the generated
+// code compiles correctly.
+
+sequence<SerialLarge> SLS;
+sequence<SLS> SLSS;
+dictionary<int, SerialLarge> SLD;
+dictionary<int, SLS> SLSD;
+struct Foo
+{
+ SerialLarge SLmem;
+ SLS SLSmem;
+};
+
+exception Bar
+{
+ SerialLarge SLmem;
+ SLS SLSmem;
+};
+
+class Baz
+{
+ SerialLarge SLmem;
+ SLS SLSmem;
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/Twoways.java b/java-compat/test/src/main/java/test/Ice/seqMapping/Twoways.java
new file mode 100644
index 00000000000..36e0480c73b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/seqMapping/Twoways.java
@@ -0,0 +1,137 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.seqMapping;
+
+import test.Ice.seqMapping.Test.*;
+import test.Ice.seqMapping.Serialize.*;
+
+class Twoways
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ static void
+ twoways(MyClassPrx p)
+ {
+ {
+ Small i = null;
+ Ice.Holder<Small> o = new Ice.Holder<Small>();
+ Small r;
+
+ r = p.opSerialSmallJava(i, o);
+
+ test(o.value == null);
+ test(r == null);
+ }
+
+ {
+ Small i = new Small();
+ i.i = 99;
+ Ice.Holder<Small> o = new Ice.Holder<Small>();
+ Small r;
+
+ try
+ {
+ r = p.opSerialSmallJava(i, o);
+
+ test(o.value.i == 99);
+ test(r.i == 99);
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ // OK, talking to non-Java server.
+ }
+ }
+
+ {
+ Large i = new Large();
+ i.d1 = 1.0;
+ i.d2 = 2.0;
+ i.d3 = 3.0;
+ i.d4 = 4.0;
+ i.d5 = 5.0;
+ i.d6 = 6.0;
+ i.d7 = 7.0;
+ i.d8 = 8.0;
+ i.d9 = 9.0;
+ i.d10 = 10.0;
+ Ice.Holder<Large> o = new Ice.Holder<Large>();
+ Large r;
+
+ try
+ {
+ r = p.opSerialLargeJava(i, o);
+
+ test(o.value.d1 == 1.0);
+ test(o.value.d2 == 2.0);
+ test(o.value.d3 == 3.0);
+ test(o.value.d4 == 4.0);
+ test(o.value.d5 == 5.0);
+ test(o.value.d6 == 6.0);
+ test(o.value.d7 == 7.0);
+ test(o.value.d8 == 8.0);
+ test(o.value.d9 == 9.0);
+ test(o.value.d10 == 10.0);
+ test(r.d1 == 1.0);
+ test(r.d2 == 2.0);
+ test(r.d3 == 3.0);
+ test(r.d4 == 4.0);
+ test(r.d5 == 5.0);
+ test(r.d6 == 6.0);
+ test(r.d7 == 7.0);
+ test(r.d8 == 8.0);
+ test(r.d9 == 9.0);
+ test(r.d10 == 10.0);
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ // OK, talking to non-Java server.
+ }
+ }
+
+ {
+ Struct i = new Struct();
+ i.o = null;
+ i.o2 = i;
+ i.s = null;
+ i.s2 = "Hello";
+ Ice.Holder<Struct> o = new Ice.Holder<Struct>();
+ Struct r;
+
+ try
+ {
+ r = p.opSerialStructJava(i, o);
+
+ test(o.value.o == null);
+ test(o.value.o2 != null);
+ test(((Struct)(o.value.o2)).o == null);
+ test(((Struct)(o.value.o2)).o2 == o.value.o2);
+ test(o.value.s == null);
+ test(o.value.s2.equals("Hello"));
+ test(r.o == null);
+ test(r.o2 != null);
+ test(((Struct)(r.o2)).o == null);
+ test(((Struct)(r.o2)).o2 == r.o2);
+ test(r.s == null);
+ test(r.s2.equals("Hello"));
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ // OK, talking to non-Java server.
+ }
+ }
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/TwowaysAMI.java b/java-compat/test/src/main/java/test/Ice/seqMapping/TwowaysAMI.java
new file mode 100644
index 00000000000..d76481ea4e6
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/seqMapping/TwowaysAMI.java
@@ -0,0 +1,248 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.seqMapping;
+
+import test.Ice.seqMapping.Test.*;
+import test.Ice.seqMapping.Serialize.*;
+
+class TwowaysAMI
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private static class Callback
+ {
+ Callback()
+ {
+ _called = false;
+ }
+
+ public synchronized boolean
+ check()
+ {
+ while(!_called)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ _called = false;
+ return true;
+ }
+
+ public synchronized void
+ called()
+ {
+ assert(!_called);
+ _called = true;
+ notify();
+ }
+
+ private boolean _called;
+ }
+
+ private static class Callback_MyClass_opSerialSmallJavaNull extends Callback_MyClass_opSerialSmallJava
+ {
+ @Override
+ public void
+ response(Small r, Small o)
+ {
+ test(o == null);
+ test(r == null);
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(ex instanceof Ice.OperationNotExistException); // OK, talking to non-Java server.
+ }
+
+ public boolean
+ check()
+ {
+ return callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_MyClass_opSerialSmallJavaI extends Callback_MyClass_opSerialSmallJava
+ {
+ @Override
+ public void
+ response(Small r, Small o)
+ {
+ test(o.i == 99);
+ test(r.i == 99);
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(ex instanceof Ice.OperationNotExistException); // OK, talking to non-Java server.
+ }
+
+ public boolean
+ check()
+ {
+ return callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_MyClass_opSerialLargeJavaI extends Callback_MyClass_opSerialLargeJava
+ {
+ @Override
+ public void
+ response(Large r, Large o)
+ {
+ test(o.d1 == 1.0);
+ test(o.d2 == 2.0);
+ test(o.d3 == 3.0);
+ test(o.d4 == 4.0);
+ test(o.d5 == 5.0);
+ test(o.d6 == 6.0);
+ test(o.d7 == 7.0);
+ test(o.d8 == 8.0);
+ test(o.d9 == 9.0);
+ test(o.d10 == 10.0);
+ test(r.d1 == 1.0);
+ test(r.d2 == 2.0);
+ test(r.d3 == 3.0);
+ test(r.d4 == 4.0);
+ test(r.d5 == 5.0);
+ test(r.d6 == 6.0);
+ test(r.d7 == 7.0);
+ test(r.d8 == 8.0);
+ test(r.d9 == 9.0);
+ test(r.d10 == 10.0);
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(ex instanceof Ice.OperationNotExistException); // OK, talking to non-Java server.
+ }
+
+ public boolean
+ check()
+ {
+ return callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_MyClass_opSerialStructJavaI extends Callback_MyClass_opSerialStructJava
+ {
+ @Override
+ public void
+ response(Struct r, Struct o)
+ {
+ test(o.o == null);
+ test(o.o2 != null);
+ test(((Struct)(o.o2)).o == null);
+ test(((Struct)(o.o2)).o2 == o.o2);
+ test(o.s == null);
+ test(o.s2.equals("Hello"));
+ test(r.o == null);
+ test(r.o2 != null);
+ test(((Struct)(r.o2)).o == null);
+ test(((Struct)(r.o2)).o2 == r.o2);
+ test(r.s == null);
+ test(r.s2.equals("Hello"));
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException ex)
+ {
+ test(ex instanceof Ice.OperationNotExistException); // OK, talking to non-Java server.
+ }
+
+ public boolean
+ check()
+ {
+ return callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ static void
+ twowaysAMI(MyClassPrx p)
+ {
+ {
+ Small i = null;
+
+ Callback_MyClass_opSerialSmallJavaNull cb = new Callback_MyClass_opSerialSmallJavaNull();
+ p.begin_opSerialSmallJava(i, cb);
+ test(cb.check());
+ }
+
+ {
+ Small i = new Small();
+ i.i = 99;
+
+ Callback_MyClass_opSerialSmallJavaI cb = new Callback_MyClass_opSerialSmallJavaI();
+ p.begin_opSerialSmallJava(i, cb);
+ test(cb.check());
+ }
+
+ {
+ Large i = new Large();
+ i.d1 = 1.0;
+ i.d2 = 2.0;
+ i.d3 = 3.0;
+ i.d4 = 4.0;
+ i.d5 = 5.0;
+ i.d6 = 6.0;
+ i.d7 = 7.0;
+ i.d8 = 8.0;
+ i.d9 = 9.0;
+ i.d10 = 10.0;
+
+ Callback_MyClass_opSerialLargeJavaI cb = new Callback_MyClass_opSerialLargeJavaI();
+ p.begin_opSerialLargeJava(i, cb);
+ test(cb.check());
+ }
+
+ {
+ Struct i = new Struct();
+ i.o = null;
+ i.o2 = i;
+ i.s = null;
+ i.s2 = "Hello";
+
+ Callback_MyClass_opSerialStructJavaI cb = new Callback_MyClass_opSerialStructJavaI();
+ p.begin_opSerialStructJava(i, cb);
+ test(cb.check());
+ }
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/run.py b/java-compat/test/src/main/java/test/Ice/seqMapping/run.py
new file mode 100755
index 00000000000..685319f3cae
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/seqMapping/run.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.",
+ server="test.Ice.seqMapping.AMDServer")
+TestUtil.queueCollocatedTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/serialize/AllTests.java b/java-compat/test/src/main/java/test/Ice/serialize/AllTests.java
new file mode 100644
index 00000000000..202de5696da
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/serialize/AllTests.java
@@ -0,0 +1,170 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.serialize;
+import test.Ice.serialize.Test.*;
+import java.io.*;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static InitialPrx
+ allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out)
+ {
+ String ref = "initial:default -p 12010";
+ Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ InitialPrx initial = InitialPrxHelper.checkedCast(base);
+
+ out.print("testing serialization... ");
+ out.flush();
+
+ //
+ // Call getStruct1 and force an error.
+ //
+ try
+ {
+ //
+ // We expect this test to raise an exception: we are attempting to deserialize
+ // an instance of Struct1 using java.io.ObjectInputStream. However, we must
+ // use Ice.ObjectInputStream instead because Struct1 contains a proxy.
+ //
+ byte[] bytes = initial.getStruct1();
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ ois.readObject();
+ test(false);
+ }
+ catch(IOException ex)
+ {
+ // Expected.
+ }
+ catch(Throwable ex)
+ {
+ test(false);
+ }
+
+ //
+ // Call getStruct1.
+ //
+ try
+ {
+ byte[] bytes = initial.getStruct1();
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+ Ice.ObjectInputStream ois = new Ice.ObjectInputStream(communicator, bais);
+ try
+ {
+ Struct1 s = (Struct1)ois.readObject();
+ checkStruct1(s);
+ }
+ finally
+ {
+ ois.close();
+ }
+ }
+ catch(Throwable ex)
+ {
+ test(false);
+ }
+
+ //
+ // Call getBase.
+ //
+ try
+ {
+ byte[] bytes = initial.getBase();
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+ Ice.ObjectInputStream ois = new Ice.ObjectInputStream(communicator, bais);
+ try
+ {
+ Base b = (Base) ois.readObject();
+ checkBase(b);
+ }
+ finally
+ {
+ ois.close();
+ }
+ }
+ catch(Throwable ex)
+ {
+ test(false);
+ }
+
+ //
+ // Call getEx.
+ //
+ try
+ {
+ byte[] bytes = initial.getEx();
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+ Ice.ObjectInputStream ois = new Ice.ObjectInputStream(communicator, bais);
+ try
+ {
+ Ex ex = (Ex)ois.readObject();
+ checkStruct1(ex.s);
+ checkBase(ex.b);
+ }
+ finally
+ {
+ ois.close();
+ }
+ }
+ catch(Throwable ex)
+ {
+ test(false);
+ }
+
+ out.println("ok");
+
+ return initial;
+ }
+
+ private static void
+ checkStruct1(Struct1 s)
+ {
+ test(s.bo);
+ test(s.by == (byte)1);
+ test(s.sh == (short)2);
+ test(s.i == 3);
+ test(s.l == 4);
+ test(s.f == (float)5.0);
+ test(s.d == 6.0);
+ test(s.str.equals("7"));
+ test(s.e == MyEnum.enum2);
+ test(s.p != null);
+ s.p.ice_ping(); // Make sure the deserialized proxy is usable.
+ }
+
+ private static void
+ checkBase(Base b)
+ {
+ test(b.b == b);
+ test(b.o == b);
+ checkStruct1(b.s);
+ test(java.util.Arrays.equals(b.seq1, new byte[] { 0, 1, 2, 3, 4 }));
+ test(java.util.Arrays.equals(b.seq2, new int[] { 5, 6, 7, 8, 9 }));
+ test(java.util.Arrays.equals(b.seq3, new MyEnum[] { MyEnum.enum3, MyEnum.enum2, MyEnum.enum1 }));
+ test(java.util.Arrays.equals(b.seq4, new Base[] { b }));
+ test(b.d1.get(new Byte((byte)1)).equals(Boolean.TRUE));
+ test(b.d2.get(new Short((short)2)).equals(new Integer(3)));
+ test(b.d3.get("enum3") == MyEnum.enum3);
+ test(b.d4.get("b") == b);
+ test(b instanceof Derived);
+ Derived d = (Derived)b;
+ test(d.p != null);
+ d.p.ice_ping();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/serialize/Client.java b/java-compat/test/src/main/java/test/Ice/serialize/Client.java
new file mode 100644
index 00000000000..ca504c66b15
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/serialize/Client.java
@@ -0,0 +1,42 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.serialize;
+import test.Ice.serialize.Test.*;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int
+ run(String[] args)
+ {
+ java.io.PrintWriter out = getWriter();
+ InitialPrx initial = AllTests.allTests(communicator(), false, out);
+ initial.shutdown();
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.serialize");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/serialize/InitialI.java b/java-compat/test/src/main/java/test/Ice/serialize/InitialI.java
new file mode 100644
index 00000000000..60d860c93aa
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/serialize/InitialI.java
@@ -0,0 +1,119 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.serialize;
+import test.Ice.serialize.Test.*;
+import java.io.*;
+
+public final class InitialI extends _InitialDisp
+{
+ InitialI(Ice.ObjectAdapter adapter, Ice.Identity ident)
+ {
+ _s = new Struct1();
+ _s.bo = true;
+ _s.by = (byte)1;
+ _s.sh = (short)2;
+ _s.i = 3;
+ _s.l = 4;
+ _s.f = (float)5.0;
+ _s.d = 6.0;
+ _s.str = "7";
+ _s.e = MyEnum.enum2;
+ _s.p = InitialPrxHelper.uncheckedCast(adapter.createProxy(ident));
+
+ _d = new Derived();
+ _d.b = _d;
+ _d.o = _d;
+ _d.s = _s;
+ _d.seq1 = new byte[] { 0, 1, 2, 3, 4 };
+ _d.seq2 = new int[] { 5, 6, 7, 8, 9 };
+ _d.seq3 = new MyEnum[] { MyEnum.enum3, MyEnum.enum2, MyEnum.enum1 };
+ _d.seq4 = new Base[] { _d };
+ _d.d1 = new java.util.HashMap<Byte, Boolean>();
+ _d.d1.put((byte)1, true);
+ _d.d2 = new java.util.HashMap<Short, Integer>();
+ _d.d2.put((short)2, 3);
+ _d.d3 = new java.util.HashMap<String, MyEnum>();
+ _d.d3.put("enum3", MyEnum.enum3);
+ _d.d4 = new java.util.HashMap<String, Base>();
+ _d.d4.put("b", _d);
+ _d.p = _s.p;
+ }
+
+ @Override
+ public byte[]
+ getStruct1(Ice.Current current)
+ {
+ try
+ {
+ ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
+ ObjectOutputStream stream = new ObjectOutputStream(byteStream);
+ stream.writeObject(_s);
+ return byteStream.toByteArray();
+ }
+ catch(IOException ex)
+ {
+ Ice.UnknownException e = new Ice.UnknownException();
+ e.initCause(ex);
+ throw e;
+ }
+ }
+
+ @Override
+ public byte[]
+ getBase(Ice.Current current)
+ {
+ try
+ {
+ ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
+ ObjectOutputStream stream = new ObjectOutputStream(byteStream);
+ stream.writeObject(_d);
+ return byteStream.toByteArray();
+ }
+ catch(IOException ex)
+ {
+ Ice.UnknownException e = new Ice.UnknownException();
+ e.initCause(ex);
+ throw e;
+ }
+ }
+
+ @Override
+ public byte[]
+ getEx(Ice.Current current)
+ {
+ try
+ {
+ Ex ex = new Ex();
+ ex.s = _s;
+ ex.b = _d;
+
+ ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
+ ObjectOutputStream stream = new ObjectOutputStream(byteStream);
+ stream.writeObject(ex);
+ return byteStream.toByteArray();
+ }
+ catch(IOException ex)
+ {
+ Ice.UnknownException e = new Ice.UnknownException();
+ e.initCause(ex);
+ throw e;
+ }
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+
+ private Struct1 _s;
+ private Derived _d;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/serialize/Server.java b/java-compat/test/src/main/java/test/Ice/serialize/Server.java
new file mode 100644
index 00000000000..a0658f19668
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/serialize/Server.java
@@ -0,0 +1,45 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.serialize;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int
+ run(String[] args)
+ {
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.Identity ident = Ice.Util.stringToIdentity("initial");
+ Ice.Object object = new InitialI(adapter, ident);
+ adapter.add(object, ident);
+ adapter.activate();
+
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.serialize");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server c = new Server();
+ int status = c.main("Server", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/serialize/Test.ice b/java-compat/test/src/main/java/test/Ice/serialize/Test.ice
new file mode 100644
index 00000000000..4fc54852ba4
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/serialize/Test.ice
@@ -0,0 +1,84 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.serialize"]]
+module Test
+{
+
+enum MyEnum
+{
+ enum1,
+ enum2,
+ enum3
+};
+
+interface Initial;
+class Base;
+
+struct Struct1
+{
+ bool bo;
+ byte by;
+ short sh;
+ int i;
+ long l;
+ float f;
+ double d;
+ string str;
+ MyEnum e;
+ Initial* p;
+};
+
+sequence<byte> ByteS;
+sequence<int> IntS;
+sequence<MyEnum> MyEnumS;
+sequence<Base> BaseS;
+
+dictionary<byte, bool> ByteBoolD;
+dictionary<short, int> ShortIntD;
+dictionary<string, MyEnum> StringMyEnumD;
+dictionary<string, Base> StringBaseD;
+
+class Base
+{
+ Base b;
+ Object o;
+ Struct1 s;
+ ByteS seq1;
+ IntS seq2;
+ MyEnumS seq3;
+ BaseS seq4;
+ ByteBoolD d1;
+ ShortIntD d2;
+ StringMyEnumD d3;
+ StringBaseD d4;
+};
+
+class Derived extends Base
+{
+ Object* p;
+};
+
+exception Ex
+{
+ Struct1 s;
+ Base b;
+};
+
+interface Initial
+{
+ ByteS getStruct1();
+ ByteS getBase();
+ ByteS getEx();
+ void shutdown();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/serialize/run.py b/java-compat/test/src/main/java/test/Ice/serialize/run.py
new file mode 100755
index 00000000000..97f9acd4094
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/serialize/run.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/AMDCookieI.java b/java-compat/test/src/main/java/test/Ice/servantLocator/AMDCookieI.java
new file mode 100644
index 00000000000..639244ab65d
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/servantLocator/AMDCookieI.java
@@ -0,0 +1,22 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.servantLocator;
+
+import test.Ice.servantLocator.AMD.Test.Cookie;
+
+public final class AMDCookieI extends Cookie
+{
+ @Override
+ public String
+ message()
+ {
+ return "blahblah";
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/AMDServantLocatorI.java b/java-compat/test/src/main/java/test/Ice/servantLocator/AMDServantLocatorI.java
new file mode 100644
index 00000000000..348e9a94c6c
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/servantLocator/AMDServantLocatorI.java
@@ -0,0 +1,184 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.servantLocator;
+
+import test.Ice.servantLocator.AMD.Test.Cookie;
+import test.Ice.servantLocator.AMD.Test.TestImpossibleException;
+import test.Ice.servantLocator.AMD.Test.TestIntfUserException;
+import Ice.ObjectNotExistException;
+import Ice.SocketException;
+import Ice.UnknownException;
+import Ice.UnknownLocalException;
+import Ice.UnknownUserException;
+
+public final class AMDServantLocatorI implements Ice.ServantLocator
+{
+ public
+ AMDServantLocatorI(String category)
+ {
+ _category = category;
+ _deactivated = false;
+ _requestId = -1;
+ }
+
+ @Override
+ protected synchronized void
+ finalize()
+ throws Throwable
+ {
+ test(_deactivated);
+ }
+
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ @Override
+ public Ice.Object
+ locate(Ice.Current current, Ice.LocalObjectHolder cookie) throws Ice.UserException
+ {
+ synchronized(this)
+ {
+ test(!_deactivated);
+ }
+
+ test(current.id.category.equals(_category) || _category.length() == 0);
+
+ if(current.id.name.equals("unknown"))
+ {
+ return null;
+ }
+
+ test(current.id.name.equals("locate") || current.id.name.equals("finished"));
+ if(current.id.name.equals("locate"))
+ {
+ exception(current);
+ }
+
+ //
+ // Ensure locate() is only called once per request.
+ //
+ test(_requestId == -1);
+ _requestId = current.requestId;
+
+ cookie.value = new AMDCookieI();
+
+ return new AMDTestI();
+ }
+
+ @Override
+ public void
+ finished(Ice.Current current, Ice.Object servant, java.lang.Object cookie) throws Ice.UserException
+ {
+ synchronized(this)
+ {
+ test(!_deactivated);
+ }
+
+ //
+ // Ensure finished() is only called once per request.
+ //
+ test(_requestId == current.requestId);
+ _requestId = -1;
+
+ test(current.id.category.equals(_category) || _category.length() == 0);
+ test(current.id.name.equals("locate") || current.id.name.equals("finished"));
+
+ if(current.id.name.equals("finished"))
+ {
+ exception(current);
+ }
+
+ Cookie co = (Cookie)cookie;
+ test(co.message().equals("blahblah"));
+ }
+
+ @Override
+ public synchronized void
+ deactivate(String category)
+ {
+ synchronized(this)
+ {
+ test(!_deactivated);
+
+ _deactivated = true;
+ }
+ }
+
+ private void
+ exception(Ice.Current current) throws Ice.UserException
+ {
+ if(current.operation.equals("ice_ids"))
+ {
+ throw new TestIntfUserException();
+ }
+ else if(current.operation.equals("requestFailedException"))
+ {
+ throw new ObjectNotExistException();
+ }
+ else if(current.operation.equals("unknownUserException"))
+ {
+ throw new UnknownUserException("reason");
+ }
+ else if(current.operation.equals("unknownLocalException"))
+ {
+ throw new UnknownLocalException("reason");
+ }
+ else if(current.operation.equals("unknownException"))
+ {
+ throw new UnknownException("reason");
+ }
+ //
+ // User exceptions are checked exceptions in Java, so it's not
+ // possible to throw it from the servant locator.
+ //
+// else if(current.operation.equals("userException"))
+// {
+// throw new TestIntfUserException();
+// }
+ else if(current.operation.equals("localException"))
+ {
+ throw new SocketException(0);
+ }
+ else if(current.operation.equals("javaException"))
+ {
+ throw new java.lang.RuntimeException("message");
+ }
+ else if(current.operation.equals("unknownExceptionWithServantException"))
+ {
+ throw new UnknownException("reason");
+ }
+ else if(current.operation.equals("impossibleException"))
+ {
+ throw new TestIntfUserException(); // Yes, it really is meant to be TestIntfUserException.
+ }
+ else if(current.operation.equals("intfUserException"))
+ {
+ throw new TestImpossibleException(); // Yes, it really is meant to be TestImpossibleException.
+ }
+ else if(current.operation.equals("asyncResponse"))
+ {
+ throw new TestImpossibleException();
+ }
+ else if(current.operation.equals("asyncException"))
+ {
+ throw new TestImpossibleException();
+ }
+ }
+
+ private boolean _deactivated;
+ private final String _category;
+ private int _requestId;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/AMDServer.java b/java-compat/test/src/main/java/test/Ice/servantLocator/AMDServer.java
new file mode 100644
index 00000000000..77f66d39142
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/servantLocator/AMDServer.java
@@ -0,0 +1,46 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.servantLocator;
+
+public class AMDServer extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.addServantLocator(new AMDServantLocatorI("category"), "category");
+ adapter.addServantLocator(new AMDServantLocatorI(""), "");
+ adapter.add(new AMDTestI(), Ice.Util.stringToIdentity("asm"));
+ adapter.add(new AMDTestActivationI(), Ice.Util.stringToIdentity("test/activation"));
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator.AMD");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ AMDServer app = new AMDServer();
+ int result = app.main("AMDServer", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/AMDTestActivationI.java b/java-compat/test/src/main/java/test/Ice/servantLocator/AMDTestActivationI.java
new file mode 100644
index 00000000000..a90d2abb347
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/servantLocator/AMDTestActivationI.java
@@ -0,0 +1,32 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.servantLocator;
+
+import test.Ice.servantLocator.Test._TestActivationDisp;
+
+public final class AMDTestActivationI extends _TestActivationDisp
+{
+ @Override
+ public void activateServantLocator(boolean activate, Ice.Current current)
+ {
+ if(activate)
+ {
+ current.adapter.addServantLocator(new AMDServantLocatorI(""), "");
+ current.adapter.addServantLocator(new AMDServantLocatorI("category"), "category");
+ }
+ else
+ {
+ Ice.ServantLocator locator = current.adapter.removeServantLocator("");
+ locator.deactivate("");
+ locator = current.adapter.removeServantLocator("category");
+ locator.deactivate("category");
+ }
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/AMDTestI.java b/java-compat/test/src/main/java/test/Ice/servantLocator/AMDTestI.java
new file mode 100644
index 00000000000..9a750ad6577
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/servantLocator/AMDTestI.java
@@ -0,0 +1,145 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.servantLocator;
+
+import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_asyncException;
+import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_asyncResponse;
+import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_impossibleException;
+import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_intfUserException;
+import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_javaException;
+import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_localException;
+import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_requestFailedException;
+import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_shutdown;
+import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_unknownException;
+import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_unknownLocalException;
+import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_unknownUserException;
+import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_unknownExceptionWithServantException;
+import test.Ice.servantLocator.AMD.Test.TestImpossibleException;
+import test.Ice.servantLocator.AMD.Test.TestIntfUserException;
+import test.Ice.servantLocator.AMD.Test._TestIntfDisp;
+
+public final class AMDTestI extends _TestIntfDisp
+{
+ @Override
+ public void
+ requestFailedException_async(AMD_TestIntf_requestFailedException cb, Ice.Current current)
+ {
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ unknownUserException_async(AMD_TestIntf_unknownUserException cb, Ice.Current current)
+ {
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ unknownLocalException_async(AMD_TestIntf_unknownLocalException cb, Ice.Current current)
+ {
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ unknownException_async(AMD_TestIntf_unknownException cb, Ice.Current current)
+ {
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ localException_async(AMD_TestIntf_localException cb, Ice.Current current)
+ {
+ cb.ice_response();
+ }
+
+// public void
+// userException_async(AMD_TestIntf_userException cb, Ice.Current current)
+// {
+// cb.ice_response();
+// }
+
+ @Override
+ public void
+ javaException_async(AMD_TestIntf_javaException cb, Ice.Current current)
+ {
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ unknownExceptionWithServantException_async(AMD_TestIntf_unknownExceptionWithServantException cb,
+ Ice.Current current)
+ {
+ cb.ice_exception(new Ice.ObjectNotExistException());
+ }
+
+ @Override
+ public void
+ impossibleException_async(AMD_TestIntf_impossibleException cb, boolean _throw, Ice.Current current)
+ {
+ if(_throw)
+ {
+ cb.ice_exception(new TestImpossibleException());
+ }
+ else
+ {
+ //
+ // Return a value so we can be sure that the stream position
+ // is reset correctly if finished() throws.
+ //
+ cb.ice_response("Hello");
+ }
+ }
+
+ @Override
+ public void
+ intfUserException_async(AMD_TestIntf_intfUserException cb, boolean _throw, Ice.Current current)
+ {
+ if(_throw)
+ {
+ cb.ice_exception(new TestIntfUserException());
+ }
+ else
+ {
+ //
+ // Return a value so we can be sure that the stream position
+ // is reset correctly if finished() throws.
+ //
+ cb.ice_response("Hello");
+ }
+ }
+
+ @Override
+ public void
+ asyncResponse_async(AMD_TestIntf_asyncResponse cb, Ice.Current current)
+ {
+ cb.ice_response();
+ throw new Ice.ObjectNotExistException();
+ }
+
+ @Override
+ public void
+ asyncException_async(AMD_TestIntf_asyncException cb, Ice.Current current)
+ {
+ cb.ice_exception(new TestIntfUserException());
+ throw new Ice.ObjectNotExistException();
+ }
+
+ @Override
+ public void
+ shutdown_async(AMD_TestIntf_shutdown cb, Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ cb.ice_response();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/AllTests.java b/java-compat/test/src/main/java/test/Ice/servantLocator/AllTests.java
new file mode 100644
index 00000000000..de9b90ee2d9
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/servantLocator/AllTests.java
@@ -0,0 +1,375 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.servantLocator;
+
+import java.io.PrintWriter;
+
+import test.Ice.servantLocator.Test.TestImpossibleException;
+import test.Ice.servantLocator.Test.TestIntfUserException;
+import test.Ice.servantLocator.Test.TestIntfPrx;
+import test.Ice.servantLocator.Test.TestIntfPrxHelper;
+import test.Ice.servantLocator.Test.TestActivationPrx;
+import test.Ice.servantLocator.Test.TestActivationPrxHelper;
+
+import Ice.ObjectNotExistException;
+import Ice.ObjectPrx;
+import Ice.UnknownException;
+import Ice.UnknownLocalException;
+import Ice.UnknownUserException;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static void
+ testExceptions(TestIntfPrx obj)
+ {
+ try
+ {
+ obj.requestFailedException();
+ test(false);
+ }
+ catch(ObjectNotExistException ex)
+ {
+ test(ex.id.equals(obj.ice_getIdentity()));
+ test(ex.facet.equals(obj.ice_getFacet()));
+ test(ex.operation.equals("requestFailedException"));
+ }
+
+ try
+ {
+ obj.unknownUserException();
+ test(false);
+ }
+ catch(UnknownUserException ex)
+ {
+ test(ex.unknown.equals("reason"));
+ }
+
+ try
+ {
+ obj.unknownLocalException();
+ test(false);
+ }
+ catch(UnknownLocalException ex)
+ {
+ test(ex.unknown.equals("reason"));
+ }
+
+ try
+ {
+ obj.unknownException();
+ test(false);
+ }
+ catch(UnknownException ex)
+ {
+ test(ex.unknown.equals("reason"));
+ }
+
+ //
+ // User exceptions are checked exceptions
+ //
+// try
+// {
+// obj.userException();
+// test(false);
+// }
+// catch(UnknownUserException ex)
+// {
+// //System.err.println(ex.unknown);
+// test(!collocated);
+// test(ex.unknown.equals("Test::TestIntfUserException"));
+// }
+// catch(TestIntfUserException ex)
+// {
+// test(collocated);
+// }
+
+ try
+ {
+ obj.localException();
+ test(false);
+ }
+ catch(UnknownLocalException ex)
+ {
+ test(ex.unknown.indexOf("Ice::SocketException") >= 0 ||
+ ex.unknown.indexOf("Ice.SocketException") >= 0);
+ }
+ catch(Throwable ex)
+ {
+ test(false);
+ }
+
+ try
+ {
+ obj.javaException();
+ test(false);
+ }
+ catch(UnknownException ex)
+ {
+ test(ex.unknown.indexOf("java.lang.RuntimeException: message") >= 0);
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ //System.err.println(ex);
+ test(false);
+ }
+
+ try
+ {
+ obj.unknownExceptionWithServantException();
+ test(false);
+ }
+ catch(UnknownException ex)
+ {
+ test(ex.unknown.equals("reason"));
+ }
+ catch(Throwable ex)
+ {
+ test(false);
+ }
+
+ try
+ {
+ obj.impossibleException(false);
+ test(false);
+ }
+ catch(UnknownUserException ex)
+ {
+ // Operation doesn't throw, but locate() and finished() throw TestIntfUserException.
+ }
+ catch(Throwable ex)
+ {
+ //System.err.println(ex);
+ test(false);
+ }
+
+ try
+ {
+ obj.impossibleException(true);
+ test(false);
+ }
+ catch(UnknownUserException ex)
+ {
+ // Operation throws TestImpossibleException, but locate() and finished() throw TestIntfUserException.
+ }
+ catch(Throwable ex)
+ {
+ //System.err.println(ex);
+ test(false);
+ }
+
+ try
+ {
+ obj.intfUserException(false);
+ test(false);
+ }
+ catch(TestImpossibleException ex)
+ {
+ // Operation doesn't throw, but locate() and finished() throw TestImpossibleException.
+ }
+ catch(Throwable ex)
+ {
+ //System.err.println(ex);
+ test(false);
+ }
+
+ try
+ {
+ obj.intfUserException(true);
+ test(false);
+ }
+ catch(TestImpossibleException ex)
+ {
+ // Operation throws TestIntfUserException, but locate() and finished() throw TestImpossibleException.
+ }
+ catch(Throwable ex)
+ {
+ //System.err.println(ex);
+ test(false);
+ }
+ }
+
+ public static TestIntfPrx
+ allTests(Ice.Communicator communicator, PrintWriter out)
+ {
+ out.print("testing stringToProxy... ");
+ out.flush();
+ String ref = "asm:default -p 12010";
+ Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ test(base != null);
+ out.println("ok");
+
+ out.print("testing checked cast... ");
+ out.flush();
+ TestIntfPrx obj = TestIntfPrxHelper.checkedCast(base);
+ test(obj != null);
+ test(obj.equals(base));
+ out.println("ok");
+
+ out.print("testing ice_ids... ");
+ out.flush();
+ try
+ {
+ ObjectPrx o = communicator.stringToProxy("category/locate:default -p 12010");
+ o.ice_ids();
+ test(false);
+ }
+ catch(UnknownUserException ex)
+ {
+ test(ex.unknown.equals("::Test::TestIntfUserException"));
+ }
+ catch(Throwable ex)
+ {
+ test(false);
+ }
+
+ try
+ {
+ ObjectPrx o = communicator.stringToProxy("category/finished:default -p 12010");
+ o.ice_ids();
+ test(false);
+ }
+ catch(UnknownUserException ex)
+ {
+ test(ex.unknown.equals("::Test::TestIntfUserException"));
+ }
+ catch(Throwable ex)
+ {
+ test(false);
+ }
+ out.println("ok");
+
+ out.print("testing servant locator... ");
+ out.flush();
+ base = communicator.stringToProxy("category/locate:default -p 12010");
+ obj = TestIntfPrxHelper.checkedCast(base);
+ try
+ {
+ TestIntfPrxHelper.checkedCast(communicator.stringToProxy("category/unknown:default -p 12010"));
+ }
+ catch(ObjectNotExistException ex)
+ {
+ }
+ out.println("ok");
+
+ out.print("testing default servant locator... ");
+ out.flush();
+ base = communicator.stringToProxy("anothercat/locate:default -p 12010");
+ obj = TestIntfPrxHelper.checkedCast(base);
+ base = communicator.stringToProxy("locate:default -p 12010");
+ obj = TestIntfPrxHelper.checkedCast(base);
+ try
+ {
+ TestIntfPrxHelper.checkedCast(communicator.stringToProxy("anothercat/unknown:default -p 12010"));
+ }
+ catch(ObjectNotExistException ex)
+ {
+ }
+ try
+ {
+ TestIntfPrxHelper.checkedCast(communicator.stringToProxy("unknown:default -p 12010"));
+ }
+ catch(ObjectNotExistException ex)
+ {
+ }
+ out.println("ok");
+
+ out.print("testing locate exceptions... ");
+ out.flush();
+ base = communicator.stringToProxy("category/locate:default -p 12010");
+ obj = TestIntfPrxHelper.checkedCast(base);
+ testExceptions(obj);
+ out.println("ok");
+
+ out.print("testing finished exceptions... ");
+ out.flush();
+ base = communicator.stringToProxy("category/finished:default -p 12010");
+ obj = TestIntfPrxHelper.checkedCast(base);
+ testExceptions(obj);
+
+ //
+ // Only call these for category/finished.
+ //
+ try
+ {
+ obj.asyncResponse();
+ }
+ catch(TestIntfUserException ex)
+ {
+ test(false);
+ }
+ catch(TestImpossibleException ex)
+ {
+ //
+ // Called by finished().
+ //
+ }
+
+ //
+ // Only call these for category/finished.
+ //
+ try
+ {
+ obj.asyncException();
+ }
+ catch(TestIntfUserException ex)
+ {
+ test(false);
+ }
+ catch(TestImpossibleException ex)
+ {
+ //
+ // Called by finished().
+ //
+ }
+
+ out.println("ok");
+
+ out.print("testing servant locator removal... ");
+ out.flush();
+ base = communicator.stringToProxy("test/activation:default -p 12010");
+ TestActivationPrx activation = TestActivationPrxHelper.checkedCast(base);
+ activation.activateServantLocator(false);
+ try
+ {
+ obj.ice_ping();
+ test(false);
+ }
+ catch(ObjectNotExistException ex)
+ {
+ out.println("ok");
+ }
+ out.print("testing servant locator addition... ");
+ out.flush();
+ activation.activateServantLocator(true);
+ try
+ {
+ obj.ice_ping();
+ out.println("ok");
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+
+ return obj;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/Client.java b/java-compat/test/src/main/java/test/Ice/servantLocator/Client.java
new file mode 100644
index 00000000000..fa676eb383c
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/servantLocator/Client.java
@@ -0,0 +1,40 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.servantLocator;
+
+import test.Ice.servantLocator.Test.TestIntfPrx;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ TestIntfPrx obj = AllTests.allTests(communicator(), getWriter());
+ obj.shutdown();
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/Collocated.java b/java-compat/test/src/main/java/test/Ice/servantLocator/Collocated.java
new file mode 100644
index 00000000000..6e4fbf4e820
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/servantLocator/Collocated.java
@@ -0,0 +1,46 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.servantLocator;
+
+public class Collocated extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.addServantLocator(new ServantLocatorI("category"), "category");
+ adapter.addServantLocator(new ServantLocatorI(""), "");
+ adapter.add(new TestI(), Ice.Util.stringToIdentity("asm"));
+ adapter.add(new TestActivationI(), Ice.Util.stringToIdentity("test/activation"));
+ AllTests.allTests(communicator(), getWriter());
+
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Collocated app = new Collocated();
+ int result = app.main("Collocated", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/CookieI.java b/java-compat/test/src/main/java/test/Ice/servantLocator/CookieI.java
new file mode 100644
index 00000000000..38934db95a1
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/servantLocator/CookieI.java
@@ -0,0 +1,22 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.servantLocator;
+
+import test.Ice.servantLocator.Test.Cookie;
+
+public final class CookieI extends Cookie
+{
+ @Override
+ public String
+ message()
+ {
+ return "blahblah";
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/ServantLocatorI.java b/java-compat/test/src/main/java/test/Ice/servantLocator/ServantLocatorI.java
new file mode 100644
index 00000000000..09f12a13efb
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/servantLocator/ServantLocatorI.java
@@ -0,0 +1,184 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.servantLocator;
+
+import test.Ice.servantLocator.Test.Cookie;
+import test.Ice.servantLocator.Test.TestImpossibleException;
+import test.Ice.servantLocator.Test.TestIntfUserException;
+import Ice.ObjectNotExistException;
+import Ice.SocketException;
+import Ice.UnknownException;
+import Ice.UnknownLocalException;
+import Ice.UnknownUserException;
+
+public final class ServantLocatorI implements Ice.ServantLocator
+{
+ public
+ ServantLocatorI(String category)
+ {
+ _category = category;
+ _deactivated = false;
+ _requestId = -1;
+ }
+
+ @Override
+ protected synchronized void
+ finalize()
+ throws Throwable
+ {
+ test(_deactivated);
+ }
+
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ @Override
+ public Ice.Object
+ locate(Ice.Current current, Ice.LocalObjectHolder cookie) throws Ice.UserException
+ {
+ synchronized(this)
+ {
+ test(!_deactivated);
+ }
+
+ test(current.id.category.equals(_category) || _category.length() == 0);
+
+ if(current.id.name.equals("unknown"))
+ {
+ return null;
+ }
+
+ test(current.id.name.equals("locate") || current.id.name.equals("finished"));
+ if(current.id.name.equals("locate"))
+ {
+ exception(current);
+ }
+
+ //
+ // Ensure locate() is only called once per request.
+ //
+ test(_requestId == -1);
+ _requestId = current.requestId;
+
+ cookie.value = new CookieI();
+
+ return new TestI();
+ }
+
+ @Override
+ public void
+ finished(Ice.Current current, Ice.Object servant, java.lang.Object cookie) throws Ice.UserException
+ {
+ synchronized(this)
+ {
+ test(!_deactivated);
+ }
+
+ //
+ // Ensure finished() is only called once per request.
+ //
+ test(_requestId == current.requestId);
+ _requestId = -1;
+
+ test(current.id.category.equals(_category) || _category.length() == 0);
+ test(current.id.name.equals("locate") || current.id.name.equals("finished"));
+
+ if(current.id.name.equals("finished"))
+ {
+ exception(current);
+ }
+
+ Cookie co = (Cookie)cookie;
+ test(co.message().equals("blahblah"));
+ }
+
+ @Override
+ public synchronized void
+ deactivate(String category)
+ {
+ synchronized(this)
+ {
+ test(!_deactivated);
+
+ _deactivated = true;
+ }
+ }
+
+ private void
+ exception(Ice.Current current) throws Ice.UserException
+ {
+ if(current.operation.equals("ice_ids"))
+ {
+ throw new TestIntfUserException();
+ }
+ else if(current.operation.equals("requestFailedException"))
+ {
+ throw new ObjectNotExistException();
+ }
+ else if(current.operation.equals("unknownUserException"))
+ {
+ throw new UnknownUserException("reason");
+ }
+ else if(current.operation.equals("unknownLocalException"))
+ {
+ throw new UnknownLocalException("reason");
+ }
+ else if(current.operation.equals("unknownException"))
+ {
+ throw new UnknownException("reason");
+ }
+ //
+ // User exceptions are checked exceptions in Java, so it's not
+ // possible to throw it from the servant locator.
+ //
+// else if(current.operation.equals("userException"))
+// {
+// throw new TestIntfUserException();
+// }
+ else if(current.operation.equals("localException"))
+ {
+ throw new SocketException(0);
+ }
+ else if(current.operation.equals("javaException"))
+ {
+ throw new java.lang.RuntimeException("message");
+ }
+ else if(current.operation.equals("unknownExceptionWithServantException"))
+ {
+ throw new UnknownException("reason");
+ }
+ else if(current.operation.equals("impossibleException"))
+ {
+ throw new TestIntfUserException(); // Yes, it really is meant to be TestIntfUserException.
+ }
+ else if(current.operation.equals("intfUserException"))
+ {
+ throw new TestImpossibleException(); // Yes, it really is meant to be TestImpossibleException.
+ }
+ else if(current.operation.equals("asyncResponse"))
+ {
+ throw new TestImpossibleException();
+ }
+ else if(current.operation.equals("asyncException"))
+ {
+ throw new TestImpossibleException();
+ }
+ }
+
+ private boolean _deactivated;
+ private final String _category;
+ private int _requestId;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/Server.java b/java-compat/test/src/main/java/test/Ice/servantLocator/Server.java
new file mode 100644
index 00000000000..9559c24a7a4
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/servantLocator/Server.java
@@ -0,0 +1,45 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.servantLocator;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.addServantLocator(new ServantLocatorI("category"), "category");
+ adapter.addServantLocator(new ServantLocatorI(""), "");
+ adapter.add(new TestI(), Ice.Util.stringToIdentity("asm"));
+ adapter.add(new TestActivationI(), Ice.Util.stringToIdentity("test/activation"));
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/Test.ice b/java-compat/test/src/main/java/test/Ice/servantLocator/Test.ice
new file mode 100644
index 00000000000..5f4f60472c8
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/servantLocator/Test.ice
@@ -0,0 +1,55 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.servantLocator"]]
+module Test
+{
+
+exception TestIntfUserException
+{
+};
+
+exception TestImpossibleException
+{
+};
+
+interface TestIntf
+{
+ void requestFailedException();
+ void unknownUserException();
+ void unknownLocalException();
+ void unknownException();
+ void localException();
+ //void userException();
+ void javaException();
+
+ void unknownExceptionWithServantException();
+
+ string impossibleException(bool throw) throws TestImpossibleException;
+ string intfUserException(bool throw) throws TestIntfUserException, TestImpossibleException;
+
+ void asyncResponse() throws TestIntfUserException, TestImpossibleException;
+ void asyncException() throws TestIntfUserException, TestImpossibleException;
+
+ void shutdown();
+};
+
+interface TestActivation
+{
+ void activateServantLocator(bool activate);
+};
+
+local class Cookie
+{
+ ["cpp:const"] string message();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/TestAMD.ice b/java-compat/test/src/main/java/test/Ice/servantLocator/TestAMD.ice
new file mode 100644
index 00000000000..287b22593fa
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/servantLocator/TestAMD.ice
@@ -0,0 +1,55 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.servantLocator.AMD"]]
+module Test
+{
+
+exception TestIntfUserException
+{
+};
+
+exception TestImpossibleException
+{
+};
+
+["amd"] interface TestIntf
+{
+ void requestFailedException();
+ void unknownUserException();
+ void unknownLocalException();
+ void unknownException();
+ void localException();
+ //void userException();
+ void javaException();
+
+ void unknownExceptionWithServantException();
+
+ string impossibleException(bool throw) throws TestImpossibleException;
+ string intfUserException(bool throw) throws TestIntfUserException, TestImpossibleException;
+
+ void asyncResponse() throws TestIntfUserException, TestImpossibleException;
+ void asyncException() throws TestIntfUserException, TestImpossibleException;
+
+ void shutdown();
+};
+
+interface TestActivation
+{
+ void activateServantLocator(bool activate);
+};
+
+local class Cookie
+{
+ ["cpp:const"] string message();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/TestActivationI.java b/java-compat/test/src/main/java/test/Ice/servantLocator/TestActivationI.java
new file mode 100644
index 00000000000..094992022df
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/servantLocator/TestActivationI.java
@@ -0,0 +1,32 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.servantLocator;
+
+import test.Ice.servantLocator.Test._TestActivationDisp;
+
+public final class TestActivationI extends _TestActivationDisp
+{
+ @Override
+ public void activateServantLocator(boolean activate, Ice.Current current)
+ {
+ if(activate)
+ {
+ current.adapter.addServantLocator(new ServantLocatorI(""), "");
+ current.adapter.addServantLocator(new ServantLocatorI("category"), "category");
+ }
+ else
+ {
+ Ice.ServantLocator locator = current.adapter.removeServantLocator("");
+ locator.deactivate("");
+ locator = current.adapter.removeServantLocator("category");
+ locator.deactivate("category");
+ }
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/TestI.java b/java-compat/test/src/main/java/test/Ice/servantLocator/TestI.java
new file mode 100644
index 00000000000..f479681d910
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/servantLocator/TestI.java
@@ -0,0 +1,122 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.servantLocator;
+
+import test.Ice.servantLocator.Test.TestImpossibleException;
+import test.Ice.servantLocator.Test.TestIntfUserException;
+import test.Ice.servantLocator.Test._TestIntfDisp;
+
+public final class TestI extends _TestIntfDisp
+{
+ @Override
+ public void
+ requestFailedException(Ice.Current current)
+ {
+ }
+
+ @Override
+ public void
+ unknownUserException(Ice.Current current)
+ {
+ }
+
+ @Override
+ public void
+ unknownLocalException(Ice.Current current)
+ {
+ }
+
+ @Override
+ public void
+ unknownException(Ice.Current current)
+ {
+ }
+
+ @Override
+ public void
+ localException(Ice.Current current)
+ {
+ }
+
+// public void
+// userException(Ice.Current current)
+// {
+// }
+
+ @Override
+ public void
+ javaException(Ice.Current current)
+ {
+ }
+
+ @Override
+ public void
+ unknownExceptionWithServantException(Ice.Current current)
+ {
+ throw new Ice.ObjectNotExistException();
+ }
+
+ @Override
+ public String
+ impossibleException(boolean _throw, Ice.Current current) throws TestImpossibleException
+ {
+ if(_throw)
+ {
+ throw new TestImpossibleException();
+ }
+
+ //
+ // Return a value so we can be sure that the stream position
+ // is reset correctly if finished() throws.
+ //
+ return "Hello";
+ }
+
+ @Override
+ public String
+ intfUserException(boolean _throw, Ice.Current current) throws TestIntfUserException, TestImpossibleException
+ {
+ if(_throw)
+ {
+ throw new TestIntfUserException();
+ }
+
+ //
+ // Return a value so we can be sure that the stream position
+ // is reset correctly if finished() throws.
+ //
+ return "Hello";
+ }
+
+ @Override
+ public void
+ asyncResponse(Ice.Current current) throws TestIntfUserException, TestImpossibleException
+ {
+ //
+ // Only relevant for AMD.
+ //
+ }
+
+ @Override
+ public void
+ asyncException(Ice.Current current) throws TestIntfUserException, TestImpossibleException
+ {
+ //
+ // Only relevant for AMD.
+ //
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/run.py b/java-compat/test/src/main/java/test/Ice/servantLocator/run.py
new file mode 100755
index 00000000000..205d37b5a05
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/servantLocator/run.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.",
+ server="test.Ice.servantLocator.AMDServer")
+TestUtil.queueCollocatedTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java
new file mode 100644
index 00000000000..220b71f7e03
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java
@@ -0,0 +1,43 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.slicing.exceptions;
+
+public class AMDServer extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.Object object = new AMDTestI();
+ adapter.add(object, Ice.Util.stringToIdentity("Test"));
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.exceptions.serverAMD");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ AMDServer c = new AMDServer();
+ int status = c.main("AMDServer", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AMDTestI.java b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AMDTestI.java
new file mode 100644
index 00000000000..a500d1b6da5
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AMDTestI.java
@@ -0,0 +1,321 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.slicing.exceptions;
+
+import test.Ice.slicing.exceptions.serverAMD.Test.*;
+
+public final class AMDTestI extends _TestIntfDisp
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ @Override
+ public void
+ shutdown_async(AMD_TestIntf_shutdown cb, Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ baseAsBase_async(AMD_TestIntf_baseAsBase cb, Ice.Current current)
+ throws Base
+ {
+ Base b = new Base();
+ b.b = "Base.b";
+ cb.ice_exception(b);
+ }
+
+ @Override
+ public void
+ unknownDerivedAsBase_async(AMD_TestIntf_unknownDerivedAsBase cb, Ice.Current current)
+ throws Base
+ {
+ UnknownDerived d = new UnknownDerived();
+ d.b = "UnknownDerived.b";
+ d.ud = "UnknownDerived.ud";
+ cb.ice_exception(d);
+ }
+
+ @Override
+ public void
+ knownDerivedAsBase_async(AMD_TestIntf_knownDerivedAsBase cb, Ice.Current current)
+ throws Base
+ {
+ KnownDerived d = new KnownDerived();
+ d.b = "KnownDerived.b";
+ d.kd = "KnownDerived.kd";
+ cb.ice_exception(d);
+ }
+
+ @Override
+ public void
+ knownDerivedAsKnownDerived_async(AMD_TestIntf_knownDerivedAsKnownDerived cb, Ice.Current current)
+ throws KnownDerived
+ {
+ KnownDerived d = new KnownDerived();
+ d.b = "KnownDerived.b";
+ d.kd = "KnownDerived.kd";
+ cb.ice_exception(d);
+ }
+
+ @Override
+ public void
+ unknownIntermediateAsBase_async(AMD_TestIntf_unknownIntermediateAsBase cb, Ice.Current current)
+ throws Base
+ {
+ UnknownIntermediate ui = new UnknownIntermediate();
+ ui.b = "UnknownIntermediate.b";
+ ui.ui = "UnknownIntermediate.ui";
+ cb.ice_exception(ui);
+ }
+
+ @Override
+ public void
+ knownIntermediateAsBase_async(AMD_TestIntf_knownIntermediateAsBase cb, Ice.Current current)
+ throws Base
+ {
+ KnownIntermediate ki = new KnownIntermediate();
+ ki.b = "KnownIntermediate.b";
+ ki.ki = "KnownIntermediate.ki";
+ cb.ice_exception(ki);
+ }
+
+ @Override
+ public void
+ knownMostDerivedAsBase_async(AMD_TestIntf_knownMostDerivedAsBase cb, Ice.Current current)
+ throws Base
+ {
+ KnownMostDerived kmd = new KnownMostDerived();
+ kmd.b = "KnownMostDerived.b";
+ kmd.ki = "KnownMostDerived.ki";
+ kmd.kmd = "KnownMostDerived.kmd";
+ cb.ice_exception(kmd);
+ }
+
+ @Override
+ public void
+ knownIntermediateAsKnownIntermediate_async(AMD_TestIntf_knownIntermediateAsKnownIntermediate cb,
+ Ice.Current current)
+ throws KnownIntermediate
+ {
+ KnownIntermediate ki = new KnownIntermediate();
+ ki.b = "KnownIntermediate.b";
+ ki.ki = "KnownIntermediate.ki";
+ cb.ice_exception(ki);
+ }
+
+ @Override
+ public void
+ knownMostDerivedAsKnownIntermediate_async(AMD_TestIntf_knownMostDerivedAsKnownIntermediate cb,
+ Ice.Current current)
+ throws KnownIntermediate
+ {
+ KnownMostDerived kmd = new KnownMostDerived();
+ kmd.b = "KnownMostDerived.b";
+ kmd.ki = "KnownMostDerived.ki";
+ kmd.kmd = "KnownMostDerived.kmd";
+ cb.ice_exception(kmd);
+ }
+
+ @Override
+ public void
+ knownMostDerivedAsKnownMostDerived_async(AMD_TestIntf_knownMostDerivedAsKnownMostDerived cb,
+ Ice.Current current)
+ throws KnownMostDerived
+ {
+ KnownMostDerived kmd = new KnownMostDerived();
+ kmd.b = "KnownMostDerived.b";
+ kmd.ki = "KnownMostDerived.ki";
+ kmd.kmd = "KnownMostDerived.kmd";
+ cb.ice_exception(kmd);
+ }
+
+ @Override
+ public void
+ unknownMostDerived1AsBase_async(AMD_TestIntf_unknownMostDerived1AsBase cb, Ice.Current current)
+ throws Base
+ {
+ UnknownMostDerived1 umd1 = new UnknownMostDerived1();
+ umd1.b = "UnknownMostDerived1.b";
+ umd1.ki = "UnknownMostDerived1.ki";
+ umd1.umd1 = "UnknownMostDerived1.umd1";
+ cb.ice_exception(umd1);
+ }
+
+ @Override
+ public void
+ unknownMostDerived1AsKnownIntermediate_async(AMD_TestIntf_unknownMostDerived1AsKnownIntermediate cb,
+ Ice.Current current)
+ throws KnownIntermediate
+ {
+ UnknownMostDerived1 umd1 = new UnknownMostDerived1();
+ umd1.b = "UnknownMostDerived1.b";
+ umd1.ki = "UnknownMostDerived1.ki";
+ umd1.umd1 = "UnknownMostDerived1.umd1";
+ cb.ice_exception(umd1);
+ }
+
+ @Override
+ public void
+ unknownMostDerived2AsBase_async(AMD_TestIntf_unknownMostDerived2AsBase cb, Ice.Current current)
+ throws Base
+ {
+ UnknownMostDerived2 umd2 = new UnknownMostDerived2();
+ umd2.b = "UnknownMostDerived2.b";
+ umd2.ui = "UnknownMostDerived2.ui";
+ umd2.umd2 = "UnknownMostDerived2.umd2";
+ cb.ice_exception(umd2);
+ }
+
+ @Override
+ public void
+ unknownMostDerived2AsBaseCompact_async(AMD_TestIntf_unknownMostDerived2AsBaseCompact cb, Ice.Current current)
+ {
+ UnknownMostDerived2 umd2 = new UnknownMostDerived2();
+ umd2.b = "UnknownMostDerived2.b";
+ umd2.ui = "UnknownMostDerived2.ui";
+ umd2.umd2 = "UnknownMostDerived2.umd2";
+ cb.ice_exception(umd2);
+ }
+
+ @Override
+ public void
+ knownPreservedAsBase_async(AMD_TestIntf_knownPreservedAsBase cb, Ice.Current current)
+ {
+ KnownPreservedDerived ex = new KnownPreservedDerived();
+ ex.b = "base";
+ ex.kp = "preserved";
+ ex.kpd = "derived";
+ cb.ice_exception(ex);
+ }
+
+ @Override
+ public void
+ knownPreservedAsKnownPreserved_async(AMD_TestIntf_knownPreservedAsKnownPreserved cb, Ice.Current current)
+ {
+ KnownPreservedDerived ex = new KnownPreservedDerived();
+ ex.b = "base";
+ ex.kp = "preserved";
+ ex.kpd = "derived";
+ cb.ice_exception(ex);
+ }
+
+ @Override
+ public void
+ relayKnownPreservedAsBase_async(AMD_TestIntf_relayKnownPreservedAsBase cb, RelayPrx r, Ice.Current current)
+ {
+ try
+ {
+ r.knownPreservedAsBase();
+ test(false);
+ }
+ catch(Ice.UserException ex)
+ {
+ cb.ice_exception(ex);
+ }
+ catch(Ice.LocalException ex)
+ {
+ cb.ice_exception(ex);
+ }
+ }
+
+ @Override
+ public void
+ relayKnownPreservedAsKnownPreserved_async(AMD_TestIntf_relayKnownPreservedAsKnownPreserved cb,
+ RelayPrx r, Ice.Current current)
+ {
+ try
+ {
+ r.knownPreservedAsKnownPreserved();
+ test(false);
+ }
+ catch(Ice.UserException ex)
+ {
+ cb.ice_exception(ex);
+ }
+ catch(Ice.LocalException ex)
+ {
+ cb.ice_exception(ex);
+ }
+ }
+
+ @Override
+ public void
+ unknownPreservedAsBase_async(AMD_TestIntf_unknownPreservedAsBase cb, Ice.Current current)
+ {
+ SPreserved2 ex = new SPreserved2();
+ ex.b = "base";
+ ex.kp = "preserved";
+ ex.kpd = "derived";
+ ex.p1 = new SPreservedClass("bc", "spc");
+ ex.p2 = ex.p1;
+ cb.ice_exception(ex);
+ }
+
+ @Override
+ public void
+ unknownPreservedAsKnownPreserved_async(AMD_TestIntf_unknownPreservedAsKnownPreserved cb, Ice.Current current)
+ {
+ SPreserved2 ex = new SPreserved2();
+ ex.b = "base";
+ ex.kp = "preserved";
+ ex.kpd = "derived";
+ ex.p1 = new SPreservedClass("bc", "spc");
+ ex.p2 = ex.p1;
+ cb.ice_exception(ex);
+ }
+
+ @Override
+ public void
+ relayUnknownPreservedAsBase_async(AMD_TestIntf_relayUnknownPreservedAsBase cb, RelayPrx r, Ice.Current current)
+ {
+ try
+ {
+ r.unknownPreservedAsBase();
+ test(false);
+ }
+ catch(Ice.UserException ex)
+ {
+ cb.ice_exception(ex);
+ }
+ catch(Ice.LocalException ex)
+ {
+ cb.ice_exception(ex);
+ }
+ }
+
+ @Override
+ public void
+ relayUnknownPreservedAsKnownPreserved_async(AMD_TestIntf_relayUnknownPreservedAsKnownPreserved cb, RelayPrx r,
+ Ice.Current current)
+ {
+ try
+ {
+ r.unknownPreservedAsKnownPreserved();
+ test(false);
+ }
+ catch(Ice.UserException ex)
+ {
+ cb.ice_exception(ex);
+ }
+ catch(Ice.LocalException ex)
+ {
+ cb.ice_exception(ex);
+ }
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java
new file mode 100644
index 00000000000..c9426103f5e
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java
@@ -0,0 +1,1278 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.slicing.exceptions;
+
+import test.Ice.slicing.exceptions.client.Test.*;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private static class Callback
+ {
+ Callback()
+ {
+ _called = false;
+ }
+
+ public synchronized void
+ check()
+ {
+ while(!_called)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ _called = false;
+ }
+
+ public synchronized void
+ called()
+ {
+ assert(!_called);
+ _called = true;
+ notify();
+ }
+
+ private boolean _called;
+ }
+
+ private static class Callback_TestIntf_baseAsBaseI extends Callback_TestIntf_baseAsBase
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.UserException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(Base b)
+ {
+ test(b.b.equals("Base.b"));
+ test(b.ice_id().equals("::Test::Base"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_unknownDerivedAsBaseI extends Callback_TestIntf_unknownDerivedAsBase
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.UserException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(Base b)
+ {
+ test(b.b.equals("UnknownDerived.b"));
+ test(b.ice_id().equals("::Test::Base"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_knownDerivedAsBaseI extends Callback_TestIntf_knownDerivedAsBase
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.UserException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(KnownDerived k)
+ {
+ test(k.b.equals("KnownDerived.b"));
+ test(k.kd.equals("KnownDerived.kd"));
+ test(k.ice_id().equals("::Test::KnownDerived"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_knownDerivedAsKnownDerivedI
+ extends Callback_TestIntf_knownDerivedAsKnownDerived
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.UserException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(KnownDerived k)
+ {
+ test(k.b.equals("KnownDerived.b"));
+ test(k.kd.equals("KnownDerived.kd"));
+ test(k.ice_id().equals("::Test::KnownDerived"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_unknownIntermediateAsBaseI
+ extends Callback_TestIntf_unknownIntermediateAsBase
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.UserException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(Base b)
+ {
+ test(b.b.equals("UnknownIntermediate.b"));
+ test(b.ice_id().equals("::Test::Base"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_knownIntermediateAsBaseI extends Callback_TestIntf_knownIntermediateAsBase
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.UserException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(KnownIntermediate ki)
+ {
+ test(ki.b.equals("KnownIntermediate.b"));
+ test(ki.ki.equals("KnownIntermediate.ki"));
+ test(ki.ice_id().equals("::Test::KnownIntermediate"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_knownMostDerivedAsBaseI extends Callback_TestIntf_knownMostDerivedAsBase
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.UserException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(KnownMostDerived kmd)
+ {
+ test(kmd.b.equals("KnownMostDerived.b"));
+ test(kmd.ki.equals("KnownMostDerived.ki"));
+ test(kmd.kmd.equals("KnownMostDerived.kmd"));
+ test(kmd.ice_id().equals("::Test::KnownMostDerived"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_knownIntermediateAsKnownIntermediateI
+ extends Callback_TestIntf_knownIntermediateAsKnownIntermediate
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.UserException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(KnownIntermediate ki)
+ {
+ test(ki.b.equals("KnownIntermediate.b"));
+ test(ki.ki.equals("KnownIntermediate.ki"));
+ test(ki.ice_id().equals("::Test::KnownIntermediate"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_knownMostDerivedAsKnownIntermediateI
+ extends Callback_TestIntf_knownMostDerivedAsKnownIntermediate
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.UserException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(KnownMostDerived kmd)
+ {
+ test(kmd.b.equals("KnownMostDerived.b"));
+ test(kmd.ki.equals("KnownMostDerived.ki"));
+ test(kmd.kmd.equals("KnownMostDerived.kmd"));
+ test(kmd.ice_id().equals("::Test::KnownMostDerived"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_knownMostDerivedAsKnownMostDerivedI
+ extends Callback_TestIntf_knownMostDerivedAsKnownMostDerived
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.UserException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(KnownMostDerived kmd)
+ {
+ test(kmd.b.equals("KnownMostDerived.b"));
+ test(kmd.ki.equals("KnownMostDerived.ki"));
+ test(kmd.kmd.equals("KnownMostDerived.kmd"));
+ test(kmd.ice_id().equals("::Test::KnownMostDerived"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_unknownMostDerived1AsBaseI
+ extends Callback_TestIntf_unknownMostDerived1AsBase
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.UserException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(KnownIntermediate ki)
+ {
+ test(ki.b.equals("UnknownMostDerived1.b"));
+ test(ki.ki.equals("UnknownMostDerived1.ki"));
+ test(ki.ice_id().equals("::Test::KnownIntermediate"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_unknownMostDerived1AsKnownIntermediateI
+ extends Callback_TestIntf_unknownMostDerived1AsKnownIntermediate
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.UserException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(KnownIntermediate ki)
+ {
+ test(ki.b.equals("UnknownMostDerived1.b"));
+ test(ki.ki.equals("UnknownMostDerived1.ki"));
+ test(ki.ice_id().equals("::Test::KnownIntermediate"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_unknownMostDerived2AsBaseI
+ extends Callback_TestIntf_unknownMostDerived2AsBase
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.UserException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(Base b)
+ {
+ test(b.b.equals("UnknownMostDerived2.b"));
+ test(b.ice_id().equals("::Test::Base"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class RelayI extends _RelayDisp
+ {
+ @Override
+ public void knownPreservedAsBase(Ice.Current current)
+ throws Base
+ {
+ KnownPreservedDerived ex = new KnownPreservedDerived();
+ ex.b = "base";
+ ex.kp = "preserved";
+ ex.kpd = "derived";
+ throw ex;
+ }
+
+ @Override
+ public void knownPreservedAsKnownPreserved(Ice.Current current)
+ throws KnownPreserved
+ {
+ KnownPreservedDerived ex = new KnownPreservedDerived();
+ ex.b = "base";
+ ex.kp = "preserved";
+ ex.kpd = "derived";
+ throw ex;
+ }
+
+ @Override
+ public void unknownPreservedAsBase(Ice.Current current)
+ throws Base
+ {
+ Preserved2 ex = new Preserved2();
+ ex.b = "base";
+ ex.kp = "preserved";
+ ex.kpd = "derived";
+ ex.p1 = new PreservedClass("bc", "pc");
+ ex.p2 = ex.p1;
+ throw ex;
+ }
+
+ @Override
+ public void unknownPreservedAsKnownPreserved(Ice.Current current)
+ throws KnownPreserved
+ {
+ Preserved2 ex = new Preserved2();
+ ex.b = "base";
+ ex.kp = "preserved";
+ ex.kpd = "derived";
+ ex.p1 = new PreservedClass("bc", "pc");
+ ex.p2 = ex.p1;
+ throw ex;
+ }
+ }
+
+ public static TestIntfPrx
+ allTests(Ice.Communicator communicator, boolean collocated, java.io.PrintWriter out)
+ {
+ out.print("testing stringToProxy... ");
+ out.flush();
+ String ref = "Test:default -p 12010 -t 10000";
+ Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ test(base != null);
+ out.println("ok");
+
+ out.print("testing checked cast... ");
+ out.flush();
+ TestIntfPrx test = TestIntfPrxHelper.checkedCast(base);
+ test(test != null);
+ test(test.equals(base));
+ out.println("ok");
+
+ out.print("base... ");
+ out.flush();
+ {
+ try
+ {
+ test.baseAsBase();
+ test(false);
+ }
+ catch(Base b)
+ {
+ test(b.b.equals("Base.b"));
+ test(b.ice_id().equals("::Test::Base"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("base (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_baseAsBaseI cb = new Callback_TestIntf_baseAsBaseI();
+ test.begin_baseAsBase(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("slicing of unknown derived... ");
+ out.flush();
+ {
+ try
+ {
+ test.unknownDerivedAsBase();
+ test(false);
+ }
+ catch(Base b)
+ {
+ test(b.b.equals("UnknownDerived.b"));
+ test(b.ice_id().equals("::Test::Base"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("slicing of unknown derived (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_unknownDerivedAsBaseI cb = new Callback_TestIntf_unknownDerivedAsBaseI();
+ test.begin_unknownDerivedAsBase(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("non-slicing of known derived as base... ");
+ out.flush();
+ {
+ try
+ {
+ test.knownDerivedAsBase();
+ test(false);
+ }
+ catch(KnownDerived k)
+ {
+ test(k.b.equals("KnownDerived.b"));
+ test(k.kd.equals("KnownDerived.kd"));
+ test(k.ice_id().equals("::Test::KnownDerived"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("non-slicing of known derived as base (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_knownDerivedAsBaseI cb = new Callback_TestIntf_knownDerivedAsBaseI();
+ test.begin_knownDerivedAsBase(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("non-slicing of known derived as derived... ");
+ out.flush();
+ {
+ try
+ {
+ test.knownDerivedAsKnownDerived();
+ test(false);
+ }
+ catch(KnownDerived k)
+ {
+ test(k.b.equals("KnownDerived.b"));
+ test(k.kd.equals("KnownDerived.kd"));
+ test(k.ice_id().equals("::Test::KnownDerived"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("non-slicing of known derived as derived (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_knownDerivedAsKnownDerivedI cb = new Callback_TestIntf_knownDerivedAsKnownDerivedI();
+ test.begin_knownDerivedAsKnownDerived(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("slicing of unknown intermediate as base... ");
+ out.flush();
+ {
+ try
+ {
+ test.unknownIntermediateAsBase();
+ test(false);
+ }
+ catch(Base b)
+ {
+ test(b.b.equals("UnknownIntermediate.b"));
+ test(b.ice_id().equals("::Test::Base"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("slicing of unknown intermediate as base (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_unknownIntermediateAsBaseI cb = new Callback_TestIntf_unknownIntermediateAsBaseI();
+ test.begin_unknownIntermediateAsBase(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("slicing of known intermediate as base... ");
+ out.flush();
+ {
+ try
+ {
+ test.knownIntermediateAsBase();
+ test(false);
+ }
+ catch(KnownIntermediate ki)
+ {
+ test(ki.b.equals("KnownIntermediate.b"));
+ test(ki.ki.equals("KnownIntermediate.ki"));
+ test(ki.ice_id().equals("::Test::KnownIntermediate"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("slicing of known intermediate as base (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_knownIntermediateAsBaseI cb = new Callback_TestIntf_knownIntermediateAsBaseI();
+ test.begin_knownIntermediateAsBase(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("slicing of known most derived as base... ");
+ out.flush();
+ {
+ try
+ {
+ test.knownMostDerivedAsBase();
+ test(false);
+ }
+ catch(KnownMostDerived kmd)
+ {
+ test(kmd.b.equals("KnownMostDerived.b"));
+ test(kmd.ki.equals("KnownMostDerived.ki"));
+ test(kmd.kmd.equals("KnownMostDerived.kmd"));
+ test(kmd.ice_id().equals("::Test::KnownMostDerived"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("slicing of known most derived as base (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_knownMostDerivedAsBaseI cb = new Callback_TestIntf_knownMostDerivedAsBaseI();
+ test.begin_knownMostDerivedAsBase(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("non-slicing of known intermediate as intermediate... ");
+ out.flush();
+ {
+ try
+ {
+ test.knownIntermediateAsKnownIntermediate();
+ test(false);
+ }
+ catch(KnownIntermediate ki)
+ {
+ test(ki.b.equals("KnownIntermediate.b"));
+ test(ki.ki.equals("KnownIntermediate.ki"));
+ test(ki.ice_id().equals("::Test::KnownIntermediate"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("non-slicing of known intermediate as intermediate (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_knownIntermediateAsKnownIntermediateI cb =
+ new Callback_TestIntf_knownIntermediateAsKnownIntermediateI();
+ test.begin_knownIntermediateAsKnownIntermediate(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("non-slicing of known most derived as intermediate... ");
+ out.flush();
+ {
+ try
+ {
+ test.knownMostDerivedAsKnownIntermediate();
+ test(false);
+ }
+ catch(KnownMostDerived kmd)
+ {
+ test(kmd.b.equals("KnownMostDerived.b"));
+ test(kmd.ki.equals("KnownMostDerived.ki"));
+ test(kmd.kmd.equals("KnownMostDerived.kmd"));
+ test(kmd.ice_id().equals("::Test::KnownMostDerived"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("non-slicing of known most derived as intermediate (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_knownMostDerivedAsKnownIntermediateI cb =
+ new Callback_TestIntf_knownMostDerivedAsKnownIntermediateI();
+ test.begin_knownMostDerivedAsKnownIntermediate(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("non-slicing of known most derived as most derived... ");
+ out.flush();
+ {
+ try
+ {
+ test.knownMostDerivedAsKnownMostDerived();
+ test(false);
+ }
+ catch(KnownMostDerived kmd)
+ {
+ test(kmd.b.equals("KnownMostDerived.b"));
+ test(kmd.ki.equals("KnownMostDerived.ki"));
+ test(kmd.kmd.equals("KnownMostDerived.kmd"));
+ test(kmd.ice_id().equals("::Test::KnownMostDerived"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("non-slicing of known most derived as most derived (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_knownMostDerivedAsKnownMostDerivedI cb =
+ new Callback_TestIntf_knownMostDerivedAsKnownMostDerivedI();
+ test.begin_knownMostDerivedAsKnownMostDerived(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("slicing of unknown most derived, known intermediate as base... ");
+ out.flush();
+ {
+ try
+ {
+ test.unknownMostDerived1AsBase();
+ test(false);
+ }
+ catch(KnownIntermediate ki)
+ {
+ test(ki.b.equals("UnknownMostDerived1.b"));
+ test(ki.ki.equals("UnknownMostDerived1.ki"));
+ test(ki.ice_id().equals("::Test::KnownIntermediate"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("slicing of unknown most derived, known intermediate as base (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_unknownMostDerived1AsBaseI cb = new Callback_TestIntf_unknownMostDerived1AsBaseI();
+ test.begin_unknownMostDerived1AsBase(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("slicing of unknown most derived, known intermediate as intermediate... ");
+ out.flush();
+ {
+ try
+ {
+ test.unknownMostDerived1AsKnownIntermediate();
+ test(false);
+ }
+ catch(KnownIntermediate ki)
+ {
+ test(ki.b.equals("UnknownMostDerived1.b"));
+ test(ki.ki.equals("UnknownMostDerived1.ki"));
+ test(ki.ice_id().equals("::Test::KnownIntermediate"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("slicing of unknown most derived, known intermediate as intermediate (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_unknownMostDerived1AsKnownIntermediateI cb =
+ new Callback_TestIntf_unknownMostDerived1AsKnownIntermediateI();
+ test.begin_unknownMostDerived1AsKnownIntermediate(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("slicing of unknown most derived, unknown intermediate thrown as base... ");
+ out.flush();
+ {
+ try
+ {
+ test.unknownMostDerived2AsBase();
+ test(false);
+ }
+ catch(Base b)
+ {
+ test(b.b.equals("UnknownMostDerived2.b"));
+ test(b.ice_id().equals("::Test::Base"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("slicing of unknown most derived, unknown intermediate thrown as base (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_unknownMostDerived2AsBaseI cb = new Callback_TestIntf_unknownMostDerived2AsBaseI();
+ test.begin_unknownMostDerived2AsBase(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("unknown most derived in compact format... ");
+ out.flush();
+ {
+ try
+ {
+ test.unknownMostDerived2AsBaseCompact();
+ test(false);
+ }
+ catch(Base ex)
+ {
+ //
+ // For the 1.0 encoding, the unknown exception is sliced to Base.
+ //
+ test(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0));
+ }
+ catch(Ice.UnknownUserException ex)
+ {
+ //
+ // An UnknownUserException is raised for the compact format because the
+ // most-derived type is unknown and the exception cannot be sliced.
+ //
+ test(!test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0));
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("preserved exceptions... ");
+ out.flush();
+ {
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("Relay", "default");
+ RelayPrx relay = RelayPrxHelper.uncheckedCast(adapter.addWithUUID(new RelayI()));
+ adapter.activate();
+
+ try
+ {
+ test.relayKnownPreservedAsBase(relay);
+ test(false);
+ }
+ catch(KnownPreservedDerived ex)
+ {
+ test(ex.b.equals("base"));
+ test(ex.kp.equals("preserved"));
+ test(ex.kpd.equals("derived"));
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+
+ try
+ {
+ test.relayKnownPreservedAsKnownPreserved(relay);
+ test(false);
+ }
+ catch(KnownPreservedDerived ex)
+ {
+ test(ex.b.equals("base"));
+ test(ex.kp.equals("preserved"));
+ test(ex.kpd.equals("derived"));
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+
+ try
+ {
+ test.relayUnknownPreservedAsBase(relay);
+ test(false);
+ }
+ catch(Preserved2 ex)
+ {
+ test(ex.b.equals("base"));
+ test(ex.kp.equals("preserved"));
+ test(ex.kpd.equals("derived"));
+ test(ex.p1.ice_id().equals(PreservedClass.ice_staticId()));
+ PreservedClass pc = (PreservedClass)ex.p1;
+ test(pc.bc.equals("bc"));
+ test(pc.pc.equals("pc"));
+ test(ex.p2 == ex.p1);
+ }
+ catch(KnownPreservedDerived ex)
+ {
+ //
+ // For the 1.0 encoding, the unknown exception is sliced to KnownPreserved.
+ //
+ test(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0));
+ test(ex.b.equals("base"));
+ test(ex.kp.equals("preserved"));
+ test(ex.kpd.equals("derived"));
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+
+ try
+ {
+ test.relayUnknownPreservedAsKnownPreserved(relay);
+ test(false);
+ }
+ catch(Preserved2 ex)
+ {
+ test(ex.b.equals("base"));
+ test(ex.kp.equals("preserved"));
+ test(ex.kpd.equals("derived"));
+ test(ex.p1.ice_id().equals(PreservedClass.ice_staticId()));
+ PreservedClass pc = (PreservedClass)ex.p1;
+ test(pc.bc.equals("bc"));
+ test(pc.pc.equals("pc"));
+ test(ex.p2 == ex.p1);
+ }
+ catch(KnownPreservedDerived ex)
+ {
+ //
+ // For the 1.0 encoding, the unknown exception is sliced to KnownPreserved.
+ //
+ test(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0));
+ test(ex.b.equals("base"));
+ test(ex.kp.equals("preserved"));
+ test(ex.kpd.equals("derived"));
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+
+ adapter.destroy();
+ }
+ out.println("ok");
+
+ return test;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/Client.java b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/Client.java
new file mode 100644
index 00000000000..bf5aa54559a
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/Client.java
@@ -0,0 +1,41 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.slicing.exceptions;
+
+import test.Ice.slicing.exceptions.client.Test.TestIntfPrx;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.exceptions.client");
+ return initData;
+ }
+
+ @Override
+ public int run(String[] args)
+ {
+ TestIntfPrx test = AllTests.allTests(communicator(), false, getWriter());
+ test.shutdown();
+ return 0;
+ }
+
+ public static void main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/ClientPrivate.ice b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/ClientPrivate.ice
new file mode 100644
index 00000000000..1fa019272be
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/ClientPrivate.ice
@@ -0,0 +1,123 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.slicing.exceptions.client"]]
+module Test
+{
+
+//
+// Duplicate types from Test.ice. We cannot use #include since
+// that will use the types from the same prefix.
+//
+
+exception Base
+{
+ string b;
+};
+
+exception KnownDerived extends Base
+{
+ string kd;
+};
+
+exception KnownIntermediate extends Base
+{
+ string ki;
+};
+
+exception KnownMostDerived extends KnownIntermediate
+{
+ string kmd;
+};
+
+["preserve-slice"]
+exception KnownPreserved extends Base
+{
+ string kp;
+};
+
+exception KnownPreservedDerived extends KnownPreserved
+{
+ string kpd;
+};
+
+["preserve-slice"]
+class BaseClass
+{
+ string bc;
+};
+
+["format:sliced"]
+interface Relay
+{
+ void knownPreservedAsBase() throws Base;
+ void knownPreservedAsKnownPreserved() throws KnownPreserved;
+
+ void unknownPreservedAsBase() throws Base;
+ void unknownPreservedAsKnownPreserved() throws KnownPreserved;
+};
+
+["format:sliced"]
+interface TestIntf
+{
+ void baseAsBase() throws Base;
+ void unknownDerivedAsBase() throws Base;
+ void knownDerivedAsBase() throws Base;
+ void knownDerivedAsKnownDerived() throws KnownDerived;
+
+ void unknownIntermediateAsBase() throws Base;
+ void knownIntermediateAsBase() throws Base;
+ void knownMostDerivedAsBase() throws Base;
+ void knownIntermediateAsKnownIntermediate() throws KnownIntermediate;
+ void knownMostDerivedAsKnownIntermediate() throws KnownIntermediate;
+ void knownMostDerivedAsKnownMostDerived() throws KnownMostDerived;
+
+ void unknownMostDerived1AsBase() throws Base;
+ void unknownMostDerived1AsKnownIntermediate() throws KnownIntermediate;
+ void unknownMostDerived2AsBase() throws Base;
+
+ ["format:compact"] void unknownMostDerived2AsBaseCompact() throws Base;
+
+ void knownPreservedAsBase() throws Base;
+ void knownPreservedAsKnownPreserved() throws KnownPreserved;
+
+ void relayKnownPreservedAsBase(Relay* r) throws Base;
+ void relayKnownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved;
+
+ void unknownPreservedAsBase() throws Base;
+ void unknownPreservedAsKnownPreserved() throws KnownPreserved;
+
+ void relayUnknownPreservedAsBase(Relay* r) throws Base;
+ void relayUnknownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved;
+
+ void shutdown();
+};
+
+//
+// Types private to the client.
+//
+
+class PreservedClass extends BaseClass
+{
+ string pc;
+};
+
+exception Preserved1 extends KnownPreservedDerived
+{
+ BaseClass p1;
+};
+
+exception Preserved2 extends Preserved1
+{
+ BaseClass p2;
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/Server.java b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/Server.java
new file mode 100644
index 00000000000..183f1dd91d8
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/Server.java
@@ -0,0 +1,43 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.slicing.exceptions;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.Object object = new TestI();
+ adapter.add(object, Ice.Util.stringToIdentity("Test"));
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.exceptions.server");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server c = new Server();
+ int status = c.main("Server", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/ServerPrivate.ice b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/ServerPrivate.ice
new file mode 100644
index 00000000000..585a22e9e56
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/ServerPrivate.ice
@@ -0,0 +1,143 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.slicing.exceptions.server"]]
+module Test
+{
+
+//
+// Duplicate types from Test.ice. We cannot use #include since
+// that will use the types from the same prefix.
+//
+
+exception Base
+{
+ string b;
+};
+
+exception KnownDerived extends Base
+{
+ string kd;
+};
+
+exception KnownIntermediate extends Base
+{
+ string ki;
+};
+
+exception KnownMostDerived extends KnownIntermediate
+{
+ string kmd;
+};
+
+["preserve-slice"]
+exception KnownPreserved extends Base
+{
+ string kp;
+};
+
+exception KnownPreservedDerived extends KnownPreserved
+{
+ string kpd;
+};
+
+["preserve-slice"]
+class BaseClass
+{
+ string bc;
+};
+
+["format:sliced"]
+interface Relay
+{
+ void knownPreservedAsBase() throws Base;
+ void knownPreservedAsKnownPreserved() throws KnownPreserved;
+
+ void unknownPreservedAsBase() throws Base;
+ void unknownPreservedAsKnownPreserved() throws KnownPreserved;
+};
+
+["format:sliced"]
+interface TestIntf
+{
+ void baseAsBase() throws Base;
+ void unknownDerivedAsBase() throws Base;
+ void knownDerivedAsBase() throws Base;
+ void knownDerivedAsKnownDerived() throws KnownDerived;
+
+ void unknownIntermediateAsBase() throws Base;
+ void knownIntermediateAsBase() throws Base;
+ void knownMostDerivedAsBase() throws Base;
+ void knownIntermediateAsKnownIntermediate() throws KnownIntermediate;
+ void knownMostDerivedAsKnownIntermediate() throws KnownIntermediate;
+ void knownMostDerivedAsKnownMostDerived() throws KnownMostDerived;
+
+ void unknownMostDerived1AsBase() throws Base;
+ void unknownMostDerived1AsKnownIntermediate() throws KnownIntermediate;
+ void unknownMostDerived2AsBase() throws Base;
+
+ ["format:compact"] void unknownMostDerived2AsBaseCompact() throws Base;
+
+ void knownPreservedAsBase() throws Base;
+ void knownPreservedAsKnownPreserved() throws KnownPreserved;
+
+ void relayKnownPreservedAsBase(Relay* r) throws Base;
+ void relayKnownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved;
+
+ void unknownPreservedAsBase() throws Base;
+ void unknownPreservedAsKnownPreserved() throws KnownPreserved;
+
+ void relayUnknownPreservedAsBase(Relay* r) throws Base;
+ void relayUnknownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved;
+
+ void shutdown();
+};
+
+//
+// Types private to the server.
+//
+
+exception UnknownDerived extends Base
+{
+ string ud;
+};
+
+exception UnknownIntermediate extends Base
+{
+ string ui;
+};
+
+exception UnknownMostDerived1 extends KnownIntermediate
+{
+ string umd1;
+};
+
+exception UnknownMostDerived2 extends UnknownIntermediate
+{
+ string umd2;
+};
+
+class SPreservedClass extends BaseClass
+{
+ string spc;
+};
+
+exception SPreserved1 extends KnownPreservedDerived
+{
+ BaseClass p1;
+};
+
+exception SPreserved2 extends SPreserved1
+{
+ BaseClass p2;
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/ServerPrivateAMD.ice b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/ServerPrivateAMD.ice
new file mode 100644
index 00000000000..bdd74bbad8e
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/ServerPrivateAMD.ice
@@ -0,0 +1,143 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.slicing.exceptions.serverAMD"]]
+module Test
+{
+
+//
+// Duplicate types from Test.ice. We cannot use #include since
+// that will use the types from the same prefix.
+//
+
+exception Base
+{
+ string b;
+};
+
+exception KnownDerived extends Base
+{
+ string kd;
+};
+
+exception KnownIntermediate extends Base
+{
+ string ki;
+};
+
+exception KnownMostDerived extends KnownIntermediate
+{
+ string kmd;
+};
+
+["preserve-slice"]
+exception KnownPreserved extends Base
+{
+ string kp;
+};
+
+exception KnownPreservedDerived extends KnownPreserved
+{
+ string kpd;
+};
+
+["preserve-slice"]
+class BaseClass
+{
+ string bc;
+};
+
+["format:sliced"]
+interface Relay
+{
+ void knownPreservedAsBase() throws Base;
+ void knownPreservedAsKnownPreserved() throws KnownPreserved;
+
+ void unknownPreservedAsBase() throws Base;
+ void unknownPreservedAsKnownPreserved() throws KnownPreserved;
+};
+
+["amd", "format:sliced"]
+interface TestIntf
+{
+ void baseAsBase() throws Base;
+ void unknownDerivedAsBase() throws Base;
+ void knownDerivedAsBase() throws Base;
+ void knownDerivedAsKnownDerived() throws KnownDerived;
+
+ void unknownIntermediateAsBase() throws Base;
+ void knownIntermediateAsBase() throws Base;
+ void knownMostDerivedAsBase() throws Base;
+ void knownIntermediateAsKnownIntermediate() throws KnownIntermediate;
+ void knownMostDerivedAsKnownIntermediate() throws KnownIntermediate;
+ void knownMostDerivedAsKnownMostDerived() throws KnownMostDerived;
+
+ void unknownMostDerived1AsBase() throws Base;
+ void unknownMostDerived1AsKnownIntermediate() throws KnownIntermediate;
+ void unknownMostDerived2AsBase() throws Base;
+
+ ["format:compact"] void unknownMostDerived2AsBaseCompact() throws Base;
+
+ void knownPreservedAsBase() throws Base;
+ void knownPreservedAsKnownPreserved() throws KnownPreserved;
+
+ void relayKnownPreservedAsBase(Relay* r) throws Base;
+ void relayKnownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved;
+
+ void unknownPreservedAsBase() throws Base;
+ void unknownPreservedAsKnownPreserved() throws KnownPreserved;
+
+ void relayUnknownPreservedAsBase(Relay* r) throws Base;
+ void relayUnknownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved;
+
+ void shutdown();
+};
+
+//
+// Types private to the server.
+//
+
+exception UnknownDerived extends Base
+{
+ string ud;
+};
+
+exception UnknownIntermediate extends Base
+{
+ string ui;
+};
+
+exception UnknownMostDerived1 extends KnownIntermediate
+{
+ string umd1;
+};
+
+exception UnknownMostDerived2 extends UnknownIntermediate
+{
+ string umd2;
+};
+
+class SPreservedClass extends BaseClass
+{
+ string spc;
+};
+
+exception SPreserved1 extends KnownPreservedDerived
+{
+ BaseClass p1;
+};
+
+exception SPreserved2 extends SPreserved1
+{
+ BaseClass p2;
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/TestI.java b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/TestI.java
new file mode 100644
index 00000000000..128c8c4bb8c
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/TestI.java
@@ -0,0 +1,279 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.slicing.exceptions;
+
+import test.Ice.slicing.exceptions.server.Test.*;
+
+public final class TestI extends _TestIntfDisp
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+
+ @Override
+ public void
+ baseAsBase(Ice.Current current)
+ throws Base
+ {
+ Base b = new Base();
+ b.b = "Base.b";
+ throw b;
+ }
+
+ @Override
+ public void
+ unknownDerivedAsBase(Ice.Current current)
+ throws Base
+ {
+ UnknownDerived d = new UnknownDerived();
+ d.b = "UnknownDerived.b";
+ d.ud = "UnknownDerived.ud";
+ throw d;
+ }
+
+ @Override
+ public void
+ knownDerivedAsBase(Ice.Current current)
+ throws Base
+ {
+ KnownDerived d = new KnownDerived();
+ d.b = "KnownDerived.b";
+ d.kd = "KnownDerived.kd";
+ throw d;
+ }
+
+ @Override
+ public void
+ knownDerivedAsKnownDerived(Ice.Current current)
+ throws KnownDerived
+ {
+ KnownDerived d = new KnownDerived();
+ d.b = "KnownDerived.b";
+ d.kd = "KnownDerived.kd";
+ throw d;
+ }
+
+ @Override
+ public void
+ unknownIntermediateAsBase(Ice.Current current)
+ throws Base
+ {
+ UnknownIntermediate ui = new UnknownIntermediate();
+ ui.b = "UnknownIntermediate.b";
+ ui.ui = "UnknownIntermediate.ui";
+ throw ui;
+ }
+
+ @Override
+ public void
+ knownIntermediateAsBase(Ice.Current current)
+ throws Base
+ {
+ KnownIntermediate ki = new KnownIntermediate();
+ ki.b = "KnownIntermediate.b";
+ ki.ki = "KnownIntermediate.ki";
+ throw ki;
+ }
+
+ @Override
+ public void
+ knownMostDerivedAsBase(Ice.Current current)
+ throws Base
+ {
+ KnownMostDerived kmd = new KnownMostDerived();
+ kmd.b = "KnownMostDerived.b";
+ kmd.ki = "KnownMostDerived.ki";
+ kmd.kmd = "KnownMostDerived.kmd";
+ throw kmd;
+ }
+
+ @Override
+ public void
+ knownIntermediateAsKnownIntermediate(Ice.Current current)
+ throws KnownIntermediate
+ {
+ KnownIntermediate ki = new KnownIntermediate();
+ ki.b = "KnownIntermediate.b";
+ ki.ki = "KnownIntermediate.ki";
+ throw ki;
+ }
+
+ @Override
+ public void
+ knownMostDerivedAsKnownIntermediate(Ice.Current current)
+ throws KnownIntermediate
+ {
+ KnownMostDerived kmd = new KnownMostDerived();
+ kmd.b = "KnownMostDerived.b";
+ kmd.ki = "KnownMostDerived.ki";
+ kmd.kmd = "KnownMostDerived.kmd";
+ throw kmd;
+ }
+
+ @Override
+ public void
+ knownMostDerivedAsKnownMostDerived(Ice.Current current)
+ throws KnownMostDerived
+ {
+ KnownMostDerived kmd = new KnownMostDerived();
+ kmd.b = "KnownMostDerived.b";
+ kmd.ki = "KnownMostDerived.ki";
+ kmd.kmd = "KnownMostDerived.kmd";
+ throw kmd;
+ }
+
+ @Override
+ public void
+ unknownMostDerived1AsBase(Ice.Current current)
+ throws Base
+ {
+ UnknownMostDerived1 umd1 = new UnknownMostDerived1();
+ umd1.b = "UnknownMostDerived1.b";
+ umd1.ki = "UnknownMostDerived1.ki";
+ umd1.umd1 = "UnknownMostDerived1.umd1";
+ throw umd1;
+ }
+
+ @Override
+ public void
+ unknownMostDerived1AsKnownIntermediate(Ice.Current current)
+ throws KnownIntermediate
+ {
+ UnknownMostDerived1 umd1 = new UnknownMostDerived1();
+ umd1.b = "UnknownMostDerived1.b";
+ umd1.ki = "UnknownMostDerived1.ki";
+ umd1.umd1 = "UnknownMostDerived1.umd1";
+ throw umd1;
+ }
+
+ @Override
+ public void
+ unknownMostDerived2AsBase(Ice.Current current)
+ throws Base
+ {
+ UnknownMostDerived2 umd2 = new UnknownMostDerived2();
+ umd2.b = "UnknownMostDerived2.b";
+ umd2.ui = "UnknownMostDerived2.ui";
+ umd2.umd2 = "UnknownMostDerived2.umd2";
+ throw umd2;
+ }
+
+ @Override
+ public void
+ unknownMostDerived2AsBaseCompact(Ice.Current current)
+ throws Base
+ {
+ UnknownMostDerived2 umd2 = new UnknownMostDerived2();
+ umd2.b = "UnknownMostDerived2.b";
+ umd2.ui = "UnknownMostDerived2.ui";
+ umd2.umd2 = "UnknownMostDerived2.umd2";
+ throw umd2;
+ }
+
+ @Override
+ public void
+ knownPreservedAsBase(Ice.Current current)
+ throws Base
+ {
+ KnownPreservedDerived ex = new KnownPreservedDerived();
+ ex.b = "base";
+ ex.kp = "preserved";
+ ex.kpd = "derived";
+ throw ex;
+ }
+
+ @Override
+ public void
+ knownPreservedAsKnownPreserved(Ice.Current current)
+ throws KnownPreserved
+ {
+ KnownPreservedDerived ex = new KnownPreservedDerived();
+ ex.b = "base";
+ ex.kp = "preserved";
+ ex.kpd = "derived";
+ throw ex;
+ }
+
+ @Override
+ public void
+ relayKnownPreservedAsBase(RelayPrx r, Ice.Current current)
+ throws Base
+ {
+ r.knownPreservedAsBase();
+ test(false);
+ }
+
+ @Override
+ public void
+ relayKnownPreservedAsKnownPreserved(RelayPrx r, Ice.Current current)
+ throws KnownPreserved
+ {
+ r.knownPreservedAsKnownPreserved();
+ test(false);
+ }
+
+ @Override
+ public void
+ unknownPreservedAsBase(Ice.Current current)
+ throws Base
+ {
+ SPreserved2 ex = new SPreserved2();
+ ex.b = "base";
+ ex.kp = "preserved";
+ ex.kpd = "derived";
+ ex.p1 = new SPreservedClass("bc", "spc");
+ ex.p2 = ex.p1;
+ throw ex;
+ }
+
+ @Override
+ public void
+ unknownPreservedAsKnownPreserved(Ice.Current current)
+ throws KnownPreserved
+ {
+ SPreserved2 ex = new SPreserved2();
+ ex.b = "base";
+ ex.kp = "preserved";
+ ex.kpd = "derived";
+ ex.p1 = new SPreservedClass("bc", "spc");
+ ex.p2 = ex.p1;
+ throw ex;
+ }
+
+ @Override
+ public void
+ relayUnknownPreservedAsBase(RelayPrx r, Ice.Current current)
+ throws Base
+ {
+ r.unknownPreservedAsBase();
+ test(false);
+ }
+
+ @Override
+ public void
+ relayUnknownPreservedAsKnownPreserved(RelayPrx r, Ice.Current current)
+ throws KnownPreserved
+ {
+ r.unknownPreservedAsKnownPreserved();
+ test(false);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/run.py b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/run.py
new file mode 100755
index 00000000000..e796b96ceef
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/run.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.")
+
+TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.",
+ additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
+ additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
+
+TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True,
+ message = "Running test with sliced format and AMD server.",
+ server="test.Ice.slicing.exceptions.AMDServer")
+
+TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True,
+ message = "Running test with 1.0 encoding and AMD server.",
+ server="test.Ice.slicing.exceptions.AMDServer",
+ additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
+ additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
+
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/slicing/objects/AMDServer.java b/java-compat/test/src/main/java/test/Ice/slicing/objects/AMDServer.java
new file mode 100644
index 00000000000..529194081fe
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/slicing/objects/AMDServer.java
@@ -0,0 +1,43 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.slicing.objects;
+
+public class AMDServer extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.Object object = new AMDTestI();
+ adapter.add(object, Ice.Util.stringToIdentity("Test"));
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.objects.serverAMD");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ AMDServer app = new AMDServer();
+ int result = app.main("AMDServer", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/slicing/objects/AMDTestI.java b/java-compat/test/src/main/java/test/Ice/slicing/objects/AMDTestI.java
new file mode 100644
index 00000000000..0c9e6662935
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/slicing/objects/AMDTestI.java
@@ -0,0 +1,571 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.slicing.objects;
+
+import test.Ice.slicing.objects.serverAMD.Test.*;
+
+public final class AMDTestI extends _TestIntfDisp
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ @Override
+ public void
+ shutdown_async(AMD_TestIntf_shutdown cb, Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ SBaseAsObject_async(AMD_TestIntf_SBaseAsObject cb, Ice.Current current)
+ {
+ SBase sb = new SBase();
+ sb.sb = "SBase.sb";
+ cb.ice_response(sb);
+ }
+
+ @Override
+ public void
+ SBaseAsSBase_async(AMD_TestIntf_SBaseAsSBase cb, Ice.Current current)
+ {
+ SBase sb = new SBase();
+ sb.sb = "SBase.sb";
+ cb.ice_response(sb);
+ }
+
+ @Override
+ public void
+ SBSKnownDerivedAsSBase_async(AMD_TestIntf_SBSKnownDerivedAsSBase cb, Ice.Current current)
+ {
+ SBSKnownDerived sbskd = new SBSKnownDerived();
+ sbskd.sb = "SBSKnownDerived.sb";
+ sbskd.sbskd = "SBSKnownDerived.sbskd";
+ cb.ice_response(sbskd);
+ }
+
+ @Override
+ public void
+ SBSKnownDerivedAsSBSKnownDerived_async(AMD_TestIntf_SBSKnownDerivedAsSBSKnownDerived cb, Ice.Current current)
+ {
+ SBSKnownDerived sbskd = new SBSKnownDerived();
+ sbskd.sb = "SBSKnownDerived.sb";
+ sbskd.sbskd = "SBSKnownDerived.sbskd";
+ cb.ice_response(sbskd);
+ }
+
+ @Override
+ public void
+ SBSUnknownDerivedAsSBase_async(AMD_TestIntf_SBSUnknownDerivedAsSBase cb, Ice.Current current)
+ {
+ SBSUnknownDerived sbsud = new SBSUnknownDerived();
+ sbsud.sb = "SBSUnknownDerived.sb";
+ sbsud.sbsud = "SBSUnknownDerived.sbsud";
+ cb.ice_response(sbsud);
+ }
+
+ @Override
+ public void
+ SBSUnknownDerivedAsSBaseCompact_async(AMD_TestIntf_SBSUnknownDerivedAsSBaseCompact cb, Ice.Current current)
+ {
+ SBSUnknownDerived sbsud = new SBSUnknownDerived();
+ sbsud.sb = "SBSUnknownDerived.sb";
+ sbsud.sbsud = "SBSUnknownDerived.sbsud";
+ cb.ice_response(sbsud);
+ }
+
+ @Override
+ public void
+ SUnknownAsObject_async(AMD_TestIntf_SUnknownAsObject cb, Ice.Current current)
+ {
+ SUnknown su = new SUnknown();
+ su.su = "SUnknown.su";
+ cb.ice_response(su);
+ }
+
+ @Override
+ public void
+ checkSUnknown_async(AMD_TestIntf_checkSUnknown cb, Ice.Object obj, Ice.Current current)
+ {
+ if(current.encoding.equals(Ice.Util.Encoding_1_0))
+ {
+ test(!(obj instanceof SUnknown));
+ }
+ else
+ {
+ SUnknown su = (SUnknown)obj;
+ test(su.su.equals("SUnknown.su"));
+ }
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ oneElementCycle_async(AMD_TestIntf_oneElementCycle cb, Ice.Current current)
+ {
+ B b = new B();
+ b.sb = "B1.sb";
+ b.pb = b;
+ cb.ice_response(b);
+ }
+
+ @Override
+ public void
+ twoElementCycle_async(AMD_TestIntf_twoElementCycle cb, Ice.Current current)
+ {
+ B b1 = new B();
+ b1.sb = "B1.sb";
+ B b2 = new B();
+ b2.sb = "B2.sb";
+ b2.pb = b1;
+ b1.pb = b2;
+ cb.ice_response(b1);
+ }
+
+ @Override
+ public void
+ D1AsB_async(AMD_TestIntf_D1AsB cb, Ice.Current current)
+ {
+ D1 d1 = new D1();
+ d1.sb = "D1.sb";
+ d1.sd1 = "D1.sd1";
+ D2 d2 = new D2();
+ d2.pb = d1;
+ d2.sb = "D2.sb";
+ d2.sd2 = "D2.sd2";
+ d2.pd2 = d1;
+ d1.pb = d2;
+ d1.pd1 = d2;
+ cb.ice_response(d1);
+ }
+
+ @Override
+ public void
+ D1AsD1_async(AMD_TestIntf_D1AsD1 cb, Ice.Current current)
+ {
+ D1 d1 = new D1();
+ d1.sb = "D1.sb";
+ d1.sd1 = "D1.sd1";
+ D2 d2 = new D2();
+ d2.pb = d1;
+ d2.sb = "D2.sb";
+ d2.sd2 = "D2.sd2";
+ d2.pd2 = d1;
+ d1.pb = d2;
+ d1.pd1 = d2;
+ cb.ice_response(d1);
+ }
+
+ @Override
+ public void
+ D2AsB_async(AMD_TestIntf_D2AsB cb, Ice.Current current)
+ {
+ D2 d2 = new D2();
+ d2.sb = "D2.sb";
+ d2.sd2 = "D2.sd2";
+ D1 d1 = new D1();
+ d1.pb = d2;
+ d1.sb = "D1.sb";
+ d1.sd1 = "D1.sd1";
+ d1.pd1 = d2;
+ d2.pb = d1;
+ d2.pd2 = d1;
+ cb.ice_response(d2);
+ }
+
+ @Override
+ public void
+ paramTest1_async(AMD_TestIntf_paramTest1 cb, Ice.Current current)
+ {
+ D1 d1 = new D1();
+ d1.sb = "D1.sb";
+ d1.sd1 = "D1.sd1";
+ D2 d2 = new D2();
+ d2.pb = d1;
+ d2.sb = "D2.sb";
+ d2.sd2 = "D2.sd2";
+ d2.pd2 = d1;
+ d1.pb = d2;
+ d1.pd1 = d2;
+ cb.ice_response(d1, d2);
+ }
+
+ @Override
+ public void
+ paramTest2_async(AMD_TestIntf_paramTest2 cb, Ice.Current current)
+ {
+ D1 d1 = new D1();
+ d1.sb = "D1.sb";
+ d1.sd1 = "D1.sd1";
+ D2 d2 = new D2();
+ d2.pb = d1;
+ d2.sb = "D2.sb";
+ d2.sd2 = "D2.sd2";
+ d2.pd2 = d1;
+ d1.pb = d2;
+ d1.pd1 = d2;
+ cb.ice_response(d2, d1);
+ }
+
+ @Override
+ public void
+ paramTest3_async(AMD_TestIntf_paramTest3 cb, Ice.Current current)
+ {
+ D2 d2 = new D2();
+ d2.sb = "D2.sb (p1 1)";
+ d2.pb = null;
+ d2.sd2 = "D2.sd2 (p1 1)";
+
+ D1 d1 = new D1();
+ d1.sb = "D1.sb (p1 2)";
+ d1.pb = null;
+ d1.sd1 = "D1.sd2 (p1 2)";
+ d1.pd1 = null;
+ d2.pd2 = d1;
+
+ D2 d4 = new D2();
+ d4.sb = "D2.sb (p2 1)";
+ d4.pb = null;
+ d4.sd2 = "D2.sd2 (p2 1)";
+
+ D1 d3 = new D1();
+ d3.sb = "D1.sb (p2 2)";
+ d3.pb = null;
+ d3.sd1 = "D1.sd2 (p2 2)";
+ d3.pd1 = null;
+ d4.pd2 = d3;
+ cb.ice_response(d3, d2, d4);
+ }
+
+ @Override
+ public void
+ paramTest4_async(AMD_TestIntf_paramTest4 cb, Ice.Current current)
+ {
+ D4 d4 = new D4();
+ d4.sb = "D4.sb (1)";
+ d4.pb = null;
+ d4.p1 = new B();
+ d4.p1.sb = "B.sb (1)";
+ d4.p2 = new B();
+ d4.p2.sb = "B.sb (2)";
+ cb.ice_response(d4.p2, d4);
+ }
+
+ @Override
+ public void
+ returnTest1_async(AMD_TestIntf_returnTest1 cb, Ice.Current current)
+ {
+ D1 d1 = new D1();
+ d1.sb = "D1.sb";
+ d1.sd1 = "D1.sd1";
+ D2 d2 = new D2();
+ d2.pb = d1;
+ d2.sb = "D2.sb";
+ d2.sd2 = "D2.sd2";
+ d2.pd2 = d1;
+ d1.pb = d2;
+ d1.pd1 = d2;
+ cb.ice_response(d2, d2, d1);
+ }
+
+ @Override
+ public void
+ returnTest2_async(AMD_TestIntf_returnTest2 cb, Ice.Current current)
+ {
+ D1 d1 = new D1();
+ d1.sb = "D1.sb";
+ d1.sd1 = "D1.sd1";
+ D2 d2 = new D2();
+ d2.pb = d1;
+ d2.sb = "D2.sb";
+ d2.sd2 = "D2.sd2";
+ d2.pd2 = d1;
+ d1.pb = d2;
+ d1.pd1 = d2;
+ cb.ice_response(d1, d1, d2);
+ }
+
+ @Override
+ public void
+ returnTest3_async(AMD_TestIntf_returnTest3 cb, B p1, B p2, Ice.Current current)
+ {
+ cb.ice_response(p1);
+ }
+
+ @Override
+ public void
+ sequenceTest_async(AMD_TestIntf_sequenceTest cb, SS1 p1, SS2 p2, Ice.Current current)
+ {
+ SS3 ss = new SS3();
+ ss.c1 = p1;
+ ss.c2 = p2;
+ cb.ice_response(ss);
+ }
+
+ @Override
+ public void
+ dictionaryTest_async(AMD_TestIntf_dictionaryTest cb, java.util.Map<Integer, B> bin, Ice.Current current)
+ {
+ java.util.Map<Integer, B> bout = new java.util.HashMap<Integer, B>();
+ int i;
+ for(i = 0; i < 10; ++i)
+ {
+ B b = bin.get(i);
+ D2 d2 = new D2();
+ d2.sb = b.sb;
+ d2.pb = b.pb;
+ d2.sd2 = "D2";
+ d2.pd2 = d2;
+ bout.put(i * 10, d2);
+ }
+ java.util.Map<Integer, B> r = new java.util.HashMap<Integer, B>();
+ for(i = 0; i < 10; ++i)
+ {
+ String s = "D1." + new Integer(i * 20).toString();
+ D1 d1 = new D1();
+ d1.sb = s;
+ d1.pb = (i == 0 ? null : r.get((i - 1) * 20));
+ d1.sd1 = s;
+ d1.pd1 = d1;
+ r.put(i * 20, d1);
+ }
+ cb.ice_response(r, bout);
+ }
+
+ @Override
+ public void
+ exchangePBase_async(AMD_TestIntf_exchangePBase cb, PBase pb, Ice.Current current)
+ {
+ cb.ice_response(pb);
+ }
+
+ @Override
+ public void
+ PBSUnknownAsPreserved_async(AMD_TestIntf_PBSUnknownAsPreserved cb, Ice.Current current)
+ {
+ PSUnknown r = new PSUnknown();
+ r.pi = 5;
+ r.ps = "preserved";
+ r.psu = "unknown";
+ r.graph = null;
+ if(!current.encoding.equals(Ice.Util.Encoding_1_0))
+ {
+ //
+ // 1.0 encoding doesn't support unmarshaling unknown classes even if referenced
+ // from unread slice.
+ //
+ r.cl = new MyClass(15);
+ }
+ cb.ice_response(r);
+ }
+
+ @Override
+ public void
+ checkPBSUnknown_async(AMD_TestIntf_checkPBSUnknown cb, Preserved p, Ice.Current current)
+ {
+ if(current.encoding.equals(Ice.Util.Encoding_1_0))
+ {
+ test(!(p instanceof PSUnknown));
+ test(p.pi == 5);
+ test(p.ps.equals("preserved"));
+ }
+ else
+ {
+ PSUnknown pu = (PSUnknown)p;
+ test(pu.pi == 5);
+ test(pu.ps.equals("preserved"));
+ test(pu.psu.equals("unknown"));
+ test(pu.graph == null);
+ test(pu.cl != null && pu.cl.i == 15);
+ }
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ PBSUnknownAsPreservedWithGraph_async(AMD_TestIntf_PBSUnknownAsPreservedWithGraph cb, Ice.Current current)
+ {
+ PSUnknown r = new PSUnknown();
+ r.pi = 5;
+ r.ps = "preserved";
+ r.psu = "unknown";
+ r.graph = new PNode();
+ r.graph.next = new PNode();
+ r.graph.next.next = new PNode();
+ r.graph.next.next.next = r.graph;
+ cb.ice_response(r);
+ r.graph.next.next.next = null; // Break the cycle.
+ }
+
+ @Override
+ public void
+ checkPBSUnknownWithGraph_async(AMD_TestIntf_checkPBSUnknownWithGraph cb, Preserved p, Ice.Current current)
+ {
+ if(current.encoding.equals(Ice.Util.Encoding_1_0))
+ {
+ test(!(p instanceof PSUnknown));
+ test(p.pi == 5);
+ test(p.ps.equals("preserved"));
+ }
+ else
+ {
+ PSUnknown pu = (PSUnknown)p;
+ test(pu.pi == 5);
+ test(pu.ps.equals("preserved"));
+ test(pu.psu.equals("unknown"));
+ test(pu.graph != pu.graph.next);
+ test(pu.graph.next != pu.graph.next.next);
+ test(pu.graph.next.next.next == pu.graph);
+ pu.graph.next.next.next = null; // Break the cycle.
+ }
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ PBSUnknown2AsPreservedWithGraph_async(AMD_TestIntf_PBSUnknown2AsPreservedWithGraph cb, Ice.Current current)
+ {
+ PSUnknown2 r = new PSUnknown2();
+ r.pi = 5;
+ r.ps = "preserved";
+ r.pb = r;
+ cb.ice_response(r);
+ r.pb = null; // Break the cycle.
+ }
+
+ @Override
+ public void
+ checkPBSUnknown2WithGraph_async(AMD_TestIntf_checkPBSUnknown2WithGraph cb, Preserved p, Ice.Current current)
+ {
+ if(current.encoding.equals(Ice.Util.Encoding_1_0))
+ {
+ test(!(p instanceof PSUnknown2));
+ test(p.pi == 5);
+ test(p.ps.equals("preserved"));
+ }
+ else
+ {
+ PSUnknown2 pu = (PSUnknown2)p;
+ test(pu.pi == 5);
+ test(pu.ps.equals("preserved"));
+ test(pu.pb == pu);
+ pu.pb = null; // Break the cycle.
+ }
+ cb.ice_response();
+ }
+
+ @Override
+ public void
+ exchangePNode_async(AMD_TestIntf_exchangePNode cb, PNode pn, Ice.Current current)
+ {
+ cb.ice_response(pn);
+ }
+
+ @Override
+ public void
+ throwBaseAsBase_async(AMD_TestIntf_throwBaseAsBase cb, Ice.Current current)
+ throws BaseException
+ {
+ BaseException be = new BaseException();
+ be.sbe = "sbe";
+ be.pb = new B();
+ be.pb.sb = "sb";
+ be.pb.pb = be.pb;
+ cb.ice_exception(be);
+ }
+
+ @Override
+ public void
+ throwDerivedAsBase_async(AMD_TestIntf_throwDerivedAsBase cb, Ice.Current current)
+ throws BaseException
+ {
+ DerivedException de = new DerivedException();
+ de.sbe = "sbe";
+ de.pb = new B();
+ de.pb.sb = "sb1";
+ de.pb.pb = de.pb;
+ de.sde = "sde1";
+ de.pd1 = new D1();
+ de.pd1.sb = "sb2";
+ de.pd1.pb = de.pd1;
+ de.pd1.sd1 = "sd2";
+ de.pd1.pd1 = de.pd1;
+ cb.ice_exception(de);
+ }
+
+ @Override
+ public void
+ throwDerivedAsDerived_async(AMD_TestIntf_throwDerivedAsDerived cb, Ice.Current current)
+ throws DerivedException
+ {
+ DerivedException de = new DerivedException();
+ de.sbe = "sbe";
+ de.pb = new B();
+ de.pb.sb = "sb1";
+ de.pb.pb = de.pb;
+ de.sde = "sde1";
+ de.pd1 = new D1();
+ de.pd1.sb = "sb2";
+ de.pd1.pb = de.pd1;
+ de.pd1.sd1 = "sd2";
+ de.pd1.pd1 = de.pd1;
+ cb.ice_exception(de);
+ }
+
+ @Override
+ public void
+ throwUnknownDerivedAsBase_async(AMD_TestIntf_throwUnknownDerivedAsBase cb, Ice.Current current)
+ throws BaseException
+ {
+ D2 d2 = new D2();
+ d2.sb = "sb d2";
+ d2.pb = d2;
+ d2.sd2 = "sd2 d2";
+ d2.pd2 = d2;
+
+ UnknownDerivedException ude = new UnknownDerivedException();
+ ude.sbe = "sbe";
+ ude.pb = d2;
+ ude.sude = "sude";
+ ude.pd2 = d2;
+ cb.ice_exception(ude);
+ }
+
+ @Override
+ public void
+ throwPreservedException_async(AMD_TestIntf_throwPreservedException cb, Ice.Current current)
+ {
+ PSUnknownException ue = new PSUnknownException();
+ ue.p = new PSUnknown2();
+ ue.p.pi = 5;
+ ue.p.ps = "preserved";
+ ue.p.pb = ue.p;
+ cb.ice_exception(ue);
+ ue.p.pb = null; // Break the cycle.
+ }
+
+ @Override
+ public void
+ useForward_async(AMD_TestIntf_useForward cb, Ice.Current current)
+ {
+ Forward f = new Forward();
+ f = new Forward();
+ f.h = new Hidden();
+ f.h.f = f;
+ cb.ice_response(f);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/slicing/objects/AllTests.java b/java-compat/test/src/main/java/test/Ice/slicing/objects/AllTests.java
new file mode 100644
index 00000000000..d8080a02248
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/slicing/objects/AllTests.java
@@ -0,0 +1,3151 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.slicing.objects;
+
+import java.io.PrintWriter;
+
+import test.Ice.slicing.objects.client.Test.*;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private static class Callback
+ {
+ Callback()
+ {
+ _called = false;
+ }
+
+ public synchronized void
+ check()
+ {
+ while(!_called)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ _called = false;
+ }
+
+ public synchronized void
+ called()
+ {
+ assert(!_called);
+ _called = true;
+ notify();
+ }
+
+ private boolean _called;
+ }
+
+ private static class Callback_TestIntf_SBaseAsObjectI extends Callback_TestIntf_SBaseAsObject
+ {
+ @Override
+ public void
+ response(Ice.Object o)
+ {
+ test(o != null);
+ test(o.ice_id().equals("::Test::SBase"));
+ SBase sb = (SBase)o;
+ test(sb != null);
+ test(sb.sb.equals("SBase.sb"));
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_SBaseAsSBaseI extends Callback_TestIntf_SBaseAsSBase
+ {
+ @Override
+ public void
+ response(SBase sb)
+ {
+ test(sb.sb.equals("SBase.sb"));
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_SBSKnownDerivedAsSBaseI extends Callback_TestIntf_SBSKnownDerivedAsSBase
+ {
+ @Override
+ public void
+ response(SBase sb)
+ {
+ test(sb.sb.equals("SBSKnownDerived.sb"));
+ SBSKnownDerived sbskd = (SBSKnownDerived)sb;
+ test(sbskd != null);
+ test(sbskd.sbskd.equals("SBSKnownDerived.sbskd"));
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_SBSKnownDerivedAsSBSKnownDerivedI
+ extends Callback_TestIntf_SBSKnownDerivedAsSBSKnownDerived
+ {
+ @Override
+ public void
+ response(SBSKnownDerived sbskd)
+ {
+ test(sbskd.sbskd.equals("SBSKnownDerived.sbskd"));
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_SBSUnknownDerivedAsSBaseI extends Callback_TestIntf_SBSUnknownDerivedAsSBase
+ {
+ @Override
+ public void
+ response(SBase sb)
+ {
+ test(sb.sb.equals("SBSUnknownDerived.sb"));
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_SBSUnknownDerivedAsSBaseCompactI
+ extends Callback_TestIntf_SBSUnknownDerivedAsSBaseCompact
+ {
+ @Override
+ public void
+ response(SBase sb)
+ {
+ test(sb.sb.equals("SBSUnknownDerived.sb"));
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ if(exc instanceof Ice.OperationNotExistException)
+ {
+ callback.called();
+ return;
+ }
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_SBSUnknownDerivedAsSBaseCompactFailI
+ extends Callback_TestIntf_SBSUnknownDerivedAsSBaseCompact
+ {
+ @Override
+ public void
+ response(SBase sb)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ if(exc instanceof Ice.OperationNotExistException)
+ {
+ callback.called();
+ return;
+ }
+ test(exc instanceof Ice.NoValueFactoryException);
+ callback.called();
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_SUnknownAsObjectI1 extends Callback_TestIntf_SUnknownAsObject
+ {
+ @Override
+ public void
+ response(Ice.Object o)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(exc.ice_id().equals("::Ice::NoValueFactoryException"));
+ callback.called();
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_SUnknownAsObjectI2 extends Callback_TestIntf_SUnknownAsObject
+ {
+ @Override
+ public void
+ response(Ice.Object o)
+ {
+ test(o instanceof Ice.UnknownSlicedValue);
+ test(((Ice.UnknownSlicedValue)o).getUnknownTypeId().equals("::Test::SUnknown"));
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_oneElementCycleI extends Callback_TestIntf_oneElementCycle
+ {
+ @Override
+ public void
+ response(B b)
+ {
+ test(b != null);
+ test(b.ice_id().equals("::Test::B"));
+ test(b.sb.equals("B1.sb"));
+ test(b.pb == b);
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_twoElementCycleI extends Callback_TestIntf_twoElementCycle
+ {
+ @Override
+ public void
+ response(B b1)
+ {
+ test(b1 != null);
+ test(b1.ice_id().equals("::Test::B"));
+ test(b1.sb.equals("B1.sb"));
+
+ B b2 = b1.pb;
+ test(b2 != null);
+ test(b2.ice_id().equals("::Test::B"));
+ test(b2.sb.equals("B2.sb"));
+ test(b2.pb == b1);
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_D1AsBI extends Callback_TestIntf_D1AsB
+ {
+ @Override
+ public void
+ response(B b1)
+ {
+ test(b1 != null);
+ test(b1.ice_id().equals("::Test::D1"));
+ test(b1.sb.equals("D1.sb"));
+ test(b1.pb != null);
+ test(b1.pb != b1);
+ D1 d1 = (D1)b1;
+ test(d1 != null);
+ test(d1.sd1.equals("D1.sd1"));
+ test(d1.pd1 != null);
+ test(d1.pd1 != b1);
+ test(b1.pb == d1.pd1);
+
+ B b2 = b1.pb;
+ test(b2 != null);
+ test(b2.pb == b1);
+ test(b2.sb.equals("D2.sb"));
+ test(b2.ice_id().equals("::Test::B"));
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_D1AsD1I extends Callback_TestIntf_D1AsD1
+ {
+ @Override
+ public void
+ response(D1 d1)
+ {
+ test(d1 != null);
+ test(d1.ice_id().equals("::Test::D1"));
+ test(d1.sb.equals("D1.sb"));
+ test(d1.pb != null);
+ test(d1.pb != d1);
+
+ B b2 = d1.pb;
+ test(b2 != null);
+ test(b2.ice_id().equals("::Test::B"));
+ test(b2.sb.equals("D2.sb"));
+ test(b2.pb == d1);
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_D2AsBI extends Callback_TestIntf_D2AsB
+ {
+ @Override
+ public void
+ response(B b2)
+ {
+ test(b2 != null);
+ test(b2.ice_id().equals("::Test::B"));
+ test(b2.sb.equals("D2.sb"));
+ test(b2.pb != null);
+ test(b2.pb != b2);
+
+ B b1 = b2.pb;
+ test(b1 != null);
+ test(b1.ice_id().equals("::Test::D1"));
+ test(b1.sb.equals("D1.sb"));
+ test(b1.pb == b2);
+ D1 d1 = (D1)b1;
+ test(d1 != null);
+ test(d1.sd1.equals("D1.sd1"));
+ test(d1.pd1 == b2);
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_paramTest1I extends Callback_TestIntf_paramTest1
+ {
+ @Override
+ public void
+ response(B b1, B b2)
+ {
+ test(b1 != null);
+ test(b1.ice_id().equals("::Test::D1"));
+ test(b1.sb.equals("D1.sb"));
+ test(b1.pb == b2);
+ D1 d1 = (D1)b1;
+ test(d1 != null);
+ test(d1.sd1.equals("D1.sd1"));
+ test(d1.pd1 == b2);
+
+ test(b2 != null);
+ test(b2.ice_id().equals("::Test::B")); // No factory, must be sliced
+ test(b2.sb.equals("D2.sb"));
+ test(b2.pb == b1);
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_paramTest2I extends Callback_TestIntf_paramTest2
+ {
+ @Override
+ public void
+ response(B b2, B b1)
+ {
+ test(b1 != null);
+ test(b1.ice_id().equals("::Test::D1"));
+ test(b1.sb.equals("D1.sb"));
+ test(b1.pb == b2);
+ D1 d1 = (D1)b1;
+ test(d1 != null);
+ test(d1.sd1.equals("D1.sd1"));
+ test(d1.pd1 == b2);
+
+ test(b2 != null);
+ test(b2.ice_id().equals("::Test::B")); // No factory, must be sliced
+ test(b2.sb.equals("D2.sb"));
+ test(b2.pb == b1);
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_returnTest1I extends Callback_TestIntf_returnTest1
+ {
+ @Override
+ public void
+ response(B r, B p1, B p2)
+ {
+ test(r == p1);
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_returnTest2I extends Callback_TestIntf_returnTest2
+ {
+ @Override
+ public void
+ response(B r, B p1, B p2)
+ {
+ test(r == p1);
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_returnTest3I extends Callback_TestIntf_returnTest3
+ {
+ @Override
+ public void
+ response(B b)
+ {
+ r = b;
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+
+ public B r;
+ }
+
+ private static class Callback_TestIntf_paramTest3I extends Callback_TestIntf_paramTest3
+ {
+ @Override
+ public void
+ response(B ret, B p1, B p2)
+ {
+ test(p1 != null);
+ test(p1.sb.equals("D2.sb (p1 1)"));
+ test(p1.pb == null);
+ test(p1.ice_id().equals("::Test::B"));
+
+ test(p2 != null);
+ test(p2.sb.equals("D2.sb (p2 1)"));
+ test(p2.pb == null);
+ test(p2.ice_id().equals("::Test::B"));
+
+ test(ret != null);
+ test(ret.sb.equals("D1.sb (p2 2)"));
+ test(ret.pb == null);
+ test(ret.ice_id().equals("::Test::D1"));
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_paramTest4I extends Callback_TestIntf_paramTest4
+ {
+ @Override
+ public void
+ response(B ret, B b)
+ {
+ test(b != null);
+ test(b.sb.equals("D4.sb (1)"));
+ test(b.pb == null);
+ test(b.ice_id().equals("::Test::B"));
+
+ test(ret != null);
+ test(ret.sb.equals("B.sb (2)"));
+ test(ret.pb == null);
+ test(ret.ice_id().equals("::Test::B"));
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_sequenceTestI extends Callback_TestIntf_sequenceTest
+ {
+ @Override
+ public void
+ response(SS3 ss)
+ {
+ r = ss;
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+
+ public SS3 r;
+ }
+
+ private static class Callback_TestIntf_dictionaryTestI extends Callback_TestIntf_dictionaryTest
+ {
+ @Override
+ public void
+ response(java.util.Map<Integer, B> r, java.util.Map<Integer, B> bout)
+ {
+ this.r = r;
+ this.bout = bout;
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+
+ public java.util.Map<Integer, B> r;
+ public java.util.Map<Integer, B> bout;
+ }
+
+ private static class Callback_TestIntf_throwBaseAsBaseI extends Callback_TestIntf_throwBaseAsBase
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.UserException exc)
+ {
+ try
+ {
+ BaseException e = (BaseException)exc;
+ test(e.ice_id().equals("::Test::BaseException"));
+ test(e.sbe.equals("sbe"));
+ test(e.pb != null);
+ test(e.pb.sb.equals("sb"));
+ test(e.pb.pb == e.pb);
+ }
+ catch(Exception e)
+ {
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_throwDerivedAsBaseI extends Callback_TestIntf_throwDerivedAsBase
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.UserException exc)
+ {
+ try
+ {
+ DerivedException e = (DerivedException)exc;
+ test(e.ice_id().equals("::Test::DerivedException"));
+ test(e.sbe.equals("sbe"));
+ test(e.pb != null);
+ test(e.pb.sb.equals("sb1"));
+ test(e.pb.pb == e.pb);
+ test(e.sde.equals("sde1"));
+ test(e.pd1 != null);
+ test(e.pd1.sb.equals("sb2"));
+ test(e.pd1.pb == e.pd1);
+ test(e.pd1.sd1.equals("sd2"));
+ test(e.pd1.pd1 == e.pd1);
+ }
+ catch(Exception e)
+ {
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_throwDerivedAsDerivedI extends Callback_TestIntf_throwDerivedAsDerived
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.UserException exc)
+ {
+ try
+ {
+ DerivedException e = (DerivedException)exc;
+ test(e.ice_id().equals("::Test::DerivedException"));
+ test(e.sbe.equals("sbe"));
+ test(e.pb != null);
+ test(e.pb.sb.equals("sb1"));
+ test(e.pb.pb == e.pb);
+ test(e.sde.equals("sde1"));
+ test(e.pd1 != null);
+ test(e.pd1.sb.equals("sb2"));
+ test(e.pd1.pb == e.pd1);
+ test(e.pd1.sd1.equals("sd2"));
+ test(e.pd1.pd1 == e.pd1);
+ }
+ catch(Exception e)
+ {
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_throwUnknownDerivedAsBaseI
+ extends Callback_TestIntf_throwUnknownDerivedAsBase
+ {
+ @Override
+ public void
+ response()
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ @Override
+ public void
+ exception(Ice.UserException exc)
+ {
+ try
+ {
+ BaseException e = (BaseException)exc;
+ test(e.ice_id().equals("::Test::BaseException"));
+ test(e.sbe.equals("sbe"));
+ test(e.pb != null);
+ test(e.pb.sb.equals("sb d2"));
+ test(e.pb.pb == e.pb);
+ }
+ catch(Exception e)
+ {
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_useForwardI extends Callback_TestIntf_useForward
+ {
+ @Override
+ public void
+ response(Forward f)
+ {
+ test(f != null);
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_exchangePBaseI1 extends Callback_TestIntf_exchangePBase
+ {
+ @Override
+ public void
+ response(PBase r)
+ {
+ PDerived p2 = (PDerived)r;
+ test(p2.pi == 3);
+ test(p2.ps.equals("preserved"));
+ test(p2.pb == p2);
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ if(exc instanceof Ice.OperationNotExistException)
+ {
+ callback.called();
+ return;
+ }
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_exchangePBaseI2 extends Callback_TestIntf_exchangePBase
+ {
+ @Override
+ public void
+ response(PBase r)
+ {
+ test(!(r instanceof PCUnknown));
+ test(r.pi == 3);
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ if(exc instanceof Ice.OperationNotExistException)
+ {
+ callback.called();
+ return;
+ }
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_exchangePBaseI3 extends Callback_TestIntf_exchangePBase
+ {
+ @Override
+ public void
+ response(PBase r)
+ {
+ test(!(r instanceof PCDerived));
+ test(r.pi == 3);
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ if(exc instanceof Ice.OperationNotExistException)
+ {
+ callback.called();
+ return;
+ }
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_exchangePBaseI4 extends Callback_TestIntf_exchangePBase
+ {
+ @Override
+ public void
+ response(PBase r)
+ {
+ PCDerived p2 = (PCDerived)r;
+ test(p2.pi == 3);
+ test(p2.pbs[0] == p2);
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ if(exc instanceof Ice.OperationNotExistException)
+ {
+ callback.called();
+ return;
+ }
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_exchangePBaseICompact1 extends Callback_TestIntf_exchangePBase
+ {
+ @Override
+ public void
+ response(PBase r)
+ {
+ test(!(r instanceof CompactPCDerived));
+ test(r.pi == 3);
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ if(exc instanceof Ice.OperationNotExistException)
+ {
+ callback.called();
+ return;
+ }
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_exchangePBaseICompact2 extends Callback_TestIntf_exchangePBase
+ {
+ @Override
+ public void
+ response(PBase r)
+ {
+ CompactPCDerived p2 = (CompactPCDerived)r;
+ test(p2.pi == 3);
+ test(p2.pbs[0] == p2);
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ if(exc instanceof Ice.OperationNotExistException)
+ {
+ callback.called();
+ return;
+ }
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_exchangePBaseI5 extends Callback_TestIntf_exchangePBase
+ {
+ @Override
+ public void
+ response(PBase r)
+ {
+ test(!(r instanceof PCDerived3));
+ test(r instanceof Preserved);
+ test(r.pi == 3);
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ if(exc instanceof Ice.OperationNotExistException)
+ {
+ callback.called();
+ return;
+ }
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class Callback_TestIntf_exchangePBaseI6 extends Callback_TestIntf_exchangePBase
+ {
+ @Override
+ public void
+ response(PBase r)
+ {
+ PCDerived3 p3 = (PCDerived3)r;
+ test(p3.pi == 3);
+ for(int i = 0; i < 300; ++i)
+ {
+ PCDerived2 p2 = (PCDerived2)p3.pbs[i];
+ test(p2.pi == i);
+ test(p2.pbs.length == 1);
+ test(p2.pbs[0] == null);
+ test(p2.pcd2 == i);
+ }
+ test(p3.pcd2 == p3.pi);
+ test(p3.pcd3 == p3.pbs[10]);
+ callback.called();
+ }
+
+ @Override
+ public void
+ exception(Ice.LocalException exc)
+ {
+ if(exc instanceof Ice.OperationNotExistException)
+ {
+ callback.called();
+ return;
+ }
+ test(false);
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class PNodeI extends PNode
+ {
+ public PNodeI()
+ {
+ ++counter;
+ }
+
+ static int counter = 0;
+ }
+
+ private static class NodeFactoryI implements Ice.ValueFactory
+ {
+ @Override
+ public Ice.Object create(String id)
+ {
+ if(id.equals(PNode.ice_staticId()))
+ {
+ return new PNodeI();
+ }
+ return null;
+ }
+ }
+
+ private static class PreservedI extends Preserved
+ {
+ public PreservedI()
+ {
+ ++counter;
+ }
+
+ static int counter = 0;
+ }
+
+ private static class PreservedFactoryI implements Ice.ValueFactory
+ {
+ @Override
+ public Ice.Object create(String id)
+ {
+ if(id.equals(Preserved.ice_staticId()))
+ {
+ return new PreservedI();
+ }
+ return null;
+ }
+ }
+
+ public static TestIntfPrx
+ allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out)
+ {
+ out.print("testing stringToProxy... ");
+ out.flush();
+ String ref = "Test:default -p 12010 -t 10000";
+ Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ test(base != null);
+ out.println("ok");
+
+ out.print("testing checked cast... ");
+ out.flush();
+ TestIntfPrx test = TestIntfPrxHelper.checkedCast(base);
+ test(test != null);
+ test(test.equals(base));
+ out.println("ok");
+
+ out.print("base as Object... ");
+ out.flush();
+ {
+ Ice.Object o;
+ SBase sb = null;
+ try
+ {
+ o = test.SBaseAsObject();
+ test(o != null);
+ test(o.ice_id().equals("::Test::SBase"));
+ sb = (SBase)o;
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ test(sb != null);
+ test(sb.sb.equals("SBase.sb"));
+ }
+ out.println("ok");
+
+ out.print("base as Object (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_SBaseAsObjectI cb = new Callback_TestIntf_SBaseAsObjectI();
+ test.begin_SBaseAsObject(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("base as base... ");
+ out.flush();
+ {
+ SBase sb;
+ try
+ {
+ sb = test.SBaseAsSBase();
+ test(sb.sb.equals("SBase.sb"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("base as base (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_SBaseAsSBaseI cb = new Callback_TestIntf_SBaseAsSBaseI();
+ test.begin_SBaseAsSBase(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("base with known derived as base... ");
+ out.flush();
+ {
+ SBase sb;
+ SBSKnownDerived sbskd = null;
+ try
+ {
+ sb = test.SBSKnownDerivedAsSBase();
+ test(sb.sb.equals("SBSKnownDerived.sb"));
+ sbskd = (SBSKnownDerived)sb;
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ test(sbskd != null);
+ test(sbskd.sbskd.equals("SBSKnownDerived.sbskd"));
+ }
+ out.println("ok");
+
+ out.print("base with known derived as base (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_SBSKnownDerivedAsSBaseI cb = new Callback_TestIntf_SBSKnownDerivedAsSBaseI();
+ test.begin_SBSKnownDerivedAsSBase(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("base with known derived as known derived... ");
+ out.flush();
+ {
+ SBSKnownDerived sbskd;
+ try
+ {
+ sbskd = test.SBSKnownDerivedAsSBSKnownDerived();
+ test(sbskd.sbskd.equals("SBSKnownDerived.sbskd"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("base with known derived as known derived (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_SBSKnownDerivedAsSBSKnownDerivedI cb =
+ new Callback_TestIntf_SBSKnownDerivedAsSBSKnownDerivedI();
+ test.begin_SBSKnownDerivedAsSBSKnownDerived(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("base with unknown derived as base... ");
+ out.flush();
+ {
+ try
+ {
+ SBase sb = test.SBSUnknownDerivedAsSBase();
+ test(sb.sb.equals("SBSUnknownDerived.sb"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ if(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0))
+ {
+ try
+ {
+ SBase sb = test.SBSUnknownDerivedAsSBaseCompact();
+ test(sb.sb.equals("SBSUnknownDerived.sb"));
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ else
+ {
+ try
+ {
+ //
+ // This test fails when using the compact format because the instance cannot
+ // be sliced to a known type.
+ //
+ test.SBSUnknownDerivedAsSBaseCompact();
+ test(false);
+ }
+ catch(Ice.NoValueFactoryException ex)
+ {
+ // Expected.
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("base with unknown derived as base (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_SBSUnknownDerivedAsSBaseI cb = new Callback_TestIntf_SBSUnknownDerivedAsSBaseI();
+ test.begin_SBSUnknownDerivedAsSBase(cb);
+ cb.check();
+ }
+ if(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0))
+ {
+ //
+ // This test succeeds for the 1.0 encoding.
+ //
+ Callback_TestIntf_SBSUnknownDerivedAsSBaseCompactI cb =
+ new Callback_TestIntf_SBSUnknownDerivedAsSBaseCompactI();
+ test.begin_SBSUnknownDerivedAsSBaseCompact(cb);
+ cb.check();
+ }
+ else
+ {
+ //
+ // This test fails when using the compact format because the instance cannot
+ // be sliced to a known type.
+ //
+ Callback_TestIntf_SBSUnknownDerivedAsSBaseCompactFailI cb =
+ new Callback_TestIntf_SBSUnknownDerivedAsSBaseCompactFailI();
+ test.begin_SBSUnknownDerivedAsSBaseCompact(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("unknown with Object as Object... ");
+ out.flush();
+ {
+ Ice.Object o;
+ try
+ {
+ o = test.SUnknownAsObject();
+ test(!test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0));
+ test(o instanceof Ice.UnknownSlicedValue);
+ test(((Ice.UnknownSlicedValue)o).getUnknownTypeId().equals("::Test::SUnknown"));
+ test.checkSUnknown(o);
+ }
+ catch(Ice.NoValueFactoryException ex)
+ {
+ test(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("unknown with Object as Object (AMI)... ");
+ out.flush();
+ {
+ if(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0))
+ {
+ Callback_TestIntf_SUnknownAsObjectI1 cb = new Callback_TestIntf_SUnknownAsObjectI1();
+ test.begin_SUnknownAsObject(cb);
+ cb.check();
+ }
+ else
+ {
+ Callback_TestIntf_SUnknownAsObjectI2 cb = new Callback_TestIntf_SUnknownAsObjectI2();
+ test.begin_SUnknownAsObject(cb);
+ cb.check();
+ }
+ }
+ out.println("ok");
+
+ out.print("one-element cycle... ");
+ out.flush();
+ {
+ try
+ {
+ B b = test.oneElementCycle();
+ test(b != null);
+ test(b.ice_id().equals("::Test::B"));
+ test(b.sb.equals("B1.sb"));
+ test(b.pb == b);
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("one-element cycle (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_oneElementCycleI cb = new Callback_TestIntf_oneElementCycleI();
+ test.begin_oneElementCycle(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("two-element cycle... ");
+ out.flush();
+ {
+ try
+ {
+ B b1 = test.twoElementCycle();
+ test(b1 != null);
+ test(b1.ice_id().equals("::Test::B"));
+ test(b1.sb.equals("B1.sb"));
+
+ B b2 = b1.pb;
+ test(b2 != null);
+ test(b2.ice_id().equals("::Test::B"));
+ test(b2.sb.equals("B2.sb"));
+ test(b2.pb == b1);
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("two-element cycle (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_twoElementCycleI cb = new Callback_TestIntf_twoElementCycleI();
+ test.begin_twoElementCycle(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("known derived pointer slicing as base... ");
+ out.flush();
+ {
+ try
+ {
+ B b1;
+ b1 = test.D1AsB();
+ test(b1 != null);
+ test(b1.ice_id().equals("::Test::D1"));
+ test(b1.sb.equals("D1.sb"));
+ test(b1.pb != null);
+ test(b1.pb != b1);
+ D1 d1 = (D1)b1;
+ test(d1 != null);
+ test(d1.sd1.equals("D1.sd1"));
+ test(d1.pd1 != null);
+ test(d1.pd1 != b1);
+ test(b1.pb == d1.pd1);
+
+ B b2 = b1.pb;
+ test(b2 != null);
+ test(b2.pb == b1);
+ test(b2.sb.equals("D2.sb"));
+ test(b2.ice_id().equals("::Test::B"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("known derived pointer slicing as base (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_D1AsBI cb = new Callback_TestIntf_D1AsBI();
+ test.begin_D1AsB(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("known derived pointer slicing as derived... ");
+ out.flush();
+ {
+ try
+ {
+ D1 d1;
+ d1 = test.D1AsD1();
+ test(d1 != null);
+ test(d1.ice_id().equals("::Test::D1"));
+ test(d1.sb.equals("D1.sb"));
+ test(d1.pb != null);
+ test(d1.pb != d1);
+
+ B b2 = d1.pb;
+ test(b2 != null);
+ test(b2.ice_id().equals("::Test::B"));
+ test(b2.sb.equals("D2.sb"));
+ test(b2.pb == d1);
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("known derived pointer slicing as derived (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_D1AsD1I cb = new Callback_TestIntf_D1AsD1I();
+ test.begin_D1AsD1(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("unknown derived pointer slicing as base... ");
+ out.flush();
+ {
+ try
+ {
+ B b2;
+ b2 = test.D2AsB();
+ test(b2 != null);
+ test(b2.ice_id().equals("::Test::B"));
+ test(b2.sb.equals("D2.sb"));
+ test(b2.pb != null);
+ test(b2.pb != b2);
+
+ B b1 = b2.pb;
+ test(b1 != null);
+ test(b1.ice_id().equals("::Test::D1"));
+ test(b1.sb.equals("D1.sb"));
+ test(b1.pb == b2);
+ D1 d1 = (D1)b1;
+ test(d1 != null);
+ test(d1.sd1.equals("D1.sd1"));
+ test(d1.pd1 == b2);
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("unknown derived pointer slicing as base (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_D2AsBI cb = new Callback_TestIntf_D2AsBI();
+ test.begin_D2AsB(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("param ptr slicing with known first... ");
+ out.flush();
+ {
+ try
+ {
+ BHolder b1 = new BHolder();
+ BHolder b2 = new BHolder();
+ test.paramTest1(b1, b2);
+
+ test(b1.value != null);
+ test(b1.value.ice_id().equals("::Test::D1"));
+ test(b1.value.sb.equals("D1.sb"));
+ test(b1.value.pb == b2.value);
+ D1 d1 = (D1)b1.value;
+ test(d1 != null);
+ test(d1.sd1.equals("D1.sd1"));
+ test(d1.pd1 == b2.value);
+
+ test(b2.value != null);
+ test(b2.value.ice_id().equals("::Test::B")); // No factory, must be sliced
+ test(b2.value.sb.equals("D2.sb"));
+ test(b2.value.pb == b1.value);
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("param ptr slicing with known first (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_paramTest1I cb = new Callback_TestIntf_paramTest1I();
+ test.begin_paramTest1(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("param ptr slicing with unknown first... ");
+ out.flush();
+ {
+ try
+ {
+ BHolder b2 = new BHolder();
+ BHolder b1 = new BHolder();
+ test.paramTest2(b2, b1);
+
+ test(b1.value != null);
+ test(b1.value.ice_id().equals("::Test::D1"));
+ test(b1.value.sb.equals("D1.sb"));
+ test(b1.value.pb == b2.value);
+ D1 d1 = (D1)b1.value;
+ test(d1 != null);
+ test(d1.sd1.equals("D1.sd1"));
+ test(d1.pd1 == b2.value);
+
+ test(b2.value != null);
+ test(b2.value.ice_id().equals("::Test::B")); // No factory, must be sliced
+ test(b2.value.sb.equals("D2.sb"));
+ test(b2.value.pb == b1.value);
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("param ptr slicing with unknown first (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_paramTest2I cb = new Callback_TestIntf_paramTest2I();
+ test.begin_paramTest2(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("return value identity with known first... ");
+ out.flush();
+ {
+ try
+ {
+ BHolder p1 = new BHolder();
+ BHolder p2 = new BHolder();
+ B r = test.returnTest1(p1, p2);
+ test(r == p1.value);
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("return value identity with known first (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_returnTest1I cb = new Callback_TestIntf_returnTest1I();
+ test.begin_returnTest1(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("return value identity with unknown first... ");
+ out.flush();
+ {
+ try
+ {
+ BHolder p1 = new BHolder();
+ BHolder p2 = new BHolder();
+ B r = test.returnTest2(p1, p2);
+ test(r == p1.value);
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("return value identity with unknown first (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_returnTest2I cb = new Callback_TestIntf_returnTest2I();
+ test.begin_returnTest2(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("return value identity for input params known first... ");
+ out.flush();
+ {
+ //try
+ //{
+ D1 d1 = new D1();
+ d1.sb = "D1.sb";
+ d1.sd1 = "D1.sd1";
+ D3 d3 = new D3();
+ d3.pb = d1;
+ d3.sb = "D3.sb";
+ d3.sd3 = "D3.sd3";
+ d3.pd3 = d1;
+ d1.pb = d3;
+ d1.pd1 = d3;
+
+ B b1 = test.returnTest3(d1, d3);
+
+ test(b1 != null);
+ test(b1.sb.equals("D1.sb"));
+ test(b1.ice_id().equals("::Test::D1"));
+ D1 p1 = (D1)b1;
+ test(p1 != null);
+ test(p1.sd1.equals("D1.sd1"));
+ test(p1.pd1 == b1.pb);
+
+ B b2 = b1.pb;
+ test(b2 != null);
+ test(b2.sb.equals("D3.sb"));
+ test(b2.ice_id().equals("::Test::B")); // Sliced by server
+ test(b2.pb == b1);
+ try
+ {
+ D3 p3 = (D3)b2;
+ test(p3 != null);
+ test(false);
+ }
+ catch(ClassCastException ex)
+ {
+ }
+
+ test(b1 != d1);
+ test(b1 != d3);
+ test(b2 != d1);
+ test(b2 != d3);
+ //}
+ //catch(Exception ex)
+ //{
+ //test(false);
+ //}
+ }
+ out.println("ok");
+
+ out.print("return value identity for input params known first (AMI)... ");
+ out.flush();
+ {
+ D1 d1 = new D1();
+ d1.sb = "D1.sb";
+ d1.sd1 = "D1.sd1";
+ D3 d3 = new D3();
+ d3.pb = d1;
+ d3.sb = "D3.sb";
+ d3.sd3 = "D3.sd3";
+ d3.pd3 = d1;
+ d1.pb = d3;
+ d1.pd1 = d3;
+
+ Callback_TestIntf_returnTest3I cb = new Callback_TestIntf_returnTest3I();
+ test.begin_returnTest3(d1, d3, cb);
+ cb.check();
+ B b1 = cb.r;
+
+ test(b1 != null);
+ test(b1.sb.equals("D1.sb"));
+ test(b1.ice_id().equals("::Test::D1"));
+ D1 p1 = (D1)b1;
+ test(p1 != null);
+ test(p1.sd1.equals("D1.sd1"));
+ test(p1.pd1 == b1.pb);
+
+ B b2 = b1.pb;
+ test(b2 != null);
+ test(b2.sb.equals("D3.sb"));
+ test(b2.ice_id().equals("::Test::B")); // Sliced by server
+ test(b2.pb == b1);
+ try
+ {
+ D3 p3 = (D3)b2;
+ test(p3 != null);
+ test(false);
+ }
+ catch(ClassCastException ex)
+ {
+ }
+
+ test(b1 != d1);
+ test(b1 != d3);
+ test(b2 != d1);
+ test(b2 != d3);
+ }
+ out.println("ok");
+
+ out.print("return value identity for input params unknown first... ");
+ out.flush();
+ {
+ try
+ {
+ D1 d1 = new D1();
+ d1.sb = "D1.sb";
+ d1.sd1 = "D1.sd1";
+ D3 d3 = new D3();
+ d3.pb = d1;
+ d3.sb = "D3.sb";
+ d3.sd3 = "D3.sd3";
+ d3.pd3 = d1;
+ d1.pb = d3;
+ d1.pd1 = d3;
+
+ B b1 = test.returnTest3(d3, d1);
+
+ test(b1 != null);
+ test(b1.sb.equals("D3.sb"));
+ test(b1.ice_id().equals("::Test::B")); // Sliced by server
+
+ try
+ {
+ D3 p1 = (D3)b1;
+ test(p1 != null);
+ test(false);
+ }
+ catch(ClassCastException ex)
+ {
+ }
+
+ B b2 = b1.pb;
+ test(b2 != null);
+ test(b2.sb.equals("D1.sb"));
+ test(b2.ice_id().equals("::Test::D1"));
+ test(b2.pb == b1);
+ D1 p3 = (D1)b2;
+ test(p3 != null);
+ test(p3.sd1.equals("D1.sd1"));
+ test(p3.pd1 == b1);
+
+ test(b1 != d1);
+ test(b1 != d3);
+ test(b2 != d1);
+ test(b2 != d3);
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("return value identity for input params unknown first (AMI)... ");
+ out.flush();
+ {
+ D1 d1 = new D1();
+ d1.sb = "D1.sb";
+ d1.sd1 = "D1.sd1";
+ D3 d3 = new D3();
+ d3.pb = d1;
+ d3.sb = "D3.sb";
+ d3.sd3 = "D3.sd3";
+ d3.pd3 = d1;
+ d1.pb = d3;
+ d1.pd1 = d3;
+
+ Callback_TestIntf_returnTest3I cb = new Callback_TestIntf_returnTest3I();
+ test.begin_returnTest3(d3, d1, cb);
+ cb.check();
+ B b1 = cb.r;
+
+ test(b1 != null);
+ test(b1.sb.equals("D3.sb"));
+ test(b1.ice_id().equals("::Test::B")); // Sliced by server
+
+ try
+ {
+ D3 p1 = (D3)b1;
+ test(p1 != null);
+ test(false);
+ }
+ catch(ClassCastException ex)
+ {
+ }
+
+ B b2 = b1.pb;
+ test(b2 != null);
+ test(b2.sb.equals("D1.sb"));
+ test(b2.ice_id().equals("::Test::D1"));
+ test(b2.pb == b1);
+ D1 p3 = (D1)b2;
+ test(p3 != null);
+ test(p3.sd1.equals("D1.sd1"));
+ test(p3.pd1 == b1);
+
+ test(b1 != d1);
+ test(b1 != d3);
+ test(b2 != d1);
+ test(b2 != d3);
+ }
+ out.println("ok");
+
+ out.print("remainder unmarshaling (3 instances)... ");
+ out.flush();
+ {
+ try
+ {
+ BHolder p1 = new BHolder();
+ BHolder p2 = new BHolder();
+ B ret = test.paramTest3(p1, p2);
+
+ test(p1.value != null);
+ test(p1.value.sb.equals("D2.sb (p1 1)"));
+ test(p1.value.pb == null);
+ test(p1.value.ice_id().equals("::Test::B"));
+
+ test(p2.value != null);
+ test(p2.value.sb.equals("D2.sb (p2 1)"));
+ test(p2.value.pb == null);
+ test(p2.value.ice_id().equals("::Test::B"));
+
+ test(ret != null);
+ test(ret.sb.equals("D1.sb (p2 2)"));
+ test(ret.pb == null);
+ test(ret.ice_id().equals("::Test::D1"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("remainder unmarshaling (3 instances) (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_paramTest3I cb = new Callback_TestIntf_paramTest3I();
+ test.begin_paramTest3(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("remainder unmarshaling (4 instances)... ");
+ out.flush();
+ {
+ try
+ {
+ BHolder b = new BHolder();
+ B ret = test.paramTest4(b);
+
+ test(b.value != null);
+ test(b.value.sb.equals("D4.sb (1)"));
+ test(b.value.pb == null);
+ test(b.value.ice_id().equals("::Test::B"));
+
+ test(ret != null);
+ test(ret.sb.equals("B.sb (2)"));
+ test(ret.pb == null);
+ test(ret.ice_id().equals("::Test::B"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("remainder unmarshaling (4 instances) (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_paramTest4I cb = new Callback_TestIntf_paramTest4I();
+ test.begin_paramTest4(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("param ptr slicing, instance marshaled in unknown derived as base... ");
+ out.flush();
+ {
+ try
+ {
+ B b1 = new B();
+ b1.sb = "B.sb(1)";
+ b1.pb = b1;
+
+ D3 d3 = new D3();
+ d3.sb = "D3.sb";
+ d3.pb = d3;
+ d3.sd3 = "D3.sd3";
+ d3.pd3 = b1;
+
+ B b2 = new B();
+ b2.sb = "B.sb(2)";
+ b2.pb = b1;
+
+ B r = test.returnTest3(d3, b2);
+
+ test(r != null);
+ test(r.ice_id().equals("::Test::B"));
+ test(r.sb.equals("D3.sb"));
+ test(r.pb == r);
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("param ptr slicing, instance marshaled in unknown derived as base (AMI)... ");
+ out.flush();
+ {
+ B b1 = new B();
+ b1.sb = "B.sb(1)";
+ b1.pb = b1;
+
+ D3 d3 = new D3();
+ d3.sb = "D3.sb";
+ d3.pb = d3;
+ d3.sd3 = "D3.sd3";
+ d3.pd3 = b1;
+
+ B b2 = new B();
+ b2.sb = "B.sb(2)";
+ b2.pb = b1;
+
+ Callback_TestIntf_returnTest3I cb = new Callback_TestIntf_returnTest3I();
+ test.begin_returnTest3(d3, b2, cb);
+ cb.check();
+ B r = cb.r;
+
+ test(r != null);
+ test(r.ice_id().equals("::Test::B"));
+ test(r.sb.equals("D3.sb"));
+ test(r.pb == r);
+ }
+ out.println("ok");
+
+ out.print("param ptr slicing, instance marshaled in unknown derived as derived... ");
+ out.flush();
+ {
+ try
+ {
+ D1 d11 = new D1();
+ d11.sb = "D1.sb(1)";
+ d11.pb = d11;
+ d11.sd1 = "D1.sd1(1)";
+
+ D3 d3 = new D3();
+ d3.sb = "D3.sb";
+ d3.pb = d3;
+ d3.sd3 = "D3.sd3";
+ d3.pd3 = d11;
+
+ D1 d12 = new D1();
+ d12.sb = "D1.sb(2)";
+ d12.pb = d12;
+ d12.sd1 = "D1.sd1(2)";
+ d12.pd1 = d11;
+
+ B r = test.returnTest3(d3, d12);
+ test(r != null);
+ test(r.ice_id().equals("::Test::B"));
+ test(r.sb.equals("D3.sb"));
+ test(r.pb == r);
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("param ptr slicing, instance marshaled in unknown derived as derived (AMI)... ");
+ out.flush();
+ {
+ D1 d11 = new D1();
+ d11.sb = "D1.sb(1)";
+ d11.pb = d11;
+ d11.sd1 = "D1.sd1(1)";
+
+ D3 d3 = new D3();
+ d3.sb = "D3.sb";
+ d3.pb = d3;
+ d3.sd3 = "D3.sd3";
+ d3.pd3 = d11;
+
+ D1 d12 = new D1();
+ d12.sb = "D1.sb(2)";
+ d12.pb = d12;
+ d12.sd1 = "D1.sd1(2)";
+ d12.pd1 = d11;
+
+ Callback_TestIntf_returnTest3I cb = new Callback_TestIntf_returnTest3I();
+ test.begin_returnTest3(d3, d12, cb);
+ cb.check();
+ B r = cb.r;
+
+ test(r != null);
+ test(r.ice_id().equals("::Test::B"));
+ test(r.sb.equals("D3.sb"));
+ test(r.pb == r);
+ }
+ out.println("ok");
+
+ out.print("sequence slicing... ");
+ out.flush();
+ {
+ try
+ {
+ SS3 ss;
+ {
+ B ss1b = new B();
+ ss1b.sb = "B.sb";
+ ss1b.pb = ss1b;
+
+ D1 ss1d1 = new D1();
+ ss1d1.sb = "D1.sb";
+ ss1d1.sd1 = "D1.sd1";
+ ss1d1.pb = ss1b;
+
+ D3 ss1d3 = new D3();
+ ss1d3.sb = "D3.sb";
+ ss1d3.sd3 = "D3.sd3";
+ ss1d3.pb = ss1b;
+
+ B ss2b = new B();
+ ss2b.sb = "B.sb";
+ ss2b.pb = ss1b;
+
+ D1 ss2d1 = new D1();
+ ss2d1.sb = "D1.sb";
+ ss2d1.sd1 = "D1.sd1";
+ ss2d1.pb = ss2b;
+
+ D3 ss2d3 = new D3();
+ ss2d3.sb = "D3.sb";
+ ss2d3.sd3 = "D3.sd3";
+ ss2d3.pb = ss2b;
+
+ ss1d1.pd1 = ss2b;
+ ss1d3.pd3 = ss2d1;
+
+ ss2d1.pd1 = ss1d3;
+ ss2d3.pd3 = ss1d1;
+
+ SS1 ss1 = new SS1();
+ ss1.s = new B[3];
+ ss1.s[0] = ss1b;
+ ss1.s[1] = ss1d1;
+ ss1.s[2] = ss1d3;
+
+ SS2 ss2 = new SS2();
+ ss2.s = new B[3];
+ ss2.s[0] = ss2b;
+ ss2.s[1] = ss2d1;
+ ss2.s[2] = ss2d3;
+
+ ss = test.sequenceTest(ss1, ss2);
+ }
+
+ test(ss.c1 != null);
+ B ss1b = ss.c1.s[0];
+ B ss1d1 = ss.c1.s[1];
+ test(ss.c2 != null);
+ B ss1d3 = ss.c1.s[2];
+
+ test(ss.c2 != null);
+ B ss2b = ss.c2.s[0];
+ B ss2d1 = ss.c2.s[1];
+ B ss2d3 = ss.c2.s[2];
+
+ test(ss1b.pb == ss1b);
+ test(ss1d1.pb == ss1b);
+ test(ss1d3.pb == ss1b);
+
+ test(ss2b.pb == ss1b);
+ test(ss2d1.pb == ss2b);
+ test(ss2d3.pb == ss2b);
+
+ test(ss1b.ice_id().equals("::Test::B"));
+ test(ss1d1.ice_id().equals("::Test::D1"));
+ test(ss1d3.ice_id().equals("::Test::B"));
+
+ test(ss2b.ice_id().equals("::Test::B"));
+ test(ss2d1.ice_id().equals("::Test::D1"));
+ test(ss2d3.ice_id().equals("::Test::B"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("sequence slicing (AMI)... ");
+ out.flush();
+ {
+ SS3 ss;
+ {
+ B ss1b = new B();
+ ss1b.sb = "B.sb";
+ ss1b.pb = ss1b;
+
+ D1 ss1d1 = new D1();
+ ss1d1.sb = "D1.sb";
+ ss1d1.sd1 = "D1.sd1";
+ ss1d1.pb = ss1b;
+
+ D3 ss1d3 = new D3();
+ ss1d3.sb = "D3.sb";
+ ss1d3.sd3 = "D3.sd3";
+ ss1d3.pb = ss1b;
+
+ B ss2b = new B();
+ ss2b.sb = "B.sb";
+ ss2b.pb = ss1b;
+
+ D1 ss2d1 = new D1();
+ ss2d1.sb = "D1.sb";
+ ss2d1.sd1 = "D1.sd1";
+ ss2d1.pb = ss2b;
+
+ D3 ss2d3 = new D3();
+ ss2d3.sb = "D3.sb";
+ ss2d3.sd3 = "D3.sd3";
+ ss2d3.pb = ss2b;
+
+ ss1d1.pd1 = ss2b;
+ ss1d3.pd3 = ss2d1;
+
+ ss2d1.pd1 = ss1d3;
+ ss2d3.pd3 = ss1d1;
+
+ SS1 ss1 = new SS1();
+ ss1.s = new B[3];
+ ss1.s[0] = ss1b;
+ ss1.s[1] = ss1d1;
+ ss1.s[2] = ss1d3;
+
+ SS2 ss2 = new SS2();
+ ss2.s = new B[3];
+ ss2.s[0] = ss2b;
+ ss2.s[1] = ss2d1;
+ ss2.s[2] = ss2d3;
+
+ Callback_TestIntf_sequenceTestI cb = new Callback_TestIntf_sequenceTestI();
+ test.begin_sequenceTest(ss1, ss2, cb);
+ cb.check();
+ ss = cb.r;
+ }
+ test(ss.c1 != null);
+ B ss1b = ss.c1.s[0];
+ B ss1d1 = ss.c1.s[1];
+ test(ss.c2 != null);
+ B ss1d3 = ss.c1.s[2];
+
+ test(ss.c2 != null);
+ B ss2b = ss.c2.s[0];
+ B ss2d1 = ss.c2.s[1];
+ B ss2d3 = ss.c2.s[2];
+
+ test(ss1b.pb == ss1b);
+ test(ss1d1.pb == ss1b);
+ test(ss1d3.pb == ss1b);
+
+ test(ss2b.pb == ss1b);
+ test(ss2d1.pb == ss2b);
+ test(ss2d3.pb == ss2b);
+
+ test(ss1b.ice_id().equals("::Test::B"));
+ test(ss1d1.ice_id().equals("::Test::D1"));
+ test(ss1d3.ice_id().equals("::Test::B"));
+
+ test(ss2b.ice_id().equals("::Test::B"));
+ test(ss2d1.ice_id().equals("::Test::D1"));
+ test(ss2d3.ice_id().equals("::Test::B"));
+ }
+ out.println("ok");
+
+ out.print("dictionary slicing... ");
+ out.flush();
+ {
+ try
+ {
+ java.util.IdentityHashMap<Integer, B> bin = new java.util.IdentityHashMap<Integer, B>();
+ BDictHolder boutH = new BDictHolder();
+ java.util.Map<Integer, B> r;
+ int i;
+ for(i = 0; i < 10; ++i)
+ {
+ String s = "D1." + new Integer(i).toString();
+ D1 d1 = new D1();
+ d1.sb = s;
+ d1.pb = d1;
+ d1.sd1 = s;
+ bin.put(i, d1);
+ }
+
+ r = test.dictionaryTest(bin, boutH);
+
+ test(boutH.value.size() == 10);
+ for(i = 0; i < 10; ++i)
+ {
+ B b = boutH.value.get(i * 10);
+ test(b != null);
+ String s = "D1." + new Integer(i).toString();
+ test(b.sb.equals(s));
+ test(b.pb != null);
+ test(b.pb != b);
+ test(b.pb.sb.equals(s));
+ test(b.pb.pb == b.pb);
+ }
+
+ test(r.size() == 10);
+ for(i = 0; i < 10; ++i)
+ {
+ B b = r.get(i * 20);
+ test(b != null);
+ String s = "D1." + new Integer(i * 20).toString();
+ test(b.sb.equals(s));
+ test(b.pb == (i == 0 ? null : r.get((i - 1) * 20)));
+ D1 d1 = (D1)b;
+ test(d1 != null);
+ test(d1.sd1.equals(s));
+ test(d1.pd1 == d1);
+ }
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("dictionary slicing (AMI)... ");
+ out.flush();
+ {
+ java.util.Map<Integer, B> bin = new java.util.HashMap<Integer, B>();
+ java.util.Map<Integer, B> bout;
+ java.util.Map<Integer, B> r;
+ int i;
+ for(i = 0; i < 10; ++i)
+ {
+ String s = "D1." + new Integer(i).toString();
+ D1 d1 = new D1();
+ d1.sb = s;
+ d1.pb = d1;
+ d1.sd1 = s;
+ bin.put(i, d1);
+ }
+
+ Callback_TestIntf_dictionaryTestI cb = new Callback_TestIntf_dictionaryTestI();
+ test.begin_dictionaryTest(bin, cb);
+ cb.check();
+ bout = cb.bout;
+ r = cb.r;
+
+ test(bout.size() == 10);
+ for(i = 0; i < 10; ++i)
+ {
+ B b = bout.get(i * 10);
+ test(b != null);
+ String s = "D1." + new Integer(i).toString();
+ test(b.sb.equals(s));
+ test(b.pb != null);
+ test(b.pb != b);
+ test(b.pb.sb.equals(s));
+ test(b.pb.pb == b.pb);
+ }
+
+ test(r.size() == 10);
+ for(i = 0; i < 10; ++i)
+ {
+ B b = r.get(i * 20);
+ test(b != null);
+ String s = "D1." + new Integer(i * 20).toString();
+ test(b.sb.equals(s));
+ test(b.pb == (i == 0 ? null : r.get((i - 1) * 20)));
+ D1 d1 = (D1)b;
+ test(d1 != null);
+ test(d1.sd1.equals(s));
+ test(d1.pd1 == d1);
+ }
+ }
+ out.println("ok");
+
+ out.print("base exception thrown as base exception... ");
+ out.flush();
+ {
+ try
+ {
+ test.throwBaseAsBase();
+ test(false);
+ }
+ catch(BaseException e)
+ {
+ test(e.ice_id().equals("::Test::BaseException"));
+ test(e.sbe.equals("sbe"));
+ test(e.pb != null);
+ test(e.pb.sb.equals("sb"));
+ test(e.pb.pb == e.pb);
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("base exception thrown as base exception (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_throwBaseAsBaseI cb = new Callback_TestIntf_throwBaseAsBaseI();
+ test.begin_throwBaseAsBase(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("derived exception thrown as base exception... ");
+ out.flush();
+ {
+ try
+ {
+ test.throwDerivedAsBase();
+ test(false);
+ }
+ catch(DerivedException e)
+ {
+ test(e.ice_id().equals("::Test::DerivedException"));
+ test(e.sbe.equals("sbe"));
+ test(e.pb != null);
+ test(e.pb.sb.equals("sb1"));
+ test(e.pb.pb == e.pb);
+ test(e.sde.equals("sde1"));
+ test(e.pd1 != null);
+ test(e.pd1.sb.equals("sb2"));
+ test(e.pd1.pb == e.pd1);
+ test(e.pd1.sd1.equals("sd2"));
+ test(e.pd1.pd1 == e.pd1);
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("derived exception thrown as base exception (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_throwDerivedAsBaseI cb = new Callback_TestIntf_throwDerivedAsBaseI();
+ test.begin_throwDerivedAsBase(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("derived exception thrown as derived exception... ");
+ out.flush();
+ {
+ try
+ {
+ test.throwDerivedAsDerived();
+ test(false);
+ }
+ catch(DerivedException e)
+ {
+ test(e.ice_id().equals("::Test::DerivedException"));
+ test(e.sbe.equals("sbe"));
+ test(e.pb != null);
+ test(e.pb.sb.equals("sb1"));
+ test(e.pb.pb == e.pb);
+ test(e.sde.equals("sde1"));
+ test(e.pd1 != null);
+ test(e.pd1.sb.equals("sb2"));
+ test(e.pd1.pb == e.pd1);
+ test(e.pd1.sd1.equals("sd2"));
+ test(e.pd1.pd1 == e.pd1);
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("derived exception thrown as derived exception (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_throwDerivedAsDerivedI cb = new Callback_TestIntf_throwDerivedAsDerivedI();
+ test.begin_throwDerivedAsDerived(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("unknown derived exception thrown as base exception... ");
+ out.flush();
+ {
+ try
+ {
+ test.throwUnknownDerivedAsBase();
+ test(false);
+ }
+ catch(BaseException e)
+ {
+ test(e.ice_id().equals("::Test::BaseException"));
+ test(e.sbe.equals("sbe"));
+ test(e.pb != null);
+ test(e.pb.sb.equals("sb d2"));
+ test(e.pb.pb == e.pb);
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("unknown derived exception thrown as base exception (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_throwUnknownDerivedAsBaseI cb = new Callback_TestIntf_throwUnknownDerivedAsBaseI();
+ test.begin_throwUnknownDerivedAsBase(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("forward-declared class... ");
+ out.flush();
+ {
+ try
+ {
+ ForwardHolder f = new ForwardHolder();
+ test.useForward(f);
+ test(f.value != null);
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("forward-declared class (AMI)... ");
+ out.flush();
+ {
+ Callback_TestIntf_useForwardI cb = new Callback_TestIntf_useForwardI();
+ test.begin_useForward(cb);
+ cb.check();
+ }
+ out.println("ok");
+
+ out.print("preserved classes... ");
+ out.flush();
+
+ //
+ // Register a factory in order to substitute our own subclass of Preserved. This provides
+ // an easy way to determine how many unmarshaled instances currently exist.
+ //
+ // TODO: We have to install this now (even though it's not necessary yet), because otherwise
+ // the Ice run time will install its own internal factory for Preserved upon receiving the
+ // first instance.
+ //
+ communicator.getValueFactoryManager().add(new PreservedFactoryI(), Preserved.ice_staticId());
+
+ try
+ {
+ //
+ // Server knows the most-derived class PDerived.
+ //
+ PDerived pd = new PDerived();
+ pd.pi = 3;
+ pd.ps = "preserved";
+ pd.pb = pd;
+
+ PBase r = test.exchangePBase(pd);
+ PDerived p2 = (PDerived)r;
+ test(p2.pi == 3);
+ test(p2.ps.equals("preserved"));
+ test(p2.pb == p2);
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+
+ try
+ {
+ //
+ // Server only knows the base (non-preserved) type, so the object is sliced.
+ //
+ PCUnknown pu = new PCUnknown();
+ pu.pi = 3;
+ pu.pu = "preserved";
+
+ PBase r = test.exchangePBase(pu);
+ test(!(r instanceof PCUnknown));
+ test(r.pi == 3);
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+
+ try
+ {
+ //
+ // Server only knows the intermediate type Preserved. The object will be sliced to
+ // Preserved for the 1.0 encoding; otherwise it should be returned intact.
+ //
+ PCDerived pcd = new PCDerived();
+ pcd.pi = 3;
+ pcd.pbs = new PBase[] { pcd };
+
+ PBase r = test.exchangePBase(pcd);
+ if(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0))
+ {
+ test(!(r instanceof PCDerived));
+ test(r.pi == 3);
+ }
+ else
+ {
+ PCDerived p2 = (PCDerived)r;
+ test(p2.pi == 3);
+ test(p2.pbs[0] == p2);
+ }
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+
+ try
+ {
+ //
+ // Server only knows the intermediate type Preserved. The object will be sliced to
+ // Preserved for the 1.0 encoding; otherwise it should be returned intact.
+ //
+ CompactPCDerived pcd = new CompactPCDerived();
+ pcd.pi = 3;
+ pcd.pbs = new PBase[] { pcd };
+
+ PBase r = test.exchangePBase(pcd);
+ if(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0))
+ {
+ test(!(r instanceof CompactPCDerived));
+ test(r.pi == 3);
+ }
+ else
+ {
+ CompactPCDerived p2 = (CompactPCDerived)r;
+ test(p2.pi == 3);
+ test(p2.pbs[0] == p2);
+ }
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+
+ try
+ {
+ //
+ // Send an object that will have multiple preserved slices in the server.
+ // The object will be sliced to Preserved for the 1.0 encoding.
+ //
+ PCDerived3 pcd = new PCDerived3();
+ pcd.pi = 3;
+ //
+ // Sending more than 254 objects exercises the encoding for object ids.
+ //
+ pcd.pbs = new PBase[300];
+ int i;
+ for(i = 0; i < 300; ++i)
+ {
+ PCDerived2 p2 = new PCDerived2();
+ p2.pi = i;
+ p2.pbs = new PBase[] { null }; // Nil reference. This slice should not have an indirection table.
+ p2.pcd2 = i;
+ pcd.pbs[i] = p2;
+ }
+ pcd.pcd2 = pcd.pi;
+ pcd.pcd3 = pcd.pbs[10];
+
+ PBase r = test.exchangePBase(pcd);
+ if(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0))
+ {
+ test(!(r instanceof PCDerived3));
+ test(r instanceof Preserved);
+ test(r.pi == 3);
+ }
+ else
+ {
+ PCDerived3 p3 = (PCDerived3)r;
+ test(p3.pi == 3);
+ for(i = 0; i < 300; ++i)
+ {
+ PCDerived2 p2 = (PCDerived2)p3.pbs[i];
+ test(p2.pi == i);
+ test(p2.pbs.length == 1);
+ test(p2.pbs[0] == null);
+ test(p2.pcd2 == i);
+ }
+ test(p3.pcd2 == p3.pi);
+ test(p3.pcd3 == p3.pbs[10]);
+ }
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+
+ try
+ {
+ //
+ // Obtain an object with preserved slices and send it back to the server.
+ // The preserved slices should be excluded for the 1.0 encoding, otherwise
+ // they should be included.
+ //
+ Preserved p = test.PBSUnknownAsPreserved();
+ test.checkPBSUnknown(p);
+ if(!test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0))
+ {
+ ((TestIntfPrx)test.ice_encodingVersion(Ice.Util.Encoding_1_0)).checkPBSUnknown(p);
+ }
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+ out.println("ok");
+
+ out.print("preserved classes (AMI)... ");
+ out.flush();
+ try
+ {
+ //
+ // Server knows the most-derived class PDerived.
+ //
+ PDerived pd = new PDerived();
+ pd.pi = 3;
+ pd.ps = "preserved";
+ pd.pb = pd;
+
+ Callback_TestIntf_exchangePBaseI1 cb = new Callback_TestIntf_exchangePBaseI1();
+ test.begin_exchangePBase(pd, cb);
+ cb.check();
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+
+ try
+ {
+ //
+ // Server only knows the base (non-preserved) type, so the object is sliced.
+ //
+ PCUnknown pu = new PCUnknown();
+ pu.pi = 3;
+ pu.pu = "preserved";
+
+ Callback_TestIntf_exchangePBaseI2 cb = new Callback_TestIntf_exchangePBaseI2();
+ test.begin_exchangePBase(pu, cb);
+ cb.check();
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+
+ try
+ {
+ //
+ // Server only knows the intermediate type Preserved. The object will be sliced to
+ // Preserved for the 1.0 encoding; otherwise it should be returned intact.
+ //
+ PCDerived pcd = new PCDerived();
+ pcd.pi = 3;
+ pcd.pbs = new PBase[] { pcd };
+
+ if(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0))
+ {
+ Callback_TestIntf_exchangePBaseI3 cb = new Callback_TestIntf_exchangePBaseI3();
+ test.begin_exchangePBase(pcd, cb);
+ cb.check();
+ }
+ else
+ {
+ Callback_TestIntf_exchangePBaseI4 cb = new Callback_TestIntf_exchangePBaseI4();
+ test.begin_exchangePBase(pcd, cb);
+ cb.check();
+ }
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+
+ try
+ {
+ //
+ // Server only knows the intermediate type Preserved. The object will be sliced to
+ // Preserved for the 1.0 encoding; otherwise it should be returned intact.
+ //
+ CompactPCDerived pcd = new CompactPCDerived();
+ pcd.pi = 3;
+ pcd.pbs = new PBase[] { pcd };
+
+ if(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0))
+ {
+ Callback_TestIntf_exchangePBaseICompact1 cb = new Callback_TestIntf_exchangePBaseICompact1();
+ test.begin_exchangePBase(pcd, cb);
+ cb.check();
+ }
+ else
+ {
+ Callback_TestIntf_exchangePBaseICompact2 cb = new Callback_TestIntf_exchangePBaseICompact2();
+ test.begin_exchangePBase(pcd, cb);
+ cb.check();
+ }
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+
+ try
+ {
+ //
+ // Send an object that will have multiple preserved slices in the server.
+ // The object will be sliced to Preserved for the 1.0 encoding.
+ //
+ PCDerived3 pcd = new PCDerived3();
+ pcd.pi = 3;
+ //
+ // Sending more than 254 objects exercises the encoding for object ids.
+ //
+ pcd.pbs = new PBase[300];
+ int i;
+ for(i = 0; i < 300; ++i)
+ {
+ PCDerived2 p2 = new PCDerived2();
+ p2.pi = i;
+ p2.pbs = new PBase[] { null }; // Nil reference. This slice should not have an indirection table.
+ p2.pcd2 = i;
+ pcd.pbs[i] = p2;
+ }
+ pcd.pcd2 = pcd.pi;
+ pcd.pcd3 = pcd.pbs[10];
+
+ if(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0))
+ {
+ Callback_TestIntf_exchangePBaseI5 cb = new Callback_TestIntf_exchangePBaseI5();
+ test.begin_exchangePBase(pcd, cb);
+ cb.check();
+ }
+ else
+ {
+ Callback_TestIntf_exchangePBaseI6 cb = new Callback_TestIntf_exchangePBaseI6();
+ test.begin_exchangePBase(pcd, cb);
+ cb.check();
+ }
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+
+ try
+ {
+ //
+ // Obtain an object with preserved slices and send it back to the server.
+ // The preserved slices should be excluded for the 1.0 encoding, otherwise
+ // they should be included.
+ //
+ Preserved p = test.PBSUnknownAsPreserved();
+ test.checkPBSUnknown(p);
+ if(!test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0))
+ {
+ ((TestIntfPrx)test.ice_encodingVersion(Ice.Util.Encoding_1_0)).checkPBSUnknown(p);
+ }
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+
+ out.println("ok");
+
+ out.print("garbage collection for preserved classes... ");
+ out.flush();
+ try
+ {
+ //
+ // Register a factory in order to substitute our own subclass of PNode. This provides
+ // an easy way to determine how many unmarshaled instances currently exist.
+ //
+ communicator.getValueFactoryManager().add(new NodeFactoryI(), PNode.ice_staticId());
+
+ //
+ // Relay a graph through the server.
+ //
+ {
+ PNode c = new PNode();
+ c.next = new PNode();
+ c.next.next = new PNode();
+ c.next.next.next = c;
+
+ test(PNodeI.counter == 0);
+ test.exchangePNode(c);
+
+ test(PNodeI.counter == 3);
+ PNodeI.counter = 0;
+ }
+
+ //
+ // Obtain a preserved object from the server where the most-derived
+ // type is unknown. The preserved slice refers to a graph of PNode
+ // objects.
+ //
+ {
+ test(PNodeI.counter == 0);
+ Preserved p = test.PBSUnknownAsPreservedWithGraph();
+ test.checkPBSUnknownWithGraph(p);
+ test(PNodeI.counter == 3);
+ PNodeI.counter = 0;
+ }
+
+ //
+ // Obtain a preserved object from the server where the most-derived
+ // type is unknown. A data member in the preserved slice refers to the
+ // outer object, so the chain of references looks like this:
+ //
+ // outer.slicedData.outer
+ //
+ {
+ PreservedI.counter = 0;
+ Preserved p = test.PBSUnknown2AsPreservedWithGraph();
+ test.checkPBSUnknown2WithGraph(p);
+ test(PreservedI.counter == 1);
+ PreservedI.counter = 0;
+ }
+
+ //
+ // Throw a preserved exception where the most-derived type is unknown.
+ // The preserved exception slice contains a class data member. This
+ // object is also preserved, and its most-derived type is also unknown.
+ // The preserved slice of the object contains a class data member that
+ // refers to itself.
+ //
+ // The chain of references looks like this:
+ //
+ // ex.slicedData.obj.slicedData.obj
+ //
+ try
+ {
+ test(PreservedI.counter == 0);
+
+ try
+ {
+ test.throwPreservedException();
+ }
+ catch(PreservedException ex)
+ {
+ test(PreservedI.counter == 1);
+ }
+
+ PreservedI.counter = 0;
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+
+ out.println("ok");
+
+ return test;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/slicing/objects/Client.java b/java-compat/test/src/main/java/test/Ice/slicing/objects/Client.java
new file mode 100644
index 00000000000..f6eb48a34f0
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/slicing/objects/Client.java
@@ -0,0 +1,41 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.slicing.objects;
+
+import test.Ice.slicing.objects.client.Test.TestIntfPrx;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ TestIntfPrx test = AllTests.allTests(communicator, false, getWriter());
+ test.shutdown();
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.objects.client");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/slicing/objects/ClientPrivate.ice b/java-compat/test/src/main/java/test/Ice/slicing/objects/ClientPrivate.ice
new file mode 100644
index 00000000000..67f13f531c2
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/slicing/objects/ClientPrivate.ice
@@ -0,0 +1,215 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.slicing.objects.client"]]
+module Test
+{
+
+//
+// Duplicate types from Test.ice. We cannot use #include since
+// that will use the types from the same prefix.
+//
+
+class SBase
+{
+ string sb;
+};
+
+class SBSKnownDerived extends SBase
+{
+ string sbskd;
+};
+
+class B
+{
+ string sb;
+ B pb;
+};
+
+class D1 extends B
+{
+ string sd1;
+ B pd1;
+};
+
+sequence<B> BSeq;
+
+class SS1
+{
+ BSeq s;
+};
+
+class SS2
+{
+ BSeq s;
+};
+
+struct SS3
+{
+ SS1 c1;
+ SS2 c2;
+};
+
+dictionary<int, B> BDict;
+
+exception BaseException
+{
+ string sbe;
+ B pb;
+};
+
+exception DerivedException extends BaseException
+{
+ string sde;
+ D1 pd1;
+};
+
+class Forward; /* Forward-declared class defined in another compilation unit */
+
+class PBase
+{
+ int pi;
+};
+
+sequence<PBase> PBaseSeq;
+
+["preserve-slice"]
+class Preserved extends PBase
+{
+ string ps;
+};
+
+class PDerived extends Preserved
+{
+ PBase pb;
+};
+
+class CompactPDerived(56) extends Preserved
+{
+ PBase pb;
+};
+
+["preserve-slice"]
+class PNode
+{
+ PNode next;
+};
+
+["preserve-slice"]
+exception PreservedException
+{
+};
+
+["format:sliced"]
+interface TestIntf
+{
+ Object SBaseAsObject();
+ SBase SBaseAsSBase();
+ SBase SBSKnownDerivedAsSBase();
+ SBSKnownDerived SBSKnownDerivedAsSBSKnownDerived();
+
+ SBase SBSUnknownDerivedAsSBase();
+
+ ["format:compact"] SBase SBSUnknownDerivedAsSBaseCompact();
+
+ Object SUnknownAsObject();
+ void checkSUnknown(Object o);
+
+ B oneElementCycle();
+ B twoElementCycle();
+ B D1AsB();
+ D1 D1AsD1();
+ B D2AsB();
+
+ void paramTest1(out B p1, out B p2);
+ void paramTest2(out B p2, out B p1);
+ B paramTest3(out B p1, out B p2);
+ B paramTest4(out B p);
+
+ B returnTest1(out B p1, out B p2);
+ B returnTest2(out B p2, out B p1);
+ B returnTest3(B p1, B p2);
+
+ SS3 sequenceTest(SS1 p1, SS2 p2);
+
+ BDict dictionaryTest(BDict bin, out BDict bout);
+
+ PBase exchangePBase(PBase pb);
+
+ Preserved PBSUnknownAsPreserved();
+ void checkPBSUnknown(Preserved p);
+
+ ["amd"] Preserved PBSUnknownAsPreservedWithGraph();
+ void checkPBSUnknownWithGraph(Preserved p);
+
+ ["amd"] Preserved PBSUnknown2AsPreservedWithGraph();
+ void checkPBSUnknown2WithGraph(Preserved p);
+
+ PNode exchangePNode(PNode pn);
+
+ void throwBaseAsBase() throws BaseException;
+ void throwDerivedAsBase() throws BaseException;
+ void throwDerivedAsDerived() throws DerivedException;
+ void throwUnknownDerivedAsBase() throws BaseException;
+ ["amd"] void throwPreservedException() throws PreservedException;
+
+ void useForward(out Forward f); /* Use of forward-declared class to verify that code is generated correctly. */
+
+ void shutdown();
+};
+
+//
+// Types private to the client.
+//
+
+class D3 extends B
+{
+ string sd3;
+ B pd3;
+};
+
+["preserve-slice"]
+class PCUnknown extends PBase
+{
+ string pu;
+};
+
+class PCDerived extends PDerived
+{
+ PBaseSeq pbs;
+};
+
+class PCDerived2 extends PCDerived
+{
+ int pcd2;
+};
+
+class PCDerived3 extends PCDerived2
+{
+ Object pcd3;
+};
+
+class CompactPCDerived(57) extends CompactPDerived
+{
+ PBaseSeq pbs;
+};
+
+class Hidden
+{
+ Forward f;
+};
+
+class Forward
+{
+ Hidden h;
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/slicing/objects/Server.java b/java-compat/test/src/main/java/test/Ice/slicing/objects/Server.java
new file mode 100644
index 00000000000..629716506f6
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/slicing/objects/Server.java
@@ -0,0 +1,43 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.slicing.objects;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.Object object = new TestI();
+ adapter.add(object, Ice.Util.stringToIdentity("Test"));
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.objects.server");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/slicing/objects/ServerPrivate.ice b/java-compat/test/src/main/java/test/Ice/slicing/objects/ServerPrivate.ice
new file mode 100644
index 00000000000..3bd8e0acd45
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/slicing/objects/ServerPrivate.ice
@@ -0,0 +1,233 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.slicing.objects.server"]]
+module Test
+{
+
+//
+// Duplicate types from Test.ice. We cannot use #include since
+// that will use the types from the same prefix.
+//
+
+class SBase
+{
+ string sb;
+};
+
+class SBSKnownDerived extends SBase
+{
+ string sbskd;
+};
+
+class B
+{
+ string sb;
+ B pb;
+};
+
+class D1 extends B
+{
+ string sd1;
+ B pd1;
+};
+
+sequence<B> BSeq;
+
+class SS1
+{
+ BSeq s;
+};
+
+class SS2
+{
+ BSeq s;
+};
+
+struct SS3
+{
+ SS1 c1;
+ SS2 c2;
+};
+
+dictionary<int, B> BDict;
+
+exception BaseException
+{
+ string sbe;
+ B pb;
+};
+
+exception DerivedException extends BaseException
+{
+ string sde;
+ D1 pd1;
+};
+
+class Forward; /* Forward-declared class defined in another compilation unit */
+
+class PBase
+{
+ int pi;
+};
+
+sequence<PBase> PBaseSeq;
+
+["preserve-slice"]
+class Preserved extends PBase
+{
+ string ps;
+};
+
+class PDerived extends Preserved
+{
+ PBase pb;
+};
+
+class CompactPDerived(56) extends Preserved
+{
+ PBase pb;
+};
+
+["preserve-slice"]
+class PNode
+{
+ PNode next;
+};
+
+["preserve-slice"]
+exception PreservedException
+{
+};
+
+["format:sliced"]
+interface TestIntf
+{
+ Object SBaseAsObject();
+ SBase SBaseAsSBase();
+ SBase SBSKnownDerivedAsSBase();
+ SBSKnownDerived SBSKnownDerivedAsSBSKnownDerived();
+
+ SBase SBSUnknownDerivedAsSBase();
+
+ ["format:compact"] SBase SBSUnknownDerivedAsSBaseCompact();
+
+ Object SUnknownAsObject();
+ void checkSUnknown(Object o);
+
+ B oneElementCycle();
+ B twoElementCycle();
+ B D1AsB();
+ D1 D1AsD1();
+ B D2AsB();
+
+ void paramTest1(out B p1, out B p2);
+ void paramTest2(out B p2, out B p1);
+ B paramTest3(out B p1, out B p2);
+ B paramTest4(out B p);
+
+ B returnTest1(out B p1, out B p2);
+ B returnTest2(out B p2, out B p1);
+ B returnTest3(B p1, B p2);
+
+ SS3 sequenceTest(SS1 p1, SS2 p2);
+
+ BDict dictionaryTest(BDict bin, out BDict bout);
+
+ PBase exchangePBase(PBase pb);
+
+ Preserved PBSUnknownAsPreserved();
+ void checkPBSUnknown(Preserved p);
+
+ ["amd"] Preserved PBSUnknownAsPreservedWithGraph();
+ void checkPBSUnknownWithGraph(Preserved p);
+
+ ["amd"] Preserved PBSUnknown2AsPreservedWithGraph();
+ void checkPBSUnknown2WithGraph(Preserved p);
+
+ PNode exchangePNode(PNode pn);
+
+ void throwBaseAsBase() throws BaseException;
+ void throwDerivedAsBase() throws BaseException;
+ void throwDerivedAsDerived() throws DerivedException;
+ void throwUnknownDerivedAsBase() throws BaseException;
+ ["amd"] void throwPreservedException() throws PreservedException;
+
+ void useForward(out Forward f); /* Use of forward-declared class to verify that code is generated correctly. */
+
+ void shutdown();
+};
+
+//
+// Types private to the server.
+//
+
+class SBSUnknownDerived extends SBase
+{
+ string sbsud;
+};
+
+class SUnknown
+{
+ string su;
+};
+
+class D2 extends B
+{
+ string sd2;
+ B pd2;
+};
+
+class D4 extends B
+{
+ B p1;
+ B p2;
+};
+
+exception UnknownDerivedException extends BaseException
+{
+ string sude;
+ D2 pd2;
+};
+
+class MyClass
+{
+ int i;
+};
+
+class PSUnknown extends Preserved
+{
+ string psu;
+ PNode graph;
+ MyClass cl;
+};
+
+class PSUnknown2 extends Preserved
+{
+ PBase pb;
+};
+
+exception PSUnknownException extends PreservedException
+{
+ PSUnknown2 p;
+};
+
+class Hidden
+{
+ Forward f;
+};
+
+class Forward
+{
+ Hidden h;
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/slicing/objects/ServerPrivateAMD.ice b/java-compat/test/src/main/java/test/Ice/slicing/objects/ServerPrivateAMD.ice
new file mode 100644
index 00000000000..691510f5532
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/slicing/objects/ServerPrivateAMD.ice
@@ -0,0 +1,228 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.slicing.objects.serverAMD"]]
+module Test
+{
+
+//
+// Duplicate types from Test.ice. We cannot use #include since
+// that will use the types from the same prefix.
+//
+
+class SBase
+{
+ string sb;
+};
+
+class SBSKnownDerived extends SBase
+{
+ string sbskd;
+};
+
+class B
+{
+ string sb;
+ B pb;
+};
+
+class D1 extends B
+{
+ string sd1;
+ B pd1;
+};
+
+sequence<B> BSeq;
+
+class SS1
+{
+ BSeq s;
+};
+
+class SS2
+{
+ BSeq s;
+};
+
+struct SS3
+{
+ SS1 c1;
+ SS2 c2;
+};
+
+dictionary<int, B> BDict;
+
+exception BaseException
+{
+ string sbe;
+ B pb;
+};
+
+exception DerivedException extends BaseException
+{
+ string sde;
+ D1 pd1;
+};
+
+class Forward; // Forward-declared class defined in another compilation unit
+
+class PBase
+{
+ int pi;
+};
+
+sequence<PBase> PBaseSeq;
+
+["preserve-slice"]
+class Preserved extends PBase
+{
+ string ps;
+};
+
+class PDerived extends Preserved
+{
+ PBase pb;
+};
+
+["preserve-slice"]
+class PNode
+{
+ PNode next;
+};
+
+["preserve-slice"]
+exception PreservedException
+{
+};
+
+["amd", "format:sliced"]
+interface TestIntf
+{
+ Object SBaseAsObject();
+ SBase SBaseAsSBase();
+ SBase SBSKnownDerivedAsSBase();
+ SBSKnownDerived SBSKnownDerivedAsSBSKnownDerived();
+
+ SBase SBSUnknownDerivedAsSBase();
+
+ ["format:compact"] SBase SBSUnknownDerivedAsSBaseCompact();
+
+ Object SUnknownAsObject();
+ void checkSUnknown(Object o);
+
+ B oneElementCycle();
+ B twoElementCycle();
+ B D1AsB();
+ D1 D1AsD1();
+ B D2AsB();
+
+ void paramTest1(out B p1, out B p2);
+ void paramTest2(out B p2, out B p1);
+ B paramTest3(out B p1, out B p2);
+ B paramTest4(out B p);
+
+ B returnTest1(out B p1, out B p2);
+ B returnTest2(out B p2, out B p1);
+ B returnTest3(B p1, B p2);
+
+ SS3 sequenceTest(SS1 p1, SS2 p2);
+
+ BDict dictionaryTest(BDict bin, out BDict bout);
+
+ PBase exchangePBase(PBase pb);
+
+ Preserved PBSUnknownAsPreserved();
+ void checkPBSUnknown(Preserved p);
+
+ Preserved PBSUnknownAsPreservedWithGraph();
+ void checkPBSUnknownWithGraph(Preserved p);
+
+ Preserved PBSUnknown2AsPreservedWithGraph();
+ void checkPBSUnknown2WithGraph(Preserved p);
+
+ PNode exchangePNode(PNode pn);
+
+ void throwBaseAsBase() throws BaseException;
+ void throwDerivedAsBase() throws BaseException;
+ void throwDerivedAsDerived() throws DerivedException;
+ void throwUnknownDerivedAsBase() throws BaseException;
+ void throwPreservedException() throws PreservedException;
+
+ void useForward(out Forward f); /* Use of forward-declared class to verify that code is generated correctly. */
+
+ void shutdown();
+};
+
+//
+// Types private to the server.
+//
+
+class SBSUnknownDerived extends SBase
+{
+ string sbsud;
+};
+
+class SUnknown
+{
+ string su;
+};
+
+class D2 extends B
+{
+ string sd2;
+ B pd2;
+};
+
+class D4 extends B
+{
+ B p1;
+ B p2;
+};
+
+exception UnknownDerivedException extends BaseException
+{
+ string sude;
+ D2 pd2;
+};
+
+class MyClass
+{
+ int i;
+};
+
+class PSUnknown extends Preserved
+{
+ string psu;
+ PNode graph;
+ MyClass cl;
+};
+
+class PSUnknown2 extends Preserved
+{
+ PBase pb;
+};
+
+exception PSUnknownException extends PreservedException
+{
+ PSUnknown2 p;
+};
+
+class Hidden
+{
+ Forward f;
+};
+
+class Forward
+{
+ Hidden h;
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/slicing/objects/TestI.java b/java-compat/test/src/main/java/test/Ice/slicing/objects/TestI.java
new file mode 100644
index 00000000000..bdd69fa7dad
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/slicing/objects/TestI.java
@@ -0,0 +1,543 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.slicing.objects;
+
+import test.Ice.slicing.objects.server.Test.*;
+
+public final class TestI extends _TestIntfDisp
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+
+ @Override
+ public Ice.Object
+ SBaseAsObject(Ice.Current current)
+ {
+ SBase sb = new SBase();
+ sb.sb = "SBase.sb";
+ return sb;
+ }
+
+ @Override
+ public SBase
+ SBaseAsSBase(Ice.Current current)
+ {
+ SBase sb = new SBase();
+ sb.sb = "SBase.sb";
+ return sb;
+ }
+
+ @Override
+ public SBase
+ SBSKnownDerivedAsSBase(Ice.Current current)
+ {
+ SBSKnownDerived sbskd = new SBSKnownDerived();
+ sbskd.sb = "SBSKnownDerived.sb";
+ sbskd.sbskd = "SBSKnownDerived.sbskd";
+ return sbskd;
+ }
+
+ @Override
+ public SBSKnownDerived
+ SBSKnownDerivedAsSBSKnownDerived(Ice.Current current)
+ {
+ SBSKnownDerived sbskd = new SBSKnownDerived();
+ sbskd.sb = "SBSKnownDerived.sb";
+ sbskd.sbskd = "SBSKnownDerived.sbskd";
+ return sbskd;
+ }
+
+ @Override
+ public SBase
+ SBSUnknownDerivedAsSBase(Ice.Current current)
+ {
+ SBSUnknownDerived sbsud = new SBSUnknownDerived();
+ sbsud.sb = "SBSUnknownDerived.sb";
+ sbsud.sbsud = "SBSUnknownDerived.sbsud";
+ return sbsud;
+ }
+
+ @Override
+ public SBase
+ SBSUnknownDerivedAsSBaseCompact(Ice.Current current)
+ {
+ SBSUnknownDerived sbsud = new SBSUnknownDerived();
+ sbsud.sb = "SBSUnknownDerived.sb";
+ sbsud.sbsud = "SBSUnknownDerived.sbsud";
+ return sbsud;
+ }
+
+ @Override
+ public Ice.Object
+ SUnknownAsObject(Ice.Current current)
+ {
+ SUnknown su = new SUnknown();
+ su.su = "SUnknown.su";
+ return su;
+ }
+
+ @Override
+ public void
+ checkSUnknown(Ice.Object obj, Ice.Current current)
+ {
+ if(current.encoding.equals(Ice.Util.Encoding_1_0))
+ {
+ test(!(obj instanceof SUnknown));
+ }
+ else
+ {
+ SUnknown su = (SUnknown)obj;
+ test(su.su.equals("SUnknown.su"));
+ }
+ }
+
+ @Override
+ public B
+ oneElementCycle(Ice.Current current)
+ {
+ B b = new B();
+ b.sb = "B1.sb";
+ b.pb = b;
+ return b;
+ }
+
+ @Override
+ public B
+ twoElementCycle(Ice.Current current)
+ {
+ B b1 = new B();
+ b1.sb = "B1.sb";
+ B b2 = new B();
+ b2.sb = "B2.sb";
+ b2.pb = b1;
+ b1.pb = b2;
+ return b1;
+ }
+
+ @Override
+ public B
+ D1AsB(Ice.Current current)
+ {
+ D1 d1 = new D1();
+ d1.sb = "D1.sb";
+ d1.sd1 = "D1.sd1";
+ D2 d2 = new D2();
+ d2.pb = d1;
+ d2.sb = "D2.sb";
+ d2.sd2 = "D2.sd2";
+ d2.pd2 = d1;
+ d1.pb = d2;
+ d1.pd1 = d2;
+ return d1;
+ }
+
+ @Override
+ public D1
+ D1AsD1(Ice.Current current)
+ {
+ D1 d1 = new D1();
+ d1.sb = "D1.sb";
+ d1.sd1 = "D1.sd1";
+ D2 d2 = new D2();
+ d2.pb = d1;
+ d2.sb = "D2.sb";
+ d2.sd2 = "D2.sd2";
+ d2.pd2 = d1;
+ d1.pb = d2;
+ d1.pd1 = d2;
+ return d1;
+ }
+
+ @Override
+ public B
+ D2AsB(Ice.Current current)
+ {
+ D2 d2 = new D2();
+ d2.sb = "D2.sb";
+ d2.sd2 = "D2.sd2";
+ D1 d1 = new D1();
+ d1.pb = d2;
+ d1.sb = "D1.sb";
+ d1.sd1 = "D1.sd1";
+ d1.pd1 = d2;
+ d2.pb = d1;
+ d2.pd2 = d1;
+ return d2;
+ }
+
+ @Override
+ public void
+ paramTest1(BHolder p1, BHolder p2, Ice.Current current)
+ {
+ D1 d1 = new D1();
+ d1.sb = "D1.sb";
+ d1.sd1 = "D1.sd1";
+ D2 d2 = new D2();
+ d2.pb = d1;
+ d2.sb = "D2.sb";
+ d2.sd2 = "D2.sd2";
+ d2.pd2 = d1;
+ d1.pb = d2;
+ d1.pd1 = d2;
+ p1.value = d1;
+ p2.value = d2;
+ }
+
+ @Override
+ public void
+ paramTest2(BHolder p1, BHolder p2, Ice.Current current)
+ {
+ paramTest1(p2, p1, current);
+ }
+
+ @Override
+ public B
+ paramTest3(BHolder p1, BHolder p2, Ice.Current current)
+ {
+ D2 d2 = new D2();
+ d2.sb = "D2.sb (p1 1)";
+ d2.pb = null;
+ d2.sd2 = "D2.sd2 (p1 1)";
+ p1.value = d2;
+
+ D1 d1 = new D1();
+ d1.sb = "D1.sb (p1 2)";
+ d1.pb = null;
+ d1.sd1 = "D1.sd2 (p1 2)";
+ d1.pd1 = null;
+ d2.pd2 = d1;
+
+ D2 d4 = new D2();
+ d4.sb = "D2.sb (p2 1)";
+ d4.pb = null;
+ d4.sd2 = "D2.sd2 (p2 1)";
+ p2.value = d4;
+
+ D1 d3 = new D1();
+ d3.sb = "D1.sb (p2 2)";
+ d3.pb = null;
+ d3.sd1 = "D1.sd2 (p2 2)";
+ d3.pd1 = null;
+ d4.pd2 = d3;
+
+ return d3;
+ }
+
+ @Override
+ public B
+ paramTest4(BHolder p1, Ice.Current current)
+ {
+ D4 d4 = new D4();
+ d4.sb = "D4.sb (1)";
+ d4.pb = null;
+ d4.p1 = new B();
+ d4.p1.sb = "B.sb (1)";
+ d4.p2 = new B();
+ d4.p2.sb = "B.sb (2)";
+ p1.value = d4;
+ return d4.p2;
+ }
+
+ @Override
+ public B
+ returnTest1(BHolder p1, BHolder p2, Ice.Current current)
+ {
+ Ice.Current c;
+ paramTest1(p1, p2, current);
+ return p1.value;
+ }
+
+ @Override
+ public B
+ returnTest2(BHolder p1, BHolder p2, Ice.Current current)
+ {
+ Ice.Current c;
+ paramTest1(p2, p1, current);
+ return p1.value;
+ }
+
+ @Override
+ public B
+ returnTest3(B p1, B p2, Ice.Current current)
+ {
+ return p1;
+ }
+
+ @Override
+ public SS3
+ sequenceTest(SS1 p1, SS2 p2, Ice.Current current)
+ {
+ SS3 ss = new SS3();
+ ss.c1 = p1;
+ ss.c2 = p2;
+ return ss;
+ }
+
+ @Override
+ public java.util.Map<Integer, B>
+ dictionaryTest(java.util.Map<Integer, B> bin, BDictHolder bout, Ice.Current current)
+ {
+ bout.value = new java.util.HashMap<Integer, B>();
+ int i;
+ for(i = 0; i < 10; ++i)
+ {
+ B b = bin.get(i);
+ D2 d2 = new D2();
+ d2.sb = b.sb;
+ d2.pb = b.pb;
+ d2.sd2 = "D2";
+ d2.pd2 = d2;
+ bout.value.put(i * 10, d2);
+ }
+ java.util.Map<Integer, B> r = new java.util.HashMap<Integer, B>();
+ for(i = 0; i < 10; ++i)
+ {
+ String s = "D1." + new Integer(i * 20).toString();
+ D1 d1 = new D1();
+ d1.sb = s;
+ d1.pb = (i == 0 ? null : r.get((i - 1) * 20));
+ d1.sd1 = s;
+ d1.pd1 = d1;
+ r.put(i * 20, d1);
+ }
+ return r;
+ }
+
+ @Override
+ public PBase
+ exchangePBase(PBase pb, Ice.Current current)
+ {
+ return pb;
+ }
+
+ @Override
+ public Preserved
+ PBSUnknownAsPreserved(Ice.Current current)
+ {
+ PSUnknown r = new PSUnknown();
+ r.pi = 5;
+ r.ps = "preserved";
+ r.psu = "unknown";
+ r.graph = null;
+ if(!current.encoding.equals(Ice.Util.Encoding_1_0))
+ {
+ //
+ // 1.0 encoding doesn't support unmarshaling unknown classes even if referenced
+ // from unread slice.
+ //
+ r.cl = new MyClass(15);
+ }
+ return r;
+ }
+
+ @Override
+ public void
+ checkPBSUnknown(Preserved p, Ice.Current current)
+ {
+ if(current.encoding.equals(Ice.Util.Encoding_1_0))
+ {
+ test(!(p instanceof PSUnknown));
+ test(p.pi == 5);
+ test(p.ps.equals("preserved"));
+ }
+ else
+ {
+ PSUnknown pu = (PSUnknown)p;
+ test(pu.pi == 5);
+ test(pu.ps.equals("preserved"));
+ test(pu.psu.equals("unknown"));
+ test(pu.graph == null);
+ test(pu.cl != null && pu.cl.i == 15);
+ }
+ }
+
+ @Override
+ public void
+ PBSUnknownAsPreservedWithGraph_async(AMD_TestIntf_PBSUnknownAsPreservedWithGraph cb, Ice.Current current)
+ {
+ PSUnknown r = new PSUnknown();
+ r.pi = 5;
+ r.ps = "preserved";
+ r.psu = "unknown";
+ r.graph = new PNode();
+ r.graph.next = new PNode();
+ r.graph.next.next = new PNode();
+ r.graph.next.next.next = r.graph;
+ cb.ice_response(r);
+ r.graph.next.next.next = null; // Break the cycle.
+ }
+
+ @Override
+ public void
+ checkPBSUnknownWithGraph(Preserved p, Ice.Current current)
+ {
+ if(current.encoding.equals(Ice.Util.Encoding_1_0))
+ {
+ test(!(p instanceof PSUnknown));
+ test(p.pi == 5);
+ test(p.ps.equals("preserved"));
+ }
+ else
+ {
+ PSUnknown pu = (PSUnknown)p;
+ test(pu.pi == 5);
+ test(pu.ps.equals("preserved"));
+ test(pu.psu.equals("unknown"));
+ test(pu.graph != pu.graph.next);
+ test(pu.graph.next != pu.graph.next.next);
+ test(pu.graph.next.next.next == pu.graph);
+ pu.graph.next.next.next = null; // Break the cycle.
+ }
+ }
+
+ @Override
+ public void
+ PBSUnknown2AsPreservedWithGraph_async(AMD_TestIntf_PBSUnknown2AsPreservedWithGraph cb, Ice.Current current)
+ {
+ PSUnknown2 r = new PSUnknown2();
+ r.pi = 5;
+ r.ps = "preserved";
+ r.pb = r;
+ cb.ice_response(r);
+ r.pb = null; // Break the cycle.
+ }
+
+ @Override
+ public void
+ checkPBSUnknown2WithGraph(Preserved p, Ice.Current current)
+ {
+ if(current.encoding.equals(Ice.Util.Encoding_1_0))
+ {
+ test(!(p instanceof PSUnknown2));
+ test(p.pi == 5);
+ test(p.ps.equals("preserved"));
+ }
+ else
+ {
+ PSUnknown2 pu = (PSUnknown2)p;
+ test(pu.pi == 5);
+ test(pu.ps.equals("preserved"));
+ test(pu.pb == pu);
+ pu.pb = null; // Break the cycle.
+ }
+ }
+
+ @Override
+ public PNode
+ exchangePNode(PNode pn, Ice.Current current)
+ {
+ return pn;
+ }
+
+ @Override
+ public void
+ throwBaseAsBase(Ice.Current current)
+ throws BaseException
+ {
+ BaseException be = new BaseException();
+ be.sbe = "sbe";
+ be.pb = new B();
+ be.pb.sb = "sb";
+ be.pb.pb = be.pb;
+ throw be;
+ }
+
+ @Override
+ public void
+ throwDerivedAsBase(Ice.Current current)
+ throws BaseException
+ {
+ DerivedException de = new DerivedException();
+ de.sbe = "sbe";
+ de.pb = new B();
+ de.pb.sb = "sb1";
+ de.pb.pb = de.pb;
+ de.sde = "sde1";
+ de.pd1 = new D1();
+ de.pd1.sb = "sb2";
+ de.pd1.pb = de.pd1;
+ de.pd1.sd1 = "sd2";
+ de.pd1.pd1 = de.pd1;
+ throw de;
+ }
+
+ @Override
+ public void
+ throwDerivedAsDerived(Ice.Current current)
+ throws DerivedException
+ {
+ DerivedException de = new DerivedException();
+ de.sbe = "sbe";
+ de.pb = new B();
+ de.pb.sb = "sb1";
+ de.pb.pb = de.pb;
+ de.sde = "sde1";
+ de.pd1 = new D1();
+ de.pd1.sb = "sb2";
+ de.pd1.pb = de.pd1;
+ de.pd1.sd1 = "sd2";
+ de.pd1.pd1 = de.pd1;
+ throw de;
+ }
+
+ @Override
+ public void
+ throwUnknownDerivedAsBase(Ice.Current current)
+ throws BaseException
+ {
+ D2 d2 = new D2();
+ d2.sb = "sb d2";
+ d2.pb = d2;
+ d2.sd2 = "sd2 d2";
+ d2.pd2 = d2;
+
+ UnknownDerivedException ude = new UnknownDerivedException();
+ ude.sbe = "sbe";
+ ude.pb = d2;
+ ude.sude = "sude";
+ ude.pd2 = d2;
+ throw ude;
+ }
+
+ @Override
+ public void
+ throwPreservedException_async(AMD_TestIntf_throwPreservedException cb, Ice.Current current)
+ {
+ PSUnknownException ue = new PSUnknownException();
+ ue.p = new PSUnknown2();
+ ue.p.pi = 5;
+ ue.p.ps = "preserved";
+ ue.p.pb = ue.p;
+ cb.ice_exception(ue);
+ ue.p.pb = null; // Break the cycle.
+ }
+
+ @Override
+ public void
+ useForward(ForwardHolder f, Ice.Current current)
+ {
+ f.value = new Forward();
+ f.value.h = new Hidden();
+ f.value.h.f = f.value;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/slicing/objects/run.py b/java-compat/test/src/main/java/test/Ice/slicing/objects/run.py
new file mode 100755
index 00000000000..89a4d8598ea
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/slicing/objects/run.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.")
+
+TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.",
+ additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
+ additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
+
+TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True,
+ message = "Running test with sliced format and AMD server.",
+ server="test.Ice.slicing.objects.AMDServer")
+
+TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True,
+ message = "Running test with 1.0 encoding and AMD server.",
+ server="test.Ice.slicing.objects.AMDServer",
+ additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
+ additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
+
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/stream/Client.java b/java-compat/test/src/main/java/test/Ice/stream/Client.java
new file mode 100644
index 00000000000..b00dd482951
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/stream/Client.java
@@ -0,0 +1,861 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.stream;
+
+import java.io.PrintWriter;
+
+import Ice.BoolSeqHelper;
+import Ice.ByteSeqHelper;
+import Ice.DoubleSeqHelper;
+import Ice.FloatSeqHelper;
+import Ice.ShortSeqHelper;
+import Ice.IntSeqHelper;
+import Ice.LongSeqHelper;
+import Ice.StringSeqHelper;
+import test.Ice.stream.Test.*;
+
+public class Client extends test.Util.Application
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private static class TestObjectWriter extends Ice.ObjectWriter
+ {
+ TestObjectWriter(MyClass obj)
+ {
+ this.obj = obj;
+ }
+
+ @Override
+ public void
+ write(Ice.OutputStream out)
+ {
+ obj.__write(out);
+ called = true;
+ }
+
+ MyClass obj;
+ boolean called = false;
+ }
+
+ private static class TestObjectReader extends Ice.ObjectReader
+ {
+ @Override
+ public void
+ read(Ice.InputStream in)
+ {
+ obj = new MyClass();
+ obj.__read(in);
+ called = true;
+ }
+
+ MyClass obj;
+ boolean called = false;
+ }
+
+ private static class TestValueFactory implements Ice.ValueFactory
+ {
+ @Override
+ public Ice.Object
+ create(String type)
+ {
+ assert(type.equals(MyClass.ice_staticId()));
+ return new TestObjectReader();
+ }
+ }
+
+ private static class MyInterfaceI extends _MyInterfaceDisp
+ {
+ }
+
+ private static class MyInterfaceFactory implements Ice.ValueFactory
+ {
+ @Override
+ public Ice.Object
+ create(String type)
+ {
+ assert(type.equals(_MyInterfaceDisp.ice_staticId()));
+ return new MyInterfaceI();
+ }
+ }
+
+ private static class TestReadValueCallback implements Ice.ReadValueCallback
+ {
+ @Override
+ public void valueReady(Ice.Object obj)
+ {
+ this.obj = obj;
+ }
+
+ Ice.Object obj;
+ }
+
+ private static class MyClassFactoryWrapper implements Ice.ValueFactory
+ {
+ MyClassFactoryWrapper()
+ {
+ _factory = MyClass.ice_factory();
+ }
+
+ @Override
+ public Ice.Object
+ create(String type)
+ {
+ return _factory.create(type);
+ }
+
+ void
+ setFactory(Ice.ValueFactory factory)
+ {
+ if(factory == null)
+ {
+ _factory = MyClass.ice_factory();
+ }
+ else
+ {
+ _factory = factory;
+ }
+ }
+
+ private Ice.ValueFactory _factory;
+ }
+
+ @Override
+ public int
+ run(String[] args)
+ {
+ Ice.Communicator comm = communicator();
+ MyClassFactoryWrapper factoryWrapper = new MyClassFactoryWrapper();
+ comm.getValueFactoryManager().add(factoryWrapper, MyClass.ice_staticId());
+ comm.getValueFactoryManager().add(new MyInterfaceFactory(), _MyInterfaceDisp.ice_staticId());
+
+ Ice.InputStream in;
+ Ice.OutputStream out;
+
+ PrintWriter printWriter = getWriter();
+ printWriter.print("testing primitive types... ");
+ printWriter.flush();
+
+ {
+ byte[] data = new byte[0];
+ in = new Ice.InputStream(comm, data);
+ }
+
+ {
+ out = new Ice.OutputStream(comm);
+ out.startEncapsulation();
+ out.writeBool(true);
+ out.endEncapsulation();
+ byte[] data = out.finished();
+
+ in = new Ice.InputStream(comm, data);
+ in.startEncapsulation();
+ test(in.readBool());
+ in.endEncapsulation();
+ }
+
+ {
+ byte[] data = new byte[0];
+ in = new Ice.InputStream(comm, data);
+ try
+ {
+ in.readBool();
+ test(false);
+ }
+ catch(Ice.UnmarshalOutOfBoundsException ex)
+ {
+ }
+ }
+
+ {
+ out = new Ice.OutputStream(comm);
+ out.writeBool(true);
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ test(in.readBool());
+ }
+
+ {
+ out = new Ice.OutputStream(comm);
+ out.writeByte((byte)1);
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ test(in.readByte() == (byte)1);
+ }
+
+ {
+ out = new Ice.OutputStream(comm);
+ out.writeShort((short)2);
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ test(in.readShort() == (short)2);
+ }
+
+ {
+ out = new Ice.OutputStream(comm);
+ out.writeInt(3);
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ test(in.readInt() == 3);
+ }
+
+ {
+ out = new Ice.OutputStream(comm);
+ out.writeLong(4);
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ test(in.readLong() == 4);
+ }
+
+ {
+ out = new Ice.OutputStream(comm);
+ out.writeFloat((float)5.0);
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ test(in.readFloat() == (float)5.0);
+ }
+
+ {
+ out = new Ice.OutputStream(comm);
+ out.writeDouble(6.0);
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ test(in.readDouble() == 6.0);
+ }
+
+ {
+ out = new Ice.OutputStream(comm);
+ out.writeString("hello world");
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ test(in.readString().equals("hello world"));
+ }
+
+ printWriter.println("ok");
+
+ printWriter.print("testing constructed types... ");
+ printWriter.flush();
+
+ {
+ out = new Ice.OutputStream(comm);
+ MyEnum.write(out, MyEnum.enum3);
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ test(MyEnum.read(in) == MyEnum.enum3);
+ }
+
+ {
+ out = new Ice.OutputStream(comm);
+ SmallStruct s = new SmallStruct();
+ s.bo = true;
+ s.by = (byte)1;
+ s.sh = (short)2;
+ s.i = 3;
+ s.l = 4;
+ s.f = (float)5.0;
+ s.d = 6.0;
+ s.str = "7";
+ s.e = MyEnum.enum2;
+ s.p = MyClassPrxHelper.uncheckedCast(comm.stringToProxy("test:default"));
+ SmallStruct.write(out, s);
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ SmallStruct s2 = SmallStruct.read(in, null);
+ test(s2.equals(s));
+ }
+
+ {
+ out = new Ice.OutputStream(comm);
+ OptionalClass o = new OptionalClass();
+ o.bo = true;
+ o.by = (byte)5;
+ o.setSh((short)4);
+ o.setI(3);
+ out.writeValue(o);
+ out.writePendingValues();
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ TestReadValueCallback cb = new TestReadValueCallback();
+ in.readValue(cb);
+ in.readPendingValues();
+ OptionalClass o2 = (OptionalClass)cb.obj;
+ test(o2.bo == o.bo);
+ test(o2.by == o.by);
+ if(comm.getProperties().getProperty("Ice.Default.EncodingVersion").equals("1.0"))
+ {
+ test(!o2.hasSh());
+ test(!o2.hasI());
+ }
+ else
+ {
+ test(o2.getSh() == o.getSh());
+ test(o2.getI() == o.getI());
+ }
+ }
+
+ {
+ out = new Ice.OutputStream(comm, Ice.Util.Encoding_1_0);
+ OptionalClass o = new OptionalClass();
+ o.bo = true;
+ o.by = (byte)5;
+ o.setSh((short)4);
+ o.setI(3);
+ out.writeValue(o);
+ out.writePendingValues();
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, Ice.Util.Encoding_1_0, data);
+ TestReadValueCallback cb = new TestReadValueCallback();
+ in.readValue(cb);
+ in.readPendingValues();
+ OptionalClass o2 = (OptionalClass)cb.obj;
+ test(o2.bo == o.bo);
+ test(o2.by == o.by);
+ test(!o2.hasSh());
+ test(!o2.hasI());
+ }
+
+ {
+ final boolean[] arr =
+ {
+ true,
+ false,
+ true,
+ false
+ };
+ out = new Ice.OutputStream(comm);
+ BoolSeqHelper.write(out, arr);
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ boolean[] arr2 = BoolSeqHelper.read(in);
+ test(java.util.Arrays.equals(arr2, arr));
+
+ final boolean[][] arrS =
+ {
+ arr,
+ new boolean[0],
+ arr
+ };
+ out = new Ice.OutputStream(comm);
+ BoolSSHelper.write(out, arrS);
+ data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ boolean[][] arr2S = BoolSSHelper.read(in);
+ test(java.util.Arrays.deepEquals(arr2S, arrS));
+ }
+
+ {
+ final byte[] arr =
+ {
+ (byte)0x01,
+ (byte)0x11,
+ (byte)0x12,
+ (byte)0x22
+ };
+ out = new Ice.OutputStream(comm);
+ ByteSeqHelper.write(out, arr);
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ byte[] arr2 = ByteSeqHelper.read(in);
+ test(java.util.Arrays.equals(arr2, arr));
+
+ final byte[][] arrS =
+ {
+ arr,
+ new byte[0],
+ arr
+ };
+ out = new Ice.OutputStream(comm);
+ ByteSSHelper.write(out, arrS);
+ data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ byte[][] arr2S = ByteSSHelper.read(in);
+ test(java.util.Arrays.deepEquals(arr2S, arrS));
+ }
+
+ {
+ test.Ice.stream.Serialize.Small small = new test.Ice.stream.Serialize.Small();
+ small.i = 99;
+ out = new Ice.OutputStream(comm);
+ out.writeSerializable(small);
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ test.Ice.stream.Serialize.Small small2 = (test.Ice.stream.Serialize.Small)in.readSerializable();
+ test(small2.i == 99);
+ }
+
+ {
+ final short[] arr =
+ {
+ (short)0x01,
+ (short)0x11,
+ (short)0x12,
+ (short)0x22
+ };
+ out = new Ice.OutputStream(comm);
+ ShortSeqHelper.write(out, arr);
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ short[] arr2 = ShortSeqHelper.read(in);
+ test(java.util.Arrays.equals(arr2, arr));
+
+ final short[][] arrS =
+ {
+ arr,
+ new short[0],
+ arr
+ };
+ out = new Ice.OutputStream(comm);
+ ShortSSHelper.write(out, arrS);
+ data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ short[][] arr2S = ShortSSHelper.read(in);
+ test(java.util.Arrays.deepEquals(arr2S, arrS));
+ }
+
+ {
+ final int[] arr =
+ {
+ 0x01,
+ 0x11,
+ 0x12,
+ 0x22
+ };
+ out = new Ice.OutputStream(comm);
+ IntSeqHelper.write(out, arr);
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ int[] arr2 = IntSeqHelper.read(in);
+ test(java.util.Arrays.equals(arr2, arr));
+
+ final int[][] arrS =
+ {
+ arr,
+ new int[0],
+ arr
+ };
+ out = new Ice.OutputStream(comm);
+ IntSSHelper.write(out, arrS);
+ data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ int[][] arr2S = IntSSHelper.read(in);
+ test(java.util.Arrays.deepEquals(arr2S, arrS));
+ }
+
+ {
+ final long[] arr =
+ {
+ 0x01,
+ 0x11,
+ 0x12,
+ 0x22
+ };
+ out = new Ice.OutputStream(comm);
+ LongSeqHelper.write(out, arr);
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ long[] arr2 = LongSeqHelper.read(in);
+ test(java.util.Arrays.equals(arr2, arr));
+
+ final long[][] arrS =
+ {
+ arr,
+ new long[0],
+ arr
+ };
+ out = new Ice.OutputStream(comm);
+ LongSSHelper.write(out, arrS);
+ data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ long[][] arr2S = LongSSHelper.read(in);
+ test(java.util.Arrays.deepEquals(arr2S, arrS));
+ }
+
+ {
+ final float[] arr =
+ {
+ 1,
+ 2,
+ 3,
+ 4
+ };
+ out = new Ice.OutputStream(comm);
+ FloatSeqHelper.write(out, arr);
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ float[] arr2 = FloatSeqHelper.read(in);
+ test(java.util.Arrays.equals(arr2, arr));
+
+ final float[][] arrS =
+ {
+ arr,
+ new float[0],
+ arr
+ };
+ out = new Ice.OutputStream(comm);
+ FloatSSHelper.write(out, arrS);
+ data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ float[][] arr2S = FloatSSHelper.read(in);
+ test(java.util.Arrays.deepEquals(arr2S, arrS));
+ }
+
+ {
+ final double[] arr =
+ {
+ 1,
+ 2,
+ 3,
+ 4
+ };
+ out = new Ice.OutputStream(comm);
+ DoubleSeqHelper.write(out, arr);
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ double[] arr2 = DoubleSeqHelper.read(in);
+ test(java.util.Arrays.equals(arr2, arr));
+
+ final double[][] arrS =
+ {
+ arr,
+ new double[0],
+ arr
+ };
+ out = new Ice.OutputStream(comm);
+ DoubleSSHelper.write(out, arrS);
+ data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ double[][] arr2S = DoubleSSHelper.read(in);
+ test(java.util.Arrays.deepEquals(arr2S, arrS));
+ }
+
+ {
+ final String[] arr =
+ {
+ "string1",
+ "string2",
+ "string3",
+ "string4"
+ };
+ out = new Ice.OutputStream(comm);
+ StringSeqHelper.write(out, arr);
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ String[] arr2 = StringSeqHelper.read(in);
+ test(java.util.Arrays.equals(arr2, arr));
+
+ final String[][] arrS =
+ {
+ arr,
+ new String[0],
+ arr
+ };
+ out = new Ice.OutputStream(comm);
+ StringSSHelper.write(out, arrS);
+ data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ String[][] arr2S = StringSSHelper.read(in);
+ test(java.util.Arrays.deepEquals(arr2S, arrS));
+ }
+
+ {
+ final MyEnum[] arr =
+ {
+ MyEnum.enum3,
+ MyEnum.enum2,
+ MyEnum.enum1,
+ MyEnum.enum2
+ };
+ out = new Ice.OutputStream(comm);
+ MyEnumSHelper.write(out, arr);
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ MyEnum[] arr2 = MyEnumSHelper.read(in);
+ test(java.util.Arrays.equals(arr2, arr));
+
+ final MyEnum[][] arrS =
+ {
+ arr,
+ new MyEnum[0],
+ arr
+ };
+ out = new Ice.OutputStream(comm);
+ MyEnumSSHelper.write(out, arrS);
+ data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ MyEnum[][] arr2S = MyEnumSSHelper.read(in);
+ test(java.util.Arrays.deepEquals(arr2S, arrS));
+ }
+
+ {
+ MyClass[] arr = new MyClass[4];
+ for(int i = 0; i < arr.length; ++i)
+ {
+ arr[i] = new MyClass();
+ arr[i].c = arr[i];
+ arr[i].o = arr[i];
+ arr[i].s = new SmallStruct();
+ arr[i].s.e = MyEnum.enum2;
+ arr[i].seq1 = new boolean[] { true, false, true, false };
+ arr[i].seq2 = new byte[] { (byte)1, (byte)2, (byte)3, (byte)4 };
+ arr[i].seq3 = new short[] { (short)1, (short)2, (short)3, (short)4 };
+ arr[i].seq4 = new int[] { 1, 2, 3, 4 };
+ arr[i].seq5 = new long[] { 1, 2, 3, 4 };
+ arr[i].seq6 = new float[] { 1, 2, 3, 4 };
+ arr[i].seq7 = new double[] { 1, 2, 3, 4 };
+ arr[i].seq8 = new String[] { "string1", "string2", "string3", "string4" };
+ arr[i].seq9 = new MyEnum[] { MyEnum.enum3, MyEnum.enum2, MyEnum.enum1 };
+ arr[i].seq10 = new MyClass[4]; // null elements.
+ arr[i].d = new java.util.HashMap<String, MyClass>();
+ arr[i].d.put("hi", arr[i]);
+ }
+ out = new Ice.OutputStream(comm);
+ MyClassSHelper.write(out, arr);
+ out.writePendingValues();
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ MyClass[] arr2 = MyClassSHelper.read(in);
+ in.readPendingValues();
+ test(arr2.length == arr.length);
+ for(int i = 0; i < arr2.length; ++i)
+ {
+ test(arr2[i] != null);
+ test(arr2[i].c == arr2[i]);
+ test(arr2[i].o == arr2[i]);
+ test(arr2[i].s.e == MyEnum.enum2);
+ test(java.util.Arrays.equals(arr2[i].seq1, arr[i].seq1));
+ test(java.util.Arrays.equals(arr2[i].seq2, arr[i].seq2));
+ test(java.util.Arrays.equals(arr2[i].seq3, arr[i].seq3));
+ test(java.util.Arrays.equals(arr2[i].seq4, arr[i].seq4));
+ test(java.util.Arrays.equals(arr2[i].seq5, arr[i].seq5));
+ test(java.util.Arrays.equals(arr2[i].seq6, arr[i].seq6));
+ test(java.util.Arrays.equals(arr2[i].seq7, arr[i].seq7));
+ test(java.util.Arrays.equals(arr2[i].seq8, arr[i].seq8));
+ test(java.util.Arrays.equals(arr2[i].seq9, arr[i].seq9));
+ test(arr2[i].d.get("hi") == arr2[i]);
+ }
+
+ final MyClass[][] arrS =
+ {
+ arr,
+ new MyClass[0],
+ arr
+ };
+ out = new Ice.OutputStream(comm);
+ MyClassSSHelper.write(out, arrS);
+ data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ MyClass[][] arr2S = MyClassSSHelper.read(in);
+ test(arr2S.length == arrS.length);
+ test(arr2S[0].length == arrS[0].length);
+ test(arr2S[1].length == arrS[1].length);
+ test(arr2S[2].length == arrS[2].length);
+ }
+
+ {
+ MyInterface i = new MyInterfaceI();
+ out = new Ice.OutputStream(comm);
+ out.writeValue(i);
+ out.writePendingValues();
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ MyInterfaceHolder j = new MyInterfaceHolder();
+ in.readValue(j);
+ in.readPendingValues();
+ test(j.value != null);
+ }
+
+ {
+ out = new Ice.OutputStream(comm);
+ MyClass obj = new MyClass();
+ obj.s = new SmallStruct();
+ obj.s.e = MyEnum.enum2;
+ TestObjectWriter writer = new TestObjectWriter(obj);
+ out.writeValue(writer);
+ out.writePendingValues();
+ out.finished();
+ test(writer.called);
+ }
+
+ {
+ out = new Ice.OutputStream(comm);
+ MyClass obj = new MyClass();
+ obj.s = new SmallStruct();
+ obj.s.e = MyEnum.enum2;
+ TestObjectWriter writer = new TestObjectWriter(obj);
+ out.writeValue(writer);
+ out.writePendingValues();
+ byte[] data = out.finished();
+ test(writer.called);
+ factoryWrapper.setFactory(new TestValueFactory());
+ in = new Ice.InputStream(comm, data);
+ TestReadValueCallback cb = new TestReadValueCallback();
+ in.readValue(cb);
+ in.readPendingValues();
+ test(cb.obj != null);
+ test(cb.obj instanceof TestObjectReader);
+ TestObjectReader reader = (TestObjectReader)cb.obj;
+ test(reader.called);
+ test(reader.obj != null);
+ test(reader.obj.s.e == MyEnum.enum2);
+ factoryWrapper.setFactory(null);
+ }
+
+ {
+ out = new Ice.OutputStream(comm);
+ MyException ex = new MyException();
+
+ MyClass c = new MyClass();
+ c.c = c;
+ c.o = c;
+ c.s = new SmallStruct();
+ c.s.e = MyEnum.enum2;
+ c.seq1 = new boolean[] { true, false, true, false };
+ c.seq2 = new byte[] { (byte)1, (byte)2, (byte)3, (byte)4 };
+ c.seq3 = new short[] { (short)1, (short)2, (short)3, (short)4 };
+ c.seq4 = new int[] { 1, 2, 3, 4 };
+ c.seq5 = new long[] { 1, 2, 3, 4 };
+ c.seq6 = new float[] { 1, 2, 3, 4 };
+ c.seq7 = new double[] { 1, 2, 3, 4 };
+ c.seq8 = new String[] { "string1", "string2", "string3", "string4" };
+ c.seq9 = new MyEnum[] { MyEnum.enum3, MyEnum.enum2, MyEnum.enum1 };
+ c.seq10 = new MyClass[4]; // null elements.
+ c.d = new java.util.HashMap<String, MyClass>();
+ c.d.put("hi", c);
+
+ ex.c = c;
+
+ out.writeException(ex);
+ byte[] data = out.finished();
+
+ in = new Ice.InputStream(comm, data);
+ try
+ {
+ in.throwException();
+ test(false);
+ }
+ catch(MyException ex1)
+ {
+ test(ex1.c.s.e == c.s.e);
+ test(java.util.Arrays.equals(ex1.c.seq1, c.seq1));
+ test(java.util.Arrays.equals(ex1.c.seq2, c.seq2));
+ test(java.util.Arrays.equals(ex1.c.seq3, c.seq3));
+ test(java.util.Arrays.equals(ex1.c.seq4, c.seq4));
+ test(java.util.Arrays.equals(ex1.c.seq5, c.seq5));
+ test(java.util.Arrays.equals(ex1.c.seq6, c.seq6));
+ test(java.util.Arrays.equals(ex1.c.seq7, c.seq7));
+ test(java.util.Arrays.equals(ex1.c.seq8, c.seq8));
+ test(java.util.Arrays.equals(ex1.c.seq9, c.seq9));
+ }
+ catch(Ice.UserException ex1)
+ {
+ test(false);
+ }
+ }
+
+ {
+ java.util.Map<Byte, Boolean> dict = new java.util.HashMap<Byte, Boolean>();
+ dict.put((byte)4, true);
+ dict.put((byte)1, false);
+ out = new Ice.OutputStream(comm);
+ ByteBoolDHelper.write(out, dict);
+ byte data[] = out.finished();
+ in = new Ice.InputStream(comm, data);
+ java.util.Map<Byte, Boolean> dict2 = ByteBoolDHelper.read(in);
+ test(dict2.equals(dict));
+ }
+
+ {
+ java.util.Map<Short, Integer> dict = new java.util.HashMap<Short, Integer>();
+ dict.put((short)1, 9);
+ dict.put((short)4, 8);
+ out = new Ice.OutputStream(comm);
+ ShortIntDHelper.write(out, dict);
+ byte data[] = out.finished();
+ in = new Ice.InputStream(comm, data);
+ java.util.Map<Short, Integer> dict2 = ShortIntDHelper.read(in);
+ test(dict2.equals(dict));
+ }
+
+
+ {
+ java.util.Map<Long, Float> dict = new java.util.HashMap<Long, Float>();
+ dict.put((long)123809828, 0.51f);
+ dict.put((long)123809829, 0.56f);
+ out = new Ice.OutputStream(comm);
+ LongFloatDHelper.write(out, dict);
+ byte data[] = out.finished();
+ in = new Ice.InputStream(comm, data);
+ java.util.Map<Long, Float> dict2 = LongFloatDHelper.read(in);
+ test(dict2.equals(dict));
+ }
+
+ {
+ java.util.Map<String, String> dict = new java.util.HashMap<String, String>();
+ dict.put("key1", "value1");
+ dict.put("key2", "value2");
+ out = new Ice.OutputStream(comm);
+ StringStringDHelper.write(out, dict);
+ byte data[] = out.finished();
+ in = new Ice.InputStream(comm, data);
+ java.util.Map<String, String> dict2 = StringStringDHelper.read(in);
+ test(dict2.equals(dict));
+ }
+
+ {
+ java.util.Map<String, MyClass> dict = new java.util.HashMap<String, MyClass>();
+ MyClass c;
+ c = new MyClass();
+ c.s = new SmallStruct();
+ c.s.e = MyEnum.enum2;
+ dict.put("key1", c);
+ c = new MyClass();
+ c.s = new SmallStruct();
+ c.s.e = MyEnum.enum3;
+ dict.put("key2", c);
+ out = new Ice.OutputStream(comm);
+ StringMyClassDHelper.write(out, dict);
+ out.writePendingValues();
+ byte[] data = out.finished();
+ in = new Ice.InputStream(comm, data);
+ java.util.Map<String, MyClass> dict2 = StringMyClassDHelper.read(in);
+ in.readPendingValues();
+ test(dict2.size() == dict.size());
+ test(dict2.get("key1").s.e == MyEnum.enum2);
+ test(dict2.get("key2").s.e == MyEnum.enum3);
+ }
+
+ printWriter.println("ok");
+
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.stream");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/stream/Serialize/Small.java b/java-compat/test/src/main/java/test/Ice/stream/Serialize/Small.java
new file mode 100644
index 00000000000..7ac68322cd2
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/stream/Serialize/Small.java
@@ -0,0 +1,15 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.stream.Serialize;
+
+public class Small implements java.io.Serializable // Fewer than 254 bytes when serialized.
+{
+ public int i;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/stream/Test.ice b/java-compat/test/src/main/java/test/Ice/stream/Test.ice
new file mode 100644
index 00000000000..8302a9e342c
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/stream/Test.ice
@@ -0,0 +1,123 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+#include <Ice/BuiltinSequences.ice>
+
+[["java:package:test.Ice.stream"]]
+module Test
+{
+
+enum MyEnum
+{
+ enum1,
+ enum2,
+ enum3
+};
+
+class MyClass;
+
+["java:serializable:test.Ice.stream.Serialize.Small"] sequence<byte> SerialSmall;
+
+struct SmallStruct
+{
+ bool bo;
+ byte by;
+ short sh;
+ int i;
+ long l;
+ float f;
+ double d;
+ string str;
+ MyEnum e;
+ MyClass* p;
+ SerialSmall ss;
+};
+
+struct Point
+{
+ int x;
+ int y;
+};
+
+sequence<MyEnum> MyEnumS;
+sequence<MyClass> MyClassS;
+dictionary<byte, bool> ByteBoolD;
+dictionary<short, int> ShortIntD;
+dictionary<string, MyClass> StringMyClassD;
+
+class OptionalClass
+{
+ bool bo;
+ byte by;
+ optional(1) short sh;
+ optional(2) int i;
+ optional(3) SmallStruct sm;
+
+ optional(4) MyEnumS enumS4;
+ optional(5) MyClassS myClassS5;
+
+ optional(6) ByteBoolD byteBoolD6;
+ optional(7) ShortIntD shortIntD7;
+
+ optional(8) MyEnum enum8;
+ optional(9) MyClass class9;
+ optional(10) StringMyClassD stringMyClassD10;
+ optional(12) Ice::IntSeq intSeq12;
+ optional(13) Ice::ByteSeq byteSeq13;
+ optional(14) Ice::StringSeq stringSeq14;
+ optional(15) Point p15;
+};
+
+sequence<Ice::BoolSeq> BoolSS;
+sequence<Ice::ByteSeq> ByteSS;
+sequence<Ice::ShortSeq> ShortSS;
+sequence<Ice::IntSeq> IntSS;
+sequence<Ice::LongSeq> LongSS;
+sequence<Ice::FloatSeq> FloatSS;
+sequence<Ice::DoubleSeq> DoubleSS;
+sequence<Ice::StringSeq> StringSS;
+sequence<MyEnumS> MyEnumSS;
+sequence<MyClassS> MyClassSS;
+
+dictionary<long, float> LongFloatD;
+dictionary<string, string> StringStringD;
+
+class Bar;
+
+class MyClass
+{
+ MyClass c;
+ MyClass* prx;
+ Object o;
+ SmallStruct s;
+ Ice::BoolSeq seq1;
+ Ice::ByteSeq seq2;
+ Ice::ShortSeq seq3;
+ Ice::IntSeq seq4;
+ Ice::LongSeq seq5;
+ Ice::FloatSeq seq6;
+ Ice::DoubleSeq seq7;
+ Ice::StringSeq seq8;
+ MyEnumS seq9;
+ MyClassS seq10;
+ StringMyClassD d;
+};
+
+interface MyInterface
+{
+};
+
+exception MyException
+{
+ MyClass c;
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/stream/run.py b/java-compat/test/src/main/java/test/Ice/stream/run.py
new file mode 100755
index 00000000000..66636d7a5c1
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/stream/run.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+print("Running test with default encoding...")
+TestUtil.simpleTest("test.Ice.stream.Client")
+
+print("Running test with 1.0 encoding...")
+TestUtil.simpleTest("test.Ice.stream.Client", "--Ice.Default.EncodingVersion=1.0")
diff --git a/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Client.java b/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Client.java
new file mode 100644
index 00000000000..d9b17b4e55c
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Client.java
@@ -0,0 +1,50 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.threadPoolPriority;
+
+import test.Ice.threadPoolPriority.Test.PriorityPrx;
+import test.Ice.threadPoolPriority.Test.PriorityPrxHelper;
+
+public class Client extends test.Util.Application
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ @Override
+ public int run(String[] args)
+ {
+ java.io.PrintWriter out = getWriter();
+ Ice.ObjectPrx object = communicator().stringToProxy("test:default -p 12010 -t 10000");
+ PriorityPrx priority = PriorityPrxHelper.checkedCast(object);
+ out.print("testing thread priority... ");
+ out.flush();
+ int prio = priority.getPriority();
+ test(prio == 10);
+ out.println("ok");
+
+ priority.shutdown();
+ return 0;
+ }
+
+ public static void main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/threadPoolPriority/PriorityI.java b/java-compat/test/src/main/java/test/Ice/threadPoolPriority/PriorityI.java
new file mode 100644
index 00000000000..18579e7713a
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/threadPoolPriority/PriorityI.java
@@ -0,0 +1,20 @@
+
+package test.Ice.threadPoolPriority;
+
+import test.Ice.threadPoolPriority.Test._PriorityDisp;
+
+public class PriorityI extends _PriorityDisp
+{
+
+ @Override
+ public void shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+
+ @Override
+ public int getPriority(Ice.Current current)
+ {
+ return Thread.currentThread().getPriority();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Server.java b/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Server.java
new file mode 100644
index 00000000000..68ae4707319
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Server.java
@@ -0,0 +1,42 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.threadPoolPriority;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000:udp");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.add(new PriorityI(), Ice.Util.stringToIdentity("test"));
+ adapter.activate();
+
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.ThreadPool.Server.ThreadPriority", "10");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server c = new Server();
+ int status = c.main("Server", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Test.ice b/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Test.ice
new file mode 100644
index 00000000000..0b25a2e4ba5
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Test.ice
@@ -0,0 +1,22 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.threadPoolPriority"]]
+module Test
+{
+
+interface Priority
+{
+ void shutdown();
+ int getPriority();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/threadPoolPriority/run.py b/java-compat/test/src/main/java/test/Ice/threadPoolPriority/run.py
new file mode 100755
index 00000000000..97f9acd4094
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/threadPoolPriority/run.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/throughput/Client.java b/java-compat/test/src/main/java/test/Ice/throughput/Client.java
new file mode 100644
index 00000000000..22bfc5ce894
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/throughput/Client.java
@@ -0,0 +1,493 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.throughput;
+
+import java.io.PrintWriter;
+
+import test.Ice.throughput.Demo.ByteSeqSize;
+import test.Ice.throughput.Demo.Fixed;
+import test.Ice.throughput.Demo.FixedSeqSize;
+import test.Ice.throughput.Demo.StringDouble;
+import test.Ice.throughput.Demo.StringDoubleSeqSize;
+import test.Ice.throughput.Demo.StringSeqSize;
+import test.Ice.throughput.Demo.ThroughputPrx;
+import test.Ice.throughput.Demo.ThroughputPrxHelper;
+
+public class Client extends test.Util.Application
+{
+ class ShutdownHook extends Thread
+ {
+ @Override
+ public void
+ run()
+ {
+ try
+ {
+ communicator().destroy();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ private static void
+ menu()
+ {
+ System.out.println(
+ "usage:\n" +
+ "\n" +
+ "toggle type of data to send:\n" +
+ "1: sequence of bytes (default)\n" +
+ "2: sequence of strings (\"hello\")\n" +
+ "3: sequence of structs with a string (\"hello\") and a double\n" +
+ "4: sequence of structs with two ints and a double\n" +
+ "\n" +
+ "select test to run:\n" +
+ "t: Send sequence as twoway\n" +
+ "o: Send sequence as oneway\n" +
+ "r: Receive sequence\n" +
+ "e: Echo (send and receive) sequence\n" +
+ "\n" +
+ "other commands:\n" +
+ "s: shutdown server\n" +
+ "x: exit\n" +
+ "?: help\n");
+ }
+
+ @Override
+ public int
+ run(String[] args)
+ {
+ PrintWriter out = getWriter();
+ PrintWriter err = out;
+ if(args.length > 0)
+ {
+ err.println(appName() + ": too many arguments");
+ return 1;
+ }
+
+ //
+ // Since this is an interactive demo we want to clear the
+ // Application installed interrupt callback and install our
+ // own shutdown hook.
+ //
+ ThroughputPrx throughput = ThroughputPrxHelper.checkedCast(communicator().propertyToProxy("Throughput.Proxy"));
+ if(throughput == null)
+ {
+ err.println("invalid proxy");
+ return 1;
+ }
+ ThroughputPrx throughputOneway = ThroughputPrxHelper.uncheckedCast(throughput.ice_oneway());
+
+ byte[] byteSeq = new byte[ByteSeqSize.value];
+
+ String[] stringSeq = new String[StringSeqSize.value];
+ for(int i = 0; i < StringSeqSize.value; ++i)
+ {
+ stringSeq[i] = "hello";
+ }
+
+ StringDouble[] structSeq = new StringDouble[StringDoubleSeqSize.value];
+ for(int i = 0; i < StringDoubleSeqSize.value; ++i)
+ {
+ structSeq[i] = new StringDouble();
+ structSeq[i].s = "hello";
+ structSeq[i].d = 3.14;
+ }
+
+ Fixed[] fixedSeq = new Fixed[FixedSeqSize.value];
+ for(int i = 0; i < FixedSeqSize.value; ++i)
+ {
+ fixedSeq[i] = new Fixed();
+ fixedSeq[i].i = 0;
+ fixedSeq[i].j = 0;
+ fixedSeq[i].d = 0;
+ }
+
+ //
+ // A method needs to be invoked thousands of times before the
+ // JIT compiler will convert it to native code. To ensure an
+ // accurate throughput measurement, we need to "warm up" the
+ // JIT compiler.
+ //
+
+/*
+ {
+ byte[] emptyBytes= new byte[1];
+ String[] emptyStrings = new String[1];
+ StringDouble[] emptyStructs = new StringDouble[1];
+ emptyStructs[0] = new StringDouble();
+ Fixed[] emptyFixed = new Fixed[1];
+ emptyFixed[0] = new Fixed();
+
+ throughput.startWarmup();
+
+ out.print("warming up the client/server...");
+ out.flush();
+ for(int i = 0; i < 10000; i++)
+ {
+ throughput.sendByteSeq(emptyBytes);
+ throughput.sendStringSeq(emptyStrings);
+ throughput.sendStructSeq(emptyStructs);
+ throughput.sendFixedSeq(emptyFixed);
+
+ throughput.recvByteSeq();
+ throughput.recvStringSeq();
+ throughput.recvStructSeq();
+ throughput.recvFixedSeq();
+
+ throughput.echoByteSeq(emptyBytes);
+ throughput.echoStringSeq(emptyStrings);
+ throughput.echoStructSeq(emptyStructs);
+ throughput.echoFixedSeq(emptyFixed);
+ }
+ throughput.endWarmup();
+
+ out.println(" ok");
+ }
+*/
+
+ menu();
+
+ char currentType = '1';
+ int seqSize = ByteSeqSize.value;
+
+ // Initial ping to setup the connection.
+ throughput.ice_ping();
+
+ String[] input = { "t", "o", "r", "e", "s", "x", null };
+ int inputIndex = 0;
+ String line = null;
+ do
+ {
+ try
+ {
+ line = input[inputIndex++];
+
+ long tmsec = System.currentTimeMillis();
+ final int repetitions = 100;
+
+ if(line.equals("1") || line.equals("2") || line.equals("3") || line.equals("4"))
+ {
+ currentType = line.charAt(0);
+
+ switch(currentType)
+ {
+ case '1':
+ {
+ out.println("using byte sequences");
+ seqSize = ByteSeqSize.value;
+ break;
+ }
+
+ case '2':
+ {
+ out.println("using string sequences");
+ seqSize = StringSeqSize.value;
+ break;
+ }
+
+ case '3':
+ {
+ out.println("using variable-length struct sequences");
+ seqSize = StringDoubleSeqSize.value;
+ break;
+ }
+
+ case '4':
+ {
+ out.println("using fixed-length struct sequences");
+ seqSize = FixedSeqSize.value;
+ break;
+ }
+ }
+ }
+ else if(line.equals("t") || line.equals("o") || line.equals("r") || line.equals("e"))
+ {
+ char c = line.charAt(0);
+
+ switch(c)
+ {
+ case 't':
+ case 'o':
+ {
+ out.print("sending");
+ break;
+ }
+
+ case 'r':
+ {
+ out.print("receiving");
+ break;
+ }
+
+ case 'e':
+ {
+ out.print("sending and receiving");
+ break;
+ }
+ }
+
+ out.print(" " + repetitions);
+ switch(currentType)
+ {
+ case '1':
+ {
+ out.print(" byte");
+ break;
+ }
+
+ case '2':
+ {
+ out.print(" string");
+ break;
+ }
+
+ case '3':
+ {
+ out.print(" variable-length struct");
+ break;
+ }
+
+ case '4':
+ {
+ out.print(" fixed-length struct");
+ break;
+ }
+ }
+
+ out.print(" sequences of size " + seqSize);
+
+ if(c == 'o')
+ {
+ out.print(" as oneway");
+ }
+
+ out.println("...");
+ out.flush();
+
+ for(int i = 0; i < repetitions; ++i)
+ {
+ switch(currentType)
+ {
+ case '1':
+ {
+ switch(c)
+ {
+ case 't':
+ {
+ throughput.sendByteSeq(byteSeq);
+ break;
+ }
+
+ case 'o':
+ {
+ throughputOneway.sendByteSeq(byteSeq);
+ break;
+ }
+
+ case 'r':
+ {
+ throughput.recvByteSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput.echoByteSeq(byteSeq);
+ break;
+ }
+ }
+ break;
+ }
+
+ case '2':
+ {
+ switch(c)
+ {
+ case 't':
+ {
+ throughput.sendStringSeq(stringSeq);
+ break;
+ }
+
+ case 'o':
+ {
+ throughputOneway.sendStringSeq(stringSeq);
+ break;
+ }
+
+ case 'r':
+ {
+ throughput.recvStringSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput.echoStringSeq(stringSeq);
+ break;
+ }
+ }
+ break;
+ }
+
+ case '3':
+ {
+ switch(c)
+ {
+ case 't':
+ {
+ throughput.sendStructSeq(structSeq);
+ break;
+ }
+
+ case 'o':
+ {
+ throughputOneway.sendStructSeq(structSeq);
+ break;
+ }
+
+ case 'r':
+ {
+ throughput.recvStructSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput.echoStructSeq(structSeq);
+ break;
+ }
+ }
+ break;
+ }
+
+ case '4':
+ {
+ switch(c)
+ {
+ case 't':
+ {
+ throughput.sendFixedSeq(fixedSeq);
+ break;
+ }
+
+ case 'o':
+ {
+ throughputOneway.sendFixedSeq(fixedSeq);
+ break;
+ }
+
+ case 'r':
+ {
+ throughput.recvFixedSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput.echoFixedSeq(fixedSeq);
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ double dmsec = System.currentTimeMillis() - tmsec;
+ out.println("time for " + repetitions + " sequences: " + dmsec + "ms");
+ out.println("time per sequence: " + dmsec / repetitions + "ms");
+ out.flush();
+ int wireSize = 0;
+ switch(currentType)
+ {
+ case '1':
+ {
+ wireSize = 1;
+ break;
+ }
+
+ case '2':
+ {
+ wireSize = stringSeq[0].length();
+ break;
+ }
+
+ case '3':
+ {
+ wireSize = structSeq[0].s.length();
+ wireSize += 8; // Size of double on the wire.
+ break;
+ }
+
+ case '4':
+ {
+ wireSize = 16; // Size of two ints and a double on the wire.
+ break;
+ }
+ }
+ double mbit = repetitions * seqSize * wireSize * 8.0 / dmsec / 1000.0;
+ if(c == 'e')
+ {
+ mbit *= 2;
+ }
+ out.println("throughput: " + new java.text.DecimalFormat("#.##").format(mbit) + "Mbps");
+ out.flush();
+ }
+ else if(line.equals("s"))
+ {
+ throughput.shutdown();
+ }
+ else if(line.equals("x"))
+ {
+ // Nothing to do
+ }
+ else if(line.equals("?"))
+ {
+ menu();
+ }
+ else
+ {
+ out.println("unknown command `" + line + "'");
+ menu();
+ }
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ while(!line.equals("x"));
+
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Demo", "test.Ice.throughput");
+ initData.properties.setProperty("Throughput.Proxy", "throughput:default -p 10000 -h 127.0.0.1");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/throughput/Server.java b/java-compat/test/src/main/java/test/Ice/throughput/Server.java
new file mode 100644
index 00000000000..fb81f2fc963
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/throughput/Server.java
@@ -0,0 +1,41 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.throughput;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int
+ run(String[] args)
+ {
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Throughput");
+ adapter.add(new ThroughputI(), Ice.Util.stringToIdentity("throughput"));
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Demo", "test.Ice.throughput");
+ initData.properties.setProperty("Throughput.Endpoints", "default -p 10000 -h 127.0.0.1");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/throughput/Throughput.ice b/java-compat/test/src/main/java/test/Ice/throughput/Throughput.ice
new file mode 100644
index 00000000000..6a33c27c09b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/throughput/Throughput.ice
@@ -0,0 +1,66 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.throughput"]]
+module Demo
+{
+
+sequence<byte> ByteSeq;
+//const int ByteSeqSize = 500000;
+const int ByteSeqSize = 250000;
+
+sequence<string> StringSeq;
+const int StringSeqSize = 50000;
+
+struct StringDouble
+{
+ string s;
+ double d;
+};
+sequence<StringDouble> StringDoubleSeq;
+const int StringDoubleSeqSize = 50000;
+
+struct Fixed
+{
+ int i;
+ int j;
+ double d;
+};
+sequence<Fixed> FixedSeq;
+const int FixedSeqSize = 50000;
+
+interface Throughput
+{
+ bool needsWarmup();
+ void startWarmup();
+ void endWarmup();
+
+ void sendByteSeq(ByteSeq seq);
+ ByteSeq recvByteSeq();
+ ByteSeq echoByteSeq(ByteSeq seq);
+
+ void sendStringSeq(StringSeq seq);
+ StringSeq recvStringSeq();
+ StringSeq echoStringSeq(StringSeq seq);
+
+ void sendStructSeq(StringDoubleSeq seq);
+ StringDoubleSeq recvStructSeq();
+ StringDoubleSeq echoStructSeq(StringDoubleSeq seq);
+
+ void sendFixedSeq(FixedSeq seq);
+ FixedSeq recvFixedSeq();
+ FixedSeq echoFixedSeq(FixedSeq seq);
+
+ void shutdown();
+};
+
+};
+
diff --git a/java-compat/test/src/main/java/test/Ice/throughput/ThroughputI.java b/java-compat/test/src/main/java/test/Ice/throughput/ThroughputI.java
new file mode 100644
index 00000000000..dec3f3aef9d
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/throughput/ThroughputI.java
@@ -0,0 +1,201 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.throughput;
+
+import test.Ice.throughput.Demo.ByteSeqSize;
+import test.Ice.throughput.Demo.Fixed;
+import test.Ice.throughput.Demo.FixedSeqSize;
+import test.Ice.throughput.Demo.StringDouble;
+import test.Ice.throughput.Demo.StringDoubleSeqSize;
+import test.Ice.throughput.Demo.StringSeqSize;
+import test.Ice.throughput.Demo._ThroughputDisp;
+
+public final class ThroughputI extends _ThroughputDisp
+{
+ public
+ ThroughputI()
+ {
+ _byteSeq = new byte[ByteSeqSize.value];
+
+ _stringSeq = new String[StringSeqSize.value];
+ for(int i = 0; i < StringSeqSize.value; ++i)
+ {
+ _stringSeq[i] = "hello";
+ }
+
+ _structSeq = new StringDouble[StringDoubleSeqSize.value];
+ for(int i = 0; i < StringDoubleSeqSize.value; ++i)
+ {
+ _structSeq[i] = new StringDouble();
+ _structSeq[i].s = "hello";
+ _structSeq[i].d = 3.14;
+ }
+
+ _fixedSeq = new Fixed[FixedSeqSize.value];
+ for(int i = 0; i < FixedSeqSize.value; ++i)
+ {
+ _fixedSeq[i] = new Fixed();
+ _fixedSeq[i].i = 0;
+ _fixedSeq[i].j = 0;
+ _fixedSeq[i].d = 0;
+ }
+ }
+
+ @Override
+ public boolean
+ needsWarmup(Ice.Current current)
+ {
+ _warmup = false;
+ return _needsWarmup;
+ }
+
+ @Override
+ public void
+ startWarmup(Ice.Current current)
+ {
+ _warmup = true;
+ }
+
+ @Override
+ public void
+ endWarmup(Ice.Current current)
+ {
+ _warmup = false;
+ _needsWarmup = false;
+ }
+
+ @Override
+ public void
+ sendByteSeq(byte[] seq, Ice.Current current)
+ {
+ }
+
+ @Override
+ public byte[]
+ recvByteSeq(Ice.Current current)
+ {
+ if(_warmup)
+ {
+ return _emptyByteSeq;
+ }
+ else
+ {
+ return _byteSeq;
+ }
+ }
+
+ @Override
+ public byte[]
+ echoByteSeq(byte[] seq, Ice.Current current)
+ {
+ return seq;
+ }
+
+ @Override
+ public void
+ sendStringSeq(String[] seq, Ice.Current current)
+ {
+ }
+
+ @Override
+ public String[]
+ recvStringSeq(Ice.Current current)
+ {
+ if(_warmup)
+ {
+ return _emptyStringSeq;
+ }
+ else
+ {
+ return _stringSeq;
+ }
+ }
+
+ @Override
+ public String[]
+ echoStringSeq(String[] seq, Ice.Current current)
+ {
+ return seq;
+ }
+
+ @Override
+ public void
+ sendStructSeq(StringDouble[] seq, Ice.Current current)
+ {
+ }
+
+ @Override
+ public StringDouble[]
+ recvStructSeq(Ice.Current current)
+ {
+ if(_warmup)
+ {
+ return _emptyStructSeq;
+ }
+ else
+ {
+ return _structSeq;
+ }
+ }
+
+ @Override
+ public StringDouble[]
+ echoStructSeq(StringDouble[] seq, Ice.Current current)
+ {
+ return seq;
+ }
+
+ @Override
+ public void
+ sendFixedSeq(Fixed[] seq, Ice.Current current)
+ {
+ }
+
+ @Override
+ public Fixed[]
+ recvFixedSeq(Ice.Current current)
+ {
+ if(_warmup)
+ {
+ return _emptyFixedSeq;
+ }
+ else
+ {
+ return _fixedSeq;
+ }
+ }
+
+ @Override
+ public Fixed[]
+ echoFixedSeq(Fixed[] seq, Ice.Current current)
+ {
+ return seq;
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+
+ private byte[] _byteSeq;
+ private String[] _stringSeq;
+ private StringDouble[] _structSeq;
+ private Fixed[] _fixedSeq;
+
+ private byte[] _emptyByteSeq = new byte[0];
+ private String[] _emptyStringSeq = new String[0];
+ private StringDouble[] _emptyStructSeq = new StringDouble[0];
+ private Fixed[] _emptyFixedSeq = new Fixed[0];
+
+ private boolean _needsWarmup = true;
+ private boolean _warmup = false;
+}
diff --git a/java-compat/test/src/main/java/test/Ice/timeout/AllTests.java b/java-compat/test/src/main/java/test/Ice/timeout/AllTests.java
new file mode 100644
index 00000000000..facbe176e24
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/timeout/AllTests.java
@@ -0,0 +1,541 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.timeout;
+
+import java.io.PrintWriter;
+
+import test.Ice.timeout.Test.TimeoutPrx;
+import test.Ice.timeout.Test.TimeoutPrxHelper;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private static class Callback
+ {
+ Callback()
+ {
+ _called = false;
+ }
+
+ public synchronized void
+ check()
+ {
+ while(!_called)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ _called = false;
+ }
+
+ public synchronized void
+ called()
+ {
+ assert(!_called);
+ _called = true;
+ notify();
+ }
+
+ private boolean _called;
+ }
+
+ private static class CallbackSuccess extends Ice.Callback
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult result)
+ {
+ try
+ {
+ TimeoutPrx p = TimeoutPrxHelper.uncheckedCast(result.getProxy());
+ if(result.getOperation().equals("sendData"))
+ {
+ p.end_sendData(result);
+ }
+ else if(result.getOperation().equals("sleep"))
+ {
+ p.end_sleep(result);
+ }
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ callback.called();
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ private static class CallbackFail extends Ice.Callback
+ {
+ @Override
+ public void
+ completed(Ice.AsyncResult result)
+ {
+ try
+ {
+ TimeoutPrx p = TimeoutPrxHelper.uncheckedCast(result.getProxy());
+ if(result.getOperation().equals("sendData"))
+ {
+ p.end_sendData(result);
+ }
+ else if(result.getOperation().equals("sleep"))
+ {
+ p.end_sleep(result);
+ }
+ test(false);
+ }
+ catch(Ice.TimeoutException ex)
+ {
+ callback.called();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ }
+
+ public void
+ check()
+ {
+ callback.check();
+ }
+
+ private Callback callback = new Callback();
+ }
+
+ public static TimeoutPrx
+ allTests(test.Util.Application app)
+ {
+ Ice.Communicator communicator = app.communicator();
+ PrintWriter out = app.getWriter();
+
+ String sref = "timeout:default -p 12010";
+ Ice.ObjectPrx obj = communicator.stringToProxy(sref);
+ test(obj != null);
+
+ int mult = 1;
+ if(!communicator.getProperties().getPropertyWithDefault("Ice.Default.Protocol", "tcp").equals("tcp"))
+ {
+ mult = 4;
+ }
+
+ TimeoutPrx timeout = TimeoutPrxHelper.checkedCast(obj);
+ test(timeout != null);
+
+ out.print("testing connect timeout... ");
+ out.flush();
+ {
+ //
+ // Expect ConnectTimeoutException.
+ //
+ TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(100 * mult));
+ timeout.holdAdapter(500 * mult);
+ try
+ {
+ to.op();
+ test(false);
+ }
+ catch(Ice.ConnectTimeoutException ex)
+ {
+ // Expected.
+ }
+ }
+ {
+ //
+ // Expect success.
+ //
+ timeout.op(); // Ensure adapter is active.
+ TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000 * mult));
+ timeout.holdAdapter(500 * mult);
+ try
+ {
+ to.op();
+ }
+ catch(Ice.ConnectTimeoutException ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ // The sequence needs to be large enough to fill the write/recv buffers
+ int bufSize = 2000000;
+ byte[] seq = new byte[bufSize];
+
+ out.print("testing connection timeout... ");
+ out.flush();
+ {
+ //
+ // Expect TimeoutException.
+ //
+ TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(100));
+ timeout.holdAdapter(500 * mult);
+ try
+ {
+ to.sendData(seq);
+ test(false);
+ }
+ catch(Ice.TimeoutException ex)
+ {
+ // Expected.
+ }
+ }
+ {
+ //
+ // Expect success.
+ //
+ timeout.op(); // Ensure adapter is active.
+ TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000 * mult));
+ timeout.holdAdapter(500 * mult);
+ try
+ {
+ to.sendData(new byte[1000000]);
+ }
+ catch(Ice.TimeoutException ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
+
+ out.print("testing invocation timeout... ");
+ out.flush();
+ {
+ Ice.Connection connection = obj.ice_getConnection();
+ TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_invocationTimeout(100));
+ test(connection == to.ice_getConnection());
+ try
+ {
+ to.sleep(750 * mult);
+ test(false);
+ }
+ catch(Ice.InvocationTimeoutException ex)
+ {
+ }
+ obj.ice_ping();
+ to = TimeoutPrxHelper.checkedCast(obj.ice_invocationTimeout(500 * mult));
+ test(connection == to.ice_getConnection());
+ try
+ {
+ to.sleep(250 * mult);
+ }
+ catch(Ice.InvocationTimeoutException ex)
+ {
+ test(false);
+ }
+ test(connection == to.ice_getConnection());
+ }
+ {
+ //
+ // Expect InvocationTimeoutException.
+ //
+ TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_invocationTimeout(100));
+ CallbackFail cb = new CallbackFail();
+ to.begin_sleep(750 * mult, cb);
+ cb.check();
+ obj.ice_ping();
+ }
+ {
+ //
+ // Expect success.
+ //
+ TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_invocationTimeout(500 * mult));
+ CallbackSuccess cb = new CallbackSuccess();
+ to.begin_sleep(250 * mult, cb);
+ cb.check();
+ }
+ {
+ //
+ // Backward compatible connection timeouts
+ //
+ TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_invocationTimeout(-2).ice_timeout(100));
+ Ice.Connection con = null;
+ try
+ {
+ con = to.ice_getConnection();
+ to.sleep(750);
+ test(false);
+ }
+ catch(Ice.TimeoutException ex)
+ {
+ assert(con != null);
+ try
+ {
+ con.getInfo();
+ test(false);
+ }
+ catch(Ice.TimeoutException exc)
+ {
+ // Connection got closed as well.
+ }
+ }
+ obj.ice_ping();
+
+ try
+ {
+ con = to.ice_getConnection();
+ to.end_sleep(to.begin_sleep(750));
+ test(false);
+ }
+ catch(Ice.TimeoutException ex)
+ {
+ assert(con != null);
+ try
+ {
+ con.getInfo();
+ test(false);
+ }
+ catch(Ice.TimeoutException exc)
+ {
+ // Connection got closed as well.
+ }
+ }
+ obj.ice_ping();
+ }
+ out.println("ok");
+
+ out.print("testing close timeout... ");
+ out.flush();
+ {
+ TimeoutPrx to = TimeoutPrxHelper.checkedCast(obj.ice_timeout(100 * mult));
+ Ice.Connection connection = to.ice_getConnection();
+ timeout.holdAdapter(500);
+ connection.close(false);
+ try
+ {
+ connection.getInfo(); // getInfo() doesn't throw in the closing state.
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ try
+ {
+ Thread.sleep(500 * mult);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ try
+ {
+ connection.getInfo();
+ test(false);
+ }
+ catch(Ice.CloseConnectionException ex)
+ {
+ // Expected.
+ }
+ timeout.op(); // Ensure adapter is active.
+ }
+ out.println("ok");
+
+ out.print("testing timeout overrides... ");
+ out.flush();
+ {
+ //
+ // Test Ice.Override.Timeout. This property overrides all
+ // endpoint timeouts.
+ //
+ Ice.InitializationData initData = app.createInitializationData();
+ initData.properties = communicator.getProperties()._clone();
+ initData.properties.setProperty("Ice.Override.Timeout", "250");
+ Ice.Communicator comm = app.initialize(initData);
+ TimeoutPrx to = TimeoutPrxHelper.checkedCast(comm.stringToProxy(sref));
+ timeout.holdAdapter(700 * mult);
+ try
+ {
+ to.sendData(seq);
+ test(false);
+ }
+ catch(Ice.TimeoutException ex)
+ {
+ // Expected.
+ }
+ //
+ // Calling ice_timeout() should have no effect.
+ //
+ timeout.op(); // Ensure adapter is active.
+ to = TimeoutPrxHelper.checkedCast(to.ice_timeout(1000 * mult));
+ timeout.holdAdapter(500 * mult);
+ try
+ {
+ to.sendData(seq);
+ test(false);
+ }
+ catch(Ice.TimeoutException ex)
+ {
+ // Expected.
+ }
+ comm.destroy();
+ }
+ {
+ //
+ // Test Ice.Override.ConnectTimeout.
+ //
+ Ice.InitializationData initData = app.createInitializationData();
+ initData.properties = communicator.getProperties()._clone();
+ if(mult == 1)
+ {
+ initData.properties.setProperty("Ice.Override.ConnectTimeout", "250");
+ }
+ else
+ {
+ initData.properties.setProperty("Ice.Override.ConnectTimeout", "2500");
+ }
+
+ Ice.Communicator comm = app.initialize(initData);
+ TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(comm.stringToProxy(sref));
+ timeout.holdAdapter(750 * mult);
+ try
+ {
+ to.op();
+ test(false);
+ }
+ catch(Ice.ConnectTimeoutException ex)
+ {
+ // Expected.
+ }
+ //
+ // Calling ice_timeout() should have no effect on the connect timeout.
+ //
+ timeout.op(); // Ensure adapter is active.
+ timeout.holdAdapter(750 * mult);
+ to = TimeoutPrxHelper.uncheckedCast(to.ice_timeout(1000 * mult));
+ try
+ {
+ to.op();
+ test(false);
+ }
+ catch(Ice.ConnectTimeoutException ex)
+ {
+ // Expected.
+ }
+ //
+ // Verify that timeout set via ice_timeout() is still used for requests.
+ //
+ timeout.op(); // Ensure adapter is active.
+ to = TimeoutPrxHelper.uncheckedCast(to.ice_timeout(250));
+ to.ice_getConnection(); // Establish connection
+ timeout.holdAdapter(750 * mult);
+ try
+ {
+ to.sendData(seq);
+ test(false);
+ }
+ catch(Ice.TimeoutException ex)
+ {
+ // Expected.
+ }
+ comm.destroy();
+ }
+ {
+ //
+ // Test Ice.Override.CloseTimeout.
+ //
+ Ice.InitializationData initData = app.createInitializationData();
+ initData.properties = communicator.getProperties()._clone();
+ initData.properties.setProperty("Ice.Override.CloseTimeout", "100");
+ Ice.Communicator comm = app.initialize(initData);
+ comm.stringToProxy(sref).ice_getConnection();
+ timeout.holdAdapter(500);
+ long now = System.nanoTime();
+ comm.destroy();
+ test(System.nanoTime() - now < 400 * 1000000);
+ }
+ out.println("ok");
+
+ out.print("testing invocation timeouts with collocated calls... ");
+ out.flush();
+ {
+ communicator.getProperties().setProperty("TimeoutCollocated.AdapterId", "timeoutAdapter");
+
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TimeoutCollocated");
+ adapter.activate();
+
+ TimeoutPrx proxy = TimeoutPrxHelper.uncheckedCast(adapter.addWithUUID(new TimeoutI()));
+ proxy = (TimeoutPrx)proxy.ice_invocationTimeout(100);
+ try
+ {
+ proxy.sleep(300);
+ test(false);
+ }
+ catch(Ice.InvocationTimeoutException ex)
+ {
+ }
+
+ try
+ {
+ proxy.end_sleep(proxy.begin_sleep(300));
+ test(false);
+ }
+ catch(Ice.InvocationTimeoutException ex)
+ {
+ }
+
+ ((TimeoutPrx)proxy.ice_invocationTimeout(-1)).ice_ping();
+
+ TimeoutPrx batchTimeout = (TimeoutPrx)proxy.ice_batchOneway();
+ batchTimeout.ice_ping();
+ batchTimeout.ice_ping();
+ batchTimeout.ice_ping();
+
+ ((TimeoutPrx)proxy.ice_invocationTimeout(-1)).begin_sleep(300); // Keep the server thread pool busy.
+ try
+ {
+ batchTimeout.ice_flushBatchRequests();
+ test(false);
+ }
+ catch(Ice.InvocationTimeoutException ex)
+ {
+ }
+
+ batchTimeout.ice_ping();
+ batchTimeout.ice_ping();
+ batchTimeout.ice_ping();
+
+ ((TimeoutPrx)proxy.ice_invocationTimeout(-1)).begin_sleep(300); // Keep the server thread pool busy.
+ try
+ {
+ batchTimeout.end_ice_flushBatchRequests(batchTimeout.begin_ice_flushBatchRequests());
+ test(false);
+ }
+ catch(Ice.InvocationTimeoutException ex)
+ {
+ }
+
+ adapter.destroy();
+ }
+ out.println("ok");
+
+ return timeout;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/timeout/Client.java b/java-compat/test/src/main/java/test/Ice/timeout/Client.java
new file mode 100644
index 00000000000..1de8964d87b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/timeout/Client.java
@@ -0,0 +1,63 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.timeout;
+
+import test.Ice.timeout.Test.TimeoutPrx;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ TimeoutPrx timeout = AllTests.allTests(this);
+ timeout.shutdown();
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.timeout");
+
+ //
+ // We need to send messages large enough to cause the transport
+ // buffers to fill up.
+ //
+ initData.properties.setProperty("Ice.MessageSizeMax", "20000");
+
+ //
+ // For this test, we want to disable retries.
+ //
+ initData.properties.setProperty("Ice.RetryIntervals", "-1");
+
+ //
+ // This test kills connections, so we don't want warnings.
+ //
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+
+ //
+ // Limit the send buffer size, this test relies on the socket
+ // send() blocking after sending a given amount of data.
+ //
+ initData.properties.setProperty("Ice.TCP.SndSize", "50000");
+
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/timeout/Server.java b/java-compat/test/src/main/java/test/Ice/timeout/Server.java
new file mode 100644
index 00000000000..3d4982f6305
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/timeout/Server.java
@@ -0,0 +1,51 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.timeout;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new TimeoutI(), Ice.Util.stringToIdentity("timeout"));
+ adapter.activate();
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.timeout");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ //
+ // Limit the recv buffer size, this test relies on the socket
+ // send() blocking after sending a given amount of data.
+ //
+ initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
+
+ //
+ // This test kills connections, so we don't want warnings.
+ //
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server app = new Server();
+ int result = app.main("Server", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/timeout/Test.ice b/java-compat/test/src/main/java/test/Ice/timeout/Test.ice
new file mode 100644
index 00000000000..d804e326e60
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/timeout/Test.ice
@@ -0,0 +1,29 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Ice.timeout"]]
+module Test
+{
+
+sequence<byte> ByteSeq;
+
+interface Timeout
+{
+ void op();
+ void sendData(ByteSeq seq);
+ void sleep(int to);
+
+ void holdAdapter(int to);
+
+ void shutdown();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/timeout/TimeoutI.java b/java-compat/test/src/main/java/test/Ice/timeout/TimeoutI.java
new file mode 100644
index 00000000000..fcfff4d36ec
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/timeout/TimeoutI.java
@@ -0,0 +1,84 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.timeout;
+import test.Ice.timeout.Test._TimeoutDisp;
+
+
+class TimeoutI extends _TimeoutDisp
+{
+ static class ActivateAdapterThread extends Thread
+ {
+ ActivateAdapterThread(Ice.ObjectAdapter adapter, int timeout)
+ {
+ _adapter = adapter;
+ _timeout = timeout;
+ }
+
+ @Override
+ public void
+ run()
+ {
+ _adapter.waitForHold();
+ try
+ {
+ sleep(_timeout);
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ _adapter.activate();
+ }
+
+ Ice.ObjectAdapter _adapter;
+ int _timeout;
+ }
+
+ @Override
+ public void
+ op(Ice.Current current)
+ {
+ }
+
+ @Override
+ public void
+ sendData(byte[] seq, Ice.Current current)
+ {
+ }
+
+ @Override
+ public void
+ sleep(int to, Ice.Current current)
+ {
+ try
+ {
+ Thread.currentThread();
+ Thread.sleep(to);
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ @Override
+ public void
+ holdAdapter(int to, Ice.Current current)
+ {
+ current.adapter.hold();
+ Thread thread = new ActivateAdapterThread(current.adapter, to);
+ thread.start();
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/timeout/run.py b/java-compat/test/src/main/java/test/Ice/timeout/run.py
new file mode 100755
index 00000000000..97f9acd4094
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/timeout/run.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.queueClientServerTest()
+TestUtil.runQueuedTests()
diff --git a/java-compat/test/src/main/java/test/Ice/udp/AllTests.java b/java-compat/test/src/main/java/test/Ice/udp/AllTests.java
new file mode 100644
index 00000000000..1e43756d12e
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/udp/AllTests.java
@@ -0,0 +1,249 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.udp;
+
+import test.Ice.udp.Test.*;
+
+import java.io.PrintWriter;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static class PingReplyI extends _PingReplyDisp
+ {
+ @Override
+ public synchronized void
+ reply(Ice.Current current)
+ {
+ ++_replies;
+ notify();
+ }
+
+ public synchronized void
+ reset()
+ {
+ _replies = 0;
+ }
+
+ public synchronized boolean
+ waitReply(int expectedReplies, long timeout)
+ {
+ long end = System.currentTimeMillis() + timeout;
+ while(_replies < expectedReplies)
+ {
+ long delay = end - System.currentTimeMillis();
+ if(delay > 0)
+ {
+ try
+ {
+ wait(delay);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+ return _replies == expectedReplies;
+ }
+
+ private int _replies;
+ }
+
+ public static void
+ allTests(test.Util.Application app)
+ {
+ Ice.Communicator communicator = app.communicator();
+ PrintWriter out = app.getWriter();
+
+ communicator.getProperties().setProperty("ReplyAdapter.Endpoints", "udp -p 12030");
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ReplyAdapter");
+ PingReplyI replyI = new PingReplyI();
+
+ PingReplyPrx reply =
+ (PingReplyPrx)PingReplyPrxHelper.uncheckedCast(adapter.addWithUUID(replyI)).ice_datagram();
+ adapter.activate();
+
+ out.print("testing udp... ");
+ out.flush();
+ Ice.ObjectPrx base = communicator.stringToProxy("test -d:udp -p 12010");
+ TestIntfPrx obj = TestIntfPrxHelper.uncheckedCast(base);
+
+ int nRetry = 5;
+ boolean ret = false;
+ while(nRetry-- > 0)
+ {
+ replyI.reset();
+ obj.ping(reply);
+ obj.ping(reply);
+ obj.ping(reply);
+ ret = replyI.waitReply(3, 2000);
+ if(ret)
+ {
+ break; // Success
+ }
+
+ // If the 3 datagrams were not received within the 2 seconds, we try again to
+ // receive 3 new datagrams using a new object. We give up after 5 retries.
+ replyI = new PingReplyI();
+ reply = (PingReplyPrx)PingReplyPrxHelper.uncheckedCast(adapter.addWithUUID(replyI)).ice_datagram();
+ }
+ test(ret == true);
+
+ if(communicator.getProperties().getPropertyAsInt("Ice.Override.Compress") == 0)
+ {
+ //
+ // Only run this test if compression is disabled, the test expect fixed message size
+ // to be sent over the wire.
+ //
+ byte[] seq = null;
+ try
+ {
+ seq = new byte[1024];
+ while(true)
+ {
+ seq = new byte[seq.length * 2 + 10];
+ replyI.reset();
+ obj.sendByteSeq(seq, reply);
+ replyI.waitReply(1, 10000);
+ }
+ }
+ catch(Ice.DatagramLimitException ex)
+ {
+ test(seq.length > 16384);
+ }
+ obj.ice_getConnection().close(false);
+ communicator.getProperties().setProperty("Ice.UDP.SndSize", "64000");
+ seq = new byte[50000];
+ try
+ {
+ replyI.reset();
+ obj.sendByteSeq(seq, reply);
+ test(!replyI.waitReply(1, 500));
+ }
+ catch(Ice.LocalException ex)
+ {
+ System.err.println(ex);
+ test(false);
+ }
+ }
+
+ out.println("ok");
+
+ if(!app.isAndroid())
+ {
+ out.print("testing udp multicast... ");
+ out.flush();
+ String endpoint;
+ if(communicator.getProperties().getProperty("Ice.IPv6").equals("1"))
+ {
+ if(System.getProperty("os.name").contains("OS X"))
+ {
+ endpoint = "udp -h \"ff15::1:1\" -p 12020 --interface \"::1\"";
+ }
+ else
+ {
+ endpoint = "udp -h \"ff15::1:1\" -p 12020";
+ }
+ }
+ else
+ {
+ endpoint = "udp -h 239.255.1.1 -p 12020";
+ }
+ base = communicator.stringToProxy("test -d:" + endpoint);
+ TestIntfPrx objMcast = TestIntfPrxHelper.uncheckedCast(base);
+
+ nRetry = 5;
+ while(nRetry-- > 0)
+ {
+ replyI.reset();
+ objMcast.ping(reply);
+ ret = replyI.waitReply(5, 2000);
+ if(ret)
+ {
+ break; // Success
+ }
+ replyI = new PingReplyI();
+ reply = (PingReplyPrx) PingReplyPrxHelper.uncheckedCast(adapter.addWithUUID(replyI)).ice_datagram();
+ }
+ if(!ret)
+ {
+ out.println("failed (is a firewall enabled?)");
+ }
+ else
+ {
+ out.println("ok");
+ }
+
+ out.print("testing udp bi-dir connection... ");
+ out.flush();
+ obj.ice_getConnection().setAdapter(adapter);
+ objMcast.ice_getConnection().setAdapter(adapter);
+ nRetry = 5;
+ while(nRetry-- > 0)
+ {
+ replyI.reset();
+ obj.pingBiDir(reply.ice_getIdentity());
+ obj.pingBiDir(reply.ice_getIdentity());
+ obj.pingBiDir(reply.ice_getIdentity());
+ ret = replyI.waitReply(3, 2000);
+ if(ret)
+ {
+ break; // Success
+ }
+ replyI = new PingReplyI();
+ reply = (PingReplyPrx) PingReplyPrxHelper.uncheckedCast(adapter.addWithUUID(replyI)).ice_datagram();
+ }
+ test(ret);
+ out.println("ok");
+ }
+
+ //
+ // Sending the replies back on the multicast UDP connection doesn't work for most
+ // platform (it works for OS X Leopard but not Snow Leopard, doesn't work on SLES,
+ // Windows...). For Windows, see UdpTransceiver constructor for the details. So
+ // we don't run this test.
+ //
+// out.print("testing udp bi-dir connection... ");
+// nRetry = 5;
+// while(nRetry-- > 0)
+// {
+// replyI.reset();
+// objMcast.pingBiDir(reply.ice_getIdentity());
+// ret = replyI.waitReply(5, 2000);
+// if(ret)
+// {
+// break; // Success
+// }
+// replyI = new PingReplyI();
+// reply = (PingReplyPrx)PingReplyPrxHelper.uncheckedCast(adapter.addWithUUID(replyI)).ice_datagram();
+// }
+
+// if(!ret)
+// {
+// out.println("failed (is a firewall enabled?)");
+// }
+// else
+// {
+// out.println("ok");
+// }
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/udp/Client.java b/java-compat/test/src/main/java/test/Ice/udp/Client.java
new file mode 100644
index 00000000000..585531f0253
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/udp/Client.java
@@ -0,0 +1,57 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.udp;
+
+import test.Ice.udp.Test.*;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ AllTests.allTests(this);
+
+ int num;
+ try
+ {
+ num = args.length == 1 ? Integer.parseInt(args[0]) : 1;
+ }
+ catch(NumberFormatException ex)
+ {
+ num = 1;
+ }
+ for(int i = 0; i < num; ++i)
+ {
+ TestIntfPrxHelper.uncheckedCast(communicator().stringToProxy("control:tcp -p " + (12010 + i))).shutdown();
+ }
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.udp");
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.UDP.RcvSize", "16384");
+ initData.properties.setProperty("Ice.UDP.SndSize", "16384");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/udp/Server.java b/java-compat/test/src/main/java/test/Ice/udp/Server.java
new file mode 100644
index 00000000000..02b6fca4ab1
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/udp/Server.java
@@ -0,0 +1,91 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.udp;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Properties properties = communicator().getProperties();
+
+ int port = 12010;
+ try
+ {
+ port += args.length == 1 ? Integer.parseInt(args[0]) : 0;
+ }
+ catch(NumberFormatException ex)
+ {
+ }
+ properties.setProperty("ControlAdapter.Endpoints", "tcp -p " + port);
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("ControlAdapter");
+ adapter.add(new TestIntfI(), Ice.Util.stringToIdentity("control"));
+ adapter.activate();
+
+ if(port == 12010)
+ {
+ properties.setProperty("TestAdapter.Endpoints", "udp -p 12010");
+ Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("TestAdapter");
+ adapter2.add(new TestIntfI(), Ice.Util.stringToIdentity("test"));
+ adapter2.activate();
+ }
+
+ if(!isAndroid())
+ {
+ Ice.ObjectAdapter mcastAdapter = communicator().createObjectAdapter("McastTestAdapter");
+ mcastAdapter.add(new TestIntfI(), Ice.Util.stringToIdentity("test"));
+ mcastAdapter.activate();
+ }
+
+ return WAIT;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.udp");
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.UDP.RcvSize", "16384");
+ initData.properties.setProperty("Ice.UDP.SndSize", "16384");
+
+ if(!isAndroid())
+ {
+ String endpoint;
+ if(initData.properties.getProperty("Ice.IPv6").equals("1"))
+ {
+ if(System.getProperty("os.name").contains("OS X"))
+ {
+ endpoint = "udp -h \"ff15::1:1\" -p 12020 --interface \"::1\"";
+ }
+ else
+ {
+ endpoint = "udp -h \"ff15::1:1\" -p 12020";
+ }
+ }
+ else
+ {
+ endpoint = "udp -h 239.255.1.1 -p 12020";
+ }
+ initData.properties.setProperty("McastTestAdapter.Endpoints", endpoint);
+ }
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server c = new Server();
+ int status = c.main("Server", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/udp/Test.ice b/java-compat/test/src/main/java/test/Ice/udp/Test.ice
new file mode 100644
index 00000000000..c32954acae1
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/udp/Test.ice
@@ -0,0 +1,32 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+#include <Ice/Identity.ice>
+
+[["java:package:test.Ice.udp"]]
+module Test
+{
+
+interface PingReply
+{
+ void reply();
+};
+
+sequence<byte> ByteSeq;
+
+interface TestIntf
+{
+ void ping(PingReply* reply);
+ void sendByteSeq(ByteSeq seq, PingReply* reply);
+ void pingBiDir(Ice::Identity id);
+ void shutdown();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Ice/udp/TestIntfI.java b/java-compat/test/src/main/java/test/Ice/udp/TestIntfI.java
new file mode 100644
index 00000000000..e113e0b67f0
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/udp/TestIntfI.java
@@ -0,0 +1,74 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Ice.udp;
+
+import test.Ice.udp.Test.*;
+
+public final class TestIntfI extends _TestIntfDisp
+{
+ @Override
+ public void ping(PingReplyPrx reply, Ice.Current current)
+ {
+ try
+ {
+ reply.reply();
+ }
+ catch(Ice.LocalException ex)
+ {
+ assert(false);
+ }
+ }
+
+ @Override
+ public void sendByteSeq(byte[] seq, PingReplyPrx reply, Ice.Current current)
+ {
+ try
+ {
+ reply.reply();
+ }
+ catch(Ice.LocalException ex)
+ {
+ assert(false);
+ }
+ }
+
+ @Override
+ public void pingBiDir(Ice.Identity id, Ice.Current current)
+ {
+ try
+ {
+ //
+ // Ensure sending too much data doesn't cause the UDP connection
+ // to be closed.
+ //
+ try
+ {
+ byte[] seq = new byte[32 * 1024];
+ TestIntfPrxHelper.uncheckedCast(current.con.createProxy(id)).sendByteSeq(seq, null);
+ }
+ catch(Ice.DatagramLimitException ex)
+ {
+ // Expected.
+ }
+
+ PingReplyPrxHelper.uncheckedCast(current.con.createProxy(id)).reply();
+ }
+ catch(Ice.LocalException ex)
+ {
+ assert(false);
+ }
+ }
+
+ @Override
+ public void shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Ice/udp/run.py b/java-compat/test/src/main/java/test/Ice/udp/run.py
new file mode 100755
index 00000000000..4b3a05010e2
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Ice/udp/run.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.addClasspath(os.path.join(os.getcwd(), "classes"))
+
+num = 5
+
+serverProc = []
+for i in range(0, num):
+ sys.stdout.write("starting server #%d... " % (i + 1))
+ sys.stdout.flush()
+ serverProc.append(TestUtil.startServer("test.Ice.udp.Server", "%d" % i , adapter="McastTestAdapter"))
+ print("ok")
+
+sys.stdout.write("starting client... ")
+sys.stdout.flush()
+clientProc = TestUtil.startClient("test.Ice.udp.Client", "%d" % num, startReader=False)
+print("ok")
+clientProc.startReader()
+
+clientProc.waitTestSuccess()
+for p in serverProc:
+ p.waitTestSuccess()
diff --git a/java-compat/test/src/main/java/test/IceBox/admin/AllTests.java b/java-compat/test/src/main/java/test/IceBox/admin/AllTests.java
new file mode 100644
index 00000000000..1d7cce6c451
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/admin/AllTests.java
@@ -0,0 +1,128 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceBox.admin;
+
+import test.IceBox.admin.Test.*;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static void
+ allTests(Ice.Communicator communicator)
+ {
+ String ref = "DemoIceBox/admin:default -p 9996 -t 10000";
+ Ice.ObjectPrx admin = communicator.stringToProxy(ref);
+
+ TestFacetPrx facet = null;
+
+ System.out.print("testing custom facet... ");
+ System.out.flush();
+ {
+ //
+ // Test: Verify that the custom facet is present.
+ //
+ facet = TestFacetPrxHelper.checkedCast(admin, "TestFacet");
+ facet.ice_ping();
+ }
+ System.out.println("ok");
+
+ System.out.print("testing properties facet... ");
+ System.out.flush();
+ {
+ Ice.PropertiesAdminPrx pa =
+ Ice.PropertiesAdminPrxHelper.checkedCast(admin, "IceBox.Service.TestService.Properties");
+
+ //
+ // Test: PropertiesAdmin::getProperty()
+ //
+ test(pa.getProperty("Prop1").equals("1"));
+ test(pa.getProperty("Bogus").equals(""));
+
+ //
+ // Test: PropertiesAdmin::getProperties()
+ //
+ java.util.Map<String, String> pd = pa.getPropertiesForPrefix("");
+ test(pd.size() == 6);
+ test(pd.get("Prop1").equals("1"));
+ test(pd.get("Prop2").equals("2"));
+ test(pd.get("Prop3").equals("3"));
+ test(pd.get("Ice.Config").equals("config.service"));
+ test(pd.get("Ice.ProgramName").equals("IceBox-TestService"));
+ test(pd.get("Ice.Admin.Enabled").equals("1"));
+
+ java.util.Map<String, String> changes;
+
+ //
+ // Test: PropertiesAdmin::setProperties()
+ //
+ java.util.Map<String, String> setProps = new java.util.HashMap<String, String>();
+ setProps.put("Prop1", "10"); // Changed
+ setProps.put("Prop2", "20"); // Changed
+ setProps.put("Prop3", ""); // Removed
+ setProps.put("Prop4", "4"); // Added
+ setProps.put("Prop5", "5"); // Added
+ pa.setProperties(setProps);
+ test(pa.getProperty("Prop1").equals("10"));
+ test(pa.getProperty("Prop2").equals("20"));
+ test(pa.getProperty("Prop3").equals(""));
+ test(pa.getProperty("Prop4").equals("4"));
+ test(pa.getProperty("Prop5").equals("5"));
+ changes = facet.getChanges();
+ test(changes.size() == 5);
+ test(changes.get("Prop1").equals("10"));
+ test(changes.get("Prop2").equals("20"));
+ test(changes.get("Prop3").equals(""));
+ test(changes.get("Prop4").equals("4"));
+ test(changes.get("Prop5").equals("5"));
+ pa.setProperties(setProps);
+ changes = facet.getChanges();
+ test(changes.isEmpty());
+ }
+ System.out.println("ok");
+
+ System.out.print("testing metrics admin facet... ");
+ System.out.flush();
+ {
+ IceMX.MetricsAdminPrx ma =
+ IceMX.MetricsAdminPrxHelper.checkedCast(admin, "IceBox.Service.TestService.Metrics");
+
+ Ice.PropertiesAdminPrx pa =
+ Ice.PropertiesAdminPrxHelper.checkedCast(admin, "IceBox.Service.TestService.Properties");
+
+ String[] views;
+ Ice.StringSeqHolder disabledViews = new Ice.StringSeqHolder();
+ views = ma.getMetricsViewNames(disabledViews);
+ test(views.length == 0);
+
+ java.util.Map<String, String> setProps = new java.util.HashMap<String, String>();
+ setProps.put("IceMX.Metrics.Debug.GroupBy", "id");
+ setProps.put("IceMX.Metrics.All.GroupBy", "none");
+ setProps.put("IceMX.Metrics.Parent.GroupBy", "parent");
+ pa.setProperties(setProps);
+ pa.setProperties(new java.util.HashMap<String, String>());
+
+ views = ma.getMetricsViewNames(disabledViews);
+ test(views.length == 3);
+
+ // Make sure that the IceBox communicator metrics admin is a separate instance.
+ test(IceMX.MetricsAdminPrxHelper.checkedCast(admin,
+ "Metrics").getMetricsViewNames(disabledViews).length == 0);
+ }
+ System.out.println("ok");
+ }
+}
diff --git a/java-compat/test/src/main/java/test/IceBox/admin/Client.java b/java-compat/test/src/main/java/test/IceBox/admin/Client.java
new file mode 100644
index 00000000000..474c874e3e9
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/admin/Client.java
@@ -0,0 +1,44 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceBox.admin;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ AllTests.allTests(communicator);
+
+ //
+ // Shutdown the IceBox server.
+ //
+ Ice.ProcessPrxHelper.uncheckedCast(
+ communicator.stringToProxy("DemoIceBox/admin -f Process:default -p 9996")).shutdown();
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int result = app.main("Client", args);
+ System.gc();
+ System.exit(result);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/IceBox/admin/Test.ice b/java-compat/test/src/main/java/test/IceBox/admin/Test.ice
new file mode 100644
index 00000000000..6dd04596115
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/admin/Test.ice
@@ -0,0 +1,26 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef TEST_ICE
+#define TEST_ICE
+
+#include <Ice/Properties.ice>
+
+[["java:package:test.IceBox.admin"]]
+module Test
+{
+
+interface TestFacet
+{
+ Ice::PropertyDict getChanges();
+};
+
+};
+
+#endif
diff --git a/java-compat/test/src/main/java/test/IceBox/admin/TestFacetI.java b/java-compat/test/src/main/java/test/IceBox/admin/TestFacetI.java
new file mode 100644
index 00000000000..ec0e56f3568
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/admin/TestFacetI.java
@@ -0,0 +1,57 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceBox.admin;
+
+import test.IceBox.admin.Test.*;
+
+public class TestFacetI extends _TestFacetDisp implements Ice.PropertiesAdminUpdateCallback
+{
+ public TestFacetI()
+ {
+ _called = false;
+ }
+
+ @Override
+ public synchronized java.util.Map<String, String> getChanges(Ice.Current current)
+ {
+ //
+ // The client calls PropertiesAdmin::setProperties() and then invokes
+ // this operation. Since setProperties() is implemented using AMD, the
+ // client might receive its reply and then call getChanges() before our
+ // updated() method is called. We block here to ensure that updated()
+ // gets called before we return the most recent set of changes.
+ //
+ while(!_called)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ _called = false;
+
+ return _changes;
+ }
+
+ @Override
+ public synchronized void updated(java.util.Map<String, String> changes)
+ {
+ _changes = changes;
+ _called = true;
+ notify();
+ }
+
+ private java.util.Map<String, String> _changes;
+ private boolean _called;
+}
diff --git a/java-compat/test/src/main/java/test/IceBox/admin/TestServiceI.java b/java-compat/test/src/main/java/test/IceBox/admin/TestServiceI.java
new file mode 100644
index 00000000000..16371331026
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/admin/TestServiceI.java
@@ -0,0 +1,46 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceBox.admin;
+
+public class TestServiceI implements IceBox.Service
+{
+ public TestServiceI(Ice.Communicator serviceManagerCommunicator)
+ {
+ TestFacetI facet = new TestFacetI();
+
+ //
+ // Install a custom admin facet.
+ //
+ serviceManagerCommunicator.addAdminFacet(facet, "TestFacet");
+
+ //
+ // The TestFacetI servant also implements PropertiesAdminUpdateCallback.
+ // Set the callback on the admin facet.
+ //
+ Ice.Object propFacet = serviceManagerCommunicator.findAdminFacet("IceBox.Service.TestService.Properties");
+ if(propFacet != null)
+ {
+ Ice.NativePropertiesAdmin admin = (Ice.NativePropertiesAdmin)propFacet;
+ admin.addUpdateCallback(facet);
+ }
+ }
+
+ @Override
+ public void
+ start(String name, Ice.Communicator communicator, String[] args)
+ {
+ }
+
+ @Override
+ public void
+ stop()
+ {
+ }
+}
diff --git a/java-compat/test/src/main/java/test/IceBox/admin/config.admin b/java-compat/test/src/main/java/test/IceBox/admin/config.admin
new file mode 100644
index 00000000000..1baad8bea86
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/admin/config.admin
@@ -0,0 +1,4 @@
+#
+# Proxy to the IceBox ServiceManager:
+#
+IceBoxAdmin.ServiceManager.Proxy=DemoIceBox/admin -f IceBox.ServiceManager:default -p 9996
diff --git a/java-compat/test/src/main/java/test/IceBox/admin/config.icebox b/java-compat/test/src/main/java/test/IceBox/admin/config.icebox
new file mode 100644
index 00000000000..34d0b233419
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/admin/config.icebox
@@ -0,0 +1,5 @@
+Ice.Admin.InstanceName=DemoIceBox
+Ice.Admin.Endpoints=default -p 9996 -h 127.0.0.1
+Ice.ProgramName=IceBox
+
+IceBox.Service.TestService=test.IceBox.admin.TestServiceI --Ice.Config=config.service
diff --git a/java-compat/test/src/main/java/test/IceBox/admin/config.service b/java-compat/test/src/main/java/test/IceBox/admin/config.service
new file mode 100644
index 00000000000..23c6f841859
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/admin/config.service
@@ -0,0 +1,3 @@
+Prop1=1
+Prop2=2
+Prop3=3
diff --git a/java-compat/test/src/main/java/test/IceBox/admin/run.py b/java-compat/test/src/main/java/test/IceBox/admin/run.py
new file mode 100755
index 00000000000..6ebb72ea3f2
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/admin/run.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+icebox = TestUtil.getIceBox()
+config = os.path.join(os.getcwd(), "config.icebox")
+
+TestUtil.clientServerTest(additionalServerOptions='--Ice.Config="%s"' % config, server=icebox)
+
+sys.stdout.write("testing iceboxadmin... ")
+sys.stdout.flush()
+
+admin = TestUtil.getIceBoxAdmin()
+adminconfig = os.path.join(os.getcwd(), "config.admin")
+
+ib = TestUtil.startServer(icebox, args = '--Ice.Config=\"%s\"' % config)
+iba = TestUtil.startClient(admin, args = '--Ice.Config=\"%s\" stop TestService' % adminconfig)
+iba.waitTestSuccess()
+iba = TestUtil.startClient(admin, args = '--Ice.Config=\"%s\" start TestService' % adminconfig)
+iba.waitTestSuccess()
+iba = TestUtil.startClient(admin, args = '--Ice.Config=\"%s\" shutdown' % adminconfig)
+iba.waitTestSuccess()
+ib.waitTestSuccess()
+
+print("ok")
diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/AllTests.java b/java-compat/test/src/main/java/test/IceBox/configuration/AllTests.java
new file mode 100644
index 00000000000..8035fb508d1
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/configuration/AllTests.java
@@ -0,0 +1,101 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceBox.configuration;
+
+import java.io.PrintWriter;
+
+import test.IceBox.configuration.Test.TestIntfPrx;
+import test.IceBox.configuration.Test.TestIntfPrxHelper;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if (!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static void
+ allTests(Ice.Communicator communicator, PrintWriter out)
+ {
+ TestIntfPrx service1 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:tcp -p 12010"));
+ TestIntfPrx service2 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:tcp -p 12011"));
+ TestIntfPrx service3 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:tcp -p 12012"));
+ TestIntfPrx service4 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:tcp -p 12013"));
+
+ if(service1.getProperty("IceBox.InheritProperties").equals(""))
+ {
+ out.print("testing service properties... ");
+ out.flush();
+
+ test(service1.getProperty("Ice.ProgramName").equals("IceBox-Service1"));
+ test(service1.getProperty("Service").equals("1"));
+ test(service1.getProperty("Service1.Ovrd").equals("2"));
+ test(service1.getProperty("Service1.Unset").equals(""));
+ test(service1.getProperty("Arg").equals("1"));
+
+ String[] args1 = {"-a", "--Arg=2"};
+ test(java.util.Arrays.equals(service1.getArgs(), args1));
+
+ test(service2.getProperty("Ice.ProgramName").equals("Test"));
+ test(service2.getProperty("Service").equals("2"));
+ test(service2.getProperty("Service1.ArgProp").equals(""));
+ test(service2.getProperty("IceBox.InheritProperties").equals("1"));
+
+ String[] args2 = {"--Service1.ArgProp=1"};
+ test(java.util.Arrays.equals(service2.getArgs(), args2));
+
+ out.println("ok");
+
+ out.print("testing with shared communicator... ");
+ out.flush();
+
+ test(service3.getProperty("Ice.ProgramName").equals("IceBox-SharedCommunicator"));
+ test(service3.getProperty("Service").equals("4"));
+ test(service3.getProperty("Prop").equals(""));
+ test(service3.getProperty("Service3.Prop").equals("1"));
+ test(service3.getProperty("Ice.Trace.Slicing").equals("3"));
+
+ test(service4.getProperty("Ice.ProgramName").equals("IceBox-SharedCommunicator"));
+ test(service4.getProperty("Service").equals("4"));
+ test(service4.getProperty("Prop").equals(""));
+ test(service4.getProperty("Service3.Prop").equals("1"));
+ test(service4.getProperty("Ice.Trace.Slicing").equals("3"));
+
+ String[] args4 = {"--Service3.Prop=2"};
+ test(java.util.Arrays.equals(service4.getArgs(), args4));
+
+ out.println("ok");
+ }
+ else
+ {
+ out.print("testing property inheritance... ");
+ out.flush();
+
+ test(service1.getProperty("Ice.ProgramName").equals("IceBox2-Service1"));
+ test(service1.getProperty("ServerProp").equals("1"));
+ test(service1.getProperty("OverrideMe").equals("2"));
+ test(service1.getProperty("UnsetMe").equals(""));
+ test(service1.getProperty("Service1.Prop").equals("1"));
+ test(service1.getProperty("Service1.ArgProp").equals("2"));
+
+ test(service2.getProperty("Ice.ProgramName").equals("IceBox2-SharedCommunicator"));
+ test(service2.getProperty("ServerProp").equals("1"));
+ test(service2.getProperty("OverrideMe").equals("3"));
+ test(service2.getProperty("UnsetMe").equals(""));
+ test(service2.getProperty("Service2.Prop").equals("1"));
+
+ out.println("ok");
+ }
+ }
+}
diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/Client.java b/java-compat/test/src/main/java/test/IceBox/configuration/Client.java
new file mode 100644
index 00000000000..1417b0b37f8
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/configuration/Client.java
@@ -0,0 +1,46 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceBox.configuration;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ AllTests.allTests(communicator, getWriter());
+
+ //
+ // Shutdown the IceBox server.
+ //
+ Ice.ProcessPrxHelper.uncheckedCast(communicator.stringToProxy("DemoIceBox/admin -f Process:default -p 9996"))
+ .shutdown();
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.IceBox.configuration");
+ initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/Test.ice b/java-compat/test/src/main/java/test/IceBox/configuration/Test.ice
new file mode 100644
index 00000000000..5846a1d5f12
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/configuration/Test.ice
@@ -0,0 +1,25 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+#include <Ice/BuiltinSequences.ice>
+
+[["java:package:test.IceBox.configuration"]]
+module Test
+{
+
+interface TestIntf
+{
+ string getProperty(string name);
+ Ice::StringSeq getArgs();
+
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/TestI.java b/java-compat/test/src/main/java/test/IceBox/configuration/TestI.java
new file mode 100644
index 00000000000..24cc986a83a
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/configuration/TestI.java
@@ -0,0 +1,38 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceBox.configuration;
+
+import test.IceBox.configuration.Test._TestIntfDisp;
+
+
+public class TestI extends _TestIntfDisp
+{
+ public
+ TestI(String[] args)
+ {
+ _args = args;
+ }
+
+ @Override
+ public String
+ getProperty(String name, Ice.Current current)
+ {
+ return current.adapter.getCommunicator().getProperties().getProperty(name);
+ }
+
+ @Override
+ public String[]
+ getArgs(Ice.Current current)
+ {
+ return _args;
+ }
+
+ final private String[] _args;
+}
diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/TestServiceI.java b/java-compat/test/src/main/java/test/IceBox/configuration/TestServiceI.java
new file mode 100644
index 00000000000..d12a648b819
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/configuration/TestServiceI.java
@@ -0,0 +1,30 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceBox.configuration;
+
+public class TestServiceI implements IceBox.Service
+{
+ @Override
+ public void
+ start(String name, Ice.Communicator communicator, String[] args)
+ {
+ communicator.getProperties().setProperty("Ice.Package.Test", "test.IceBox.configuration");
+
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter(name + "OA");
+ adapter.add(new TestI(args), Ice.Util.stringToIdentity("test"));
+ adapter.activate();
+ }
+
+ @Override
+ public void
+ stop()
+ {
+ }
+}
diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/config.icebox b/java-compat/test/src/main/java/test/IceBox/configuration/config.icebox
new file mode 100644
index 00000000000..1dd4b90957c
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/configuration/config.icebox
@@ -0,0 +1,13 @@
+Ice.Admin.InstanceName=DemoIceBox
+Ice.Admin.Endpoints=default -p 9996 -h 127.0.0.1
+Ice.ProgramName=IceBox
+
+IceBox.Service.Service1=test.IceBox.configuration.TestServiceI --Ice.Config=config.service1 --Service1.ArgProp=1 --Service1.Ovrd=2 --Service1.Unset= -a --Arg=2
+IceBox.Service.Service2=test.IceBox.configuration.TestServiceI --Ice.Config=config.service2 --Service1.ArgProp=1 --IceBox.InheritProperties
+
+IceBox.UseSharedCommunicator.Service3=1
+IceBox.Service.Service3=test.IceBox.configuration.TestServiceI --Ice.Config=config.service3
+IceBox.UseSharedCommunicator.Service4=1
+IceBox.Service.Service4=test.IceBox.configuration.TestServiceI --Ice.Config=config.service4 --Service3.Prop=2 --Ice.Trace.Slicing=3
+
+IceBox.LoadOrder=Service1 Service2 Service3 Service4
diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/config.icebox2 b/java-compat/test/src/main/java/test/IceBox/configuration/config.icebox2
new file mode 100644
index 00000000000..2866764f19f
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/configuration/config.icebox2
@@ -0,0 +1,16 @@
+Ice.Admin.InstanceName=DemoIceBox
+Ice.Admin.Endpoints=default -p 9996 -h 127.0.0.1
+Ice.ProgramName=IceBox2
+
+IceBox.InheritProperties=1
+
+ServerProp=1
+OverrideMe=1
+UnsetMe=1
+
+IceBox.Service.Service1=test.IceBox.configuration.TestServiceI --Ice.Config=config.service1-2 --Service1.ArgProp=2
+
+IceBox.UseSharedCommunicator.Service2=1
+IceBox.Service.Service2=test.IceBox.configuration.TestServiceI --Ice.Config=config.service2-2
+
+IceBox.LoadOrder=Service1 Service2
diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/config.service1 b/java-compat/test/src/main/java/test/IceBox/configuration/config.service1
new file mode 100644
index 00000000000..6028e615ff5
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/configuration/config.service1
@@ -0,0 +1,9 @@
+Service1OA.Endpoints=tcp -p 12010 -h 127.0.0.1
+
+#Ice.ProgramName
+Service=1
+Service1.Ovrd=1
+Service1.Unset=1
+
+Arg=1
+ArgUnset=2
diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/config.service1-2 b/java-compat/test/src/main/java/test/IceBox/configuration/config.service1-2
new file mode 100644
index 00000000000..c173914db2a
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/configuration/config.service1-2
@@ -0,0 +1,11 @@
+Service1OA.Endpoints=tcp -p 12010 -h 127.0.0.1
+
+#Ice.ProgramName
+Service1.Prop=1
+Service1.ArgProp=1
+
+OverrideMe=2
+UnsetMe=
+
+
+Ice.PrintAdapterReady=0
diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/config.service2 b/java-compat/test/src/main/java/test/IceBox/configuration/config.service2
new file mode 100644
index 00000000000..78e08aadba6
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/configuration/config.service2
@@ -0,0 +1,4 @@
+Service2OA.Endpoints=tcp -p 12011 -h 127.0.0.1
+
+Ice.ProgramName=Test
+Service=2
diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/config.service2-2 b/java-compat/test/src/main/java/test/IceBox/configuration/config.service2-2
new file mode 100644
index 00000000000..36c8d0812cb
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/configuration/config.service2-2
@@ -0,0 +1,9 @@
+Service2OA.Endpoints=tcp -p 12011 -h 127.0.0.1
+
+#Ice.ProgramName
+Service2.Prop=1
+
+OverrideMe=3
+UnsetMe=
+
+Ice.PrintAdapterReady=0
diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/config.service3 b/java-compat/test/src/main/java/test/IceBox/configuration/config.service3
new file mode 100644
index 00000000000..c93ed144701
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/configuration/config.service3
@@ -0,0 +1,8 @@
+Service3OA.Endpoints=tcp -p 12012 -h 127.0.0.1
+
+#Ice.ProgramName
+Service=3
+Prop=2
+Service3.Prop=1
+
+Ice.Trace.Slicing=2
diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/config.service4 b/java-compat/test/src/main/java/test/IceBox/configuration/config.service4
new file mode 100644
index 00000000000..182fb3a7289
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/configuration/config.service4
@@ -0,0 +1,6 @@
+Service4OA.Endpoints=tcp -p 12013 -h 127.0.0.1
+
+#Ice.ProgramName
+Service=4
+Prop=
+
diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/run.py b/java-compat/test/src/main/java/test/IceBox/configuration/run.py
new file mode 100755
index 00000000000..077936ccbe5
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceBox/configuration/run.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+TestUtil.clientServerTest(additionalServerOptions='--Ice.Config="%s"' % os.path.join(os.getcwd(), "config.icebox"),
+ server=TestUtil.getIceBox())
+TestUtil.clientServerTest(additionalServerOptions='--Ice.Config="%s"' % os.path.join(os.getcwd(), "config.icebox2"),
+ server=TestUtil.getIceBox())
diff --git a/java-compat/test/src/main/java/test/IceDiscovery/simple/AllTests.java b/java-compat/test/src/main/java/test/IceDiscovery/simple/AllTests.java
new file mode 100644
index 00000000000..e9b3f3e87c7
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceDiscovery/simple/AllTests.java
@@ -0,0 +1,220 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceDiscovery.simple;
+
+import test.IceDiscovery.simple.Test.*;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import java.util.Set;
+import java.util.HashSet;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static void
+ allTests(Ice.Communicator communicator, int num)
+ {
+ List<ControllerPrx> proxies = new ArrayList<ControllerPrx>();
+ List<ControllerPrx> indirectProxies = new ArrayList<ControllerPrx>();
+ for(int i = 0; i < num; ++i)
+ {
+ String id = "controller" + i;
+ proxies.add(ControllerPrxHelper.uncheckedCast(communicator.stringToProxy(id)));
+ indirectProxies.add(ControllerPrxHelper.uncheckedCast(communicator.stringToProxy(id + "@control" + i)));
+ }
+
+ System.out.print("testing indirect proxies... ");
+ System.out.flush();
+ {
+ for(ControllerPrx prx : indirectProxies)
+ {
+ prx.ice_ping();
+ }
+ }
+ System.out.println("ok");
+
+ System.out.print("testing well-known proxies... ");
+ System.out.flush();
+ {
+ for(ControllerPrx prx : proxies)
+ {
+ prx.ice_ping();
+ }
+ }
+ System.out.println("ok");
+
+ System.out.print("testing object adapter registration... ");
+ System.out.flush();
+ {
+ try
+ {
+ communicator.stringToProxy("object @ oa1").ice_ping();
+ }
+ catch(Ice.NoEndpointException ex)
+ {
+ }
+
+ proxies.get(0).activateObjectAdapter("oa", "oa1", "");
+
+ try
+ {
+ communicator.stringToProxy("object @ oa1").ice_ping();
+ }
+ catch(Ice.ObjectNotExistException ex)
+ {
+ }
+
+ proxies.get(0).deactivateObjectAdapter("oa");
+
+ try
+ {
+ communicator.stringToProxy("object @ oa1").ice_ping();
+ }
+ catch(Ice.NoEndpointException ex)
+ {
+ }
+ }
+ System.out.println("ok");
+
+ System.out.print("testing object adapter migration...");
+ System.out.flush();
+ {
+ proxies.get(0).activateObjectAdapter("oa", "oa1", "");
+ proxies.get(0).addObject("oa", "object");
+ communicator.stringToProxy("object @ oa1").ice_ping();
+ proxies.get(0).removeObject("oa", "object");
+ proxies.get(0).deactivateObjectAdapter("oa");
+
+ proxies.get(1).activateObjectAdapter("oa", "oa1", "");
+ proxies.get(1).addObject("oa", "object");
+ communicator.stringToProxy("object @ oa1").ice_ping();
+ proxies.get(1).removeObject("oa", "object");
+ proxies.get(1).deactivateObjectAdapter("oa");
+ }
+ System.out.println("ok");
+
+ System.out.print("testing object migration...");
+ System.out.flush();
+ {
+ proxies.get(0).activateObjectAdapter("oa", "oa1", "");
+ proxies.get(1).activateObjectAdapter("oa", "oa2", "");
+
+ proxies.get(0).addObject("oa", "object");
+ communicator.stringToProxy("object @ oa1").ice_ping();
+ communicator.stringToProxy("object").ice_ping();
+ proxies.get(0).removeObject("oa", "object");
+
+ proxies.get(1).addObject("oa", "object");
+ communicator.stringToProxy("object @ oa2").ice_ping();
+ communicator.stringToProxy("object").ice_ping();
+ proxies.get(1).removeObject("oa", "object");
+
+ try
+ {
+ communicator.stringToProxy("object @ oa1").ice_ping();
+ }
+ catch(Ice.ObjectNotExistException ex)
+ {
+ }
+ try
+ {
+ communicator.stringToProxy("object @ oa2").ice_ping();
+ }
+ catch(Ice.ObjectNotExistException ex)
+ {
+ }
+
+ proxies.get(0).deactivateObjectAdapter("oa");
+ proxies.get(1).deactivateObjectAdapter("oa");
+ }
+ System.out.println("ok");
+
+ System.out.print("testing replica groups...");
+ System.out.flush();
+ {
+ proxies.get(0).activateObjectAdapter("oa", "oa1", "rg");
+ proxies.get(1).activateObjectAdapter("oa", "oa2", "rg");
+ proxies.get(2).activateObjectAdapter("oa", "oa3", "rg");
+
+ proxies.get(0).addObject("oa", "object");
+ proxies.get(1).addObject("oa", "object");
+ proxies.get(2).addObject("oa", "object");
+
+ communicator.stringToProxy("object @ oa1").ice_ping();
+ communicator.stringToProxy("object @ oa2").ice_ping();
+ communicator.stringToProxy("object @ oa3").ice_ping();
+
+ communicator.stringToProxy("object @ rg").ice_ping();
+
+ Set<String> adapterIds = new HashSet<String>();
+ adapterIds.add("oa1");
+ adapterIds.add("oa2");
+ adapterIds.add("oa3");
+ TestIntfPrx intf = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("object"));
+ intf = (TestIntfPrx)intf.ice_connectionCached(false).ice_locatorCacheTimeout(0);
+ while(!adapterIds.isEmpty())
+ {
+ adapterIds.remove(intf.getAdapterId());
+ }
+
+ while(true)
+ {
+ adapterIds.add("oa1");
+ adapterIds.add("oa2");
+ adapterIds.add("oa3");
+ intf = TestIntfPrxHelper.uncheckedCast(
+ communicator.stringToProxy("object @ rg").ice_connectionCached(false));
+ int nRetry = 100;
+ while(!adapterIds.isEmpty() && --nRetry > 0)
+ {
+ adapterIds.remove(intf.getAdapterId());
+ }
+ if(nRetry > 0)
+ {
+ break;
+ }
+
+ // The previous locator lookup probably didn't return all the replicas... try again.
+ communicator.stringToProxy("object @ rg").ice_locatorCacheTimeout(0).ice_ping();
+ }
+
+ proxies.get(0).deactivateObjectAdapter("oa");
+ proxies.get(1).deactivateObjectAdapter("oa");
+ test(TestIntfPrxHelper.uncheckedCast(
+ communicator.stringToProxy("object @ rg")).getAdapterId().equals("oa3"));
+ proxies.get(2).deactivateObjectAdapter("oa");
+
+ proxies.get(0).activateObjectAdapter("oa", "oa1", "rg");
+ proxies.get(0).addObject("oa", "object");
+ test(TestIntfPrxHelper.uncheckedCast(
+ communicator.stringToProxy("object @ rg")).getAdapterId().equals("oa1"));
+ proxies.get(0).deactivateObjectAdapter("oa");
+ }
+ System.out.println("ok");
+
+ System.out.print("shutting down... ");
+ System.out.flush();
+ for(ControllerPrx prx : proxies)
+ {
+ prx.shutdown();
+ }
+ System.out.println("ok");
+ }
+}
diff --git a/java-compat/test/src/main/java/test/IceDiscovery/simple/Client.java b/java-compat/test/src/main/java/test/IceDiscovery/simple/Client.java
new file mode 100644
index 00000000000..de48e574ab2
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceDiscovery/simple/Client.java
@@ -0,0 +1,38 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceDiscovery.simple;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ int num;
+ try
+ {
+ num = args.length == 1 ? Integer.parseInt(args[0]) : 0;
+ }
+ catch(NumberFormatException ex)
+ {
+ num = 0;
+ }
+ AllTests.allTests(communicator(), num);
+ return 0;
+ }
+
+ public static void main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/IceDiscovery/simple/ControllerI.java b/java-compat/test/src/main/java/test/IceDiscovery/simple/ControllerI.java
new file mode 100644
index 00000000000..aea6b38b3a3
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceDiscovery/simple/ControllerI.java
@@ -0,0 +1,66 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceDiscovery.simple;
+
+import test.IceDiscovery.simple.Test.*;
+
+public final class ControllerI extends _ControllerDisp
+{
+ @Override
+ public void
+ activateObjectAdapter(String name, String adapterId, String replicaGroupId, Ice.Current current)
+ {
+ Ice.Communicator communicator = current.adapter.getCommunicator();
+ Ice.Properties properties = communicator.getProperties();
+ properties.setProperty(name + ".AdapterId", adapterId);
+ properties.setProperty(name + ".ReplicaGroupId", replicaGroupId);
+ properties.setProperty(name + ".Endpoints", "default");
+ Ice.ObjectAdapter oa = communicator.createObjectAdapter(name);
+ _adapters.put(name, oa);
+ oa.activate();
+ }
+
+ @Override
+ public void
+ deactivateObjectAdapter(String name, Ice.Current current)
+ {
+ _adapters.get(name).destroy();
+ _adapters.remove(name);
+ }
+
+ @Override
+ public void
+ addObject(String oaName, String id, Ice.Current current)
+ {
+ assert(_adapters.containsKey(oaName));
+ Ice.Identity identity = new Ice.Identity();
+ identity.name = id;
+ _adapters.get(oaName).add(new TestIntfI(), identity);
+ }
+
+ @Override
+ public void
+ removeObject(String oaName, String id, Ice.Current current)
+ {
+ assert(_adapters.containsKey(oaName));
+ Ice.Identity identity = new Ice.Identity();
+ identity.name = id;
+ _adapters.get(oaName).remove(identity);
+ }
+
+ @Override
+ public void shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+
+ final private java.util.Map<String, Ice.ObjectAdapter> _adapters =
+ new java.util.HashMap<String, Ice.ObjectAdapter>();
+}
diff --git a/java-compat/test/src/main/java/test/IceDiscovery/simple/Server.java b/java-compat/test/src/main/java/test/IceDiscovery/simple/Server.java
new file mode 100644
index 00000000000..28db45ec264
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceDiscovery/simple/Server.java
@@ -0,0 +1,46 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceDiscovery.simple;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Properties properties = communicator().getProperties();
+
+ int num = 0;
+ try
+ {
+ num = Integer.parseInt(args[0]);
+ }
+ catch(NumberFormatException ex)
+ {
+ }
+
+ properties.setProperty("ControlAdapter.Endpoints", "default -p " + (12010 + num));
+ properties.setProperty("ControlAdapter.AdapterId", "control" + num);
+ properties.setProperty("ControlAdapter.ThreadPool.Size", "1");
+
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("ControlAdapter");
+ adapter.add(new ControllerI(), Ice.Util.stringToIdentity("controller" + num));
+ adapter.activate();
+
+ return WAIT;
+ }
+
+ public static void main(String[] args)
+ {
+ Server c = new Server();
+ int status = c.main("Server", args);
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/IceDiscovery/simple/Test.ice b/java-compat/test/src/main/java/test/IceDiscovery/simple/Test.ice
new file mode 100644
index 00000000000..35503271cd8
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceDiscovery/simple/Test.ice
@@ -0,0 +1,33 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+
+[["java:package:test.IceDiscovery.simple"]]
+module Test
+{
+
+interface TestIntf
+{
+ string getAdapterId();
+};
+
+interface Controller
+{
+ void activateObjectAdapter(string name, string adapterId, string replicaGroupId);
+ void deactivateObjectAdapter(string name);
+
+ void addObject(string oaName, string id);
+ void removeObject(string oaName, string id);
+
+ void shutdown();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/IceDiscovery/simple/TestIntfI.java b/java-compat/test/src/main/java/test/IceDiscovery/simple/TestIntfI.java
new file mode 100644
index 00000000000..43b9cc5bc62
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceDiscovery/simple/TestIntfI.java
@@ -0,0 +1,22 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceDiscovery.simple;
+
+import test.IceDiscovery.simple.Test.*;
+
+public final class TestIntfI extends _TestIntfDisp
+{
+ @Override
+ public String
+ getAdapterId(Ice.Current current)
+ {
+ return current.adapter.getCommunicator().getProperties().getProperty(current.adapter.getName() + ".AdapterId");
+ }
+}
diff --git a/java-compat/test/src/main/java/test/IceDiscovery/simple/run.py b/java-compat/test/src/main/java/test/IceDiscovery/simple/run.py
new file mode 100755
index 00000000000..86f25ed9c16
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceDiscovery/simple/run.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+server = "test.IceDiscovery.simple.Server"
+client = "test.IceDiscovery.simple.Client"
+
+num = 3
+
+args = " --Ice.Plugin.IceDiscovery=IceDiscovery:IceDiscovery.PluginFactory"
+args += " --IceDiscovery.Timeout=50"
+args += " --IceDiscovery.RetryCount=5"
+if not TestUtil.ipv6:
+ args += " --IceDiscovery.Interface=127.0.0.1"
+elif TestUtil.isDarwin():
+ args += " --IceDiscovery.Interface=\"::1\""
+
+serverProc = []
+for i in range(0, num):
+ sys.stdout.write("starting server #%d... " % (i + 1))
+ sys.stdout.flush()
+ serverProc.append(TestUtil.startServer(server, "%d %s" % (i, args), count = 4))
+ print("ok")
+
+sys.stdout.write("starting client... ")
+sys.stdout.flush()
+clientProc = TestUtil.startClient(client, "%d %s" % (num, args), startReader = False)
+print("ok")
+clientProc.startReader()
+
+clientProc.waitTestSuccess()
+for p in serverProc:
+ p.waitTestSuccess()
diff --git a/java-compat/test/src/main/java/test/IceGrid/simple/.gitignore b/java-compat/test/src/main/java/test/IceGrid/simple/.gitignore
new file mode 100644
index 00000000000..1a5104f3c93
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceGrid/simple/.gitignore
@@ -0,0 +1,4 @@
+db/node/*
+db/registry/*
+db/replica-1/*
+db/replica-2/*
diff --git a/java-compat/test/src/main/java/test/IceGrid/simple/AllTests.java b/java-compat/test/src/main/java/test/IceGrid/simple/AllTests.java
new file mode 100644
index 00000000000..c18faeeefdf
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceGrid/simple/AllTests.java
@@ -0,0 +1,364 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceGrid.simple;
+import java.io.PrintWriter;
+
+import test.IceGrid.simple.Test.TestIntfPrx;
+import test.IceGrid.simple.Test.TestIntfPrxHelper;
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static void
+ allTests(test.Util.Application app)
+ {
+ Ice.Communicator communicator = app.communicator();
+ PrintWriter out = app.getWriter();
+
+ out.print("testing stringToProxy... ");
+ out.flush();
+ String ref = "test @ TestAdapter";
+ Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ test(base != null);
+ out.println("ok");
+
+ out.print("testing IceGrid.Locator is present... ");
+ IceGrid.LocatorPrx locator = IceGrid.LocatorPrxHelper.uncheckedCast(base);
+ test(locator != null);
+ out.println("ok");
+
+ out.print("testing checked cast... ");
+ out.flush();
+ TestIntfPrx obj = TestIntfPrxHelper.checkedCast(base);
+ test(obj != null);
+ test(obj.equals(base));
+ out.println("ok");
+
+ out.print("pinging server... ");
+ out.flush();
+ obj.ice_ping();
+ out.println("ok");
+
+ out.print("testing locator finder... ");
+ Ice.Identity finderId = new Ice.Identity();
+ finderId.category = "Ice";
+ finderId.name = "LocatorFinder";
+ Ice.LocatorFinderPrx finder = Ice.LocatorFinderPrxHelper.checkedCast(
+ communicator.getDefaultLocator().ice_identity(finderId));
+ test(finder.getLocator() != null);
+ out.println("ok");
+
+ out.print("testing discovery... ");
+ out.flush();
+ {
+ // Add test well-known object
+ IceGrid.RegistryPrx registry = IceGrid.RegistryPrxHelper.checkedCast(
+ communicator.stringToProxy(communicator.getDefaultLocator().ice_getIdentity().category + "/Registry"));
+ test(registry != null);
+
+ try
+ {
+ IceGrid.AdminSessionPrx session = registry.createAdminSession("foo", "bar");
+ session.getAdmin().addObjectWithType(base, "::Test");
+ session.destroy();
+ }
+ catch(Ice.UserException ex)
+ {
+ test(false);
+ }
+
+ //
+ // Ensure the IceGrid discovery locator can discover the
+ // registries and make sure locator requests are forwarded.
+ //
+ Ice.InitializationData initData = app.createInitializationData();
+ initData.properties = communicator.getProperties()._clone();
+ initData.properties.setProperty("Ice.Default.Locator", "");
+ initData.properties.setProperty("Ice.Plugin.IceLocatorDiscovery",
+ "IceLocatorDiscovery:IceLocatorDiscovery.PluginFactory");
+ if(System.getProperty("os.name").contains("OS X") &&
+ initData.properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0)
+ {
+ initData.properties.setProperty("IceLocatorDiscovery.Interface", "::1");
+ }
+ initData.properties.setProperty("AdapterForDiscoveryTest.AdapterId", "discoveryAdapter");
+ initData.properties.setProperty("AdapterForDiscoveryTest.Endpoints", "default");
+
+ Ice.Communicator com = Ice.Util.initialize(initData);
+ test(com.getDefaultLocator() != null);
+ com.stringToProxy("test @ TestAdapter").ice_ping();
+ com.stringToProxy("test").ice_ping();
+
+ test(com.getDefaultLocator().getRegistry() != null);
+ test(IceGrid.LocatorPrxHelper.uncheckedCast(com.getDefaultLocator()).getLocalRegistry() != null);
+ test(IceGrid.LocatorPrxHelper.uncheckedCast(com.getDefaultLocator()).getLocalQuery() != null);
+
+ Ice.ObjectAdapter adapter = com.createObjectAdapter("AdapterForDiscoveryTest");
+ adapter.activate();
+ adapter.deactivate();
+ com.destroy();
+
+ //
+ // Now, ensure that the IceGrid discovery locator correctly
+ // handles failure to find a locator.
+ //
+ initData.properties.setProperty("IceLocatorDiscovery.InstanceName", "unknown");
+ initData.properties.setProperty("IceLocatorDiscovery.RetryCount", "1");
+ initData.properties.setProperty("IceLocatorDiscovery.Timeout", "100");
+ com = Ice.Util.initialize(initData);
+ test(com.getDefaultLocator() != null);
+ try
+ {
+ com.stringToProxy("test @ TestAdapter").ice_ping();
+ }
+ catch(Ice.NoEndpointException ex)
+ {
+ }
+ try
+ {
+ com.stringToProxy("test").ice_ping();
+ }
+ catch(Ice.NoEndpointException ex)
+ {
+ }
+ test(com.getDefaultLocator().getRegistry() == null);
+ test(IceGrid.LocatorPrxHelper.checkedCast(com.getDefaultLocator()) == null);
+ try
+ {
+ IceGrid.LocatorPrxHelper.uncheckedCast(com.getDefaultLocator()).getLocalQuery();
+ }
+ catch(Ice.OperationNotExistException ex)
+ {
+ }
+
+ adapter = com.createObjectAdapter("AdapterForDiscoveryTest");
+ adapter.activate();
+ adapter.deactivate();
+
+ com.destroy();
+ }
+ out.println("ok");
+
+ out.print("shutting down server... ");
+ out.flush();
+ obj.shutdown();
+ out.println("ok");
+ }
+
+ public static void
+ allTestsWithDeploy(Ice.Communicator communicator, PrintWriter out)
+ {
+ out.print("testing stringToProxy... ");
+ out.flush();
+ Ice.ObjectPrx base = communicator.stringToProxy("test @ TestAdapter");
+ test(base != null);
+ Ice.ObjectPrx base2 = communicator.stringToProxy("test");
+ test(base2 != null);
+ out.println("ok");
+
+ out.print("testing checked cast... ");
+ out.flush();
+ TestIntfPrx obj = TestIntfPrxHelper.checkedCast(base);
+ test(obj != null);
+ test(obj.equals(base));
+ TestIntfPrx obj2 = TestIntfPrxHelper.checkedCast(base2);
+ test(obj2 != null);
+ test(obj2.equals(base2));
+ out.println("ok");
+
+ out.print("pinging server... ");
+ out.flush();
+ obj.ice_ping();
+ obj2.ice_ping();
+ out.println("ok");
+
+ out.print("testing encoding versioning... ");
+ out.flush();
+ Ice.ObjectPrx base10 = communicator.stringToProxy("test10 @ TestAdapter10");
+ test(base10 != null);
+ Ice.ObjectPrx base102 = communicator.stringToProxy("test10");
+ test(base102 != null);
+ try
+ {
+ base10.ice_ping();
+ test(false);
+ }
+ catch(Ice.NoEndpointException ex)
+ {
+ }
+ try
+ {
+ base102.ice_ping();
+ test(false);
+ }
+ catch(Ice.NoEndpointException ex)
+ {
+ }
+ base10 = base10.ice_encodingVersion(Ice.Util.Encoding_1_0);
+ base102 = base102.ice_encodingVersion(Ice.Util.Encoding_1_0);
+ base10.ice_ping();
+ base102.ice_ping();
+ out.println("ok");
+
+ out.print("testing reference with unknown identity... ");
+ out.flush();
+ try
+ {
+ communicator.stringToProxy("unknown/unknown").ice_ping();
+ test(false);
+ }
+ catch(Ice.NotRegisteredException ex)
+ {
+ test(ex.kindOfObject.equals("object"));
+ test(ex.id.equals("unknown/unknown"));
+ }
+ out.println("ok");
+
+ out.print("testing reference with unknown adapter... ");
+ out.flush();
+ try
+ {
+ communicator.stringToProxy("test @ TestAdapterUnknown").ice_ping();
+ test(false);
+ }
+ catch(Ice.NotRegisteredException ex)
+ {
+ test(ex.kindOfObject.equals("object adapter"));
+ test(ex.id.equals("TestAdapterUnknown"));
+ }
+ out.println("ok");
+
+ IceGrid.RegistryPrx registry = IceGrid.RegistryPrxHelper.checkedCast(
+ communicator.stringToProxy(communicator.getDefaultLocator().ice_getIdentity().category + "/Registry"));
+ test(registry != null);
+ IceGrid.AdminSessionPrx session = null;
+ try
+ {
+ session = registry.createAdminSession("foo", "bar");
+ }
+ catch(IceGrid.PermissionDeniedException e)
+ {
+ test(false);
+ }
+
+ session.ice_getConnection().setACM(new Ice.IntOptional(registry.getACMTimeout()), null,
+ new Ice.Optional<Ice.ACMHeartbeat>(Ice.ACMHeartbeat.HeartbeatAlways));
+
+ IceGrid.AdminPrx admin = session.getAdmin();
+ test(admin != null);
+
+ try
+ {
+ admin.enableServer("server", false);
+ admin.stopServer("server");
+ }
+ catch(IceGrid.ServerNotExistException ex)
+ {
+ test(false);
+ }
+ catch(IceGrid.ServerStopException ex)
+ {
+ test(false);
+ }
+ catch(IceGrid.NodeUnreachableException ex)
+ {
+ test(false);
+ }
+ catch(IceGrid.DeploymentException ex)
+ {
+ test(false);
+ }
+
+ out.print("testing whether server is still reachable... ");
+ out.flush();
+ try
+ {
+ obj = TestIntfPrxHelper.checkedCast(base);
+ test(false);
+ }
+ catch(Ice.NoEndpointException ex)
+ {
+ }
+ try
+ {
+ obj2 = TestIntfPrxHelper.checkedCast(base2);
+ test(false);
+ }
+ catch(Ice.NoEndpointException ex)
+ {
+ }
+
+ try
+ {
+ admin.enableServer("server", true);
+ }
+ catch(IceGrid.ServerNotExistException ex)
+ {
+ test(false);
+ }
+ catch(IceGrid.NodeUnreachableException ex)
+ {
+ test(false);
+ }
+ catch(IceGrid.DeploymentException ex)
+ {
+ test(false);
+ }
+
+ try
+ {
+ obj = TestIntfPrxHelper.checkedCast(base);
+ }
+ catch(Ice.NoEndpointException ex)
+ {
+ test(false);
+ }
+ try
+ {
+ obj2 = TestIntfPrxHelper.checkedCast(base2);
+ }
+ catch(Ice.NoEndpointException ex)
+ {
+ test(false);
+ }
+ out.println("ok");
+
+ try
+ {
+ admin.stopServer("server");
+ }
+ catch(IceGrid.ServerNotExistException ex)
+ {
+ test(false);
+ }
+ catch(IceGrid.ServerStopException ex)
+ {
+ test(false);
+ }
+ catch(IceGrid.NodeUnreachableException ex)
+ {
+ test(false);
+ }
+ catch(IceGrid.DeploymentException ex)
+ {
+ test(false);
+ }
+
+ session.destroy();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/IceGrid/simple/Client.java b/java-compat/test/src/main/java/test/IceGrid/simple/Client.java
new file mode 100644
index 00000000000..c843e477fc5
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceGrid/simple/Client.java
@@ -0,0 +1,57 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceGrid.simple;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ boolean withDeploy = false;
+ for(String arg : args)
+ {
+ if(arg.equals("--with-deploy"))
+ {
+ withDeploy = true;
+ break;
+ }
+ }
+
+ if(!withDeploy)
+ {
+ AllTests.allTests(this);
+ }
+ else
+ {
+ AllTests.allTestsWithDeploy(communicator, getWriter());
+ }
+
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.IceGrid.simple");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/IceGrid/simple/Server.java b/java-compat/test/src/main/java/test/IceGrid/simple/Server.java
new file mode 100644
index 00000000000..e1ea3916029
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceGrid/simple/Server.java
@@ -0,0 +1,62 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceGrid.simple;
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int
+ run(String[] args)
+ {
+ Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
+ argsH.value = communicator().getProperties().parseCommandLineOptions("TestAdapter", argsH.value);
+
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.Object object = new TestI();
+ String id = communicator().getProperties().getPropertyWithDefault("Identity", "test");
+ adapter.add(object, Ice.Util.stringToIdentity(id));
+ //shutdownOnInterrupt();
+ try
+ {
+ adapter.activate();
+ }
+ catch(Ice.ObjectAdapterDeactivatedException ex)
+ {
+ }
+ communicator().waitForShutdown();
+ //defaultInterrupt();
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ //
+ // Its possible to have batch oneway requests dispatched
+ // after the adapter is deactivated due to thread
+ // scheduling so we supress this warning.
+ //
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties.setProperty("Ice.Package.Test", "test.IceGrid.simple");
+ return initData;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Server c = new Server();
+ int status = c.main("test.IceGrid.simple.Server", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/IceGrid/simple/Test.ice b/java-compat/test/src/main/java/test/IceGrid/simple/Test.ice
new file mode 100644
index 00000000000..cb3f5ad0a41
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceGrid/simple/Test.ice
@@ -0,0 +1,21 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.IceGrid.simple"]]
+module Test
+{
+
+interface TestIntf
+{
+ void shutdown();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/IceGrid/simple/TestI.java b/java-compat/test/src/main/java/test/IceGrid/simple/TestI.java
new file mode 100644
index 00000000000..03ef5d74b4a
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceGrid/simple/TestI.java
@@ -0,0 +1,27 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceGrid.simple;
+
+import test.IceGrid.simple.Test._TestIntfDisp;
+
+public class TestI extends _TestIntfDisp
+{
+ public
+ TestI()
+ {
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+}
diff --git a/java-compat/test/src/main/java/test/IceGrid/simple/db/.gitignore b/java-compat/test/src/main/java/test/IceGrid/simple/db/.gitignore
new file mode 100644
index 00000000000..39af5887579
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceGrid/simple/db/.gitignore
@@ -0,0 +1 @@
+# Dummy file, so that git retains this otherwise empty directory.
diff --git a/java-compat/test/src/main/java/test/IceGrid/simple/run.py b/java-compat/test/src/main/java/test/IceGrid/simple/run.py
new file mode 100755
index 00000000000..8831f0a03ec
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceGrid/simple/run.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil, IceGridAdmin
+
+# Test IceGrid discovery with multiple replicas
+IceGridAdmin.nreplicas=2
+
+#
+# Test client/server without on demand activation.
+#
+IceGridAdmin.iceGridClientServerTest("", "--TestAdapter.Endpoints=default --TestAdapter.AdapterId=TestAdapter")
+
+#
+# Test client/server with on demand activation.
+#
+IceGridAdmin.iceGridTest("simple_server.xml", "--with-deploy")
diff --git a/java-compat/test/src/main/java/test/IceGrid/simple/simple_server.xml b/java-compat/test/src/main/java/test/IceGrid/simple/simple_server.xml
new file mode 100644
index 00000000000..9ebc5d95a72
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceGrid/simple/simple_server.xml
@@ -0,0 +1,22 @@
+<icegrid>
+ <application name="Test">
+ <node name="localnode">
+ <server id="server" exe="${java.exe}" pwd="." activation="on-demand">
+ <option>-Djava.security.egd=file:/dev/urandom</option>
+ <option>test.IceGrid.simple.Server</option>
+ <adapter name="TestAdapter" id="TestAdapter" endpoints="default">
+ <object identity="test" type="Test"/>
+ </adapter>
+ </server>
+
+ <server id="server10" exe="${java.exe}" pwd="." activation="on-demand">
+ <option>-Djava.security.egd=file:/dev/urandom</option>
+ <option>test.IceGrid.simple.Server</option>
+ <adapter name="TestAdapter" endpoints="default" id="TestAdapter10">
+ <object identity="test10" type="Test" property="Identity"/>
+ </adapter>
+ <property name="Ice.Default.EncodingVersion" value="1.0"/>
+ </server>
+ </node>
+ </application>
+</icegrid>
diff --git a/java-compat/test/src/main/java/test/IceSSL/certs/README.md b/java-compat/test/src/main/java/test/IceSSL/certs/README.md
new file mode 100644
index 00000000000..9236ac1e241
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/certs/README.md
@@ -0,0 +1,9 @@
+This directory contains certificates that are required by the tests in
+test/IceSSL/configuration. The 'makecerts.py' script generates
+certificates in the current directory using the CA databases stored in
+the cpp/test/IceSSL/certs/db directory.
+
+Running this script, we'll just re-save the certificates in the
+current directory without creating new certificates.
+
+See cpp/test/IceSSL/certs/README.md for more information
diff --git a/java-compat/test/src/main/java/test/IceSSL/certs/c_dsa_ca1.jks b/java-compat/test/src/main/java/test/IceSSL/certs/c_dsa_ca1.jks
new file mode 100644
index 00000000000..cfd65f79454
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/certs/c_dsa_ca1.jks
Binary files differ
diff --git a/java-compat/test/src/main/java/test/IceSSL/certs/c_rsa_ca1.jks b/java-compat/test/src/main/java/test/IceSSL/certs/c_rsa_ca1.jks
new file mode 100644
index 00000000000..1d69f92ded8
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/certs/c_rsa_ca1.jks
Binary files differ
diff --git a/java-compat/test/src/main/java/test/IceSSL/certs/c_rsa_ca1_exp.jks b/java-compat/test/src/main/java/test/IceSSL/certs/c_rsa_ca1_exp.jks
new file mode 100644
index 00000000000..37a443a8a91
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/certs/c_rsa_ca1_exp.jks
Binary files differ
diff --git a/java-compat/test/src/main/java/test/IceSSL/certs/c_rsa_ca2.jks b/java-compat/test/src/main/java/test/IceSSL/certs/c_rsa_ca2.jks
new file mode 100644
index 00000000000..d1c11df0d45
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/certs/c_rsa_ca2.jks
Binary files differ
diff --git a/java-compat/test/src/main/java/test/IceSSL/certs/c_rsa_cai2.jks b/java-compat/test/src/main/java/test/IceSSL/certs/c_rsa_cai2.jks
new file mode 100644
index 00000000000..07a87ab3a84
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/certs/c_rsa_cai2.jks
Binary files differ
diff --git a/java-compat/test/src/main/java/test/IceSSL/certs/cacert1.jks b/java-compat/test/src/main/java/test/IceSSL/certs/cacert1.jks
new file mode 100644
index 00000000000..9879a7f4cbf
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/certs/cacert1.jks
Binary files differ
diff --git a/java-compat/test/src/main/java/test/IceSSL/certs/cacert2.jks b/java-compat/test/src/main/java/test/IceSSL/certs/cacert2.jks
new file mode 100644
index 00000000000..e3ead556ed1
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/certs/cacert2.jks
Binary files differ
diff --git a/java-compat/test/src/main/java/test/IceSSL/certs/cacerts.jks b/java-compat/test/src/main/java/test/IceSSL/certs/cacerts.jks
new file mode 100644
index 00000000000..0c668c4f501
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/certs/cacerts.jks
Binary files differ
diff --git a/java-compat/test/src/main/java/test/IceSSL/certs/makecerts.py b/java-compat/test/src/main/java/test/IceSSL/certs/makecerts.py
new file mode 100755
index 00000000000..03d932341a5
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/certs/makecerts.py
@@ -0,0 +1,113 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2015-2016 ZeroC, Inc. All rights reserved.
+#
+# **********************************************************************
+
+import os, sys, socket, getopt
+
+try:
+ import IceCertUtils
+except:
+ print("error: couldn't find IceCertUtils, install `zeroc-icecertutils' package "
+ "from Python package repository")
+ sys.exit(1)
+
+toplevel="."
+while(toplevel != "/"):
+ toplevel = os.path.normpath(os.path.join("..", toplevel))
+ if os.path.exists(os.path.join(toplevel, "scripts", "TestUtil.py")):
+ break
+else:
+ raise RuntimeError("can't find toplevel directory!")
+
+cppcerts = os.path.join(toplevel, "cpp", "test", "IceSSL", "certs")
+if not os.path.exists(os.path.join(cppcerts, "db", "ca1", "ca.pem")):
+ print("error: CA database is not initialized in `" + os.path.join(cppcerts, "db") + "',"
+ " run makecerts.py in `" + cppcerts + "' first")
+ sys.exit(1)
+
+def usage():
+ print("Usage: " + sys.argv[0] + " [options]")
+ print("")
+ print("Options:")
+ print("-h Show this message.")
+ print("-d | --debug Debugging output.")
+ print("--clean Clean the CA database first.")
+ print("--force Re-save all the files even if they already exists.")
+ sys.exit(1)
+
+#
+# Check arguments
+#
+debug = False
+force = False
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "hd", ["help", "debug", "force"])
+except getopt.GetoptError as e:
+ print("Error %s " % e)
+ usage()
+ sys.exit(1)
+
+for (o, a) in opts:
+ if o == "-h" or o == "--help":
+ usage()
+ sys.exit(0)
+ elif o == "-d" or o == "--debug":
+ debug = True
+ elif o == "--force":
+ force = True
+
+ca1 = IceCertUtils.CertificateFactory(home=os.path.join(cppcerts, "db", "ca1"), debug=debug)
+ca2 = IceCertUtils.CertificateFactory(home=os.path.join(cppcerts, "db", "ca2"), debug=debug)
+cai1 = ca1.getIntermediateFactory("intermediate1")
+cai2 = cai1.getIntermediateFactory("intermediate1")
+
+if force or not os.path.exists("cacert1.jks"): ca1.getCA().save("cacert1.jks")
+if force or not os.path.exists("cacert2.jks"): ca2.getCA().save("cacert2.jks")
+
+certs = [
+ (ca1, "s_rsa_ca1", None, {}),
+ (ca1, "c_rsa_ca1", None, {}),
+ (ca1, "s_rsa_ca1_exp", None, {}), # Expired certificate
+ (ca1, "c_rsa_ca1_exp", None, {}), # Expired certificate
+ (ca1, "s_rsa_ca1_cn1", None, {}), # No subjectAltName, CN=127.0.0.1
+ (ca1, "s_rsa_ca1_cn2", None, {}), # No subjectAltName, CN=127.0.0.11
+ (ca2, "s_rsa_ca2", None, {}),
+ (ca2, "c_rsa_ca2", None, {}),
+ (ca1, "s_dsa_ca1", None, {}),
+ (ca1, "c_dsa_ca1", None, {}),
+ (cai1, "s_rsa_cai1", None, {}),
+ (cai2, "s_rsa_cai2", None, {}),
+ (cai2, "c_rsa_cai2", None, {}),
+ (ca1, "s_rsa_ca1", "s_rsa_wroot_ca1", { "root": True }),
+]
+
+#
+# Save the certificate JKS files.
+#
+for (ca, alias, path, args) in certs:
+ if not path: path = alias
+ cert = ca.get(alias)
+ if force or not os.path.exists(path + ".jks"):
+ cert.save(path + ".jks", alias="cert", **args)
+
+#
+# Create a cacerts.jks truststore that contains both CA certs.
+#
+if force or not os.path.exists("cacerts.jks"):
+ if os.path.exists("cacerts.jks"): os.remove("cacerts.jks")
+ ca1.getCA().exportToKeyStore("cacerts.jks", alias="cacert1")
+ ca2.getCA().exportToKeyStore("cacerts.jks", alias="cacert2")
+
+if force or not os.path.exists("s_cacert2.jks"): ca2.getCA().saveJKS("s_cacert2.jks", addkey=True)
+
+#
+# Create a client/server certificate that contains both the DSA and
+# RSA certs.
+#
+if force or not os.path.exists("s_rsa_dsa_ca1.jks"):
+ if os.path.exists("s_rsa_dsa_ca1.jks"): os.remove("s_rsa_dsa_ca1.jks")
+ ca1.get("s_rsa_ca1").exportToKeyStore("s_rsa_dsa_ca1.jks", alias="rsacert")
+ ca1.get("s_dsa_ca1").exportToKeyStore("s_rsa_dsa_ca1.jks", alias="dsacert")
diff --git a/java-compat/test/src/main/java/test/IceSSL/certs/s_cacert2.jks b/java-compat/test/src/main/java/test/IceSSL/certs/s_cacert2.jks
new file mode 100644
index 00000000000..a33b582d140
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/certs/s_cacert2.jks
Binary files differ
diff --git a/java-compat/test/src/main/java/test/IceSSL/certs/s_dsa_ca1.jks b/java-compat/test/src/main/java/test/IceSSL/certs/s_dsa_ca1.jks
new file mode 100644
index 00000000000..aee42dfd114
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/certs/s_dsa_ca1.jks
Binary files differ
diff --git a/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_ca1.jks b/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_ca1.jks
new file mode 100644
index 00000000000..ef51c01e1db
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_ca1.jks
Binary files differ
diff --git a/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_ca1_cn1.jks b/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_ca1_cn1.jks
new file mode 100644
index 00000000000..55b336e308c
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_ca1_cn1.jks
Binary files differ
diff --git a/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_ca1_cn2.jks b/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_ca1_cn2.jks
new file mode 100644
index 00000000000..a33ed0dfc84
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_ca1_cn2.jks
Binary files differ
diff --git a/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_ca1_exp.jks b/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_ca1_exp.jks
new file mode 100644
index 00000000000..77a50df3907
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_ca1_exp.jks
Binary files differ
diff --git a/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_ca2.jks b/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_ca2.jks
new file mode 100644
index 00000000000..486940b6d19
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_ca2.jks
Binary files differ
diff --git a/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_cai1.jks b/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_cai1.jks
new file mode 100644
index 00000000000..0662dc021dc
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_cai1.jks
Binary files differ
diff --git a/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_cai2.jks b/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_cai2.jks
new file mode 100644
index 00000000000..f5b315d7100
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_cai2.jks
Binary files differ
diff --git a/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_dsa_ca1.jks b/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_dsa_ca1.jks
new file mode 100644
index 00000000000..0b99f6dcade
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_dsa_ca1.jks
Binary files differ
diff --git a/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_wroot_ca1.jks b/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_wroot_ca1.jks
new file mode 100644
index 00000000000..a2b5f4205e9
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/certs/s_rsa_wroot_ca1.jks
Binary files differ
diff --git a/java-compat/test/src/main/java/test/IceSSL/certs/seed.dat b/java-compat/test/src/main/java/test/IceSSL/certs/seed.dat
new file mode 100644
index 00000000000..ba313c59460
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/certs/seed.dat
Binary files differ
diff --git a/java-compat/test/src/main/java/test/IceSSL/configuration/AllTests.java b/java-compat/test/src/main/java/test/IceSSL/configuration/AllTests.java
new file mode 100644
index 00000000000..d4d89c9f61e
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/configuration/AllTests.java
@@ -0,0 +1,2272 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceSSL.configuration;
+import java.io.PrintWriter;
+
+import test.IceSSL.configuration.Test.ServerFactoryPrx;
+import test.IceSSL.configuration.Test.ServerFactoryPrxHelper;
+import test.IceSSL.configuration.Test.ServerPrx;
+
+//
+// NOTE: This test is not interoperable with other language mappings.
+//
+
+public class AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private static java.security.cert.X509Certificate
+ loadCertificate(String path, String alias)
+ {
+ try
+ {
+ java.security.KeyStore keystore = java.security.KeyStore.getInstance("JKS");
+ keystore.load(new java.io.FileInputStream(path), "password".toCharArray());
+ return (java.security.cert.X509Certificate)keystore.getCertificate(alias);
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ return null;
+ }
+ }
+
+ private static Ice.InitializationData
+ createClientProps(Ice.Properties defaultProperties, String defaultDir, String defaultHost)
+ {
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties();
+ initData.properties.setProperty("Ice.Plugin.IceSSL", "IceSSL.PluginFactory");
+ if(defaultProperties.getProperty("Ice.IPv6").length() > 0)
+ {
+ initData.properties.setProperty("Ice.IPv6", defaultProperties.getProperty("Ice.IPv6"));
+ }
+ initData.properties.setProperty("Ice.RetryIntervals", "-1");
+ initData.properties.setProperty("IceSSL.DefaultDir", defaultDir);
+ initData.properties.setProperty("IceSSL.Random", "seed.dat");
+ if(defaultHost.length() > 0)
+ {
+ initData.properties.setProperty("Ice.Default.Host", defaultHost);
+ }
+ return initData;
+ }
+
+ private static Ice.InitializationData
+ createClientProps(Ice.Properties defaultProperties, String defaultDir, String defaultHost, String ks, String ts)
+ {
+ Ice.InitializationData initData = createClientProps(defaultProperties, defaultDir, defaultHost);
+ if(!ks.isEmpty())
+ {
+ initData.properties.setProperty("IceSSL.Keystore", ks + ".jks");
+ }
+ if(!ts.isEmpty())
+ {
+ initData.properties.setProperty("IceSSL.Truststore", ts + ".jks");
+ }
+ initData.properties.setProperty("IceSSL.Password", "password");
+ return initData;
+ }
+
+ private static java.util.Map<String, String>
+ createServerProps(Ice.Properties defaultProperties, String defaultDir, String defaultHost)
+ {
+ java.util.Map<String, String> result = new java.util.HashMap<String, String>();
+ result.put("Ice.Plugin.IceSSL", "IceSSL.PluginFactory");
+ if(defaultProperties.getProperty("Ice.IPv6").length() > 0)
+ {
+ result.put("Ice.IPv6", defaultProperties.getProperty("Ice.IPv6"));
+ }
+ result.put("IceSSL.DefaultDir", defaultDir);
+ result.put("IceSSL.Random", "seed.dat");
+ if(defaultHost.length() > 0)
+ {
+ result.put("Ice.Default.Host", defaultHost);
+ }
+ return result;
+ }
+
+ private static java.util.Map<String, String>
+ createServerProps(Ice.Properties defaultProperties, String defaultDir, String defaultHost, String ks, String ts)
+ {
+ java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost);
+ if(!ks.isEmpty())
+ {
+ d.put("IceSSL.Keystore", ks + ".jks");
+ }
+ if(!ts.isEmpty())
+ {
+ d.put("IceSSL.Truststore", ts + ".jks");
+ }
+ d.put("IceSSL.Password", "password");
+ return d;
+ }
+
+ public static ServerFactoryPrx
+ allTests(test.Util.Application app, String testDir, PrintWriter out)
+ {
+ Ice.Communicator communicator = app.communicator();
+ final String factoryRef = "factory:tcp -p 12010";
+ Ice.ObjectPrx b = communicator.stringToProxy(factoryRef);
+ test(b != null);
+ ServerFactoryPrx factory = ServerFactoryPrxHelper.checkedCast(b);
+
+ final String defaultHost = communicator.getProperties().getProperty("Ice.Default.Host");
+ final String defaultDir = testDir + "/../certs";
+ final Ice.Properties defaultProperties = communicator.getProperties();
+ final String[] args = new String[0];
+
+ out.print("testing manual initialization... ");
+ out.flush();
+ {
+ Ice.InitializationData initData = createClientProps(defaultProperties, defaultDir, defaultHost);
+ initData.properties.setProperty("Ice.InitPlugins", "0");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Ice.ObjectPrx p = comm.stringToProxy("dummy:ssl -p 9999");
+ try
+ {
+ p.ice_ping();
+ test(false);
+ }
+ catch(Ice.PluginInitializationException ex)
+ {
+ // Expected.
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ comm.destroy();
+ }
+ {
+ Ice.InitializationData initData = createClientProps(defaultProperties, defaultDir, defaultHost);
+ initData.properties.setProperty("Ice.InitPlugins", "0");
+ initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DH_anon.*AES.*)");
+ initData.properties.setProperty("IceSSL.VerifyPeer", "0");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Ice.PluginManager pm = comm.getPluginManager();
+ pm.initializePlugins();
+ Ice.ObjectPrx obj = comm.stringToProxy(factoryRef);
+ test(obj != null);
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(obj);
+ java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost);
+ d.put("IceSSL.Ciphers", "NONE (.*DH_anon.*AES.*)");
+ d.put("IceSSL.VerifyPeer", "0");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ out.println("ok");
+
+ out.print("testing certificate verification... ");
+ out.flush();
+ {
+ java.util.Map<String, String> d;
+ Ice.InitializationData initData;
+
+ //
+ // Test IceSSL.VerifyPeer=0. Client does not have a certificate,
+ // and it doesn't trust the server certificate.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "", "");
+ initData.properties.setProperty("IceSSL.VerifyPeer", "0");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "");
+ d.put("IceSSL.VerifyPeer", "0");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.noCert();
+ test(!((IceSSL.ConnectionInfo)server.ice_getConnection().getInfo()).verified);
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+
+ //
+ // Test IceSSL.VerifyPeer=0. Client does not have a certificate,
+ // but it still verifies the server's.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "", "cacert1");
+ comm = Ice.Util.initialize(args, initData);
+ fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "");
+ d.put("IceSSL.VerifyPeer", "0");
+ server = fact.createServer(d);
+ try
+ {
+ server.noCert();
+ test(((IceSSL.ConnectionInfo)server.ice_getConnection().getInfo()).verified);
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+
+ //
+ // Test IceSSL.VerifyPeer=1. Client does not have a certificate.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "", "cacert1");
+ comm = Ice.Util.initialize(args, initData);
+ fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "");
+ d.put("IceSSL.VerifyPeer", "1");
+ server = fact.createServer(d);
+ try
+ {
+ server.noCert();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+
+ //
+ // Test IceSSL.VerifyPeer=2. This should fail because the client
+ // does not supply a certificate.
+ //
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "");
+ d.put("IceSSL.VerifyPeer", "2");
+ server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.SecurityException ex)
+ {
+ // Expected.
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ // Expected.
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+
+ comm.destroy();
+
+ //
+ // Test IceSSL.VerifyPeer=1. Client has a certificate.
+ //
+ // Provide "cacert1" to the client to verify the server
+ // certificate (without this the client connection wouln't be
+ // able to provide the certificate chain).
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ comm = Ice.Util.initialize(args, initData);
+ fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
+ d.put("IceSSL.VerifyPeer", "1");
+ server = fact.createServer(d);
+ try
+ {
+ java.security.cert.X509Certificate clientCert = loadCertificate(defaultDir + "/c_rsa_ca1.jks", "cert");
+ server.checkCert(clientCert.getSubjectDN().toString(), clientCert.getIssuerDN().toString());
+
+ java.security.cert.X509Certificate serverCert = loadCertificate(defaultDir + "/s_rsa_ca1.jks", "cert");
+ java.security.cert.X509Certificate caCert = loadCertificate(defaultDir + "/cacert1.jks", "ca");
+
+ IceSSL.NativeConnectionInfo info = (IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
+
+ test(info.nativeCerts.length == 2);
+ test(info.verified);
+
+ test(caCert.equals(info.nativeCerts[1]));
+ test(serverCert.equals(info.nativeCerts[0]));
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ fact.destroyServer(server);
+
+ //
+ // Test IceSSL.VerifyPeer=2. Client has a certificate.
+ //
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
+ d.put("IceSSL.VerifyPeer", "2");
+ server = fact.createServer(d);
+ try
+ {
+ java.security.cert.X509Certificate clientCert = loadCertificate(defaultDir + "/c_rsa_ca1.jks", "cert");
+ server.checkCert(clientCert.getSubjectDN().toString(), clientCert.getIssuerDN().toString());
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+
+ comm.destroy();
+
+ //
+ // Test IceSSL.VerifyPeer=1. This should fail because the
+ // client doesn't trust the server's CA.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "", "");
+ initData.properties.setProperty("IceSSL.VerifyPeer", "1");
+ comm = Ice.Util.initialize(args, initData);
+ fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
+ d.put("IceSSL.VerifyPeer", "0");
+ server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.SecurityException ex)
+ {
+ // Expected.
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+
+ comm.destroy();
+
+ //
+ // Test IceSSL.VerifyPeer=1. This should fail because the
+ // server doesn't trust the client's CA.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca2", "");
+ initData.properties.setProperty("IceSSL.VerifyPeer", "0");
+ comm = Ice.Util.initialize(args, initData);
+ fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "");
+ d.put("IceSSL.VerifyPeer", "1");
+ server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.SecurityException ex)
+ {
+ // Expected.
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ // Expected.
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+
+ //
+ // Test IceSSL.VerifyPeer=1. This should fail because the server
+ // does not supply a certificate.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost);
+ initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DH_anon.*AES.*)");
+ initData.properties.setProperty("IceSSL.VerifyPeer", "1");
+ comm = Ice.Util.initialize(args, initData);
+ fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost);
+ d.put("IceSSL.Ciphers", "NONE (.*DH_anon.*AES.*)");
+ d.put("IceSSL.VerifyPeer", "0");
+ server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.SecurityException ex)
+ {
+ // Expected.
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+
+ //
+ // This should succeed because the self signed certificate used by the server is
+ // trusted.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "", "cacert2");
+ initData.properties.setProperty("IceSSL.VerifyPeer", "1");
+ comm = Ice.Util.initialize(args, initData);
+ fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_cacert2", "");
+ d.put("IceSSL.VerifyPeer", "0");
+ server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+
+ //
+ // This should fail because the self signed certificate used by the server is not
+ // trusted.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost);
+ initData.properties.setProperty("IceSSL.VerifyPeer", "1");
+ comm = Ice.Util.initialize(args, initData);
+ fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_cacert2", "");
+ d.put("IceSSL.VerifyPeer", "0");
+ server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.SecurityException ex)
+ {
+ // Expected.
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+
+ //
+ // Verify that IceSSL.CheckCertName has no effect in a server.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ comm = Ice.Util.initialize(args, initData);
+
+ fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
+ d.put("IceSSL.CheckCertName", "1");
+ server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+
+ //
+ // Test IceSSL.CheckCertName. The test certificates for the server contain "127.0.0.1"
+ // as the common name or as a subject alternative name, so we only perform this test when
+ // the default host is "127.0.0.1".
+ //
+ if(defaultHost.equals("127.0.0.1"))
+ {
+ //
+ // Test subject alternative name.
+ //
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.CheckCertName", "1");
+ comm = Ice.Util.initialize(args, initData);
+
+ fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
+ server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ //
+ // Test common name.
+ //
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.CheckCertName", "1");
+ comm = Ice.Util.initialize(args, initData);
+
+ fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1_cn1", "cacert1");
+ server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ //
+ // Test common name again. The certificate used in this test has "127.0.0.11" as its
+ // common name, therefore the address "127.0.0.1" must NOT match.
+ //
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.CheckCertName", "1");
+ comm = Ice.Util.initialize(args, initData);
+
+ fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1_cn2", "cacert1");
+ server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ // Expected.
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ }
+ }
+ out.println("ok");
+
+ Ice.InitializationData initData;
+ java.util.Map<String, String> d;
+
+ out.print("testing certificate chains... ");
+ out.flush();
+ {
+ IceSSL.NativeConnectionInfo info;
+
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "", "");
+ initData.properties.setProperty("IceSSL.VerifyPeer", "0");
+ Ice.Communicator comm = Ice.Util.initialize(initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+
+ //
+ // The client can't verify the server certificate but it should
+ // still provide it. "s_rsa_ca1" doesn't include the root so the
+ // cert size should be 1.
+ //
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "");
+ d.put("IceSSL.VerifyPeer", "0");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ info = (IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
+ test(info.nativeCerts.length == 1);
+ test(!info.verified);
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+
+ //
+ // Setting the CA for the server shouldn't change anything, it
+ // shouldn't modify the cert chain sent to the client.
+ //
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
+ d.put("IceSSL.VerifyPeer", "0");
+ server = fact.createServer(d);
+ try
+ {
+ info = (IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
+ test(info.nativeCerts.length == 1);
+ test(!info.verified);
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+
+ //
+ // The client can't verify the server certificate but should
+ // still provide it. "s_rsa_wroot_ca1" includes the root so
+ // the cert size should be 2.
+ //
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_wroot_ca1", "");
+ d.put("IceSSL.VerifyPeer", "0");
+ server = fact.createServer(d);
+ try
+ {
+ info = (IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
+ test(info.nativeCerts.length == 2);
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+
+ //
+ // Now the client verifies the server certificate
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "", "cacert1");
+ initData.properties.setProperty("IceSSL.VerifyPeer", "1");
+ comm = Ice.Util.initialize(initData);
+
+ fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+
+ {
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "");
+ d.put("IceSSL.VerifyPeer", "0");
+ server = fact.createServer(d);
+ try
+ {
+ info = (IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
+ test(info.nativeCerts.length == 2);
+ test(info.verified);
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ }
+
+ comm.destroy();
+
+ //
+ // Try certificate with one intermediate and VerifyDepthMax=2
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "", "cacert1");
+ initData.properties.setProperty("IceSSL.VerifyPeer", "1");
+ initData.properties.setProperty("IceSSL.VerifyDepthMax", "2");
+ comm = Ice.Util.initialize(initData);
+
+ fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+
+ {
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_cai1", "");
+ d.put("IceSSL.VerifyPeer", "0");
+ server = fact.createServer(d);
+ try
+ {
+ server.ice_getConnection().getInfo();
+ test(false);
+ }
+ catch(Ice.SecurityException ex)
+ {
+ // Chain length too long
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ }
+ comm.destroy();
+
+ //
+ // Try with VerifyDepthMax to 3 (the default)
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "", "cacert1");
+ initData.properties.setProperty("IceSSL.VerifyPeer", "1");
+ //initData.properties.setProperty("IceSSL.VerifyDepthMax", "3");
+ comm = Ice.Util.initialize(initData);
+
+ fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+
+ {
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_cai1", "");
+ d.put("IceSSL.VerifyPeer", "0");
+ server = fact.createServer(d);
+ try
+ {
+ info = (IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
+ test(info.nativeCerts.length == 3);
+ test(info.verified);
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ }
+
+ {
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_cai2", "");
+ d.put("IceSSL.VerifyPeer", "0");
+ server = fact.createServer(d);
+ try
+ {
+ server.ice_getConnection().getInfo();
+ test(false);
+ }
+ catch(Ice.SecurityException ex)
+ {
+ // Chain length too long
+ }
+ fact.destroyServer(server);
+ }
+ comm.destroy();
+
+ //
+ // Increase VerifyDepthMax to 4
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "", "cacert1");
+ initData.properties.setProperty("IceSSL.VerifyPeer", "1");
+ initData.properties.setProperty("IceSSL.VerifyDepthMax", "4");
+ comm = Ice.Util.initialize(initData);
+
+ fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+
+ {
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_cai2", "");
+ d.put("IceSSL.VerifyPeer", "0");
+ server = fact.createServer(d);
+ try
+ {
+ info = (IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
+ test(info.nativeCerts.length == 4);
+ test(info.verified);
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ }
+
+ comm.destroy();
+
+ //
+ // Increase VerifyDepthMax to 4
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_cai2", "cacert1");
+ initData.properties.setProperty("IceSSL.VerifyPeer", "1");
+ initData.properties.setProperty("IceSSL.VerifyDepthMax", "4");
+ comm = Ice.Util.initialize(initData);
+
+ fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+
+ {
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_cai2", "cacert1");
+ d.put("IceSSL.VerifyPeer", "2");
+ server = fact.createServer(d);
+ try
+ {
+ server.ice_getConnection();
+ test(false);
+ }
+ catch(Ice.ProtocolException ex)
+ {
+ // Expected
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ // Expected
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ }
+
+ {
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_cai2", "cacert1");
+ d.put("IceSSL.VerifyPeer", "2");
+ d.put("IceSSL.VerifyDepthMax", "4");
+ server = fact.createServer(d);
+ try
+ {
+ server.ice_getConnection();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ }
+
+ comm.destroy();
+ }
+ out.println("ok");
+
+ out.print("testing custom certificate verifier... ");
+ out.flush();
+ {
+ //
+ // ADH is allowed but will not have a certificate.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost);
+ initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DH_anon.*AES.*)");
+ initData.properties.setProperty("IceSSL.VerifyPeer", "0");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ IceSSL.Plugin plugin = (IceSSL.Plugin)comm.getPluginManager().getPlugin("IceSSL");
+ test(plugin != null);
+ CertificateVerifierI verifier = new CertificateVerifierI();
+ plugin.setCertificateVerifier(verifier);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost);
+ d.put("IceSSL.Ciphers", "NONE (.*DH_anon.*AES.*)");
+ d.put("IceSSL.VerifyPeer", "0");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ String cipherSub = "DH_anon";
+ server.checkCipher(cipherSub);
+ IceSSL.NativeConnectionInfo info = (IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
+ test(info.cipher.indexOf(cipherSub) >= 0);
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ test(verifier.invoked());
+ test(!verifier.hadCert());
+
+ //
+ // Have the verifier return false. Close the connection explicitly
+ // to force a new connection to be established.
+ //
+ verifier.reset();
+ verifier.returnValue(false);
+ server.ice_getConnection().close(false);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.SecurityException ex)
+ {
+ // Expected.
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ test(verifier.invoked());
+ test(!verifier.hadCert());
+
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+
+ {
+ //
+ // Verify that a server certificate is present.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ IceSSL.Plugin plugin = (IceSSL.Plugin)comm.getPluginManager().getPlugin("IceSSL");
+ test(plugin != null);
+ CertificateVerifierI verifier = new CertificateVerifierI();
+ plugin.setCertificateVerifier(verifier);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
+ d.put("IceSSL.VerifyPeer", "2");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ test(verifier.invoked());
+ test(verifier.hadCert());
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ //
+ // Verify that verifier is installed via property.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.CertVerifier", "test.IceSSL.configuration.CertificateVerifierI");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ IceSSL.Plugin plugin = (IceSSL.Plugin)comm.getPluginManager().getPlugin("IceSSL");
+ test(plugin != null);
+ test(plugin.getCertificateVerifier() != null);
+ comm.destroy();
+ }
+ out.println("ok");
+
+ out.print("testing protocols... ");
+ out.flush();
+ {
+ //
+ // This should fail because the client and server have no protocol
+ // in common.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.Protocols", "ssl3");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
+ d.put("IceSSL.VerifyPeer", "2");
+ d.put("IceSSL.Protocols", "tls1");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.SecurityException ex)
+ {
+ // Expected.
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ // Expected for thread pool.
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+
+ //
+ // SSLv3 has been disabled by default in latests JDK updates.
+ //
+// //
+// // SSLv3 is disabled by default in the IBM JDK.
+// //
+// if(System.getProperty("java.vendor").toLowerCase().indexOf("ibm") == -1)
+// {
+// //
+// // This should succeed.
+// //
+// comm = Ice.Util.initialize(args, initData);
+// fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+// test(fact != null);
+// d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
+// d.put("IceSSL.VerifyPeer", "2");
+// d.put("IceSSL.Protocols", "tls1, ssl3");
+// server = fact.createServer(d);
+// try
+// {
+// server.ice_ping();
+// }
+// catch(Ice.LocalException ex)
+// {
+// ex.printStackTrace();
+// test(false);
+// }
+// fact.destroyServer(server);
+// comm.destroy();
+// }
+ }
+
+ {
+ //
+ // This should fail because the client ony enables SSLv3 and the server
+ // uses the default protocol set that disables SSLv3
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.Protocols", "ssl3");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
+ d.put("IceSSL.VerifyPeer", "2");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.SecurityException ex)
+ {
+ // Expected.
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ // Expected for thread pool.
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+
+ {
+ //
+ // This should success because the client and the server enables SSLv3
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.Protocols", "ssl3");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
+ d.put("IceSSL.VerifyPeer", "2");
+ d.put("IceSSL.Protocols", "ssl3, tls1_0, tls1_1, tls1_2");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.SecurityException ex)
+ {
+ // Expected.
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ // Expected for thread pool.
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+
+ out.println("ok");
+
+ out.print("testing expired certificates... ");
+ out.flush();
+ {
+ //
+ // This should fail because the server's certificate is expired.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1_exp", "cacert1");
+ d.put("IceSSL.VerifyPeer", "2");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.SecurityException ex)
+ {
+ // Expected.
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+
+ //
+ // This should fail because the client's certificate is expired.
+ //
+ initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1_exp.jks");
+ initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks");
+ comm = Ice.Util.initialize(args, initData);
+ fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
+ d.put("IceSSL.VerifyPeer", "2");
+ server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ // Expected.
+ }
+ catch(Ice.SecurityException ex)
+ {
+ // Expected.
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ out.println("ok");
+
+ out.print("testing multiple CA certificates... ");
+ out.flush();
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacerts");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca2", "cacerts");
+ d.put("IceSSL.VerifyPeer", "2");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ out.println("ok");
+
+ out.print("testing passwords... ");
+ out.flush();
+ {
+ //
+ // Test password failure.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost);
+ initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks");
+ // Don't specify the password.
+ try
+ {
+ Ice.Util.initialize(args, initData);
+ test(false);
+ }
+ catch(Ice.PluginInitializationException ex)
+ {
+ // Expected.
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ }
+ {
+ //
+ // Test password failure with callback.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost);
+ initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks");
+ initData.properties.setProperty("Ice.InitPlugins", "0");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Ice.PluginManager pm = comm.getPluginManager();
+ IceSSL.Plugin plugin = (IceSSL.Plugin)pm.getPlugin("IceSSL");
+ test(plugin != null);
+ PasswordCallbackI cb = new PasswordCallbackI("bogus");
+ plugin.setPasswordCallback(cb);
+ try
+ {
+ pm.initializePlugins();
+ test(false);
+ }
+ catch(Ice.PluginInitializationException ex)
+ {
+ // Expected.
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ comm.destroy();
+ }
+ {
+ //
+ // Test installation of password callback.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost);
+ initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks");
+ initData.properties.setProperty("Ice.InitPlugins", "0");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Ice.PluginManager pm = comm.getPluginManager();
+ IceSSL.Plugin plugin = (IceSSL.Plugin)pm.getPlugin("IceSSL");
+ test(plugin != null);
+ PasswordCallbackI cb = new PasswordCallbackI();
+ plugin.setPasswordCallback(cb);
+ test(plugin.getPasswordCallback() == cb);
+ try
+ {
+ pm.initializePlugins();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ comm.destroy();
+ }
+ {
+ //
+ // Test password callback property.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost);
+ initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks");
+ initData.properties.setProperty("IceSSL.PasswordCallback", "test.IceSSL.configuration.PasswordCallbackI");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Ice.PluginManager pm = comm.getPluginManager();
+ IceSSL.Plugin plugin = (IceSSL.Plugin)pm.getPlugin("IceSSL");
+ test(plugin != null);
+ test(plugin.getPasswordCallback() != null);
+ comm.destroy();
+ }
+ out.println("ok");
+
+ out.print("testing ciphers... ");
+ out.flush();
+ {
+ //
+ // The server has a certificate but the client doesn't. They should
+ // negotiate to use ADH since we explicitly enable it.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost);
+ initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DH_anon.*AES.*)");
+ initData.properties.setProperty("IceSSL.VerifyPeer", "0");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
+ d.put("IceSSL.Ciphers", "ALL");
+ d.put("IceSSL.VerifyPeer", "1");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ //
+ // Configure a server with RSA and DSA certificates.
+ //
+ // First try a client with a DSA certificate.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_dsa_ca1", "cacert1");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ d.put("IceSSL.VerifyPeer", "1");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+
+ //
+ // Next try a client with an RSA certificate.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ comm = Ice.Util.initialize(args, initData);
+ fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ d.put("IceSSL.VerifyPeer", "1");
+ server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+
+ //
+ // Next try a client with ADH. This should fail.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost);
+ initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DH_anon.*AES.*)");
+ comm = Ice.Util.initialize(args, initData);
+ fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ d.put("IceSSL.VerifyPeer", "1");
+ server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.SecurityException ex)
+ {
+ // Expected.
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ // Expected for thread pool.
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ //
+ // Configure a server with RSA and a client with DSA. This should fail.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_dsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DSS.*)");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
+ d.put("IceSSL.VerifyPeer", "2");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.SecurityException ex)
+ {
+ // Expected.
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ // Expected for thread pool.
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ //
+ // Configure the server with both RSA and DSA certificates, but use the
+ // Alias property to select the RSA certificate. This should fail.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_dsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DSS.*)");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ d.put("IceSSL.Alias", "rsacert");
+ d.put("IceSSL.VerifyPeer", "2");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.SecurityException ex)
+ {
+ // Expected.
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ // Expected for thread pool.
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ //
+ // Configure the server with both RSA and DSA certificates, but use the
+ // Alias property to select the DSA certificate. This should succeed.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "cacert1", "");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ d.put("IceSSL.Alias", "dsacert");
+ d.put("IceSSL.VerifyPeer", "1");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ //
+ // RSA is used by default, so we examine the negotiated cipher to determine whether
+ // DSA was actually used.
+ //
+ IceSSL.ConnectionInfo info = (IceSSL.ConnectionInfo)server.ice_getConnection().getInfo();
+ test(info.cipher.toLowerCase().contains("dss"));
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ out.println("ok");
+
+ out.print("testing IceSSL.TrustOnly... ");
+ out.flush();
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.TrustOnly",
+ "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Server");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.TrustOnly",
+ "!C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Server");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.TrustOnly",
+ "C=US, ST=Florida, O=\"ZeroC, Inc.\", OU=Ice, emailAddress=info@zeroc.com, CN=Server");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ d.put("IceSSL.TrustOnly",
+ "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Client");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ d.put("IceSSL.TrustOnly",
+ "!C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Client");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.TrustOnly", "CN=Server");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.TrustOnly", "!CN=Server");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ d.put("IceSSL.TrustOnly", "CN=Client");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ d.put("IceSSL.TrustOnly", "!CN=Client");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.TrustOnly", "CN=Client");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ d.put("IceSSL.TrustOnly", "CN=Server");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.TrustOnly", "C=Canada,CN=Server");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.TrustOnly", "!C=Canada,CN=Server");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.TrustOnly", "C=Canada;CN=Server");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.TrustOnly", "!C=Canada;!CN=Server");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.TrustOnly", "!CN=Server1"); // Should not match "Server"
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ d.put("IceSSL.TrustOnly", "!CN=Client1"); // Should not match "Client"
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ //
+ // Test rejection when client does not supply a certificate.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost);
+ initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DH_anon.*AES.*)");
+ initData.properties.setProperty("IceSSL.VerifyPeer", "0");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost);
+ d.put("IceSSL.TrustOnly",
+ "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Client");
+ d.put("IceSSL.Ciphers", "NONE (.*DH_anon.*AES.*)");
+ d.put("IceSSL.VerifyPeer", "0");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ //
+ // Test rejection when client does not supply a certificate.
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost);
+ initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DH_anon.*AES.*)");
+ initData.properties.setProperty("IceSSL.VerifyPeer", "0");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost);
+ d.put("IceSSL.TrustOnly",
+ "!C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Client");
+ d.put("IceSSL.Ciphers", "NONE (.*DH_anon.*AES.*)");
+ d.put("IceSSL.VerifyPeer", "0");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ //
+ // Rejection takes precedence (client).
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.TrustOnly", "ST=Florida;!CN=Server;C=US");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ //
+ // Rejection takes precedence (server).
+ //
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ d.put("IceSSL.TrustOnly", "ST=Florida;!CN=Client;C=US");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ out.println("ok");
+
+ out.print("testing IceSSL.TrustOnly.Client... ");
+ out.flush();
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.TrustOnly.Client",
+ "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Server");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ // Should have no effect.
+ d.put("IceSSL.TrustOnly.Client",
+ "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Server");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.TrustOnly.Client",
+ "!C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Server");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ // Should have no effect.
+ d.put("IceSSL.TrustOnly.Client", "CN=Client");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.TrustOnly.Client", "CN=Client");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ initData.properties.setProperty("IceSSL.TrustOnly.Client", "!CN=Client");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ out.println("ok");
+
+ out.print("testing IceSSL.TrustOnly.Server... ");
+ out.flush();
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ // Should have no effect.
+ initData.properties.setProperty("IceSSL.TrustOnly.Server",
+ "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Client");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ d.put("IceSSL.TrustOnly.Server",
+ "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Client");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ d.put("IceSSL.TrustOnly.Server",
+ "!C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Client");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ // Should have no effect.
+ initData.properties.setProperty("IceSSL.TrustOnly.Server", "!CN=Server");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ d.put("IceSSL.TrustOnly.Server", "CN=Server");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ d.put("IceSSL.TrustOnly.Server", "!CN=Client");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ out.println("ok");
+
+ out.print("testing IceSSL.TrustOnly.Server.<AdapterName>... ");
+ out.flush();
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ d.put("IceSSL.TrustOnly.Server", "CN=bogus");
+ d.put("IceSSL.TrustOnly.Server.ServerAdapter",
+ "C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Client");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ d.put("IceSSL.TrustOnly.Server.ServerAdapter",
+ "!C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Client");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ d.put("IceSSL.TrustOnly.Server.ServerAdapter", "CN=bogus");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
+ Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ test(fact != null);
+ d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
+ d.put("IceSSL.TrustOnly.Server.ServerAdapter", "!CN=bogus");
+ ServerPrx server = fact.createServer(d);
+ try
+ {
+ server.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ fact.destroyServer(server);
+ comm.destroy();
+ }
+ out.println("ok");
+
+ out.print("testing system CAs... ");
+ out.flush();
+ {
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost);
+ initData.properties.setProperty("IceSSL.VerifyDepthMax", "4");
+ initData.properties.setProperty("Ice.Override.Timeout", "5000"); // 5s timeout
+ Ice.Communicator comm = Ice.Util.initialize(initData);
+ Ice.ObjectPrx p = comm.stringToProxy("dummy:wss -h demo.zeroc.com -p 5064");
+ try
+ {
+ p.ice_ping();
+ test(false);
+ }
+ catch(Ice.SecurityException ex)
+ {
+ // Expected, by default we don't check for system CAs.
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+
+ initData = createClientProps(defaultProperties, defaultDir, defaultHost);
+ initData.properties.setProperty("IceSSL.VerifyDepthMax", "4");
+ initData.properties.setProperty("Ice.Override.Timeout", "5000"); // 5s timeout
+ initData.properties.setProperty("IceSSL.UsePlatformCAs", "1");
+ comm = Ice.Util.initialize(initData);
+ p = comm.stringToProxy("dummy:wss -h demo.zeroc.com -p 5064");
+ try
+ {
+ Ice.WSConnectionInfo info = (Ice.WSConnectionInfo)p.ice_getConnection().getInfo();
+ IceSSL.ConnectionInfo sslinfo = (IceSSL.ConnectionInfo)info.underlying;
+ test(sslinfo.verified);
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ comm.destroy();
+ }
+ out.println("ok");
+
+ return factory;
+ }
+}
diff --git a/java-compat/test/src/main/java/test/IceSSL/configuration/CertificateVerifierI.java b/java-compat/test/src/main/java/test/IceSSL/configuration/CertificateVerifierI.java
new file mode 100644
index 00000000000..7f3d4099f5d
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/configuration/CertificateVerifierI.java
@@ -0,0 +1,99 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceSSL.configuration;
+
+public class CertificateVerifierI implements IceSSL.CertificateVerifier
+{
+ public
+ CertificateVerifierI()
+ {
+ reset();
+ }
+
+ @Override
+ public boolean
+ verify(IceSSL.NativeConnectionInfo info)
+ {
+ if(info.nativeCerts != null)
+ {
+ try
+ {
+ java.util.Collection<java.util.List<?> > subjectAltNames =
+ ((java.security.cert.X509Certificate)info.nativeCerts[0]).getSubjectAlternativeNames();
+ test(subjectAltNames != null);
+ java.util.List<String> ipAddresses = new java.util.ArrayList<String>();
+ java.util.List<String> dnsNames = new java.util.ArrayList<String>();
+ for(java.util.List<?> l : subjectAltNames)
+ {
+ test(!l.isEmpty());
+ Integer n = (Integer)l.get(0);
+ if(n.intValue() == 7)
+ {
+ ipAddresses.add((String)l.get(1));
+ }
+ else if(n.intValue() == 2)
+ {
+ dnsNames.add((String)l.get(1));
+ }
+ }
+
+ test(dnsNames.contains("server"));
+ test(ipAddresses.contains("127.0.0.1"));
+ }
+ catch(java.security.cert.CertificateParsingException ex)
+ {
+ test(false);
+ }
+ }
+
+ _hadCert = info.nativeCerts != null;
+ _invoked = true;
+ return _returnValue;
+ }
+
+ void
+ reset()
+ {
+ _returnValue = true;
+ _invoked = false;
+ _hadCert = false;
+ }
+
+ void
+ returnValue(boolean b)
+ {
+ _returnValue = b;
+ }
+
+ boolean
+ invoked()
+ {
+ return _invoked;
+ }
+
+ boolean
+ hadCert()
+ {
+ return _hadCert;
+ }
+
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private boolean _returnValue;
+ private boolean _invoked;
+ private boolean _hadCert;
+}
diff --git a/java-compat/test/src/main/java/test/IceSSL/configuration/Client.java b/java-compat/test/src/main/java/test/IceSSL/configuration/Client.java
new file mode 100644
index 00000000000..fb92b152d10
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/configuration/Client.java
@@ -0,0 +1,51 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceSSL.configuration;
+
+import java.io.PrintWriter;
+
+import test.IceSSL.configuration.Test.ServerFactoryPrx;
+
+public class Client extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ PrintWriter out = getWriter();
+ if(args.length < 1)
+ {
+ out.println("Usage: client testdir");
+ return 1;
+ }
+
+ ServerFactoryPrx factory = AllTests.allTests(this, args[0], out);
+ factory.shutdown();
+
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.IceSSL.configuration");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Client c = new Client();
+ int status = c.main("Client", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/IceSSL/configuration/PasswordCallbackI.java b/java-compat/test/src/main/java/test/IceSSL/configuration/PasswordCallbackI.java
new file mode 100644
index 00000000000..c4a3011911d
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/configuration/PasswordCallbackI.java
@@ -0,0 +1,48 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceSSL.configuration;
+
+public class PasswordCallbackI implements IceSSL.PasswordCallback
+{
+ public
+ PasswordCallbackI()
+ {
+ _password = "password";
+ }
+
+ public
+ PasswordCallbackI(String password)
+ {
+ _password = password;
+ }
+
+ @Override
+ public char[]
+ getPassword(String alias)
+ {
+ return _password.toCharArray();
+ }
+
+ @Override
+ public char[]
+ getTruststorePassword()
+ {
+ return null;
+ }
+
+ @Override
+ public char[]
+ getKeystorePassword()
+ {
+ return null;
+ }
+
+ private String _password;
+}
diff --git a/java-compat/test/src/main/java/test/IceSSL/configuration/Server.java b/java-compat/test/src/main/java/test/IceSSL/configuration/Server.java
new file mode 100644
index 00000000000..54aeb9a9f0f
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/configuration/Server.java
@@ -0,0 +1,46 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceSSL.configuration;
+
+
+public class Server extends test.Util.Application
+{
+ @Override
+ public int run(String[] args)
+ {
+ Ice.Communicator communicator = communicator();
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "tcp -p 12010");
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.Identity id = Ice.Util.stringToIdentity("factory");
+ adapter.add(new ServerFactoryI(), id);
+ adapter.activate();
+
+ communicator.waitForShutdown();
+ return 0;
+ }
+
+ @Override
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ Ice.InitializationData initData = createInitializationData() ;
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package.Test", "test.IceSSL.configuration");
+ return initData;
+ }
+
+ public static void main(String[] args)
+ {
+ Server c = new Server();
+ int status = c.main("Server", args);
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/IceSSL/configuration/ServerFactoryI.java b/java-compat/test/src/main/java/test/IceSSL/configuration/ServerFactoryI.java
new file mode 100644
index 00000000000..6acd389c8fd
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/configuration/ServerFactoryI.java
@@ -0,0 +1,70 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceSSL.configuration;
+import test.IceSSL.configuration.Test.ServerPrx;
+import test.IceSSL.configuration.Test.ServerPrxHelper;
+import test.IceSSL.configuration.Test._ServerFactoryDisp;
+
+class ServerFactoryI extends _ServerFactoryDisp
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ @Override
+ public ServerPrx
+ createServer(java.util.Map<String, String> props, Ice.Current current)
+ {
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties();
+ for(java.util.Map.Entry<String, String> i : props.entrySet())
+ {
+ initData.properties.setProperty(i.getKey(), i.getValue());
+ }
+
+ String[] args = new String[0];
+ Ice.Communicator communicator = Ice.Util.initialize(args, initData);
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("ServerAdapter", "ssl");
+ ServerI server = new ServerI(communicator);
+ Ice.ObjectPrx obj = adapter.addWithUUID(server);
+ _servers.put(obj.ice_getIdentity(), server);
+ adapter.activate();
+
+ return ServerPrxHelper.uncheckedCast(obj);
+ }
+
+ @Override
+ public void
+ destroyServer(ServerPrx srv, Ice.Current current)
+ {
+ Ice.Identity key = srv.ice_getIdentity();
+ if(_servers.containsKey(key))
+ {
+ ServerI server = _servers.get(key);
+ server.destroy();
+ _servers.remove(key);
+ }
+ }
+
+ @Override
+ public void
+ shutdown(Ice.Current current)
+ {
+ test(_servers.size() == 0);
+ current.adapter.getCommunicator().shutdown();
+ }
+
+ private java.util.Map<Ice.Identity, ServerI> _servers = new java.util.HashMap<Ice.Identity, ServerI>();
+}
diff --git a/java-compat/test/src/main/java/test/IceSSL/configuration/ServerI.java b/java-compat/test/src/main/java/test/IceSSL/configuration/ServerI.java
new file mode 100644
index 00000000000..b81f9212d1b
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/configuration/ServerI.java
@@ -0,0 +1,85 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceSSL.configuration;
+import test.IceSSL.configuration.Test._ServerDisp;
+
+class ServerI extends _ServerDisp
+{
+ ServerI(Ice.Communicator communicator)
+ {
+ _communicator = communicator;
+ }
+
+ @Override
+ public void
+ noCert(Ice.Current current)
+ {
+ try
+ {
+ IceSSL.NativeConnectionInfo info = (IceSSL.NativeConnectionInfo)current.con.getInfo();
+ test(info.certs == null);
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ }
+
+ @Override
+ public void
+ checkCert(String subjectDN, String issuerDN, Ice.Current current)
+ {
+ try
+ {
+ IceSSL.NativeConnectionInfo info = (IceSSL.NativeConnectionInfo)current.con.getInfo();
+ java.security.cert.X509Certificate cert = (java.security.cert.X509Certificate)info.nativeCerts[0];
+ test(info.verified);
+ test(info.nativeCerts.length == 2 &&
+ cert.getSubjectDN().toString().equals(subjectDN) &&
+ cert.getIssuerDN().toString().equals(issuerDN));
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ }
+
+ @Override
+ public void
+ checkCipher(String cipher, Ice.Current current)
+ {
+ try
+ {
+ IceSSL.NativeConnectionInfo info = (IceSSL.NativeConnectionInfo)current.con.getInfo();
+ test(info.cipher.indexOf(cipher) >= 0);
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ }
+
+ public void
+ destroy()
+ {
+ _communicator.destroy();
+ }
+
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private Ice.Communicator _communicator;
+}
diff --git a/java-compat/test/src/main/java/test/IceSSL/configuration/Test.ice b/java-compat/test/src/main/java/test/IceSSL/configuration/Test.ice
new file mode 100644
index 00000000000..9d389c7a8b7
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/configuration/Test.ice
@@ -0,0 +1,32 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.IceSSL.configuration"]]
+module Test
+{
+
+interface Server
+{
+ void noCert();
+ void checkCert(string subjectDN, string issuerDN);
+ void checkCipher(string cipher);
+};
+
+dictionary<string, string> Properties;
+
+interface ServerFactory
+{
+ Server* createServer(Properties props);
+ void destroyServer(Server* srv);
+ void shutdown();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/IceSSL/configuration/run.py b/java-compat/test/src/main/java/test/IceSSL/configuration/run.py
new file mode 100755
index 00000000000..2d87a19bc40
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceSSL/configuration/run.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+testdir = '"%s"' % os.getcwd()
+
+TestUtil.clientServerTest(additionalClientOptions=testdir)
diff --git a/java-compat/test/src/main/java/test/IceUtil/inputUtil/Client.java b/java-compat/test/src/main/java/test/IceUtil/inputUtil/Client.java
new file mode 100644
index 00000000000..e5414ed48dc
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceUtil/inputUtil/Client.java
@@ -0,0 +1,169 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.IceUtil.inputUtil;
+
+public class Client
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static void
+ main(String[] argvs)
+ {
+ System.out.print("testing string to command line arguments... ");
+ System.out.flush();
+ String[] args;
+
+ try
+ {
+ test(IceUtilInternal.Options.split("").length == 0);
+
+ args = IceUtilInternal.Options.split("\"\"");
+ test(args.length == 1 && args[0].equals(""));
+ args = IceUtilInternal.Options.split("''");
+ test(args.length == 1 && args[0].equals(""));
+ args = IceUtilInternal.Options.split("$''");
+ test(args.length == 1 && args[0].equals(""));
+
+ args = IceUtilInternal.Options.split("-a -b -c");
+ test(args.length == 3 && args[0].equals("-a") && args[1].equals("-b") && args[2].equals("-c"));
+ args = IceUtilInternal.Options.split("\"-a\" '-b' $'-c'");
+ test(args.length == 3 && args[0].equals("-a") && args[1].equals("-b") && args[2].equals("-c"));
+ args = IceUtilInternal.Options.split(" '-b' \"-a\" $'-c' ");
+ test(args.length == 3 && args[0].equals("-b") && args[1].equals("-a") && args[2].equals("-c"));
+ args = IceUtilInternal.Options.split(" $'-c' '-b' \"-a\" ");
+ test(args.length == 3 && args[0].equals("-c") && args[1].equals("-b") && args[2].equals("-a"));
+
+ // Testing single quote
+ args = IceUtilInternal.Options.split("-Dir='C:\\\\test\\\\file'"); // -Dir='C:\\test\\file'
+ test(args.length == 1 && args[0].equals("-Dir=C:\\\\test\\\\file")); // -Dir=C:\\test\\file
+ args = IceUtilInternal.Options.split("-Dir='C:\\test\\file'"); // -Dir='C:\test\file'
+ test(args.length == 1 && args[0].equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file
+ args = IceUtilInternal.Options.split("-Dir='C:\\test\\filewith\"quote'"); // -Dir='C:\test\filewith"quote'
+ test(args.length == 1 && args[0].equals("-Dir=C:\\test\\filewith\"quote")); // -Dir=C:\test\filewith"quote
+
+ // Testing double quote
+ args = IceUtilInternal.Options.split("-Dir=\"C:\\\\test\\\\file\""); // -Dir="C:\\test\\file"
+ test(args.length == 1 && args[0].equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file
+ args = IceUtilInternal.Options.split("-Dir=\"C:\\test\\file\""); // -Dir="C:\test\file"
+ test(args.length == 1 && args[0].equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file
+ args = IceUtilInternal.Options.split("-Dir=\"C:\\test\\filewith\\\"quote\""); // -Dir="C:\test\filewith\"quote"
+ test(args.length == 1 && args[0].equals("-Dir=C:\\test\\filewith\"quote")); // -Dir=C:\test\filewith"quote
+
+ // Testing ANSI quote
+ args = IceUtilInternal.Options.split("-Dir=$'C:\\\\test\\\\file'"); // -Dir=$'C:\\test\\file'
+ test(args.length == 1 && args[0].equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file
+ args = IceUtilInternal.Options.split("-Dir=$'C:\\oest\\oile'"); // -Dir='C:\oest\oile'
+ test(args.length == 1 && args[0].equals("-Dir=C:\\oest\\oile")); // -Dir=C:\oest\oile
+ args = IceUtilInternal.Options.split("-Dir=$'C:\\oest\\oilewith\"quote'"); // -Dir=$'C:\oest\oilewith"quote'
+ test(args.length == 1 && args[0].equals("-Dir=C:\\oest\\oilewith\"quote")); // -Dir=C:\oest\oilewith"quote
+ args = IceUtilInternal.Options.split("-Dir=$'\\103\\072\\134\\164\\145\\163\\164\\134\\146\\151\\154\\145'");
+ test(args.length == 1 && args[0].equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file
+ args = IceUtilInternal.Options.split("-Dir=$'\\x43\\x3A\\x5C\\x74\\x65\\x73\\x74\\x5C\\x66\\x69\\x6C\\x65'");
+ test(args.length == 1 && args[0].equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file
+ args = IceUtilInternal.Options.split("-Dir=$'\\cM\\c_'"); // Control characters
+ test(args.length == 1 && args[0].equals("-Dir=\015\037"));
+ args = IceUtilInternal.Options.split("-Dir=$'C:\\\\\\146\\x66\\cMi'"); // -Dir=$'C:\\\146\x66i\cMi'
+ test(args.length == 1 && args[0].equals("-Dir=C:\\ff\015i"));
+ args = IceUtilInternal.Options.split("-Dir=$'C:\\\\\\cM\\x66\\146i'"); // -Dir=$'C:\\\cM\x66\146i'
+ test(args.length == 1 && args[0].equals("-Dir=C:\\\015ffi"));
+ }
+ catch(IceUtilInternal.Options.BadQuote ex)
+ {
+ test(false);
+ }
+
+ String[] badQuoteCommands = new String[6];
+ badQuoteCommands[0] = "\"";
+ badQuoteCommands[1] = "'";
+ badQuoteCommands[2] = "\\$'";
+ badQuoteCommands[3] = "-Dir=\"test";
+ badQuoteCommands[4] = "-Dir='test";
+ badQuoteCommands[5] = "-Dir=$'test";
+ for(int i = 0; i < 6; ++i)
+ {
+ try
+ {
+ IceUtilInternal.Options.split(badQuoteCommands[i]);
+ test(false);
+ }
+ catch(IceUtilInternal.Options.BadQuote ex)
+ {
+ }
+ }
+
+ System.out.println("ok");
+
+ System.out.print("checking string splitting... ");
+ System.out.flush();
+ {
+ String[] arr;
+
+ arr = IceUtilInternal.StringUtil.splitString("", "");
+ test(arr.length == 0);
+ arr = IceUtilInternal.StringUtil.splitString("", ":");
+ test(arr.length == 0);
+ arr = IceUtilInternal.StringUtil.splitString("a", "");
+ test(arr.length == 1 && arr[0].equals("a"));
+ arr = IceUtilInternal.StringUtil.splitString("a", ":");
+ test(arr.length == 1 && arr[0].equals("a"));
+ arr = IceUtilInternal.StringUtil.splitString("ab", "");
+ test(arr.length == 1 && arr[0].equals("ab"));
+ arr = IceUtilInternal.StringUtil.splitString("ab:", ":");
+ test(arr.length == 1 && arr[0].equals("ab"));
+ arr = IceUtilInternal.StringUtil.splitString(":ab", ":");
+ test(arr.length == 1 && arr[0].equals("ab"));
+ arr = IceUtilInternal.StringUtil.splitString("a:b", ":");
+ test(arr.length == 2 && arr[0].equals("a") && arr[1].equals("b"));
+ arr = IceUtilInternal.StringUtil.splitString(":a:b:", ":");
+ test(arr.length == 2 && arr[0].equals("a") && arr[1].equals("b"));
+
+ arr = IceUtilInternal.StringUtil.splitString("\"a\"", ":");
+ test(arr.length == 1 && arr[0].equals("a"));
+ arr = IceUtilInternal.StringUtil.splitString("\"a\":b", ":");
+ test(arr.length == 2 && arr[0].equals("a") && arr[1].equals("b"));
+ arr = IceUtilInternal.StringUtil.splitString("\"a\":\"b\"", ":");
+ test(arr.length == 2 && arr[0].equals("a") && arr[1].equals("b"));
+ arr = IceUtilInternal.StringUtil.splitString("\"a:b\"", ":");
+ test(arr.length == 1 && arr[0].equals("a:b"));
+ arr = IceUtilInternal.StringUtil.splitString("a=\"a:b\"", ":");
+ test(arr.length == 1 && arr[0].equals("a=a:b"));
+
+ arr = IceUtilInternal.StringUtil.splitString("'a'", ":");
+ test(arr.length == 1 && arr[0].equals("a"));
+ arr = IceUtilInternal.StringUtil.splitString("'\"a'", ":");
+ test(arr.length == 1 && arr[0].equals("\"a"));
+ arr = IceUtilInternal.StringUtil.splitString("\"'a\"", ":");
+ test(arr.length == 1 && arr[0].equals("'a"));
+
+ arr = IceUtilInternal.StringUtil.splitString("a\\'b", ":");
+ test(arr.length == 1 && arr[0].equals("a'b"));
+ arr = IceUtilInternal.StringUtil.splitString("'a:b\\'c'", ":");
+ test(arr.length == 1 && arr[0].equals("a:b'c"));
+ arr = IceUtilInternal.StringUtil.splitString("a\\\"b", ":");
+ test(arr.length == 1 && arr[0].equals("a\"b"));
+ arr = IceUtilInternal.StringUtil.splitString("\"a:b\\\"c\"", ":");
+ test(arr.length == 1 && arr[0].equals("a:b\"c"));
+ arr = IceUtilInternal.StringUtil.splitString("'a:b\"c'", ":");
+ test(arr.length == 1 && arr[0].equals("a:b\"c"));
+ arr = IceUtilInternal.StringUtil.splitString("\"a:b'c\"", ":");
+ test(arr.length == 1 && arr[0].equals("a:b'c"));
+
+ test(IceUtilInternal.StringUtil.splitString("a\"b", ":") == null);
+ }
+ System.out.println("ok");
+ }
+}
diff --git a/java-compat/test/src/main/java/test/IceUtil/inputUtil/run.py b/java-compat/test/src/main/java/test/IceUtil/inputUtil/run.py
new file mode 100755
index 00000000000..7f349d5cef0
--- /dev/null
+++ b/java-compat/test/src/main/java/test/IceUtil/inputUtil/run.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+sys.stdout.write("starting client... ")
+sys.stdout.flush()
+clientProc = TestUtil.startClient("test.IceUtil.inputUtil.Client",startReader=False)
+print("ok")
+clientProc.startReader()
+clientProc.waitTestSuccess()
diff --git a/java-compat/test/src/main/java/test/Slice/generation/.gitignore b/java-compat/test/src/main/java/test/Slice/generation/.gitignore
new file mode 100644
index 00000000000..90b07e9d451
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Slice/generation/.gitignore
@@ -0,0 +1 @@
+classes
diff --git a/java-compat/test/src/main/java/test/Slice/generation/File1.ice b/java-compat/test/src/main/java/test/Slice/generation/File1.ice
new file mode 100644
index 00000000000..edb99ef014f
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Slice/generation/File1.ice
@@ -0,0 +1,21 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Slice.generation"]]
+module Test
+{
+
+interface Interface1
+{
+ void method();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Slice/generation/File2.ice b/java-compat/test/src/main/java/test/Slice/generation/File2.ice
new file mode 100644
index 00000000000..b034c844594
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Slice/generation/File2.ice
@@ -0,0 +1,21 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Slice.generation"]]
+module Test
+{
+
+interface Interface2
+{
+ void method();
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Slice/generation/list-generated.out b/java-compat/test/src/main/java/test/Slice/generation/list-generated.out
new file mode 100644
index 00000000000..cbacf36a41c
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Slice/generation/list-generated.out
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<generated>
+ <source name="File1.ice">
+ <file name="classes/test/Slice/generation/Test/_Interface1Operations.java"/>
+ <file name="classes/test/Slice/generation/Test/_Interface1OperationsNC.java"/>
+ <file name="classes/test/Slice/generation/Test/_Marker.java"/>
+ <file name="classes/test/Slice/generation/Test/Interface1.java"/>
+ <file name="classes/test/Slice/generation/Test/Interface1Holder.java"/>
+ <file name="classes/test/Slice/generation/Test/Interface1PrxHolder.java"/>
+ <file name="classes/test/Slice/generation/Test/Interface1PrxHelper.java"/>
+ <file name="classes/test/Slice/generation/Test/Interface1Prx.java"/>
+ <file name="classes/test/Slice/generation/Test/_Interface1Disp.java"/>
+ <file name="classes/test/Slice/generation/Test/Callback_Interface1_method.java"/>
+ <output></output>
+ </source>
+ <source name="File2.ice">
+ <file name="classes/test/Slice/generation/Test/_Interface2Operations.java"/>
+ <file name="classes/test/Slice/generation/Test/_Interface2OperationsNC.java"/>
+ <file name="classes/test/Slice/generation/Test/_Marker.java"/>
+ <file name="classes/test/Slice/generation/Test/Interface2.java"/>
+ <file name="classes/test/Slice/generation/Test/Interface2Holder.java"/>
+ <file name="classes/test/Slice/generation/Test/Interface2PrxHolder.java"/>
+ <file name="classes/test/Slice/generation/Test/Interface2PrxHelper.java"/>
+ <file name="classes/test/Slice/generation/Test/Interface2Prx.java"/>
+ <file name="classes/test/Slice/generation/Test/_Interface2Disp.java"/>
+ <file name="classes/test/Slice/generation/Test/Callback_Interface2_method.java"/>
+ <output></output>
+ </source>
+</generated>
diff --git a/java-compat/test/src/main/java/test/Slice/generation/run.py b/java-compat/test/src/main/java/test/Slice/generation/run.py
new file mode 100755
index 00000000000..58c1f07b722
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Slice/generation/run.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys, re
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel os.getcwd()!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+sys.stdout.write("testing list-generated... ")
+sys.stdout.flush()
+
+slice2java = TestUtil.getSliceTranslator("java")
+if not os.path.exists("classes"):
+ os.mkdir("classes")
+
+command = '"' + slice2java + '" --compat --list-generated --output-dir classes File1.ice File2.ice'
+if TestUtil.debug:
+ sys.stdout.write("(%s) " % command)
+p = TestUtil.runCommand(command)
+lines1 = p.stdout.readlines()
+lines2 = open(os.path.join(os.getcwd(), "list-generated.out"), "r").readlines()
+if len(lines1) != len(lines2):
+ print("failed!")
+ sys.exit(1)
+
+i = 0
+while i < len(lines1):
+ if sys.version_info[0] == 2:
+ line1 = lines1[i].strip()
+ line2 = lines2[i].strip()
+ else:
+ line1 = lines1[i].decode("utf-8").strip()
+ line2 = lines2[i].strip()
+ if line1 != line2:
+ print("failed!")
+ sys.exit(1)
+ i = i + 1
+else:
+ print("ok")
+
+sys.exit(0)
diff --git a/java-compat/test/src/main/java/test/Slice/keyword/Client.java b/java-compat/test/src/main/java/test/Slice/keyword/Client.java
new file mode 100644
index 00000000000..c972b6320f1
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Slice/keyword/Client.java
@@ -0,0 +1,229 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Slice.keyword;
+import test.Slice.keyword._abstract.AMD_catch_checkedCast;
+import test.Slice.keyword._abstract._assert;
+import test.Slice.keyword._abstract._break;
+import test.Slice.keyword._abstract._catch;
+import test.Slice.keyword._abstract._catchDisp;
+import test.Slice.keyword._abstract._default;
+import test.Slice.keyword._abstract._defaultDisp;
+import test.Slice.keyword._abstract._else;
+import test.Slice.keyword._abstract._finalize;
+import test.Slice.keyword._abstract._hashCode;
+import test.Slice.keyword._abstract._import;
+import test.Slice.keyword._abstract._new;
+import test.Slice.keyword._abstract._switch;
+import test.Slice.keyword._abstract.catchPrx;
+import test.Slice.keyword._abstract.defaultPrx;
+import test.Slice.keyword._abstract.defaultPrxHelper;
+import test.Slice.keyword._abstract.elsePrx;
+import test.Slice.keyword._abstract.finalizePrx;
+import test.Slice.keyword._abstract.forHolder;
+import test.Slice.keyword._abstract.gotoHolder;
+
+public class Client
+{
+ static public class catchI extends _catchDisp
+ {
+ public
+ catchI()
+ {
+ }
+
+ @Override
+ public void
+ checkedCast_async(AMD_catch_checkedCast __cb, int _clone, Ice.Current __current)
+ {
+ int _continue = 0;
+ __cb.ice_response(_continue);
+ }
+ }
+
+ static public class defaultI extends _defaultDisp
+ {
+ public
+ defaultI()
+ {
+ }
+
+ @Override
+ public void
+ _do(Ice.Current __current)
+ {
+ assert __current.operation.equals("do");
+ }
+ }
+
+ static public class elseI extends _else
+ {
+ public
+ elseI()
+ {
+ }
+
+ @Override
+ public void
+ foo(defaultPrx _equals, Ice.IntHolder _final, Ice.Current __current)
+ {
+ }
+ }
+
+ static public class newI implements _new
+ {
+ public
+ newI()
+ {
+ }
+
+ @Override
+ public _assert
+ _notify(_break _notifyAll, _else _null, _finalize _package,
+ elsePrx _private, finalizePrx _protected,
+ catchPrx _public, defaultPrx _return, int _static, int _strictfp, int _super)
+ throws _hashCode, _import
+ {
+ return null;
+ }
+ }
+
+ static public class finalizeI extends _finalize
+ {
+ public
+ finalizeI()
+ {
+ }
+
+ @Override
+ public void
+ checkedCast_async(AMD_catch_checkedCast __cb, int _clone, Ice.Current __current)
+ {
+ int _continue = 0;
+ __cb.ice_response(_continue);
+ }
+
+ @Override
+ public void
+ _do(Ice.Current __current)
+ {
+ }
+
+ @Override
+ public void
+ foo(defaultPrx _equals, Ice.IntHolder _final, Ice.Current __current)
+ {
+ }
+ }
+
+ //
+ // This section of the test is present to ensure that the C++ types
+ // are named correctly. It is not expected to run.
+ //
+ @SuppressWarnings({ "unused", "null" })
+ private static void
+ testtypes()
+ {
+ _assert v = _assert._boolean;
+ _break b = new _break();
+ b._case = 0;
+ catchPrx c = null;
+ c._checkedCast(0, new Ice.IntHolder());
+ _catch c1 = new catchI();
+ defaultPrx d = null;
+ d._do();
+ _default d1 = new defaultI();
+ elsePrx e;
+ _else e1 = new elseI();
+ finalizePrx f = null;
+ f._checkedCast(0, new Ice.IntHolder());
+ f._do();
+ _finalize f1 = new finalizeI();
+ forHolder g;
+ gotoHolder h;
+ _hashCode i = new _hashCode();
+ i._if = 0;
+ _import j = new _import();
+ j._if = 0;
+ j._instanceof = 1;
+ j._native = 2;
+ _new k = new newI();
+ assert _switch.value == 0;
+ }
+
+ private static int
+ run(String[] args, Ice.Communicator communicator)
+ {
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new defaultI(), Ice.Util.stringToIdentity("test"));
+ adapter.activate();
+
+ System.out.print("Testing operation name... ");
+ System.out.flush();
+ defaultPrx p = defaultPrxHelper.uncheckedCast(
+ adapter.createProxy(Ice.Util.stringToIdentity("test")));
+ p._do();
+ System.out.println("ok");
+
+ return 0;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ int status = 0;
+ Ice.Communicator communicator = null;
+
+ try
+ {
+ //
+ // In this test, we need at least two threads in the
+ // client side thread pool for nested AMI.
+ //
+ Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.Package._abstract", "test.Slice.keyword");
+ initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2");
+ initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0");
+ initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+
+ //
+ // We must set MessageSizeMax to an explicit values,
+ // because we run tests to check whether
+ // Ice.MemoryLimitException is raised as expected.
+ //
+ initData.properties.setProperty("Ice.MessageSizeMax", "100");
+
+ communicator = Ice.Util.initialize(argsH, initData);
+ status = run(argsH.value, communicator);
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ status = 1;
+ }
+
+ if(communicator != null)
+ {
+ try
+ {
+ communicator.destroy();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ status = 1;
+ }
+ }
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Slice/keyword/Key.ice b/java-compat/test/src/main/java/test/Slice/keyword/Key.ice
new file mode 100644
index 00000000000..2f0e36ae3f0
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Slice/keyword/Key.ice
@@ -0,0 +1,79 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Slice.keyword"]]
+module abstract
+{
+
+enum assert
+{
+ boolean
+};
+
+struct break
+{
+ int case;
+};
+
+interface catch
+{
+ ["amd"] void checkedCast(int clone, out int continue);
+};
+
+interface default
+{
+ void do();
+};
+
+class else
+{
+ int if;
+ void foo(default* equals, out int final);
+};
+
+class finalize extends else implements default, catch
+{
+};
+sequence<assert> for;
+dictionary<string, assert> goto;
+
+exception hashCode
+{
+ int if;
+};
+
+exception import extends hashCode
+{
+ int instanceof;
+ int native;
+};
+
+local interface new
+{
+ assert notify( break notifyAll, else null, finalize package, else* private, finalize * protected, catch* public,
+ default* return, int static, int strictfp, int super)
+ throws hashCode, import;
+};
+
+const int switch = 0;
+const int synchronized = 0;
+const int this = 0;
+const int throw = 0;
+const int toString = 0;
+const int try = 0;
+const int uncheckedCast = 0;
+const int volatile = 0;
+const int wait = 0;
+const int while = 0;
+const int finally = 0;
+const int getClass = 0;
+
+};
diff --git a/java-compat/test/src/main/java/test/Slice/keyword/run.py b/java-compat/test/src/main/java/test/Slice/keyword/run.py
new file mode 100755
index 00000000000..851ddcd2d36
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Slice/keyword/run.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+sys.stdout.write("starting client... ")
+sys.stdout.flush()
+clientProc = TestUtil.startClient("test.Slice.keyword.Client",startReader=False)
+print("ok")
+clientProc.startReader()
+clientProc.waitTestSuccess()
diff --git a/java-compat/test/src/main/java/test/Slice/macros/Client.java b/java-compat/test/src/main/java/test/Slice/macros/Client.java
new file mode 100644
index 00000000000..8a9cf97d3d9
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Slice/macros/Client.java
@@ -0,0 +1,54 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Slice.macros;
+
+import test.Slice.macros.Test.Default;
+import test.Slice.macros.Test.NoDefault;
+import test.Slice.macros.Test.JavaOnly;
+
+public class Client
+{
+ private static void test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ public static void
+ main(String[] args)
+ {
+ int status = 0;
+ try
+ {
+ System.out.print("testing Slice predefined macros... ");
+ Default d = new Default();
+ test(d.x == 10);
+ test(d.y == 10);
+
+ NoDefault nd = new NoDefault();
+ test(nd.x != 10);
+ test(nd.y != 10);
+
+ JavaOnly c = new JavaOnly();
+ test(c.lang.equals("java"));
+ test(c.version == Ice.Util.intVersion());
+ System.out.println("ok");
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ status = 1;
+ }
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Slice/macros/Test.ice b/java-compat/test/src/main/java/test/Slice/macros/Test.ice
new file mode 100644
index 00000000000..b3c6979e9bb
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Slice/macros/Test.ice
@@ -0,0 +1,58 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Slice.macros"]]
+
+//
+// This macro sets the default value only when compiling with slice2java.
+//
+#ifdef __SLICE2JAVA__
+# define DEFAULT(X) = X
+#else
+# define DEFAULT(X) /**/
+#endif
+
+//
+// This macro sets the default value only when not compiling with slice2java.
+//
+#ifndef __SLICE2JAVA__
+# define NODEFAULT(X) = X
+#else
+# define NODEFAULT(X) /**/
+#endif
+
+module Test
+{
+
+class Default
+{
+ int x DEFAULT(10);
+ int y DEFAULT(10);
+};
+
+class NoDefault
+{
+ int x NODEFAULT(10);
+ int y NODEFAULT(10);
+};
+
+//
+// This class is only defined when compiling with slice2java.
+//
+#ifdef __SLICE2JAVA__
+class JavaOnly
+{
+ string lang DEFAULT("java");
+ int version DEFAULT(ICE_VERSION);
+};
+#endif
+
+};
diff --git a/java-compat/test/src/main/java/test/Slice/macros/run.py b/java-compat/test/src/main/java/test/Slice/macros/run.py
new file mode 100755
index 00000000000..a8b0dad4496
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Slice/macros/run.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+sys.stdout.write("starting client... ")
+sys.stdout.flush()
+clientProc = TestUtil.startClient("test.Slice.macros.Client",startReader=False)
+print("ok")
+clientProc.startReader()
+clientProc.waitTestSuccess()
diff --git a/java-compat/test/src/main/java/test/Slice/structure/Client.java b/java-compat/test/src/main/java/test/Slice/structure/Client.java
new file mode 100644
index 00000000000..ede1f92c0c8
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Slice/structure/Client.java
@@ -0,0 +1,315 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Slice.structure;
+
+import test.Slice.structure.Test.S1;
+import test.Slice.structure.Test.S2;
+import test.Slice.structure.Test.C;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+
+public class Client
+{
+ private static void test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private static void allTests(Ice.Communicator communicator)
+ {
+ System.out.print("testing equals() for Slice structures... ");
+ System.out.flush();
+
+ //
+ // Define some default values.
+ //
+ C def_cls = new C(5);
+ S1 def_s = new S1("name");
+ String[] def_ss = new String[]{ "one", "two", "three" };
+ ArrayList<Integer> def_il = new ArrayList<Integer>();
+ def_il.add(1);
+ def_il.add(2);
+ def_il.add(3);
+ Map<String, String> def_sd = new HashMap<String, String>();
+ def_sd.put("abc", "def");
+ Ice.ObjectPrx def_prx = communicator.stringToProxy("test");
+ S2 def_s2 = new S2(true, (byte)98, (short)99, 100, 101, (float)1.0, 2.0, "string", def_ss, def_il, def_sd,
+ def_s, def_cls, def_prx);
+
+ //
+ // Compare default-constructed structures.
+ //
+ {
+ test(new S2().equals(new S2()));
+ }
+
+ //
+ // Change one primitive member at a time.
+ //
+ {
+ S2 v;
+
+ v = def_s2.clone();
+ test(v.equals(def_s2));
+
+ v = def_s2.clone();
+ v.bo = false;
+ test(!v.equals(def_s2));
+
+ v = def_s2.clone();
+ v.by--;
+ test(!v.equals(def_s2));
+
+ v = def_s2.clone();
+ v.sh--;
+ test(!v.equals(def_s2));
+
+ v = def_s2.clone();
+ v.i--;
+ test(!v.equals(def_s2));
+
+ v = def_s2.clone();
+ v.l--;
+ test(!v.equals(def_s2));
+
+ v = def_s2.clone();
+ v.f--;
+ test(!v.equals(def_s2));
+
+ v = def_s2.clone();
+ v.d--;
+ test(!v.equals(def_s2));
+
+ v = def_s2.clone();
+ v.str = "";
+ test(!v.equals(def_s2));
+ }
+
+ //
+ // String member
+ //
+ {
+ S2 v1, v2;
+
+ v1 = def_s2.clone();
+ v1.str = new String(def_s2.str);
+ test(v1.equals(def_s2));
+
+ v1 = def_s2.clone();
+ v2 = def_s2.clone();
+ v1.str = null;
+ test(!v1.equals(v2));
+
+ v1 = def_s2.clone();
+ v2 = def_s2.clone();
+ v2.str = null;
+ test(!v1.equals(v2));
+
+ v1 = def_s2.clone();
+ v2 = def_s2.clone();
+ v1.str = null;
+ v2.str = null;
+ test(v1.equals(v2));
+ }
+
+ //
+ // Sequence member
+ //
+ {
+ S2 v1, v2;
+
+ v1 = def_s2.clone();
+ v1.ss = def_s2.ss.clone();
+ test(v1.equals(def_s2));
+
+ v1 = def_s2.clone();
+ v2 = def_s2.clone();
+ v1.ss = null;
+ test(!v1.equals(v2));
+
+ v1 = def_s2.clone();
+ v2 = def_s2.clone();
+ v2.ss = null;
+ test(!v1.equals(v2));
+ }
+
+ //
+ // Custom sequence member
+ //
+ {
+ S2 v1, v2;
+
+ v1 = def_s2.clone();
+ v1.il = new ArrayList<Integer>(def_s2.il);
+ test(v1.equals(def_s2));
+
+ v1 = def_s2.clone();
+ v1.il = new ArrayList<Integer>();
+ test(!v1.equals(def_s2));
+
+ v1 = def_s2.clone();
+ v2 = def_s2.clone();
+ v1.il = null;
+ test(!v1.equals(v2));
+
+ v1 = def_s2.clone();
+ v2 = def_s2.clone();
+ v2.il = null;
+ test(!v1.equals(v2));
+ }
+
+ //
+ // Dictionary member
+ //
+ {
+ S2 v1, v2;
+
+ v1 = def_s2.clone();
+ v1.sd = new HashMap<String, String>(def_s2.sd);
+ test(v1.equals(def_s2));
+
+ v1 = def_s2.clone();
+ v1.sd = new HashMap<String, String>();
+ test(!v1.equals(def_s2));
+
+ v1 = def_s2.clone();
+ v2 = def_s2.clone();
+ v1.sd = null;
+ test(!v1.equals(v2));
+
+ v1 = def_s2.clone();
+ v2 = def_s2.clone();
+ v2.sd = null;
+ test(!v1.equals(v2));
+ }
+
+ //
+ // Struct member
+ //
+ {
+ S2 v1, v2;
+
+ v1 = def_s2.clone();
+ v1.s = def_s2.s.clone();
+ test(v1.equals(def_s2));
+
+ v1 = def_s2.clone();
+ v1.s = new S1("name");
+ test(v1.equals(def_s2));
+
+ v1 = def_s2.clone();
+ v1.s = new S1("noname");
+ test(!v1.equals(def_s2));
+
+ v1 = def_s2.clone();
+ v2 = def_s2.clone();
+ v1.s = null;
+ test(!v1.equals(v2));
+
+ v1 = def_s2.clone();
+ v2 = def_s2.clone();
+ v2.s = null;
+ test(!v1.equals(v2));
+ }
+
+ //
+ // Class member
+ //
+ {
+ S2 v1, v2;
+
+ v1 = def_s2.clone();
+ v1.cls = def_s2.cls.clone();
+ test(!v1.equals(def_s2));
+
+ v1 = def_s2.clone();
+ v2 = def_s2.clone();
+ v1.cls = null;
+ test(!v1.equals(v2));
+
+ v1 = def_s2.clone();
+ v2 = def_s2.clone();
+ v2.cls = null;
+ test(!v1.equals(v2));
+ }
+
+ //
+ // Proxy member
+ //
+ {
+ S2 v1, v2;
+
+ v1 = def_s2.clone();
+ v1.prx = communicator.stringToProxy("test");
+ test(v1.equals(def_s2));
+
+ v1 = def_s2.clone();
+ v1.prx = communicator.stringToProxy("test2");
+ test(!v1.equals(def_s2));
+
+ v1 = def_s2.clone();
+ v2 = def_s2.clone();
+ v1.prx = null;
+ test(!v1.equals(v2));
+
+ v1 = def_s2.clone();
+ v2 = def_s2.clone();
+ v2.prx = null;
+ test(!v1.equals(v2));
+ }
+
+ System.out.println("ok");
+ }
+
+ private static int run(String[] args, Ice.Communicator communicator)
+ {
+ allTests(communicator);
+
+ return 0;
+ }
+
+ public static void main(String[] args)
+ {
+ int status = 0;
+ Ice.Communicator communicator = null;
+
+ try
+ {
+ Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
+ communicator = Ice.Util.initialize(argsH);
+ status = run(argsH.value, communicator);
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ status = 1;
+ }
+
+ if(communicator != null)
+ {
+ try
+ {
+ communicator.destroy();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ status = 1;
+ }
+ }
+
+ System.gc();
+ System.exit(status);
+ }
+}
diff --git a/java-compat/test/src/main/java/test/Slice/structure/Test.ice b/java-compat/test/src/main/java/test/Slice/structure/Test.ice
new file mode 100644
index 00000000000..16a3a82b128
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Slice/structure/Test.ice
@@ -0,0 +1,48 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+[["java:package:test.Slice.structure"]]
+module Test
+{
+
+sequence<string> StringSeq;
+["java:type:java.util.ArrayList<Integer>"] sequence<int> IntList;
+dictionary<string, string> StringDict;
+
+class C
+{
+ int i;
+};
+
+struct S1
+{
+ string name;
+};
+
+struct S2
+{
+ bool bo;
+ byte by;
+ short sh;
+ int i;
+ long l;
+ float f;
+ double d;
+ string str;
+ StringSeq ss;
+ IntList il;
+ StringDict sd;
+ S1 s;
+ C cls;
+ Object* prx;
+};
+
+};
diff --git a/java-compat/test/src/main/java/test/Slice/structure/run.py b/java-compat/test/src/main/java/test/Slice/structure/run.py
new file mode 100755
index 00000000000..ecb3cf4e54e
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Slice/structure/run.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..",
+ "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(os.path.join(path[0], "scripts"))
+import TestUtil
+
+sys.stdout.write("starting client... ")
+sys.stdout.flush()
+clientProc = TestUtil.startClient("test.Slice.structure.Client",startReader=False)
+print("ok")
+clientProc.startReader()
+clientProc.waitTestSuccess()
diff --git a/java-compat/test/src/main/java/test/Util/Application.java b/java-compat/test/src/main/java/test/Util/Application.java
new file mode 100644
index 00000000000..5c072418482
--- /dev/null
+++ b/java-compat/test/src/main/java/test/Util/Application.java
@@ -0,0 +1,284 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package test.Util;
+
+import Ice.*;
+
+public abstract class Application
+{
+ public final int WAIT = 2;
+
+
+
+ public interface ServerReadyListener
+ {
+ void serverReady();
+ }
+
+ public interface CommunicatorListener
+ {
+ void communicatorInitialized(Communicator c);
+ }
+
+ public
+ Application()
+ {
+ }
+
+ //
+ // This main() must be called by the global main(). main()
+ // initializes the Communicator, calls run(), and destroys
+ // the Communicator upon return from run(). It thereby handles
+ // all exceptions properly, i.e., error messages are printed
+ // if exceptions propagate to main(), and the Communicator is
+ // always destroyed, regardless of exceptions.
+ //
+ public final int
+ main(String appName, String[] args)
+ {
+ Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
+ Ice.InitializationData initData = getInitData(argsH);
+ initData.classLoader = _classLoader;
+ return main(appName, argsH.value, initData);
+ }
+
+ public final int
+ main(String appName, String[] args, InitializationData initializationData)
+ {
+ java.io.PrintWriter writer = getWriter();
+ if(_communicator != null)
+ {
+ writer.println(appName + ": only one instance of the Application class can be used");
+ return 1;
+ }
+
+ _testName = appName;
+
+ //
+ // We parse the properties here to extract Ice.ProgramName.
+ //
+ StringSeqHolder argHolder = new StringSeqHolder(args);
+ if(initializationData == null)
+ {
+ initializationData = getInitData(argHolder);
+ }
+
+ InitializationData initData;
+ if(initializationData != null)
+ {
+ initData = initializationData.clone();
+ }
+ else
+ {
+ initData = new InitializationData();
+ }
+ initData.properties = Util.createProperties(argHolder, initData.properties);
+
+ //
+ // If the process logger is the default logger, we replace it with a
+ // a logger that uses the program name as the prefix.
+ //
+ if(Util.getProcessLogger() instanceof LoggerI)
+ {
+ Util.setProcessLogger(new LoggerI(initData.properties.getProperty("Ice.ProgramName"), ""));
+ }
+
+ int status = 0;
+
+ try
+ {
+ _communicator = Util.initialize(argHolder, initData);
+ if(_communicatorListener != null)
+ {
+ _communicatorListener.communicatorInitialized(_communicator);
+ }
+ status = run(argHolder.value);
+ if(status == WAIT)
+ {
+ if(_cb != null)
+ {
+ _cb.serverReady();
+ }
+ _communicator.waitForShutdown();
+ status = 0;
+ }
+ }
+ catch(LocalException ex)
+ {
+ writer.println(_testName + ": " + ex);
+ ex.printStackTrace();
+ status = 1;
+ }
+ catch(java.lang.Exception ex)
+ {
+ writer.println(_testName + ": unknown exception");
+ ex.printStackTrace(writer);
+ status = 1;
+ }
+ catch(java.lang.Error err)
+ {
+ //
+ // We catch Error to avoid hangs in some non-fatal situations
+ //
+ writer.println(_testName + ": Java error");
+ err.printStackTrace(writer);
+ status = 1;
+ }
+ writer.flush();
+
+ if(_communicator != null)
+ {
+ try
+ {
+ _communicator.destroy();
+ }
+ catch(LocalException ex)
+ {
+ writer.println(_testName + ": " + ex);
+ ex.printStackTrace(writer);
+ status = 1;
+ }
+ catch(java.lang.Exception ex)
+ {
+ writer.println(_testName + ": unknown exception");
+ ex.printStackTrace(writer);
+ status = 1;
+ }
+ _communicator = null;
+ }
+ writer.flush();
+
+ return status;
+ }
+
+ public void stop()
+ {
+ if(_communicator != null)
+ {
+ _communicator.shutdown();
+ }
+ }
+
+ //
+ // Initialize a new communicator.
+ //
+ public Ice.Communicator initialize(InitializationData initData)
+ {
+ Ice.Communicator communicator = Util.initialize(initData);
+ if(_communicatorListener != null)
+ {
+ _communicatorListener.communicatorInitialized(communicator);
+ }
+ return communicator;
+ }
+
+ public Ice.Communicator initialize()
+ {
+ Ice.Communicator communicator = Util.initialize();
+ if(_communicatorListener != null)
+ {
+ _communicatorListener.communicatorInitialized(communicator);
+ }
+ return communicator;
+ }
+
+ public abstract int run(String[] args);
+
+ //
+ // Hook to override the initialization data. This hook is
+ // necessary because some properties must be set prior to
+ // communicator initialization.
+ //
+ protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ {
+ return createInitializationData();
+ }
+
+ public java.io.PrintWriter getWriter()
+ {
+ return _printWriter;
+ }
+
+ public void setWriter(java.io.Writer writer)
+ {
+ _printWriter = new java.io.PrintWriter(writer);
+ }
+
+ public void setLogger(Ice.Logger logger)
+ {
+ _logger = logger;
+ }
+
+ public void setServerReadyListener(ServerReadyListener cb)
+ {
+ _cb = cb;
+ }
+
+ public void setCommunicatorListener(CommunicatorListener listener)
+ {
+ _communicatorListener = listener;
+ }
+
+ public void serverReady()
+ {
+ if(_cb != null)
+ {
+ _cb.serverReady();
+ }
+ }
+
+ static public boolean isAndroid()
+ {
+ return IceInternal.Util.isAndroid();
+ }
+ //
+ // Return the application name, i.e., argv[0].
+ //
+ public String appName()
+ {
+ return _testName;
+ }
+
+ public Communicator communicator()
+ {
+ return _communicator;
+ }
+
+ public void setClassLoader(ClassLoader c)
+ {
+ _classLoader = c;
+ }
+
+ public ClassLoader getClassLoader()
+ {
+ return _classLoader;
+ }
+
+ public InitializationData createInitializationData()
+ {
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.classLoader = _classLoader;
+ initData.logger = _logger;
+ return initData;
+ }
+
+ public ClassLoader classLoader()
+ {
+ return _classLoader;
+ }
+
+ private ClassLoader _classLoader;
+ private String _testName;
+ private Communicator _communicator;
+ private Ice.Logger _logger = null;
+ private java.io.PrintWriter _printWriter = new java.io.PrintWriter(new java.io.OutputStreamWriter(System.out));
+ private ServerReadyListener _cb = null;
+ private CommunicatorListener _communicatorListener = null;
+}
diff --git a/java/build.gradle b/java/build.gradle
index 7752992c4d7..118858c410d 100644
--- a/java/build.gradle
+++ b/java/build.gradle
@@ -15,6 +15,7 @@ subprojects {
apply plugin: 'idea'
apply from: "$rootProject.projectDir/gradle/ice.gradle"
+
repositories {
if (slice.jarDir) {
flatDir {
@@ -60,7 +61,7 @@ dist.dependsOn(project(":icebox").assemble)
dist.dependsOn(project(":icediscovery").assemble)
dist.dependsOn(project(":icepatch2").assemble)
dist.dependsOn(project(":icestorm").assemble)
-dist.dependsOn(project(":IceGridGUI").assemble)
+//dist.dependsOn(project(":IceGridGUI").assemble)
//
// Used to build the gradle wrapper to automatically download and install
diff --git a/java/gradle.properties b/java/gradle.properties
index 8d318390105..9ccd1e1aa94 100644
--- a/java/gradle.properties
+++ b/java/gradle.properties
@@ -87,4 +87,3 @@ jarDir =
// The installation directory for executable files, if not set, defaults to <prefix>/bin.
//
binDir =
-
diff --git a/java/gradle/wrapper/gradle-wrapper.jar b/java/gradle/wrapper/gradle-wrapper.jar
index 3baa851b28c..d3b83982b9b 100644
--- a/java/gradle/wrapper/gradle-wrapper.jar
+++ b/java/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/java/gradle/wrapper/gradle-wrapper.properties b/java/gradle/wrapper/gradle-wrapper.properties
index f3ba03367a8..b3de2719c77 100644
--- a/java/gradle/wrapper/gradle-wrapper.properties
+++ b/java/gradle/wrapper/gradle-wrapper.properties
@@ -1,4 +1,4 @@
-#Thu Jul 21 10:44:21 EDT 2016
+#Thu Jul 28 13:36:19 EDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
diff --git a/java/settings.gradle b/java/settings.gradle
index 4c726e637ca..19fc73ac5d2 100644
--- a/java/settings.gradle
+++ b/java/settings.gradle
@@ -14,8 +14,8 @@ include ':icediscovery'
project(':icediscovery').projectDir = new File('src/IceDiscovery')
include ':icelocatordiscovery'
project(':icelocatordiscovery').projectDir = new File('src/IceLocatorDiscovery')
-include ':icebt'
-project(':icebt').projectDir = new File('src/IceBT')
+//include ':icebt'
+//project(':icebt').projectDir = new File('src/IceBT')
include ':icebox'
project(':icebox').projectDir = new File('src/IceBox')
include ':glacier2'
diff --git a/java/src/Glacier2/build.gradle b/java/src/Glacier2/build.gradle
index feedebb7041..c8c2a985fcb 100644
--- a/java/src/Glacier2/build.gradle
+++ b/java/src/Glacier2/build.gradle
@@ -7,16 +7,27 @@
//
// **********************************************************************
-sourceCompatibility = iceSourceCompatibility
-targetCompatibility = iceTargetCompatibility
+//sourceCompatibility = iceSourceCompatibility
+//targetCompatibility = iceTargetCompatibility
+sourceCompatibility = 1.8
+targetCompatibility = 1.8
project.ext.displayName = "Glacier2"
project.ext.description = "Firewall traversal for Ice"
+sourceSets {
+ main {
+ java {
+ // ice.jar already includes a marker for the IceMX package.
+ exclude '**/com/zeroc/IceMX/_Marker.java'
+ }
+ }
+}
+
slice {
java {
set1 {
- args = "--ice --tie --checksum Glacier2.SliceChecksums"
+ args = "--ice --checksum com.zeroc.Glacier2.SliceChecksums"
files = fileTree(dir: "${sliceDir}/Glacier2", includes:['*.ice'], excludes:["*F.ice"])
}
}
diff --git a/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/Application.java b/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/Application.java
new file mode 100644
index 00000000000..c81eb917632
--- /dev/null
+++ b/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/Application.java
@@ -0,0 +1,500 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Glacier2;
+
+import com.zeroc.Ice.Util;
+import com.zeroc.Ice.ACMHeartbeat;
+import com.zeroc.IceInternal.Ex;
+
+/**
+ * An extension of com.zeroc.Ice.Application that makes it easy to write
+ * Glacier2 applications.
+ *
+ * <p> Applications must create a derived class that implements the
+ * {@link #createSession} and {@link #runWithSession} methods.<p>
+ *
+ * The base class invokes {@link #createSession} to create a new
+ * Glacier2 session and then invokes {@link #runWithSession} in
+ * which the subclass performs its application logic. The base class
+ * automatically destroys the session when {@link #runWithSession}
+ * returns.
+ *
+ * If {@link #runWithSession} calls {@link #restart} or raises any of
+ * the exceptions com.zeroc.Ice.ConnectionRefusedException,
+ * com.zeroc.Ice.ConnectionLostException, com.zeroc.Ice.UnknownLocalException,
+ * com.zeroc.Ice.RequestFailedException, or com.zeroc.Ice.TimeoutException, the base
+ * class destroys the current session and restarts the application
+ * with another call to {@link #createSession} followed by
+ * {@link #runWithSession}.
+ *
+ * The application can optionally override the {@link #sessionDestroyed}
+ * callback method if it needs to take action when connectivity with
+ * the Glacier2 router is lost.
+ *
+ * A program can contain only one instance of this class.
+ *
+ * @see com.zeroc.Ice.Application
+ * @see com.zeroc.Glacier2.Router
+ * @see com.zeroc.Glacier2.Session
+ * @see com.zeroc.Ice.Communicator
+ * @see com.zeroc.Ice.Logger
+ * @see #runWithSession
+ **/
+public abstract class Application extends com.zeroc.Ice.Application
+{
+ /**
+ * This exception is raised if the session should be restarted.
+ */
+ public class RestartSessionException extends Exception
+ {
+ }
+
+ /**
+ * Initializes an instance that calls {@link Communicator#shutdown} if
+ * a signal is received.
+ **/
+ public Application()
+ {
+ }
+
+ /**
+ * Initializes an instance that handles signals according to the signal
+ * policy.
+ *
+ * @param signalPolicy Determines how to respond to signals.
+ *
+ * @see SignalPolicy
+ **/
+ public Application(com.zeroc.Ice.SignalPolicy signalPolicy)
+ {
+ super(signalPolicy);
+ }
+
+ /**
+ * Called once the communicator has been initialized and the Glacier2 session
+ * has been established. A derived class must implement <code>runWithSession</code>,
+ * which is the application's starting method.
+ *
+ * @param args The argument vector for the application. <code>Application</code>
+ * scans the argument vector passed to <code>main</code> for options that are
+ * specific to the Ice run time and removes them; therefore, the vector passed
+ * to <code>run</code> is free from Ice-related options and contains only options
+ * and arguments that are application-specific.
+ *
+ * @return The <code>runWithSession</code> method should return zero for successful
+ * termination, and non-zero otherwise. <code>Application.main</code> returns the
+ * value returned by <code>runWithSession</code>.
+ **/
+ public abstract int runWithSession(String[] args)
+ throws RestartSessionException;
+
+ /**
+ * Run should not be overridden for com.zeroc.Glacier2.Application. Instead
+ * <code>runWithSession</code> should be used.
+ */
+ @Override
+ final public int run(String[] args)
+ {
+ // This shouldn't be called.
+ assert false;
+ return 0;
+ }
+
+ /**
+ * Called to restart the application's Glacier2 session. This
+ * method never returns. The exception produce an application restart
+ * when called from the Application main thread.
+ *
+ * @throws RestartSessionException This exception is always thrown.
+ **/
+ public void restart()
+ throws RestartSessionException
+ {
+ throw new RestartSessionException();
+ }
+
+ /**
+ * Creates a new Glacier2 session. A call to
+ * <code>createSession</code> always precedes a call to
+ * <code>runWithSession</code>. If <code>com.zeroc.Ice.LocalException</code>
+ * is thrown from this method, the application is terminated.
+ *
+ * @return The Glacier2 session.
+ **/
+ abstract public com.zeroc.Glacier2.SessionPrx createSession();
+
+ /**
+ * Called when the session refresh thread detects that the session has been
+ * destroyed. A subclass can override this method to take action after the
+ * loss of connectivity with the Glacier2 router. This method is called
+ * according to the Ice invocation dipsatch rules (in other words, it
+ * uses the same rules as an servant upcall or AMI callback).
+ **/
+ public void sessionDestroyed()
+ {
+ }
+
+ /**
+ * Returns the Glacier2 router proxy
+ * @return The router proxy.
+ **/
+ public static com.zeroc.Glacier2.RouterPrx router()
+ {
+ return _router;
+ }
+
+ /**
+ * Returns the Glacier2 session proxy
+ * @return The session proxy.
+ **/
+ public static com.zeroc.Glacier2.SessionPrx session()
+ {
+ return _session;
+ }
+
+ /**
+ * Returns the category to be used in the identities of all of the client's
+ * callback objects. Clients must use this category for the router to
+ * forward callback requests to the intended client.
+ * @return The category.
+ * @throws SessionNotExistException No session exists.
+ **/
+ public String categoryForClient()
+ throws SessionNotExistException
+ {
+ if(_router == null)
+ {
+ throw new SessionNotExistException();
+ }
+ return _category;
+ }
+
+ /**
+ * Create a new Ice identity for callback objects with the given
+ * identity name field.
+ * @return The identity.
+ * @throws SessionNotExistException No session exists.
+ **/
+ public com.zeroc.Ice.Identity createCallbackIdentity(String name)
+ throws SessionNotExistException
+ {
+ return new com.zeroc.Ice.Identity(name, categoryForClient());
+ }
+
+ /**
+ * Adds a servant to the callback object adapter's Active Servant Map with a UUID.
+ * @param servant The servant to add.
+ * @return The proxy for the servant.
+ * @throws SessionNotExistException No session exists.
+ **/
+ public com.zeroc.Ice.ObjectPrx addWithUUID(com.zeroc.Ice.Object servant)
+ throws SessionNotExistException
+ {
+ return objectAdapter().add(servant, createCallbackIdentity(java.util.UUID.randomUUID().toString()));
+ }
+
+ /**
+ * Creates an object adapter for callback objects.
+ * @return The object adapter.
+ * @throws SessionNotExistException No session exists.
+ */
+ public com.zeroc.Ice.ObjectAdapter objectAdapter()
+ throws SessionNotExistException
+ {
+ if(_router == null)
+ {
+ throw new SessionNotExistException();
+ }
+
+ synchronized(this)
+ {
+ if(_adapter == null)
+ {
+ _adapter = communicator().createObjectAdapterWithRouter("", _router);
+ _adapter.activate();
+ }
+ }
+ return _adapter;
+ }
+
+ private static class DoMainResult
+ {
+ int returnValue;
+ boolean restart;
+ }
+
+ @Override
+ protected int doMain(String[] args, com.zeroc.Ice.InitializationData initData)
+ {
+ //
+ // Set the default properties for all Glacier2 applications.
+ //
+ initData.properties.setProperty("Ice.RetryIntervals", "-1");
+
+ DoMainResult r;
+ do
+ {
+ //
+ // A copy of the initialization data and the string array
+ // needs to be passed to doMainInternal, as these can be
+ // changed by the application.
+ //
+ com.zeroc.Ice.InitializationData id = initData.clone();
+ id.properties = id.properties._clone();
+ String[] a = args.clone();
+
+ r = doMainInternal(a, id);
+ }
+ while(r.restart);
+ return r.returnValue;
+ }
+
+ private DoMainResult doMainInternal(String[] args, com.zeroc.Ice.InitializationData initData)
+ {
+ //
+ // Reset internal state variables from com.zeroc.Ice.Application. The
+ // remainder are reset at the end of this method.
+ //
+ _callbackInProgress = false;
+ _destroyed = false;
+ _interrupted = false;
+
+ DoMainResult r = new DoMainResult();
+ r.restart = false;
+ r.returnValue = 0;
+
+ try
+ {
+ Util.InitializeResult ir = Util.initialize(args, initData);
+ _communicator = ir.communicator;
+
+ _router = com.zeroc.Glacier2.RouterPrx.uncheckedCast(communicator().getDefaultRouter());
+ if(_router == null)
+ {
+ Util.getProcessLogger().error("no glacier2 router configured");
+ r.returnValue = 1;
+ }
+ else
+ {
+ //
+ // The default is to destroy when a signal is received.
+ //
+ if(_signalPolicy == com.zeroc.Ice.SignalPolicy.HandleSignals)
+ {
+ destroyOnInterrupt();
+ }
+
+ //
+ // If createSession throws, we're done.
+ //
+ try
+ {
+ _session = createSession();
+ _createdSession = true;
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ Util.getProcessLogger().error(Ex.toString(ex));
+ r.returnValue = 1;
+ }
+
+ if(_createdSession)
+ {
+ int acmTimeout = 0;
+ try
+ {
+ acmTimeout = _router.getACMTimeout();
+ }
+ catch(com.zeroc.Ice.OperationNotExistException ex)
+ {
+ }
+ if(acmTimeout <= 0)
+ {
+ acmTimeout = (int)_router.getSessionTimeout();
+ }
+ if(acmTimeout > 0)
+ {
+ com.zeroc.Ice.Connection connection = _router.ice_getCachedConnection();
+ assert(connection != null);
+ connection.setACM(
+ java.util.OptionalInt.of(acmTimeout), null,
+ java.util.Optional.of(ACMHeartbeat.HeartbeatAlways));
+ connection.setCloseCallback(con -> sessionDestroyed());
+ }
+ _category = _router.getCategoryForClient();
+ r.returnValue = runWithSession(ir.args);
+ }
+ }
+ }
+ //
+ // We want to restart on those exceptions that indicate a
+ // break down in communications, but not those exceptions that
+ // indicate a programming logic error (i.e., marshal, protocol
+ // failure, etc).
+ //
+ catch(RestartSessionException ex)
+ {
+ r.restart = true;
+ }
+ catch(com.zeroc.Ice.ConnectionRefusedException ex)
+ {
+ Util.getProcessLogger().error(Ex.toString(ex));
+ r.restart = true;
+ }
+ catch(com.zeroc.Ice.ConnectionLostException ex)
+ {
+ Util.getProcessLogger().error(Ex.toString(ex));
+ r.restart = true;
+ }
+ catch(com.zeroc.Ice.UnknownLocalException ex)
+ {
+ Util.getProcessLogger().error(Ex.toString(ex));
+ r.restart = true;
+ }
+ catch(com.zeroc.Ice.RequestFailedException ex)
+ {
+ Util.getProcessLogger().error(Ex.toString(ex));
+ r.restart = true;
+ }
+ catch(com.zeroc.Ice.TimeoutException ex)
+ {
+ Util.getProcessLogger().error(Ex.toString(ex));
+ r.restart = true;
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ Util.getProcessLogger().error(Ex.toString(ex));
+ r.returnValue = 1;
+ }
+ catch(java.lang.Exception ex)
+ {
+ Util.getProcessLogger().error("unknown exception:\n" + Ex.toString(ex));
+ r.returnValue = 1;
+ }
+ catch(java.lang.Error err)
+ {
+ //
+ // We catch Error to avoid hangs in some non-fatal situations
+ //
+ Util.getProcessLogger().error("Java error:\n" + Ex.toString(err));
+ r.returnValue = 1;
+ }
+
+ //
+ // This clears any set interrupt.
+ //
+ if(_signalPolicy == com.zeroc.Ice.SignalPolicy.HandleSignals)
+ {
+ defaultInterrupt();
+ }
+
+ synchronized(_mutex)
+ {
+ while(_callbackInProgress)
+ {
+ try
+ {
+ _mutex.wait();
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+
+ if(_destroyed)
+ {
+ _communicator = null;
+ }
+ else
+ {
+ _destroyed = true;
+ //
+ // And _communicator != null, meaning will be
+ // destroyed next, _destroyed = true also ensures that
+ // any remaining callback won't do anything.
+ //
+ }
+ }
+
+ if(_createdSession && _router != null)
+ {
+ try
+ {
+ _router.destroySession();
+ }
+ catch(com.zeroc.Ice.ConnectionLostException ex)
+ {
+ //
+ // Expected if another thread invoked on an object from the session concurrently.
+ //
+ }
+ catch(com.zeroc.Glacier2.SessionNotExistException ex)
+ {
+ //
+ // This can also occur.
+ //
+ }
+ catch(Throwable ex)
+ {
+ //
+ // Not expected.
+ //
+ Util.getProcessLogger().error("unexpected exception when destroying the session:\n" + Ex.toString(ex));
+ }
+ _router = null;
+ }
+
+ if(_communicator != null)
+ {
+ try
+ {
+ _communicator.destroy();
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ Util.getProcessLogger().error(Ex.toString(ex));
+ r.returnValue = 1;
+ }
+ catch(java.lang.Exception ex)
+ {
+ Util.getProcessLogger().error("unknown exception:\n" + Ex.toString(ex));
+ r.returnValue = 1;
+ }
+ _communicator = null;
+ }
+
+ synchronized(_mutex)
+ {
+ if(_appHook != null)
+ {
+ _appHook.done();
+ }
+ }
+
+ //
+ // Reset internal state. We cannot reset the Application state
+ // here, since _destroyed must remain true until we re-run
+ // this method.
+ //
+ _adapter = null;
+ _router = null;
+ _session = null;
+ _createdSession = false;
+ _category = null;
+
+ return r;
+ }
+
+ private static com.zeroc.Ice.ObjectAdapter _adapter;
+ private static com.zeroc.Glacier2.RouterPrx _router;
+ private static com.zeroc.Glacier2.SessionPrx _session;
+ private static boolean _createdSession = false;
+ private static String _category;
+}
diff --git a/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionCallback.java b/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionCallback.java
new file mode 100644
index 00000000000..7e76fb80605
--- /dev/null
+++ b/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionCallback.java
@@ -0,0 +1,48 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Glacier2;
+
+/**
+ * A callback class to get notifications of status changes in the Glacier2 session.
+ * All callbacks on the <code>Callback</code> interface occur in the main swing thread.
+ */
+public interface SessionCallback
+{
+ /**
+ * Notifies the application that the communicator was created.
+ *
+ * @param session The Glacier2 session.
+ */
+ void createdCommunicator(SessionHelper session);
+
+ /**
+ * Notifies the application that the Glacier2 session has been established.
+ *
+ * @param session The established session.
+ */
+ void connected(SessionHelper session)
+ throws SessionNotExistException;
+
+ /**
+ * Notifies the application that the Glacier2 session has been disconnected.
+ *
+ * @param session The disconnected session.
+ */
+ void disconnected(SessionHelper session);
+
+ /**
+ * Notifies the application that the Glacier2 session establishment failed.
+ *
+ * @param session The session reporting the connection
+ * failure.
+ * @param ex The exception.
+ */
+ void connectFailed(SessionHelper session, Throwable ex);
+}
diff --git a/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionFactoryHelper.java b/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionFactoryHelper.java
new file mode 100644
index 00000000000..065cfbbf78c
--- /dev/null
+++ b/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionFactoryHelper.java
@@ -0,0 +1,381 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Glacier2;
+
+import com.zeroc.Ice.InitializationData;
+import com.zeroc.Ice.InitializationException;
+import com.zeroc.Ice.Properties;
+import com.zeroc.Ice.Util;
+
+/**
+ * A helper class for using Glacier2 with GUI applications.
+ *
+ * Applications should create a session factory for each Glacier2 router to which the application will
+ * connect. To connect with the Glacier2 router, call {@link SessionFactory#connect}. The callback object is
+ * notified of the various life cycle events. Once the session is torn down for whatever reason, the application
+ * can use the session factory to create another connection.
+ */
+public class SessionFactoryHelper
+{
+ /**
+ * Creates a SessionFactory object.
+ *
+ * @param callback The callback object for notifications.
+ * @throws {@link com.zeroc.Ice.InitializationException}
+ */
+ public SessionFactoryHelper(SessionCallback callback)
+ throws InitializationException
+ {
+ initialize(callback, new InitializationData(), Util.createProperties());
+ }
+
+ /**
+ * Creates a SessionFactory object.
+ *
+ * @param initData The initialization data to use when creating the communicator.
+ * @param callback The callback object for notifications.
+ * @throws {@link com.zeroc.Ice.InitializationException}
+ */
+ public SessionFactoryHelper(InitializationData initData, SessionCallback callback)
+ throws InitializationException
+ {
+ initialize(callback, initData, initData.properties);
+ }
+
+ /**
+ * Creates a SessionFactory object.
+ *
+ * @param properties The properties to use when creating the communicator.
+ * @param callback The callback object for notifications.
+ * @throws {@link com.zeroc.Ice.InitializationException}
+ */
+ public SessionFactoryHelper(Properties properties, SessionCallback callback)
+ throws InitializationException
+ {
+ initialize(callback, new InitializationData(), properties);
+ }
+
+ private void initialize(SessionCallback callback, InitializationData initData, Properties properties)
+ throws InitializationException
+ {
+ if(callback == null)
+ {
+ throw new InitializationException("Attempt to create a SessionFactoryHelper with a null " +
+ "SessionCallback argument");
+ }
+
+ if(initData == null)
+ {
+ throw new InitializationException("Attempt to create a SessionFactoryHelper with a null " +
+ "InitializationData argument");
+ }
+
+ if(properties == null)
+ {
+ throw new InitializationException("Attempt to create a SessionFactoryHelper with a null Properties " +
+ "argument");
+ }
+
+ _callback = callback;
+ _initData = initData;
+ _initData.properties = properties;
+
+ //
+ // Set default properties;
+ //
+ _initData.properties.setProperty("Ice.RetryIntervals", "-1");
+ }
+
+ /**
+ * Set the router object identity.
+ *
+ * @param identity The Glacier2 router's identity.
+ */
+ synchronized public void setRouterIdentity(com.zeroc.Ice.Identity identity)
+ {
+ _identity = identity;
+ }
+
+ /**
+ * Returns the object identity of the Glacier2 router.
+ *
+ * @return The Glacier2 router's identity.
+ */
+ synchronized public com.zeroc.Ice.Identity getRouterIdentity()
+ {
+ return _identity;
+ }
+
+ /**
+ * Sets the host on which the Glacier2 router runs.
+ *
+ * @param hostname The host name (or IP address) of the router host.
+ */
+ synchronized public void setRouterHost(String hostname)
+ {
+ _routerHost = hostname;
+ }
+
+ /**
+ * Returns the host on which the Glacier2 router runs.
+ *
+ * @return The Glacier2 router host.
+ */
+ synchronized public String getRouterHost()
+ {
+ return _routerHost;
+ }
+
+ /**
+ * Sets whether to connect with the Glacier2 router securely.
+ *
+ * @param secure If <code>true</code>, the client connects to the router
+ * via SSL; otherwise, the client connects via TCP.
+ * @deprecated deprecated, use SessionFactoryHelper.setProtocol instead
+ */
+ @Deprecated
+ public void setSecure(boolean secure)
+ {
+ setProtocol(secure ? "ssl" : "tcp");
+ }
+
+ /**
+ * Returns whether the session factory will establish a secure connection to the Glacier2 router.
+ *
+ * @return The secure flag.
+ * @deprecated deprecated, use SessionFactoryHelper.getProtocol instead
+ */
+ @Deprecated
+ public boolean getSecure()
+ {
+ return getProtocol().equals("ssl");
+ }
+
+ /**
+ *
+ * Sets the protocol that will be used by the session factory to establish the connection.
+ *
+ * @param protocol.
+ */
+ synchronized public void setProtocol(String protocol)
+ {
+ if(protocol == null)
+ {
+ throw new IllegalArgumentException("You must use a valid protocol");
+ }
+
+ if(!protocol.equals("tcp") &&
+ !protocol.equals("ssl") &&
+ !protocol.equals("wss") &&
+ !protocol.equals("ws"))
+ {
+ throw new IllegalArgumentException("Unknow protocol `" + protocol + "'");
+ }
+
+ _protocol = protocol;
+ }
+
+ /**
+ *
+ * Returns the protocol that will be used by the session factory to establish the connection.
+ *
+ * @return The protocol.
+ */
+ synchronized public String getProtocol()
+ {
+ return _protocol;
+ }
+
+ /**
+ * Sets the connect and connection timeout for the Glacier2 router.
+ *
+ * @param timeoutMillisecs The timeout in milliseconds. A zero
+ * or negative timeout value indicates that the router proxy has no associated timeout.
+ */
+ synchronized public void setTimeout(int timeoutMillisecs)
+ {
+ _timeout = timeoutMillisecs;
+ }
+
+ /**
+ * Returns the connect and connection timeout associated with the Glacier2 router.
+ *
+ * @return The timeout.
+ */
+ synchronized public int getTimeout()
+ {
+ return _timeout;
+ }
+
+ /**
+ * Sets the Glacier2 router port to connect to.
+ *
+ * @param port The port. If 0, then the default port (4063 for TCP or 4064 for SSL) is used.
+ */
+ synchronized public void setPort(int port)
+ {
+ _port = port;
+ }
+
+ /**
+ * Returns the Glacier2 router port to connect to.
+ *
+ * @return The port.
+ */
+ synchronized public int getPort()
+ {
+ return getPortInternal();
+ }
+
+ private int getPortInternal()
+ {
+ return _port == 0 ? ((_protocol.equals("ssl") ||
+ _protocol.equals("wss"))? GLACIER2_SSL_PORT : GLACIER2_TCP_PORT) : _port;
+ }
+
+ /**
+ * Returns the initialization data used to initialize the communicator.
+ *
+ * @return The initialization data.
+ */
+ synchronized public InitializationData getInitializationData()
+ {
+ return _initData;
+ }
+
+ /**
+ * Sets the request context to use while establishing a connection to the Glacier2 router.
+ *
+ * @param context The request context.
+ */
+ synchronized public void setConnectContext(final java.util.Map<String, String> context)
+ {
+ _context = context;
+ }
+
+ /**
+ * Determines whether the session should create an object adapter that the client
+ * can use for receiving callbacks.
+ *
+ * @param useCallbacks True if the session should create an object adapter.
+ */
+ synchronized public void setUseCallbacks(boolean useCallbacks)
+ {
+ _useCallbacks = useCallbacks;
+ }
+
+ /**
+ * Indicates whether a newly-created session will also create an object adapter that
+ * the client can use for receiving callbacks.
+ *
+ * @return True if the session will create an object adapter.
+ */
+ synchronized public boolean getUseCallbacks()
+ {
+ return _useCallbacks;
+ }
+
+ /**
+ * Connects to the Glacier2 router using the associated SSL credentials.
+ *
+ * Once the connection is established, {@link SessionCallback#connected} is called on the callback object;
+ * upon failure, {@link SessionCallback#connectFailed} is called with the exception.
+ *
+ * @return The connected session.
+ */
+ synchronized public SessionHelper connect()
+ {
+ SessionHelper session = new SessionHelper(_callback, createInitData(), getRouterFinderStr(), _useCallbacks);
+ session.connect(_context);
+ return session;
+ }
+
+ /**
+ * Connect the Glacier2 session using user name and password credentials.
+ *
+ * Once the connection is established, {@link SessionCallback#connected} is called on the callback object;
+ * upon failure, {@link SessionCallback#connectFailed) is called with the exception.
+ *
+ * @param username The user name.
+ * @param password The password.
+ * @return The connected session.
+ */
+ synchronized public SessionHelper connect(final String username, final String password)
+ {
+ SessionHelper session = new SessionHelper(_callback, createInitData(), getRouterFinderStr(), _useCallbacks);
+ session.connect(username, password, _context);
+ return session;
+ }
+
+ private InitializationData createInitData()
+ {
+ //
+ // Clone the initialization data and properties.
+ //
+ InitializationData initData = _initData.clone();
+ initData.properties = initData.properties._clone();
+
+ if(initData.properties.getProperty("Ice.Default.Router").length() == 0 && _identity != null)
+ {
+ initData.properties.setProperty("Ice.Default.Router", getProxyStr(_identity));
+ }
+
+ //
+ // If using a secure connection setup the IceSSL plug-in, if IceSSL
+ // plug-in has already been setup we don't want to override the
+ // configuration so it can be loaded from a custom location.
+ //
+ if((_protocol.equals("ssl") || _protocol.equals("wss")) &&
+ initData.properties.getProperty("Ice.Plugin.IceSSL").length() == 0)
+ {
+ initData.properties.setProperty("Ice.Plugin.IceSSL", "com.zeroc.IceSSL.PluginFactory");
+ }
+
+ return initData;
+ }
+
+ private String getRouterFinderStr()
+ {
+ com.zeroc.Ice.Identity ident = new com.zeroc.Ice.Identity("RouterFinder", "Ice");
+ return getProxyStr(ident);
+ }
+
+ private String
+ getProxyStr(com.zeroc.Ice.Identity ident)
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append("\"");
+ sb.append(Util.identityToString(ident));
+ sb.append("\":");
+ sb.append(_protocol + " -p ");
+ sb.append(getPortInternal());
+ sb.append(" -h \"");
+ sb.append(_routerHost);
+ sb.append("\"");
+ if(_timeout > 0)
+ {
+ sb.append(" -t ");
+ sb.append(_timeout);
+ }
+ return sb.toString();
+ }
+
+ private SessionCallback _callback;
+ private String _routerHost = "localhost";
+ private InitializationData _initData;
+ private com.zeroc.Ice.Identity _identity = null;
+ private String _protocol = "ssl";
+ private int _port = 0;
+ private int _timeout = 10000;
+ private java.util.Map<String, String> _context;
+ private boolean _useCallbacks = true;
+ private static final int GLACIER2_SSL_PORT = 4064;
+ private static final int GLACIER2_TCP_PORT = 4063;
+}
diff --git a/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionHelper.java b/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionHelper.java
new file mode 100644
index 00000000000..d9cad5f60d2
--- /dev/null
+++ b/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionHelper.java
@@ -0,0 +1,607 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Glacier2;
+
+import com.zeroc.Ice.ACMHeartbeat;
+import com.zeroc.Ice.InitializationData;
+
+/**
+ * A helper class for using Glacier2 with GUI applications.
+ */
+public class SessionHelper
+{
+ /**
+ * Creates a Glacier2 session.
+ *
+ * @param callback The callback for notifications about session establishment.
+ * @param initData The {@link Ice.InitializationData} for initializing the communicator.
+ * @param finderStr The stringified Ice.RouterFinder proxy.
+ * @param useCallbacks True if the session should create an object adapter for receiving callbacks.
+ */
+ public SessionHelper(SessionCallback callback, InitializationData initData, String finderStr,
+ boolean useCallbacks)
+ {
+ _callback = callback;
+ _initData = initData;
+ _finderStr = finderStr;
+ _useCallbacks = useCallbacks;
+ }
+
+ /**
+ * Destroys the Glacier2 session.
+ *
+ * Once the session has been destroyed, {@link SessionCallback.disconnected} is called on
+ * the associated callback object.
+ */
+ public void destroy()
+ {
+ synchronized(this)
+ {
+ if(_destroy)
+ {
+ return;
+ }
+ _destroy = true;
+ if(!_connected)
+ {
+ //
+ // In this case a connecting session is being destroyed.
+ // We destroy the communicator to trigger the immediate
+ // failure of the connection establishment.
+ //
+ new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ destroyCommunicator();
+ }
+ }).start();
+ return;
+ }
+ _session = null;
+ _connected = false;
+
+ try
+ {
+ Runtime.getRuntime().removeShutdownHook(_shutdownHook);
+ }
+ catch(IllegalStateException ex)
+ {
+ // Ignore
+ }
+ catch(SecurityException ex)
+ {
+ // Ignore
+ }
+ }
+
+ //
+ // Run destroyInternal in a thread because it makes remote invocations.
+ //
+ new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ destroyInternal();
+ }
+ }).start();
+ }
+
+ /**
+ * Returns the session's communicator object.
+ * @return The communicator.
+ */
+ synchronized public com.zeroc.Ice.Communicator communicator()
+ {
+ return _communicator;
+ }
+
+ /**
+ * Returns the category to be used in the identities of all of the client's
+ * callback objects. Clients must use this category for the router to
+ * forward callback requests to the intended client.
+ * @return The category.
+ * @throws SessionNotExistException No session exists.
+ **/
+ synchronized public String categoryForClient()
+ throws SessionNotExistException
+ {
+ if(_router == null)
+ {
+ throw new SessionNotExistException();
+ }
+
+ return _category;
+ }
+
+ /**
+ * Adds a servant to the callback object adapter's Active Servant Map with a UUID.
+ * @param servant The servant to add.
+ * @return The proxy for the servant.
+ * @throws SessionNotExistException No session exists.
+ **/
+ synchronized public com.zeroc.Ice.ObjectPrx addWithUUID(com.zeroc.Ice.Object servant)
+ throws SessionNotExistException
+ {
+ if(_router == null)
+ {
+ throw new SessionNotExistException();
+ }
+ return internalObjectAdapter().add(servant, new com.zeroc.Ice.Identity(java.util.UUID.randomUUID().toString(),
+ _category));
+ }
+
+ /**
+ * Returns the Glacier2 session proxy. If the session hasn't been established yet,
+ * or the session has already been destroyed, throws SessionNotExistException.
+ * @return The session proxy, or throws SessionNotExistException if no session exists.
+ * @throws SessionNotExistException No session exists.
+ */
+ synchronized public com.zeroc.Glacier2.SessionPrx session()
+ throws SessionNotExistException
+ {
+ if(_session == null)
+ {
+ throw new SessionNotExistException();
+ }
+
+ return _session;
+ }
+
+ /**
+ * Returns true if there is an active session, otherwise returns false.
+ * @return <code>true</code>if session exists or false if no session exists.
+ */
+ synchronized public boolean isConnected()
+ {
+ return _connected;
+ }
+
+ /**
+ * Creates an object adapter for callback objects.
+ * @return The object adapter.
+ * @throws SessionNotExistException No session exists.
+ */
+ synchronized public com.zeroc.Ice.ObjectAdapter objectAdapter()
+ throws SessionNotExistException
+ {
+ return internalObjectAdapter();
+ }
+
+ //
+ // Only call this method when the calling thread owns the lock
+ //
+ private com.zeroc.Ice.ObjectAdapter internalObjectAdapter()
+ throws SessionNotExistException
+ {
+ if(_router == null)
+ {
+ throw new SessionNotExistException();
+ }
+ if(!_useCallbacks)
+ {
+ throw new com.zeroc.Ice.InitializationException(
+ "Object adapter not available, call SessionFactoryHelper.setUseCallbacks(true)");
+ }
+ return _adapter;
+ }
+
+ private interface ConnectStrategy
+ {
+ com.zeroc.Glacier2.SessionPrx connect(com.zeroc.Glacier2.RouterPrx router)
+ throws CannotCreateSessionException, PermissionDeniedException;
+ }
+
+ /**
+ * Connects to the Glacier2 router using the associated SSL credentials.
+ *
+ * Once the connection is established, {@link SessionCallback#connected} is called on the callback object;
+ * upon failure, {@link SessionCallback#exception} is called with the exception.
+ *
+ * @param context The request context to use when creating the session.
+ */
+ synchronized protected void connect(final java.util.Map<String, String> context)
+ {
+ connectImpl(new ConnectStrategy()
+ {
+ @Override
+ public SessionPrx connect(RouterPrx router)
+ throws CannotCreateSessionException, PermissionDeniedException
+ {
+ return router.createSessionFromSecureConnection(context);
+ }
+ });
+ }
+
+ /**
+ * Connects a Glacier2 session using user name and password credentials.
+ *
+ * Once the connection is established, {@link SessionCallback#connected} is called on the callback object;
+ * upon failure {@link SessionCallback.exception} is called with the exception.
+ *
+ * @param username The user name.
+ * @param password The password.
+ * @param context The request context to use when creating the session.
+ */
+ synchronized protected void connect(final String username, final String password,
+ final java.util.Map<String, String> context)
+ {
+ connectImpl(new ConnectStrategy()
+ {
+ @Override
+ public SessionPrx connect(RouterPrx router)
+ throws CannotCreateSessionException, PermissionDeniedException
+ {
+ return router.createSession(username, password, context);
+ }
+ });
+ }
+
+ private void connected(RouterPrx router, SessionPrx session)
+ {
+ //
+ // Remote invocation should be done without acquiring a mutex lock.
+ //
+ assert(router != null);
+ com.zeroc.Ice.Connection conn = router.ice_getCachedConnection();
+ String category = router.getCategoryForClient();
+ int acmTimeout = 0;
+ try
+ {
+ acmTimeout = router.getACMTimeout();
+ }
+ catch(com.zeroc.Ice.OperationNotExistException ex)
+ {
+ }
+
+ if(acmTimeout <= 0)
+ {
+ acmTimeout = (int)router.getSessionTimeout();
+ }
+
+ //
+ // We create the callback object adapter here because createObjectAdapter internally
+ // makes synchronous RPCs to the router. We can't create the OA on-demand when the
+ // client calls objectAdapter() or addWithUUID() because they can be called from the
+ // GUI thread.
+ //
+ if(_useCallbacks)
+ {
+ assert(_adapter == null);
+ _adapter = _communicator.createObjectAdapterWithRouter("", router);
+ _adapter.activate();
+ }
+
+ synchronized(this)
+ {
+ _router = router;
+
+ if(_destroy)
+ {
+ //
+ // Run destroyInternal in a thread because it makes remote invocations.
+ //
+ new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ destroyInternal();
+ }
+ }).start();
+ return;
+ }
+
+ //
+ // Cache the category.
+ //
+ _category = category;
+
+ //
+ // Assign the session after _destroy is checked.
+ //
+ _session = session;
+ _connected = true;
+
+ if(acmTimeout > 0)
+ {
+ com.zeroc.Ice.Connection connection = _router.ice_getCachedConnection();
+ assert(connection != null);
+ connection.setACM(java.util.OptionalInt.of(acmTimeout),
+ null,
+ java.util.Optional.of(ACMHeartbeat.HeartbeatAlways));
+ connection.setCloseCallback(con -> destroy());
+ }
+
+ _shutdownHook = new Thread("Shutdown hook")
+ {
+ @Override
+ public void run()
+ {
+ SessionHelper.this.destroy();
+ }
+ };
+
+ try
+ {
+ Runtime.getRuntime().addShutdownHook(_shutdownHook);
+ }
+ catch(IllegalStateException e)
+ {
+ //
+ // Shutdown in progress, ignored
+ //
+ }
+ catch(SecurityException ex)
+ {
+ //
+ // Ignore. Unsigned applets cannot registered shutdown hooks.
+ //
+ }
+ }
+
+ dispatchCallback(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ _callback.connected(SessionHelper.this);
+ }
+ catch(SessionNotExistException ex)
+ {
+ SessionHelper.this.destroy();
+ }
+ }
+ }, conn);
+ }
+
+ private void destroyInternal()
+ {
+ assert _destroy;
+ com.zeroc.Glacier2.RouterPrx router = null;
+ com.zeroc.Ice.Communicator communicator = null;
+ synchronized(this)
+ {
+ if(_router == null)
+ {
+ return;
+ }
+
+ router = _router;
+ _router = null;
+
+ communicator = _communicator;
+ }
+
+ assert communicator != null;
+
+ try
+ {
+ router.destroySession();
+ }
+ catch(com.zeroc.Ice.ConnectionLostException e)
+ {
+ //
+ // Expected if another thread invoked on an object from the session concurrently.
+ //
+ }
+ catch(SessionNotExistException e)
+ {
+ //
+ // This can also occur.
+ //
+ }
+ catch(Throwable e)
+ {
+ //
+ // Not expected.
+ //
+ communicator.getLogger().warning("SessionHelper: unexpected exception when destroying the session:\n" + e);
+ }
+
+ try
+ {
+ communicator.destroy();
+ }
+ catch(Throwable ex)
+ {
+ }
+
+ //
+ // Notify the callback that the session is gone.
+ //
+ dispatchCallback(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ _callback.disconnected(SessionHelper.this);
+ }
+ }, null);
+ }
+
+ private void destroyCommunicator()
+ {
+ com.zeroc.Ice.Communicator communicator = null;
+ synchronized(this)
+ {
+ communicator = _communicator;
+ }
+
+ if(communicator != null)
+ {
+ try
+ {
+ _communicator.destroy();
+ }
+ catch(Throwable ex)
+ {
+ }
+ }
+ }
+
+ private void connectImpl(final ConnectStrategy factory)
+ {
+ assert !_destroy;
+
+ try
+ {
+ _communicator = com.zeroc.Ice.Util.initialize(_initData);
+ }
+ catch(final com.zeroc.Ice.LocalException ex)
+ {
+ _destroy = true;
+ new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ dispatchCallback(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ _callback.connectFailed(SessionHelper.this, ex);
+ }
+ }, null);
+ }
+ }).start();
+ return;
+ }
+
+ final com.zeroc.Ice.RouterFinderPrx finder =
+ com.zeroc.Ice.RouterFinderPrx.uncheckedCast(_communicator.stringToProxy(_finderStr));
+ new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ if(_communicator.getDefaultRouter() == null)
+ {
+ try
+ {
+ _communicator.setDefaultRouter(finder.getRouter());
+ }
+ catch(final com.zeroc.Ice.CommunicatorDestroyedException ex)
+ {
+ dispatchCallback(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ _callback.connectFailed(SessionHelper.this, ex);
+ }
+ }, null);
+ return;
+ }
+ catch(Exception ex)
+ {
+ //
+ // In case of error getting router identity from RouterFinder use
+ // default identity.
+ //
+ com.zeroc.Ice.Identity ident = new com.zeroc.Ice.Identity("router", "Glacier2");
+ _communicator.setDefaultRouter(
+ com.zeroc.Ice.RouterPrx.uncheckedCast(finder.ice_identity(ident)));
+ }
+ }
+
+ try
+ {
+ dispatchCallbackAndWait(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ _callback.createdCommunicator(SessionHelper.this);
+ }
+ });
+
+ com.zeroc.Glacier2.RouterPrx routerPrx = com.zeroc.Glacier2.RouterPrx.uncheckedCast(
+ _communicator.getDefaultRouter());
+ com.zeroc.Glacier2.SessionPrx session = factory.connect(routerPrx);
+ connected(routerPrx, session);
+ }
+ catch(final Exception ex)
+ {
+ try
+ {
+ _communicator.destroy();
+ }
+ catch(Throwable ex1)
+ {
+ }
+
+ dispatchCallback(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ _callback.connectFailed(SessionHelper.this, ex);
+ }
+ }, null);
+ }
+ }
+ }).start();
+ }
+
+ private void dispatchCallback(Runnable runnable, com.zeroc.Ice.Connection conn)
+ {
+ if(_initData.dispatcher != null)
+ {
+ _initData.dispatcher.dispatch(runnable, conn);
+ }
+ else
+ {
+ runnable.run();
+ }
+ }
+
+ private void dispatchCallbackAndWait(final Runnable runnable)
+ {
+ if(_initData.dispatcher != null)
+ {
+ final java.util.concurrent.Semaphore sem = new java.util.concurrent.Semaphore(0);
+ _initData.dispatcher.dispatch(
+ new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ runnable.run();
+ sem.release();
+ }
+ }, null);
+ sem.acquireUninterruptibly();
+ }
+ else
+ {
+ runnable.run();
+ }
+ }
+
+ private final InitializationData _initData;
+ private com.zeroc.Ice.Communicator _communicator;
+ private com.zeroc.Ice.ObjectAdapter _adapter;
+ private com.zeroc.Glacier2.RouterPrx _router;
+ private com.zeroc.Glacier2.SessionPrx _session;
+ private String _category;
+ private String _finderStr;
+ private boolean _useCallbacks;
+
+ private final SessionCallback _callback;
+ private boolean _destroy = false;
+ private boolean _connected = false;
+ private Thread _shutdownHook;
+}
diff --git a/java/src/Ice/build.gradle b/java/src/Ice/build.gradle
index eec56094858..7e687c43682 100644
--- a/java/src/Ice/build.gradle
+++ b/java/src/Ice/build.gradle
@@ -7,8 +7,10 @@
//
// **********************************************************************
-sourceCompatibility = iceSourceCompatibility
-targetCompatibility = iceTargetCompatibility
+//sourceCompatibility = iceSourceCompatibility
+//targetCompatibility = iceTargetCompatibility
+sourceCompatibility = 1.8
+targetCompatibility = 1.8
project.ext.displayName = "Ice"
project.ext.description = "Ice is a comprehensive RPC framework that helps you build distributed applications" +
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/Application.java b/java/src/Ice/src/main/java/com/zeroc/Ice/Application.java
new file mode 100644
index 00000000000..ed74d65161e
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/Application.java
@@ -0,0 +1,699 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * Utility base class that makes it easy to correctly initialize and finalize
+ * the Ice run time, as well as handle signals. Unless the application specifies
+ * a logger, <Application> installs a per-process logger that logs to the standard
+ * error output.
+ * <p>
+ * Applications must create a derived class that implements the {@link #run} method.
+ * <p>
+ * A program can contain only one instance of this class.
+ *
+ * @see #run
+ * @see Communicator
+ * @see Logger
+ **/
+public abstract class Application
+{
+ /**
+ * Initializes an instance that calls {@link Communicator#shutdown} if
+ * a signal is received.
+ **/
+ public
+ Application()
+ {
+ }
+
+ /**
+ * Initializes an instance that handles signals according to the signal
+ * policy.
+ *
+ * @param signalPolicy Determines how to respond to signals.
+ *
+ * @see SignalPolicy
+ **/
+ public
+ Application(SignalPolicy signalPolicy)
+ {
+ _signalPolicy = signalPolicy;
+ }
+
+ /**
+ * The application must call <code>main</code> after it has
+ * instantiated the derived class. <code>main</code> creates
+ * a communicator, establishes the specified signal policy, and,
+ * once <code>run</code> returns, destroys the communicator.
+ * <p>
+ * The method prints an error message for any exception that propagates
+ * out of <code>run</code> and ensures that the communicator is
+ * destroyed correctly even if <code>run</code> completes abnormally.
+ *
+ * @param appName The name of the application. This parameter is used to initialize
+ * the value of the <code>Ice.ProgramName</code> property.
+ * @param args The arguments for the application (as passed to <code>Main(String[])</code>
+ * by the operating system.
+ * @return The value returned by <code>run</code>. If <code>run</code> terminates with an exception,
+ * the return value is non-zero.
+ **/
+ public final int
+ main(String appName, String[] args)
+ {
+ return main(appName, args, new InitializationData());
+ }
+
+ /**
+ * The application must call <code>main</code> after it has
+ * instantiated the derived class. <code>main</code> creates
+ * a communicator, establishes the specified signal policy, and,
+ * once <code>run</code> returns, destroys the communicator.
+ * <p>
+ * The method prints an error message for any exception that propagates
+ * out of <code>run</code> and ensures that the communicator is
+ * destroyed correctly even if <code>run</code> completes abnormally.
+ *
+ * @param appName The name of the application. This parameter is used to initialize
+ * the value of the <code>Ice.ProgramName</code> property.
+ * @param configFile The configuration file with which to initialize
+ * Ice properties.
+ * @return The value returned by <code>run</code>. If <code>run</code> terminates with an exception,
+ * the return value is non-zero.
+ **/
+ public final int
+ main(String appName, String[] args, String configFile)
+ {
+ if(Util.getProcessLogger() instanceof LoggerI)
+ {
+ Util.setProcessLogger(new LoggerI(appName, ""));
+ }
+
+ InitializationData initData = new InitializationData();
+ if(configFile != null)
+ {
+ try
+ {
+ initData.properties = Util.createProperties();
+ initData.properties.load(configFile);
+ }
+ catch(LocalException ex)
+ {
+ Util.getProcessLogger().error(com.zeroc.IceInternal.Ex.toString(ex));
+ return 1;
+ }
+ catch(java.lang.Exception ex)
+ {
+ Util.getProcessLogger().error("unknown exception: " + com.zeroc.IceInternal.Ex.toString(ex));
+ return 1;
+ }
+ }
+ return main(appName, args, initData);
+ }
+
+ /**
+ * The application must call <code>main</code> after it has
+ * instantiated the derived class. <code>main</code> creates
+ * a communicator, establishes the specified signal policy, and,
+ * once <code>run</code> returns, destroys the communicator.
+ * <p>
+ * The method prints an error message for any exception that propagates
+ * out of <code>run</code> and ensures that the communicator is
+ * destroyed correctly even if <code>run</code> completes abnormally.
+ *
+ * @param appName The name of the application. This parameter is used to initialize
+ * the value of the <code>Ice.ProgramName</code> property.
+ * @param args The arguments for the application (as passed to <code>Main(String[])</code>.
+ * @param initializationData Additional data used to initialize the communicator.
+ * @return The value returned by <code>run</code>. If <code>run</code> terminates with an exception,
+ * the return value is non-zero.
+ *
+ * @see InitializationData
+ **/
+ public final int
+ main(String appName, String[] args, InitializationData initializationData)
+ {
+ if(Util.getProcessLogger() instanceof LoggerI)
+ {
+ Util.setProcessLogger(new LoggerI(appName, ""));
+ }
+
+ if(_communicator != null)
+ {
+ Util.getProcessLogger().error("only one instance of the Application class can be used");
+ return 1;
+ }
+
+ _appName = appName;
+
+ //
+ // We parse the properties here to extract Ice.ProgramName.
+ //
+ InitializationData initData;
+ if(initializationData != null)
+ {
+ initData = initializationData.clone();
+ }
+ else
+ {
+ initData = new InitializationData();
+ }
+
+ Util.CreatePropertiesResult cpr = null;
+ try
+ {
+ cpr = Util.createProperties(args, initData.properties);
+ initData.properties = cpr.properties;
+ }
+ catch(LocalException ex)
+ {
+ Util.getProcessLogger().error(com.zeroc.IceInternal.Ex.toString(ex));
+ return 1;
+ }
+ catch(java.lang.Exception ex)
+ {
+ Util.getProcessLogger().error("unknown exception: " + com.zeroc.IceInternal.Ex.toString(ex));
+ return 1;
+ }
+ _appName = initData.properties.getPropertyWithDefault("Ice.ProgramName", _appName);
+
+ //
+ // If the process logger is the default logger, we replace it with a
+ // a logger which is using the program name for the prefix.
+ //
+ if(!initData.properties.getProperty("Ice.ProgramName").equals("") && Util.getProcessLogger() instanceof LoggerI)
+ {
+ Util.setProcessLogger(new LoggerI(initData.properties.getProperty("Ice.ProgramName"), ""));
+ }
+
+ return doMain(cpr.args, initData);
+ }
+
+ protected int doMain(String[] args, InitializationData initData)
+ {
+ int status = 0;
+
+ try
+ {
+ Util.InitializeResult ir = Util.initialize(args, initData);
+
+ _communicator = ir.communicator;
+
+ //
+ // The default is to destroy when a signal is received.
+ //
+ if(_signalPolicy == SignalPolicy.HandleSignals)
+ {
+ destroyOnInterrupt();
+ }
+
+ status = run(ir.args);
+ }
+ catch(LocalException ex)
+ {
+ Util.getProcessLogger().error(com.zeroc.IceInternal.Ex.toString(ex));
+ status = 1;
+ }
+ catch(java.lang.Exception ex)
+ {
+ Util.getProcessLogger().error("unknown exception: " + com.zeroc.IceInternal.Ex.toString(ex));
+ status = 1;
+ }
+ catch(java.lang.Error err)
+ {
+ //
+ // We catch Error to avoid hangs in some non-fatal situations
+ //
+ Util.getProcessLogger().error("Java error: " + com.zeroc.IceInternal.Ex.toString(err));
+ status = 1;
+ }
+
+ // This clears any set interrupt.
+ if(_signalPolicy == SignalPolicy.HandleSignals)
+ {
+ defaultInterrupt();
+ }
+
+ synchronized(_mutex)
+ {
+ boolean interrupted = false;
+ while(_callbackInProgress)
+ {
+ try
+ {
+ _mutex.wait();
+ }
+ catch(InterruptedException ex)
+ {
+ interrupted = true;
+ }
+ }
+ if(interrupted)
+ {
+ Thread.currentThread().interrupt();
+ }
+
+ if(_destroyed)
+ {
+ _communicator = null;
+ }
+ else
+ {
+ _destroyed = true;
+ //
+ // And _communicator != null, meaning will be
+ // destroyed next, _destroyed = true also ensures that
+ // any remaining callback won't do anything
+ //
+ }
+ }
+
+ if(_communicator != null)
+ {
+ try
+ {
+ try
+ {
+ _communicator.destroy();
+ }
+ catch(OperationInterruptedException ex)
+ {
+ Util.getProcessLogger().error(com.zeroc.IceInternal.Ex.toString(ex));
+ // Retry communicator destroy in case of an operation
+ // interrupt exception, but don't do so in a loop
+ // otherwise it could go on forever.
+ _communicator.destroy();
+ }
+ }
+ catch(LocalException ex)
+ {
+ Util.getProcessLogger().error(com.zeroc.IceInternal.Ex.toString(ex));
+ status = 1;
+ }
+ catch(java.lang.Exception ex)
+ {
+ Util.getProcessLogger().error("unknown exception: " + com.zeroc.IceInternal.Ex.toString(ex));
+ status = 1;
+ }
+ _communicator = null;
+ }
+
+ synchronized(_mutex)
+ {
+ if(_appHook != null)
+ {
+ _appHook.done();
+ }
+ }
+
+ return status;
+ }
+
+ /**
+ * Called once the communicator has been initialized. The derived class must
+ * implement <code>run</code>, which is the application's starting method.
+ *
+ * @param args The argument vector for the application. <code>Application</code>
+ * scans the argument vector passed to <code>main</code> for options that are
+ * specific to the Ice run time and removes them; therefore, the vector passed
+ * to <code>run</code> is free from Ice-related options and contains only options
+ * and arguments that are application-specific.
+ *
+ * @return The <code>run</code> method should return zero for successful termination, and
+ * non-zero otherwise. <code>Application.main</code> returns the value returned by <code>run</code>.
+ **/
+ public abstract int
+ run(String[] args);
+
+ /**
+ * Returns the value of <code>appName</code> that is passed to <code>main</code> (which is also the
+ * the value of <code>Ice.ProgramName</code>). This method is useful mainly for error messages that
+ * include the application name. Because <appName> is a static method, it is available from anywhere
+ * in the program.
+ *
+ * @return The name of the application.
+ **/
+ public static String
+ appName()
+ {
+ return _appName;
+ }
+
+ /**
+ * Returns the communicator for the application. Because <communicator> is a static method,
+ * it permits access to the communicator from anywhere in the program. Note that, as a consequence,
+ * you cannot have more than one instance of <code>Application</code> in a program.
+ *
+ * @return The communicator for the application.
+ **/
+ public static Communicator
+ communicator()
+ {
+ return _communicator;
+ }
+
+ /**
+ * Instructs <code>Application</code> to call {@link Communicator#destroy} on receipt of a signal.
+ * This is default signal handling policy established by the default constructor.
+ *
+ * @see Communicator#destroy
+ **/
+ public static void
+ destroyOnInterrupt()
+ {
+ if(_signalPolicy == SignalPolicy.HandleSignals)
+ {
+ synchronized(_mutex)
+ {
+ //
+ // As soon as the destroy hook ends all the threads are
+ // terminated. So the destroy hook will join the current
+ // thread before to end.
+ //
+ try
+ {
+ changeHook(new DestroyHook());
+ }
+ catch(java.lang.IllegalStateException ex)
+ {
+ if(_communicator != null)
+ {
+ _communicator.destroy();
+ }
+ }
+ }
+ }
+ else
+ {
+ Util.getProcessLogger().warning(
+ "interrupt method called on Application configured to not handle interrupts.");
+ }
+ }
+
+ /**
+ * Instructs <code>Application</code> to call {@link Communicator#shutdown} on receipt of a signal.
+ *
+ * @see Communicator#shutdown
+ **/
+ public static void
+ shutdownOnInterrupt()
+ {
+ if(_signalPolicy == SignalPolicy.HandleSignals)
+ {
+ synchronized(_mutex)
+ {
+ //
+ // As soon as the shutdown hook ends all the threads are
+ // terminated. So the shutdown hook will join the current
+ // thread before to end.
+ //
+ try
+ {
+ changeHook(new ShutdownHook());
+ }
+ catch(java.lang.IllegalStateException ex)
+ {
+ if(_communicator != null)
+ {
+ _communicator.shutdown();
+ }
+ }
+ }
+ }
+ else
+ {
+ Util.getProcessLogger().warning(
+ "interrupt method called on Application configured to not handle interrupts.");
+ }
+ }
+
+ /**
+ * Installs a custom shutdown hook. The implementation of the shutdown
+ * hook can do whatever cleanup is necessary to shut down the application.
+ * The hook is unregistered once <code>run</code> returns.
+ * Note that the hook must obey the rules for shutdown hooks; specifically,
+ * it must not call <code>exit</code>.
+ *
+ * @param newHook The thread to run on shutdown.
+ *
+ * @see java.lang.Runtime#addShutdownHook
+ **/
+ public static void
+ setInterruptHook(java.lang.Thread newHook) // Pun intended.
+ {
+ if(_signalPolicy == SignalPolicy.HandleSignals)
+ {
+ try
+ {
+ changeHook(new CustomHook(newHook));
+ }
+ catch(java.lang.IllegalStateException ex)
+ {
+ // Ignore.
+ }
+ }
+ else
+ {
+ Util.getProcessLogger().warning(
+ "interrupt method called on Application configured to not handle interrupts.");
+ }
+ }
+
+ /**
+ * Clears any shutdown hooks, including any hook established with {@link #destroyOnInterrupt} or
+ * {@link #shutdownOnInterrupt}.
+ **/
+ public static void
+ defaultInterrupt()
+ {
+ if(_signalPolicy == SignalPolicy.HandleSignals)
+ {
+ changeHook(null);
+ }
+ else
+ {
+ Util.getProcessLogger().warning(
+ "interrupt method called on Application configured to not handle interrupts.");
+ }
+ }
+
+ /**
+ * Determines whether the application shut down intentionally or was forced to shut down by the JVM. This
+ * is useful for logging purposes.
+ *
+ * @return <code>true</code> if a shutdown hook caused the communicator to shut down; false otherwise.
+ **/
+ public static boolean
+ interrupted()
+ {
+ synchronized(_mutex)
+ {
+ return _interrupted;
+ }
+ }
+
+ private static void
+ changeHook(AppHook newHook)
+ {
+ synchronized(_mutex)
+ {
+ //
+ // Remove any existing shutdown hooks.
+ //
+ try
+ {
+ if(_appHook != null)
+ {
+ Runtime.getRuntime().removeShutdownHook(_appHook);
+ _appHook.done();
+ _appHook = null;
+ }
+ }
+ catch(java.lang.IllegalStateException ex)
+ {
+ //
+ // Expected if we are in the process of shutting down.
+ //
+ }
+
+ //
+ // Note that we let the IllegalStateException propagate
+ // out if necessary.
+ //
+ if(newHook != null)
+ {
+ Runtime.getRuntime().addShutdownHook(newHook);
+ _appHook = newHook;
+ }
+ }
+ }
+
+ private static boolean
+ setCallbackInProgress(boolean destroy)
+ {
+ synchronized(_mutex)
+ {
+ if(_destroyed)
+ {
+ //
+ // Being destroyed by main thread
+ //
+ return false;
+ }
+ _callbackInProgress = true;
+ _destroyed = destroy;
+ _interrupted = true;
+ return true;
+ }
+ }
+
+ private static void
+ clearCallbackInProgress()
+ {
+ synchronized(_mutex)
+ {
+ _callbackInProgress = false;
+ _mutex.notify();
+ }
+ }
+
+ // For use by Glacier2.Application
+ static public class AppHook extends Thread
+ {
+ public void
+ done()
+ {
+ synchronized(_doneMutex)
+ {
+ _done = true;
+ _doneMutex.notify();
+ }
+ }
+
+ protected boolean _done = false;
+ protected final java.lang.Object _doneMutex = new java.lang.Object();
+ }
+
+ static class DestroyHook extends AppHook
+ {
+ @Override
+ public void
+ run()
+ {
+ synchronized(_doneMutex)
+ {
+ if(!setCallbackInProgress(true))
+ {
+ return;
+ }
+
+ Communicator communicator = communicator();
+ if(communicator != null)
+ {
+ communicator.destroy();
+ }
+
+ clearCallbackInProgress();
+
+ while(!_done)
+ {
+ try
+ {
+ _doneMutex.wait();
+ }
+ catch(InterruptedException ex)
+ {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ static class ShutdownHook extends AppHook
+ {
+ @Override
+ public void
+ run()
+ {
+ synchronized(_doneMutex)
+ {
+ if(!setCallbackInProgress(false))
+ {
+ return;
+ }
+
+ Communicator communicator = communicator();
+ if(communicator != null)
+ {
+ communicator.shutdown();
+ }
+
+ clearCallbackInProgress();
+
+ while(!_done)
+ {
+ try
+ {
+ _doneMutex.wait();
+ }
+ catch(InterruptedException ex)
+ {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // Although this class doesn't actually use any of the AppHook
+ // done stuff, its more trouble than its worth to add all of the
+ // code necessary to support another hook member variable and
+ // support code.
+ static class CustomHook extends AppHook
+ {
+ CustomHook(Thread hook)
+ {
+ _hook = hook;
+ }
+
+ @Override
+ public void
+ run()
+ {
+ synchronized(_doneMutex)
+ {
+ if(!setCallbackInProgress(false))
+ {
+ return;
+ }
+
+ _hook.run();
+
+ clearCallbackInProgress();
+
+ //
+ // Don't bother to join with main, we're done.
+ //
+ }
+ }
+
+ private Thread _hook;
+ }
+
+ protected static String _appName;
+ protected static Communicator _communicator;
+ protected static AppHook _appHook;
+ protected final static java.lang.Object _mutex = new java.lang.Object();
+ protected static boolean _callbackInProgress = false;
+ protected static boolean _destroyed = false;
+ protected static boolean _interrupted = false;
+ protected static SignalPolicy _signalPolicy = SignalPolicy.HandleSignals;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/AsyncResult.java b/java/src/Ice/src/main/java/com/zeroc/Ice/AsyncResult.java
new file mode 100644
index 00000000000..1e336c7dbac
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/AsyncResult.java
@@ -0,0 +1,105 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * An AsyncResult object is the return value of an asynchronous invocation.
+ * With this object, an application can obtain several attributes of the
+ * invocation and discover its outcome.
+ **/
+public interface AsyncResult
+{
+ /**
+ * If not completed, cancels the request. This is a local
+ * operation, it won't cancel the request on the server side.
+ * Calling <code>cancel</code> prevents a queued request from
+ * being sent or ignores a reply if the request has already
+ * been sent.
+ **/
+ public void cancel();
+
+ /**
+ * Returns the communicator that sent the invocation.
+ *
+ * @return The communicator.
+ **/
+ public Communicator getCommunicator();
+
+ /**
+ * Returns the connection that was used to call the <code>begin_</code> method, or nil
+ * if this AsyncResult object was not obtained via an asynchronous connection invocation
+ * (such as <code>begin_flushBatchRequests</code>).
+ *
+ * @return The connection.
+ **/
+ public Connection getConnection();
+
+ /**
+ * Returns the proxy that was used to call the <code>begin_</code> method, or nil
+ * if this AsyncResult object was not obtained via an asynchronous proxy invocation.
+ *
+ * @return The proxy.
+ **/
+ public ObjectPrx getProxy();
+
+ /**
+ * Indicates whether the result of an invocation is available.
+ *
+ * @return True if the result is available, which means a call to the <code>end_</code>
+ * method will not block. The method returns false if the result is not yet available.
+ **/
+ public boolean isCompleted();
+
+ /**
+ * Blocks the caller until the result of the invocation is available.
+ **/
+ public void waitForCompleted();
+
+ /**
+ * When you call the <code>begin_</code> method, the Ice run time attempts to
+ * write the corresponding request to the client-side transport. If the
+ * transport cannot accept the request, the Ice run time queues the request
+ * for later transmission. This method returns true if, at the time it is called,
+ * the request has been written to the local transport (whether it was initially
+ * queued or not). Otherwise, if the request is still queued, this method returns
+ * false.
+ *
+ * @return True if the request has been sent, or false if the request is queued.
+ **/
+ public boolean isSent();
+
+ /**
+ * Blocks the caller until the request has been written to the client-side transport.
+ **/
+ public void waitForSent();
+
+ /**
+ * If the invocation failed with a local exception, throws the local exception.
+ **/
+ public void throwLocalException();
+
+ /**
+ * This method returns true if a request was written to the client-side
+ * transport without first being queued. If the request was initially
+ * queued, this method returns false (independent of whether the request
+ * is still in the queue or has since been written to the client-side transport).
+ *
+ * @return True if the request was sent without being queued, or false
+ * otherwise.
+ **/
+ public boolean sentSynchronously();
+
+ /**
+ * Returns the name of the operation.
+ *
+ * @return The operation name.
+ **/
+ public String getOperation();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/BatchRequest.java b/java/src/Ice/src/main/java/com/zeroc/Ice/BatchRequest.java
new file mode 100644
index 00000000000..b3687efa9f2
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/BatchRequest.java
@@ -0,0 +1,33 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+public interface BatchRequest
+{
+ /**
+ * Confirms the queuing of the batch request.
+ **/
+ void enqueue();
+
+ /**
+ * The marshalled size of the request.
+ **/
+ int getSize();
+
+ /**
+ * The name of the operation
+ **/
+ String getOperation();
+
+ /**
+ * The proxy used to invoke the batch request.
+ **/
+ ObjectPrx getProxy();
+};
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/BatchRequestInterceptor.java b/java/src/Ice/src/main/java/com/zeroc/Ice/BatchRequestInterceptor.java
new file mode 100644
index 00000000000..2f03d6b65e6
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/BatchRequestInterceptor.java
@@ -0,0 +1,28 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * Base interface for listening to batch request queues.
+ **/
+public interface BatchRequestInterceptor
+{
+ /**
+ * Called by the Ice runtime when a batch request is about to be
+ * added to the batch request queue of a proxy or connection.
+ *
+ * The implementation of this method must call enqueue() on the
+ * request to confirm its addition to the queue, if not called
+ * the request isn't added to the queue. The implementation can
+ * raise an Ice local exception to notify the caller of a failure.
+ *
+ **/
+ void enqueue(BatchRequest request, int queueBatchRequestCount, int queueBatchRequestSize);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/Blobject.java b/java/src/Ice/src/main/java/com/zeroc/Ice/Blobject.java
new file mode 100644
index 00000000000..4c802bb977f
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/Blobject.java
@@ -0,0 +1,48 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+import java.util.concurrent.CompletionStage;
+
+/**
+ * Base class for dynamic dispatch servants. A server application
+ * derives a concrete servant class from <code>Blobject</code> that
+ * implements the {@link Blobject#ice_invoke} method.
+ **/
+public interface Blobject extends com.zeroc.Ice.Object
+{
+ /**
+ * Dispatch an incoming request.
+ *
+ * @param inEncaps The encoded in-parameters for the operation.
+ * @param outEncaps The encoded out-paramaters and return value
+ * for the operation. The return value follows any out-parameters.
+ * @param current The Current object to pass to the operation.
+ * @return The method returns an instance of <code>Ice_invokeResult</code>.
+ * If the operation completed successfully, set the <code>returnValue</code>
+ * member to <code>true</code> and the <code>outParams</code> member to
+ * the encoded results. If the operation raises a user exception, you can
+ * either throw it directly or set the <code>returnValue</code> member to
+ * <code>false</code> and the <code>outParams</code> member to the encoded
+ * user exception. If the operation raises an Ice run-time exception, it
+ * must throw it directly.
+ **/
+ com.zeroc.Ice.Object.Ice_invokeResult ice_invoke(byte[] inEncaps, Current current)
+ throws UserException;
+
+ @Override
+ default CompletionStage<OutputStream> __dispatch(com.zeroc.IceInternal.Incoming in, Current current)
+ throws UserException
+ {
+ byte[] inEncaps = in.readParamEncaps();
+ com.zeroc.Ice.Object.Ice_invokeResult r = ice_invoke(inEncaps, current);
+ return in.setResult(in.writeParamEncaps(r.outParams, r.returnValue));
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/BlobjectAsync.java b/java/src/Ice/src/main/java/com/zeroc/Ice/BlobjectAsync.java
new file mode 100644
index 00000000000..f0edc5442fe
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/BlobjectAsync.java
@@ -0,0 +1,66 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+import java.util.concurrent.CompletionStage;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * <code>BlobjectAsync</code> is the base class for asynchronous dynamic
+ * dispatch servants. A server application derives a concrete servant
+ * class that implements the {@link BlobjectAsync#ice_invoke_async} method,
+ * which is called by the Ice run time to deliver every request on this
+ * object.
+ **/
+public interface BlobjectAsync extends com.zeroc.Ice.Object
+{
+ /**
+ * Dispatch an incoming request.
+ *
+ * @param inEncaps The encoded input parameters.
+ * @param response Accepts the invocation's results on success.
+ * @param exception Accepts an exception on failure. User exceptions must be sent via
+ * <code>response</code>.
+ * @param current The Current object, which provides important information
+ * about the request, such as the identity of the target object and the
+ * name of the operation.
+ * @return A completion stage that eventually completes with the result of
+ * the invocation, an instance of <code>Ice_invokeResult</code>.
+ * If the operation completed successfully, set the <code>returnValue</code>
+ * member to <code>true</code> and the <code>outParams</code> member to
+ * the encoded results. If the operation raises a user exception, you can
+ * throw it directly from <code>ice_invokeAsync</code>, or complete the
+ * future by setting the <code>returnValue</code> member to
+ * <code>false</code> and the <code>outParams</code> member to the encoded
+ * user exception.
+ **/
+ CompletionStage<Object.Ice_invokeResult> ice_invokeAsync(byte[] inEncaps, Current current)
+ throws UserException;
+
+ @Override
+ default CompletionStage<OutputStream> __dispatch(com.zeroc.IceInternal.Incoming in, Current current)
+ throws UserException
+ {
+ byte[] inEncaps = in.readParamEncaps();
+ CompletableFuture<OutputStream> f = new CompletableFuture<>();
+ ice_invokeAsync(inEncaps, current).whenComplete((result, ex) ->
+ {
+ if(ex != null)
+ {
+ f.completeExceptionally(ex);
+ }
+ else
+ {
+ f.complete(in.writeParamEncaps(result.outParams, result.returnValue));
+ }
+ });
+ return f;
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/ClassResolver.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ClassResolver.java
new file mode 100644
index 00000000000..31cac6b2955
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ClassResolver.java
@@ -0,0 +1,29 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ *
+ * A ClassResolver translates a Slice type Id into a Java class using
+ * an implementation-defined algorithm.
+ *
+ **/
+public interface ClassResolver
+{
+ /**
+ * Resolve a Slice type Id into a Java class. The type Id corresponds to a
+ * Slice value or user exception.
+ *
+ * @param typeId A string type ID (such as <code>"::Module::Class"</code>).
+ * @return The Java class object corresponding to the Slice type ID, or null
+ * if no class could be found.
+ **/
+ Class<?> resolveClass(String typeId);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/CommunicatorI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/CommunicatorI.java
new file mode 100644
index 00000000000..64ff934f6d4
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/CommunicatorI.java
@@ -0,0 +1,333 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+public final class CommunicatorI implements Communicator
+{
+ @Override
+ public void
+ destroy()
+ {
+ _instance.destroy();
+ }
+
+ @Override
+ public void
+ shutdown()
+ {
+ _instance.objectAdapterFactory().shutdown();
+ }
+
+ @Override
+ public void
+ waitForShutdown()
+ {
+ _instance.objectAdapterFactory().waitForShutdown();
+ }
+
+ @Override
+ public boolean
+ isShutdown()
+ {
+ return _instance.objectAdapterFactory().isShutdown();
+ }
+
+ @Override
+ public ObjectPrx
+ stringToProxy(String s)
+ {
+ return _instance.proxyFactory().stringToProxy(s);
+ }
+
+ @Override
+ public String
+ proxyToString(ObjectPrx proxy)
+ {
+ return _instance.proxyFactory().proxyToString(proxy);
+ }
+
+ @Override
+ public ObjectPrx
+ propertyToProxy(String s)
+ {
+ return _instance.proxyFactory().propertyToProxy(s);
+ }
+
+ @Override
+ public java.util.Map<String, String>
+ proxyToProperty(ObjectPrx proxy, String prefix)
+ {
+ return _instance.proxyFactory().proxyToProperty(proxy, prefix);
+ }
+
+ @Override @SuppressWarnings("deprecation")
+ public Identity
+ stringToIdentity(String s)
+ {
+ return Util.stringToIdentity(s);
+ }
+
+ @Override @SuppressWarnings("deprecation")
+ public String
+ identityToString(Identity ident)
+ {
+ return Util.identityToString(ident);
+ }
+
+ @Override
+ public ObjectAdapter
+ createObjectAdapter(String name)
+ {
+ return _instance.objectAdapterFactory().createObjectAdapter(name, null);
+ }
+
+ @Override
+ public ObjectAdapter
+ createObjectAdapterWithEndpoints(String name, String endpoints)
+ {
+ if(name.length() == 0)
+ {
+ name = java.util.UUID.randomUUID().toString();
+ }
+
+ getProperties().setProperty(name + ".Endpoints", endpoints);
+ return _instance.objectAdapterFactory().createObjectAdapter(name, null);
+ }
+
+ @Override
+ public ObjectAdapter
+ createObjectAdapterWithRouter(String name, RouterPrx router)
+ {
+ if(name.length() == 0)
+ {
+ name = java.util.UUID.randomUUID().toString();
+ }
+
+ //
+ // We set the proxy properties here, although we still use the proxy supplied.
+ //
+ java.util.Map<String, String> properties = proxyToProperty(router, name + ".Router");
+ for(java.util.Map.Entry<String, String> p : properties.entrySet())
+ {
+ getProperties().setProperty(p.getKey(), p.getValue());
+ }
+
+ return _instance.objectAdapterFactory().createObjectAdapter(name, router);
+ }
+
+ @Override @SuppressWarnings("deprecation")
+ public void addObjectFactory(ObjectFactory factory, String id)
+ {
+ _instance.addObjectFactory(factory, id);
+ }
+
+ @Override @SuppressWarnings("deprecation")
+ public ObjectFactory findObjectFactory(String id)
+ {
+ return _instance.findObjectFactory(id);
+ }
+
+ @Override
+ public ValueFactoryManager getValueFactoryManager()
+ {
+ return _instance.initializationData().valueFactoryManager;
+ }
+
+ @Override
+ public Properties
+ getProperties()
+ {
+ return _instance.initializationData().properties;
+ }
+
+ @Override
+ public Logger
+ getLogger()
+ {
+ return _instance.initializationData().logger;
+ }
+
+ @Override
+ public com.zeroc.Ice.Instrumentation.CommunicatorObserver
+ getObserver()
+ {
+ return _instance.initializationData().observer;
+ }
+
+ @Override
+ public RouterPrx
+ getDefaultRouter()
+ {
+ return _instance.referenceFactory().getDefaultRouter();
+ }
+
+ @Override
+ public void
+ setDefaultRouter(RouterPrx router)
+ {
+ _instance.setDefaultRouter(router);
+ }
+
+ @Override
+ public LocatorPrx
+ getDefaultLocator()
+ {
+ return _instance.referenceFactory().getDefaultLocator();
+ }
+
+ @Override
+ public void
+ setDefaultLocator(LocatorPrx locator)
+ {
+ _instance.setDefaultLocator(locator);
+ }
+
+ @Override
+ public ImplicitContext
+ getImplicitContext()
+ {
+ return _instance.getImplicitContext();
+ }
+
+ @Override
+ public PluginManager
+ getPluginManager()
+ {
+ return _instance.pluginManager();
+ }
+
+ @Override
+ public void flushBatchRequests()
+ {
+ __flushBatchRequestsAsync().__wait();
+ }
+
+ @Override
+ public java.util.concurrent.CompletableFuture<Void> flushBatchRequestsAsync()
+ {
+ return __flushBatchRequestsAsync();
+ }
+
+ public com.zeroc.IceInternal.CommunicatorFlushBatch __flushBatchRequestsAsync()
+ {
+ com.zeroc.IceInternal.OutgoingConnectionFactory connectionFactory = _instance.outgoingConnectionFactory();
+ com.zeroc.IceInternal.ObjectAdapterFactory adapterFactory = _instance.objectAdapterFactory();
+
+ //
+ // This callback object receives the results of all invocations
+ // of Connection.begin_flushBatchRequests.
+ //
+ com.zeroc.IceInternal.CommunicatorFlushBatch __f =
+ new com.zeroc.IceInternal.CommunicatorFlushBatch(this, _instance);
+
+ connectionFactory.flushAsyncBatchRequests(__f);
+ adapterFactory.flushAsyncBatchRequests(__f);
+
+ //
+ // Inform the callback that we have finished initiating all of the
+ // flush requests.
+ //
+ __f.ready();
+
+ return __f;
+ }
+
+ @Override
+ public ObjectPrx
+ createAdmin(ObjectAdapter adminAdapter, Identity adminId)
+ {
+ return _instance.createAdmin(adminAdapter, adminId);
+ }
+
+ @Override
+ public ObjectPrx
+ getAdmin()
+ {
+ return _instance.getAdmin();
+ }
+
+ @Override
+ public void
+ addAdminFacet(Object servant, String facet)
+ {
+ _instance.addAdminFacet(servant, facet);
+ }
+
+ @Override
+ public Object
+ removeAdminFacet(String facet)
+ {
+ return _instance.removeAdminFacet(facet);
+ }
+
+ @Override
+ public Object
+ findAdminFacet(String facet)
+ {
+ return _instance.findAdminFacet(facet);
+ }
+
+ @Override
+ public java.util.Map<String, com.zeroc.Ice.Object>
+ findAllAdminFacets()
+ {
+ return _instance.findAllAdminFacets();
+ }
+
+ CommunicatorI(InitializationData initData)
+ {
+ _instance = new com.zeroc.IceInternal.Instance(this, initData);
+ }
+
+ /**
+ * For compatibility with C#, we do not invoke methods on other objects
+ * from within a finalizer.
+ *
+ protected synchronized void
+ finalize()
+ throws Throwable
+ {
+ if(!_instance.destroyed())
+ {
+ _instance.logger().warning("Ice::Communicator::destroy() has not been called");
+ }
+
+ super.finalize();
+ }
+ */
+
+ //
+ // Certain initialization tasks need to be completed after the
+ // constructor.
+ //
+ String[] finishSetup(String[] args)
+ {
+ try
+ {
+ return _instance.finishSetup(args, this);
+ }
+ catch(RuntimeException ex)
+ {
+ _instance.destroy();
+ throw ex;
+ }
+ }
+
+ //
+ // For use by com.zeroc.IceInternal.Util.getInstance()
+ //
+ public com.zeroc.IceInternal.Instance
+ getInstance()
+ {
+ return _instance;
+ }
+
+ private com.zeroc.IceInternal.Instance _instance;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/CompactIdResolver.java b/java/src/Ice/src/main/java/com/zeroc/Ice/CompactIdResolver.java
new file mode 100644
index 00000000000..a6af91cc5af
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/CompactIdResolver.java
@@ -0,0 +1,29 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * Applications that make use of compact type IDs to conserve space
+ * when marshaling class instances, and also use the streaming API to
+ * extract such classes, can intercept the translation between compact
+ * type IDs and their corresponding string type IDs by installing an
+ * instance of <code>CompactIdResolver</code> in <code>InitializationData</code>.
+ **/
+public interface CompactIdResolver
+{
+ /**
+ * Translates a compact (integer) ID into its string equivalent.
+ *
+ * @param id The compact ID.
+ * @return A string type ID (such as <code>"::Module::Class"</code>),
+ * or an empty string if the compact ID is unknown.
+ **/
+ String resolve(int id);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/ConnectionI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ConnectionI.java
new file mode 100644
index 00000000000..d2b85c58782
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ConnectionI.java
@@ -0,0 +1,3002 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+import java.util.concurrent.Callable;
+
+import com.zeroc.IceInternal.AsyncStatus;
+import com.zeroc.IceInternal.Buffer;
+import com.zeroc.IceInternal.Incoming;
+import com.zeroc.IceInternal.OutgoingAsyncBase;
+import com.zeroc.IceInternal.Protocol;
+import com.zeroc.IceInternal.SocketOperation;
+import com.zeroc.IceInternal.Time;
+import com.zeroc.IceInternal.TraceUtil;
+import com.zeroc.Ice.Instrumentation.ConnectionState;
+
+public final class ConnectionI extends com.zeroc.IceInternal.EventHandler
+ implements Connection, com.zeroc.IceInternal.ResponseHandler, com.zeroc.IceInternal.CancellationHandler
+{
+ public interface StartCallback
+ {
+ void connectionStartCompleted(ConnectionI connection);
+
+ void connectionStartFailed(ConnectionI connection, LocalException ex);
+ }
+
+ private class TimeoutCallback implements Runnable
+ {
+ @Override
+ public void run()
+ {
+ timedOut();
+ }
+ }
+
+ public void start(StartCallback callback)
+ {
+ try
+ {
+ synchronized(this)
+ {
+ // The connection might already be closed if the communicator
+ // was destroyed.
+ if(_state >= StateClosed)
+ {
+ assert (_exception != null);
+ throw (LocalException) _exception.fillInStackTrace();
+ }
+
+ if(!initialize(SocketOperation.None) || !validate(SocketOperation.None))
+ {
+ _startCallback = callback;
+ return;
+ }
+
+ //
+ // We start out in holding state.
+ //
+ setState(StateHolding);
+ }
+ }
+ catch(LocalException ex)
+ {
+ exception(ex);
+ callback.connectionStartFailed(this, _exception);
+ return;
+ }
+
+ callback.connectionStartCompleted(this);
+ }
+
+ public void startAndWait() throws InterruptedException
+ {
+ try
+ {
+ synchronized(this)
+ {
+ // The connection might already be closed if the communicator
+ // was destroyed.
+ if(_state >= StateClosed)
+ {
+ assert (_exception != null);
+ throw (LocalException) _exception.fillInStackTrace();
+ }
+
+ if(!initialize(SocketOperation.None) || !validate(SocketOperation.None))
+ {
+ while(_state <= StateNotValidated)
+ {
+ wait();
+ }
+
+ if(_state >= StateClosing)
+ {
+ assert (_exception != null);
+ throw (LocalException) _exception.fillInStackTrace();
+ }
+ }
+
+ //
+ // We start out in holding state.
+ //
+ setState(StateHolding);
+ }
+ }
+ catch(LocalException ex)
+ {
+ exception(ex);
+ waitUntilFinished();
+ }
+ }
+
+ public synchronized void activate()
+ {
+ if(_state <= StateNotValidated)
+ {
+ return;
+ }
+
+ if(_acmLastActivity > 0)
+ {
+ _acmLastActivity = Time.currentMonotonicTimeMillis();
+ }
+
+ setState(StateActive);
+ }
+
+ public synchronized void hold()
+ {
+ if(_state <= StateNotValidated)
+ {
+ return;
+ }
+
+ setState(StateHolding);
+ }
+
+ // DestructionReason.
+ public final static int ObjectAdapterDeactivated = 0;
+ public final static int CommunicatorDestroyed = 1;
+
+ synchronized public void destroy(int reason)
+ {
+ switch(reason)
+ {
+ case ObjectAdapterDeactivated:
+ {
+ setState(StateClosing, new ObjectAdapterDeactivatedException());
+ break;
+ }
+
+ case CommunicatorDestroyed:
+ {
+ setState(StateClosing, new CommunicatorDestroyedException());
+ break;
+ }
+ }
+ }
+
+ @Override
+ synchronized public void close(boolean force)
+ {
+ if(Thread.interrupted())
+ {
+ throw new OperationInterruptedException();
+ }
+
+ if(force)
+ {
+ setState(StateClosed, new ForcedCloseConnectionException());
+ }
+ else
+ {
+ //
+ // If we do a graceful shutdown, then we wait until all
+ // outstanding requests have been completed. Otherwise,
+ // the CloseConnectionException will cause all outstanding
+ // requests to be retried, regardless of whether the
+ // server has processed them or not.
+ //
+ while(!_asyncRequests.isEmpty())
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ throw new OperationInterruptedException();
+ }
+ }
+
+ setState(StateClosing, new CloseConnectionException());
+ }
+ }
+
+ public synchronized boolean isActiveOrHolding()
+ {
+ return _state > StateNotValidated && _state < StateClosing;
+ }
+
+ public synchronized boolean isFinished()
+ {
+ if(_state != StateFinished || _dispatchCount != 0)
+ {
+ return false;
+ }
+
+ assert (_state == StateFinished);
+ return true;
+ }
+
+ public synchronized void throwException()
+ {
+ if(_exception != null)
+ {
+ assert (_state >= StateClosing);
+ throw (LocalException) _exception.fillInStackTrace();
+ }
+ }
+
+ public synchronized void waitUntilHolding() throws InterruptedException
+ {
+ while(_state < StateHolding || _dispatchCount > 0)
+ {
+ wait();
+ }
+ }
+
+ public synchronized void waitUntilFinished() throws InterruptedException
+ {
+ //
+ // We wait indefinitely until the connection is finished and all
+ // outstanding requests are completed. Otherwise we couldn't
+ // guarantee that there are no outstanding calls when deactivate()
+ // is called on the servant locators.
+ //
+ while(_state < StateFinished || _dispatchCount > 0)
+ {
+ wait();
+ }
+
+ assert (_state == StateFinished);
+
+ //
+ // Clear the OA. See bug 1673 for the details of why this is necessary.
+ //
+ _adapter = null;
+ }
+
+ synchronized public void updateObserver()
+ {
+ if(_state < StateNotValidated || _state > StateClosed)
+ {
+ return;
+ }
+
+ assert (_instance.initializationData().observer != null);
+ _observer = _instance.initializationData().observer.getConnectionObserver(initConnectionInfo(),
+ _endpoint,
+ toConnectionState(_state),
+ _observer);
+ if(_observer != null)
+ {
+ _observer.attach();
+ }
+ else
+ {
+ _writeStreamPos = -1;
+ _readStreamPos = -1;
+ }
+ }
+
+ synchronized public void monitor(long now, com.zeroc.IceInternal.ACMConfig acm)
+ {
+ if(_state != StateActive)
+ {
+ return;
+ }
+
+ //
+ // We send a heartbeat if there was no activity in the last
+ // (timeout / 4) period. Sending a heartbeat sooner than
+ // really needed is safer to ensure that the receiver will
+ // receive in time the heartbeat. Sending the heartbeat if
+ // there was no activity in the last (timeout / 2) period
+ // isn't enough since monitor() is called only every (timeout
+ // / 2) period.
+ //
+ // Note that this doesn't imply that we are sending 4
+ // heartbeats per timeout period because the monitor() method
+ // is sill only called every (timeout / 2) period.
+ //
+ if(acm.heartbeat == ACMHeartbeat.HeartbeatAlways ||
+ (acm.heartbeat != ACMHeartbeat.HeartbeatOff && _writeStream.isEmpty() &&
+ now >= (_acmLastActivity + acm.timeout / 4)))
+ {
+ if(acm.heartbeat != ACMHeartbeat.HeartbeatOnInvocation || _dispatchCount > 0)
+ {
+ heartbeat();
+ }
+ }
+
+ if(_readStream.size() > Protocol.headerSize || !_writeStream.isEmpty())
+ {
+ //
+ // If writing or reading, nothing to do, the connection
+ // timeout will kick-in if writes or reads don't progress.
+ // This check is necessary because the activity timer is
+ // only set when a message is fully read/written.
+ //
+ return;
+ }
+
+ if(acm.close != ACMClose.CloseOff && now >= (_acmLastActivity + acm.timeout))
+ {
+ if(acm.close == ACMClose.CloseOnIdleForceful ||
+ (acm.close != ACMClose.CloseOnIdle && (!_asyncRequests.isEmpty())))
+ {
+ //
+ // Close the connection if we didn't receive a heartbeat in
+ // the last period.
+ //
+ setState(StateClosed, new ConnectionTimeoutException());
+ }
+ else if(acm.close != ACMClose.CloseOnInvocation && _dispatchCount == 0 && _batchRequestQueue.isEmpty() &&
+ _asyncRequests.isEmpty())
+ {
+ //
+ // The connection is idle, close it.
+ //
+ setState(StateClosing, new ConnectionTimeoutException());
+ }
+ }
+ }
+
+ synchronized public int
+ sendAsyncRequest(OutgoingAsyncBase out, boolean compress, boolean response,
+ int batchRequestNum)
+ throws com.zeroc.IceInternal.RetryException
+ {
+ final OutputStream os = out.getOs();
+
+ if(_exception != null)
+ {
+ //
+ // If the connection is closed before we even have a chance
+ // to send our request, we always try to send the request
+ // again.
+ //
+ throw new com.zeroc.IceInternal.RetryException((LocalException) _exception.fillInStackTrace());
+ }
+
+ assert (_state > StateNotValidated);
+ assert (_state < StateClosing);
+
+ //
+ // Ensure the message isn't bigger than what we can send with the
+ // transport.
+ //
+ _transceiver.checkSendSize(os.getBuffer());
+
+ //
+ // Notify the request that it's cancelable with this connection.
+ // This will throw if the request is canceled.
+ //
+ out.cancelable(this);
+
+ int requestId = 0;
+ if(response)
+ {
+ //
+ // Create a new unique request ID.
+ //
+ requestId = _nextRequestId++;
+ if(requestId <= 0)
+ {
+ _nextRequestId = 1;
+ requestId = _nextRequestId++;
+ }
+
+ //
+ // Fill in the request ID.
+ //
+ os.pos(Protocol.headerSize);
+ os.writeInt(requestId);
+ }
+ else if(batchRequestNum > 0)
+ {
+ os.pos(Protocol.headerSize);
+ os.writeInt(batchRequestNum);
+ }
+
+ out.attachRemoteObserver(initConnectionInfo(), _endpoint, requestId);
+
+ int status;
+ try
+ {
+ status = sendMessage(new OutgoingMessage(out, os, compress, requestId));
+ }
+ catch(LocalException ex)
+ {
+ setState(StateClosed, ex);
+ assert (_exception != null);
+ throw (LocalException) _exception.fillInStackTrace();
+ }
+
+ if(response)
+ {
+ //
+ // Add to the async requests map.
+ //
+ _asyncRequests.put(requestId, out);
+ }
+ return status;
+ }
+
+ public com.zeroc.IceInternal.BatchRequestQueue
+ getBatchRequestQueue()
+ {
+ return _batchRequestQueue;
+ }
+
+ @Override
+ public void flushBatchRequests()
+ {
+ ObjectPrx.__waitForCompletion(flushBatchRequestsAsync());
+ }
+
+ @Override
+ public java.util.concurrent.CompletableFuture<Void> flushBatchRequestsAsync()
+ {
+ com.zeroc.IceInternal.ConnectionFlushBatch __f =
+ new com.zeroc.IceInternal.ConnectionFlushBatch(this, _communicator, _instance);
+ __f.invoke();
+ return __f;
+ }
+
+ @Override
+ synchronized public void setCloseCallback(final CloseCallback callback)
+ {
+ if(_state >= StateClosed)
+ {
+ if(callback != null)
+ {
+ _threadPool.dispatch(new com.zeroc.IceInternal.DispatchWorkItem(this)
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ callback.closed(ConnectionI.this);
+ }
+ catch(Exception ex)
+ {
+ _logger.error("connection callback exception:\n" + ex + '\n' + _desc);
+ }
+ }
+ });
+ }
+ }
+ else
+ {
+ _closeCallback = callback;
+ }
+ }
+
+ @Override
+ synchronized public void setHeartbeatCallback(final HeartbeatCallback callback)
+ {
+ _heartbeatCallback = callback;
+ }
+
+ @Override
+ synchronized public void setACM(java.util.OptionalInt timeout, java.util.Optional<ACMClose> close,
+ java.util.Optional<ACMHeartbeat> heartbeat)
+ {
+ if(_monitor == null || _state >= StateClosed)
+ {
+ return;
+ }
+
+ if(_state == StateActive)
+ {
+ _monitor.remove(this);
+ }
+ _monitor = _monitor.acm(timeout, close, heartbeat);
+
+ if(_monitor.getACM().timeout <= 0)
+ {
+ _acmLastActivity = -1; // Disable the recording of last activity.
+ }
+ else if(_state == StateActive && _acmLastActivity == -1)
+ {
+ _acmLastActivity = Time.currentMonotonicTimeMillis();
+ }
+
+ if(_state == StateActive)
+ {
+ _monitor.add(this);
+ }
+ }
+
+ @Override
+ synchronized public ACM getACM()
+ {
+ return _monitor != null ? _monitor.getACM() : new ACM(0, ACMClose.CloseOff, ACMHeartbeat.HeartbeatOff);
+ }
+
+ @Override
+ synchronized public void asyncRequestCanceled(OutgoingAsyncBase outAsync, LocalException ex)
+ {
+ if(_state >= StateClosed)
+ {
+ return; // The request has already been or will be shortly notified of the failure.
+ }
+
+ java.util.Iterator<OutgoingMessage> it = _sendStreams.iterator();
+ while(it.hasNext())
+ {
+ OutgoingMessage o = it.next();
+ if(o.outAsync == outAsync)
+ {
+ if(o.requestId > 0)
+ {
+ _asyncRequests.remove(o.requestId);
+ }
+
+ if(ex instanceof ConnectionTimeoutException)
+ {
+ setState(StateClosed, ex);
+ }
+ else
+ {
+ //
+ // If the request is being sent, don't remove it from the send
+ // streams, it will be removed once the sending is finished.
+ //
+ // Note that since we swapped the message stream to _writeStream
+ // it's fine if the OutgoingAsync output stream is released (and
+ // as long as canceled requests cannot be retried).
+ //
+ o.canceled();
+ if(o != _sendStreams.getFirst())
+ {
+ it.remove();
+ }
+ if(outAsync.completed(ex))
+ {
+ outAsync.invokeCompletedAsync();
+ }
+ }
+ return;
+ }
+ }
+
+ if(outAsync instanceof com.zeroc.IceInternal.OutgoingAsync)
+ {
+ com.zeroc.IceInternal.OutgoingAsync o = (com.zeroc.IceInternal.OutgoingAsync) outAsync;
+ java.util.Iterator<OutgoingAsyncBase> it2 = _asyncRequests.values().iterator();
+ while(it2.hasNext())
+ {
+ if(it2.next() == o)
+ {
+ if(ex instanceof ConnectionTimeoutException)
+ {
+ setState(StateClosed, ex);
+ }
+ else
+ {
+ it2.remove();
+ if(outAsync.completed(ex))
+ {
+ outAsync.invokeCompletedAsync();
+ }
+ }
+ return;
+ }
+ }
+ }
+ }
+
+ @Override
+ synchronized public void sendResponse(int requestId, OutputStream os, byte compressFlag, boolean amd)
+ {
+ assert (_state > StateNotValidated);
+
+ try
+ {
+ if(--_dispatchCount == 0)
+ {
+ if(_state == StateFinished)
+ {
+ reap();
+ }
+ notifyAll();
+ }
+
+ if(_state >= StateClosed)
+ {
+ assert (_exception != null);
+ throw (LocalException) _exception.fillInStackTrace();
+ }
+
+ sendMessage(new OutgoingMessage(os, compressFlag != 0, true));
+
+ if(_state == StateClosing && _dispatchCount == 0)
+ {
+ initiateShutdown();
+ }
+ }
+ catch(LocalException ex)
+ {
+ setState(StateClosed, ex);
+ }
+ }
+
+ @Override
+ synchronized public void sendNoResponse()
+ {
+ assert (_state > StateNotValidated);
+ try
+ {
+ if(--_dispatchCount == 0)
+ {
+ if(_state == StateFinished)
+ {
+ reap();
+ }
+ notifyAll();
+ }
+
+ if(_state >= StateClosed)
+ {
+ assert (_exception != null);
+ throw (LocalException) _exception.fillInStackTrace();
+ }
+
+ if(_state == StateClosing && _dispatchCount == 0)
+ {
+ initiateShutdown();
+ }
+ }
+ catch(LocalException ex)
+ {
+ setState(StateClosed, ex);
+ }
+ }
+
+ @Override
+ public boolean systemException(int requestId, SystemException ex, boolean amd)
+ {
+ return false; // System exceptions aren't marshalled.
+ }
+
+ @Override
+ public synchronized void invokeException(int requestId, LocalException ex, int invokeNum, boolean amd)
+ {
+ //
+ // Fatal exception while invoking a request. Since
+ // sendResponse/sendNoResponse isn't
+ // called in case of a fatal exception we decrement _dispatchCount here.
+ //
+
+ setState(StateClosed, ex);
+
+ if(invokeNum > 0)
+ {
+ assert (_dispatchCount > 0);
+ _dispatchCount -= invokeNum;
+ assert (_dispatchCount >= 0);
+ if(_dispatchCount == 0)
+ {
+ if(_state == StateFinished)
+ {
+ reap();
+ }
+ notifyAll();
+ }
+ }
+ }
+
+ public com.zeroc.IceInternal.EndpointI endpoint()
+ {
+ return _endpoint; // No mutex protection necessary, _endpoint is
+ // immutable.
+ }
+
+ public com.zeroc.IceInternal.Connector connector()
+ {
+ return _connector; // No mutex protection necessary, _connector is
+ // immutable.
+ }
+
+ @Override
+ public synchronized void setAdapter(ObjectAdapter adapter)
+ {
+ if(_state <= StateNotValidated || _state >= StateClosing)
+ {
+ return;
+ }
+
+ _adapter = adapter;
+
+ if(_adapter != null)
+ {
+ _servantManager = ((ObjectAdapterI) _adapter).getServantManager();
+ if(_servantManager == null)
+ {
+ _adapter = null;
+ }
+ }
+ else
+ {
+ _servantManager = null;
+ }
+
+ //
+ // We never change the thread pool with which we were
+ // initially registered, even if we add or remove an object
+ // adapter.
+ //
+ }
+
+ @Override
+ public synchronized ObjectAdapter getAdapter()
+ {
+ return _adapter;
+ }
+
+ @Override
+ public Endpoint getEndpoint()
+ {
+ return _endpoint; // No mutex protection necessary, _endpoint is
+ // immutable.
+ }
+
+ @Override
+ public ObjectPrx createProxy(Identity ident)
+ {
+ //
+ // Create a reference and return a reverse proxy for this
+ // reference.
+ //
+ return _instance.proxyFactory().referenceToProxy(_instance.referenceFactory().create(ident, this));
+ }
+
+ //
+ // Operations from EventHandler
+ //
+ @Override
+ public void message(com.zeroc.IceInternal.ThreadPoolCurrent current)
+ {
+ StartCallback startCB = null;
+ java.util.List<OutgoingMessage> sentCBs = null;
+ MessageInfo info = null;
+ int dispatchCount = 0;
+
+ synchronized(this)
+ {
+ if(_state >= StateClosed)
+ {
+ return;
+ }
+
+ if(!current.ioReady())
+ {
+ return;
+ }
+
+ int readyOp = current.operation;
+ try
+ {
+ unscheduleTimeout(current.operation);
+
+ int writeOp = SocketOperation.None;
+ int readOp = SocketOperation.None;
+
+ if((readyOp & SocketOperation.Write) != 0)
+ {
+ final Buffer buf = _writeStream.getBuffer();
+ if(_observer != null)
+ {
+ observerStartWrite(buf);
+ }
+ writeOp = write(buf);
+ if(_observer != null && (writeOp & SocketOperation.Write) == 0)
+ {
+ observerFinishWrite(buf);
+ }
+ }
+
+ while((readyOp & SocketOperation.Read) != 0)
+ {
+ final Buffer buf = _readStream.getBuffer();
+ if(_observer != null && !_readHeader)
+ {
+ observerStartRead(buf);
+ }
+
+ readOp = read(buf);
+ if((readOp & SocketOperation.Read) != 0)
+ {
+ break;
+ }
+ if(_observer != null && !_readHeader)
+ {
+ assert (!buf.b.hasRemaining());
+ observerFinishRead(buf);
+ }
+
+ if(_readHeader) // Read header if necessary.
+ {
+ _readHeader = false;
+
+ if(_observer != null)
+ {
+ _observer.receivedBytes(Protocol.headerSize);
+ }
+
+ int pos = _readStream.pos();
+ if(pos < Protocol.headerSize)
+ {
+ //
+ // This situation is possible for small UDP packets.
+ //
+ throw new IllegalMessageSizeException();
+ }
+
+ _readStream.pos(0);
+ byte[] m = new byte[4];
+ m[0] = _readStream.readByte();
+ m[1] = _readStream.readByte();
+ m[2] = _readStream.readByte();
+ m[3] = _readStream.readByte();
+ if(m[0] != Protocol.magic[0] ||
+ m[1] != Protocol.magic[1] ||
+ m[2] != Protocol.magic[2] ||
+ m[3] != Protocol.magic[3])
+ {
+ BadMagicException ex = new BadMagicException();
+ ex.badMagic = m;
+ throw ex;
+ }
+
+ _readProtocol.ice_read(_readStream);
+ Protocol.checkSupportedProtocol(_readProtocol);
+
+ _readProtocolEncoding.ice_read(_readStream);
+ Protocol.checkSupportedProtocolEncoding(_readProtocolEncoding);
+
+ _readStream.readByte(); // messageType
+ _readStream.readByte(); // compress
+ int size = _readStream.readInt();
+ if(size < Protocol.headerSize)
+ {
+ throw new IllegalMessageSizeException();
+ }
+ if(size > _messageSizeMax)
+ {
+ com.zeroc.IceInternal.Ex.throwMemoryLimitException(size, _messageSizeMax);
+ }
+ if(size > _readStream.size())
+ {
+ _readStream.resize(size);
+ }
+ _readStream.pos(pos);
+ }
+
+ if(_readStream.pos() != _readStream.size())
+ {
+ if(_endpoint.datagram())
+ {
+ // The message was truncated.
+ throw new DatagramLimitException();
+ }
+ continue;
+ }
+ break;
+ }
+
+ int newOp = readOp | writeOp;
+ readyOp = readyOp & ~newOp;
+ assert (readyOp != 0 || newOp != 0);
+
+ if(_state <= StateNotValidated)
+ {
+ if(newOp != 0)
+ {
+ //
+ // Wait for all the transceiver conditions to be
+ // satisfied before continuing.
+ //
+ scheduleTimeout(newOp);
+ _threadPool.update(this, current.operation, newOp);
+ return;
+ }
+
+ if(_state == StateNotInitialized && !initialize(current.operation))
+ {
+ return;
+ }
+
+ if(_state <= StateNotValidated && !validate(current.operation))
+ {
+ return;
+ }
+
+ _threadPool.unregister(this, current.operation);
+
+ //
+ // We start out in holding state.
+ //
+ setState(StateHolding);
+ if(_startCallback != null)
+ {
+ startCB = _startCallback;
+ _startCallback = null;
+ if(startCB != null)
+ {
+ ++dispatchCount;
+ }
+ }
+ }
+ else
+ {
+ assert (_state <= StateClosingPending);
+
+ //
+ // We parse messages first, if we receive a close
+ // connection message we won't send more messages.
+ //
+ if((readyOp & SocketOperation.Read) != 0)
+ {
+ // Optimization: use the thread's stream.
+ info = new MessageInfo(current.stream);
+ newOp |= parseMessage(info);
+ dispatchCount += info.messageDispatchCount;
+ }
+
+ if((readyOp & SocketOperation.Write) != 0)
+ {
+ sentCBs = new java.util.LinkedList<>();
+ newOp |= sendNextMessage(sentCBs);
+ if(!sentCBs.isEmpty())
+ {
+ ++dispatchCount;
+ }
+ else
+ {
+ sentCBs = null;
+ }
+ }
+
+ if(_state < StateClosed)
+ {
+ scheduleTimeout(newOp);
+ _threadPool.update(this, current.operation, newOp);
+ }
+ }
+
+ if(_acmLastActivity > 0)
+ {
+ _acmLastActivity = Time.currentMonotonicTimeMillis();
+ }
+
+ if(dispatchCount == 0)
+ {
+ return; // Nothing to dispatch we're done!
+ }
+
+ _dispatchCount += dispatchCount;
+ current.ioCompleted();
+ }
+ catch(DatagramLimitException ex) // Expected.
+ {
+ if(_warnUdp)
+ {
+ _logger.warning("maximum datagram size of " + _readStream.pos() + " exceeded");
+ }
+ _readStream.resize(Protocol.headerSize);
+ _readStream.pos(0);
+ _readHeader = true;
+ return;
+ }
+ catch(SocketException ex)
+ {
+ setState(StateClosed, ex);
+ return;
+ }
+ catch(LocalException ex)
+ {
+ if(_endpoint.datagram())
+ {
+ if(_warn)
+ {
+ String s = "datagram connection exception:\n" + ex + '\n' + _desc;
+ _logger.warning(s);
+ }
+ _readStream.resize(Protocol.headerSize);
+ _readStream.pos(0);
+ _readHeader = true;
+ }
+ else
+ {
+ setState(StateClosed, ex);
+ }
+ return;
+ }
+ }
+
+ if(!_dispatcher) // Optimization, call dispatch() directly if there's no dispatcher.
+ {
+ dispatch(startCB, sentCBs, info);
+ }
+ else
+ {
+ // No need for the stream if heartbeat callback
+ if(info != null && info.heartbeatCallback == null)
+ {
+ //
+ // Create a new stream for the dispatch instead of using the
+ // thread pool's thread stream.
+ //
+ assert (info.stream == current.stream);
+ InputStream stream = info.stream;
+ info.stream = new InputStream(_instance, Protocol.currentProtocolEncoding);
+ info.stream.swap(stream);
+ }
+
+ final StartCallback finalStartCB = startCB;
+ final java.util.List<OutgoingMessage> finalSentCBs = sentCBs;
+ final MessageInfo finalInfo = info;
+ _threadPool.dispatchFromThisThread(new com.zeroc.IceInternal.DispatchWorkItem(this)
+ {
+ @Override
+ public void run()
+ {
+ dispatch(finalStartCB, finalSentCBs, finalInfo);
+ }
+ });
+ }
+ }
+
+ protected void dispatch(StartCallback startCB, java.util.List<OutgoingMessage> sentCBs, MessageInfo info)
+ {
+ int dispatchedCount = 0;
+
+ //
+ // Notify the factory that the connection establishment and
+ // validation has completed.
+ //
+ if(startCB != null)
+ {
+ startCB.connectionStartCompleted(this);
+ ++dispatchedCount;
+ }
+
+ //
+ // Notify AMI calls that the message was sent.
+ //
+ if(sentCBs != null)
+ {
+ for(OutgoingMessage msg : sentCBs)
+ {
+ msg.outAsync.invokeSent();
+ }
+ ++dispatchedCount;
+ }
+
+ if(info != null)
+ {
+ //
+ // Asynchronous replies must be handled outside the thread
+ // synchronization, so that nested calls are possible.
+ //
+ if(info.outAsync != null)
+ {
+ info.outAsync.invokeCompleted();
+ ++dispatchedCount;
+ }
+
+ if(info.heartbeatCallback != null)
+ {
+ try
+ {
+ info.heartbeatCallback.heartbeat(this);
+ }
+ catch(Exception ex)
+ {
+ _logger.error("connection callback exception:\n" + ex + '\n' + _desc);
+ }
+ ++dispatchedCount;
+ }
+
+ //
+ // Method invocation (or multiple invocations for batch messages)
+ // must be done outside the thread synchronization, so that nested
+ // calls are possible.
+ //
+ if(info.invokeNum > 0)
+ {
+ invokeAll(info.stream, info.invokeNum, info.requestId, info.compress, info.servantManager, info.adapter);
+
+ //
+ // Don't increase dispatchedCount, the dispatch count is
+ // decreased when the incoming reply is sent.
+ //
+ }
+ }
+
+ //
+ // Decrease dispatch count.
+ //
+ if(dispatchedCount > 0)
+ {
+ boolean queueShutdown = false;
+
+ synchronized(this)
+ {
+ _dispatchCount -= dispatchedCount;
+ if(_dispatchCount == 0)
+ {
+ //
+ // Only initiate shutdown if not already done. It might
+ // have already been done if the sent callback or AMI
+ // callback was dispatched when the connection was already
+ // in the closing state.
+ //
+ if(_state == StateClosing)
+ {
+ if(_instance.queueRequests())
+ {
+ //
+ // We can't call initiateShutdown() from this thread in certain
+ // situations (such as in Android).
+ //
+ queueShutdown = true;
+ }
+ else
+ {
+ try
+ {
+ initiateShutdown();
+ }
+ catch(LocalException ex)
+ {
+ setState(StateClosed, ex);
+ }
+ }
+ }
+ else if(_state == StateFinished)
+ {
+ reap();
+ }
+ if(!queueShutdown)
+ {
+ notifyAll();
+ }
+ }
+ }
+
+ if(queueShutdown)
+ {
+ _instance.getQueueExecutor().executeNoThrow(new Callable<Void>()
+ {
+ @Override
+ public Void call() throws Exception
+ {
+ synchronized(ConnectionI.this)
+ {
+ try
+ {
+ initiateShutdown();
+ }
+ catch(LocalException ex)
+ {
+ setState(StateClosed, ex);
+ }
+ ConnectionI.this.notifyAll();
+ }
+ return null;
+ }
+ });
+ }
+ }
+ }
+
+ @Override
+ public void finished(com.zeroc.IceInternal.ThreadPoolCurrent current, final boolean close)
+ {
+ synchronized(this)
+ {
+ assert (_state == StateClosed);
+ unscheduleTimeout(SocketOperation.Read | SocketOperation.Write);
+ }
+
+ //
+ // If there are no callbacks to call, we don't call ioCompleted() since
+ // we're not going to call code that will potentially block (this avoids
+ // promoting a new leader and unecessary thread creation, especially if
+ // this is called on shutdown).
+ //
+ if(_startCallback == null && _sendStreams.isEmpty() && _asyncRequests.isEmpty() &&
+ _closeCallback == null && _heartbeatCallback == null)
+ {
+ finish(close);
+ return;
+ }
+
+ current.ioCompleted();
+ if(!_dispatcher) // Optimization, call finish() directly if there's no
+ // dispatcher.
+ {
+ finish(close);
+ }
+ else
+ {
+ _threadPool.dispatchFromThisThread(new com.zeroc.IceInternal.DispatchWorkItem(this)
+ {
+ @Override
+ public void run()
+ {
+ finish(close);
+ }
+ });
+ }
+ }
+
+ public void finish(boolean close)
+ {
+ if(!_initialized)
+ {
+ if(_instance.traceLevels().network >= 2)
+ {
+ StringBuffer s = new StringBuffer("failed to ");
+ s.append(_connector != null ? "establish" : "accept");
+ s.append(" ");
+ s.append(_endpoint.protocol());
+ s.append(" connection\n");
+ s.append(toString());
+ s.append("\n");
+ s.append(_exception);
+ _instance.initializationData().logger.trace(_instance.traceLevels().networkCat, s.toString());
+ }
+ }
+ else
+ {
+ if(_instance.traceLevels().network >= 1)
+ {
+ StringBuffer s = new StringBuffer("closed ");
+ s.append(_endpoint.protocol());
+ s.append(" connection\n");
+ s.append(toString());
+
+ //
+ // Trace the cause of unexpected connection closures
+ //
+ if(!(_exception instanceof CloseConnectionException ||
+ _exception instanceof ForcedCloseConnectionException ||
+ _exception instanceof ConnectionTimeoutException ||
+ _exception instanceof CommunicatorDestroyedException ||
+ _exception instanceof ObjectAdapterDeactivatedException))
+ {
+ s.append("\n");
+ s.append(_exception);
+ }
+ _instance.initializationData().logger.trace(_instance.traceLevels().networkCat, s.toString());
+ }
+ }
+
+ if(close)
+ {
+ try
+ {
+ _transceiver.close();
+ }
+ catch(LocalException ex)
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ ex.printStackTrace(pw);
+ pw.flush();
+ String s = "unexpected connection exception:\n " + _desc + "\n" + sw.toString();
+ _instance.initializationData().logger.error(s);
+ }
+ }
+
+ if(_startCallback != null)
+ {
+ if(_instance.queueRequests())
+ {
+ // The connectStartFailed method might try to connect with another
+ // connector.
+ _instance.getQueueExecutor().executeNoThrow(new Callable<Void>()
+ {
+ @Override
+ public Void call() throws Exception
+ {
+ _startCallback.connectionStartFailed(ConnectionI.this, _exception);
+ return null;
+ }
+ });
+ }
+ else
+ {
+ _startCallback.connectionStartFailed(this, _exception);
+ }
+ _startCallback = null;
+ }
+
+ if(!_sendStreams.isEmpty())
+ {
+ if(!_writeStream.isEmpty())
+ {
+ //
+ // Return the stream to the outgoing call. This is important for
+ // retriable AMI calls which are not marshalled again.
+ //
+ OutgoingMessage message = _sendStreams.getFirst();
+ _writeStream.swap(message.stream);
+ }
+
+ for(OutgoingMessage p : _sendStreams)
+ {
+ p.completed(_exception);
+ if(p.requestId > 0) // Make sure finished isn't called twice.
+ {
+ _asyncRequests.remove(p.requestId);
+ }
+ }
+ _sendStreams.clear();
+ }
+
+ for(OutgoingAsyncBase p : _asyncRequests.values())
+ {
+ if(p.completed(_exception))
+ {
+ p.invokeCompleted();
+ }
+ }
+ _asyncRequests.clear();
+
+ //
+ // Don't wait to be reaped to reclaim memory allocated by read/write streams.
+ //
+ _writeStream.clear();
+ _writeStream.getBuffer().clear();
+ _readStream.clear();
+ _readStream.getBuffer().clear();
+
+ if(_closeCallback != null)
+ {
+ try
+ {
+ _closeCallback.closed(this);
+ }
+ catch(Exception ex)
+ {
+ _logger.error("connection callback exception:\n" + ex + '\n' + _desc);
+ }
+ _closeCallback = null;
+ }
+
+ _heartbeatCallback = null;
+
+ //
+ // This must be done last as this will cause waitUntilFinished() to
+ // return (and communicator objects such as the timer might be destroyed
+ // too).
+ //
+ synchronized(this)
+ {
+ setState(StateFinished);
+
+ if(_dispatchCount == 0)
+ {
+ reap();
+ }
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ return _toString();
+ }
+
+ @Override
+ public java.nio.channels.SelectableChannel fd()
+ {
+ return _transceiver.fd();
+ }
+
+ @Override
+ public void setReadyCallback(com.zeroc.IceInternal.ReadyCallback callback)
+ {
+ _transceiver.setReadyCallback(callback);
+ }
+
+ public synchronized void timedOut()
+ {
+ if(_state <= StateNotValidated)
+ {
+ setState(StateClosed, new ConnectTimeoutException());
+ }
+ else if(_state < StateClosing)
+ {
+ setState(StateClosed, new TimeoutException());
+ }
+ else if(_state < StateClosed)
+ {
+ setState(StateClosed, new CloseTimeoutException());
+ }
+ }
+
+ @Override
+ public String type()
+ {
+ return _type; // No mutex lock, _type is immutable.
+ }
+
+ @Override
+ public int timeout()
+ {
+ return _endpoint.timeout(); // No mutex protection necessary, _endpoint
+ // is immutable.
+ }
+
+ @Override
+ public synchronized ConnectionInfo getInfo()
+ {
+ if(_state >= StateClosed)
+ {
+ throw (LocalException) _exception.fillInStackTrace();
+ }
+ return initConnectionInfo();
+ }
+
+ @Override
+ public synchronized void setBufferSize(int rcvSize, int sndSize)
+ {
+ if(_state >= StateClosed)
+ {
+ throw (LocalException) _exception.fillInStackTrace();
+ }
+ _transceiver.setBufferSize(rcvSize, sndSize);
+ _info = null; // Invalidate the cached connection info
+ }
+
+ @Override
+ public String _toString()
+ {
+ return _desc; // No mutex lock, _desc is immutable.
+ }
+
+ public synchronized void exception(LocalException ex)
+ {
+ setState(StateClosed, ex);
+ }
+
+ public ConnectionI(Communicator communicator, com.zeroc.IceInternal.Instance instance,
+ com.zeroc.IceInternal.ACMMonitor monitor, com.zeroc.IceInternal.Transceiver transceiver,
+ com.zeroc.IceInternal.Connector connector, com.zeroc.IceInternal.EndpointI endpoint,
+ ObjectAdapterI adapter)
+ {
+ _communicator = communicator;
+ _instance = instance;
+ _monitor = monitor;
+ _transceiver = transceiver;
+ _desc = transceiver.toString();
+ _type = transceiver.protocol();
+ _connector = connector;
+ _endpoint = endpoint;
+ _adapter = adapter;
+ final InitializationData initData = instance.initializationData();
+ // Cached for better performance.
+ _dispatcher = initData.dispatcher != null;
+ _logger = initData.logger; // Cached for better performance.
+ _traceLevels = instance.traceLevels(); // Cached for better performance.
+ _timer = instance.timer();
+ _writeTimeout = new TimeoutCallback();
+ _writeTimeoutFuture = null;
+ _readTimeout = new TimeoutCallback();
+ _readTimeoutFuture = null;
+ _warn = initData.properties.getPropertyAsInt("Ice.Warn.Connections") > 0;
+ _warnUdp = instance.initializationData().properties.getPropertyAsInt("Ice.Warn.Datagrams") > 0;
+ _cacheBuffers = instance.cacheMessageBuffers();
+ if(_monitor != null && _monitor.getACM().timeout > 0)
+ {
+ _acmLastActivity = Time.currentMonotonicTimeMillis();
+ }
+ else
+ {
+ _acmLastActivity = -1;
+ }
+ _nextRequestId = 1;
+ _messageSizeMax = adapter != null ? adapter.messageSizeMax() : instance.messageSizeMax();
+ _batchRequestQueue = new com.zeroc.IceInternal.BatchRequestQueue(instance, _endpoint.datagram());
+ _readStream = new InputStream(instance, Protocol.currentProtocolEncoding);
+ _readHeader = false;
+ _readStreamPos = -1;
+ _writeStream = new OutputStream(instance, Protocol.currentProtocolEncoding);
+ _writeStreamPos = -1;
+ _dispatchCount = 0;
+ _state = StateNotInitialized;
+
+ int compressionLevel = initData.properties.getPropertyAsIntWithDefault("Ice.Compression.Level", 1);
+ if(compressionLevel < 1)
+ {
+ compressionLevel = 1;
+ }
+ else if(compressionLevel > 9)
+ {
+ compressionLevel = 9;
+ }
+ _compressionLevel = compressionLevel;
+
+ if(adapter != null)
+ {
+ _servantManager = adapter.getServantManager();
+ }
+ else
+ {
+ _servantManager = null;
+ }
+
+ try
+ {
+ if(adapter != null)
+ {
+ _threadPool = adapter.getThreadPool();
+ }
+ else
+ {
+ _threadPool = _instance.clientThreadPool();
+ }
+ _threadPool.initialize(this);
+ }
+ catch(LocalException ex)
+ {
+ throw ex;
+ }
+ catch(java.lang.Exception ex)
+ {
+ throw new SyscallException(ex);
+ }
+ }
+
+ @Override
+ protected synchronized void finalize() throws Throwable
+ {
+ try
+ {
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_startCallback == null);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_state == StateFinished);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_dispatchCount == 0);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_sendStreams.isEmpty());
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_asyncRequests.isEmpty());
+ }
+ catch(java.lang.Exception ex)
+ {
+ }
+ finally
+ {
+ super.finalize();
+ }
+ }
+
+ private static final int StateNotInitialized = 0;
+ private static final int StateNotValidated = 1;
+ private static final int StateActive = 2;
+ private static final int StateHolding = 3;
+ private static final int StateClosing = 4;
+ private static final int StateClosingPending = 5;
+ private static final int StateClosed = 6;
+ private static final int StateFinished = 7;
+
+ private void setState(int state, LocalException ex)
+ {
+ //
+ // If setState() is called with an exception, then only closed
+ // and closing states are permissible.
+ //
+ assert state >= StateClosing;
+
+ if(_state == state) // Don't switch twice.
+ {
+ return;
+ }
+
+ if(_exception == null)
+ {
+ //
+ // If we are in closed state, an exception must be set.
+ //
+ assert (_state != StateClosed);
+
+ _exception = ex;
+
+ //
+ // We don't warn if we are not validated.
+ //
+ if(_warn && _validated)
+ {
+ //
+ // Don't warn about certain expected exceptions.
+ //
+ if(!(_exception instanceof CloseConnectionException ||
+ _exception instanceof ForcedCloseConnectionException ||
+ _exception instanceof ConnectionTimeoutException ||
+ _exception instanceof CommunicatorDestroyedException ||
+ _exception instanceof ObjectAdapterDeactivatedException ||
+ (_exception instanceof ConnectionLostException && _state >= StateClosing)))
+ {
+ warning("connection exception", _exception);
+ }
+ }
+ }
+
+ //
+ // We must set the new state before we notify requests of any
+ // exceptions. Otherwise new requests may retry on a
+ // connection that is not yet marked as closed or closing.
+ //
+ setState(state);
+ }
+
+ private void setState(int state)
+ {
+ //
+ // We don't want to send close connection messages if the endpoint
+ // only supports oneway transmission from client to server.
+ //
+ if(_endpoint.datagram() && state == StateClosing)
+ {
+ state = StateClosed;
+ }
+
+ //
+ // Skip graceful shutdown if we are destroyed before validation.
+ //
+ if(_state <= StateNotValidated && state == StateClosing)
+ {
+ state = StateClosed;
+ }
+
+ if(_state == state) // Don't switch twice.
+ {
+ return;
+ }
+
+ try
+ {
+ switch(state)
+ {
+ case StateNotInitialized:
+ {
+ assert (false);
+ break;
+ }
+
+ case StateNotValidated:
+ {
+ if(_state != StateNotInitialized)
+ {
+ assert (_state == StateClosed);
+ return;
+ }
+ break;
+ }
+
+ case StateActive:
+ {
+ //
+ // Can only switch from holding or not validated to
+ // active.
+ //
+ if(_state != StateHolding && _state != StateNotValidated)
+ {
+ return;
+ }
+ _threadPool.register(this, SocketOperation.Read);
+ break;
+ }
+
+ case StateHolding:
+ {
+ //
+ // Can only switch from active or not validated to
+ // holding.
+ //
+ if(_state != StateActive && _state != StateNotValidated)
+ {
+ return;
+ }
+ if(_state == StateActive)
+ {
+ _threadPool.unregister(this, SocketOperation.Read);
+ }
+ break;
+ }
+
+ case StateClosing:
+ case StateClosingPending:
+ {
+ //
+ // Can't change back from closing pending.
+ //
+ if(_state >= StateClosingPending)
+ {
+ return;
+ }
+ break;
+ }
+
+ case StateClosed:
+ {
+ if(_state == StateFinished)
+ {
+ return;
+ }
+
+ _batchRequestQueue.destroy(_exception);
+
+ //
+ // Don't need to close now for connections so only close the transceiver
+ // if the selector request it.
+ //
+ if(_threadPool.finish(this, false))
+ {
+ _transceiver.close();
+ }
+ break;
+ }
+
+ case StateFinished:
+ {
+ assert (_state == StateClosed);
+ _communicator = null;
+ break;
+ }
+ }
+ }
+ catch(LocalException ex)
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ ex.printStackTrace(pw);
+ pw.flush();
+ String s = "unexpected connection exception:\n " + _desc + "\n" + sw.toString();
+ _instance.initializationData().logger.error(s);
+ }
+
+ //
+ // We only register with the connection monitor if our new state
+ // is StateActive. Otherwise we unregister with the connection
+ // monitor, but only if we were registered before, i.e., if our
+ // old state was StateActive.
+ //
+ if(_monitor != null)
+ {
+ if(state == StateActive)
+ {
+ if(_acmLastActivity > 0)
+ {
+ _acmLastActivity = Time.currentMonotonicTimeMillis();
+ }
+ _monitor.add(this);
+ }
+ else if(_state == StateActive)
+ {
+ _monitor.remove(this);
+ }
+ }
+
+ if(_instance.initializationData().observer != null)
+ {
+ ConnectionState oldState = toConnectionState(_state);
+ ConnectionState newState = toConnectionState(state);
+ if(oldState != newState)
+ {
+ _observer = _instance.initializationData().observer.getConnectionObserver(initConnectionInfo(),
+ _endpoint,
+ newState,
+ _observer);
+ if(_observer != null)
+ {
+ _observer.attach();
+ }
+ else
+ {
+ _writeStreamPos = -1;
+ _readStreamPos = -1;
+ }
+ }
+ if(_observer != null && state == StateClosed && _exception != null)
+ {
+ if(!(_exception instanceof CloseConnectionException ||
+ _exception instanceof ForcedCloseConnectionException ||
+ _exception instanceof ConnectionTimeoutException ||
+ _exception instanceof CommunicatorDestroyedException ||
+ _exception instanceof ObjectAdapterDeactivatedException ||
+ (_exception instanceof ConnectionLostException && _state >= StateClosing)))
+ {
+ _observer.failed(_exception.ice_id());
+ }
+ }
+ }
+ _state = state;
+
+ notifyAll();
+
+ if(_state == StateClosing && _dispatchCount == 0)
+ {
+ try
+ {
+ initiateShutdown();
+ }
+ catch(LocalException ex)
+ {
+ setState(StateClosed, ex);
+ }
+ }
+ }
+
+ private void initiateShutdown()
+ {
+ assert (_state == StateClosing);
+ assert (_dispatchCount == 0);
+
+ if(_shutdownInitiated)
+ {
+ return;
+ }
+ _shutdownInitiated = true;
+
+ if(!_endpoint.datagram())
+ {
+ //
+ // Before we shut down, we send a close connection message.
+ //
+ OutputStream os = new OutputStream(_instance, Protocol.currentProtocolEncoding);
+ os.writeBlob(Protocol.magic);
+ Protocol.currentProtocol.ice_write(os);
+ Protocol.currentProtocolEncoding.ice_write(os);
+ os.writeByte(Protocol.closeConnectionMsg);
+ os.writeByte((byte) 0); // compression status: always report 0 for
+ // CloseConnection in Java.
+ os.writeInt(Protocol.headerSize); // Message size.
+
+ if((sendMessage(new OutgoingMessage(os, false, false)) & AsyncStatus.Sent) > 0)
+ {
+ setState(StateClosingPending);
+
+ //
+ // Notify the the transceiver of the graceful connection
+ // closure.
+ //
+ int op = _transceiver.closing(true, _exception);
+ if(op != 0)
+ {
+ scheduleTimeout(op);
+ _threadPool.register(this, op);
+ }
+ }
+ }
+ }
+
+ private void heartbeat()
+ {
+ assert (_state == StateActive);
+
+ if(!_endpoint.datagram())
+ {
+ OutputStream os = new OutputStream(_instance, Protocol.currentProtocolEncoding);
+ os.writeBlob(Protocol.magic);
+ Protocol.currentProtocol.ice_write(os);
+ Protocol.currentProtocolEncoding.ice_write(os);
+ os.writeByte(Protocol.validateConnectionMsg);
+ os.writeByte((byte) 0);
+ os.writeInt(Protocol.headerSize); // Message size.
+
+ try
+ {
+ OutgoingMessage message = new OutgoingMessage(os, false, false);
+ sendMessage(message);
+ }
+ catch(LocalException ex)
+ {
+ setState(StateClosed, ex);
+ assert (_exception != null);
+ }
+ }
+ }
+
+ private boolean initialize(int operation)
+ {
+ int s = _transceiver.initialize(_readStream.getBuffer(), _writeStream.getBuffer());
+ if(s != SocketOperation.None)
+ {
+ scheduleTimeout(s);
+ _threadPool.update(this, operation, s);
+ return false;
+ }
+
+ //
+ // Update the connection description once the transceiver is
+ // initialized.
+ //
+ _desc = _transceiver.toString();
+ _initialized = true;
+ setState(StateNotValidated);
+
+ return true;
+ }
+
+ private boolean validate(int operation)
+ {
+ if(!_endpoint.datagram()) // Datagram connections are always implicitly
+ // validated.
+ {
+ if(_adapter != null) // The server side has the active role for
+ // connection validation.
+ {
+ if(_writeStream.isEmpty())
+ {
+ _writeStream.writeBlob(Protocol.magic);
+ Protocol.currentProtocol.ice_write(_writeStream);
+ Protocol.currentProtocolEncoding.ice_write(_writeStream);
+ _writeStream.writeByte(Protocol.validateConnectionMsg);
+ _writeStream.writeByte((byte) 0); // Compression status
+ // (always zero for
+ // validate connection).
+ _writeStream.writeInt(Protocol.headerSize); // Message size.
+ TraceUtil.traceSend(_writeStream, _logger, _traceLevels);
+ _writeStream.prepareWrite();
+ }
+
+ if(_observer != null)
+ {
+ observerStartWrite(_writeStream.getBuffer());
+ }
+
+ if(_writeStream.pos() != _writeStream.size())
+ {
+ int op = write(_writeStream.getBuffer());
+ if(op != 0)
+ {
+ scheduleTimeout(op);
+ _threadPool.update(this, operation, op);
+ return false;
+ }
+ }
+
+ if(_observer != null)
+ {
+ observerFinishWrite(_writeStream.getBuffer());
+ }
+ }
+ else
+ // The client side has the passive role for connection validation.
+ {
+ if(_readStream.isEmpty())
+ {
+ _readStream.resize(Protocol.headerSize);
+ _readStream.pos(0);
+ }
+
+ if(_observer != null)
+ {
+ observerStartRead(_readStream.getBuffer());
+ }
+
+ if(_readStream.pos() != _readStream.size())
+ {
+ int op = read(_readStream.getBuffer());
+ if(op != 0)
+ {
+ scheduleTimeout(op);
+ _threadPool.update(this, operation, op);
+ return false;
+ }
+ }
+
+ if(_observer != null)
+ {
+ observerFinishRead(_readStream.getBuffer());
+ }
+
+ assert (_readStream.pos() == Protocol.headerSize);
+ _readStream.pos(0);
+ byte[] m = _readStream.readBlob(4);
+ if(m[0] != Protocol.magic[0] || m[1] != Protocol.magic[1] ||
+ m[2] != Protocol.magic[2] || m[3] != Protocol.magic[3])
+ {
+ BadMagicException ex = new BadMagicException();
+ ex.badMagic = m;
+ throw ex;
+ }
+
+ _readProtocol.ice_read(_readStream);
+ Protocol.checkSupportedProtocol(_readProtocol);
+
+ _readProtocolEncoding.ice_read(_readStream);
+ Protocol.checkSupportedProtocolEncoding(_readProtocolEncoding);
+
+ byte messageType = _readStream.readByte();
+ if(messageType != Protocol.validateConnectionMsg)
+ {
+ throw new ConnectionNotValidatedException();
+ }
+ _readStream.readByte(); // Ignore compression status for
+ // validate connection.
+ int size = _readStream.readInt();
+ if(size != Protocol.headerSize)
+ {
+ throw new IllegalMessageSizeException();
+ }
+ TraceUtil.traceRecv(_readStream, _logger, _traceLevels);
+
+ _validated = true;
+ }
+ }
+
+ _writeStream.resize(0);
+ _writeStream.pos(0);
+
+ _readStream.resize(Protocol.headerSize);
+ _readStream.pos(0);
+ _readHeader = true;
+
+ if(_instance.traceLevels().network >= 1)
+ {
+ StringBuffer s = new StringBuffer();
+ if(_endpoint.datagram())
+ {
+ s.append("starting to ");
+ s.append(_connector != null ? "send" : "receive");
+ s.append(" ");
+ s.append(_endpoint.protocol());
+ s.append(" messages\n");
+ s.append(_transceiver.toDetailedString());
+ }
+ else
+ {
+ s.append(_connector != null ? "established" : "accepted");
+ s.append(" ");
+ s.append(_endpoint.protocol());
+ s.append(" connection\n");
+ s.append(toString());
+ }
+ _instance.initializationData().logger.trace(_instance.traceLevels().networkCat, s.toString());
+ }
+
+ return true;
+ }
+
+ private int sendNextMessage(java.util.List<OutgoingMessage> callbacks)
+ {
+ if(_sendStreams.isEmpty())
+ {
+ return SocketOperation.None;
+ }
+ else if(_state == StateClosingPending && _writeStream.pos() == 0)
+ {
+ // Message wasn't sent, empty the _writeStream, we're not going to
+ // send more data.
+ OutgoingMessage message = _sendStreams.getFirst();
+ _writeStream.swap(message.stream);
+ return SocketOperation.None;
+ }
+
+ assert (!_writeStream.isEmpty() && _writeStream.pos() == _writeStream.size());
+ try
+ {
+ while(true)
+ {
+ //
+ // Notify the message that it was sent.
+ //
+ OutgoingMessage message = _sendStreams.getFirst();
+ _writeStream.swap(message.stream);
+ if(message.sent())
+ {
+ callbacks.add(message);
+ }
+ _sendStreams.removeFirst();
+
+ //
+ // If there's nothing left to send, we're done.
+ //
+ if(_sendStreams.isEmpty())
+ {
+ break;
+ }
+
+ //
+ // If we are in the closed state or if the close is
+ // pending, don't continue sending.
+ //
+ // This can occur if parseMessage (called before
+ // sendNextMessage by message()) closes the connection.
+ //
+ if(_state >= StateClosingPending)
+ {
+ return SocketOperation.None;
+ }
+
+ //
+ // Otherwise, prepare the next message stream for writing.
+ //
+ message = _sendStreams.getFirst();
+ assert (!message.prepared);
+ OutputStream stream = message.stream;
+
+ message.stream = doCompress(stream, message.compress);
+ message.stream.prepareWrite();
+ message.prepared = true;
+
+ if(message.outAsync != null)
+ {
+ TraceUtil.trace("sending asynchronous request", stream, _logger, _traceLevels);
+ }
+ else
+ {
+ TraceUtil.traceSend(stream, _logger, _traceLevels);
+ }
+ _writeStream.swap(message.stream);
+
+ //
+ // Send the message.
+ //
+ if(_observer != null)
+ {
+ observerStartWrite(_writeStream.getBuffer());
+ }
+ if(_writeStream.pos() != _writeStream.size())
+ {
+ int op = write(_writeStream.getBuffer());
+ if(op != 0)
+ {
+ return op;
+ }
+ }
+ if(_observer != null)
+ {
+ observerFinishWrite(_writeStream.getBuffer());
+ }
+ }
+
+ //
+ // If all the messages were sent and we are in the closing state, we
+ // schedule the close timeout to wait for the peer to close the
+ // connection.
+ //
+ if(_state == StateClosing && _shutdownInitiated)
+ {
+ setState(StateClosingPending);
+ int op = _transceiver.closing(true, _exception);
+ if(op != 0)
+ {
+ return op;
+ }
+ }
+ }
+ catch(LocalException ex)
+ {
+ setState(StateClosed, ex);
+ }
+ return SocketOperation.None;
+ }
+
+ private int sendMessage(OutgoingMessage message)
+ {
+ assert (_state < StateClosed);
+
+ if(!_sendStreams.isEmpty())
+ {
+ message.adopt();
+ _sendStreams.addLast(message);
+ return AsyncStatus.Queued;
+ }
+
+ //
+ // Attempt to send the message without blocking. If the send blocks, we
+ // register the connection with the selector thread.
+ //
+
+ assert (!message.prepared);
+
+ OutputStream stream = message.stream;
+
+ message.stream = doCompress(stream, message.compress);
+ message.stream.prepareWrite();
+ message.prepared = true;
+ int op;
+
+ if(message.outAsync != null)
+ {
+ TraceUtil.trace("sending asynchronous request", stream, _logger, _traceLevels);
+ }
+ else
+ {
+ TraceUtil.traceSend(stream, _logger, _traceLevels);
+ }
+
+ //
+ // Send the message without blocking.
+ //
+ if(_observer != null)
+ {
+ observerStartWrite(message.stream.getBuffer());
+ }
+ op = write(message.stream.getBuffer());
+ if(op == 0)
+ {
+ if(_observer != null)
+ {
+ observerFinishWrite(message.stream.getBuffer());
+ }
+
+ int status = AsyncStatus.Sent;
+ if(message.sent())
+ {
+ status |= AsyncStatus.InvokeSentCallback;
+ }
+
+ if(_acmLastActivity > 0)
+ {
+ _acmLastActivity = Time.currentMonotonicTimeMillis();
+ }
+ return status;
+ }
+
+ message.adopt();
+
+ _writeStream.swap(message.stream);
+ _sendStreams.addLast(message);
+ scheduleTimeout(op);
+ _threadPool.register(this, op);
+ return AsyncStatus.Queued;
+ }
+
+ private OutputStream doCompress(OutputStream uncompressed, boolean compress)
+ {
+ boolean compressionSupported = false;
+ if(compress)
+ {
+ //
+ // Don't check whether compression support is available unless the
+ // proxy is configured for compression.
+ //
+ compressionSupported = com.zeroc.IceInternal.BZip2.supported();
+ }
+
+ if(compressionSupported && uncompressed.size() >= 100)
+ {
+ //
+ // Do compression.
+ //
+ Buffer cbuf = com.zeroc.IceInternal.BZip2.compress(uncompressed.getBuffer(),
+ Protocol.headerSize, _compressionLevel);
+ if(cbuf != null)
+ {
+ OutputStream cstream =
+ new OutputStream(uncompressed.instance(), uncompressed.getEncoding(), cbuf, true);
+
+ //
+ // Set compression status.
+ //
+ cstream.pos(9);
+ cstream.writeByte((byte) 2);
+
+ //
+ // Write the size of the compressed stream into the header.
+ //
+ cstream.pos(10);
+ cstream.writeInt(cstream.size());
+
+ //
+ // Write the compression status and size of the compressed
+ // stream into the header of the uncompressed stream -- we need
+ // this to trace requests correctly.
+ //
+ uncompressed.pos(9);
+ uncompressed.writeByte((byte) 2);
+ uncompressed.writeInt(cstream.size());
+
+ return cstream;
+ }
+ }
+
+ uncompressed.pos(9);
+ uncompressed.writeByte((byte) (compressionSupported ? 1 : 0));
+
+ //
+ // Not compressed, fill in the message size.
+ //
+ uncompressed.pos(10);
+ uncompressed.writeInt(uncompressed.size());
+
+ return uncompressed;
+ }
+
+ private static class MessageInfo
+ {
+ MessageInfo(InputStream stream)
+ {
+ this.stream = stream;
+ }
+
+ InputStream stream;
+ int invokeNum;
+ int requestId;
+ byte compress;
+ com.zeroc.IceInternal.ServantManager servantManager;
+ ObjectAdapter adapter;
+ OutgoingAsyncBase outAsync;
+ HeartbeatCallback heartbeatCallback;
+ int messageDispatchCount;
+ }
+
+ private int parseMessage(MessageInfo info)
+ {
+ assert (_state > StateNotValidated && _state < StateClosed);
+
+ _readStream.swap(info.stream);
+ _readStream.resize(Protocol.headerSize);
+ _readStream.pos(0);
+ _readHeader = true;
+
+ assert (info.stream.pos() == info.stream.size());
+
+ //
+ // Connection is validated on first message. This is only used by
+ // setState() to check wether or not we can print a connection
+ // warning (a client might close the connection forcefully if the
+ // connection isn't validated).
+ //
+ _validated = true;
+
+ try
+ {
+ //
+ // We don't need to check magic and version here. This has already
+ // been done by the ThreadPool which provides us with the stream.
+ //
+ info.stream.pos(8);
+ byte messageType = info.stream.readByte();
+ info.compress = info.stream.readByte();
+ if(info.compress == (byte)2)
+ {
+ if(com.zeroc.IceInternal.BZip2.supported())
+ {
+ Buffer ubuf = com.zeroc.IceInternal.BZip2.uncompress(info.stream.getBuffer(),
+ Protocol.headerSize,
+ _messageSizeMax);
+ info.stream = new InputStream(info.stream.instance(), info.stream.getEncoding(), ubuf, true);
+ }
+ else
+ {
+ FeatureNotSupportedException ex = new FeatureNotSupportedException();
+ ex.unsupportedFeature = "Cannot uncompress compressed message: "
+ + "org.apache.tools.bzip2.CBZip2OutputStream was not found";
+ throw ex;
+ }
+ }
+ info.stream.pos(Protocol.headerSize);
+
+ switch(messageType)
+ {
+ case Protocol.closeConnectionMsg:
+ {
+ TraceUtil.traceRecv(info.stream, _logger, _traceLevels);
+ if(_endpoint.datagram())
+ {
+ if(_warn)
+ {
+ _logger.warning("ignoring close connection message for datagram connection:\n" + _desc);
+ }
+ }
+ else
+ {
+ setState(StateClosingPending, new CloseConnectionException());
+
+ //
+ // Notify the the transceiver of the graceful connection
+ // closure.
+ //
+ int op = _transceiver.closing(false, _exception);
+ if(op != 0)
+ {
+ return op;
+ }
+ setState(StateClosed);
+ }
+ break;
+ }
+
+ case Protocol.requestMsg:
+ {
+ if(_state >= StateClosing)
+ {
+ TraceUtil.trace("received request during closing\n"
+ + "(ignored by server, client will retry)", info.stream, _logger,
+ _traceLevels);
+ }
+ else
+ {
+ TraceUtil.traceRecv(info.stream, _logger, _traceLevels);
+ info.requestId = info.stream.readInt();
+ info.invokeNum = 1;
+ info.servantManager = _servantManager;
+ info.adapter = _adapter;
+ ++info.messageDispatchCount;
+ }
+ break;
+ }
+
+ case Protocol.requestBatchMsg:
+ {
+ if(_state >= StateClosing)
+ {
+ TraceUtil.trace("received batch request during closing\n"
+ + "(ignored by server, client will retry)", info.stream, _logger,
+ _traceLevels);
+ }
+ else
+ {
+ TraceUtil.traceRecv(info.stream, _logger, _traceLevels);
+ info.invokeNum = info.stream.readInt();
+ if(info.invokeNum < 0)
+ {
+ info.invokeNum = 0;
+ throw new UnmarshalOutOfBoundsException();
+ }
+ info.servantManager = _servantManager;
+ info.adapter = _adapter;
+ info.messageDispatchCount += info.invokeNum;
+ }
+ break;
+ }
+
+ case Protocol.replyMsg:
+ {
+ TraceUtil.traceRecv(info.stream, _logger, _traceLevels);
+ info.requestId = info.stream.readInt();
+
+ OutgoingAsyncBase outAsync = _asyncRequests.remove(info.requestId);
+ if(outAsync != null && outAsync.completed(info.stream))
+ {
+ info.outAsync = outAsync;
+ ++info.messageDispatchCount;
+ }
+ notifyAll(); // Notify threads blocked in close(false)
+ break;
+ }
+
+ case Protocol.validateConnectionMsg:
+ {
+ TraceUtil.traceRecv(info.stream, _logger, _traceLevels);
+ if(_heartbeatCallback != null)
+ {
+ info.heartbeatCallback = _heartbeatCallback;
+ ++info.messageDispatchCount;
+ }
+ break;
+ }
+
+ default:
+ {
+ TraceUtil.trace("received unknown message\n(invalid, closing connection)", info.stream,
+ _logger, _traceLevels);
+ throw new UnknownMessageException();
+ }
+ }
+ }
+ catch(LocalException ex)
+ {
+ if(_endpoint.datagram())
+ {
+ if(_warn)
+ {
+ _logger.warning("datagram connection exception:\n" + ex + '\n' + _desc);
+ }
+ }
+ else
+ {
+ setState(StateClosed, ex);
+ }
+ }
+
+ return _state == StateHolding ? SocketOperation.None : SocketOperation.Read;
+ }
+
+ private void invokeAll(InputStream stream, int invokeNum, int requestId, byte compress,
+ com.zeroc.IceInternal.ServantManager servantManager, ObjectAdapter adapter)
+ {
+ //
+ // Note: In contrast to other private or protected methods, this
+ // operation must be called *without* the mutex locked.
+ //
+
+ Incoming in = null;
+ try
+ {
+ while(invokeNum > 0)
+ {
+
+ //
+ // Prepare the invocation.
+ //
+ boolean response = !_endpoint.datagram() && requestId != 0;
+ in = getIncoming(adapter, response, compress, requestId);
+
+ //
+ // Dispatch the invocation.
+ //
+ in.invoke(servantManager, stream);
+
+ --invokeNum;
+
+ reclaimIncoming(in);
+ in = null;
+ }
+
+ stream.clear();
+ }
+ catch(LocalException ex)
+ {
+ invokeException(requestId, ex, invokeNum, false);
+ }
+ catch(com.zeroc.IceInternal.ServantError ex)
+ {
+ //
+ // ServantError is thrown when an Error has been raised by servant (or servant locator)
+ // code. We've already attempted to complete the invocation and send a response.
+ //
+ Throwable t = ex.getCause();
+ //
+ // Suppress AssertionError and OutOfMemoryError, rethrow everything else.
+ //
+ if(!(t instanceof java.lang.AssertionError || t instanceof java.lang.OutOfMemoryError))
+ {
+ throw (java.lang.Error)t;
+ }
+ }
+ catch(java.lang.Error ex)
+ {
+ //
+ // An Error was raised outside of servant code (i.e., by Ice code).
+ // Attempt to log the error and clean up. This may still fail
+ // depending on the severity of the error.
+ //
+ // Note that this does NOT send a response to the client.
+ //
+ UnknownException uex = new UnknownException(ex);
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ ex.printStackTrace(pw);
+ pw.flush();
+ uex.unknown = sw.toString();
+ _logger.error(uex.unknown);
+ invokeException(requestId, uex, invokeNum, false);
+ //
+ // Suppress AssertionError and OutOfMemoryError, rethrow everything else.
+ //
+ if(!(ex instanceof java.lang.AssertionError || ex instanceof java.lang.OutOfMemoryError))
+ {
+ throw ex;
+ }
+ }
+ finally
+ {
+ if(in != null)
+ {
+ reclaimIncoming(in);
+ }
+ }
+ }
+
+ private void scheduleTimeout(int status)
+ {
+ int timeout;
+ if(_state < StateActive)
+ {
+ com.zeroc.IceInternal.DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
+ if(defaultsAndOverrides.overrideConnectTimeout)
+ {
+ timeout = defaultsAndOverrides.overrideConnectTimeoutValue;
+ }
+ else
+ {
+ timeout = _endpoint.timeout();
+ }
+ }
+ else if(_state < StateClosingPending)
+ {
+ if(_readHeader) // No timeout for reading the header.
+ {
+ status &= ~SocketOperation.Read;
+ }
+ timeout = _endpoint.timeout();
+ }
+ else
+ {
+ com.zeroc.IceInternal.DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
+ if(defaultsAndOverrides.overrideCloseTimeout)
+ {
+ timeout = defaultsAndOverrides.overrideCloseTimeoutValue;
+ }
+ else
+ {
+ timeout = _endpoint.timeout();
+ }
+ }
+
+ if(timeout < 0)
+ {
+ return;
+ }
+
+ try
+ {
+ if((status & SocketOperation.Read) != 0)
+ {
+ if(_readTimeoutFuture != null)
+ {
+ _readTimeoutFuture.cancel(false);
+ }
+ _readTimeoutFuture = _timer.schedule(_readTimeout, timeout, java.util.concurrent.TimeUnit.MILLISECONDS);
+ }
+ if((status & (SocketOperation.Write | SocketOperation.Connect)) != 0)
+ {
+ if(_writeTimeoutFuture != null)
+ {
+ _writeTimeoutFuture.cancel(false);
+ }
+ _writeTimeoutFuture = _timer.schedule(_writeTimeout, timeout,
+ java.util.concurrent.TimeUnit.MILLISECONDS);
+ }
+ }
+ catch(Throwable ex)
+ {
+ assert (false);
+ }
+ }
+
+ private void unscheduleTimeout(int status)
+ {
+ if((status & SocketOperation.Read) != 0 && _readTimeoutFuture != null)
+ {
+ _readTimeoutFuture.cancel(false);
+ _readTimeoutFuture = null;
+ }
+ if((status & (SocketOperation.Write | SocketOperation.Connect)) != 0 &&
+ _writeTimeoutFuture != null)
+ {
+ _writeTimeoutFuture.cancel(false);
+ _writeTimeoutFuture = null;
+ }
+ }
+
+ private ConnectionInfo initConnectionInfo()
+ {
+ if(_state > StateNotInitialized && _info != null) // Update the connection information until it's initialized
+ {
+ return _info;
+ }
+
+ try
+ {
+ _info = _transceiver.getInfo();
+ }
+ catch(LocalException ex)
+ {
+ _info = new ConnectionInfo();
+ }
+ for(ConnectionInfo info = _info; info != null; info = info.underlying)
+ {
+ info.connectionId = _endpoint.connectionId();
+ info.adapterName = _adapter != null ? _adapter.getName() : "";
+ info.incoming = _connector == null;
+ }
+ return _info;
+ }
+
+ private ConnectionState toConnectionState(int state)
+ {
+ return connectionStateMap[state];
+ }
+
+ private void warning(String msg, java.lang.Exception ex)
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ ex.printStackTrace(pw);
+ pw.flush();
+ String s = msg + ":\n" + _desc + "\n" + sw.toString();
+ _logger.warning(s);
+ }
+
+ private void observerStartRead(Buffer buf)
+ {
+ if(_readStreamPos >= 0)
+ {
+ assert (!buf.empty());
+ _observer.receivedBytes(buf.b.position() - _readStreamPos);
+ }
+ _readStreamPos = buf.empty() ? -1 : buf.b.position();
+ }
+
+ private void observerFinishRead(Buffer buf)
+ {
+ if(_readStreamPos == -1)
+ {
+ return;
+ }
+ assert (buf.b.position() >= _readStreamPos);
+ _observer.receivedBytes(buf.b.position() - _readStreamPos);
+ _readStreamPos = -1;
+ }
+
+ private void observerStartWrite(Buffer buf)
+ {
+ if(_writeStreamPos >= 0)
+ {
+ assert (!buf.empty());
+ _observer.sentBytes(buf.b.position() - _writeStreamPos);
+ }
+ _writeStreamPos = buf.empty() ? -1 : buf.b.position();
+ }
+
+ private void observerFinishWrite(Buffer buf)
+ {
+ if(_writeStreamPos == -1)
+ {
+ return;
+ }
+ if(buf.b.position() > _writeStreamPos)
+ {
+ _observer.sentBytes(buf.b.position() - _writeStreamPos);
+ }
+ _writeStreamPos = -1;
+ }
+
+ private Incoming getIncoming(ObjectAdapter adapter, boolean response, byte compress,
+ int requestId)
+ {
+ Incoming in = null;
+
+ if(_cacheBuffers > 0)
+ {
+ synchronized(_incomingCacheMutex)
+ {
+ if(_incomingCache == null)
+ {
+ in = new Incoming(_instance, this, this, adapter, response, compress, requestId);
+ }
+ else
+ {
+ in = _incomingCache;
+ _incomingCache = _incomingCache.next;
+ in.reset(_instance, this, this, adapter, response, compress, requestId);
+ in.next = null;
+ }
+ }
+ }
+ else
+ {
+ in = new Incoming(_instance, this, this, adapter, response, compress, requestId);
+ }
+
+ return in;
+ }
+
+ private void reclaimIncoming(Incoming in)
+ {
+ if(_cacheBuffers > 0 && in.reclaim())
+ {
+ synchronized(_incomingCacheMutex)
+ {
+ in.next = _incomingCache;
+ _incomingCache = in;
+ }
+ }
+ }
+
+ private void reap()
+ {
+ if(_monitor != null)
+ {
+ _monitor.reap(this);
+ }
+ if(_observer != null)
+ {
+ _observer.detach();
+ }
+ }
+
+ private int read(Buffer buf)
+ {
+ int start = buf.b.position();
+ int op = _transceiver.read(buf);
+ if(_instance.traceLevels().network >= 3 && buf.b.position() != start)
+ {
+ StringBuffer s = new StringBuffer("received ");
+ if(_endpoint.datagram())
+ {
+ s.append(buf.b.limit());
+ }
+ else
+ {
+ s.append(buf.b.position() - start);
+ s.append(" of ");
+ s.append(buf.b.limit() - start);
+ }
+ s.append(" bytes via ");
+ s.append(_endpoint.protocol());
+ s.append("\n");
+ s.append(toString());
+
+ _instance.initializationData().logger.trace(_instance.traceLevels().networkCat, s.toString());
+ }
+ return op;
+ }
+
+ private int write(Buffer buf)
+ {
+ int start = buf.b.position();
+ int op = _transceiver.write(buf);
+ if(_instance.traceLevels().network >= 3 && buf.b.position() != start)
+ {
+ StringBuffer s = new StringBuffer("sent ");
+ s.append(buf.b.position() - start);
+ if(!_endpoint.datagram())
+ {
+ s.append(" of ");
+ s.append(buf.b.limit() - start);
+ }
+ s.append(" bytes via ");
+ s.append(_endpoint.protocol());
+ s.append("\n");
+ s.append(toString());
+ _instance.initializationData().logger.trace(_instance.traceLevels().networkCat, s.toString());
+ }
+ return op;
+ }
+
+ private static class OutgoingMessage
+ {
+ OutgoingMessage(OutputStream stream, boolean compress, boolean adopt)
+ {
+ this.stream = stream;
+ this.compress = compress;
+ this.adopt = adopt;
+ this.requestId = 0;
+ }
+
+ OutgoingMessage(OutgoingAsyncBase out, OutputStream stream, boolean compress,
+ int requestId)
+ {
+ this.stream = stream;
+ this.compress = compress;
+ this.outAsync = out;
+ this.requestId = requestId;
+ }
+
+ public void canceled()
+ {
+ assert (outAsync != null);
+ outAsync = null;
+ }
+
+ public void adopt()
+ {
+ if(adopt)
+ {
+ OutputStream stream = new OutputStream(this.stream.instance(), Protocol.currentProtocolEncoding);
+ stream.swap(this.stream);
+ this.stream = stream;
+ adopt = false;
+ }
+ }
+
+ public boolean sent()
+ {
+ if(outAsync != null)
+ {
+ return outAsync.sent();
+ }
+ return false;
+ }
+
+ public void completed(LocalException ex)
+ {
+ if(outAsync != null && outAsync.completed(ex))
+ {
+ outAsync.invokeCompleted();
+ }
+ }
+
+ public OutputStream stream;
+ public OutgoingAsyncBase outAsync;
+ public boolean compress;
+ public int requestId;
+ boolean adopt;
+ boolean prepared;
+ }
+
+ private Communicator _communicator;
+ private final com.zeroc.IceInternal.Instance _instance;
+ private com.zeroc.IceInternal.ACMMonitor _monitor;
+ private final com.zeroc.IceInternal.Transceiver _transceiver;
+ private String _desc;
+ private final String _type;
+ private final com.zeroc.IceInternal.Connector _connector;
+ private final com.zeroc.IceInternal.EndpointI _endpoint;
+
+ private ObjectAdapter _adapter;
+ private com.zeroc.IceInternal.ServantManager _servantManager;
+
+ private final boolean _dispatcher;
+ private final Logger _logger;
+ private final com.zeroc.IceInternal.TraceLevels _traceLevels;
+ private final com.zeroc.IceInternal.ThreadPool _threadPool;
+
+ private final java.util.concurrent.ScheduledExecutorService _timer;
+ private final Runnable _writeTimeout;
+ private java.util.concurrent.Future<?> _writeTimeoutFuture;
+ private final Runnable _readTimeout;
+ private java.util.concurrent.Future<?> _readTimeoutFuture;
+
+ private StartCallback _startCallback = null;
+
+ private final boolean _warn;
+ private final boolean _warnUdp;
+
+ private long _acmLastActivity;
+
+ private final int _compressionLevel;
+
+ private int _nextRequestId;
+
+ private java.util.Map<Integer, OutgoingAsyncBase> _asyncRequests = new java.util.HashMap<>();
+
+ private LocalException _exception;
+
+ private final int _messageSizeMax;
+ private com.zeroc.IceInternal.BatchRequestQueue _batchRequestQueue;
+
+ private java.util.LinkedList<OutgoingMessage> _sendStreams = new java.util.LinkedList<>();
+
+ private InputStream _readStream;
+ private boolean _readHeader;
+ private OutputStream _writeStream;
+
+ private com.zeroc.Ice.Instrumentation.ConnectionObserver _observer;
+ private int _readStreamPos;
+ private int _writeStreamPos;
+
+ private int _dispatchCount;
+
+ private int _state; // The current state.
+ private boolean _shutdownInitiated = false;
+ private boolean _initialized = false;
+ private boolean _validated = false;
+
+ private Incoming _incomingCache;
+ private final java.lang.Object _incomingCacheMutex = new java.lang.Object();
+
+ private ProtocolVersion _readProtocol = new ProtocolVersion();
+ private EncodingVersion _readProtocolEncoding = new EncodingVersion();
+
+ private int _cacheBuffers;
+
+ private ConnectionInfo _info;
+
+ private CloseCallback _closeCallback;
+ private HeartbeatCallback _heartbeatCallback;
+
+ private static ConnectionState connectionStateMap[] =
+ {
+ ConnectionState.ConnectionStateValidating, // StateNotInitialized
+ ConnectionState.ConnectionStateValidating, // StateNotValidated
+ ConnectionState.ConnectionStateActive, // StateActive
+ ConnectionState.ConnectionStateHolding, // StateHolding
+ ConnectionState.ConnectionStateClosing, // StateClosing
+ ConnectionState.ConnectionStateClosing, // StateClosingPending
+ ConnectionState.ConnectionStateClosed, // StateClosed
+ ConnectionState.ConnectionStateClosed, // StateFinished
+ };
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/DispatchInterceptor.java b/java/src/Ice/src/main/java/com/zeroc/Ice/DispatchInterceptor.java
new file mode 100644
index 00000000000..7a753abd81b
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/DispatchInterceptor.java
@@ -0,0 +1,43 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+import java.util.concurrent.CompletionStage;
+
+/**
+ * Base class that allows a server to intercept incoming requests.
+ * The application must derive a concrete class from <code>DispatchInterceptor</code>
+ * that implements the {@link DispatchInterceptor#dispatch} operation. An instance of this derived
+ * class can be registered with an object adapter like any other servant.
+ * <p>
+ * A dispatch interceptor is useful particularly to automatically retry requests
+ * that have failed due to a recoverable error condition.
+ **/
+public abstract class DispatchInterceptor implements com.zeroc.Ice.Object
+{
+ /**
+ * Called by the Ice run time to dispatch an incoming request. The implementation
+ * of <code>dispatch</code> must dispatch the request to the actual servant.
+ *
+ * @param request The details of the incoming request.
+ * @return A completion stage if dispatched asynchronously, null otherwise.
+ *
+ * @see Request
+ **/
+ public abstract CompletionStage<OutputStream> dispatch(Request request)
+ throws UserException;
+
+ @Override
+ public CompletionStage<OutputStream> __dispatch(com.zeroc.IceInternal.Incoming in, Current current)
+ throws UserException
+ {
+ return dispatch(in);
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/Dispatcher.java b/java/src/Ice/src/main/java/com/zeroc/Ice/Dispatcher.java
new file mode 100644
index 00000000000..9fd63168693
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/Dispatcher.java
@@ -0,0 +1,34 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * You can control which thread receives operation invocations and AMI
+ * callbacks by implementing the <code>Dispatcher</code> interface and
+ * supplying an instance in <code>InitializationData</code> when
+ * initializing a communicator.
+ * <p>
+ * For example, you can use this dispatching facility to ensure that
+ * all invocations and callbacks are dispatched in a GUI event loop
+ * thread so that it is safe to invoke directly on GUI objects.
+ **/
+public interface Dispatcher
+{
+ /**
+ * Responsible for dispatching an invocation or AMI callback.
+ * The method must eventually invoke <code>run</code> on the
+ * supplied <code>Runnable</code> object.
+ *
+ * @param runnable The object encapsulating the invocation or
+ * callback to be dispatched.
+ * @param con The connection associated with the dispatch.
+ **/
+ void dispatch(Runnable runnable, Connection con);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/Exception.java b/java/src/Ice/src/main/java/com/zeroc/Ice/Exception.java
new file mode 100644
index 00000000000..a35d23777b8
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/Exception.java
@@ -0,0 +1,91 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * Base class for Ice local and system exceptions. Those exceptions
+ * are not checked so we inherit from java.lang.RuntimeException. User
+ * exceptions are checked exceptions and therefore inherit directly
+ * from java.lang.Exception.
+ **/
+public abstract class Exception extends RuntimeException implements Cloneable
+{
+ public Exception()
+ {
+ }
+
+ public Exception(Throwable cause)
+ {
+ super(cause);
+ }
+
+ /**
+ * Creates a copy of this exception.
+ *
+ * @return The copy of this exception.
+ **/
+ @Override
+ public Exception clone()
+ {
+ Exception c = null;
+
+ try
+ {
+ c = (Exception)super.clone();
+ }
+ catch(CloneNotSupportedException ex)
+ {
+ assert false;
+ }
+ return c;
+ }
+
+ /**
+ * Returns the name of this exception.
+ *
+ * @return The name of this exception.
+ *
+ * @deprecated ice_name() is deprecated, use ice_id() instead.
+ **/
+ @Deprecated
+ public String
+ ice_name()
+ {
+ return ice_id().substring(2);
+ }
+
+ /**
+ * Returns the type id of this exception.
+ *
+ * @return The type id of this exception.
+ **/
+ public abstract String
+ ice_id();
+
+ /**
+ * Returns a string representation of this exception.
+ *
+ * @return A string representation of this exception.
+ **/
+ @Override
+ public String
+ toString()
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ com.zeroc.IceUtilInternal.OutputBase out = new com.zeroc.IceUtilInternal.OutputBase(pw);
+ out.setUseTab(false);
+ out.print(getClass().getName());
+ out.inc();
+ com.zeroc.IceInternal.ValueWriter.write(this, out);
+ pw.flush();
+ return sw.toString();
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/FormatType.java b/java/src/Ice/src/main/java/com/zeroc/Ice/FormatType.java
new file mode 100644
index 00000000000..ad47bcc6d8e
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/FormatType.java
@@ -0,0 +1,29 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * This enumeration describes the possible formats for classes and exceptions.
+ **/
+public enum FormatType
+{
+ /**
+ * Indicates that no preference was specified.
+ **/
+ DefaultFormat,
+ /**
+ * A minimal format that eliminates the possibility for slicing unrecognized types.
+ **/
+ CompactFormat,
+ /**
+ * Allow slicing and preserve slices for unknown types.
+ **/
+ SlicedFormat
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/ImplicitContextI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ImplicitContextI.java
new file mode 100644
index 00000000000..626bbfe3fc2
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ImplicitContextI.java
@@ -0,0 +1,318 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+//
+// The base class for all ImplicitContext implementations
+//
+public abstract class ImplicitContextI implements ImplicitContext
+{
+ public static ImplicitContextI create(String kind)
+ {
+ if(kind.equals("None") || kind.equals(""))
+ {
+ return null;
+ }
+ else if(kind.equals("Shared"))
+ {
+ return new Shared();
+ }
+ else if(kind.equals("PerThread"))
+ {
+ return new PerThread();
+ }
+ else
+ {
+ throw new InitializationException(
+ "'" + kind + "' is not a valid value for ImplicitContext");
+ }
+ }
+
+ abstract public void write(java.util.Map<String, String> prxContext, OutputStream os);
+ abstract java.util.Map<String, String> combine(java.util.Map<String, String> prxContext);
+
+ static class Shared extends ImplicitContextI
+ {
+ @Override
+ public synchronized java.util.Map<String, String> getContext()
+ {
+ return new java.util.HashMap<>(_context);
+ }
+
+ @Override
+ public synchronized void setContext(java.util.Map<String, String> context)
+ {
+ _context.clear();
+ if(context != null && !context.isEmpty())
+ {
+ _context.putAll(context);
+ }
+ }
+
+ @Override
+ public synchronized boolean containsKey(String key)
+ {
+ if(key == null)
+ {
+ key = "";
+ }
+
+ return _context.containsKey(key);
+ }
+
+ @Override
+ public synchronized String get(String key)
+ {
+ if(key == null)
+ {
+ key = "";
+ }
+
+ String val = _context.get(key);
+ if(val == null)
+ {
+ val = "";
+ }
+
+ return val;
+ }
+
+ @Override
+ public synchronized String put(String key, String value)
+ {
+ if(key == null)
+ {
+ key = "";
+ }
+ if(value == null)
+ {
+ value = "";
+ }
+
+ String oldVal = _context.put(key, value);
+ if(oldVal == null)
+ {
+ oldVal = "";
+ }
+ return oldVal;
+ }
+
+ @Override
+ public synchronized String remove(String key)
+ {
+ if(key == null)
+ {
+ key = "";
+ }
+
+ String val = _context.remove(key);
+
+ if(val == null)
+ {
+ val = "";
+ }
+ return val;
+ }
+
+ @Override
+ public void write(java.util.Map<String, String> prxContext, OutputStream os)
+ {
+ if(prxContext.isEmpty())
+ {
+ synchronized(this)
+ {
+ ContextHelper.write(os, _context);
+ }
+ }
+ else
+ {
+ java.util.Map<String, String> ctx = null;
+ synchronized(this)
+ {
+ ctx = _context.isEmpty() ? prxContext : combine(prxContext);
+ }
+ ContextHelper.write(os, ctx);
+ }
+ }
+
+ @Override
+ synchronized java.util.Map<String, String> combine(java.util.Map<String, String> prxContext)
+ {
+ java.util.Map<String, String> combined = new java.util.HashMap<>(_context);
+ combined.putAll(prxContext);
+ return combined;
+ }
+
+ private java.util.Map<String, String> _context = new java.util.HashMap<>();
+ }
+
+ static class PerThread extends ImplicitContextI
+ {
+
+ @Override
+ public java.util.Map<String, String> getContext()
+ {
+ //
+ // Note that _map is a *synchronized* map
+ //
+ java.util.Map<String, String> threadContext = _map.get(Thread.currentThread());
+
+ if(threadContext == null)
+ {
+ threadContext = new java.util.HashMap<>();
+ }
+ return threadContext;
+ }
+
+ @Override
+ public void setContext(java.util.Map<String, String> context)
+ {
+ if(context == null || context.isEmpty())
+ {
+ _map.remove(Thread.currentThread());
+ }
+ else
+ {
+ java.util.Map<String, String> threadContext = new java.util.HashMap<>(context);
+ _map.put(Thread.currentThread(), threadContext);
+ }
+ }
+
+ @Override
+ public boolean containsKey(String key)
+ {
+ if(key == null)
+ {
+ key = "";
+ }
+
+ java.util.Map<String, String> threadContext = _map.get(Thread.currentThread());
+
+ if(threadContext == null)
+ {
+ return false;
+ }
+
+ return threadContext.containsKey(key);
+ }
+
+ @Override
+ public String get(String key)
+ {
+ if(key == null)
+ {
+ key = "";
+ }
+
+ java.util.Map<String, String> threadContext = _map.get(Thread.currentThread());
+
+ if(threadContext == null)
+ {
+ return "";
+ }
+ String val = threadContext.get(key);
+ if(val == null)
+ {
+ val = "";
+ }
+ return val;
+ }
+
+ @Override
+ public String put(String key, String value)
+ {
+ if(key == null)
+ {
+ key = "";
+ }
+ if(value == null)
+ {
+ value = "";
+ }
+
+ Thread currentThread = Thread.currentThread();
+ java.util.Map<String, String> threadContext = _map.get(currentThread);
+
+ if(threadContext == null)
+ {
+ threadContext = new java.util.HashMap<>();
+ _map.put(currentThread, threadContext);
+ }
+
+ String oldVal = threadContext.put(key, value);
+ if(oldVal == null)
+ {
+ oldVal = "";
+ }
+ return oldVal;
+ }
+
+ @Override
+ public String remove(String key)
+ {
+ if(key == null)
+ {
+ key = "";
+ }
+
+ java.util.Map<String, String> threadContext = _map.get(Thread.currentThread());
+
+ if(threadContext == null)
+ {
+ return null;
+ }
+
+ String val = threadContext.remove(key);
+
+ if(val == null)
+ {
+ val = "";
+ }
+ return val;
+ }
+
+ @Override
+ public void write(java.util.Map<String, String> prxContext, OutputStream os)
+ {
+ java.util.Map<String, String> threadContext = _map.get(Thread.currentThread());
+
+ if(threadContext == null || threadContext.isEmpty())
+ {
+ ContextHelper.write(os, prxContext);
+ }
+ else if(prxContext.isEmpty())
+ {
+ ContextHelper.write(os, threadContext);
+ }
+ else
+ {
+ java.util.Map<String, String> combined = new java.util.HashMap<>(threadContext);
+ combined.putAll(prxContext);
+ ContextHelper.write(os, combined);
+ }
+ }
+
+ @Override
+ java.util.Map<String, String> combine(java.util.Map<String, String> prxContext)
+ {
+ java.util.Map<String, String> threadContext = _map.get(Thread.currentThread());
+
+ java.util.Map<String, String> combined = new java.util.HashMap<>(threadContext);
+ combined.putAll(prxContext);
+ return combined;
+ }
+
+ //
+ // Synchronized map Thread -> Context
+ //
+ private java.util.Map<Thread, java.util.Map<String, String> > _map =
+ java.util.Collections.synchronizedMap(new java.util.HashMap<>());
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/InitializationData.java b/java/src/Ice/src/main/java/com/zeroc/Ice/InitializationData.java
new file mode 100644
index 00000000000..61394af201c
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/InitializationData.java
@@ -0,0 +1,96 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * A class that encapsulates data to initialize a communicator.
+ *
+ * @see Util#initialize
+ * @see Properties
+ * @see Logger
+ * @see ThreadNotification
+ **/
+public final class InitializationData implements Cloneable
+{
+ /**
+ * Creates an instance with all members set to <code>null</code>.
+ **/
+ public
+ InitializationData()
+ {
+ }
+
+ /**
+ * Creates and returns a copy of this object.
+ **/
+ @Override
+ public InitializationData
+ clone()
+ {
+ //
+ // A member-wise copy is safe because the members are immutable.
+ //
+ InitializationData c = null;
+ try
+ {
+ c = (InitializationData)super.clone();
+ }
+ catch(CloneNotSupportedException ex)
+ {
+ assert false;
+ }
+ return c;
+ }
+
+ /**
+ * The properties for the communicator.
+ **/
+ public Properties properties;
+
+ /**
+ * The logger for the communicator.
+ **/
+ public Logger logger;
+
+ /**
+ * The communicator observer used by the Ice run-time.
+ **/
+ public com.zeroc.Ice.Instrumentation.CommunicatorObserver observer;
+
+ /**
+ * The thread hook for the communicator.
+ **/
+ public ThreadNotification threadHook;
+
+ /**
+ * The custom class loader for the communicator.
+ **/
+ public ClassLoader classLoader;
+
+ /**
+ * The call dispatcher for the communicator.
+ **/
+ public Dispatcher dispatcher;
+
+ /**
+ * The compact type ID resolver.
+ **/
+ public CompactIdResolver compactIdResolver;
+
+ /**
+ * The batch request interceptor.
+ **/
+ public BatchRequestInterceptor batchRequestInterceptor;
+
+ /**
+ * The value factory manager.
+ **/
+ public ValueFactoryManager valueFactoryManager;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/InputStream.java b/java/src/Ice/src/main/java/com/zeroc/Ice/InputStream.java
new file mode 100644
index 00000000000..197831372cc
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/InputStream.java
@@ -0,0 +1,3436 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+import java.io.IOException;
+
+import com.zeroc.IceInternal.Buffer;
+import com.zeroc.IceInternal.Instance;
+import com.zeroc.IceInternal.Protocol;
+import com.zeroc.IceInternal.SequencePatcher;
+
+/**
+ * Interface for input streams used to extract Slice types from a sequence
+ * of bytes.
+ *
+ * @see OutputStream
+ **/
+public class InputStream
+{
+ /**
+ * Constructing an InputStream without providing a communicator means the stream will
+ * use the default encoding version. A communicator is required in order to unmarshal
+ * proxies. You can supply a communicator later by calling initialize().
+ **/
+ public InputStream()
+ {
+ initialize(Protocol.currentEncoding);
+ _buf = new Buffer(false);
+ }
+
+ /**
+ * Constructing an InputStream without providing a communicator means the stream will
+ * use the default encoding version. A communicator is required in order to unmarshal
+ * proxies. You can supply a communicator later by calling initialize().
+ *
+ * @param data The byte array containing encoded Slice types.
+ **/
+ public InputStream(byte[] data)
+ {
+ initialize(Protocol.currentEncoding);
+ _buf = new Buffer(data);
+ }
+
+ /**
+ * Constructing an InputStream without providing a communicator means the stream will
+ * use the default encoding version. A communicator is required in order to unmarshal
+ * proxies. You can supply a communicator later by calling initialize().
+ *
+ * @param buf The byte buffer containing encoded Slice types.
+ **/
+ public InputStream(java.nio.ByteBuffer buf)
+ {
+ initialize(Protocol.currentEncoding);
+ _buf = new Buffer(buf);
+ }
+
+ public InputStream(Buffer buf)
+ {
+ this(buf, false);
+ }
+
+ public InputStream(Buffer buf, boolean adopt)
+ {
+ initialize(Protocol.currentEncoding);
+ _buf = new Buffer(buf, adopt);
+ }
+
+ /**
+ * This constructor uses the communicator's default encoding version.
+ *
+ * @param communicator The communicator to use when initializing the stream.
+ **/
+ public InputStream(Communicator communicator)
+ {
+ Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator);
+ initialize(instance, instance.defaultsAndOverrides().defaultEncoding);
+ _buf = new Buffer(instance.cacheMessageBuffers() > 1);
+ }
+
+ /**
+ * This constructor uses the communicator's default encoding version.
+ *
+ * @param communicator The communicator to use when initializing the stream.
+ * @param data The byte array containing encoded Slice types.
+ **/
+ public InputStream(Communicator communicator, byte[] data)
+ {
+ initialize(communicator);
+ _buf = new Buffer(data);
+ }
+
+ /**
+ * This constructor uses the communicator's default encoding version.
+ *
+ * @param communicator The communicator to use when initializing the stream.
+ * @param buf The byte buffer containing encoded Slice types.
+ **/
+ public InputStream(Communicator communicator, java.nio.ByteBuffer buf)
+ {
+ initialize(communicator);
+ _buf = new Buffer(buf);
+ }
+
+ public InputStream(Communicator communicator, Buffer buf)
+ {
+ this(communicator, buf, false);
+ }
+
+ public InputStream(Communicator communicator, Buffer buf, boolean adopt)
+ {
+ initialize(communicator);
+ _buf = new Buffer(buf, adopt);
+ }
+
+ /**
+ * This constructor uses the given encoding version.
+ **/
+ public InputStream(EncodingVersion encoding)
+ {
+ initialize(encoding);
+ _buf = new Buffer(false);
+ }
+
+ /**
+ * This constructor uses the given encoding version.
+ *
+ * @param data The byte array containing encoded Slice types.
+ **/
+ public InputStream(EncodingVersion encoding, byte[] data)
+ {
+ initialize(encoding);
+ _buf = new Buffer(data);
+ }
+
+ /**
+ * This constructor uses the given encoding version.
+ *
+ * @param buf The byte buffer containing encoded Slice types.
+ **/
+ public InputStream(EncodingVersion encoding, java.nio.ByteBuffer buf)
+ {
+ initialize(encoding);
+ _buf = new Buffer(buf);
+ }
+
+ public InputStream(EncodingVersion encoding, Buffer buf)
+ {
+ this(encoding, buf, false);
+ }
+
+ public InputStream(EncodingVersion encoding, Buffer buf, boolean adopt)
+ {
+ initialize(encoding);
+ _buf = new Buffer(buf, adopt);
+ }
+
+ /**
+ * This constructor uses the given communicator and encoding version.
+ *
+ * @param communicator The communicator to use when initializing the stream.
+ * @param encoding The desired encoding version.
+ **/
+ public InputStream(Communicator communicator, EncodingVersion encoding)
+ {
+ Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator);
+ initialize(instance, encoding);
+ _buf = new Buffer(instance.cacheMessageBuffers() > 1);
+ }
+
+ /**
+ * This constructor uses the given communicator and encoding version.
+ *
+ * @param communicator The communicator to use when initializing the stream.
+ * @param encoding The desired encoding version.
+ * @param data The byte array containing encoded Slice types.
+ **/
+ public InputStream(Communicator communicator, EncodingVersion encoding, byte[] data)
+ {
+ initialize(communicator, encoding);
+ _buf = new Buffer(data);
+ }
+
+ /**
+ * This constructor uses the given communicator and encoding version.
+ *
+ * @param communicator The communicator to use when initializing the stream.
+ * @param encoding The desired encoding version.
+ * @param buf The byte buffer containing encoded Slice types.
+ **/
+ public InputStream(Communicator communicator, EncodingVersion encoding, java.nio.ByteBuffer buf)
+ {
+ initialize(communicator, encoding);
+ _buf = new Buffer(buf);
+ }
+
+ public InputStream(Communicator communicator, EncodingVersion encoding, Buffer buf)
+ {
+ this(communicator, encoding, buf, false);
+ }
+
+ public InputStream(Communicator communicator, EncodingVersion encoding, Buffer buf, boolean adopt)
+ {
+ initialize(communicator, encoding);
+ _buf = new Buffer(buf, adopt);
+ }
+
+ public InputStream(Instance instance, EncodingVersion encoding)
+ {
+ this(instance, encoding, instance.cacheMessageBuffers() > 1);
+ }
+
+ public InputStream(Instance instance, EncodingVersion encoding, boolean direct)
+ {
+ initialize(instance, encoding);
+ _buf = new Buffer(direct);
+ }
+
+ public InputStream(Instance instance, EncodingVersion encoding, byte[] data)
+ {
+ initialize(instance, encoding);
+ _buf = new Buffer(data);
+ }
+
+ public InputStream(Instance instance, EncodingVersion encoding, java.nio.ByteBuffer data)
+ {
+ initialize(instance, encoding);
+ _buf = new Buffer(data);
+ }
+
+ public InputStream(Instance instance, EncodingVersion encoding, Buffer buf, boolean adopt)
+ {
+ initialize(instance, encoding);
+ _buf = new Buffer(buf, adopt);
+ }
+
+ /**
+ * Initializes the stream to use the communicator's default encoding version.
+ *
+ * @param communicator The communicator to use when initializing the stream.
+ **/
+ public void initialize(Communicator communicator)
+ {
+ Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator);
+ initialize(instance, instance.defaultsAndOverrides().defaultEncoding);
+ }
+
+ /**
+ * Initializes the stream to use the given communicator and encoding version.
+ *
+ * @param communicator The communicator to use when initializing the stream.
+ * @param encoding The desired encoding version.
+ **/
+ public void initialize(Communicator communicator, EncodingVersion encoding)
+ {
+ Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator);
+ initialize(instance, encoding);
+ }
+
+ private void initialize(Instance instance, EncodingVersion encoding)
+ {
+ initialize(encoding);
+
+ _instance = instance;
+ _traceSlicing = _instance.traceLevels().slicing > 0;
+
+ _valueFactoryManager = _instance.initializationData().valueFactoryManager;
+ _logger = _instance.initializationData().logger;
+ _classResolver = _instance;
+ }
+
+ private void initialize(EncodingVersion encoding)
+ {
+ _instance = null;
+ _encoding = encoding;
+ _encapsStack = null;
+ _encapsCache = null;
+ _traceSlicing = false;
+ _closure = null;
+ _sliceValues = true;
+ _startSeq = -1;
+ _minSeqSize = 0;
+ }
+
+ /**
+ * Resets this stream. This method allows the stream to be reused, to avoid creating
+ * unnecessary garbage.
+ **/
+ public void reset()
+ {
+ _buf.reset();
+ clear();
+ }
+
+ /**
+ * Releases any data retained by encapsulations. The {@link #reset} method internally calls </code>clear</code>.
+ **/
+ public void clear()
+ {
+ if(_encapsStack != null)
+ {
+ assert(_encapsStack.next == null);
+ _encapsStack.next = _encapsCache;
+ _encapsCache = _encapsStack;
+ _encapsCache.reset();
+ _encapsStack = null;
+ }
+
+ _startSeq = -1;
+ _sliceValues = true;
+ }
+
+ /**
+ * Sets the value factory manager to use when marshaling value instances. If the stream
+ * was initialized with a communicator, the communicator's value factory manager will
+ * be used by default.
+ *
+ * @param vfm The value factory manager.
+ **/
+ public void setValueFactoryManager(ValueFactoryManager vfm)
+ {
+ _valueFactoryManager = vfm;
+ }
+
+ /**
+ * Sets the logger to use when logging trace messages. If the stream
+ * was initialized with a communicator, the communicator's logger will
+ * be used by default.
+ *
+ * @param logger The logger to use for logging trace messages.
+ **/
+ public void setLogger(Logger logger)
+ {
+ _logger = logger;
+ }
+
+ /**
+ * Sets the compact ID resolver to use when unmarshaling value and exception
+ * instances. If the stream was initialized with a communicator, the communicator's
+ * resolver will be used by default.
+ *
+ * @param r The compact ID resolver.
+ **/
+ public void setCompactIdResolver(CompactIdResolver r)
+ {
+ _compactIdResolver = r;
+ }
+
+ /**
+ * Sets the class resolver, which the stream will use when attempting to unmarshal
+ * a value or exception. If the stream was initialized with a communicator, the communicator's
+ * resolver will be used by default.
+ *
+ * @param r The class resolver.
+ **/
+ public void setClassResolver(ClassResolver r)
+ {
+ _classResolver = r;
+ }
+
+ /**
+ * Determines the behavior of the stream when extracting instances of Slice classes.
+ * An instance is "sliced" when a factory cannot be found for a Slice type ID.
+ * The stream's default behavior is to slice instances.
+ *
+ * @param b If <code>true</code> (the default), slicing is enabled; if <code>false</code>,
+ * slicing is disabled. If slicing is disabled and the stream encounters a Slice type ID
+ * during decoding for which no value factory is installed, it raises {@link NoValueFactoryException}.
+ **/
+ public void setSliceValues(boolean b)
+ {
+ _sliceValues = b;
+ }
+
+ /**
+ * Determines whether the stream logs messages about slicing instances of Slice values.
+ *
+ * @param b True to enable logging, false to disable logging.
+ **/
+ public void setTraceSlicing(boolean b)
+ {
+ _traceSlicing = b;
+ }
+
+ /**
+ * Retrieves the closure object associated with this stream.
+ *
+ * @return The closure object.
+ **/
+ public Object getClosure()
+ {
+ return _closure;
+ }
+
+ /**
+ * Associates a closure object with this stream.
+ *
+ * @param p The new closure object.
+ * @return The previous closure object, or null.
+ **/
+ public Object setClosure(Object p)
+ {
+ Object prev = _closure;
+ _closure = p;
+ return prev;
+ }
+
+ public Instance instance()
+ {
+ return _instance;
+ }
+
+ /**
+ * Swaps the contents of one stream with another.
+ *
+ * @param other The other stream.
+ **/
+ public void swap(InputStream other)
+ {
+ assert(_instance == other._instance);
+
+ Buffer tmpBuf = other._buf;
+ other._buf = _buf;
+ _buf = tmpBuf;
+
+ EncodingVersion tmpEncoding = other._encoding;
+ other._encoding = _encoding;
+ _encoding = tmpEncoding;
+
+ boolean tmpTraceSlicing = other._traceSlicing;
+ other._traceSlicing = _traceSlicing;
+ _traceSlicing = tmpTraceSlicing;
+
+ Object tmpClosure = other._closure;
+ other._closure = _closure;
+ _closure = tmpClosure;
+
+ boolean tmpSliceValues = other._sliceValues;
+ other._sliceValues = _sliceValues;
+ _sliceValues = tmpSliceValues;
+
+ //
+ // Swap is never called for streams that have encapsulations being read. However,
+ // encapsulations might still be set in case unmarshaling failed. We just
+ // reset the encapsulations if there are still some set.
+ //
+ resetEncapsulation();
+ other.resetEncapsulation();
+
+ int tmpStartSeq = other._startSeq;
+ other._startSeq = _startSeq;
+ _startSeq = tmpStartSeq;
+
+ int tmpMinSeqSize = other._minSeqSize;
+ other._minSeqSize = _minSeqSize;
+ _minSeqSize = tmpMinSeqSize;
+
+ ValueFactoryManager tmpVfm = other._valueFactoryManager;
+ other._valueFactoryManager = _valueFactoryManager;
+ _valueFactoryManager = tmpVfm;
+
+ Logger tmpLogger = other._logger;
+ other._logger = _logger;
+ _logger = tmpLogger;
+
+ CompactIdResolver tmpCompactIdResolver = other._compactIdResolver;
+ other._compactIdResolver = _compactIdResolver;
+ _compactIdResolver = tmpCompactIdResolver;
+
+ ClassResolver tmpClassResolver = other._classResolver;
+ other._classResolver = _classResolver;
+ _classResolver = tmpClassResolver;
+ }
+
+ private void resetEncapsulation()
+ {
+ _encapsStack = null;
+ }
+
+ /**
+ * Resizes the stream to a new size.
+ *
+ * @param sz The new size.
+ **/
+ public void resize(int sz)
+ {
+ _buf.resize(sz, true);
+ _buf.b.position(sz);
+ }
+
+ public Buffer getBuffer()
+ {
+ return _buf;
+ }
+
+ /**
+ * Marks the start of a class instance.
+ **/
+ public void startValue()
+ {
+ assert(_encapsStack != null && _encapsStack.decoder != null);
+ _encapsStack.decoder.startInstance(SliceType.ValueSlice);
+ }
+
+ /**
+ * Marks the end of a class instance.
+ *
+ * @param preserve Pass true and the stream will preserve the unknown slices of the instance, or false
+ * to discard the unknown slices.
+ * @return An object that encapsulates the unknown slice data.
+ **/
+ public SlicedData endValue(boolean preserve)
+ {
+ assert(_encapsStack != null && _encapsStack.decoder != null);
+ return _encapsStack.decoder.endInstance(preserve);
+ }
+
+ /**
+ * Marks the start of a user exception.
+ **/
+ public void startException()
+ {
+ assert(_encapsStack != null && _encapsStack.decoder != null);
+ _encapsStack.decoder.startInstance(SliceType.ExceptionSlice);
+ }
+
+ /**
+ * Marks the end of a user exception.
+ *
+ * @param preserve Pass true and the stream will preserve the unknown slices of the exception, or false
+ * to discard the unknown slices.
+ * @return An object that encapsulates the unknown slice data.
+ **/
+ public SlicedData endException(boolean preserve)
+ {
+ assert(_encapsStack != null && _encapsStack.decoder != null);
+ return _encapsStack.decoder.endInstance(preserve);
+ }
+
+ /**
+ * Reads the start of an encapsulation.
+ *
+ * @return The encoding version used by the encapsulation.
+ **/
+ public EncodingVersion startEncapsulation()
+ {
+ Encaps curr = _encapsCache;
+ if(curr != null)
+ {
+ curr.reset();
+ _encapsCache = _encapsCache.next;
+ }
+ else
+ {
+ curr = new Encaps();
+ }
+ curr.next = _encapsStack;
+ _encapsStack = curr;
+
+ _encapsStack.start = _buf.b.position();
+
+ //
+ // I don't use readSize() for encapsulations, because when creating an encapsulation,
+ // I must know in advance how many bytes the size information will require in the data
+ // stream. If I use an Int, it is always 4 bytes. For readSize(), it could be 1 or 5 bytes.
+ //
+ int sz = readInt();
+ if(sz < 6)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ if(sz - 4 > _buf.b.remaining())
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ _encapsStack.sz = sz;
+
+ EncodingVersion encoding = EncodingVersion.read(this, null);
+ Protocol.checkSupportedEncoding(encoding); // Make sure the encoding is supported.
+ _encapsStack.setEncoding(encoding);
+
+ return encoding;
+ }
+
+ /**
+ * Ends the previous encapsulation.
+ **/
+ public void endEncapsulation()
+ {
+ assert(_encapsStack != null);
+
+ if(!_encapsStack.encoding_1_0)
+ {
+ skipOptionals();
+ if(_buf.b.position() != _encapsStack.start + _encapsStack.sz)
+ {
+ throw new EncapsulationException();
+ }
+ }
+ else if(_buf.b.position() != _encapsStack.start + _encapsStack.sz)
+ {
+ if(_buf.b.position() + 1 != _encapsStack.start + _encapsStack.sz)
+ {
+ throw new EncapsulationException();
+ }
+
+ //
+ // Ice version < 3.3 had a bug where user exceptions with
+ // class members could be encoded with a trailing byte
+ // when dispatched with AMD. So we tolerate an extra byte
+ // in the encapsulation.
+ //
+ try
+ {
+ _buf.b.get();
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ Encaps curr = _encapsStack;
+ _encapsStack = curr.next;
+ curr.next = _encapsCache;
+ _encapsCache = curr;
+ _encapsCache.reset();
+ }
+
+ /**
+ * Skips an empty encapsulation.
+ *
+ * @return The encapsulation's encoding version.
+ **/
+ public EncodingVersion skipEmptyEncapsulation()
+ {
+ int sz = readInt();
+ if(sz < 6)
+ {
+ throw new EncapsulationException();
+ }
+ if(sz - 4 > _buf.b.remaining())
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+
+ EncodingVersion encoding = EncodingVersion.read(this, null);
+ if(encoding.equals(Util.Encoding_1_0))
+ {
+ if(sz != 6)
+ {
+ throw new EncapsulationException();
+ }
+ }
+ else
+ {
+ //
+ // Skip the optional content of the encapsulation if we are expecting an
+ // empty encapsulation.
+ //
+ _buf.b.position(_buf.b.position() + sz - 6);
+ }
+ return encoding;
+ }
+
+ /**
+ * Returns a blob of bytes representing an encapsulation. The encapsulation's encoding version
+ * is returned in the argument.
+ *
+ * @param encoding The encapsulation's encoding version.
+ * @return The encoded encapuslation.
+ **/
+ public byte[] readEncapsulation(EncodingVersion encoding)
+ {
+ int sz = readInt();
+ if(sz < 6)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+
+ if(sz - 4 > _buf.b.remaining())
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+
+ if(encoding != null)
+ {
+ encoding.ice_read(this);
+ _buf.b.position(_buf.b.position() - 6);
+ }
+ else
+ {
+ _buf.b.position(_buf.b.position() - 4);
+ }
+
+ byte[] v = new byte[sz];
+ try
+ {
+ _buf.b.get(v);
+ return v;
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Determines the current encoding version.
+ *
+ * @return The encoding version.
+ **/
+ public EncodingVersion getEncoding()
+ {
+ return _encapsStack != null ? _encapsStack.encoding : _encoding;
+ }
+
+ /**
+ * Determines the size of the current encapsulation, excluding the encapsulation header.
+ *
+ * @return The size of the encapsulated data.
+ **/
+ public int getEncapsulationSize()
+ {
+ assert(_encapsStack != null);
+ return _encapsStack.sz - 6;
+ }
+
+ /**
+ * Skips over an encapsulation.
+ *
+ * @return The encoding version of the skipped encapsulation.
+ **/
+ public EncodingVersion skipEncapsulation()
+ {
+ int sz = readInt();
+ if(sz < 6)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ EncodingVersion encoding = EncodingVersion.read(this, null);
+ try
+ {
+ _buf.b.position(_buf.b.position() + sz - 6);
+ }
+ catch(IllegalArgumentException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ return encoding;
+ }
+
+ /**
+ * Reads the start of a value or exception slice.
+ *
+ * @return The Slice type ID for this slice.
+ **/
+ public String startSlice() // Returns type ID of next slice
+ {
+ assert(_encapsStack != null && _encapsStack.decoder != null);
+ return _encapsStack.decoder.startSlice();
+ }
+
+ /**
+ * Indicates that the end of a value or exception slice has been reached.
+ **/
+ public void endSlice()
+ {
+ assert(_encapsStack != null && _encapsStack.decoder != null);
+ _encapsStack.decoder.endSlice();
+ }
+
+ /**
+ * Skips over a value or exception slice.
+ **/
+ public void skipSlice()
+ {
+ assert(_encapsStack != null && _encapsStack.decoder != null);
+ _encapsStack.decoder.skipSlice();
+ }
+
+ /**
+ * Indicates that unmarshaling is complete, except for any class instances. The application must call this method
+ * only if the stream actually contains class instances. Calling <code>readPendingValues</code> triggers the
+ * calls to {@link ReadValueCallback#valueReady} that inform the application that unmarshaling of an instance
+ * is complete.
+ **/
+ public void readPendingValues()
+ {
+ if(_encapsStack != null && _encapsStack.decoder != null)
+ {
+ _encapsStack.decoder.readPendingValues();
+ }
+ else if(_encapsStack != null ? _encapsStack.encoding_1_0 : _encoding.equals(Util.Encoding_1_0))
+ {
+ //
+ // If using the 1.0 encoding and no instances were read, we
+ // still read an empty sequence of pending instances if
+ // requested (i.e.: if this is called).
+ //
+ // This is required by the 1.0 encoding, even if no instances
+ // are written we do marshal an empty sequence if marshaled
+ // data types use classes.
+ //
+ skipSize();
+ }
+ }
+
+ /**
+ * Extracts a size from the stream.
+ *
+ * @return The extracted size.
+ **/
+ public int readSize()
+ {
+ try
+ {
+ byte b = _buf.b.get();
+ if(b == -1)
+ {
+ int v = _buf.b.getInt();
+ if(v < 0)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ return v;
+ }
+ else
+ {
+ return b < 0 ? b + 256 : b;
+ }
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Reads and validates a sequence size.
+ *
+ * @return The extracted size.
+ **/
+ public int readAndCheckSeqSize(int minSize)
+ {
+ int sz = readSize();
+
+ if(sz == 0)
+ {
+ return sz;
+ }
+
+ //
+ // The _startSeq variable points to the start of the sequence for which
+ // we expect to read at least _minSeqSize bytes from the stream.
+ //
+ // If not initialized or if we already read more data than _minSeqSize,
+ // we reset _startSeq and _minSeqSize for this sequence (possibly a
+ // top-level sequence or enclosed sequence it doesn't really matter).
+ //
+ // Otherwise, we are reading an enclosed sequence and we have to bump
+ // _minSeqSize by the minimum size that this sequence will require on
+ // the stream.
+ //
+ // The goal of this check is to ensure that when we start un-marshalling
+ // a new sequence, we check the minimal size of this new sequence against
+ // the estimated remaining buffer size. This estimatation is based on
+ // the minimum size of the enclosing sequences, it's _minSeqSize.
+ //
+ if(_startSeq == -1 || _buf.b.position() > (_startSeq + _minSeqSize))
+ {
+ _startSeq = _buf.b.position();
+ _minSeqSize = sz * minSize;
+ }
+ else
+ {
+ _minSeqSize += sz * minSize;
+ }
+
+ //
+ // If there isn't enough data to read on the stream for the sequence (and
+ // possibly enclosed sequences), something is wrong with the marshalled
+ // data: it's claiming having more data that what is possible to read.
+ //
+ if(_startSeq + _minSeqSize > _buf.size())
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+
+ return sz;
+ }
+
+ /**
+ * Reads a blob of bytes from the stream.
+ *
+ * @param sz The number of bytes to read.
+ * @return The requested bytes as a byte array.
+ **/
+ public byte[] readBlob(int sz)
+ {
+ if(_buf.b.remaining() < sz)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ byte[] v = new byte[sz];
+ try
+ {
+ _buf.b.get(v);
+ return v;
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Determine if an optional value is available for reading.
+ *
+ * @param tag The tag associated with the value.
+ * @param expectedFormat The optional format for the value.
+ * @return True if the value is present, false otherwise.
+ **/
+ public boolean readOptional(int tag, OptionalFormat expectedFormat)
+ {
+ assert(_encapsStack != null);
+ if(_encapsStack.decoder != null)
+ {
+ return _encapsStack.decoder.readOptional(tag, expectedFormat);
+ }
+ else
+ {
+ return readOptImpl(tag, expectedFormat);
+ }
+ }
+
+ /**
+ * Extracts a byte value from the stream.
+ *
+ * @return The extracted byte.
+ **/
+ public byte readByte()
+ {
+ try
+ {
+ return _buf.b.get();
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Extracts an optional byte value from the stream.
+ *
+ * @param tag The numeric tag associated with the value.
+ * @return The optional value (if any).
+ **/
+ public java.util.Optional<Byte> readByte(int tag)
+ {
+ if(readOptional(tag, OptionalFormat.F1))
+ {
+ return java.util.Optional.of(readByte());
+ }
+ else
+ {
+ return java.util.Optional.empty();
+ }
+ }
+
+ /**
+ * Extracts a sequence of byte values from the stream.
+ *
+ * @return The extracted byte sequence.
+ **/
+ public byte[] readByteSeq()
+ {
+ try
+ {
+ final int sz = readAndCheckSeqSize(1);
+ byte[] v = new byte[sz];
+ _buf.b.get(v);
+ return v;
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Extracts an optional byte sequence from the stream.
+ *
+ * @param tag The numeric tag associated with the value.
+ * @return The optional value (if any).
+ **/
+ public java.util.Optional<byte[]> readByteSeq(int tag)
+ {
+ if(readOptional(tag, OptionalFormat.VSize))
+ {
+ return java.util.Optional.of(readByteSeq());
+ }
+ else
+ {
+ return java.util.Optional.empty();
+ }
+ }
+
+ /**
+ * Returns a byte buffer representing a sequence of bytes. This method does not copy the data.
+ *
+ * @return A byte buffer "slice" of the internal buffer.
+ **/
+ public java.nio.ByteBuffer readByteBuffer()
+ {
+ try
+ {
+ final int sz = readAndCheckSeqSize(1);
+ java.nio.ByteBuffer v = _buf.b.slice();
+ v.limit(sz);
+ _buf.b.position(_buf.b.position() + sz);
+ return v.asReadOnlyBuffer();
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Extracts a serializable Java object from the stream.
+ *
+ * @return The deserialized Java object.
+ **/
+ public java.io.Serializable readSerializable()
+ {
+ int sz = readAndCheckSeqSize(1);
+ if (sz == 0)
+ {
+ return null;
+ }
+ com.zeroc.IceInternal.ObjectInputStream in = null;
+ try
+ {
+ com.zeroc.IceInternal.InputStreamWrapper w = new com.zeroc.IceInternal.InputStreamWrapper(sz, _buf.b);
+ in = new com.zeroc.IceInternal.ObjectInputStream(_instance, w);
+ return (java.io.Serializable)in.readObject();
+ }
+ catch(LocalException ex)
+ {
+ throw ex;
+ }
+ catch(java.lang.Exception ex)
+ {
+ throw new MarshalException("cannot deserialize object", ex);
+ }
+ finally
+ {
+ if(in != null)
+ {
+ try
+ {
+ in.close();
+ }
+ catch (IOException ex)
+ {
+ throw new MarshalException("cannot deserialize object", ex);
+ }
+ }
+ }
+ }
+
+ /**
+ * Extracts a boolean value from the stream.
+ *
+ * @return The extracted boolean.
+ **/
+ public boolean readBool()
+ {
+ try
+ {
+ return _buf.b.get() == 1;
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Extracts an optional boolean value from the stream.
+ *
+ * @param tag The numeric tag associated with the value.
+ * @return The optional value (if any).
+ **/
+ public java.util.Optional<Boolean> readBool(int tag)
+ {
+ if(readOptional(tag, OptionalFormat.F1))
+ {
+ return java.util.Optional.of(readBool());
+ }
+ else
+ {
+ return java.util.Optional.empty();
+ }
+ }
+
+ /**
+ * Extracts a sequence of boolean values from the stream.
+ *
+ * @return The extracted boolean sequence.
+ **/
+ public boolean[] readBoolSeq()
+ {
+ try
+ {
+ final int sz = readAndCheckSeqSize(1);
+ boolean[] v = new boolean[sz];
+ for(int i = 0; i < sz; i++)
+ {
+ v[i] = _buf.b.get() == 1;
+ }
+ return v;
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Extracts an optional boolean sequence from the stream.
+ *
+ * @param tag The numeric tag associated with the value.
+ * @return The optional value (if any).
+ **/
+ public java.util.Optional<boolean[]> readBoolSeq(int tag)
+ {
+ if(readOptional(tag, OptionalFormat.VSize))
+ {
+ return java.util.Optional.of(readBoolSeq());
+ }
+ else
+ {
+ return java.util.Optional.empty();
+ }
+ }
+
+ /**
+ * Extracts a short value from the stream.
+ *
+ * @return The extracted short.
+ **/
+ public short readShort()
+ {
+ try
+ {
+ return _buf.b.getShort();
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Extracts an optional short value from the stream.
+ *
+ * @param tag The numeric tag associated with the value.
+ * @return The optional value (if any).
+ **/
+ public java.util.Optional<Short> readShort(int tag)
+ {
+ if(readOptional(tag, OptionalFormat.F2))
+ {
+ return java.util.Optional.of(readShort());
+ }
+ else
+ {
+ return java.util.Optional.empty();
+ }
+ }
+
+ /**
+ * Extracts a sequence of short values from the stream.
+ *
+ * @return The extracted short sequence.
+ **/
+ public short[] readShortSeq()
+ {
+ try
+ {
+ final int sz = readAndCheckSeqSize(2);
+ short[] v = new short[sz];
+ java.nio.ShortBuffer shortBuf = _buf.b.asShortBuffer();
+ shortBuf.get(v);
+ _buf.b.position(_buf.b.position() + sz * 2);
+ return v;
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Extracts an optional short sequence from the stream.
+ *
+ * @param tag The numeric tag associated with the value.
+ * @return The optional value (if any).
+ **/
+ public java.util.Optional<short[]> readShortSeq(int tag)
+ {
+ if(readOptional(tag, OptionalFormat.VSize))
+ {
+ skipSize();
+ return java.util.Optional.of(readShortSeq());
+ }
+ else
+ {
+ return java.util.Optional.empty();
+ }
+ }
+
+ /**
+ * Returns a short buffer representing a sequence of shorts. This method does not copy the data.
+ *
+ * @return A short buffer "slice" of the internal buffer.
+ **/
+ public java.nio.ShortBuffer readShortBuffer()
+ {
+ try
+ {
+ final int sz = readAndCheckSeqSize(2);
+ java.nio.ShortBuffer shortBuf = _buf.b.asShortBuffer();
+ java.nio.ShortBuffer v = shortBuf.slice();
+ v.limit(sz);
+ _buf.b.position(_buf.b.position() + sz * 2);
+ return v.asReadOnlyBuffer();
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Extracts an int value from the stream.
+ *
+ * @return The extracted int.
+ **/
+ public int readInt()
+ {
+ try
+ {
+ return _buf.b.getInt();
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Extracts an optional int value from the stream.
+ *
+ * @param tag The numeric tag associated with the value.
+ * @return The optional value (if any).
+ **/
+ public java.util.OptionalInt readInt(int tag)
+ {
+ if(readOptional(tag, OptionalFormat.F4))
+ {
+ return java.util.OptionalInt.of(readInt());
+ }
+ else
+ {
+ return java.util.OptionalInt.empty();
+ }
+ }
+
+ /**
+ * Extracts a sequence of int values from the stream.
+ *
+ * @return The extracted int sequence.
+ **/
+ public int[] readIntSeq()
+ {
+ try
+ {
+ final int sz = readAndCheckSeqSize(4);
+ int[] v = new int[sz];
+ java.nio.IntBuffer intBuf = _buf.b.asIntBuffer();
+ intBuf.get(v);
+ _buf.b.position(_buf.b.position() + sz * 4);
+ return v;
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Extracts an optional int sequence from the stream.
+ *
+ * @param tag The numeric tag associated with the value.
+ * @return The optional value (if any).
+ **/
+ public java.util.Optional<int[]> readIntSeq(int tag)
+ {
+ if(readOptional(tag, OptionalFormat.VSize))
+ {
+ skipSize();
+ return java.util.Optional.of(readIntSeq());
+ }
+ else
+ {
+ return java.util.Optional.empty();
+ }
+ }
+
+ /**
+ * Returns an int buffer representing a sequence of ints. This method does not copy the data.
+ *
+ * @return An int buffer "slice" of the internal buffer.
+ **/
+ public java.nio.IntBuffer readIntBuffer()
+ {
+ try
+ {
+ final int sz = readAndCheckSeqSize(4);
+ java.nio.IntBuffer intBuf = _buf.b.asIntBuffer();
+ java.nio.IntBuffer v = intBuf.slice();
+ v.limit(sz);
+ _buf.b.position(_buf.b.position() + sz * 4);
+ return v.asReadOnlyBuffer();
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Extracts a long value from the stream.
+ *
+ * @return The extracted long.
+ **/
+ public long readLong()
+ {
+ try
+ {
+ return _buf.b.getLong();
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Extracts an optional long value from the stream.
+ *
+ * @param tag The numeric tag associated with the value.
+ * @return The optional value (if any).
+ **/
+ public java.util.OptionalLong readLong(int tag)
+ {
+ if(readOptional(tag, OptionalFormat.F8))
+ {
+ return java.util.OptionalLong.of(readLong());
+ }
+ else
+ {
+ return java.util.OptionalLong.empty();
+ }
+ }
+
+ /**
+ * Extracts a sequence of long values from the stream.
+ *
+ * @return The extracted long sequence.
+ **/
+ public long[] readLongSeq()
+ {
+ try
+ {
+ final int sz = readAndCheckSeqSize(8);
+ long[] v = new long[sz];
+ java.nio.LongBuffer longBuf = _buf.b.asLongBuffer();
+ longBuf.get(v);
+ _buf.b.position(_buf.b.position() + sz * 8);
+ return v;
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Extracts an optional long sequence from the stream.
+ *
+ * @param tag The numeric tag associated with the value.
+ * @return The optional value (if any).
+ **/
+ public java.util.Optional<long[]> readLongSeq(int tag)
+ {
+ if(readOptional(tag, OptionalFormat.VSize))
+ {
+ skipSize();
+ return java.util.Optional.of(readLongSeq());
+ }
+ else
+ {
+ return java.util.Optional.empty();
+ }
+ }
+
+ /**
+ * Returns a long buffer representing a sequence of longs. This method does not copy the data.
+ *
+ * @return A long buffer "slice" of the internal buffer.
+ **/
+ public java.nio.LongBuffer readLongBuffer()
+ {
+ try
+ {
+ final int sz = readAndCheckSeqSize(8);
+ java.nio.LongBuffer longBuf = _buf.b.asLongBuffer();
+ java.nio.LongBuffer v = longBuf.slice();
+ v.limit(sz);
+ _buf.b.position(_buf.b.position() + sz * 8);
+ return v.asReadOnlyBuffer();
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Extracts a float value from the stream.
+ *
+ * @return The extracted float.
+ **/
+ public float readFloat()
+ {
+ try
+ {
+ return _buf.b.getFloat();
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Extracts an optional float value from the stream.
+ *
+ * @param tag The numeric tag associated with the value.
+ * @return The optional value (if any).
+ **/
+ public java.util.Optional<Float> readFloat(int tag)
+ {
+ if(readOptional(tag, OptionalFormat.F4))
+ {
+ return java.util.Optional.of(readFloat());
+ }
+ else
+ {
+ return java.util.Optional.empty();
+ }
+ }
+
+ /**
+ * Extracts a sequence of float values from the stream.
+ *
+ * @return The extracted float sequence.
+ **/
+ public float[] readFloatSeq()
+ {
+ try
+ {
+ final int sz = readAndCheckSeqSize(4);
+ float[] v = new float[sz];
+ java.nio.FloatBuffer floatBuf = _buf.b.asFloatBuffer();
+ floatBuf.get(v);
+ _buf.b.position(_buf.b.position() + sz * 4);
+ return v;
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Extracts an optional float sequence from the stream.
+ *
+ * @param tag The numeric tag associated with the value.
+ * @return The optional value (if any).
+ **/
+ public java.util.Optional<float[]> readFloatSeq(int tag)
+ {
+ if(readOptional(tag, OptionalFormat.VSize))
+ {
+ skipSize();
+ return java.util.Optional.of(readFloatSeq());
+ }
+ else
+ {
+ return java.util.Optional.empty();
+ }
+ }
+
+ /**
+ * Returns a float buffer representing a sequence of floats. This method does not copy the data.
+ *
+ * @return A float buffer "slice" of the internal buffer.
+ **/
+ public java.nio.FloatBuffer readFloatBuffer()
+ {
+ try
+ {
+ final int sz = readAndCheckSeqSize(4);
+ java.nio.FloatBuffer floatBuf = _buf.b.asFloatBuffer();
+ java.nio.FloatBuffer v = floatBuf.slice();
+ v.limit(sz);
+ _buf.b.position(_buf.b.position() + sz * 4);
+ return v.asReadOnlyBuffer();
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Extracts a double value from the stream.
+ *
+ * @return The extracted double.
+ **/
+ public double readDouble()
+ {
+ try
+ {
+ return _buf.b.getDouble();
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Extracts an optional double value from the stream.
+ *
+ * @param tag The numeric tag associated with the value.
+ * @return The optional value (if any).
+ **/
+ public java.util.OptionalDouble readDouble(int tag)
+ {
+ if(readOptional(tag, OptionalFormat.F8))
+ {
+ return java.util.OptionalDouble.of(readDouble());
+ }
+ else
+ {
+ return java.util.OptionalDouble.empty();
+ }
+ }
+
+ /**
+ * Extracts a sequence of double values from the stream.
+ *
+ * @return The extracted double sequence.
+ **/
+ public double[] readDoubleSeq()
+ {
+ try
+ {
+ final int sz = readAndCheckSeqSize(8);
+ double[] v = new double[sz];
+ java.nio.DoubleBuffer doubleBuf = _buf.b.asDoubleBuffer();
+ doubleBuf.get(v);
+ _buf.b.position(_buf.b.position() + sz * 8);
+ return v;
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Extracts an optional double sequence from the stream.
+ *
+ * @param tag The numeric tag associated with the value.
+ * @return The optional value (if any).
+ **/
+ public java.util.Optional<double[]> readDoubleSeq(int tag)
+ {
+ if(readOptional(tag, OptionalFormat.VSize))
+ {
+ skipSize();
+ return java.util.Optional.of(readDoubleSeq());
+ }
+ else
+ {
+ return java.util.Optional.empty();
+ }
+ }
+
+ /**
+ * Returns a double buffer representing a sequence of doubles. This method does not copy the data.
+ *
+ * @return A double buffer "slice" of the internal buffer.
+ **/
+ public java.nio.DoubleBuffer readDoubleBuffer()
+ {
+ try
+ {
+ final int sz = readAndCheckSeqSize(8);
+ java.nio.DoubleBuffer doubleBuf = _buf.b.asDoubleBuffer();
+ java.nio.DoubleBuffer v = doubleBuf.slice();
+ v.limit(sz);
+ _buf.b.position(_buf.b.position() + sz * 8);
+ return v.asReadOnlyBuffer();
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+
+ final static java.nio.charset.Charset _utf8 = java.nio.charset.Charset.forName("UTF8");
+ private java.nio.charset.CharsetEncoder _charEncoder = null;
+
+ /**
+ * Extracts a string from the stream.
+ *
+ * @return The extracted string.
+ **/
+ public String readString()
+ {
+ final int len = readSize();
+
+ if(len == 0)
+ {
+ return "";
+ }
+ else
+ {
+ //
+ // Check the buffer has enough bytes to read.
+ //
+ if(_buf.b.remaining() < len)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+
+ try
+ {
+ //
+ // We reuse the _stringBytes array to avoid creating
+ // excessive garbage.
+ //
+ if(_stringBytes == null || len > _stringBytes.length)
+ {
+ _stringBytes = new byte[len];
+ }
+ if(_stringChars == null || len > _stringChars.length)
+ {
+ _stringChars = new char[len];
+ }
+ _buf.b.get(_stringBytes, 0, len);
+
+ //
+ // It's more efficient to construct a string using a
+ // character array instead of a byte array, because
+ // byte arrays require conversion.
+ //
+ for(int i = 0; i < len; i++)
+ {
+ if(_stringBytes[i] < 0)
+ {
+ //
+ // Multi-byte character found - we must use
+ // conversion.
+ //
+ // TODO: If the string contains garbage bytes
+ // that won't correctly decode as UTF, the
+ // behavior of this constructor is
+ // undefined. It would be better to explicitly
+ // decode using
+ // java.nio.charset.CharsetDecoder and to
+ // throw MarshalException if the string won't
+ // decode.
+ //
+ return new String(_stringBytes, 0, len, "UTF8");
+ }
+ else
+ {
+ _stringChars[i] = (char)_stringBytes[i];
+ }
+ }
+ return new String(_stringChars, 0, len);
+ }
+ catch(java.io.UnsupportedEncodingException ex)
+ {
+ assert(false);
+ return "";
+ }
+ catch(java.nio.BufferUnderflowException ex)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+ }
+
+ /**
+ * Extracts an optional string value from the stream.
+ *
+ * @param tag The numeric tag associated with the value.
+ * @return The optional value (if any).
+ **/
+ public java.util.Optional<String> readString(int tag)
+ {
+ if(readOptional(tag, OptionalFormat.VSize))
+ {
+ return java.util.Optional.of(readString());
+ }
+ else
+ {
+ return java.util.Optional.empty();
+ }
+ }
+
+ /**
+ * Extracts a sequence of string values from the stream.
+ *
+ * @return The extracted string sequence.
+ **/
+ public String[] readStringSeq()
+ {
+ final int sz = readAndCheckSeqSize(1);
+ String[] v = new String[sz];
+ for(int i = 0; i < sz; i++)
+ {
+ v[i] = readString();
+ }
+ return v;
+ }
+
+ /**
+ * Extracts an optional string sequence from the stream.
+ *
+ * @param tag The numeric tag associated with the value.
+ * @return The optional value (if any).
+ **/
+ public java.util.Optional<String[]> readStringSeq(int tag)
+ {
+ if(readOptional(tag, OptionalFormat.FSize))
+ {
+ skip(4);
+ return java.util.Optional.of(readStringSeq());
+ }
+ else
+ {
+ return java.util.Optional.empty();
+ }
+ }
+
+ /**
+ * Extracts a proxy from the stream. The stream must have been initialized with a communicator.
+ *
+ * @return The extracted proxy.
+ **/
+ public ObjectPrx readProxy()
+ {
+ if(_instance == null)
+ {
+ throw new MarshalException("cannot unmarshal a proxy without a communicator");
+ }
+
+ return _instance.proxyFactory().streamToProxy(this);
+ }
+
+ /**
+ * Extracts an optional proxy from the stream. The stream must have been initialized with a communicator.
+ *
+ * @param tag The numeric tag associated with the value.
+ * @return The optional value (if any).
+ **/
+ public java.util.Optional<ObjectPrx> readProxy(int tag)
+ {
+ if(readOptional(tag, OptionalFormat.FSize))
+ {
+ skip(4);
+ return java.util.Optional.of(readProxy());
+ }
+ else
+ {
+ return java.util.Optional.empty();
+ }
+ }
+
+ /**
+ * Read an enumerated value.
+ *
+ * @param maxValue The maximum enumerator value in the definition.
+ * @return The enumerator.
+ **/
+ public int readEnum(int maxValue)
+ {
+ if(getEncoding().equals(Util.Encoding_1_0))
+ {
+ if(maxValue < 127)
+ {
+ return readByte();
+ }
+ else if(maxValue < 32767)
+ {
+ return readShort();
+ }
+ else
+ {
+ return readInt();
+ }
+ }
+ else
+ {
+ return readSize();
+ }
+ }
+
+ /**
+ * Extracts the index of a Slice value from the stream.
+ *
+ * @param cb The callback to notify the application when the extracted instance is available.
+ * The stream extracts Slice values in stages. The Ice run time calls {@link ReadValueCallback#valueReady}
+ * when the corresponding instance has been fully unmarshaled.
+ *
+ * @see ReadValueCallback
+ **/
+ public void readValue(ReadValueCallback cb)
+ {
+ initEncaps();
+ _encapsStack.decoder.readValue(cb);
+ }
+
+ /**
+ * Extracts the index of an optional Slice value from the stream.
+ *
+ * @param tag The numeric tag associated with the value.
+ * @param cb The callback to notify the application when the extracted instance is available.
+ * The stream extracts Slice values in stages. The Ice run time calls {@link ReadValueCallback#valueReady}
+ * when the corresponding instance has been fully unmarshaled.
+ *
+ * @see ReadValueCallback
+ **/
+ public void readValue(int tag, ReadValueCallback cb)
+ {
+ if(readOptional(tag, OptionalFormat.Class))
+ {
+ readValue(cb);
+ }
+ else
+ {
+ cb.valueReady(null);
+ }
+ }
+
+ /**
+ * Extracts a user exception from the stream and throws it.
+ **/
+ public void throwException()
+ throws UserException
+ {
+ throwException(null);
+ }
+
+ /**
+ * Extracts a user exception from the stream and throws it. The caller can supply a factory
+ * to instantiate exception instances.
+ *
+ * @param factory The user exception factory, or null to use the stream's default behavior.
+ **/
+ public void throwException(UserExceptionFactory factory)
+ throws UserException
+ {
+ initEncaps();
+ _encapsStack.decoder.throwException(factory);
+ }
+
+ private boolean readOptImpl(int readTag, OptionalFormat expectedFormat)
+ {
+ if(isEncoding_1_0())
+ {
+ return false; // Optional members aren't supported with the 1.0 encoding.
+ }
+
+ while(true)
+ {
+ if(_buf.b.position() >= _encapsStack.start + _encapsStack.sz)
+ {
+ return false; // End of encapsulation also indicates end of optionals.
+ }
+
+ final byte b = readByte();
+ final int v = b < 0 ? b + 256 : b;
+ if(v == Protocol.OPTIONAL_END_MARKER)
+ {
+ _buf.b.position(_buf.b.position() - 1); // Rewind.
+ return false;
+ }
+
+ OptionalFormat format = OptionalFormat.valueOf(v & 0x07); // First 3 bits.
+ int tag = v >> 3;
+ if(tag == 30)
+ {
+ tag = readSize();
+ }
+
+ if(tag > readTag)
+ {
+ int offset = tag < 30 ? 1 : (tag < 255 ? 2 : 6); // Rewind
+ _buf.b.position(_buf.b.position() - offset);
+ return false; // No optional data members with the requested tag.
+ }
+ else if(tag < readTag)
+ {
+ skipOptional(format); // Skip optional data members
+ }
+ else
+ {
+ if(format != expectedFormat)
+ {
+ throw new MarshalException("invalid optional data member `" + tag + "': unexpected format");
+ }
+ return true;
+ }
+ }
+ }
+
+ private void skipOptional(OptionalFormat format)
+ {
+ switch(format)
+ {
+ case F1:
+ {
+ skip(1);
+ break;
+ }
+ case F2:
+ {
+ skip(2);
+ break;
+ }
+ case F4:
+ {
+ skip(4);
+ break;
+ }
+ case F8:
+ {
+ skip(8);
+ break;
+ }
+ case Size:
+ {
+ skipSize();
+ break;
+ }
+ case VSize:
+ {
+ skip(readSize());
+ break;
+ }
+ case FSize:
+ {
+ skip(readInt());
+ break;
+ }
+ case Class:
+ {
+ readValue(null);
+ break;
+ }
+ }
+ }
+
+ private void skipOptionals()
+ {
+ //
+ // Skip remaining un-read optional members.
+ //
+ while(true)
+ {
+ if(_buf.b.position() >= _encapsStack.start + _encapsStack.sz)
+ {
+ return; // End of encapsulation also indicates end of optionals.
+ }
+
+ final byte b = readByte();
+ final int v = b < 0 ? b + 256 : b;
+ if(v == Protocol.OPTIONAL_END_MARKER)
+ {
+ return;
+ }
+
+ OptionalFormat format = OptionalFormat.valueOf(v & 0x07); // Read first 3 bits.
+ if((v >> 3) == 30)
+ {
+ skipSize();
+ }
+ skipOptional(format);
+ }
+ }
+
+ /**
+ * Skip the given number of bytes.
+ *
+ * @param size The number of bytes to skip.
+ **/
+ public void skip(int size)
+ {
+ if(size < 0 || size > _buf.b.remaining())
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ _buf.b.position(_buf.b.position() + size);
+ }
+
+ /**
+ * Skip over a size value.
+ **/
+ public void skipSize()
+ {
+ byte b = readByte();
+ if(b == -1)
+ {
+ skip(4);
+ }
+ }
+
+ /**
+ * Determines the current position in the stream.
+ *
+ * @return The current position.
+ **/
+ public int pos()
+ {
+ return _buf.b.position();
+ }
+
+ /**
+ * Sets the current position in the stream.
+ *
+ * @param n The new position.
+ **/
+ public void pos(int n)
+ {
+ _buf.b.position(n);
+ }
+
+ /**
+ * Determines the current size of the stream.
+ *
+ * @return The current size.
+ **/
+ public int size()
+ {
+ return _buf.size();
+ }
+
+ /**
+ * Determines whether the stream is empty.
+ *
+ * @return True if the internal buffer has no data, false otherwise.
+ **/
+ public boolean isEmpty()
+ {
+ return _buf.empty();
+ }
+
+ private UserException createUserException(String id)
+ {
+ UserException userEx = null;
+
+ try
+ {
+ if(_classResolver != null)
+ {
+ Class<?> c = _classResolver.resolveClass(id);
+ if(c != null)
+ {
+ userEx = (UserException)c.newInstance();
+ }
+ }
+ }
+ catch(java.lang.Exception ex)
+ {
+ throw new MarshalException(ex);
+ }
+
+ return userEx;
+ }
+
+ private Instance _instance;
+ private Buffer _buf;
+ private Object _closure;
+ private byte[] _stringBytes; // Reusable array for reading strings.
+ private char[] _stringChars; // Reusable array for reading strings.
+
+ private enum SliceType { NoSlice, ValueSlice, ExceptionSlice }
+
+ abstract private static class EncapsDecoder
+ {
+ EncapsDecoder(InputStream stream, boolean sliceValues, ValueFactoryManager f, ClassResolver cr)
+ {
+ _stream = stream;
+ _sliceValues = sliceValues;
+ _valueFactoryManager = f;
+ _classResolver = cr;
+ _typeIdIndex = 0;
+ _unmarshaledMap = new java.util.TreeMap<>();
+ }
+
+ abstract void readValue(ReadValueCallback cb);
+ abstract void throwException(UserExceptionFactory factory)
+ throws UserException;
+
+ abstract void startInstance(SliceType type);
+ abstract SlicedData endInstance(boolean preserve);
+ abstract String startSlice();
+ abstract void endSlice();
+ abstract void skipSlice();
+
+ boolean readOptional(int tag, OptionalFormat format)
+ {
+ return false;
+ }
+
+ void readPendingValues()
+ {
+ }
+
+ protected String readTypeId(boolean isIndex)
+ {
+ if(_typeIdMap == null) // Lazy initialization
+ {
+ _typeIdMap = new java.util.TreeMap<>();
+ }
+
+ if(isIndex)
+ {
+ int index = _stream.readSize();
+ String typeId = _typeIdMap.get(index);
+ if(typeId == null)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ return typeId;
+ }
+ else
+ {
+ String typeId = _stream.readString();
+ _typeIdMap.put(++_typeIdIndex, typeId);
+ return typeId;
+ }
+ }
+
+ protected Class<?> resolveClass(String typeId)
+ {
+ Class<?> cls = null;
+ if(_typeIdCache == null)
+ {
+ _typeIdCache = new java.util.HashMap<>(); // Lazy initialization.
+ }
+ else
+ {
+ cls = _typeIdCache.get(typeId);
+ }
+
+ if(cls == EncapsDecoder.class) // Marker for non-existent class.
+ {
+ cls = null;
+ }
+ else if(cls == null)
+ {
+ try
+ {
+ if(_classResolver != null)
+ {
+ cls = _classResolver.resolveClass(typeId);
+ _typeIdCache.put(typeId, cls != null ? cls : EncapsDecoder.class);
+ }
+ }
+ catch(java.lang.Exception ex)
+ {
+ throw new NoValueFactoryException("no value factory", typeId, ex);
+ }
+ }
+
+ return cls;
+ }
+
+ protected Value newInstance(String typeId)
+ {
+ //
+ // Try to find a factory registered for the specific type.
+ //
+ ValueFactory userFactory = _valueFactoryManager.find(typeId);
+ Value v = null;
+ if(userFactory != null)
+ {
+ v = userFactory.create(typeId);
+ }
+
+ //
+ // If that fails, invoke the default factory if one has been
+ // registered.
+ //
+ if(v == null)
+ {
+ userFactory = _valueFactoryManager.find("");
+ if(userFactory != null)
+ {
+ v = userFactory.create(typeId);
+ }
+ }
+
+ //
+ // Last chance: try to instantiate the class dynamically.
+ //
+ if(v == null)
+ {
+ Class<?> cls = resolveClass(typeId);
+
+ if(cls != null)
+ {
+ try
+ {
+ v = (Value)cls.newInstance();
+ }
+ catch(java.lang.Exception ex)
+ {
+ throw new NoValueFactoryException("no value factory", typeId, ex);
+ }
+ }
+ }
+
+ return v;
+ }
+
+ protected void addPatchEntry(int index, ReadValueCallback cb)
+ {
+ assert(index > 0);
+
+ //
+ // Check if we have already unmarshalled the instance. If that's the case,
+ // just invoke the callback and we're done.
+ //
+ Value obj = _unmarshaledMap.get(index);
+ if(obj != null)
+ {
+ cb.valueReady(obj);
+ return;
+ }
+
+ if(_patchMap == null) // Lazy initialization
+ {
+ _patchMap = new java.util.TreeMap<>();
+ }
+
+ //
+ // Add patch entry if the instance isn't unmarshaled yet,
+ // the callback will be called when the instance is
+ // unmarshaled.
+ //
+ java.util.LinkedList<ReadValueCallback> l = _patchMap.get(index);
+ if(l == null)
+ {
+ //
+ // We have no outstanding instances to be patched for this
+ // index, so make a new entry in the patch map.
+ //
+ l = new java.util.LinkedList<>();
+ _patchMap.put(index, l);
+ }
+
+ //
+ // Append a patch entry for this instance.
+ //
+ l.add(cb);
+ }
+
+ protected void unmarshal(int index, Value v)
+ {
+ //
+ // Add the instance to the map of unmarshaled instances, this must
+ // be done before reading the instances (for circular references).
+ //
+ _unmarshaledMap.put(index, v);
+
+ //
+ // Read the instance.
+ //
+ v.__read(_stream);
+
+ if(_patchMap != null)
+ {
+ //
+ // Patch all instances now that the instance is unmarshaled.
+ //
+ java.util.LinkedList<ReadValueCallback> l = _patchMap.get(index);
+ if(l != null)
+ {
+ assert(l.size() > 0);
+
+ //
+ // Patch all pointers that refer to the instance.
+ //
+ for(ReadValueCallback cb : l)
+ {
+ cb.valueReady(v);
+ }
+
+ //
+ // Clear out the patch map for that index -- there is nothing left
+ // to patch for that index for the time being.
+ //
+ _patchMap.remove(index);
+ }
+ }
+
+ if((_patchMap == null || _patchMap.isEmpty()) && _valueList == null)
+ {
+ try
+ {
+ v.ice_postUnmarshal();
+ }
+ catch(java.lang.Exception ex)
+ {
+ String s = "exception raised by ice_postUnmarshal:\n" + com.zeroc.IceInternal.Ex.toString(ex);
+ _stream.instance().initializationData().logger.warning(s);
+ }
+ }
+ else
+ {
+ if(_valueList == null) // Lazy initialization
+ {
+ _valueList = new java.util.ArrayList<>();
+ }
+ _valueList.add(v);
+
+ if(_patchMap == null || _patchMap.isEmpty())
+ {
+ //
+ // Iterate over the instance list and invoke ice_postUnmarshal on
+ // each instance. We must do this after all instances have been
+ // unmarshaled in order to ensure that any instance data members
+ // have been properly patched.
+ //
+ for(Value p : _valueList)
+ {
+ try
+ {
+ p.ice_postUnmarshal();
+ }
+ catch(java.lang.Exception ex)
+ {
+ String s = "exception raised by ice_postUnmarshal:\n" +
+ com.zeroc.IceInternal.Ex.toString(ex);
+ _stream.instance().initializationData().logger.warning(s);
+ }
+ }
+ _valueList.clear();
+ }
+ }
+ }
+
+ protected final InputStream _stream;
+ protected final boolean _sliceValues;
+ protected ValueFactoryManager _valueFactoryManager;
+ protected ClassResolver _classResolver;
+
+ //
+ // Encapsulation attributes for value unmarshaling.
+ //
+ protected java.util.TreeMap<Integer, java.util.LinkedList<ReadValueCallback> > _patchMap;
+ private java.util.TreeMap<Integer, Value> _unmarshaledMap;
+ private java.util.TreeMap<Integer, String> _typeIdMap;
+ private int _typeIdIndex;
+ private java.util.List<Value> _valueList;
+ private java.util.HashMap<String, Class<?> > _typeIdCache;
+ }
+
+ private static final class EncapsDecoder10 extends EncapsDecoder
+ {
+ EncapsDecoder10(InputStream stream, boolean sliceValues, ValueFactoryManager f, ClassResolver cr)
+ {
+ super(stream, sliceValues, f, cr);
+ _sliceType = SliceType.NoSlice;
+ }
+
+ @Override
+ void readValue(ReadValueCallback cb)
+ {
+ assert(cb != null);
+
+ //
+ // Object references are encoded as a negative integer in 1.0.
+ //
+ int index = _stream.readInt();
+ if(index > 0)
+ {
+ throw new MarshalException("invalid object id");
+ }
+ index = -index;
+
+ if(index == 0)
+ {
+ cb.valueReady(null);
+ }
+ else
+ {
+ addPatchEntry(index, cb);
+ }
+ }
+
+ @Override
+ void throwException(UserExceptionFactory factory)
+ throws UserException
+ {
+ assert(_sliceType == SliceType.NoSlice);
+
+ //
+ // User exception with the 1.0 encoding start with a boolean flag
+ // that indicates whether or not the exception has classes.
+ //
+ // This allows reading the pending instances even if some part of
+ // the exception was sliced.
+ //
+ boolean usesClasses = _stream.readBool();
+
+ _sliceType = SliceType.ExceptionSlice;
+ _skipFirstSlice = false;
+
+ //
+ // Read the first slice header.
+ //
+ startSlice();
+ final String mostDerivedId = _typeId;
+ while(true)
+ {
+ UserException userEx = null;
+
+ //
+ // Use a factory if one was provided.
+ //
+ if(factory != null)
+ {
+ try
+ {
+ factory.createAndThrow(_typeId);
+ }
+ catch(UserException ex)
+ {
+ userEx = ex;
+ }
+ }
+
+ if(userEx == null)
+ {
+ userEx = _stream.createUserException(_typeId);
+ }
+
+ //
+ // We found the exception.
+ //
+ if(userEx != null)
+ {
+ userEx.__read(_stream);
+ if(usesClasses)
+ {
+ readPendingValues();
+ }
+ throw userEx;
+
+ // Never reached.
+ }
+
+ //
+ // Slice off what we don't understand.
+ //
+ skipSlice();
+ try
+ {
+ startSlice();
+ }
+ catch(UnmarshalOutOfBoundsException ex)
+ {
+ //
+ // An oversight in the 1.0 encoding means there is no marker to indicate
+ // the last slice of an exception. As a result, we just try to read the
+ // next type ID, which raises UnmarshalOutOfBoundsException when the
+ // input buffer underflows.
+ //
+ // Set the reason member to a more helpful message.
+ //
+ ex.reason = "unknown exception type `" + mostDerivedId + "'";
+ throw ex;
+ }
+ }
+ }
+
+ @Override
+ void startInstance(SliceType sliceType)
+ {
+ assert(_sliceType == sliceType);
+ _skipFirstSlice = true;
+ }
+
+ @Override
+ SlicedData endInstance(boolean preserve)
+ {
+ //
+ // Read the Ice::Object slice.
+ //
+ if(_sliceType == SliceType.ValueSlice)
+ {
+ startSlice();
+ int sz = _stream.readSize(); // For compatibility with the old AFM.
+ if(sz != 0)
+ {
+ throw new MarshalException("invalid Object slice");
+ }
+ endSlice();
+ }
+
+ _sliceType = SliceType.NoSlice;
+ return null;
+ }
+
+ @Override
+ String startSlice()
+ {
+ //
+ // If first slice, don't read the header, it was already read in
+ // readInstance or throwException to find the factory.
+ //
+ if(_skipFirstSlice)
+ {
+ _skipFirstSlice = false;
+ return _typeId;
+ }
+
+ //
+ // For class instances, first read the type ID boolean which indicates
+ // whether or not the type ID is encoded as a string or as an
+ // index. For exceptions, the type ID is always encoded as a
+ // string.
+ //
+ if(_sliceType == SliceType.ValueSlice) // For exceptions, the type ID is always encoded as a string
+ {
+ boolean isIndex = _stream.readBool();
+ _typeId = readTypeId(isIndex);
+ }
+ else
+ {
+ _typeId = _stream.readString();
+ }
+
+ _sliceSize = _stream.readInt();
+ if(_sliceSize < 4)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+
+ return _typeId;
+ }
+
+ @Override
+ void endSlice()
+ {
+ }
+
+ @Override
+ void skipSlice()
+ {
+ _stream.traceSkipSlice(_typeId, _sliceType);
+ assert(_sliceSize >= 4);
+ _stream.skip(_sliceSize - 4);
+ }
+
+ @Override
+ void readPendingValues()
+ {
+ int num;
+ do
+ {
+ num = _stream.readSize();
+ for(int k = num; k > 0; --k)
+ {
+ readInstance();
+ }
+ }
+ while(num > 0);
+
+ if(_patchMap != null && !_patchMap.isEmpty())
+ {
+ //
+ // If any entries remain in the patch map, the sender has sent an index for an object, but failed
+ // to supply the object.
+ //
+ throw new MarshalException("index for class received, but no instance");
+ }
+ }
+
+ private void readInstance()
+ {
+ int index = _stream.readInt();
+
+ if(index <= 0)
+ {
+ throw new MarshalException("invalid object id");
+ }
+
+ _sliceType = SliceType.ValueSlice;
+ _skipFirstSlice = false;
+
+ //
+ // Read the first slice header.
+ //
+ startSlice();
+ final String mostDerivedId = _typeId;
+ Value v = null;
+ while(true)
+ {
+ //
+ // For the 1.0 encoding, the type ID for the base Object class
+ // marks the last slice.
+ //
+ if(_typeId.equals(Value.ice_staticId))
+ {
+ throw new NoValueFactoryException("", mostDerivedId);
+ }
+
+ v = newInstance(_typeId);
+
+ //
+ // We found a factory, we get out of this loop.
+ //
+ if(v != null)
+ {
+ break;
+ }
+
+ //
+ // If slicing is disabled, stop unmarshaling.
+ //
+ if(!_sliceValues)
+ {
+ throw new NoValueFactoryException("no value factory found and slicing is disabled", _typeId);
+ }
+
+ //
+ // Slice off what we don't understand.
+ //
+ skipSlice();
+ startSlice(); // Read next Slice header for next iteration.
+ }
+
+ //
+ // Unmarshal the instance and add it to the map of unmarshaled instances.
+ //
+ unmarshal(index, v);
+ }
+
+ // Value/exception attributes
+ private SliceType _sliceType;
+ private boolean _skipFirstSlice;
+
+ // Slice attributes
+ private int _sliceSize;
+ private String _typeId;
+ }
+
+ private static class EncapsDecoder11 extends EncapsDecoder
+ {
+ EncapsDecoder11(InputStream stream, boolean sliceValues, ValueFactoryManager f, ClassResolver cr,
+ CompactIdResolver r)
+ {
+ super(stream, sliceValues, f, cr);
+ _compactIdResolver = r;
+ _current = null;
+ _valueIdIndex = 1;
+ }
+
+ @Override
+ void readValue(ReadValueCallback cb)
+ {
+ int index = _stream.readSize();
+ if(index < 0)
+ {
+ throw new MarshalException("invalid object id");
+ }
+ else if(index == 0)
+ {
+ if(cb != null)
+ {
+ cb.valueReady(null);
+ }
+ }
+ else if(_current != null && (_current.sliceFlags & Protocol.FLAG_HAS_INDIRECTION_TABLE) != 0)
+ {
+ //
+ // When reading a class instance within a slice and there's an
+ // indirect instance table, always read an indirect reference
+ // that points to an instance from the indirect instance table
+ // marshaled at the end of the Slice.
+ //
+ // Maintain a list of indirect references. Note that the
+ // indirect index starts at 1, so we decrement it by one to
+ // derive an index into the indirection table that we'll read
+ // at the end of the slice.
+ //
+ if(cb != null)
+ {
+ if(_current.indirectPatchList == null) // Lazy initialization
+ {
+ _current.indirectPatchList = new java.util.ArrayDeque<>();
+ }
+ IndirectPatchEntry e = new IndirectPatchEntry();
+ e.index = index - 1;
+ e.cb = cb;
+ _current.indirectPatchList.push(e);
+ }
+ }
+ else
+ {
+ readInstance(index, cb);
+ }
+ }
+
+ @Override
+ void throwException(UserExceptionFactory factory)
+ throws UserException
+ {
+ assert(_current == null);
+
+ push(SliceType.ExceptionSlice);
+
+ //
+ // Read the first slice header.
+ //
+ startSlice();
+ final String mostDerivedId = _current.typeId;
+ while(true)
+ {
+ UserException userEx = null;
+
+ //
+ // Use a factory if one was provided.
+ //
+ if(factory != null)
+ {
+ try
+ {
+ factory.createAndThrow(_current.typeId);
+ }
+ catch(UserException ex)
+ {
+ userEx = ex;
+ }
+ }
+
+ if(userEx == null)
+ {
+ userEx = _stream.createUserException(_current.typeId);
+ }
+
+ //
+ // We found the exception.
+ //
+ if(userEx != null)
+ {
+ userEx.__read(_stream);
+ throw userEx;
+
+ // Never reached.
+ }
+
+ //
+ // Slice off what we don't understand.
+ //
+ skipSlice();
+
+ if((_current.sliceFlags & Protocol.FLAG_IS_LAST_SLICE) != 0)
+ {
+ if(mostDerivedId.startsWith("::"))
+ {
+ throw new UnknownUserException(mostDerivedId.substring(2));
+ }
+ else
+ {
+ throw new UnknownUserException(mostDerivedId);
+ }
+ }
+
+ startSlice();
+ }
+ }
+
+ @Override
+ void startInstance(SliceType sliceType)
+ {
+ assert(_current.sliceType == sliceType);
+ _current.skipFirstSlice = true;
+ }
+
+ @Override
+ SlicedData endInstance(boolean preserve)
+ {
+ SlicedData slicedData = null;
+ if(preserve)
+ {
+ slicedData = readSlicedData();
+ }
+ if(_current.slices != null)
+ {
+ _current.slices.clear();
+ _current.indirectionTables.clear();
+ }
+ _current = _current.previous;
+ return slicedData;
+ }
+
+ @Override
+ String startSlice()
+ {
+ //
+ // If first slice, don't read the header, it was already read in
+ // readInstance or throwException to find the factory.
+ //
+ if(_current.skipFirstSlice)
+ {
+ _current.skipFirstSlice = false;
+ return _current.typeId;
+ }
+
+ _current.sliceFlags = _stream.readByte();
+
+ //
+ // Read the type ID, for value slices the type ID is encoded as a
+ // string or as an index, for exceptions it's always encoded as a
+ // string.
+ //
+ if(_current.sliceType == SliceType.ValueSlice)
+ {
+ if((_current.sliceFlags & Protocol.FLAG_HAS_TYPE_ID_COMPACT) ==
+ Protocol.FLAG_HAS_TYPE_ID_COMPACT) // Must be checked 1st!
+ {
+ _current.typeId = "";
+ _current.compactId = _stream.readSize();
+ }
+ else if((_current.sliceFlags & (Protocol.FLAG_HAS_TYPE_ID_INDEX |
+ Protocol.FLAG_HAS_TYPE_ID_STRING)) != 0)
+ {
+ _current.typeId =
+ readTypeId((_current.sliceFlags & Protocol.FLAG_HAS_TYPE_ID_INDEX) != 0);
+ _current.compactId = -1;
+ }
+ else
+ {
+ //
+ // Only the most derived slice encodes the type ID for the compact format.
+ //
+ _current.typeId = "";
+ _current.compactId = -1;
+ }
+ }
+ else
+ {
+ _current.typeId = _stream.readString();
+ _current.compactId = -1;
+ }
+
+ //
+ // Read the slice size if necessary.
+ //
+ if((_current.sliceFlags & Protocol.FLAG_HAS_SLICE_SIZE) != 0)
+ {
+ _current.sliceSize = _stream.readInt();
+ if(_current.sliceSize < 4)
+ {
+ throw new UnmarshalOutOfBoundsException();
+ }
+ }
+ else
+ {
+ _current.sliceSize = 0;
+ }
+
+ return _current.typeId;
+ }
+
+ @Override
+ void endSlice()
+ {
+ if((_current.sliceFlags & Protocol.FLAG_HAS_OPTIONAL_MEMBERS) != 0)
+ {
+ _stream.skipOptionals();
+ }
+
+ //
+ // Read the indirection table if one is present and transform the
+ // indirect patch list into patch entries with direct references.
+ //
+ if((_current.sliceFlags & Protocol.FLAG_HAS_INDIRECTION_TABLE) != 0)
+ {
+ //
+ // The table is written as a sequence<size> to conserve space.
+ //
+ int[] indirectionTable = new int[_stream.readAndCheckSeqSize(1)];
+ for(int i = 0; i < indirectionTable.length; ++i)
+ {
+ indirectionTable[i] = readInstance(_stream.readSize(), null);
+ }
+
+ //
+ // Sanity checks. If there are optional members, it's possible
+ // that not all instance references were read if they are from
+ // unknown optional data members.
+ //
+ if(indirectionTable.length == 0)
+ {
+ throw new MarshalException("empty indirection table");
+ }
+ if((_current.indirectPatchList == null || _current.indirectPatchList.isEmpty()) &&
+ (_current.sliceFlags & Protocol.FLAG_HAS_OPTIONAL_MEMBERS) == 0)
+ {
+ throw new MarshalException("no references to indirection table");
+ }
+
+ //
+ // Convert indirect references into direct references.
+ //
+ if(_current.indirectPatchList != null)
+ {
+ for(IndirectPatchEntry e : _current.indirectPatchList)
+ {
+ assert(e.index >= 0);
+ if(e.index >= indirectionTable.length)
+ {
+ throw new MarshalException("indirection out of range");
+ }
+ addPatchEntry(indirectionTable[e.index], e.cb);
+ }
+ _current.indirectPatchList.clear();
+ }
+ }
+ }
+
+ @Override
+ void skipSlice()
+ {
+ _stream.traceSkipSlice(_current.typeId, _current.sliceType);
+
+ int start = _stream.pos();
+
+ if((_current.sliceFlags & Protocol.FLAG_HAS_SLICE_SIZE) != 0)
+ {
+ assert(_current.sliceSize >= 4);
+ _stream.skip(_current.sliceSize - 4);
+ }
+ else
+ {
+ if(_current.sliceType == SliceType.ValueSlice)
+ {
+ throw new NoValueFactoryException("no value factory found and compact format prevents " +
+ "slicing (the sender should use the sliced format instead)",
+ _current.typeId);
+ }
+ else
+ {
+ if(_current.typeId.startsWith("::"))
+ {
+ throw new UnknownUserException(_current.typeId.substring(2));
+ }
+ else
+ {
+ throw new UnknownUserException(_current.typeId);
+ }
+ }
+ }
+
+ //
+ // Preserve this slice.
+ //
+ SliceInfo info = new SliceInfo();
+ info.typeId = _current.typeId;
+ info.compactId = _current.compactId;
+ info.hasOptionalMembers = (_current.sliceFlags & Protocol.FLAG_HAS_OPTIONAL_MEMBERS) != 0;
+ info.isLastSlice = (_current.sliceFlags & Protocol.FLAG_IS_LAST_SLICE) != 0;
+ java.nio.ByteBuffer b = _stream.getBuffer().b;
+ final int end = b.position();
+ int dataEnd = end;
+ if(info.hasOptionalMembers)
+ {
+ //
+ // Don't include the optional member end marker. It will be re-written by
+ // endSlice when the sliced data is re-written.
+ //
+ --dataEnd;
+ }
+ info.bytes = new byte[dataEnd - start];
+ b.position(start);
+ b.get(info.bytes);
+ b.position(end);
+
+ if(_current.slices == null) // Lazy initialization
+ {
+ _current.slices = new java.util.ArrayList<>();
+ _current.indirectionTables = new java.util.ArrayList<>();
+ }
+
+ //
+ // Read the indirect instance table. We read the instances or their
+ // IDs if the instance is a reference to an already unmarhsaled
+ // instance.
+ //
+ // The SliceInfo object sequence is initialized only if
+ // readSlicedData is called.
+ //
+
+ if((_current.sliceFlags & Protocol.FLAG_HAS_INDIRECTION_TABLE) != 0)
+ {
+ int[] indirectionTable = new int[_stream.readAndCheckSeqSize(1)];
+ for(int i = 0; i < indirectionTable.length; ++i)
+ {
+ indirectionTable[i] = readInstance(_stream.readSize(), null);
+ }
+ _current.indirectionTables.add(indirectionTable);
+ }
+ else
+ {
+ _current.indirectionTables.add(null);
+ }
+
+ _current.slices.add(info);
+ }
+
+ @Override
+ boolean readOptional(int readTag, OptionalFormat expectedFormat)
+ {
+ if(_current == null)
+ {
+ return _stream.readOptImpl(readTag, expectedFormat);
+ }
+ else if((_current.sliceFlags & Protocol.FLAG_HAS_OPTIONAL_MEMBERS) != 0)
+ {
+ return _stream.readOptImpl(readTag, expectedFormat);
+ }
+ return false;
+ }
+
+ private int readInstance(int index, ReadValueCallback cb)
+ {
+ assert(index > 0);
+
+ if(index > 1)
+ {
+ if(cb != null)
+ {
+ addPatchEntry(index, cb);
+ }
+ return index;
+ }
+
+ push(SliceType.ValueSlice);
+
+ //
+ // Get the instance ID before we start reading slices. If some
+ // slices are skipped, the indirect instance table is still read and
+ // might read other instances.
+ //
+ index = ++_valueIdIndex;
+
+ //
+ // Read the first slice header.
+ //
+ startSlice();
+ final String mostDerivedId = _current.typeId;
+ Value v = null;
+ while(true)
+ {
+ boolean updateCache = false;
+
+ if(_current.compactId >= 0)
+ {
+ updateCache = true;
+
+ //
+ // Translate a compact (numeric) type ID into a class.
+ //
+ if(_compactIdCache == null)
+ {
+ _compactIdCache = new java.util.TreeMap<>(); // Lazy initialization.
+ }
+ else
+ {
+ //
+ // Check the cache to see if we've already translated the compact type ID into a class.
+ //
+ Class<?> cls = _compactIdCache.get(_current.compactId);
+ if(cls != null)
+ {
+ try
+ {
+ v = (Value)cls.newInstance();
+ updateCache = false;
+ }
+ catch(java.lang.Exception ex)
+ {
+ throw new NoValueFactoryException("no value factory", "compact ID " +
+ _current.compactId, ex);
+ }
+ }
+ }
+
+ //
+ // If we haven't already cached a class for the compact ID, then try to translate the
+ // compact ID into a type ID.
+ //
+ if(v == null)
+ {
+ _current.typeId = "";
+ if(_compactIdResolver != null)
+ {
+ try
+ {
+ _current.typeId = _compactIdResolver.resolve(_current.compactId);
+ }
+ catch(LocalException ex)
+ {
+ throw ex;
+ }
+ catch(Throwable ex)
+ {
+ throw new MarshalException("exception in CompactIdResolver for ID " +
+ _current.compactId, ex);
+ }
+ }
+
+ if(_current.typeId.isEmpty())
+ {
+ _current.typeId = _stream.instance().resolveCompactId(_current.compactId);
+ }
+ }
+ }
+
+ if(v == null && !_current.typeId.isEmpty())
+ {
+ v = newInstance(_current.typeId);
+ }
+
+ if(v != null)
+ {
+ if(updateCache)
+ {
+ assert(_current.compactId >= 0);
+ _compactIdCache.put(_current.compactId, v.getClass());
+ }
+
+ //
+ // We have an instance, get out of this loop.
+ //
+ break;
+ }
+
+ //
+ // If slicing is disabled, stop unmarshaling.
+ //
+ if(!_sliceValues)
+ {
+ throw new NoValueFactoryException("no value factory found and slicing is disabled",
+ _current.typeId);
+ }
+
+ //
+ // Slice off what we don't understand.
+ //
+ skipSlice();
+
+ //
+ // If this is the last slice, keep the instance as an opaque
+ // UnknownSlicedValue object.
+ //
+ if((_current.sliceFlags & Protocol.FLAG_IS_LAST_SLICE) != 0)
+ {
+ //
+ // Provide a factory with an opportunity to supply the instance.
+ // We pass the "::Ice::Object" ID to indicate that this is the
+ // last chance to preserve the instance.
+ //
+ v = newInstance(Value.ice_staticId);
+ if(v == null)
+ {
+ v = new UnknownSlicedValue(mostDerivedId);
+ }
+
+ break;
+ }
+
+ startSlice(); // Read next Slice header for next iteration.
+ }
+
+ //
+ // Unmarshal the instance.
+ //
+ unmarshal(index, v);
+
+ if(_current == null && _patchMap != null && !_patchMap.isEmpty())
+ {
+ //
+ // If any entries remain in the patch map, the sender has sent an index for an instance, but failed
+ // to supply the instance.
+ //
+ throw new MarshalException("index for class received, but no instance");
+ }
+
+ if(cb != null)
+ {
+ cb.valueReady(v);
+ }
+
+ return index;
+ }
+
+ private SlicedData readSlicedData()
+ {
+ if(_current.slices == null) // No preserved slices.
+ {
+ return null;
+ }
+
+ //
+ // The _indirectionTables member holds the indirection table for each slice
+ // in _slices.
+ //
+ assert(_current.slices.size() == _current.indirectionTables.size());
+ for(int n = 0; n < _current.slices.size(); ++n)
+ {
+ //
+ // We use the "instances" list in SliceInfo to hold references
+ // to the target instances. Note that the instances might not have
+ // been read yet in the case of a circular reference to an
+ // enclosing instance.
+ //
+ final int[] table = _current.indirectionTables.get(n);
+ SliceInfo info = _current.slices.get(n);
+ info.instances = new Value[table != null ? table.length : 0];
+ for(int j = 0; j < info.instances.length; ++j)
+ {
+ addPatchEntry(table[j],
+ new SequencePatcher<Value>(info.instances, Value.class, Value.ice_staticId, j));
+ }
+ }
+
+ SliceInfo[] arr = new SliceInfo[_current.slices.size()];
+ _current.slices.toArray(arr);
+ return new SlicedData(arr);
+ }
+
+ private void push(SliceType sliceType)
+ {
+ if(_current == null)
+ {
+ _current = new InstanceData(null);
+ }
+ else
+ {
+ _current = _current.next == null ? new InstanceData(_current) : _current.next;
+ }
+ _current.sliceType = sliceType;
+ _current.skipFirstSlice = false;
+ }
+
+ private static final class IndirectPatchEntry
+ {
+ int index;
+ ReadValueCallback cb;
+ }
+
+ private static final class InstanceData
+ {
+ InstanceData(InstanceData previous)
+ {
+ if(previous != null)
+ {
+ previous.next = this;
+ }
+ this.previous = previous;
+ this.next = null;
+ }
+
+ // Instance attributes
+ SliceType sliceType;
+ boolean skipFirstSlice;
+ java.util.List<SliceInfo> slices; // Preserved slices.
+ java.util.List<int[]> indirectionTables;
+
+ // Slice attributes
+ byte sliceFlags;
+ int sliceSize;
+ String typeId;
+ int compactId;
+ java.util.Deque<IndirectPatchEntry> indirectPatchList;
+
+ final InstanceData previous;
+ InstanceData next;
+ }
+
+ private CompactIdResolver _compactIdResolver;
+ private InstanceData _current;
+ private int _valueIdIndex; // The ID of the next instance to unmarshal.
+ private java.util.TreeMap<Integer, Class<?> > _compactIdCache; // Cache of compact type IDs.
+ }
+
+ private static final class Encaps
+ {
+ void reset()
+ {
+ decoder = null;
+ }
+
+ void setEncoding(EncodingVersion encoding)
+ {
+ this.encoding = encoding;
+ encoding_1_0 = encoding.equals(Util.Encoding_1_0);
+ }
+
+ int start;
+ int sz;
+ EncodingVersion encoding;
+ boolean encoding_1_0;
+
+ EncapsDecoder decoder;
+
+ Encaps next;
+ }
+
+ //
+ // The encoding version to use when there's no encapsulation to
+ // read from. This is for example used to read message headers.
+ //
+ private EncodingVersion _encoding;
+
+ private boolean isEncoding_1_0()
+ {
+ return _encapsStack != null ? _encapsStack.encoding_1_0 : _encoding.equals(Util.Encoding_1_0);
+ }
+
+ private Encaps _encapsStack;
+ private Encaps _encapsCache;
+
+ private void initEncaps()
+ {
+ if(_encapsStack == null) // Lazy initialization
+ {
+ _encapsStack = _encapsCache;
+ if(_encapsStack != null)
+ {
+ _encapsCache = _encapsCache.next;
+ }
+ else
+ {
+ _encapsStack = new Encaps();
+ }
+ _encapsStack.setEncoding(_encoding);
+ _encapsStack.sz = _buf.b.limit();
+ }
+
+ if(_encapsStack.decoder == null) // Lazy initialization.
+ {
+ if(_encapsStack.encoding_1_0)
+ {
+ _encapsStack.decoder = new EncapsDecoder10(this, _sliceValues, _valueFactoryManager, _classResolver);
+ }
+ else
+ {
+ _encapsStack.decoder = new EncapsDecoder11(this, _sliceValues, _valueFactoryManager, _classResolver,
+ _compactIdResolver);
+ }
+ }
+ }
+
+ private void traceSkipSlice(String typeId, SliceType sliceType)
+ {
+ if(_traceSlicing && _logger != null)
+ {
+ com.zeroc.IceInternal.TraceUtil.traceSlicing(
+ sliceType == SliceType.ExceptionSlice ? "exception" : "object", typeId, "Slicing", _logger);
+ }
+ }
+
+ @FunctionalInterface
+ static public interface Unmarshaler
+ {
+ void unmarshal(InputStream istr);
+ }
+
+ private boolean _sliceValues;
+ private boolean _traceSlicing;
+
+ private int _startSeq;
+ private int _minSeqSize;
+
+ private ValueFactoryManager _valueFactoryManager;
+ private Logger _logger;
+ private CompactIdResolver _compactIdResolver;
+ private ClassResolver _classResolver;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/InvocationFuture.java b/java/src/Ice/src/main/java/com/zeroc/Ice/InvocationFuture.java
new file mode 100644
index 00000000000..86a303e7656
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/InvocationFuture.java
@@ -0,0 +1,131 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.Executor;
+
+/**
+ * An instance of an InvocationFuture subclass is the return value of an asynchronous invocation.
+ * With this object, an application can obtain several attributes of the invocation.
+ **/
+public abstract class InvocationFuture<T> extends CompletableFuture<T>
+{
+ /**
+ * If not completed, cancels the request. This is a local
+ * operation, it won't cancel the request on the server side.
+ * Calling <code>cancel</code> prevents a queued request from
+ * being sent or ignores a reply if the request has already
+ * been sent.
+ *
+ * @return True if this task is now cancelled.
+ **/
+ public abstract boolean cancel();
+
+ /**
+ * Returns the communicator that sent the invocation.
+ *
+ * @return The communicator.
+ **/
+ public abstract Communicator getCommunicator();
+
+ /**
+ * Returns the connection that was used to start the invocation, or nil
+ * if this future was not obtained via an asynchronous connection invocation
+ * (such as <code>flushBatchRequestsAsync</code>).
+ *
+ * @return The connection.
+ **/
+ public abstract Connection getConnection();
+
+ /**
+ * Returns the proxy that was used to start the asynchronous invocation, or nil
+ * if this object was not obtained via an asynchronous proxy invocation.
+ *
+ * @return The proxy.
+ **/
+ public abstract ObjectPrx getProxy();
+
+ /**
+ * Returns the name of the operation.
+ *
+ * @return The operation name.
+ **/
+ public abstract String getOperation();
+
+ /**
+ * Blocks the caller until the result of the invocation is available.
+ **/
+ public abstract void waitForCompleted();
+
+ /**
+ * When you start an asynchronous invocation, the Ice run time attempts to
+ * write the corresponding request to the client-side transport. If the
+ * transport cannot accept the request, the Ice run time queues the request
+ * for later transmission. This method returns true if, at the time it is called,
+ * the request has been written to the local transport (whether it was initially
+ * queued or not). Otherwise, if the request is still queued, this method returns
+ * false.
+ *
+ * @return True if the request has been sent, or false if the request is queued.
+ **/
+ public abstract boolean isSent();
+
+ /**
+ * Blocks the caller until the request has been written to the client-side transport.
+ **/
+ public abstract void waitForSent();
+
+ /**
+ * Returns true if a request was written to the client-side
+ * transport without first being queued. If the request was initially
+ * queued, this method returns false (independent of whether the request
+ * is still in the queue or has since been written to the client-side transport).
+ *
+ * @return True if the request was sent without being queued, or false
+ * otherwise.
+ **/
+ public abstract boolean sentSynchronously();
+
+ /**
+ * Returns a future that completes when the entire request message has been
+ * accepted by the transport and executes the given action. The boolean value
+ * indicates whether the message was sent synchronously.
+ *
+ * @param action Executed when the future is completed successfully or exceptionally.
+ * @return A future that completes when the message has been handed off to the transport.
+ **/
+ public abstract CompletableFuture<Boolean> whenSent(
+ java.util.function.BiConsumer<Boolean, ? super Throwable> action);
+
+ /**
+ * Returns a future that completes when the entire request message has been
+ * accepted by the transport and executes the given action using the default executor. The boolean value
+ * indicates whether the message was sent synchronously.
+ *
+ * @param action Executed when the future is completed successfully or exceptionally.
+ * @return A future that completes when the message has been handed off to the transport.
+ **/
+ public abstract CompletableFuture<Boolean> whenSentAsync(
+ java.util.function.BiConsumer<Boolean, ? super Throwable> action);
+
+ /**
+ * Returns a future that completes when the entire request message has been
+ * accepted by the transport and executes the given action using the executor. The boolean value
+ * indicates whether the message was sent synchronously.
+ *
+ * @param action Executed when the future is completed successfully or exceptionally.
+ * @param executor The executor to use for asynchronous execution.
+ * @return A future that completes when the message has been handed off to the transport.
+ **/
+ public abstract CompletableFuture<Boolean> whenSentAsync(
+ java.util.function.BiConsumer<Boolean, ? super Throwable> action,
+ Executor executor);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/LocalException.java b/java/src/Ice/src/main/java/com/zeroc/Ice/LocalException.java
new file mode 100644
index 00000000000..5056dacf449
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/LocalException.java
@@ -0,0 +1,25 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * Base class for all Ice run-time exceptions.
+ **/
+public abstract class LocalException extends Exception
+{
+ public LocalException()
+ {
+ }
+
+ public LocalException(Throwable cause)
+ {
+ super(cause);
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/LoggerI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/LoggerI.java
new file mode 100644
index 00000000000..c2e2aed82d2
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/LoggerI.java
@@ -0,0 +1,163 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+public class LoggerI implements Logger
+{
+ public
+ LoggerI(String prefix, String file)
+ {
+ _prefix = prefix;
+
+ if(prefix.length() > 0)
+ {
+ _formattedPrefix = prefix + ": ";
+ }
+
+ _lineSeparator = System.getProperty("line.separator");
+ _date = java.text.DateFormat.getDateInstance(java.text.DateFormat.SHORT);
+ _time = new java.text.SimpleDateFormat(" HH:mm:ss:SSS");
+
+ if(file.length() != 0)
+ {
+ _file = file;
+ try
+ {
+ _out = new java.io.FileOutputStream(new java.io.File(_file), true);
+ }
+ catch(java.io.FileNotFoundException ex)
+ {
+ throw new InitializationException("FileLogger: cannot open " + _file);
+ }
+ }
+ }
+
+ @Override
+ public void
+ print(String message)
+ {
+ StringBuilder s = new StringBuilder(256);
+ s.append(message);
+ write(s, false);
+ }
+
+ @Override
+ public void
+ trace(String category, String message)
+ {
+ StringBuilder s = new StringBuilder(256);
+ s.append("-- ");
+ synchronized(this)
+ {
+ java.util.Date date = new java.util.Date();
+ s.append(_date.format(date));
+ s.append(_time.format(date));
+ }
+ s.append(' ');
+ s.append(_formattedPrefix);
+ s.append(category);
+ s.append(": ");
+ s.append(message);
+ write(s, true);
+ }
+
+ @Override
+ public void
+ warning(String message)
+ {
+ StringBuilder s = new StringBuilder(256);
+ s.append("-! ");
+ synchronized(this)
+ {
+ s.append(_date.format(new java.util.Date()));
+ s.append(_time.format(new java.util.Date()));
+ }
+ s.append(' ');
+ s.append(_formattedPrefix);
+ s.append("warning: ");
+ s.append(Thread.currentThread().getName());
+ s.append(": ");
+ s.append(message);
+ write(s, true);
+ }
+
+ @Override
+ public void
+ error(String message)
+ {
+ StringBuilder s = new StringBuilder(256);
+ s.append("!! ");
+ synchronized(this)
+ {
+ s.append(_date.format(new java.util.Date()));
+ s.append(_time.format(new java.util.Date()));
+ }
+ s.append(' ');
+ s.append(_formattedPrefix);
+ s.append("error: ");
+ s.append(Thread.currentThread().getName());
+ s.append(": ");
+ s.append(message);
+ write(s, true);
+ }
+
+
+ @Override
+ public String
+ getPrefix()
+ {
+ return _prefix;
+ }
+
+ @Override
+ public Logger
+ cloneWithPrefix(String prefix)
+ {
+ return new LoggerI(prefix, _file);
+ }
+
+ private void
+ write(StringBuilder message, boolean indent)
+ {
+ if(indent)
+ {
+ int idx = 0;
+ while((idx = message.indexOf("\n", idx)) != -1)
+ {
+ message.insert(idx + 1, " ");
+ ++idx;
+ }
+ }
+ message.append(_lineSeparator);
+
+ if(_out == null)
+ {
+ System.err.print(message.toString());
+ }
+ else
+ {
+ try
+ {
+ _out.write(message.toString().getBytes());
+ }
+ catch(java.io.IOException ex)
+ {
+ }
+ }
+ }
+
+ String _prefix = "";
+ String _formattedPrefix = "";
+ String _file = "";
+ String _lineSeparator;
+ java.text.DateFormat _date;
+ java.text.SimpleDateFormat _time;
+ java.io.FileOutputStream _out = null;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/LoggerPlugin.java b/java/src/Ice/src/main/java/com/zeroc/Ice/LoggerPlugin.java
new file mode 100644
index 00000000000..e78c46ef383
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/LoggerPlugin.java
@@ -0,0 +1,70 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * Class to support custom loggers. Applications using a custom logger
+ * instantiate a <code>LoggerPlugin</code> with a custom logger and
+ * return the instance from their {@link PluginFactory} implementation.
+ *
+ * @see PluginFactory
+ * @see Plugin
+ **/
+public class LoggerPlugin implements Plugin
+{
+ /**
+ * Installs a custom logger for a communicator.
+ *
+ * @param communicator The communicator using the custom logger.
+ * @param logger The custom logger for the communicator.
+ **/
+ public
+ LoggerPlugin(Communicator communicator, Logger logger)
+ {
+ if(communicator == null)
+ {
+ PluginInitializationException ex = new PluginInitializationException();
+ ex.reason = "Communicator cannot be null";
+ throw ex;
+ }
+
+ if(logger == null)
+ {
+ PluginInitializationException ex = new PluginInitializationException();
+ ex.reason = "Logger cannot be null";
+ throw ex;
+ }
+
+ com.zeroc.IceInternal.Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator);
+ instance.setLogger(logger);
+ }
+
+ /**
+ * Called by the Ice run time during communicator initialization. The derived class
+ * can override this method to perform any initialization that might be required
+ * by a custom logger.
+ **/
+ @Override
+ public void
+ initialize()
+ {
+ }
+
+ /**
+ * Called by the Ice run time when the communicator is destroyed. The derived class
+ * can override this method to perform any finalization that might be required
+ * by a custom logger.
+ **/
+ @Override
+ public void
+ destroy()
+ {
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/MarshaledResult.java b/java/src/Ice/src/main/java/com/zeroc/Ice/MarshaledResult.java
new file mode 100644
index 00000000000..84cccff3887
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/MarshaledResult.java
@@ -0,0 +1,12 @@
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+public interface MarshaledResult
+{
+ OutputStream getOutputStream();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/NativePropertiesAdmin.java b/java/src/Ice/src/main/java/com/zeroc/Ice/NativePropertiesAdmin.java
new file mode 100644
index 00000000000..6c163f26f6d
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/NativePropertiesAdmin.java
@@ -0,0 +1,16 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+public interface NativePropertiesAdmin
+{
+ void addUpdateCallback(PropertiesAdminUpdateCallback callback);
+ void removeUpdateCallback(PropertiesAdminUpdateCallback callback);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/Object.java b/java/src/Ice/src/main/java/com/zeroc/Ice/Object.java
new file mode 100644
index 00000000000..92e17bcfa79
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/Object.java
@@ -0,0 +1,320 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+import java.util.concurrent.CompletionStage;
+
+import com.zeroc.IceInternal.Incoming;
+
+/**
+ * The base interface for servants.
+ **/
+public interface Object
+{
+ public static final String ice_staticId = "::Ice::Object";
+
+ public final static String[] __ids =
+ {
+ ice_staticId
+ };
+
+ /**
+ * Holds the results of a call to <code>ice_invoke</code>.
+ **/
+ public class Ice_invokeResult
+ {
+ /**
+ * Default initializes the members.
+ **/
+ public Ice_invokeResult()
+ {
+ }
+
+ /**
+ * One-shot constructor to initialize the members.
+ *
+ * @param returnValue True for a succesful invocation with any results encoded in <code>outParams</code>.
+ * False if a user exception occurred with the exception encoded in <code>outParams</code>.
+ * @param outParams The encoded results.
+ **/
+ public Ice_invokeResult(boolean returnValue, byte[] outParams)
+ {
+ this.returnValue = returnValue;
+ this.outParams = outParams;
+ }
+
+ /**
+ * If the operation completed successfully, the return value
+ * is <code>true</code>. If the operation raises a user exception,
+ * the return value is <code>false</code>; in this case, <code>outParams</code>
+ * contains the encoded user exception. If the operation raises a run-time exception,
+ * it throws it directly.
+ **/
+ public boolean returnValue;
+
+ /**
+ * The encoded out-paramaters and return value for the operation. The return value
+ * follows any out-parameters.
+ **/
+ public byte[] outParams;
+ }
+
+ /**
+ * Tests whether this object supports a specific Slice interface.
+ *
+ * @param s The type ID of the Slice interface to test against.
+ * @param current The {@link Current} object for the invocation.
+ * @return <code>true</code> if this object has the interface
+ * specified by <code>s</code> or derives from the interface
+ * specified by <code>s</code>.
+ **/
+ default boolean ice_isA(String s, Current current)
+ {
+ return java.util.Arrays.binarySearch(ice_ids(current), s) >= 0;
+ }
+
+ /**
+ * Tests whether this object can be reached.
+ *
+ * @param current The {@link Current} object for the invocation.
+ **/
+ default void ice_ping(Current current)
+ {
+ // Nothing to do.
+ }
+
+ /**
+ * Returns the Slice type IDs of the interfaces supported by this object.
+ *
+ * @param current The {@link Current} object for the invocation.
+ * @return The Slice type IDs of the interfaces supported by this object, in base-to-derived
+ * order. The first element of the returned array is always <code>::Ice::Object</code>.
+ **/
+ default String[] ice_ids(Current current)
+ {
+ return __ids;
+ }
+
+ /**
+ * Returns the Slice type ID of the most-derived interface supported by this object.
+ *
+ * @param current The {@link Current} object for the invocation.
+ * @return The Slice type ID of the most-derived interface.
+ **/
+ default String ice_id(Current current)
+ {
+ return __ids[0];
+ }
+
+ /**
+ * Returns the Slice type ID of the interface supported by this object.
+ *
+ * @return The return value is always ::Ice::Object.
+ **/
+ public static String ice_staticId()
+ {
+ return ice_staticId;
+ }
+
+ /**
+ * Returns the Freeze metadata attributes for an operation.
+ *
+ * @param operation The name of the operation.
+ * @return The least significant bit indicates whether the operation is a read
+ * or write operation. If the bit is set, the operation is a write operation.
+ * The expression <code>ice_operationAttributes("op") & 0x1</code> is true if
+ * the operation has a <code>["freeze:write"]</code> metadata directive.
+ * <p>
+ * The second- and third least significant bit indicate the transactional mode
+ * of the operation. The expression <code>ice_operationAttributes("op") & 0x6 >> 1</code>
+ * indicates the transactional mode as follows:
+ * <dl>
+ * <dt>0</dt>
+ * <dd><code>["freeze:read:supports"]</code></dd>
+ * <dt>1</dt>
+ * <dd><code>["freeze:read:mandatory"]</code> or <code>["freeze:write:mandatory"]</code></dd>
+ * <dt>2</dt>
+ * <dd><code>["freeze:read:required"]</code> or <code>["freeze:write:required"]</code></dd>
+ * <dt>3</dt>
+ * <dd><code>["freeze:read:never"]</code></dd>
+ * </dl>
+ *
+ * Refer to the Freeze manual for more information on the TransactionalEvictor.
+ **/
+ default int ice_operationAttributes(String operation)
+ {
+ return 0;
+ }
+
+ final static String[] __ops =
+ {
+ "ice_id",
+ "ice_ids",
+ "ice_isA",
+ "ice_ping"
+ };
+
+ /**
+ * Dispatches an invocation to a servant. This method is used by dispatch interceptors to forward an invocation
+ * to a servant (or to another interceptor).
+ *
+ * @param request The details of the invocation.
+ * @return A completion stage if the dispatched asynchronously, null otherwise.
+ *
+ * @see DispatchInterceptor
+ **/
+ default CompletionStage<OutputStream> ice_dispatch(Request request)
+ throws UserException
+ {
+ Incoming in = (Incoming)request;
+ in.startOver();
+ return __dispatch(in, in.getCurrent());
+ }
+
+ default CompletionStage<OutputStream> __dispatch(Incoming in, Current current)
+ throws UserException
+ {
+ int pos = java.util.Arrays.binarySearch(__ops, current.operation);
+ if(pos < 0)
+ {
+ throw new OperationNotExistException(current.id, current.facet, current.operation);
+ }
+
+ switch(pos)
+ {
+ case 0:
+ {
+ return ___ice_id(this, in, current);
+ }
+ case 1:
+ {
+ return ___ice_ids(this, in, current);
+ }
+ case 2:
+ {
+ return ___ice_isA(this, in, current);
+ }
+ case 3:
+ {
+ return ___ice_ping(this, in, current);
+ }
+ }
+
+ assert(false);
+ throw new OperationNotExistException(current.id, current.facet, current.operation);
+ }
+
+ default void __write(OutputStream __os)
+ {
+ __os.startValue(null);
+ __writeImpl(__os);
+ __os.endValue();
+ }
+
+ default void __writeImpl(OutputStream __os)
+ {
+ }
+
+ default void __read(InputStream __is)
+ {
+ __is.startValue();
+ __readImpl(__is);
+ __is.endValue(false);
+ }
+
+ default void __readImpl(InputStream __is)
+ {
+ }
+
+ static CompletionStage<OutputStream> ___ice_isA(Object __obj, Incoming __inS, Current __current)
+ {
+ InputStream __is = __inS.startReadParams();
+ String __id = __is.readString();
+ __inS.endReadParams();
+ boolean __ret = __obj.ice_isA(__id, __current);
+ OutputStream __os = __inS.startWriteParams();
+ __os.writeBool(__ret);
+ __inS.endWriteParams(__os);
+ return __inS.setResult(__os);
+ }
+
+ static CompletionStage<OutputStream> ___ice_ping(Object __obj, Incoming __inS, Current __current)
+ {
+ __inS.readEmptyParams();
+ __obj.ice_ping(__current);
+ return __inS.setResult(__inS.writeEmptyParams());
+ }
+
+ static CompletionStage<OutputStream> ___ice_ids(Object __obj, Incoming __inS, Current __current)
+ {
+ __inS.readEmptyParams();
+ String[] __ret = __obj.ice_ids(__current);
+ OutputStream __os = __inS.startWriteParams();
+ __os.writeStringSeq(__ret);
+ __inS.endWriteParams(__os);
+ return __inS.setResult(__os);
+ }
+
+ static CompletionStage<OutputStream> ___ice_id(Object __obj, Incoming __inS, Current __current)
+ {
+ __inS.readEmptyParams();
+ String __ret = __obj.ice_id(__current);
+ OutputStream __os = __inS.startWriteParams();
+ __os.writeString(__ret);
+ __inS.endWriteParams(__os);
+ return __inS.setResult(__os);
+ }
+
+ static String __operationModeToString(OperationMode mode)
+ {
+ if(mode == OperationMode.Normal)
+ {
+ return "::Ice::Normal";
+ }
+ if(mode == OperationMode.Nonmutating)
+ {
+ return "::Ice::Nonmutating";
+ }
+
+ if(mode == OperationMode.Idempotent)
+ {
+ return "::Ice::Idempotent";
+ }
+
+ return "???";
+ }
+
+ static void __checkMode(OperationMode expected, OperationMode received)
+ {
+ if(expected == null)
+ {
+ expected = OperationMode.Normal;
+ }
+
+ if(expected != received)
+ {
+ if(expected == OperationMode.Idempotent && received == OperationMode.Nonmutating)
+ {
+ //
+ // Fine: typically an old client still using the
+ // deprecated nonmutating keyword
+ //
+ }
+ else
+ {
+ MarshalException ex = new MarshalException();
+ ex.reason = "unexpected operation mode. expected = "
+ + __operationModeToString(expected) + " received = "
+ + __operationModeToString(received);
+ throw ex;
+ }
+ }
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/ObjectAdapterI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ObjectAdapterI.java
new file mode 100644
index 00000000000..61cf6d72537
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ObjectAdapterI.java
@@ -0,0 +1,1559 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+import java.util.Map;
+import java.util.List;
+import java.util.ArrayList;
+
+import com.zeroc.IceInternal.IncomingConnectionFactory;
+
+public final class ObjectAdapterI implements ObjectAdapter
+{
+ @Override
+ public String
+ getName()
+ {
+ //
+ // No mutex lock necessary, _name is immutable.
+ //
+ return _noConfig ? "" : _name;
+ }
+
+ @Override
+ public Communicator
+ getCommunicator()
+ {
+ return _communicator;
+ }
+
+ @Override
+ public void
+ activate()
+ {
+ com.zeroc.IceInternal.LocatorInfo locatorInfo = null;
+ boolean printAdapterReady = false;
+
+ synchronized(this)
+ {
+ checkForDeactivation();
+
+ //
+ // If we've previously been initialized we just need to activate the
+ // incoming connection factories and we're done.
+ //
+ if(_state != StateUninitialized)
+ {
+ for(IncomingConnectionFactory factory : _incomingConnectionFactories)
+ {
+ factory.activate();
+ }
+ return;
+ }
+
+ //
+ // One off initializations of the adapter: update the
+ // locator registry and print the "adapter ready"
+ // message. We set set state to StateActivating to prevent
+ // deactivation from other threads while these one off
+ // initializations are done.
+ //
+ _state = StateActivating;
+
+ locatorInfo = _locatorInfo;
+ if(!_noConfig)
+ {
+ final Properties properties = _instance.initializationData().properties;
+ printAdapterReady = properties.getPropertyAsInt("Ice.PrintAdapterReady") > 0;
+ }
+ }
+
+ try
+ {
+ Identity dummy = new Identity();
+ dummy.name = "dummy";
+ updateLocatorRegistry(locatorInfo, createDirectProxy(dummy));
+ }
+ catch(LocalException ex)
+ {
+ //
+ // If we couldn't update the locator registry, we let the
+ // exception go through and don't activate the adapter to
+ // allow to user code to retry activating the adapter
+ // later.
+ //
+ synchronized(this)
+ {
+ _state = StateUninitialized;
+ notifyAll();
+ }
+ throw ex;
+ }
+
+ if(printAdapterReady)
+ {
+ System.out.println(_name + " ready");
+ }
+
+ synchronized(this)
+ {
+ assert(_state == StateActivating);
+
+ //
+ // Signal threads waiting for the activation.
+ //
+ _state = StateActive;
+ notifyAll();
+
+ for(IncomingConnectionFactory factory : _incomingConnectionFactories)
+ {
+ factory.activate();
+ }
+ }
+ }
+
+ @Override
+ public synchronized void
+ hold()
+ {
+ checkForDeactivation();
+ _state = StateHeld;
+ for(IncomingConnectionFactory factory : _incomingConnectionFactories)
+ {
+ factory.hold();
+ }
+ }
+
+ @Override
+ public void
+ waitForHold()
+ {
+ if(Thread.interrupted())
+ {
+ throw new OperationInterruptedException();
+ }
+
+ List<IncomingConnectionFactory> incomingConnectionFactories;
+ synchronized(this)
+ {
+ checkForDeactivation();
+ incomingConnectionFactories = new ArrayList<>(_incomingConnectionFactories);
+ }
+
+ for(IncomingConnectionFactory factory : incomingConnectionFactories)
+ {
+ try
+ {
+ factory.waitUntilHolding();
+ }
+ catch(InterruptedException ex)
+ {
+ throw new OperationInterruptedException();
+ }
+ }
+ }
+
+
+ @Override
+ public void
+ deactivate()
+ {
+ if(Thread.interrupted())
+ {
+ throw new OperationInterruptedException();
+ }
+
+ synchronized(this)
+ {
+ //
+ // Wait for activation to complete. This is necessary to
+ // not get out of order locator updates.
+ //
+ while(_state == StateActivating)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ throw new OperationInterruptedException();
+ }
+ }
+ if(_state > StateDeactivating)
+ {
+ return;
+ }
+ _state = StateDeactivating;
+ }
+
+ //
+ // NOTE: the router/locator infos and incoming connection
+ // facatory list are immutable at this point.
+ //
+
+ if(_routerInfo != null)
+ {
+ //
+ // Remove entry from the router manager.
+ //
+ _instance.routerManager().erase(_routerInfo.getRouter());
+
+ //
+ // Clear this object adapter with the router.
+ //
+ _routerInfo.setAdapter(null);
+ }
+
+ try
+ {
+ updateLocatorRegistry(_locatorInfo, null);
+ }
+ catch(LocalException ex)
+ {
+ //
+ // We can't throw exceptions in deactivate so we ignore
+ // failures to update the locator registry.
+ //
+ }
+
+ //
+ // Must be called outside the thread synchronization, because
+ // Connection::destroy() might block when sending a
+ // CloseConnection message.
+ //
+ for(IncomingConnectionFactory factory : _incomingConnectionFactories)
+ {
+ factory.destroy();
+ }
+
+ //
+ // Must be called outside the thread synchronization, because
+ // changing the object adapter might block if there are still
+ // requests being dispatched.
+ //
+ _instance.outgoingConnectionFactory().removeAdapter(this);
+
+ synchronized(this)
+ {
+ _state = StateDeactivated;
+ notifyAll();
+ }
+ }
+
+ @Override
+ public void
+ waitForDeactivate()
+ {
+ if(Thread.interrupted())
+ {
+ throw new OperationInterruptedException();
+ }
+
+ try
+ {
+ List<IncomingConnectionFactory> incomingConnectionFactories;
+ synchronized(this)
+ {
+ //
+ // Wait for deactivation of the adapter itself, and
+ // for the return of all direct method calls using
+ // this adapter.
+ //
+ while((_state < StateDeactivated) || _directCount > 0)
+ {
+ wait();
+ }
+ if(_state > StateDeactivated)
+ {
+ return;
+ }
+ incomingConnectionFactories = new ArrayList<>(_incomingConnectionFactories);
+ }
+
+ //
+ // Now we wait for until all incoming connection factories are
+ // finished (the incoming connection factory list is immutable
+ // at this point).
+ //
+ for(IncomingConnectionFactory f : incomingConnectionFactories)
+ {
+ f.waitUntilFinished();
+ }
+ }
+ catch(InterruptedException e)
+ {
+ throw new OperationInterruptedException();
+ }
+ }
+
+ @Override
+ public synchronized boolean
+ isDeactivated()
+ {
+ return _state >= StateDeactivated;
+ }
+
+ @Override
+ public void
+ destroy()
+ {
+ if(Thread.interrupted())
+ {
+ throw new OperationInterruptedException();
+ }
+
+ //
+ // Deactivate and wait for completion.
+ //
+ deactivate();
+ waitForDeactivate();
+
+ synchronized(this)
+ {
+ assert(_state >= StateDeactivated);
+
+ //
+ // Only a single thread is allowed to destroy the object
+ // adapter. Other threads wait for the destruction to be
+ // completed.
+ //
+ while(_state == StateDestroying)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ throw new OperationInterruptedException();
+ }
+ }
+ if(_state == StateDestroyed)
+ {
+ return;
+ }
+
+ _state = StateDestroying;
+ }
+
+ //
+ // Now it's also time to clean up our servants and servant
+ // locators.
+ //
+ _servantManager.destroy();
+
+ //
+ // Destroy the thread pool.
+ //
+ if(_threadPool != null)
+ {
+ _threadPool.destroy();
+ try
+ {
+ _threadPool.joinWithAllThreads();
+ }
+ catch (InterruptedException e)
+ {
+ throw new OperationInterruptedException();
+ }
+ }
+
+ _objectAdapterFactory.removeObjectAdapter(this);
+
+ synchronized(this)
+ {
+ _incomingConnectionFactories.clear();
+
+ //
+ // Remove object references (some of them cyclic).
+ //
+ _instance = null;
+ _threadPool = null;
+ _routerEndpoints = null;
+ _routerInfo = null;
+ _publishedEndpoints = null;
+ _locatorInfo = null;
+ _reference = null;
+ _objectAdapterFactory = null;
+
+ //
+ // Signal that destroying is complete.
+ //
+ _state = StateDestroyed;
+ notifyAll();
+ }
+ }
+
+ @Override
+ public ObjectPrx
+ add(com.zeroc.Ice.Object object, Identity ident)
+ {
+ return addFacet(object, ident, "");
+ }
+
+ @Override
+ public synchronized ObjectPrx
+ addFacet(com.zeroc.Ice.Object object, Identity ident, String facet)
+ {
+ checkForDeactivation();
+ checkIdentity(ident);
+ checkServant(object);
+
+ //
+ // Create a copy of the Identity argument, in case the caller
+ // reuses it.
+ //
+ Identity id = new Identity();
+ id.category = ident.category;
+ id.name = ident.name;
+
+ _servantManager.addServant(object, id, facet);
+
+ return newProxy(id, facet);
+ }
+
+ @Override
+ public ObjectPrx
+ addWithUUID(com.zeroc.Ice.Object object)
+ {
+ return addFacetWithUUID(object, "");
+ }
+
+ @Override
+ public ObjectPrx
+ addFacetWithUUID(com.zeroc.Ice.Object object, String facet)
+ {
+ Identity ident = new Identity();
+ ident.category = "";
+ ident.name = java.util.UUID.randomUUID().toString();
+
+ return addFacet(object, ident, facet);
+ }
+
+ @Override
+ public synchronized void
+ addDefaultServant(com.zeroc.Ice.Object servant, String category)
+ {
+ checkServant(servant);
+ checkForDeactivation();
+
+ _servantManager.addDefaultServant(servant, category);
+ }
+
+ @Override
+ public com.zeroc.Ice.Object
+ remove(Identity ident)
+ {
+ return removeFacet(ident, "");
+ }
+
+ @Override
+ public synchronized com.zeroc.Ice.Object
+ removeFacet(Identity ident, String facet)
+ {
+ checkForDeactivation();
+ checkIdentity(ident);
+
+ return _servantManager.removeServant(ident, facet);
+ }
+
+ @Override
+ public synchronized Map<String, Object>
+ removeAllFacets(Identity ident)
+ {
+ checkForDeactivation();
+ checkIdentity(ident);
+
+ return _servantManager.removeAllFacets(ident);
+ }
+
+ @Override
+ public synchronized com.zeroc.Ice.Object
+ removeDefaultServant(String category)
+ {
+ checkForDeactivation();
+
+ return _servantManager.removeDefaultServant(category);
+ }
+
+ @Override
+ public com.zeroc.Ice.Object
+ find(Identity ident)
+ {
+ return findFacet(ident, "");
+ }
+
+ @Override
+ public synchronized com.zeroc.Ice.Object
+ findFacet(Identity ident, String facet)
+ {
+ checkForDeactivation();
+ checkIdentity(ident);
+
+ return _servantManager.findServant(ident, facet);
+ }
+
+ @Override
+ public synchronized java.util.Map<String, com.zeroc.Ice.Object>
+ findAllFacets(Identity ident)
+ {
+ checkForDeactivation();
+ checkIdentity(ident);
+
+ return _servantManager.findAllFacets(ident);
+ }
+
+ @Override
+ public synchronized com.zeroc.Ice.Object
+ findByProxy(ObjectPrx proxy)
+ {
+ checkForDeactivation();
+
+ com.zeroc.IceInternal.Reference ref = ((_ObjectPrxI)proxy).__reference();
+ return findFacet(ref.getIdentity(), ref.getFacet());
+ }
+
+ @Override
+ public synchronized com.zeroc.Ice.Object
+ findDefaultServant(String category)
+ {
+ checkForDeactivation();
+
+ return _servantManager.findDefaultServant(category);
+ }
+
+ @Override
+ public synchronized void
+ addServantLocator(ServantLocator locator, String prefix)
+ {
+ checkForDeactivation();
+
+ _servantManager.addServantLocator(locator, prefix);
+ }
+
+ @Override
+ public synchronized ServantLocator
+ removeServantLocator(String prefix)
+ {
+ checkForDeactivation();
+
+ return _servantManager.removeServantLocator(prefix);
+ }
+
+ @Override
+ public synchronized ServantLocator
+ findServantLocator(String prefix)
+ {
+ checkForDeactivation();
+
+ return _servantManager.findServantLocator(prefix);
+ }
+
+ @Override
+ public synchronized ObjectPrx
+ createProxy(Identity ident)
+ {
+ checkForDeactivation();
+ checkIdentity(ident);
+
+ return newProxy(ident, "");
+ }
+
+ @Override
+ public synchronized ObjectPrx
+ createDirectProxy(Identity ident)
+ {
+ checkForDeactivation();
+ checkIdentity(ident);
+
+ return newDirectProxy(ident, "");
+ }
+
+ @Override
+ public synchronized ObjectPrx
+ createIndirectProxy(Identity ident)
+ {
+ checkForDeactivation();
+ checkIdentity(ident);
+
+ return newIndirectProxy(ident, "", _id);
+ }
+
+ @Override
+ public synchronized void
+ setLocator(LocatorPrx locator)
+ {
+ checkForDeactivation();
+
+ _locatorInfo = _instance.locatorManager().get(locator);
+ }
+
+ @Override
+ public synchronized LocatorPrx
+ getLocator()
+ {
+ if(_locatorInfo == null)
+ {
+ return null;
+ }
+ else
+ {
+ return _locatorInfo.getLocator();
+ }
+ }
+
+ @Override
+ public void
+ refreshPublishedEndpoints()
+ {
+ com.zeroc.IceInternal.LocatorInfo locatorInfo = null;
+ List<com.zeroc.IceInternal.EndpointI> oldPublishedEndpoints;
+
+ synchronized(this)
+ {
+ checkForDeactivation();
+
+ oldPublishedEndpoints = _publishedEndpoints;
+ _publishedEndpoints = parsePublishedEndpoints();
+
+ locatorInfo = _locatorInfo;
+ }
+
+ try
+ {
+ Identity dummy = new Identity();
+ dummy.name = "dummy";
+ updateLocatorRegistry(locatorInfo, createDirectProxy(dummy));
+ }
+ catch(LocalException ex)
+ {
+ synchronized(this)
+ {
+ //
+ // Restore the old published endpoints.
+ //
+ _publishedEndpoints = oldPublishedEndpoints;
+ throw ex;
+ }
+ }
+ }
+
+ @Override
+ public synchronized Endpoint[]
+ getEndpoints()
+ {
+ List<Endpoint> endpoints = new ArrayList<>();
+ for(IncomingConnectionFactory factory : _incomingConnectionFactories)
+ {
+ endpoints.add(factory.endpoint());
+ }
+ return endpoints.toArray(new Endpoint[0]);
+ }
+
+ @Override
+ public synchronized Endpoint[]
+ getPublishedEndpoints()
+ {
+ return _publishedEndpoints.toArray(new Endpoint[0]);
+ }
+
+ public boolean
+ isLocal(ObjectPrx proxy)
+ {
+ //
+ // NOTE: it's important that isLocal() doesn't perform any blocking operations as
+ // it can be called for AMI invocations if the proxy has no delegate set yet.
+ //
+
+ com.zeroc.IceInternal.Reference ref = ((_ObjectPrxI)proxy).__reference();
+ if(ref.isWellKnown())
+ {
+ //
+ // Check the active servant map to see if the well-known
+ // proxy is for a local object.
+ //
+ return _servantManager.hasServant(ref.getIdentity());
+ }
+ else if(ref.isIndirect())
+ {
+ //
+ // Proxy is local if the reference adapter id matches this
+ // adapter id or replica group id.
+ //
+ return ref.getAdapterId().equals(_id) || ref.getAdapterId().equals(_replicaGroupId);
+ }
+ else
+ {
+ com.zeroc.IceInternal.EndpointI[] endpoints = ref.getEndpoints();
+
+ synchronized(this)
+ {
+ checkForDeactivation();
+
+ //
+ // Proxies which have at least one endpoint in common with the
+ // endpoints used by this object adapter's incoming connection
+ // factories are considered local.
+ //
+ for(com.zeroc.IceInternal.EndpointI endpoint : endpoints)
+ {
+ for(com.zeroc.IceInternal.EndpointI p : _publishedEndpoints)
+ {
+ if(endpoint.equivalent(p))
+ {
+ return true;
+ }
+ }
+ for(IncomingConnectionFactory p : _incomingConnectionFactories)
+ {
+ if(endpoint.equivalent(p.endpoint()))
+ {
+ return true;
+ }
+ }
+ }
+
+ //
+ // Proxies which have at least one endpoint in common with the
+ // router's server proxy endpoints (if any), are also considered
+ // local.
+ //
+ if(_routerInfo != null && _routerInfo.getRouter().equals(proxy.ice_getRouter()))
+ {
+ for(com.zeroc.IceInternal.EndpointI endpoint : endpoints)
+ {
+ for(com.zeroc.IceInternal.EndpointI p : _routerEndpoints)
+ {
+ if(endpoint.equivalent(p))
+ {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ public void
+ flushAsyncBatchRequests(com.zeroc.IceInternal.CommunicatorFlushBatch outAsync)
+ {
+ List<IncomingConnectionFactory> f;
+ synchronized(this)
+ {
+ f = new ArrayList<>(_incomingConnectionFactories);
+ }
+ for(IncomingConnectionFactory p : f)
+ {
+ p.flushAsyncBatchRequests(outAsync);
+ }
+ }
+
+ public void
+ updateConnectionObservers()
+ {
+ List<IncomingConnectionFactory> f;
+ synchronized(this)
+ {
+ f = new ArrayList<>(_incomingConnectionFactories);
+ }
+ for(IncomingConnectionFactory p : f)
+ {
+ p.updateConnectionObservers();
+ }
+ }
+
+ public void
+ updateThreadObservers()
+ {
+ com.zeroc.IceInternal.ThreadPool threadPool = null;
+ synchronized(this)
+ {
+ threadPool = _threadPool;
+ }
+ if(threadPool != null)
+ {
+ threadPool.updateObservers();
+ }
+ }
+
+ public synchronized void
+ incDirectCount()
+ {
+ checkForDeactivation();
+
+ assert(_directCount >= 0);
+ ++_directCount;
+ }
+
+ public synchronized void
+ decDirectCount()
+ {
+ // Not check for deactivation here!
+
+ assert(_instance != null); // Must not be called after destroy().
+
+ assert(_directCount > 0);
+ if(--_directCount == 0)
+ {
+ notifyAll();
+ }
+ }
+
+ public com.zeroc.IceInternal.ThreadPool
+ getThreadPool()
+ {
+ // No mutex lock necessary, _threadPool and _instance are
+ // immutable after creation until they are removed in
+ // destroy().
+
+ // Not check for deactivation here!
+
+ assert(_instance != null); // Must not be called after destroy().
+
+ if(_threadPool != null)
+ {
+ return _threadPool;
+ }
+ else
+ {
+ return _instance.serverThreadPool();
+ }
+ }
+
+ public com.zeroc.IceInternal.ServantManager
+ getServantManager()
+ {
+ //
+ // No mutex lock necessary, _servantManager is immutable.
+ //
+ return _servantManager;
+ }
+
+ public com.zeroc.IceInternal.ACMConfig
+ getACM()
+ {
+ // No check for deactivation here!
+ assert(_instance != null); // Must not be called after destroy().
+ return _acm;
+ }
+
+ public int
+ messageSizeMax()
+ {
+ // No mutex lock, immutable.
+ return _messageSizeMax;
+ }
+
+ //
+ // Only for use by com.zeroc.IceInternal.ObjectAdapterFactory
+ //
+ public
+ ObjectAdapterI(com.zeroc.IceInternal.Instance instance, Communicator communicator,
+ com.zeroc.IceInternal.ObjectAdapterFactory objectAdapterFactory, String name,
+ RouterPrx router, boolean noConfig)
+ {
+ _instance = instance;
+ _communicator = communicator;
+ _objectAdapterFactory = objectAdapterFactory;
+ _servantManager = new com.zeroc.IceInternal.ServantManager(instance, name);
+ _name = name;
+ _directCount = 0;
+ _noConfig = noConfig;
+
+ if(_noConfig)
+ {
+ _id = "";
+ _replicaGroupId = "";
+ _reference = _instance.referenceFactory().create("dummy -t", "");
+ _acm = _instance.serverACM();
+ _messageSizeMax = _instance.messageSizeMax();
+ return;
+ }
+
+ final Properties properties = _instance.initializationData().properties;
+ List<String> unknownProps = new ArrayList<>();
+ boolean noProps = filterProperties(unknownProps);
+
+ //
+ // Warn about unknown object adapter properties.
+ //
+ if(unknownProps.size() != 0 && properties.getPropertyAsIntWithDefault("Ice.Warn.UnknownProperties", 1) > 0)
+ {
+ StringBuffer message = new StringBuffer("found unknown properties for object adapter `");
+ message.append(_name);
+ message.append("':");
+ for(String p : unknownProps)
+ {
+ message.append("\n ");
+ message.append(p);
+ }
+ _instance.initializationData().logger.warning(message.toString());
+ }
+
+ //
+ // Make sure named adapter has some configuration.
+ //
+ if(router == null && noProps)
+ {
+ //
+ // These need to be set to prevent finalizer from complaining.
+ //
+ _state = StateDestroyed;
+ _instance = null;
+ _incomingConnectionFactories = null;
+
+ InitializationException ex = new InitializationException();
+ ex.reason = "object adapter `" + _name + "' requires configuration";
+ throw ex;
+ }
+
+ _id = properties.getProperty(_name + ".AdapterId");
+ _replicaGroupId = properties.getProperty(_name + ".ReplicaGroupId");
+
+ //
+ // Setup a reference to be used to get the default proxy options
+ // when creating new proxies. By default, create twoway proxies.
+ //
+ String proxyOptions = properties.getPropertyWithDefault(_name + ".ProxyOptions", "-t");
+ try
+ {
+ _reference = _instance.referenceFactory().create("dummy " + proxyOptions, "");
+ }
+ catch(ProxyParseException e)
+ {
+ InitializationException ex = new InitializationException();
+ ex.reason = "invalid proxy options `" + proxyOptions + "' for object adapter `" + _name + "'";
+ throw ex;
+ }
+
+ _acm = new com.zeroc.IceInternal.ACMConfig(properties, communicator.getLogger(), _name + ".ACM",
+ instance.serverACM());
+
+ {
+ final int defaultMessageSizeMax = instance.messageSizeMax() / 1024;
+ int num = properties.getPropertyAsIntWithDefault(_name + ".MessageSizeMax", defaultMessageSizeMax);
+ if(num < 1 || num > 0x7fffffff / 1024)
+ {
+ _messageSizeMax = 0x7fffffff;
+ }
+ else
+ {
+ _messageSizeMax = num * 1024; // Property is in kilobytes, _messageSizeMax in bytes
+ }
+ }
+
+ try
+ {
+ int threadPoolSize = properties.getPropertyAsInt(_name + ".ThreadPool.Size");
+ int threadPoolSizeMax = properties.getPropertyAsInt(_name + ".ThreadPool.SizeMax");
+
+ //
+ // Create the per-adapter thread pool, if necessary.
+ //
+ if(threadPoolSize > 0 || threadPoolSizeMax > 0)
+ {
+ _threadPool = new com.zeroc.IceInternal.ThreadPool(_instance, _name + ".ThreadPool", 0);
+ }
+
+ if(router == null)
+ {
+ router = RouterPrx.uncheckedCast(_instance.proxyFactory().propertyToProxy(name + ".Router"));
+ }
+ if(router != null)
+ {
+ _routerInfo = _instance.routerManager().get(router);
+ if(_routerInfo != null)
+ {
+ //
+ // Make sure this router is not already registered with another adapter.
+ //
+ if(_routerInfo.getAdapter() != null)
+ {
+ throw new AlreadyRegisteredException("object adapter with router",
+ Util.identityToString(router.ice_getIdentity()));
+ }
+
+ //
+ // Add the router's server proxy endpoints to this object
+ // adapter.
+ //
+ com.zeroc.IceInternal.EndpointI[] endpoints = _routerInfo.getServerEndpoints();
+ for(com.zeroc.IceInternal.EndpointI endpoint : endpoints)
+ {
+ _routerEndpoints.add(endpoint);
+ }
+ java.util.Collections.sort(_routerEndpoints); // Must be sorted.
+
+ //
+ // Remove duplicate endpoints, so we have a list of unique
+ // endpoints.
+ //
+ for(int i = 0; i < _routerEndpoints.size() - 1;)
+ {
+ com.zeroc.IceInternal.EndpointI e1 = _routerEndpoints.get(i);
+ com.zeroc.IceInternal.EndpointI e2 = _routerEndpoints.get(i + 1);
+ if(e1.equals(e2))
+ {
+ _routerEndpoints.remove(i);
+ }
+ else
+ {
+ ++i;
+ }
+ }
+
+ //
+ // Associate this object adapter with the router. This way,
+ // new outgoing connections to the router's client proxy will
+ // use this object adapter for callbacks.
+ //
+ _routerInfo.setAdapter(this);
+
+ //
+ // Also modify all existing outgoing connections to the
+ // router's client proxy to use this object adapter for
+ // callbacks.
+ //
+ _instance.outgoingConnectionFactory().setRouterInfo(_routerInfo);
+ }
+ }
+ else
+ {
+ //
+ // Parse the endpoints, but don't store them in the adapter. The connection
+ // factory might change it, for example, to fill in the real port number.
+ //
+ List<com.zeroc.IceInternal.EndpointI> endpoints =
+ parseEndpoints(properties.getProperty(_name + ".Endpoints"), true);
+ for(com.zeroc.IceInternal.EndpointI endp : endpoints)
+ {
+ IncomingConnectionFactory factory = new IncomingConnectionFactory(instance, endp, this);
+ _incomingConnectionFactories.add(factory);
+ }
+ if(endpoints.size() == 0)
+ {
+ com.zeroc.IceInternal.TraceLevels tl = _instance.traceLevels();
+ if(tl.network >= 2)
+ {
+ _instance.initializationData().logger.trace(tl.networkCat,
+ "created adapter `" + name + "' without endpoints");
+ }
+ }
+
+ //
+ // Parse the publsihed endpoints.
+ //
+ _publishedEndpoints = parsePublishedEndpoints();
+ }
+
+ if(properties.getProperty(_name + ".Locator").length() > 0)
+ {
+ setLocator(LocatorPrx.uncheckedCast(_instance.proxyFactory().propertyToProxy(_name + ".Locator")));
+ }
+ else
+ {
+ setLocator(_instance.referenceFactory().getDefaultLocator());
+ }
+ }
+ catch(LocalException ex)
+ {
+ destroy();
+ throw ex;
+ }
+ }
+
+ @Override
+ protected synchronized void
+ finalize()
+ throws Throwable
+ {
+ try
+ {
+ if(_state < StateDeactivated)
+ {
+ _instance.initializationData().logger.warning("object adapter `" + getName() +
+ "' has not been deactivated");
+ }
+ else if(_state != StateDestroyed)
+ {
+ _instance.initializationData().logger.warning("object adapter `" + getName() +
+ "' has not been destroyed");
+ }
+ else
+ {
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_threadPool == null);
+ // Not cleared, it needs to be immutable.
+ //com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_servantManager == null);
+ //com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_incomingConnectionFactories.isEmpty());
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_directCount == 0);
+ }
+ }
+ catch(java.lang.Exception ex)
+ {
+ }
+ finally
+ {
+ super.finalize();
+ }
+ }
+
+ private ObjectPrx
+ newProxy(Identity ident, String facet)
+ {
+ if(_id.length() == 0)
+ {
+ return newDirectProxy(ident, facet);
+ }
+ else if(_replicaGroupId.length() == 0)
+ {
+ return newIndirectProxy(ident, facet, _id);
+ }
+ else
+ {
+ return newIndirectProxy(ident, facet, _replicaGroupId);
+ }
+ }
+
+ private ObjectPrx
+ newDirectProxy(Identity ident, String facet)
+ {
+ com.zeroc.IceInternal.EndpointI[] endpoints;
+
+ int sz = _publishedEndpoints.size();
+ endpoints = new com.zeroc.IceInternal.EndpointI[sz + _routerEndpoints.size()];
+ _publishedEndpoints.toArray(endpoints);
+
+ //
+ // Now we also add the endpoints of the router's server proxy, if
+ // any. This way, object references created by this object adapter
+ // will also point to the router's server proxy endpoints.
+ //
+ for(int i = 0; i < _routerEndpoints.size(); ++i)
+ {
+ endpoints[sz + i] = _routerEndpoints.get(i);
+ }
+
+ //
+ // Create a reference and return a proxy for this reference.
+ //
+ com.zeroc.IceInternal.Reference ref = _instance.referenceFactory().create(ident, facet, _reference, endpoints);
+ return _instance.proxyFactory().referenceToProxy(ref);
+ }
+
+ private ObjectPrx
+ newIndirectProxy(Identity ident, String facet, String id)
+ {
+ //
+ // Create a reference with the adapter id and return a proxy
+ // for the reference.
+ //
+ com.zeroc.IceInternal.Reference ref = _instance.referenceFactory().create(ident, facet, _reference, id);
+ return _instance.proxyFactory().referenceToProxy(ref);
+ }
+
+ private void
+ checkForDeactivation()
+ {
+ if(_state >= StateDeactivating)
+ {
+ ObjectAdapterDeactivatedException ex = new ObjectAdapterDeactivatedException();
+ ex.name = getName();
+ throw ex;
+ }
+ }
+
+ private static void
+ checkIdentity(Identity ident)
+ {
+ if(ident.name == null || ident.name.length() == 0)
+ {
+ throw new IllegalIdentityException(ident);
+ }
+
+ if(ident.category == null)
+ {
+ ident.category = "";
+ }
+ }
+
+ private static void
+ checkServant(com.zeroc.Ice.Object servant)
+ {
+ if(servant == null)
+ {
+ throw new IllegalServantException("cannot add null servant to Object Adapter");
+ }
+ }
+
+ private List<com.zeroc.IceInternal.EndpointI>
+ parseEndpoints(String endpts, boolean oaEndpoints)
+ {
+ int beg;
+ int end = 0;
+
+ final String delim = " \t\n\r";
+
+ List<com.zeroc.IceInternal.EndpointI> endpoints = new ArrayList<>();
+ while(end < endpts.length())
+ {
+ beg = com.zeroc.IceUtilInternal.StringUtil.findFirstNotOf(endpts, delim, end);
+ if(beg == -1)
+ {
+ break;
+ }
+
+ end = beg;
+ while(true)
+ {
+ end = endpts.indexOf(':', end);
+ if(end == -1)
+ {
+ end = endpts.length();
+ break;
+ }
+ else
+ {
+ boolean quoted = false;
+ int quote = beg;
+ while(true)
+ {
+ quote = endpts.indexOf('\"', quote);
+ if(quote == -1 || end < quote)
+ {
+ break;
+ }
+ else
+ {
+ quote = endpts.indexOf('\"', ++quote);
+ if(quote == -1)
+ {
+ break;
+ }
+ else if(end < quote)
+ {
+ quoted = true;
+ break;
+ }
+ ++quote;
+ }
+ }
+ if(!quoted)
+ {
+ break;
+ }
+ ++end;
+ }
+ }
+
+ if(end == beg)
+ {
+ ++end;
+ continue;
+ }
+
+ String s = endpts.substring(beg, end);
+ com.zeroc.IceInternal.EndpointI endp = _instance.endpointFactoryManager().create(s, oaEndpoints);
+ if(endp == null)
+ {
+ EndpointParseException e = new EndpointParseException();
+ e.str = "invalid object adapter endpoint `" + s + "'";
+ throw e;
+ }
+ endpoints.add(endp);
+
+ ++end;
+ }
+
+ return endpoints;
+ }
+
+ private List<com.zeroc.IceInternal.EndpointI>
+ parsePublishedEndpoints()
+ {
+ //
+ // Parse published endpoints. If set, these are used in proxies
+ // instead of the connection factory Endpoints.
+ //
+ String endpts = _instance.initializationData().properties.getProperty(_name + ".PublishedEndpoints");
+ List<com.zeroc.IceInternal.EndpointI> endpoints = parseEndpoints(endpts, false);
+ if(endpoints.isEmpty())
+ {
+ //
+ // If the PublishedEndpoints property isn't set, we compute the published enpdoints
+ // from the OA endpoints, expanding any endpoints that may be listening on INADDR_ANY
+ // to include actual addresses in the published endpoints.
+ //
+ for(IncomingConnectionFactory factory : _incomingConnectionFactories)
+ {
+ endpoints.addAll(factory.endpoint().expand());
+ }
+ }
+
+ if(_instance.traceLevels().network >= 1 && !endpoints.isEmpty())
+ {
+ StringBuffer s = new StringBuffer("published endpoints for object adapter `");
+ s.append(_name);
+ s.append("':\n");
+ boolean first = true;
+ for(com.zeroc.IceInternal.EndpointI endpoint : endpoints)
+ {
+ if(!first)
+ {
+ s.append(":");
+ }
+ s.append(endpoint.toString());
+ first = false;
+ }
+ _instance.initializationData().logger.trace(_instance.traceLevels().networkCat, s.toString());
+ }
+ return endpoints;
+ }
+
+ private void
+ updateLocatorRegistry(com.zeroc.IceInternal.LocatorInfo locatorInfo, ObjectPrx proxy)
+ {
+ if(_id.length() == 0 || locatorInfo == null)
+ {
+ return; // Nothing to update.
+ }
+
+ //
+ // Call on the locator registry outside the synchronization to
+ // blocking other threads that need to lock this OA.
+ //
+ LocatorRegistryPrx locatorRegistry = locatorInfo.getLocatorRegistry();
+ if(locatorRegistry == null)
+ {
+ return;
+ }
+
+ try
+ {
+ if(_replicaGroupId.length() == 0)
+ {
+ locatorRegistry.setAdapterDirectProxy(_id, proxy);
+ }
+ else
+ {
+ locatorRegistry.setReplicatedAdapterDirectProxy(_id, _replicaGroupId, proxy);
+ }
+ }
+ catch(AdapterNotFoundException ex)
+ {
+ if(_instance.traceLevels().location >= 1)
+ {
+ StringBuilder s = new StringBuilder(128);
+ s.append("couldn't update object adapter `");
+ s.append(_id);
+ s.append("' endpoints with the locator registry:\n");
+ s.append("the object adapter is not known to the locator registry");
+ _instance.initializationData().logger.trace(_instance.traceLevels().locationCat, s.toString());
+ }
+
+ NotRegisteredException ex1 = new NotRegisteredException();
+ ex1.kindOfObject = "object adapter";
+ ex1.id = _id;
+ throw ex1;
+ }
+ catch(InvalidReplicaGroupIdException ex)
+ {
+ if(_instance.traceLevels().location >= 1)
+ {
+ StringBuilder s = new StringBuilder(128);
+ s.append("couldn't update object adapter `");
+ s.append(_id);
+ s.append("' endpoints with the locator registry:\n");
+ s.append("the replica group `");
+ s.append(_replicaGroupId);
+ s.append("' is not known to the locator registry");
+ _instance.initializationData().logger.trace(_instance.traceLevels().locationCat, s.toString());
+ }
+
+ NotRegisteredException ex1 = new NotRegisteredException();
+ ex1.kindOfObject = "replica group";
+ ex1.id = _replicaGroupId;
+ throw ex1;
+ }
+ catch(AdapterAlreadyActiveException ex)
+ {
+ if(_instance.traceLevels().location >= 1)
+ {
+ StringBuilder s = new StringBuilder(128);
+ s.append("couldn't update object adapter `");
+ s.append(_id);
+ s.append("' endpoints with the locator registry:\n");
+ s.append("the object adapter endpoints are already set");
+ _instance.initializationData().logger.trace(_instance.traceLevels().locationCat, s.toString());
+ }
+
+ ObjectAdapterIdInUseException ex1 = new ObjectAdapterIdInUseException();
+ ex1.id = _id;
+ throw ex1;
+ }
+ catch(ObjectAdapterDeactivatedException e)
+ {
+ // Expected if collocated call and OA is deactivated, ignore.
+ }
+ catch(CommunicatorDestroyedException e)
+ {
+ // Ignore
+ }
+ catch(LocalException e)
+ {
+ if(_instance.traceLevels().location >= 1)
+ {
+ StringBuilder s = new StringBuilder(128);
+ s.append("couldn't update object adapter `");
+ s.append(_id);
+ s.append("' endpoints with the locator registry:\n");
+ s.append(e.toString());
+ _instance.initializationData().logger.trace(_instance.traceLevels().locationCat, s.toString());
+ }
+ throw e; // TODO: Shall we raise a special exception instead of a non obvious local exception?
+ }
+
+ if(_instance.traceLevels().location >= 1)
+ {
+ StringBuilder s = new StringBuilder(128);
+ s.append("updated object adapter `");
+ s.append(_id);
+ s.append("' endpoints with the locator registry\n");
+ s.append("endpoints = ");
+ if(proxy != null)
+ {
+ Endpoint[] endpoints = proxy.ice_getEndpoints();
+ for(int i = 0; i < endpoints.length; i++)
+ {
+ s.append(endpoints[i].toString());
+ if(i + 1 < endpoints.length)
+ {
+ s.append(":");
+ }
+ }
+ }
+ _instance.initializationData().logger.trace(_instance.traceLevels().locationCat, s.toString());
+ }
+ }
+
+ static private String[] _suffixes =
+ {
+ "ACM",
+ "ACM.Timeout",
+ "ACM.Heartbeat",
+ "ACM.Close",
+ "AdapterId",
+ "Endpoints",
+ "Locator",
+ "Locator.EncodingVersion",
+ "Locator.EndpointSelection",
+ "Locator.ConnectionCached",
+ "Locator.PreferSecure",
+ "Locator.CollocationOptimized",
+ "Locator.Router",
+ "MessageSizeMax",
+ "PublishedEndpoints",
+ "ReplicaGroupId",
+ "Router",
+ "Router.EncodingVersion",
+ "Router.EndpointSelection",
+ "Router.ConnectionCached",
+ "Router.PreferSecure",
+ "Router.CollocationOptimized",
+ "Router.Locator",
+ "Router.Locator.EndpointSelection",
+ "Router.Locator.ConnectionCached",
+ "Router.Locator.PreferSecure",
+ "Router.Locator.CollocationOptimized",
+ "Router.Locator.LocatorCacheTimeout",
+ "Router.Locator.InvocationTimeout",
+ "Router.LocatorCacheTimeout",
+ "Router.InvocationTimeout",
+ "ProxyOptions",
+ "ThreadPool.Size",
+ "ThreadPool.SizeMax",
+ "ThreadPool.SizeWarn",
+ "ThreadPool.StackSize",
+ "ThreadPool.Serialize"
+ };
+
+ boolean
+ filterProperties(List<String> unknownProps)
+ {
+ //
+ // Do not create unknown properties list if Ice prefix, ie Ice, Glacier2, etc
+ //
+ boolean addUnknown = true;
+ String prefix = _name + ".";
+ for(int i = 0; com.zeroc.IceInternal.PropertyNames.clPropNames[i] != null; ++i)
+ {
+ if(prefix.startsWith(com.zeroc.IceInternal.PropertyNames.clPropNames[i] + "."))
+ {
+ addUnknown = false;
+ break;
+ }
+ }
+
+ boolean noProps = true;
+ Map<String, String> props = _instance.initializationData().properties.getPropertiesForPrefix(prefix);
+ for(String prop : props.keySet())
+ {
+ boolean valid = false;
+ for(String suffix : _suffixes)
+ {
+ if(prop.equals(prefix + suffix))
+ {
+ noProps = false;
+ valid = true;
+ break;
+ }
+ }
+
+ if(!valid && addUnknown)
+ {
+ unknownProps.add(prop);
+ }
+ }
+
+ return noProps;
+ }
+
+ private static final int StateUninitialized = 0; // Just constructed.
+ private static final int StateHeld = 1;
+ private static final int StateActivating = 2;
+ private static final int StateActive = 3;
+ private static final int StateDeactivating = 4;
+ private static final int StateDeactivated = 5;
+ private static final int StateDestroying = 6;
+ private static final int StateDestroyed = 7;
+
+ private int _state = StateUninitialized;
+ private com.zeroc.IceInternal.Instance _instance;
+ private Communicator _communicator;
+ private com.zeroc.IceInternal.ObjectAdapterFactory _objectAdapterFactory;
+ private com.zeroc.IceInternal.ThreadPool _threadPool;
+ private com.zeroc.IceInternal.ACMConfig _acm;
+ private com.zeroc.IceInternal.ServantManager _servantManager;
+ final private String _name;
+ final private String _id;
+ final private String _replicaGroupId;
+ private com.zeroc.IceInternal.Reference _reference;
+ private List<IncomingConnectionFactory> _incomingConnectionFactories = new ArrayList<>();
+ private List<com.zeroc.IceInternal.EndpointI> _routerEndpoints = new ArrayList<>();
+ private com.zeroc.IceInternal.RouterInfo _routerInfo = null;
+ private List<com.zeroc.IceInternal.EndpointI> _publishedEndpoints = new ArrayList<>();
+ private com.zeroc.IceInternal.LocatorInfo _locatorInfo;
+ private int _directCount; // The number of direct proxies dispatching on this object adapter.
+ private boolean _noConfig;
+ private final int _messageSizeMax;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/ObjectInputStream.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ObjectInputStream.java
new file mode 100644
index 00000000000..caffaa274fa
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ObjectInputStream.java
@@ -0,0 +1,43 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * For deserialization of Slice types that contain a proxy, the application
+ * must instantiate a subclass of <code>ObjectInputStream</code> and supply
+ * a communicator that is used to reconstruct the proxy.
+ **/
+public class ObjectInputStream extends java.io.ObjectInputStream
+{
+ /**
+ * Instantiates this class for the specified communicator and input stream.
+ *
+ * @param communicator The communicator to use to deserialize proxies.
+ * @param stream The input stream to read from.
+ **/
+ public
+ ObjectInputStream(Communicator communicator, java.io.InputStream stream)
+ throws java.io.IOException
+ {
+ super(stream);
+ _communicator = communicator;
+ }
+
+ /**
+ * Returns the communicator for this stream.
+ **/
+ public Communicator
+ getCommunicator()
+ {
+ return _communicator;
+ }
+
+ private Communicator _communicator;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/ObjectPrx.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ObjectPrx.java
new file mode 100644
index 00000000000..50b1045d72d
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ObjectPrx.java
@@ -0,0 +1,1252 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * Base interface of all object proxies.
+ **/
+public interface ObjectPrx
+{
+ /**
+ * Returns the communicator that created this proxy.
+ *
+ * @return The communicator that created this proxy.
+ **/
+ Communicator ice_getCommunicator();
+
+ /**
+ * Tests whether this object supports a specific Slice interface.
+ *
+ * @param id The type ID of the Slice interface to test against.
+ * @return <code>true</code> if the target object has the interface
+ * specified by <code>id</code> or derives from the interface
+ * specified by <code>id</code>.
+ **/
+ boolean ice_isA(String id);
+
+ /**
+ * Tests whether this object supports a specific Slice interface.
+ *
+ * @param id The type ID of the Slice interface to test against.
+ * @param __context The context map for the invocation.
+ * @return <code>true</code> if the target object has the interface
+ * specified by <code>id</code> or derives from the interface
+ * specified by <code>id</code>.
+ **/
+ boolean ice_isA(String id, java.util.Map<String, String> __context);
+
+ /**
+ * Tests whether this object supports a specific Slice interface.
+ *
+ * @param id The type ID of the Slice interface to test against.
+ * @return A future for the completion of the request.
+ **/
+ java.util.concurrent.CompletableFuture<Boolean> ice_isAAsync(String id);
+
+ /**
+ * Tests whether this object supports a specific Slice interface.
+ *
+ * @param id The type ID of the Slice interface to test against.
+ * @param __context The context map for the invocation.
+ * @return A future for the completion of the request.
+ **/
+ java.util.concurrent.CompletableFuture<Boolean> ice_isAAsync(String id, java.util.Map<String, String> __context);
+
+ /**
+ * Tests whether the target object of this proxy can be reached.
+ **/
+ void ice_ping();
+
+ /**
+ * Tests whether the target object of this proxy can be reached.
+ *
+ * @param __context The context map for the invocation.
+ **/
+ void ice_ping(java.util.Map<String, String> __context);
+
+ /**
+ * Tests whether the target object of this proxy can be reached.
+ *
+ * @return A future for the completion of the request.
+ **/
+ java.util.concurrent.CompletableFuture<Void> ice_pingAsync();
+
+ /**
+ * Tests whether the target object of this proxy can be reached.
+ *
+ * @param __context The context map for the invocation.
+ * @return A future for the completion of the request.
+ **/
+ java.util.concurrent.CompletableFuture<Void> ice_pingAsync(java.util.Map<String, String> __context);
+
+ /**
+ * Returns the Slice type IDs of the interfaces supported by the target object of this proxy.
+ *
+ * @return The Slice type IDs of the interfaces supported by the target object, in base-to-derived
+ * order. The first element of the returned array is always <code>::Ice::Object</code>.
+ **/
+ String[] ice_ids();
+
+ /**
+ * Returns the Slice type IDs of the interfaces supported by the target object of this proxy.
+ *
+ * @param __context The context map for the invocation.
+ * @return The Slice type IDs of the interfaces supported by the target object, in base-to-derived
+ * order. The first element of the returned array is always <code>::Ice::Object</code>.
+ **/
+ String[] ice_ids(java.util.Map<String, String> __context);
+
+ /**
+ * Returns the Slice type IDs of the interfaces supported by the target object of this proxy.
+ *
+ * @return A future for the completion of the request.
+ **/
+ java.util.concurrent.CompletableFuture<String[]> ice_idsAsync();
+
+ /**
+ * Returns the Slice type IDs of the interfaces supported by the target object of this proxy.
+ *
+ * @param __context The context map for the invocation.
+ * @return A future for the completion of the request.
+ **/
+ java.util.concurrent.CompletableFuture<String[]> ice_idsAsync(java.util.Map<String, String> __context);
+
+ /**
+ * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy.
+ *
+ * @return The Slice type ID of the most-derived interface.
+ **/
+ String ice_id();
+
+ /**
+ * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy.
+ *
+ * @param __context The context map for the invocation.
+ * @return The Slice type ID of the most-derived interface.
+ **/
+ String ice_id(java.util.Map<String, String> __context);
+
+ /**
+ * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy.
+ *
+ * @return A future for the completion of the request.
+ **/
+ java.util.concurrent.CompletableFuture<String> ice_idAsync();
+
+ /**
+ * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy.
+ *
+ * @param __context The context map for the invocation.
+ * @return A future for the completion of the request.
+ **/
+ java.util.concurrent.CompletableFuture<String> ice_idAsync(java.util.Map<String, String> __context);
+
+ /**
+ * Invokes an operation dynamically.
+ *
+ * @param operation The name of the operation to invoke.
+ * @param mode The operation mode (normal or idempotent).
+ * @param inParams The encoded in-parameters for the operation.
+ * @return The results of the invocation.
+ *
+ * @see Blobject
+ * @see OperationMode
+ **/
+ com.zeroc.Ice.Object.Ice_invokeResult ice_invoke(String operation, OperationMode mode, byte[] inParams);
+
+ /**
+ * Invokes an operation dynamically.
+ *
+ * @param operation The name of the operation to invoke.
+ * @param mode The operation mode (normal or idempotent).
+ * @param inParams The encoded in-parameters for the operation.
+ * @param __context The context map for the invocation.
+ * @return The results of the invocation.
+ *
+ * @see Blobject
+ * @see OperationMode
+ **/
+ com.zeroc.Ice.Object.Ice_invokeResult ice_invoke(String operation, OperationMode mode, byte[] inParams,
+ java.util.Map<String, String> __context);
+
+ /**
+ * Invokes an operation dynamically and asynchronously.
+ *
+ * @param operation The name of the operation to invoke.
+ * @param mode The operation mode (normal or idempotent).
+ * @param inParams The encoded in-parameters for the operation.
+ * @return A future for the completion of the request.
+ *
+ * @see Blobject
+ * @see OperationMode
+ **/
+ java.util.concurrent.CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> ice_invokeAsync(
+ String operation,
+ OperationMode mode,
+ byte[] inParams);
+
+ /**
+ * Invokes an operation dynamically and asynchronously.
+ *
+ * @param operation The name of the operation to invoke.
+ * @param mode The operation mode (normal or idempotent).
+ * @param inParams The encoded in-parameters for the operation.
+ * for the operation. The return value follows any out-parameters.
+ * @param __context The context map for the invocation.
+ * @return A future for the completion of the request.
+ *
+ * @see Blobject
+ * @see OperationMode
+ **/
+ java.util.concurrent.CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> ice_invokeAsync(
+ String operation,
+ OperationMode mode,
+ byte[] inParams,
+ java.util.Map<String, String> __context);
+
+ /**
+ * Returns the identity embedded in this proxy.
+ *
+ * @return The identity of the target object.
+ **/
+ Identity ice_getIdentity();
+
+ /**
+ * Returns a proxy that is identical to this proxy, except for the identity.
+ *
+ * @param newIdentity The identity for the new proxy.
+ * @return The proxy with the new identity.
+ **/
+ ObjectPrx ice_identity(Identity newIdentity);
+
+ /**
+ * Returns the per-proxy context for this proxy.
+ *
+ * @return The per-proxy context. If the proxy does not have a per-proxy (implicit) context, the return value
+ * is <code>null</code>.
+ **/
+ java.util.Map<String, String> ice_getContext();
+
+ /**
+ * Returns a proxy that is identical to this proxy, except for the per-proxy context.
+ *
+ * @param newContext The context for the new proxy.
+ * @return The proxy with the new per-proxy context.
+ **/
+ default ObjectPrx ice_context(java.util.Map<String, String> newContext)
+ {
+ return __ice_context(newContext);
+ }
+
+ /**
+ * Returns the facet for this proxy.
+ *
+ * @return The facet for this proxy. If the proxy uses the default facet, the return value is the empty string.
+ **/
+ String ice_getFacet();
+
+ /**
+ * Returns a proxy that is identical to this proxy, except for the facet.
+ *
+ * @param newFacet The facet for the new proxy.
+ * @return The proxy with the new facet.
+ **/
+ ObjectPrx ice_facet(String newFacet);
+
+ /**
+ * Returns the adapter ID for this proxy.
+ *
+ * @return The adapter ID. If the proxy does not have an adapter ID, the return value is the empty string.
+ **/
+ String ice_getAdapterId();
+
+ /**
+ * Returns a proxy that is identical to this proxy, except for the adapter ID.
+ *
+ * @param newAdapterId The adapter ID for the new proxy.
+ * @return The proxy with the new adapter ID.
+ **/
+ default ObjectPrx ice_adapterId(String newAdapterId)
+ {
+ return __ice_adapterId(newAdapterId);
+ }
+
+ /**
+ * Returns the endpoints used by this proxy.
+ *
+ * @return The endpoints used by this proxy.
+ *
+ * @see Endpoint
+ **/
+ Endpoint[] ice_getEndpoints();
+
+ /**
+ * Returns a proxy that is identical to this proxy, except for the endpoints.
+ *
+ * @param newEndpoints The endpoints for the new proxy.
+ * @return The proxy with the new endpoints.
+ **/
+ default ObjectPrx ice_endpoints(Endpoint[] newEndpoints)
+ {
+ return __ice_endpoints(newEndpoints);
+ }
+
+ /**
+ * Returns the locator cache timeout of this proxy.
+ *
+ * @return The locator cache timeout value (in seconds).
+ *
+ * @see Locator
+ **/
+ int ice_getLocatorCacheTimeout();
+
+ /**
+ * Returns the invocation timeout of this proxy.
+ *
+ * @return The invocation timeout value (in seconds).
+ **/
+ int ice_getInvocationTimeout();
+
+ /**
+ * Returns the connection id of this proxy.
+ *
+ * @return The connection id.
+ *
+ **/
+ String ice_getConnectionId();
+
+ /**
+ * Returns a proxy that is identical to this proxy, except for the locator cache timeout.
+ *
+ * @param newTimeout The new locator cache timeout (in seconds).
+ * @return The proxy with the new timeout.
+ *
+ * @see Locator
+ **/
+ default ObjectPrx ice_locatorCacheTimeout(int newTimeout)
+ {
+ return __ice_locatorCacheTimeout(newTimeout);
+ }
+
+ /**
+ * Returns a proxy that is identical to this proxy, except for the invocation timeout.
+ *
+ * @param newTimeout The new invocation timeout (in seconds).
+ * @return The proxy with the new timeout.
+ *
+ **/
+ default ObjectPrx ice_invocationTimeout(int newTimeout)
+ {
+ return __ice_invocationTimeout(newTimeout);
+ }
+
+ /**
+ * Returns whether this proxy caches connections.
+ *
+ * @return <code>true</code> if this proxy caches connections; <code>false</code> otherwise.
+ **/
+ boolean ice_isConnectionCached();
+
+ /**
+ * Returns a proxy that is identical to this proxy, except for connection caching.
+ *
+ * @param newCache <code>true</code> if the new proxy should cache connections; <code>false</code> otherwise.
+ * @return The proxy with the specified caching policy.
+ **/
+ default ObjectPrx ice_connectionCached(boolean newCache)
+ {
+ return __ice_connectionCached(newCache);
+ }
+
+ /**
+ * Returns how this proxy selects endpoints (randomly or ordered).
+ *
+ * @return The endpoint selection policy.
+ *
+ * @see EndpointSelectionType
+ **/
+ EndpointSelectionType ice_getEndpointSelection();
+
+ /**
+ * Returns a proxy that is identical to this proxy, except for the endpoint selection policy.
+ *
+ * @param newType The new endpoint selection policy.
+ * @return The proxy with the specified endpoint selection policy.
+ *
+ * @see EndpointSelectionType
+ **/
+ default ObjectPrx ice_endpointSelection(EndpointSelectionType newType)
+ {
+ return __ice_endpointSelection(newType);
+ }
+
+ /**
+ * Returns whether this proxy uses only secure endpoints.
+ *
+ * @return <code>True</code> if this proxy communicates only via secure endpoints; <code>false</code> otherwise.
+ **/
+ boolean ice_isSecure();
+
+ /**
+ * Returns a proxy that is identical to this proxy, except for how it selects endpoints.
+ *
+ * @param b If <code>b</code> is <code>true</code>, only endpoints that use a secure transport are
+ * used by the new proxy. If <code>b</code> is false, the returned proxy uses both secure and insecure
+ * endpoints.
+ * @return The proxy with the specified selection policy.
+ **/
+ default ObjectPrx ice_secure(boolean b)
+ {
+ return __ice_secure(b);
+ }
+
+ /**
+ * Returns a proxy that is identical to this proxy, except for the encoding used to marshal
+ * parameters.
+ *
+ * @param e The encoding version to use to marshal request parameters.
+ * @return The proxy with the specified encoding version.
+ **/
+ default ObjectPrx ice_encodingVersion(EncodingVersion e)
+ {
+ return __ice_encodingVersion(e);
+ }
+
+ /**
+ * Returns the encoding version used to marshal requests parameters.
+ *
+ * @return The encoding version.
+ **/
+ EncodingVersion ice_getEncodingVersion();
+
+ /**
+ * Returns whether this proxy prefers secure endpoints.
+ *
+ * @return <code>true</code> if the proxy always attempts to invoke via secure endpoints before it
+ * attempts to use insecure endpoints; <code>false</code> otherwise.
+ **/
+ boolean ice_isPreferSecure();
+
+ /**
+ * Returns a proxy that is identical to this proxy, except for its endpoint selection policy.
+ *
+ * @param b If <code>b</code> is <code>true</code>, the new proxy will use secure endpoints for invocations
+ * and only use insecure endpoints if an invocation cannot be made via secure endpoints. If <code>b</code> is
+ * <code>false</code>, the proxy prefers insecure endpoints to secure ones.
+ * @return The proxy with the specified selection policy.
+ **/
+ default ObjectPrx ice_preferSecure(boolean b)
+ {
+ return __ice_preferSecure(b);
+ }
+
+ /**
+ * Returns the router for this proxy.
+ *
+ * @return The router for the proxy. If no router is configured for the proxy, the return value
+ * is <code>null</code>.
+ **/
+ RouterPrx ice_getRouter();
+
+ /**
+ * Returns a proxy that is identical to this proxy, except for the router.
+ *
+ * @param router The router for the new proxy.
+ * @return The proxy with the specified router.
+ **/
+ default ObjectPrx ice_router(RouterPrx router)
+ {
+ return __ice_router(router);
+ }
+
+ /**
+ * Returns the locator for this proxy.
+ *
+ * @return The locator for this proxy. If no locator is configured, the return value is <code>null</code>.
+ **/
+ LocatorPrx ice_getLocator();
+
+ /**
+ * Returns a proxy that is identical to this proxy, except for the locator.
+ *
+ * @param locator The locator for the new proxy.
+ * @return The proxy with the specified locator.
+ **/
+ default ObjectPrx ice_locator(LocatorPrx locator)
+ {
+ return __ice_locator(locator);
+ }
+
+ /**
+ * Returns whether this proxy uses collocation optimization.
+ *
+ * @return <code>true</code> if the proxy uses collocation optimization; <code>false</code> otherwise.
+ **/
+ boolean ice_isCollocationOptimized();
+
+ /**
+ * Returns a proxy that is identical to this proxy, except for collocation optimization.
+ *
+ * @param b <code>true</code> if the new proxy enables collocation optimization; <code>false</code> otherwise.
+ * @return The proxy the specified collocation optimization.
+ **/
+ default ObjectPrx ice_collocationOptimized(boolean b)
+ {
+ return __ice_collocationOptimized(b);
+ }
+
+ /**
+ * Returns a proxy that is identical to this proxy, but uses twoway invocations.
+ *
+ * @return A proxy that uses twoway invocations.
+ **/
+ default ObjectPrx ice_twoway()
+ {
+ return __ice_twoway();
+ }
+
+ /**
+ * Returns whether this proxy uses twoway invocations.
+ * @return <code>true</code> if this proxy uses twoway invocations; <code>false</code> otherwise.
+ **/
+ boolean ice_isTwoway();
+
+ /**
+ * Returns a proxy that is identical to this proxy, but uses oneway invocations.
+ *
+ * @return A proxy that uses oneway invocations.
+ **/
+ default ObjectPrx ice_oneway()
+ {
+ return __ice_oneway();
+ }
+
+ /**
+ * Returns whether this proxy uses oneway invocations.
+ * @return <code>true</code> if this proxy uses oneway invocations; <code>false</code> otherwise.
+ **/
+ boolean ice_isOneway();
+
+ /**
+ * Returns a proxy that is identical to this proxy, but uses batch oneway invocations.
+ *
+ * @return A new proxy that uses batch oneway invocations.
+ **/
+ default ObjectPrx ice_batchOneway()
+ {
+ return __ice_batchOneway();
+ }
+
+ /**
+ * Returns whether this proxy uses batch oneway invocations.
+ * @return <code>true</code> if this proxy uses batch oneway invocations; <code>false</code> otherwise.
+ **/
+ boolean ice_isBatchOneway();
+
+ /**
+ * Returns a proxy that is identical to this proxy, but uses datagram invocations.
+ *
+ * @return A new proxy that uses datagram invocations.
+ **/
+ default ObjectPrx ice_datagram()
+ {
+ return __ice_datagram();
+ }
+
+ /**
+ * Returns whether this proxy uses datagram invocations.
+ * @return <code>true</code> if this proxy uses datagram invocations; <code>false</code> otherwise.
+ **/
+ boolean ice_isDatagram();
+
+ /**
+ * Returns a proxy that is identical to this proxy, but uses batch datagram invocations.
+ *
+ * @return A new proxy that uses batch datagram invocations.
+ **/
+ default ObjectPrx ice_batchDatagram()
+ {
+ return __ice_batchDatagram();
+ }
+
+ /**
+ * Returns whether this proxy uses batch datagram invocations.
+ * @return <code>true</code> if this proxy uses batch datagram invocations; <code>false</code> otherwise.
+ **/
+ boolean ice_isBatchDatagram();
+
+ /**
+ * Returns a proxy that is identical to this proxy, except for compression.
+ *
+ * @param co <code>true</code> enables compression for the new proxy; <code>false</code> disables compression.
+ * @return A proxy with the specified compression setting.
+ **/
+ default ObjectPrx ice_compress(boolean co)
+ {
+ return __ice_compress(co);
+ }
+
+ /**
+ * Returns a proxy that is identical to this proxy, except for its connection timeout setting.
+ *
+ * @param t The connection timeout for the proxy in milliseconds.
+ * @return A proxy with the specified timeout.
+ **/
+ default ObjectPrx ice_timeout(int t)
+ {
+ return __ice_timeout(t);
+ }
+
+ /**
+ * Returns a proxy that is identical to this proxy, except for its connection ID.
+ *
+ * @param connectionId The connection ID for the new proxy. An empty string removes the
+ * connection ID.
+ *
+ * @return A proxy with the specified connection ID.
+ **/
+ default ObjectPrx ice_connectionId(String connectionId)
+ {
+ return __ice_connectionId(connectionId);
+ }
+
+ /**
+ * Returns the {@link Connection} for this proxy. If the proxy does not yet have an established connection,
+ * it first attempts to create a connection.
+ *
+ * @return The {@link Connection} for this proxy.
+ * @throws CollocationOptimizationException If the proxy uses collocation optimization and denotes a
+ * collocated object.
+ *
+ * @see Connection
+ **/
+ Connection ice_getConnection();
+
+ /**
+ * Asynchronously gets the connection for this proxy. The call does not block.
+ *
+ * @return A future for the completion of the request.
+ **/
+ java.util.concurrent.CompletableFuture<Connection> ice_getConnectionAsync();
+
+ /**
+ * Returns the cached {@link Connection} for this proxy. If the proxy does not yet have an established
+ * connection, it does not attempt to create a connection.
+ *
+ * @return The cached {@link Connection} for this proxy (<code>null</code> if the proxy does not have
+ * an established connection).
+ * @throws CollocationOptimizationException If the proxy uses collocation optimization and denotes a
+ * collocated object.
+ *
+ * @see Connection
+ **/
+ Connection ice_getCachedConnection();
+
+ /**
+ * Flushes any pending batched requests for this communicator. The call blocks until the flush is complete.
+ **/
+ void ice_flushBatchRequests();
+
+ /**
+ * Asynchronously flushes any pending batched requests for this communicator. The call does not block.
+ *
+ * @return A future for the completion of the request.
+ **/
+ java.util.concurrent.CompletableFuture<Void> ice_flushBatchRequestsAsync();
+
+ /**
+ * Returns whether this proxy equals the passed object. Two proxies are equal if they are equal in all respects,
+ * that is, if their object identity, endpoints timeout settings, and so on are all equal.
+ *
+ * @param r The object to compare this proxy with.
+ * @return <code>true</code> if this proxy is equal to <code>r</code>; <code>false</code> otherwise.
+ **/
+ @Override
+ boolean equals(java.lang.Object r);
+
+ static final String ice_staticId = "::Ice::Object";
+
+ /**
+ * Returns the Slice type ID associated with this type.
+ **/
+ static String ice_staticId()
+ {
+ return ice_staticId;
+ }
+
+ /**
+ * Casts a proxy to {@link ObjectPrx}. For user-defined types, this call contacts
+ * the server and will throw an Ice run-time exception if the target
+ * object does not exist or the server cannot be reached.
+ *
+ * @param __obj The proxy to cast to @{link ObjectPrx}.
+ * @return <code>__obj</code>.
+ **/
+ static ObjectPrx checkedCast(ObjectPrx __obj)
+ {
+ return __obj;
+ }
+
+ /**
+ * Casts a proxy to {@link ObjectPrx}. For user-defined types, this call contacts
+ * the server and throws an Ice run-time exception if the target
+ * object does not exist or the server cannot be reached.
+ *
+ * @param __obj The proxy to cast to {@link ObjectPrx}.
+ * @param __ctx The <code>Context</code> map for the invocation.
+ * @return <code>__obj</code>.
+ **/
+ static ObjectPrx checkedCast(ObjectPrx __obj, java.util.Map<String, String> __ctx)
+ {
+ return __obj;
+ }
+
+ /**
+ * Creates a new proxy that is identical to the passed proxy, except
+ * for its facet. This call contacts
+ * the server and throws an Ice run-time exception if the target
+ * object does not exist, the specified facet does not exist, or the server cannot be reached.
+ *
+ * @param __obj The proxy to cast to {@link ObjectPrx}.
+ * @param __facet The facet for the new proxy.
+ * @return The new proxy with the specified facet.
+ **/
+ static ObjectPrx checkedCast(ObjectPrx __obj, String __facet)
+ {
+ return checkedCast(__obj, __facet, noExplicitContext);
+ }
+
+ /**
+ * Creates a new proxy that is identical to the passed proxy, except
+ * for its facet. This call contacts
+ * the server and throws an Ice run-time exception if the target
+ * object does not exist, the specified facet does not exist, or the server cannot be reached.
+ *
+ * @param __obj The proxy to cast to {@link ObjectPrx}.
+ * @param __facet The facet for the new proxy.
+ * @param __ctx The <code>Context</code> map for the invocation.
+ * @return The new proxy with the specified facet.
+ **/
+ static ObjectPrx checkedCast(ObjectPrx __obj, String __facet, java.util.Map<String, String> __ctx)
+ {
+ ObjectPrx r = null;
+ if(__obj != null)
+ {
+ ObjectPrx p = __obj.ice_facet(__facet);
+ try
+ {
+ boolean ok = p.ice_isA(ice_staticId, __ctx);
+ assert(ok);
+ r = new _ObjectPrxI();
+ r.__copyFrom(p);
+ }
+ catch(FacetNotExistException ex)
+ {
+ }
+ }
+ return r;
+ }
+
+ /**
+ * Casts a proxy to {@link ObjectPrx}. This call does
+ * not contact the server and always succeeds.
+ *
+ * @param __obj The proxy to cast to {@link ObjectPrx}.
+ * @return <code>__obj</code>.
+ **/
+ static ObjectPrx uncheckedCast(ObjectPrx __obj)
+ {
+ return __obj;
+ }
+
+ /**
+ * Creates a new proxy that is identical to the passed proxy, except
+ * for its facet. This call does not contact the server and always succeeds.
+ *
+ * @param __obj The proxy to cast to {@link ObjectPrx}.
+ * @param __facet The facet for the new proxy.
+ * @return The new proxy with the specified facet.
+ **/
+ static ObjectPrx uncheckedCast(ObjectPrx __obj, String __facet)
+ {
+ ObjectPrx r = null;
+ if(__obj != null)
+ {
+ ObjectPrx p = __obj.ice_facet(__facet);
+ r = new _ObjectPrxI();
+ r.__copyFrom(p);
+ }
+ return r;
+ }
+
+ /**
+ * Writes a proxy to the stream.
+ *
+ * @param ostr The destination stream.
+ * @param v The proxy to write to the stream.
+ **/
+ static void write(OutputStream ostr, ObjectPrx v)
+ {
+ ostr.writeProxy(v);
+ }
+
+ /**
+ * Reads a proxy from the stream.
+ *
+ * @param istr The source stream.
+ * @return A new proxy or null for a nil proxy.
+ **/
+ static ObjectPrx read(InputStream istr)
+ {
+ return istr.readProxy();
+ }
+
+ static <T> T __checkedCast(ObjectPrx obj, String id, Class<T> proxy, Class<?> impl)
+ {
+ return __checkedCast(obj, false, null, noExplicitContext, id, proxy, impl);
+ }
+
+ static <T> T __checkedCast(ObjectPrx obj, java.util.Map<String, String> ctx, String id, Class<T> proxy,
+ Class<?> impl)
+ {
+ return __checkedCast(obj, false, null, ctx, id, proxy, impl);
+ }
+
+ static <T> T __checkedCast(ObjectPrx obj, String facet, String id, Class<T> proxy, Class<?> impl)
+ {
+ return __checkedCast(obj, true, facet, noExplicitContext, id, proxy, impl);
+ }
+
+ static <T> T __checkedCast(ObjectPrx obj, String facet, java.util.Map<String, String> ctx, String id,
+ Class<T> proxy, Class<?> impl)
+ {
+ return __checkedCast(obj, true, facet, ctx, id, proxy, impl);
+ }
+
+ static <T> T __checkedCast(ObjectPrx obj, boolean explicitFacet, String facet, java.util.Map<String, String> ctx,
+ String id, Class<T> proxy, Class<?> impl)
+ {
+ T r = null;
+ if(obj != null)
+ {
+ if(explicitFacet)
+ {
+ obj = obj.ice_facet(facet);
+ }
+ if(proxy.isInstance(obj))
+ {
+ r = proxy.cast(obj);
+ }
+ else
+ {
+ try
+ {
+ boolean ok = obj.ice_isA(id, ctx);
+ if(ok)
+ {
+ ObjectPrx h = null;
+ try
+ {
+ h = _ObjectPrxI.class.cast(impl.newInstance());
+ }
+ catch(InstantiationException ex)
+ {
+ throw new SyscallException(ex);
+ }
+ catch(IllegalAccessException ex)
+ {
+ throw new SyscallException(ex);
+ }
+ h.__copyFrom(obj);
+ r = proxy.cast(h);
+ }
+ }
+ catch(FacetNotExistException ex)
+ {
+ }
+ }
+ }
+ return r;
+ }
+
+ static <T> T __uncheckedCast(ObjectPrx obj, Class<T> proxy, Class<?> impl)
+ {
+ return __uncheckedCast(obj, false, null, proxy, impl);
+ }
+
+ static <T> T __uncheckedCast(ObjectPrx obj, String facet, Class<T> proxy, Class<?> impl)
+ {
+ return __uncheckedCast(obj, true, facet, proxy, impl);
+ }
+
+ static <T> T __uncheckedCast(ObjectPrx obj, boolean explicitFacet, String facet, Class<T> proxy, Class<?> impl)
+ {
+ T r = null;
+ if(obj != null)
+ {
+ try
+ {
+ if(explicitFacet)
+ {
+ ObjectPrx h = _ObjectPrxI.class.cast(impl.newInstance());
+ h.__copyFrom(obj.ice_facet(facet));
+ r = proxy.cast(h);
+ }
+ else
+ {
+ if(proxy.isInstance(obj))
+ {
+ r = proxy.cast(obj);
+ }
+ else
+ {
+ ObjectPrx h = _ObjectPrxI.class.cast(impl.newInstance());
+ h.__copyFrom(obj);
+ r = proxy.cast(h);
+ }
+ }
+ }
+ catch(InstantiationException ex)
+ {
+ throw new SyscallException(ex);
+ }
+ catch(IllegalAccessException ex)
+ {
+ throw new SyscallException(ex);
+ }
+ }
+ return r;
+ }
+
+ static <T> T __waitForCompletion(java.util.concurrent.CompletableFuture<T> f)
+ {
+ try
+ {
+ return __waitForCompletionUserEx(f);
+ }
+ catch(UserException ex)
+ {
+ throw new UnknownUserException(ex.ice_id(), ex);
+ }
+ }
+
+ static <T> T __waitForCompletionUserEx(java.util.concurrent.CompletableFuture<T> f)
+ throws UserException
+ {
+ if(Thread.currentThread().interrupted())
+ {
+ throw new OperationInterruptedException();
+ }
+
+ try
+ {
+ return f.get();
+ }
+ catch(InterruptedException ex)
+ {
+ throw new OperationInterruptedException();
+ }
+ catch(java.util.concurrent.ExecutionException ee)
+ {
+ try
+ {
+ throw ee.getCause();
+ }
+ catch(RuntimeException ex) // Includes LocalException
+ {
+ throw ex;
+ }
+ catch(UserException ex)
+ {
+ throw ex;
+ }
+ catch(Throwable ex)
+ {
+ throw new UnknownException(ex);
+ }
+ }
+ }
+
+ void __write(OutputStream os);
+ void __copyFrom(ObjectPrx p);
+ com.zeroc.IceInternal.Reference __reference();
+ ObjectPrx __newInstance(com.zeroc.IceInternal.Reference r);
+
+ default ObjectPrx __ice_context(java.util.Map<String, String> newContext)
+ {
+ return __newInstance(__reference().changeContext(newContext));
+ }
+
+ default ObjectPrx __ice_adapterId(String newAdapterId)
+ {
+ if(newAdapterId == null)
+ {
+ newAdapterId = "";
+ }
+
+ if(newAdapterId.equals(__reference().getAdapterId()))
+ {
+ return this;
+ }
+ else
+ {
+ return __newInstance(__reference().changeAdapterId(newAdapterId));
+ }
+ }
+
+ default ObjectPrx __ice_endpoints(Endpoint[] newEndpoints)
+ {
+ if(java.util.Arrays.equals(newEndpoints, __reference().getEndpoints()))
+ {
+ return this;
+ }
+ else
+ {
+ com.zeroc.IceInternal.EndpointI[] edpts = new com.zeroc.IceInternal.EndpointI[newEndpoints.length];
+ edpts = java.util.Arrays.asList(newEndpoints).toArray(edpts);
+ return __newInstance(__reference().changeEndpoints(edpts));
+ }
+ }
+
+ default ObjectPrx __ice_locatorCacheTimeout(int newTimeout)
+ {
+ if(newTimeout < -1)
+ {
+ throw new IllegalArgumentException("invalid value passed to ice_locatorCacheTimeout: " + newTimeout);
+ }
+ if(newTimeout == __reference().getLocatorCacheTimeout())
+ {
+ return this;
+ }
+ else
+ {
+ return __newInstance(__reference().changeLocatorCacheTimeout(newTimeout));
+ }
+ }
+
+ default ObjectPrx __ice_invocationTimeout(int newTimeout)
+ {
+ if(newTimeout < 1 && newTimeout != -1 && newTimeout != -2)
+ {
+ throw new IllegalArgumentException("invalid value passed to ice_invocationTimeout: " + newTimeout);
+ }
+ if(newTimeout == __reference().getInvocationTimeout())
+ {
+ return this;
+ }
+ else
+ {
+ return __newInstance(__reference().changeInvocationTimeout(newTimeout));
+ }
+ }
+
+ default ObjectPrx __ice_connectionCached(boolean newCache)
+ {
+ if(newCache == __reference().getCacheConnection())
+ {
+ return this;
+ }
+ else
+ {
+ return __newInstance(__reference().changeCacheConnection(newCache));
+ }
+ }
+
+ default ObjectPrx __ice_endpointSelection(EndpointSelectionType newType)
+ {
+ if(newType == __reference().getEndpointSelection())
+ {
+ return this;
+ }
+ else
+ {
+ return __newInstance(__reference().changeEndpointSelection(newType));
+ }
+ }
+
+ default ObjectPrx __ice_secure(boolean b)
+ {
+ if(b == __reference().getSecure())
+ {
+ return this;
+ }
+ else
+ {
+ return __newInstance(__reference().changeSecure(b));
+ }
+ }
+
+ default ObjectPrx __ice_encodingVersion(EncodingVersion e)
+ {
+ if(e.equals(__reference().getEncoding()))
+ {
+ return this;
+ }
+ else
+ {
+ return __newInstance(__reference().changeEncoding(e));
+ }
+ }
+
+ default ObjectPrx __ice_preferSecure(boolean b)
+ {
+ if(b == __reference().getPreferSecure())
+ {
+ return this;
+ }
+ else
+ {
+ return __newInstance(__reference().changePreferSecure(b));
+ }
+ }
+
+ default ObjectPrx __ice_router(RouterPrx router)
+ {
+ com.zeroc.IceInternal.Reference ref = __reference().changeRouter(router);
+ if(ref.equals(__reference()))
+ {
+ return this;
+ }
+ else
+ {
+ return __newInstance(ref);
+ }
+ }
+
+ default ObjectPrx __ice_locator(LocatorPrx locator)
+ {
+ com.zeroc.IceInternal.Reference ref = __reference().changeLocator(locator);
+ if(ref.equals(__reference()))
+ {
+ return this;
+ }
+ else
+ {
+ return __newInstance(ref);
+ }
+ }
+
+ default ObjectPrx __ice_collocationOptimized(boolean b)
+ {
+ if(b == __reference().getCollocationOptimized())
+ {
+ return this;
+ }
+ else
+ {
+ return __newInstance(__reference().changeCollocationOptimized(b));
+ }
+ }
+
+ default ObjectPrx __ice_twoway()
+ {
+ if(__reference().getMode() == com.zeroc.IceInternal.Reference.ModeTwoway)
+ {
+ return this;
+ }
+ else
+ {
+ return __newInstance(__reference().changeMode(com.zeroc.IceInternal.Reference.ModeTwoway));
+ }
+ }
+
+ default ObjectPrx __ice_oneway()
+ {
+ if(__reference().getMode() == com.zeroc.IceInternal.Reference.ModeOneway)
+ {
+ return this;
+ }
+ else
+ {
+ return __newInstance(__reference().changeMode(com.zeroc.IceInternal.Reference.ModeOneway));
+ }
+ }
+
+ default ObjectPrx __ice_batchOneway()
+ {
+ if(__reference().getMode() == com.zeroc.IceInternal.Reference.ModeBatchOneway)
+ {
+ return this;
+ }
+ else
+ {
+ return __newInstance(__reference().changeMode(com.zeroc.IceInternal.Reference.ModeBatchOneway));
+ }
+ }
+
+ default ObjectPrx __ice_datagram()
+ {
+ if(__reference().getMode() == com.zeroc.IceInternal.Reference.ModeDatagram)
+ {
+ return this;
+ }
+ else
+ {
+ return __newInstance(__reference().changeMode(com.zeroc.IceInternal.Reference.ModeDatagram));
+ }
+ }
+
+ default ObjectPrx __ice_batchDatagram()
+ {
+ if(__reference().getMode() == com.zeroc.IceInternal.Reference.ModeBatchDatagram)
+ {
+ return this;
+ }
+ else
+ {
+ return __newInstance(__reference().changeMode(com.zeroc.IceInternal.Reference.ModeBatchDatagram));
+ }
+ }
+
+ default ObjectPrx __ice_compress(boolean co)
+ {
+ com.zeroc.IceInternal.Reference ref = __reference().changeCompress(co);
+ if(ref.equals(__reference()))
+ {
+ return this;
+ }
+ else
+ {
+ return __newInstance(ref);
+ }
+ }
+
+ default ObjectPrx __ice_timeout(int t)
+ {
+ if(t < 1 && t != -1)
+ {
+ throw new IllegalArgumentException("invalid value passed to ice_timeout: " + t);
+ }
+ com.zeroc.IceInternal.Reference ref = __reference().changeTimeout(t);
+ if(ref.equals(__reference()))
+ {
+ return this;
+ }
+ else
+ {
+ return __newInstance(ref);
+ }
+ }
+
+ default ObjectPrx __ice_connectionId(String connectionId)
+ {
+ com.zeroc.IceInternal.Reference ref = __reference().changeConnectionId(connectionId);
+ if(ref.equals(__reference()))
+ {
+ return this;
+ }
+ else
+ {
+ return __newInstance(ref);
+ }
+ }
+
+ static final java.util.Map<String, String> noExplicitContext = new java.util.HashMap<>();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/OptionalFormat.java b/java/src/Ice/src/main/java/com/zeroc/Ice/OptionalFormat.java
new file mode 100644
index 00000000000..b1460bf6da7
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/OptionalFormat.java
@@ -0,0 +1,70 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * The optional type.
+ *
+ * An optional value is encoded with a specific optional format. This optional
+ * format describes how the data is encoded and how it can be skipped by the
+ * unmarshaling code if the optional is not known to the receiver.
+ *
+ **/
+public enum OptionalFormat
+{
+ F1(0),
+ F2(1),
+ F4(2),
+ F8(3),
+ Size(4),
+ VSize(5),
+ FSize(6),
+ Class(7);
+
+ private
+ OptionalFormat(int value)
+ {
+ _value = value;
+ }
+
+ public int
+ value()
+ {
+ return _value;
+ }
+
+ public static OptionalFormat
+ valueOf(int v)
+ {
+ switch(v)
+ {
+ case 0:
+ return F1;
+ case 1:
+ return F2;
+ case 2:
+ return F4;
+ case 3:
+ return F8;
+ case 4:
+ return Size;
+ case 5:
+ return VSize;
+ case 6:
+ return FSize;
+ case 7:
+ return Class;
+ default:
+ throw new IllegalArgumentException();
+ }
+ }
+
+ private int _value;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/OutputStream.java b/java/src/Ice/src/main/java/com/zeroc/Ice/OutputStream.java
new file mode 100644
index 00000000000..051bd3fa320
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/OutputStream.java
@@ -0,0 +1,2434 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+public class OutputStream
+{
+ /**
+ * Constructing an OutputStream without providing a communicator means the stream will
+ * use the default encoding version, the default format for class encoding, and a
+ * non-direct buffer. You can supply a communicator later by calling initialize().
+ **/
+ public OutputStream()
+ {
+ this(false);
+ }
+
+ /**
+ * Constructing an OutputStream without providing a communicator means the stream will
+ * use the default encoding version and the default format for class encoding.
+ * You can supply a communicator later by calling initialize().
+ *
+ * @param direct Indicates whether to use a direct buffer.
+ **/
+ public OutputStream(boolean direct)
+ {
+ _buf = new com.zeroc.IceInternal.Buffer(direct);
+ _instance = null;
+ _closure = null;
+ _encoding = com.zeroc.IceInternal.Protocol.currentEncoding;
+ _format = FormatType.CompactFormat;
+ }
+
+ /**
+ * This constructor uses the communicator's default encoding version.
+ *
+ * @param communicator The communicator to use when initializing the stream.
+ **/
+ public OutputStream(Communicator communicator)
+ {
+ assert(communicator != null);
+ final com.zeroc.IceInternal.Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator);
+ initialize(instance, instance.defaultsAndOverrides().defaultEncoding, instance.cacheMessageBuffers() > 1);
+ }
+
+ /**
+ * This constructor uses the communicator's default encoding version.
+ *
+ * @param communicator The communicator to use when initializing the stream.
+ * @param direct Indicates whether to use a direct buffer.
+ **/
+ public OutputStream(Communicator communicator, boolean direct)
+ {
+ assert(communicator != null);
+ final com.zeroc.IceInternal.Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator);
+ initialize(instance, instance.defaultsAndOverrides().defaultEncoding, direct);
+ }
+
+ /**
+ * This constructor uses the given communicator and encoding version.
+ *
+ * @param communicator The communicator to use when initializing the stream.
+ * @param encoding The desired Ice encoding version.
+ **/
+ public OutputStream(Communicator communicator, EncodingVersion encoding)
+ {
+ assert(communicator != null);
+ final com.zeroc.IceInternal.Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator);
+ initialize(instance, encoding, instance.cacheMessageBuffers() > 1);
+ }
+
+ /**
+ * This constructor uses the given communicator and encoding version.
+ *
+ * @param communicator The communicator to use when initializing the stream.
+ * @param encoding The desired Ice encoding version.
+ * @param direct Indicates whether to use a direct buffer.
+ **/
+ public OutputStream(Communicator communicator, EncodingVersion encoding, boolean direct)
+ {
+ assert(communicator != null);
+ final com.zeroc.IceInternal.Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator);
+ initialize(instance, encoding, direct);
+ }
+
+ public OutputStream(com.zeroc.IceInternal.Instance instance, EncodingVersion encoding)
+ {
+ initialize(instance, encoding, instance.cacheMessageBuffers() > 1);
+ }
+
+ public OutputStream(com.zeroc.IceInternal.Instance instance, EncodingVersion encoding, boolean direct)
+ {
+ initialize(instance, encoding, direct);
+ }
+
+ public OutputStream(com.zeroc.IceInternal.Instance instance, EncodingVersion encoding,
+ com.zeroc.IceInternal.Buffer buf, boolean adopt)
+ {
+ initialize(instance, encoding, new com.zeroc.IceInternal.Buffer(buf, adopt));
+ }
+
+ /**
+ * Initializes the stream to use the communicator's default encoding version and class
+ * encoding format.
+ *
+ * @param communicator The communicator to use when initializing the stream.
+ **/
+ public void initialize(Communicator communicator)
+ {
+ assert(communicator != null);
+ final com.zeroc.IceInternal.Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator);
+ initialize(instance, instance.defaultsAndOverrides().defaultEncoding, instance.cacheMessageBuffers() > 1);
+ }
+
+ /**
+ * Initializes the stream to use the given encoding version and the communicator's
+ * default class encoding format.
+ *
+ * @param communicator The communicator to use when initializing the stream.
+ * @param encoding The desired Ice encoding version.
+ **/
+ public void initialize(Communicator communicator, EncodingVersion encoding)
+ {
+ assert(communicator != null);
+ final com.zeroc.IceInternal.Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator);
+ initialize(instance, encoding, instance.cacheMessageBuffers() > 1);
+ }
+
+ private void initialize(com.zeroc.IceInternal.Instance instance, EncodingVersion encoding, boolean direct)
+ {
+ initialize(instance, encoding, new com.zeroc.IceInternal.Buffer(direct));
+ }
+
+ private void initialize(com.zeroc.IceInternal.Instance instance, EncodingVersion encoding,
+ com.zeroc.IceInternal.Buffer buf)
+ {
+ assert(instance != null);
+
+ _instance = instance;
+ _buf = buf;
+ _closure = null;
+ _encoding = encoding;
+
+ _format = _instance.defaultsAndOverrides().defaultFormat;
+
+ _encapsStack = null;
+ _encapsCache = null;
+ }
+
+ /**
+ * Resets this output stream. This method allows the stream to be reused, to avoid creating
+ * unnecessary garbage.
+ **/
+ public void reset()
+ {
+ _buf.reset();
+ clear();
+ }
+
+ /**
+ * Releases any data retained by encapsulations. The {@link #reset} method internally calls </code>clear</code>.
+ **/
+ public void clear()
+ {
+ if(_encapsStack != null)
+ {
+ assert(_encapsStack.next == null);
+ _encapsStack.next = _encapsCache;
+ _encapsCache = _encapsStack;
+ _encapsCache.reset();
+ _encapsStack = null;
+ }
+ }
+
+ public com.zeroc.IceInternal.Instance instance()
+ {
+ return _instance;
+ }
+
+ /**
+ * Sets the encoding format for class and exception instances.
+ *
+ * @param fmt The encoding format.
+ **/
+ public void setFormat(FormatType fmt)
+ {
+ _format = fmt;
+ }
+
+ /**
+ * Retrieves the closure object associated with this stream.
+ *
+ * @return The closure object.
+ **/
+ public Object getClosure()
+ {
+ return _closure;
+ }
+
+ /**
+ * Associates a closure object with this stream.
+ *
+ * @param p The new closure object.
+ * @return The previous closure object, or null.
+ **/
+ public Object setClosure(Object p)
+ {
+ Object prev = _closure;
+ _closure = p;
+ return prev;
+ }
+
+ /**
+ * Indicates that marshaling is finished.
+ *
+ * @return The byte sequence containing the encoded data.
+ **/
+ public byte[] finished()
+ {
+ com.zeroc.IceInternal.Buffer buf = prepareWrite();
+ byte[] result = new byte[buf.b.limit()];
+ buf.b.get(result);
+ return result;
+ }
+
+ /**
+ * Swaps the contents of one stream with another.
+ *
+ * @param other The other stream.
+ **/
+ public void swap(OutputStream other)
+ {
+ assert(_instance == other._instance);
+
+ com.zeroc.IceInternal.Buffer tmpBuf = other._buf;
+ other._buf = _buf;
+ _buf = tmpBuf;
+
+ EncodingVersion tmpEncoding = other._encoding;
+ other._encoding = _encoding;
+ _encoding = tmpEncoding;
+
+ Object tmpClosure = other._closure;
+ other._closure = _closure;
+ _closure = tmpClosure;
+
+ //
+ // Swap is never called for streams that have encapsulations being written. However,
+ // encapsulations might still be set in case marshalling failed. We just
+ // reset the encapsulations if there are still some set.
+ //
+ resetEncapsulation();
+ other.resetEncapsulation();
+ }
+
+ private void resetEncapsulation()
+ {
+ _encapsStack = null;
+ }
+
+ /**
+ * Resizes the stream to a new size.
+ *
+ * @param sz The new size.
+ **/
+ public void resize(int sz)
+ {
+ _buf.resize(sz, false);
+ _buf.b.position(sz);
+ }
+
+ /**
+ * Prepares the internal data buffer to be written to a socket.
+ **/
+ public com.zeroc.IceInternal.Buffer prepareWrite()
+ {
+ _buf.b.limit(_buf.size());
+ _buf.b.position(0);
+ return _buf;
+ }
+
+ /**
+ * Retrieves the internal data buffer.
+ *
+ * @return The buffer.
+ **/
+ public com.zeroc.IceInternal.Buffer getBuffer()
+ {
+ return _buf;
+ }
+
+ /**
+ * Marks the start of a class instance.
+ *
+ * @param data Preserved slices for this instance, or null.
+ **/
+ public void startValue(SlicedData data)
+ {
+ assert(_encapsStack != null && _encapsStack.encoder != null);
+ _encapsStack.encoder.startInstance(SliceType.ValueSlice, data);
+ }
+
+ /**
+ * Marks the end of a class instance.
+ **/
+ public void endValue()
+ {
+ assert(_encapsStack != null && _encapsStack.encoder != null);
+ _encapsStack.encoder.endInstance();
+ }
+
+ /**
+ * Marks the start of a user exception.
+ *
+ * @param data Preserved slices for this exception, or null.
+ **/
+ public void startException(SlicedData data)
+ {
+ assert(_encapsStack != null && _encapsStack.encoder != null);
+ _encapsStack.encoder.startInstance(SliceType.ExceptionSlice, data);
+ }
+
+ /**
+ * Marks the end of a user exception.
+ **/
+ public void endException()
+ {
+ assert(_encapsStack != null && _encapsStack.encoder != null);
+ _encapsStack.encoder.endInstance();
+ }
+
+ /**
+ * Writes the start of an encapsulation to the stream.
+ **/
+ public void startEncapsulation()
+ {
+ //
+ // If no encoding version is specified, use the current write
+ // encapsulation encoding version if there's a current write
+ // encapsulation, otherwise, use the stream encoding version.
+ //
+
+ if(_encapsStack != null)
+ {
+ startEncapsulation(_encapsStack.encoding, _encapsStack.format);
+ }
+ else
+ {
+ startEncapsulation(_encoding, FormatType.DefaultFormat);
+ }
+ }
+
+ /**
+ * Writes the start of an encapsulation to the stream.
+ *
+ * @param encoding The encoding version of the encapsulation.
+ *
+ * @param format Specify the compact or sliced format.
+ *
+ **/
+ public void startEncapsulation(EncodingVersion encoding, FormatType format)
+ {
+ com.zeroc.IceInternal.Protocol.checkSupportedEncoding(encoding);
+
+ Encaps curr = _encapsCache;
+ if(curr != null)
+ {
+ curr.reset();
+ _encapsCache = _encapsCache.next;
+ }
+ else
+ {
+ curr = new Encaps();
+ }
+ curr.next = _encapsStack;
+ _encapsStack = curr;
+
+ _encapsStack.format = format;
+ _encapsStack.setEncoding(encoding);
+ _encapsStack.start = _buf.size();
+
+ writeInt(0); // Placeholder for the encapsulation length.
+ _encapsStack.encoding.ice_write(this);
+ }
+
+ /**
+ * Ends the previous encapsulation.
+ **/
+ public void endEncapsulation()
+ {
+ assert(_encapsStack != null);
+
+ // Size includes size and version.
+ int start = _encapsStack.start;
+ int sz = _buf.size() - start;
+ _buf.b.putInt(start, sz);
+
+ Encaps curr = _encapsStack;
+ _encapsStack = curr.next;
+ curr.next = _encapsCache;
+ _encapsCache = curr;
+ _encapsCache.reset();
+ }
+
+ /**
+ * Writes an empty encapsulation using the given encoding version.
+ *
+ * @param encoding The desired encoding version.
+ **/
+ public void writeEmptyEncapsulation(EncodingVersion encoding)
+ {
+ com.zeroc.IceInternal.Protocol.checkSupportedEncoding(encoding);
+ writeInt(6); // Size
+ encoding.ice_write(this);
+ }
+
+ /**
+ * Writes a pre-encoded encapsulation.
+ *
+ * @param v The encapsulation data.
+ **/
+ public void writeEncapsulation(byte[] v)
+ {
+ if(v.length < 6)
+ {
+ throw new EncapsulationException();
+ }
+ expand(v.length);
+ _buf.b.put(v);
+ }
+
+ /**
+ * Determines the current encoding version.
+ *
+ * @return The encoding version.
+ **/
+ public EncodingVersion getEncoding()
+ {
+ return _encapsStack != null ? _encapsStack.encoding : _encoding;
+ }
+
+ /**
+ * Marks the start of a new slice for a class instance or user exception.
+ *
+ * @param typeId The Slice type ID corresponding to this slice.
+
+ * @param compactId The Slice compact type ID corresponding to
+ * this slice or -1 if no compact ID is defined for the
+ * type ID.
+
+ * @param last True if this is the last slice, false otherwise.
+ **/
+ public void startSlice(String typeId, int compactId, boolean last)
+ {
+ assert(_encapsStack != null && _encapsStack.encoder != null);
+ _encapsStack.encoder.startSlice(typeId, compactId, last);
+ }
+
+ /**
+ * Marks the end of a slice for a class instance or user exception.
+ **/
+ public void endSlice()
+ {
+ assert(_encapsStack != null && _encapsStack.encoder != null);
+ _encapsStack.encoder.endSlice();
+ }
+
+ /**
+ * Writes the state of Slice classes whose index was previously
+ * written with {@link #writeValue} to the stream.
+ **/
+ public void writePendingValues()
+ {
+ if(_encapsStack != null && _encapsStack.encoder != null)
+ {
+ _encapsStack.encoder.writePendingValues();
+ }
+ else if(_encapsStack != null ? _encapsStack.encoding_1_0 : _encoding.equals(Util.Encoding_1_0))
+ {
+ //
+ // If using the 1.0 encoding and no instances were written, we
+ // still write an empty sequence for pending instances if
+ // requested (i.e.: if this is called).
+ //
+ // This is required by the 1.0 encoding, even if no instances
+ // are written we do marshal an empty sequence if marshaled
+ // data types use classes.
+ //
+ writeSize(0);
+ }
+ }
+
+ /**
+ * Writes a size to the stream.
+ *
+ * @param v The size to write.
+ **/
+ public void writeSize(int v)
+ {
+ if(v > 254)
+ {
+ expand(5);
+ _buf.b.put((byte)-1);
+ _buf.b.putInt(v);
+ }
+ else
+ {
+ expand(1);
+ _buf.b.put((byte)v);
+ }
+ }
+
+ /**
+ * Returns the current position and allocates four bytes for a fixed-length (32-bit)
+ * size value.
+ *
+ * @return The current position.
+ **/
+ public int startSize()
+ {
+ int pos = _buf.b.position();
+ writeInt(0); // Placeholder for 32-bit size
+ return pos;
+ }
+
+ /**
+ * Computes the amount of data written since the previous call to startSize and
+ * writes that value at the saved position.
+ *
+ * @param pos The saved position.
+ **/
+ public void endSize(int pos)
+ {
+ assert(pos >= 0);
+ rewriteInt(_buf.b.position() - pos - 4, pos);
+ }
+
+ /**
+ * Writes a blob of bytes to the stream.
+ *
+ * @param v The byte array to be written. All of the bytes in the array are written.
+ **/
+ public void writeBlob(byte[] v)
+ {
+ if(v == null)
+ {
+ return;
+ }
+ expand(v.length);
+ _buf.b.put(v);
+ }
+
+ /**
+ * Writes a blob of bytes to the stream.
+ *
+ * @param v The byte array to be written.
+ * @param off The offset into the byte array from which to copy.
+ * @param len The number of bytes from the byte array to copy.
+ **/
+ public void writeBlob(byte[] v, int off, int len)
+ {
+ if(v == null)
+ {
+ return;
+ }
+ expand(len);
+ _buf.b.put(v, off, len);
+ }
+
+ /**
+ * Write the header information for an optional value.
+ *
+ * @param tag The numeric tag associated with the value.
+ * @param format The optional format of the value.
+ **/
+ public boolean writeOptional(int tag, OptionalFormat format)
+ {
+ assert(_encapsStack != null);
+ if(_encapsStack.encoder != null)
+ {
+ return _encapsStack.encoder.writeOptional(tag, format);
+ }
+ else
+ {
+ return writeOptionalImpl(tag, format);
+ }
+ }
+
+ /**
+ * Writes a byte to the stream.
+ *
+ * @param v The byte to write to the stream.
+ **/
+ public void writeByte(byte v)
+ {
+ expand(1);
+ _buf.b.put(v);
+ }
+
+ /**
+ * Writes an optional byte to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The optional byte to write to the stream.
+ **/
+ public void writeByte(int tag, java.util.Optional<Byte> v)
+ {
+ if(v != null && v.isPresent())
+ {
+ writeByte(tag, v.get());
+ }
+ }
+
+ /**
+ * Writes an optional byte to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The byte to write to the stream.
+ **/
+ public void writeByte(int tag, byte v)
+ {
+ if(writeOptional(tag, OptionalFormat.F1))
+ {
+ writeByte(v);
+ }
+ }
+
+ /**
+ * Writes a byte to the stream at the given position. The current position of the stream is not modified.
+ *
+ * @param v The byte to write to the stream.
+ * @param dest The position at which to store the byte in the buffer.
+ **/
+ public void rewriteByte(byte v, int dest)
+ {
+ _buf.b.put(dest, v);
+ }
+
+ /**
+ * Writes a byte sequence to the stream.
+ *
+ * @param v The byte sequence to write to the stream.
+ * Passing <code>null</code> causes an empty sequence to be written to the stream.
+ **/
+ public void writeByteSeq(byte[] v)
+ {
+ if(v == null)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ writeSize(v.length);
+ expand(v.length);
+ _buf.b.put(v);
+ }
+ }
+
+ /**
+ * Writes an optional byte sequence to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The optional byte sequence to write to the stream.
+ **/
+ public void writeByteSeq(int tag, java.util.Optional<byte[]> v)
+ {
+ if(v != null && v.isPresent())
+ {
+ writeByteSeq(tag, v.get());
+ }
+ }
+
+ /**
+ * Writes an optional byte sequence to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The byte sequence to write to the stream.
+ **/
+ public void writeByteSeq(int tag, byte[] v)
+ {
+ if(writeOptional(tag, OptionalFormat.VSize))
+ {
+ writeByteSeq(v);
+ }
+ }
+
+ /**
+ * Writes the remaining contents of the byte buffer as a byte sequence to the stream.
+ *
+ * @param v The byte buffer to write to the stream.
+ **/
+ public void writeByteBuffer(java.nio.ByteBuffer v)
+ {
+ if(v == null || v.remaining() == 0)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ writeSize(v.remaining());
+ expand(v.remaining());
+ _buf.b.put(v);
+ }
+ }
+
+ /**
+ * Writes a serializable Java object to the stream.
+ *
+ * @param o The serializable object to write.
+ **/
+ public void writeSerializable(java.io.Serializable o)
+ {
+ if(o == null)
+ {
+ writeSize(0);
+ return;
+ }
+ try
+ {
+ com.zeroc.IceInternal.OutputStreamWrapper w = new com.zeroc.IceInternal.OutputStreamWrapper(this);
+ java.io.ObjectOutputStream out = new java.io.ObjectOutputStream(w);
+ out.writeObject(o);
+ out.close();
+ w.close();
+ }
+ catch(java.lang.Exception ex)
+ {
+ throw new MarshalException("cannot serialize object: " + ex);
+ }
+ }
+
+ /**
+ * Writes a boolean to the stream.
+ *
+ * @param v The boolean to write to the stream.
+ **/
+ public void writeBool(boolean v)
+ {
+ expand(1);
+ _buf.b.put(v ? (byte)1 : (byte)0);
+ }
+
+ /**
+ * Writes an optional boolean to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The optional boolean to write to the stream.
+ **/
+ public void writeBool(int tag, java.util.Optional<Boolean> v)
+ {
+ if(v != null && v.isPresent())
+ {
+ writeBool(tag, v.get());
+ }
+ }
+
+ /**
+ * Writes an optional boolean to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The boolean to write to the stream.
+ **/
+ public void writeBool(int tag, boolean v)
+ {
+ if(writeOptional(tag, OptionalFormat.F1))
+ {
+ writeBool(v);
+ }
+ }
+
+ /**
+ * Writes a boolean to the stream at the given position. The current position of the stream is not modified.
+ *
+ * @param v The boolean to write to the stream.
+ * @param dest The position at which to store the boolean in the buffer.
+ **/
+ public void rewriteBool(boolean v, int dest)
+ {
+ _buf.b.put(dest, v ? (byte)1 : (byte)0);
+ }
+
+ /**
+ * Writes a boolean sequence to the stream.
+ *
+ * @param v The boolean sequence to write to the stream.
+ * Passing <code>null</code> causes an empty sequence to be written to the stream.
+ **/
+ public void writeBoolSeq(boolean[] v)
+ {
+ if(v == null)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ writeSize(v.length);
+ expand(v.length);
+ for(boolean b : v)
+ {
+ _buf.b.put(b ? (byte)1 : (byte)0);
+ }
+ }
+ }
+
+ /**
+ * Writes an optional boolean sequence to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The optional boolean sequence to write to the stream.
+ **/
+ public void writeBoolSeq(int tag, java.util.Optional<boolean[]> v)
+ {
+ if(v != null && v.isPresent())
+ {
+ writeBoolSeq(tag, v.get());
+ }
+ }
+
+ /**
+ * Writes an optional boolean sequence to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The boolean sequence to write to the stream.
+ **/
+ public void writeBoolSeq(int tag, boolean[] v)
+ {
+ if(writeOptional(tag, OptionalFormat.VSize))
+ {
+ writeBoolSeq(v);
+ }
+ }
+
+ /**
+ * Writes a short to the stream.
+ *
+ * @param v The short to write to the stream.
+ **/
+ public void writeShort(short v)
+ {
+ expand(2);
+ _buf.b.putShort(v);
+ }
+
+ /**
+ * Writes an optional short to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The optional short to write to the stream.
+ **/
+ public void writeShort(int tag, java.util.Optional<Short> v)
+ {
+ if(v != null && v.isPresent())
+ {
+ writeShort(tag, v.get());
+ }
+ }
+
+ /**
+ * Writes an optional short to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The short to write to the stream.
+ **/
+ public void writeShort(int tag, short v)
+ {
+ if(writeOptional(tag, OptionalFormat.F2))
+ {
+ writeShort(v);
+ }
+ }
+
+ /**
+ * Writes a short sequence to the stream.
+ *
+ * @param v The short sequence to write to the stream.
+ * Passing <code>null</code> causes an empty sequence to be written to the stream.
+ **/
+ public void writeShortSeq(short[] v)
+ {
+ if(v == null)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ writeSize(v.length);
+ expand(v.length * 2);
+ java.nio.ShortBuffer shortBuf = _buf.b.asShortBuffer();
+ shortBuf.put(v);
+ _buf.b.position(_buf.b.position() + v.length * 2);
+ }
+ }
+
+ /**
+ * Writes an optional short sequence to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The optional short sequence to write to the stream.
+ **/
+ public void writeShortSeq(int tag, java.util.Optional<short[]> v)
+ {
+ if(v != null && v.isPresent())
+ {
+ writeShortSeq(tag, v.get());
+ }
+ }
+
+ /**
+ * Writes an optional short sequence to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The short sequence to write to the stream.
+ **/
+ public void writeShortSeq(int tag, short[] v)
+ {
+ if(writeOptional(tag, OptionalFormat.VSize))
+ {
+ writeSize(v == null || v.length == 0 ? 1 : v.length * 2 + (v.length > 254 ? 5 : 1));
+ writeShortSeq(v);
+ }
+ }
+
+ /**
+ * Writes the remaining contents of the short buffer as a short sequence to the stream.
+ *
+ * @param v The short buffer to write to the stream.
+ **/
+ public void writeShortBuffer(java.nio.ShortBuffer v)
+ {
+ if(v == null || v.remaining() == 0)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ int sz = v.remaining();
+ writeSize(sz);
+ expand(sz * 2);
+
+ java.nio.ShortBuffer shortBuf = _buf.b.asShortBuffer();
+ shortBuf.put(v);
+ _buf.b.position(_buf.b.position() + sz * 2);
+ }
+ }
+
+ /**
+ * Writes an int to the stream.
+ *
+ * @param v The int to write to the stream.
+ **/
+ public void writeInt(int v)
+ {
+ expand(4);
+ _buf.b.putInt(v);
+ }
+
+ /**
+ * Writes an optional int to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The optional int to write to the stream.
+ **/
+ public void writeInt(int tag, java.util.OptionalInt v)
+ {
+ if(v != null && v.isPresent())
+ {
+ writeInt(tag, v.getAsInt());
+ }
+ }
+
+ /**
+ * Writes an optional int to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The int to write to the stream.
+ **/
+ public void writeInt(int tag, int v)
+ {
+ if(writeOptional(tag, OptionalFormat.F4))
+ {
+ writeInt(v);
+ }
+ }
+
+ /**
+ * Writes an int to the stream at the given position. The current position of the stream is not modified.
+ *
+ * @param v The int to write to the stream.
+ * @param dest The position at which to store the int in the buffer.
+ **/
+ public void rewriteInt(int v, int dest)
+ {
+ _buf.b.putInt(dest, v);
+ }
+
+ /**
+ * Writes an int sequence to the stream.
+ *
+ * @param v The int sequence to write to the stream.
+ * Passing <code>null</code> causes an empty sequence to be written to the stream.
+ **/
+ public void writeIntSeq(int[] v)
+ {
+ if(v == null)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ writeSize(v.length);
+ expand(v.length * 4);
+ java.nio.IntBuffer intBuf = _buf.b.asIntBuffer();
+ intBuf.put(v);
+ _buf.b.position(_buf.b.position() + v.length * 4);
+ }
+ }
+
+ /**
+ * Writes an optional int sequence to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The optional int sequence to write to the stream.
+ **/
+ public void writeIntSeq(int tag, java.util.Optional<int[]> v)
+ {
+ if(v != null && v.isPresent())
+ {
+ writeIntSeq(tag, v.get());
+ }
+ }
+
+ /**
+ * Writes an optional int sequence to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The int sequence to write to the stream.
+ **/
+ public void writeIntSeq(int tag, int[] v)
+ {
+ if(writeOptional(tag, OptionalFormat.VSize))
+ {
+ writeSize(v == null || v.length == 0 ? 1 : v.length * 4 + (v.length > 254 ? 5 : 1));
+ writeIntSeq(v);
+ }
+ }
+
+ /**
+ * Writes the remaining contents of the int buffer as an int sequence to the stream.
+ *
+ * @param v The int buffer to write to the stream.
+ **/
+ public void writeIntBuffer(java.nio.IntBuffer v)
+ {
+ if(v == null || v.remaining() == 0)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ int sz = v.remaining();
+ writeSize(sz);
+ expand(sz * 4);
+
+ java.nio.IntBuffer intBuf = _buf.b.asIntBuffer();
+ intBuf.put(v);
+ _buf.b.position(_buf.b.position() + sz * 4);
+ }
+ }
+
+ /**
+ * Writes a long to the stream.
+ *
+ * @param v The long to write to the stream.
+ **/
+ public void writeLong(long v)
+ {
+ expand(8);
+ _buf.b.putLong(v);
+ }
+
+ /**
+ * Writes an optional long to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The optional long to write to the stream.
+ **/
+ public void writeLong(int tag, java.util.OptionalLong v)
+ {
+ if(v != null && v.isPresent())
+ {
+ writeLong(tag, v.getAsLong());
+ }
+ }
+
+ /**
+ * Writes an optional long to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The long to write to the stream.
+ **/
+ public void writeLong(int tag, long v)
+ {
+ if(writeOptional(tag, OptionalFormat.F8))
+ {
+ writeLong(v);
+ }
+ }
+
+ /**
+ * Writes a long sequence to the stream.
+ *
+ * @param v The long sequence to write to the stream.
+ * Passing <code>null</code> causes an empty sequence to be written to the stream.
+ **/
+ public void writeLongSeq(long[] v)
+ {
+ if(v == null)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ writeSize(v.length);
+ expand(v.length * 8);
+ java.nio.LongBuffer longBuf = _buf.b.asLongBuffer();
+ longBuf.put(v);
+ _buf.b.position(_buf.b.position() + v.length * 8);
+ }
+ }
+
+ /**
+ * Writes an optional long sequence to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The optional long sequence to write to the stream.
+ **/
+ public void writeLongSeq(int tag, java.util.Optional<long[]> v)
+ {
+ if(v != null && v.isPresent())
+ {
+ writeLongSeq(tag, v.get());
+ }
+ }
+
+ /**
+ * Writes an optional long sequence to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The long sequence to write to the stream.
+ **/
+ public void writeLongSeq(int tag, long[] v)
+ {
+ if(writeOptional(tag, OptionalFormat.VSize))
+ {
+ writeSize(v == null || v.length == 0 ? 1 : v.length * 8 + (v.length > 254 ? 5 : 1));
+ writeLongSeq(v);
+ }
+ }
+
+ /**
+ * Writes the remaining contents of the long buffer as a long sequence to the stream.
+ *
+ * @param v The long buffer to write to the stream.
+ **/
+ public void writeLongBuffer(java.nio.LongBuffer v)
+ {
+ if(v == null || v.remaining() == 0)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ int sz = v.remaining();
+ writeSize(sz);
+ expand(sz * 8);
+
+ java.nio.LongBuffer longBuf = _buf.b.asLongBuffer();
+ longBuf.put(v);
+ _buf.b.position(_buf.b.position() + sz * 8);
+ }
+ }
+
+ /**
+ * Writes a float to the stream.
+ *
+ * @param v The float to write to the stream.
+ **/
+ public void writeFloat(float v)
+ {
+ expand(4);
+ _buf.b.putFloat(v);
+ }
+
+ /**
+ * Writes an optional float to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The optional float to write to the stream.
+ **/
+ public void writeFloat(int tag, java.util.Optional<Float> v)
+ {
+ if(v != null && v.isPresent())
+ {
+ writeFloat(tag, v.get());
+ }
+ }
+
+ /**
+ * Writes an optional float to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The float to write to the stream.
+ **/
+ public void writeFloat(int tag, float v)
+ {
+ if(writeOptional(tag, OptionalFormat.F4))
+ {
+ writeFloat(v);
+ }
+ }
+
+ /**
+ * Writes a float sequence to the stream.
+ *
+ * @param v The float sequence to write to the stream.
+ * Passing <code>null</code> causes an empty sequence to be written to the stream.
+ **/
+ public void writeFloatSeq(float[] v)
+ {
+ if(v == null)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ writeSize(v.length);
+ expand(v.length * 4);
+ java.nio.FloatBuffer floatBuf = _buf.b.asFloatBuffer();
+ floatBuf.put(v);
+ _buf.b.position(_buf.b.position() + v.length * 4);
+ }
+ }
+
+ /**
+ * Writes an optional float sequence to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The optional float sequence to write to the stream.
+ **/
+ public void writeFloatSeq(int tag, java.util.Optional<float[]> v)
+ {
+ if(v != null && v.isPresent())
+ {
+ writeFloatSeq(tag, v.get());
+ }
+ }
+
+ /**
+ * Writes an optional float sequence to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The float sequence to write to the stream.
+ **/
+ public void writeFloatSeq(int tag, float[] v)
+ {
+ if(writeOptional(tag, OptionalFormat.VSize))
+ {
+ writeSize(v == null || v.length == 0 ? 1 : v.length * 4 + (v.length > 254 ? 5 : 1));
+ writeFloatSeq(v);
+ }
+ }
+
+ /**
+ * Writes the remaining contents of the float buffer as a float sequence to the stream.
+ *
+ * @param v The float buffer to write to the stream.
+ **/
+ public void writeFloatBuffer(java.nio.FloatBuffer v)
+ {
+ if(v == null || v.remaining() == 0)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ int sz = v.remaining();
+ writeSize(sz);
+ expand(sz * 4);
+
+ java.nio.FloatBuffer floatBuf = _buf.b.asFloatBuffer();
+ floatBuf.put(v);
+ _buf.b.position(_buf.b.position() + sz * 4);
+ }
+ }
+
+ /**
+ * Writes a double to the stream.
+ *
+ * @param v The double to write to the stream.
+ **/
+ public void writeDouble(double v)
+ {
+ expand(8);
+ _buf.b.putDouble(v);
+ }
+
+ /**
+ * Writes an optional double to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The optional double to write to the stream.
+ **/
+ public void writeDouble(int tag, java.util.OptionalDouble v)
+ {
+ if(v != null && v.isPresent())
+ {
+ writeDouble(tag, v.getAsDouble());
+ }
+ }
+
+ /**
+ * Writes an optional double to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The double to write to the stream.
+ **/
+ public void writeDouble(int tag, double v)
+ {
+ if(writeOptional(tag, OptionalFormat.F8))
+ {
+ writeDouble(v);
+ }
+ }
+
+ /**
+ * Writes a double sequence to the stream.
+ *
+ * @param v The double sequence to write to the stream.
+ * Passing <code>null</code> causes an empty sequence to be written to the stream.
+ **/
+ public void writeDoubleSeq(double[] v)
+ {
+ if(v == null)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ writeSize(v.length);
+ expand(v.length * 8);
+ java.nio.DoubleBuffer doubleBuf = _buf.b.asDoubleBuffer();
+ doubleBuf.put(v);
+ _buf.b.position(_buf.b.position() + v.length * 8);
+ }
+ }
+
+ /**
+ * Writes an optional double sequence to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The optional double sequence to write to the stream.
+ **/
+ public void writeDoubleSeq(int tag, java.util.Optional<double[]> v)
+ {
+ if(v != null && v.isPresent())
+ {
+ writeDoubleSeq(tag, v.get());
+ }
+ }
+
+ /**
+ * Writes an optional double sequence to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The double sequence to write to the stream.
+ **/
+ public void writeDoubleSeq(int tag, double[] v)
+ {
+ if(writeOptional(tag, OptionalFormat.VSize))
+ {
+ writeSize(v == null || v.length == 0 ? 1 : v.length * 8 + (v.length > 254 ? 5 : 1));
+ writeDoubleSeq(v);
+ }
+ }
+
+ /**
+ * Writes the remaining contents of the double buffer as a double sequence to the stream.
+ *
+ * @param v The double buffer to write to the stream.
+ **/
+ public void writeDoubleBuffer(java.nio.DoubleBuffer v)
+ {
+ if(v == null || v.remaining() == 0)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ int sz = v.remaining();
+ writeSize(sz);
+ expand(sz * 8);
+
+ java.nio.DoubleBuffer doubleBuf = _buf.b.asDoubleBuffer();
+ doubleBuf.put(v);
+ _buf.b.position(_buf.b.position() + sz * 8);
+ }
+ }
+
+ final static java.nio.charset.Charset _utf8 = java.nio.charset.Charset.forName("UTF8");
+ private java.nio.charset.CharsetEncoder _charEncoder = null;
+
+ /**
+ * Writes a string to the stream.
+ *
+ * @param v The string to write to the stream. Passing <code>null</code> causes
+ * an empty string to be written to the stream.
+ **/
+ public void writeString(String v)
+ {
+ if(v == null)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ final int len = v.length();
+ if(len > 0)
+ {
+ if(_stringBytes == null || len > _stringBytes.length)
+ {
+ _stringBytes = new byte[len];
+ }
+ if(_stringChars == null || len > _stringChars.length)
+ {
+ _stringChars = new char[len];
+ }
+ //
+ // If the string contains only 7-bit characters, it's more efficient
+ // to perform the conversion to UTF-8 manually.
+ //
+ v.getChars(0, len, _stringChars, 0);
+ for(int i = 0; i < len; ++i)
+ {
+ if(_stringChars[i] > (char)127)
+ {
+ //
+ // Found a multibyte character.
+ //
+ if(_charEncoder == null)
+ {
+ _charEncoder = _utf8.newEncoder();
+ }
+ java.nio.ByteBuffer b = null;
+ try
+ {
+ b = _charEncoder.encode(java.nio.CharBuffer.wrap(_stringChars, 0, len));
+ }
+ catch(java.nio.charset.CharacterCodingException ex)
+ {
+ throw new MarshalException(ex);
+ }
+ writeSize(b.limit());
+ expand(b.limit());
+ _buf.b.put(b);
+ return;
+ }
+ _stringBytes[i] = (byte)_stringChars[i];
+ }
+ writeSize(len);
+ expand(len);
+ _buf.b.put(_stringBytes, 0, len);
+ }
+ else
+ {
+ writeSize(0);
+ }
+ }
+ }
+
+ /**
+ * Writes an optional string to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The optional string to write to the stream.
+ **/
+ public void writeString(int tag, java.util.Optional<String> v)
+ {
+ if(v != null && v.isPresent())
+ {
+ writeString(tag, v.get());
+ }
+ }
+
+ /**
+ * Writes an optional string to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The string to write to the stream.
+ **/
+ public void writeString(int tag, String v)
+ {
+ if(writeOptional(tag, OptionalFormat.VSize))
+ {
+ writeString(v);
+ }
+ }
+
+ /**
+ * Writes a string sequence to the stream.
+ *
+ * @param v The string sequence to write to the stream.
+ * Passing <code>null</code> causes an empty sequence to be written to the stream.
+ **/
+ public void writeStringSeq(String[] v)
+ {
+ if(v == null)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ writeSize(v.length);
+ for(String e : v)
+ {
+ writeString(e);
+ }
+ }
+ }
+
+ /**
+ * Writes an optional string sequence to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The optional string sequence to write to the stream.
+ **/
+ public void writeStringSeq(int tag, java.util.Optional<String[]> v)
+ {
+ if(v != null && v.isPresent())
+ {
+ writeStringSeq(tag, v.get());
+ }
+ }
+
+ /**
+ * Writes an optional string sequence to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The string sequence to write to the stream.
+ **/
+ public void writeStringSeq(int tag, String[] v)
+ {
+ if(writeOptional(tag, OptionalFormat.FSize))
+ {
+ int pos = startSize();
+ writeStringSeq(v);
+ endSize(pos);
+ }
+ }
+
+ /**
+ * Writes a proxy to the stream.
+ *
+ * @param v The proxy to write.
+ **/
+ public void writeProxy(ObjectPrx v)
+ {
+ if(v != null)
+ {
+ v.__write(this);
+ }
+ else
+ {
+ Identity ident = new Identity();
+ ident.ice_write(this);
+ }
+ }
+
+ /**
+ * Writes an optional proxy to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The optional proxy to write to the stream.
+ **/
+ public void writeProxy(int tag, java.util.Optional<ObjectPrx> v)
+ {
+ if(v != null && v.isPresent())
+ {
+ writeProxy(tag, v.get());
+ }
+ }
+
+ /**
+ * Writes an optional proxy to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The proxy to write to the stream.
+ **/
+ public void writeProxy(int tag, ObjectPrx v)
+ {
+ if(writeOptional(tag, OptionalFormat.FSize))
+ {
+ int pos = startSize();
+ writeProxy(v);
+ endSize(pos);
+ }
+ }
+
+ /**
+ * Write an enumerated value.
+ *
+ * @param v The enumerator.
+ * @param maxValue The maximum enumerator value in the definition.
+ **/
+ public void writeEnum(int v, int maxValue)
+ {
+ if(isEncoding_1_0())
+ {
+ if(maxValue < 127)
+ {
+ writeByte((byte)v);
+ }
+ else if(maxValue < 32767)
+ {
+ writeShort((short)v);
+ }
+ else
+ {
+ writeInt(v);
+ }
+ }
+ else
+ {
+ writeSize(v);
+ }
+ }
+
+ /**
+ * Writes a Slice value to the stream.
+ *
+ * @param v The value to write. This method writes the index of an instance; the state of the value is
+ * written once {@link #writePendingValues} is called.
+ **/
+ public void writeValue(Value v)
+ {
+ initEncaps();
+ _encapsStack.encoder.writeValue(v);
+ }
+
+ /**
+ * Writes an optional value to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The optional value to write to the stream.
+ **/
+ public <T extends Value> void writeValue(int tag, java.util.Optional<T> v)
+ {
+ if(v != null && v.isPresent())
+ {
+ writeValue(tag, v.get());
+ }
+ }
+
+ /**
+ * Writes an optional value to the stream.
+ *
+ * @param tag The optional tag.
+ * @param v The value to write to the stream.
+ **/
+ public void writeValue(int tag, Value v)
+ {
+ if(writeOptional(tag, OptionalFormat.Class))
+ {
+ writeValue(v);
+ }
+ }
+
+ /**
+ * Writes a user exception to the stream.
+ *
+ * @param v The user exception to write.
+ **/
+ public void writeException(UserException v)
+ {
+ initEncaps();
+ _encapsStack.encoder.writeException(v);
+ }
+
+ private boolean writeOptionalImpl(int tag, OptionalFormat format)
+ {
+ if(isEncoding_1_0())
+ {
+ return false; // Optional members aren't supported with the 1.0 encoding.
+ }
+
+ int v = format.value();
+ if(tag < 30)
+ {
+ v |= tag << 3;
+ writeByte((byte)v);
+ }
+ else
+ {
+ v |= 0x0F0; // tag = 30
+ writeByte((byte)v);
+ writeSize(tag);
+ }
+ return true;
+ }
+
+ /**
+ * Determines the current position in the stream.
+ *
+ * @return The current position.
+ **/
+ public int pos()
+ {
+ return _buf.b.position();
+ }
+
+ /**
+ * Sets the current position in the stream.
+ *
+ * @param n The new position.
+ **/
+ public void pos(int n)
+ {
+ _buf.b.position(n);
+ }
+
+ /**
+ * Determines the current size of the stream.
+ *
+ * @return The current size.
+ **/
+ public int size()
+ {
+ return _buf.size();
+ }
+
+ /**
+ * Determines whether the stream is empty.
+ *
+ * @return True if no data has been written yet, false otherwise.
+ **/
+ public boolean isEmpty()
+ {
+ return _buf.empty();
+ }
+
+ /**
+ * Expand the stream to accept more data.
+ *
+ * @param n The number of bytes to accommodate in the stream.
+ **/
+ public void expand(int n)
+ {
+ _buf.expand(n);
+ }
+
+ private com.zeroc.IceInternal.Instance _instance;
+ private com.zeroc.IceInternal.Buffer _buf;
+ private Object _closure;
+ private FormatType _format;
+ private byte[] _stringBytes; // Reusable array for string operations.
+ private char[] _stringChars; // Reusable array for string operations.
+
+ private enum SliceType { NoSlice, ValueSlice, ExceptionSlice }
+
+ abstract private static class EncapsEncoder
+ {
+ protected EncapsEncoder(OutputStream stream, Encaps encaps)
+ {
+ _stream = stream;
+ _encaps = encaps;
+ _typeIdIndex = 0;
+ _marshaledMap = new java.util.IdentityHashMap<>();
+ }
+
+ abstract void writeValue(Value v);
+ abstract void writeException(UserException v);
+
+ abstract void startInstance(SliceType type, SlicedData data);
+ abstract void endInstance();
+ abstract void startSlice(String typeId, int compactId, boolean last);
+ abstract void endSlice();
+
+ boolean writeOptional(int tag, OptionalFormat format)
+ {
+ return false;
+ }
+
+ void writePendingValues()
+ {
+ }
+
+ protected int registerTypeId(String typeId)
+ {
+ if(_typeIdMap == null) // Lazy initialization
+ {
+ _typeIdMap = new java.util.TreeMap<>();
+ }
+
+ Integer p = _typeIdMap.get(typeId);
+ if(p != null)
+ {
+ return p;
+ }
+ else
+ {
+ _typeIdMap.put(typeId, ++_typeIdIndex);
+ return -1;
+ }
+ }
+
+ final protected OutputStream _stream;
+ final protected Encaps _encaps;
+
+ // Encapsulation attributes for instance marshaling.
+ final protected java.util.IdentityHashMap<Value, Integer> _marshaledMap;
+ private java.util.TreeMap<String, Integer> _typeIdMap;
+ private int _typeIdIndex;
+ }
+
+ private static final class EncapsEncoder10 extends EncapsEncoder
+ {
+ EncapsEncoder10(OutputStream stream, Encaps encaps)
+ {
+ super(stream, encaps);
+ _sliceType = SliceType.NoSlice;
+ _valueIdIndex = 0;
+ _toBeMarshaledMap = new java.util.IdentityHashMap<>();
+ }
+
+ @Override
+ void writeValue(Value v)
+ {
+ //
+ // Object references are encoded as a negative integer in 1.0.
+ //
+ if(v != null)
+ {
+ _stream.writeInt(-registerValue(v));
+ }
+ else
+ {
+ _stream.writeInt(0);
+ }
+ }
+
+ @Override
+ void writeException(UserException v)
+ {
+ //
+ // User exception with the 1.0 encoding start with a boolean
+ // flag that indicates whether or not the exception uses
+ // classes.
+ //
+ // This allows reading the pending instances even if some part of
+ // the exception was sliced.
+ //
+ boolean usesClasses = v.__usesClasses();
+ _stream.writeBool(usesClasses);
+ v.__write(_stream);
+ if(usesClasses)
+ {
+ writePendingValues();
+ }
+ }
+
+ @Override
+ void startInstance(SliceType sliceType, SlicedData sliceData)
+ {
+ _sliceType = sliceType;
+ }
+
+ @Override
+ void endInstance()
+ {
+ if(_sliceType == SliceType.ValueSlice)
+ {
+ //
+ // Write the Object slice.
+ //
+ startSlice(Value.ice_staticId, -1, true);
+ _stream.writeSize(0); // For compatibility with the old AFM.
+ endSlice();
+ }
+ _sliceType = SliceType.NoSlice;
+ }
+
+ @Override
+ void startSlice(String typeId, int compactId, boolean last)
+ {
+ //
+ // For instance slices, encode a boolean to indicate how the type ID
+ // is encoded and the type ID either as a string or index. For
+ // exception slices, always encode the type ID as a string.
+ //
+ if(_sliceType == SliceType.ValueSlice)
+ {
+ int index = registerTypeId(typeId);
+ if(index < 0)
+ {
+ _stream.writeBool(false);
+ _stream.writeString(typeId);
+ }
+ else
+ {
+ _stream.writeBool(true);
+ _stream.writeSize(index);
+ }
+ }
+ else
+ {
+ _stream.writeString(typeId);
+ }
+
+ _stream.writeInt(0); // Placeholder for the slice length.
+
+ _writeSlice = _stream.pos();
+ }
+
+ @Override
+ void endSlice()
+ {
+ //
+ // Write the slice length.
+ //
+ final int sz = _stream.pos() - _writeSlice + 4;
+ _stream.rewriteInt(sz, _writeSlice - 4);
+ }
+
+ @Override
+ void writePendingValues()
+ {
+ while(_toBeMarshaledMap.size() > 0)
+ {
+ //
+ // Consider the to be marshalled instances as marshaled now,
+ // this is necessary to avoid adding again the "to be
+ // marshaled instances" into _toBeMarshaledMap while writing
+ // instances.
+ //
+ _marshaledMap.putAll(_toBeMarshaledMap);
+
+ java.util.IdentityHashMap<Value, Integer> savedMap = _toBeMarshaledMap;
+ _toBeMarshaledMap = new java.util.IdentityHashMap<>();
+ _stream.writeSize(savedMap.size());
+ for(java.util.Map.Entry<Value, Integer> p : savedMap.entrySet())
+ {
+ //
+ // Ask the instance to marshal itself. Any new class
+ // instances that are triggered by the classes marshaled
+ // are added to toBeMarshaledMap.
+ //
+ _stream.writeInt(p.getValue().intValue());
+
+ try
+ {
+ p.getKey().ice_preMarshal();
+ }
+ catch(java.lang.Exception ex)
+ {
+ String s = "exception raised by ice_preMarshal:\n" + com.zeroc.IceInternal.Ex.toString(ex);
+ _stream.instance().initializationData().logger.warning(s);
+ }
+
+ p.getKey().__write(_stream);
+ }
+ }
+ _stream.writeSize(0); // Zero marker indicates end of sequence of sequences of instances.
+ }
+
+ private int registerValue(Value v)
+ {
+ assert(v != null);
+
+ //
+ // Look for this instance in the to-be-marshaled map.
+ //
+ Integer p = _toBeMarshaledMap.get(v);
+ if(p != null)
+ {
+ return p.intValue();
+ }
+
+ //
+ // Didn't find it, try the marshaled map next.
+ //
+ p = _marshaledMap.get(v);
+ if(p != null)
+ {
+ return p.intValue();
+ }
+
+ //
+ // We haven't seen this instance previously, create a new
+ // index, and insert it into the to-be-marshaled map.
+ //
+ _toBeMarshaledMap.put(v, ++_valueIdIndex);
+ return _valueIdIndex;
+ }
+
+ // Instance attributes
+ private SliceType _sliceType;
+
+ // Slice attributes
+ private int _writeSlice; // Position of the slice data members
+
+ // Encapsulation attributes for instance marshaling.
+ private int _valueIdIndex;
+ private java.util.IdentityHashMap<Value, Integer> _toBeMarshaledMap;
+ }
+
+ private static final class EncapsEncoder11 extends EncapsEncoder
+ {
+ EncapsEncoder11(OutputStream stream, Encaps encaps)
+ {
+ super(stream, encaps);
+ _current = null;
+ _valueIdIndex = 1;
+ }
+
+ @Override
+ void writeValue(Value v)
+ {
+ if(v == null)
+ {
+ _stream.writeSize(0);
+ }
+ else if(_current != null && _encaps.format == FormatType.SlicedFormat)
+ {
+ if(_current.indirectionTable == null) // Lazy initialization
+ {
+ _current.indirectionTable = new java.util.ArrayList<>();
+ _current.indirectionMap = new java.util.IdentityHashMap<>();
+ }
+
+ //
+ // If writing an instance within a slice and using the sliced
+ // format, write an index from the instance indirection
+ // table. The indirect instance table is encoded at the end of
+ // each slice and is always read (even if the Slice is
+ // unknown).
+ //
+ Integer index = _current.indirectionMap.get(v);
+ if(index == null)
+ {
+ _current.indirectionTable.add(v);
+ final int idx = _current.indirectionTable.size(); // Position + 1 (0 is reserved for nil)
+ _current.indirectionMap.put(v, idx);
+ _stream.writeSize(idx);
+ }
+ else
+ {
+ _stream.writeSize(index.intValue());
+ }
+ }
+ else
+ {
+ writeInstance(v); // Write the instance or a reference if already marshaled.
+ }
+ }
+
+ @Override
+ void writeException(UserException v)
+ {
+ v.__write(_stream);
+ }
+
+ @Override
+ void startInstance(SliceType sliceType, SlicedData data)
+ {
+ if(_current == null)
+ {
+ _current = new InstanceData(null);
+ }
+ else
+ {
+ _current = _current.next == null ? new InstanceData(_current) : _current.next;
+ }
+ _current.sliceType = sliceType;
+ _current.firstSlice = true;
+
+ if(data != null)
+ {
+ writeSlicedData(data);
+ }
+ }
+
+ @Override
+ void endInstance()
+ {
+ _current = _current.previous;
+ }
+
+ @Override
+ void startSlice(String typeId, int compactId, boolean last)
+ {
+ assert((_current.indirectionTable == null || _current.indirectionTable.isEmpty()) &&
+ (_current.indirectionMap == null || _current.indirectionMap.isEmpty()));
+
+ _current.sliceFlagsPos = _stream.pos();
+
+ _current.sliceFlags = (byte)0;
+ if(_encaps.format == FormatType.SlicedFormat)
+ {
+ // Encode the slice size if using the sliced format.
+ _current.sliceFlags |= com.zeroc.IceInternal.Protocol.FLAG_HAS_SLICE_SIZE;
+ }
+ if(last)
+ {
+ _current.sliceFlags |= com.zeroc.IceInternal.Protocol.FLAG_IS_LAST_SLICE; // This is the last slice.
+ }
+
+ _stream.writeByte((byte)0); // Placeholder for the slice flags
+
+ //
+ // For instance slices, encode the flag and the type ID either as a
+ // string or index. For exception slices, always encode the type
+ // ID a string.
+ //
+ if(_current.sliceType == SliceType.ValueSlice)
+ {
+ //
+ // Encode the type ID (only in the first slice for the compact
+ // encoding).
+ //
+ if(_encaps.format == FormatType.SlicedFormat || _current.firstSlice)
+ {
+ if(compactId >= 0)
+ {
+ _current.sliceFlags |= com.zeroc.IceInternal.Protocol.FLAG_HAS_TYPE_ID_COMPACT;
+ _stream.writeSize(compactId);
+ }
+ else
+ {
+ int index = registerTypeId(typeId);
+ if(index < 0)
+ {
+ _current.sliceFlags |= com.zeroc.IceInternal.Protocol.FLAG_HAS_TYPE_ID_STRING;
+ _stream.writeString(typeId);
+ }
+ else
+ {
+ _current.sliceFlags |= com.zeroc.IceInternal.Protocol.FLAG_HAS_TYPE_ID_INDEX;
+ _stream.writeSize(index);
+ }
+ }
+ }
+ }
+ else
+ {
+ _stream.writeString(typeId);
+ }
+
+ if((_current.sliceFlags & com.zeroc.IceInternal.Protocol.FLAG_HAS_SLICE_SIZE) != 0)
+ {
+ _stream.writeInt(0); // Placeholder for the slice length.
+ }
+
+ _current.writeSlice = _stream.pos();
+ _current.firstSlice = false;
+ }
+
+ @Override
+ void endSlice()
+ {
+ //
+ // Write the optional member end marker if some optional members
+ // were encoded. Note that the optional members are encoded before
+ // the indirection table and are included in the slice size.
+ //
+ if((_current.sliceFlags & com.zeroc.IceInternal.Protocol.FLAG_HAS_OPTIONAL_MEMBERS) != 0)
+ {
+ _stream.writeByte((byte)com.zeroc.IceInternal.Protocol.OPTIONAL_END_MARKER);
+ }
+
+ //
+ // Write the slice length if necessary.
+ //
+ if((_current.sliceFlags & com.zeroc.IceInternal.Protocol.FLAG_HAS_SLICE_SIZE) != 0)
+ {
+ final int sz = _stream.pos() - _current.writeSlice + 4;
+ _stream.rewriteInt(sz, _current.writeSlice - 4);
+ }
+
+ //
+ // Only write the indirection table if it contains entries.
+ //
+ if(_current.indirectionTable != null && !_current.indirectionTable.isEmpty())
+ {
+ assert(_encaps.format == FormatType.SlicedFormat);
+ _current.sliceFlags |= com.zeroc.IceInternal.Protocol.FLAG_HAS_INDIRECTION_TABLE;
+
+ //
+ // Write the indirection instance table.
+ //
+ _stream.writeSize(_current.indirectionTable.size());
+ for(Value v : _current.indirectionTable)
+ {
+ writeInstance(v);
+ }
+ _current.indirectionTable.clear();
+ _current.indirectionMap.clear();
+ }
+
+ //
+ // Finally, update the slice flags.
+ //
+ _stream.rewriteByte(_current.sliceFlags, _current.sliceFlagsPos);
+ }
+
+ @Override
+ boolean writeOptional(int tag, OptionalFormat format)
+ {
+ if(_current == null)
+ {
+ return _stream.writeOptionalImpl(tag, format);
+ }
+ else
+ {
+ if(_stream.writeOptionalImpl(tag, format))
+ {
+ _current.sliceFlags |= com.zeroc.IceInternal.Protocol.FLAG_HAS_OPTIONAL_MEMBERS;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+
+ private void writeSlicedData(SlicedData slicedData)
+ {
+ assert(slicedData != null);
+
+ //
+ // We only remarshal preserved slices if we are using the sliced
+ // format. Otherwise, we ignore the preserved slices, which
+ // essentially "slices" the instance into the most-derived type
+ // known by the sender.
+ //
+ if(_encaps.format != FormatType.SlicedFormat)
+ {
+ return;
+ }
+
+ for(SliceInfo info : slicedData.slices)
+ {
+ startSlice(info.typeId, info.compactId, info.isLastSlice);
+
+ //
+ // Write the bytes associated with this slice.
+ //
+ _stream.writeBlob(info.bytes);
+
+ if(info.hasOptionalMembers)
+ {
+ _current.sliceFlags |= com.zeroc.IceInternal.Protocol.FLAG_HAS_OPTIONAL_MEMBERS;
+ }
+
+ //
+ // Make sure to also re-write the instance indirection table.
+ //
+ if(info.instances != null && info.instances.length > 0)
+ {
+ if(_current.indirectionTable == null) // Lazy initialization
+ {
+ _current.indirectionTable = new java.util.ArrayList<>();
+ _current.indirectionMap = new java.util.IdentityHashMap<>();
+ }
+ for(Value o : info.instances)
+ {
+ _current.indirectionTable.add(o);
+ }
+ }
+
+ endSlice();
+ }
+ }
+
+ private void writeInstance(Value v)
+ {
+ assert(v != null);
+
+ //
+ // If the instance was already marshaled, just write it's ID.
+ //
+ Integer p = _marshaledMap.get(v);
+ if(p != null)
+ {
+ _stream.writeSize(p);
+ return;
+ }
+
+ //
+ // We haven't seen this instance previously, create a new ID,
+ // insert it into the marshaled map, and write the instance.
+ //
+ _marshaledMap.put(v, ++_valueIdIndex);
+
+ try
+ {
+ v.ice_preMarshal();
+ }
+ catch(java.lang.Exception ex)
+ {
+ String s = "exception raised by ice_preMarshal:\n" + com.zeroc.IceInternal.Ex.toString(ex);
+ _stream.instance().initializationData().logger.warning(s);
+ }
+
+ _stream.writeSize(1); // Class instance marker.
+ v.__write(_stream);
+ }
+
+ private static final class InstanceData
+ {
+ InstanceData(InstanceData previous)
+ {
+ if(previous != null)
+ {
+ previous.next = this;
+ }
+ this.previous = previous;
+ this.next = null;
+ }
+
+ // Instance attributes
+ SliceType sliceType;
+ boolean firstSlice;
+
+ // Slice attributes
+ byte sliceFlags;
+ int writeSlice; // Position of the slice data members
+ int sliceFlagsPos; // Position of the slice flags
+ java.util.List<Value> indirectionTable;
+ java.util.IdentityHashMap<Value, Integer> indirectionMap;
+
+ final InstanceData previous;
+ InstanceData next;
+ }
+
+ private InstanceData _current;
+
+ private int _valueIdIndex; // The ID of the next instance to marhsal
+ }
+
+ private static final class Encaps
+ {
+ void reset()
+ {
+ encoder = null;
+ }
+
+ void setEncoding(EncodingVersion encoding)
+ {
+ this.encoding = encoding;
+ encoding_1_0 = encoding.equals(Util.Encoding_1_0);
+ }
+
+ int start;
+ FormatType format = FormatType.DefaultFormat;
+ EncodingVersion encoding;
+ boolean encoding_1_0;
+
+ EncapsEncoder encoder;
+
+ Encaps next;
+ }
+
+ //
+ // The encoding version to use when there's no encapsulation to
+ // read from or write to. This is for example used to read message
+ // headers or when the user is using the streaming API with no
+ // encapsulation.
+ //
+ private EncodingVersion _encoding;
+
+ private boolean isEncoding_1_0()
+ {
+ return _encapsStack != null ? _encapsStack.encoding_1_0 : _encoding.equals(Util.Encoding_1_0);
+ }
+
+ private Encaps _encapsStack;
+ private Encaps _encapsCache;
+
+ private void initEncaps()
+ {
+ if(_encapsStack == null) // Lazy initialization
+ {
+ _encapsStack = _encapsCache;
+ if(_encapsStack != null)
+ {
+ _encapsCache = _encapsCache.next;
+ }
+ else
+ {
+ _encapsStack = new Encaps();
+ }
+ _encapsStack.setEncoding(_encoding);
+ }
+
+ if(_encapsStack.format == FormatType.DefaultFormat)
+ {
+ _encapsStack.format = _format;
+ }
+
+ if(_encapsStack.encoder == null) // Lazy initialization.
+ {
+ if(_encapsStack.encoding_1_0)
+ {
+ _encapsStack.encoder = new EncapsEncoder10(this, _encapsStack);
+ }
+ else
+ {
+ _encapsStack.encoder = new EncapsEncoder11(this, _encapsStack);
+ }
+ }
+ }
+
+ @FunctionalInterface
+ static public interface Marshaler
+ {
+ void marshal(OutputStream ostr);
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/PluginFactory.java b/java/src/Ice/src/main/java/com/zeroc/Ice/PluginFactory.java
new file mode 100644
index 00000000000..048566ef7f8
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/PluginFactory.java
@@ -0,0 +1,27 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * Applications implement this interface to provide a plug-in factory
+ * to the Ice run time.
+ **/
+public interface PluginFactory
+{
+ /**
+ * Called by the Ice run time to create a new plug-in.
+ *
+ * @param communicator The communicator that is in the process of being initialized.
+ * @param name The name of the plug-in.
+ * @param args The arguments that are specified in the plug-ins configuration.
+ * @return The plug-in that was created by this method.
+ **/
+ Plugin create(Communicator communicator, String name, String[] args);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/PluginManagerI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/PluginManagerI.java
new file mode 100644
index 00000000000..e3ec657ab95
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/PluginManagerI.java
@@ -0,0 +1,549 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+import java.net.URLEncoder;
+
+public final class PluginManagerI implements PluginManager
+{
+ private static String _kindOfObject = "plugin";
+
+ @Override
+ public synchronized void
+ initializePlugins()
+ {
+ if(_initialized)
+ {
+ InitializationException ex = new InitializationException();
+ ex.reason = "plug-ins already initialized";
+ throw ex;
+ }
+
+ //
+ // Invoke initialize() on the plug-ins, in the order they were loaded.
+ //
+ java.util.List<Plugin> initializedPlugins = new java.util.ArrayList<>();
+ try
+ {
+ for(PluginInfo p : _plugins)
+ {
+ try
+ {
+ p.plugin.initialize();
+ }
+ catch(PluginInitializationException ex)
+ {
+ throw ex;
+ }
+ catch(RuntimeException ex)
+ {
+ PluginInitializationException e = new PluginInitializationException();
+ e.reason = "plugin `" + p.name + "' initialization failed";
+ e.initCause(ex);
+ throw e;
+ }
+ initializedPlugins.add(p.plugin);
+ }
+ }
+ catch(RuntimeException ex)
+ {
+ //
+ // Destroy the plug-ins that have been successfully initialized, in the
+ // reverse order.
+ //
+ java.util.ListIterator<Plugin> i = initializedPlugins.listIterator(initializedPlugins.size());
+ while(i.hasPrevious())
+ {
+ Plugin p = i.previous();
+ try
+ {
+ p.destroy();
+ }
+ catch(RuntimeException e)
+ {
+ // Ignore.
+ }
+ }
+ throw ex;
+ }
+
+ _initialized = true;
+ }
+
+ @Override
+ public synchronized String[]
+ getPlugins()
+ {
+ java.util.ArrayList<String> names = new java.util.ArrayList<>();
+ for(PluginInfo p : _plugins)
+ {
+ names.add(p.name);
+ }
+ return names.toArray(new String[0]);
+ }
+
+ @Override
+ public synchronized Plugin
+ getPlugin(String name)
+ {
+ if(_communicator == null)
+ {
+ throw new CommunicatorDestroyedException();
+ }
+
+ Plugin p = findPlugin(name);
+ if(p != null)
+ {
+ return p;
+ }
+
+ NotRegisteredException ex = new NotRegisteredException();
+ ex.id = name;
+ ex.kindOfObject = _kindOfObject;
+ throw ex;
+ }
+
+ @Override
+ public synchronized void
+ addPlugin(String name, Plugin plugin)
+ {
+ if(_communicator == null)
+ {
+ throw new CommunicatorDestroyedException();
+ }
+
+ if(findPlugin(name) != null)
+ {
+ AlreadyRegisteredException ex = new AlreadyRegisteredException();
+ ex.id = name;
+ ex.kindOfObject = _kindOfObject;
+ throw ex;
+ }
+
+ PluginInfo info = new PluginInfo();
+ info.name = name;
+ info.plugin = plugin;
+ _plugins.add(info);
+ }
+
+ @Override
+ public synchronized void
+ destroy()
+ {
+ if(_communicator != null)
+ {
+ if(_initialized)
+ {
+ java.util.ListIterator<PluginInfo> i = _plugins.listIterator(_plugins.size());
+ while(i.hasPrevious())
+ {
+ PluginInfo p = i.previous();
+ try
+ {
+ p.plugin.destroy();
+ }
+ catch(RuntimeException ex)
+ {
+ Util.getProcessLogger().warning("unexpected exception raised by plug-in `" +
+ p.name + "' destruction:\n" + ex.toString());
+ }
+ }
+ }
+
+ _communicator = null;
+ }
+
+ _plugins.clear();
+
+ if(_classLoaders != null)
+ {
+ _classLoaders.clear();
+ }
+ }
+
+ public PluginManagerI(Communicator communicator, com.zeroc.IceInternal.Instance instance)
+ {
+ _communicator = communicator;
+ _instance = instance;
+ _initialized = false;
+ }
+
+ public String[] loadPlugins(String[] cmdArgs)
+ {
+ assert(_communicator != null);
+
+ //
+ // Load and initialize the plug-ins defined in the property set
+ // with the prefix "Ice.Plugin.". These properties should
+ // have the following format:
+ //
+ // Ice.Plugin.name[.<language>]=entry_point [args]
+ //
+ // If the Ice.PluginLoadOrder property is defined, load the
+ // specified plug-ins in the specified order, then load any
+ // remaining plug-ins.
+ //
+ final String prefix = "Ice.Plugin.";
+ Properties properties = _communicator.getProperties();
+ java.util.Map<String, String> plugins = properties.getPropertiesForPrefix(prefix);
+
+ final String[] loadOrder = properties.getPropertyAsList("Ice.PluginLoadOrder");
+ for(String name : loadOrder)
+ {
+ if(findPlugin(name) != null)
+ {
+ PluginInitializationException ex = new PluginInitializationException();
+ ex.reason = "plug-in `" + name + "' already loaded";
+ throw ex;
+ }
+
+ String key = "Ice.Plugin." + name + ".java";
+ boolean hasKey = plugins.containsKey(key);
+ if(hasKey)
+ {
+ plugins.remove("Ice.Plugin." + name);
+ }
+ else
+ {
+ key = "Ice.Plugin." + name;
+ hasKey = plugins.containsKey(key);
+ }
+
+ if(hasKey)
+ {
+ final String value = plugins.get(key);
+ cmdArgs = loadPlugin(name, value, cmdArgs);
+ plugins.remove(key);
+ }
+ else
+ {
+ PluginInitializationException ex = new PluginInitializationException();
+ ex.reason = "plug-in `" + name + "' not defined";
+ throw ex;
+ }
+ }
+
+ //
+ // Load any remaining plug-ins that weren't specified in PluginLoadOrder.
+ //
+ while(!plugins.isEmpty())
+ {
+ java.util.Iterator<java.util.Map.Entry<String, String> > p = plugins.entrySet().iterator();
+ java.util.Map.Entry<String, String> entry = p.next();
+
+ String name = entry.getKey().substring(prefix.length());
+
+ int dotPos = name.lastIndexOf('.');
+ if(dotPos != -1)
+ {
+ String suffix = name.substring(dotPos + 1);
+ if(suffix.equals("cpp") || suffix.equals("clr"))
+ {
+ //
+ // Ignored
+ //
+ p.remove();
+ }
+ else if(suffix.equals("java"))
+ {
+ name = name.substring(0, dotPos);
+ cmdArgs = loadPlugin(name, entry.getValue(), cmdArgs);
+ p.remove();
+
+ //
+ // Don't want to load this one if it's there!
+ //
+ plugins.remove("Ice.Plugin." + name);
+ }
+ else
+ {
+ //
+ // Name is just a regular name that happens to contain a dot
+ //
+ dotPos = -1;
+ }
+ }
+
+ if(dotPos == -1)
+ {
+ //
+ // Is there a .java entry?
+ //
+ String value = entry.getValue();
+ p.remove();
+
+ String javaValue = plugins.remove("Ice.Plugin." + name + ".java");
+ if(javaValue != null)
+ {
+ value = javaValue;
+ }
+
+ cmdArgs = loadPlugin(name, value, cmdArgs);
+ }
+ }
+
+ return cmdArgs;
+ }
+
+ private String[] loadPlugin(String name, String pluginSpec, String[] cmdArgs)
+ {
+ assert(_communicator != null);
+
+ //
+ // We support the following formats:
+ //
+ // <class-name> [args]
+ // <jar-file>:<class-name> [args]
+ // <class-dir>:<class-name> [args]
+ // "<path with spaces>":<class-name> [args]
+ // "<path with spaces>:<class-name>" [args]
+ //
+
+ String[] args;
+ try
+ {
+ args = com.zeroc.IceUtilInternal.Options.split(pluginSpec);
+ }
+ catch(com.zeroc.IceUtilInternal.Options.BadQuote ex)
+ {
+ throw new PluginInitializationException("invalid arguments for plug-in `" + name + "':\n" +
+ ex.getMessage());
+ }
+
+ assert(args.length > 0);
+
+ final String entryPoint = args[0];
+
+ final boolean isWindows = System.getProperty("os.name").startsWith("Windows");
+ boolean absolutePath = false;
+
+ //
+ // Find first ':' that isn't part of the file path.
+ //
+ int pos = entryPoint.indexOf(':');
+ if(isWindows)
+ {
+ final String driveLetters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ if(pos == 1 && entryPoint.length() > 2 && driveLetters.indexOf(entryPoint.charAt(0)) != -1 &&
+ (entryPoint.charAt(2) == '\\' || entryPoint.charAt(2) == '/'))
+ {
+ absolutePath = true;
+ pos = entryPoint.indexOf(':', pos + 1);
+ }
+ if(!absolutePath)
+ {
+ absolutePath = entryPoint.startsWith("\\\\");
+ }
+ }
+ else
+ {
+ absolutePath = entryPoint.startsWith("/");
+ }
+
+ if((pos == -1 && absolutePath) || (pos != -1 && entryPoint.length() <= pos + 1))
+ {
+ //
+ // Class name is missing.
+ //
+ throw new PluginInitializationException("invalid entry point for plug-in `" + name + "':\n" + entryPoint);
+ }
+
+ //
+ // Extract the JAR file or subdirectory, if any.
+ //
+ String classDir = null; // Path name of JAR file or subdirectory.
+ String className;
+
+ if(pos == -1)
+ {
+ className = entryPoint;
+ }
+ else
+ {
+ classDir = entryPoint.substring(0, pos).trim();
+ className = entryPoint.substring(pos + 1).trim();
+ }
+
+ //
+ // Shift the arguments.
+ //
+ String[] tmp = new String[args.length - 1];
+ System.arraycopy(args, 1, tmp, 0, args.length - 1);
+ args = tmp;
+
+ //
+ // Convert command-line options into properties. First we
+ // convert the options from the plug-in configuration, then
+ // we convert the options from the application command-line.
+ //
+ Properties properties = _communicator.getProperties();
+ args = properties.parseCommandLineOptions(name, args);
+ cmdArgs = properties.parseCommandLineOptions(name, cmdArgs);
+
+ //
+ // Instantiate the class.
+ //
+ PluginFactory pluginFactory = null;
+ try
+ {
+ Class<?> c = null;
+
+ //
+ // Use a class loader if the user specified a JAR file or class directory.
+ //
+ if(classDir != null)
+ {
+ try
+ {
+ if(!absolutePath)
+ {
+ classDir = new java.io.File(System.getProperty("user.dir") + java.io.File.separator +
+ classDir).getCanonicalPath();
+ }
+
+ if(!classDir.endsWith(java.io.File.separator) && !classDir.toLowerCase().endsWith(".jar"))
+ {
+ classDir += java.io.File.separator;
+ }
+ classDir = URLEncoder.encode(classDir, "UTF-8");
+
+ //
+ // Reuse an existing class loader if we have already loaded a plug-in with
+ // the same value for classDir, otherwise create a new one.
+ //
+ ClassLoader cl = null;
+
+ if(_classLoaders == null)
+ {
+ _classLoaders = new java.util.HashMap<>();
+ }
+ else
+ {
+ cl = _classLoaders.get(classDir);
+ }
+
+ if(cl == null)
+ {
+ final java.net.URL[] url = new java.net.URL[] { new java.net.URL("file", null, classDir) };
+
+ //
+ // Use the custom class loader (if any) as the parent.
+ //
+ if(_instance.initializationData().classLoader != null)
+ {
+ cl = new java.net.URLClassLoader(url, _instance.initializationData().classLoader);
+ }
+ else
+ {
+ cl = new java.net.URLClassLoader(url);
+ }
+
+ _classLoaders.put(classDir, cl);
+ }
+
+ c = cl.loadClass(className);
+ }
+ catch(java.net.MalformedURLException ex)
+ {
+ throw new PluginInitializationException("invalid entry point format `" + pluginSpec + "'", ex);
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new PluginInitializationException("invalid path in entry point `" + pluginSpec + "'", ex);
+ }
+ catch(java.lang.ClassNotFoundException ex)
+ {
+ // Ignored
+ }
+ }
+ else
+ {
+ c = com.zeroc.IceInternal.Util.getInstance(_communicator).findClass(className);
+ }
+
+ if(c == null)
+ {
+ throw new PluginInitializationException("class " + className + " not found");
+ }
+
+ java.lang.Object obj = c.newInstance();
+ try
+ {
+ pluginFactory = (PluginFactory)obj;
+ }
+ catch(ClassCastException ex)
+ {
+ throw new PluginInitializationException("class " + className + " does not implement PluginFactory",
+ ex);
+ }
+ }
+ catch(IllegalAccessException ex)
+ {
+ throw new PluginInitializationException("unable to access default constructor in class " + className, ex);
+ }
+ catch(InstantiationException ex)
+ {
+ throw new PluginInitializationException("unable to instantiate class " + className, ex);
+ }
+
+ //
+ // Invoke the factory.
+ //
+ Plugin plugin = null;
+ try
+ {
+ plugin = pluginFactory.create(_communicator, name, args);
+ }
+ catch(PluginInitializationException ex)
+ {
+ throw ex;
+ }
+ catch(Throwable ex)
+ {
+ throw new PluginInitializationException("exception in factory " + className, ex);
+ }
+
+ if(plugin == null)
+ {
+ throw new PluginInitializationException("failure in factory " + className);
+ }
+
+ PluginInfo info = new PluginInfo();
+ info.name = name;
+ info.plugin = plugin;
+ _plugins.add(info);
+
+ return cmdArgs;
+ }
+
+ private Plugin findPlugin(String name)
+ {
+ for(PluginInfo p : _plugins)
+ {
+ if(name.equals(p.name))
+ {
+ return p.plugin;
+ }
+ }
+ return null;
+ }
+
+ static class PluginInfo
+ {
+ String name;
+ Plugin plugin;
+ }
+
+ private Communicator _communicator;
+ private com.zeroc.IceInternal.Instance _instance;
+ private java.util.List<PluginInfo> _plugins = new java.util.ArrayList<>();
+ private boolean _initialized;
+ private java.util.Map<String, ClassLoader> _classLoaders;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/PropertiesAdminUpdateCallback.java b/java/src/Ice/src/main/java/com/zeroc/Ice/PropertiesAdminUpdateCallback.java
new file mode 100644
index 00000000000..4585a4ddfb1
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/PropertiesAdminUpdateCallback.java
@@ -0,0 +1,16 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+@FunctionalInterface
+public interface PropertiesAdminUpdateCallback
+{
+ void updated(java.util.Map<String, String> changes);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/PropertiesI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/PropertiesI.java
new file mode 100644
index 00000000000..29ae6ddc1e5
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/PropertiesI.java
@@ -0,0 +1,764 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+public final class PropertiesI implements Properties
+{
+ static class PropertyValue
+ {
+ public PropertyValue(PropertyValue v)
+ {
+ value = v.value;
+ used = v.used;
+ }
+
+ public PropertyValue(String v, boolean u)
+ {
+ value = v;
+ used = u;
+ }
+
+ public String value;
+ public boolean used;
+ }
+
+ @Override
+ public synchronized String
+ getProperty(String key)
+ {
+ PropertyValue pv = _properties.get(key);
+ if(pv != null)
+ {
+ pv.used = true;
+ return pv.value;
+ }
+ else
+ {
+ return "";
+ }
+ }
+
+ @Override
+ public synchronized String
+ getPropertyWithDefault(String key, String value)
+ {
+ PropertyValue pv = _properties.get(key);
+ if(pv != null)
+ {
+ pv.used = true;
+ return pv.value;
+ }
+ else
+ {
+ return value;
+ }
+ }
+
+ @Override
+ public int
+ getPropertyAsInt(String key)
+ {
+ return getPropertyAsIntWithDefault(key, 0);
+ }
+
+ @Override
+ public synchronized int
+ getPropertyAsIntWithDefault(String key, int value)
+ {
+ PropertyValue pv = _properties.get(key);
+ if(pv != null)
+ {
+ pv.used = true;
+
+ try
+ {
+ return Integer.parseInt(pv.value);
+ }
+ catch(NumberFormatException ex)
+ {
+ Util.getProcessLogger().warning("numeric property " + key +
+ " set to non-numeric value, defaulting to " + value);
+ }
+ }
+
+ return value;
+ }
+
+ @Override
+ public String[]
+ getPropertyAsList(String key)
+ {
+ return getPropertyAsListWithDefault(key, null);
+ }
+
+ @Override
+ public synchronized String[]
+ getPropertyAsListWithDefault(String key, String[] value)
+ {
+ if(value == null)
+ {
+ value = new String[0];
+ }
+
+ PropertyValue pv = _properties.get(key);
+ if(pv != null)
+ {
+ pv.used = true;
+
+ String[] result = com.zeroc.IceUtilInternal.StringUtil.splitString(pv.value, ", \t\r\n");
+ if(result == null)
+ {
+ Util.getProcessLogger().warning("mismatched quotes in property " + key +
+ "'s value, returning default value");
+ return value;
+ }
+ if(result.length == 0)
+ {
+ result = value;
+ }
+ return result;
+ }
+ else
+ {
+ return value;
+ }
+ }
+
+ @Override
+ public synchronized java.util.Map<String, String>
+ getPropertiesForPrefix(String prefix)
+ {
+ java.util.HashMap<String, String> result = new java.util.HashMap<>();
+ for(java.util.Map.Entry<String, PropertyValue> p : _properties.entrySet())
+ {
+ String key = p.getKey();
+ if(prefix.length() == 0 || key.startsWith(prefix))
+ {
+ PropertyValue pv = p.getValue();
+ pv.used = true;
+ result.put(key, pv.value);
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public void
+ setProperty(String key, String value)
+ {
+ //
+ // Trim whitespace
+ //
+ if(key != null)
+ {
+ key = key.trim();
+ }
+
+ //
+ // Check if the property is legal.
+ //
+ Logger logger = Util.getProcessLogger();
+ if(key == null || key.length() == 0)
+ {
+ throw new InitializationException("Attempt to set property with empty key");
+ }
+
+ int dotPos = key.indexOf('.');
+ if(dotPos != -1)
+ {
+ String prefix = key.substring(0, dotPos);
+ for(int i = 0; com.zeroc.IceInternal.PropertyNames.validProps[i] != null; ++i)
+ {
+ String pattern = com.zeroc.IceInternal.PropertyNames.validProps[i][0].pattern();
+ dotPos = pattern.indexOf('.');
+ //
+ // Each top level prefix describes a non-empty namespace. Having a string without a
+ // prefix followed by a dot is an error.
+ //
+ assert(dotPos != -1);
+ String propPrefix = pattern.substring(0, dotPos - 1);
+ boolean mismatchCase = false;
+ String otherKey = "";
+ if(!propPrefix.toUpperCase().equals(prefix.toUpperCase()))
+ {
+ continue;
+ }
+
+ boolean found = false;
+ for(int j = 0; com.zeroc.IceInternal.PropertyNames.validProps[i][j] != null && !found; ++j)
+ {
+ pattern = com.zeroc.IceInternal.PropertyNames.validProps[i][j].pattern();
+ java.util.regex.Pattern pComp = java.util.regex.Pattern.compile(pattern);
+ java.util.regex.Matcher m = pComp.matcher(key);
+ found = m.matches();
+
+ if(found && com.zeroc.IceInternal.PropertyNames.validProps[i][j].deprecated())
+ {
+ logger.warning("deprecated property: " + key);
+ if(com.zeroc.IceInternal.PropertyNames.validProps[i][j].deprecatedBy() != null)
+ {
+ key = com.zeroc.IceInternal.PropertyNames.validProps[i][j].deprecatedBy();
+ }
+ }
+
+ if(!found)
+ {
+ pComp = java.util.regex.Pattern.compile(pattern.toUpperCase());
+ m = pComp.matcher(key.toUpperCase());
+ if(m.matches())
+ {
+ found = true;
+ mismatchCase = true;
+ otherKey = pattern.replaceAll("\\\\", "");
+ break;
+ }
+ }
+ }
+ if(!found)
+ {
+ logger.warning("unknown property: " + key);
+ }
+ else if(mismatchCase)
+ {
+ logger.warning("unknown property: `" + key + "'; did you mean `" + otherKey + "'");
+ }
+ }
+ }
+
+ synchronized(this)
+ {
+ //
+ // Set or clear the property.
+ //
+ if(value != null && value.length() > 0)
+ {
+ PropertyValue pv = _properties.get(key);
+ if(pv != null)
+ {
+ pv.value = value;
+ }
+ else
+ {
+ pv = new PropertyValue(value, false);
+ }
+ _properties.put(key, pv);
+ }
+ else
+ {
+ _properties.remove(key);
+ }
+ }
+ }
+
+ @Override
+ public synchronized String[]
+ getCommandLineOptions()
+ {
+ String[] result = new String[_properties.size()];
+ int i = 0;
+ for(java.util.Map.Entry<String, PropertyValue> p : _properties.entrySet())
+ {
+ result[i++] = "--" + p.getKey() + "=" + p.getValue().value;
+ }
+ assert(i == result.length);
+ return result;
+ }
+
+ @Override
+ public String[]
+ parseCommandLineOptions(String pfx, String[] options)
+ {
+ if(pfx.length() > 0 && pfx.charAt(pfx.length() - 1) != '.')
+ {
+ pfx += '.';
+ }
+ pfx = "--" + pfx;
+
+ java.util.ArrayList<String> result = new java.util.ArrayList<>();
+ for(String opt : options)
+ {
+ if(opt.startsWith(pfx))
+ {
+ if(opt.indexOf('=') == -1)
+ {
+ opt += "=1";
+ }
+
+ parseLine(opt.substring(2));
+ }
+ else
+ {
+ result.add(opt);
+ }
+ }
+ return result.toArray(new String[0]);
+ }
+
+ @Override
+ public String[]
+ parseIceCommandLineOptions(String[] options)
+ {
+ String[] args = options;
+ for(int i = 0; com.zeroc.IceInternal.PropertyNames.clPropNames[i] != null; ++i)
+ {
+ args = parseCommandLineOptions(com.zeroc.IceInternal.PropertyNames.clPropNames[i], args);
+ }
+ return args;
+ }
+
+ @Override
+ public void
+ load(String file)
+ {
+ if(System.getProperty("os.name").startsWith("Windows") && file.startsWith("HKLM\\"))
+ {
+ String regQuery = "reg query " + file;
+ try
+ {
+ java.lang.Process process = Runtime.getRuntime().exec(regQuery);
+ process.waitFor();
+ if(process.exitValue() != 0)
+ {
+ InitializationException ie = new InitializationException();
+ ie.reason = "Could not read Windows registry key `" + file + "'";
+ throw ie;
+ }
+
+ java.io.InputStream is = process.getInputStream();
+ java.io.StringWriter sw = new java.io.StringWriter();
+ int c;
+ while((c = is.read()) != -1)
+ {
+ sw.write(c);
+ }
+ String[] result = sw.toString().split("\n");
+
+ for(String line : result)
+ {
+ int pos = line.indexOf("REG_SZ");
+ if(pos != -1)
+ {
+ setProperty(line.substring(0, pos).trim(), line.substring(pos + 6, line.length()).trim());
+ continue;
+ }
+
+ pos = line.indexOf("REG_EXPAND_SZ");
+ if(pos != -1)
+ {
+ String name = line.substring(0, pos).trim();
+ line = line.substring(pos + 13, line.length()).trim();
+ while(true)
+ {
+ int start = line.indexOf("%", 0);
+ int end = line.indexOf("%", start + 1);
+
+ //
+ // If there isn't more %var% break the loop
+ //
+ if(start == -1 || end == -1)
+ {
+ break;
+ }
+
+ String envKey = line.substring(start + 1, end);
+ String envValue = System.getenv(envKey);
+ if(envValue == null)
+ {
+ envValue = "";
+ }
+
+ envKey = "%" + envKey + "%";
+ do
+ {
+ line = line.replace(envKey , envValue);
+ }
+ while(line.indexOf(envKey) != -1);
+ }
+ setProperty(name, line);
+ continue;
+ }
+ }
+ }
+ catch(LocalException ex)
+ {
+ throw ex;
+ }
+ catch(java.lang.Exception ex)
+ {
+ throw new InitializationException("Could not read Windows registry key `" + file + "'", ex);
+ }
+ }
+ else
+ {
+ java.io.PushbackInputStream is = null;
+ try
+ {
+ java.io.InputStream f = com.zeroc.IceInternal.Util.openResource(getClass().getClassLoader(), file);
+ if(f == null)
+ {
+ FileException fe = new FileException();
+ fe.path = file;
+ throw fe;
+ }
+ //
+ // Skip UTF-8 BOM if present.
+ //
+ byte[] bom = new byte[3];
+ is = new java.io.PushbackInputStream(f, bom.length);
+ int read = is.read(bom, 0, bom.length);
+ if(read < 3 || bom[0] != (byte)0xEF || bom[1] != (byte)0xBB || bom[2] != (byte)0xBF)
+ {
+ if(read > 0)
+ {
+ is.unread(bom, 0, read);
+ }
+ }
+
+ java.io.InputStreamReader isr = new java.io.InputStreamReader(is, "UTF-8");
+ java.io.BufferedReader br = new java.io.BufferedReader(isr);
+ parse(br);
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new FileException(0, file, ex);
+ }
+ finally
+ {
+ if(is != null)
+ {
+ try
+ {
+ is.close();
+ }
+ catch(Throwable ex)
+ {
+ // Ignore.
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public synchronized Properties
+ _clone()
+ {
+ return new PropertiesI(this);
+ }
+
+ public synchronized java.util.List<String>
+ getUnusedProperties()
+ {
+ java.util.List<String> unused = new java.util.ArrayList<>();
+ for(java.util.Map.Entry<String, PropertyValue> p : _properties.entrySet())
+ {
+ PropertyValue pv = p.getValue();
+ if(!pv.used)
+ {
+ unused.add(p.getKey());
+ }
+ }
+ return unused;
+ }
+
+ PropertiesI(PropertiesI props)
+ {
+ //
+ // NOTE: we can't just do a shallow copy of the map as the map values
+ // would otherwise be shared between the two PropertiesI object.
+ //
+ //_properties = new java.util.HashMap<String, PropertyValue>(props._properties);
+ for(java.util.Map.Entry<String, PropertyValue> p : props._properties.entrySet())
+ {
+ _properties.put(p.getKey(), new PropertyValue(p.getValue()));
+ }
+ }
+
+ PropertiesI()
+ {
+ }
+
+ String[] init(String[] args, Properties defaults)
+ {
+ if(defaults != null)
+ {
+ //
+ // NOTE: we can't just do a shallow copy of the map as the map values
+ // would otherwise be shared between the two PropertiesI object.
+ //
+ //_properties = new java.util.HashMap<>(((PropertiesI)defaults)._properties);
+ for(java.util.Map.Entry<String, PropertyValue> p : (((PropertiesI)defaults)._properties).entrySet())
+ {
+ _properties.put(p.getKey(), new PropertyValue(p.getValue()));
+ }
+ }
+
+ boolean loadConfigFiles = false;
+
+ for(int i = 0; i < args.length; i++)
+ {
+ if(args[i].startsWith("--Ice.Config"))
+ {
+ String line = args[i];
+ if(line.indexOf('=') == -1)
+ {
+ line += "=1";
+ }
+ parseLine(line.substring(2));
+ loadConfigFiles = true;
+
+ String[] arr = new String[args.length - 1];
+ System.arraycopy(args, 0, arr, 0, i);
+ if(i < args.length - 1)
+ {
+ System.arraycopy(args, i + 1, arr, i, args.length - i - 1);
+ }
+ args = arr;
+ }
+ }
+
+ if(!loadConfigFiles)
+ {
+ //
+ // If Ice.Config is not set, load from ICE_CONFIG (if set)
+ //
+ loadConfigFiles = !_properties.containsKey("Ice.Config");
+ }
+
+ if(loadConfigFiles)
+ {
+ loadConfig();
+ }
+
+ return parseIceCommandLineOptions(args);
+ }
+
+ private void
+ parse(java.io.BufferedReader in)
+ {
+ try
+ {
+ String line;
+ while((line = in.readLine()) != null)
+ {
+ parseLine(line);
+ }
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new SyscallException(ex);
+ }
+ }
+
+ private static final int ParseStateKey = 0;
+ private static final int ParseStateValue = 1;
+
+ private void
+ parseLine(String line)
+ {
+ String key = "";
+ String value = "";
+
+ int state = ParseStateKey;
+
+ String whitespace = "";
+ String escapedspace = "";
+ boolean finished = false;
+ for(int i = 0; i < line.length(); ++i)
+ {
+ char c = line.charAt(i);
+ switch(state)
+ {
+ case ParseStateKey:
+ {
+ switch(c)
+ {
+ case '\\':
+ if(i < line.length() - 1)
+ {
+ c = line.charAt(++i);
+ switch(c)
+ {
+ case '\\':
+ case '#':
+ case '=':
+ key += whitespace;
+ whitespace = "";
+ key += c;
+ break;
+
+ case ' ':
+ if(key.length() != 0)
+ {
+ whitespace += c;
+ }
+ break;
+
+ default:
+ key += whitespace;
+ whitespace = "";
+ key += '\\';
+ key += c;
+ break;
+ }
+ }
+ else
+ {
+ key += whitespace;
+ key += c;
+ }
+ break;
+
+ case ' ':
+ case '\t':
+ case '\r':
+ case '\n':
+ if(key.length() != 0)
+ {
+ whitespace += c;
+ }
+ break;
+
+ case '=':
+ whitespace = "";
+ state = ParseStateValue;
+ break;
+
+ case '#':
+ finished = true;
+ break;
+
+ default:
+ key += whitespace;
+ whitespace = "";
+ key += c;
+ break;
+ }
+ break;
+ }
+
+ case ParseStateValue:
+ {
+ switch(c)
+ {
+ case '\\':
+ if(i < line.length() - 1)
+ {
+ c = line.charAt(++i);
+ switch(c)
+ {
+ case '\\':
+ case '#':
+ case '=':
+ value += value.length() == 0 ? escapedspace : whitespace;
+ whitespace = "";
+ escapedspace = "";
+ value += c;
+ break;
+
+ case ' ':
+ whitespace += c;
+ escapedspace += c;
+ break;
+
+ default:
+ value += value.length() == 0 ? escapedspace : whitespace;
+ whitespace = "";
+ escapedspace = "";
+ value += '\\';
+ value += c;
+ break;
+ }
+ }
+ else
+ {
+ value += value.length() == 0 ? escapedspace : whitespace;
+ value += c;
+ }
+ break;
+
+ case ' ':
+ case '\t':
+ case '\r':
+ case '\n':
+ if(value.length() != 0)
+ {
+ whitespace += c;
+ }
+ break;
+
+ case '#':
+ finished = true;
+ break;
+
+ default:
+ value += value.length() == 0 ? escapedspace : whitespace;
+ whitespace = "";
+ escapedspace = "";
+ value += c;
+ break;
+ }
+ break;
+ }
+ }
+ if(finished)
+ {
+ break;
+ }
+ }
+ value += escapedspace;
+
+ if((state == ParseStateKey && key.length() != 0) || (state == ParseStateValue && key.length() == 0))
+ {
+ Util.getProcessLogger().warning("invalid config file entry: \"" + line + "\"");
+ return;
+ }
+ else if(key.length() == 0)
+ {
+ return;
+ }
+
+ setProperty(key, value);
+ }
+
+ private void
+ loadConfig()
+ {
+ String value = getProperty("Ice.Config");
+
+ if(value.length() == 0 || value.equals("1"))
+ {
+ try
+ {
+ value = System.getenv("ICE_CONFIG");
+ if(value == null)
+ {
+ value = "";
+ }
+ }
+ catch(java.lang.SecurityException ex)
+ {
+ value = "";
+ }
+ }
+
+ if(value.length() > 0)
+ {
+ for(String file : value.split(","))
+ {
+ load(file.trim());
+ }
+
+ _properties.put("Ice.Config", new PropertyValue(value, true));
+ }
+ }
+
+ private java.util.HashMap<String, PropertyValue> _properties = new java.util.HashMap<>();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/ProxyIdentityFacetKey.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ProxyIdentityFacetKey.java
new file mode 100644
index 00000000000..bac38e4842b
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ProxyIdentityFacetKey.java
@@ -0,0 +1,97 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * This class wraps a proxy to allow it to be used the key for a hashed collection.
+ * The <code>hashCode</code> and <code>equals</code> methods are based on the object identity and
+ * the facet of the proxy.
+ *
+ * @see Util#proxyIdentityAndFacetCompare
+ * @see Util#proxyIdentityCompare
+ * @see ProxyIdentityKey
+ *
+ **/
+public class ProxyIdentityFacetKey
+{
+ /**
+ * Initializes this class with the passed proxy.
+ *
+ * @param proxy The proxy for this instance.
+ **/
+ public
+ ProxyIdentityFacetKey(ObjectPrx proxy)
+ {
+ _proxy = proxy;
+
+ //
+ // Cache the identity and facet, and compute the hash code.
+ //
+ _identity = proxy.ice_getIdentity();
+ _facet = proxy.ice_getFacet();
+ int h = 5381;
+ h = com.zeroc.IceInternal.HashUtil.hashAdd(h, _identity);
+ h = com.zeroc.IceInternal.HashUtil.hashAdd(h, _facet);
+ _hashCode = h;
+ }
+
+ /**
+ * Computes a hash value based on the object identity and the facet of the proxy.
+ *
+ * @return The hash value.
+ **/
+ @Override
+ public int
+ hashCode()
+ {
+ return _hashCode;
+ }
+
+ /**
+ * Compares this proxy with the passed object for equality.
+ *
+ * @param obj The object to compare this proxy with.
+ * @return <code>true</code> if the passed object is a proxy with the same object
+ * identity and facet as this proxy; <code>false</code>, otherwise.
+ **/
+ @Override
+ public boolean
+ equals(java.lang.Object obj)
+ {
+ if(this == obj)
+ {
+ return true;
+ }
+
+ if(obj instanceof ProxyIdentityFacetKey)
+ {
+ ProxyIdentityFacetKey other = (ProxyIdentityFacetKey)obj;
+ return (_hashCode == other._hashCode) && _identity.equals(other._identity) && _facet.equals(other._facet);
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns the proxy stored by this class.
+ *
+ * @return The proxy stored by this class.
+ **/
+ public ObjectPrx
+ getProxy()
+ {
+ return _proxy;
+ }
+
+ final private ObjectPrx _proxy;
+ final private Identity _identity;
+ final private String _facet;
+ final private int _hashCode;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/ProxyIdentityKey.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ProxyIdentityKey.java
new file mode 100644
index 00000000000..cc1a763cb1e
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ProxyIdentityKey.java
@@ -0,0 +1,89 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * This class wraps a proxy to allow it to be used the key for a hashed collection.
+ * The <code>hashCode</code> and <code>equals</code> methods are based on the object identity
+ * of the proxy.
+ *
+ * @see Util#proxyIdentityCompare
+ * @see Util#proxyIdentityAndFacetCompare
+ * @see ProxyIdentityFacetKey
+ *
+ **/
+public class ProxyIdentityKey
+{
+ /**
+ * Initializes this class with the passed proxy.
+ *
+ * @param proxy The proxy for this instance.
+ **/
+ public
+ ProxyIdentityKey(ObjectPrx proxy)
+ {
+ _proxy = proxy;
+
+ //
+ // Cache the identity and its hash code.
+ //
+ _identity = proxy.ice_getIdentity();
+ int h = 5381;
+ h = com.zeroc.IceInternal.HashUtil.hashAdd(h, _identity);
+ _hashCode = h;
+ }
+
+ /**
+ * Computes a hash value based on the object identity of the proxy.
+ *
+ * @return The hash value.
+ **/
+ @Override
+ public int
+ hashCode()
+ {
+ return _hashCode;
+ }
+
+ /**
+ * Compares this proxy with the passed object for equality.
+ *
+ * @param obj The object to compare this proxy with.
+ * @return <code>true</code> if the passed object is a proxy with the same object
+ * identity; <code>false</code>, otherwise.
+ **/
+ @Override
+ public boolean
+ equals(java.lang.Object obj)
+ {
+ if(this == obj)
+ {
+ return true;
+ }
+
+ if(obj instanceof ProxyIdentityKey)
+ {
+ ProxyIdentityKey other = (ProxyIdentityKey)obj;
+ return (_hashCode == other._hashCode) && _identity.equals(other._identity);
+ }
+
+ return false;
+ }
+
+ public ObjectPrx
+ getProxy()
+ {
+ return _proxy;
+ }
+
+ final private ObjectPrx _proxy;
+ final private Identity _identity;
+ final private int _hashCode;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/ReadValueCallback.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ReadValueCallback.java
new file mode 100644
index 00000000000..41e9ffba464
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ReadValueCallback.java
@@ -0,0 +1,28 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * Callback class to inform an application when an instance of a Slice class has been
+ * unmarshaled from an input stream.
+ *
+ * @see InputStream#readValue
+ **/
+@FunctionalInterface
+public interface ReadValueCallback
+{
+ /**
+ * The Ice run time calls this method when it has fully unmarshaled the state
+ * of a Slice class instance.
+ *
+ * @param v The unmarshaled Slice class instance.
+ **/
+ void valueReady(Value v);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/Request.java b/java/src/Ice/src/main/java/com/zeroc/Ice/Request.java
new file mode 100644
index 00000000000..4b9ccb87190
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/Request.java
@@ -0,0 +1,23 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * Interface for incoming requests.
+ **/
+public interface Request
+{
+ /**
+ * Returns the {@link Current} object for this the request.
+ *
+ * @return The {@link Current} object for this request.
+ **/
+ Current getCurrent();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/SignalPolicy.java b/java/src/Ice/src/main/java/com/zeroc/Ice/SignalPolicy.java
new file mode 100644
index 00000000000..060fd83b1bf
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/SignalPolicy.java
@@ -0,0 +1,31 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * The signal policy for Ice.Application signal handling.
+ *
+ * @see Application
+ **/
+public enum SignalPolicy
+{
+ /**
+ * If a signal is received, {@link Application} reacts to the signal
+ * by calling {@link Communicator#destroy} or {@link Communicator#shutdown},
+ * or by calling a custom shutdown hook installed by the application.
+ **/
+ HandleSignals,
+
+ /**
+ * Any signal that is received is not intercepted and takes the default
+ * action.
+ **/
+ NoSignalHandling
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/SliceInfo.java b/java/src/Ice/src/main/java/com/zeroc/Ice/SliceInfo.java
new file mode 100644
index 00000000000..c1834b1c53c
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/SliceInfo.java
@@ -0,0 +1,46 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * SliceInfo encapsulates the details of a slice for an unknown class or exception type.
+ **/
+public class SliceInfo
+{
+ /**
+ * The Slice type ID for this slice.
+ **/
+ public String typeId;
+
+ /**
+ * The Slice compact type ID for this slice.
+ **/
+ public int compactId;
+
+ /**
+ * The encoded bytes for this slice, including the leading size integer.
+ **/
+ public byte[] bytes;
+
+ /**
+ * The class instances referenced by this slice.
+ **/
+ public com.zeroc.Ice.Value[] instances;
+
+ /**
+ * Whether or not the slice contains optional members.
+ **/
+ public boolean hasOptionalMembers;
+
+ /**
+ * Whether or not this is the last slice.
+ **/
+ public boolean isLastSlice;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/SlicedData.java b/java/src/Ice/src/main/java/com/zeroc/Ice/SlicedData.java
new file mode 100644
index 00000000000..33d2b91e7b6
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/SlicedData.java
@@ -0,0 +1,26 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * SlicedData holds the slices of unknown class or exception types.
+ **/
+public class SlicedData
+{
+ public SlicedData(SliceInfo[] slices)
+ {
+ this.slices = slices;
+ }
+
+ /**
+ * The details of each slice, in order of most-derived to least-derived.
+ **/
+ public SliceInfo[] slices;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/SysLoggerI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/SysLoggerI.java
new file mode 100644
index 00000000000..1818e225aee
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/SysLoggerI.java
@@ -0,0 +1,244 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+import java.net.DatagramPacket;
+import java.net.DatagramSocket;
+import java.net.InetAddress;
+import java.io.IOException;
+
+public final class SysLoggerI implements Logger
+{
+ public
+ SysLoggerI(String prefix, String facilityString)
+ {
+ int facility;
+ if(facilityString.equals("LOG_KERN"))
+ {
+ facility = LOG_KERN;
+ }
+ else if(facilityString.equals("LOG_USER"))
+ {
+ facility = LOG_USER;
+ }
+ else if(facilityString.equals("LOG_MAIL"))
+ {
+ facility = LOG_MAIL;
+ }
+ else if(facilityString.equals("LOG_DAEMON"))
+ {
+ facility = LOG_DAEMON;
+ }
+ else if(facilityString.equals("LOG_AUTH"))
+ {
+ facility = LOG_AUTH;
+ }
+ else if(facilityString.equals("LOG_SYSLOG"))
+ {
+ facility = LOG_SYSLOG;
+ }
+ else if(facilityString.equals("LOG_LPR"))
+ {
+ facility = LOG_LPR;
+ }
+ else if(facilityString.equals("LOG_NEWS"))
+ {
+ facility = LOG_NEWS;
+ }
+ else if(facilityString.equals("LOG_UUCP"))
+ {
+ facility = LOG_UUCP;
+ }
+ else if(facilityString.equals("LOG_CRON"))
+ {
+ facility = LOG_CRON;
+ }
+ else if(facilityString.equals("LOG_AUTHPRIV"))
+ {
+ facility = LOG_AUTHPRIV;
+ }
+ else if(facilityString.equals("LOG_FTP"))
+ {
+ facility = LOG_FTP;
+ }
+ else if(facilityString.equals("LOG_LOCAL0"))
+ {
+ facility = LOG_LOCAL0;
+ }
+ else if(facilityString.equals("LOG_LOCAL1"))
+ {
+ facility = LOG_LOCAL1;
+ }
+ else if(facilityString.equals("LOG_LOCAL2"))
+ {
+ facility = LOG_LOCAL2;
+ }
+ else if(facilityString.equals("LOG_LOCAL3"))
+ {
+ facility = LOG_LOCAL3;
+ }
+ else if(facilityString.equals("LOG_LOCAL4"))
+ {
+ facility = LOG_LOCAL4;
+ }
+ else if(facilityString.equals("LOG_LOCAL5"))
+ {
+ facility = LOG_LOCAL5;
+ }
+ else if(facilityString.equals("LOG_LOCAL6"))
+ {
+ facility = LOG_LOCAL6;
+ }
+ else if(facilityString.equals("LOG_LOCAL7"))
+ {
+ facility = LOG_LOCAL7;
+ }
+ else
+ {
+ throw new InitializationException("Invalid value for Ice.SyslogFacility: " + facilityString);
+ }
+ initialize(prefix, facility);
+ }
+
+ private
+ SysLoggerI(String prefix, int facility)
+ {
+ initialize(prefix, facility);
+ }
+
+ private void
+ initialize(String prefix, int facility)
+ {
+ _prefix = prefix;
+ _facility = facility;
+
+ //
+ // Open a datagram socket to communicate with the localhost
+ // syslog daemon.
+ //
+ try
+ {
+ _host = com.zeroc.IceInternal.Network.getLocalAddress(com.zeroc.IceInternal.Network.EnableBoth);
+ _socket = new DatagramSocket();
+ _socket.connect(_host, _port);
+ }
+ catch(IOException ex)
+ {
+ throw new SocketException(ex);
+ }
+ }
+
+ @Override
+ public void
+ print(String message)
+ {
+ log(LOG_INFO, message);
+ }
+
+ @Override
+ public void
+ trace(String category, String message)
+ {
+ log(LOG_INFO, category + ": " + message);
+ }
+
+ @Override
+ public void
+ warning(String message)
+ {
+ log(LOG_WARNING, message);
+ }
+
+ @Override
+ public void
+ error(String message)
+ {
+ log(LOG_ERR, message);
+ }
+
+
+ @Override
+ public String
+ getPrefix()
+ {
+ return _prefix;
+ }
+
+ @Override
+ public Logger
+ cloneWithPrefix(String prefix)
+ {
+ return new SysLoggerI(prefix, _facility);
+ }
+
+ private void
+ log(int severity, String message)
+ {
+ try
+ {
+ //
+ // Create a syslog message as defined by the RFC 3164:
+ // <PRI>HEADER MSG. PRI is the priority and is calculated
+ // from the facility and the severity. We don't specify
+ // the HEADER. MSG contains the identifier followed by a
+ // colon character and the message.
+ //
+
+ int priority = (_facility << 3) | severity;
+
+ String msg = '<' + Integer.toString(priority) + '>' + _prefix + ": " + message;
+
+ byte buf[] = msg.getBytes();
+ DatagramPacket p = new DatagramPacket(buf, buf.length, _host, _port);
+ _socket.send(p);
+ }
+ catch(IOException ex)
+ {
+ throw new SocketException(ex);
+ }
+ }
+
+ private String _prefix;
+ private int _facility;
+ private DatagramSocket _socket;
+ private InetAddress _host;
+ private static int _port = 514;
+
+ //
+ // Syslog facilities (as defined in syslog.h)
+ //
+ private final static int LOG_KERN = 0;
+ private final static int LOG_USER = 1;
+ private final static int LOG_MAIL = 2;
+ private final static int LOG_DAEMON = 3;
+ private final static int LOG_AUTH = 4;
+ private final static int LOG_SYSLOG = 5;
+ private final static int LOG_LPR = 6;
+ private final static int LOG_NEWS = 7;
+ private final static int LOG_UUCP = 8;
+ private final static int LOG_CRON = 9;
+ private final static int LOG_AUTHPRIV = 10;
+ private final static int LOG_FTP = 11;
+ private final static int LOG_LOCAL0 = 16;
+ private final static int LOG_LOCAL1 = 17;
+ private final static int LOG_LOCAL2 = 18;
+ private final static int LOG_LOCAL3 = 19;
+ private final static int LOG_LOCAL4 = 20;
+ private final static int LOG_LOCAL5 = 21;
+ private final static int LOG_LOCAL6 = 22;
+ private final static int LOG_LOCAL7 = 23;
+
+ //
+ // Syslog priorities (as defined in syslog.h)
+ //
+ private final static int LOG_ERR = 3;
+ private final static int LOG_WARNING = 4;
+ private final static int LOG_INFO = 6;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/SystemException.java b/java/src/Ice/src/main/java/com/zeroc/Ice/SystemException.java
new file mode 100644
index 00000000000..d07c2da2c37
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/SystemException.java
@@ -0,0 +1,25 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * Base class for all Ice system exceptions.
+ **/
+public abstract class SystemException extends Exception
+{
+ public SystemException()
+ {
+ }
+
+ public SystemException(Throwable cause)
+ {
+ super(cause);
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/ThreadHookPlugin.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ThreadHookPlugin.java
new file mode 100644
index 00000000000..799b89a0b72
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ThreadHookPlugin.java
@@ -0,0 +1,64 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * Class to support thread notification hooks. Applications using thread
+ * notifications hooks instantiate a <code>ThreadHookPlugin</code> with
+ * a thread notification hook and return the instance from their
+ * {@link PluginFactory} implementation.
+ *
+ * @see PluginFactory
+ * @see Plugin
+ **/
+public class ThreadHookPlugin implements Plugin
+{
+ /**
+ * Installs a thread notification hook for a communicator.
+ *
+ * @param communicator The communicator using the thread notification hook.
+ * @param threadHook The thread notification hook for the communicator.
+ **/
+ public
+ ThreadHookPlugin(Communicator communicator, ThreadNotification threadHook)
+ {
+ if(communicator == null)
+ {
+ PluginInitializationException ex = new PluginInitializationException();
+ ex.reason = "Communicator cannot be null";
+ throw ex;
+ }
+
+ com.zeroc.IceInternal.Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator);
+ instance.setThreadHook(threadHook);
+ }
+
+ /**
+ * Called by the Ice run time during communicator initialization. The derived class
+ * can override this method to perform any initialization that might be required
+ * by a custom thread notification hook.
+ **/
+ @Override
+ public void
+ initialize()
+ {
+ }
+
+ /**
+ * Called by the Ice run time when the communicator is destroyed. The derived class
+ * can override this method to perform any finalization that might be required
+ * by a custom thread notification hook.
+ **/
+ @Override
+ public void
+ destroy()
+ {
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/ThreadNotification.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ThreadNotification.java
new file mode 100644
index 00000000000..195e6e842b0
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ThreadNotification.java
@@ -0,0 +1,34 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * Interface for thread notification hooks. Applications can derive
+ * a class that implements the <code>start</code> and <code>stop</code>
+ * methods to intercept creation and destruction of threads created
+ * by the Ice run time.
+ *
+ * @see InitializationData
+ **/
+public interface ThreadNotification
+{
+ /**
+ * The Ice run time calls <code>start</code> for each new
+ * thread it creates. The call is made by the newly-started thread.
+ **/
+ void start();
+
+ /**
+ * The Ice run time calls <code>stop</code> before it destroys
+ * a thread. The call is made by thread that is about to be
+ * destroyed.
+ **/
+ void stop();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/UnknownSlicedValue.java b/java/src/Ice/src/main/java/com/zeroc/Ice/UnknownSlicedValue.java
new file mode 100644
index 00000000000..7b0cfc75fbc
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/UnknownSlicedValue.java
@@ -0,0 +1,53 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * Unknown sliced value holds an instance of an unknown Slice class type.
+ **/
+public final class UnknownSlicedValue extends Value
+{
+ /**
+ * Represents an instance of a Slice class type having the given Slice type.
+ *
+ * @param unknownTypeId The Slice type ID of the unknown object.
+ **/
+ public UnknownSlicedValue(String unknownTypeId)
+ {
+ _unknownTypeId = unknownTypeId;
+ }
+
+ /**
+ * Determine the Slice type ID associated with this object.
+ *
+ * @return The type ID.
+ **/
+ public String getUnknownTypeId()
+ {
+ return _unknownTypeId;
+ }
+
+ @Override
+ public void __write(OutputStream __os)
+ {
+ __os.startValue(_slicedData);
+ __os.endValue();
+ }
+
+ @Override
+ public void __read(InputStream __is)
+ {
+ __is.startValue();
+ _slicedData = __is.endValue(true);
+ }
+
+ private final String _unknownTypeId;
+ private SlicedData _slicedData;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/UserException.java b/java/src/Ice/src/main/java/com/zeroc/Ice/UserException.java
new file mode 100644
index 00000000000..e4ea68ea718
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/UserException.java
@@ -0,0 +1,108 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * Base class for Slice user exceptions.
+ **/
+public abstract class UserException extends java.lang.Exception implements Cloneable
+{
+ public UserException()
+ {
+ }
+
+ public UserException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ /**
+ * Creates a copy of this exception.
+ *
+ * @return The copy of this exception.
+ **/
+ @Override
+ public UserException clone()
+ {
+ UserException c = null;
+
+ try
+ {
+ c = (UserException)super.clone();
+ }
+ catch(CloneNotSupportedException ex)
+ {
+ assert false;
+ }
+ return c;
+ }
+
+ /**
+ * Returns the name of this exception.
+ *
+ * @return The name of this exception.
+ *
+ * @deprecated ice_name() is deprecated, use ice_id() instead.
+ **/
+ @Deprecated
+ public String ice_name()
+ {
+ return ice_id().substring(2);
+ }
+
+ /**
+ * Returns the type id of this exception.
+ *
+ * @return The type id of this exception.
+ **/
+ public abstract String ice_id();
+
+ /**
+ * Returns a string representation of this exception.
+ *
+ * @return A string representation of this exception.
+ **/
+ @Override
+ public String toString()
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ com.zeroc.IceUtilInternal.OutputBase out = new com.zeroc.IceUtilInternal.OutputBase(pw);
+ out.setUseTab(false);
+ out.print(getClass().getName());
+ out.inc();
+ com.zeroc.IceInternal.ValueWriter.write(this, out);
+ pw.flush();
+ return sw.toString();
+ }
+
+ public void __write(OutputStream os)
+ {
+ os.startException(null);
+ __writeImpl(os);
+ os.endException();
+ }
+
+ public void __read(InputStream is)
+ {
+ is.startException();
+ __readImpl(is);
+ is.endException(false);
+ }
+
+ public boolean __usesClasses()
+ {
+ return false;
+ }
+
+ protected abstract void __writeImpl(OutputStream os);
+
+ protected abstract void __readImpl(InputStream is);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/UserExceptionFactory.java b/java/src/Ice/src/main/java/com/zeroc/Ice/UserExceptionFactory.java
new file mode 100644
index 00000000000..9ee52aacf31
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/UserExceptionFactory.java
@@ -0,0 +1,26 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * Instantiates user exceptions.
+ *
+ * @see InputStream#throwException
+ **/
+public interface UserExceptionFactory
+{
+ /**
+ * Instantiate a user exception with the given Slice type id (such as <code>::Module::MyException</code>)
+ * and throw it. If the implementation does not throw an exception, the Ice run time will fall back
+ * to using its default behavior for instantiating the user exception.
+ **/
+ void createAndThrow(String typeId)
+ throws UserException;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/Util.java b/java/src/Ice/src/main/java/com/zeroc/Ice/Util.java
new file mode 100644
index 00000000000..05e8faccafd
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/Util.java
@@ -0,0 +1,665 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+import com.zeroc.IceUtilInternal.StringUtil;
+
+/**
+ * Utility methods for the Ice run time.
+ **/
+public final class Util
+{
+ /**
+ * Creates a new empty property set.
+ *
+ * @return A new empty property set.
+ **/
+ public static Properties createProperties()
+ {
+ return new PropertiesI();
+ }
+
+ /**
+ * Encapsulates the results of a call to createProperties().
+ **/
+ public static class CreatePropertiesResult
+ {
+ /** The new property set. */
+ public Properties properties;
+
+ /** The original command-line arguments with Ice-related arguments removed. */
+ public String[] args;
+ }
+
+ /**
+ * Creates a property set initialized from an argument vector.
+ *
+ * @param args A command-line argument vector, possibly containing
+ * options to set properties. If the command-line options include
+ * a <code>--Ice.Config</code> option, the corresponding configuration
+ * files are parsed. If the same property is set in a configuration
+ * file and in the argument vector, the argument vector takes precedence.
+ *
+ * @return A new property set initialized with the property settings
+ * that were removed from the argument vector, along with the filtered
+ * argument vector.
+ **/
+ public static CreatePropertiesResult createProperties(String[] args)
+ {
+ return createProperties(args, null);
+ }
+
+ /**
+ * Creates a property set initialized from an argument vector.
+ *
+ * @param args A command-line argument vector, possibly containing
+ * options to set properties. If the command-line options include
+ * a <code>--Ice.Config</code> option, the corresponding configuration
+ * files are parsed. If the same property is set in a configuration
+ * file and in the argument vector, the argument vector takes precedence.
+ *
+ * @param defaults Default values for the property set. Settings in configuration
+ * files and <code>args</code> override these defaults.
+ *
+ * @return A new property set initialized with the property settings
+ * that were removed from the argument vector, along with the filtered
+ * argument vector.
+ **/
+ public static CreatePropertiesResult createProperties(String[] args, Properties defaults)
+ {
+ PropertiesI properties = new PropertiesI();
+ CreatePropertiesResult cpr = new CreatePropertiesResult();
+ cpr.properties = properties;
+ cpr.args = properties.init(args, defaults);
+ return cpr;
+ }
+
+ /**
+ * Encapsulates the results of a call to initialize().
+ **/
+ public static class InitializeResult
+ {
+ /** The new communicator. */
+ public Communicator communicator;
+
+ /** The original command-line arguments with Ice-related arguments removed. */
+ public String[] args;
+ }
+
+ /**
+ * Creates a communicator.
+ *
+ * @param args A command-line argument vector. Any Ice-related options
+ * in this vector are used to initialize the communicator.
+ *
+ * @return The new communicator and a filtered argument vector.
+ **/
+ public static InitializeResult initialize(String[] args)
+ {
+ return initialize(args, null);
+ }
+
+ /**
+ * Creates a communicator.
+ *
+ * @param args A command-line argument vector. Any Ice-related options
+ * in this vector are used to initialize the communicator.
+ *
+ * @param initData Additional initialization data. Property settings in <code>args</code>
+ * override property settings in <code>initData</code>.
+ *
+ * @return The new communicator and a filtered argument vector.
+ *
+ * @see InitializationData
+ **/
+ public static InitializeResult initialize(String[] args, InitializationData initData)
+ {
+ if(initData == null)
+ {
+ initData = new InitializationData();
+ }
+ else
+ {
+ initData = initData.clone();
+ }
+
+ CreatePropertiesResult cpr = createProperties(args, initData.properties);
+ initData.properties = cpr.properties;
+
+ InitializeResult ir = new InitializeResult();
+
+ CommunicatorI c = new CommunicatorI(initData);
+ ir.communicator = c;
+ ir.args = c.finishSetup(cpr.args);
+ return ir;
+ }
+
+ /**
+ * Creates a communicator.
+ *
+ * @param initData Additional initialization data.
+ *
+ * @return The new communicator.
+ *
+ * @see InitializationData
+ **/
+ public static Communicator initialize(InitializationData initData)
+ {
+ if(initData == null)
+ {
+ initData = new InitializationData();
+ }
+ else
+ {
+ initData = initData.clone();
+ }
+
+ CommunicatorI result = new CommunicatorI(initData);
+ result.finishSetup(new String[0]);
+ return result;
+ }
+
+ /**
+ * Creates a communicator using a default configuration.
+ **/
+ public static Communicator initialize()
+ {
+ return initialize(new InitializationData());
+ }
+
+ /**
+ * Converts a string to an object identity.
+ *
+ * @param s The string to convert.
+ *
+ * @return The converted object identity.
+ **/
+ public static Identity stringToIdentity(String s)
+ {
+ Identity ident = new Identity();
+
+ //
+ // Find unescaped separator; note that the string may contain an escaped
+ // backslash before the separator.
+ //
+ int slash = -1, pos = 0;
+ while((pos = s.indexOf('/', pos)) != -1)
+ {
+ int escapes = 0;
+ while(pos - escapes > 0 && s.charAt(pos - escapes - 1) == '\\')
+ {
+ escapes++;
+ }
+
+ //
+ // We ignore escaped escapes
+ //
+ if(escapes % 2 == 0)
+ {
+ if(slash == -1)
+ {
+ slash = pos;
+ }
+ else
+ {
+ //
+ // Extra unescaped slash found.
+ //
+ IdentityParseException ex = new IdentityParseException();
+ ex.str = "unescaped backslash in identity `" + s + "'";
+ throw ex;
+ }
+ }
+ pos++;
+ }
+
+ if(slash == -1)
+ {
+ ident.category = "";
+ try
+ {
+ ident.name = StringUtil.unescapeString(s, 0, s.length());
+ }
+ catch(IllegalArgumentException e)
+ {
+ IdentityParseException ex = new IdentityParseException();
+ ex.str = "invalid identity name `" + s + "': " + e.getMessage();
+ throw ex;
+ }
+ }
+ else
+ {
+ try
+ {
+ ident.category = StringUtil.unescapeString(s, 0, slash);
+ }
+ catch(IllegalArgumentException e)
+ {
+ IdentityParseException ex = new IdentityParseException();
+ ex.str = "invalid category in identity `" + s + "': " + e.getMessage();
+ throw ex;
+ }
+ if(slash + 1 < s.length())
+ {
+ try
+ {
+ ident.name = StringUtil.unescapeString(s, slash + 1, s.length());
+ }
+ catch(IllegalArgumentException e)
+ {
+ IdentityParseException ex = new IdentityParseException();
+ ex.str = "invalid name in identity `" + s + "': " + e.getMessage();
+ throw ex;
+ }
+ }
+ else
+ {
+ ident.name = "";
+ }
+ }
+
+ return ident;
+ }
+
+ /**
+ * Converts an object identity to a string.
+ *
+ * @param ident The object identity to convert.
+ *
+ * @return The string representation of the object identity.
+ **/
+ public static String identityToString(Identity ident)
+ {
+ if(ident.category == null || ident.category.length() == 0)
+ {
+ return StringUtil.escapeString(ident.name, "/");
+ }
+ else
+ {
+ return StringUtil.escapeString(ident.category, "/") + '/' + StringUtil.escapeString(ident.name, "/");
+ }
+ }
+
+ /**
+ * Compares the object identities of two proxies.
+ *
+ * @param lhs A proxy.
+ * @param rhs A proxy.
+ * @return -1 if the identity in <code>lhs</code> compares
+ * less than the identity in <code>rhs</code>; 0 if the identities
+ * compare equal; 1, otherwise.
+ *
+ * @see ProxyIdentityKey
+ * @see ProxyIdentityFacetKey
+ * @see #proxyIdentityAndFacetCompare
+ **/
+ public static int proxyIdentityCompare(ObjectPrx lhs, ObjectPrx rhs)
+ {
+ if(lhs == null && rhs == null)
+ {
+ return 0;
+ }
+ else if(lhs == null && rhs != null)
+ {
+ return -1;
+ }
+ else if(lhs != null && rhs == null)
+ {
+ return 1;
+ }
+ else
+ {
+ Identity lhsIdentity = lhs.ice_getIdentity();
+ Identity rhsIdentity = rhs.ice_getIdentity();
+ int n;
+ if((n = lhsIdentity.name.compareTo(rhsIdentity.name)) != 0)
+ {
+ return n;
+ }
+ return lhsIdentity.category.compareTo(rhsIdentity.category);
+ }
+ }
+
+ /**
+ * Compares the object identities and facets of two proxies.
+ *
+ * @param lhs A proxy.
+ * @param rhs A proxy.
+ * @return -1 if the identity and facet in <code>lhs</code> compare
+ * less than the identity and facet in <code>rhs</code>; 0 if the identities
+ * and facets compare equal; 1, otherwise.
+ *
+ * @see ProxyIdentityFacetKey
+ * @see ProxyIdentityKey
+ * @see #proxyIdentityCompare
+ **/
+ public static int proxyIdentityAndFacetCompare(ObjectPrx lhs, ObjectPrx rhs)
+ {
+ if(lhs == null && rhs == null)
+ {
+ return 0;
+ }
+ else if(lhs == null && rhs != null)
+ {
+ return -1;
+ }
+ else if(lhs != null && rhs == null)
+ {
+ return 1;
+ }
+ else
+ {
+ Identity lhsIdentity = lhs.ice_getIdentity();
+ Identity rhsIdentity = rhs.ice_getIdentity();
+ int n;
+ if((n = lhsIdentity.name.compareTo(rhsIdentity.name)) != 0)
+ {
+ return n;
+ }
+ if((n = lhsIdentity.category.compareTo(rhsIdentity.category)) != 0)
+ {
+ return n;
+ }
+
+ String lhsFacet = lhs.ice_getFacet();
+ String rhsFacet = rhs.ice_getFacet();
+ if(lhsFacet == null && rhsFacet == null)
+ {
+ return 0;
+ }
+ else if(lhsFacet == null)
+ {
+ return -1;
+ }
+ else if(rhsFacet == null)
+ {
+ return 1;
+ }
+ return lhsFacet.compareTo(rhsFacet);
+ }
+ }
+
+ /**
+ * Returns the process-wide logger.
+ *
+ * @return The process-wide logger.
+ **/
+ public static Logger getProcessLogger()
+ {
+ synchronized(_processLoggerMutex)
+ {
+ if(_processLogger == null)
+ {
+ //
+ // TODO: Would be nice to be able to use process name as prefix by default.
+ //
+ _processLogger = new LoggerI("", "");
+ }
+
+ return _processLogger;
+ }
+ }
+
+ /**
+ * Changes the process-wide logger.
+ *
+ * @param logger The new process-wide logger.
+ **/
+ public static void setProcessLogger(Logger logger)
+ {
+ synchronized(_processLoggerMutex)
+ {
+ _processLogger = logger;
+ }
+ }
+
+ /**
+ * Returns the Ice version in the form <code>A.B.C</code>, where <code>A</code> indicates the
+ * major version, <code>B</code> indicates the minor version, and <code>C</code> indicates the
+ * patch level.
+ *
+ * @return The Ice version.
+ **/
+ public static String stringVersion()
+ {
+ return "3.7a3"; // "A.B.C", with A=major, B=minor, C=patch
+ }
+
+ /**
+ * Returns the Ice version as an integer in the form <code>A.BB.CC</code>, where <code>A</code>
+ * indicates the major version, <code>BB</code> indicates the minor version, and <code>CC</code>
+ * indicates the patch level. For example, for Ice 3.3.1, the returned value is 30301.
+ *
+ * @return The Ice version.
+ **/
+ public static int intVersion()
+ {
+ return 30753; // AABBCC, with AA=major, BB=minor, CC=patch
+ }
+
+ /**
+ * Converts a string to a protocol version.
+ *
+ * @param version The string to convert.
+ *
+ * @return The converted protocol version.
+ **/
+ static public ProtocolVersion stringToProtocolVersion(String version)
+ {
+ return new ProtocolVersion(stringToMajor(version), stringToMinor(version));
+ }
+
+ /**
+ * Converts a string to an encoding version.
+ *
+ * @param version The string to convert.
+ *
+ * @return The converted object identity.
+ **/
+ static public EncodingVersion stringToEncodingVersion(String version)
+ {
+ return new EncodingVersion(stringToMajor(version), stringToMinor(version));
+ }
+
+ /**
+ * Converts a protocol version to a string.
+ *
+ * @param v The protocol version to convert.
+ *
+ * @return The converted string.
+ **/
+ static public String protocolVersionToString(ProtocolVersion v)
+ {
+ return majorMinorToString(v.major, v.minor);
+ }
+
+ /**
+ * Converts an encoding version to a string.
+ *
+ * @param v The encoding version to convert.
+ *
+ * @return The converted string.
+ **/
+ static public String encodingVersionToString(EncodingVersion v)
+ {
+ return majorMinorToString(v.major, v.minor);
+ }
+
+ /**
+ * Returns the supported Ice protocol version.
+ *
+ * @return The Ice protocol version.
+ **/
+ static public ProtocolVersion currentProtocol()
+ {
+ return com.zeroc.IceInternal.Protocol.currentProtocol.clone();
+ }
+
+ /**
+ * Returns the supported Ice encoding version.
+ *
+ * @return The Ice encoding version.
+ **/
+ static public EncodingVersion currentEncoding()
+ {
+ return com.zeroc.IceInternal.Protocol.currentEncoding.clone();
+ }
+
+ /**
+ * Returns the InvocationFuture equivalent of the given CompletableFuture.
+ *
+ * @param f The CompletableFuture returned by an asynchronous Ice proxy invocation.
+ * @return The InvocationFuture object.
+ **/
+ @SuppressWarnings("unchecked")
+ static public <T> InvocationFuture<T> getInvocationFuture(java.util.concurrent.CompletableFuture<T> f)
+ {
+ if(!(f instanceof InvocationFuture))
+ {
+ throw new IllegalArgumentException("future did not originate from an asynchronous proxy invocation");
+ }
+ return (InvocationFuture)f;
+ }
+
+ /**
+ * Translates a Slice type id to a Java class name.
+ *
+ * @param id The Slice type id, such as <code>::Module::Type</code>.
+ * @return The equivalent Java class name, or null if the type id is malformed.
+ **/
+ static public String typeIdToClass(String id)
+ {
+ if(!id.startsWith("::"))
+ {
+ return null;
+ }
+
+ StringBuilder buf = new StringBuilder(id.length());
+
+ int start = 2;
+ boolean done = false;
+ while(!done)
+ {
+ int end = id.indexOf(':', start);
+ String s;
+ if(end != -1)
+ {
+ s = id.substring(start, end);
+ start = end + 2;
+ }
+ else
+ {
+ s = id.substring(start);
+ done = true;
+ }
+ if(buf.length() > 0)
+ {
+ buf.append('.');
+ }
+ buf.append(fixKwd(s));
+ }
+
+ return buf.toString();
+ }
+
+ static private String fixKwd(String name)
+ {
+ //
+ // Keyword list. *Must* be kept in alphabetical order. Note that checkedCast and uncheckedCast
+ // are not Java keywords, but are in this list to prevent illegal code being generated if
+ // someone defines Slice operations with that name.
+ //
+ final String[] keywordList =
+ {
+ "abstract", "assert", "boolean", "break", "byte", "case", "catch",
+ "char", "checkedCast", "class", "clone", "const", "continue", "default", "do",
+ "double", "else", "enum", "equals", "extends", "false", "final", "finalize",
+ "finally", "float", "for", "getClass", "goto", "hashCode", "if",
+ "implements", "import", "instanceof", "int", "interface", "long",
+ "native", "new", "notify", "notifyAll", "null", "package", "private",
+ "protected", "public", "return", "short", "static", "strictfp", "super", "switch",
+ "synchronized", "this", "throw", "throws", "toString", "transient",
+ "true", "try", "uncheckedCast", "void", "volatile", "wait", "while"
+ };
+ boolean found = java.util.Arrays.binarySearch(keywordList, name) >= 0;
+ return found ? "_" + name : name;
+ }
+
+ static private byte stringToMajor(String str)
+ {
+ int pos = str.indexOf('.');
+ if(pos == -1)
+ {
+ throw new VersionParseException("malformed version value `" + str + "'");
+ }
+
+ String majStr = str.substring(0, pos);
+ int majVersion;
+ try
+ {
+ majVersion = Integer.parseInt(majStr);
+ }
+ catch(NumberFormatException ex)
+ {
+ throw new VersionParseException("invalid version value `" + str + "'");
+ }
+
+ if(majVersion < 1 || majVersion > 255)
+ {
+ throw new VersionParseException("range error in version `" + str + "'");
+ }
+
+ return (byte)majVersion;
+ }
+
+ static private byte stringToMinor(String str)
+ {
+ int pos = str.indexOf('.');
+ if(pos == -1)
+ {
+ throw new VersionParseException("malformed version value `" + str + "'");
+ }
+
+ String minStr = str.substring(pos + 1, str.length());
+ int minVersion;
+ try
+ {
+ minVersion = Integer.parseInt(minStr);
+ }
+ catch(NumberFormatException ex)
+ {
+ throw new VersionParseException("invalid version value `" + str + "'");
+ }
+
+ if(minVersion < 0 || minVersion > 255)
+ {
+ throw new VersionParseException("range error in version `" + str + "'");
+ }
+
+ return (byte)minVersion;
+ }
+
+ static private String majorMinorToString(byte major, byte minor)
+ {
+ StringBuilder str = new StringBuilder();
+ str.append(major < 0 ? major + 255 : (int)major);
+ str.append(".");
+ str.append(minor < 0 ? minor + 255 : (int)minor);
+ return str.toString();
+ }
+
+ public final static ProtocolVersion Protocol_1_0 = new ProtocolVersion((byte)1, (byte)0);
+
+ public final static EncodingVersion Encoding_1_0 = new EncodingVersion((byte)1, (byte)0);
+ public final static EncodingVersion Encoding_1_1 = new EncodingVersion((byte)1, (byte)1);
+
+ private static java.lang.Object _processLoggerMutex = new java.lang.Object();
+ private static Logger _processLogger = null;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/Value.java b/java/src/Ice/src/main/java/com/zeroc/Ice/Value.java
new file mode 100644
index 00000000000..7b1c64781f8
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/Value.java
@@ -0,0 +1,90 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * The base class for instances of Slice classes.
+ **/
+public abstract class Value implements java.lang.Cloneable, java.io.Serializable
+{
+ /**
+ * Returns a copy of the object. The cloned object contains field-for-field copies
+ * of the state.
+ *
+ * @return The cloned object.
+ **/
+ public Value clone()
+ {
+ Value c = null;
+
+ try
+ {
+ c = (Value)super.clone();
+ }
+ catch(CloneNotSupportedException ex)
+ {
+ assert(false);
+ }
+
+ return c;
+ }
+
+ /**
+ * The Ice run time invokes this method prior to marshaling an object's data members. This allows a subclass
+ * to override this method in order to validate its data members.
+ **/
+ public void ice_preMarshal()
+ {
+ }
+
+ /**
+ * The Ice run time invokes this method vafter unmarshaling an object's data members. This allows a
+ * subclass to override this method in order to perform additional initialization.
+ **/
+ public void ice_postUnmarshal()
+ {
+ }
+
+ public static final String ice_staticId = "::Ice::Object";
+
+ /**
+ * Returns the Slice type ID of the most-derived interface supported by this object.
+ *
+ * @return The return value is always <code>::Ice::Object</code>.
+ **/
+ public String ice_id()
+ {
+ return ice_staticId;
+ }
+
+ public void __write(OutputStream __os)
+ {
+ __os.startValue(null);
+ __writeImpl(__os);
+ __os.endValue();
+ }
+
+ public void __read(InputStream __is)
+ {
+ __is.startValue();
+ __readImpl(__is);
+ __is.endValue(false);
+ }
+
+ protected void __writeImpl(OutputStream __os)
+ {
+ }
+
+ protected void __readImpl(InputStream __is)
+ {
+ }
+
+ public static final long serialVersionUID = 0L;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/ValueFactoryManagerI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ValueFactoryManagerI.java
new file mode 100644
index 00000000000..bba1a8d8eb0
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ValueFactoryManagerI.java
@@ -0,0 +1,30 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+public class ValueFactoryManagerI implements ValueFactoryManager
+{
+ public synchronized void add(ValueFactory factory, String id)
+ {
+ if(_factoryMap.containsKey(id))
+ {
+ throw new AlreadyRegisteredException("value factory", id);
+ }
+
+ _factoryMap.put(id, factory);
+ }
+
+ public synchronized ValueFactory find(String id)
+ {
+ return _factoryMap.get(id);
+ }
+
+ private java.util.HashMap<String, ValueFactory> _factoryMap = new java.util.HashMap<>();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/ValueReader.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ValueReader.java
new file mode 100644
index 00000000000..86849af7450
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ValueReader.java
@@ -0,0 +1,35 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * Base class for extracting a Slice class instance from an input stream.
+ **/
+public abstract class ValueReader extends Value
+{
+ /**
+ * Reads the state of this Slice class from an input stream.
+ *
+ * @param in The input stream to read from.
+ **/
+ public abstract void read(InputStream in);
+
+ @Override
+ public void __write(OutputStream os)
+ {
+ assert(false);
+ }
+
+ @Override
+ public void __read(InputStream is)
+ {
+ read(is);
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/ValueWriter.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ValueWriter.java
new file mode 100644
index 00000000000..40e739a914f
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ValueWriter.java
@@ -0,0 +1,35 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * Base class for writing a Slice class instance to an output stream.
+ **/
+public abstract class ValueWriter extends Value
+{
+ /**
+ * Writes the state of this Slice class to an output stream.
+ *
+ * @param out The stream to write to.
+ **/
+ public abstract void write(OutputStream out);
+
+ @Override
+ public void __write(OutputStream os)
+ {
+ write(os);
+ }
+
+ @Override
+ public void __read(InputStream is)
+ {
+ assert(false);
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxFactoryMethods.java b/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxFactoryMethods.java
new file mode 100644
index 00000000000..a322a6e86b6
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxFactoryMethods.java
@@ -0,0 +1,144 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+/**
+ * Provides overloads of the proxy factory methods with covariant return types
+ * so that applications do not need to downcast to the derived proxy type.
+ **/
+@SuppressWarnings("unchecked")
+public interface _ObjectPrxFactoryMethods<T extends ObjectPrx> extends ObjectPrx
+{
+ @Override
+ default T ice_context(java.util.Map<String, String> newContext)
+ {
+ return (T)ObjectPrx.super.ice_context(newContext);
+ }
+
+ @Override
+ default T ice_adapterId(String newAdapterId)
+ {
+ return (T)ObjectPrx.super.ice_adapterId(newAdapterId);
+ }
+
+ @Override
+ default T ice_endpoints(Endpoint[] newEndpoints)
+ {
+ return (T)ObjectPrx.super.ice_endpoints(newEndpoints);
+ }
+
+ @Override
+ default T ice_locatorCacheTimeout(int newTimeout)
+ {
+ return (T)ObjectPrx.super.ice_locatorCacheTimeout(newTimeout);
+ }
+
+ @Override
+ default T ice_invocationTimeout(int newTimeout)
+ {
+ return (T)ObjectPrx.super.ice_invocationTimeout(newTimeout);
+ }
+
+ @Override
+ default T ice_connectionCached(boolean newCache)
+ {
+ return (T)ObjectPrx.super.ice_connectionCached(newCache);
+ }
+
+ @Override
+ default T ice_endpointSelection(EndpointSelectionType newType)
+ {
+ return (T)ObjectPrx.super.ice_endpointSelection(newType);
+ }
+
+ @Override
+ default T ice_secure(boolean b)
+ {
+ return (T)ObjectPrx.super.ice_secure(b);
+ }
+
+ @Override
+ default T ice_encodingVersion(EncodingVersion e)
+ {
+ return (T)ObjectPrx.super.ice_encodingVersion(e);
+ }
+
+ @Override
+ default T ice_preferSecure(boolean b)
+ {
+ return (T)ObjectPrx.super.ice_preferSecure(b);
+ }
+
+ @Override
+ default T ice_router(RouterPrx router)
+ {
+ return (T)ObjectPrx.super.ice_router(router);
+ }
+
+ @Override
+ default T ice_locator(LocatorPrx locator)
+ {
+ return (T)ObjectPrx.super.ice_locator(locator);
+ }
+
+ @Override
+ default T ice_collocationOptimized(boolean b)
+ {
+ return (T)ObjectPrx.super.ice_collocationOptimized(b);
+ }
+
+ @Override
+ default T ice_twoway()
+ {
+ return (T)ObjectPrx.super.ice_twoway();
+ }
+
+ @Override
+ default T ice_oneway()
+ {
+ return (T)ObjectPrx.super.ice_oneway();
+ }
+
+ @Override
+ default T ice_batchOneway()
+ {
+ return (T)ObjectPrx.super.ice_batchOneway();
+ }
+
+ @Override
+ default T ice_datagram()
+ {
+ return (T)ObjectPrx.super.ice_datagram();
+ }
+
+ @Override
+ default T ice_batchDatagram()
+ {
+ return (T)ObjectPrx.super.ice_batchDatagram();
+ }
+
+ @Override
+ default T ice_compress(boolean co)
+ {
+ return (T)ObjectPrx.super.ice_compress(co);
+ }
+
+ @Override
+ default T ice_timeout(int t)
+ {
+ return (T)ObjectPrx.super.ice_timeout(t);
+ }
+
+ @Override
+ default T ice_connectionId(String connectionId)
+ {
+ return (T)ObjectPrx.super.ice_connectionId(connectionId);
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxI.java
new file mode 100644
index 00000000000..10af97bb35a
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxI.java
@@ -0,0 +1,690 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.Ice;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import com.zeroc.IceInternal.OutgoingAsync;
+
+/**
+ * Concrete proxy implementation.
+ **/
+public class _ObjectPrxI implements ObjectPrx, java.io.Serializable
+{
+ public Communicator ice_getCommunicator()
+ {
+ return _reference.getCommunicator();
+ }
+
+ public boolean ice_isA(String id)
+ {
+ return ice_isA(id, ObjectPrx.noExplicitContext);
+ }
+
+ public boolean ice_isA(String id, java.util.Map<String, String> __ctx)
+ {
+ return __ice_isAAsync(id, __ctx, true).__wait();
+ }
+
+ public java.util.concurrent.CompletableFuture<java.lang.Boolean> ice_isAAsync(String id)
+ {
+ return __ice_isAAsync(id, ObjectPrx.noExplicitContext, false);
+ }
+
+ public java.util.concurrent.CompletableFuture<java.lang.Boolean> ice_isAAsync(
+ String id,
+ java.util.Map<String, String> __ctx)
+ {
+ return __ice_isAAsync(id, __ctx, false);
+ }
+
+ private OutgoingAsync<java.lang.Boolean> __ice_isAAsync(
+ String id,
+ java.util.Map<String, String> __ctx,
+ boolean __sync)
+ {
+ OutgoingAsync<java.lang.Boolean> __f =
+ new OutgoingAsync<>(this, "ice_isA", OperationMode.Nonmutating, __sync, null);
+ __f.invoke(true, __ctx, null, __os -> {
+ __os.writeString(id);
+ }, __is -> {
+ boolean __ret;
+ __ret = __is.readBool();
+ return __ret;
+ });
+ return __f;
+ }
+
+ public void ice_ping()
+ {
+ ice_ping(ObjectPrx.noExplicitContext);
+ }
+
+ public void ice_ping(java.util.Map<String, String> __ctx)
+ {
+ __ice_pingAsync(__ctx, true).__wait();
+ }
+
+ public java.util.concurrent.CompletableFuture<Void> ice_pingAsync()
+ {
+ return __ice_pingAsync(ObjectPrx.noExplicitContext, false);
+ }
+
+ public java.util.concurrent.CompletableFuture<Void> ice_pingAsync(java.util.Map<String, String> __ctx)
+ {
+ return __ice_pingAsync(__ctx, false);
+ }
+
+ private OutgoingAsync<Void> __ice_pingAsync(
+ java.util.Map<String, String> __ctx,
+ boolean __sync)
+ {
+ OutgoingAsync<Void> __f = new OutgoingAsync<>(this, "ice_ping", OperationMode.Nonmutating, __sync, null);
+ __f.invoke(false, __ctx, null, null, null);
+ return __f;
+ }
+
+ public String[] ice_ids()
+ {
+ return ice_ids(ObjectPrx.noExplicitContext);
+ }
+
+ public String[] ice_ids(java.util.Map<String, String> __ctx)
+ {
+ return __ice_idsAsync(__ctx, true).__wait();
+ }
+
+ public java.util.concurrent.CompletableFuture<String[]> ice_idsAsync()
+ {
+ return __ice_idsAsync(ObjectPrx.noExplicitContext, false);
+ }
+
+ public java.util.concurrent.CompletableFuture<String[]> ice_idsAsync(java.util.Map<String, String> __ctx)
+ {
+ return __ice_idsAsync(__ctx, false);
+ }
+
+ private OutgoingAsync<String[]> __ice_idsAsync(
+ java.util.Map<String, String> __ctx,
+ boolean __sync)
+ {
+ OutgoingAsync<String[]> __f =
+ new OutgoingAsync<>(this, "ice_ids", OperationMode.Nonmutating, __sync, null);
+ __f.invoke(true, __ctx, null, null, __is -> {
+ String[] __ret;
+ __ret = StringSeqHelper.read(__is);
+ return __ret;
+ });
+ return __f;
+ }
+
+ public String ice_id()
+ {
+ return ice_id(ObjectPrx.noExplicitContext);
+ }
+
+ public String ice_id(java.util.Map<String, String> __ctx)
+ {
+ return __ice_idAsync(__ctx, true).__wait();
+ }
+
+ public java.util.concurrent.CompletableFuture<java.lang.String> ice_idAsync()
+ {
+ return __ice_idAsync(ObjectPrx.noExplicitContext, false);
+ }
+
+ public java.util.concurrent.CompletableFuture<java.lang.String> ice_idAsync(java.util.Map<String, String> __ctx)
+ {
+ return __ice_idAsync(__ctx, false);
+ }
+
+ private OutgoingAsync<java.lang.String> __ice_idAsync(
+ java.util.Map<String, String> __ctx,
+ boolean __sync)
+ {
+ OutgoingAsync<java.lang.String> __f =
+ new OutgoingAsync<>(this, "ice_id", OperationMode.Nonmutating, __sync, null);
+ __f.invoke(true, __ctx, null, null, __is -> {
+ String __ret;
+ __ret = __is.readString();
+ return __ret;
+ });
+ return __f;
+ }
+
+ public com.zeroc.Ice.Object.Ice_invokeResult ice_invoke(String operation, OperationMode mode, byte[] inParams)
+ {
+ return ice_invoke(operation, mode, inParams, ObjectPrx.noExplicitContext);
+ }
+
+ public com.zeroc.Ice.Object.Ice_invokeResult ice_invoke(String operation, OperationMode mode, byte[] inParams,
+ java.util.Map<String, String> __context)
+ {
+ return __ice_invokeAsync(operation, mode, inParams, __context, true).__wait();
+ }
+
+ public java.util.concurrent.CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> ice_invokeAsync(
+ String operation,
+ OperationMode mode,
+ byte[] inParams)
+ {
+ return ice_invokeAsync(operation, mode, inParams, ObjectPrx.noExplicitContext);
+ }
+
+ public java.util.concurrent.CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> ice_invokeAsync(
+ String operation,
+ OperationMode mode,
+ byte[] inParams,
+ java.util.Map<String, String> __context)
+ {
+ return __ice_invokeAsync(operation, mode, inParams, __context, false);
+ }
+
+ private com.zeroc.IceInternal.ProxyIceInvoke __ice_invokeAsync(
+ String operation,
+ OperationMode mode,
+ byte[] inParams,
+ java.util.Map<String, String> __context,
+ boolean __sync)
+ {
+ com.zeroc.IceInternal.ProxyIceInvoke __f =
+ new com.zeroc.IceInternal.ProxyIceInvoke(this, operation, mode, __sync);
+ __f.invoke(inParams, __context);
+ return __f;
+ }
+
+ public Identity ice_getIdentity()
+ {
+ return _reference.getIdentity().clone();
+ }
+
+ public ObjectPrx ice_identity(Identity newIdentity)
+ {
+ if(newIdentity.name == null || newIdentity.name.equals(""))
+ {
+ throw new IllegalIdentityException();
+ }
+ if(newIdentity.equals(_reference.getIdentity()))
+ {
+ return this;
+ }
+ else
+ {
+ _ObjectPrxI proxy = new _ObjectPrxI();
+ proxy.__setup(_reference.changeIdentity(newIdentity));
+ return proxy;
+ }
+ }
+
+ public java.util.Map<String, String> ice_getContext()
+ {
+ return new java.util.HashMap<>(_reference.getContext());
+ }
+
+ public String ice_getFacet()
+ {
+ return _reference.getFacet();
+ }
+
+ public ObjectPrx ice_facet(String newFacet)
+ {
+ if(newFacet == null)
+ {
+ newFacet = "";
+ }
+
+ if(newFacet.equals(_reference.getFacet()))
+ {
+ return this;
+ }
+ else
+ {
+ _ObjectPrxI proxy = new _ObjectPrxI();
+ proxy.__setup(_reference.changeFacet(newFacet));
+ return proxy;
+ }
+ }
+
+ public String ice_getAdapterId()
+ {
+ return _reference.getAdapterId();
+ }
+
+ public Endpoint[] ice_getEndpoints()
+ {
+ return _reference.getEndpoints().clone();
+ }
+
+ public int ice_getLocatorCacheTimeout()
+ {
+ return _reference.getLocatorCacheTimeout();
+ }
+
+ public int ice_getInvocationTimeout()
+ {
+ return _reference.getInvocationTimeout();
+ }
+
+ public String ice_getConnectionId()
+ {
+ return _reference.getConnectionId();
+ }
+
+ public boolean ice_isConnectionCached()
+ {
+ return _reference.getCacheConnection();
+ }
+
+ public EndpointSelectionType ice_getEndpointSelection()
+ {
+ return _reference.getEndpointSelection();
+ }
+
+ public boolean ice_isSecure()
+ {
+ return _reference.getSecure();
+ }
+
+ public EncodingVersion ice_getEncodingVersion()
+ {
+ return _reference.getEncoding().clone();
+ }
+
+ public boolean ice_isPreferSecure()
+ {
+ return _reference.getPreferSecure();
+ }
+
+ public RouterPrx ice_getRouter()
+ {
+ com.zeroc.IceInternal.RouterInfo ri = _reference.getRouterInfo();
+ return ri != null ? ri.getRouter() : null;
+ }
+
+ public LocatorPrx ice_getLocator()
+ {
+ com.zeroc.IceInternal.LocatorInfo ri = _reference.getLocatorInfo();
+ return ri != null ? ri.getLocator() : null;
+ }
+
+ public boolean ice_isCollocationOptimized()
+ {
+ return _reference.getCollocationOptimized();
+ }
+
+ public boolean ice_isTwoway()
+ {
+ return _reference.getMode() == com.zeroc.IceInternal.Reference.ModeTwoway;
+ }
+
+ public boolean ice_isOneway()
+ {
+ return _reference.getMode() == com.zeroc.IceInternal.Reference.ModeOneway;
+ }
+
+ public boolean ice_isBatchOneway()
+ {
+ return _reference.getMode() == com.zeroc.IceInternal.Reference.ModeBatchOneway;
+ }
+
+ public boolean ice_isDatagram()
+ {
+ return _reference.getMode() == com.zeroc.IceInternal.Reference.ModeDatagram;
+ }
+
+ public boolean ice_isBatchDatagram()
+ {
+ return _reference.getMode() == com.zeroc.IceInternal.Reference.ModeBatchDatagram;
+ }
+
+ public Connection ice_getConnection()
+ {
+ return __ice_getConnectionAsync().__wait();
+ }
+
+ public java.util.concurrent.CompletableFuture<Connection> ice_getConnectionAsync()
+ {
+ return __ice_getConnectionAsync();
+ }
+
+ private com.zeroc.IceInternal.ProxyGetConnection __ice_getConnectionAsync()
+ {
+ com.zeroc.IceInternal.ProxyGetConnection r = new com.zeroc.IceInternal.ProxyGetConnection(this);
+ r.invoke();
+ return r;
+ }
+
+ public Connection ice_getCachedConnection()
+ {
+ com.zeroc.IceInternal.RequestHandler handler = null;
+ synchronized(this)
+ {
+ handler = _requestHandler;
+ }
+
+ if(handler != null)
+ {
+ try
+ {
+ return handler.getConnection();
+ }
+ catch(LocalException ex)
+ {
+ }
+ }
+ return null;
+ }
+
+ public void ice_flushBatchRequests()
+ {
+ __ice_flushBatchRequestsAsync().__wait();
+ }
+
+ public java.util.concurrent.CompletableFuture<Void> ice_flushBatchRequestsAsync()
+ {
+ return __ice_flushBatchRequestsAsync();
+ }
+
+ private com.zeroc.IceInternal.ProxyFlushBatch __ice_flushBatchRequestsAsync()
+ {
+ com.zeroc.IceInternal.ProxyFlushBatch __f = new com.zeroc.IceInternal.ProxyFlushBatch(this);
+ try
+ {
+ __f.invoke();
+ }
+ catch(Exception ex)
+ {
+ __f.abort(ex);
+ }
+ return __f;
+ }
+
+ @Override
+ public boolean equals(java.lang.Object r)
+ {
+ if(this == r)
+ {
+ return true;
+ }
+
+ if(r instanceof _ObjectPrxI)
+ {
+ return _reference.equals(((_ObjectPrxI)r)._reference);
+ }
+
+ return false;
+ }
+
+ @Override
+ public final int hashCode()
+ {
+ return _reference.hashCode();
+ }
+
+ @Override
+ public final String toString()
+ {
+ return _reference.toString();
+ }
+
+ @Override
+ public void __write(OutputStream os)
+ {
+ _reference.getIdentity().ice_write(os);
+ _reference.streamWrite(os);
+ }
+
+ @Override
+ public void __copyFrom(ObjectPrx p)
+ {
+ synchronized(p)
+ {
+ _ObjectPrxI h = (_ObjectPrxI)p;
+ _reference = h._reference;
+ _requestHandler = h._requestHandler;
+ }
+ }
+
+ @Override
+ public com.zeroc.IceInternal.Reference __reference()
+ {
+ return _reference;
+ }
+
+ @Override
+ public ObjectPrx __newInstance(com.zeroc.IceInternal.Reference ref)
+ {
+ try
+ {
+ _ObjectPrxI proxy = getClass().newInstance();
+ proxy.__setup(ref);
+ return proxy;
+ }
+ catch(InstantiationException e)
+ {
+ //
+ // Impossible
+ //
+ assert false;
+ return null;
+ }
+ catch(IllegalAccessException e)
+ {
+ //
+ // Impossible
+ //
+ assert false;
+ return null;
+ }
+ }
+
+ public StreamPair __getCachedMessageBuffers()
+ {
+ synchronized(this)
+ {
+ if(_streamCache != null && !_streamCache.isEmpty())
+ {
+ return _streamCache.remove(0);
+ }
+ }
+ return null;
+ }
+
+ public void __cacheMessageBuffers(InputStream is, OutputStream os)
+ {
+ synchronized(this)
+ {
+ if(_streamCache == null)
+ {
+ _streamCache = new LinkedList<>();
+ }
+ _streamCache.add(new StreamPair(is, os));
+ }
+ }
+
+ public int __handleException(Exception ex, com.zeroc.IceInternal.RequestHandler handler, OperationMode mode,
+ boolean sent, com.zeroc.IceInternal.Holder<Integer> interval, int cnt)
+ {
+ __updateRequestHandler(handler, null); // Clear the request handler
+
+ //
+ // We only retry local exception, system exceptions aren't retried.
+ //
+ // A CloseConnectionException indicates graceful server shutdown, and is therefore
+ // always repeatable without violating "at-most-once". That's because by sending a
+ // close connection message, the server guarantees that all outstanding requests
+ // can safely be repeated.
+ //
+ // An ObjectNotExistException can always be retried as well without violating
+ // "at-most-once" (see the implementation of the checkRetryAfterException method
+ // of the ProxyFactory class for the reasons why it can be useful).
+ //
+ // If the request didn't get sent or if it's non-mutating or idempotent it can
+ // also always be retried if the retry count isn't reached.
+ //
+ if(ex instanceof LocalException && (!sent ||
+ mode == OperationMode.Nonmutating || mode == OperationMode.Idempotent ||
+ ex instanceof CloseConnectionException ||
+ ex instanceof ObjectNotExistException))
+ {
+ try
+ {
+ return _reference.getInstance().proxyFactory().checkRetryAfterException((LocalException)ex,
+ _reference,
+ interval,
+ cnt);
+ }
+ catch(CommunicatorDestroyedException exc)
+ {
+ //
+ // The communicator is already destroyed, so we cannot retry.
+ //
+ throw ex;
+ }
+ }
+ else
+ {
+ throw ex; // Retry could break at-most-once semantics, don't retry.
+ }
+ }
+
+ public com.zeroc.IceInternal.RequestHandler __getRequestHandler()
+ {
+ if(_reference.getCacheConnection())
+ {
+ synchronized(this)
+ {
+ if(_requestHandler != null)
+ {
+ return _requestHandler;
+ }
+ }
+ }
+ return _reference.getRequestHandler(this);
+ }
+
+ synchronized public com.zeroc.IceInternal.BatchRequestQueue __getBatchRequestQueue()
+ {
+ if(_batchRequestQueue == null)
+ {
+ _batchRequestQueue = _reference.getBatchRequestQueue();
+ }
+ return _batchRequestQueue;
+ }
+
+ public com.zeroc.IceInternal.RequestHandler __setRequestHandler(com.zeroc.IceInternal.RequestHandler handler)
+ {
+ if(_reference.getCacheConnection())
+ {
+ synchronized(this)
+ {
+ if(_requestHandler == null)
+ {
+ _requestHandler = handler;
+ }
+ return _requestHandler;
+ }
+ }
+ return handler;
+ }
+
+ public void __updateRequestHandler(com.zeroc.IceInternal.RequestHandler previous,
+ com.zeroc.IceInternal.RequestHandler handler)
+ {
+ if(_reference.getCacheConnection() && previous != null)
+ {
+ synchronized(this)
+ {
+ if(_requestHandler != null && _requestHandler != handler)
+ {
+ //
+ // Update the request handler only if "previous" is the same
+ // as the current request handler. This is called after
+ // connection binding by the connect request handler. We only
+ // replace the request handler if the current handler is the
+ // connect request handler.
+ //
+ _requestHandler = _requestHandler.update(previous, handler);
+ }
+ }
+ }
+ }
+
+ //
+ // Only for use by ProxyFactory
+ //
+ public void __setup(com.zeroc.IceInternal.Reference ref)
+ {
+ //
+ // No need to synchronize, as this operation is only called
+ // upon initial initialization.
+ //
+
+ assert(_reference == null);
+ assert(_requestHandler == null);
+
+ _reference = ref;
+ }
+
+ private void writeObject(java.io.ObjectOutputStream out)
+ throws java.io.IOException
+ {
+ out.writeUTF(toString());
+ }
+
+ private void readObject(java.io.ObjectInputStream in)
+ throws java.io.IOException, ClassNotFoundException
+ {
+ String s = in.readUTF();
+ try
+ {
+ Communicator communicator = ((com.zeroc.Ice.ObjectInputStream)in).getCommunicator();
+ if(communicator == null)
+ {
+ throw new java.io.IOException("Cannot deserialize proxy: no communicator provided");
+ }
+ _ObjectPrxI proxy = (_ObjectPrxI)communicator.stringToProxy(s);
+ _reference = proxy._reference;
+ assert(proxy._requestHandler == null);
+ }
+ catch(ClassCastException ex)
+ {
+ java.io.IOException e =
+ new java.io.IOException("Cannot deserialize proxy: com.zeroc.Ice.ObjectInputStream not found");
+ e.initCause(ex);
+ throw e;
+ }
+ catch(LocalException ex)
+ {
+ java.io.IOException e = new java.io.IOException("Failure occurred while deserializing proxy");
+ e.initCause(ex);
+ throw e;
+ }
+ }
+
+ public static class StreamPair
+ {
+ StreamPair(InputStream is, OutputStream os)
+ {
+ this.is = is;
+ this.os = os;
+ }
+
+ public InputStream is;
+ public OutputStream os;
+ }
+
+ protected transient com.zeroc.IceInternal.Reference _reference;
+ private transient com.zeroc.IceInternal.RequestHandler _requestHandler;
+ private transient com.zeroc.IceInternal.BatchRequestQueue _batchRequestQueue;
+ private transient List<StreamPair> _streamCache;
+ public static final long serialVersionUID = 0L;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ACMConfig.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ACMConfig.java
new file mode 100644
index 00000000000..dc321cbe82d
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ACMConfig.java
@@ -0,0 +1,85 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import com.zeroc.Ice.ACMClose;
+import com.zeroc.Ice.ACMHeartbeat;
+
+public final class ACMConfig implements java.lang.Cloneable
+{
+ ACMConfig(boolean server)
+ {
+ timeout = 60 * 1000;
+ heartbeat = ACMHeartbeat.HeartbeatOnInvocation;
+ close = server ? ACMClose.CloseOnInvocation : ACMClose.CloseOnInvocationAndIdle;
+ }
+
+ public ACMConfig(com.zeroc.Ice.Properties p, com.zeroc.Ice.Logger l, String prefix, ACMConfig dflt)
+ {
+ assert(prefix != null);
+
+ String timeoutProperty;
+ if((prefix.equals("Ice.ACM.Client") || prefix.equals("Ice.ACM.Server")) &&
+ p.getProperty(prefix + ".Timeout").isEmpty())
+ {
+ timeoutProperty = prefix; // Deprecated property.
+ }
+ else
+ {
+ timeoutProperty = prefix + ".Timeout";
+ }
+
+ timeout = p.getPropertyAsIntWithDefault(timeoutProperty, dflt.timeout / 1000) * 1000; // To milliseconds
+
+ int hb = p.getPropertyAsIntWithDefault(prefix + ".Heartbeat", dflt.heartbeat.ordinal());
+ ACMHeartbeat[] heartbeatValues = ACMHeartbeat.values();
+ if(hb >= 0 && hb < heartbeatValues.length)
+ {
+ heartbeat = heartbeatValues[hb];
+ }
+ else
+ {
+ l.warning("invalid value for property `" + prefix + ".Heartbeat" + "', default value will be used instead");
+ heartbeat = dflt.heartbeat;
+ }
+
+ ACMClose[] closeValues = ACMClose.values();
+ int cl = p.getPropertyAsIntWithDefault(prefix + ".Close", dflt.close.ordinal());
+ if(cl >= 0 && cl < closeValues.length)
+ {
+ close = closeValues[cl];
+ }
+ else
+ {
+ l.warning("invalid value for property `" + prefix + ".Close" + "', default value will be used instead");
+ close = dflt.close;
+ }
+ }
+
+ @Override
+ public ACMConfig
+ clone()
+ {
+ ACMConfig c = null;
+ try
+ {
+ c = (ACMConfig)super.clone();
+ }
+ catch(CloneNotSupportedException ex)
+ {
+ assert false; // impossible
+ }
+ return c;
+ }
+
+ public int timeout;
+ public ACMHeartbeat heartbeat;
+ public ACMClose close;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ACMMonitor.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ACMMonitor.java
new file mode 100644
index 00000000000..d60dcdad7f1
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ACMMonitor.java
@@ -0,0 +1,21 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public interface ACMMonitor
+{
+ void add(com.zeroc.Ice.ConnectionI con);
+ void remove(com.zeroc.Ice.ConnectionI con);
+ void reap(com.zeroc.Ice.ConnectionI con);
+
+ ACMMonitor acm(java.util.OptionalInt timeout, java.util.Optional<com.zeroc.Ice.ACMClose> close,
+ java.util.Optional<com.zeroc.Ice.ACMHeartbeat> heartbeat);
+ com.zeroc.Ice.ACM getACM();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Acceptor.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Acceptor.java
new file mode 100644
index 00000000000..8c12faf2072
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Acceptor.java
@@ -0,0 +1,23 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public interface Acceptor
+{
+ java.nio.channels.ServerSocketChannel fd();
+ void setReadyCallback(ReadyCallback callback);
+ void close();
+ EndpointI listen();
+ Transceiver accept();
+ String protocol();
+ @Override
+ String toString();
+ String toDetailedString();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/AsyncStatus.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/AsyncStatus.java
new file mode 100644
index 00000000000..adb6e2c6a55
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/AsyncStatus.java
@@ -0,0 +1,17 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class AsyncStatus
+{
+ public static final int Queued = 0;
+ public static final int Sent = 1;
+ public static final int InvokeSentCallback = 2;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/BZip2.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/BZip2.java
new file mode 100644
index 00000000000..495d1ed1da3
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/BZip2.java
@@ -0,0 +1,281 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class BZip2
+{
+ public static Buffer compress(Buffer buf, int headerSize, int compressionLevel)
+ {
+ assert(supported());
+
+ int uncompressedLen = buf.size() - headerSize;
+ int compressedLen = (int)(uncompressedLen * 1.01 + 600);
+ byte[] compressed = new byte[compressedLen];
+
+ byte[] data = null;
+ int offset = 0;
+ try
+ {
+ //
+ // If the ByteBuffer is backed by an array then we can avoid
+ // an extra copy by using the array directly.
+ //
+ data = buf.b.array();
+ offset = buf.b.arrayOffset();
+ }
+ catch(Exception ex)
+ {
+ //
+ // Otherwise, allocate an array to hold a copy of the uncompressed data.
+ //
+ data = new byte[buf.size()];
+ buf.b.position(0);
+ buf.b.get(data);
+ }
+
+ try
+ {
+ //
+ // Compress the data using the class org.apache.tools.bzip2.CBZip2OutputStream.
+ // Its constructor requires an OutputStream argument, therefore we pass the
+ // compressed buffer in an OutputStream wrapper.
+ //
+ BufferedOutputStream bos = new BufferedOutputStream(compressed);
+ //
+ // For interoperability with the bzip2 C library, we insert the magic bytes
+ // 'B', 'Z' before invoking the Java implementation.
+ //
+ bos.write('B');
+ bos.write('Z');
+ java.lang.Object[] args = new java.lang.Object[]{ bos, Integer.valueOf(compressionLevel) };
+ java.io.OutputStream os = (java.io.OutputStream)_bzOutputStreamCtor.newInstance(args);
+ os.write(data, offset + headerSize, uncompressedLen);
+ os.close();
+ compressedLen = bos.pos();
+ }
+ catch(Exception ex)
+ {
+ throw new com.zeroc.Ice.CompressionException("bzip2 compression failure", ex);
+ }
+
+ //
+ // Don't bother if the compressed data is larger than the
+ // uncompressed data.
+ //
+ if(compressedLen >= uncompressedLen)
+ {
+ return null;
+ }
+
+ Buffer r = new Buffer(false);
+ r.resize(headerSize + 4 + compressedLen, false);
+ r.b.position(0);
+
+ //
+ // Copy the header from the uncompressed stream to the compressed one.
+ //
+ r.b.put(data, offset, headerSize);
+
+ //
+ // Add the size of the uncompressed stream before the message body.
+ //
+ r.b.putInt(buf.size());
+
+ //
+ // Add the compressed message body.
+ //
+ r.b.put(compressed, 0, compressedLen);
+
+ return r;
+ }
+
+ public static Buffer uncompress(Buffer buf, int headerSize, int messageSizeMax)
+ {
+ assert(supported());
+
+ buf.b.position(headerSize);
+ int uncompressedSize = buf.b.getInt();
+ if(uncompressedSize <= headerSize)
+ {
+ throw new com.zeroc.Ice.IllegalMessageSizeException();
+ }
+ if(uncompressedSize > messageSizeMax)
+ {
+ Ex.throwMemoryLimitException(uncompressedSize, messageSizeMax);
+ }
+
+ int compressedLen = buf.size() - headerSize - 4;
+
+ byte[] compressed = null;
+ int offset = 0;
+ try
+ {
+ //
+ // If the ByteBuffer is backed by an array then we can avoid
+ // an extra copy by using the array directly.
+ //
+ compressed = buf.b.array();
+ offset = buf.b.arrayOffset();
+ }
+ catch(Exception ex)
+ {
+ //
+ // Otherwise, allocate an array to hold a copy of the compressed data.
+ //
+ compressed = new byte[buf.size()];
+ buf.b.position(0);
+ buf.b.get(compressed);
+ }
+
+ Buffer r = new Buffer(false);
+ r.resize(uncompressedSize, false);
+
+ try
+ {
+ //
+ // Uncompress the data using the class org.apache.tools.bzip2.CBZip2InputStream.
+ // Its constructor requires an InputStream argument, therefore we pass the
+ // compressed data in a ByteArrayInputStream.
+ //
+ java.io.ByteArrayInputStream bais =
+ new java.io.ByteArrayInputStream(compressed, offset + headerSize + 4, compressedLen);
+ //
+ // For interoperability with the bzip2 C library, we insert the magic bytes
+ // 'B', 'Z' during compression and therefore must extract them before we
+ // invoke the Java implementation.
+ //
+ byte magicB = (byte)bais.read();
+ byte magicZ = (byte)bais.read();
+ if(magicB != (byte)'B' || magicZ != (byte)'Z')
+ {
+ com.zeroc.Ice.CompressionException e = new com.zeroc.Ice.CompressionException();
+ e.reason = "bzip2 uncompression failure: invalid magic bytes";
+ throw e;
+ }
+ java.lang.Object[] args = new java.lang.Object[]{ bais };
+ java.io.InputStream is = (java.io.InputStream)_bzInputStreamCtor.newInstance(args);
+ r.b.position(headerSize);
+ byte[] arr = new byte[8 * 1024];
+ int n;
+ while((n = is.read(arr)) != -1)
+ {
+ r.b.put(arr, 0, n);
+ }
+ is.close();
+ }
+ catch(Exception ex)
+ {
+ throw new com.zeroc.Ice.CompressionException("bzip2 uncompression failure", ex);
+ }
+
+ //
+ // Copy the header from the compressed stream to the uncompressed one.
+ //
+ r.b.position(0);
+ r.b.put(compressed, offset, headerSize);
+
+ return r;
+ }
+
+ private static boolean _checked = false;
+ private static java.lang.reflect.Constructor<?> _bzInputStreamCtor;
+ private static java.lang.reflect.Constructor<?> _bzOutputStreamCtor;
+
+ public synchronized static boolean supported()
+ {
+ //
+ // Use lazy initialization when determining whether support for bzip2 compression is available.
+ //
+ if(!_checked)
+ {
+ _checked = true;
+ try
+ {
+ Class<?> cls;
+ Class<?>[] types = new Class<?>[1];
+ cls = Util.findClass("org.apache.tools.bzip2.CBZip2InputStream", null);
+ if(cls != null)
+ {
+ types[0] = java.io.InputStream.class;
+ _bzInputStreamCtor = cls.getDeclaredConstructor(types);
+ }
+ cls = Util.findClass("org.apache.tools.bzip2.CBZip2OutputStream", null);
+ if(cls != null)
+ {
+ types = new Class[2];
+ types[0] = java.io.OutputStream.class;
+ types[1] = Integer.TYPE;
+ _bzOutputStreamCtor = cls.getDeclaredConstructor(types);
+ }
+ }
+ catch(Exception ex)
+ {
+ // Ignore - bzip2 compression not available.
+ }
+ }
+ return _bzInputStreamCtor != null && _bzOutputStreamCtor != null;
+ }
+
+ private static class BufferedOutputStream extends java.io.OutputStream
+ {
+ BufferedOutputStream(byte[] data)
+ {
+ _data = data;
+ }
+
+ @Override
+ public void close()
+ throws java.io.IOException
+ {
+ }
+
+ @Override
+ public void flush()
+ throws java.io.IOException
+ {
+ }
+
+ @Override
+ public void write(byte[] b)
+ throws java.io.IOException
+ {
+ assert(_data.length - _pos >= b.length);
+ System.arraycopy(b, 0, _data, _pos, b.length);
+ _pos += b.length;
+ }
+
+ @Override
+ public void write(byte[] b, int off, int len)
+ throws java.io.IOException
+ {
+ assert(_data.length - _pos >= len);
+ System.arraycopy(b, off, _data, _pos, len);
+ _pos += len;
+ }
+
+ @Override
+ public void write(int b)
+ throws java.io.IOException
+ {
+ assert(_data.length - _pos >= 1);
+ _data[_pos] = (byte)b;
+ ++_pos;
+ }
+
+ int
+ pos()
+ {
+ return _pos;
+ }
+
+ private byte[] _data;
+ private int _pos;
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/BatchRequestQueue.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/BatchRequestQueue.java
new file mode 100644
index 00000000000..3bb4d920c16
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/BatchRequestQueue.java
@@ -0,0 +1,239 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class BatchRequestQueue
+{
+ class BatchRequestI implements com.zeroc.Ice.BatchRequest
+ {
+ public void reset(com.zeroc.Ice.ObjectPrx proxy, String operation, int size)
+ {
+ _proxy = proxy;
+ _operation = operation;
+ _size = size;
+ }
+
+ @Override
+ public void enqueue()
+ {
+ enqueueBatchRequest();
+ }
+
+ @Override
+ public com.zeroc.Ice.ObjectPrx getProxy()
+ {
+ return _proxy;
+ }
+
+ @Override
+ public String getOperation()
+ {
+ return _operation;
+ }
+
+ @Override
+ public int getSize()
+ {
+ return _size;
+ }
+
+ private com.zeroc.Ice.ObjectPrx _proxy;
+ private String _operation;
+ private int _size;
+ }
+
+ public
+ BatchRequestQueue(Instance instance, boolean datagram)
+ {
+ com.zeroc.Ice.InitializationData initData = instance.initializationData();
+ _interceptor = initData.batchRequestInterceptor;
+ _batchStreamInUse = false;
+ _batchRequestNum = 0;
+ _batchStream = new com.zeroc.Ice.OutputStream(instance, Protocol.currentProtocolEncoding);
+ _batchStream.writeBlob(Protocol.requestBatchHdr);
+ _batchMarker = _batchStream.size();
+ _request = new BatchRequestI();
+
+ _maxSize = instance.batchAutoFlushSize();
+ if(_maxSize > 0 && datagram)
+ {
+ int udpSndSize = initData.properties.getPropertyAsIntWithDefault("Ice.UDP.SndSize", 65535 - _udpOverhead);
+ if(udpSndSize < _maxSize)
+ {
+ _maxSize = udpSndSize;
+ }
+ }
+ }
+
+ synchronized public void
+ prepareBatchRequest(com.zeroc.Ice.OutputStream os)
+ {
+ if(_exception != null)
+ {
+ throw (com.zeroc.Ice.LocalException)_exception.fillInStackTrace();
+ }
+
+ waitStreamInUse(false);
+ _batchStreamInUse = true;
+ _batchStream.swap(os);
+ }
+
+ public void
+ finishBatchRequest(com.zeroc.Ice.OutputStream os, com.zeroc.Ice.ObjectPrx proxy, String operation)
+ {
+ //
+ // No need for synchronization, no other threads are supposed
+ // to modify the queue since we set _batchStreamInUse to true.
+ //
+ assert(_batchStreamInUse);
+ _batchStream.swap(os);
+
+ try
+ {
+ _batchStreamCanFlush = true; // Allow flush to proceed even if the stream is marked in use.
+
+ if(_maxSize > 0 && _batchStream.size() >= _maxSize)
+ {
+ proxy.ice_flushBatchRequestsAsync(); // Auto flush
+ }
+
+ assert(_batchMarker < _batchStream.size());
+ if(_interceptor != null)
+ {
+ _request.reset(proxy, operation, _batchStream.size() - _batchMarker);
+ _interceptor.enqueue(_request, _batchRequestNum, _batchMarker);
+ }
+ else
+ {
+ _batchMarker = _batchStream.size();
+ ++_batchRequestNum;
+ }
+ }
+ finally
+ {
+ synchronized(this)
+ {
+ _batchStream.resize(_batchMarker);
+ _batchStreamInUse = false;
+ _batchStreamCanFlush = false;
+ notifyAll();
+ }
+ }
+ }
+
+ synchronized public void
+ abortBatchRequest(com.zeroc.Ice.OutputStream os)
+ {
+ if(_batchStreamInUse)
+ {
+ _batchStream.swap(os);
+ _batchStream.resize(_batchMarker);
+ _batchStreamInUse = false;
+ notifyAll();
+ }
+ }
+
+ synchronized public int
+ swap(com.zeroc.Ice.OutputStream os)
+ {
+ if(_batchRequestNum == 0)
+ {
+ return 0;
+ }
+
+ waitStreamInUse(true);
+
+ byte[] lastRequest = null;
+ if(_batchMarker < _batchStream.size())
+ {
+ lastRequest = new byte[_batchStream.size() - _batchMarker];
+ Buffer buffer = _batchStream.getBuffer();
+ buffer.b.position(_batchMarker);
+ buffer.b.get(lastRequest);
+ _batchStream.resize(_batchMarker);
+ }
+
+ int requestNum = _batchRequestNum;
+ _batchStream.swap(os);
+
+ //
+ // Reset the batch.
+ //
+ _batchRequestNum = 0;
+ _batchStream.writeBlob(Protocol.requestBatchHdr);
+ _batchMarker = _batchStream.size();
+ if(lastRequest != null)
+ {
+ _batchStream.writeBlob(lastRequest);
+ }
+ return requestNum;
+ }
+
+ synchronized public void
+ destroy(com.zeroc.Ice.LocalException ex)
+ {
+ _exception = ex;
+ }
+
+ synchronized public boolean
+ isEmpty()
+ {
+ return _batchStream.size() == Protocol.requestBatchHdr.length;
+ }
+
+ private void
+ waitStreamInUse(boolean flush)
+ {
+ //
+ // This is similar to a mutex lock in that the stream is
+ // only "locked" while marshaling. As such we don't permit the wait
+ // to be interrupted. Instead the interrupted status is saved and
+ // restored.
+ //
+ boolean interrupted = false;
+ while(_batchStreamInUse && !(flush && _batchStreamCanFlush))
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ interrupted = true;
+ }
+ }
+ //
+ // Restore the interrupted flag if we were interrupted.
+ //
+ if(interrupted)
+ {
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ private void enqueueBatchRequest()
+ {
+ assert(_batchMarker < _batchStream.size());
+ _batchMarker = _batchStream.size();
+ ++_batchRequestNum;
+ }
+
+ private com.zeroc.Ice.BatchRequestInterceptor _interceptor;
+ private com.zeroc.Ice.OutputStream _batchStream;
+ private boolean _batchStreamInUse;
+ private boolean _batchStreamCanFlush;
+ private int _batchRequestNum;
+ private int _batchMarker;
+ private BatchRequestI _request;
+ private com.zeroc.Ice.LocalException _exception;
+ private int _maxSize;
+
+ final private static int _udpOverhead = 20 + 8;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/BufSizeWarnInfo.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/BufSizeWarnInfo.java
new file mode 100644
index 00000000000..e3cbf387cf2
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/BufSizeWarnInfo.java
@@ -0,0 +1,25 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+class BufSizeWarnInfo
+{
+ // Whether send size warning has been emitted
+ public boolean sndWarn;
+
+ // The send size for which the warning wwas emitted
+ public int sndSize;
+
+ // Whether receive size warning has been emitted
+ public boolean rcvWarn;
+
+ // The receive size for which the warning wwas emitted
+ public int rcvSize;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Buffer.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Buffer.java
new file mode 100644
index 00000000000..81baab46d88
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Buffer.java
@@ -0,0 +1,223 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+//
+// An instance of java.nio.ByteBuffer cannot grow beyond its initial capacity.
+// This class wraps a ByteBuffer and supports reallocation.
+//
+public class Buffer
+{
+ public Buffer(boolean direct)
+ {
+ this(direct, java.nio.ByteOrder.LITTLE_ENDIAN);
+ }
+
+ public Buffer(boolean direct, java.nio.ByteOrder order)
+ {
+ b = _emptyBuffer;
+ _size = 0;
+ _capacity = 0;
+ _direct = direct;
+ _order = order;
+ }
+
+ public Buffer(byte[] data)
+ {
+ this(data, java.nio.ByteOrder.LITTLE_ENDIAN);
+ }
+
+ public Buffer(byte[] data, java.nio.ByteOrder order)
+ {
+ b = java.nio.ByteBuffer.wrap(data);
+ b.order(order);
+ _size = data.length;
+ _capacity = 0;
+ _direct = false;
+ _order = order;
+ }
+
+ public Buffer(java.nio.ByteBuffer data)
+ {
+ this(data, java.nio.ByteOrder.LITTLE_ENDIAN);
+ }
+
+ public Buffer(java.nio.ByteBuffer data, java.nio.ByteOrder order)
+ {
+ b = data;
+ b.order(order);
+ _size = data.remaining();
+ _capacity = 0;
+ _direct = false;
+ _order = order;
+ }
+
+ public Buffer(Buffer buf, boolean adopt)
+ {
+ b = buf.b;
+ _size = buf._size;
+ _capacity = buf._capacity;
+ _direct = buf._direct;
+ _shrinkCounter = buf._shrinkCounter;
+ _order = buf._order;
+
+ if(adopt)
+ {
+ buf.clear();
+ }
+ }
+
+ public int size()
+ {
+ return _size;
+ }
+
+ public boolean empty()
+ {
+ return _size == 0;
+ }
+
+ public void clear()
+ {
+ b = _emptyBuffer;
+ _size = 0;
+ _capacity = 0;
+ _shrinkCounter = 0;
+ }
+
+ //
+ // Call expand(n) to add room for n additional bytes. Note that expand()
+ // examines the current position of the buffer first; we don't want to
+ // expand the buffer if the caller is writing to a location that is
+ // already in the buffer.
+ //
+ public void expand(int n)
+ {
+ final int sz = (b == _emptyBuffer) ? n : b.position() + n;
+ if(sz > _size)
+ {
+ resize(sz, false);
+ }
+ }
+
+ public void resize(int n, boolean reading)
+ {
+ assert(b == _emptyBuffer || _capacity > 0);
+
+ if(n == 0)
+ {
+ clear();
+ }
+ else if(n > _capacity)
+ {
+ reserve(n);
+ }
+ _size = n;
+
+ //
+ // When used for reading, we want to set the buffer's limit to the new size.
+ //
+ if(reading)
+ {
+ b.limit(_size);
+ }
+ }
+
+ public void reset()
+ {
+ if(_size > 0 && _size * 2 < _capacity)
+ {
+ //
+ // If the current buffer size is smaller than the
+ // buffer capacity, we shrink the buffer memory to the
+ // current size. This is to avoid holding on to too much
+ // memory if it's not needed anymore.
+ //
+ if(++_shrinkCounter > 2)
+ {
+ reserve(_size);
+ _shrinkCounter = 0;
+ }
+ }
+ else
+ {
+ _shrinkCounter = 0;
+ }
+ _size = 0;
+ if(b != _emptyBuffer)
+ {
+ b.limit(b.capacity());
+ b.position(0);
+ }
+ }
+
+ private void reserve(int n)
+ {
+ if(n > _capacity)
+ {
+ _capacity = java.lang.Math.max(n, 2 * _capacity);
+ _capacity = java.lang.Math.max(240, _capacity);
+ }
+ else if(n < _capacity)
+ {
+ _capacity = n;
+ }
+ else
+ {
+ return;
+ }
+
+ try
+ {
+ java.nio.ByteBuffer buf;
+
+ if(_direct)
+ {
+ buf = java.nio.ByteBuffer.allocateDirect(_capacity);
+ }
+ else
+ {
+ buf = java.nio.ByteBuffer.allocate(_capacity);
+ }
+
+ if(b == _emptyBuffer)
+ {
+ b = buf;
+ }
+ else
+ {
+ final int pos = b.position();
+ b.position(0);
+ b.limit(java.lang.Math.min(_capacity, b.capacity()));
+ buf.put(b);
+ b = buf;
+ b.limit(b.capacity());
+ b.position(pos);
+ }
+
+ b.order(_order); // Preserve the original order.
+ }
+ catch(OutOfMemoryError ex)
+ {
+ _capacity = b.capacity(); // Restore the previous capacity.
+ throw ex;
+ }
+ }
+
+ public java.nio.ByteBuffer b;
+ // Sentinel used for null buffer.
+ public java.nio.ByteBuffer _emptyBuffer = java.nio.ByteBuffer.allocate(0);
+
+ private int _size;
+ private int _capacity; // Cache capacity to avoid excessive method calls.
+ private boolean _direct; // Use direct buffers?
+ private int _shrinkCounter;
+ private java.nio.ByteOrder _order;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/CancellationHandler.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/CancellationHandler.java
new file mode 100644
index 00000000000..ba958f0253d
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/CancellationHandler.java
@@ -0,0 +1,15 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public interface CancellationHandler
+{
+ void asyncRequestCanceled(OutgoingAsyncBase outAsync, com.zeroc.Ice.LocalException ex);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/CollocatedObserverI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/CollocatedObserverI.java
new file mode 100644
index 00000000000..995ad3685c4
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/CollocatedObserverI.java
@@ -0,0 +1,34 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class CollocatedObserverI
+ extends com.zeroc.IceMX.ObserverWithDelegate<com.zeroc.IceMX.CollocatedMetrics,
+ com.zeroc.Ice.Instrumentation.CollocatedObserver>
+ implements com.zeroc.Ice.Instrumentation.CollocatedObserver
+{
+ @Override
+ public void
+ reply(final int size)
+ {
+ forEach(new MetricsUpdate<com.zeroc.IceMX.CollocatedMetrics>()
+ {
+ @Override
+ public void update(com.zeroc.IceMX.CollocatedMetrics v)
+ {
+ v.replySize += size;
+ }
+ });
+ if(_delegate != null)
+ {
+ _delegate.reply(size);
+ }
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/CollocatedRequestHandler.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/CollocatedRequestHandler.java
new file mode 100644
index 00000000000..54dd044788c
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/CollocatedRequestHandler.java
@@ -0,0 +1,437 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class CollocatedRequestHandler implements RequestHandler, ResponseHandler
+{
+ private class InvokeAllAsync extends DispatchWorkItem
+ {
+ private InvokeAllAsync(OutgoingAsyncBase outAsync, com.zeroc.Ice.OutputStream os, int requestId,
+ int batchRequestNum)
+ {
+ _outAsync = outAsync;
+ _os = os;
+ _requestId = requestId;
+ _batchRequestNum = batchRequestNum;
+ }
+
+ @Override
+ public void run()
+ {
+ if(sentAsync(_outAsync))
+ {
+ invokeAll(_os, _requestId, _batchRequestNum);
+ }
+ }
+
+ private final OutgoingAsyncBase _outAsync;
+ private com.zeroc.Ice.OutputStream _os;
+ private final int _requestId;
+ private final int _batchRequestNum;
+ }
+
+ public
+ CollocatedRequestHandler(Reference ref, com.zeroc.Ice.ObjectAdapter adapter)
+ {
+ _reference = ref;
+ _dispatcher = ref.getInstance().initializationData().dispatcher != null;
+ _adapter = (com.zeroc.Ice.ObjectAdapterI)adapter;
+ _response = _reference.getMode() == Reference.ModeTwoway;
+
+ _logger = _reference.getInstance().initializationData().logger; // Cached for better performance.
+ _traceLevels = _reference.getInstance().traceLevels(); // Cached for better performance.
+ _requestId = 0;
+ }
+
+ @Override
+ public RequestHandler
+ update(RequestHandler previousHandler, RequestHandler newHandler)
+ {
+ return previousHandler == this ? newHandler : this;
+ }
+
+ @Override
+ public int
+ sendAsyncRequest(ProxyOutgoingAsyncBase outAsync)
+ {
+ return outAsync.invokeCollocated(this);
+ }
+
+ @Override
+ synchronized public void
+ asyncRequestCanceled(OutgoingAsyncBase outAsync, com.zeroc.Ice.LocalException ex)
+ {
+ Integer requestId = _sendAsyncRequests.remove(outAsync);
+ if(requestId != null)
+ {
+ if(requestId > 0)
+ {
+ _asyncRequests.remove(requestId);
+ }
+ if(outAsync.completed(ex))
+ {
+ outAsync.invokeCompletedAsync();
+ }
+ _adapter.decDirectCount(); // invokeAll won't be called, decrease the direct count.
+ return;
+ }
+
+ if(outAsync instanceof OutgoingAsync)
+ {
+ OutgoingAsync o = (OutgoingAsync)outAsync;
+ assert(o != null);
+ for(java.util.Map.Entry<Integer, OutgoingAsyncBase> e : _asyncRequests.entrySet())
+ {
+ if(e.getValue() == o)
+ {
+ _asyncRequests.remove(e.getKey());
+ if(outAsync.completed(ex))
+ {
+ outAsync.invokeCompletedAsync();
+ }
+ return;
+ }
+ }
+ }
+ }
+
+ @Override
+ public void
+ sendResponse(int requestId, final com.zeroc.Ice.OutputStream os, byte status, boolean amd)
+ {
+ OutgoingAsyncBase outAsync = null;
+ synchronized(this)
+ {
+ assert(_response);
+
+ if(_traceLevels.protocol >= 1)
+ {
+ fillInValue(os, 10, os.size());
+ }
+
+ // Adopt the OutputStream's buffer.
+ com.zeroc.Ice.InputStream is =
+ new com.zeroc.Ice.InputStream(os.instance(), os.getEncoding(), os.getBuffer(), true);
+
+ is.pos(Protocol.replyHdr.length + 4);
+
+ if(_traceLevels.protocol >= 1)
+ {
+ TraceUtil.traceRecv(is, _logger, _traceLevels);
+ }
+
+ outAsync = _asyncRequests.remove(requestId);
+ if(outAsync != null && !outAsync.completed(is))
+ {
+ outAsync = null;
+ }
+ }
+
+ if(outAsync != null)
+ {
+ //
+ // If called from an AMD dispatch, invoke asynchronously
+ // the completion callback since this might be called from
+ // the user code.
+ //
+ if(amd)
+ {
+ outAsync.invokeCompletedAsync();
+ }
+ else
+ {
+ outAsync.invokeCompleted();
+ }
+ }
+ _adapter.decDirectCount();
+ }
+
+ @Override
+ public void
+ sendNoResponse()
+ {
+ _adapter.decDirectCount();
+ }
+
+ @Override
+ public boolean
+ systemException(int requestId, com.zeroc.Ice.SystemException ex, boolean amd)
+ {
+ handleException(requestId, ex, amd);
+ _adapter.decDirectCount();
+ return true;
+ }
+
+ @Override
+ public void
+ invokeException(int requestId, com.zeroc.Ice.LocalException ex, int batchRequestNum, boolean amd)
+ {
+ handleException(requestId, ex, amd);
+ _adapter.decDirectCount();
+ }
+
+ @Override
+ public Reference
+ getReference()
+ {
+ return _reference;
+ }
+
+ @Override
+ public com.zeroc.Ice.ConnectionI
+ getConnection()
+ {
+ return null;
+ }
+
+ int invokeAsyncRequest(OutgoingAsyncBase outAsync, int batchRequestNum, boolean sync)
+ {
+ //
+ // Increase the direct count to prevent the thread pool from being destroyed before
+ // invokeAll is called. This will also throw if the object adapter has been deactivated.
+ //
+ _adapter.incDirectCount();
+
+ int requestId = 0;
+ try
+ {
+ synchronized(this)
+ {
+ outAsync.cancelable(this); // This will throw if the request is canceled
+
+ if(_response)
+ {
+ requestId = ++_requestId;
+ _asyncRequests.put(requestId, outAsync);
+ }
+
+ _sendAsyncRequests.put(outAsync, requestId);
+ }
+ }
+ catch(Exception ex)
+ {
+ _adapter.decDirectCount();
+ throw ex;
+ }
+
+ outAsync.attachCollocatedObserver(_adapter, requestId);
+
+ if(!sync || !_response || _reference.getInstance().queueRequests() || _reference.getInvocationTimeout() > 0)
+ {
+ _adapter.getThreadPool().dispatch(new InvokeAllAsync(outAsync,
+ outAsync.getOs(),
+ requestId,
+ batchRequestNum));
+ }
+ else if(_dispatcher)
+ {
+ _adapter.getThreadPool().dispatchFromThisThread(new InvokeAllAsync(outAsync,
+ outAsync.getOs(),
+ requestId,
+ batchRequestNum));
+ }
+ else // Optimization: directly call invokeAll if there's no dispatcher.
+ {
+ if(sentAsync(outAsync))
+ {
+ invokeAll(outAsync.getOs(), requestId, batchRequestNum);
+ }
+ }
+ return AsyncStatus.Queued;
+ }
+
+ private boolean
+ sentAsync(final OutgoingAsyncBase outAsync)
+ {
+ synchronized(this)
+ {
+ if(_sendAsyncRequests.remove(outAsync) == null)
+ {
+ return false; // The request timed-out.
+ }
+
+ //
+ // This must be called within the synchronization to
+ // ensure completed(ex) can't be called concurrently if
+ // the request is canceled.
+ //
+ if(!outAsync.sent())
+ {
+ return true;
+ }
+ }
+
+ outAsync.invokeSent();
+ return true;
+ }
+
+ private void
+ invokeAll(com.zeroc.Ice.OutputStream os, int requestId, int batchRequestNum)
+ {
+ if(_traceLevels.protocol >= 1)
+ {
+ fillInValue(os, 10, os.size());
+ if(requestId > 0)
+ {
+ fillInValue(os, Protocol.headerSize, requestId);
+ }
+ else if(batchRequestNum > 0)
+ {
+ fillInValue(os, Protocol.headerSize, batchRequestNum);
+ }
+ TraceUtil.traceSend(os, _logger, _traceLevels);
+ }
+
+ com.zeroc.Ice.InputStream is =
+ new com.zeroc.Ice.InputStream(os.instance(), os.getEncoding(), os.getBuffer(), false);
+
+ if(batchRequestNum > 0)
+ {
+ is.pos(Protocol.requestBatchHdr.length);
+ }
+ else
+ {
+ is.pos(Protocol.requestHdr.length);
+ }
+
+ int invokeNum = batchRequestNum > 0 ? batchRequestNum : 1;
+ ServantManager servantManager = _adapter.getServantManager();
+ try
+ {
+ while(invokeNum > 0)
+ {
+ //
+ // Increase the direct count for the dispatch. We increase it again here for
+ // each dispatch. It's important for the direct count to be > 0 until the last
+ // collocated request response is sent to make sure the thread pool isn't
+ // destroyed before.
+ //
+ try
+ {
+ _adapter.incDirectCount();
+ }
+ catch(com.zeroc.Ice.ObjectAdapterDeactivatedException ex)
+ {
+ handleException(requestId, ex, false);
+ break;
+ }
+
+ Incoming in = new Incoming(_reference.getInstance(), this, null, _adapter, _response, (byte)0,
+ requestId);
+ in.invoke(servantManager, is);
+ --invokeNum;
+ }
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ invokeException(requestId, ex, invokeNum, false); // Fatal invocation exception
+ }
+ catch(ServantError ex)
+ {
+ //
+ // ServantError is thrown when an Error has been raised by servant (or servant locator)
+ // code. We've already attempted to complete the invocation and send a response.
+ //
+ Throwable t = ex.getCause();
+ //
+ // Suppress AssertionError and OutOfMemoryError, rethrow everything else.
+ //
+ if(!(t instanceof java.lang.AssertionError || t instanceof java.lang.OutOfMemoryError))
+ {
+ throw (java.lang.Error)t;
+ }
+ }
+ catch(java.lang.Error ex)
+ {
+ //
+ // An Error was raised outside of servant code (i.e., by Ice code).
+ // Attempt to log the error and clean up. This may still fail
+ // depending on the severity of the error.
+ //
+ // Note that this does NOT send a response to the client.
+ //
+ com.zeroc.Ice.UnknownException uex = new com.zeroc.Ice.UnknownException(ex);
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ ex.printStackTrace(pw);
+ pw.flush();
+ uex.unknown = sw.toString();
+ _logger.error(uex.unknown);
+ invokeException(requestId, uex, invokeNum, false);
+ //
+ // Suppress AssertionError and OutOfMemoryError, rethrow everything else.
+ //
+ if(!(ex instanceof java.lang.AssertionError || ex instanceof java.lang.OutOfMemoryError))
+ {
+ throw ex;
+ }
+ }
+
+ _adapter.decDirectCount();
+ }
+
+ private void
+ handleException(int requestId, com.zeroc.Ice.Exception ex, boolean amd)
+ {
+ if(requestId == 0)
+ {
+ return; // Ignore exception for oneway messages.
+ }
+
+ OutgoingAsyncBase outAsync = null;
+ synchronized(this)
+ {
+ outAsync = _asyncRequests.remove(requestId);
+ if(outAsync != null && !outAsync.completed(ex))
+ {
+ outAsync = null;
+ }
+ }
+
+ if(outAsync != null)
+ {
+ //
+ // If called from an AMD dispatch, invoke asynchronously
+ // the completion callback since this might be called from
+ // the user code.
+ //
+ if(amd)
+ {
+ outAsync.invokeCompletedAsync();
+ }
+ else
+ {
+ outAsync.invokeCompleted();
+ }
+ }
+ }
+
+ private void
+ fillInValue(com.zeroc.Ice.OutputStream os, int pos, int value)
+ {
+ os.rewriteInt(value, pos);
+ }
+
+ private final Reference _reference;
+ private final boolean _dispatcher;
+ private final boolean _response;
+ private final com.zeroc.Ice.ObjectAdapterI _adapter;
+ private final com.zeroc.Ice.Logger _logger;
+ private final TraceLevels _traceLevels;
+
+ private int _requestId;
+
+ // A map of outstanding requests that can be canceled. A request
+ // can be canceled if it has an invocation timeout, or we support
+ // interrupts.
+ private java.util.Map<OutgoingAsyncBase, Integer> _sendAsyncRequests = new java.util.HashMap<>();
+
+ private java.util.Map<Integer, OutgoingAsyncBase> _asyncRequests = new java.util.HashMap<>();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/CommunicatorFlushBatch.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/CommunicatorFlushBatch.java
new file mode 100644
index 00000000000..772c1a463ab
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/CommunicatorFlushBatch.java
@@ -0,0 +1,206 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import java.util.concurrent.Callable;
+
+public class CommunicatorFlushBatch extends InvocationFutureI<Void>
+{
+ public CommunicatorFlushBatch(com.zeroc.Ice.Communicator communicator, Instance instance)
+ {
+ super(communicator, instance, "flushBatchRequests");
+
+ _observer = ObserverHelper.get(instance, "flushBatchRequests");
+
+ //
+ // _useCount is initialized to 1 to prevent premature callbacks.
+ // The caller must invoke ready() after all flush requests have
+ // been initiated.
+ //
+ _useCount = 1;
+ }
+
+ @Override
+ protected void __sent()
+ {
+ super.__sent();
+
+ assert((_state & StateOK) != 0);
+ complete(null);
+ }
+
+ public void flushConnection(final com.zeroc.Ice.ConnectionI con)
+ {
+ class FlushBatch extends OutgoingAsyncBase<Void>
+ {
+ public FlushBatch()
+ {
+ super(CommunicatorFlushBatch.this.getCommunicator(),
+ CommunicatorFlushBatch.this._instance,
+ CommunicatorFlushBatch.this.getOperation());
+ }
+
+ @Override
+ protected void __sent()
+ {
+ assert(false);
+ }
+
+ @Override
+ protected boolean __needCallback()
+ {
+ return false;
+ }
+
+ @Override
+ protected void __completed()
+ {
+ assert(false);
+ }
+
+ @Override
+ public boolean sent()
+ {
+ if(_childObserver != null)
+ {
+ _childObserver.detach();
+ _childObserver = null;
+ }
+ doCheck(false);
+ return false;
+ }
+
+ // TODO: MJN: This is missing a test.
+ @Override
+ public boolean completed(com.zeroc.Ice.Exception ex)
+ {
+ if(_childObserver != null)
+ {
+ _childObserver.failed(ex.ice_id());
+ _childObserver.detach();
+ _childObserver = null;
+ }
+ doCheck(false);
+ return false;
+ }
+
+ @Override
+ protected com.zeroc.Ice.Instrumentation.InvocationObserver getObserver()
+ {
+ return CommunicatorFlushBatch.this._observer;
+ }
+ }
+
+ synchronized(this)
+ {
+ ++_useCount;
+ }
+
+ try
+ {
+ final FlushBatch flushBatch = new FlushBatch();
+ final int batchRequestNum = con.getBatchRequestQueue().swap(flushBatch.getOs());
+ if(batchRequestNum == 0)
+ {
+ flushBatch.sent();
+ }
+ else if(_instance.queueRequests())
+ {
+ _instance.getQueueExecutor().executeNoThrow(new Callable<Void>()
+ {
+ @Override
+ public Void call() throws RetryException
+ {
+ con.sendAsyncRequest(flushBatch, false, false, batchRequestNum);
+ return null;
+ }
+ });
+ }
+ else
+ {
+ con.sendAsyncRequest(flushBatch, false, false, batchRequestNum);
+ }
+ }
+ catch(RetryException ex)
+ {
+ doCheck(false);
+ throw ex.get();
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ doCheck(false);
+ throw ex;
+ }
+ }
+
+ public void ready()
+ {
+ doCheck(true);
+ }
+
+ public void __wait()
+ {
+ if(Thread.currentThread().interrupted())
+ {
+ throw new com.zeroc.Ice.OperationInterruptedException();
+ }
+
+ try
+ {
+ get();
+ }
+ catch(InterruptedException ex)
+ {
+ throw new com.zeroc.Ice.OperationInterruptedException();
+ }
+ catch(java.util.concurrent.ExecutionException ee)
+ {
+ try
+ {
+ throw ee.getCause();
+ }
+ catch(RuntimeException ex) // Includes LocalException
+ {
+ throw ex;
+ }
+ catch(Throwable ex)
+ {
+ throw new com.zeroc.Ice.UnknownException(ex);
+ }
+ }
+ }
+
+ private void doCheck(boolean userThread)
+ {
+ synchronized(this)
+ {
+ assert(_useCount > 0);
+ if(--_useCount > 0)
+ {
+ return;
+ }
+ }
+
+ if(sent(true))
+ {
+ if(userThread)
+ {
+ _sentSynchronously = true;
+ invokeSent();
+ }
+ else
+ {
+ invokeSentAsync();
+ }
+ }
+ }
+
+ private int _useCount;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/CommunicatorObserverI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/CommunicatorObserverI.java
new file mode 100644
index 00000000000..d16ba494470
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/CommunicatorObserverI.java
@@ -0,0 +1,843 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import com.zeroc.IceMX.*;
+
+public class CommunicatorObserverI implements com.zeroc.Ice.Instrumentation.CommunicatorObserver
+{
+ static void
+ addEndpointAttributes(MetricsHelper.AttributeResolver r, Class<?> cl)
+ throws Exception
+ {
+ r.add("endpoint", cl.getDeclaredMethod("getEndpoint"));
+
+ Class<?> cli = com.zeroc.Ice.EndpointInfo.class;
+ r.add("endpointType", cl.getDeclaredMethod("getEndpointInfo"), cli.getDeclaredMethod("type"));
+ r.add("endpointIsDatagram", cl.getDeclaredMethod("getEndpointInfo"), cli.getDeclaredMethod("datagram"));
+ r.add("endpointIsSecure", cl.getDeclaredMethod("getEndpointInfo"), cli.getDeclaredMethod("secure"));
+ r.add("endpointTimeout", cl.getDeclaredMethod("getEndpointInfo"), cli.getDeclaredField("timeout"));
+ r.add("endpointCompress", cl.getDeclaredMethod("getEndpointInfo"), cli.getDeclaredField("compress"));
+
+ cli = com.zeroc.Ice.IPEndpointInfo.class;
+ r.add("endpointHost", cl.getDeclaredMethod("getEndpointInfo"), cli.getDeclaredField("host"));
+ r.add("endpointPort", cl.getDeclaredMethod("getEndpointInfo"), cli.getDeclaredField("port"));
+ }
+
+ static void
+ addConnectionAttributes(MetricsHelper.AttributeResolver r, Class<?> cl)
+ throws Exception
+ {
+ Class<?> cli = com.zeroc.Ice.ConnectionInfo.class;
+ r.add("incoming", cl.getDeclaredMethod("getConnectionInfo"), cli.getDeclaredField("incoming"));
+ r.add("adapterName", cl.getDeclaredMethod("getConnectionInfo"), cli.getDeclaredField("adapterName"));
+ r.add("connectionId", cl.getDeclaredMethod("getConnectionInfo"), cli.getDeclaredField("connectionId"));
+
+ cli = com.zeroc.Ice.IPConnectionInfo.class;
+ r.add("localHost", cl.getDeclaredMethod("getConnectionInfo"), cli.getDeclaredField("localAddress"));
+ r.add("localPort", cl.getDeclaredMethod("getConnectionInfo"), cli.getDeclaredField("localPort"));
+ r.add("remoteHost", cl.getDeclaredMethod("getConnectionInfo"), cli.getDeclaredField("remoteAddress"));
+ r.add("remotePort", cl.getDeclaredMethod("getConnectionInfo"), cli.getDeclaredField("remotePort"));
+
+ cli = com.zeroc.Ice.UDPConnectionInfo.class;
+ r.add("mcastHost", cl.getDeclaredMethod("getConnectionInfo"), cli.getDeclaredField("mcastAddress"));
+ r.add("mcastPort", cl.getDeclaredMethod("getConnectionInfo"), cli.getDeclaredField("mcastPort"));
+
+ addEndpointAttributes(r, cl);
+ }
+
+ static public class ConnectionHelper extends MetricsHelper<ConnectionMetrics>
+ {
+ static private AttributeResolver _attributes = new AttributeResolver()
+ {
+ {
+ try
+ {
+ add("parent", ConnectionHelper.class.getDeclaredMethod("getParent"));
+ add("id", ConnectionHelper.class.getDeclaredMethod("getId"));
+ add("state", ConnectionHelper.class.getDeclaredMethod("getState"));
+ addConnectionAttributes(this, ConnectionHelper.class);
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ assert(false);
+ }
+ }
+ };
+
+ ConnectionHelper(com.zeroc.Ice.ConnectionInfo con, com.zeroc.Ice.Endpoint endpt,
+ com.zeroc.Ice.Instrumentation.ConnectionState state)
+ {
+ super(_attributes);
+ _connectionInfo = con;
+ _endpoint = endpt;
+ _state = state;
+ }
+
+ public String
+ getId()
+ {
+ if(_id == null)
+ {
+ StringBuilder os = new StringBuilder();
+ com.zeroc.Ice.IPConnectionInfo info = getIPConnectionInfo();
+ if(info != null)
+ {
+ os.append(info.localAddress).append(':').append(info.localPort);
+ os.append(" -> ");
+ os.append(info.remoteAddress).append(':').append(info.remotePort);
+ }
+ else
+ {
+ os.append("connection-").append(_connectionInfo);
+ }
+ if(!_connectionInfo.connectionId.isEmpty())
+ {
+ os.append(" [").append(_connectionInfo.connectionId).append("]");
+ }
+ _id = os.toString();
+ }
+ return _id;
+ }
+
+ public String
+ getState()
+ {
+ switch(_state)
+ {
+ case ConnectionStateValidating:
+ return "validating";
+ case ConnectionStateHolding:
+ return "holding";
+ case ConnectionStateActive:
+ return "active";
+ case ConnectionStateClosing:
+ return "closing";
+ case ConnectionStateClosed:
+ return "closed";
+ default:
+ assert(false);
+ return "";
+ }
+ }
+
+ public String
+ getParent()
+ {
+ if(_connectionInfo.adapterName != null && !_connectionInfo.adapterName.isEmpty())
+ {
+ return _connectionInfo.adapterName;
+ }
+ else
+ {
+ return "Communicator";
+ }
+ }
+
+ public com.zeroc.Ice.ConnectionInfo
+ getConnectionInfo()
+ {
+ return _connectionInfo;
+ }
+
+ public com.zeroc.Ice.Endpoint
+ getEndpoint()
+ {
+ return _endpoint;
+ }
+
+ public com.zeroc.Ice.EndpointInfo
+ getEndpointInfo()
+ {
+ if(_endpointInfo == null)
+ {
+ _endpointInfo = _endpoint.getInfo();
+ }
+ return _endpointInfo;
+ }
+
+ private com.zeroc.Ice.IPConnectionInfo
+ getIPConnectionInfo()
+ {
+ for(com.zeroc.Ice.ConnectionInfo p = _connectionInfo; p != null; p = p.underlying)
+ {
+ if(p instanceof com.zeroc.Ice.IPConnectionInfo)
+ {
+ return (com.zeroc.Ice.IPConnectionInfo)p;
+ }
+ }
+ return null;
+ }
+
+ private final com.zeroc.Ice.ConnectionInfo _connectionInfo;
+ private final com.zeroc.Ice.Endpoint _endpoint;
+ private final com.zeroc.Ice.Instrumentation.ConnectionState _state;
+ private String _id;
+ private com.zeroc.Ice.EndpointInfo _endpointInfo;
+ }
+
+ static public final class DispatchHelper extends MetricsHelper<DispatchMetrics>
+ {
+ static private final AttributeResolver _attributes = new AttributeResolver()
+ {
+ {
+ try
+ {
+ Class<?> cl = DispatchHelper.class;
+ add("parent", cl.getDeclaredMethod("getParent"));
+ add("id", cl.getDeclaredMethod("getId"));
+
+ addConnectionAttributes(this, cl);
+
+ Class<?> clc = com.zeroc.Ice.Current.class;
+ add("operation", cl.getDeclaredMethod("getCurrent"), clc.getDeclaredField("operation"));
+ add("identity", cl.getDeclaredMethod("getIdentity"));
+ add("facet", cl.getDeclaredMethod("getCurrent"), clc.getDeclaredField("facet"));
+ add("requestId", cl.getDeclaredMethod("getCurrent"), clc.getDeclaredField("requestId"));
+ add("mode", cl.getDeclaredMethod("getMode"));
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ assert(false);
+ }
+ }
+ };
+
+ DispatchHelper(com.zeroc.Ice.Current current, int size)
+ {
+ super(_attributes);
+ _current = current;
+ _size = size;
+ }
+
+ @Override
+ public void
+ initMetrics(DispatchMetrics v)
+ {
+ v.size += _size;
+ }
+
+ @Override
+ protected String
+ defaultResolve(String attribute)
+ {
+ if(attribute.indexOf("context.", 0) == 0)
+ {
+ String v = _current.ctx.get(attribute.substring(8));
+ if(v != null)
+ {
+ return v;
+ }
+ }
+ throw new IllegalArgumentException(attribute);
+ }
+
+ public String
+ getMode()
+ {
+ return _current.requestId == 0 ? "oneway" : "twoway";
+ }
+
+ public String
+ getId()
+ {
+ if(_id == null)
+ {
+ StringBuilder os = new StringBuilder();
+ if(_current.id.category != null && !_current.id.category.isEmpty())
+ {
+ os.append(_current.id.category).append('/');
+ }
+ os.append(_current.id.name).append(" [").append(_current.operation).append(']');
+ _id = os.toString();
+ }
+ return _id;
+ }
+
+ public int
+ getRequestId()
+ {
+ return _current.requestId;
+ }
+
+ public String
+ getParent()
+ {
+ return _current.adapter.getName();
+ }
+
+ public com.zeroc.Ice.ConnectionInfo
+ getConnectionInfo()
+ {
+ if(_current.con != null)
+ {
+ return _current.con.getInfo();
+ }
+ return null;
+ }
+
+ public com.zeroc.Ice.Endpoint
+ getEndpoint()
+ {
+ if(_current.con != null)
+ {
+ return _current.con.getEndpoint();
+ }
+ return null;
+ }
+
+ public com.zeroc.Ice.Connection
+ getConnection()
+ {
+ return _current.con;
+ }
+
+ public com.zeroc.Ice.EndpointInfo
+ getEndpointInfo()
+ {
+ if(_current.con != null && _endpointInfo == null)
+ {
+ _endpointInfo = _current.con.getEndpoint().getInfo();
+ }
+ return _endpointInfo;
+ }
+
+ public com.zeroc.Ice.Current
+ getCurrent()
+ {
+ return _current;
+ }
+
+ public String
+ getIdentity()
+ {
+ return com.zeroc.Ice.Util.identityToString(_current.id);
+ }
+
+ final private com.zeroc.Ice.Current _current;
+ final private int _size;
+ private String _id;
+ private com.zeroc.Ice.EndpointInfo _endpointInfo;
+ }
+
+ static public final class InvocationHelper extends MetricsHelper<InvocationMetrics>
+ {
+ static private final AttributeResolver _attributes = new AttributeResolver()
+ {
+ {
+ try
+ {
+ Class<?> cl = InvocationHelper.class;
+ add("parent", cl.getDeclaredMethod("getParent"));
+ add("id", cl.getDeclaredMethod("getId"));
+
+ add("operation", cl.getDeclaredMethod("getOperation"));
+ add("identity", cl.getDeclaredMethod("getIdentity"));
+
+ Class<?> cli = com.zeroc.Ice.ObjectPrx.class;
+ add("facet", cl.getDeclaredMethod("getProxy"), cli.getDeclaredMethod("ice_getFacet"));
+ add("encoding", cl.getDeclaredMethod("getEncodingVersion"));
+ add("mode", cl.getDeclaredMethod("getMode"));
+ add("proxy", cl.getDeclaredMethod("getProxy"));
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ assert(false);
+ }
+ }
+ };
+
+ InvocationHelper(com.zeroc.Ice.ObjectPrx proxy, String op, java.util.Map<String, String> ctx)
+ {
+ super(_attributes);
+ _proxy = proxy;
+ _operation = op;
+ _context = ctx;
+ }
+
+ @Override
+ protected String
+ defaultResolve(String attribute)
+ {
+ if(attribute.indexOf("context.", 0) == 0)
+ {
+ String v = _context.get(attribute.substring(8));
+ if(v != null)
+ {
+ return v;
+ }
+ }
+ throw new IllegalArgumentException(attribute);
+ }
+
+ public String
+ getMode()
+ {
+ if(_proxy == null)
+ {
+ throw new IllegalArgumentException("mode");
+ }
+
+ if(_proxy.ice_isTwoway())
+ {
+ return "twoway";
+ }
+ else if(_proxy.ice_isOneway())
+ {
+ return "oneway";
+ }
+ else if(_proxy.ice_isBatchOneway())
+ {
+ return "batch-oneway";
+ }
+ else if(_proxy.ice_isDatagram())
+ {
+ return "datagram";
+ }
+ else if(_proxy.ice_isBatchDatagram())
+ {
+ return "batch-datagram";
+ }
+ else
+ {
+ throw new IllegalArgumentException("mode");
+ }
+ }
+
+ public String
+ getId()
+ {
+ if(_id == null)
+ {
+ if(_proxy != null)
+ {
+ StringBuilder os = new StringBuilder();
+ try
+ {
+ os.append(_proxy.ice_endpoints(emptyEndpoints)).append(" [").append(_operation).append(']');
+ }
+ catch(Exception ex)
+ {
+ // Either a fixed proxy or the communicator is destroyed.
+ os.append(com.zeroc.Ice.Util.identityToString(_proxy.ice_getIdentity()));
+ os.append(" [").append(_operation).append(']');
+ }
+ _id = os.toString();
+ }
+ else
+ {
+ _id = _operation;
+ }
+ }
+ return _id;
+ }
+
+ public String
+ getParent()
+ {
+ return "Communicator";
+ }
+
+ public com.zeroc.Ice.ObjectPrx
+ getProxy()
+ {
+ return _proxy;
+ }
+
+ public String
+ getIdentity()
+ {
+ if(_proxy != null)
+ {
+ return com.zeroc.Ice.Util.identityToString(_proxy.ice_getIdentity());
+ }
+ else
+ {
+ return "";
+ }
+ }
+
+ public String
+ getOperation()
+ {
+ return _operation;
+ }
+
+ public String
+ getEncodingVersion()
+ {
+ return com.zeroc.Ice.Util.encodingVersionToString(_proxy.ice_getEncodingVersion());
+ }
+
+ final private com.zeroc.Ice.ObjectPrx _proxy;
+ final private String _operation;
+ final private java.util.Map<String, String> _context;
+ private String _id;
+
+ static final private com.zeroc.Ice.Endpoint[] emptyEndpoints = new com.zeroc.Ice.Endpoint[0];
+ }
+
+ static public final class ThreadHelper extends MetricsHelper<ThreadMetrics>
+ {
+ static private final AttributeResolver _attributes = new AttributeResolver()
+ {
+ {
+ try
+ {
+ add("parent", ThreadHelper.class.getDeclaredField("_parent"));
+ add("id", ThreadHelper.class.getDeclaredField("_id"));
+ }
+ catch(Exception ex)
+ {
+ assert(false);
+ }
+ }
+ };
+
+ ThreadHelper(String parent, String id, com.zeroc.Ice.Instrumentation.ThreadState state)
+ {
+ super(_attributes);
+ _parent = parent;
+ _id = id;
+ _state = state;
+ }
+
+ @Override
+ public void
+ initMetrics(ThreadMetrics v)
+ {
+ switch(_state)
+ {
+ case ThreadStateInUseForIO:
+ ++v.inUseForIO;
+ break;
+ case ThreadStateInUseForUser:
+ ++v.inUseForUser;
+ break;
+ case ThreadStateInUseForOther:
+ ++v.inUseForOther;
+ break;
+ default:
+ break;
+ }
+ }
+
+ final public String _parent;
+ final public String _id;
+ final private com.zeroc.Ice.Instrumentation.ThreadState _state;
+ }
+
+ static public final class EndpointHelper extends MetricsHelper<Metrics>
+ {
+ static private final AttributeResolver _attributes = new AttributeResolver()
+ {
+ {
+ try
+ {
+ add("parent", EndpointHelper.class.getDeclaredMethod("getParent"));
+ add("id", EndpointHelper.class.getDeclaredMethod("getId"));
+ addEndpointAttributes(this, EndpointHelper.class);
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ assert(false);
+ }
+ }
+ };
+
+ EndpointHelper(com.zeroc.Ice.Endpoint endpt, String id)
+ {
+ super(_attributes);
+ _endpoint = endpt;
+ _id = id;
+ }
+
+ EndpointHelper(com.zeroc.Ice.Endpoint endpt)
+ {
+ super(_attributes);
+ _endpoint = endpt;
+ }
+
+ public com.zeroc.Ice.EndpointInfo
+ getEndpointInfo()
+ {
+ if(_endpointInfo == null)
+ {
+ _endpointInfo = _endpoint.getInfo();
+ }
+ return _endpointInfo;
+ }
+
+ public String
+ getParent()
+ {
+ return "Communicator";
+ }
+
+ public String
+ getId()
+ {
+ if(_id == null)
+ {
+ _id = _endpoint.toString();
+ }
+ return _id;
+ }
+
+ public String
+ getEndpoint()
+ {
+ return _endpoint.toString();
+ }
+
+ final private com.zeroc.Ice.Endpoint _endpoint;
+ private String _id;
+ private com.zeroc.Ice.EndpointInfo _endpointInfo;
+ }
+
+ public
+ CommunicatorObserverI(com.zeroc.Ice.InitializationData initData)
+ {
+ _metrics = new MetricsAdminI(initData.properties, initData.logger);
+ _delegate = initData.observer;
+
+ _connections = new ObserverFactoryWithDelegate<ConnectionMetrics, ConnectionObserverI,
+ com.zeroc.Ice.Instrumentation.ConnectionObserver>(_metrics, "Connection", ConnectionMetrics.class);
+ _dispatch = new ObserverFactoryWithDelegate<DispatchMetrics, DispatchObserverI,
+ com.zeroc.Ice.Instrumentation.DispatchObserver>(_metrics, "Dispatch", DispatchMetrics.class);
+ _invocations = new ObserverFactoryWithDelegate<InvocationMetrics, InvocationObserverI,
+ com.zeroc.Ice.Instrumentation.InvocationObserver>(_metrics, "Invocation", InvocationMetrics.class);
+ _threads = new ObserverFactoryWithDelegate<ThreadMetrics, ThreadObserverI,
+ com.zeroc.Ice.Instrumentation.ThreadObserver>(_metrics, "Thread", ThreadMetrics.class);
+ _connects = new ObserverFactoryWithDelegate<Metrics, ObserverWithDelegateI,
+ com.zeroc.Ice.Instrumentation.Observer>(_metrics, "ConnectionEstablishment", Metrics.class);
+ _endpointLookups = new ObserverFactoryWithDelegate<Metrics, ObserverWithDelegateI,
+ com.zeroc.Ice.Instrumentation.Observer>(_metrics, "EndpointLookup", Metrics.class);
+
+ try
+ {
+ _invocations.registerSubMap("Remote", RemoteMetrics.class,
+ InvocationMetrics.class.getDeclaredField("remotes"));
+ _invocations.registerSubMap("Collocated", CollocatedMetrics.class,
+ InvocationMetrics.class.getDeclaredField("collocated"));
+ }
+ catch(Exception ex)
+ {
+ assert(false);
+ }
+ }
+
+ @Override
+ public com.zeroc.Ice.Instrumentation.Observer
+ getConnectionEstablishmentObserver(com.zeroc.Ice.Endpoint endpt, String connector)
+ {
+ if(_connects.isEnabled())
+ {
+ try
+ {
+ com.zeroc.Ice.Instrumentation.Observer delegate = null;
+ if(_delegate != null)
+ {
+ delegate = _delegate.getConnectionEstablishmentObserver(endpt, connector);
+ }
+ return _connects.getObserver(new EndpointHelper(endpt, connector), ObserverWithDelegateI.class,
+ delegate);
+ }
+ catch(Exception ex)
+ {
+ _metrics.getLogger().error("unexpected exception trying to obtain observer:\n" + Ex.toString(ex));
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public com.zeroc.Ice.Instrumentation.Observer
+ getEndpointLookupObserver(com.zeroc.Ice.Endpoint endpt)
+ {
+ if(_endpointLookups.isEnabled())
+ {
+ try
+ {
+ com.zeroc.Ice.Instrumentation.Observer delegate = null;
+ if(_delegate != null)
+ {
+ delegate = _delegate.getEndpointLookupObserver(endpt);
+ }
+ return _endpointLookups.getObserver(new EndpointHelper(endpt), ObserverWithDelegateI.class, delegate);
+ }
+ catch(Exception ex)
+ {
+ _metrics.getLogger().error("unexpected exception trying to obtain observer:\n" + Ex.toString(ex));
+ }
+
+ }
+ return null;
+ }
+
+ @Override
+ public com.zeroc.Ice.Instrumentation.ConnectionObserver
+ getConnectionObserver(com.zeroc.Ice.ConnectionInfo c, com.zeroc.Ice.Endpoint e,
+ com.zeroc.Ice.Instrumentation.ConnectionState s,
+ com.zeroc.Ice.Instrumentation.ConnectionObserver observer)
+ {
+ if(_connections.isEnabled())
+ {
+ try
+ {
+ com.zeroc.Ice.Instrumentation.ConnectionObserver delegate = null;
+ ConnectionObserverI o = observer instanceof ConnectionObserverI ? (ConnectionObserverI)observer : null;
+ if(_delegate != null)
+ {
+ delegate = _delegate.getConnectionObserver(c, e, s, o != null ? o.getDelegate() : observer);
+ }
+ return _connections.getObserver(new ConnectionHelper(c, e, s), o, ConnectionObserverI.class, delegate);
+ }
+ catch(Exception ex)
+ {
+ _metrics.getLogger().error("unexpected exception trying to obtain observer:\n" + Ex.toString(ex));
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public com.zeroc.Ice.Instrumentation.ThreadObserver
+ getThreadObserver(String parent, String id, com.zeroc.Ice.Instrumentation.ThreadState s,
+ com.zeroc.Ice.Instrumentation.ThreadObserver observer)
+ {
+ if(_threads.isEnabled())
+ {
+ try
+ {
+ com.zeroc.Ice.Instrumentation.ThreadObserver delegate = null;
+ ThreadObserverI o = observer instanceof ThreadObserverI ? (ThreadObserverI)observer : null;
+ if(_delegate != null)
+ {
+ delegate = _delegate.getThreadObserver(parent, id, s, o != null ? o.getDelegate() : observer);
+ }
+ return _threads.getObserver(new ThreadHelper(parent, id, s), o, ThreadObserverI.class, delegate);
+ }
+ catch(Exception ex)
+ {
+ _metrics.getLogger().error("unexpected exception trying to obtain observer:\n" + Ex.toString(ex));
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public com.zeroc.Ice.Instrumentation.InvocationObserver
+ getInvocationObserver(com.zeroc.Ice.ObjectPrx prx, String operation, java.util.Map<java.lang.String,
+ java.lang.String> ctx)
+ {
+ if(_invocations.isEnabled())
+ {
+ try
+ {
+ com.zeroc.Ice.Instrumentation.InvocationObserver delegate = null;
+ if(_delegate != null)
+ {
+ delegate = _delegate.getInvocationObserver(prx, operation, ctx);
+ }
+ return _invocations.getObserver(new InvocationHelper(prx, operation, ctx),
+ InvocationObserverI.class,
+ delegate);
+ }
+ catch(Exception ex)
+ {
+ _metrics.getLogger().error("unexpected exception trying to obtain observer:\n" + Ex.toString(ex));
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public com.zeroc.Ice.Instrumentation.DispatchObserver
+ getDispatchObserver(com.zeroc.Ice.Current c, int size)
+ {
+ if(_dispatch.isEnabled())
+ {
+ try
+ {
+ com.zeroc.Ice.Instrumentation.DispatchObserver delegate = null;
+ if(_delegate != null)
+ {
+ delegate = _delegate.getDispatchObserver(c, size);
+ }
+ return _dispatch.getObserver(new DispatchHelper(c, size), DispatchObserverI.class, delegate);
+ }
+ catch(Exception ex)
+ {
+ _metrics.getLogger().error("unexpected exception trying to obtain observer:\n" + Ex.toString(ex));
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void
+ setObserverUpdater(final com.zeroc.Ice.Instrumentation.ObserverUpdater updater)
+ {
+ if(updater == null)
+ {
+ _connections.setUpdater(null);
+ _threads.setUpdater(null);
+ }
+ else
+ {
+ _connections.setUpdater(new Runnable() {
+ @Override
+ public void
+ run()
+ {
+ updater.updateConnectionObservers();
+ }
+ });
+ _threads.setUpdater(new Runnable() {
+ @Override
+ public void
+ run()
+ {
+ updater.updateThreadObservers();
+ }
+ });
+ }
+
+ if(_delegate != null)
+ {
+ _delegate.setObserverUpdater(updater);
+ }
+ }
+
+ public MetricsAdminI getFacet()
+ {
+ return _metrics;
+ }
+
+ final private MetricsAdminI _metrics;
+ final private com.zeroc.Ice.Instrumentation.CommunicatorObserver _delegate;
+ final private ObserverFactoryWithDelegate<ConnectionMetrics, ConnectionObserverI,
+ com.zeroc.Ice.Instrumentation.ConnectionObserver> _connections;
+ final private ObserverFactoryWithDelegate<DispatchMetrics, DispatchObserverI,
+ com.zeroc.Ice.Instrumentation.DispatchObserver> _dispatch;
+ final private ObserverFactoryWithDelegate<InvocationMetrics, InvocationObserverI,
+ com.zeroc.Ice.Instrumentation.InvocationObserver> _invocations;
+ final private ObserverFactoryWithDelegate<ThreadMetrics, ThreadObserverI,
+ com.zeroc.Ice.Instrumentation.ThreadObserver> _threads;
+ final private ObserverFactoryWithDelegate<Metrics, ObserverWithDelegateI,
+ com.zeroc.Ice.Instrumentation.Observer> _connects;
+ final private ObserverFactoryWithDelegate<Metrics, ObserverWithDelegateI,
+ com.zeroc.Ice.Instrumentation.Observer> _endpointLookups;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectRequestHandler.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectRequestHandler.java
new file mode 100644
index 00000000000..12e6d3616a1
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectRequestHandler.java
@@ -0,0 +1,383 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import java.util.concurrent.Callable;
+
+public class ConnectRequestHandler
+ implements RequestHandler, Reference.GetConnectionCallback, RouterInfo.AddProxyCallback
+{
+ synchronized public RequestHandler
+ connect(com.zeroc.Ice._ObjectPrxI proxy)
+ {
+ if(!initialized())
+ {
+ _proxies.add(proxy);
+ }
+ return _requestHandler;
+ }
+
+ @Override
+ public RequestHandler
+ update(RequestHandler previousHandler, RequestHandler newHandler)
+ {
+ return previousHandler == this ? newHandler : this;
+ }
+
+ @Override
+ public int
+ sendAsyncRequest(ProxyOutgoingAsyncBase out)
+ throws RetryException
+ {
+ synchronized(this)
+ {
+ if(!_initialized)
+ {
+ out.cancelable(this); // This will throw if the request is canceled
+ }
+
+ if(!initialized())
+ {
+ _requests.add(out);
+ return AsyncStatus.Queued;
+ }
+ }
+ return out.invokeRemote(_connection, _compress, _response);
+ }
+
+ @Override
+ public void
+ asyncRequestCanceled(OutgoingAsyncBase outAsync, com.zeroc.Ice.LocalException ex)
+ {
+ synchronized(this)
+ {
+ if(_exception != null)
+ {
+ return; // The request has been notified of a failure already.
+ }
+
+ if(!initialized())
+ {
+ java.util.Iterator<ProxyOutgoingAsyncBase> it = _requests.iterator();
+ while(it.hasNext())
+ {
+ OutgoingAsyncBase request = it.next();
+ if(request == outAsync)
+ {
+ it.remove();
+ if(outAsync.completed(ex))
+ {
+ outAsync.invokeCompletedAsync();
+ }
+ return;
+ }
+ }
+ assert(false); // The request has to be queued if it timed out and we're not initialized yet.
+ }
+ }
+ _connection.asyncRequestCanceled(outAsync, ex);
+ }
+
+ @Override
+ public Reference
+ getReference()
+ {
+ return _reference;
+ }
+
+ @Override
+ synchronized public com.zeroc.Ice.ConnectionI
+ getConnection()
+ {
+ if(_exception != null)
+ {
+ throw (com.zeroc.Ice.LocalException)_exception.fillInStackTrace();
+ }
+ else
+ {
+ return _connection;
+ }
+ }
+
+ //
+ // Implementation of Reference.GetConnectionCallback
+ //
+
+ @Override
+ public void
+ setConnection(com.zeroc.Ice.ConnectionI connection, boolean compress)
+ {
+ synchronized(this)
+ {
+ assert(_exception == null && _connection == null);
+ _connection = connection;
+ _compress = compress;
+ }
+
+ //
+ // If this proxy is for a non-local object, and we are using a router, then
+ // add this proxy to the router info object.
+ //
+ RouterInfo ri = _reference.getRouterInfo();
+ if(ri != null && !ri.addProxy(_proxy, this))
+ {
+ return; // The request handler will be initialized once addProxy returns.
+ }
+
+ //
+ // We can now send the queued requests.
+ //
+ flushRequests();
+ }
+
+ @Override
+ public synchronized void
+ setException(final com.zeroc.Ice.LocalException ex)
+ {
+ assert(!_initialized && _exception == null);
+ _exception = ex;
+ _proxies.clear();
+ _proxy = null; // Break cyclic reference count.
+
+ //
+ // NOTE: remove the request handler *before* notifying the
+ // requests that the connection failed. It's important to ensure
+ // that future invocations will obtain a new connect request
+ // handler once invocations are notified.
+ //
+ try
+ {
+ _reference.getInstance().requestHandlerFactory().removeRequestHandler(_reference, this);
+ }
+ catch(com.zeroc.Ice.CommunicatorDestroyedException exc)
+ {
+ // Ignore
+ }
+
+ for(OutgoingAsyncBase outAsync : _requests)
+ {
+ if(outAsync.completed(_exception))
+ {
+ outAsync.invokeCompletedAsync();
+ }
+ }
+ _requests.clear();
+ notifyAll();
+ }
+
+ //
+ // Implementation of RouterInfo.AddProxyCallback
+ //
+ @Override
+ public void
+ addedProxy()
+ {
+ //
+ // The proxy was added to the router info, we're now ready to send the
+ // queued requests.
+ //
+ flushRequests();
+ }
+
+ public
+ ConnectRequestHandler(Reference ref, com.zeroc.Ice._ObjectPrxI proxy)
+ {
+ _reference = ref;
+ _response = _reference.getMode() == Reference.ModeTwoway;
+ _proxy = proxy;
+ _initialized = false;
+ _flushing = false;
+
+ if(_reference.getInstance().queueRequests())
+ {
+ _requestHandler = new QueueRequestHandler(_reference.getInstance(), this);
+ }
+ else
+ {
+ _requestHandler = this;
+ }
+ }
+
+ private boolean
+ initialized()
+ {
+ // Must be called with the mutex locked.
+
+ if(_initialized)
+ {
+ assert(_connection != null);
+ return true;
+ }
+ else
+ {
+ //
+ // This is similar to a mutex lock in that the flag is
+ // only true for a short period of time.
+ //
+ boolean interrupted = false;
+ while(_flushing && _exception == null)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ interrupted = true;
+ }
+ }
+ //
+ // Restore the interrupted status.
+ //
+ if(interrupted)
+ {
+ Thread.currentThread().interrupt();
+ }
+
+ if(_exception != null)
+ {
+ if(_connection != null)
+ {
+ //
+ // Only throw if the connection didn't get established. If
+ // it died after being established, we allow the caller to
+ // retry the connection establishment by not throwing here
+ // (the connection will throw RetryException).
+ //
+ return true;
+ }
+ throw (com.zeroc.Ice.LocalException)_exception.fillInStackTrace();
+ }
+ else
+ {
+ return _initialized;
+ }
+ }
+ }
+
+ private void
+ flushRequests()
+ {
+ if(_reference.getInstance().queueRequests())
+ {
+ _reference.getInstance().getQueueExecutor().executeNoThrow(new Callable<Void>()
+ {
+ @Override
+ public Void call() throws Exception
+ {
+ flushRequestsImpl();
+ return null;
+ }
+ });
+ }
+ else
+ {
+ flushRequestsImpl();
+ }
+ }
+
+ private void
+ flushRequestsImpl()
+ {
+ synchronized(this)
+ {
+ assert(_connection != null && !_initialized);
+
+ //
+ // We set the _flushing flag to true to prevent any additional queuing. Callers
+ // might block for a little while as the queued requests are being sent but this
+ // shouldn't be an issue as the request sends are non-blocking.
+ //
+ _flushing = true;
+ }
+
+ com.zeroc.Ice.LocalException exception = null;
+ for(ProxyOutgoingAsyncBase outAsync : _requests)
+ {
+ try
+ {
+ if((outAsync.invokeRemote(_connection, _compress, _response) & AsyncStatus.InvokeSentCallback) > 0)
+ {
+ outAsync.invokeSentAsync();
+ }
+ }
+ catch(RetryException ex)
+ {
+ exception = ex.get();
+
+ // Remove the request handler before retrying.
+ _reference.getInstance().requestHandlerFactory().removeRequestHandler(_reference, this);
+ outAsync.retryException(ex.get());
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ exception = ex;
+ if(outAsync.completed(ex))
+ {
+ outAsync.invokeCompletedAsync();
+ }
+ }
+ }
+ _requests.clear();
+
+ //
+ // If we aren't caching the connection, don't bother creating a
+ // connection request handler. Otherwise, update the proxies
+ // request handler to use the more efficient connection request
+ // handler.
+ //
+ if(_reference.getCacheConnection() && exception == null)
+ {
+ RequestHandler previous = _requestHandler;
+ _requestHandler = new ConnectionRequestHandler(_reference, _connection, _compress);
+ if(_reference.getInstance().queueRequests())
+ {
+ _requestHandler = new QueueRequestHandler(_reference.getInstance(), _requestHandler);
+ }
+ for(com.zeroc.Ice._ObjectPrxI proxy : _proxies)
+ {
+ proxy.__updateRequestHandler(previous, _requestHandler);
+ }
+ }
+
+ synchronized(this)
+ {
+ assert(!_initialized);
+ _exception = exception;
+ _initialized = _exception == null;
+ _flushing = false;
+
+ //
+ // Only remove once all the requests are flushed to
+ // guarantee serialization.
+ //
+ _reference.getInstance().requestHandlerFactory().removeRequestHandler(_reference, this);
+
+ _proxies.clear();
+ _proxy = null; // Break cyclic reference count.
+ notifyAll();
+ }
+ }
+
+ private final Reference _reference;
+ private boolean _response;
+
+ private com.zeroc.Ice._ObjectPrxI _proxy;
+ private java.util.Set<com.zeroc.Ice._ObjectPrxI> _proxies = new java.util.HashSet<>();
+
+ private com.zeroc.Ice.ConnectionI _connection;
+ private boolean _compress;
+ private com.zeroc.Ice.LocalException _exception;
+ private boolean _initialized;
+ private boolean _flushing;
+
+ private java.util.List<ProxyOutgoingAsyncBase> _requests = new java.util.LinkedList<>();
+ private RequestHandler _requestHandler;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionACMMonitor.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionACMMonitor.java
new file mode 100644
index 00000000000..f7576e28816
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionACMMonitor.java
@@ -0,0 +1,127 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+class ConnectionACMMonitor implements ACMMonitor
+{
+ ConnectionACMMonitor(FactoryACMMonitor parent, java.util.concurrent.ScheduledExecutorService timer,
+ ACMConfig config)
+ {
+ _parent = parent;
+ _timer = timer;
+ _config = config;
+ }
+
+ @Override
+ protected synchronized void
+ finalize()
+ throws Throwable
+ {
+ try
+ {
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_connection == null);
+ }
+ catch(java.lang.Exception ex)
+ {
+ }
+ finally
+ {
+ super.finalize();
+ }
+ }
+
+ @Override
+ public synchronized void
+ add(com.zeroc.Ice.ConnectionI connection)
+ {
+ assert(_connection == null);
+ _connection = connection;
+ if(_config.timeout > 0)
+ {
+ _future = _timer.scheduleAtFixedRate(new Runnable() {
+ @Override
+ public void run()
+ {
+ monitorConnection();
+ }
+ },
+ _config.timeout / 2, _config.timeout / 2, java.util.concurrent.TimeUnit.MILLISECONDS);
+ }
+ }
+
+ @Override
+ public synchronized void
+ remove(com.zeroc.Ice.ConnectionI connection)
+ {
+ assert(_connection == connection);
+ _connection = null;
+ if(_config.timeout > 0)
+ {
+ _future.cancel(false);
+ _future = null;
+ }
+ }
+
+ @Override
+ public void
+ reap(com.zeroc.Ice.ConnectionI connection)
+ {
+ _parent.reap(connection);
+ }
+
+ @Override
+ public ACMMonitor
+ acm(java.util.OptionalInt timeout, java.util.Optional<com.zeroc.Ice.ACMClose> close,
+ java.util.Optional<com.zeroc.Ice.ACMHeartbeat> heartbeat)
+ {
+ return _parent.acm(timeout, close, heartbeat);
+ }
+
+ @Override
+ public com.zeroc.Ice.ACM
+ getACM()
+ {
+ com.zeroc.Ice.ACM acm = new com.zeroc.Ice.ACM();
+ acm.timeout = _config.timeout / 1000;
+ acm.close = _config.close;
+ acm.heartbeat = _config.heartbeat;
+ return acm;
+ }
+
+ private void
+ monitorConnection()
+ {
+ com.zeroc.Ice.ConnectionI connection;
+ synchronized(this)
+ {
+ if(_connection == null)
+ {
+ return;
+ }
+ connection = _connection;
+ }
+
+ try
+ {
+ connection.monitor(Time.currentMonotonicTimeMillis(), _config);
+ }
+ catch(Exception ex)
+ {
+ _parent.handleException(ex);
+ }
+ }
+
+ final private FactoryACMMonitor _parent;
+ final private java.util.concurrent.ScheduledExecutorService _timer;
+ private java.util.concurrent.Future<?> _future;
+ final private ACMConfig _config;
+
+ private com.zeroc.Ice.ConnectionI _connection;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionFlushBatch.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionFlushBatch.java
new file mode 100644
index 00000000000..3ec636ed074
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionFlushBatch.java
@@ -0,0 +1,106 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import java.util.concurrent.Callable;
+
+public class ConnectionFlushBatch extends OutgoingAsyncBase<Void>
+{
+ public ConnectionFlushBatch(com.zeroc.Ice.ConnectionI con, com.zeroc.Ice.Communicator communicator,
+ Instance instance)
+ {
+ super(communicator, instance, "flushBatchRequests");
+ _connection = con;
+ }
+
+ @Override
+ public com.zeroc.Ice.Connection getConnection()
+ {
+ return _connection;
+ }
+
+ @Override
+ protected void __sent()
+ {
+ super.__sent();
+
+ assert((_state & StateOK) != 0);
+ complete(null);
+ }
+
+ @Override
+ protected void __completed()
+ {
+ if(_exception != null)
+ {
+ completeExceptionally(_exception);
+ }
+ super.__completed();
+ }
+
+ public void invoke()
+ {
+ try
+ {
+ final int batchRequestNum = _connection.getBatchRequestQueue().swap(_os);
+
+ int status;
+ if(batchRequestNum == 0)
+ {
+ status = AsyncStatus.Sent;
+ if(sent())
+ {
+ status |= AsyncStatus.InvokeSentCallback;
+ }
+ }
+ else if(_instance.queueRequests())
+ {
+ status = _instance.getQueueExecutor().execute(new Callable<Integer>()
+ {
+ @Override
+ public Integer call()
+ throws RetryException
+ {
+ return _connection.sendAsyncRequest(ConnectionFlushBatch.this, false, false, batchRequestNum);
+ }
+ });
+ }
+ else
+ {
+ status = _connection.sendAsyncRequest(this, false, false, batchRequestNum);
+ }
+
+ if((status & AsyncStatus.Sent) > 0)
+ {
+ _sentSynchronously = true;
+ if((status & AsyncStatus.InvokeSentCallback) > 0)
+ {
+ invokeSent();
+ }
+ }
+ }
+ catch(RetryException ex)
+ {
+ if(completed(ex.get()))
+ {
+ invokeCompletedAsync();
+ }
+ }
+ catch(com.zeroc.Ice.Exception ex)
+ {
+ if(completed(ex))
+ {
+ invokeCompletedAsync();
+ }
+ }
+ }
+
+ private com.zeroc.Ice.ConnectionI _connection;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionObserverI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionObserverI.java
new file mode 100644
index 00000000000..b3898f5476c
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionObserverI.java
@@ -0,0 +1,61 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class ConnectionObserverI
+ extends com.zeroc.IceMX.ObserverWithDelegate<com.zeroc.IceMX.ConnectionMetrics,
+ com.zeroc.Ice.Instrumentation.ConnectionObserver>
+ implements com.zeroc.Ice.Instrumentation.ConnectionObserver
+{
+ @Override
+ public void sentBytes(final int num)
+ {
+ _sentBytes = num;
+ forEach(_sentBytesUpdate);
+ if(_delegate != null)
+ {
+ _delegate.sentBytes(num);
+ }
+ }
+
+ @Override
+ public void receivedBytes(int num)
+ {
+ _receivedBytes = num;
+ forEach(_receivedBytesUpdate);
+ if(_delegate != null)
+ {
+ _delegate.receivedBytes(num);
+ }
+ }
+
+ private MetricsUpdate<com.zeroc.IceMX.ConnectionMetrics> _sentBytesUpdate =
+ new MetricsUpdate<com.zeroc.IceMX.ConnectionMetrics>()
+ {
+ @Override
+ public void update(com.zeroc.IceMX.ConnectionMetrics v)
+ {
+ v.sentBytes += _sentBytes;
+ }
+ };
+
+ private MetricsUpdate<com.zeroc.IceMX.ConnectionMetrics> _receivedBytesUpdate =
+ new MetricsUpdate<com.zeroc.IceMX.ConnectionMetrics>()
+ {
+ @Override
+ public void update(com.zeroc.IceMX.ConnectionMetrics v)
+ {
+ v.receivedBytes += _receivedBytes;
+ }
+ };
+
+ private int _sentBytes;
+ private int _receivedBytes;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionRequestHandler.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionRequestHandler.java
new file mode 100644
index 00000000000..586c20dd54a
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionRequestHandler.java
@@ -0,0 +1,82 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class ConnectionRequestHandler implements RequestHandler
+{
+ @Override
+ public RequestHandler
+ update(RequestHandler previousHandler, RequestHandler newHandler)
+ {
+ try
+ {
+ if(previousHandler == this)
+ {
+ return newHandler;
+ }
+ else if(previousHandler.getConnection() == _connection)
+ {
+ //
+ // If both request handlers point to the same connection, we also
+ // update the request handler. See bug ICE-5489 for reasons why
+ // this can be useful.
+ //
+ return newHandler;
+ }
+ }
+ catch(com.zeroc.Ice.Exception ex)
+ {
+ // Ignore
+ }
+ return this;
+ }
+
+ @Override
+ public int sendAsyncRequest(ProxyOutgoingAsyncBase out)
+ throws RetryException
+ {
+ return out.invokeRemote(_connection, _compress, _response);
+ }
+
+ @Override
+ public void
+ asyncRequestCanceled(OutgoingAsyncBase outgoingAsync, com.zeroc.Ice.LocalException ex)
+ {
+ _connection.asyncRequestCanceled(outgoingAsync, ex);
+ }
+
+ @Override
+ public Reference
+ getReference()
+ {
+ return _reference;
+ }
+
+ @Override
+ public com.zeroc.Ice.ConnectionI
+ getConnection()
+ {
+ return _connection;
+ }
+
+ public ConnectionRequestHandler(Reference ref, com.zeroc.Ice.ConnectionI connection, boolean compress)
+ {
+ _reference = ref;
+ _response = _reference.getMode() == Reference.ModeTwoway;
+ _connection = connection;
+ _compress = compress;
+ }
+
+ private final Reference _reference;
+ private final boolean _response;
+ private final com.zeroc.Ice.ConnectionI _connection;
+ private final boolean _compress;
+
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Connector.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Connector.java
new file mode 100644
index 00000000000..28de64f6115
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Connector.java
@@ -0,0 +1,25 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public interface Connector
+{
+ Transceiver connect();
+
+ short type();
+ @Override
+ String toString();
+
+ //
+ // Compare connectors for sorting process.
+ //
+ @Override
+ boolean equals(java.lang.Object obj);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/DefaultsAndOverrides.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/DefaultsAndOverrides.java
new file mode 100644
index 00000000000..2bb2903476d
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/DefaultsAndOverrides.java
@@ -0,0 +1,243 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public final class DefaultsAndOverrides
+{
+ DefaultsAndOverrides(com.zeroc.Ice.Properties properties, com.zeroc.Ice.Logger logger)
+ {
+ String value;
+ int intValue;
+
+ defaultProtocol = properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp");
+
+ value = properties.getProperty("Ice.Default.Host");
+ if(!value.isEmpty())
+ {
+ defaultHost = value;
+ }
+ else
+ {
+ defaultHost = null;
+ }
+
+ value = properties.getProperty("Ice.Default.SourceAddress");
+ if(!value.isEmpty())
+ {
+ defaultSourceAddress = Network.getNumericAddress(value);
+ if(defaultSourceAddress == null)
+ {
+ throw new com.zeroc.Ice.InitializationException(
+ "invalid IP address set for Ice.Default.SourceAddress: `" + value + "'");
+ }
+ }
+ else
+ {
+ defaultSourceAddress = null;
+ }
+
+ value = properties.getProperty("Ice.Override.Timeout");
+ if(!value.isEmpty())
+ {
+ overrideTimeout = true;
+ intValue = properties.getPropertyAsInt("Ice.Override.Timeout");
+ if(intValue < 0 && intValue != -1)
+ {
+ overrideTimeoutValue = -1;
+ StringBuffer msg = new StringBuffer("invalid value for Ice.Override.Timeout `");
+ msg.append(properties.getProperty("Ice.Override.Timeout"));
+ msg.append("': defaulting to -1");
+ logger.warning(msg.toString());
+ }
+ else
+ {
+ overrideTimeoutValue = intValue;
+ }
+ }
+ else
+ {
+ overrideTimeout = false;
+ overrideTimeoutValue = -1;
+ }
+
+ value = properties.getProperty("Ice.Override.ConnectTimeout");
+ if(!value.isEmpty())
+ {
+ overrideConnectTimeout = true;
+ intValue = properties.getPropertyAsInt("Ice.Override.ConnectTimeout");
+ if(intValue < 0 && intValue != -1)
+ {
+ overrideConnectTimeoutValue = -1;
+ StringBuffer msg = new StringBuffer("invalid value for Ice.Override.ConnectTimeout `");
+ msg.append(properties.getProperty("Ice.Override.ConnectTimeout"));
+ msg.append("': defaulting to -1");
+ logger.warning(msg.toString());
+ }
+ else
+ {
+ overrideConnectTimeoutValue = intValue;
+ }
+ }
+ else
+ {
+ overrideConnectTimeout = false;
+ overrideConnectTimeoutValue = -1;
+ }
+
+ value = properties.getProperty("Ice.Override.CloseTimeout");
+ if(!value.isEmpty())
+ {
+ overrideCloseTimeout = true;
+ intValue = properties.getPropertyAsInt("Ice.Override.CloseTimeout");
+ if(intValue < 0 && intValue != -1)
+ {
+ overrideCloseTimeoutValue = -1;
+ StringBuffer msg = new StringBuffer("invalid value for Ice.Override.CloseTimeout `");
+ msg.append(properties.getProperty("Ice.Override.CloseTimeout"));
+ msg.append("': defaulting to -1");
+ logger.warning(msg.toString());
+ }
+ else
+ {
+ overrideCloseTimeoutValue = intValue;
+ }
+ }
+ else
+ {
+ overrideCloseTimeout = false;
+ overrideCloseTimeoutValue = -1;
+ }
+
+ value = properties.getProperty("Ice.Override.Compress");
+ if(!value.isEmpty())
+ {
+ overrideCompress = true;
+ boolean b = properties.getPropertyAsInt("Ice.Override.Compress") > 0;
+ if(b && !BZip2.supported())
+ {
+ System.err.println("warning: bzip2 support not available, Ice.Override.Compress ignored");
+ b = false;
+ }
+ overrideCompressValue = b;
+ }
+ else
+ {
+ overrideCompress = false;
+ overrideCompressValue = false;
+ }
+
+ value = properties.getProperty("Ice.Override.Secure");
+ if(!value.isEmpty())
+ {
+ overrideSecure = true;
+ overrideSecureValue = properties.getPropertyAsInt("Ice.Override.Secure") > 0;
+ }
+ else
+ {
+ overrideSecure = false;
+ overrideSecureValue = false;
+ }
+
+ defaultCollocationOptimization =
+ properties.getPropertyAsIntWithDefault("Ice.Default.CollocationOptimized", 1) > 0;
+
+ value = properties.getPropertyWithDefault("Ice.Default.EndpointSelection", "Random");
+ if(value.equals("Random"))
+ {
+ defaultEndpointSelection = com.zeroc.Ice.EndpointSelectionType.Random;
+ }
+ else if(value.equals("Ordered"))
+ {
+ defaultEndpointSelection = com.zeroc.Ice.EndpointSelectionType.Ordered;
+ }
+ else
+ {
+ com.zeroc.Ice.EndpointSelectionTypeParseException ex =
+ new com.zeroc.Ice.EndpointSelectionTypeParseException();
+ ex.str = "illegal value `" + value + "'; expected `Random' or `Ordered'";
+ throw ex;
+ }
+
+ intValue = properties.getPropertyAsIntWithDefault("Ice.Default.Timeout", 60000);
+ if(intValue < 1 && intValue != -1)
+ {
+ defaultTimeout = 60000;
+ StringBuffer msg = new StringBuffer("invalid value for Ice.Default.Timeout `");
+ msg.append(properties.getProperty("Ice.Default.Timeout"));
+ msg.append("': defaulting to 60000");
+ logger.warning(msg.toString());
+ }
+ else
+ {
+ defaultTimeout = intValue;
+ }
+
+ intValue = properties.getPropertyAsIntWithDefault("Ice.Default.LocatorCacheTimeout", -1);
+ if(intValue < -1)
+ {
+ defaultLocatorCacheTimeout = -1;
+ StringBuffer msg = new StringBuffer("invalid value for Ice.Default.LocatorCacheTimeout `");
+ msg.append(properties.getProperty("Ice.Default.LocatorCacheTimeout"));
+ msg.append("': defaulting to -1");
+ logger.warning(msg.toString());
+ }
+ else
+ {
+ defaultLocatorCacheTimeout = intValue;
+ }
+
+ intValue = properties.getPropertyAsIntWithDefault("Ice.Default.InvocationTimeout", -1);
+ if(intValue < 1 && intValue != -1 && intValue != -2)
+ {
+ defaultInvocationTimeout = -1;
+ StringBuffer msg = new StringBuffer("invalid value for Ice.Default.InvocationTimeout `");
+ msg.append(properties.getProperty("Ice.Default.InvocationTimeout"));
+ msg.append("': defaulting to -1");
+ logger.warning(msg.toString());
+ }
+ else
+ {
+ defaultInvocationTimeout = intValue;
+ }
+
+ defaultPreferSecure = properties.getPropertyAsIntWithDefault("Ice.Default.PreferSecure", 0) > 0;
+
+ value = properties.getPropertyWithDefault("Ice.Default.EncodingVersion",
+ com.zeroc.Ice.Util.encodingVersionToString(Protocol.currentEncoding));
+ defaultEncoding = com.zeroc.Ice.Util.stringToEncodingVersion(value);
+ Protocol.checkSupportedEncoding(defaultEncoding);
+
+ boolean slicedFormat = properties.getPropertyAsIntWithDefault("Ice.Default.SlicedFormat", 0) > 0;
+ defaultFormat = slicedFormat ? com.zeroc.Ice.FormatType.SlicedFormat : com.zeroc.Ice.FormatType.CompactFormat;
+ }
+
+ final public String defaultHost;
+ final public java.net.InetSocketAddress defaultSourceAddress;
+ final public String defaultProtocol;
+ final public boolean defaultCollocationOptimization;
+ final public com.zeroc.Ice.EndpointSelectionType defaultEndpointSelection;
+ final public int defaultTimeout;
+ final public int defaultLocatorCacheTimeout;
+ final public int defaultInvocationTimeout;
+ final public boolean defaultPreferSecure;
+ final public com.zeroc.Ice.EncodingVersion defaultEncoding;
+ final public com.zeroc.Ice.FormatType defaultFormat;
+
+ final public boolean overrideTimeout;
+ final public int overrideTimeoutValue;
+ final public boolean overrideConnectTimeout;
+ final public int overrideConnectTimeoutValue;
+ final public boolean overrideCloseTimeout;
+ final public int overrideCloseTimeoutValue;
+ final public boolean overrideCompress;
+ final public boolean overrideCompressValue;
+ final public boolean overrideSecure;
+ final public boolean overrideSecureValue;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/DictionaryPatcher.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/DictionaryPatcher.java
new file mode 100644
index 00000000000..f77f47eb84d
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/DictionaryPatcher.java
@@ -0,0 +1,38 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class DictionaryPatcher<K, V> implements com.zeroc.Ice.ReadValueCallback
+{
+ public DictionaryPatcher(java.util.Map<K, V> dict, Class<V> cls, String type, K key)
+ {
+ _dict = dict;
+ _cls = cls;
+ _type = type;
+ _key = key;
+ }
+
+ public void valueReady(com.zeroc.Ice.Value v)
+ {
+ if(v == null || _cls.isInstance(v))
+ {
+ _dict.put(_key, _cls.cast(v));
+ }
+ else
+ {
+ Ex.throwUOE(_type, v);
+ }
+ }
+
+ private java.util.Map<K, V> _dict;
+ private Class<V> _cls;
+ private String _type;
+ private K _key;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/DispatchObserverI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/DispatchObserverI.java
new file mode 100644
index 00000000000..1cc43566526
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/DispatchObserverI.java
@@ -0,0 +1,53 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class DispatchObserverI
+ extends com.zeroc.IceMX.ObserverWithDelegate<com.zeroc.IceMX.DispatchMetrics,
+ com.zeroc.Ice.Instrumentation.DispatchObserver>
+ implements com.zeroc.Ice.Instrumentation.DispatchObserver
+{
+ @Override
+ public void userException()
+ {
+ forEach(_userException);
+ if(_delegate != null)
+ {
+ _delegate.userException();
+ }
+ }
+
+ @Override
+ public void reply(final int size)
+ {
+ forEach(new MetricsUpdate<com.zeroc.IceMX.DispatchMetrics>()
+ {
+ @Override
+ public void update(com.zeroc.IceMX.DispatchMetrics v)
+ {
+ v.replySize += size;
+ }
+ });
+ if(_delegate != null)
+ {
+ _delegate.reply(size);
+ }
+ }
+
+ final private MetricsUpdate<com.zeroc.IceMX.DispatchMetrics> _userException =
+ new MetricsUpdate<com.zeroc.IceMX.DispatchMetrics>()
+ {
+ @Override
+ public void update(com.zeroc.IceMX.DispatchMetrics v)
+ {
+ ++v.userException;
+ }
+ };
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/DispatchWorkItem.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/DispatchWorkItem.java
new file mode 100644
index 00000000000..9e5cbf669c8
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/DispatchWorkItem.java
@@ -0,0 +1,44 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+//
+// A helper class for thread pool work items that only need to call user
+// callbacks. If a dispatcher is installed with the communicator, the
+// thread pool work item is executed with the dispatcher, otherwise it's
+// executed by a thread pool thread (after promoting a follower thread).
+//
+abstract public class DispatchWorkItem implements ThreadPoolWorkItem, Runnable
+{
+ public DispatchWorkItem()
+ {
+ }
+
+ public DispatchWorkItem(com.zeroc.Ice.Connection connection)
+ {
+ _connection = connection;
+ }
+
+ @Override
+ final public void
+ execute(ThreadPoolCurrent current)
+ {
+ current.ioCompleted(); // Promote a follower
+ current.dispatchFromThisThread(this);
+ }
+
+ public com.zeroc.Ice.Connection
+ getConnection()
+ {
+ return _connection;
+ }
+
+ private com.zeroc.Ice.Connection _connection;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointFactory.java
new file mode 100644
index 00000000000..01abd58535f
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointFactory.java
@@ -0,0 +1,21 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public interface EndpointFactory
+{
+ short type();
+ String protocol();
+ EndpointI create(java.util.ArrayList<String> args, boolean oaEndpoint);
+ EndpointI read(com.zeroc.Ice.InputStream s);
+ void destroy();
+
+ EndpointFactory clone(ProtocolInstance instance, EndpointFactory delegate);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointFactoryManager.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointFactoryManager.java
new file mode 100644
index 00000000000..7fa9aa318a3
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointFactoryManager.java
@@ -0,0 +1,184 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public final class EndpointFactoryManager
+{
+ EndpointFactoryManager(Instance instance)
+ {
+ _instance = instance;
+ }
+
+ public synchronized void add(EndpointFactory factory)
+ {
+ for(int i = 0; i < _factories.size(); i++)
+ {
+ EndpointFactory f = _factories.get(i);
+ if(f.type() == factory.type())
+ {
+ assert(false);
+ }
+ }
+ _factories.add(factory);
+ }
+
+ public synchronized EndpointFactory get(short type)
+ {
+ for(int i = 0; i < _factories.size(); i++)
+ {
+ EndpointFactory f = _factories.get(i);
+ if(f.type() == type)
+ {
+ return f;
+ }
+ }
+ return null;
+ }
+
+ public synchronized EndpointI create(String str, boolean oaEndpoint)
+ {
+ String[] arr = com.zeroc.IceUtilInternal.StringUtil.splitString(str, " \t\r\n");
+ if(arr == null)
+ {
+ com.zeroc.Ice.EndpointParseException e = new com.zeroc.Ice.EndpointParseException();
+ e.str = "mismatched quote";
+ throw e;
+ }
+
+ if(arr.length == 0)
+ {
+ com.zeroc.Ice.EndpointParseException e = new com.zeroc.Ice.EndpointParseException();
+ e.str = "value has no non-whitespace characters";
+ throw e;
+ }
+
+ java.util.ArrayList<String> v = new java.util.ArrayList<>(java.util.Arrays.asList(arr));
+ String protocol = v.get(0);
+ v.remove(0);
+
+ if(protocol.equals("default"))
+ {
+ protocol = _instance.defaultsAndOverrides().defaultProtocol;
+ }
+
+ EndpointFactory factory = null;
+
+ for(int i = 0; i < _factories.size(); i++)
+ {
+ EndpointFactory f = _factories.get(i);
+ if(f.protocol().equals(protocol))
+ {
+ factory = f;
+ }
+ }
+
+ if(factory != null)
+ {
+ EndpointI e = factory.create(v, oaEndpoint);
+ if(!v.isEmpty())
+ {
+ com.zeroc.Ice.EndpointParseException ex = new com.zeroc.Ice.EndpointParseException();
+ ex.str = "unrecognized argument `" + v.get(0) + "' in endpoint `" + str + "'";
+ throw ex;
+ }
+ return e;
+
+ // Code below left in place for debugging.
+
+ /*
+ EndpointI e = f.create(s.substring(m.end()), oaEndpoint);
+ BasicStream bs = new BasicStream(_instance, true, false);
+ e.streamWrite(bs);
+ java.nio.ByteBuffer buf = bs.getBuffer();
+ buf.position(0);
+ short type = bs.readShort();
+ EndpointI ue = new OpaqueEndpointI(type, bs);
+ System.err.println("Normal: " + e);
+ System.err.println("Opaque: " + ue);
+ return e;
+ */
+ }
+
+ //
+ // If the stringified endpoint is opaque, create an unknown endpoint,
+ // then see whether the type matches one of the known endpoints.
+ //
+ if(protocol.equals("opaque"))
+ {
+ EndpointI ue = new OpaqueEndpointI(v);
+ if(!v.isEmpty())
+ {
+ com.zeroc.Ice.EndpointParseException ex = new com.zeroc.Ice.EndpointParseException();
+ ex.str = "unrecognized argument `" + v.get(0) + "' in endpoint `" + str + "'";
+ throw ex;
+ }
+ factory = get(ue.type());
+ if(factory != null)
+ {
+ //
+ // Make a temporary stream, write the opaque endpoint data into the stream,
+ // and ask the factory to read the endpoint data from that stream to create
+ // the actual endpoint.
+ //
+ com.zeroc.Ice.OutputStream os =
+ new com.zeroc.Ice.OutputStream(_instance, Protocol.currentProtocolEncoding, false);
+ os.writeShort(ue.type());
+ ue.streamWrite(os);
+ com.zeroc.Ice.InputStream is =
+ new com.zeroc.Ice.InputStream(_instance, Protocol.currentProtocolEncoding, os.getBuffer(), true);
+ is.pos(0);
+ is.readShort(); // type
+ is.startEncapsulation();
+ EndpointI e = factory.read(is);
+ is.endEncapsulation();
+ return e;
+ }
+ return ue; // Endpoint is opaque, but we don't have a factory for its type.
+ }
+
+ return null;
+ }
+
+ public synchronized EndpointI read(com.zeroc.Ice.InputStream s)
+ {
+ short type = s.readShort();
+
+ EndpointFactory factory = get(type);
+ EndpointI e = null;
+
+ s.startEncapsulation();
+
+ if(factory != null)
+ {
+ e = factory.read(s);
+ }
+ else
+ {
+ e = new OpaqueEndpointI(type, s);
+ }
+
+ s.endEncapsulation();
+
+ return e;
+ }
+
+ void destroy()
+ {
+ for(int i = 0; i < _factories.size(); i++)
+ {
+ EndpointFactory f = _factories.get(i);
+ f.destroy();
+ }
+ _factories.clear();
+ }
+
+ private Instance _instance;
+ private java.util.List<EndpointFactory> _factories = new java.util.ArrayList<>();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointHostResolver.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointHostResolver.java
new file mode 100644
index 00000000000..bdf3aceed54
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointHostResolver.java
@@ -0,0 +1,204 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+class EndpointHostResolver
+{
+ EndpointHostResolver(Instance instance)
+ {
+ _instance = instance;
+ _protocol = instance.protocolSupport();
+ _preferIPv6 = instance.preferIPv6();
+ try
+ {
+ _threadName = Util.createThreadName(_instance.initializationData().properties, "Ice.HostResolver");
+ _executor = java.util.concurrent.Executors.newFixedThreadPool(1,
+ Util.createThreadFactory(_instance.initializationData().properties, _threadName));
+ updateObserver();
+ }
+ catch(RuntimeException ex)
+ {
+ String s = "cannot create thread for endpoint host resolver thread:\n" + Ex.toString(ex);
+ _instance.initializationData().logger.error(s);
+ throw ex;
+ }
+ }
+
+ synchronized void resolve(final String host, final int port, final com.zeroc.Ice.EndpointSelectionType selType,
+ final IPEndpointI endpoint, final EndpointI_connectors callback)
+ {
+ //
+ // TODO: Optimize to avoid the lookup if the given host is a textual IPv4 or IPv6
+ // address. This requires implementing parsing of IPv4/IPv6 addresses (Java does
+ // not provide such methods).
+ //
+
+ assert(!_destroyed);
+
+ NetworkProxy networkProxy = _instance.networkProxy();
+ if(networkProxy == null)
+ {
+ java.util.List<java.net.InetSocketAddress> addrs = Network.getAddresses(host, port, _protocol, selType,
+ _preferIPv6, false);
+ if(addrs != null)
+ {
+ callback.connectors(endpoint.connectors(addrs, networkProxy));
+ return;
+ }
+ }
+
+ final com.zeroc.Ice.Instrumentation.ThreadObserver threadObserver = _observer;
+ final com.zeroc.Ice.Instrumentation.Observer observer = getObserver(endpoint);
+ if(observer != null)
+ {
+ observer.attach();
+ }
+
+ _executor.execute(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ synchronized(EndpointHostResolver.this)
+ {
+ if(_destroyed)
+ {
+ com.zeroc.Ice.CommunicatorDestroyedException ex =
+ new com.zeroc.Ice.CommunicatorDestroyedException();
+ if(observer != null)
+ {
+ observer.failed(ex.ice_id());
+ observer.detach();
+ }
+ callback.exception(ex);
+ return;
+ }
+ }
+
+ if(threadObserver != null)
+ {
+ threadObserver.stateChanged(com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateIdle,
+ com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateInUseForOther);
+ }
+
+ try
+ {
+ int protocol = _protocol;
+ NetworkProxy networkProxy = _instance.networkProxy();
+ if(networkProxy != null)
+ {
+ networkProxy = networkProxy.resolveHost(_protocol);
+ if(networkProxy != null)
+ {
+ protocol = networkProxy.getProtocolSupport();
+ }
+ }
+
+ callback.connectors(endpoint.connectors(Network.getAddresses(host,
+ port,
+ protocol,
+ selType,
+ _preferIPv6,
+ true),
+ networkProxy));
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ if(observer != null)
+ {
+ observer.failed(ex.ice_id());
+ }
+ callback.exception(ex);
+ }
+ finally
+ {
+ if(threadObserver != null)
+ {
+ threadObserver.stateChanged(
+ com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateInUseForOther,
+ com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateIdle);
+ }
+ if(observer != null)
+ {
+ observer.detach();
+ }
+ }
+ }
+ });
+ }
+
+ synchronized void destroy()
+ {
+ assert(!_destroyed);
+ _destroyed = true;
+
+ //
+ // Shutdown the executor. No new tasks will be accepted.
+ // Existing tasks will execute.
+ //
+ _executor.shutdown();
+ }
+
+ void joinWithThread()
+ throws InterruptedException
+ {
+ // Wait for the executor to terminate.
+ try
+ {
+ while(!_executor.isTerminated())
+ {
+ // A very long time.
+ _executor.awaitTermination(100000, java.util.concurrent.TimeUnit.SECONDS);
+ }
+
+ }
+ finally
+ {
+ if(_observer != null)
+ {
+ _observer.detach();
+ }
+ }
+ }
+
+ synchronized void updateObserver()
+ {
+ com.zeroc.Ice.Instrumentation.CommunicatorObserver obsv = _instance.initializationData().observer;
+ if(obsv != null)
+ {
+ _observer = obsv.getThreadObserver("Communicator", _threadName,
+ com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateIdle,
+ _observer);
+ if(_observer != null)
+ {
+ _observer.attach();
+ }
+ }
+ }
+
+ private com.zeroc.Ice.Instrumentation.Observer
+ getObserver(IPEndpointI endpoint)
+ {
+ com.zeroc.Ice.Instrumentation.CommunicatorObserver obsv = _instance.initializationData().observer;
+ if(obsv != null)
+ {
+ return obsv.getEndpointLookupObserver(endpoint);
+ }
+ return null;
+ }
+
+ private final Instance _instance;
+ private final int _protocol;
+ private final boolean _preferIPv6;
+ private boolean _destroyed;
+ private com.zeroc.Ice.Instrumentation.ThreadObserver _observer;
+ private String _threadName;
+ private java.util.concurrent.ExecutorService _executor;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointI.java
new file mode 100644
index 00000000000..f5ee93573b1
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointI.java
@@ -0,0 +1,197 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+abstract public class EndpointI implements com.zeroc.Ice.Endpoint, java.lang.Comparable<EndpointI>
+{
+ public void streamWrite(com.zeroc.Ice.OutputStream s)
+ {
+ s.startEncapsulation();
+ streamWriteImpl(s);
+ s.endEncapsulation();
+ }
+
+ @Override
+ public String toString()
+ {
+ return _toString();
+ }
+
+ @Override
+ public String _toString()
+ {
+ //
+ // WARNING: Certain features, such as proxy validation in Glacier2,
+ // depend on the format of proxy strings. Changes to toString() and
+ // methods called to generate parts of the reference string could break
+ // these features. Please review for all features that depend on the
+ // format of proxyToString() before changing this and related code.
+ //
+ return protocol() + options();
+ }
+
+ //
+ // Marshal the endpoint.
+ //
+ public abstract void streamWriteImpl(com.zeroc.Ice.OutputStream s);
+
+ //
+ // Return the endpoint type.
+ //
+ public abstract short type();
+
+ //
+ // Return the protocol name.
+ //
+ public abstract String protocol();
+
+ //
+ // Return the timeout for the endpoint in milliseconds. 0 means
+ // non-blocking, -1 means no timeout.
+ //
+ public abstract int timeout();
+
+ //
+ // Return a new endpoint with a different timeout value, provided
+ // that timeouts are supported by the endpoint. Otherwise the same
+ // endpoint is returned.
+ //
+ public abstract EndpointI timeout(int t);
+
+ //
+ // Return the connection ID
+ //
+ public abstract String connectionId();
+
+ //
+ // Return a new endpoint with a different connection id.
+ //
+ public abstract EndpointI connectionId(String connectionId);
+
+ //
+ // Return true if the endpoints support bzip2 compress, or false
+ // otherwise.
+ //
+ public abstract boolean compress();
+
+ //
+ // Return a new endpoint with a different compression value,
+ // provided that compression is supported by the
+ // endpoint. Otherwise the same endpoint is returned.
+ //
+ public abstract EndpointI compress(boolean co);
+
+ //
+ // Return true if the endpoint is datagram-based.
+ //
+ public abstract boolean datagram();
+
+ //
+ // Return true if the endpoint is secure.
+ //
+ public abstract boolean secure();
+
+ //
+ // Return a server side transceiver for this endpoint, or null if a
+ // transceiver can only be created by an acceptor.
+ //
+ public abstract Transceiver transceiver();
+
+ //
+ // Return connectors for this endpoint, or empty list if no connector
+ // is available.
+ //
+ public abstract void connectors_async(com.zeroc.Ice.EndpointSelectionType selType, EndpointI_connectors callback);
+
+ //
+ // Return an acceptor for this endpoint, or null if no acceptors
+ // is available.
+ //
+ public abstract Acceptor acceptor(String adapterName);
+
+ //
+ // Expand endpoint out in to separate endpoints for each local
+ // host if listening on INADDR_ANY.
+ //
+ public abstract java.util.List<EndpointI> expand();
+
+ //
+ // Check whether the endpoint is equivalent to another one.
+ //
+ public abstract boolean equivalent(EndpointI endpoint);
+
+ public abstract String options();
+
+ public void initWithOptions(java.util.ArrayList<String> args)
+ {
+ java.util.ArrayList<String> unknown = new java.util.ArrayList<>();
+
+ String str = "`" + protocol() + " ";
+ for(String p : args)
+ {
+ if(com.zeroc.IceUtilInternal.StringUtil.findFirstOf(p, " \t\n\r") != -1)
+ {
+ str += " \"" + p + "\"";
+ }
+ else
+ {
+ str += " " + p;
+ }
+ }
+ str += "'";
+
+ for(int n = 0; n < args.size(); ++n)
+ {
+ String option = args.get(n);
+ if(option.length() < 2 || option.charAt(0) != '-')
+ {
+ unknown.add(option);
+ continue;
+ }
+
+ String argument = null;
+ if(n + 1 < args.size() && args.get(n + 1).charAt(0) != '-')
+ {
+ argument = args.get(++n);
+ }
+
+ if(!checkOption(option, argument, str))
+ {
+ unknown.add(option);
+ if(argument != null)
+ {
+ unknown.add(argument);
+ }
+ }
+ }
+
+ args.clear();
+ args.addAll(unknown);
+ }
+
+ //
+ // Compare endpoints for sorting purposes.
+ //
+ @Override
+ public boolean equals(java.lang.Object obj)
+ {
+ if(!(obj instanceof EndpointI))
+ {
+ return false;
+ }
+ return compareTo((EndpointI)obj) == 0;
+ }
+
+ protected boolean checkOption(String option, String argument, String endpoint)
+ {
+ // Must be overridden to check for options.
+ return false;
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointIHolder.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointIHolder.java
new file mode 100644
index 00000000000..e5e8568fb65
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointIHolder.java
@@ -0,0 +1,15 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public final class EndpointIHolder
+{
+ public EndpointI value;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointI_connectors.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointI_connectors.java
new file mode 100644
index 00000000000..f3444ef8d94
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointI_connectors.java
@@ -0,0 +1,16 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public interface EndpointI_connectors
+{
+ void connectors(java.util.List<Connector> connectors);
+ void exception(com.zeroc.Ice.LocalException ex);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/EventHandler.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EventHandler.java
new file mode 100644
index 00000000000..f7e1a24e5cc
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EventHandler.java
@@ -0,0 +1,44 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public abstract class EventHandler
+{
+ //
+ // Called when there's a message ready to be processed.
+ //
+ abstract public void message(ThreadPoolCurrent current);
+
+ //
+ // Called when the event handler is unregistered.
+ //
+ abstract public void finished(ThreadPoolCurrent current, boolean close);
+
+ //
+ // Get a textual representation of the event handler.
+ //
+ @Override
+ abstract public String toString();
+
+ //
+ // Get the native information of the handler, this is used by the selector.
+ //
+ abstract public java.nio.channels.SelectableChannel fd();
+
+ //
+ // Set the ready callback
+ //
+ abstract public void setReadyCallback(ReadyCallback callback);
+
+ public int _disabled = 0;
+ public int _registered = 0;
+ public int _ready = 0;
+ public java.nio.channels.SelectionKey _key = null;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/EventHandlerOpPair.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EventHandlerOpPair.java
new file mode 100644
index 00000000000..bef7d5e9cf6
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EventHandlerOpPair.java
@@ -0,0 +1,22 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+class EventHandlerOpPair
+{
+ EventHandlerOpPair(EventHandler handler, int op)
+ {
+ this.handler = handler;
+ this.op = op;
+ }
+
+ EventHandler handler;
+ int op;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Ex.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Ex.java
new file mode 100644
index 00000000000..0880a697bae
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Ex.java
@@ -0,0 +1,49 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class Ex
+{
+ public static void throwUOE(String expectedType, com.zeroc.Ice.Value v)
+ {
+ //
+ // If the object is an unknown sliced object, we didn't find an
+ // value factory, in this case raise a NoValueFactoryException
+ // instead.
+ //
+ if(v instanceof com.zeroc.Ice.UnknownSlicedValue)
+ {
+ com.zeroc.Ice.UnknownSlicedValue usv = (com.zeroc.Ice.UnknownSlicedValue)v;
+ throw new com.zeroc.Ice.NoValueFactoryException("", usv.getUnknownTypeId());
+ }
+
+ String type = v.ice_id();
+ throw new com.zeroc.Ice.UnexpectedObjectException(
+ "expected element of type `" + expectedType + "' but received '" + type, type, expectedType);
+ }
+
+ public static void throwMemoryLimitException(int requested, int maximum)
+ {
+ throw new com.zeroc.Ice.MemoryLimitException(
+ "requested " + requested + " bytes, maximum allowed is " + maximum + " bytes (see Ice.MessageSizeMax)");
+ }
+
+ //
+ // A small utility to get the strack trace of the exception (which also includes toString()).
+ //
+ public static String toString(java.lang.Throwable ex)
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ ex.printStackTrace(pw);
+ pw.flush();
+ return sw.toString();
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/FactoryACMMonitor.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/FactoryACMMonitor.java
new file mode 100644
index 00000000000..33da39b01dd
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/FactoryACMMonitor.java
@@ -0,0 +1,233 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+class FactoryACMMonitor implements ACMMonitor
+{
+ static class Change
+ {
+ Change(com.zeroc.Ice.ConnectionI connection, boolean remove)
+ {
+ this.connection = connection;
+ this.remove = remove;
+ }
+
+ final com.zeroc.Ice.ConnectionI connection;
+ final boolean remove;
+ }
+
+ FactoryACMMonitor(Instance instance, ACMConfig config)
+ {
+ _instance = instance;
+ _config = config;
+ }
+
+ @Override
+ protected synchronized void
+ finalize()
+ throws Throwable
+ {
+ try
+ {
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_instance == null);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_connections.isEmpty());
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_changes.isEmpty());
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_reapedConnections.isEmpty());
+ }
+ catch(java.lang.Exception ex)
+ {
+ }
+ finally
+ {
+ super.finalize();
+ }
+ }
+
+ synchronized void
+ destroy()
+ {
+ if(_instance == null)
+ {
+ return;
+ }
+ _instance = null;
+ _connections.clear();
+ _changes.clear();
+ }
+
+ @Override
+ public void
+ add(com.zeroc.Ice.ConnectionI connection)
+ {
+ if(_config.timeout == 0)
+ {
+ return;
+ }
+
+ synchronized(this)
+ {
+ if(_connections.isEmpty())
+ {
+ _connections.add(connection);
+ assert _future == null;
+ _future = _instance.timer().scheduleAtFixedRate(new Runnable() {
+ @Override
+ public void run()
+ {
+ monitorConnections();
+ }
+ },
+ _config.timeout / 2, _config.timeout / 2, java.util.concurrent.TimeUnit.MILLISECONDS);
+ }
+ else
+ {
+ _changes.add(new Change(connection, false));
+ }
+ }
+ }
+
+ @Override
+ public void
+ remove(com.zeroc.Ice.ConnectionI connection)
+ {
+ if(_config.timeout == 0)
+ {
+ return;
+ }
+
+ synchronized(this)
+ {
+ assert(_instance != null);
+ _changes.add(new Change(connection, true));
+ }
+ }
+
+ @Override
+ public synchronized void
+ reap(com.zeroc.Ice.ConnectionI connection)
+ {
+ _reapedConnections.add(connection);
+ }
+
+ @Override
+ public synchronized ACMMonitor
+ acm(java.util.OptionalInt timeout, java.util.Optional<com.zeroc.Ice.ACMClose> close,
+ java.util.Optional<com.zeroc.Ice.ACMHeartbeat> heartbeat)
+ {
+ assert(_instance != null);
+
+ ACMConfig config = _config.clone();
+ if(timeout != null && timeout.isPresent())
+ {
+ config.timeout = timeout.getAsInt() * 1000; // To milliseconds
+ }
+ if(close != null && close.isPresent())
+ {
+ config.close = close.get();
+ }
+ if(heartbeat != null && heartbeat.isPresent())
+ {
+ config.heartbeat = heartbeat.get();
+ }
+ return new ConnectionACMMonitor(this, _instance.timer(), config);
+ }
+
+ @Override
+ public com.zeroc.Ice.ACM
+ getACM()
+ {
+ com.zeroc.Ice.ACM acm = new com.zeroc.Ice.ACM();
+ acm.timeout = _config.timeout / 1000;
+ acm.close = _config.close;
+ acm.heartbeat = _config.heartbeat;
+ return acm;
+ }
+
+ synchronized java.util.List<com.zeroc.Ice.ConnectionI>
+ swapReapedConnections()
+ {
+ if(_reapedConnections.isEmpty())
+ {
+ return null;
+ }
+ java.util.List<com.zeroc.Ice.ConnectionI> connections = _reapedConnections;
+ _reapedConnections = new java.util.ArrayList<>();
+ return connections;
+ }
+
+ private void
+ monitorConnections()
+ {
+ synchronized(this)
+ {
+ if(_instance == null)
+ {
+ return;
+ }
+
+ for(Change change : _changes)
+ {
+ if(change.remove)
+ {
+ _connections.remove(change.connection);
+ }
+ else
+ {
+ _connections.add(change.connection);
+ }
+ }
+ _changes.clear();
+
+ if(_connections.isEmpty())
+ {
+ _future.cancel(false);
+ _future = null;
+ return;
+ }
+ }
+
+
+ //
+ // Monitor connections outside the thread synchronization, so
+ // that connections can be added or removed during monitoring.
+ //
+ long now = Time.currentMonotonicTimeMillis();
+ for(com.zeroc.Ice.ConnectionI connection : _connections)
+ {
+ try
+ {
+ connection.monitor(now, _config);
+ }
+ catch(Exception ex)
+ {
+ handleException(ex);
+ }
+ }
+ }
+
+ synchronized void
+ handleException(Exception ex)
+ {
+ if(_instance == null)
+ {
+ return;
+ }
+ _instance.initializationData().logger.error("exception in connection monitor:\n" + ex);
+ }
+
+ private Instance _instance;
+ final private ACMConfig _config;
+
+ private java.util.Set<com.zeroc.Ice.ConnectionI> _connections = new java.util.HashSet<>();
+ private java.util.List<Change> _changes = new java.util.ArrayList<>();
+ private java.util.List<com.zeroc.Ice.ConnectionI> _reapedConnections = new java.util.ArrayList<>();
+ private java.util.concurrent.Future<?> _future;
+}
+
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/FixedReference.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/FixedReference.java
new file mode 100644
index 00000000000..a861857bf4d
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/FixedReference.java
@@ -0,0 +1,320 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class FixedReference extends Reference
+{
+ public
+ FixedReference(Instance instance,
+ com.zeroc.Ice.Communicator communicator,
+ com.zeroc.Ice.Identity identity,
+ String facet,
+ int mode,
+ boolean secure,
+ com.zeroc.Ice.EncodingVersion encoding,
+ com.zeroc.Ice.ConnectionI connection)
+ {
+ super(instance, communicator, identity, facet, mode, secure, com.zeroc.Ice.Util.Protocol_1_0, encoding, -1,
+ null);
+ _fixedConnection = connection;
+ }
+
+ @Override
+ public EndpointI[]
+ getEndpoints()
+ {
+ return _emptyEndpoints;
+ }
+
+ @Override
+ public String
+ getAdapterId()
+ {
+ return "";
+ }
+
+ @Override
+ public LocatorInfo
+ getLocatorInfo()
+ {
+ return null;
+ }
+
+ @Override
+ public RouterInfo
+ getRouterInfo()
+ {
+ return null;
+ }
+
+ @Override
+ public boolean
+ getCollocationOptimized()
+ {
+ return false;
+ }
+
+ @Override
+ public final boolean
+ getCacheConnection()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean
+ getPreferSecure()
+ {
+ return false;
+ }
+
+ @Override
+ public final com.zeroc.Ice.EndpointSelectionType
+ getEndpointSelection()
+ {
+ return com.zeroc.Ice.EndpointSelectionType.Random;
+ }
+
+ @Override
+ public int
+ getLocatorCacheTimeout()
+ {
+ return 0;
+ }
+
+ @Override
+ public String
+ getConnectionId()
+ {
+ return "";
+ }
+
+ @Override
+ public Reference
+ changeEndpoints(EndpointI[] newEndpoints)
+ {
+ throw new com.zeroc.Ice.FixedProxyException();
+ }
+
+ @Override
+ public Reference
+ changeAdapterId(String newAdapterId)
+ {
+ throw new com.zeroc.Ice.FixedProxyException();
+ }
+
+ @Override
+ public Reference
+ changeLocator(com.zeroc.Ice.LocatorPrx newLocator)
+ {
+ throw new com.zeroc.Ice.FixedProxyException();
+ }
+
+ @Override
+ public Reference
+ changeRouter(com.zeroc.Ice.RouterPrx newRouter)
+ {
+ throw new com.zeroc.Ice.FixedProxyException();
+ }
+
+ @Override
+ public Reference
+ changeCollocationOptimized(boolean newCollocationOptimized)
+ {
+ throw new com.zeroc.Ice.FixedProxyException();
+ }
+
+ @Override
+ public final Reference
+ changeCacheConnection(boolean newCache)
+ {
+ throw new com.zeroc.Ice.FixedProxyException();
+ }
+
+ @Override
+ public Reference
+ changePreferSecure(boolean prefSec)
+ {
+ throw new com.zeroc.Ice.FixedProxyException();
+ }
+
+ @Override
+ public final Reference
+ changeEndpointSelection(com.zeroc.Ice.EndpointSelectionType newType)
+ {
+ throw new com.zeroc.Ice.FixedProxyException();
+ }
+
+ @Override
+ public Reference
+ changeLocatorCacheTimeout(int newTimeout)
+ {
+ throw new com.zeroc.Ice.FixedProxyException();
+ }
+
+ @Override
+ public Reference
+ changeTimeout(int newTimeout)
+ {
+ throw new com.zeroc.Ice.FixedProxyException();
+ }
+
+ @Override
+ public Reference
+ changeConnectionId(String connectionId)
+ {
+ throw new com.zeroc.Ice.FixedProxyException();
+ }
+
+ @Override
+ public boolean
+ isIndirect()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean
+ isWellKnown()
+ {
+ return false;
+ }
+
+ @Override
+ public void
+ streamWrite(com.zeroc.Ice.OutputStream s)
+ throws com.zeroc.Ice.MarshalException
+ {
+ throw new com.zeroc.Ice.FixedProxyException();
+ }
+
+ @Override
+ public String
+ toString()
+ throws com.zeroc.Ice.MarshalException
+ {
+ throw new com.zeroc.Ice.FixedProxyException();
+ }
+
+ @Override
+ public java.util.Map<String, String>
+ toProperty(String prefix)
+ {
+ throw new com.zeroc.Ice.FixedProxyException();
+ }
+
+ @Override
+ public RequestHandler
+ getRequestHandler(com.zeroc.Ice._ObjectPrxI proxy)
+ {
+ switch(getMode())
+ {
+ case Reference.ModeTwoway:
+ case Reference.ModeOneway:
+ case Reference.ModeBatchOneway:
+ {
+ if(_fixedConnection.endpoint().datagram())
+ {
+ throw new com.zeroc.Ice.NoEndpointException("");
+ }
+ break;
+ }
+
+ case Reference.ModeDatagram:
+ case Reference.ModeBatchDatagram:
+ {
+ if(!_fixedConnection.endpoint().datagram())
+ {
+ throw new com.zeroc.Ice.NoEndpointException("");
+ }
+ break;
+ }
+ }
+
+ //
+ // If a secure connection is requested or secure overrides is set,
+ // check if the connection is secure.
+ //
+ boolean secure;
+ DefaultsAndOverrides defaultsAndOverrides = getInstance().defaultsAndOverrides();
+ if(defaultsAndOverrides.overrideSecure)
+ {
+ secure = defaultsAndOverrides.overrideSecureValue;
+ }
+ else
+ {
+ secure = getSecure();
+ }
+ if(secure && !_fixedConnection.endpoint().secure())
+ {
+ throw new com.zeroc.Ice.NoEndpointException("");
+ }
+
+ _fixedConnection.throwException(); // Throw in case our connection is already destroyed.
+
+ boolean compress;
+ if(defaultsAndOverrides.overrideCompress)
+ {
+ compress = defaultsAndOverrides.overrideCompressValue;
+ }
+ else if(_overrideCompress)
+ {
+ compress = _compress;
+ }
+ else
+ {
+ compress = _fixedConnection.endpoint().compress();
+ }
+
+ RequestHandler handler = new ConnectionRequestHandler(this, _fixedConnection, compress);
+ if(getInstance().queueRequests())
+ {
+ handler = new QueueRequestHandler(getInstance(), handler);
+ }
+ return proxy.__setRequestHandler(handler);
+ }
+
+ @Override
+ public BatchRequestQueue
+ getBatchRequestQueue()
+ {
+ return _fixedConnection.getBatchRequestQueue();
+ }
+
+ @Override
+ public boolean
+ equals(java.lang.Object obj)
+ {
+ if(this == obj)
+ {
+ return true;
+ }
+ if(!(obj instanceof FixedReference))
+ {
+ return false;
+ }
+ FixedReference rhs = (FixedReference)obj;
+ if(!super.equals(rhs))
+ {
+ return false;
+ }
+ return _fixedConnection.equals(rhs._fixedConnection);
+ }
+
+ @Override
+ public int
+ hashCode()
+ {
+ return super.hashCode();
+ }
+
+ private com.zeroc.Ice.ConnectionI _fixedConnection;
+ private static EndpointI[] _emptyEndpoints = new EndpointI[0];
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/HTTPNetworkProxy.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/HTTPNetworkProxy.java
new file mode 100644
index 00000000000..0cf95aa34e2
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/HTTPNetworkProxy.java
@@ -0,0 +1,135 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public final class HTTPNetworkProxy implements NetworkProxy
+{
+ public HTTPNetworkProxy(String host, int port)
+ {
+ _host = host;
+ _port = port;
+ _protocolSupport = Network.EnableBoth;
+ }
+
+ private HTTPNetworkProxy(java.net.InetSocketAddress address, int protocolSupport)
+ {
+ _address = address;
+ _protocolSupport = protocolSupport;
+ }
+
+ @Override
+ public void beginWrite(java.net.InetSocketAddress endpoint, Buffer buf)
+ {
+ String addr = Network.addrToString(endpoint);
+ StringBuilder str = new StringBuilder();
+ str.append("CONNECT ");
+ str.append(addr);
+ str.append(" HTTP/1.1\r\nHost: ");
+ str.append(addr);
+ str.append("\r\n\r\n");
+
+ byte[] b = str.toString().getBytes(java.nio.charset.StandardCharsets.US_ASCII);
+
+ //
+ // HTTP connect request
+ //
+ buf.resize(b.length, false);
+ buf.b.position(0);
+ buf.b.put(b);
+ buf.b.position(0);
+ buf.b.limit(buf.size());
+ }
+
+ @Override
+ public int endWrite(Buffer buf)
+ {
+ // Once the request is sent, read the response
+ return buf.b.hasRemaining() ? SocketOperation.Write : SocketOperation.Read;
+ }
+
+ @Override
+ public void beginRead(Buffer buf)
+ {
+ //
+ // Read the HTTP response
+ //
+ buf.resize(7, true); // Enough space for reading at least HTTP1.1
+ buf.b.position(0);
+ }
+
+ @Override
+ public int endRead(Buffer buf)
+ {
+ //
+ // Check if we received the full HTTP response, if not, continue
+ // reading otherwise we're done.
+ //
+ int end = new HttpParser().isCompleteMessage(buf.b, 0, buf.b.position());
+ if(end < 0 && !buf.b.hasRemaining())
+ {
+ //
+ // Read one more byte, we can't easily read bytes in advance
+ // since the transport implenentation might be be able to read
+ // the data from the memory instead of the socket.
+ //
+ buf.resize(buf.size() + 1, true);
+ return SocketOperation.Read;
+ }
+ return SocketOperation.None;
+ }
+
+ @Override
+ public void finish(Buffer readBuffer, Buffer writeBuffer)
+ {
+ HttpParser parser = new HttpParser();
+ parser.parse(readBuffer.b, 0, readBuffer.b.position());
+ if(parser.status() != 200)
+ {
+ throw new com.zeroc.Ice.ConnectFailedException();
+ }
+ }
+
+ @Override
+ public NetworkProxy resolveHost(int protocol)
+ {
+ assert(_host != null);
+ return new HTTPNetworkProxy(Network.getAddresses(_host,
+ _port,
+ protocol,
+ com.zeroc.Ice.EndpointSelectionType.Random,
+ false,
+ true).get(0),
+ protocol);
+ }
+
+ @Override
+ public java.net.InetSocketAddress getAddress()
+ {
+ assert(_address != null); // Host must be resolved.
+ return _address;
+ }
+
+ @Override
+ public String getName()
+ {
+ return "HTTP";
+ }
+
+ @Override
+ public int getProtocolSupport()
+ {
+ return _protocolSupport;
+ }
+
+ private String _host;
+ private int _port;
+ private java.net.InetSocketAddress _address;
+ private int _protocolSupport;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/HashUtil.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/HashUtil.java
new file mode 100644
index 00000000000..8c88f0d6695
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/HashUtil.java
@@ -0,0 +1,120 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public final class HashUtil
+{
+ public static int
+ hashAdd(int hashCode, boolean value)
+ {
+ return ((hashCode << 5) + hashCode) ^ (value ? 0 : 1);
+ }
+
+ public static int
+ hashAdd(int hashCode, short value)
+ {
+ return ((hashCode << 5) + hashCode) ^ (int)(2654435761l * value);
+ }
+
+ public static int
+ hashAdd(int hashCode, byte value)
+ {
+ return ((hashCode << 5) + hashCode) ^ (int)(2654435761l * value);
+ }
+
+ public static int
+ hashAdd(int hashCode, int value)
+ {
+ return ((hashCode << 5) + hashCode) ^ (int)(2654435761l * value);
+ }
+
+ public static int
+ hashAdd(int hashCode, long value)
+ {
+ return ((hashCode << 5) + hashCode) ^ (int)(value ^ (value >>> 32));
+ }
+
+ public static int
+ hashAdd(int hashCode, float value)
+ {
+ return ((hashCode << 5) + hashCode) ^ Float.floatToIntBits(value);
+ }
+
+ public static int
+ hashAdd(int hashCode, double value)
+ {
+ long v = Double.doubleToLongBits(value);
+ return ((hashCode << 5) + hashCode) ^ (int)(v ^ (v >>> 32));
+ }
+
+ public static int
+ hashAdd(int hashCode, java.lang.Object value)
+ {
+ if(value != null)
+ {
+ hashCode = ((hashCode << 5) + hashCode) ^ value.hashCode();
+ }
+ return hashCode;
+ }
+
+ public static int
+ hashAdd(int hashCode, boolean[] arr)
+ {
+ return ((hashCode << 5) + hashCode) ^ java.util.Arrays.hashCode(arr);
+ }
+
+ public static int
+ hashAdd(int hashCode, byte[] arr)
+ {
+ return ((hashCode << 5) + hashCode) ^ java.util.Arrays.hashCode(arr);
+ }
+
+ public static int
+ hashAdd(int hashCode, char[] arr)
+ {
+ return ((hashCode << 5) + hashCode) ^ java.util.Arrays.hashCode(arr);
+ }
+
+ public static int
+ hashAdd(int hashCode, double[] arr)
+ {
+ return ((hashCode << 5) + hashCode) ^ java.util.Arrays.hashCode(arr);
+ }
+
+ public static int
+ hashAdd(int hashCode, float[] arr)
+ {
+ return ((hashCode << 5) + hashCode) ^ java.util.Arrays.hashCode(arr);
+ }
+
+ public static int
+ hashAdd(int hashCode, int[] arr)
+ {
+ return ((hashCode << 5) + hashCode) ^ java.util.Arrays.hashCode(arr);
+ }
+
+ public static int
+ hashAdd(int hashCode, long[] arr)
+ {
+ return ((hashCode << 5) + hashCode) ^ java.util.Arrays.hashCode(arr);
+ }
+
+ public static int
+ hashAdd(int hashCode, Object[] arr)
+ {
+ return ((hashCode << 5) + hashCode) ^ java.util.Arrays.hashCode(arr);
+ }
+
+ public static int
+ hashAdd(int hashCode, short[] arr)
+ {
+ return ((hashCode << 5) + hashCode) ^ java.util.Arrays.hashCode(arr);
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Holder.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Holder.java
new file mode 100644
index 00000000000..bd21a9a2042
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Holder.java
@@ -0,0 +1,24 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class Holder<T>
+{
+ public Holder()
+ {
+ }
+
+ public Holder(T value)
+ {
+ this.value = value;
+ }
+
+ public T value;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/HttpParser.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/HttpParser.java
new file mode 100644
index 00000000000..ebaed1fe646
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/HttpParser.java
@@ -0,0 +1,732 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+final class HttpParser
+{
+ HttpParser()
+ {
+ _type = Type.Unknown;
+ _versionMajor = 0;
+ _versionMinor = 0;
+ _status = 0;
+ _state = State.Init;
+ }
+
+ private enum Type
+ {
+ Unknown,
+ Request,
+ Response
+ }
+
+ int isCompleteMessage(java.nio.ByteBuffer buf, int begin, int end)
+ {
+ int p = begin;
+
+ //
+ // Skip any leading CR-LF characters.
+ //
+ while(p < end)
+ {
+ byte ch = buf.get(p);
+ if(ch != (byte)'\r' && ch != (byte)'\n')
+ {
+ break;
+ }
+ ++p;
+ }
+
+ //
+ // Look for adjacent CR-LF/CR-LF or LF/LF.
+ //
+ boolean seenFirst = false;
+ while(p < end)
+ {
+ byte ch = buf.get(p++);
+ if(ch == (byte)'\n')
+ {
+ if(seenFirst)
+ {
+ return p;
+ }
+ else
+ {
+ seenFirst = true;
+ }
+ }
+ else if(ch != (byte)'\r')
+ {
+ seenFirst = false;
+ }
+ }
+
+ return -1;
+ }
+
+ boolean parse(java.nio.ByteBuffer buf, int begin, int end)
+ {
+ int p = begin;
+ int start = 0;
+ final char CR = '\r';
+ final char LF = '\n';
+
+ if(_state == State.Complete)
+ {
+ _state = State.Init;
+ }
+
+ while(p != end && _state != State.Complete)
+ {
+ char c = (char)buf.get(p);
+
+ switch(_state)
+ {
+ case Init:
+ {
+ _method.setLength(0);
+ _uri.setLength(0);
+ _versionMajor = -1;
+ _versionMinor = -1;
+ _status = -1;
+ _reason = "";
+ _headers.clear();
+ _state = State.Type;
+ continue;
+ }
+ case Type:
+ {
+ if(c == CR || c == LF)
+ {
+ break;
+ }
+ else if(c == 'H')
+ {
+ //
+ // Could be the start of "HTTP/1.1" or "HEAD".
+ //
+ _state = State.TypeCheck;
+ break;
+ }
+ else
+ {
+ _state = State.Request;
+ continue;
+ }
+ }
+ case TypeCheck:
+ {
+ if(c == 'T') // Continuing "H_T_TP/1.1"
+ {
+ _state = State.Response;
+ }
+ else if(c == 'E') // Expecting "HEAD"
+ {
+ _state = State.Request;
+ _method.append('H');
+ _method.append('E');
+ }
+ else
+ {
+ throw new WebSocketException("malformed request or response");
+ }
+ break;
+ }
+ case Request:
+ {
+ _type = Type.Request;
+ _state = State.RequestMethod;
+ continue;
+ }
+ case RequestMethod:
+ {
+ if(c == ' ' || c == CR || c == LF)
+ {
+ _state = State.RequestMethodSP;
+ continue;
+ }
+ _method.append(c);
+ break;
+ }
+ case RequestMethodSP:
+ {
+ if(c == ' ')
+ {
+ break;
+ }
+ else if(c == CR || c == LF)
+ {
+ throw new WebSocketException("malformed request");
+ }
+ _state = State.RequestURI;
+ continue;
+ }
+ case RequestURI:
+ {
+ if(c == ' ' || c == CR || c == LF)
+ {
+ _state = State.RequestURISP;
+ continue;
+ }
+ _uri.append(c);
+ break;
+ }
+ case RequestURISP:
+ {
+ if(c == ' ')
+ {
+ break;
+ }
+ else if(c == CR || c == LF)
+ {
+ throw new WebSocketException("malformed request");
+ }
+ _state = State.Version;
+ continue;
+ }
+ case RequestLF:
+ {
+ if(c != LF)
+ {
+ throw new WebSocketException("malformed request");
+ }
+ _state = State.HeaderFieldStart;
+ break;
+ }
+ case HeaderFieldStart:
+ {
+ //
+ // We've already seen a LF to reach this state.
+ //
+ // Another CR or LF indicates the end of the header fields.
+ //
+ if(c == CR)
+ {
+ _state = State.HeaderFieldEndLF;
+ break;
+ }
+ else if(c == LF)
+ {
+ _state = State.Complete;
+ break;
+ }
+ else if(c == ' ')
+ {
+ //
+ // Could be a continuation line.
+ //
+ _state = State.HeaderFieldContStart;
+ break;
+ }
+
+ _state = State.HeaderFieldNameStart;
+ continue;
+ }
+ case HeaderFieldContStart:
+ {
+ if(c == ' ')
+ {
+ break;
+ }
+
+ _state = State.HeaderFieldCont;
+ start = p;
+ continue;
+ }
+ case HeaderFieldCont:
+ {
+ if(c == CR || c == LF)
+ {
+ if(p > start)
+ {
+ if(_headerName.isEmpty())
+ {
+ throw new WebSocketException("malformed header");
+ }
+ String s = _headers.get(_headerName);
+ assert(s != null);
+ StringBuffer newValue = new StringBuffer(s);
+ newValue.append(' ');
+ for(int i = start; i < p; ++i)
+ {
+ newValue.append((char)buf.get(i));
+ }
+ _headers.put(_headerName, newValue.toString());
+ _state = c == CR ? State.HeaderFieldLF : State.HeaderFieldStart;
+ }
+ else
+ {
+ //
+ // Could mark the end of the header fields.
+ //
+ _state = c == CR ? State.HeaderFieldEndLF : State.Complete;
+ }
+ }
+
+ break;
+ }
+ case HeaderFieldNameStart:
+ {
+ assert(c != ' ');
+ start = p;
+ _headerName = "";
+ _state = State.HeaderFieldName;
+ continue;
+ }
+ case HeaderFieldName:
+ {
+ if(c == ' ' || c == ':')
+ {
+ _state = State.HeaderFieldNameEnd;
+ continue;
+ }
+ else if(c == CR || c == LF)
+ {
+ throw new WebSocketException("malformed header");
+ }
+ break;
+ }
+ case HeaderFieldNameEnd:
+ {
+ if(_headerName.isEmpty())
+ {
+ StringBuffer str = new StringBuffer();
+ for(int i = start; i < p; ++i)
+ {
+ str.append((char)buf.get(i));
+ }
+ _headerName = str.toString().toLowerCase();
+ //
+ // Add a placeholder entry if necessary.
+ //
+ if(!_headers.containsKey(_headerName))
+ {
+ _headers.put(_headerName, "");
+ _headerNames.put(_headerName, str.toString());
+ }
+ }
+
+ if(c == ' ')
+ {
+ break;
+ }
+ else if(c != ':' || p == start)
+ {
+ throw new WebSocketException("malformed header");
+ }
+
+ _state = State.HeaderFieldValueStart;
+ break;
+ }
+ case HeaderFieldValueStart:
+ {
+ if(c == ' ')
+ {
+ break;
+ }
+
+ //
+ // Check for "Name:\r\n"
+ //
+ if(c == CR)
+ {
+ _state = State.HeaderFieldLF;
+ break;
+ }
+ else if(c == LF)
+ {
+ _state = State.HeaderFieldStart;
+ break;
+ }
+
+ start = p;
+ _state = State.HeaderFieldValue;
+ continue;
+ }
+ case HeaderFieldValue:
+ {
+ if(c == CR || c == LF)
+ {
+ _state = State.HeaderFieldValueEnd;
+ continue;
+ }
+ break;
+ }
+ case HeaderFieldValueEnd:
+ {
+ assert(c == CR || c == LF);
+ if(p > start)
+ {
+ StringBuffer str = new StringBuffer();
+ for(int i = start; i < p; ++i)
+ {
+ str.append((char)buf.get(i));
+ }
+ String s = _headers.get(_headerName);
+ if(s == null || s.length() == 0)
+ {
+ _headers.put(_headerName, str.toString());
+ }
+ else
+ {
+ _headers.put(_headerName, s + ", " + str.toString());
+ }
+ }
+
+ if(c == CR)
+ {
+ _state = State.HeaderFieldLF;
+ }
+ else
+ {
+ _state = State.HeaderFieldStart;
+ }
+ break;
+ }
+ case HeaderFieldLF:
+ {
+ if(c != LF)
+ {
+ throw new WebSocketException("malformed header");
+ }
+ _state = State.HeaderFieldStart;
+ break;
+ }
+ case HeaderFieldEndLF:
+ {
+ if(c != LF)
+ {
+ throw new WebSocketException("malformed header");
+ }
+ _state = State.Complete;
+ break;
+ }
+ case Version:
+ {
+ if(c != 'H')
+ {
+ throw new WebSocketException("malformed version");
+ }
+ _state = State.VersionH;
+ break;
+ }
+ case VersionH:
+ {
+ if(c != 'T')
+ {
+ throw new WebSocketException("malformed version");
+ }
+ _state = State.VersionHT;
+ break;
+ }
+ case VersionHT:
+ {
+ if(c != 'T')
+ {
+ throw new WebSocketException("malformed version");
+ }
+ _state = State.VersionHTT;
+ break;
+ }
+ case VersionHTT:
+ {
+ if(c != 'P')
+ {
+ throw new WebSocketException("malformed version");
+ }
+ _state = State.VersionHTTP;
+ break;
+ }
+ case VersionHTTP:
+ {
+ if(c != '/')
+ {
+ throw new WebSocketException("malformed version");
+ }
+ _state = State.VersionMajor;
+ break;
+ }
+ case VersionMajor:
+ {
+ if(c == '.')
+ {
+ if(_versionMajor == -1)
+ {
+ throw new WebSocketException("malformed version");
+ }
+ _state = State.VersionMinor;
+ break;
+ }
+ else if(c < '0' || c > '9')
+ {
+ throw new WebSocketException("malformed version");
+ }
+ if(_versionMajor == -1)
+ {
+ _versionMajor = 0;
+ }
+ _versionMajor *= 10;
+ _versionMajor += c - '0';
+ break;
+ }
+ case VersionMinor:
+ {
+ if(c == CR)
+ {
+ if(_versionMinor == -1 || _type != Type.Request)
+ {
+ throw new WebSocketException("malformed version");
+ }
+ _state = State.RequestLF;
+ break;
+ }
+ else if(c == LF)
+ {
+ if(_versionMinor == -1 || _type != Type.Request)
+ {
+ throw new WebSocketException("malformed version");
+ }
+ _state = State.HeaderFieldStart;
+ break;
+ }
+ else if(c == ' ')
+ {
+ if(_versionMinor == -1 || _type != Type.Response)
+ {
+ throw new WebSocketException("malformed version");
+ }
+ _state = State.ResponseVersionSP;
+ break;
+ }
+ else if(c < '0' || c > '9')
+ {
+ throw new WebSocketException("malformed version");
+ }
+ if(_versionMinor == -1)
+ {
+ _versionMinor = 0;
+ }
+ _versionMinor *= 10;
+ _versionMinor += c - '0';
+ break;
+ }
+ case Response:
+ {
+ _type = Type.Response;
+ _state = State.VersionHT;
+ continue;
+ }
+ case ResponseVersionSP:
+ {
+ if(c == ' ')
+ {
+ break;
+ }
+
+ _state = State.ResponseStatus;
+ continue;
+ }
+ case ResponseStatus:
+ {
+ // TODO: Is reason string optional?
+ if(c == CR)
+ {
+ if(_status == -1)
+ {
+ throw new WebSocketException("malformed response status");
+ }
+ _state = State.ResponseLF;
+ break;
+ }
+ else if(c == LF)
+ {
+ if(_status == -1)
+ {
+ throw new WebSocketException("malformed response status");
+ }
+ _state = State.HeaderFieldStart;
+ break;
+ }
+ else if(c == ' ')
+ {
+ if(_status == -1)
+ {
+ throw new WebSocketException("malformed response status");
+ }
+ _state = State.ResponseReasonStart;
+ break;
+ }
+ else if(c < '0' || c > '9')
+ {
+ throw new WebSocketException("malformed response status");
+ }
+ if(_status == -1)
+ {
+ _status = 0;
+ }
+ _status *= 10;
+ _status += c - '0';
+ break;
+ }
+ case ResponseReasonStart:
+ {
+ //
+ // Skip leading spaces.
+ //
+ if(c == ' ')
+ {
+ break;
+ }
+
+ _state = State.ResponseReason;
+ start = p;
+ continue;
+ }
+ case ResponseReason:
+ {
+ if(c == CR || c == LF)
+ {
+ if(p > start)
+ {
+ StringBuffer str = new StringBuffer();
+ for(int i = start; i < p; ++i)
+ {
+ str.append((char)buf.get(i));
+ }
+ _reason = str.toString();
+ }
+ _state = c == CR ? State.ResponseLF : State.HeaderFieldStart;
+ }
+
+ break;
+ }
+ case ResponseLF:
+ {
+ if(c != LF)
+ {
+ throw new WebSocketException("malformed status line");
+ }
+ _state = State.HeaderFieldStart;
+ break;
+ }
+ case Complete:
+ {
+ assert(false); // Shouldn't reach
+ }
+ }
+
+ ++p;
+ }
+
+ return _state == State.Complete;
+ }
+
+ String uri()
+ {
+ assert(_type == Type.Request);
+ return _uri.toString();
+ }
+
+ int versionMajor()
+ {
+ return _versionMajor;
+ }
+
+ int versionMinor()
+ {
+ return _versionMinor;
+ }
+
+ int status()
+ {
+ return _status;
+ }
+
+ String reason()
+ {
+ return _reason;
+ }
+
+ String getHeader(String name, boolean toLower)
+ {
+ String s = _headers.get(name.toLowerCase());
+ if(s != null)
+ {
+ return toLower ? s.trim().toLowerCase() : s.trim();
+ }
+
+ return null;
+ }
+
+ java.util.Map<String, String> getHeaders()
+ {
+ java.util.Map<String, String> headers = new java.util.HashMap<>();
+ for(java.util.Map.Entry<String, String> entry : _headers.entrySet())
+ {
+ headers.put(_headerNames.get(entry.getKey()), entry.getValue().trim()); // Return original header name.
+ }
+ return headers;
+ }
+
+ private Type _type;
+
+ private StringBuffer _method = new StringBuffer();
+ private StringBuffer _uri = new StringBuffer();
+
+ private java.util.Map<String, String> _headers = new java.util.HashMap<>();
+ private java.util.Map<String, String> _headerNames = new java.util.HashMap<>();
+ private String _headerName = "";
+
+ private int _versionMajor;
+ private int _versionMinor;
+
+ private int _status;
+ private String _reason;
+
+ private enum State
+ {
+ Init,
+ Type,
+ TypeCheck,
+ Request,
+ RequestMethod,
+ RequestMethodSP,
+ RequestURI,
+ RequestURISP,
+ RequestLF,
+ HeaderFieldStart,
+ HeaderFieldContStart,
+ HeaderFieldCont,
+ HeaderFieldNameStart,
+ HeaderFieldName,
+ HeaderFieldNameEnd,
+ HeaderFieldValueStart,
+ HeaderFieldValue,
+ HeaderFieldValueEnd,
+ HeaderFieldLF,
+ HeaderFieldEndLF,
+ Version,
+ VersionH,
+ VersionHT,
+ VersionHTT,
+ VersionHTTP,
+ VersionMajor,
+ VersionMinor,
+ Response,
+ ResponseVersionSP,
+ ResponseStatus,
+ ResponseReasonStart,
+ ResponseReason,
+ ResponseLF,
+ Complete
+ }
+
+ private State _state;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/IPEndpointI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/IPEndpointI.java
new file mode 100644
index 00000000000..89f3d8855af
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/IPEndpointI.java
@@ -0,0 +1,380 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public abstract class IPEndpointI extends EndpointI
+{
+ protected IPEndpointI(ProtocolInstance instance, String host, int port, java.net.InetSocketAddress sourceAddr,
+ String connectionId)
+ {
+ _instance = instance;
+ _host = host;
+ _port = port;
+ _sourceAddr = sourceAddr;
+ _connectionId = connectionId;
+ _hashInitialized = false;
+ }
+
+ protected IPEndpointI(ProtocolInstance instance)
+ {
+ _instance = instance;
+ _host = null;
+ _port = 0;
+ _sourceAddr = null;
+ _connectionId = "";
+ _hashInitialized = false;
+ }
+
+ protected IPEndpointI(ProtocolInstance instance, com.zeroc.Ice.InputStream s)
+ {
+ _instance = instance;
+ _host = s.readString();
+ _port = s.readInt();
+ _sourceAddr = null;
+ _connectionId = "";
+ _hashInitialized = false;
+ }
+
+ @Override
+ public com.zeroc.Ice.EndpointInfo getInfo()
+ {
+ com.zeroc.Ice.IPEndpointInfo info = new com.zeroc.Ice.IPEndpointInfo()
+ {
+ @Override
+ public short type()
+ {
+ return IPEndpointI.this.type();
+ }
+
+ @Override
+ public boolean datagram()
+ {
+ return IPEndpointI.this.datagram();
+ }
+
+ @Override
+ public boolean secure()
+ {
+ return IPEndpointI.this.secure();
+ }
+ };
+ fillEndpointInfo(info);
+ return info;
+ }
+
+ @Override
+ public short type()
+ {
+ return _instance.type();
+ }
+
+ @Override
+ public String protocol()
+ {
+ return _instance.protocol();
+ }
+
+ @Override
+ public boolean secure()
+ {
+ return _instance.secure();
+ }
+
+ @Override
+ public String connectionId()
+ {
+ return _connectionId;
+ }
+
+ @Override
+ public EndpointI connectionId(String connectionId)
+ {
+ if(connectionId.equals(_connectionId))
+ {
+ return this;
+ }
+ else
+ {
+ return createEndpoint(_host, _port, connectionId);
+ }
+ }
+
+ @Override
+ public void connectors_async(com.zeroc.Ice.EndpointSelectionType selType, EndpointI_connectors callback)
+ {
+ _instance.resolve(_host, _port, selType, this, callback);
+ }
+
+ @Override
+ public java.util.List<EndpointI> expand()
+ {
+ java.util.List<EndpointI> endps = new java.util.ArrayList<>();
+ java.util.List<String> hosts = Network.getHostsForEndpointExpand(_host, _instance.protocolSupport(), false);
+ if(hosts == null || hosts.isEmpty())
+ {
+ endps.add(this);
+ }
+ else
+ {
+ for(String h : hosts)
+ {
+ endps.add(createEndpoint(h, _port, _connectionId));
+ }
+ }
+ return endps;
+ }
+
+ @Override
+ public boolean equivalent(EndpointI endpoint)
+ {
+ if(!(endpoint instanceof IPEndpointI))
+ {
+ return false;
+ }
+ IPEndpointI ipEndpointI = (IPEndpointI)endpoint;
+ return ipEndpointI.type() == type() && ipEndpointI._host.equals(_host) && ipEndpointI._port == _port &&
+ Network.compareAddress(ipEndpointI._sourceAddr, _sourceAddr) == 0;
+ }
+
+ public java.util.List<Connector> connectors(java.util.List<java.net.InetSocketAddress> addresses,
+ NetworkProxy proxy)
+ {
+ java.util.List<Connector> connectors = new java.util.ArrayList<>();
+ for(java.net.InetSocketAddress p : addresses)
+ {
+ connectors.add(createConnector(p, proxy));
+ }
+ return connectors;
+ }
+
+ @Override
+ synchronized public int hashCode()
+ {
+ if(!_hashInitialized)
+ {
+ _hashValue = 5381;
+ _hashValue = HashUtil.hashAdd(_hashValue, type());
+ _hashValue = hashInit(_hashValue);
+ _hashInitialized = true;
+ }
+ return _hashValue;
+ }
+
+ @Override
+ public String options()
+ {
+ //
+ // WARNING: Certain features, such as proxy validation in Glacier2,
+ // depend on the format of proxy strings. Changes to toString() and
+ // methods called to generate parts of the reference string could break
+ // these features. Please review for all features that depend on the
+ // format of proxyToString() before changing this and related code.
+ //
+ String s = "";
+
+ if(_host != null && _host.length() > 0)
+ {
+ s += " -h ";
+ boolean addQuote = _host.indexOf(':') != -1;
+ if(addQuote)
+ {
+ s += "\"";
+ }
+ s += _host;
+ if(addQuote)
+ {
+ s += "\"";
+ }
+ }
+
+ s += " -p " + _port;
+
+ if(_sourceAddr != null)
+ {
+ s += " --sourceAddress " + _sourceAddr.getAddress().getHostAddress();
+ }
+
+ return s;
+ }
+
+ @Override
+ public int compareTo(EndpointI obj) // From java.lang.Comparable
+ {
+ if(!(obj instanceof IPEndpointI))
+ {
+ return type() < obj.type() ? -1 : 1;
+ }
+
+ IPEndpointI p = (IPEndpointI)obj;
+ if(this == p)
+ {
+ return 0;
+ }
+
+ int v = _host.compareTo(p._host);
+ if(v != 0)
+ {
+ return v;
+ }
+
+ if(_port < p._port)
+ {
+ return -1;
+ }
+ else if(p._port < _port)
+ {
+ return 1;
+ }
+
+ int rc = Network.compareAddress(_sourceAddr, p._sourceAddr);
+ if(rc != 0)
+ {
+ return rc;
+ }
+
+ return _connectionId.compareTo(p._connectionId);
+ }
+
+ @Override
+ public void streamWriteImpl(com.zeroc.Ice.OutputStream s)
+ {
+ s.writeString(_host);
+ s.writeInt(_port);
+ }
+
+ public int hashInit(int h)
+ {
+ h = HashUtil.hashAdd(h, _host);
+ h = HashUtil.hashAdd(h, _port);
+ if(_sourceAddr != null)
+ {
+ h = HashUtil.hashAdd(h, _sourceAddr.getAddress().getHostAddress());
+ }
+ h = HashUtil.hashAdd(h, _connectionId);
+ return h;
+ }
+
+ public void fillEndpointInfo(com.zeroc.Ice.IPEndpointInfo info)
+ {
+ info.timeout = timeout();
+ info.compress = compress();
+ info.host = _host;
+ info.port = _port;
+ info.sourceAddress = _sourceAddr == null ? "" : _sourceAddr.getAddress().getHostAddress();
+ }
+
+ public void initWithOptions(java.util.ArrayList<String> args, boolean oaEndpoint)
+ {
+ super.initWithOptions(args);
+
+ if(_host == null || _host.length() == 0)
+ {
+ _host = _instance.defaultHost();
+ }
+ else if(_host.equals("*"))
+ {
+ if(oaEndpoint)
+ {
+ _host = "";
+ }
+ else
+ {
+ throw new com.zeroc.Ice.EndpointParseException(
+ "`-h *' not valid for proxy endpoint `" + toString() + "'");
+ }
+ }
+
+ if(_host == null)
+ {
+ _host = "";
+ }
+
+ if(_sourceAddr == null)
+ {
+ if (!oaEndpoint)
+ {
+ _sourceAddr = _instance.defaultSourceAddress();
+ }
+ }
+ else if(oaEndpoint)
+ {
+ throw new com.zeroc.Ice.EndpointParseException(
+ "`--sourceAddress' not valid for object adapter endpoint `" + toString() + "'");
+ }
+ }
+
+ @Override
+ protected boolean checkOption(String option, String argument, String endpoint)
+ {
+ if(option.equals("-h"))
+ {
+ if(argument == null)
+ {
+ throw new com.zeroc.Ice.EndpointParseException(
+ "no argument provided for -h option in endpoint " + endpoint);
+ }
+ _host = argument;
+ }
+ else if(option.equals("-p"))
+ {
+ if(argument == null)
+ {
+ throw new com.zeroc.Ice.EndpointParseException(
+ "no argument provided for -p option in endpoint " + endpoint);
+ }
+
+ try
+ {
+ _port = Integer.parseInt(argument);
+ }
+ catch(NumberFormatException ex)
+ {
+ throw new com.zeroc.Ice.EndpointParseException(
+ "invalid port value `" + argument + "' in endpoint " + endpoint);
+ }
+
+ if(_port < 0 || _port > 65535)
+ {
+ throw new com.zeroc.Ice.EndpointParseException(
+ "port value `" + argument + "' out of range in endpoint " + endpoint);
+ }
+ }
+ else if(option.equals("--sourceAddress"))
+ {
+ if(argument == null)
+ {
+ throw new com.zeroc.Ice.EndpointParseException(
+ "no argument provided for --sourceAddress option in endpoint " + endpoint);
+ }
+ _sourceAddr = Network.getNumericAddress(argument);
+ if(_sourceAddr == null)
+ {
+ throw new com.zeroc.Ice.EndpointParseException(
+ "invalid IP address provided for --sourceAddress option in endpoint " + endpoint);
+ }
+ }
+ else
+ {
+ return false;
+ }
+ return true;
+ }
+
+ protected abstract Connector createConnector(java.net.InetSocketAddress addr, NetworkProxy proxy);
+ protected abstract IPEndpointI createEndpoint(String host, int port, String connectionId);
+
+ protected ProtocolInstance _instance;
+ protected String _host;
+ protected int _port;
+ protected java.net.InetSocketAddress _sourceAddr;
+ protected String _connectionId;
+ private boolean _hashInitialized;
+ private int _hashValue;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Incoming.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Incoming.java
new file mode 100644
index 00000000000..7ca1acc5465
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Incoming.java
@@ -0,0 +1,896 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import java.util.concurrent.CompletionStage;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+
+import com.zeroc.Ice.ConnectionInfo;
+import com.zeroc.Ice.Current;
+import com.zeroc.Ice.FormatType;
+import com.zeroc.Ice.Instrumentation.CommunicatorObserver;
+import com.zeroc.Ice.Instrumentation.DispatchObserver;
+import com.zeroc.Ice.InputStream;
+import com.zeroc.Ice.IPConnectionInfo;
+import com.zeroc.Ice.MarshaledResult;
+import com.zeroc.Ice.OutputStream;
+import com.zeroc.Ice.ServantLocator;
+import com.zeroc.Ice.Util;
+
+final public class Incoming implements com.zeroc.Ice.Request
+{
+ public Incoming(Instance instance, ResponseHandler responseHandler, com.zeroc.Ice.ConnectionI connection,
+ com.zeroc.Ice.ObjectAdapter adapter, boolean response, byte compress, int requestId)
+ {
+ _instance = instance;
+ _responseHandler = responseHandler;
+ _response = response;
+ _compress = compress;
+
+ _current = new Current();
+ _current.id = new com.zeroc.Ice.Identity();
+ _current.adapter = adapter;
+ _current.con = connection;
+ _current.requestId = requestId;
+
+ _cookie = null;
+ }
+
+ //
+ // These functions allow this object to be reused, rather than reallocated.
+ //
+ public void reset(Instance instance, ResponseHandler handler, com.zeroc.Ice.ConnectionI connection,
+ com.zeroc.Ice.ObjectAdapter adapter, boolean response, byte compress, int requestId)
+ {
+ _instance = instance;
+ _responseHandler = handler;
+ _response = response;
+ _compress = compress;
+
+ //
+ // Don't recycle the Current object, because servants may keep a reference to it.
+ //
+ _current = new Current();
+ _current.id = new com.zeroc.Ice.Identity();
+ _current.adapter = adapter;
+ _current.con = connection;
+ _current.requestId = requestId;
+
+ assert(_cookie == null);
+
+ _inParamPos = -1;
+ }
+
+ public boolean reclaim()
+ {
+ if(_responseHandler != null) // Async dispatch not ready for being reclaimed!
+ {
+ return false;
+ }
+
+ _current = null;
+ _servant = null;
+ _locator = null;
+ _cookie = null;
+
+ //_observer = null;
+ assert(_observer == null);
+
+ if(_os != null)
+ {
+ _os.reset();
+ }
+
+ _is = null;
+
+ //_responseHandler = null;
+ assert(_responseHandler == null);
+
+ _inParamPos = -1;
+
+ return true;
+ }
+
+ @Override
+ public Current getCurrent()
+ {
+ return _current;
+ }
+
+ public void invoke(ServantManager servantManager, InputStream stream)
+ {
+ _is = stream;
+
+ int start = _is.pos();
+
+ //
+ // Read the current.
+ //
+ _current.id.ice_read(_is);
+
+ //
+ // For compatibility with the old FacetPath.
+ //
+ String[] facetPath = _is.readStringSeq();
+ if(facetPath.length > 0)
+ {
+ if(facetPath.length > 1)
+ {
+ throw new com.zeroc.Ice.MarshalException();
+ }
+ _current.facet = facetPath[0];
+ }
+ else
+ {
+ _current.facet = "";
+ }
+
+ _current.operation = _is.readString();
+ _current.mode = com.zeroc.Ice.OperationMode.values()[_is.readByte()];
+ _current.ctx = new java.util.HashMap<>();
+ int sz = _is.readSize();
+ while(sz-- > 0)
+ {
+ String first = _is.readString();
+ String second = _is.readString();
+ _current.ctx.put(first, second);
+ }
+
+ CommunicatorObserver obsv = _instance.initializationData().observer;
+ if(obsv != null)
+ {
+ // Read the parameter encapsulation size.
+ int size = _is.readInt();
+ _is.pos(_is.pos() - 4);
+
+ _observer = obsv.getDispatchObserver(_current, _is.pos() - start + size);
+ if(_observer != null)
+ {
+ _observer.attach();
+ }
+ }
+
+ //
+ // Don't put the code above into the try block below. Exceptions
+ // in the code above are considered fatal, and must propagate to
+ // the caller of this operation.
+ //
+
+ if(servantManager != null)
+ {
+ _servant = servantManager.findServant(_current.id, _current.facet);
+ if(_servant == null)
+ {
+ _locator = servantManager.findServantLocator(_current.id.category);
+ if(_locator == null && _current.id.category.length() > 0)
+ {
+ _locator = servantManager.findServantLocator("");
+ }
+
+ if(_locator != null)
+ {
+ try
+ {
+ ServantLocator.LocateResult r = _locator.locate(_current);
+ _servant = r.returnValue;
+ _cookie = r.cookie;
+ }
+ catch(Throwable ex)
+ {
+ skipReadParams(); // Required for batch requests.
+ handleException(ex, false);
+ return;
+ }
+ }
+ }
+ }
+
+ if(_servant == null)
+ {
+ try
+ {
+ //
+ // Skip the input parameters, this is required for reading
+ // the next batch request if dispatching batch requests.
+ //
+ _is.skipEncapsulation();
+
+ if(servantManager != null && servantManager.hasServant(_current.id))
+ {
+ throw new com.zeroc.Ice.FacetNotExistException(_current.id, _current.facet, _current.operation);
+ }
+ else
+ {
+ throw new com.zeroc.Ice.ObjectNotExistException(_current.id, _current.facet, _current.operation);
+ }
+ }
+ catch(Throwable ex)
+ {
+ handleException(ex, false);
+ return;
+ }
+ }
+
+ try
+ {
+ if(_instance.useApplicationClassLoader())
+ {
+ Thread.currentThread().setContextClassLoader(_servant.getClass().getClassLoader());
+ }
+
+ try
+ {
+ CompletionStage<OutputStream> f = _servant.__dispatch(this, _current);
+ if(f == null)
+ {
+ completed(null, false);
+ }
+ else
+ {
+ f.whenComplete((result, ex) ->
+ {
+ if(ex != null)
+ {
+ completed(ex, true); // true = asynchronous
+ }
+ else
+ {
+ _os = result;
+ completed(null, true); // true = asynchronous
+ }
+ });
+ }
+ }
+ finally
+ {
+ if(_instance.useApplicationClassLoader())
+ {
+ Thread.currentThread().setContextClassLoader(null);
+ }
+ }
+ }
+ catch(Throwable ex)
+ {
+ completed(ex, false);
+ }
+ }
+
+ public CompletionStage<OutputStream> setResult(OutputStream os)
+ {
+ _os = os;
+ return null; // Response is cached in the Incoming to not have to create unnecessary future
+ }
+
+ @FunctionalInterface
+ public static interface Write<T>
+ {
+ void write(OutputStream os, T v);
+ }
+
+ public <T> CompletionStage<OutputStream> setResultFuture(CompletionStage<T> f, Write<T> write)
+ {
+ final CompletableFuture<OutputStream> r = new CompletableFuture<OutputStream>();
+ f.whenComplete((result, ex) ->
+ {
+ if(ex != null)
+ {
+ r.completeExceptionally(ex);
+ }
+ else
+ {
+ OutputStream os = startWriteParams();
+ write.write(os, result);
+ endWriteParams(os);
+ r.complete(os);
+ }
+ });
+ return r;
+ }
+
+ public CompletionStage<OutputStream> setResultFuture(CompletionStage<Void> f)
+ {
+ final CompletableFuture<OutputStream> r = new CompletableFuture<OutputStream>();
+ f.whenComplete((result, ex) ->
+ {
+ if(ex != null)
+ {
+ r.completeExceptionally(ex);
+ }
+ else
+ {
+ r.complete(writeEmptyParams());
+ }
+ });
+ return r;
+ }
+
+ public CompletionStage<OutputStream> setMarshaledResult(MarshaledResult result)
+ {
+ _os = result.getOutputStream();
+ return null; // Response is cached in the Incoming to not have to create unnecessary future
+ }
+
+ public <T extends MarshaledResult> CompletionStage<OutputStream>
+ setMarshaledResultFuture(CompletionStage<T> f)
+ {
+ final CompletableFuture<OutputStream> r = new CompletableFuture<OutputStream>();
+ f.whenComplete((result, ex) ->
+ {
+ if(ex != null)
+ {
+ r.completeExceptionally(ex);
+ }
+ else
+ {
+ r.complete(result.getOutputStream());
+ }
+ });
+ return r;
+ }
+
+ public void completed(Throwable exc, boolean amd)
+ {
+ try
+ {
+ if(_locator != null)
+ {
+ assert(_locator != null && _servant != null);
+ try
+ {
+ _locator.finished(_current, _servant, _cookie);
+ }
+ catch(Throwable ex)
+ {
+ handleException(ex, amd);
+ return;
+ }
+ }
+
+ assert(_responseHandler != null);
+
+ if(exc != null)
+ {
+ handleException(exc, amd);
+ }
+ else if(_response)
+ {
+ if(_observer != null)
+ {
+ _observer.reply(_os.size() - Protocol.headerSize - 4);
+ }
+ _responseHandler.sendResponse(_current.requestId, _os, _compress, amd);
+ }
+ else
+ {
+ _responseHandler.sendNoResponse();
+ }
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ _responseHandler.invokeException(_current.requestId, ex, 1, amd);
+ }
+ finally
+ {
+ if(_observer != null)
+ {
+ _observer.detach();
+ _observer = null;
+ }
+ _responseHandler = null;
+ }
+ }
+
+ public final void startOver()
+ {
+ if(_inParamPos == -1)
+ {
+ //
+ // That's the first startOver, so almost nothing to do
+ //
+ _inParamPos = _is.pos();
+ }
+ else
+ {
+ //
+ // Let's rewind _is and clean-up _os
+ //
+ _is.pos(_inParamPos);
+ }
+ }
+
+ public void skipReadParams()
+ {
+ //
+ // Remember the encoding used by the input parameters, we'll
+ // encode the response parameters with the same encoding.
+ //
+ _current.encoding = _is.skipEncapsulation();
+ }
+
+ public InputStream startReadParams()
+ {
+ //
+ // Remember the encoding used by the input parameters, we'll
+ // encode the response parameters with the same encoding.
+ //
+ _current.encoding = _is.startEncapsulation();
+ return _is;
+ }
+
+ public void endReadParams()
+ {
+ _is.endEncapsulation();
+ }
+
+ public void readEmptyParams()
+ {
+ _current.encoding = _is.skipEmptyEncapsulation();
+ }
+
+ public byte[] readParamEncaps()
+ {
+ _current.encoding = new com.zeroc.Ice.EncodingVersion();
+ return _is.readEncapsulation(_current.encoding);
+ }
+
+ public void setFormat(FormatType format)
+ {
+ if(format == null)
+ {
+ format = FormatType.DefaultFormat;
+ }
+ _format = format;
+ }
+
+ static public OutputStream createResponseOutputStream(Current current)
+ {
+ OutputStream os = new OutputStream(current.adapter.getCommunicator(), Protocol.currentProtocolEncoding);
+ os.writeBlob(Protocol.replyHdr);
+ os.writeInt(current.requestId);
+ os.writeByte(ReplyStatus.replyOK);
+ return os;
+ }
+
+ public com.zeroc.Ice.OutputStream startWriteParams()
+ {
+ if(!_response)
+ {
+ throw new com.zeroc.Ice.MarshalException("can't marshal out parameters for oneway dispatch");
+ }
+
+ OutputStream os = new OutputStream(_instance, Protocol.currentProtocolEncoding);
+ os.writeBlob(Protocol.replyHdr);
+ os.writeInt(_current.requestId);
+ os.writeByte(ReplyStatus.replyOK);
+ os.startEncapsulation(_current.encoding, _format);
+ return os;
+ }
+
+ public void endWriteParams(OutputStream os)
+ {
+ if(_response)
+ {
+ os.endEncapsulation();
+ }
+ }
+
+ public OutputStream writeEmptyParams()
+ {
+ if(_response)
+ {
+ OutputStream os = new OutputStream(_instance, Protocol.currentProtocolEncoding);
+ os.writeBlob(Protocol.replyHdr);
+ os.writeInt(_current.requestId);
+ os.writeByte(ReplyStatus.replyOK);
+ os.writeEmptyEncapsulation(_current.encoding);
+ return os;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public OutputStream writeParamEncaps(byte[] v, boolean ok)
+ {
+ if(!ok && _observer != null)
+ {
+ _observer.userException();
+ }
+
+ if(_response)
+ {
+ OutputStream os = new OutputStream(_instance, Protocol.currentProtocolEncoding);
+ os.writeBlob(Protocol.replyHdr);
+ os.writeInt(_current.requestId);
+ os.writeByte(ok ? ReplyStatus.replyOK : ReplyStatus.replyUserException);
+ if(v == null || v.length == 0)
+ {
+ os.writeEmptyEncapsulation(_current.encoding);
+ }
+ else
+ {
+ os.writeEncapsulation(v);
+ }
+ return os;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private void warning(Throwable ex)
+ {
+ assert(_instance != null);
+
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ com.zeroc.IceUtilInternal.OutputBase out = new com.zeroc.IceUtilInternal.OutputBase(pw);
+ out.setUseTab(false);
+ out.print("dispatch exception:");
+ out.print("\nidentity: " + Util.identityToString(_current.id));
+ out.print("\nfacet: " + com.zeroc.IceUtilInternal.StringUtil.escapeString(_current.facet, ""));
+ out.print("\noperation: " + _current.operation);
+ if(_current.con != null)
+ {
+ for(ConnectionInfo connInfo = _current.con.getInfo(); connInfo != null; connInfo = connInfo.underlying)
+ {
+ if(connInfo instanceof IPConnectionInfo)
+ {
+ IPConnectionInfo ipConnInfo = (IPConnectionInfo)connInfo;
+ out.print("\nremote host: " + ipConnInfo.remoteAddress + " remote port: " + ipConnInfo.remotePort);
+ }
+ }
+ }
+ out.print("\n");
+ ex.printStackTrace(pw);
+ pw.flush();
+ _instance.initializationData().logger.warning(sw.toString());
+ }
+
+ private void handleException(Throwable exc, boolean amd)
+ {
+ assert(_responseHandler != null);
+
+ try
+ {
+ throw exc;
+ }
+ catch(com.zeroc.Ice.RequestFailedException ex)
+ {
+ if(ex.id == null || ex.id.name == null || ex.id.name.isEmpty())
+ {
+ ex.id = _current.id;
+ }
+
+ if(ex.facet == null || ex.facet.isEmpty())
+ {
+ ex.facet = _current.facet;
+ }
+
+ if(ex.operation == null || ex.operation.length() == 0)
+ {
+ ex.operation = _current.operation;
+ }
+
+ if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1)
+ {
+ warning(ex);
+ }
+
+ if(_observer != null)
+ {
+ _observer.failed(ex.ice_id());
+ }
+
+ if(_response)
+ {
+ assert(_responseHandler != null && _current != null);
+ _os = new OutputStream(_instance, Protocol.currentProtocolEncoding);
+ _os.writeBlob(Protocol.replyHdr);
+ _os.writeInt(_current.requestId);
+ if(ex instanceof com.zeroc.Ice.ObjectNotExistException)
+ {
+ _os.writeByte(ReplyStatus.replyObjectNotExist);
+ }
+ else if(ex instanceof com.zeroc.Ice.FacetNotExistException)
+ {
+ _os.writeByte(ReplyStatus.replyFacetNotExist);
+ }
+ else if(ex instanceof com.zeroc.Ice.OperationNotExistException)
+ {
+ _os.writeByte(ReplyStatus.replyOperationNotExist);
+ }
+ else
+ {
+ assert(false);
+ }
+ ex.id.ice_write(_os);
+
+ //
+ // For compatibility with the old FacetPath.
+ //
+ if(ex.facet == null || ex.facet.length() == 0)
+ {
+ _os.writeStringSeq(null);
+ }
+ else
+ {
+ String[] facetPath2 = { ex.facet };
+ _os.writeStringSeq(facetPath2);
+ }
+
+ _os.writeString(ex.operation);
+
+ if(_observer != null)
+ {
+ _observer.reply(_os.size() - Protocol.headerSize - 4);
+ }
+ _responseHandler.sendResponse(_current.requestId, _os, _compress, amd);
+ }
+ else
+ {
+ _responseHandler.sendNoResponse();
+ }
+ }
+ catch(com.zeroc.Ice.UnknownLocalException ex)
+ {
+ if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ warning(ex);
+ }
+
+ if(_observer != null)
+ {
+ _observer.failed(ex.ice_id());
+ }
+
+ if(_response)
+ {
+ assert(_responseHandler != null && _current != null);
+ _os = new OutputStream(_instance, Protocol.currentProtocolEncoding);
+ _os.writeBlob(Protocol.replyHdr);
+ _os.writeInt(_current.requestId);
+ _os.writeByte(ReplyStatus.replyUnknownLocalException);
+ _os.writeString(ex.unknown);
+ if(_observer != null)
+ {
+ _observer.reply(_os.size() - Protocol.headerSize - 4);
+ }
+ _responseHandler.sendResponse(_current.requestId, _os, _compress, amd);
+ }
+ else
+ {
+ _responseHandler.sendNoResponse();
+ }
+ }
+ catch(com.zeroc.Ice.UnknownUserException ex)
+ {
+ if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ warning(ex);
+ }
+
+ if(_observer != null)
+ {
+ _observer.failed(ex.ice_id());
+ }
+
+ if(_response)
+ {
+ assert(_responseHandler != null && _current != null);
+ _os = new OutputStream(_instance, Protocol.currentProtocolEncoding);
+ _os.writeBlob(Protocol.replyHdr);
+ _os.writeInt(_current.requestId);
+ _os.writeByte(ReplyStatus.replyUnknownUserException);
+ _os.writeString(ex.unknown);
+ if(_observer != null)
+ {
+ _observer.reply(_os.size() - Protocol.headerSize - 4);
+ }
+ _responseHandler.sendResponse(_current.requestId, _os, _compress, amd);
+ }
+ else
+ {
+ _responseHandler.sendNoResponse();
+ }
+ }
+ catch(com.zeroc.Ice.UnknownException ex)
+ {
+ if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ warning(ex);
+ }
+
+ if(_observer != null)
+ {
+ _observer.failed(ex.ice_id());
+ }
+
+ if(_response)
+ {
+ assert(_responseHandler != null && _current != null);
+ _os = new OutputStream(_instance, Protocol.currentProtocolEncoding);
+ _os.writeBlob(Protocol.replyHdr);
+ _os.writeInt(_current.requestId);
+ _os.writeByte(ReplyStatus.replyUnknownException);
+ _os.writeString(ex.unknown);
+ if(_observer != null)
+ {
+ _observer.reply(_os.size() - Protocol.headerSize - 4);
+ }
+ _responseHandler.sendResponse(_current.requestId, _os, _compress, amd);
+ }
+ else
+ {
+ _responseHandler.sendNoResponse();
+ }
+ }
+ catch(com.zeroc.Ice.UserException ex)
+ {
+ if(_observer != null)
+ {
+ _observer.userException();
+ }
+
+ if(_response)
+ {
+ assert(_responseHandler != null && _current != null);
+ _os = new OutputStream(_instance, Protocol.currentProtocolEncoding);
+ _os.writeBlob(Protocol.replyHdr);
+ _os.writeInt(_current.requestId);
+ _os.writeByte(ReplyStatus.replyUserException);
+ _os.startEncapsulation(_current.encoding, _format);
+ _os.writeException(ex);
+ _os.endEncapsulation();
+ if(_observer != null)
+ {
+ _observer.reply(_os.size() - Protocol.headerSize - 4);
+ }
+ _responseHandler.sendResponse(_current.requestId, _os, _compress, false);
+ }
+ else
+ {
+ _responseHandler.sendNoResponse();
+ }
+ }
+ catch(com.zeroc.Ice.Exception ex)
+ {
+ if(ex instanceof com.zeroc.Ice.SystemException)
+ {
+ if(_responseHandler.systemException(_current.requestId, (com.zeroc.Ice.SystemException)ex, amd))
+ {
+ return;
+ }
+ }
+
+ if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ warning(ex);
+ }
+
+ if(_observer != null)
+ {
+ _observer.failed(ex.ice_id());
+ }
+
+ if(_response)
+ {
+ assert(_responseHandler != null && _current != null);
+ _os = new OutputStream(_instance, Protocol.currentProtocolEncoding);
+ _os.writeBlob(Protocol.replyHdr);
+ _os.writeInt(_current.requestId);
+ _os.writeByte(ReplyStatus.replyUnknownLocalException);
+ //_os.writeString(ex.toString());
+ java.io.StringWriter sw = new java.io.StringWriter();
+ sw.write(ex.ice_id() + "\n");
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ ex.printStackTrace(pw);
+ pw.flush();
+ _os.writeString(sw.toString());
+ if(_observer != null)
+ {
+ _observer.reply(_os.size() - Protocol.headerSize - 4);
+ }
+ _responseHandler.sendResponse(_current.requestId, _os, _compress, amd);
+ }
+ else
+ {
+ _responseHandler.sendNoResponse();
+ }
+ }
+ catch(ExecutionException ex)
+ {
+ //
+ // Raised by CompletableFuture.get(). The inner exception caused the future to complete exceptionally.
+ // Recurse with the inner exception.
+ //
+ handleException(ex.getCause(), amd);
+ return;
+ }
+ catch(java.lang.Error ex)
+ {
+ com.zeroc.Ice.UnknownException uex = new com.zeroc.Ice.UnknownException(exc);
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ exc.printStackTrace(pw);
+ pw.flush();
+ uex.unknown = sw.toString();
+
+ handleException(uex, amd);
+
+ throw new ServantError(exc);
+ }
+ catch(Throwable ex)
+ {
+ if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ warning(ex);
+ }
+
+ if(_observer != null)
+ {
+ _observer.failed(ex.getClass().getName());
+ }
+
+ if(_response)
+ {
+ assert(_responseHandler != null && _current != null);
+ _os = new OutputStream(_instance, Protocol.currentProtocolEncoding);
+ _os.writeBlob(Protocol.replyHdr);
+ _os.writeInt(_current.requestId);
+ _os.writeByte(ReplyStatus.replyUnknownException);
+ //_os.writeString(ex.toString());
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ ex.printStackTrace(pw);
+ pw.flush();
+ _os.writeString(sw.toString());
+ if(_observer != null)
+ {
+ _observer.reply(_os.size() - Protocol.headerSize - 4);
+ }
+ _responseHandler.sendResponse(_current.requestId, _os, _compress, amd);
+ }
+ else
+ {
+ _responseHandler.sendNoResponse();
+ }
+ }
+
+ if(_observer != null)
+ {
+ _observer.detach();
+ _observer = null;
+ }
+ _responseHandler = null;
+ }
+
+ private Instance _instance;
+ private Current _current;
+ private com.zeroc.Ice.Object _servant;
+ private ServantLocator _locator;
+ private java.lang.Object _cookie;
+ private DispatchObserver _observer;
+ private ResponseHandler _responseHandler;
+
+ private boolean _response;
+ private byte _compress;
+ private FormatType _format = FormatType.DefaultFormat;
+
+ private OutputStream _os;
+ private InputStream _is;
+
+ private int _inParamPos = -1;
+
+ public Incoming next; // For use by ConnectionI.
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/IncomingConnectionFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/IncomingConnectionFactory.java
new file mode 100644
index 00000000000..cc98bfe0394
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/IncomingConnectionFactory.java
@@ -0,0 +1,660 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import com.zeroc.Ice.ConnectionI;
+
+public final class IncomingConnectionFactory extends EventHandler implements ConnectionI.StartCallback
+{
+ public synchronized void
+ activate()
+ {
+ setState(StateActive);
+ }
+
+ public synchronized void
+ hold()
+ {
+ setState(StateHolding);
+ }
+
+ public synchronized void
+ destroy()
+ {
+ setState(StateClosed);
+ }
+
+ public synchronized void
+ updateConnectionObservers()
+ {
+ for(ConnectionI connection : _connections)
+ {
+ connection.updateObserver();
+ }
+ }
+
+ public void
+ waitUntilHolding()
+ throws InterruptedException
+ {
+ java.util.LinkedList<ConnectionI> connections;
+
+ synchronized(this)
+ {
+ //
+ // First we wait until the connection factory itself is in holding
+ // state.
+ //
+ while(_state < StateHolding)
+ {
+ wait();
+ }
+
+ //
+ // We want to wait until all connections are in holding state
+ // outside the thread synchronization.
+ //
+ connections = new java.util.LinkedList<>(_connections);
+ }
+
+ //
+ // Now we wait until each connection is in holding state.
+ //
+ for(ConnectionI connection : connections)
+ {
+ connection.waitUntilHolding();
+ }
+ }
+
+ public void
+ waitUntilFinished()
+ throws InterruptedException
+ {
+ java.util.LinkedList<ConnectionI> connections = null;
+
+ synchronized(this)
+ {
+ //
+ // First we wait until the factory is destroyed. If we are using
+ // an acceptor, we also wait for it to be closed.
+ //
+ while(_state != StateFinished)
+ {
+ wait();
+ }
+
+ //
+ // Clear the OA. See bug 1673 for the details of why this is necessary.
+ //
+ _adapter = null;
+
+ //
+ // We want to wait until all connections are finished outside the
+ // thread synchronization.
+ //
+ connections = new java.util.LinkedList<>(_connections);
+ }
+
+ if(connections != null)
+ {
+ for(ConnectionI connection : connections)
+ {
+ try
+ {
+ connection.waitUntilFinished();
+ }
+ catch(InterruptedException e)
+ {
+ //
+ // Force close all of the connections.
+ //
+ for(ConnectionI c : connections)
+ {
+ c.close(true);
+ }
+ throw e;
+ }
+ }
+ }
+
+ synchronized(this)
+ {
+ if(_transceiver != null)
+ {
+ assert(_connections.size() <= 1); // The connection isn't monitored or reaped.
+ }
+ else
+ {
+ // Ensure all the connections are finished and reapable at this point.
+ java.util.List<ConnectionI> cons = _monitor.swapReapedConnections();
+ assert((cons == null ? 0 : cons.size()) == _connections.size());
+ if(cons != null)
+ {
+ cons.clear();
+ }
+ }
+ _connections.clear();
+ _monitor.destroy();
+ }
+ }
+
+ public EndpointI
+ endpoint()
+ {
+ // No mutex protection necessary, _endpoint is immutable.
+ return _endpoint;
+ }
+
+ public synchronized java.util.LinkedList<ConnectionI>
+ connections()
+ {
+ java.util.LinkedList<ConnectionI> connections = new java.util.LinkedList<>();
+
+ //
+ // Only copy connections which have not been destroyed.
+ //
+ for(ConnectionI connection : _connections)
+ {
+ if(connection.isActiveOrHolding())
+ {
+ connections.add(connection);
+ }
+ }
+
+ return connections;
+ }
+
+ public void
+ flushAsyncBatchRequests(CommunicatorFlushBatch outAsync)
+ {
+ for(ConnectionI c : connections()) // connections() is synchronized, no need to synchronize here.
+ {
+ try
+ {
+ outAsync.flushConnection(c);
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ // Ignore.
+ }
+ }
+ }
+
+ //
+ // Operations from EventHandler.
+ //
+
+ @Override
+ public void
+ message(ThreadPoolCurrent current)
+ {
+ ConnectionI connection = null;
+ synchronized(this)
+ {
+ if(_state >= StateClosed)
+ {
+ return;
+ }
+ else if(_state == StateHolding)
+ {
+ Thread.yield();
+ return;
+ }
+
+ //
+ // Reap closed connections.
+ //
+ java.util.List<ConnectionI> cons = _monitor.swapReapedConnections();
+ if(cons != null)
+ {
+ for(ConnectionI c : cons)
+ {
+ _connections.remove(c);
+ }
+ }
+
+ //
+ // Now accept a new connection.
+ //
+ Transceiver transceiver = null;
+ try
+ {
+ transceiver = _acceptor.accept();
+
+ if(_instance.traceLevels().network >= 2)
+ {
+ StringBuffer s = new StringBuffer("trying to accept ");
+ s.append(_endpoint.protocol());
+ s.append(" connection\n");
+ s.append(transceiver.toString());
+ _instance.initializationData().logger.trace(_instance.traceLevels().networkCat, s.toString());
+ }
+ }
+ catch(com.zeroc.Ice.SocketException ex)
+ {
+ if(Network.noMoreFds(ex.getCause()))
+ {
+ try
+ {
+ String s = "fatal error: can't accept more connections:\n" + ex.getCause().getMessage();
+ s += '\n' + _acceptor.toString();
+ _instance.initializationData().logger.error(s);
+ }
+ finally
+ {
+ Runtime.getRuntime().halt(1);
+ }
+ }
+
+ // Ignore socket exceptions.
+ return;
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ // Warn about other Ice local exceptions.
+ if(_warn)
+ {
+ warning(ex);
+ }
+ return;
+ }
+
+ assert(transceiver != null);
+
+ try
+ {
+ connection = new ConnectionI(_adapter.getCommunicator(), _instance, _monitor, transceiver, null,
+ _endpoint, _adapter);
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ try
+ {
+ transceiver.close();
+ }
+ catch(com.zeroc.Ice.LocalException exc)
+ {
+ // Ignore
+ }
+
+ if(_warn)
+ {
+ warning(ex);
+ }
+ return;
+ }
+
+ _connections.add(connection);
+ }
+
+ assert(connection != null);
+ connection.start(this);
+ }
+
+ @Override
+ public synchronized void
+ finished(ThreadPoolCurrent current, boolean close)
+ {
+ assert(_state == StateClosed);
+ setState(StateFinished);
+
+ if(close)
+ {
+ closeAcceptor();
+ }
+ }
+
+ @Override
+ public synchronized String
+ toString()
+ {
+ if(_transceiver != null)
+ {
+ return _transceiver.toString();
+ }
+ return _acceptor.toString();
+ }
+
+ @Override
+ public java.nio.channels.SelectableChannel
+ fd()
+ {
+ assert(_acceptor != null);
+ return _acceptor.fd();
+ }
+
+ @Override
+ public void setReadyCallback(ReadyCallback readyCallback)
+ {
+ if(_acceptor != null)
+ {
+ _acceptor.setReadyCallback(readyCallback);
+ }
+ }
+
+ //
+ // Operations from ConnectionI.StartCallback
+ //
+ @Override
+ public synchronized void
+ connectionStartCompleted(ConnectionI connection)
+ {
+ //
+ // Initially, connections are in the holding state. If the factory is active
+ // we activate the connection.
+ //
+ if(_state == StateActive)
+ {
+ connection.activate();
+ }
+ }
+
+ @Override
+ public synchronized void
+ connectionStartFailed(ConnectionI connection, com.zeroc.Ice.LocalException ex)
+ {
+ if(_state >= StateClosed)
+ {
+ return;
+ }
+ //
+ // Do not warn about connection exceptions here. The connection is not yet validated.
+ //
+ }
+
+ public
+ IncomingConnectionFactory(Instance instance, EndpointI endpoint, com.zeroc.Ice.ObjectAdapterI adapter)
+ {
+ _instance = instance;
+ _endpoint = endpoint;
+ _adapter = adapter;
+ _warn = _instance.initializationData().properties.getPropertyAsInt("Ice.Warn.Connections") > 0 ? true : false;
+ _state = StateHolding;
+ _monitor = new FactoryACMMonitor(instance, adapter.getACM());
+
+ DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
+ if(defaultsAndOverrides.overrideTimeout)
+ {
+ _endpoint = _endpoint.timeout(defaultsAndOverrides.overrideTimeoutValue);
+ }
+
+ if(defaultsAndOverrides.overrideCompress)
+ {
+ _endpoint = _endpoint.compress(defaultsAndOverrides.overrideCompressValue);
+ }
+
+ try
+ {
+ _transceiver = _endpoint.transceiver();
+ if(_transceiver != null)
+ {
+ if(_instance.traceLevels().network >= 2)
+ {
+ StringBuffer s = new StringBuffer("attempting to bind to ");
+ s.append(_endpoint.protocol());
+ s.append(" socket\n");
+ s.append(_transceiver.toString());
+ _instance.initializationData().logger.trace(_instance.traceLevels().networkCat, s.toString());
+ }
+ _endpoint = _transceiver.bind();
+
+ ConnectionI connection =
+ new ConnectionI(_adapter.getCommunicator(), _instance, null, _transceiver, null, _endpoint,
+ _adapter);
+ connection.startAndWait();
+
+ _connections.add(connection);
+ }
+ else
+ {
+ createAcceptor();
+ }
+ }
+ catch(java.lang.Exception ex)
+ {
+ //
+ // Clean up for finalizer.
+ //
+ if(_transceiver != null)
+ {
+ try
+ {
+ _transceiver.close();
+ }
+ catch(com.zeroc.Ice.LocalException e)
+ {
+ // Here we ignore any exceptions in close().
+ }
+ }
+
+ _state = StateFinished;
+ _monitor.destroy();
+ _connections.clear();
+
+ if(ex instanceof com.zeroc.Ice.LocalException)
+ {
+ throw (com.zeroc.Ice.LocalException)ex;
+ }
+ else if(ex instanceof InterruptedException)
+ {
+ throw new com.zeroc.Ice.OperationInterruptedException();
+ }
+ else
+ {
+ throw new com.zeroc.Ice.SyscallException(ex);
+ }
+ }
+ }
+
+ @Override
+ protected synchronized void
+ finalize()
+ throws Throwable
+ {
+ try
+ {
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_state == StateFinished);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_connections.isEmpty());
+ }
+ catch(java.lang.Exception ex)
+ {
+ }
+ finally
+ {
+ super.finalize();
+ }
+ }
+
+ private static final int StateActive = 0;
+ private static final int StateHolding = 1;
+ private static final int StateClosed = 2;
+ private static final int StateFinished = 3;
+
+ private void
+ setState(int state)
+ {
+ if(_state == state) // Don't switch twice.
+ {
+ return;
+ }
+
+ switch(state)
+ {
+ case StateActive:
+ {
+ if(_state != StateHolding) // Can only switch from holding to active.
+ {
+ return;
+ }
+ if(_acceptor != null)
+ {
+ if(_instance.traceLevels().network >= 1)
+ {
+ StringBuffer s = new StringBuffer("accepting ");
+ s.append(_endpoint.protocol());
+ s.append(" connections at ");
+ s.append(_acceptor.toString());
+ _instance.initializationData().logger.trace(_instance.traceLevels().networkCat, s.toString());
+ }
+ _adapter.getThreadPool().register(this, SocketOperation.Read);
+ }
+
+ for(ConnectionI connection : _connections)
+ {
+ connection.activate();
+ }
+ break;
+ }
+
+ case StateHolding:
+ {
+ if(_state != StateActive) // Can only switch from active to holding.
+ {
+ return;
+ }
+ if(_acceptor != null)
+ {
+ if(_instance.traceLevels().network >= 1)
+ {
+ StringBuffer s = new StringBuffer("holding ");
+ s.append(_endpoint.protocol());
+ s.append(" connections at ");
+ s.append(_acceptor.toString());
+ _instance.initializationData().logger.trace(_instance.traceLevels().networkCat, s.toString());
+ }
+ _adapter.getThreadPool().unregister(this, SocketOperation.Read);
+ }
+
+ for(ConnectionI connection : _connections)
+ {
+ connection.hold();
+ }
+ break;
+ }
+
+ case StateClosed:
+ {
+ if(_acceptor != null)
+ {
+ //
+ // If possible, close the acceptor now to prevent new connections from
+ // being accepted while we are deactivating. This is especially useful
+ // if there are no more threads in the thread pool available to dispatch
+ // the finish() call.
+ //
+ if(_adapter.getThreadPool().finish(this, true))
+ {
+ closeAcceptor();
+ }
+ }
+ else
+ {
+ state = StateFinished;
+ }
+
+ for(ConnectionI connection : _connections)
+ {
+ connection.destroy(ConnectionI.ObjectAdapterDeactivated);
+ }
+ break;
+ }
+
+ case StateFinished:
+ {
+ assert(_state == StateClosed);
+ break;
+ }
+ }
+
+ _state = state;
+ notifyAll();
+ }
+
+ private void
+ createAcceptor()
+ {
+ try
+ {
+ _acceptor = _endpoint.acceptor(_adapter.getName());
+ assert(_acceptor != null);
+
+ if(_instance.traceLevels().network >= 2)
+ {
+ StringBuffer s = new StringBuffer("attempting to bind to ");
+ s.append(_endpoint.protocol());
+ s.append(" socket ");
+ s.append(_acceptor.toString());
+ _instance.initializationData().logger.trace(_instance.traceLevels().networkCat, s.toString());
+ }
+
+ _endpoint = _acceptor.listen();
+
+ if(_instance.traceLevels().network >= 1)
+ {
+ StringBuffer s = new StringBuffer("listening for ");
+ s.append(_endpoint.protocol());
+ s.append(" connections\n");
+ s.append(_acceptor.toDetailedString());
+ _instance.initializationData().logger.trace(_instance.traceLevels().networkCat, s.toString());
+ }
+
+ _adapter.getThreadPool().initialize(this);
+
+ if(_state == StateActive)
+ {
+ _adapter.getThreadPool().register(this, SocketOperation.Read);
+ }
+ }
+ catch(Exception ex)
+ {
+ if(_acceptor != null)
+ {
+ _acceptor.close();
+ }
+ throw ex;
+ }
+ }
+
+ private void
+ closeAcceptor()
+ {
+ if(_instance.traceLevels().network >= 1)
+ {
+ StringBuffer s = new StringBuffer("stopping to accept ");
+ s.append(_endpoint.protocol());
+ s.append(" connections at ");
+ s.append(_acceptor.toString());
+ _instance.initializationData().logger.trace(_instance.traceLevels().networkCat, s.toString());
+ }
+ _acceptor.close();
+ }
+
+ private void
+ warning(com.zeroc.Ice.LocalException ex)
+ {
+ String s = "connection exception:\n" + Ex.toString(ex) + '\n' + _acceptor.toString();
+ _instance.initializationData().logger.warning(s);
+ }
+
+ private final Instance _instance;
+ private final FactoryACMMonitor _monitor;
+
+ private Acceptor _acceptor;
+ private Transceiver _transceiver;
+ private EndpointI _endpoint;
+
+ private com.zeroc.Ice.ObjectAdapterI _adapter;
+
+ private final boolean _warn;
+
+ private java.util.Set<ConnectionI> _connections = new java.util.HashSet<>();
+
+ private int _state;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/InputStreamWrapper.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/InputStreamWrapper.java
new file mode 100644
index 00000000000..3e39f38c45f
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/InputStreamWrapper.java
@@ -0,0 +1,96 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+//
+// Class to provide a java.io.InputStream on top of a ByteBuffer.
+// We use this to deserialize arbitrary Java serializable classes from
+// a Slice byte sequence. This class is a wrapper around a Buffer
+// that passes all methods through.
+//
+
+public class InputStreamWrapper extends java.io.InputStream
+{
+ public InputStreamWrapper(int size, java.nio.ByteBuffer buf)
+ {
+ _buf = buf;
+ _markPos = 0;
+ }
+
+ @Override
+ public int read()
+ throws java.io.IOException
+ {
+ try
+ {
+ return _buf.get();
+ }
+ catch(java.lang.Exception ex)
+ {
+ throw new java.io.IOException(ex.toString());
+ }
+ }
+
+ @Override
+ public int read(byte[] b)
+ throws java.io.IOException
+ {
+ return read(b, 0, b.length);
+ }
+
+ @Override
+ public int read(byte[] b, int offset, int count)
+ throws java.io.IOException
+ {
+ try
+ {
+ _buf.get(b, offset, count);
+ }
+ catch(java.lang.Exception ex)
+ {
+ throw new java.io.IOException(ex.toString());
+ }
+ return count;
+ }
+
+ @Override
+ public int available()
+ {
+ return _buf.remaining();
+ }
+
+ @Override
+ public void mark(int readlimit)
+ {
+ _markPos = _buf.position();
+ }
+
+ @Override
+ public void reset()
+ throws java.io.IOException
+ {
+ _buf.position(_markPos);
+ }
+
+ @Override
+ public boolean markSupported()
+ {
+ return true;
+ }
+
+ @Override
+ public void close()
+ throws java.io.IOException
+ {
+ }
+
+ private java.nio.ByteBuffer _buf;
+ private int _markPos;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Instance.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Instance.java
new file mode 100644
index 00000000000..d4c3663560f
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Instance.java
@@ -0,0 +1,1917 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import java.util.concurrent.TimeUnit;
+
+import com.zeroc.Ice.Instrumentation.ThreadState;
+
+public final class Instance implements com.zeroc.Ice.ClassResolver
+{
+ static private class ThreadObserverHelper
+ {
+ ThreadObserverHelper(String threadName)
+ {
+ _threadName = threadName;
+ }
+
+ synchronized public void updateObserver(com.zeroc.Ice.Instrumentation.CommunicatorObserver obsv)
+ {
+ assert(obsv != null);
+
+ _observer = obsv.getThreadObserver("Communicator", _threadName, ThreadState.ThreadStateIdle, _observer);
+ if(_observer != null)
+ {
+ _observer.attach();
+ }
+ }
+
+ protected void beforeExecute()
+ {
+ _threadObserver = _observer;
+ if(_threadObserver != null)
+ {
+ _threadObserver.stateChanged(ThreadState.ThreadStateIdle, ThreadState.ThreadStateInUseForOther);
+ }
+ }
+
+ protected void afterExecute()
+ {
+ if(_threadObserver != null)
+ {
+ _threadObserver.stateChanged(ThreadState.ThreadStateInUseForOther, ThreadState.ThreadStateIdle);
+ _threadObserver = null;
+ }
+ }
+
+ final private String _threadName;
+ //
+ // We use a volatile to avoid synchronization when reading
+ // _observer. Reference assignement is atomic in Java so it
+ // also doesn't need to be synchronized.
+ //
+ private volatile com.zeroc.Ice.Instrumentation.ThreadObserver _observer;
+ private com.zeroc.Ice.Instrumentation.ThreadObserver _threadObserver;
+ }
+
+ static private class Timer extends java.util.concurrent.ScheduledThreadPoolExecutor
+ {
+ Timer(com.zeroc.Ice.Properties props, String threadName)
+ {
+ super(1, Util.createThreadFactory(props, threadName)); // Single thread executor
+ if(!Util.isAndroid())
+ {
+ // This API doesn't exist on Android up to API level 20.
+ setRemoveOnCancelPolicy(true);
+ }
+ setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
+ _observerHelper = new ThreadObserverHelper(threadName);
+ }
+
+ public void updateObserver(com.zeroc.Ice.Instrumentation.CommunicatorObserver obsv)
+ {
+ _observerHelper.updateObserver(obsv);
+ }
+
+ @Override
+ protected void beforeExecute(Thread t, Runnable r)
+ {
+ _observerHelper.beforeExecute();
+ }
+
+ @Override
+ protected void afterExecute(Runnable t, Throwable e)
+ {
+ _observerHelper.afterExecute();
+ }
+
+ private final ThreadObserverHelper _observerHelper;
+ }
+
+ static private class QueueExecutor extends java.util.concurrent.ThreadPoolExecutor
+ {
+ QueueExecutor(com.zeroc.Ice.Properties props, String threadName)
+ {
+ super(1, 1, 0, TimeUnit.MILLISECONDS, new java.util.concurrent.LinkedBlockingQueue<Runnable>(),
+ Util.createThreadFactory(props, threadName));
+ _observerHelper = new ThreadObserverHelper(threadName);
+ }
+
+ public void updateObserver(com.zeroc.Ice.Instrumentation.CommunicatorObserver obsv)
+ {
+ _observerHelper.updateObserver(obsv);
+ }
+
+ @Override
+ protected void beforeExecute(Thread t, Runnable r)
+ {
+ _observerHelper.beforeExecute();
+ }
+
+ @Override
+ protected void afterExecute(Runnable t, Throwable e)
+ {
+ _observerHelper.afterExecute();
+ }
+
+ public void destroy()
+ throws InterruptedException
+ {
+ shutdown();
+ while(!isTerminated())
+ {
+ // A very long time.
+ awaitTermination(100000, java.util.concurrent.TimeUnit.SECONDS);
+ }
+ }
+
+ private final ThreadObserverHelper _observerHelper;
+ }
+
+ private class ObserverUpdaterI implements com.zeroc.Ice.Instrumentation.ObserverUpdater
+ {
+ @Override
+ public void
+ updateConnectionObservers()
+ {
+ Instance.this.updateConnectionObservers();
+ }
+
+ @Override
+ public void
+ updateThreadObservers()
+ {
+ Instance.this.updateThreadObservers();
+ }
+ }
+
+ public com.zeroc.Ice.InitializationData
+ initializationData()
+ {
+ //
+ // No check for destruction. It must be possible to access the
+ // initialization data after destruction.
+ //
+ // No mutex lock, immutable.
+ //
+ return _initData;
+ }
+
+ public TraceLevels
+ traceLevels()
+ {
+ // No mutex lock, immutable.
+ assert(_traceLevels != null);
+ return _traceLevels;
+ }
+
+ public DefaultsAndOverrides
+ defaultsAndOverrides()
+ {
+ // No mutex lock, immutable.
+ assert(_defaultsAndOverrides != null);
+ return _defaultsAndOverrides;
+ }
+
+ public synchronized RouterManager
+ routerManager()
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ assert(_routerManager != null);
+ return _routerManager;
+ }
+
+ public synchronized LocatorManager
+ locatorManager()
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ assert(_locatorManager != null);
+ return _locatorManager;
+ }
+
+ public synchronized ReferenceFactory
+ referenceFactory()
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ assert(_referenceFactory != null);
+ return _referenceFactory;
+ }
+
+ public synchronized RequestHandlerFactory
+ requestHandlerFactory()
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ assert(_requestHandlerFactory != null);
+ return _requestHandlerFactory;
+ }
+
+ public synchronized ProxyFactory
+ proxyFactory()
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ assert(_proxyFactory != null);
+ return _proxyFactory;
+ }
+
+ public synchronized OutgoingConnectionFactory
+ outgoingConnectionFactory()
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ assert(_outgoingConnectionFactory != null);
+ return _outgoingConnectionFactory;
+ }
+
+ public synchronized ObjectAdapterFactory
+ objectAdapterFactory()
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ assert(_objectAdapterFactory != null);
+ return _objectAdapterFactory;
+ }
+
+ public int
+ protocolSupport()
+ {
+ return _protocolSupport;
+ }
+
+ public boolean
+ preferIPv6()
+ {
+ return _preferIPv6;
+ }
+
+ public NetworkProxy
+ networkProxy()
+ {
+ return _networkProxy;
+ }
+
+ public synchronized ThreadPool
+ clientThreadPool()
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ assert(_clientThreadPool != null);
+ return _clientThreadPool;
+ }
+
+ public synchronized ThreadPool
+ serverThreadPool()
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ if(_serverThreadPool == null) // Lazy initialization.
+ {
+ if(_state == StateDestroyInProgress)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ int timeout = _initData.properties.getPropertyAsInt("Ice.ServerIdleTime");
+ _serverThreadPool = new ThreadPool(this, "Ice.ThreadPool.Server", timeout);
+ }
+
+ return _serverThreadPool;
+ }
+
+ public synchronized EndpointHostResolver
+ endpointHostResolver()
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ assert(_endpointHostResolver != null);
+ return _endpointHostResolver;
+ }
+
+ synchronized public RetryQueue
+ retryQueue()
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ assert(_retryQueue != null);
+ return _retryQueue;
+ }
+
+ synchronized public java.util.concurrent.ScheduledExecutorService
+ timer()
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ assert(_timer != null);
+ return _timer;
+ }
+
+ public synchronized EndpointFactoryManager
+ endpointFactoryManager()
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ assert(_endpointFactoryManager != null);
+ return _endpointFactoryManager;
+ }
+
+ public synchronized com.zeroc.Ice.PluginManager
+ pluginManager()
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ assert(_pluginManager != null);
+ return _pluginManager;
+ }
+
+ public int
+ messageSizeMax()
+ {
+ // No mutex lock, immutable.
+ return _messageSizeMax;
+ }
+
+ public int
+ batchAutoFlushSize()
+ {
+ // No mutex lock, immutable.
+ return _batchAutoFlushSize;
+ }
+
+ public int
+ cacheMessageBuffers()
+ {
+ // No mutex lock, immutable.
+ return _cacheMessageBuffers;
+ }
+
+ public ACMConfig
+ clientACM()
+ {
+ // No mutex lock, immutable.
+ return _clientACM;
+ }
+
+ public ACMConfig
+ serverACM()
+ {
+ // No mutex lock, immutable.
+ return _serverACM;
+ }
+
+ public com.zeroc.Ice.ImplicitContextI
+ getImplicitContext()
+ {
+ return _implicitContext;
+ }
+
+ public synchronized com.zeroc.Ice.ObjectPrx
+ createAdmin(com.zeroc.Ice.ObjectAdapter adminAdapter, com.zeroc.Ice.Identity adminIdentity)
+ {
+ if(Thread.interrupted())
+ {
+ throw new com.zeroc.Ice.OperationInterruptedException();
+ }
+
+ boolean createAdapter = (adminAdapter == null);
+
+ synchronized(this)
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ if(adminIdentity == null || adminIdentity.name == null || adminIdentity.name.isEmpty())
+ {
+ throw new com.zeroc.Ice.IllegalIdentityException(adminIdentity);
+ }
+
+ if(_adminAdapter != null)
+ {
+ throw new com.zeroc.Ice.InitializationException("Admin already created");
+ }
+
+ if(!_adminEnabled)
+ {
+ throw new com.zeroc.Ice.InitializationException("Admin is disabled");
+ }
+
+ if(createAdapter)
+ {
+ if(!_initData.properties.getProperty("Ice.Admin.Endpoints").isEmpty())
+ {
+ adminAdapter = _objectAdapterFactory.createObjectAdapter("Ice.Admin", null);
+ }
+ else
+ {
+ throw new com.zeroc.Ice.InitializationException("Ice.Admin.Endpoints is not set");
+ }
+ }
+
+ _adminIdentity = adminIdentity;
+ _adminAdapter = adminAdapter;
+ addAllAdminFacets();
+ }
+
+ if(createAdapter)
+ {
+ try
+ {
+ adminAdapter.activate();
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ //
+ // We cleanup _adminAdapter, however this error is not recoverable
+ // (can't call again getAdmin() after fixing the problem)
+ // since all the facets (servants) in the adapter are lost
+ //
+ adminAdapter.destroy();
+ synchronized(this)
+ {
+ _adminAdapter = null;
+ }
+ throw ex;
+ }
+ }
+ setServerProcessProxy(adminAdapter, adminIdentity);
+ return adminAdapter.createProxy(adminIdentity);
+ }
+
+ public com.zeroc.Ice.ObjectPrx
+ getAdmin()
+ {
+ if(Thread.interrupted())
+ {
+ throw new com.zeroc.Ice.OperationInterruptedException();
+ }
+
+ com.zeroc.Ice.ObjectAdapter adminAdapter;
+ com.zeroc.Ice.Identity adminIdentity;
+
+ synchronized(this)
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ if(_adminAdapter != null)
+ {
+ return _adminAdapter.createProxy(_adminIdentity);
+ }
+ else if(_adminEnabled)
+ {
+ if(!_initData.properties.getProperty("Ice.Admin.Endpoints").isEmpty())
+ {
+ adminAdapter = _objectAdapterFactory.createObjectAdapter("Ice.Admin", null);
+ }
+ else
+ {
+ return null;
+ }
+ adminIdentity =
+ new com.zeroc.Ice.Identity("admin", _initData.properties.getProperty("Ice.Admin.InstanceName"));
+ if(adminIdentity.category.isEmpty())
+ {
+ adminIdentity.category = java.util.UUID.randomUUID().toString();
+ }
+
+ _adminIdentity = adminIdentity;
+ _adminAdapter = adminAdapter;
+ addAllAdminFacets();
+ // continue below outside synchronization
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ try
+ {
+ adminAdapter.activate();
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ //
+ // We cleanup _adminAdapter, however this error is not recoverable
+ // (can't call again getAdmin() after fixing the problem)
+ // since all the facets (servants) in the adapter are lost
+ //
+ adminAdapter.destroy();
+ synchronized(this)
+ {
+ _adminAdapter = null;
+ }
+ throw ex;
+ }
+
+ setServerProcessProxy(adminAdapter, adminIdentity);
+ return adminAdapter.createProxy(adminIdentity);
+ }
+
+ public synchronized void
+ addAdminFacet(com.zeroc.Ice.Object servant, String facet)
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ if(_adminAdapter == null || (!_adminFacetFilter.isEmpty() && !_adminFacetFilter.contains(facet)))
+ {
+ if(_adminFacets.get(facet) != null)
+ {
+ throw new com.zeroc.Ice.AlreadyRegisteredException("facet", facet);
+ }
+ _adminFacets.put(facet, servant);
+ }
+ else
+ {
+ _adminAdapter.addFacet(servant, _adminIdentity, facet);
+ }
+ }
+
+ public synchronized com.zeroc.Ice.Object
+ removeAdminFacet(String facet)
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ com.zeroc.Ice.Object result;
+
+ if(_adminAdapter == null || (!_adminFacetFilter.isEmpty() && !_adminFacetFilter.contains(facet)))
+ {
+ result = _adminFacets.remove(facet);
+ if(result == null)
+ {
+ throw new com.zeroc.Ice.NotRegisteredException("facet", facet);
+ }
+ }
+ else
+ {
+ result = _adminAdapter.removeFacet(_adminIdentity, facet);
+ }
+
+ return result;
+ }
+
+ public synchronized com.zeroc.Ice.Object
+ findAdminFacet(String facet)
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ com.zeroc.Ice.Object result = null;
+
+ if(_adminAdapter == null || (!_adminFacetFilter.isEmpty() && !_adminFacetFilter.contains(facet)))
+ {
+ result = _adminFacets.get(facet);
+ }
+ else
+ {
+ result = _adminAdapter.findFacet(_adminIdentity, facet);
+ }
+
+ return result;
+ }
+
+ public synchronized java.util.Map<String, com.zeroc.Ice.Object>
+ findAllAdminFacets()
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ if(_adminAdapter == null)
+ {
+ return new java.util.HashMap<>(_adminFacets);
+ }
+ else
+ {
+ java.util.Map<String, com.zeroc.Ice.Object> result = _adminAdapter.findAllFacets(_adminIdentity);
+ if(!_adminFacets.isEmpty())
+ {
+ // Also returns filtered facets
+ result.putAll(_adminFacets);
+ }
+ return result;
+ }
+ }
+
+ public synchronized void
+ setDefaultLocator(com.zeroc.Ice.LocatorPrx locator)
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ _referenceFactory = _referenceFactory.setDefaultLocator(locator);
+ }
+
+ public synchronized void
+ setDefaultRouter(com.zeroc.Ice.RouterPrx router)
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ _referenceFactory = _referenceFactory.setDefaultRouter(router);
+ }
+
+ public void
+ setLogger(com.zeroc.Ice.Logger logger)
+ {
+ //
+ // No locking, as it can only be called during plug-in loading
+ //
+ _initData.logger = logger;
+ }
+
+ public void
+ setThreadHook(com.zeroc.Ice.ThreadNotification threadHook)
+ {
+ //
+ // No locking, as it can only be called during plug-in loading
+ //
+ _initData.threadHook = threadHook;
+ }
+
+ public Class<?>
+ findClass(String className)
+ {
+ return Util.findClass(className, _initData.classLoader);
+ }
+
+ public ClassLoader
+ getClassLoader()
+ {
+ return _initData.classLoader;
+ }
+
+ static private String[] _iceTypeIdPrefixes =
+ {
+ "::Glacier2::",
+ "::Ice::",
+ "::IceBox::",
+ "::IceDiscovery::",
+ "::IceGrid::",
+ "::IceLocatorDiscovery::",
+ "::IceMX::",
+ "::IcePatch2::",
+ "::IceStorm::"
+ };
+
+ //
+ // From com.zeroc.Ice.ClassResolver.
+ //
+ public Class<?> resolveClass(String typeId)
+ throws LinkageError
+ {
+ Class<?> c = null;
+
+ //
+ // To convert a Slice type id into a Java class, we do the following:
+ //
+ // 1. Convert the Slice type id into a classname (e.g., ::M::X -> M.X).
+ // 2. If that fails, extract the top-level module (if any) from the type id
+ // and check for a Package property. If found, prepend the property
+ // value to the classname.
+ // 3. If that fails, check for an Default.Package property. If found,
+ // prepend the property value to the classname.
+ //
+ String className;
+ boolean addClass = false;
+
+ //
+ // See if we've already translated this type ID before.
+ //
+ synchronized(this)
+ {
+ className = _typeToClassMap.get(typeId);
+ }
+
+ //
+ // It's a new type ID, so first convert it into a Java class name.
+ //
+ if(className == null)
+ {
+ className = com.zeroc.Ice.Util.typeIdToClass(typeId);
+ addClass = true;
+ }
+
+ //
+ // See if we can find the class without any prefix.
+ //
+ c = getConcreteClass(className);
+
+ //
+ // See if the application defined an Ice.Package.MODULE property.
+ //
+ if(c == null)
+ {
+ int pos = typeId.indexOf(':', 2);
+ if(pos != -1)
+ {
+ String topLevelModule = typeId.substring(2, pos);
+ String pkg = _initData.properties.getProperty("Ice.Package." + topLevelModule);
+ if(pkg.length() > 0)
+ {
+ c = getConcreteClass(pkg + "." + className);
+ }
+ }
+ }
+
+ //
+ // See if the application defined a default package.
+ //
+ if(c == null)
+ {
+ String pkg = _initData.properties.getProperty("Ice.Default.Package");
+ if(pkg.length() > 0)
+ {
+ c = getConcreteClass(pkg + "." + className);
+ }
+ }
+
+ //
+ // See if the type ID is one of the Ice modules.
+ //
+ if(c == null)
+ {
+ String pkg = null;
+ for(int i = 0; i < _iceTypeIdPrefixes.length && c == null; ++i)
+ {
+ if(typeId.startsWith(_iceTypeIdPrefixes[i]))
+ {
+ c = getConcreteClass("com.zeroc." + className);
+ }
+ }
+ }
+
+ //
+ // If we found the class, update our map so we don't have to translate this type ID again.
+ //
+ if(c != null && addClass)
+ {
+ synchronized(this)
+ {
+ className = c.getName();
+ if(_typeToClassMap.containsKey(typeId))
+ {
+ assert(_typeToClassMap.get(typeId).equals(className));
+ }
+ else
+ {
+ _typeToClassMap.put(typeId, className);
+ }
+ }
+ }
+
+ return c;
+ }
+
+ public String resolveCompactId(int compactId)
+ {
+ String className = "com.zeroc.IceCompactId.TypeId_" + Integer.toString(compactId);
+ Class<?> c = getConcreteClass(className);
+ if(c == null)
+ {
+ for(String pkg : _packages)
+ {
+ c = getConcreteClass(pkg + "." + className);
+ if(c != null)
+ {
+ break;
+ }
+ }
+ }
+ if(c != null)
+ {
+ try
+ {
+ return (String)c.getField("typeId").get(null);
+ }
+ catch(Exception ex)
+ {
+ assert(false);
+ }
+ }
+ return "";
+ }
+
+ public Class<?> getConcreteClass(String className)
+ throws LinkageError
+ {
+ Class<?> c = findClass(className);
+
+ if(c != null)
+ {
+ //
+ // Ensure the class is instantiable. The constants are
+ // defined in the JVM specification (0x200 = interface,
+ // 0x400 = abstract).
+ //
+ final int modifiers = c.getModifiers();
+ if((modifiers & 0x200) == 0 && (modifiers & 0x400) == 0)
+ {
+ return c;
+ }
+ }
+
+ return null;
+ }
+
+ public boolean
+ useApplicationClassLoader()
+ {
+ return _useApplicationClassLoader;
+ }
+
+ public boolean
+ queueRequests()
+ {
+ return _queueExecutorService != null;
+ }
+
+ synchronized public QueueExecutorService
+ getQueueExecutor()
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+ return _queueExecutorService;
+ }
+
+ //
+ // Only for use by com.zeroc.Ice.CommunicatorI
+ //
+ public
+ Instance(com.zeroc.Ice.Communicator communicator, com.zeroc.Ice.InitializationData initData)
+ {
+ _state = StateActive;
+ _initData = initData;
+
+ try
+ {
+ if(_initData.properties == null)
+ {
+ _initData.properties = com.zeroc.Ice.Util.createProperties();
+ }
+
+ synchronized(Instance.class)
+ {
+ if(!_oneOffDone)
+ {
+ String stdOut = _initData.properties.getProperty("Ice.StdOut");
+ String stdErr = _initData.properties.getProperty("Ice.StdErr");
+
+ java.io.PrintStream outStream = null;
+
+ if(stdOut.length() > 0)
+ {
+ //
+ // We need to close the existing stdout for JVM thread dump to go
+ // to the new file
+ //
+ System.out.close();
+
+ try
+ {
+ outStream = new java.io.PrintStream(new java.io.FileOutputStream(stdOut, true));
+ }
+ catch(java.io.FileNotFoundException ex)
+ {
+ throw new com.zeroc.Ice.FileException(0, stdOut, ex);
+ }
+
+ System.setOut(outStream);
+ }
+ if(stdErr.length() > 0)
+ {
+ //
+ // close for consistency with stdout
+ //
+ System.err.close();
+
+ if(stdErr.equals(stdOut))
+ {
+ System.setErr(outStream);
+ }
+ else
+ {
+ try
+ {
+ System.setErr(new java.io.PrintStream(new java.io.FileOutputStream(stdErr, true)));
+ }
+ catch(java.io.FileNotFoundException ex)
+ {
+ throw new com.zeroc.Ice.FileException(0, stdErr, ex);
+ }
+
+ }
+ }
+ _oneOffDone = true;
+ }
+ }
+
+ if(_initData.logger == null)
+ {
+ String logfile = _initData.properties.getProperty("Ice.LogFile");
+ if(_initData.properties.getPropertyAsInt("Ice.UseSyslog") > 0 &&
+ !System.getProperty("os.name").startsWith("Windows"))
+ {
+ if(logfile.length() != 0)
+ {
+ throw new com.zeroc.Ice.InitializationException(
+ "Both syslog and file logger cannot be enabled.");
+ }
+ _initData.logger = new com.zeroc.Ice.SysLoggerI(
+ _initData.properties.getProperty("Ice.ProgramName"),
+ _initData.properties.getPropertyWithDefault("Ice.SyslogFacility", "LOG_USER"));
+ }
+ else if(logfile.length() != 0)
+ {
+ _initData.logger =
+ new com.zeroc.Ice.LoggerI(_initData.properties.getProperty("Ice.ProgramName"), logfile);
+ }
+ else
+ {
+ _initData.logger = com.zeroc.Ice.Util.getProcessLogger();
+ }
+ }
+
+ _packages = validatePackages();
+
+ _useApplicationClassLoader = _initData.properties.getPropertyAsInt("Ice.UseApplicationClassLoader") > 0;
+
+ _traceLevels = new TraceLevels(_initData.properties);
+
+ _defaultsAndOverrides = new DefaultsAndOverrides(_initData.properties, _initData.logger);
+
+ _clientACM = new ACMConfig(_initData.properties,
+ _initData.logger,
+ "Ice.ACM.Client",
+ new ACMConfig(_initData.properties, _initData.logger, "Ice.ACM",
+ new ACMConfig(false)));
+
+ _serverACM = new ACMConfig(_initData.properties,
+ _initData.logger,
+ "Ice.ACM.Server",
+ new ACMConfig(_initData.properties, _initData.logger, "Ice.ACM",
+ new ACMConfig(true)));
+
+ {
+ final int defaultMessageSizeMax = 1024;
+ int num = _initData.properties.getPropertyAsIntWithDefault("Ice.MessageSizeMax", defaultMessageSizeMax);
+ if(num < 1 || num > 0x7fffffff / 1024)
+ {
+ _messageSizeMax = 0x7fffffff;
+ }
+ else
+ {
+ _messageSizeMax = num * 1024; // Property is in kilobytes, _messageSizeMax in bytes
+ }
+ }
+
+ if(_initData.properties.getProperty("Ice.BatchAutoFlushSize").isEmpty() &&
+ !_initData.properties.getProperty("Ice.BatchAutoFlush").isEmpty())
+ {
+ if(_initData.properties.getPropertyAsInt("Ice.BatchAutoFlush") > 0)
+ {
+ _batchAutoFlushSize = _messageSizeMax;
+ }
+ else
+ {
+ _batchAutoFlushSize = 0;
+ }
+ }
+ else
+ {
+ int num = _initData.properties.getPropertyAsIntWithDefault("Ice.BatchAutoFlushSize", 1024); // 1MB
+ if(num < 1)
+ {
+ _batchAutoFlushSize = num;
+ }
+ else if(num > 0x7fffffff / 1024)
+ {
+ _batchAutoFlushSize = 0x7fffffff;
+ }
+ else
+ {
+ _batchAutoFlushSize = num * 1024; // Property is in kilobytes, _batchAutoFlushSize in bytes
+ }
+ }
+
+ _implicitContext =
+ com.zeroc.Ice.ImplicitContextI.create(_initData.properties.getProperty("Ice.ImplicitContext"));
+
+ _routerManager = new RouterManager();
+
+ _locatorManager = new LocatorManager(_initData.properties);
+
+ _referenceFactory = new ReferenceFactory(this, communicator);
+
+ _requestHandlerFactory = new RequestHandlerFactory(this);
+
+ _proxyFactory = new ProxyFactory(this);
+
+ boolean isIPv6Supported = Network.isIPv6Supported();
+ boolean ipv4 = _initData.properties.getPropertyAsIntWithDefault("Ice.IPv4", 1) > 0;
+ boolean ipv6 = _initData.properties.getPropertyAsIntWithDefault("Ice.IPv6", isIPv6Supported ? 1 : 0) > 0;
+ if(!ipv4 && !ipv6)
+ {
+ throw new com.zeroc.Ice.InitializationException("Both IPV4 and IPv6 support cannot be disabled.");
+ }
+ else if(ipv4 && ipv6)
+ {
+ _protocolSupport = Network.EnableBoth;
+ }
+ else if(ipv4)
+ {
+ _protocolSupport = Network.EnableIPv4;
+ }
+ else
+ {
+ _protocolSupport = Network.EnableIPv6;
+ }
+ _preferIPv6 = _initData.properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0;
+
+ _networkProxy = createNetworkProxy(_initData.properties, _protocolSupport);
+
+ _endpointFactoryManager = new EndpointFactoryManager(this);
+
+ ProtocolInstance tcpProtocolInstance =
+ new ProtocolInstance(this, com.zeroc.Ice.TCPEndpointType.value, "tcp", false);
+ _endpointFactoryManager.add(new TcpEndpointFactory(tcpProtocolInstance));
+
+ ProtocolInstance udpProtocolInstance =
+ new ProtocolInstance(this, com.zeroc.Ice.UDPEndpointType.value, "udp", false);
+ _endpointFactoryManager.add(new UdpEndpointFactory(udpProtocolInstance));
+
+ _pluginManager = new com.zeroc.Ice.PluginManagerI(communicator, this);
+
+ if(_initData.valueFactoryManager == null)
+ {
+ _initData.valueFactoryManager = new ValueFactoryManagerI();
+ }
+
+ _outgoingConnectionFactory = new OutgoingConnectionFactory(communicator, this);
+
+ _objectAdapterFactory = new ObjectAdapterFactory(this, communicator);
+
+ _retryQueue = new RetryQueue(this);
+
+ //
+ // If Ice.ThreadInterruptSafe is set or we're running on Android all
+ // IO is done on the background thread. For Android we use the queue
+ // executor as Android doesn't allow any network invocations on the main
+ // thread even if the call is non-blocking.
+ //
+ if(_initData.properties.getPropertyAsInt("Ice.ThreadInterruptSafe") > 0 || Util.isAndroid())
+ {
+ _queueExecutor = new QueueExecutor(_initData.properties,
+ Util.createThreadName(_initData.properties, "Ice.BackgroundIO"));
+ _queueExecutorService = new QueueExecutorService(_queueExecutor);
+
+ // Caching message buffers is not supported with background IO.
+ _cacheMessageBuffers = 0;
+ }
+ else
+ {
+ _cacheMessageBuffers = _initData.properties.getPropertyAsIntWithDefault("Ice.CacheMessageBuffers", 2);
+ }
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ destroy();
+ throw ex;
+ }
+ }
+
+ @Override
+ protected synchronized void
+ finalize()
+ throws Throwable
+ {
+ try
+ {
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_state == StateDestroyed);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_referenceFactory == null);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_requestHandlerFactory == null);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_proxyFactory == null);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_outgoingConnectionFactory == null);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_objectAdapterFactory == null);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_clientThreadPool == null);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_serverThreadPool == null);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_endpointHostResolver == null);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_timer == null);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_routerManager == null);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_locatorManager == null);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_endpointFactoryManager == null);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_pluginManager == null);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_retryQueue == null);
+ }
+ catch(java.lang.Exception ex)
+ {
+ }
+ finally
+ {
+ super.finalize();
+ }
+ }
+
+ public String[] finishSetup(String[] args, com.zeroc.Ice.Communicator communicator)
+ {
+ //
+ // Load plug-ins.
+ //
+ assert(_serverThreadPool == null);
+ com.zeroc.Ice.PluginManagerI pluginManagerImpl = (com.zeroc.Ice.PluginManagerI)_pluginManager;
+ args = pluginManagerImpl.loadPlugins(args);
+
+ //
+ // Add WS and WSS endpoint factories if TCP/SSL factories are installed.
+ //
+ final EndpointFactory tcpFactory = _endpointFactoryManager.get(com.zeroc.Ice.TCPEndpointType.value);
+ if(tcpFactory != null)
+ {
+ final ProtocolInstance instance =
+ new ProtocolInstance(this, com.zeroc.Ice.WSEndpointType.value, "ws", false);
+ _endpointFactoryManager.add(new WSEndpointFactory(instance, tcpFactory.clone(instance, null)));
+ }
+ final EndpointFactory sslFactory = _endpointFactoryManager.get(com.zeroc.Ice.SSLEndpointType.value);
+ if(sslFactory != null)
+ {
+ final ProtocolInstance instance =
+ new ProtocolInstance(this, com.zeroc.Ice.WSSEndpointType.value, "wss", true);
+ _endpointFactoryManager.add(new WSEndpointFactory(instance, sslFactory.clone(instance, null)));
+ }
+
+ //
+ // Create Admin facets, if enabled.
+ //
+ // Note that any logger-dependent admin facet must be created after we load all plugins,
+ // since one of these plugins can be a Logger plugin that sets a new logger during loading
+ //
+
+ if(_initData.properties.getProperty("Ice.Admin.Enabled").isEmpty())
+ {
+ _adminEnabled = !_initData.properties.getProperty("Ice.Admin.Endpoints").isEmpty();
+ }
+ else
+ {
+ _adminEnabled = _initData.properties.getPropertyAsInt("Ice.Admin.Enabled") > 0;
+ }
+
+ String[] facetFilter = _initData.properties.getPropertyAsList("Ice.Admin.Facets");
+ if(facetFilter.length > 0)
+ {
+ _adminFacetFilter.addAll(java.util.Arrays.asList(facetFilter));
+ }
+
+ if(_adminEnabled)
+ {
+ //
+ // Process facet
+ //
+ String processFacetName = "Process";
+ if(_adminFacetFilter.isEmpty() || _adminFacetFilter.contains(processFacetName))
+ {
+ _adminFacets.put(processFacetName, new ProcessI(communicator));
+ }
+
+ //
+ // Logger facet
+ //
+ String loggerFacetName = "Logger";
+ if(_adminFacetFilter.isEmpty() || _adminFacetFilter.contains(loggerFacetName))
+ {
+ LoggerAdminLogger logger = new LoggerAdminLoggerI(_initData.properties, _initData.logger);
+ setLogger(logger);
+ _adminFacets.put(loggerFacetName, logger.getFacet());
+ }
+
+ //
+ // Properties facet
+ //
+ String propertiesFacetName = "Properties";
+ PropertiesAdminI propsAdmin = null;
+ if(_adminFacetFilter.isEmpty() || _adminFacetFilter.contains(propertiesFacetName))
+ {
+ propsAdmin = new PropertiesAdminI(this);
+ _adminFacets.put(propertiesFacetName, propsAdmin);
+ }
+
+ //
+ // Metrics facet
+ //
+ String metricsFacetName = "Metrics";
+ if(_adminFacetFilter.isEmpty() || _adminFacetFilter.contains(metricsFacetName))
+ {
+ CommunicatorObserverI observer = new CommunicatorObserverI(_initData);
+ _initData.observer = observer;
+ _adminFacets.put(metricsFacetName, observer.getFacet());
+
+ //
+ // Make sure the admin plugin receives property updates.
+ //
+ if(propsAdmin != null)
+ {
+ propsAdmin.addUpdateCallback(observer.getFacet());
+ }
+ }
+ }
+
+ //
+ // Set observer updater
+ //
+ if(_initData.observer != null)
+ {
+ _initData.observer.setObserverUpdater(new ObserverUpdaterI());
+ }
+
+ //
+ // Create threads.
+ //
+ try
+ {
+ _timer = new Timer(_initData.properties, Util.createThreadName(_initData.properties, "Ice.Timer"));
+ }
+ catch(RuntimeException ex)
+ {
+ String s = "cannot create thread for timer:\n" + Ex.toString(ex);
+ _initData.logger.error(s);
+ throw ex;
+ }
+
+ try
+ {
+ _endpointHostResolver = new EndpointHostResolver(this);
+ }
+ catch(RuntimeException ex)
+ {
+ String s = "cannot create thread for endpoint host resolver:\n" + Ex.toString(ex);
+ _initData.logger.error(s);
+ throw ex;
+ }
+
+ _clientThreadPool = new ThreadPool(this, "Ice.ThreadPool.Client", 0);
+
+ //
+ // The default router/locator may have been set during the loading of plugins.
+ // Therefore we make sure it is not already set before checking the property.
+ //
+ if(_referenceFactory.getDefaultRouter() == null)
+ {
+ com.zeroc.Ice.RouterPrx router =
+ com.zeroc.Ice.RouterPrx.uncheckedCast(_proxyFactory.propertyToProxy("Ice.Default.Router"));
+ if(router != null)
+ {
+ _referenceFactory = _referenceFactory.setDefaultRouter(router);
+ }
+ }
+
+ if(_referenceFactory.getDefaultLocator() == null)
+ {
+ com.zeroc.Ice.LocatorPrx loc =
+ com.zeroc.Ice.LocatorPrx.uncheckedCast(_proxyFactory.propertyToProxy("Ice.Default.Locator"));
+ if(loc != null)
+ {
+ _referenceFactory = _referenceFactory.setDefaultLocator(loc);
+ }
+ }
+
+ //
+ // Server thread pool initialization is lazy in serverThreadPool().
+ //
+
+ //
+ // An application can set Ice.InitPlugins=0 if it wants to postpone
+ // initialization until after it has interacted directly with the
+ // plug-ins.
+ //
+ if(_initData.properties.getPropertyAsIntWithDefault("Ice.InitPlugins", 1) > 0)
+ {
+ pluginManagerImpl.initializePlugins();
+ }
+
+ //
+ // This must be done last as this call creates the Ice.Admin object adapter
+ // and eventually registers a process proxy with the Ice locator (allowing
+ // remote clients to invoke on Ice.Admin facets as soon as it's registered).
+ //
+ if(_initData.properties.getPropertyAsIntWithDefault("Ice.Admin.DelayCreation", 0) <= 0)
+ {
+ getAdmin();
+ }
+
+ return args;
+ }
+
+ //
+ // Only for use by com.zeroc.Ice.CommunicatorI
+ //
+ @SuppressWarnings("deprecation")
+ public void
+ destroy()
+ {
+ if(Thread.interrupted())
+ {
+ throw new com.zeroc.Ice.OperationInterruptedException();
+ }
+
+ synchronized(this)
+ {
+ //
+ // If destroy is in progress, wait for it to be done. This
+ // is necessary in case destroy() is called concurrently
+ // by multiple threads.
+ //
+ while(_state == StateDestroyInProgress)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ throw new com.zeroc.Ice.OperationInterruptedException();
+ }
+ }
+
+ if(_state == StateDestroyed)
+ {
+ return;
+ }
+ _state = StateDestroyInProgress;
+ }
+
+ try
+ {
+ //
+ // Shutdown and destroy all the incoming and outgoing Ice
+ // connections and wait for the connections to be finished.
+ //
+ if(_objectAdapterFactory != null)
+ {
+ _objectAdapterFactory.shutdown();
+ }
+
+ if(_outgoingConnectionFactory != null)
+ {
+ _outgoingConnectionFactory.destroy();
+ }
+
+ if(_objectAdapterFactory != null)
+ {
+ _objectAdapterFactory.destroy();
+ }
+
+ if(_outgoingConnectionFactory != null)
+ {
+ _outgoingConnectionFactory.waitUntilFinished();
+ }
+
+ if(_retryQueue != null)
+ {
+ _retryQueue.destroy(); // Must be called before destroying thread pools.
+ }
+
+ if(_initData.observer != null)
+ {
+ _initData.observer.setObserverUpdater(null);
+ }
+
+ if(_initData.logger instanceof LoggerAdminLogger)
+ {
+ //
+ // This only disables the remote logging; we don't set or reset _initData.logger
+ //
+ ((LoggerAdminLogger)_initData.logger).destroy();
+ }
+
+ //
+ // Now, destroy the thread pools. This must be done *only* after
+ // all the connections are finished (the connections destruction
+ // can require invoking callbacks with the thread pools).
+ //
+ if(_serverThreadPool != null)
+ {
+ _serverThreadPool.destroy();
+ }
+ if(_clientThreadPool != null)
+ {
+ _clientThreadPool.destroy();
+ }
+ if(_endpointHostResolver != null)
+ {
+ _endpointHostResolver.destroy();
+ }
+ if(_timer != null)
+ {
+ _timer.shutdown(); // Don't use shutdownNow(), timers don't support interrupts
+ }
+
+ //
+ // Wait for all the threads to be finished.
+ //
+ try
+ {
+ if(_clientThreadPool != null)
+ {
+ _clientThreadPool.joinWithAllThreads();
+ }
+ if(_serverThreadPool != null)
+ {
+ _serverThreadPool.joinWithAllThreads();
+ }
+ if(_endpointHostResolver != null)
+ {
+ _endpointHostResolver.joinWithThread();
+ }
+ if(_queueExecutor != null)
+ {
+ _queueExecutor.destroy();
+ }
+ if(_timer != null)
+ {
+ while(!_timer.isTerminated())
+ {
+ // A very long time.
+ _timer.awaitTermination(100000, java.util.concurrent.TimeUnit.SECONDS);
+ }
+ }
+ }
+ catch(InterruptedException ex)
+ {
+ throw new com.zeroc.Ice.OperationInterruptedException();
+ }
+
+ //
+ // NOTE: at this point destroy() can't be interrupted
+ // anymore. The calls below are therefore guaranteed to be
+ // called once.
+ //
+
+ for(com.zeroc.Ice.ObjectFactory f : _objectFactoryMap.values())
+ {
+ f.destroy();
+ }
+ _objectFactoryMap.clear();
+
+ if(_routerManager != null)
+ {
+ _routerManager.destroy();
+ }
+
+ if(_locatorManager != null)
+ {
+ _locatorManager.destroy();
+ }
+
+ if(_endpointFactoryManager != null)
+ {
+ _endpointFactoryManager.destroy();
+ }
+
+ if(_initData.properties.getPropertyAsInt("Ice.Warn.UnusedProperties") > 0)
+ {
+ java.util.List<String> unusedProperties =
+ ((com.zeroc.Ice.PropertiesI)_initData.properties).getUnusedProperties();
+ if(unusedProperties.size() != 0)
+ {
+ StringBuilder message = new StringBuilder("The following properties were set but never read:");
+ for(String p : unusedProperties)
+ {
+ message.append("\n ");
+ message.append(p);
+ }
+ _initData.logger.warning(message.toString());
+ }
+ }
+
+ //
+ // Destroy last so that a Logger plugin can receive all log/traces before its destruction.
+ //
+ if(_pluginManager != null)
+ {
+ _pluginManager.destroy();
+ }
+
+ synchronized(this)
+ {
+ _objectAdapterFactory = null;
+ _outgoingConnectionFactory = null;
+ _retryQueue = null;
+
+ _serverThreadPool = null;
+ _clientThreadPool = null;
+ _endpointHostResolver = null;
+ _timer = null;
+
+ _referenceFactory = null;
+ _requestHandlerFactory = null;
+ _proxyFactory = null;
+ _routerManager = null;
+ _locatorManager = null;
+ _endpointFactoryManager = null;
+
+ _pluginManager = null;
+
+ _adminAdapter = null;
+ _adminFacets.clear();
+
+ _queueExecutor = null;
+ _queueExecutorService = null;
+
+ _typeToClassMap.clear();
+
+ _state = StateDestroyed;
+ notifyAll();
+ }
+ }
+ finally
+ {
+ synchronized(this)
+ {
+ if(_state == StateDestroyInProgress)
+ {
+ _state = StateActive;
+ notifyAll();
+ }
+ }
+ }
+ }
+
+ public BufSizeWarnInfo getBufSizeWarn(short type)
+ {
+ synchronized(_setBufSizeWarn)
+ {
+ BufSizeWarnInfo info;
+ if(!_setBufSizeWarn.containsKey(type))
+ {
+ info = new BufSizeWarnInfo();
+ info.sndWarn = false;
+ info.sndSize = -1;
+ info.rcvWarn = false;
+ info.rcvSize = -1;
+ _setBufSizeWarn.put(type, info);
+ }
+ else
+ {
+ info = _setBufSizeWarn.get(type);
+ }
+ return info;
+ }
+ }
+
+ public void setSndBufSizeWarn(short type, int size)
+ {
+ synchronized(_setBufSizeWarn)
+ {
+ BufSizeWarnInfo info = getBufSizeWarn(type);
+ info.sndWarn = true;
+ info.sndSize = size;
+ _setBufSizeWarn.put(type, info);
+ }
+ }
+
+ public void setRcvBufSizeWarn(short type, int size)
+ {
+ synchronized(_setBufSizeWarn)
+ {
+ BufSizeWarnInfo info = getBufSizeWarn(type);
+ info.rcvWarn = true;
+ info.rcvSize = size;
+ _setBufSizeWarn.put(type, info);
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ public synchronized void addObjectFactory(final com.zeroc.Ice.ObjectFactory factory, String id)
+ {
+ //
+ // Create a ValueFactory wrapper around the given ObjectFactory and register the wrapper
+ // with the value factory manager. This may raise AlreadyRegisteredException.
+ //
+ _initData.valueFactoryManager.add(
+ new com.zeroc.Ice.ValueFactory()
+ {
+ public com.zeroc.Ice.Value create(String id)
+ {
+ return factory.create(id);
+ }
+ }, id);
+
+ _objectFactoryMap.put(id, factory);
+ }
+
+ @SuppressWarnings("deprecation")
+ public synchronized com.zeroc.Ice.ObjectFactory findObjectFactory(String id)
+ {
+ return _objectFactoryMap.get(id);
+ }
+
+ private void
+ updateConnectionObservers()
+ {
+ try
+ {
+ assert(_outgoingConnectionFactory != null);
+ _outgoingConnectionFactory.updateConnectionObservers();
+ assert(_objectAdapterFactory != null);
+ _objectAdapterFactory.updateConnectionObservers();
+ }
+ catch(com.zeroc.Ice.CommunicatorDestroyedException ex)
+ {
+ }
+ }
+
+ private void
+ updateThreadObservers()
+ {
+ try
+ {
+ if(_clientThreadPool != null)
+ {
+ _clientThreadPool.updateObservers();
+ }
+ if(_serverThreadPool != null)
+ {
+ _serverThreadPool.updateObservers();
+ }
+ assert(_objectAdapterFactory != null);
+ _objectAdapterFactory.updateThreadObservers();
+ if(_endpointHostResolver != null)
+ {
+ _endpointHostResolver.updateObserver();
+ }
+ if(_timer != null)
+ {
+ _timer.updateObserver(_initData.observer);
+ }
+ if(_queueExecutor != null)
+ {
+ _queueExecutor.updateObserver(_initData.observer);
+ }
+ }
+ catch(com.zeroc.Ice.CommunicatorDestroyedException ex)
+ {
+ }
+ }
+
+ private String[]
+ validatePackages()
+ {
+ final String prefix = "Ice.Package.";
+ java.util.Map<String, String> map = _initData.properties.getPropertiesForPrefix(prefix);
+ java.util.List<String> packages = new java.util.ArrayList<>();
+ for(java.util.Map.Entry<String, String> p : map.entrySet())
+ {
+ String key = p.getKey();
+ String pkg = p.getValue();
+ if(key.length() == prefix.length())
+ {
+ _initData.logger.warning("ignoring invalid property: " + key + "=" + pkg);
+ }
+ String module = key.substring(prefix.length());
+ String className = pkg + "." + module + "._Marker";
+ Class<?> cls = null;
+ try
+ {
+ cls = findClass(className);
+ }
+ catch(java.lang.Exception ex)
+ {
+ }
+ if(cls == null)
+ {
+ _initData.logger.warning("unable to validate package: " + key + "=" + pkg);
+ }
+ else
+ {
+ packages.add(pkg);
+ }
+ }
+
+ String pkg = _initData.properties.getProperty("Ice.Default.Package");
+ if(pkg.length() > 0)
+ {
+ packages.add(pkg);
+ }
+ return packages.toArray(new String[packages.size()]);
+ }
+
+ private synchronized void
+ addAllAdminFacets()
+ {
+ java.util.Map<String, com.zeroc.Ice.Object> filteredFacets = new java.util.HashMap<>();
+ for(java.util.Map.Entry<String, com.zeroc.Ice.Object> p : _adminFacets.entrySet())
+ {
+ if(_adminFacetFilter.isEmpty() || _adminFacetFilter.contains(p.getKey()))
+ {
+ _adminAdapter.addFacet(p.getValue(), _adminIdentity, p.getKey());
+ }
+ else
+ {
+ filteredFacets.put(p.getKey(), p.getValue());
+ }
+ }
+ _adminFacets = filteredFacets;
+ }
+
+ private void
+ setServerProcessProxy(com.zeroc.Ice.ObjectAdapter adminAdapter, com.zeroc.Ice.Identity adminIdentity)
+ {
+ com.zeroc.Ice.ObjectPrx admin = adminAdapter.createProxy(adminIdentity);
+ com.zeroc.Ice.LocatorPrx locator = adminAdapter.getLocator();
+ String serverId = _initData.properties.getProperty("Ice.Admin.ServerId");
+
+ if(locator != null && !serverId.isEmpty())
+ {
+ com.zeroc.Ice.ProcessPrx process = com.zeroc.Ice.ProcessPrx.uncheckedCast(admin.ice_facet("Process"));
+ try
+ {
+ //
+ // Note that as soon as the process proxy is registered, the communicator might be
+ // shutdown by a remote client and admin facets might start receiving calls.
+ //
+ locator.getRegistry().setServerProcessProxy(serverId, process);
+ }
+ catch(com.zeroc.Ice.ServerNotFoundException ex)
+ {
+ if(_traceLevels.location >= 1)
+ {
+ StringBuilder s = new StringBuilder(128);
+ s.append("couldn't register server `");
+ s.append(serverId);
+ s.append("' with the locator registry:\n");
+ s.append("the server is not known to the locator registry");
+ _initData.logger.trace(_traceLevels.locationCat, s.toString());
+ }
+
+ throw new com.zeroc.Ice.InitializationException(
+ "Locator knows nothing about server `" + serverId + "'");
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ if(_traceLevels.location >= 1)
+ {
+ StringBuilder s = new StringBuilder(128);
+ s.append("couldn't register server `");
+ s.append(serverId);
+ s.append("' with the locator registry:\n");
+ s.append(ex.toString());
+ _initData.logger.trace(_traceLevels.locationCat, s.toString());
+ }
+ throw ex;
+ }
+
+ if(_traceLevels.location >= 1)
+ {
+ StringBuilder s = new StringBuilder(128);
+ s.append("registered server `");
+ s.append(serverId);
+ s.append("' with the locator registry");
+ _initData.logger.trace(_traceLevels.locationCat, s.toString());
+ }
+ }
+ }
+
+ private NetworkProxy createNetworkProxy(com.zeroc.Ice.Properties properties, int protocolSupport)
+ {
+ String proxyHost;
+
+ proxyHost = properties.getProperty("Ice.SOCKSProxyHost");
+ if(!proxyHost.isEmpty())
+ {
+ if(protocolSupport == Network.EnableIPv6)
+ {
+ throw new com.zeroc.Ice.InitializationException("IPv6 only is not supported with SOCKS4 proxies");
+ }
+ int proxyPort = properties.getPropertyAsIntWithDefault("Ice.SOCKSProxyPort", 1080);
+ return new SOCKSNetworkProxy(proxyHost, proxyPort);
+ }
+
+ proxyHost = properties.getProperty("Ice.HTTPProxyHost");
+ if(!proxyHost.isEmpty())
+ {
+ return new HTTPNetworkProxy(proxyHost, properties.getPropertyAsIntWithDefault("Ice.HTTPProxyPort", 1080));
+ }
+
+ return null;
+ }
+
+ private static final int StateActive = 0;
+ private static final int StateDestroyInProgress = 1;
+ private static final int StateDestroyed = 2;
+ private int _state;
+
+ private final com.zeroc.Ice.InitializationData _initData; // Immutable, not reset by destroy().
+ private final TraceLevels _traceLevels; // Immutable, not reset by destroy().
+ private final DefaultsAndOverrides _defaultsAndOverrides; // Immutable, not reset by destroy().
+ private final int _messageSizeMax; // Immutable, not reset by destroy().
+ private final int _batchAutoFlushSize; // Immutable, not reset by destroy().
+ private final int _cacheMessageBuffers; // Immutable, not reset by destroy().
+ private final ACMConfig _clientACM; // Immutable, not reset by destroy().
+ private final ACMConfig _serverACM; // Immutable, not reset by destroy().
+ private final com.zeroc.Ice.ImplicitContextI _implicitContext;
+ private RouterManager _routerManager;
+ private LocatorManager _locatorManager;
+ private ReferenceFactory _referenceFactory;
+ private RequestHandlerFactory _requestHandlerFactory;
+ private ProxyFactory _proxyFactory;
+ private OutgoingConnectionFactory _outgoingConnectionFactory;
+ private ObjectAdapterFactory _objectAdapterFactory;
+ private int _protocolSupport;
+ private boolean _preferIPv6;
+ private NetworkProxy _networkProxy;
+ private ThreadPool _clientThreadPool;
+ private ThreadPool _serverThreadPool;
+ private EndpointHostResolver _endpointHostResolver;
+ private RetryQueue _retryQueue;
+ private Timer _timer;
+ private EndpointFactoryManager _endpointFactoryManager;
+ private com.zeroc.Ice.PluginManager _pluginManager;
+
+ private boolean _adminEnabled = false;
+ private com.zeroc.Ice.ObjectAdapter _adminAdapter;
+ private java.util.Map<String, com.zeroc.Ice.Object> _adminFacets = new java.util.HashMap<>();
+ private java.util.Set<String> _adminFacetFilter = new java.util.HashSet<>();
+ private com.zeroc.Ice.Identity _adminIdentity;
+ private java.util.Map<Short, BufSizeWarnInfo> _setBufSizeWarn = new java.util.HashMap<>();
+
+ private java.util.Map<String, String> _typeToClassMap = new java.util.HashMap<>();
+ final private String[] _packages;
+ final private boolean _useApplicationClassLoader;
+
+ private static boolean _oneOffDone = false;
+ private QueueExecutorService _queueExecutorService;
+ private QueueExecutor _queueExecutor;
+
+ @SuppressWarnings("deprecation")
+ private java.util.HashMap<String, com.zeroc.Ice.ObjectFactory> _objectFactoryMap = new java.util.HashMap<>();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/InvocationFutureI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/InvocationFutureI.java
new file mode 100644
index 00000000000..0561794d2a5
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/InvocationFutureI.java
@@ -0,0 +1,526 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.Executor;
+
+import com.zeroc.Ice.Communicator;
+import com.zeroc.Ice.CommunicatorDestroyedException;
+import com.zeroc.Ice.Connection;
+
+public abstract class InvocationFutureI<T> extends com.zeroc.Ice.InvocationFuture<T>
+{
+ @Override
+ public boolean cancel()
+ {
+ return cancel(false);
+ }
+
+ @Override
+ public boolean cancel(boolean mayInterruptIfRunning)
+ {
+ //
+ // Call super.cancel(boolean) first. This sets the result of the future.
+ // Calling cancel(LocalException) also eventually attempts to complete the future
+ // (exceptionally), but this result is ignored.
+ //
+ boolean r = super.cancel(mayInterruptIfRunning);
+ cancel(new com.zeroc.Ice.InvocationCanceledException());
+ return r;
+ }
+
+ @Override
+ public Communicator getCommunicator()
+ {
+ return _communicator;
+ }
+
+ @Override
+ public com.zeroc.Ice.Connection getConnection()
+ {
+ return null;
+ }
+
+ @Override
+ public com.zeroc.Ice.ObjectPrx getProxy()
+ {
+ return null;
+ }
+
+ @Override
+ public final String getOperation()
+ {
+ return _operation;
+ }
+
+ @Override
+ public final void waitForCompleted()
+ {
+ if(Thread.interrupted())
+ {
+ throw new com.zeroc.Ice.OperationInterruptedException();
+ }
+ try
+ {
+ join();
+ }
+ catch(Exception ex)
+ {
+ }
+ }
+
+ @Override
+ public final boolean isSent()
+ {
+ synchronized(this)
+ {
+ return (_state & StateSent) > 0;
+ }
+ }
+
+ @Override
+ synchronized public final void waitForSent()
+ {
+ if(Thread.interrupted())
+ {
+ throw new com.zeroc.Ice.OperationInterruptedException();
+ }
+ while((_state & StateSent) == 0 && _exception == null)
+ {
+ try
+ {
+ this.wait();
+ }
+ catch(InterruptedException ex)
+ {
+ throw new com.zeroc.Ice.OperationInterruptedException();
+ }
+ }
+ }
+
+ @Override
+ public final boolean sentSynchronously()
+ {
+ return _sentSynchronously; // No lock needed, immutable
+ }
+
+ @Override
+ synchronized public final CompletableFuture<Boolean> whenSent(
+ java.util.function.BiConsumer<Boolean, ? super Throwable> action)
+ {
+ if(_sentFuture == null)
+ {
+ _sentFuture = new CompletableFuture<>();
+ }
+
+ CompletableFuture<Boolean> r = _sentFuture.whenComplete(action);
+
+ //
+ // Check if the request has already been sent.
+ //
+ if(((_state & StateSent) > 0 || _exception != null) && !_sentFuture.isDone())
+ {
+ //
+ // The documented semantics state that a sent callback will be invoked from the
+ // calling thread if the request was sent synchronously. Calling complete() or
+ // completeExceptionally() on _sentFuture invokes the action from this thread.
+ //
+ if(_sentSynchronously)
+ {
+ if(_exception != null)
+ {
+ _sentFuture.completeExceptionally(_exception);
+ }
+ else
+ {
+ _sentFuture.complete(_sentSynchronously);
+ }
+ }
+ else
+ {
+ if(_exception != null)
+ {
+ dispatch(() ->
+ {
+ _sentFuture.completeExceptionally(_exception);
+ });
+ }
+ else
+ {
+ invokeSentAsync();
+ }
+ }
+ }
+ return r;
+ }
+
+ @Override
+ synchronized public final CompletableFuture<Boolean> whenSentAsync(
+ java.util.function.BiConsumer<Boolean, ? super Throwable> action)
+ {
+ return whenSentAsync(action, null);
+ }
+
+ @Override
+ synchronized public final CompletableFuture<Boolean> whenSentAsync(
+ java.util.function.BiConsumer<Boolean, ? super Throwable> action,
+ Executor executor)
+ {
+ if(_sentFuture == null)
+ {
+ _sentFuture = new CompletableFuture<>();
+ }
+
+ CompletableFuture<Boolean> r;
+ if(executor == null)
+ {
+ r = _sentFuture.whenCompleteAsync(action);
+ }
+ else
+ {
+ r = _sentFuture.whenCompleteAsync(action, executor);
+ }
+
+ //
+ // Check if the request has already been sent.
+ //
+ if(((_state & StateSent) > 0 || _exception != null) && !_sentFuture.isDone())
+ {
+ //
+ // When the caller uses whenSentAsync, we ignore the regular semantics and
+ // always complete the future from this thread. The caller's action will
+ // be invoked using the executor.
+ //
+ if(_exception != null)
+ {
+ _sentFuture.completeExceptionally(_exception);
+ }
+ else
+ {
+ _sentFuture.complete(_sentSynchronously);
+ }
+ }
+ return r;
+ }
+
+ protected synchronized void __sent()
+ {
+ if(_sentFuture != null && !_sentFuture.isDone())
+ {
+ _sentFuture.complete(_sentSynchronously);
+ }
+ }
+
+ public final void invokeSent()
+ {
+ /* TBD
+ if(_instance.useApplicationClassLoader())
+ {
+ Thread.currentThread().setContextClassLoader(_callback.getClass().getClassLoader());
+ }
+ */
+
+ try
+ {
+ __sent();
+ }
+ catch(java.lang.RuntimeException ex)
+ {
+ warning(ex);
+ }
+ catch(java.lang.Error exc)
+ {
+ error(exc);
+ if(!(exc instanceof java.lang.AssertionError || exc instanceof java.lang.OutOfMemoryError))
+ {
+ throw exc;
+ }
+ }
+ finally
+ {
+ /* TBD
+ if(_instance.useApplicationClassLoader())
+ {
+ Thread.currentThread().setContextClassLoader(null);
+ }
+ */
+ }
+
+ if(_observer != null)
+ {
+ com.zeroc.Ice.ObjectPrx proxy = getProxy();
+ if(proxy == null || !proxy.ice_isTwoway())
+ {
+ _observer.detach();
+ _observer = null;
+ }
+ }
+ }
+
+ protected boolean __needCallback()
+ {
+ return true;
+ }
+
+ protected void __completed()
+ {
+ if(_exception != null && _sentFuture != null)
+ {
+ _sentFuture.completeExceptionally(_exception);
+ }
+ }
+
+ public final void invokeCompleted()
+ {
+ /* TBD
+ if(_instance.useApplicationClassLoader())
+ {
+ Thread.currentThread().setContextClassLoader(_callback.getClass().getClassLoader());
+ }
+ */
+
+ try
+ {
+ __completed();
+ }
+ catch(RuntimeException ex)
+ {
+ warning(ex);
+ }
+ catch(AssertionError exc)
+ {
+ error(exc);
+ }
+ catch(OutOfMemoryError exc)
+ {
+ error(exc);
+ }
+ finally
+ {
+ /* TBD
+ if(_instance.useApplicationClassLoader())
+ {
+ Thread.currentThread().setContextClassLoader(null);
+ }
+ */
+ }
+
+ if(_observer != null)
+ {
+ _observer.detach();
+ _observer = null;
+ }
+ }
+
+ public final void invokeCompletedAsync()
+ {
+ //
+ // CommunicatorDestroyedException is the only exception that can propagate directly from this method.
+ //
+ _instance.clientThreadPool().dispatch(
+ new DispatchWorkItem(_cachedConnection)
+ {
+ @Override
+ public void run()
+ {
+ invokeCompleted();
+ }
+ });
+ }
+
+ synchronized public void cancelable(final CancellationHandler handler)
+ {
+ if(_cancellationException != null)
+ {
+ try
+ {
+ throw _cancellationException;
+ }
+ finally
+ {
+ _cancellationException = null;
+ }
+ }
+ _cancellationHandler = handler;
+ }
+
+ protected InvocationFutureI(Communicator communicator, Instance instance, String op)
+ {
+ _communicator = communicator;
+ _instance = instance;
+ _operation = op;
+ _state = 0;
+ _sentSynchronously = false;
+ _exception = null;
+ }
+
+ protected void cacheMessageBuffers()
+ {
+ }
+
+ protected boolean sent(boolean done)
+ {
+ synchronized(this)
+ {
+ assert(_exception == null);
+
+ boolean alreadySent = (_state & StateSent) != 0;
+ _state |= StateSent;
+ if(done)
+ {
+ _state |= StateDone | StateOK;
+ _cancellationHandler = null;
+
+ //
+ // For oneway requests after the data has been sent
+ // the buffers can be reused unless this is a
+ // collocated invocation. For collocated invocations
+ // the buffer won't be reused because it has already
+ // been marked as cached in invokeCollocated.
+ //
+ cacheMessageBuffers();
+ }
+ this.notifyAll();
+ return !alreadySent;
+ }
+ }
+
+ protected boolean finished(boolean ok)
+ {
+ synchronized(this)
+ {
+ _state |= StateDone;
+ if(ok)
+ {
+ _state |= StateOK;
+ }
+ _cancellationHandler = null;
+ if(!__needCallback())
+ {
+ if(_observer != null)
+ {
+ _observer.detach();
+ _observer = null;
+ }
+ }
+ this.notifyAll();
+ return __needCallback();
+ }
+ }
+
+ protected boolean finished(com.zeroc.Ice.Exception ex)
+ {
+ synchronized(this)
+ {
+ _state |= StateDone;
+ _exception = ex;
+ _cancellationHandler = null;
+ if(_observer != null)
+ {
+ _observer.failed(ex.ice_id());
+ }
+ if(!__needCallback())
+ {
+ if(_observer != null)
+ {
+ _observer.detach();
+ _observer = null;
+ }
+ }
+ this.notifyAll();
+ return __needCallback();
+ }
+ }
+
+ protected final void invokeSentAsync()
+ {
+ //
+ // This is called when it's not safe to call the sent callback
+ // synchronously from this thread. Instead the future is completed
+ // asynchronously from a client in the client thread pool.
+ //
+ dispatch(() -> invokeSent());
+ }
+
+ protected void cancel(com.zeroc.Ice.LocalException ex)
+ {
+ CancellationHandler handler;
+ synchronized(this)
+ {
+ _cancellationException = ex;
+ if(_cancellationHandler == null)
+ {
+ return;
+ }
+ handler = _cancellationHandler;
+ }
+ handler.asyncRequestCanceled((OutgoingAsyncBase)this, ex);
+ }
+
+ protected com.zeroc.Ice.Instrumentation.InvocationObserver getObserver()
+ {
+ return _observer;
+ }
+
+ protected void dispatch(final Runnable runnable)
+ {
+ try
+ {
+ _instance.clientThreadPool().dispatch(
+ new DispatchWorkItem(_cachedConnection)
+ {
+ @Override
+ public void run()
+ {
+ runnable.run();
+ }
+ });
+ }
+ catch(CommunicatorDestroyedException ex)
+ {
+ }
+ }
+
+ private void warning(RuntimeException ex)
+ {
+ if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.AMICallback", 1) > 0)
+ {
+ String s = "exception raised by AMI callback:\n" + Ex.toString(ex);
+ _instance.initializationData().logger.warning(s);
+ }
+ }
+
+ private void error(Error error)
+ {
+ String s = "error raised by AMI callback:\n" + Ex.toString(error);
+ _instance.initializationData().logger.error(s);
+ }
+
+ protected final Instance _instance;
+ protected com.zeroc.Ice.Instrumentation.InvocationObserver _observer;
+ protected Connection _cachedConnection;
+ protected boolean _sentSynchronously;
+ protected CompletableFuture<Boolean> _sentFuture;
+
+ protected final Communicator _communicator;
+ protected final String _operation;
+
+ protected com.zeroc.Ice.Exception _exception;
+
+ private CancellationHandler _cancellationHandler;
+ private com.zeroc.Ice.LocalException _cancellationException;
+
+ protected static final byte StateOK = 0x1;
+ protected static final byte StateDone = 0x2;
+ protected static final byte StateSent = 0x4;
+ protected static final byte StateCachedBuffers = 0x08;
+ protected byte _state;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/InvocationObserverI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/InvocationObserverI.java
new file mode 100644
index 00000000000..5d93dc25e5e
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/InvocationObserverI.java
@@ -0,0 +1,250 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import com.zeroc.IceMX.*;
+
+public class InvocationObserverI
+ extends com.zeroc.IceMX.ObserverWithDelegate<com.zeroc.IceMX.InvocationMetrics,
+ com.zeroc.Ice.Instrumentation.InvocationObserver>
+ implements com.zeroc.Ice.Instrumentation.InvocationObserver
+{
+ static public final class RemoteInvocationHelper extends MetricsHelper<RemoteMetrics>
+ {
+ static private final AttributeResolver _attributes = new AttributeResolver()
+ {
+ {
+ try
+ {
+ Class<?> cl = RemoteInvocationHelper.class;
+ add("parent", cl.getDeclaredMethod("getParent"));
+ add("id", cl.getDeclaredMethod("getId"));
+ add("requestId", cl.getDeclaredMethod("getRequestId"));
+ CommunicatorObserverI.addConnectionAttributes(this, RemoteInvocationHelper.class);
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ assert(false);
+ }
+ }
+ };
+
+ RemoteInvocationHelper(com.zeroc.Ice.ConnectionInfo con, com.zeroc.Ice.Endpoint endpt, int requestId, int size)
+ {
+ super(_attributes);
+ _connectionInfo = con;
+ _endpoint = endpt;
+ _requestId = requestId;
+ _size = size;
+ }
+
+ @Override
+ public void
+ initMetrics(RemoteMetrics v)
+ {
+ v.size += _size;
+ }
+
+ public String
+ getId()
+ {
+ if(_id == null)
+ {
+ _id = _endpoint.toString();
+ if(_connectionInfo.connectionId != null && !_connectionInfo.connectionId.isEmpty())
+ {
+ _id += " [" + _connectionInfo.connectionId + "]";
+ }
+ }
+ return _id;
+ }
+
+ int
+ getRequestId()
+ {
+ return _requestId;
+ }
+
+ public String
+ getParent()
+ {
+ if(_connectionInfo.adapterName != null && !_connectionInfo.adapterName.isEmpty())
+ {
+ return _connectionInfo.adapterName;
+ }
+ else
+ {
+ return "Communicator";
+ }
+ }
+
+ public com.zeroc.Ice.ConnectionInfo
+ getConnectionInfo()
+ {
+ return _connectionInfo;
+ }
+
+ public com.zeroc.Ice.Endpoint
+ getEndpoint()
+ {
+ return _endpoint;
+ }
+
+ public com.zeroc.Ice.EndpointInfo
+ getEndpointInfo()
+ {
+ if(_endpointInfo == null)
+ {
+ _endpointInfo = _endpoint.getInfo();
+ }
+ return _endpointInfo;
+ }
+
+ final private com.zeroc.Ice.ConnectionInfo _connectionInfo;
+ final private com.zeroc.Ice.Endpoint _endpoint;
+ final private int _requestId;
+ final private int _size;
+ private String _id;
+ private com.zeroc.Ice.EndpointInfo _endpointInfo;
+ }
+
+ static public final class CollocatedInvocationHelper extends MetricsHelper<CollocatedMetrics>
+ {
+ static private final AttributeResolver _attributes = new AttributeResolver()
+ {
+ {
+ try
+ {
+ Class<?> cl = CollocatedInvocationHelper.class;
+ add("parent", cl.getDeclaredMethod("getParent"));
+ add("id", cl.getDeclaredMethod("getId"));
+ add("requestId", cl.getDeclaredMethod("getRequestId"));
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ assert(false);
+ }
+ }
+ };
+
+ CollocatedInvocationHelper(com.zeroc.Ice.ObjectAdapter adapter, int requestId, int size)
+ {
+ super(_attributes);
+ _id = adapter.getName();
+ _requestId = requestId;
+ _size = size;
+ }
+
+ @Override
+ public void
+ initMetrics(CollocatedMetrics v)
+ {
+ v.size += _size;
+ }
+
+ public String
+ getId()
+ {
+ return _id;
+ }
+
+ int
+ getRequestId()
+ {
+ return _requestId;
+ }
+
+ public String
+ getParent()
+ {
+ return "Communicator";
+ }
+
+ final private int _requestId;
+ final private int _size;
+ final private String _id;
+ }
+
+ @Override
+ public void
+ userException()
+ {
+ forEach(_userException);
+ if(_delegate != null)
+ {
+ _delegate.userException();
+ }
+ }
+
+ @Override
+ public void
+ retried()
+ {
+ forEach(_incrementRetry);
+ if(_delegate != null)
+ {
+ _delegate.retried();
+ }
+ }
+
+ @Override
+ public com.zeroc.Ice.Instrumentation.RemoteObserver
+ getRemoteObserver(com.zeroc.Ice.ConnectionInfo con, com.zeroc.Ice.Endpoint edpt, int requestId, int sz)
+ {
+ com.zeroc.Ice.Instrumentation.RemoteObserver delegate = null;
+ if(_delegate != null)
+ {
+ delegate = _delegate.getRemoteObserver(con, edpt, requestId, sz);
+ }
+ return getObserver("Remote",
+ new RemoteInvocationHelper(con, edpt, requestId, sz),
+ RemoteMetrics.class,
+ RemoteObserverI.class,
+ delegate);
+ }
+
+ @Override
+ public com.zeroc.Ice.Instrumentation.CollocatedObserver
+ getCollocatedObserver(com.zeroc.Ice.ObjectAdapter adapter, int requestId, int sz)
+ {
+ com.zeroc.Ice.Instrumentation.CollocatedObserver delegate = null;
+ if(_delegate != null)
+ {
+ delegate = _delegate.getCollocatedObserver(adapter, requestId, sz);
+ }
+ return getObserver("Collocated",
+ new CollocatedInvocationHelper(adapter, requestId, sz),
+ CollocatedMetrics.class,
+ CollocatedObserverI.class,
+ delegate);
+ }
+
+ final MetricsUpdate<InvocationMetrics> _incrementRetry = new MetricsUpdate<InvocationMetrics>()
+ {
+ @Override
+ public void
+ update(InvocationMetrics v)
+ {
+ ++v.retry;
+ }
+ };
+
+ final MetricsUpdate<InvocationMetrics> _userException = new MetricsUpdate<InvocationMetrics>()
+ {
+ @Override
+ public void
+ update(InvocationMetrics v)
+ {
+ ++v.userException;
+ }
+ };
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ListPatcher.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ListPatcher.java
new file mode 100644
index 00000000000..b3772713014
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ListPatcher.java
@@ -0,0 +1,43 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class ListPatcher<T> implements com.zeroc.Ice.ReadValueCallback
+{
+ public ListPatcher(java.util.List<T> list, Class<T> cls, String type, int index)
+ {
+ _list = list;
+ _cls = cls;
+ _type = type;
+ _index = index;
+ }
+
+ public void valueReady(com.zeroc.Ice.Value v)
+ {
+ if(v == null || _cls.isInstance(v))
+ {
+ //
+ // This isn't very efficient for sequentially-accessed lists, but there
+ // isn't much we can do about it as long as a new patcher instance is
+ // created for each element.
+ //
+ _list.set(_index, _cls.cast(v));
+ }
+ else
+ {
+ Ex.throwUOE(_type, v);
+ }
+ }
+
+ private java.util.List<T> _list;
+ private Class<T> _cls;
+ private String _type;
+ private int _index;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/LocatorInfo.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LocatorInfo.java
new file mode 100644
index 00000000000..74b77c4bd2e
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LocatorInfo.java
@@ -0,0 +1,706 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public final class LocatorInfo
+{
+ interface GetEndpointsCallback
+ {
+ void setEndpoints(EndpointI[] endpoints, boolean cached);
+ void setException(com.zeroc.Ice.LocalException ex);
+ }
+
+ private static class RequestCallback
+ {
+ public void
+ response(LocatorInfo locatorInfo, com.zeroc.Ice.ObjectPrx proxy)
+ {
+ EndpointI[] endpoints = null;
+ if(proxy != null)
+ {
+ Reference r = ((com.zeroc.Ice._ObjectPrxI)proxy).__reference();
+ if(_ref.isWellKnown() && !Protocol.isSupported(_ref.getEncoding(), r.getEncoding()))
+ {
+ //
+ // If a well-known proxy and the returned proxy
+ // encoding isn't supported, we're done: there's
+ // no compatible endpoint we can use.
+ //
+ }
+ else if(!r.isIndirect())
+ {
+ endpoints = r.getEndpoints();
+ }
+ else if(_ref.isWellKnown() && !r.isWellKnown())
+ {
+ //
+ // We're resolving the endpoints of a well-known object and the proxy returned
+ // by the locator is an indirect proxy. We now need to resolve the endpoints
+ // of this indirect proxy.
+ //
+ locatorInfo.getEndpoints(r, _ref, _ttl, _callback);
+ return;
+ }
+ }
+
+ if(_ref.getInstance().traceLevels().location >= 1)
+ {
+ locatorInfo.getEndpointsTrace(_ref, endpoints, false);
+ }
+ if(_callback != null)
+ {
+ _callback.setEndpoints(endpoints == null ? new EndpointI[0] : endpoints, false);
+ }
+ }
+
+ public void
+ exception(LocatorInfo locatorInfo, Exception exc)
+ {
+ try
+ {
+ locatorInfo.getEndpointsException(_ref, exc); // This throws.
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ if(_callback != null)
+ {
+ _callback.setException(ex);
+ }
+ }
+ }
+
+ RequestCallback(Reference ref, int ttl, GetEndpointsCallback cb)
+ {
+ _ref = ref;
+ _ttl = ttl;
+ _callback = cb;
+ }
+
+ final Reference _ref;
+ final int _ttl;
+ final GetEndpointsCallback _callback;
+ }
+
+ private abstract class Request
+ {
+ public void
+ addCallback(Reference ref, Reference wellKnownRef, int ttl, GetEndpointsCallback cb)
+ {
+ RequestCallback callback = new RequestCallback(ref, ttl, cb);
+ synchronized(this)
+ {
+ if(!_response && _exception == null)
+ {
+ _callbacks.add(callback);
+ if(wellKnownRef != null) // This request is to resolve the endpoints of a cached well-known object ref
+ {
+ _wellKnownRefs.add(wellKnownRef);
+ }
+ if(!_sent)
+ {
+ _sent = true;
+ send();
+ }
+ return;
+ }
+ }
+
+ if(_response)
+ {
+ callback.response(_locatorInfo, _proxy);
+ }
+ else
+ {
+ assert(_exception != null);
+ callback.exception(_locatorInfo, _exception);
+ }
+ }
+
+ Request(LocatorInfo locatorInfo, Reference ref)
+ {
+ _locatorInfo = locatorInfo;
+ _ref = ref;
+ _sent = false;
+ _response = false;
+ }
+
+ protected void
+ response(com.zeroc.Ice.ObjectPrx proxy)
+ {
+ synchronized(this)
+ {
+ _locatorInfo.finishRequest(_ref, _wellKnownRefs, proxy, false);
+ _response = true;
+ _proxy = proxy;
+ notifyAll();
+ }
+ for(RequestCallback callback : _callbacks)
+ {
+ callback.response(_locatorInfo, proxy);
+ }
+ }
+
+ protected void
+ exception(Exception ex)
+ {
+ synchronized(this)
+ {
+ _locatorInfo.finishRequest(_ref, _wellKnownRefs, null, ex instanceof com.zeroc.Ice.UserException);
+ _exception = ex;
+ notifyAll();
+ }
+ for(RequestCallback callback : _callbacks)
+ {
+ callback.exception(_locatorInfo, ex);
+ }
+ }
+
+ protected abstract void send();
+
+ final protected LocatorInfo _locatorInfo;
+ final protected Reference _ref;
+
+ private java.util.List<RequestCallback> _callbacks = new java.util.ArrayList<>();
+ private java.util.List<Reference> _wellKnownRefs = new java.util.ArrayList<>();
+ private boolean _sent;
+ private boolean _response;
+ private com.zeroc.Ice.ObjectPrx _proxy;
+ private Exception _exception;
+ }
+
+ private class ObjectRequest extends Request
+ {
+ public ObjectRequest(LocatorInfo locatorInfo, Reference reference)
+ {
+ super(locatorInfo, reference);
+ assert(reference.isWellKnown());
+ }
+
+ @Override
+ protected void
+ send()
+ {
+ try
+ {
+ _locatorInfo.getLocator().findObjectByIdAsync(_ref.getIdentity()).whenComplete(
+ (com.zeroc.Ice.ObjectPrx proxy, Throwable ex) ->
+ {
+ if(ex != null)
+ {
+ if(ex instanceof com.zeroc.Ice.LocalException)
+ {
+ exception((com.zeroc.Ice.LocalException)ex);
+ }
+ else if(ex instanceof com.zeroc.Ice.UserException)
+ {
+ exception((com.zeroc.Ice.UserException)ex);
+ }
+ else
+ {
+ exception(new com.zeroc.Ice.UnknownException(ex));
+ }
+ }
+ else
+ {
+ response(proxy);
+ }
+ });
+ }
+ catch(Exception ex)
+ {
+ exception(ex);
+ }
+ }
+ }
+
+ private class AdapterRequest extends Request
+ {
+ public AdapterRequest(LocatorInfo locatorInfo, Reference reference)
+ {
+ super(locatorInfo, reference);
+ assert(reference.isIndirect());
+ }
+
+ @Override
+ protected void
+ send()
+ {
+ try
+ {
+ _locatorInfo.getLocator().findAdapterByIdAsync(_ref.getAdapterId()).whenComplete(
+ (com.zeroc.Ice.ObjectPrx proxy, Throwable ex) ->
+ {
+ if(ex != null)
+ {
+ if(ex instanceof com.zeroc.Ice.LocalException)
+ {
+ exception((com.zeroc.Ice.LocalException)ex);
+ }
+ else if(ex instanceof com.zeroc.Ice.UserException)
+ {
+ exception((com.zeroc.Ice.UserException)ex);
+ }
+ else
+ {
+ exception(new com.zeroc.Ice.UnknownException(ex));
+ }
+ }
+ else
+ {
+ response(proxy);
+ }
+ });
+ }
+ catch(Exception ex)
+ {
+ exception(ex);
+ }
+ }
+ }
+
+ LocatorInfo(com.zeroc.Ice.LocatorPrx locator, LocatorTable table, boolean background)
+ {
+ _locator = locator;
+ _table = table;
+ _background = background;
+ }
+
+ synchronized public void
+ destroy()
+ {
+ _locatorRegistry = null;
+ _table.clear();
+ }
+
+ @Override
+ public boolean
+ equals(java.lang.Object obj)
+ {
+ if(this == obj)
+ {
+ return true;
+ }
+
+ if(obj instanceof LocatorInfo)
+ {
+ return _locator.equals(((LocatorInfo)obj)._locator);
+ }
+
+ return false;
+ }
+
+ @Override
+ public int
+ hashCode()
+ {
+ return _locator.hashCode();
+ }
+
+ public com.zeroc.Ice.LocatorPrx
+ getLocator()
+ {
+ //
+ // No synchronization necessary, _locator is immutable.
+ //
+ return _locator;
+ }
+
+ public com.zeroc.Ice.LocatorRegistryPrx
+ getLocatorRegistry()
+ {
+ synchronized(this)
+ {
+ if(_locatorRegistry != null)
+ {
+ return _locatorRegistry;
+ }
+ }
+
+ //
+ // Do not make locator calls from within sync.
+ //
+ com.zeroc.Ice.LocatorRegistryPrx locatorRegistry = _locator.getRegistry();
+ if(locatorRegistry == null)
+ {
+ return null;
+ }
+
+ synchronized(this)
+ {
+ //
+ // The locator registry can't be located. We use ordered
+ // endpoint selection in case the locator returned a proxy
+ // with some endpoints which are prefered to be tried first.
+ //
+ _locatorRegistry =
+ (com.zeroc.Ice.LocatorRegistryPrx)locatorRegistry.ice_locator(null).ice_endpointSelection(
+ com.zeroc.Ice.EndpointSelectionType.Ordered);
+ return _locatorRegistry;
+ }
+ }
+
+ public void
+ getEndpoints(Reference ref, int ttl, GetEndpointsCallback callback)
+ {
+ getEndpoints(ref, null, ttl, callback);
+ }
+
+ public void
+ getEndpoints(Reference ref, Reference wellKnownRef, int ttl, GetEndpointsCallback callback)
+ {
+ assert(ref.isIndirect());
+ EndpointI[] endpoints = null;
+ Holder<Boolean> cached = new Holder<>();
+ if(!ref.isWellKnown())
+ {
+ endpoints = _table.getAdapterEndpoints(ref.getAdapterId(), ttl, cached);
+ if(!cached.value)
+ {
+ if(_background && endpoints != null)
+ {
+ getAdapterRequest(ref).addCallback(ref, wellKnownRef, ttl, null);
+ }
+ else
+ {
+ getAdapterRequest(ref).addCallback(ref, wellKnownRef, ttl, callback);
+ return;
+ }
+ }
+ }
+ else
+ {
+ Reference r = _table.getObjectReference(ref.getIdentity(), ttl, cached);
+ if(!cached.value)
+ {
+ if(_background && r != null)
+ {
+ getObjectRequest(ref).addCallback(ref, null, ttl, null);
+ }
+ else
+ {
+ getObjectRequest(ref).addCallback(ref, null, ttl, callback);
+ return;
+ }
+ }
+
+ if(!r.isIndirect())
+ {
+ endpoints = r.getEndpoints();
+ }
+ else if(!r.isWellKnown())
+ {
+ getEndpoints(r, ref, ttl, callback);
+ return;
+ }
+ }
+
+ assert(endpoints != null);
+ if(ref.getInstance().traceLevels().location >= 1)
+ {
+ getEndpointsTrace(ref, endpoints, true);
+ }
+ if(callback != null)
+ {
+ callback.setEndpoints(endpoints, true);
+ }
+ }
+
+ public void
+ clearCache(Reference ref)
+ {
+ assert(ref.isIndirect());
+
+ if(!ref.isWellKnown())
+ {
+ EndpointI[] endpoints = _table.removeAdapterEndpoints(ref.getAdapterId());
+
+ if(endpoints != null && ref.getInstance().traceLevels().location >= 2)
+ {
+ trace("removed endpoints from locator table\n", ref, endpoints);
+ }
+ }
+ else
+ {
+ Reference r = _table.removeObjectReference(ref.getIdentity());
+ if(r != null)
+ {
+ if(!r.isIndirect())
+ {
+ if(ref.getInstance().traceLevels().location >= 2)
+ {
+ trace("removed endpoints from locator table", ref, r.getEndpoints());
+ }
+ }
+ else if(!r.isWellKnown())
+ {
+ clearCache(r);
+ }
+ }
+ }
+ }
+
+ private void
+ trace(String msg, Reference ref, EndpointI[] endpoints)
+ {
+ assert(ref.isIndirect());
+
+ StringBuilder s = new StringBuilder(128);
+ s.append(msg);
+ s.append("\n");
+ if(!ref.isWellKnown())
+ {
+ s.append("adapter = ");
+ s.append(ref.getAdapterId());
+ s.append("\n");
+ }
+ else
+ {
+ s.append("object = ");
+ s.append(com.zeroc.Ice.Util.identityToString(ref.getIdentity()));
+ s.append("\n");
+ }
+
+ s.append("endpoints = ");
+ final int sz = endpoints.length;
+ for(int i = 0; i < sz; i++)
+ {
+ s.append(endpoints[i].toString());
+ if(i + 1 < sz)
+ {
+ s.append(":");
+ }
+ }
+
+ ref.getInstance().initializationData().logger.trace(ref.getInstance().traceLevels().locationCat, s.toString());
+ }
+
+ private void
+ getEndpointsException(Reference ref, Exception exc)
+ {
+ assert(ref.isIndirect());
+
+ try
+ {
+ throw exc;
+ }
+ catch(com.zeroc.Ice.AdapterNotFoundException ex)
+ {
+ final Instance instance = ref.getInstance();
+ if(instance.traceLevels().location >= 1)
+ {
+ StringBuilder s = new StringBuilder(128);
+ s.append("adapter not found\n");
+ s.append("adapter = ");
+ s.append(ref.getAdapterId());
+ instance.initializationData().logger.trace(instance.traceLevels().locationCat, s.toString());
+ }
+
+ com.zeroc.Ice.NotRegisteredException e = new com.zeroc.Ice.NotRegisteredException();
+ e.kindOfObject = "object adapter";
+ e.id = ref.getAdapterId();
+ throw e;
+ }
+ catch(com.zeroc.Ice.ObjectNotFoundException ex)
+ {
+ final Instance instance = ref.getInstance();
+ if(instance.traceLevels().location >= 1)
+ {
+ StringBuilder s = new StringBuilder(128);
+ s.append("object not found\n");
+ s.append("object = ");
+ s.append(com.zeroc.Ice.Util.identityToString(ref.getIdentity()));
+ instance.initializationData().logger.trace(instance.traceLevels().locationCat, s.toString());
+ }
+
+ com.zeroc.Ice.NotRegisteredException e = new com.zeroc.Ice.NotRegisteredException();
+ e.kindOfObject = "object";
+ e.id = com.zeroc.Ice.Util.identityToString(ref.getIdentity());
+ throw e;
+ }
+ catch(com.zeroc.Ice.NotRegisteredException ex)
+ {
+ throw ex;
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ final Instance instance = ref.getInstance();
+ if(instance.traceLevels().location >= 1)
+ {
+ StringBuilder s = new StringBuilder(128);
+ s.append("couldn't contact the locator to retrieve adapter endpoints\n");
+ if(ref.getAdapterId().length() > 0)
+ {
+ s.append("adapter = ");
+ s.append(ref.getAdapterId());
+ s.append("\n");
+ }
+ else
+ {
+ s.append("object = ");
+ s.append(com.zeroc.Ice.Util.identityToString(ref.getIdentity()));
+ s.append("\n");
+ }
+ s.append("reason = " + ex);
+ instance.initializationData().logger.trace(instance.traceLevels().locationCat, s.toString());
+ }
+ throw ex;
+ }
+ catch(Exception ex)
+ {
+ assert(false);
+ }
+ }
+
+ private void
+ getEndpointsTrace(Reference ref, EndpointI[] endpoints, boolean cached)
+ {
+ if(endpoints != null && endpoints.length > 0)
+ {
+ if(cached)
+ {
+ trace("found endpoints in locator table", ref, endpoints);
+ }
+ else
+ {
+ trace("retrieved endpoints from locator, adding to locator table", ref, endpoints);
+ }
+ }
+ else
+ {
+ final Instance instance = ref.getInstance();
+ StringBuilder s = new StringBuilder(128);
+ s.append("no endpoints configured for ");
+ if(ref.getAdapterId().length() > 0)
+ {
+ s.append("adapter\n");
+ s.append("adapter = ");
+ s.append(ref.getAdapterId());
+ s.append("\n");
+ }
+ else
+ {
+ s.append("object\n");
+ s.append("object = ");
+ s.append(com.zeroc.Ice.Util.identityToString(ref.getIdentity()));
+ s.append("\n");
+ }
+ instance.initializationData().logger.trace(instance.traceLevels().locationCat, s.toString());
+ }
+ }
+
+ synchronized private Request
+ getAdapterRequest(Reference ref)
+ {
+ if(ref.getInstance().traceLevels().location >= 1)
+ {
+ Instance instance = ref.getInstance();
+ StringBuilder s = new StringBuilder(128);
+ s.append("searching for adapter by id\n");
+ s.append("adapter = ");
+ s.append(ref.getAdapterId());
+ instance.initializationData().logger.trace(instance.traceLevels().locationCat, s.toString());
+ }
+
+ Request request = _adapterRequests.get(ref.getAdapterId());
+ if(request != null)
+ {
+ return request;
+ }
+ request = new AdapterRequest(this, ref);
+ _adapterRequests.put(ref.getAdapterId(), request);
+ return request;
+ }
+
+ synchronized private Request
+ getObjectRequest(Reference ref)
+ {
+ if(ref.getInstance().traceLevels().location >= 1)
+ {
+ Instance instance = ref.getInstance();
+ StringBuilder s = new StringBuilder(128);
+ s.append("searching for object by id\n");
+ s.append("object = ");
+ s.append(com.zeroc.Ice.Util.identityToString(ref.getIdentity()));
+ instance.initializationData().logger.trace(instance.traceLevels().locationCat, s.toString());
+ }
+
+ Request request = _objectRequests.get(ref.getIdentity());
+ if(request != null)
+ {
+ return request;
+ }
+ request = new ObjectRequest(this, ref);
+ _objectRequests.put(ref.getIdentity(), request);
+ return request;
+ }
+
+ private void
+ finishRequest(Reference ref, java.util.List<Reference> wellKnownRefs, com.zeroc.Ice.ObjectPrx proxy,
+ boolean notRegistered)
+ {
+ if(proxy == null || ((com.zeroc.Ice._ObjectPrxI)proxy).__reference().isIndirect())
+ {
+ //
+ // Remove the cached references of well-known objects for which we tried
+ // to resolved the endpoints if these endpoints are empty.
+ //
+ for(Reference r : wellKnownRefs)
+ {
+ _table.removeObjectReference(r.getIdentity());
+ }
+ }
+
+ if(!ref.isWellKnown())
+ {
+ if(proxy != null && !((com.zeroc.Ice._ObjectPrxI)proxy).__reference().isIndirect())
+ {
+ // Cache the adapter endpoints.
+ _table.addAdapterEndpoints(ref.getAdapterId(),
+ ((com.zeroc.Ice._ObjectPrxI)proxy).__reference().getEndpoints());
+ }
+ else if(notRegistered) // If the adapter isn't registered anymore, remove it from the cache.
+ {
+ _table.removeAdapterEndpoints(ref.getAdapterId());
+ }
+
+ synchronized(this)
+ {
+ assert(_adapterRequests.get(ref.getAdapterId()) != null);
+ _adapterRequests.remove(ref.getAdapterId());
+ }
+ }
+ else
+ {
+ if(proxy != null && !((com.zeroc.Ice._ObjectPrxI)proxy).__reference().isWellKnown())
+ {
+ // Cache the well-known object reference.
+ _table.addObjectReference(ref.getIdentity(), ((com.zeroc.Ice._ObjectPrxI)proxy).__reference());
+ }
+ else if(notRegistered) // If the well-known object isn't registered anymore, remove it from the cache.
+ {
+ _table.removeObjectReference(ref.getIdentity());
+ }
+
+ synchronized(this)
+ {
+ assert(_objectRequests.get(ref.getIdentity()) != null);
+ _objectRequests.remove(ref.getIdentity());
+ }
+ }
+ }
+
+ private final com.zeroc.Ice.LocatorPrx _locator;
+ private com.zeroc.Ice.LocatorRegistryPrx _locatorRegistry;
+ private final LocatorTable _table;
+ private final boolean _background;
+
+ private java.util.Map<String, Request> _adapterRequests = new java.util.HashMap<>();
+ private java.util.Map<com.zeroc.Ice.Identity, Request> _objectRequests = new java.util.HashMap<>();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/LocatorManager.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LocatorManager.java
new file mode 100644
index 00000000000..ae1aaca8019
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LocatorManager.java
@@ -0,0 +1,138 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public final class LocatorManager
+{
+ static private final class LocatorKey implements Cloneable
+ {
+ @Override
+ public boolean
+ equals(Object o)
+ {
+ assert(o instanceof LocatorKey);
+ LocatorKey k = (LocatorKey)o;
+ if(!k._id.equals(_id))
+ {
+ return false;
+ }
+ if(!k._encoding.equals(_encoding))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int
+ hashCode()
+ {
+ int h = 5381;
+ h = HashUtil.hashAdd(h, _id);
+ h = HashUtil.hashAdd(h, _encoding);
+ return h;
+ }
+
+ @Override
+ public LocatorKey
+ clone()
+ {
+ LocatorKey c = null;
+ try
+ {
+ c = (LocatorKey)super.clone();
+ }
+ catch(CloneNotSupportedException ex)
+ {
+ assert false; // impossible
+ }
+ return c;
+ }
+
+ LocatorKey set(com.zeroc.Ice.LocatorPrx locator)
+ {
+ Reference r = ((com.zeroc.Ice._ObjectPrxI)locator).__reference();
+ _id = r.getIdentity();
+ _encoding = r.getEncoding();
+ return this;
+ }
+
+ private com.zeroc.Ice.Identity _id;
+ private com.zeroc.Ice.EncodingVersion _encoding;
+ }
+
+ LocatorManager(com.zeroc.Ice.Properties properties)
+ {
+ _background = properties.getPropertyAsInt("Ice.BackgroundLocatorCacheUpdates") > 0;
+ }
+
+ synchronized void
+ destroy()
+ {
+ for(LocatorInfo info : _table.values())
+ {
+ info.destroy();
+ }
+ _table.clear();
+ _locatorTables.clear();
+ }
+
+ //
+ // Returns locator info for a given locator. Automatically creates
+ // the locator info if it doesn't exist yet.
+ //
+ public LocatorInfo
+ get(com.zeroc.Ice.LocatorPrx loc)
+ {
+ if(loc == null)
+ {
+ return null;
+ }
+
+ //
+ // The locator can't be located.
+ //
+ com.zeroc.Ice.LocatorPrx locator = com.zeroc.Ice.LocatorPrx.uncheckedCast(loc.ice_locator(null));
+
+ //
+ // TODO: reap unused locator info objects?
+ //
+
+ synchronized(this)
+ {
+ LocatorInfo info = _table.get(locator);
+ if(info == null)
+ {
+ //
+ // Rely on locator identity for the adapter table. We want to
+ // have only one table per locator (not one per locator
+ // proxy).
+ //
+ LocatorTable table = _locatorTables.get(_lookupKey.set(locator));
+ if(table == null)
+ {
+ table = new LocatorTable();
+ _locatorTables.put(_lookupKey.clone(), table);
+ }
+
+ info = new LocatorInfo(locator, table, _background);
+ _table.put(locator, info);
+ }
+
+ return info;
+ }
+ }
+
+ final private boolean _background;
+
+ private java.util.HashMap<com.zeroc.Ice.LocatorPrx, LocatorInfo> _table = new java.util.HashMap<>();
+ private java.util.HashMap<LocatorKey, LocatorTable> _locatorTables = new java.util.HashMap<>();
+ private LocatorKey _lookupKey = new LocatorKey(); // A key used for the lookup
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/LocatorTable.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LocatorTable.java
new file mode 100644
index 00000000000..383c35cdb7b
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LocatorTable.java
@@ -0,0 +1,130 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+final class LocatorTable
+{
+ LocatorTable()
+ {
+ }
+
+ synchronized void
+ clear()
+ {
+ _adapterEndpointsTable.clear();
+ _objectTable.clear();
+ }
+
+ synchronized EndpointI[]
+ getAdapterEndpoints(String adapter, int ttl, Holder<Boolean> cached)
+ {
+ if(ttl == 0) // Locator cache disabled.
+ {
+ cached.value = false;
+ return null;
+ }
+
+ EndpointTableEntry entry = _adapterEndpointsTable.get(adapter);
+ if(entry != null)
+ {
+ cached.value = checkTTL(entry.time, ttl);
+ return entry.endpoints;
+ }
+ cached.value = false;
+ return null;
+ }
+
+ synchronized void
+ addAdapterEndpoints(String adapter, EndpointI[] endpoints)
+ {
+ _adapterEndpointsTable.put(adapter,
+ new EndpointTableEntry(Time.currentMonotonicTimeMillis(), endpoints));
+ }
+
+ synchronized EndpointI[]
+ removeAdapterEndpoints(String adapter)
+ {
+ EndpointTableEntry entry = _adapterEndpointsTable.remove(adapter);
+ return entry != null ? entry.endpoints : null;
+ }
+
+ synchronized Reference
+ getObjectReference(com.zeroc.Ice.Identity id, int ttl, Holder<Boolean> cached)
+ {
+ if(ttl == 0) // Locator cache disabled.
+ {
+ cached.value = false;
+ return null;
+ }
+
+ ReferenceTableEntry entry = _objectTable.get(id);
+ if(entry != null)
+ {
+ cached.value = checkTTL(entry.time, ttl);
+ return entry.reference;
+ }
+ cached.value = false;
+ return null;
+ }
+
+ synchronized void
+ addObjectReference(com.zeroc.Ice.Identity id, Reference ref)
+ {
+ _objectTable.put(id, new ReferenceTableEntry(Time.currentMonotonicTimeMillis(), ref));
+ }
+
+ synchronized Reference
+ removeObjectReference(com.zeroc.Ice.Identity id)
+ {
+ ReferenceTableEntry entry = _objectTable.remove(id);
+ return entry != null ? entry.reference : null;
+ }
+
+ private boolean
+ checkTTL(long time, int ttl)
+ {
+ assert(ttl != 0);
+ if(ttl < 0) // TTL = infinite
+ {
+ return true;
+ }
+ else
+ {
+ return Time.currentMonotonicTimeMillis() - time <= ((long)ttl * 1000);
+ }
+ }
+
+ private static final class EndpointTableEntry
+ {
+ public EndpointTableEntry(long time, EndpointI[] endpoints)
+ {
+ this.time = time;
+ this.endpoints = endpoints;
+ }
+
+ final public long time;
+ final public EndpointI[] endpoints;
+ }
+
+ private static final class ReferenceTableEntry
+ {
+ public ReferenceTableEntry(long time, Reference reference)
+ {
+ this.time = time;
+ this.reference = reference;
+ }
+
+ final public long time;
+ final public Reference reference;
+ }
+
+ private java.util.Map<String, EndpointTableEntry> _adapterEndpointsTable = new java.util.HashMap<>();
+ private java.util.Map<com.zeroc.Ice.Identity, ReferenceTableEntry> _objectTable = new java.util.HashMap<>();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/LoggerAdminI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LoggerAdminI.java
new file mode 100644
index 00000000000..cf1dec3eebd
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LoggerAdminI.java
@@ -0,0 +1,472 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import com.zeroc.Ice.LogMessage;
+import com.zeroc.Ice.LogMessageType;
+import com.zeroc.Ice.RemoteLoggerPrx;
+
+final class LoggerAdminI implements com.zeroc.Ice.LoggerAdmin
+{
+ @Override
+ public void attachRemoteLogger(RemoteLoggerPrx prx, LogMessageType[] messageTypes,
+ String[] categories, int messageMax, com.zeroc.Ice.Current current)
+ throws com.zeroc.Ice.RemoteLoggerAlreadyAttachedException
+ {
+ if(prx == null)
+ {
+ return; // can't send this null RemoteLogger anything!
+ }
+
+ RemoteLoggerPrx remoteLogger = RemoteLoggerPrx.uncheckedCast(prx.ice_twoway());
+
+ Filters filters = new Filters(messageTypes, categories);
+ java.util.List<LogMessage> initLogMessages = null;
+
+ synchronized(this)
+ {
+ if(_sendLogCommunicator == null)
+ {
+ if(_destroyed)
+ {
+ throw new com.zeroc.Ice.ObjectNotExistException();
+ }
+
+ _sendLogCommunicator =
+ createSendLogCommunicator(current.adapter.getCommunicator(), _logger.getLocalLogger());
+ }
+
+ com.zeroc.Ice.Identity remoteLoggerId = remoteLogger.ice_getIdentity();
+
+ if(_remoteLoggerMap.containsKey(remoteLoggerId))
+ {
+ if(_traceLevel > 0)
+ {
+ _logger.trace(_traceCategory, "rejecting `" + remoteLogger.toString() +
+ "' with RemoteLoggerAlreadyAttachedException");
+ }
+
+ throw new com.zeroc.Ice.RemoteLoggerAlreadyAttachedException();
+ }
+
+ _remoteLoggerMap.put(remoteLoggerId,
+ new RemoteLoggerData(changeCommunicator(remoteLogger, _sendLogCommunicator), filters));
+
+ if(messageMax != 0)
+ {
+ initLogMessages = new java.util.LinkedList<>(_queue); // copy
+ }
+ else
+ {
+ initLogMessages = new java.util.LinkedList<>();
+ }
+ }
+
+ if(_traceLevel > 0)
+ {
+ _logger.trace(_traceCategory, "attached `" + remoteLogger.toString() + "'");
+ }
+
+ if(!initLogMessages.isEmpty())
+ {
+ filterLogMessages(initLogMessages, filters.messageTypes, filters.traceCategories, messageMax);
+ }
+
+ try
+ {
+ remoteLogger.initAsync(_logger.getPrefix(), initLogMessages.toArray(new LogMessage[0])).whenComplete(
+ (Void v, Throwable ex) ->
+ {
+ if(ex != null)
+ {
+ if(ex instanceof com.zeroc.Ice.LocalException)
+ {
+ deadRemoteLogger(remoteLogger, _logger, (com.zeroc.Ice.LocalException)ex, "init");
+ }
+ else
+ {
+ deadRemoteLogger(remoteLogger, _logger, new com.zeroc.Ice.UnknownException(ex), "init");
+ }
+ }
+ else
+ {
+ if(_traceLevel > 1)
+ {
+ _logger.trace(_traceCategory, "init on `" + remoteLogger.toString() +
+ "' completed successfully");
+ }
+ }
+ });
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ deadRemoteLogger(remoteLogger, _logger, ex, "init");
+ throw ex;
+ }
+ }
+
+ @Override
+ public boolean detachRemoteLogger(RemoteLoggerPrx remoteLogger, com.zeroc.Ice.Current current)
+ {
+ if(remoteLogger == null)
+ {
+ return false;
+ }
+
+ //
+ // No need to convert the proxy as we only use its identity
+ //
+ boolean found = removeRemoteLogger(remoteLogger);
+
+ if(_traceLevel > 0)
+ {
+ if(found)
+ {
+ _logger.trace(_traceCategory, "detached `" + remoteLogger.toString() + "'");
+ }
+ else
+ {
+ _logger.trace(_traceCategory, "cannot detach `" + remoteLogger.toString() + "': not found");
+ }
+ }
+
+ return found;
+ }
+
+ @Override
+ public com.zeroc.Ice.LoggerAdmin.GetLogResult getLog(
+ LogMessageType[] messageTypes,
+ String[] categories,
+ int messageMax,
+ com.zeroc.Ice.Current current)
+ {
+ com.zeroc.Ice.LoggerAdmin.GetLogResult r = new com.zeroc.Ice.LoggerAdmin.GetLogResult();
+
+ java.util.List<LogMessage> logMessages = null;
+ synchronized(this)
+ {
+ if(messageMax != 0)
+ {
+ logMessages = new java.util.LinkedList<>(_queue);
+ }
+ else
+ {
+ logMessages = new java.util.LinkedList<>();
+ }
+ }
+
+ r.prefix = _logger.getPrefix();
+
+ if(!logMessages.isEmpty())
+ {
+ Filters filters = new Filters(messageTypes, categories);
+ filterLogMessages(logMessages, filters.messageTypes, filters.traceCategories, messageMax);
+ }
+ r.returnValue = logMessages.toArray(new LogMessage[0]);
+ return r;
+ }
+
+ LoggerAdminI(com.zeroc.Ice.Properties props, LoggerAdminLoggerI logger)
+ {
+ _maxLogCount = props.getPropertyAsIntWithDefault("Ice.Admin.Logger.KeepLogs", 100);
+ _maxTraceCount = props.getPropertyAsIntWithDefault("Ice.Admin.Logger.KeepTraces", 100);
+ _traceLevel = props.getPropertyAsInt("Ice.Trace.Admin.Logger");
+ _logger = logger;
+ }
+
+ void destroy()
+ {
+ com.zeroc.Ice.Communicator sendLogCommunicator = null;
+
+ synchronized(this)
+ {
+ if(!_destroyed)
+ {
+ _destroyed = true;
+ sendLogCommunicator = _sendLogCommunicator;
+ _sendLogCommunicator = null;
+ }
+ }
+
+ //
+ // Destroy outside lock to avoid deadlock when there are outstanding two-way log calls sent to
+ // remote logggers
+ //
+ if(sendLogCommunicator != null)
+ {
+ sendLogCommunicator.destroy();
+ }
+ }
+
+ synchronized java.util.List<RemoteLoggerPrx> log(LogMessage logMessage)
+ {
+ java.util.List<RemoteLoggerPrx> remoteLoggers = null;
+
+ //
+ // Put message in _queue
+ //
+ if((logMessage.type != LogMessageType.TraceMessage && _maxLogCount > 0) ||
+ (logMessage.type == LogMessageType.TraceMessage && _maxTraceCount > 0))
+ {
+ _queue.add(logMessage); // add at the end
+
+ if(logMessage.type != LogMessageType.TraceMessage)
+ {
+ assert(_maxLogCount > 0);
+ if(_logCount == _maxLogCount)
+ {
+ //
+ // Need to remove the oldest log from the queue
+ //
+ assert(_oldestLog != -1);
+ _queue.remove(_oldestLog);
+ int qs = _queue.size();
+
+ while(_oldestLog < qs && _queue.get(_oldestLog).type == LogMessageType.TraceMessage)
+ {
+ _oldestLog++;
+ }
+ assert(_oldestLog < qs); // remember: we just added a log message at end
+ }
+ else
+ {
+ assert(_logCount < _maxLogCount);
+ _logCount++;
+ if(_oldestLog == -1)
+ {
+ _oldestLog = _queue.size() - 1;
+ }
+ }
+ }
+ else
+ {
+ assert(_maxTraceCount > 0);
+ if(_traceCount == _maxTraceCount)
+ {
+ //
+ // Need to remove the oldest trace from the queue
+ //
+ assert(_oldestTrace != -1);
+ _queue.remove(_oldestTrace);
+ int qs = _queue.size();
+ while(_oldestTrace < qs && _queue.get(_oldestTrace).type != LogMessageType.TraceMessage)
+ {
+ _oldestTrace++;
+ }
+ assert(_oldestTrace < qs); // remember: we just added a trace message at end
+ }
+ else
+ {
+ assert(_traceCount < _maxTraceCount);
+ _traceCount++;
+ if(_oldestTrace == -1)
+ {
+ _oldestTrace = _queue.size() - 1;
+ }
+ }
+ }
+
+ //
+ // Queue updated, now find which remote loggers want this message
+ //
+ for(RemoteLoggerData p : _remoteLoggerMap.values())
+ {
+ Filters filters = p.filters;
+
+ if(filters.messageTypes.isEmpty() || filters.messageTypes.contains(logMessage.type))
+ {
+ if(logMessage.type != LogMessageType.TraceMessage || filters.traceCategories.isEmpty() ||
+ filters.traceCategories.contains(logMessage.traceCategory))
+ {
+ if(remoteLoggers == null)
+ {
+ remoteLoggers = new java.util.ArrayList<>();
+ }
+ remoteLoggers.add(p.remoteLogger);
+ }
+ }
+ }
+ }
+
+ return remoteLoggers;
+ }
+
+ void deadRemoteLogger(RemoteLoggerPrx remoteLogger, com.zeroc.Ice.Logger logger,
+ com.zeroc.Ice.LocalException ex, String operation)
+ {
+ //
+ // No need to convert remoteLogger as we only use its identity
+ //
+ if(removeRemoteLogger(remoteLogger))
+ {
+ if(_traceLevel > 0)
+ {
+ logger.trace(_traceCategory, "detached `" + remoteLogger.toString() + "' because "
+ + operation + " raised:\n" + ex.toString());
+ }
+ }
+ }
+
+ int getTraceLevel()
+ {
+ return _traceLevel;
+ }
+
+ private synchronized boolean removeRemoteLogger(RemoteLoggerPrx remoteLogger)
+ {
+ return _remoteLoggerMap.remove(remoteLogger.ice_getIdentity()) != null;
+ }
+
+ private static void filterLogMessages(java.util.List<LogMessage> logMessages,
+ java.util.Set<LogMessageType> messageTypes,
+ java.util.Set<String> traceCategories, int messageMax)
+ {
+ assert(!logMessages.isEmpty() && messageMax != 0);
+
+ //
+ // Filter only if one of the 3 filters is set; messageMax < 0 means "give me all"
+ // that match the other filters, if any.
+ //
+ if(!messageTypes.isEmpty() || !traceCategories.isEmpty() || messageMax > 0)
+ {
+ int count = 0;
+ java.util.ListIterator<LogMessage> p = logMessages.listIterator(logMessages.size());
+ while(p.hasPrevious())
+ {
+ boolean keepIt = false;
+ LogMessage msg = p.previous();
+ if(messageTypes.isEmpty() || messageTypes.contains(msg.type))
+ {
+ if(msg.type != LogMessageType.TraceMessage || traceCategories.isEmpty() ||
+ traceCategories.contains(msg.traceCategory))
+ {
+ keepIt = true;
+ }
+ }
+
+ if(keepIt)
+ {
+ ++count;
+ if(messageMax > 0 && count >= messageMax)
+ {
+ if(p.hasPrevious())
+ {
+ int removeCount = p.previousIndex() + 1;
+ for(int i = 0; i < removeCount; ++i)
+ {
+ logMessages.remove(0);
+ }
+ }
+ break; // while
+ }
+ }
+ else
+ {
+ p.remove();
+ }
+ }
+ }
+ // else, don't need any filtering
+ }
+
+ //
+ // Change this proxy's communicator, while keeping its invocation timeout
+ //
+ private static RemoteLoggerPrx changeCommunicator(RemoteLoggerPrx prx, com.zeroc.Ice.Communicator communicator)
+ {
+ if(prx == null)
+ {
+ return null;
+ }
+
+ com.zeroc.Ice.ObjectPrx result = communicator.stringToProxy(prx.toString());
+ return RemoteLoggerPrx.uncheckedCast(result.ice_invocationTimeout(prx.ice_getInvocationTimeout()));
+ }
+
+ private static void copyProperties(String prefix, com.zeroc.Ice.Properties from, com.zeroc.Ice.Properties to)
+ {
+ for(java.util.Map.Entry<String, String> p : from.getPropertiesForPrefix(prefix).entrySet())
+ {
+ to.setProperty(p.getKey(), p.getValue());
+ }
+ }
+
+ private static com.zeroc.Ice.Communicator createSendLogCommunicator(com.zeroc.Ice.Communicator communicator,
+ com.zeroc.Ice.Logger logger)
+ {
+ com.zeroc.Ice.InitializationData initData = new com.zeroc.Ice.InitializationData();
+ initData.logger = logger;
+ initData.properties = com.zeroc.Ice.Util.createProperties();
+
+ com.zeroc.Ice.Properties mainProps = communicator.getProperties();
+
+ copyProperties("Ice.Default.Locator", mainProps, initData.properties);
+ copyProperties("Ice.Plugin.IceSSL", mainProps, initData.properties);
+ copyProperties("IceSSL.", mainProps, initData.properties);
+
+ String[] extraProps = mainProps.getPropertyAsList("Ice.Admin.Logger.Properties");
+
+ if(extraProps.length > 0)
+ {
+ for(int i = 0; i < extraProps.length; ++i)
+ {
+ String p = extraProps[i];
+ if(!p.startsWith("--"))
+ {
+ extraProps[i] = "--" + p;
+ }
+ }
+ initData.properties.parseCommandLineOptions("", extraProps);
+ }
+ return com.zeroc.Ice.Util.initialize(initData);
+ }
+
+
+ private final java.util.List<LogMessage> _queue = new java.util.LinkedList<>();
+ private int _logCount = 0; // non-trace messages
+ private final int _maxLogCount;
+ private int _traceCount = 0;
+ private final int _maxTraceCount;
+ private final int _traceLevel;
+
+ private int _oldestTrace = -1;
+ private int _oldestLog = -1;
+
+ private static class Filters
+ {
+ Filters(LogMessageType[] m, String[] c)
+ {
+ messageTypes = new java.util.HashSet<>(java.util.Arrays.asList(m));
+ traceCategories = new java.util.HashSet<>(java.util.Arrays.asList(c));
+ }
+
+ final java.util.Set<LogMessageType> messageTypes;
+ final java.util.Set<String> traceCategories;
+ }
+
+ private static class RemoteLoggerData
+ {
+ RemoteLoggerData(RemoteLoggerPrx prx, Filters f)
+ {
+ remoteLogger = prx;
+ filters = f;
+ }
+
+ final RemoteLoggerPrx remoteLogger;
+ final Filters filters;
+ }
+
+ private final java.util.Map<com.zeroc.Ice.Identity, RemoteLoggerData> _remoteLoggerMap = new java.util.HashMap<>();
+
+ private final LoggerAdminLoggerI _logger;
+ private com.zeroc.Ice.Communicator _sendLogCommunicator = null;
+ private boolean _destroyed = false;
+ static private final String _traceCategory = "Admin.Logger";
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/LoggerAdminLogger.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LoggerAdminLogger.java
new file mode 100644
index 00000000000..fe7d62d3dcc
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LoggerAdminLogger.java
@@ -0,0 +1,16 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+interface LoggerAdminLogger extends com.zeroc.Ice.Logger
+{
+ com.zeroc.Ice.Object getFacet();
+ void destroy();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/LoggerAdminLoggerI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LoggerAdminLoggerI.java
new file mode 100644
index 00000000000..dff7ea3e85c
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LoggerAdminLoggerI.java
@@ -0,0 +1,255 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import com.zeroc.Ice.LogMessage;
+import com.zeroc.Ice.LogMessageType;
+
+final class LoggerAdminLoggerI implements LoggerAdminLogger, Runnable
+{
+ @Override
+ public void print(String message)
+ {
+ LogMessage logMessage = new LogMessage(LogMessageType.PrintMessage, now(), "", message);
+ _localLogger.print(message);
+ log(logMessage);
+ }
+
+ @Override
+ public void trace(String category, String message)
+ {
+ LogMessage logMessage = new LogMessage(LogMessageType.TraceMessage, now(), category, message);
+ _localLogger.trace(category, message);
+ log(logMessage);
+ }
+
+ @Override
+ public void warning(String message)
+ {
+ LogMessage logMessage = new LogMessage(LogMessageType.WarningMessage, now(), "", message);
+ _localLogger.warning(message);
+ log(logMessage);
+ }
+
+ @Override
+ public void error(String message)
+ {
+ LogMessage logMessage = new LogMessage(LogMessageType.ErrorMessage, now(), "", message);
+ _localLogger.error(message);
+ log(logMessage);
+ }
+
+ @Override
+ public String getPrefix()
+ {
+ return _localLogger.getPrefix();
+ }
+
+ @Override
+ public com.zeroc.Ice.Logger cloneWithPrefix(String prefix)
+ {
+ return _localLogger.cloneWithPrefix(prefix);
+ }
+
+ @Override
+ public com.zeroc.Ice.Object getFacet()
+ {
+ return _loggerAdmin;
+ }
+
+ @Override
+ public void destroy()
+ {
+ Thread thread = null;
+ synchronized(this)
+ {
+ if(_sendLogThread != null)
+ {
+ thread = _sendLogThread;
+ _sendLogThread = null;
+ _destroyed = true;
+ notifyAll();
+ }
+ }
+
+ if(thread != null)
+ {
+ try
+ {
+ thread.join();
+ }
+ catch(InterruptedException e)
+ {
+ synchronized(this)
+ {
+ _sendLogThread = thread;
+ }
+ throw new com.zeroc.Ice.OperationInterruptedException();
+ }
+ }
+
+ _loggerAdmin.destroy();
+ }
+
+ @Override
+ public void run()
+ {
+ if(_loggerAdmin.getTraceLevel() > 1)
+ {
+ _localLogger.trace(_traceCategory, "send log thread started");
+ }
+
+ for(;;)
+ {
+ Job job = null;
+ synchronized(this)
+ {
+ while(!_destroyed && _jobQueue.isEmpty())
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException e)
+ {
+ // Ignored, this should never occur
+ }
+ }
+
+ if(_destroyed)
+ {
+ break; // for(;;)
+ }
+
+ assert(!_jobQueue.isEmpty());
+ job = _jobQueue.removeFirst();
+ }
+
+ for(com.zeroc.Ice.RemoteLoggerPrx p : job.remoteLoggers)
+ {
+ if(_loggerAdmin.getTraceLevel() > 1)
+ {
+ _localLogger.trace(_traceCategory, "sending log message to `" + p.toString() + "'");
+ }
+
+ try
+ {
+ //
+ // p is a proxy associated with the _sendLogCommunicator
+ //
+ p.logAsync(job.logMessage).whenComplete(
+ (Void v, Throwable ex) ->
+ {
+ if(ex != null)
+ {
+ if(ex instanceof com.zeroc.Ice.CommunicatorDestroyedException)
+ {
+ // Expected if there are outstanding calls during communicator destruction.
+ }
+ else if(ex instanceof com.zeroc.Ice.LocalException)
+ {
+ _loggerAdmin.deadRemoteLogger(p, _localLogger, (com.zeroc.Ice.LocalException)ex,
+ "log");
+ }
+ else
+ {
+ _loggerAdmin.deadRemoteLogger(p, _localLogger,
+ new com.zeroc.Ice.UnknownException(ex), "log");
+ }
+ }
+ else
+ {
+ if(_loggerAdmin.getTraceLevel() > 1)
+ {
+ _localLogger.trace(_traceCategory, "log on `" + p.toString() +
+ "' completed successfully");
+ }
+ }
+ });
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ _loggerAdmin.deadRemoteLogger(p, _localLogger, ex, "log");
+ }
+ }
+ }
+
+ if(_loggerAdmin.getTraceLevel() > 1)
+ {
+ _localLogger.trace(_traceCategory, "send log thread completed");
+ }
+ }
+
+ LoggerAdminLoggerI(com.zeroc.Ice.Properties props, com.zeroc.Ice.Logger localLogger)
+ {
+ if(localLogger instanceof LoggerAdminLoggerI)
+ {
+ _localLogger = ((LoggerAdminLoggerI)localLogger).getLocalLogger();
+ }
+ else
+ {
+ _localLogger = localLogger;
+ }
+
+ _loggerAdmin = new LoggerAdminI(props, this);
+ }
+
+ com.zeroc.Ice.Logger getLocalLogger()
+ {
+ return _localLogger;
+ }
+
+ void log(LogMessage logMessage)
+ {
+ java.util.List<com.zeroc.Ice.RemoteLoggerPrx> remoteLoggers = _loggerAdmin.log(logMessage);
+
+ if(remoteLoggers != null)
+ {
+ assert(!remoteLoggers.isEmpty());
+
+ synchronized(this)
+ {
+ if(_sendLogThread == null)
+ {
+ _sendLogThread = new Thread(this, "Ice.SendLogThread");
+ _sendLogThread.start();
+ }
+
+ _jobQueue.addLast(new Job(remoteLoggers, logMessage));
+ notifyAll();
+ }
+ }
+ }
+
+ static private long now()
+ {
+ return java.util.Calendar.getInstance().getTimeInMillis() * 1000;
+ }
+
+ private static class Job
+ {
+ Job(java.util.List<com.zeroc.Ice.RemoteLoggerPrx> r, LogMessage l)
+ {
+ remoteLoggers = r;
+ logMessage = l;
+ }
+
+ final java.util.List<com.zeroc.Ice.RemoteLoggerPrx> remoteLoggers;
+ final LogMessage logMessage;
+ }
+
+ private final com.zeroc.Ice.Logger _localLogger;
+ private final LoggerAdminI _loggerAdmin;
+ private boolean _destroyed = false;
+ private Thread _sendLogThread;
+ private final java.util.Deque<Job> _jobQueue = new java.util.ArrayDeque<>();
+
+ static private final String _traceCategory = "Admin.Logger";
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsAdminI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsAdminI.java
new file mode 100644
index 00000000000..dad0c811f1d
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsAdminI.java
@@ -0,0 +1,397 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class MetricsAdminI implements com.zeroc.IceMX.MetricsAdmin, com.zeroc.Ice.PropertiesAdminUpdateCallback
+{
+ final static private String[] suffixes =
+ {
+ "Disabled",
+ "GroupBy",
+ "Accept.*",
+ "Reject.*",
+ "RetainDetached",
+ "Map.*",
+ };
+
+ static void validateProperties(String prefix, com.zeroc.Ice.Properties properties)
+ {
+ java.util.Map<String, String> props = properties.getPropertiesForPrefix(prefix);
+ java.util.List<String> unknownProps = new java.util.ArrayList<>();
+ for(String prop : props.keySet())
+ {
+ boolean valid = false;
+ for(String suffix : suffixes)
+ {
+ if(com.zeroc.IceUtilInternal.StringUtil.match(prop, prefix + suffix, false))
+ {
+ valid = true;
+ break;
+ }
+ }
+
+ if(!valid)
+ {
+ unknownProps.add(prop);
+ }
+ }
+
+ if(unknownProps.size() != 0 && properties.getPropertyAsIntWithDefault("Ice.Warn.UnknownProperties", 1) > 0)
+ {
+ StringBuffer message = new StringBuffer("found unknown IceMX properties for `");
+ message.append(prefix.substring(0, prefix.length() - 1));
+ message.append("':");
+ for(String p : unknownProps)
+ {
+ message.append("\n ");
+ message.append(p);
+ }
+ com.zeroc.Ice.Util.getProcessLogger().warning(message.toString());
+ }
+ }
+
+ static class MetricsMapFactory<T extends com.zeroc.IceMX.Metrics>
+ {
+ public MetricsMapFactory(Runnable updater, Class<T> cl)
+ {
+ _updater = updater;
+ _class = cl;
+ }
+
+ public void
+ update()
+ {
+ assert(_updater != null);
+ _updater.run();
+ }
+
+ public MetricsMap<T>
+ create(String mapPrefix, com.zeroc.Ice.Properties properties)
+ {
+ return new MetricsMap<T>(mapPrefix, _class, properties, _subMaps);
+ }
+
+ public <S extends com.zeroc.IceMX.Metrics> void
+ registerSubMap(String subMap, Class<S> cl, java.lang.reflect.Field field)
+ {
+ _subMaps.put(subMap, new MetricsMap.SubMapFactory<S>(cl, field));
+ }
+
+ final private Runnable _updater;
+ final private Class<T> _class;
+ final private java.util.Map<String, MetricsMap.SubMapFactory<?>> _subMaps = new java.util.HashMap<>();
+ }
+
+ public MetricsAdminI(com.zeroc.Ice.Properties properties, com.zeroc.Ice.Logger logger)
+ {
+ _logger = logger;
+ _properties = properties;
+ updateViews();
+ }
+
+ public void updateViews()
+ {
+ java.util.Set<MetricsMapFactory<?> > updatedMaps = new java.util.HashSet<>();
+ synchronized(this)
+ {
+ String viewsPrefix = "IceMX.Metrics.";
+ java.util.Map<String, String> viewsProps = _properties.getPropertiesForPrefix(viewsPrefix);
+ java.util.Map<String, MetricsViewI> views = new java.util.HashMap<>();
+ _disabledViews.clear();
+ for(java.util.Map.Entry<String, String> e : viewsProps.entrySet())
+ {
+ String viewName = e.getKey().substring(viewsPrefix.length());
+ int dotPos = viewName.indexOf('.');
+ if(dotPos > 0)
+ {
+ viewName = viewName.substring(0, dotPos);
+ }
+
+ if(views.containsKey(viewName) || _disabledViews.contains(viewName))
+ {
+ continue; // View already configured.
+ }
+
+ validateProperties(viewsPrefix + viewName + ".", _properties);
+
+ if(_properties.getPropertyAsIntWithDefault(viewsPrefix + viewName + ".Disabled", 0) > 0)
+ {
+ _disabledViews.add(viewName);
+ continue; // The view is disabled
+ }
+
+ //
+ // Create the view or update it.
+ //
+ MetricsViewI v = _views.get(viewName);
+ if(v == null)
+ {
+ v = new MetricsViewI(viewName);
+ }
+ views.put(viewName, v);
+
+ for(java.util.Map.Entry<String, MetricsMapFactory<?>> f : _factories.entrySet())
+ {
+ if(v.addOrUpdateMap(_properties, f.getKey(), f.getValue(), _logger))
+ {
+ updatedMaps.add(f.getValue());
+ }
+ }
+ }
+ java.util.Map<String, MetricsViewI> tmp = _views;
+ _views = views;
+ views = tmp;
+
+ //
+ // Go through removed views to collect maps to update.
+ //
+ for(java.util.Map.Entry<String, MetricsViewI> v : views.entrySet())
+ {
+ if(!_views.containsKey(v.getKey()))
+ {
+ for(String n : v.getValue().getMaps())
+ {
+ updatedMaps.add(_factories.get(n));
+ }
+ }
+ }
+ }
+
+ //
+ // Call the updaters to update the maps.
+ //
+ for(MetricsMapFactory<?> f : updatedMaps)
+ {
+ f.update();
+ }
+ }
+
+ @Override
+ synchronized public com.zeroc.IceMX.MetricsAdmin.GetMetricsViewNamesResult getMetricsViewNames(
+ com.zeroc.Ice.Current current)
+ {
+ com.zeroc.IceMX.MetricsAdmin.GetMetricsViewNamesResult r =
+ new com.zeroc.IceMX.MetricsAdmin.GetMetricsViewNamesResult();
+ r.disabledViews = _disabledViews.toArray(new String[_disabledViews.size()]);
+ r.returnValue = _views.keySet().toArray(new String[_views.size()]);
+ return r;
+ }
+
+ @Override
+ public void
+ enableMetricsView(String name, com.zeroc.Ice.Current current)
+ throws com.zeroc.IceMX.UnknownMetricsView
+ {
+ synchronized(this)
+ {
+ getMetricsView(name); // Throws if unknown view.
+ _properties.setProperty("IceMX.Metrics." + name + ".Disabled", "0");
+ }
+ updateViews();
+ }
+
+ @Override
+ public void disableMetricsView(String name, com.zeroc.Ice.Current current)
+ throws com.zeroc.IceMX.UnknownMetricsView
+ {
+ synchronized(this)
+ {
+ getMetricsView(name); // Throws if unknown view.
+ _properties.setProperty("IceMX.Metrics." + name + ".Disabled", "1");
+ }
+ updateViews();
+ }
+
+ @Override
+ synchronized public com.zeroc.IceMX.MetricsAdmin.GetMetricsViewResult getMetricsView(
+ String viewName,
+ com.zeroc.Ice.Current current)
+ throws com.zeroc.IceMX.UnknownMetricsView
+ {
+ com.zeroc.IceMX.MetricsAdmin.GetMetricsViewResult r = new com.zeroc.IceMX.MetricsAdmin.GetMetricsViewResult();
+ MetricsViewI view = getMetricsView(viewName);
+ r.timestamp = Time.currentMonotonicTimeMillis();
+ if(view != null)
+ {
+ r.returnValue = view.getMetrics();
+ }
+ else
+ {
+ r.returnValue = new java.util.HashMap<>();
+ }
+ return r;
+ }
+
+ @Override
+ synchronized public com.zeroc.IceMX.MetricsFailures[] getMapMetricsFailures(String viewName, String mapName,
+ com.zeroc.Ice.Current current)
+ throws com.zeroc.IceMX.UnknownMetricsView
+ {
+ MetricsViewI view = getMetricsView(viewName);
+ if(view != null)
+ {
+ return view.getFailures(mapName);
+ }
+ return new com.zeroc.IceMX.MetricsFailures[0];
+ }
+
+ @Override
+ synchronized public com.zeroc.IceMX.MetricsFailures getMetricsFailures(String viewName, String mapName, String id,
+ com.zeroc.Ice.Current current)
+ throws com.zeroc.IceMX.UnknownMetricsView
+ {
+ MetricsViewI view = getMetricsView(viewName);
+ if(view != null)
+ {
+ return view.getFailures(mapName, id);
+ }
+ return new com.zeroc.IceMX.MetricsFailures();
+ }
+
+ public <T extends com.zeroc.IceMX.Metrics> void registerMap(String map, Class<T> cl, Runnable updater)
+ {
+ boolean updated;
+ MetricsMapFactory<T> factory;
+ synchronized(this)
+ {
+ factory = new MetricsMapFactory<T>(updater, cl);
+ _factories.put(map, factory);
+ updated = addOrUpdateMap(map, factory);
+ }
+ if(updated)
+ {
+ factory.update();
+ }
+ }
+
+ synchronized public <S extends com.zeroc.IceMX.Metrics> void registerSubMap(String map, String subMap, Class<S> cl,
+ java.lang.reflect.Field field)
+ {
+ boolean updated;
+ MetricsMapFactory<?> factory;
+ synchronized(this)
+ {
+ factory = _factories.get(map);
+ if(factory == null)
+ {
+ return;
+ }
+ factory.registerSubMap(subMap, cl, field);
+ removeMap(map);
+ updated = addOrUpdateMap(map, factory);
+ }
+ if(updated)
+ {
+ factory.update();
+ }
+ }
+
+ public void unregisterMap(String mapName)
+ {
+ boolean updated;
+ MetricsMapFactory<?> factory;
+ synchronized(this)
+ {
+ factory = _factories.remove(mapName);
+ if(factory == null)
+ {
+ return;
+ }
+ updated = removeMap(mapName);
+ }
+ if(updated)
+ {
+ factory.update();
+ }
+ }
+
+ public <T extends com.zeroc.IceMX.Metrics> java.util.List<MetricsMap<T>> getMaps(String mapName, Class<T> cl)
+ {
+ java.util.List<MetricsMap<T>> maps = new java.util.ArrayList<>();
+ for(MetricsViewI v : _views.values())
+ {
+ MetricsMap<T> map = v.getMap(mapName, cl);
+ if(map != null)
+ {
+ maps.add(map);
+ }
+ }
+ return maps;
+ }
+
+ public com.zeroc.Ice.Logger getLogger()
+ {
+ return _logger;
+ }
+
+ @Override
+ public void updated(java.util.Map<String, String> props)
+ {
+ for(java.util.Map.Entry<String, String> e : props.entrySet())
+ {
+ if(e.getKey().indexOf("IceMX.") == 0)
+ {
+ // Udpate the metrics views using the new configuration.
+ try
+ {
+ updateViews();
+ }
+ catch(Exception ex)
+ {
+ _logger.warning("unexpected exception while updating metrics view configuration:\n" +
+ ex.toString());
+ }
+ return;
+ }
+ }
+ }
+
+ private MetricsViewI getMetricsView(String name)
+ throws com.zeroc.IceMX.UnknownMetricsView
+ {
+ MetricsViewI view = _views.get(name);
+ if(view == null)
+ {
+ if(!_disabledViews.contains(name))
+ {
+ throw new com.zeroc.IceMX.UnknownMetricsView();
+ }
+ return null;
+ }
+ return view;
+ }
+
+ private boolean addOrUpdateMap(String mapName, MetricsMapFactory<?> factory)
+ {
+ boolean updated = false;
+ for(MetricsViewI v : _views.values())
+ {
+ updated |= v.addOrUpdateMap(_properties, mapName, factory, _logger);
+ }
+ return updated;
+ }
+
+ private boolean removeMap(String mapName)
+ {
+ boolean updated = false;
+ for(MetricsViewI v : _views.values())
+ {
+ updated |= v.removeMap(mapName);
+ }
+ return updated;
+ }
+
+ private com.zeroc.Ice.Properties _properties;
+ final private com.zeroc.Ice.Logger _logger;
+ final private java.util.Map<String, MetricsMapFactory<?>> _factories = new java.util.HashMap<>();
+
+ private java.util.Map<String, MetricsViewI> _views = new java.util.HashMap<>();
+ private java.util.Set<String> _disabledViews = new java.util.HashSet<>();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsMap.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsMap.java
new file mode 100644
index 00000000000..dae79c069d1
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsMap.java
@@ -0,0 +1,518 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class MetricsMap<T extends com.zeroc.IceMX.Metrics>
+{
+ public class Entry
+ {
+ Entry(T obj)
+ {
+ _object = obj;
+ }
+
+ public void
+ failed(String exceptionName)
+ {
+ synchronized(MetricsMap.this)
+ {
+ ++_object.failures;
+ if(_failures == null)
+ {
+ _failures = new java.util.HashMap<>();
+ }
+ Integer count = _failures.get(exceptionName);
+ _failures.put(exceptionName, new Integer(count == null ? 1 : count + 1));
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public <S extends com.zeroc.IceMX.Metrics> MetricsMap<S>.Entry
+ getMatching(String mapName, com.zeroc.IceMX.MetricsHelper<S> helper, Class<S> cl)
+ {
+ SubMap<S> m;
+ synchronized(MetricsMap.this)
+ {
+ m = _subMaps != null ? (SubMap<S>)_subMaps.get(mapName) : null;
+ if(m == null)
+ {
+ m = createSubMap(mapName, cl);
+ if(m == null)
+ {
+ return null;
+ }
+ if(_subMaps == null)
+ {
+ _subMaps = new java.util.HashMap<>();
+ }
+ _subMaps.put(mapName, m);
+ }
+ }
+ return m.getMatching(helper);
+ }
+
+ public void
+ detach(long lifetime)
+ {
+ synchronized(MetricsMap.this)
+ {
+ _object.totalLifetime += lifetime;
+ if(--_object.current == 0)
+ {
+ detached(this);
+ }
+ }
+ }
+
+ public void
+ execute(com.zeroc.IceMX.Observer.MetricsUpdate<T> func)
+ {
+ synchronized(MetricsMap.this)
+ {
+ func.update(_object);
+ }
+ }
+
+ public MetricsMap<?>
+ getMap()
+ {
+ return MetricsMap.this;
+ }
+
+ private com.zeroc.IceMX.MetricsFailures
+ getFailures()
+ {
+ if(_failures == null)
+ {
+ return null;
+ }
+ com.zeroc.IceMX.MetricsFailures f = new com.zeroc.IceMX.MetricsFailures();
+ f.id = _object.id;
+ f.failures = new java.util.HashMap<>(_failures);
+ return f;
+ }
+
+ private void
+ attach(com.zeroc.IceMX.MetricsHelper<T> helper)
+ {
+ ++_object.total;
+ ++_object.current;
+ helper.initMetrics(_object);
+ }
+
+ private boolean
+ isDetached()
+ {
+ return _object.current == 0;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public com.zeroc.IceMX.Metrics
+ clone()
+ {
+ T metrics = (T)_object.clone();
+ if(_subMaps != null)
+ {
+ for(SubMap<?> s : _subMaps.values())
+ {
+ s.addSubMapToMetrics(metrics);
+ }
+ }
+ return metrics;
+ }
+
+ private T _object;
+ private java.util.Map<String, Integer> _failures;
+ private java.util.Map<String, SubMap<?>> _subMaps;
+ }
+
+ static class SubMap<S extends com.zeroc.IceMX.Metrics>
+ {
+ public
+ SubMap(MetricsMap<S> map, java.lang.reflect.Field field)
+ {
+ _map = map;
+ _field = field;
+ }
+
+ public MetricsMap<S>.Entry
+ getMatching(com.zeroc.IceMX.MetricsHelper<S> helper)
+ {
+ return _map.getMatching(helper, null);
+ }
+
+ public void
+ addSubMapToMetrics(com.zeroc.IceMX.Metrics metrics)
+ {
+ try
+ {
+ _field.set(metrics, _map.getMetrics());
+ }
+ catch(Exception ex)
+ {
+ assert(false);
+ }
+ }
+
+ final private MetricsMap<S> _map;
+ final private java.lang.reflect.Field _field;
+ }
+
+ static class SubMapCloneFactory<S extends com.zeroc.IceMX.Metrics>
+ {
+ public SubMapCloneFactory(MetricsMap<S> map, java.lang.reflect.Field field)
+ {
+ _map = map;
+ _field = field;
+ }
+
+ public SubMap<S>
+ create()
+ {
+ return new SubMap<S>(new MetricsMap<S>(_map), _field);
+ }
+
+ final private MetricsMap<S> _map;
+ final private java.lang.reflect.Field _field;
+ }
+
+ static class SubMapFactory<S extends com.zeroc.IceMX.Metrics>
+ {
+ SubMapFactory(Class<S> cl, java.lang.reflect.Field field)
+ {
+ _class = cl;
+ _field = field;
+ }
+
+ SubMapCloneFactory<S>
+ createCloneFactory(String subMapPrefix, com.zeroc.Ice.Properties properties)
+ {
+ return new SubMapCloneFactory<S>(new MetricsMap<S>(subMapPrefix, _class, properties, null), _field);
+ }
+
+ final private Class<S> _class;
+ final private java.lang.reflect.Field _field;
+ }
+
+ MetricsMap(String mapPrefix, Class<T> cl, com.zeroc.Ice.Properties props,
+ java.util.Map<String, SubMapFactory<?>> subMaps)
+ {
+ MetricsAdminI.validateProperties(mapPrefix, props);
+ _properties = props.getPropertiesForPrefix(mapPrefix);
+
+ _retain = props.getPropertyAsIntWithDefault(mapPrefix + "RetainDetached", 10);
+ _accept = parseRule(props, mapPrefix + "Accept");
+ _reject = parseRule(props, mapPrefix + "Reject");
+ _groupByAttributes = new java.util.ArrayList<>();
+ _groupBySeparators = new java.util.ArrayList<>();
+ _class = cl;
+
+ String groupBy = props.getPropertyWithDefault(mapPrefix + "GroupBy", "id");
+ if(!groupBy.isEmpty())
+ {
+ String v = "";
+ boolean attribute = Character.isLetter(groupBy.charAt(0)) || Character.isDigit(groupBy.charAt(0));
+ if(!attribute)
+ {
+ _groupByAttributes.add("");
+ }
+
+ for(char p : groupBy.toCharArray())
+ {
+ boolean isAlphaNum = Character.isLetter(p) || Character.isDigit(p) || p == '.';
+ if(attribute && !isAlphaNum)
+ {
+ _groupByAttributes.add(v);
+ v = "" + p;
+ attribute = false;
+ }
+ else if(!attribute && isAlphaNum)
+ {
+ _groupBySeparators.add(v);
+ v = "" + p;
+ attribute = true;
+ }
+ else
+ {
+ v += p;
+ }
+ }
+
+ if(attribute)
+ {
+ _groupByAttributes.add(v);
+ }
+ else
+ {
+ _groupBySeparators.add(v);
+ }
+ }
+
+ if(subMaps != null && !subMaps.isEmpty())
+ {
+ _subMaps = new java.util.HashMap<>();
+
+ java.util.List<String> subMapNames = new java.util.ArrayList<>();
+ for(java.util.Map.Entry<String, SubMapFactory<?>> e : subMaps.entrySet())
+ {
+ subMapNames.add(e.getKey());
+ String subMapsPrefix = mapPrefix + "Map.";
+ String subMapPrefix = subMapsPrefix + e.getKey() + '.';
+ if(props.getPropertiesForPrefix(subMapPrefix).isEmpty())
+ {
+ if(props.getPropertiesForPrefix(subMapsPrefix).isEmpty())
+ {
+ subMapPrefix = mapPrefix;
+ }
+ else
+ {
+ continue; // This sub-map isn't configured.
+ }
+ }
+
+ _subMaps.put(e.getKey(), e.getValue().createCloneFactory(subMapPrefix, props));
+ }
+ }
+ else
+ {
+ _subMaps = null;
+ }
+ }
+
+ MetricsMap(MetricsMap<T> map)
+ {
+ _properties = map._properties;
+ _groupByAttributes = map._groupByAttributes;
+ _groupBySeparators = map._groupBySeparators;
+ _retain = map._retain;
+ _accept = map._accept;
+ _reject = map._reject;
+ _class = map._class;
+ _subMaps = map._subMaps;
+ }
+
+ java.util.Map<String, String>
+ getProperties()
+ {
+ return _properties;
+ }
+
+ synchronized com.zeroc.IceMX.Metrics[]
+ getMetrics()
+ {
+ com.zeroc.IceMX.Metrics[] metrics = new com.zeroc.IceMX.Metrics[_objects.size()];
+ int i = 0;
+ for(Entry e : _objects.values())
+ {
+ metrics[i++] = e.clone();
+ }
+ return metrics;
+ }
+
+ synchronized com.zeroc.IceMX.MetricsFailures[]
+ getFailures()
+ {
+ java.util.List<com.zeroc.IceMX.MetricsFailures> failures = new java.util.ArrayList<>();
+ for(Entry e : _objects.values())
+ {
+ com.zeroc.IceMX.MetricsFailures f = e.getFailures();
+ if(f != null)
+ {
+ failures.add(f);
+ }
+ }
+ return failures.toArray(new com.zeroc.IceMX.MetricsFailures[failures.size()]);
+ }
+
+ synchronized com.zeroc.IceMX.MetricsFailures
+ getFailures(String id)
+ {
+ Entry e = _objects.get(id);
+ if(e != null)
+ {
+ return e.getFailures();
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <S extends com.zeroc.IceMX.Metrics> SubMap<S>
+ createSubMap(String subMapName, Class<S> cl)
+ {
+ if(_subMaps == null)
+ {
+ return null;
+ }
+ SubMapCloneFactory<S> factory = (SubMapCloneFactory<S>)_subMaps.get(subMapName);
+ if(factory != null)
+ {
+ return factory.create();
+ }
+ return null;
+ }
+
+ public Entry
+ getMatching(com.zeroc.IceMX.MetricsHelper<T> helper, Entry previous)
+ {
+ //
+ // Check the accept and reject filters.
+ //
+ for(java.util.Map.Entry<String, java.util.regex.Pattern> e : _accept.entrySet())
+ {
+ if(!match(e.getKey(), e.getValue(), helper, false))
+ {
+ return null;
+ }
+ }
+
+ for(java.util.Map.Entry<String, java.util.regex.Pattern> e : _reject.entrySet())
+ {
+ if(match(e.getKey(), e.getValue(), helper, true))
+ {
+ return null;
+ }
+ }
+
+ //
+ // Compute the key from the GroupBy property.
+ //
+ String key;
+ try
+ {
+ if(_groupByAttributes.size() == 1)
+ {
+ key = helper.resolve(_groupByAttributes.get(0));
+ }
+ else
+ {
+ StringBuilder os = new StringBuilder();
+ java.util.Iterator<String> q = _groupBySeparators.iterator();
+ for(String p : _groupByAttributes)
+ {
+ os.append(helper.resolve(p));
+ if(q.hasNext())
+ {
+ os.append(q.next());
+ }
+ }
+ key = os.toString();
+ }
+ }
+ catch(Exception ex)
+ {
+ return null;
+ }
+
+ //
+ // Lookup the metrics object.
+ //
+ synchronized(this)
+ {
+ if(previous != null && previous._object.id.equals(key))
+ {
+ assert(_objects.get(key) == previous);
+ return previous;
+ }
+
+ Entry e = _objects.get(key);
+ if(e == null)
+ {
+ try
+ {
+ T t = _class.newInstance();
+ t.id = key;
+ e = new Entry(t);
+ _objects.put(key, e);
+ }
+ catch(Exception ex)
+ {
+ assert(false);
+ }
+ }
+ e.attach(helper);
+ return e;
+ }
+ }
+
+ private void
+ detached(Entry entry)
+ {
+ if(_retain == 0)
+ {
+ return;
+ }
+
+ if(_detachedQueue == null)
+ {
+ _detachedQueue = new java.util.LinkedList<>();
+ }
+ assert(_detachedQueue.size() <= _retain);
+
+ // Compress the queue by removing entries which are no longer detached.
+ java.util.Iterator<Entry> p = _detachedQueue.iterator();
+ while(p.hasNext())
+ {
+ Entry e = p.next();
+ if(e == entry || !e.isDetached())
+ {
+ p.remove();
+ }
+ }
+
+ // If there's still no room, remove the oldest entry (at the front).
+ if(_detachedQueue.size() == _retain)
+ {
+ _objects.remove(_detachedQueue.pollFirst()._object.id);
+ }
+
+ // Add the entry at the back of the queue.
+ _detachedQueue.add(entry);
+ }
+
+ private java.util.Map<String, java.util.regex.Pattern>
+ parseRule(com.zeroc.Ice.Properties properties, String name)
+ {
+ java.util.Map<String, java.util.regex.Pattern> pats = new java.util.HashMap<>();
+ java.util.Map<String, String> rules = properties.getPropertiesForPrefix(name + '.');
+ for(java.util.Map.Entry<String,String> e : rules.entrySet())
+ {
+ pats.put(e.getKey().substring(name.length() + 1), java.util.regex.Pattern.compile(e.getValue()));
+ }
+ return pats;
+ }
+
+ private boolean
+ match(String attribute, java.util.regex.Pattern regex, com.zeroc.IceMX.MetricsHelper<T> helper, boolean reject)
+ {
+ String value;
+ try
+ {
+ value = helper.resolve(attribute);
+ }
+ catch(Exception ex)
+ {
+ return !reject;
+ }
+ return regex.matcher(value).matches();
+ }
+
+ final private java.util.Map<String, String> _properties;
+ final private java.util.List<String> _groupByAttributes;
+ final private java.util.List<String> _groupBySeparators;
+ final private int _retain;
+ final private java.util.Map<String, java.util.regex.Pattern> _accept;
+ final private java.util.Map<String, java.util.regex.Pattern> _reject;
+ final private Class<T> _class;
+
+ final private java.util.Map<String, Entry> _objects = new java.util.HashMap<>();
+ final private java.util.Map<String, SubMapCloneFactory<?>> _subMaps;
+ private java.util.Deque<Entry> _detachedQueue;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsViewI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsViewI.java
new file mode 100644
index 00000000000..c393b03df21
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsViewI.java
@@ -0,0 +1,126 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class MetricsViewI
+{
+ MetricsViewI(String name)
+ {
+ _name = name;
+ }
+
+ public boolean
+ addOrUpdateMap(com.zeroc.Ice.Properties properties, String mapName, MetricsAdminI.MetricsMapFactory<?> factory,
+ com.zeroc.Ice.Logger logger)
+ {
+ //
+ // Add maps to views configured with the given map.
+ //
+ String viewPrefix = "IceMX.Metrics." + _name + ".";
+ String mapsPrefix = viewPrefix + "Map.";
+ java.util.Map<String, String> mapsProps = properties.getPropertiesForPrefix(mapsPrefix);
+
+ String mapPrefix;
+ java.util.Map<String, String> mapProps = new java.util.HashMap<>();
+ if(!mapsProps.isEmpty())
+ {
+ mapPrefix = mapsPrefix + mapName + ".";
+ mapProps = properties.getPropertiesForPrefix(mapPrefix);
+ if(mapProps.isEmpty())
+ {
+ // This map isn't configured for this view.
+ return _maps.remove(mapName) != null;
+ }
+ }
+ else
+ {
+ mapPrefix = viewPrefix;
+ mapProps = properties.getPropertiesForPrefix(mapPrefix);
+ }
+
+ if(properties.getPropertyAsInt(mapPrefix + "Disabled") > 0)
+ {
+ // This map is disabled for this view.
+ return _maps.remove(mapName) != null;
+ }
+
+ MetricsMap<?> m = _maps.get(mapName);
+ if(m != null && m.getProperties().equals(mapProps))
+ {
+ return false; // The map configuration didn't change, no need to re-create.
+ }
+
+ try
+ {
+ _maps.put(mapName, factory.create(mapPrefix, properties));
+ }
+ catch(Exception ex)
+ {
+ logger.warning("unexpected exception while creating metrics map:\n" + ex);
+ _maps.remove(mapName);
+ }
+ return true;
+ }
+
+ public boolean
+ removeMap(String mapName)
+ {
+ return _maps.remove(mapName) != null;
+ }
+
+ public java.util.Map<String, com.zeroc.IceMX.Metrics[]>
+ getMetrics()
+ {
+ java.util.Map<String, com.zeroc.IceMX.Metrics[]> metrics = new java.util.HashMap<>();
+ for(java.util.Map.Entry<String, MetricsMap<?>> e : _maps.entrySet())
+ {
+ metrics.put(e.getKey(), e.getValue().getMetrics());
+ }
+ return metrics;
+ }
+
+ public com.zeroc.IceMX.MetricsFailures[]
+ getFailures(String mapName)
+ {
+ MetricsMap<?> m = _maps.get(mapName);
+ if(m != null)
+ {
+ return m.getFailures();
+ }
+ return null;
+ }
+
+ public com.zeroc.IceMX.MetricsFailures
+ getFailures(String mapName, String id)
+ {
+ MetricsMap<?> m = _maps.get(mapName);
+ if(m != null)
+ {
+ return m.getFailures(id);
+ }
+ return null;
+ }
+
+ public java.util.Collection<String>
+ getMaps()
+ {
+ return _maps.keySet();
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends com.zeroc.IceMX.Metrics> MetricsMap<T>
+ getMap(String mapName, Class<T> cl)
+ {
+ return (MetricsMap<T>)_maps.get(mapName);
+ }
+
+ final private String _name;
+ final private java.util.Map<String, MetricsMap<?>> _maps = new java.util.HashMap<>();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Network.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Network.java
new file mode 100644
index 00000000000..0da59a5a5e1
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Network.java
@@ -0,0 +1,1358 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import com.zeroc.Ice.ConnectFailedException;
+import com.zeroc.Ice.ConnectionRefusedException;
+import com.zeroc.Ice.EndpointSelectionType;
+import com.zeroc.Ice.SocketException;
+
+public final class Network
+{
+ // ProtocolSupport
+ public final static int EnableIPv4 = 0;
+ public final static int EnableIPv6 = 1;
+ public final static int EnableBoth = 2;
+
+ private static java.util.regex.Pattern IPV4_PATTERN = null;
+ private static java.util.regex.Pattern IPV6_PATTERN = null;
+ private final static String ipv4Pattern =
+ "(([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.){3}([01]?\\d\\d?|2[0-4]\\d|25[0-5])";
+ private final static String ipv6Pattern =
+ "(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-" +
+ "fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1" +
+ ",4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1," +
+ "4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-" +
+ "F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])" +
+ "\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}" +
+ "[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))";
+
+ static
+ {
+ try
+ {
+ IPV4_PATTERN =
+ java.util.regex.Pattern.compile(ipv4Pattern, java.util.regex.Pattern.CASE_INSENSITIVE);
+ IPV6_PATTERN =
+ java.util.regex.Pattern.compile(ipv6Pattern, java.util.regex.Pattern.CASE_INSENSITIVE);
+ }
+ catch (java.util.regex.PatternSyntaxException ex)
+ {
+ assert(false);
+ }
+ }
+
+ public static boolean
+ isNumericAddress(String ipAddress)
+ {
+ java.util.regex.Matcher ipv4 = IPV4_PATTERN.matcher(ipAddress);
+ if(ipv4.matches())
+ {
+ return true;
+ }
+ java.util.regex.Matcher ipv6 = IPV6_PATTERN.matcher(ipAddress);
+ return ipv6.matches();
+ }
+
+ public static boolean
+ connectionRefused(java.net.ConnectException ex)
+ {
+ //
+ // The JDK raises a generic ConnectException when the server
+ // actively refuses a connection. Unfortunately, our only
+ // choice is to search the exception message for
+ // distinguishing phrases.
+ //
+
+ String msg = ex.getMessage();
+
+ if(msg != null)
+ {
+ msg = msg.toLowerCase();
+
+ final String[] msgs =
+ {
+ "connection refused", // ECONNREFUSED
+ "remote host refused an attempted connect operation" // ECONNREFUSED (AIX JDK 1.4.2)
+ };
+
+ for(String m : msgs)
+ {
+ if(msg.indexOf(m) != -1)
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ public static boolean
+ noMoreFds(java.lang.Throwable ex)
+ {
+ String msg = ex.getMessage();
+ if(msg != null)
+ {
+ msg = msg.toLowerCase();
+
+ final String[] msgs =
+ {
+ "too many open files", // EMFILE
+ "file table overflow", // ENFILE
+ "too many open files in system" // ENFILE
+ };
+
+ for(String m : msgs)
+ {
+ if(msg.indexOf(m) != -1)
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ public static boolean
+ isIPv6Supported()
+ {
+ try
+ {
+ java.net.Socket socket = new java.net.Socket();
+ socket.bind(new java.net.InetSocketAddress(java.net.InetAddress.getByName("::1"), 0));
+ socket.close();
+ return true;
+ }
+ catch(java.io.IOException ex)
+ {
+ return false;
+ }
+ }
+
+ public static java.nio.channels.SocketChannel
+ createTcpSocket()
+ {
+ try
+ {
+ java.nio.channels.SocketChannel fd = java.nio.channels.SocketChannel.open();
+ java.net.Socket socket = fd.socket();
+ socket.setTcpNoDelay(true);
+ socket.setKeepAlive(true);
+ return fd;
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new SocketException(ex);
+ }
+ }
+
+ public static java.nio.channels.ServerSocketChannel
+ createTcpServerSocket()
+ {
+ try
+ {
+ java.nio.channels.ServerSocketChannel fd = java.nio.channels.ServerSocketChannel.open();
+ //
+ // It's not possible to set TCP_NODELAY or KEEP_ALIVE
+ // on a server socket in Java
+ //
+ //java.net.Socket socket = fd.socket();
+ //socket.setTcpNoDelay(true);
+ //socket.setKeepAlive(true);
+ return fd;
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new SocketException(ex);
+ }
+ }
+
+ public static java.nio.channels.DatagramChannel
+ createUdpSocket(java.net.InetSocketAddress addr)
+ {
+ try
+ {
+ //
+ // Use reflection so this code still compiles with older JDK versions.
+ // java.net.StandardProtocolFamily is new in JDK 1.7
+ //
+ Class<?> c = Util.findClass("java.net.StandardProtocolFamily", null);
+ if(addr.getAddress().isMulticastAddress() && c != null)
+ {
+ //
+ // For multicast sockets with JDK 7 we must use the open overload that accepts
+ // ProtocolFamily and specify the ProtocolFamily that corresponds to the address
+ // type of the multicast groups that the channel will join.
+ //
+ String family = "INET";
+ if(addr.getAddress() instanceof java.net.Inet6Address)
+ {
+ family = "INET6";
+ }
+ java.lang.reflect.Method valueOf = c.getDeclaredMethod("valueOf", new Class<?>[]{String.class});
+
+ Object[] args = new Object[]{valueOf.invoke(null, new Object[]{family})};
+
+ java.lang.reflect.Method open = java.nio.channels.DatagramChannel.class.getDeclaredMethod(
+ "open", new Class<?>[]{Util.findClass("java.net.ProtocolFamily", null)});
+ return (java.nio.channels.DatagramChannel)open.invoke(null, args);
+ }
+ else
+ {
+ return java.nio.channels.DatagramChannel.open();
+ }
+ }
+ catch(IllegalAccessException ex)
+ {
+ throw new SocketException(ex);
+ }
+ catch(java.lang.reflect.InvocationTargetException ex)
+ {
+ throw new SocketException(ex);
+ }
+ catch(NoSuchMethodException ex)
+ {
+ throw new SocketException(ex);
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new SocketException(ex);
+ }
+ }
+
+ public static void
+ closeSocketNoThrow(java.nio.channels.SelectableChannel fd)
+ {
+ try
+ {
+ fd.close();
+ }
+ catch(java.io.IOException ex)
+ {
+ // Ignore
+ }
+ }
+
+ public static void
+ closeSocket(java.nio.channels.SelectableChannel fd)
+ {
+ try
+ {
+ fd.close();
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new SocketException(ex);
+ }
+ }
+
+ public static void
+ setBlock(java.nio.channels.SelectableChannel fd, boolean block)
+ {
+ try
+ {
+ fd.configureBlocking(block);
+ }
+ catch(java.io.IOException ex)
+ {
+ closeSocketNoThrow(fd);
+ throw new SocketException(ex);
+ }
+ }
+
+ public static void
+ setReuseAddress(java.nio.channels.DatagramChannel fd, boolean reuse)
+ {
+ try
+ {
+ fd.socket().setReuseAddress(reuse);
+ }
+ catch(java.io.IOException ex)
+ {
+ closeSocketNoThrow(fd);
+ throw new SocketException(ex);
+ }
+ }
+
+ public static void
+ setReuseAddress(java.nio.channels.ServerSocketChannel fd, boolean reuse)
+ {
+ try
+ {
+ fd.socket().setReuseAddress(reuse);
+ }
+ catch(java.io.IOException ex)
+ {
+ closeSocketNoThrow(fd);
+ throw new SocketException(ex);
+ }
+ }
+
+ public static java.net.InetSocketAddress
+ doBind(java.nio.channels.ServerSocketChannel fd, java.net.InetSocketAddress addr, int backlog)
+ {
+ try
+ {
+ java.net.ServerSocket sock = fd.socket();
+ sock.bind(addr, backlog);
+ return (java.net.InetSocketAddress)sock.getLocalSocketAddress();
+ }
+ catch(java.io.IOException ex)
+ {
+ closeSocketNoThrow(fd);
+ throw new SocketException(ex);
+ }
+ }
+
+ public static java.net.InetSocketAddress
+ doBind(java.nio.channels.DatagramChannel fd, java.net.InetSocketAddress addr)
+ {
+ try
+ {
+ java.net.DatagramSocket sock = fd.socket();
+ sock.bind(addr);
+ return (java.net.InetSocketAddress)sock.getLocalSocketAddress();
+ }
+ catch(java.io.IOException ex)
+ {
+ closeSocketNoThrow(fd);
+ throw new SocketException(ex);
+ }
+ }
+
+ public static java.nio.channels.SocketChannel
+ doAccept(java.nio.channels.ServerSocketChannel afd)
+ {
+ java.nio.channels.SocketChannel fd = null;
+ while(true)
+ {
+ try
+ {
+ fd = afd.accept();
+ break;
+ }
+ catch(java.io.IOException ex)
+ {
+ if(interrupted(ex))
+ {
+ continue;
+ }
+
+ throw new SocketException(ex);
+ }
+ }
+
+ try
+ {
+ java.net.Socket socket = fd.socket();
+ socket.setTcpNoDelay(true);
+ socket.setKeepAlive(true);
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new SocketException(ex);
+ }
+
+ return fd;
+ }
+
+ public static boolean
+ doConnect(java.nio.channels.SocketChannel fd, java.net.InetSocketAddress addr,
+ java.net.InetSocketAddress sourceAddr)
+ {
+ if(sourceAddr != null)
+ {
+ try
+ {
+ fd.bind(sourceAddr);
+ }
+ catch(java.io.IOException ex)
+ {
+ closeSocketNoThrow(fd);
+ throw new SocketException(ex);
+ }
+ }
+
+ try
+ {
+ if(!fd.connect(addr))
+ {
+ return false;
+ }
+ }
+ catch(java.net.ConnectException ex)
+ {
+ closeSocketNoThrow(fd);
+
+ if(connectionRefused(ex))
+ {
+ throw new ConnectionRefusedException(ex);
+ }
+ else
+ {
+ throw new ConnectFailedException(ex);
+ }
+ }
+ catch(java.io.IOException ex)
+ {
+ closeSocketNoThrow(fd);
+ throw new SocketException(ex);
+ }
+ catch(java.lang.SecurityException ex)
+ {
+ closeSocketNoThrow(fd);
+ throw new SocketException(ex);
+ }
+
+ if(System.getProperty("os.name").equals("Linux"))
+ {
+ //
+ // Prevent self connect (self connect happens on Linux when a client tries to connect to
+ // a server which was just deactivated if the client socket re-uses the same ephemeral
+ // port as the server).
+ //
+ if(addr.equals(fd.socket().getLocalSocketAddress()))
+ {
+ closeSocketNoThrow(fd);
+ throw new ConnectionRefusedException();
+ }
+ }
+ return true;
+ }
+
+ public static void
+ doFinishConnect(java.nio.channels.SocketChannel fd)
+ {
+ //
+ // Note: we don't close the socket if there's an exception. It's the responsibility
+ // of the caller to do so.
+ //
+
+ try
+ {
+ if(!fd.finishConnect())
+ {
+ throw new ConnectFailedException();
+ }
+
+ if(System.getProperty("os.name").equals("Linux"))
+ {
+ //
+ // Prevent self connect (self connect happens on Linux when a client tries to connect to
+ // a server which was just deactivated if the client socket re-uses the same ephemeral
+ // port as the server).
+ //
+ java.net.SocketAddress addr = fd.socket().getRemoteSocketAddress();
+ if(addr != null && addr.equals(fd.socket().getLocalSocketAddress()))
+ {
+ throw new ConnectionRefusedException();
+ }
+ }
+ }
+ catch(java.net.ConnectException ex)
+ {
+ if(connectionRefused(ex))
+ {
+ throw new ConnectionRefusedException(ex);
+ }
+ else
+ {
+ throw new ConnectFailedException(ex);
+ }
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new SocketException(ex);
+ }
+ }
+
+ public static void
+ doConnect(java.nio.channels.DatagramChannel fd, java.net.InetSocketAddress addr,
+ java.net.InetSocketAddress sourceAddr)
+ {
+ if(sourceAddr != null)
+ {
+ doBind(fd, sourceAddr);
+ }
+
+ try
+ {
+ fd.connect(addr);
+ }
+ catch(java.net.ConnectException ex)
+ {
+ closeSocketNoThrow(fd);
+
+ if(connectionRefused(ex))
+ {
+ throw new ConnectionRefusedException(ex);
+ }
+ else
+ {
+ throw new ConnectFailedException(ex);
+ }
+ }
+ catch(java.io.IOException ex)
+ {
+ closeSocketNoThrow(fd);
+ throw new SocketException(ex);
+ }
+ }
+
+ public static void
+ setSendBufferSize(java.nio.channels.SocketChannel fd, int size)
+ {
+ try
+ {
+ java.net.Socket socket = fd.socket();
+ socket.setSendBufferSize(size);
+ }
+ catch(java.io.IOException ex)
+ {
+ closeSocketNoThrow(fd);
+ throw new SocketException(ex);
+ }
+ }
+
+ public static int
+ getSendBufferSize(java.nio.channels.SocketChannel fd)
+ {
+ int size;
+ try
+ {
+ java.net.Socket socket = fd.socket();
+ size = socket.getSendBufferSize();
+ }
+ catch(java.io.IOException ex)
+ {
+ closeSocketNoThrow(fd);
+ throw new SocketException(ex);
+ }
+ return size;
+ }
+
+ public static void
+ setRecvBufferSize(java.nio.channels.SocketChannel fd, int size)
+ {
+ try
+ {
+ java.net.Socket socket = fd.socket();
+ socket.setReceiveBufferSize(size);
+ }
+ catch(java.io.IOException ex)
+ {
+ closeSocketNoThrow(fd);
+ throw new SocketException(ex);
+ }
+ }
+
+ public static int
+ getRecvBufferSize(java.nio.channels.SocketChannel fd)
+ {
+ int size;
+ try
+ {
+ java.net.Socket socket = fd.socket();
+ size = socket.getReceiveBufferSize();
+ }
+ catch(java.io.IOException ex)
+ {
+ closeSocketNoThrow(fd);
+ throw new SocketException(ex);
+ }
+ return size;
+ }
+
+ public static void
+ setRecvBufferSize(java.nio.channels.ServerSocketChannel fd, int size)
+ {
+ try
+ {
+ java.net.ServerSocket socket = fd.socket();
+ socket.setReceiveBufferSize(size);
+ }
+ catch(java.io.IOException ex)
+ {
+ closeSocketNoThrow(fd);
+ throw new SocketException(ex);
+ }
+ }
+
+ public static int
+ getRecvBufferSize(java.nio.channels.ServerSocketChannel fd)
+ {
+ int size;
+ try
+ {
+ java.net.ServerSocket socket = fd.socket();
+ size = socket.getReceiveBufferSize();
+ }
+ catch(java.io.IOException ex)
+ {
+ closeSocketNoThrow(fd);
+ throw new SocketException(ex);
+ }
+ return size;
+ }
+
+ public static void
+ setSendBufferSize(java.nio.channels.DatagramChannel fd, int size)
+ {
+ try
+ {
+ java.net.DatagramSocket socket = fd.socket();
+ socket.setSendBufferSize(size);
+ }
+ catch(java.io.IOException ex)
+ {
+ closeSocketNoThrow(fd);
+ throw new SocketException(ex);
+ }
+ }
+
+ public static int
+ getSendBufferSize(java.nio.channels.DatagramChannel fd)
+ {
+ int size;
+ try
+ {
+ java.net.DatagramSocket socket = fd.socket();
+ size = socket.getSendBufferSize();
+ }
+ catch(java.io.IOException ex)
+ {
+ closeSocketNoThrow(fd);
+ throw new SocketException(ex);
+ }
+ return size;
+ }
+
+ public static void
+ setRecvBufferSize(java.nio.channels.DatagramChannel fd, int size)
+ {
+ try
+ {
+ java.net.DatagramSocket socket = fd.socket();
+ socket.setReceiveBufferSize(size);
+ }
+ catch(java.io.IOException ex)
+ {
+ closeSocketNoThrow(fd);
+ throw new SocketException(ex);
+ }
+ }
+
+ public static int
+ getRecvBufferSize(java.nio.channels.DatagramChannel fd)
+ {
+ int size;
+ try
+ {
+ java.net.DatagramSocket socket = fd.socket();
+ size = socket.getReceiveBufferSize();
+ }
+ catch(java.io.IOException ex)
+ {
+ closeSocketNoThrow(fd);
+ throw new SocketException(ex);
+ }
+ return size;
+ }
+
+ public static java.net.InetSocketAddress
+ getAddressForServer(String host, int port, int protocol, boolean preferIPv6)
+ {
+ if(host == null || host.length() == 0)
+ {
+ try
+ {
+ if(protocol != EnableIPv4)
+ {
+ return new java.net.InetSocketAddress(java.net.InetAddress.getByName("::0"), port);
+ }
+ else
+ {
+ return new java.net.InetSocketAddress(java.net.InetAddress.getByName("0.0.0.0"), port);
+ }
+ }
+ catch(java.net.UnknownHostException ex)
+ {
+ assert(false);
+ return null;
+ }
+ catch(java.lang.SecurityException ex)
+ {
+ throw new SocketException(ex);
+ }
+ }
+ return getAddresses(host, port, protocol, EndpointSelectionType.Ordered, preferIPv6, true).get(0);
+ }
+
+ public static int
+ compareAddress(java.net.InetSocketAddress addr1, java.net.InetSocketAddress addr2)
+ {
+ if(addr1 == null)
+ {
+ if(addr2 == null)
+ {
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+ }
+ else if(addr2 == null)
+ {
+ return 1;
+ }
+
+ if(addr1.getPort() < addr2.getPort())
+ {
+ return -1;
+ }
+ else if(addr2.getPort() < addr1.getPort())
+ {
+ return 1;
+ }
+
+ byte[] larr = addr1.getAddress().getAddress();
+ byte[] rarr = addr2.getAddress().getAddress();
+ if(larr.length < rarr.length)
+ {
+ return -1;
+ }
+ else if(rarr.length < larr.length)
+ {
+ return 1;
+ }
+ assert(larr.length == rarr.length);
+
+ for(int i = 0; i < larr.length; i++)
+ {
+ if(larr[i] < rarr[i])
+ {
+ return -1;
+ }
+ else if(rarr[i] < larr[i])
+ {
+ return 1;
+ }
+ }
+
+ return 0;
+ }
+
+ public static java.net.InetAddress
+ getLocalAddress(int protocol)
+ {
+ java.net.InetAddress addr = null;
+
+ try
+ {
+ addr = java.net.InetAddress.getLocalHost();
+ }
+ catch(java.net.UnknownHostException ex)
+ {
+ //
+ // May be raised on DHCP systems.
+ //
+ }
+ catch(NullPointerException ex)
+ {
+ //
+ // Workaround for bug in JDK.
+ //
+ }
+
+ if(addr == null || !isValidAddr(addr, protocol))
+ {
+ //
+ // Iterate over the network interfaces and pick an IP
+ // address (preferably not the loopback address).
+ //
+ java.util.ArrayList<java.net.InetAddress> addrs = getLocalAddresses(protocol);
+ java.util.Iterator<java.net.InetAddress> iter = addrs.iterator();
+ while(addr == null && iter.hasNext())
+ {
+ java.net.InetAddress a = iter.next();
+ if(protocol == EnableBoth || isValidAddr(a, protocol))
+ {
+ addr = a;
+ }
+ }
+
+ if(addr == null)
+ {
+ addr = getLoopbackAddresses(protocol)[0]; // Use the loopback address as the last resort.
+ }
+ }
+
+ assert(addr != null);
+ return addr;
+ }
+
+ public static java.util.List<java.net.InetSocketAddress>
+ getAddresses(String host, int port, int protocol, EndpointSelectionType selType, boolean preferIPv6,
+ boolean blocking)
+ {
+ if(!blocking)
+ {
+ if(!isNumericAddress(host))
+ {
+ return null; // Can't get the address without blocking.
+ }
+
+ java.util.List<java.net.InetSocketAddress> addrs = new java.util.ArrayList<>();
+ try
+ {
+ addrs.add(new java.net.InetSocketAddress(java.net.InetAddress.getByName(host), port));
+ }
+ catch(java.net.UnknownHostException ex)
+ {
+ assert(false);
+ }
+ return addrs;
+ }
+
+ java.util.List<java.net.InetSocketAddress> addresses = new java.util.ArrayList<>();
+ try
+ {
+ java.net.InetAddress[] addrs;
+ if(host == null || host.length() == 0)
+ {
+ addrs = getLoopbackAddresses(protocol);
+ }
+ else
+ {
+ addrs = java.net.InetAddress.getAllByName(host);
+ }
+
+ for(java.net.InetAddress addr : addrs)
+ {
+ if(protocol == EnableBoth || isValidAddr(addr, protocol))
+ {
+ addresses.add(new java.net.InetSocketAddress(addr, port));
+ }
+ }
+
+ if(selType == EndpointSelectionType.Random)
+ {
+ java.util.Collections.shuffle(addresses);
+ }
+
+ if(protocol == EnableBoth)
+ {
+ if(preferIPv6)
+ {
+ java.util.Collections.sort(addresses, _preferIPv6Comparator);
+ }
+ else
+ {
+ java.util.Collections.sort(addresses, _preferIPv4Comparator);
+ }
+ }
+ }
+ catch(java.net.UnknownHostException ex)
+ {
+ throw new com.zeroc.Ice.DNSException(0, host, ex);
+ }
+ catch(java.lang.SecurityException ex)
+ {
+ throw new SocketException(ex);
+ }
+
+ //
+ // No Inet4Address/Inet6Address available.
+ //
+ if(addresses.isEmpty())
+ {
+ throw new com.zeroc.Ice.DNSException(0, host);
+ }
+
+ return addresses;
+ }
+
+ public static java.util.ArrayList<java.net.InetAddress>
+ getLocalAddresses(int protocol)
+ {
+ java.util.ArrayList<java.net.InetAddress> result = new java.util.ArrayList<>();
+ try
+ {
+ java.util.Enumeration<java.net.NetworkInterface> ifaces = java.net.NetworkInterface.getNetworkInterfaces();
+ while(ifaces.hasMoreElements())
+ {
+ java.net.NetworkInterface iface = ifaces.nextElement();
+ java.util.Enumeration<java.net.InetAddress> addrs = iface.getInetAddresses();
+ while(addrs.hasMoreElements())
+ {
+ java.net.InetAddress addr = addrs.nextElement();
+ if(!addr.isLoopbackAddress())
+ {
+ if(protocol == EnableBoth || isValidAddr(addr, protocol))
+ {
+ result.add(addr);
+ }
+ }
+ }
+ }
+ }
+ catch(java.net.SocketException ex)
+ {
+ throw new SocketException(ex);
+ }
+ catch(java.lang.SecurityException ex)
+ {
+ throw new SocketException(ex);
+ }
+
+ return result;
+ }
+
+ public static final class SocketPair
+ {
+ public java.nio.channels.spi.AbstractSelectableChannel source;
+ public java.nio.channels.WritableByteChannel sink;
+ }
+
+ public static SocketPair
+ createPipe()
+ {
+ SocketPair fds = new SocketPair();
+ try
+ {
+ java.nio.channels.Pipe pipe = java.nio.channels.Pipe.open();
+ fds.sink = pipe.sink();
+ fds.source = pipe.source();
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new SocketException(ex);
+ }
+ return fds;
+ }
+
+ public static java.util.ArrayList<String>
+ getHostsForEndpointExpand(String host, int protocolSupport, boolean includeLoopback)
+ {
+ boolean wildcard = (host == null || host.length() == 0);
+ if(!wildcard)
+ {
+ try
+ {
+ wildcard = java.net.InetAddress.getByName(host).isAnyLocalAddress();
+ }
+ catch(java.net.UnknownHostException ex)
+ {
+ }
+ catch(java.lang.SecurityException ex)
+ {
+ throw new SocketException(ex);
+ }
+ }
+
+ java.util.ArrayList<String> hosts = new java.util.ArrayList<>();
+ if(wildcard)
+ {
+ java.util.ArrayList<java.net.InetAddress> addrs = getLocalAddresses(protocolSupport);
+ for(java.net.InetAddress addr : addrs)
+ {
+ //
+ // NOTE: We don't publish link-local IPv6 addresses as these addresses can only
+ // be accessed in general with a scope-id.
+ //
+ if(!addr.isLinkLocalAddress())
+ {
+ hosts.add(addr.getHostAddress());
+ }
+ }
+
+ if(includeLoopback || hosts.isEmpty())
+ {
+ if(protocolSupport != EnableIPv6)
+ {
+ hosts.add("127.0.0.1");
+ }
+
+ if(protocolSupport != EnableIPv4)
+ {
+ hosts.add("0:0:0:0:0:0:0:1");
+ }
+ }
+ }
+ return hosts;
+ }
+
+ public static void
+ setTcpBufSize(java.nio.channels.SocketChannel socket, ProtocolInstance instance)
+ {
+ //
+ // By default, on Windows we use a 128KB buffer size. On Unix
+ // platforms, we use the system defaults.
+ //
+ int dfltBufSize = 0;
+ if(System.getProperty("os.name").startsWith("Windows"))
+ {
+ dfltBufSize = 128 * 1024;
+ }
+
+ int rcvSize = instance.properties().getPropertyAsIntWithDefault("Ice.TCP.RcvSize", dfltBufSize);
+ int sndSize = instance.properties().getPropertyAsIntWithDefault("Ice.TCP.SndSize", dfltBufSize);
+
+ setTcpBufSize(socket, rcvSize, sndSize, instance);
+ }
+
+ public static void
+ setTcpBufSize(java.nio.channels.SocketChannel socket, int rcvSize, int sndSize, ProtocolInstance instance)
+ {
+ if(rcvSize > 0)
+ {
+ //
+ // Try to set the buffer size. The kernel will silently adjust
+ // the size to an acceptable value. Then read the size back to
+ // get the size that was actually set.
+ //
+ setRecvBufferSize(socket, rcvSize);
+ int size = getRecvBufferSize(socket);
+ if(size < rcvSize)
+ {
+ // Warn if the size that was set is less than the requested size and
+ // we have not already warned.
+ BufSizeWarnInfo winfo = instance.getBufSizeWarn(com.zeroc.Ice.TCPEndpointType.value);
+ if(!winfo.rcvWarn || rcvSize != winfo.rcvSize)
+ {
+ instance.logger().warning("TCP receive buffer size: requested size of " + rcvSize +
+ " adjusted to " + size);
+ instance.setRcvBufSizeWarn(com.zeroc.Ice.TCPEndpointType.value, rcvSize);
+ }
+ }
+ }
+
+ if(sndSize > 0)
+ {
+ //
+ // Try to set the buffer size. The kernel will silently adjust
+ // the size to an acceptable value. Then read the size back to
+ // get the size that was actually set.
+ //
+ setSendBufferSize(socket, sndSize);
+ int size = getSendBufferSize(socket);
+ if(size < sndSize)
+ {
+ // Warn if the size that was set is less than the requested size and
+ // we have not already warned.
+ BufSizeWarnInfo winfo = instance.getBufSizeWarn(com.zeroc.Ice.TCPEndpointType.value);
+ if(!winfo.sndWarn || sndSize != winfo.sndSize)
+ {
+ instance.logger().warning("TCP send buffer size: requested size of " + sndSize +
+ " adjusted to " + size);
+ instance.setSndBufSizeWarn(com.zeroc.Ice.TCPEndpointType.value, sndSize);
+ }
+ }
+ }
+ }
+
+ public static void
+ setTcpBufSize(java.nio.channels.ServerSocketChannel socket, ProtocolInstance instance)
+ {
+ //
+ // By default, on Windows we use a 128KB buffer size. On Unix
+ // platforms, we use the system defaults.
+ //
+ int dfltBufSize = 0;
+ if(System.getProperty("os.name").startsWith("Windows"))
+ {
+ dfltBufSize = 128 * 1024;
+ }
+
+ //
+ // Get property for buffer size.
+ //
+ int sizeRequested = instance.properties().getPropertyAsIntWithDefault("Ice.TCP.RcvSize", dfltBufSize);
+ if(sizeRequested > 0)
+ {
+ //
+ // Try to set the buffer size. The kernel will silently adjust
+ // the size to an acceptable value. Then read the size back to
+ // get the size that was actually set.
+ //
+ setRecvBufferSize(socket, sizeRequested);
+ int size = getRecvBufferSize(socket);
+ if(size < sizeRequested)
+ {
+ // Warn if the size that was set is less than the requested size and
+ // we have not already warned.
+ BufSizeWarnInfo winfo = instance.getBufSizeWarn(com.zeroc.Ice.TCPEndpointType.value);
+ if(!winfo.rcvWarn || sizeRequested != winfo.rcvSize)
+ {
+ instance.logger().warning("TCP receive buffer size: requested size of " + sizeRequested +
+ " adjusted to " + size);
+ instance.setRcvBufSizeWarn(com.zeroc.Ice.TCPEndpointType.value, sizeRequested);
+ }
+ }
+ }
+ }
+
+ public static String
+ fdToString(java.nio.channels.SelectableChannel fd, NetworkProxy proxy, java.net.InetSocketAddress target)
+ {
+ if(fd == null)
+ {
+ return "<closed>";
+ }
+
+ java.net.InetAddress localAddr = null, remoteAddr = null;
+ int localPort = -1, remotePort = -1;
+
+ if(fd instanceof java.nio.channels.SocketChannel)
+ {
+ java.net.Socket socket = ((java.nio.channels.SocketChannel)fd).socket();
+ localAddr = socket.getLocalAddress();
+ localPort = socket.getLocalPort();
+ remoteAddr = socket.getInetAddress();
+ remotePort = socket.getPort();
+ }
+ else if(fd instanceof java.nio.channels.DatagramChannel)
+ {
+ java.net.DatagramSocket socket = ((java.nio.channels.DatagramChannel)fd).socket();
+ localAddr = socket.getLocalAddress();
+ localPort = socket.getLocalPort();
+ remoteAddr = socket.getInetAddress();
+ remotePort = socket.getPort();
+ }
+ else
+ {
+ assert(false);
+ }
+
+ return addressesToString(localAddr, localPort, remoteAddr, remotePort, proxy, target);
+ }
+
+ public static String
+ fdToString(java.nio.channels.SelectableChannel fd)
+ {
+ if(fd == null)
+ {
+ return "<closed>";
+ }
+
+ java.net.InetAddress localAddr = null, remoteAddr = null;
+ int localPort = -1, remotePort = -1;
+
+ if(fd instanceof java.nio.channels.SocketChannel)
+ {
+ java.net.Socket socket = ((java.nio.channels.SocketChannel)fd).socket();
+ localAddr = socket.getLocalAddress();
+ localPort = socket.getLocalPort();
+ remoteAddr = socket.getInetAddress();
+ remotePort = socket.getPort();
+ }
+ else if(fd instanceof java.nio.channels.DatagramChannel)
+ {
+ java.net.DatagramSocket socket = ((java.nio.channels.DatagramChannel)fd).socket();
+ localAddr = socket.getLocalAddress();
+ localPort = socket.getLocalPort();
+ remoteAddr = socket.getInetAddress();
+ remotePort = socket.getPort();
+ }
+ else
+ {
+ assert(false);
+ }
+
+ return addressesToString(localAddr, localPort, remoteAddr, remotePort);
+ }
+
+ public static String
+ addressesToString(java.net.InetAddress localAddr, int localPort, java.net.InetAddress remoteAddr, int remotePort,
+ NetworkProxy proxy, java.net.InetSocketAddress target)
+ {
+ StringBuilder s = new StringBuilder(128);
+ s.append("local address = ");
+ s.append(addrToString(localAddr, localPort));
+
+ if(proxy != null)
+ {
+ if(remoteAddr == null)
+ {
+ java.net.InetSocketAddress addr = proxy.getAddress();
+ remoteAddr = addr.getAddress();
+ remotePort = addr.getPort();
+ }
+ s.append("\n");
+ s.append(proxy.getName());
+ s.append(" proxy address = ");
+ s.append(addrToString(remoteAddr, remotePort));
+ s.append("\nremote address = ");
+ s.append(addrToString(target.getAddress(), target.getPort()));
+ }
+ else
+ {
+ if(remoteAddr == null && target != null)
+ {
+ remoteAddr = target.getAddress();
+ remotePort = target.getPort();
+ }
+
+ if(remoteAddr == null)
+ {
+ s.append("\nremote address = <not connected>");
+ }
+ else
+ {
+ s.append("\nremote address = ");
+ s.append(addrToString(remoteAddr, remotePort));
+ }
+ }
+
+ return s.toString();
+ }
+
+ public static String
+ addressesToString(java.net.InetAddress localAddr, int localPort, java.net.InetAddress remoteAddr, int remotePort)
+ {
+ return addressesToString(localAddr, localPort, remoteAddr, remotePort, null, null);
+ }
+
+ public static String
+ addrToString(java.net.InetSocketAddress addr)
+ {
+ StringBuilder s = new StringBuilder(128);
+ s.append(addr.getAddress().getHostAddress());
+ s.append(':');
+ s.append(addr.getPort());
+ return s.toString();
+ }
+
+ public static boolean
+ interrupted(java.io.IOException ex)
+ {
+ return ex instanceof java.io.InterruptedIOException;
+ }
+
+ private static boolean
+ isValidAddr(java.net.InetAddress addr, int protocol)
+ {
+ byte[] bytes = null;
+ if(addr != null)
+ {
+ bytes = addr.getAddress();
+ }
+ return bytes != null &&
+ ((bytes.length == 16 && protocol == EnableIPv6) ||
+ (bytes.length == 4 && protocol == EnableIPv4));
+ }
+
+ public static String
+ addrToString(java.net.InetAddress addr, int port)
+ {
+ StringBuffer s = new StringBuffer();
+
+ //
+ // In early Android releases, sockets don't correctly report their address and
+ // port information.
+ //
+
+ if(addr == null || addr.isAnyLocalAddress())
+ {
+ s.append("<not available>");
+ }
+ else
+ {
+ s.append(addr.getHostAddress());
+ }
+
+ if(port > 0)
+ {
+ s.append(':');
+ s.append(port);
+ }
+
+ return s.toString();
+ }
+
+ private static java.net.InetAddress[]
+ getLoopbackAddresses(int protocol)
+ {
+ try
+ {
+ java.net.InetAddress[] addrs = new java.net.InetAddress[protocol == EnableBoth ? 2 : 1];
+ int i = 0;
+ if(protocol != EnableIPv6)
+ {
+ addrs[i++] = java.net.InetAddress.getByName("127.0.0.1");
+ }
+ if(protocol != EnableIPv4)
+ {
+ addrs[i++] = java.net.InetAddress.getByName("::1");
+ }
+ return addrs;
+ }
+ catch(java.net.UnknownHostException ex)
+ {
+ assert(false);
+ return null;
+ }
+ catch(java.lang.SecurityException ex)
+ {
+ throw new SocketException(ex);
+ }
+ }
+
+ public static java.net.InetSocketAddress
+ getNumericAddress(String address)
+ {
+ java.net.InetSocketAddress addr = null;
+ if(!address.isEmpty() && isNumericAddress(address))
+ {
+ try
+ {
+ addr = new java.net.InetSocketAddress(java.net.InetAddress.getByName(address), 0);
+ }
+ catch(java.net.UnknownHostException ex)
+ {
+ }
+ }
+ return addr;
+ }
+
+ static class IPAddressComparator implements java.util.Comparator<java.net.InetSocketAddress>
+ {
+ IPAddressComparator(boolean ipv6)
+ {
+ _ipv6 = ipv6;
+ }
+
+ @Override
+ public int
+ compare(java.net.InetSocketAddress lhs, java.net.InetSocketAddress rhs)
+ {
+ if(lhs.getAddress().getAddress().length < rhs.getAddress().getAddress().length)
+ {
+ return _ipv6 ? 1 : -1;
+ }
+ else if(lhs.getAddress().getAddress().length > rhs.getAddress().getAddress().length)
+ {
+ return _ipv6 ? -1 : 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ final private boolean _ipv6;
+ }
+
+ private static IPAddressComparator _preferIPv4Comparator = new IPAddressComparator(false);
+ private static IPAddressComparator _preferIPv6Comparator = new IPAddressComparator(true);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/NetworkProxy.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/NetworkProxy.java
new file mode 100644
index 00000000000..825a1afd214
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/NetworkProxy.java
@@ -0,0 +1,60 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public interface NetworkProxy
+{
+ //
+ // Write the connection request on the connection established
+ // with the network proxy server. This is called right after
+ // the connection establishment succeeds.
+ //
+ void beginWrite(java.net.InetSocketAddress endpoint, Buffer buf);
+ int endWrite(Buffer buf);
+
+ //
+ // Once the connection request has been sent, this is called
+ // to prepare and read the response from the proxy server.
+ //
+ void beginRead(Buffer buf);
+ int endRead(Buffer buf);
+
+ //
+ // This is called when the response from the proxy has been
+ // read. The proxy should copy the extra read data (if any) in the
+ // given byte vector.
+ //
+ void finish(Buffer readBuffer, Buffer writeBuffer);
+
+ //
+ // If the proxy host needs to be resolved, this should return
+ // a new NetworkProxy containing the IP address of the proxy.
+ // This is called from the endpoint host resolver thread, so
+ // it's safe if this this method blocks.
+ //
+ NetworkProxy resolveHost(int protocolSupport);
+
+ //
+ // Returns the IP address of the network proxy. This method
+ // must not block. It's only called on a network proxy object
+ // returned by resolveHost().
+ //
+ java.net.InetSocketAddress getAddress();
+
+ //
+ // Returns the name of the proxy, used for tracing purposes.
+ //
+ String getName();
+
+ //
+ // Returns the protocols supported by the proxy.
+ //
+ int getProtocolSupport();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ObjectAdapterFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ObjectAdapterFactory.java
new file mode 100644
index 00000000000..94d1417a663
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ObjectAdapterFactory.java
@@ -0,0 +1,271 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import com.zeroc.Ice.ObjectAdapter;
+import com.zeroc.Ice.ObjectAdapterI;
+
+public final class ObjectAdapterFactory
+{
+ public void
+ shutdown()
+ {
+ java.util.List<ObjectAdapterI> adapters;
+ synchronized(this)
+ {
+ //
+ // Ignore shutdown requests if the object adapter factory has
+ // already been shut down.
+ //
+ if(_instance == null)
+ {
+ return;
+ }
+
+ adapters = new java.util.LinkedList<>(_adapters);
+ }
+
+ //
+ // Deactivate outside the thread synchronization, to avoid
+ // deadlocks.
+ //
+ for(ObjectAdapterI adapter : adapters)
+ {
+ adapter.deactivate();
+ }
+
+ synchronized(this)
+ {
+ _instance = null;
+ _communicator = null;
+ notifyAll();
+ }
+ }
+
+
+ public void
+ waitForShutdown()
+ {
+ java.util.List<ObjectAdapterI> adapters;
+ synchronized(this)
+ {
+ //
+ // First we wait for the shutdown of the factory itself.
+ //
+ while(_instance != null)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ throw new com.zeroc.Ice.OperationInterruptedException();
+ }
+ }
+
+ adapters = new java.util.LinkedList<>(_adapters);
+ }
+
+ //
+ // Now we wait for deactivation of each object adapter.
+ //
+ for(ObjectAdapterI adapter : adapters)
+ {
+ adapter.waitForDeactivate();
+ }
+ }
+
+ public synchronized boolean
+ isShutdown()
+ {
+ return _instance == null;
+ }
+
+ public void
+ destroy()
+ {
+ //
+ // First wait for shutdown to finish.
+ //
+ waitForShutdown();
+
+ java.util.List<ObjectAdapterI> adapters;
+ synchronized(this)
+ {
+ adapters = new java.util.LinkedList<>(_adapters);
+ }
+
+ for(ObjectAdapterI adapter : adapters)
+ {
+ adapter.destroy();
+ }
+
+ synchronized(this)
+ {
+ _adapters.clear();
+ }
+ }
+
+ public void
+ updateConnectionObservers()
+ {
+ java.util.List<ObjectAdapterI> adapters;
+ synchronized(this)
+ {
+ adapters = new java.util.LinkedList<>(_adapters);
+ }
+
+ for(ObjectAdapterI adapter : adapters)
+ {
+ adapter.updateConnectionObservers();
+ }
+ }
+
+ public void
+ updateThreadObservers()
+ {
+ java.util.List<ObjectAdapterI> adapters;
+ synchronized(this)
+ {
+ adapters = new java.util.LinkedList<>(_adapters);
+ }
+
+ for(ObjectAdapterI adapter : adapters)
+ {
+ adapter.updateThreadObservers();
+ }
+ }
+
+ public synchronized ObjectAdapter
+ createObjectAdapter(String name, com.zeroc.Ice.RouterPrx router)
+ {
+ if(Thread.interrupted())
+ {
+ throw new com.zeroc.Ice.OperationInterruptedException();
+ }
+
+ if(_instance == null)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ ObjectAdapterI adapter = null;
+ if(name.length() == 0)
+ {
+ String uuid = java.util.UUID.randomUUID().toString();
+ adapter = new ObjectAdapterI(_instance, _communicator, this, uuid, null, true);
+ }
+ else
+ {
+ if(_adapterNamesInUse.contains(name))
+ {
+ throw new com.zeroc.Ice.AlreadyRegisteredException("object adapter", name);
+ }
+ adapter = new ObjectAdapterI(_instance, _communicator, this, name, router, false);
+ _adapterNamesInUse.add(name);
+ }
+ _adapters.add(adapter);
+ return adapter;
+ }
+
+ public ObjectAdapter
+ findObjectAdapter(com.zeroc.Ice.ObjectPrx proxy)
+ {
+ java.util.List<ObjectAdapterI> adapters;
+ synchronized(this)
+ {
+ if(_instance == null)
+ {
+ return null;
+ }
+
+ adapters = new java.util.LinkedList<>(_adapters);
+ }
+
+ for(ObjectAdapterI adapter : adapters)
+ {
+ try
+ {
+ if(adapter.isLocal(proxy))
+ {
+ return adapter;
+ }
+ }
+ catch(com.zeroc.Ice.ObjectAdapterDeactivatedException ex)
+ {
+ // Ignore.
+ }
+ }
+
+ return null;
+ }
+
+ public synchronized void
+ removeObjectAdapter(ObjectAdapter adapter)
+ {
+ if(_instance == null)
+ {
+ return;
+ }
+
+ _adapters.remove(adapter);
+ _adapterNamesInUse.remove(adapter.getName());
+ }
+
+ public void
+ flushAsyncBatchRequests(CommunicatorFlushBatch outAsync)
+ {
+ java.util.List<ObjectAdapterI> adapters;
+ synchronized(this)
+ {
+ adapters = new java.util.LinkedList<>(_adapters);
+ }
+
+ for(ObjectAdapterI adapter : adapters)
+ {
+ adapter.flushAsyncBatchRequests(outAsync);
+ }
+ }
+
+ //
+ // Only for use by Instance.
+ //
+ ObjectAdapterFactory(Instance instance, com.zeroc.Ice.Communicator communicator)
+ {
+ _instance = instance;
+ _communicator = communicator;
+ }
+
+ @Override
+ protected synchronized void
+ finalize()
+ throws Throwable
+ {
+ try
+ {
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_instance == null);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_communicator == null);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_adapters.isEmpty());
+ }
+ catch(java.lang.Exception ex)
+ {
+ }
+ finally
+ {
+ super.finalize();
+ }
+ }
+
+ private Instance _instance;
+ private com.zeroc.Ice.Communicator _communicator;
+ private java.util.Set<String> _adapterNamesInUse = new java.util.HashSet<>();
+ private java.util.List<ObjectAdapterI> _adapters = new java.util.LinkedList<>();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ObjectInputStream.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ObjectInputStream.java
new file mode 100644
index 00000000000..99bc673d9db
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ObjectInputStream.java
@@ -0,0 +1,52 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+//
+// We need to override the resolveClass method of ObjectInputStream so
+// that we can use the same class-lookup mechanism as elsewhere in the
+// Ice run time.
+//
+
+public class ObjectInputStream extends java.io.ObjectInputStream
+{
+ public ObjectInputStream(Instance instance, java.io.InputStream in)
+ throws java.io.IOException
+ {
+ super(in);
+ _instance = instance;
+ }
+
+ @Override
+ protected Class<?> resolveClass(java.io.ObjectStreamClass cls)
+ throws java.io.IOException, ClassNotFoundException
+ {
+ if(_instance == null)
+ {
+ throw new com.zeroc.Ice.MarshalException("cannot unmarshal a serializable without a communicator");
+ }
+
+ try
+ {
+ Class<?> c = _instance.findClass(cls.getName());
+ if(c != null)
+ {
+ return c;
+ }
+ throw new ClassNotFoundException("unable to resolve class" + cls.getName());
+ }
+ catch(Exception ex)
+ {
+ throw new ClassNotFoundException("unable to resolve class " + cls.getName(), ex);
+ }
+ }
+
+ private Instance _instance;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ObserverHelper.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ObserverHelper.java
new file mode 100644
index 00000000000..6075fcbd2b7
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ObserverHelper.java
@@ -0,0 +1,65 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import com.zeroc.Ice.Instrumentation.CommunicatorObserver;
+import com.zeroc.Ice.Instrumentation.InvocationObserver;
+
+public final class ObserverHelper
+{
+ static public InvocationObserver
+ get(Instance instance, String op)
+ {
+ CommunicatorObserver obsv = instance.initializationData().observer;
+ if(obsv != null)
+ {
+ InvocationObserver observer = obsv.getInvocationObserver(null, op, _emptyContext);
+ if(observer != null)
+ {
+ observer.attach();
+ }
+ return observer;
+ }
+ return null;
+ }
+
+ static public InvocationObserver
+ get(com.zeroc.Ice.ObjectPrx proxy, String op)
+ {
+ return get(proxy, op, null);
+ }
+
+ static public InvocationObserver
+ get(com.zeroc.Ice.ObjectPrx proxy, String op, java.util.Map<String, String> context)
+ {
+ CommunicatorObserver obsv =
+ ((com.zeroc.Ice._ObjectPrxI)proxy).__reference().getInstance().initializationData().observer;
+ if(obsv != null)
+ {
+ InvocationObserver observer;
+ if(context == null)
+ {
+ observer = obsv.getInvocationObserver(proxy, op, _emptyContext);
+ }
+ else
+ {
+ observer = obsv.getInvocationObserver(proxy, op, context);
+ }
+ if(observer != null)
+ {
+ observer.attach();
+ }
+ return observer;
+ }
+ return null;
+ }
+
+ private static final java.util.Map<String, String> _emptyContext = new java.util.HashMap<>();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/OpaqueEndpointI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OpaqueEndpointI.java
new file mode 100644
index 00000000000..4b1c79ecfd2
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OpaqueEndpointI.java
@@ -0,0 +1,422 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import com.zeroc.Ice.EndpointParseException;
+import java.util.Base64;
+
+final class OpaqueEndpointI extends EndpointI
+{
+ public OpaqueEndpointI(java.util.ArrayList<String> args)
+ {
+ _type = -1;
+ _rawEncoding = com.zeroc.Ice.Util.Encoding_1_0;
+ _rawBytes = new byte[0];
+
+ initWithOptions(args);
+
+ if(_type < 0)
+ {
+ throw new EndpointParseException("no -t option in endpoint " + toString());
+ }
+ if(_rawBytes.length == 0)
+ {
+ throw new EndpointParseException("no -v option in endpoint " + toString());
+ }
+
+ calcHashValue();
+ }
+
+ public OpaqueEndpointI(short type, com.zeroc.Ice.InputStream s)
+ {
+ _type = type;
+ _rawEncoding = s.getEncoding();
+ int sz = s.getEncapsulationSize();
+ _rawBytes = s.readBlob(sz);
+
+ calcHashValue();
+ }
+
+ //
+ // Marshal the endpoint
+ //
+ @Override
+ public void streamWrite(com.zeroc.Ice.OutputStream s)
+ {
+ s.startEncapsulation(_rawEncoding, com.zeroc.Ice.FormatType.DefaultFormat);
+ s.writeBlob(_rawBytes);
+ s.endEncapsulation();
+ }
+
+ @Override
+ public void streamWriteImpl(com.zeroc.Ice.OutputStream s)
+ {
+ assert(false);
+ }
+
+ //
+ // Return the endpoint information.
+ //
+ @Override
+ public com.zeroc.Ice.EndpointInfo getInfo()
+ {
+ return new com.zeroc.Ice.OpaqueEndpointInfo(null, -1, false, _rawEncoding, _rawBytes)
+ {
+ @Override
+ public short type()
+ {
+ return _type;
+ }
+
+ @Override
+ public boolean datagram()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean secure()
+ {
+ return false;
+ }
+ };
+ }
+
+ //
+ // Return the endpoint type
+ //
+ @Override
+ public short type()
+ {
+ return _type;
+ }
+
+ //
+ // Return the protocol name
+ //
+ @Override
+ public String protocol()
+ {
+ return "opaque";
+ }
+
+ //
+ // Return the timeout for the endpoint in milliseconds. 0 means
+ // non-blocking, -1 means no timeout.
+ //
+ @Override
+ public int timeout()
+ {
+ return -1;
+ }
+
+ //
+ // Return a new endpoint with a different timeout value, provided
+ // that timeouts are supported by the endpoint. Otherwise the same
+ // endpoint is returned.
+ //
+ @Override
+ public EndpointI timeout(int t)
+ {
+ return this;
+ }
+
+ @Override
+ public String connectionId()
+ {
+ return "";
+ }
+
+ //
+ // Return a new endpoint with a different connection id.
+ //
+ @Override
+ public EndpointI connectionId(String connectionId)
+ {
+ return this;
+ }
+
+ //
+ // Return true if the endpoints support bzip2 compress, or false
+ // otherwise.
+ //
+ @Override
+ public boolean compress()
+ {
+ return false;
+ }
+
+ //
+ // Return a new endpoint with a different compression value,
+ // provided that compression is supported by the
+ // endpoint. Otherwise the same endpoint is returned.
+ //
+ @Override
+ public EndpointI compress(boolean compress)
+ {
+ return this;
+ }
+
+ //
+ // Return true if the endpoint is datagram-based.
+ //
+ @Override
+ public boolean datagram()
+ {
+ return false;
+ }
+
+ //
+ // Return true if the endpoint is secure.
+ //
+ @Override
+ public boolean secure()
+ {
+ return false;
+ }
+
+ //
+ // Return a server side transceiver for this endpoint, or null if a
+ // transceiver can only be created by an acceptor.d.
+ //
+ @Override
+ public Transceiver transceiver()
+ {
+ return null;
+ }
+
+ //
+ // Return connectors for this endpoint, or empty list if no connector
+ // is available.
+ //
+ @Override
+ public void connectors_async(com.zeroc.Ice.EndpointSelectionType selType, EndpointI_connectors callback)
+ {
+ callback.connectors(new java.util.ArrayList<>());
+ }
+
+ //
+ // Return an acceptor for this endpoint, or null if no acceptors
+ // is available.
+ //
+ @Override
+ public Acceptor acceptor(String adapterName)
+ {
+ return null;
+ }
+
+ //
+ // Expand endpoint out in to separate endpoints for each local
+ // host if listening on INADDR_ANY on server side or if no host
+ // was specified on client side.
+ //
+ @Override
+ public java.util.List<EndpointI> expand()
+ {
+ java.util.List<EndpointI> endps = new java.util.ArrayList<>();
+ endps.add(this);
+ return endps;
+ }
+
+ //
+ // Check whether the endpoint is equivalent to another one.
+ //
+ @Override
+ public boolean equivalent(EndpointI endpoint)
+ {
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return _hashCode;
+ }
+
+ @Override
+ public String options()
+ {
+ String s = "";
+ if(_type > -1)
+ {
+ s += " -t " + _type;
+ }
+ s += " -e " + com.zeroc.Ice.Util.encodingVersionToString(_rawEncoding);
+ if(_rawBytes.length > 0)
+ {
+ s += " -v " + Base64.getEncoder().encodeToString(_rawBytes);
+ }
+ return s;
+ }
+
+ //
+ // Compare endpoints for sorting purposes
+ //
+ @Override
+ public int compareTo(EndpointI obj) // From java.lang.Comparable
+ {
+ if(!(obj instanceof OpaqueEndpointI))
+ {
+ return type() < obj.type() ? -1 : 1;
+ }
+
+ OpaqueEndpointI p = (OpaqueEndpointI)obj;
+ if(this == p)
+ {
+ return 0;
+ }
+
+ if(_type < p._type)
+ {
+ return -1;
+ }
+ else if(p._type < _type)
+ {
+ return 1;
+ }
+
+ if(_rawEncoding.major < p._rawEncoding.major)
+ {
+ return -1;
+ }
+ else if(p._rawEncoding.major < _rawEncoding.major)
+ {
+ return 1;
+ }
+
+ if(_rawEncoding.minor < p._rawEncoding.minor)
+ {
+ return -1;
+ }
+ else if(p._rawEncoding.minor < _rawEncoding.minor)
+ {
+ return 1;
+ }
+
+ if(_rawBytes.length < p._rawBytes.length)
+ {
+ return -1;
+ }
+ else if(p._rawBytes.length < _rawBytes.length)
+ {
+ return 1;
+ }
+ for(int i = 0; i < _rawBytes.length; i++)
+ {
+ if(_rawBytes[i] < p._rawBytes[i])
+ {
+ return -1;
+ }
+ else if(p._rawBytes[i] < _rawBytes[i])
+ {
+ return 1;
+ }
+ }
+
+ return 0;
+ }
+
+ @Override
+ protected boolean checkOption(String option, String argument, String endpoint)
+ {
+ switch(option.charAt(1))
+ {
+ case 't':
+ {
+ if(_type > -1)
+ {
+ throw new EndpointParseException("multiple -t options in endpoint " + endpoint);
+ }
+ if(argument == null)
+ {
+ throw new EndpointParseException("no argument provided for -t option in endpoint " + endpoint);
+ }
+
+ int t;
+ try
+ {
+ t = Integer.parseInt(argument);
+ }
+ catch(NumberFormatException ex)
+ {
+ throw new EndpointParseException("invalid type value `" + argument + "' in endpoint " + endpoint);
+ }
+
+ if(t < 0 || t > 65535)
+ {
+ throw new EndpointParseException("type value `" + argument + "' out of range in endpoint " + endpoint);
+ }
+
+ _type = (short)t;
+ return true;
+ }
+
+ case 'v':
+ {
+ if(_rawBytes.length > 0)
+ {
+ throw new EndpointParseException("multiple -v options in endpoint " + endpoint);
+ }
+ if(argument == null)
+ {
+ throw new EndpointParseException("no argument provided for -v option in endpoint " + endpoint);
+ }
+
+ try
+ {
+ _rawBytes = Base64.getDecoder().decode(argument);
+ }
+ catch(IllegalArgumentException ex)
+ {
+ throw new EndpointParseException("base64 decoding failed in endpoint " + endpoint, ex);
+ }
+ return true;
+ }
+
+ case 'e':
+ {
+ if(argument == null)
+ {
+ throw new EndpointParseException("no argument provided for -e option in endpoint " + endpoint);
+ }
+
+ try
+ {
+ _rawEncoding = com.zeroc.Ice.Util.stringToEncodingVersion(argument);
+ }
+ catch(com.zeroc.Ice.VersionParseException e)
+ {
+ throw new EndpointParseException("invalid encoding version `" + argument + "' in endpoint " +
+ endpoint + ":\n" + e.str);
+ }
+ return true;
+ }
+
+ default:
+ {
+ return false;
+ }
+ }
+ }
+
+ private void calcHashValue()
+ {
+ int h = 5381;
+ h = HashUtil.hashAdd(h, _type);
+ h = HashUtil.hashAdd(h, _rawEncoding);
+ h = HashUtil.hashAdd(h, _rawBytes);
+ _hashCode = h;
+ }
+
+ private short _type;
+ private com.zeroc.Ice.EncodingVersion _rawEncoding;
+ private byte[] _rawBytes;
+ private int _hashCode;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingAsync.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingAsync.java
new file mode 100644
index 00000000000..e036660697a
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingAsync.java
@@ -0,0 +1,375 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import com.zeroc.Ice.FormatType;
+import com.zeroc.Ice.InputStream;
+import com.zeroc.Ice._ObjectPrxI;
+import com.zeroc.Ice.OperationInterruptedException;
+import com.zeroc.Ice.OperationMode;
+import com.zeroc.Ice.OutputStream;
+import com.zeroc.Ice.UserException;
+import com.zeroc.Ice.UnknownException;
+import com.zeroc.Ice.UnknownUserException;
+
+public class OutgoingAsync<T> extends ProxyOutgoingAsyncBase<T>
+{
+ @FunctionalInterface
+ static public interface Unmarshaler<V>
+ {
+ V unmarshal(com.zeroc.Ice.InputStream istr);
+ }
+
+ public OutgoingAsync(com.zeroc.Ice.ObjectPrx prx, String operation, OperationMode mode, boolean synchronous,
+ Class<?>[] userExceptions)
+ {
+ super((_ObjectPrxI)prx, operation, null);
+ _mode = mode == null ? OperationMode.Normal : mode;
+ _synchronous = synchronous;
+ _userExceptions = userExceptions;
+ _encoding = Protocol.getCompatibleEncoding(_proxy.__reference().getEncoding());
+
+ if(_instance.cacheMessageBuffers() > 0)
+ {
+ _ObjectPrxI.StreamPair p = _proxy.__getCachedMessageBuffers();
+ if(p != null)
+ {
+ _is = p.is;
+ _os = p.os;
+ }
+ }
+ if(_os == null)
+ {
+ _os = new com.zeroc.Ice.OutputStream(_instance, Protocol.currentProtocolEncoding);
+ }
+ }
+
+ public void invoke(boolean twowayOnly, java.util.Map<String, String> ctx, FormatType format,
+ OutputStream.Marshaler marshal, Unmarshaler<T> unmarshal)
+ {
+ _unmarshal = unmarshal;
+
+ if(twowayOnly && !_proxy.ice_isTwoway())
+ {
+ throw new java.lang.IllegalArgumentException("`" + _operation +
+ "' can only be called with a twoway proxy");
+ }
+
+ if(format == null)
+ {
+ format = FormatType.DefaultFormat;
+ }
+
+ try
+ {
+ prepare(ctx);
+
+ if(marshal == null)
+ {
+ writeEmptyParams();
+ }
+ else
+ {
+ marshal.marshal(startWriteParams(format));
+ endWriteParams();
+ }
+
+ if(isBatch())
+ {
+ //
+ // NOTE: we don't call sent/completed callbacks for batch AMI requests
+ //
+ _sentSynchronously = true;
+ _proxy.__getBatchRequestQueue().finishBatchRequest(_os, _proxy, _operation);
+ finished(true);
+ }
+ else
+ {
+ //
+ // NOTE: invokeImpl doesn't throw so this can be called from the
+ // try block with the catch block calling abort() in case of an
+ // exception.
+ //
+ invokeImpl(true); // userThread = true
+ }
+ }
+ catch(com.zeroc.Ice.Exception ex)
+ {
+ abort(ex);
+ }
+ }
+
+ public T __wait()
+ {
+ if(isBatch())
+ {
+ return null; // The future will not be completed for a batch invocation.
+ }
+
+ try
+ {
+ return __waitUserEx();
+ }
+ catch(UserException ex)
+ {
+ throw new UnknownUserException(ex.ice_id(), ex);
+ }
+ }
+
+ public T __waitUserEx()
+ throws UserException
+ {
+ if(Thread.currentThread().interrupted())
+ {
+ throw new OperationInterruptedException();
+ }
+
+ try
+ {
+ return get();
+ }
+ catch(InterruptedException ex)
+ {
+ throw new OperationInterruptedException();
+ }
+ catch(java.util.concurrent.ExecutionException ee)
+ {
+ try
+ {
+ throw ee.getCause();
+ }
+ catch(RuntimeException ex) // Includes LocalException
+ {
+ throw ex;
+ }
+ catch(UserException ex)
+ {
+ throw ex;
+ }
+ catch(Throwable ex)
+ {
+ throw new UnknownException(ex);
+ }
+ }
+ }
+
+ @Override
+ protected void __sent()
+ {
+ super.__sent();
+
+ if(!_proxy.ice_isTwoway())
+ {
+ //
+ // For a non-twoway proxy, the invocation is completed after it is sent.
+ //
+ complete(null);
+ }
+ }
+
+ @Override
+ public boolean sent()
+ {
+ return sent(!_proxy.ice_isTwoway()); // done = true if not a two-way proxy (no response expected)
+ }
+
+ @Override
+ public int invokeRemote(com.zeroc.Ice.ConnectionI connection, boolean compress, boolean response)
+ throws RetryException
+ {
+ _cachedConnection = connection;
+ return connection.sendAsyncRequest(this, compress, response, 0);
+ }
+
+ @Override
+ public int invokeCollocated(CollocatedRequestHandler handler)
+ {
+ // The stream cannot be cached if the proxy is not a twoway or there is an invocation timeout set.
+ if(!_proxy.ice_isTwoway() || _proxy.__reference().getInvocationTimeout() > 0)
+ {
+ // Disable caching by marking the streams as cached!
+ _state |= StateCachedBuffers;
+ }
+ return handler.invokeAsyncRequest(this, 0, _synchronous);
+ }
+
+ @Override
+ public void abort(com.zeroc.Ice.Exception ex)
+ {
+ if(isBatch())
+ {
+ //
+ // If we didn't finish a batch oneway or datagram request, we
+ // must notify the connection about that we give up ownership
+ // of the batch stream.
+ //
+ _proxy.__getBatchRequestQueue().abortBatchRequest(_os);
+ }
+
+ super.abort(ex);
+ }
+
+ @Override
+ protected void __completed()
+ {
+ super.__completed();
+
+ try
+ {
+ if(_exception != null)
+ {
+ completeExceptionally(_exception);
+ }
+ else if((_state & StateOK) > 0)
+ {
+ T r = null;
+ try
+ {
+ if(_unmarshal != null)
+ {
+ //
+ // The Unmarshaler callback unmarshals and returns the results.
+ //
+ r = _unmarshal.unmarshal(startReadParams());
+ endReadParams();
+ }
+ else
+ {
+ readEmptyParams();
+ }
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ completeExceptionally(ex);
+ return;
+ }
+ complete(r);
+ }
+ else
+ {
+ //
+ // Handle user exception.
+ //
+ try
+ {
+ throwUserException();
+ }
+ catch(Throwable ex)
+ {
+ completeExceptionally(ex);
+ }
+ }
+ }
+ finally
+ {
+ cacheMessageBuffers();
+ }
+ }
+
+ @Override
+ public final boolean completed(com.zeroc.Ice.InputStream is)
+ {
+ //
+ // NOTE: this method is called from ConnectionI.parseMessage
+ // with the connection locked. Therefore, it must not invoke
+ // any user callbacks.
+ //
+
+ // _is can already be initialized if the invocation is retried
+ if(_is == null)
+ {
+ _is = new com.zeroc.Ice.InputStream(_instance, Protocol.currentProtocolEncoding);
+ }
+ _is.swap(is);
+
+ return super.completed(_is);
+ }
+
+ private com.zeroc.Ice.OutputStream startWriteParams(FormatType format)
+ {
+ _os.startEncapsulation(_encoding, format);
+ return _os;
+ }
+
+ private void endWriteParams()
+ {
+ _os.endEncapsulation();
+ }
+
+ private void writeEmptyParams()
+ {
+ _os.writeEmptyEncapsulation(_encoding);
+ }
+
+ private com.zeroc.Ice.InputStream startReadParams()
+ {
+ _is.startEncapsulation();
+ return _is;
+ }
+
+ private void endReadParams()
+ {
+ _is.endEncapsulation();
+ }
+
+ private void readEmptyParams()
+ {
+ _is.skipEmptyEncapsulation();
+ }
+
+ private final void throwUserException()
+ throws com.zeroc.Ice.UserException
+ {
+ try
+ {
+ _is.startEncapsulation();
+ _is.throwException(null);
+ }
+ catch(com.zeroc.Ice.UserException ex)
+ {
+ _is.endEncapsulation();
+ throw ex;
+ }
+ }
+
+ @Override
+ protected void cacheMessageBuffers()
+ {
+ if(_instance.cacheMessageBuffers() > 0)
+ {
+ synchronized(this)
+ {
+ if((_state & StateCachedBuffers) > 0)
+ {
+ return;
+ }
+ _state |= StateCachedBuffers;
+ }
+
+ if(_is != null)
+ {
+ _is.reset();
+ }
+ _os.reset();
+
+ _proxy.__cacheMessageBuffers(_is, _os);
+
+ _is = null;
+ _os = null;
+ }
+ }
+
+ final private com.zeroc.Ice.EncodingVersion _encoding;
+ private com.zeroc.Ice.InputStream _is;
+
+ private boolean _synchronous; // True if this AMI request is being used for a generated synchronous invocation.
+ private Class<?>[] _userExceptions; // Valid user exceptions.
+ private Unmarshaler<T> _unmarshal;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingAsyncBase.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingAsyncBase.java
new file mode 100644
index 00000000000..10f2bbca055
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingAsyncBase.java
@@ -0,0 +1,108 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+//
+// Base class for handling asynchronous invocations. This class is
+// responsible for the handling of the output stream and the child
+// invocation observer.
+//
+public abstract class OutgoingAsyncBase<T> extends InvocationFutureI<T>
+{
+ public boolean sent()
+ {
+ return sent(true);
+ }
+
+ public boolean completed(com.zeroc.Ice.InputStream is)
+ {
+ assert(false); // Must be implemented by classes that handle responses
+ return false;
+ }
+
+ public boolean completed(com.zeroc.Ice.Exception ex)
+ {
+ return finished(ex);
+ }
+
+ public final void attachRemoteObserver(com.zeroc.Ice.ConnectionInfo info, com.zeroc.Ice.Endpoint endpt,
+ int requestId)
+ {
+ if(_observer != null)
+ {
+ final int size = _os.size() - Protocol.headerSize - 4;
+ _childObserver = getObserver().getRemoteObserver(info, endpt, requestId, size);
+ if(_childObserver != null)
+ {
+ _childObserver.attach();
+ }
+ }
+ }
+
+ public final void attachCollocatedObserver(com.zeroc.Ice.ObjectAdapter adapter, int requestId)
+ {
+ if(_observer != null)
+ {
+ final int size = _os.size() - Protocol.headerSize - 4;
+ _childObserver = getObserver().getCollocatedObserver(adapter, requestId, size);
+ if(_childObserver != null)
+ {
+ _childObserver.attach();
+ }
+ }
+ }
+
+ public final com.zeroc.Ice.OutputStream getOs()
+ {
+ return _os;
+ }
+
+ protected OutgoingAsyncBase(com.zeroc.Ice.Communicator com, Instance instance, String op)
+ {
+ super(com, instance, op);
+ _os = new com.zeroc.Ice.OutputStream(instance, Protocol.currentProtocolEncoding);
+ }
+
+ protected OutgoingAsyncBase(com.zeroc.Ice.Communicator com, Instance instance, String op,
+ com.zeroc.Ice.OutputStream os)
+ {
+ super(com, instance, op);
+ _os = os;
+ }
+
+ @Override
+ protected boolean sent(boolean done)
+ {
+ if(done)
+ {
+ if(_childObserver != null)
+ {
+ _childObserver.detach();
+ _childObserver = null;
+ }
+ }
+ return super.sent(done);
+ }
+
+ @Override
+ protected boolean finished(com.zeroc.Ice.Exception ex)
+ {
+ if(_childObserver != null)
+ {
+ _childObserver.failed(ex.ice_id());
+ _childObserver.detach();
+ _childObserver = null;
+ }
+ return super.finished(ex);
+ }
+
+ protected com.zeroc.Ice.OutputStream _os;
+ protected com.zeroc.Ice.Instrumentation.ChildInvocationObserver _childObserver;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingConnectionFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingConnectionFactory.java
new file mode 100644
index 00000000000..d41029e3a92
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingConnectionFactory.java
@@ -0,0 +1,1153 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import com.zeroc.Ice.ConnectionI;
+import com.zeroc.Ice.LocalException;
+
+public final class OutgoingConnectionFactory
+{
+ //
+ // Helper class to multi hash map.
+ //
+ private static class MultiHashMap<K, V> extends java.util.HashMap<K, java.util.List<V>>
+ {
+ public void
+ putOne(K key, V value)
+ {
+ java.util.List<V> list = this.get(key);
+ if(list == null)
+ {
+ list = new java.util.LinkedList<>();
+ this.put(key, list);
+ }
+ list.add(value);
+ }
+
+ public boolean
+ removeElementWithValue(K key, V value)
+ {
+ java.util.List<V> list = this.get(key);
+ assert(list != null);
+ boolean v = list.remove(value);
+ if(list.isEmpty())
+ {
+ this.remove(key);
+ }
+ return v;
+ }
+ }
+
+ interface CreateConnectionCallback
+ {
+ void setConnection(ConnectionI connection, boolean compress);
+ void setException(LocalException ex);
+ }
+
+ public synchronized void
+ destroy()
+ {
+ if(_destroyed)
+ {
+ return;
+ }
+
+ for(java.util.List<ConnectionI> connectionList : _connections.values())
+ {
+ for(ConnectionI connection : connectionList)
+ {
+ connection.destroy(ConnectionI.CommunicatorDestroyed);
+ }
+ }
+
+ _destroyed = true;
+ _communicator = null;
+ notifyAll();
+ }
+
+ public synchronized void
+ updateConnectionObservers()
+ {
+ for(java.util.List<ConnectionI> connectionList : _connections.values())
+ {
+ for(ConnectionI connection : connectionList)
+ {
+ connection.updateObserver();
+ }
+ }
+ }
+
+ // Called from Instance.destroy().
+ public void
+ waitUntilFinished()
+ {
+ java.util.Map<Connector, java.util.List<ConnectionI> > connections = null;
+ synchronized(this)
+ {
+ //
+ // First we wait until the factory is destroyed. We also
+ // wait until there are no pending connections
+ // anymore. Only then we can be sure the _connections
+ // contains all connections.
+ //
+ while(!_destroyed || !_pending.isEmpty() || _pendingConnectCount > 0)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ throw new com.zeroc.Ice.OperationInterruptedException();
+ }
+ }
+
+ //
+ // We want to wait until all connections are finished outside the
+ // thread synchronization.
+ //
+ connections = new java.util.HashMap<>(_connections);
+ }
+
+ //
+ // Now we wait until the destruction of each connection is finished.
+ //
+ for(java.util.List<ConnectionI> connectionList : connections.values())
+ {
+ for(ConnectionI connection : connectionList)
+ {
+ try
+ {
+ connection.waitUntilFinished();
+ }
+ catch(InterruptedException e)
+ {
+ //
+ // Force close all of the connections.
+ //
+ for(java.util.List<ConnectionI> l : connections.values())
+ {
+ for(ConnectionI c : l)
+ {
+ c.close(true);
+ }
+ }
+ throw new com.zeroc.Ice.OperationInterruptedException();
+ }
+ }
+ }
+
+ synchronized(this)
+ {
+ // Ensure all the connections are finished and reapable at this point.
+ java.util.List<ConnectionI> cons = _monitor.swapReapedConnections();
+ if(cons != null)
+ {
+ int size = 0;
+ for(java.util.List<ConnectionI> connectionList : _connections.values())
+ {
+ size += connectionList.size();
+ }
+ assert(cons.size() == size);
+ _connections.clear();
+ _connectionsByEndpoint.clear();
+ }
+ else
+ {
+ assert(_connections.isEmpty());
+ assert(_connectionsByEndpoint.isEmpty());
+ }
+ _monitor.destroy();
+ }
+ }
+
+ public void
+ create(EndpointI[] endpts, boolean hasMore, com.zeroc.Ice.EndpointSelectionType selType,
+ CreateConnectionCallback callback)
+ {
+ assert(endpts.length > 0);
+
+ //
+ // Apply the overrides.
+ //
+ java.util.List<EndpointI> endpoints = applyOverrides(endpts);
+
+ //
+ // Try to find a connection to one of the given endpoints.
+ //
+ try
+ {
+ Holder<Boolean> compress = new Holder<>();
+ ConnectionI connection = findConnectionByEndpoint(endpoints, compress);
+ if(connection != null)
+ {
+ callback.setConnection(connection, compress.value);
+ return;
+ }
+ }
+ catch(LocalException ex)
+ {
+ callback.setException(ex);
+ return;
+ }
+
+ ConnectCallback cb = new ConnectCallback(this, endpoints, hasMore, callback, selType);
+ cb.getConnectors();
+ }
+
+ public synchronized void
+ setRouterInfo(RouterInfo routerInfo)
+ {
+ if(_destroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ assert(routerInfo != null);
+
+ //
+ // Search for connections to the router's client proxy
+ // endpoints, and update the object adapter for such
+ // connections, so that callbacks from the router can be
+ // received over such connections.
+ //
+ com.zeroc.Ice.ObjectAdapter adapter = routerInfo.getAdapter();
+ DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
+ for(EndpointI endpoint : routerInfo.getClientEndpoints())
+ {
+ //
+ // Modify endpoints with overrides.
+ //
+ if(defaultsAndOverrides.overrideTimeout)
+ {
+ endpoint = endpoint.timeout(defaultsAndOverrides.overrideTimeoutValue);
+ }
+
+ //
+ // The Connection object does not take the compression flag of
+ // endpoints into account, but instead gets the information
+ // about whether messages should be compressed or not from
+ // other sources. In order to allow connection sharing for
+ // endpoints that differ in the value of the compression flag
+ // only, we always set the compression flag to false here in
+ // this connection factory.
+ //
+ endpoint = endpoint.compress(false);
+
+ for(java.util.List<ConnectionI> connectionList : _connections.values())
+ {
+ for(ConnectionI connection : connectionList)
+ {
+ if(connection.endpoint() == endpoint)
+ {
+ connection.setAdapter(adapter);
+ }
+ }
+ }
+ }
+ }
+
+ public synchronized void
+ removeAdapter(com.zeroc.Ice.ObjectAdapter adapter)
+ {
+ if(_destroyed)
+ {
+ return;
+ }
+
+ for(java.util.List<ConnectionI> connectionList : _connections.values())
+ {
+ for(ConnectionI connection : connectionList)
+ {
+ if(connection.getAdapter() == adapter)
+ {
+ connection.setAdapter(null);
+ }
+ }
+ }
+ }
+
+ public void
+ flushAsyncBatchRequests(CommunicatorFlushBatch outAsync)
+ {
+ java.util.List<ConnectionI> c = new java.util.LinkedList<>();
+
+ synchronized(this)
+ {
+ if(!_destroyed)
+ {
+ for(java.util.List<ConnectionI> connectionList : _connections.values())
+ {
+ for(ConnectionI connection : connectionList)
+ {
+ if(connection.isActiveOrHolding())
+ {
+ c.add(connection);
+ }
+ }
+ }
+ }
+ }
+
+ for(ConnectionI conn : c)
+ {
+ try
+ {
+ outAsync.flushConnection(conn);
+ }
+ catch(LocalException ex)
+ {
+ // Ignore.
+ }
+ }
+ }
+
+ //
+ // Only for use by Instance.
+ //
+ OutgoingConnectionFactory(com.zeroc.Ice.Communicator communicator, Instance instance)
+ {
+ _communicator = communicator;
+ _instance = instance;
+ _monitor = new FactoryACMMonitor(instance, instance.clientACM());
+ _destroyed = false;
+ }
+
+ @Override
+ protected synchronized void
+ finalize()
+ throws Throwable
+ {
+ try
+ {
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_destroyed);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_connections.isEmpty());
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_connectionsByEndpoint.isEmpty());
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_pendingConnectCount == 0);
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_pending.isEmpty());
+ }
+ catch(java.lang.Exception ex)
+ {
+ }
+ finally
+ {
+ super.finalize();
+ }
+ }
+
+ private java.util.List<EndpointI>
+ applyOverrides(EndpointI[] endpts)
+ {
+ DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
+ java.util.List<EndpointI> endpoints = new java.util.ArrayList<>();
+ for(EndpointI endpoint : endpts)
+ {
+ //
+ // Modify endpoints with overrides.
+ //
+ if(defaultsAndOverrides.overrideTimeout)
+ {
+ endpoints.add(endpoint.timeout(defaultsAndOverrides.overrideTimeoutValue));
+ }
+ else
+ {
+ endpoints.add(endpoint);
+ }
+ }
+
+ return endpoints;
+ }
+
+ synchronized private ConnectionI
+ findConnectionByEndpoint(java.util.List<EndpointI> endpoints, Holder<Boolean> compress)
+ {
+ if(_destroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
+ assert(!endpoints.isEmpty());
+
+ for(EndpointI endpoint : endpoints)
+ {
+ java.util.List<ConnectionI> connectionList = _connectionsByEndpoint.get(endpoint);
+ if(connectionList == null)
+ {
+ continue;
+ }
+
+ for(ConnectionI connection : connectionList)
+ {
+ if(connection.isActiveOrHolding()) // Don't return destroyed or un-validated connections
+ {
+ if(defaultsAndOverrides.overrideCompress)
+ {
+ compress.value = defaultsAndOverrides.overrideCompressValue;
+ }
+ else
+ {
+ compress.value = endpoint.compress();
+ }
+ return connection;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ //
+ // Must be called while synchronized.
+ //
+ private ConnectionI
+ findConnection(java.util.List<ConnectorInfo> connectors, Holder<Boolean> compress)
+ {
+ DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
+ for(ConnectorInfo ci : connectors)
+ {
+ if(_pending.containsKey(ci.connector))
+ {
+ continue;
+ }
+
+ java.util.List<ConnectionI> connectionList = _connections.get(ci.connector);
+ if(connectionList == null)
+ {
+ continue;
+ }
+
+ for(ConnectionI connection : connectionList)
+ {
+ if(connection.isActiveOrHolding()) // Don't return destroyed or un-validated connections
+ {
+ if(defaultsAndOverrides.overrideCompress)
+ {
+ compress.value = defaultsAndOverrides.overrideCompressValue;
+ }
+ else
+ {
+ compress.value = ci.endpoint.compress();
+ }
+ return connection;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ synchronized private void
+ incPendingConnectCount()
+ {
+ //
+ // Keep track of the number of pending connects. The outgoing connection factory
+ // waitUntilFinished() method waits for all the pending connects to terminate before
+ // to return. This ensures that the communicator client thread pool isn't destroyed
+ // too soon and will still be available to execute the ice_exception() callbacks for
+ // the asynchronous requests waiting on a connection to be established.
+ //
+
+ if(_destroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+ ++_pendingConnectCount;
+ }
+
+ synchronized private void
+ decPendingConnectCount()
+ {
+ --_pendingConnectCount;
+ assert(_pendingConnectCount >= 0);
+ if(_destroyed && _pendingConnectCount == 0)
+ {
+ notifyAll();
+ }
+ }
+
+ private ConnectionI
+ getConnection(java.util.List<ConnectorInfo> connectors, ConnectCallback cb, Holder<Boolean> compress)
+ {
+ assert(cb != null);
+ synchronized(this)
+ {
+ if(_destroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ //
+ // Reap closed connections
+ //
+ java.util.List<ConnectionI> cons = _monitor.swapReapedConnections();
+ if(cons != null)
+ {
+ for(ConnectionI c : cons)
+ {
+ _connections.removeElementWithValue(c.connector(), c);
+ _connectionsByEndpoint.removeElementWithValue(c.endpoint(), c);
+ _connectionsByEndpoint.removeElementWithValue(c.endpoint().compress(true), c);
+ }
+ }
+
+ //
+ // Try to get the connection. We may need to wait for other threads to
+ // finish if one of them is currently establishing a connection to one
+ // of our connectors.
+ //
+ while(true)
+ {
+ if(_destroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ //
+ // Search for a matching connection. If we find one, we're done.
+ //
+ ConnectionI connection = findConnection(connectors, compress);
+ if(connection != null)
+ {
+ return connection;
+ }
+
+ if(addToPending(cb, connectors))
+ {
+ return null;
+ }
+ else
+ {
+ //
+ // If no thread is currently establishing a connection to one of our connectors,
+ // we get out of this loop and start the connection establishment to one of the
+ // given connectors.
+ //
+ break;
+ }
+ }
+ }
+
+ //
+ // At this point, we're responsible for establishing the connection to one of
+ // the given connectors. If it's a non-blocking connect, calling nextConnector
+ // will start the connection establishment. Otherwise, we return null to get
+ // the caller to establish the connection.
+ //
+ if(cb != null)
+ {
+ cb.nextConnector();
+ }
+
+ return null;
+ }
+
+ private synchronized ConnectionI
+ createConnection(Transceiver transceiver, ConnectorInfo ci)
+ {
+ assert(_pending.containsKey(ci.connector) && transceiver != null);
+
+ //
+ // Create and add the connection to the connection map. Adding the connection to the map
+ // is necessary to support the interruption of the connection initialization and validation
+ // in case the communicator is destroyed.
+ //
+ ConnectionI connection = null;
+ try
+ {
+ if(_destroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+
+ connection = new ConnectionI(_communicator, _instance, _monitor, transceiver, ci.connector,
+ ci.endpoint.compress(false), null);
+ }
+ catch(LocalException ex)
+ {
+ try
+ {
+ transceiver.close();
+ }
+ catch(LocalException exc)
+ {
+ // Ignore
+ }
+ throw ex;
+ }
+
+ _connections.putOne(ci.connector, connection);
+ _connectionsByEndpoint.putOne(connection.endpoint(), connection);
+ _connectionsByEndpoint.putOne(connection.endpoint().compress(true), connection);
+ return connection;
+ }
+
+ private void
+ finishGetConnection(java.util.List<ConnectorInfo> connectors,
+ ConnectorInfo ci,
+ ConnectionI connection,
+ ConnectCallback cb)
+ {
+ java.util.Set<ConnectCallback> connectionCallbacks = new java.util.HashSet<>();
+ if(cb != null)
+ {
+ connectionCallbacks.add(cb);
+ }
+
+ java.util.Set<ConnectCallback> callbacks = new java.util.HashSet<>();
+ synchronized(this)
+ {
+ for(ConnectorInfo c : connectors)
+ {
+ java.util.Set<ConnectCallback> cbs = _pending.remove(c.connector);
+ if(cbs != null)
+ {
+ for(ConnectCallback cc : cbs)
+ {
+ if(cc.hasConnector(ci))
+ {
+ connectionCallbacks.add(cc);
+ }
+ else
+ {
+ callbacks.add(cc);
+ }
+ }
+ }
+ }
+
+ for(ConnectCallback cc : connectionCallbacks)
+ {
+ cc.removeFromPending();
+ callbacks.remove(cc);
+ }
+ for(ConnectCallback cc : callbacks)
+ {
+ cc.removeFromPending();
+ }
+ notifyAll();
+ }
+
+ boolean compress;
+ DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
+ if(defaultsAndOverrides.overrideCompress)
+ {
+ compress = defaultsAndOverrides.overrideCompressValue;
+ }
+ else
+ {
+ compress = ci.endpoint.compress();
+ }
+
+ for(ConnectCallback cc : callbacks)
+ {
+ cc.getConnection();
+ }
+ for(ConnectCallback cc : connectionCallbacks)
+ {
+ cc.setConnection(connection, compress);
+ }
+ }
+
+ private void
+ finishGetConnection(java.util.List<ConnectorInfo> connectors, LocalException ex, ConnectCallback cb)
+ {
+ java.util.Set<ConnectCallback> failedCallbacks = new java.util.HashSet<>();
+ if(cb != null)
+ {
+ failedCallbacks.add(cb);
+ }
+
+ java.util.Set<ConnectCallback> callbacks = new java.util.HashSet<>();
+ synchronized(this)
+ {
+ for(ConnectorInfo c : connectors)
+ {
+ java.util.Set<ConnectCallback> cbs = _pending.remove(c.connector);
+ if(cbs != null)
+ {
+ for(ConnectCallback cc : cbs)
+ {
+ if(cc.removeConnectors(connectors))
+ {
+ failedCallbacks.add(cc);
+ }
+ else
+ {
+ callbacks.add(cc);
+ }
+ }
+ }
+ }
+
+ for(ConnectCallback cc : callbacks)
+ {
+ assert(!failedCallbacks.contains(cc));
+ cc.removeFromPending();
+ }
+ notifyAll();
+ }
+
+ for(ConnectCallback cc : callbacks)
+ {
+ cc.getConnection();
+ }
+ for(ConnectCallback cc : failedCallbacks)
+ {
+ cc.setException(ex);
+ }
+ }
+
+ private boolean
+ addToPending(ConnectCallback cb, java.util.List<ConnectorInfo> connectors)
+ {
+ //
+ // Add the callback to each connector pending list.
+ //
+ boolean found = false;
+ for(ConnectorInfo p : connectors)
+ {
+ java.util.Set<ConnectCallback> cbs = _pending.get(p.connector);
+ if(cbs != null)
+ {
+ found = true;
+ if(cb != null)
+ {
+ cbs.add(cb); // Add the callback to each pending connector.
+ }
+ }
+ }
+
+ if(found)
+ {
+ return true;
+ }
+
+ //
+ // If there's no pending connection for the given connectors, we're
+ // responsible for its establishment. We add empty pending lists,
+ // other callbacks to the same connectors will be queued.
+ //
+ for(ConnectorInfo p : connectors)
+ {
+ if(!_pending.containsKey(p.connector))
+ {
+ _pending.put(p.connector, new java.util.HashSet<>());
+ }
+ }
+
+ return false;
+ }
+
+ private void
+ removeFromPending(ConnectCallback cb, java.util.List<ConnectorInfo> connectors)
+ {
+ for(ConnectorInfo p : connectors)
+ {
+ java.util.Set<ConnectCallback> cbs = _pending.get(p.connector);
+ if(cbs != null)
+ {
+ cbs.remove(cb);
+ }
+ }
+ }
+
+ private void
+ handleConnectionException(LocalException ex, boolean hasMore)
+ {
+ TraceLevels traceLevels = _instance.traceLevels();
+ if(traceLevels.retry >= 2)
+ {
+ StringBuilder s = new StringBuilder(128);
+ s.append("connection to endpoint failed");
+ if(ex instanceof com.zeroc.Ice.CommunicatorDestroyedException)
+ {
+ s.append("\n");
+ }
+ else
+ {
+ if(hasMore)
+ {
+ s.append(", trying next endpoint\n");
+ }
+ else
+ {
+ s.append(" and no more endpoints to try\n");
+ }
+ }
+ s.append(ex.toString());
+ _instance.initializationData().logger.trace(traceLevels.retryCat, s.toString());
+ }
+ }
+
+ private void
+ handleException(LocalException ex, boolean hasMore)
+ {
+ TraceLevels traceLevels = _instance.traceLevels();
+ if(traceLevels.retry >= 2)
+ {
+ StringBuilder s = new StringBuilder(128);
+ s.append("couldn't resolve endpoint host");
+ if(ex instanceof com.zeroc.Ice.CommunicatorDestroyedException)
+ {
+ s.append("\n");
+ }
+ else
+ {
+ if(hasMore)
+ {
+ s.append(", trying next endpoint\n");
+ }
+ else
+ {
+ s.append(" and no more endpoints to try\n");
+ }
+ }
+ s.append(ex.toString());
+ _instance.initializationData().logger.trace(traceLevels.retryCat, s.toString());
+ }
+ }
+
+ private static class ConnectorInfo
+ {
+ public ConnectorInfo(Connector c, EndpointI e)
+ {
+ connector = c;
+ endpoint = e;
+ }
+
+ @Override
+ public boolean
+ equals(Object obj)
+ {
+ ConnectorInfo r = (ConnectorInfo)obj;
+ return connector.equals(r.connector);
+ }
+
+ @Override
+ public int
+ hashCode()
+ {
+ return connector.hashCode();
+ }
+
+ public Connector connector;
+ public EndpointI endpoint;
+ }
+
+ private static class ConnectCallback implements ConnectionI.StartCallback, EndpointI_connectors
+ {
+ ConnectCallback(OutgoingConnectionFactory f, java.util.List<EndpointI> endpoints, boolean more,
+ CreateConnectionCallback cb, com.zeroc.Ice.EndpointSelectionType selType)
+ {
+ _factory = f;
+ _endpoints = endpoints;
+ _hasMore = more;
+ _callback = cb;
+ _selType = selType;
+ _endpointsIter = _endpoints.iterator();
+ }
+
+ //
+ // Methods from ConnectionI.StartCallback
+ //
+ @Override
+ public void
+ connectionStartCompleted(ConnectionI connection)
+ {
+ if(_observer != null)
+ {
+ _observer.detach();
+ }
+ connection.activate();
+ _factory.finishGetConnection(_connectors, _current, connection, this);
+ }
+
+ @Override
+ public void
+ connectionStartFailed(ConnectionI connection, LocalException ex)
+ {
+ assert(_current != null);
+ if(connectionStartFailedImpl(ex))
+ {
+ nextConnector();
+ }
+ }
+
+ //
+ // Methods from EndpointI_connectors
+ //
+ @Override
+ public void
+ connectors(java.util.List<Connector> cons)
+ {
+ for(Connector p : cons)
+ {
+ _connectors.add(new ConnectorInfo(p, _currentEndpoint));
+ }
+
+ if(_endpointsIter.hasNext())
+ {
+ nextEndpoint();
+ }
+ else
+ {
+ assert(!_connectors.isEmpty());
+
+ //
+ // We now have all the connectors for the given endpoints. We can try to obtain the
+ // connection.
+ //
+ _iter = _connectors.iterator();
+ getConnection();
+ }
+ }
+
+ @Override
+ public void
+ exception(LocalException ex)
+ {
+ _factory.handleException(ex, _hasMore || _endpointsIter.hasNext());
+ if(_endpointsIter.hasNext())
+ {
+ nextEndpoint();
+ }
+ else if(!_connectors.isEmpty())
+ {
+ //
+ // We now have all the connectors for the given endpoints. We can try to obtain the
+ // connection.
+ //
+ _iter = _connectors.iterator();
+ getConnection();
+ }
+ else
+ {
+ _callback.setException(ex);
+ _factory.decPendingConnectCount(); // Must be called last.
+ }
+ }
+
+ void
+ setConnection(ConnectionI connection, boolean compress)
+ {
+ //
+ // Callback from the factory: the connection to one of the callback
+ // connectors has been established.
+ //
+ _callback.setConnection(connection, compress);
+ _factory.decPendingConnectCount(); // Must be called last.
+ }
+
+ void
+ setException(LocalException ex)
+ {
+ //
+ // Callback from the factory: connection establishment failed.
+ //
+ _callback.setException(ex);
+ _factory.decPendingConnectCount(); // Must be called last.
+ }
+
+ boolean
+ hasConnector(ConnectorInfo ci)
+ {
+ return _connectors.contains(ci);
+ }
+
+ boolean
+ removeConnectors(java.util.List<ConnectorInfo> connectors)
+ {
+ _connectors.removeAll(connectors);
+ _iter = _connectors.iterator();
+ return _connectors.isEmpty();
+ }
+
+ void
+ removeFromPending()
+ {
+ _factory.removeFromPending(this, _connectors);
+ }
+
+ private void
+ getConnectors()
+ {
+ try
+ {
+ //
+ // Notify the factory that there's an async connect pending. This is necessary
+ // to prevent the outgoing connection factory to be destroyed before all the
+ // pending asynchronous connects are finished.
+ //
+ _factory.incPendingConnectCount();
+ }
+ catch(LocalException ex)
+ {
+ _callback.setException(ex);
+ return;
+ }
+
+ nextEndpoint();
+ }
+
+ private void
+ nextEndpoint()
+ {
+ try
+ {
+ assert(_endpointsIter.hasNext());
+ _currentEndpoint = _endpointsIter.next();
+ _currentEndpoint.connectors_async(_selType, this);
+ }
+ catch(LocalException ex)
+ {
+ exception(ex);
+ }
+ }
+
+ private void
+ getConnection()
+ {
+ try
+ {
+ //
+ // If all the connectors have been created, we ask the factory to get a
+ // connection.
+ //
+ Holder<Boolean> compress = new Holder<>();
+ ConnectionI connection = _factory.getConnection(_connectors, this, compress);
+ if(connection == null)
+ {
+ //
+ // A null return value from getConnection indicates that the connection
+ // is being established and that everything has been done to ensure that
+ // the callback will be notified when the connection establishment is
+ // done.
+ //
+ return;
+ }
+
+ _callback.setConnection(connection, compress.value);
+ _factory.decPendingConnectCount(); // Must be called last.
+ }
+ catch(LocalException ex)
+ {
+ _callback.setException(ex);
+ _factory.decPendingConnectCount(); // Must be called last.
+ }
+ }
+
+ private void
+ nextConnector()
+ {
+ while(true)
+ {
+ try
+ {
+ assert(_iter.hasNext());
+ _current = _iter.next();
+
+ com.zeroc.Ice.Instrumentation.CommunicatorObserver obsv =
+ _factory._instance.initializationData().observer;
+ if(obsv != null)
+ {
+ _observer = obsv.getConnectionEstablishmentObserver(_current.endpoint,
+ _current.connector.toString());
+ if(_observer != null)
+ {
+ _observer.attach();
+ }
+ }
+
+ if(_factory._instance.traceLevels().network >= 2)
+ {
+ StringBuffer s = new StringBuffer("trying to establish ");
+ s.append(_current.endpoint.protocol());
+ s.append(" connection to ");
+ s.append(_current.connector.toString());
+ _factory._instance.initializationData().logger.trace(
+ _factory._instance.traceLevels().networkCat, s.toString());
+ }
+
+ ConnectionI connection =
+ _factory.createConnection(_current.connector.connect(), _current);
+ connection.start(this);
+ }
+ catch(LocalException ex)
+ {
+ if(_factory._instance.traceLevels().network >= 2)
+ {
+ StringBuffer s = new StringBuffer("failed to establish ");
+ s.append(_current.endpoint.protocol());
+ s.append(" connection to ");
+ s.append(_current.connector.toString());
+ s.append("\n");
+ s.append(ex);
+ _factory._instance.initializationData().logger.trace(
+ _factory._instance.traceLevels().networkCat, s.toString());
+ }
+
+ if(connectionStartFailedImpl(ex))
+ {
+ continue;
+ }
+ }
+ break;
+ }
+ }
+
+ private boolean
+ connectionStartFailedImpl(LocalException ex)
+ {
+ if(_observer != null)
+ {
+ _observer.failed(ex.ice_id());
+ _observer.detach();
+ }
+
+ _factory.handleConnectionException(ex, _hasMore || _iter.hasNext());
+ if(ex instanceof com.zeroc.Ice.CommunicatorDestroyedException) // No need to continue.
+ {
+ _factory.finishGetConnection(_connectors, ex, this);
+ }
+ else if(_iter.hasNext()) // Try the next connector.
+ {
+ return true;
+ }
+ else
+ {
+ _factory.finishGetConnection(_connectors, ex, this);
+ }
+ return false;
+ }
+
+ private final OutgoingConnectionFactory _factory;
+ private final boolean _hasMore;
+ private final CreateConnectionCallback _callback;
+ private final java.util.List<EndpointI> _endpoints;
+ private final com.zeroc.Ice.EndpointSelectionType _selType;
+ private java.util.Iterator<EndpointI> _endpointsIter;
+ private EndpointI _currentEndpoint;
+ private java.util.List<ConnectorInfo> _connectors = new java.util.ArrayList<>();
+ private java.util.Iterator<ConnectorInfo> _iter;
+ private ConnectorInfo _current;
+ private com.zeroc.Ice.Instrumentation.Observer _observer;
+ }
+
+ private com.zeroc.Ice.Communicator _communicator;
+ private final Instance _instance;
+ private final FactoryACMMonitor _monitor;
+ private boolean _destroyed;
+
+ private MultiHashMap<Connector, ConnectionI> _connections = new MultiHashMap<>();
+ private MultiHashMap<EndpointI, ConnectionI> _connectionsByEndpoint = new MultiHashMap<>();
+ private java.util.Map<Connector, java.util.HashSet<ConnectCallback> > _pending = new java.util.HashMap<>();
+ private int _pendingConnectCount = 0;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutputStreamWrapper.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutputStreamWrapper.java
new file mode 100644
index 00000000000..7e25830de18
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutputStreamWrapper.java
@@ -0,0 +1,178 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import java.io.*;
+
+//
+// Class to provide a java.io.OutputStream on top of our stream.
+// We use this to serialize arbitrary Java serializable classes into
+//
+// Slice sequences are encoded on the wire as a count of elements, followed
+// by the sequence contents. For arbitrary Java classes, we do not know how
+// big the sequence that is eventually written will be. To avoid excessive
+// data copying, this class mantains a private _bytes array of 254 bytes and,
+// initially, writes data into that array. If more than 254 bytes end up being
+// written, we write a dummy sequence size of 255 (which occupies five bytes
+// on the wire) into the stream and, once this stream is closed, patch
+// that size to match the actual size. Otherwise, if the _bytes buffer contains
+// fewer than 255 bytes when this stream is closed, we write the sequence size
+// as a single byte, followed by the contents of the _bytes buffer.
+//
+
+public class OutputStreamWrapper extends java.io.OutputStream
+{
+ public
+ OutputStreamWrapper(com.zeroc.Ice.OutputStream s)
+ {
+ _s = s;
+ _spos = s.pos();
+ _bytes = new byte[254];
+ _pos = 0;
+ }
+
+ @Override
+ public void
+ write(int b) throws IOException
+ {
+ try
+ {
+ if(_bytes != null)
+ {
+ //
+ // If we can fit the data into the first 254 bytes, write it to _bytes.
+ //
+ if(_pos < _bytes.length)
+ {
+ _bytes[_pos++] = (byte)b;
+ return;
+ }
+
+ _s.writeSize(255); // Dummy size, until we know how big the stream
+ // really is and can patch the size.
+
+ if(_pos > 0)
+ {
+ //
+ // Write the current contents of _bytes.
+ //
+ _s.expand(_pos);
+ _s.getBuffer().b.put(_bytes, 0, _pos);
+ }
+ _bytes = null;
+ }
+
+ //
+ // Write data passed by caller.
+ //
+ _s.expand(1);
+ _s.getBuffer().b.put((byte)b);
+ _pos += 1;
+ }
+ catch(java.lang.Exception ex)
+ {
+ throw new IOException(ex.toString());
+ }
+ }
+
+ @Override
+ public void
+ write(byte[] b) throws IOException
+ {
+ write(b, 0, b.length);
+ }
+
+ @Override
+ public void
+ write(byte[] bytes, int offset, int count) throws IOException
+ {
+ try
+ {
+ if(_bytes != null)
+ {
+ //
+ // If we can fit the data into the first 254 bytes, write it to _bytes.
+ //
+ if(count <= _bytes.length - _pos)
+ {
+ System.arraycopy(bytes, offset, _bytes, _pos, count);
+ _pos += count;
+ return;
+ }
+
+ _s.writeSize(255); // Dummy size, until we know how big the stream
+ // really is and can patch the size.
+
+ if(_pos > 0)
+ {
+ //
+ // Write the current contents of _bytes.
+ //
+ _s.expand(_pos);
+ _s.getBuffer().b.put(_bytes, 0, _pos);
+ }
+ _bytes = null;
+ }
+
+ //
+ // Write data passed by caller.
+ //
+ _s.expand(count);
+ _s.getBuffer().b.put(bytes, offset, count);
+ _pos += count;
+ }
+ catch(java.lang.Exception ex)
+ {
+ throw new IOException(ex.toString());
+ }
+ }
+
+ @Override
+ public void
+ flush() throws IOException
+ {
+ // This does nothing because we do not know the final size of a writable stream until it is closed,
+ // and we cannot write to the stream until we know whether the final size is < 255 or not.
+ }
+
+ @Override
+ public void
+ close() throws IOException
+ {
+ try
+ {
+ if(_bytes != null)
+ {
+ assert(_pos <= _bytes.length);
+ _s.pos(_spos);
+ _s.writeSize(_pos);
+ _s.expand(_pos);
+ _s.getBuffer().b.put(_bytes, 0, _pos);
+ _bytes = null;
+ }
+ else
+ {
+ int currentPos = _s.pos();
+ _s.pos(_spos);
+ _s.writeSize(_pos); // Patch previously-written dummy value.
+ _s.pos(currentPos);
+ }
+ }
+ catch(java.lang.Exception ex)
+ {
+ throw new IOException(ex.toString());
+ }
+ }
+
+ private com.zeroc.Ice.OutputStream _s;
+ private int _spos;
+ private byte[] _bytes;
+ private int _pos;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Patcher.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Patcher.java
new file mode 100644
index 00000000000..43263641dd0
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Patcher.java
@@ -0,0 +1,52 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class Patcher<T> implements com.zeroc.Ice.ReadValueCallback
+{
+ @FunctionalInterface
+ public interface Callback<T>
+ {
+ void valueReady(T v);
+ }
+
+ public Patcher(Class<T> cls, String type)
+ {
+ this(cls, type, null);
+ }
+
+ public Patcher(Class<T> cls, String type, Callback<T> cb)
+ {
+ _cls = cls;
+ _type = type;
+ _cb = cb;
+ }
+
+ public void valueReady(com.zeroc.Ice.Value v)
+ {
+ if(v == null || _cls.isInstance(v))
+ {
+ value = _cls.cast(v);
+ if(_cb != null)
+ {
+ _cb.valueReady(value);
+ }
+ }
+ else
+ {
+ Ex.throwUOE(_type, v);
+ }
+ }
+
+ private Class<T> _cls;
+ private String _type;
+ private Callback<T> _cb;
+ public T value;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProcessI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProcessI.java
new file mode 100644
index 00000000000..d8565158954
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProcessI.java
@@ -0,0 +1,44 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class ProcessI implements com.zeroc.Ice.Process
+{
+ public ProcessI(com.zeroc.Ice.Communicator communicator)
+ {
+ _communicator = communicator;
+ }
+
+ @Override
+ public void shutdown(com.zeroc.Ice.Current current)
+ {
+ _communicator.shutdown();
+ }
+
+ @Override
+ public void writeMessage(String message, int fd, com.zeroc.Ice.Current current)
+ {
+ switch(fd)
+ {
+ case 1:
+ {
+ System.out.println(message);
+ break;
+ }
+ case 2:
+ {
+ System.err.println(message);
+ break;
+ }
+ }
+ }
+
+ private com.zeroc.Ice.Communicator _communicator;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertiesAdminI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertiesAdminI.java
new file mode 100644
index 00000000000..6a08670bc4c
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertiesAdminI.java
@@ -0,0 +1,210 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import com.zeroc.Ice.PropertiesAdminUpdateCallback;
+
+class PropertiesAdminI implements com.zeroc.Ice.PropertiesAdmin, com.zeroc.Ice.NativePropertiesAdmin
+{
+ public PropertiesAdminI(Instance instance)
+ {
+ _properties = instance.initializationData().properties;
+ _logger = instance.initializationData().logger;
+ }
+
+ @Override
+ public synchronized String getProperty(String name, com.zeroc.Ice.Current current)
+ {
+ return _properties.getProperty(name);
+ }
+
+ @Override
+ public synchronized java.util.TreeMap<String, String>
+ getPropertiesForPrefix(String name, com.zeroc.Ice.Current current)
+ {
+ return new java.util.TreeMap<>(_properties.getPropertiesForPrefix(name));
+ }
+
+ @Override
+ synchronized public void setProperties(java.util.Map<String, String> props, com.zeroc.Ice.Current current)
+ {
+ java.util.Map<String, String> old = _properties.getPropertiesForPrefix("");
+ final int traceLevel = _properties.getPropertyAsInt("Ice.Trace.Admin.Properties");
+
+ //
+ // Compute the difference between the new property set and the existing property set:
+ //
+ // 1) Any properties in the new set that were not defined in the existing set.
+ //
+ // 2) Any properties that appear in both sets but with different values.
+ //
+ // 3) Any properties not present in the new set but present in the existing set.
+ // In other words, the property has been removed.
+ //
+ java.util.Map<String, String> added = new java.util.HashMap<>();
+ java.util.Map<String, String> changed = new java.util.HashMap<>();
+ java.util.Map<String, String> removed = new java.util.HashMap<>();
+ for(java.util.Map.Entry<String, String> e : props.entrySet())
+ {
+ final String key = e.getKey();
+ final String value = e.getValue();
+ if(!old.containsKey(key))
+ {
+ if(value.length() > 0)
+ {
+ //
+ // This property is new.
+ //
+ added.put(key, value);
+ }
+ }
+ else
+ {
+ if(!value.equals(old.get(key)))
+ {
+ if(value.length() == 0)
+ {
+ //
+ // This property was removed.
+ //
+ removed.put(key, value);
+ }
+ else
+ {
+ //
+ // This property has changed.
+ //
+ changed.put(key, value);
+ }
+ }
+
+ old.remove(key);
+ }
+ }
+
+ if(traceLevel > 0 && (!added.isEmpty() || !changed.isEmpty() || !removed.isEmpty()))
+ {
+ StringBuilder out = new StringBuilder(128);
+ out.append("Summary of property changes");
+
+ if(!added.isEmpty())
+ {
+ out.append("\nNew properties:");
+ for(java.util.Map.Entry<String, String> e : added.entrySet())
+ {
+ out.append("\n ");
+ out.append(e.getKey());
+ if(traceLevel > 1)
+ {
+ out.append(" = ");
+ out.append(e.getValue());
+ }
+ }
+ }
+
+ if(!changed.isEmpty())
+ {
+ out.append("\nChanged properties:");
+ for(java.util.Map.Entry<String, String> e : changed.entrySet())
+ {
+ out.append("\n ");
+ out.append(e.getKey());
+ if(traceLevel > 1)
+ {
+ out.append(" = ");
+ out.append(e.getValue());
+ out.append(" (old value = ");
+ out.append(_properties.getProperty(e.getKey()));
+ out.append(")");
+ }
+ }
+ }
+
+ if(!removed.isEmpty())
+ {
+ out.append("\nRemoved properties:");
+ for(java.util.Map.Entry<String, String> e : removed.entrySet())
+ {
+ out.append("\n ");
+ out.append(e.getKey());
+ }
+ }
+
+ _logger.trace(_traceCategory, out.toString());
+ }
+
+ //
+ // Update the property set.
+ //
+
+ for(java.util.Map.Entry<String, String> e : added.entrySet())
+ {
+ _properties.setProperty(e.getKey(), e.getValue());
+ }
+
+ for(java.util.Map.Entry<String, String> e : changed.entrySet())
+ {
+ _properties.setProperty(e.getKey(), e.getValue());
+ }
+
+ for(java.util.Map.Entry<String, String> e : removed.entrySet())
+ {
+ _properties.setProperty(e.getKey(), "");
+ }
+
+ if(!_updateCallbacks.isEmpty())
+ {
+ java.util.Map<String, String> changes = new java.util.HashMap<>(added);
+ changes.putAll(changed);
+ changes.putAll(removed);
+
+ //
+ // Copy the callbacks to allow callbacks to update the callbacks.
+ //
+ for(PropertiesAdminUpdateCallback callback : new java.util.ArrayList<>(_updateCallbacks))
+ {
+ try
+ {
+ callback.updated(changes);
+ }
+ catch(RuntimeException ex)
+ {
+ if(_properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1)
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ ex.printStackTrace(pw);
+ pw.flush();
+ _logger.warning("properties admin update callback raised unexpected exception:\n" +
+ sw.toString());
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public synchronized void addUpdateCallback(PropertiesAdminUpdateCallback cb)
+ {
+ _updateCallbacks.add(cb);
+ }
+
+ @Override
+ public synchronized void removeUpdateCallback(PropertiesAdminUpdateCallback cb)
+ {
+ _updateCallbacks.remove(cb);
+ }
+
+ private final com.zeroc.Ice.Properties _properties;
+ private final com.zeroc.Ice.Logger _logger;
+ private java.util.List<PropertiesAdminUpdateCallback> _updateCallbacks = new java.util.ArrayList<>();
+
+ static private final String _traceCategory = "Admin.Properties";
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Property.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Property.java
new file mode 100644
index 00000000000..8f1555c5831
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Property.java
@@ -0,0 +1,42 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class Property
+{
+ public Property(String pattern, boolean deprecated, String deprecatedBy)
+ {
+ _pattern = pattern;
+ _deprecated = deprecated;
+ _deprecatedBy = deprecatedBy;
+ }
+
+ public String
+ pattern()
+ {
+ return _pattern;
+ }
+
+ public boolean
+ deprecated()
+ {
+ return _deprecated;
+ }
+
+ public String
+ deprecatedBy()
+ {
+ return _deprecatedBy;
+ }
+
+ private String _pattern;
+ private boolean _deprecated;
+ private String _deprecatedBy;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java
new file mode 100644
index 00000000000..45647f08494
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java
@@ -0,0 +1,1254 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+// Generated by makeprops.py from file ..\config\PropertyNames.xml, Fri Jul 15 14:02:34 2016
+
+// IMPORTANT: Do not edit this file -- any edits made here will be lost!
+
+package com.zeroc.IceInternal;
+
+public final class PropertyNames
+{
+ public static final Property IceProps[] =
+ {
+ new Property("Ice\\.ACM\\.Client", true, null),
+ new Property("Ice\\.ACM\\.Server", true, null),
+ new Property("Ice\\.ACM\\.Timeout", false, null),
+ new Property("Ice\\.ACM\\.Heartbeat", false, null),
+ new Property("Ice\\.ACM\\.Close", false, null),
+ new Property("Ice\\.ACM", false, null),
+ new Property("Ice\\.ACM\\.Client\\.Timeout", false, null),
+ new Property("Ice\\.ACM\\.Client\\.Heartbeat", false, null),
+ new Property("Ice\\.ACM\\.Client\\.Close", false, null),
+ new Property("Ice\\.ACM\\.Client", false, null),
+ new Property("Ice\\.ACM\\.Server\\.Timeout", false, null),
+ new Property("Ice\\.ACM\\.Server\\.Heartbeat", false, null),
+ new Property("Ice\\.ACM\\.Server\\.Close", false, null),
+ new Property("Ice\\.ACM\\.Server", false, null),
+ new Property("Ice\\.Admin\\.ACM\\.Timeout", false, null),
+ new Property("Ice\\.Admin\\.ACM\\.Heartbeat", false, null),
+ new Property("Ice\\.Admin\\.ACM\\.Close", false, null),
+ new Property("Ice\\.Admin\\.ACM", false, null),
+ new Property("Ice\\.Admin\\.AdapterId", false, null),
+ new Property("Ice\\.Admin\\.Endpoints", false, null),
+ new Property("Ice\\.Admin\\.Locator\\.EndpointSelection", false, null),
+ new Property("Ice\\.Admin\\.Locator\\.ConnectionCached", false, null),
+ new Property("Ice\\.Admin\\.Locator\\.PreferSecure", false, null),
+ new Property("Ice\\.Admin\\.Locator\\.LocatorCacheTimeout", false, null),
+ new Property("Ice\\.Admin\\.Locator\\.InvocationTimeout", false, null),
+ new Property("Ice\\.Admin\\.Locator\\.Locator", false, null),
+ new Property("Ice\\.Admin\\.Locator\\.Router", false, null),
+ new Property("Ice\\.Admin\\.Locator\\.CollocationOptimized", false, null),
+ new Property("Ice\\.Admin\\.Locator\\.Context\\.[^\\s]+", false, null),
+ new Property("Ice\\.Admin\\.Locator", false, null),
+ new Property("Ice\\.Admin\\.PublishedEndpoints", false, null),
+ new Property("Ice\\.Admin\\.ReplicaGroupId", false, null),
+ new Property("Ice\\.Admin\\.Router\\.EndpointSelection", false, null),
+ new Property("Ice\\.Admin\\.Router\\.ConnectionCached", false, null),
+ new Property("Ice\\.Admin\\.Router\\.PreferSecure", false, null),
+ new Property("Ice\\.Admin\\.Router\\.LocatorCacheTimeout", false, null),
+ new Property("Ice\\.Admin\\.Router\\.InvocationTimeout", false, null),
+ new Property("Ice\\.Admin\\.Router\\.Locator", false, null),
+ new Property("Ice\\.Admin\\.Router\\.Router", false, null),
+ new Property("Ice\\.Admin\\.Router\\.CollocationOptimized", false, null),
+ new Property("Ice\\.Admin\\.Router\\.Context\\.[^\\s]+", false, null),
+ new Property("Ice\\.Admin\\.Router", false, null),
+ new Property("Ice\\.Admin\\.ProxyOptions", false, null),
+ new Property("Ice\\.Admin\\.ThreadPool\\.Size", false, null),
+ new Property("Ice\\.Admin\\.ThreadPool\\.SizeMax", false, null),
+ new Property("Ice\\.Admin\\.ThreadPool\\.SizeWarn", false, null),
+ new Property("Ice\\.Admin\\.ThreadPool\\.StackSize", false, null),
+ new Property("Ice\\.Admin\\.ThreadPool\\.Serialize", false, null),
+ new Property("Ice\\.Admin\\.ThreadPool\\.ThreadIdleTime", false, null),
+ new Property("Ice\\.Admin\\.ThreadPool\\.ThreadPriority", false, null),
+ new Property("Ice\\.Admin\\.MessageSizeMax", false, null),
+ new Property("Ice\\.Admin\\.DelayCreation", false, null),
+ new Property("Ice\\.Admin\\.Enabled", false, null),
+ new Property("Ice\\.Admin\\.Facets", false, null),
+ new Property("Ice\\.Admin\\.InstanceName", false, null),
+ new Property("Ice\\.Admin\\.Logger\\.KeepLogs", false, null),
+ new Property("Ice\\.Admin\\.Logger\\.KeepTraces", false, null),
+ new Property("Ice\\.Admin\\.Logger\\.Properties", false, null),
+ new Property("Ice\\.Admin\\.ServerId", false, null),
+ new Property("Ice\\.BackgroundLocatorCacheUpdates", false, null),
+ new Property("Ice\\.BatchAutoFlush", true, null),
+ new Property("Ice\\.BatchAutoFlushSize", false, null),
+ new Property("Ice\\.ChangeUser", false, null),
+ new Property("Ice\\.ClientAccessPolicyProtocol", false, null),
+ new Property("Ice\\.Compression\\.Level", false, null),
+ new Property("Ice\\.CollectObjects", false, null),
+ new Property("Ice\\.Config", false, null),
+ new Property("Ice\\.ConsoleListener", false, null),
+ new Property("Ice\\.Default\\.CollocationOptimized", false, null),
+ new Property("Ice\\.Default\\.EncodingVersion", false, null),
+ new Property("Ice\\.Default\\.EndpointSelection", false, null),
+ new Property("Ice\\.Default\\.Host", false, null),
+ new Property("Ice\\.Default\\.Locator\\.EndpointSelection", false, null),
+ new Property("Ice\\.Default\\.Locator\\.ConnectionCached", false, null),
+ new Property("Ice\\.Default\\.Locator\\.PreferSecure", false, null),
+ new Property("Ice\\.Default\\.Locator\\.LocatorCacheTimeout", false, null),
+ new Property("Ice\\.Default\\.Locator\\.InvocationTimeout", false, null),
+ new Property("Ice\\.Default\\.Locator\\.Locator", false, null),
+ new Property("Ice\\.Default\\.Locator\\.Router", false, null),
+ new Property("Ice\\.Default\\.Locator\\.CollocationOptimized", false, null),
+ new Property("Ice\\.Default\\.Locator\\.Context\\.[^\\s]+", false, null),
+ new Property("Ice\\.Default\\.Locator", false, null),
+ new Property("Ice\\.Default\\.LocatorCacheTimeout", false, null),
+ new Property("Ice\\.Default\\.InvocationTimeout", false, null),
+ new Property("Ice\\.Default\\.Package", false, null),
+ new Property("Ice\\.Default\\.PreferSecure", false, null),
+ new Property("Ice\\.Default\\.Protocol", false, null),
+ new Property("Ice\\.Default\\.Router\\.EndpointSelection", false, null),
+ new Property("Ice\\.Default\\.Router\\.ConnectionCached", false, null),
+ new Property("Ice\\.Default\\.Router\\.PreferSecure", false, null),
+ new Property("Ice\\.Default\\.Router\\.LocatorCacheTimeout", false, null),
+ new Property("Ice\\.Default\\.Router\\.InvocationTimeout", false, null),
+ new Property("Ice\\.Default\\.Router\\.Locator", false, null),
+ new Property("Ice\\.Default\\.Router\\.Router", false, null),
+ new Property("Ice\\.Default\\.Router\\.CollocationOptimized", false, null),
+ new Property("Ice\\.Default\\.Router\\.Context\\.[^\\s]+", false, null),
+ new Property("Ice\\.Default\\.Router", false, null),
+ new Property("Ice\\.Default\\.SlicedFormat", false, null),
+ new Property("Ice\\.Default\\.SourceAddress", false, null),
+ new Property("Ice\\.Default\\.Timeout", false, null),
+ new Property("Ice\\.EventLog\\.Source", false, null),
+ new Property("Ice\\.FactoryAssemblies", false, null),
+ new Property("Ice\\.HTTPProxyHost", false, null),
+ new Property("Ice\\.HTTPProxyPort", false, null),
+ new Property("Ice\\.ImplicitContext", false, null),
+ new Property("Ice\\.InitPlugins", false, null),
+ new Property("Ice\\.IPv4", false, null),
+ new Property("Ice\\.IPv6", false, null),
+ new Property("Ice\\.LogFile", false, null),
+ new Property("Ice\\.LogFile\\.SizeMax", false, null),
+ new Property("Ice\\.LogStdErr\\.Convert", false, null),
+ new Property("Ice\\.MessageSizeMax", false, null),
+ new Property("Ice\\.Nohup", false, null),
+ new Property("Ice\\.NullHandleAbort", false, null),
+ new Property("Ice\\.Override\\.CloseTimeout", false, null),
+ new Property("Ice\\.Override\\.Compress", false, null),
+ new Property("Ice\\.Override\\.ConnectTimeout", false, null),
+ new Property("Ice\\.Override\\.Timeout", false, null),
+ new Property("Ice\\.Override\\.Secure", false, null),
+ new Property("Ice\\.Package\\.[^\\s]+", false, null),
+ new Property("Ice\\.Plugin\\.[^\\s]+", false, null),
+ new Property("Ice\\.PluginLoadOrder", false, null),
+ new Property("Ice\\.PreferIPv6Address", false, null),
+ new Property("Ice\\.PrintAdapterReady", false, null),
+ new Property("Ice\\.PrintProcessId", false, null),
+ new Property("Ice\\.PrintStackTraces", false, null),
+ new Property("Ice\\.ProgramName", false, null),
+ new Property("Ice\\.RetryIntervals", false, null),
+ new Property("Ice\\.ServerIdleTime", false, null),
+ new Property("Ice\\.SOCKSProxyHost", false, null),
+ new Property("Ice\\.SOCKSProxyPort", false, null),
+ new Property("Ice\\.StdErr", false, null),
+ new Property("Ice\\.StdOut", false, null),
+ new Property("Ice\\.SyslogFacility", false, null),
+ new Property("Ice\\.ThreadPool\\.Client\\.Size", false, null),
+ new Property("Ice\\.ThreadPool\\.Client\\.SizeMax", false, null),
+ new Property("Ice\\.ThreadPool\\.Client\\.SizeWarn", false, null),
+ new Property("Ice\\.ThreadPool\\.Client\\.StackSize", false, null),
+ new Property("Ice\\.ThreadPool\\.Client\\.Serialize", false, null),
+ new Property("Ice\\.ThreadPool\\.Client\\.ThreadIdleTime", false, null),
+ new Property("Ice\\.ThreadPool\\.Client\\.ThreadPriority", false, null),
+ new Property("Ice\\.ThreadPool\\.Server\\.Size", false, null),
+ new Property("Ice\\.ThreadPool\\.Server\\.SizeMax", false, null),
+ new Property("Ice\\.ThreadPool\\.Server\\.SizeWarn", false, null),
+ new Property("Ice\\.ThreadPool\\.Server\\.StackSize", false, null),
+ new Property("Ice\\.ThreadPool\\.Server\\.Serialize", false, null),
+ new Property("Ice\\.ThreadPool\\.Server\\.ThreadIdleTime", false, null),
+ new Property("Ice\\.ThreadPool\\.Server\\.ThreadPriority", false, null),
+ new Property("Ice\\.ThreadPriority", false, null),
+ new Property("Ice\\.Trace\\.Admin\\.Properties", false, null),
+ new Property("Ice\\.Trace\\.Admin\\.Logger", false, null),
+ new Property("Ice\\.Trace\\.Locator", false, null),
+ new Property("Ice\\.Trace\\.Network", false, null),
+ new Property("Ice\\.Trace\\.Protocol", false, null),
+ new Property("Ice\\.Trace\\.Retry", false, null),
+ new Property("Ice\\.Trace\\.Slicing", false, null),
+ new Property("Ice\\.Trace\\.ThreadPool", false, null),
+ new Property("Ice\\.UDP\\.RcvSize", false, null),
+ new Property("Ice\\.UDP\\.SndSize", false, null),
+ new Property("Ice\\.TCP\\.Backlog", false, null),
+ new Property("Ice\\.TCP\\.RcvSize", false, null),
+ new Property("Ice\\.TCP\\.SndSize", false, null),
+ new Property("Ice\\.UseApplicationClassLoader", false, null),
+ new Property("Ice\\.UseSyslog", false, null),
+ new Property("Ice\\.Warn\\.AMICallback", false, null),
+ new Property("Ice\\.Warn\\.Connections", false, null),
+ new Property("Ice\\.Warn\\.Datagrams", false, null),
+ new Property("Ice\\.Warn\\.Dispatch", false, null),
+ new Property("Ice\\.Warn\\.Endpoints", false, null),
+ new Property("Ice\\.Warn\\.UnknownProperties", false, null),
+ new Property("Ice\\.Warn\\.UnusedProperties", false, null),
+ new Property("Ice\\.CacheMessageBuffers", false, null),
+ new Property("Ice\\.ThreadInterruptSafe", false, null),
+ new Property("Ice\\.Voip", false, null),
+ null
+ };
+
+ public static final Property IceMXProps[] =
+ {
+ new Property("IceMX\\.Metrics\\.[^\\s]+\\.GroupBy", false, null),
+ new Property("IceMX\\.Metrics\\.[^\\s]+\\.Map", false, null),
+ new Property("IceMX\\.Metrics\\.[^\\s]+\\.RetainDetached", false, null),
+ new Property("IceMX\\.Metrics\\.[^\\s]+\\.Accept", false, null),
+ new Property("IceMX\\.Metrics\\.[^\\s]+\\.Reject", false, null),
+ new Property("IceMX\\.Metrics\\.[^\\s]+", false, null),
+ null
+ };
+
+ public static final Property IceDiscoveryProps[] =
+ {
+ new Property("IceDiscovery\\.Multicast\\.ACM\\.Timeout", false, null),
+ new Property("IceDiscovery\\.Multicast\\.ACM\\.Heartbeat", false, null),
+ new Property("IceDiscovery\\.Multicast\\.ACM\\.Close", false, null),
+ new Property("IceDiscovery\\.Multicast\\.ACM", false, null),
+ new Property("IceDiscovery\\.Multicast\\.AdapterId", false, null),
+ new Property("IceDiscovery\\.Multicast\\.Endpoints", false, null),
+ new Property("IceDiscovery\\.Multicast\\.Locator\\.EndpointSelection", false, null),
+ new Property("IceDiscovery\\.Multicast\\.Locator\\.ConnectionCached", false, null),
+ new Property("IceDiscovery\\.Multicast\\.Locator\\.PreferSecure", false, null),
+ new Property("IceDiscovery\\.Multicast\\.Locator\\.LocatorCacheTimeout", false, null),
+ new Property("IceDiscovery\\.Multicast\\.Locator\\.InvocationTimeout", false, null),
+ new Property("IceDiscovery\\.Multicast\\.Locator\\.Locator", false, null),
+ new Property("IceDiscovery\\.Multicast\\.Locator\\.Router", false, null),
+ new Property("IceDiscovery\\.Multicast\\.Locator\\.CollocationOptimized", false, null),
+ new Property("IceDiscovery\\.Multicast\\.Locator\\.Context\\.[^\\s]+", false, null),
+ new Property("IceDiscovery\\.Multicast\\.Locator", false, null),
+ new Property("IceDiscovery\\.Multicast\\.PublishedEndpoints", false, null),
+ new Property("IceDiscovery\\.Multicast\\.ReplicaGroupId", false, null),
+ new Property("IceDiscovery\\.Multicast\\.Router\\.EndpointSelection", false, null),
+ new Property("IceDiscovery\\.Multicast\\.Router\\.ConnectionCached", false, null),
+ new Property("IceDiscovery\\.Multicast\\.Router\\.PreferSecure", false, null),
+ new Property("IceDiscovery\\.Multicast\\.Router\\.LocatorCacheTimeout", false, null),
+ new Property("IceDiscovery\\.Multicast\\.Router\\.InvocationTimeout", false, null),
+ new Property("IceDiscovery\\.Multicast\\.Router\\.Locator", false, null),
+ new Property("IceDiscovery\\.Multicast\\.Router\\.Router", false, null),
+ new Property("IceDiscovery\\.Multicast\\.Router\\.CollocationOptimized", false, null),
+ new Property("IceDiscovery\\.Multicast\\.Router\\.Context\\.[^\\s]+", false, null),
+ new Property("IceDiscovery\\.Multicast\\.Router", false, null),
+ new Property("IceDiscovery\\.Multicast\\.ProxyOptions", false, null),
+ new Property("IceDiscovery\\.Multicast\\.ThreadPool\\.Size", false, null),
+ new Property("IceDiscovery\\.Multicast\\.ThreadPool\\.SizeMax", false, null),
+ new Property("IceDiscovery\\.Multicast\\.ThreadPool\\.SizeWarn", false, null),
+ new Property("IceDiscovery\\.Multicast\\.ThreadPool\\.StackSize", false, null),
+ new Property("IceDiscovery\\.Multicast\\.ThreadPool\\.Serialize", false, null),
+ new Property("IceDiscovery\\.Multicast\\.ThreadPool\\.ThreadIdleTime", false, null),
+ new Property("IceDiscovery\\.Multicast\\.ThreadPool\\.ThreadPriority", false, null),
+ new Property("IceDiscovery\\.Multicast\\.MessageSizeMax", false, null),
+ new Property("IceDiscovery\\.Reply\\.ACM\\.Timeout", false, null),
+ new Property("IceDiscovery\\.Reply\\.ACM\\.Heartbeat", false, null),
+ new Property("IceDiscovery\\.Reply\\.ACM\\.Close", false, null),
+ new Property("IceDiscovery\\.Reply\\.ACM", false, null),
+ new Property("IceDiscovery\\.Reply\\.AdapterId", false, null),
+ new Property("IceDiscovery\\.Reply\\.Endpoints", false, null),
+ new Property("IceDiscovery\\.Reply\\.Locator\\.EndpointSelection", false, null),
+ new Property("IceDiscovery\\.Reply\\.Locator\\.ConnectionCached", false, null),
+ new Property("IceDiscovery\\.Reply\\.Locator\\.PreferSecure", false, null),
+ new Property("IceDiscovery\\.Reply\\.Locator\\.LocatorCacheTimeout", false, null),
+ new Property("IceDiscovery\\.Reply\\.Locator\\.InvocationTimeout", false, null),
+ new Property("IceDiscovery\\.Reply\\.Locator\\.Locator", false, null),
+ new Property("IceDiscovery\\.Reply\\.Locator\\.Router", false, null),
+ new Property("IceDiscovery\\.Reply\\.Locator\\.CollocationOptimized", false, null),
+ new Property("IceDiscovery\\.Reply\\.Locator\\.Context\\.[^\\s]+", false, null),
+ new Property("IceDiscovery\\.Reply\\.Locator", false, null),
+ new Property("IceDiscovery\\.Reply\\.PublishedEndpoints", false, null),
+ new Property("IceDiscovery\\.Reply\\.ReplicaGroupId", false, null),
+ new Property("IceDiscovery\\.Reply\\.Router\\.EndpointSelection", false, null),
+ new Property("IceDiscovery\\.Reply\\.Router\\.ConnectionCached", false, null),
+ new Property("IceDiscovery\\.Reply\\.Router\\.PreferSecure", false, null),
+ new Property("IceDiscovery\\.Reply\\.Router\\.LocatorCacheTimeout", false, null),
+ new Property("IceDiscovery\\.Reply\\.Router\\.InvocationTimeout", false, null),
+ new Property("IceDiscovery\\.Reply\\.Router\\.Locator", false, null),
+ new Property("IceDiscovery\\.Reply\\.Router\\.Router", false, null),
+ new Property("IceDiscovery\\.Reply\\.Router\\.CollocationOptimized", false, null),
+ new Property("IceDiscovery\\.Reply\\.Router\\.Context\\.[^\\s]+", false, null),
+ new Property("IceDiscovery\\.Reply\\.Router", false, null),
+ new Property("IceDiscovery\\.Reply\\.ProxyOptions", false, null),
+ new Property("IceDiscovery\\.Reply\\.ThreadPool\\.Size", false, null),
+ new Property("IceDiscovery\\.Reply\\.ThreadPool\\.SizeMax", false, null),
+ new Property("IceDiscovery\\.Reply\\.ThreadPool\\.SizeWarn", false, null),
+ new Property("IceDiscovery\\.Reply\\.ThreadPool\\.StackSize", false, null),
+ new Property("IceDiscovery\\.Reply\\.ThreadPool\\.Serialize", false, null),
+ new Property("IceDiscovery\\.Reply\\.ThreadPool\\.ThreadIdleTime", false, null),
+ new Property("IceDiscovery\\.Reply\\.ThreadPool\\.ThreadPriority", false, null),
+ new Property("IceDiscovery\\.Reply\\.MessageSizeMax", false, null),
+ new Property("IceDiscovery\\.Locator\\.ACM\\.Timeout", false, null),
+ new Property("IceDiscovery\\.Locator\\.ACM\\.Heartbeat", false, null),
+ new Property("IceDiscovery\\.Locator\\.ACM\\.Close", false, null),
+ new Property("IceDiscovery\\.Locator\\.ACM", false, null),
+ new Property("IceDiscovery\\.Locator\\.AdapterId", false, null),
+ new Property("IceDiscovery\\.Locator\\.Endpoints", false, null),
+ new Property("IceDiscovery\\.Locator\\.Locator\\.EndpointSelection", false, null),
+ new Property("IceDiscovery\\.Locator\\.Locator\\.ConnectionCached", false, null),
+ new Property("IceDiscovery\\.Locator\\.Locator\\.PreferSecure", false, null),
+ new Property("IceDiscovery\\.Locator\\.Locator\\.LocatorCacheTimeout", false, null),
+ new Property("IceDiscovery\\.Locator\\.Locator\\.InvocationTimeout", false, null),
+ new Property("IceDiscovery\\.Locator\\.Locator\\.Locator", false, null),
+ new Property("IceDiscovery\\.Locator\\.Locator\\.Router", false, null),
+ new Property("IceDiscovery\\.Locator\\.Locator\\.CollocationOptimized", false, null),
+ new Property("IceDiscovery\\.Locator\\.Locator\\.Context\\.[^\\s]+", false, null),
+ new Property("IceDiscovery\\.Locator\\.Locator", false, null),
+ new Property("IceDiscovery\\.Locator\\.PublishedEndpoints", false, null),
+ new Property("IceDiscovery\\.Locator\\.ReplicaGroupId", false, null),
+ new Property("IceDiscovery\\.Locator\\.Router\\.EndpointSelection", false, null),
+ new Property("IceDiscovery\\.Locator\\.Router\\.ConnectionCached", false, null),
+ new Property("IceDiscovery\\.Locator\\.Router\\.PreferSecure", false, null),
+ new Property("IceDiscovery\\.Locator\\.Router\\.LocatorCacheTimeout", false, null),
+ new Property("IceDiscovery\\.Locator\\.Router\\.InvocationTimeout", false, null),
+ new Property("IceDiscovery\\.Locator\\.Router\\.Locator", false, null),
+ new Property("IceDiscovery\\.Locator\\.Router\\.Router", false, null),
+ new Property("IceDiscovery\\.Locator\\.Router\\.CollocationOptimized", false, null),
+ new Property("IceDiscovery\\.Locator\\.Router\\.Context\\.[^\\s]+", false, null),
+ new Property("IceDiscovery\\.Locator\\.Router", false, null),
+ new Property("IceDiscovery\\.Locator\\.ProxyOptions", false, null),
+ new Property("IceDiscovery\\.Locator\\.ThreadPool\\.Size", false, null),
+ new Property("IceDiscovery\\.Locator\\.ThreadPool\\.SizeMax", false, null),
+ new Property("IceDiscovery\\.Locator\\.ThreadPool\\.SizeWarn", false, null),
+ new Property("IceDiscovery\\.Locator\\.ThreadPool\\.StackSize", false, null),
+ new Property("IceDiscovery\\.Locator\\.ThreadPool\\.Serialize", false, null),
+ new Property("IceDiscovery\\.Locator\\.ThreadPool\\.ThreadIdleTime", false, null),
+ new Property("IceDiscovery\\.Locator\\.ThreadPool\\.ThreadPriority", false, null),
+ new Property("IceDiscovery\\.Locator\\.MessageSizeMax", false, null),
+ new Property("IceDiscovery\\.Lookup", false, null),
+ new Property("IceDiscovery\\.Timeout", false, null),
+ new Property("IceDiscovery\\.RetryCount", false, null),
+ new Property("IceDiscovery\\.LatencyMultiplier", false, null),
+ new Property("IceDiscovery\\.Address", false, null),
+ new Property("IceDiscovery\\.Port", false, null),
+ new Property("IceDiscovery\\.Interface", false, null),
+ new Property("IceDiscovery\\.DomainId", false, null),
+ null
+ };
+
+ public static final Property IceGridDiscoveryProps[] =
+ {
+ new Property("IceGridDiscovery\\.Reply\\.ACM\\.Timeout", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.ACM\\.Heartbeat", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.ACM\\.Close", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.ACM", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.AdapterId", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.Endpoints", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.Locator\\.EndpointSelection", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.Locator\\.ConnectionCached", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.Locator\\.PreferSecure", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.Locator\\.LocatorCacheTimeout", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.Locator\\.InvocationTimeout", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.Locator\\.Locator", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.Locator\\.Router", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.Locator\\.CollocationOptimized", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.Locator\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.Locator", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.PublishedEndpoints", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.ReplicaGroupId", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.Router\\.EndpointSelection", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.Router\\.ConnectionCached", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.Router\\.PreferSecure", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.Router\\.LocatorCacheTimeout", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.Router\\.InvocationTimeout", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.Router\\.Locator", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.Router\\.Router", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.Router\\.CollocationOptimized", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.Router\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.Router", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.ProxyOptions", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.ThreadPool\\.Size", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.ThreadPool\\.SizeMax", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.ThreadPool\\.SizeWarn", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.ThreadPool\\.StackSize", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.ThreadPool\\.Serialize", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.ThreadPool\\.ThreadIdleTime", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.ThreadPool\\.ThreadPriority", false, null),
+ new Property("IceGridDiscovery\\.Reply\\.MessageSizeMax", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.ACM\\.Timeout", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.ACM\\.Heartbeat", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.ACM\\.Close", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.ACM", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.AdapterId", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.Endpoints", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.Locator\\.EndpointSelection", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.Locator\\.ConnectionCached", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.Locator\\.PreferSecure", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.Locator\\.LocatorCacheTimeout", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.Locator\\.InvocationTimeout", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.Locator\\.Locator", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.Locator\\.Router", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.Locator\\.CollocationOptimized", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.Locator\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.Locator", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.PublishedEndpoints", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.ReplicaGroupId", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.Router\\.EndpointSelection", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.Router\\.ConnectionCached", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.Router\\.PreferSecure", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.Router\\.LocatorCacheTimeout", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.Router\\.InvocationTimeout", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.Router\\.Locator", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.Router\\.Router", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.Router\\.CollocationOptimized", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.Router\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.Router", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.ProxyOptions", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.ThreadPool\\.Size", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.ThreadPool\\.SizeMax", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.ThreadPool\\.SizeWarn", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.ThreadPool\\.StackSize", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.ThreadPool\\.Serialize", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.ThreadPool\\.ThreadIdleTime", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.ThreadPool\\.ThreadPriority", false, null),
+ new Property("IceGridDiscovery\\.Locator\\.MessageSizeMax", false, null),
+ new Property("IceGridDiscovery\\.Lookup", false, null),
+ new Property("IceGridDiscovery\\.Timeout", false, null),
+ new Property("IceGridDiscovery\\.RetryCount", false, null),
+ new Property("IceGridDiscovery\\.RetryDelay", false, null),
+ new Property("IceGridDiscovery\\.Address", false, null),
+ new Property("IceGridDiscovery\\.Port", false, null),
+ new Property("IceGridDiscovery\\.Interface", false, null),
+ new Property("IceGridDiscovery\\.InstanceName", false, null),
+ null
+ };
+
+ public static final Property IceBoxProps[] =
+ {
+ new Property("IceBox\\.InheritProperties", false, null),
+ new Property("IceBox\\.InstanceName", true, null),
+ new Property("IceBox\\.LoadOrder", false, null),
+ new Property("IceBox\\.PrintServicesReady", false, null),
+ new Property("IceBox\\.Service\\.[^\\s]+", false, null),
+ new Property("IceBox\\.ServiceManager\\.AdapterId", true, null),
+ new Property("IceBox\\.ServiceManager\\.Endpoints", true, null),
+ new Property("IceBox\\.ServiceManager\\.Locator", true, null),
+ new Property("IceBox\\.ServiceManager\\.PublishedEndpoints", true, null),
+ new Property("IceBox\\.ServiceManager\\.ReplicaGroupId", true, null),
+ new Property("IceBox\\.ServiceManager\\.Router", true, null),
+ new Property("IceBox\\.ServiceManager\\.ThreadPool\\.Size", true, null),
+ new Property("IceBox\\.ServiceManager\\.ThreadPool\\.SizeMax", true, null),
+ new Property("IceBox\\.ServiceManager\\.ThreadPool\\.SizeWarn", true, null),
+ new Property("IceBox\\.ServiceManager\\.ThreadPool\\.StackSize", true, null),
+ new Property("IceBox\\.Trace\\.ServiceObserver", false, null),
+ new Property("IceBox\\.UseSharedCommunicator\\.[^\\s]+", false, null),
+ null
+ };
+
+ public static final Property IceBoxAdminProps[] =
+ {
+ new Property("IceBoxAdmin\\.ServiceManager\\.Proxy\\.EndpointSelection", false, null),
+ new Property("IceBoxAdmin\\.ServiceManager\\.Proxy\\.ConnectionCached", false, null),
+ new Property("IceBoxAdmin\\.ServiceManager\\.Proxy\\.PreferSecure", false, null),
+ new Property("IceBoxAdmin\\.ServiceManager\\.Proxy\\.LocatorCacheTimeout", false, null),
+ new Property("IceBoxAdmin\\.ServiceManager\\.Proxy\\.InvocationTimeout", false, null),
+ new Property("IceBoxAdmin\\.ServiceManager\\.Proxy\\.Locator", false, null),
+ new Property("IceBoxAdmin\\.ServiceManager\\.Proxy\\.Router", false, null),
+ new Property("IceBoxAdmin\\.ServiceManager\\.Proxy\\.CollocationOptimized", false, null),
+ new Property("IceBoxAdmin\\.ServiceManager\\.Proxy\\.Context\\.[^\\s]+", false, null),
+ new Property("IceBoxAdmin\\.ServiceManager\\.Proxy", false, null),
+ null
+ };
+
+ public static final Property IceGridAdminProps[] =
+ {
+ new Property("IceGridAdmin\\.AuthenticateUsingSSL", false, null),
+ new Property("IceGridAdmin\\.MetricsConfig", false, null),
+ new Property("IceGridAdmin\\.Username", false, null),
+ new Property("IceGridAdmin\\.Password", false, null),
+ new Property("IceGridAdmin\\.Replica", false, null),
+ new Property("IceGridAdmin\\.Host", false, null),
+ new Property("IceGridAdmin\\.Port", false, null),
+ new Property("IceGridAdmin\\.InstanceName", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Address", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Interface", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Lookup", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.ACM\\.Timeout", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.ACM\\.Heartbeat", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.ACM\\.Close", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.ACM", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.AdapterId", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.Endpoints", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.Locator\\.EndpointSelection", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.Locator\\.ConnectionCached", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.Locator\\.PreferSecure", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.Locator\\.LocatorCacheTimeout", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.Locator\\.InvocationTimeout", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.Locator\\.Locator", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.Locator\\.Router", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.Locator\\.CollocationOptimized", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.Locator\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.Locator", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.PublishedEndpoints", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.ReplicaGroupId", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.Router\\.EndpointSelection", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.Router\\.ConnectionCached", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.Router\\.PreferSecure", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.Router\\.LocatorCacheTimeout", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.Router\\.InvocationTimeout", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.Router\\.Locator", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.Router\\.Router", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.Router\\.CollocationOptimized", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.Router\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.Router", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.ProxyOptions", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.ThreadPool\\.Size", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.ThreadPool\\.SizeMax", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.ThreadPool\\.SizeWarn", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.ThreadPool\\.StackSize", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.ThreadPool\\.Serialize", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.ThreadPool\\.ThreadIdleTime", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.ThreadPool\\.ThreadPriority", false, null),
+ new Property("IceGridAdmin\\.Discovery\\.Reply\\.MessageSizeMax", false, null),
+ new Property("IceGridAdmin\\.Trace\\.Observers", false, null),
+ new Property("IceGridAdmin\\.Trace\\.SaveToRegistry", false, null),
+ null
+ };
+
+ public static final Property IceGridProps[] =
+ {
+ new Property("IceGrid\\.AdminRouter\\.ACM\\.Timeout", false, null),
+ new Property("IceGrid\\.AdminRouter\\.ACM\\.Heartbeat", false, null),
+ new Property("IceGrid\\.AdminRouter\\.ACM\\.Close", false, null),
+ new Property("IceGrid\\.AdminRouter\\.ACM", false, null),
+ new Property("IceGrid\\.AdminRouter\\.AdapterId", false, null),
+ new Property("IceGrid\\.AdminRouter\\.Endpoints", false, null),
+ new Property("IceGrid\\.AdminRouter\\.Locator\\.EndpointSelection", false, null),
+ new Property("IceGrid\\.AdminRouter\\.Locator\\.ConnectionCached", false, null),
+ new Property("IceGrid\\.AdminRouter\\.Locator\\.PreferSecure", false, null),
+ new Property("IceGrid\\.AdminRouter\\.Locator\\.LocatorCacheTimeout", false, null),
+ new Property("IceGrid\\.AdminRouter\\.Locator\\.InvocationTimeout", false, null),
+ new Property("IceGrid\\.AdminRouter\\.Locator\\.Locator", false, null),
+ new Property("IceGrid\\.AdminRouter\\.Locator\\.Router", false, null),
+ new Property("IceGrid\\.AdminRouter\\.Locator\\.CollocationOptimized", false, null),
+ new Property("IceGrid\\.AdminRouter\\.Locator\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGrid\\.AdminRouter\\.Locator", false, null),
+ new Property("IceGrid\\.AdminRouter\\.PublishedEndpoints", false, null),
+ new Property("IceGrid\\.AdminRouter\\.ReplicaGroupId", false, null),
+ new Property("IceGrid\\.AdminRouter\\.Router\\.EndpointSelection", false, null),
+ new Property("IceGrid\\.AdminRouter\\.Router\\.ConnectionCached", false, null),
+ new Property("IceGrid\\.AdminRouter\\.Router\\.PreferSecure", false, null),
+ new Property("IceGrid\\.AdminRouter\\.Router\\.LocatorCacheTimeout", false, null),
+ new Property("IceGrid\\.AdminRouter\\.Router\\.InvocationTimeout", false, null),
+ new Property("IceGrid\\.AdminRouter\\.Router\\.Locator", false, null),
+ new Property("IceGrid\\.AdminRouter\\.Router\\.Router", false, null),
+ new Property("IceGrid\\.AdminRouter\\.Router\\.CollocationOptimized", false, null),
+ new Property("IceGrid\\.AdminRouter\\.Router\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGrid\\.AdminRouter\\.Router", false, null),
+ new Property("IceGrid\\.AdminRouter\\.ProxyOptions", false, null),
+ new Property("IceGrid\\.AdminRouter\\.ThreadPool\\.Size", false, null),
+ new Property("IceGrid\\.AdminRouter\\.ThreadPool\\.SizeMax", false, null),
+ new Property("IceGrid\\.AdminRouter\\.ThreadPool\\.SizeWarn", false, null),
+ new Property("IceGrid\\.AdminRouter\\.ThreadPool\\.StackSize", false, null),
+ new Property("IceGrid\\.AdminRouter\\.ThreadPool\\.Serialize", false, null),
+ new Property("IceGrid\\.AdminRouter\\.ThreadPool\\.ThreadIdleTime", false, null),
+ new Property("IceGrid\\.AdminRouter\\.ThreadPool\\.ThreadPriority", false, null),
+ new Property("IceGrid\\.AdminRouter\\.MessageSizeMax", false, null),
+ new Property("IceGrid\\.InstanceName", false, null),
+ new Property("IceGrid\\.Node\\.ACM\\.Timeout", false, null),
+ new Property("IceGrid\\.Node\\.ACM\\.Heartbeat", false, null),
+ new Property("IceGrid\\.Node\\.ACM\\.Close", false, null),
+ new Property("IceGrid\\.Node\\.ACM", false, null),
+ new Property("IceGrid\\.Node\\.AdapterId", false, null),
+ new Property("IceGrid\\.Node\\.Endpoints", false, null),
+ new Property("IceGrid\\.Node\\.Locator\\.EndpointSelection", false, null),
+ new Property("IceGrid\\.Node\\.Locator\\.ConnectionCached", false, null),
+ new Property("IceGrid\\.Node\\.Locator\\.PreferSecure", false, null),
+ new Property("IceGrid\\.Node\\.Locator\\.LocatorCacheTimeout", false, null),
+ new Property("IceGrid\\.Node\\.Locator\\.InvocationTimeout", false, null),
+ new Property("IceGrid\\.Node\\.Locator\\.Locator", false, null),
+ new Property("IceGrid\\.Node\\.Locator\\.Router", false, null),
+ new Property("IceGrid\\.Node\\.Locator\\.CollocationOptimized", false, null),
+ new Property("IceGrid\\.Node\\.Locator\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGrid\\.Node\\.Locator", false, null),
+ new Property("IceGrid\\.Node\\.PublishedEndpoints", false, null),
+ new Property("IceGrid\\.Node\\.ReplicaGroupId", false, null),
+ new Property("IceGrid\\.Node\\.Router\\.EndpointSelection", false, null),
+ new Property("IceGrid\\.Node\\.Router\\.ConnectionCached", false, null),
+ new Property("IceGrid\\.Node\\.Router\\.PreferSecure", false, null),
+ new Property("IceGrid\\.Node\\.Router\\.LocatorCacheTimeout", false, null),
+ new Property("IceGrid\\.Node\\.Router\\.InvocationTimeout", false, null),
+ new Property("IceGrid\\.Node\\.Router\\.Locator", false, null),
+ new Property("IceGrid\\.Node\\.Router\\.Router", false, null),
+ new Property("IceGrid\\.Node\\.Router\\.CollocationOptimized", false, null),
+ new Property("IceGrid\\.Node\\.Router\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGrid\\.Node\\.Router", false, null),
+ new Property("IceGrid\\.Node\\.ProxyOptions", false, null),
+ new Property("IceGrid\\.Node\\.ThreadPool\\.Size", false, null),
+ new Property("IceGrid\\.Node\\.ThreadPool\\.SizeMax", false, null),
+ new Property("IceGrid\\.Node\\.ThreadPool\\.SizeWarn", false, null),
+ new Property("IceGrid\\.Node\\.ThreadPool\\.StackSize", false, null),
+ new Property("IceGrid\\.Node\\.ThreadPool\\.Serialize", false, null),
+ new Property("IceGrid\\.Node\\.ThreadPool\\.ThreadIdleTime", false, null),
+ new Property("IceGrid\\.Node\\.ThreadPool\\.ThreadPriority", false, null),
+ new Property("IceGrid\\.Node\\.MessageSizeMax", false, null),
+ new Property("IceGrid\\.Node\\.AllowRunningServersAsRoot", false, null),
+ new Property("IceGrid\\.Node\\.AllowEndpointsOverride", false, null),
+ new Property("IceGrid\\.Node\\.CollocateRegistry", false, null),
+ new Property("IceGrid\\.Node\\.Data", false, null),
+ new Property("IceGrid\\.Node\\.DisableOnFailure", false, null),
+ new Property("IceGrid\\.Node\\.Name", false, null),
+ new Property("IceGrid\\.Node\\.Output", false, null),
+ new Property("IceGrid\\.Node\\.ProcessorSocketCount", false, null),
+ new Property("IceGrid\\.Node\\.PrintServersReady", false, null),
+ new Property("IceGrid\\.Node\\.PropertiesOverride", false, null),
+ new Property("IceGrid\\.Node\\.RedirectErrToOut", false, null),
+ new Property("IceGrid\\.Node\\.Trace\\.Activator", false, null),
+ new Property("IceGrid\\.Node\\.Trace\\.Adapter", false, null),
+ new Property("IceGrid\\.Node\\.Trace\\.Patch", false, null),
+ new Property("IceGrid\\.Node\\.Trace\\.Replica", false, null),
+ new Property("IceGrid\\.Node\\.Trace\\.Server", false, null),
+ new Property("IceGrid\\.Node\\.UserAccounts", false, null),
+ new Property("IceGrid\\.Node\\.UserAccountMapper\\.EndpointSelection", false, null),
+ new Property("IceGrid\\.Node\\.UserAccountMapper\\.ConnectionCached", false, null),
+ new Property("IceGrid\\.Node\\.UserAccountMapper\\.PreferSecure", false, null),
+ new Property("IceGrid\\.Node\\.UserAccountMapper\\.LocatorCacheTimeout", false, null),
+ new Property("IceGrid\\.Node\\.UserAccountMapper\\.InvocationTimeout", false, null),
+ new Property("IceGrid\\.Node\\.UserAccountMapper\\.Locator", false, null),
+ new Property("IceGrid\\.Node\\.UserAccountMapper\\.Router", false, null),
+ new Property("IceGrid\\.Node\\.UserAccountMapper\\.CollocationOptimized", false, null),
+ new Property("IceGrid\\.Node\\.UserAccountMapper\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGrid\\.Node\\.UserAccountMapper", false, null),
+ new Property("IceGrid\\.Node\\.WaitTime", false, null),
+ new Property("IceGrid\\.Registry\\.AdminCryptPasswords", false, null),
+ new Property("IceGrid\\.Registry\\.AdminPermissionsVerifier\\.EndpointSelection", false, null),
+ new Property("IceGrid\\.Registry\\.AdminPermissionsVerifier\\.ConnectionCached", false, null),
+ new Property("IceGrid\\.Registry\\.AdminPermissionsVerifier\\.PreferSecure", false, null),
+ new Property("IceGrid\\.Registry\\.AdminPermissionsVerifier\\.LocatorCacheTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.AdminPermissionsVerifier\\.InvocationTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.AdminPermissionsVerifier\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.AdminPermissionsVerifier\\.Router", false, null),
+ new Property("IceGrid\\.Registry\\.AdminPermissionsVerifier\\.CollocationOptimized", false, null),
+ new Property("IceGrid\\.Registry\\.AdminPermissionsVerifier\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGrid\\.Registry\\.AdminPermissionsVerifier", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionFilters", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.ACM\\.Timeout", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.ACM\\.Heartbeat", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.ACM\\.Close", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.ACM", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.AdapterId", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Endpoints", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Locator\\.EndpointSelection", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Locator\\.ConnectionCached", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Locator\\.PreferSecure", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Locator\\.LocatorCacheTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Locator\\.InvocationTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Locator\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Locator\\.Router", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Locator\\.CollocationOptimized", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Locator\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.PublishedEndpoints", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.ReplicaGroupId", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Router\\.EndpointSelection", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Router\\.ConnectionCached", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Router\\.PreferSecure", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Router\\.LocatorCacheTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Router\\.InvocationTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Router\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Router\\.Router", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Router\\.CollocationOptimized", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Router\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.Router", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.ProxyOptions", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.ThreadPool\\.Size", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.ThreadPool\\.SizeMax", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.ThreadPool\\.SizeWarn", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.ThreadPool\\.StackSize", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.ThreadPool\\.Serialize", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.ThreadPool\\.ThreadIdleTime", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.ThreadPool\\.ThreadPriority", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSessionManager\\.MessageSizeMax", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSSLPermissionsVerifier\\.EndpointSelection", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSSLPermissionsVerifier\\.ConnectionCached", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSSLPermissionsVerifier\\.PreferSecure", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSSLPermissionsVerifier\\.LocatorCacheTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSSLPermissionsVerifier\\.InvocationTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSSLPermissionsVerifier\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSSLPermissionsVerifier\\.Router", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSSLPermissionsVerifier\\.CollocationOptimized", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSSLPermissionsVerifier\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGrid\\.Registry\\.AdminSSLPermissionsVerifier", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.ACM\\.Timeout", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.ACM\\.Heartbeat", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.ACM\\.Close", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.ACM", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.AdapterId", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.Endpoints", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.Locator\\.EndpointSelection", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.Locator\\.ConnectionCached", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.Locator\\.PreferSecure", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.Locator\\.LocatorCacheTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.Locator\\.InvocationTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.Locator\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.Locator\\.Router", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.Locator\\.CollocationOptimized", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.Locator\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.PublishedEndpoints", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.ReplicaGroupId", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.Router\\.EndpointSelection", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.Router\\.ConnectionCached", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.Router\\.PreferSecure", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.Router\\.LocatorCacheTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.Router\\.InvocationTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.Router\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.Router\\.Router", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.Router\\.CollocationOptimized", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.Router\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.Router", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.ProxyOptions", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.ThreadPool\\.Size", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.ThreadPool\\.SizeMax", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.ThreadPool\\.SizeWarn", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.ThreadPool\\.StackSize", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.ThreadPool\\.Serialize", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.ThreadPool\\.ThreadIdleTime", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.ThreadPool\\.ThreadPriority", false, null),
+ new Property("IceGrid\\.Registry\\.Client\\.MessageSizeMax", false, null),
+ new Property("IceGrid\\.Registry\\.CryptPasswords", false, null),
+ new Property("IceGrid\\.Registry\\.DefaultTemplates", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.ACM\\.Timeout", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.ACM\\.Heartbeat", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.ACM\\.Close", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.ACM", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.AdapterId", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Endpoints", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Locator\\.EndpointSelection", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Locator\\.ConnectionCached", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Locator\\.PreferSecure", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Locator\\.LocatorCacheTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Locator\\.InvocationTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Locator\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Locator\\.Router", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Locator\\.CollocationOptimized", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Locator\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.PublishedEndpoints", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.ReplicaGroupId", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Router\\.EndpointSelection", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Router\\.ConnectionCached", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Router\\.PreferSecure", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Router\\.LocatorCacheTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Router\\.InvocationTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Router\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Router\\.Router", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Router\\.CollocationOptimized", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Router\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Router", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.ProxyOptions", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.ThreadPool\\.Size", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.ThreadPool\\.SizeMax", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.ThreadPool\\.SizeWarn", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.ThreadPool\\.StackSize", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.ThreadPool\\.Serialize", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.ThreadPool\\.ThreadIdleTime", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.ThreadPool\\.ThreadPriority", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.MessageSizeMax", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Enabled", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Address", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Port", false, null),
+ new Property("IceGrid\\.Registry\\.Discovery\\.Interface", false, null),
+ new Property("IceGrid\\.Registry\\.DynamicRegistration", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.ACM\\.Timeout", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.ACM\\.Heartbeat", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.ACM\\.Close", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.ACM", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.AdapterId", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.Endpoints", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.Locator\\.EndpointSelection", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.Locator\\.ConnectionCached", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.Locator\\.PreferSecure", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.Locator\\.LocatorCacheTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.Locator\\.InvocationTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.Locator\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.Locator\\.Router", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.Locator\\.CollocationOptimized", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.Locator\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.PublishedEndpoints", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.ReplicaGroupId", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.Router\\.EndpointSelection", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.Router\\.ConnectionCached", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.Router\\.PreferSecure", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.Router\\.LocatorCacheTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.Router\\.InvocationTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.Router\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.Router\\.Router", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.Router\\.CollocationOptimized", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.Router\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.Router", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.ProxyOptions", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.ThreadPool\\.Size", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.ThreadPool\\.SizeMax", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.ThreadPool\\.SizeWarn", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.ThreadPool\\.StackSize", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.ThreadPool\\.Serialize", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.ThreadPool\\.ThreadIdleTime", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.ThreadPool\\.ThreadPriority", false, null),
+ new Property("IceGrid\\.Registry\\.Internal\\.MessageSizeMax", false, null),
+ new Property("IceGrid\\.Registry\\.LMDB\\.MapSize", false, null),
+ new Property("IceGrid\\.Registry\\.LMDB\\.Path", false, null),
+ new Property("IceGrid\\.Registry\\.NodeSessionTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.PermissionsVerifier\\.EndpointSelection", false, null),
+ new Property("IceGrid\\.Registry\\.PermissionsVerifier\\.ConnectionCached", false, null),
+ new Property("IceGrid\\.Registry\\.PermissionsVerifier\\.PreferSecure", false, null),
+ new Property("IceGrid\\.Registry\\.PermissionsVerifier\\.LocatorCacheTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.PermissionsVerifier\\.InvocationTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.PermissionsVerifier\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.PermissionsVerifier\\.Router", false, null),
+ new Property("IceGrid\\.Registry\\.PermissionsVerifier\\.CollocationOptimized", false, null),
+ new Property("IceGrid\\.Registry\\.PermissionsVerifier\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGrid\\.Registry\\.PermissionsVerifier", false, null),
+ new Property("IceGrid\\.Registry\\.ReplicaName", false, null),
+ new Property("IceGrid\\.Registry\\.ReplicaSessionTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.RequireNodeCertCN", false, null),
+ new Property("IceGrid\\.Registry\\.RequireReplicaCertCN", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.ACM\\.Timeout", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.ACM\\.Heartbeat", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.ACM\\.Close", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.ACM", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.AdapterId", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.Endpoints", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.Locator\\.EndpointSelection", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.Locator\\.ConnectionCached", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.Locator\\.PreferSecure", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.Locator\\.LocatorCacheTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.Locator\\.InvocationTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.Locator\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.Locator\\.Router", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.Locator\\.CollocationOptimized", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.Locator\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.PublishedEndpoints", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.ReplicaGroupId", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.Router\\.EndpointSelection", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.Router\\.ConnectionCached", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.Router\\.PreferSecure", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.Router\\.LocatorCacheTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.Router\\.InvocationTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.Router\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.Router\\.Router", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.Router\\.CollocationOptimized", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.Router\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.Router", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.ProxyOptions", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.ThreadPool\\.Size", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.ThreadPool\\.SizeMax", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.ThreadPool\\.SizeWarn", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.ThreadPool\\.StackSize", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.ThreadPool\\.Serialize", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.ThreadPool\\.ThreadIdleTime", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.ThreadPool\\.ThreadPriority", false, null),
+ new Property("IceGrid\\.Registry\\.Server\\.MessageSizeMax", false, null),
+ new Property("IceGrid\\.Registry\\.SessionFilters", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.ACM\\.Timeout", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.ACM\\.Heartbeat", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.ACM\\.Close", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.ACM", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.AdapterId", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.Endpoints", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.Locator\\.EndpointSelection", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.Locator\\.ConnectionCached", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.Locator\\.PreferSecure", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.Locator\\.LocatorCacheTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.Locator\\.InvocationTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.Locator\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.Locator\\.Router", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.Locator\\.CollocationOptimized", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.Locator\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.PublishedEndpoints", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.ReplicaGroupId", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.Router\\.EndpointSelection", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.Router\\.ConnectionCached", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.Router\\.PreferSecure", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.Router\\.LocatorCacheTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.Router\\.InvocationTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.Router\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.Router\\.Router", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.Router\\.CollocationOptimized", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.Router\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.Router", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.ProxyOptions", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.ThreadPool\\.Size", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.ThreadPool\\.SizeMax", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.ThreadPool\\.SizeWarn", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.ThreadPool\\.StackSize", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.ThreadPool\\.Serialize", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.ThreadPool\\.ThreadIdleTime", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.ThreadPool\\.ThreadPriority", false, null),
+ new Property("IceGrid\\.Registry\\.SessionManager\\.MessageSizeMax", false, null),
+ new Property("IceGrid\\.Registry\\.SessionTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.SSLPermissionsVerifier\\.EndpointSelection", false, null),
+ new Property("IceGrid\\.Registry\\.SSLPermissionsVerifier\\.ConnectionCached", false, null),
+ new Property("IceGrid\\.Registry\\.SSLPermissionsVerifier\\.PreferSecure", false, null),
+ new Property("IceGrid\\.Registry\\.SSLPermissionsVerifier\\.LocatorCacheTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.SSLPermissionsVerifier\\.InvocationTimeout", false, null),
+ new Property("IceGrid\\.Registry\\.SSLPermissionsVerifier\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.SSLPermissionsVerifier\\.Router", false, null),
+ new Property("IceGrid\\.Registry\\.SSLPermissionsVerifier\\.CollocationOptimized", false, null),
+ new Property("IceGrid\\.Registry\\.SSLPermissionsVerifier\\.Context\\.[^\\s]+", false, null),
+ new Property("IceGrid\\.Registry\\.SSLPermissionsVerifier", false, null),
+ new Property("IceGrid\\.Registry\\.Trace\\.Application", false, null),
+ new Property("IceGrid\\.Registry\\.Trace\\.Adapter", false, null),
+ new Property("IceGrid\\.Registry\\.Trace\\.Locator", false, null),
+ new Property("IceGrid\\.Registry\\.Trace\\.Node", false, null),
+ new Property("IceGrid\\.Registry\\.Trace\\.Object", false, null),
+ new Property("IceGrid\\.Registry\\.Trace\\.Patch", false, null),
+ new Property("IceGrid\\.Registry\\.Trace\\.Replica", false, null),
+ new Property("IceGrid\\.Registry\\.Trace\\.Server", false, null),
+ new Property("IceGrid\\.Registry\\.Trace\\.Session", false, null),
+ new Property("IceGrid\\.Registry\\.Trace\\.Subscriber", false, null),
+ new Property("IceGrid\\.Registry\\.Trace\\.Topic", false, null),
+ new Property("IceGrid\\.Registry\\.Trace\\.TopicManager", false, null),
+ new Property("IceGrid\\.Registry\\.UserAccounts", false, null),
+ null
+ };
+
+ public static final Property IcePatch2Props[] =
+ {
+ new Property("IcePatch2\\.ACM\\.Timeout", false, null),
+ new Property("IcePatch2\\.ACM\\.Heartbeat", false, null),
+ new Property("IcePatch2\\.ACM\\.Close", false, null),
+ new Property("IcePatch2\\.ACM", false, null),
+ new Property("IcePatch2\\.AdapterId", false, null),
+ new Property("IcePatch2\\.Endpoints", false, null),
+ new Property("IcePatch2\\.Locator\\.EndpointSelection", false, null),
+ new Property("IcePatch2\\.Locator\\.ConnectionCached", false, null),
+ new Property("IcePatch2\\.Locator\\.PreferSecure", false, null),
+ new Property("IcePatch2\\.Locator\\.LocatorCacheTimeout", false, null),
+ new Property("IcePatch2\\.Locator\\.InvocationTimeout", false, null),
+ new Property("IcePatch2\\.Locator\\.Locator", false, null),
+ new Property("IcePatch2\\.Locator\\.Router", false, null),
+ new Property("IcePatch2\\.Locator\\.CollocationOptimized", false, null),
+ new Property("IcePatch2\\.Locator\\.Context\\.[^\\s]+", false, null),
+ new Property("IcePatch2\\.Locator", false, null),
+ new Property("IcePatch2\\.PublishedEndpoints", false, null),
+ new Property("IcePatch2\\.ReplicaGroupId", false, null),
+ new Property("IcePatch2\\.Router\\.EndpointSelection", false, null),
+ new Property("IcePatch2\\.Router\\.ConnectionCached", false, null),
+ new Property("IcePatch2\\.Router\\.PreferSecure", false, null),
+ new Property("IcePatch2\\.Router\\.LocatorCacheTimeout", false, null),
+ new Property("IcePatch2\\.Router\\.InvocationTimeout", false, null),
+ new Property("IcePatch2\\.Router\\.Locator", false, null),
+ new Property("IcePatch2\\.Router\\.Router", false, null),
+ new Property("IcePatch2\\.Router\\.CollocationOptimized", false, null),
+ new Property("IcePatch2\\.Router\\.Context\\.[^\\s]+", false, null),
+ new Property("IcePatch2\\.Router", false, null),
+ new Property("IcePatch2\\.ProxyOptions", false, null),
+ new Property("IcePatch2\\.ThreadPool\\.Size", false, null),
+ new Property("IcePatch2\\.ThreadPool\\.SizeMax", false, null),
+ new Property("IcePatch2\\.ThreadPool\\.SizeWarn", false, null),
+ new Property("IcePatch2\\.ThreadPool\\.StackSize", false, null),
+ new Property("IcePatch2\\.ThreadPool\\.Serialize", false, null),
+ new Property("IcePatch2\\.ThreadPool\\.ThreadIdleTime", false, null),
+ new Property("IcePatch2\\.ThreadPool\\.ThreadPriority", false, null),
+ new Property("IcePatch2\\.MessageSizeMax", false, null),
+ new Property("IcePatch2\\.Directory", false, null),
+ new Property("IcePatch2\\.InstanceName", false, null),
+ null
+ };
+
+ public static final Property IcePatch2ClientProps[] =
+ {
+ new Property("IcePatch2Client\\.ChunkSize", false, null),
+ new Property("IcePatch2Client\\.Directory", false, null),
+ new Property("IcePatch2Client\\.Proxy", false, null),
+ new Property("IcePatch2Client\\.Remove", false, null),
+ new Property("IcePatch2Client\\.Thorough", false, null),
+ null
+ };
+
+ public static final Property IceSSLProps[] =
+ {
+ new Property("IceSSL\\.Alias", false, null),
+ new Property("IceSSL\\.CAs", false, null),
+ new Property("IceSSL\\.CertAuthDir", true, "IceSSL.CAs"),
+ new Property("IceSSL\\.CertAuthFile", true, "IceSSL.CAs"),
+ new Property("IceSSL\\.CertStore", false, null),
+ new Property("IceSSL\\.CertStoreLocation", false, null),
+ new Property("IceSSL\\.CertFile", false, null),
+ new Property("IceSSL\\.CertVerifier", false, null),
+ new Property("IceSSL\\.CheckCertName", false, null),
+ new Property("IceSSL\\.CheckCRL", false, null),
+ new Property("IceSSL\\.Ciphers", false, null),
+ new Property("IceSSL\\.DefaultDir", false, null),
+ new Property("IceSSL\\.DH\\.[^\\s]+", false, null),
+ new Property("IceSSL\\.DHParams", false, null),
+ new Property("IceSSL\\.EntropyDaemon", false, null),
+ new Property("IceSSL\\.FindCert", false, null),
+ new Property("IceSSL\\.FindCert\\.[^\\s]+", true, "IceSSL.FindCert"),
+ new Property("IceSSL\\.InitOpenSSL", false, null),
+ new Property("IceSSL\\.KeyFile", true, null),
+ new Property("IceSSL\\.Keychain", false, null),
+ new Property("IceSSL\\.KeychainPassword", false, null),
+ new Property("IceSSL\\.Keystore", false, null),
+ new Property("IceSSL\\.KeystorePassword", false, null),
+ new Property("IceSSL\\.KeystoreType", false, null),
+ new Property("IceSSL\\.Password", false, null),
+ new Property("IceSSL\\.PasswordCallback", false, null),
+ new Property("IceSSL\\.PasswordRetryMax", false, null),
+ new Property("IceSSL\\.Protocols", false, null),
+ new Property("IceSSL\\.ProtocolVersionMax", false, null),
+ new Property("IceSSL\\.ProtocolVersionMin", false, null),
+ new Property("IceSSL\\.Random", false, null),
+ new Property("IceSSL\\.Trace\\.Security", false, null),
+ new Property("IceSSL\\.TrustOnly", false, null),
+ new Property("IceSSL\\.TrustOnly\\.Client", false, null),
+ new Property("IceSSL\\.TrustOnly\\.Server", false, null),
+ new Property("IceSSL\\.TrustOnly\\.Server\\.[^\\s]+", false, null),
+ new Property("IceSSL\\.Truststore", false, null),
+ new Property("IceSSL\\.TruststorePassword", false, null),
+ new Property("IceSSL\\.TruststoreType", false, null),
+ new Property("IceSSL\\.UsePlatformCAs", false, null),
+ new Property("IceSSL\\.VerifyDepthMax", false, null),
+ new Property("IceSSL\\.VerifyPeer", false, null),
+ null
+ };
+
+ public static final Property IceStormAdminProps[] =
+ {
+ new Property("IceStormAdmin\\.TopicManager\\.[^\\s]+", false, null),
+ new Property("IceStormAdmin\\.Host", false, null),
+ new Property("IceStormAdmin\\.Port", false, null),
+ null
+ };
+
+ public static final Property IceBTProps[] =
+ {
+ new Property("IceBT\\.RcvSize", false, null),
+ new Property("IceBT\\.SndSize", false, null),
+ null
+ };
+
+ public static final Property Glacier2Props[] =
+ {
+ new Property("Glacier2\\.AddConnectionContext", false, null),
+ new Property("Glacier2\\.Client\\.ACM\\.Timeout", false, null),
+ new Property("Glacier2\\.Client\\.ACM\\.Heartbeat", false, null),
+ new Property("Glacier2\\.Client\\.ACM\\.Close", false, null),
+ new Property("Glacier2\\.Client\\.ACM", false, null),
+ new Property("Glacier2\\.Client\\.AdapterId", false, null),
+ new Property("Glacier2\\.Client\\.Endpoints", false, null),
+ new Property("Glacier2\\.Client\\.Locator\\.EndpointSelection", false, null),
+ new Property("Glacier2\\.Client\\.Locator\\.ConnectionCached", false, null),
+ new Property("Glacier2\\.Client\\.Locator\\.PreferSecure", false, null),
+ new Property("Glacier2\\.Client\\.Locator\\.LocatorCacheTimeout", false, null),
+ new Property("Glacier2\\.Client\\.Locator\\.InvocationTimeout", false, null),
+ new Property("Glacier2\\.Client\\.Locator\\.Locator", false, null),
+ new Property("Glacier2\\.Client\\.Locator\\.Router", false, null),
+ new Property("Glacier2\\.Client\\.Locator\\.CollocationOptimized", false, null),
+ new Property("Glacier2\\.Client\\.Locator\\.Context\\.[^\\s]+", false, null),
+ new Property("Glacier2\\.Client\\.Locator", false, null),
+ new Property("Glacier2\\.Client\\.PublishedEndpoints", false, null),
+ new Property("Glacier2\\.Client\\.ReplicaGroupId", false, null),
+ new Property("Glacier2\\.Client\\.Router\\.EndpointSelection", false, null),
+ new Property("Glacier2\\.Client\\.Router\\.ConnectionCached", false, null),
+ new Property("Glacier2\\.Client\\.Router\\.PreferSecure", false, null),
+ new Property("Glacier2\\.Client\\.Router\\.LocatorCacheTimeout", false, null),
+ new Property("Glacier2\\.Client\\.Router\\.InvocationTimeout", false, null),
+ new Property("Glacier2\\.Client\\.Router\\.Locator", false, null),
+ new Property("Glacier2\\.Client\\.Router\\.Router", false, null),
+ new Property("Glacier2\\.Client\\.Router\\.CollocationOptimized", false, null),
+ new Property("Glacier2\\.Client\\.Router\\.Context\\.[^\\s]+", false, null),
+ new Property("Glacier2\\.Client\\.Router", false, null),
+ new Property("Glacier2\\.Client\\.ProxyOptions", false, null),
+ new Property("Glacier2\\.Client\\.ThreadPool\\.Size", false, null),
+ new Property("Glacier2\\.Client\\.ThreadPool\\.SizeMax", false, null),
+ new Property("Glacier2\\.Client\\.ThreadPool\\.SizeWarn", false, null),
+ new Property("Glacier2\\.Client\\.ThreadPool\\.StackSize", false, null),
+ new Property("Glacier2\\.Client\\.ThreadPool\\.Serialize", false, null),
+ new Property("Glacier2\\.Client\\.ThreadPool\\.ThreadIdleTime", false, null),
+ new Property("Glacier2\\.Client\\.ThreadPool\\.ThreadPriority", false, null),
+ new Property("Glacier2\\.Client\\.MessageSizeMax", false, null),
+ new Property("Glacier2\\.Client\\.AlwaysBatch", false, null),
+ new Property("Glacier2\\.Client\\.Buffered", false, null),
+ new Property("Glacier2\\.Client\\.ForwardContext", false, null),
+ new Property("Glacier2\\.Client\\.SleepTime", false, null),
+ new Property("Glacier2\\.Client\\.Trace\\.Override", false, null),
+ new Property("Glacier2\\.Client\\.Trace\\.Reject", false, null),
+ new Property("Glacier2\\.Client\\.Trace\\.Request", false, null),
+ new Property("Glacier2\\.CryptPasswords", false, null),
+ new Property("Glacier2\\.Filter\\.Address\\.Reject", false, null),
+ new Property("Glacier2\\.Filter\\.Address\\.Accept", false, null),
+ new Property("Glacier2\\.Filter\\.ProxySizeMax", false, null),
+ new Property("Glacier2\\.Filter\\.Category\\.Accept", false, null),
+ new Property("Glacier2\\.Filter\\.Category\\.AcceptUser", false, null),
+ new Property("Glacier2\\.Filter\\.AdapterId\\.Accept", false, null),
+ new Property("Glacier2\\.Filter\\.Identity\\.Accept", false, null),
+ new Property("Glacier2\\.InstanceName", false, null),
+ new Property("Glacier2\\.PermissionsVerifier\\.EndpointSelection", false, null),
+ new Property("Glacier2\\.PermissionsVerifier\\.ConnectionCached", false, null),
+ new Property("Glacier2\\.PermissionsVerifier\\.PreferSecure", false, null),
+ new Property("Glacier2\\.PermissionsVerifier\\.LocatorCacheTimeout", false, null),
+ new Property("Glacier2\\.PermissionsVerifier\\.InvocationTimeout", false, null),
+ new Property("Glacier2\\.PermissionsVerifier\\.Locator", false, null),
+ new Property("Glacier2\\.PermissionsVerifier\\.Router", false, null),
+ new Property("Glacier2\\.PermissionsVerifier\\.CollocationOptimized", false, null),
+ new Property("Glacier2\\.PermissionsVerifier\\.Context\\.[^\\s]+", false, null),
+ new Property("Glacier2\\.PermissionsVerifier", false, null),
+ new Property("Glacier2\\.ReturnClientProxy", false, null),
+ new Property("Glacier2\\.SSLPermissionsVerifier\\.EndpointSelection", false, null),
+ new Property("Glacier2\\.SSLPermissionsVerifier\\.ConnectionCached", false, null),
+ new Property("Glacier2\\.SSLPermissionsVerifier\\.PreferSecure", false, null),
+ new Property("Glacier2\\.SSLPermissionsVerifier\\.LocatorCacheTimeout", false, null),
+ new Property("Glacier2\\.SSLPermissionsVerifier\\.InvocationTimeout", false, null),
+ new Property("Glacier2\\.SSLPermissionsVerifier\\.Locator", false, null),
+ new Property("Glacier2\\.SSLPermissionsVerifier\\.Router", false, null),
+ new Property("Glacier2\\.SSLPermissionsVerifier\\.CollocationOptimized", false, null),
+ new Property("Glacier2\\.SSLPermissionsVerifier\\.Context\\.[^\\s]+", false, null),
+ new Property("Glacier2\\.SSLPermissionsVerifier", false, null),
+ new Property("Glacier2\\.RoutingTable\\.MaxSize", false, null),
+ new Property("Glacier2\\.Server\\.ACM\\.Timeout", false, null),
+ new Property("Glacier2\\.Server\\.ACM\\.Heartbeat", false, null),
+ new Property("Glacier2\\.Server\\.ACM\\.Close", false, null),
+ new Property("Glacier2\\.Server\\.ACM", false, null),
+ new Property("Glacier2\\.Server\\.AdapterId", false, null),
+ new Property("Glacier2\\.Server\\.Endpoints", false, null),
+ new Property("Glacier2\\.Server\\.Locator\\.EndpointSelection", false, null),
+ new Property("Glacier2\\.Server\\.Locator\\.ConnectionCached", false, null),
+ new Property("Glacier2\\.Server\\.Locator\\.PreferSecure", false, null),
+ new Property("Glacier2\\.Server\\.Locator\\.LocatorCacheTimeout", false, null),
+ new Property("Glacier2\\.Server\\.Locator\\.InvocationTimeout", false, null),
+ new Property("Glacier2\\.Server\\.Locator\\.Locator", false, null),
+ new Property("Glacier2\\.Server\\.Locator\\.Router", false, null),
+ new Property("Glacier2\\.Server\\.Locator\\.CollocationOptimized", false, null),
+ new Property("Glacier2\\.Server\\.Locator\\.Context\\.[^\\s]+", false, null),
+ new Property("Glacier2\\.Server\\.Locator", false, null),
+ new Property("Glacier2\\.Server\\.PublishedEndpoints", false, null),
+ new Property("Glacier2\\.Server\\.ReplicaGroupId", false, null),
+ new Property("Glacier2\\.Server\\.Router\\.EndpointSelection", false, null),
+ new Property("Glacier2\\.Server\\.Router\\.ConnectionCached", false, null),
+ new Property("Glacier2\\.Server\\.Router\\.PreferSecure", false, null),
+ new Property("Glacier2\\.Server\\.Router\\.LocatorCacheTimeout", false, null),
+ new Property("Glacier2\\.Server\\.Router\\.InvocationTimeout", false, null),
+ new Property("Glacier2\\.Server\\.Router\\.Locator", false, null),
+ new Property("Glacier2\\.Server\\.Router\\.Router", false, null),
+ new Property("Glacier2\\.Server\\.Router\\.CollocationOptimized", false, null),
+ new Property("Glacier2\\.Server\\.Router\\.Context\\.[^\\s]+", false, null),
+ new Property("Glacier2\\.Server\\.Router", false, null),
+ new Property("Glacier2\\.Server\\.ProxyOptions", false, null),
+ new Property("Glacier2\\.Server\\.ThreadPool\\.Size", false, null),
+ new Property("Glacier2\\.Server\\.ThreadPool\\.SizeMax", false, null),
+ new Property("Glacier2\\.Server\\.ThreadPool\\.SizeWarn", false, null),
+ new Property("Glacier2\\.Server\\.ThreadPool\\.StackSize", false, null),
+ new Property("Glacier2\\.Server\\.ThreadPool\\.Serialize", false, null),
+ new Property("Glacier2\\.Server\\.ThreadPool\\.ThreadIdleTime", false, null),
+ new Property("Glacier2\\.Server\\.ThreadPool\\.ThreadPriority", false, null),
+ new Property("Glacier2\\.Server\\.MessageSizeMax", false, null),
+ new Property("Glacier2\\.Server\\.AlwaysBatch", false, null),
+ new Property("Glacier2\\.Server\\.Buffered", false, null),
+ new Property("Glacier2\\.Server\\.ForwardContext", false, null),
+ new Property("Glacier2\\.Server\\.SleepTime", false, null),
+ new Property("Glacier2\\.Server\\.Trace\\.Override", false, null),
+ new Property("Glacier2\\.Server\\.Trace\\.Request", false, null),
+ new Property("Glacier2\\.SessionManager\\.EndpointSelection", false, null),
+ new Property("Glacier2\\.SessionManager\\.ConnectionCached", false, null),
+ new Property("Glacier2\\.SessionManager\\.PreferSecure", false, null),
+ new Property("Glacier2\\.SessionManager\\.LocatorCacheTimeout", false, null),
+ new Property("Glacier2\\.SessionManager\\.InvocationTimeout", false, null),
+ new Property("Glacier2\\.SessionManager\\.Locator", false, null),
+ new Property("Glacier2\\.SessionManager\\.Router", false, null),
+ new Property("Glacier2\\.SessionManager\\.CollocationOptimized", false, null),
+ new Property("Glacier2\\.SessionManager\\.Context\\.[^\\s]+", false, null),
+ new Property("Glacier2\\.SessionManager", false, null),
+ new Property("Glacier2\\.SSLSessionManager\\.EndpointSelection", false, null),
+ new Property("Glacier2\\.SSLSessionManager\\.ConnectionCached", false, null),
+ new Property("Glacier2\\.SSLSessionManager\\.PreferSecure", false, null),
+ new Property("Glacier2\\.SSLSessionManager\\.LocatorCacheTimeout", false, null),
+ new Property("Glacier2\\.SSLSessionManager\\.InvocationTimeout", false, null),
+ new Property("Glacier2\\.SSLSessionManager\\.Locator", false, null),
+ new Property("Glacier2\\.SSLSessionManager\\.Router", false, null),
+ new Property("Glacier2\\.SSLSessionManager\\.CollocationOptimized", false, null),
+ new Property("Glacier2\\.SSLSessionManager\\.Context\\.[^\\s]+", false, null),
+ new Property("Glacier2\\.SSLSessionManager", false, null),
+ new Property("Glacier2\\.SessionTimeout", false, null),
+ new Property("Glacier2\\.Trace\\.RoutingTable", false, null),
+ new Property("Glacier2\\.Trace\\.Session", false, null),
+ null
+ };
+
+ public static final Property Glacier2CryptPermissionsVerifierProps[] =
+ {
+ new Property("Glacier2CryptPermissionsVerifier\\.[^\\s]+\\.PermissionsVerifier", false, null),
+ new Property("Glacier2CryptPermissionsVerifier\\.[^\\s]+\\.AdminPermissionsVerifier", false, null),
+ null
+ };
+
+ public static final Property FreezeProps[] =
+ {
+ new Property("Freeze\\.DbEnv\\.[^\\s]+\\.CheckpointPeriod", false, null),
+ new Property("Freeze\\.DbEnv\\.[^\\s]+\\.DbHome", false, null),
+ new Property("Freeze\\.DbEnv\\.[^\\s]+\\.DbPrivate", false, null),
+ new Property("Freeze\\.DbEnv\\.[^\\s]+\\.DbRecoverFatal", false, null),
+ new Property("Freeze\\.DbEnv\\.[^\\s]+\\.EncodingVersion", false, null),
+ new Property("Freeze\\.DbEnv\\.[^\\s]+\\.LockFile", false, null),
+ new Property("Freeze\\.DbEnv\\.[^\\s]+\\.OldLogsAutoDelete", false, null),
+ new Property("Freeze\\.DbEnv\\.[^\\s]+\\.PeriodicCheckpointMinSize", false, null),
+ new Property("Freeze\\.Evictor\\.[^\\s]+\\.BtreeMinKey", false, null),
+ new Property("Freeze\\.Evictor\\.[^\\s]+\\.Checksum", false, null),
+ new Property("Freeze\\.Evictor\\.[^\\s]+\\.MaxTxSize", false, null),
+ new Property("Freeze\\.Evictor\\.[^\\s]+\\.PageSize", false, null),
+ new Property("Freeze\\.Evictor\\.[^\\s]+\\.PopulateEmptyIndices", false, null),
+ new Property("Freeze\\.Evictor\\.[^\\s]+\\.RollbackOnUserException", false, null),
+ new Property("Freeze\\.Evictor\\.[^\\s]+\\.SavePeriod", false, null),
+ new Property("Freeze\\.Evictor\\.[^\\s]+\\.SaveSizeTrigger", false, null),
+ new Property("Freeze\\.Evictor\\.[^\\s]+\\.StreamTimeout", false, null),
+ new Property("Freeze\\.Map\\.[^\\s]+\\.BtreeMinKey", false, null),
+ new Property("Freeze\\.Map\\.[^\\s]+\\.Checksum", false, null),
+ new Property("Freeze\\.Map\\.[^\\s]+\\.PageSize", false, null),
+ new Property("Freeze\\.Trace\\.DbEnv", false, null),
+ new Property("Freeze\\.Trace\\.Evictor", false, null),
+ new Property("Freeze\\.Trace\\.Map", false, null),
+ new Property("Freeze\\.Trace\\.Transaction", false, null),
+ new Property("Freeze\\.Warn\\.Deadlocks", false, null),
+ new Property("Freeze\\.Warn\\.Rollback", false, null),
+ null
+ };
+
+
+ public static final Property[] validProps[] =
+ {
+ IceProps,
+ IceMXProps,
+ IceDiscoveryProps,
+ IceGridDiscoveryProps,
+ IceBoxProps,
+ IceBoxAdminProps,
+ IceGridAdminProps,
+ IceGridProps,
+ IcePatch2Props,
+ IcePatch2ClientProps,
+ IceSSLProps,
+ IceStormAdminProps,
+ IceBTProps,
+ Glacier2Props,
+ Glacier2CryptPermissionsVerifierProps,
+ FreezeProps,
+ null
+ };
+
+ public static final String clPropNames[] =
+ {
+ "Ice",
+ "IceMX",
+ "IceDiscovery",
+ "IceGridDiscovery",
+ "IceBox",
+ "IceBoxAdmin",
+ "IceGridAdmin",
+ "IceGrid",
+ "IcePatch2",
+ "IcePatch2Client",
+ "IceSSL",
+ "IceStormAdmin",
+ "IceBT",
+ "Glacier2",
+ "Glacier2CryptPermissionsVerifier",
+ "Freeze",
+ null
+ };
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Protocol.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Protocol.java
new file mode 100644
index 00000000000..d6840f9d524
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Protocol.java
@@ -0,0 +1,201 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import com.zeroc.Ice.EncodingVersion;
+import com.zeroc.Ice.ProtocolVersion;
+
+final public class Protocol
+{
+ //
+ // Size of the Ice protocol header
+ //
+ // Magic number (4 bytes)
+ // Protocol version major (Byte)
+ // Protocol version minor (Byte)
+ // Encoding version major (Byte)
+ // Encoding version minor (Byte)
+ // Message type (Byte)
+ // Compression status (Byte)
+ // Message size (Int)
+ //
+ public final static int headerSize = 14;
+
+ //
+ // The magic number at the front of each message
+ //
+ public final static byte magic[] = { 0x49, 0x63, 0x65, 0x50 }; // 'I', 'c', 'e', 'P'
+
+ //
+ // The current Ice protocol and encoding version
+ //
+ public final static byte protocolMajor = 1;
+ public final static byte protocolMinor = 0;
+ public final static byte protocolEncodingMajor = 1;
+ public final static byte protocolEncodingMinor = 0;
+
+ public final static byte encodingMajor = 1;
+ public final static byte encodingMinor = 1;
+
+ //
+ // The Ice protocol message types
+ //
+ public final static byte requestMsg = 0;
+ public final static byte requestBatchMsg = 1;
+ public final static byte replyMsg = 2;
+ public final static byte validateConnectionMsg = 3;
+ public final static byte closeConnectionMsg = 4;
+
+ public final static byte[] requestHdr =
+ {
+ Protocol.magic[0],
+ Protocol.magic[1],
+ Protocol.magic[2],
+ Protocol.magic[3],
+ Protocol.protocolMajor,
+ Protocol.protocolMinor,
+ Protocol.protocolEncodingMajor,
+ Protocol.protocolEncodingMinor,
+ Protocol.requestMsg,
+ (byte)0, // Compression status.
+ (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder).
+ (byte)0, (byte)0, (byte)0, (byte)0 // Request ID (placeholder).
+ };
+
+ public final static byte[] requestBatchHdr =
+ {
+ Protocol.magic[0],
+ Protocol.magic[1],
+ Protocol.magic[2],
+ Protocol.magic[3],
+ Protocol.protocolMajor,
+ Protocol.protocolMinor,
+ Protocol.protocolEncodingMajor,
+ Protocol.protocolEncodingMinor,
+ Protocol.requestBatchMsg,
+ 0, // Compression status.
+ (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder).
+ (byte)0, (byte)0, (byte)0, (byte)0 // Number of requests in batch (placeholder).
+ };
+
+ public final static byte[] replyHdr =
+ {
+ Protocol.magic[0],
+ Protocol.magic[1],
+ Protocol.magic[2],
+ Protocol.magic[3],
+ Protocol.protocolMajor,
+ Protocol.protocolMinor,
+ Protocol.protocolEncodingMajor,
+ Protocol.protocolEncodingMinor,
+ Protocol.replyMsg,
+ (byte)0, // Compression status.
+ (byte)0, (byte)0, (byte)0, (byte)0 // Message size (placeholder).
+ };
+
+ static final public ProtocolVersion currentProtocol = new ProtocolVersion(protocolMajor, protocolMinor);
+ static final public EncodingVersion currentProtocolEncoding = new EncodingVersion(protocolEncodingMajor,
+ protocolEncodingMinor);
+
+ static final public EncodingVersion currentEncoding = new EncodingVersion(encodingMajor, encodingMinor);
+
+ static public void
+ checkSupportedProtocol(ProtocolVersion v)
+ {
+ if(v.major != currentProtocol.major || v.minor > currentProtocol.minor)
+ {
+ throw new com.zeroc.Ice.UnsupportedProtocolException("", v, currentProtocol);
+ }
+ }
+
+ static public void
+ checkSupportedProtocolEncoding(EncodingVersion v)
+ {
+ if(v.major != currentProtocolEncoding.major || v.minor > currentProtocolEncoding.minor)
+ {
+ throw new com.zeroc.Ice.UnsupportedEncodingException("", v, currentProtocolEncoding);
+ }
+ }
+
+ static public void
+ checkSupportedEncoding(EncodingVersion v)
+ {
+ if(v.major != currentEncoding.major || v.minor > currentEncoding.minor)
+ {
+ throw new com.zeroc.Ice.UnsupportedEncodingException("", v, currentEncoding);
+ }
+ }
+
+ //
+ // Either return the given protocol if not compatible, or the greatest
+ // supported protocol otherwise.
+ //
+ static public ProtocolVersion
+ getCompatibleProtocol(ProtocolVersion v)
+ {
+ if(v.major != currentProtocol.major)
+ {
+ return v; // Unsupported protocol, return as is.
+ }
+ else if(v.minor < currentProtocol.minor)
+ {
+ return v; // Supported protocol.
+ }
+ else
+ {
+ //
+ // Unsupported but compatible, use the currently supported
+ // protocol, that's the best we can do.
+ //
+ return currentProtocol;
+ }
+ }
+
+ //
+ // Either return the given encoding if not compatible, or the greatest
+ // supported encoding otherwise.
+ //
+ static public EncodingVersion
+ getCompatibleEncoding(EncodingVersion v)
+ {
+ if(v.major != currentEncoding.major)
+ {
+ return v; // Unsupported encoding, return as is.
+ }
+ else if(v.minor < currentEncoding.minor)
+ {
+ return v; // Supported encoding.
+ }
+ else
+ {
+ //
+ // Unsupported but compatible, use the currently supported
+ // encoding, that's the best we can do.
+ //
+ return currentEncoding;
+ }
+ }
+
+ static public boolean
+ isSupported(EncodingVersion version, EncodingVersion supported)
+ {
+ return version.major == supported.major && version.minor <= supported.minor;
+ }
+
+ public static final int OPTIONAL_END_MARKER = 0xFF;
+
+ public static final byte FLAG_HAS_TYPE_ID_STRING = (byte)(1<<0);
+ public static final byte FLAG_HAS_TYPE_ID_INDEX = (byte)(1<<1);
+ public static final byte FLAG_HAS_TYPE_ID_COMPACT = (byte)(1<<1 | 1<<0);
+ public static final byte FLAG_HAS_OPTIONAL_MEMBERS = (byte)(1<<2);
+ public static final byte FLAG_HAS_INDIRECTION_TABLE = (byte)(1<<3);
+ public static final byte FLAG_HAS_SLICE_SIZE = (byte)(1<<4);
+ public static final byte FLAG_IS_LAST_SLICE = (byte)(1<<5);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProtocolInstance.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProtocolInstance.java
new file mode 100644
index 00000000000..125f55414af
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProtocolInstance.java
@@ -0,0 +1,142 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class ProtocolInstance
+{
+ public ProtocolInstance(com.zeroc.Ice.Communicator communicator, short type, String protocol, boolean secure)
+ {
+ _instance = Util.getInstance(communicator);
+ _traceLevel = _instance.traceLevels().network;
+ _traceCategory = _instance.traceLevels().networkCat;
+ _logger = _instance.initializationData().logger;
+ _properties = _instance.initializationData().properties;
+ _type = type;
+ _protocol = protocol;
+ _secure = secure;
+ }
+
+ public int traceLevel()
+ {
+ return _traceLevel;
+ }
+
+ public String traceCategory()
+ {
+ return _traceCategory;
+ }
+
+ public com.zeroc.Ice.Logger logger()
+ {
+ return _logger;
+ }
+
+ public String protocol()
+ {
+ return _protocol;
+ }
+
+ public short type()
+ {
+ return _type;
+ }
+
+ public boolean secure()
+ {
+ return _secure;
+ }
+
+ public com.zeroc.Ice.Properties properties()
+ {
+ return _properties;
+ }
+
+ public boolean preferIPv6()
+ {
+ return _instance.preferIPv6();
+ }
+
+ public int protocolSupport()
+ {
+ return _instance.protocolSupport();
+ }
+
+ public String defaultHost()
+ {
+ return _instance.defaultsAndOverrides().defaultHost;
+ }
+
+ public java.net.InetSocketAddress defaultSourceAddress()
+ {
+ return _instance.defaultsAndOverrides().defaultSourceAddress;
+ }
+
+ public com.zeroc.Ice.EncodingVersion defaultEncoding()
+ {
+ return _instance.defaultsAndOverrides().defaultEncoding;
+ }
+
+ public int defaultTimeout()
+ {
+ return _instance.defaultsAndOverrides().defaultTimeout;
+ }
+
+ public NetworkProxy networkProxy()
+ {
+ return _instance.networkProxy();
+ }
+
+ public int messageSizeMax()
+ {
+ return _instance.messageSizeMax();
+ }
+
+ public void resolve(String host, int port, com.zeroc.Ice.EndpointSelectionType type, IPEndpointI endpt,
+ EndpointI_connectors callback)
+ {
+ _instance.endpointHostResolver().resolve(host, port, type, endpt, callback);
+ }
+
+ public BufSizeWarnInfo getBufSizeWarn(short type)
+ {
+ return _instance.getBufSizeWarn(type);
+ }
+
+ public void setSndBufSizeWarn(short type, int size)
+ {
+ _instance.setSndBufSizeWarn(type, size);
+ }
+
+ public void setRcvBufSizeWarn(short type, int size)
+ {
+ _instance.setRcvBufSizeWarn(type, size);
+ }
+
+ ProtocolInstance(Instance instance, short type, String protocol, boolean secure)
+ {
+ _instance = instance;
+ _traceLevel = _instance.traceLevels().network;
+ _traceCategory = _instance.traceLevels().networkCat;
+ _logger = _instance.initializationData().logger;
+ _properties = _instance.initializationData().properties;
+ _type = type;
+ _protocol = protocol;
+ _secure = secure;
+ }
+
+ protected Instance _instance;
+ protected int _traceLevel;
+ protected String _traceCategory;
+ protected com.zeroc.Ice.Logger _logger;
+ protected com.zeroc.Ice.Properties _properties;
+ protected String _protocol;
+ protected short _type;
+ protected boolean _secure;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProtocolPluginFacade.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProtocolPluginFacade.java
new file mode 100644
index 00000000000..b988b67274c
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProtocolPluginFacade.java
@@ -0,0 +1,34 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public interface ProtocolPluginFacade
+{
+ //
+ // Get the Communicator instance with which this facade is
+ // associated.
+ //
+ com.zeroc.Ice.Communicator getCommunicator();
+
+ //
+ // Register an EndpointFactory.
+ //
+ void addEndpointFactory(EndpointFactory factory);
+
+ //
+ // Get an EndpointFactory.
+ //
+ EndpointFactory getEndpointFactory(short type);
+
+ //
+ // Look up a Java class by name.
+ //
+ Class<?> findClass(String className);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProtocolPluginFacadeI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProtocolPluginFacadeI.java
new file mode 100644
index 00000000000..2456d0c061c
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProtocolPluginFacadeI.java
@@ -0,0 +1,59 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class ProtocolPluginFacadeI implements ProtocolPluginFacade
+{
+ public ProtocolPluginFacadeI(com.zeroc.Ice.Communicator communicator)
+ {
+ _communicator = communicator;
+ _instance = Util.getInstance(communicator);
+ }
+
+ //
+ // Get the Communicator instance with which this facade is
+ // associated.
+ //
+ @Override
+ public com.zeroc.Ice.Communicator getCommunicator()
+ {
+ return _communicator;
+ }
+
+ //
+ // Register an EndpointFactory.
+ //
+ @Override
+ public void addEndpointFactory(EndpointFactory factory)
+ {
+ _instance.endpointFactoryManager().add(factory);
+ }
+
+ //
+ // Register an EndpointFactory.
+ //
+ @Override
+ public EndpointFactory getEndpointFactory(short type)
+ {
+ return _instance.endpointFactoryManager().get(type);
+ }
+
+ //
+ // Look up a Java class by name.
+ //
+ @Override
+ public Class<?> findClass(String className)
+ {
+ return _instance.findClass(className);
+ }
+
+ private Instance _instance;
+ private com.zeroc.Ice.Communicator _communicator;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyFactory.java
new file mode 100644
index 00000000000..941dbab051a
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyFactory.java
@@ -0,0 +1,302 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import com.zeroc.Ice.OperationInterruptedException;
+
+public final class ProxyFactory
+{
+ public com.zeroc.Ice.ObjectPrx
+ stringToProxy(String str)
+ {
+ Reference ref = _instance.referenceFactory().create(str, null);
+ return referenceToProxy(ref);
+ }
+
+ public String
+ proxyToString(com.zeroc.Ice.ObjectPrx proxy)
+ {
+ if(proxy != null)
+ {
+ com.zeroc.Ice._ObjectPrxI h = (com.zeroc.Ice._ObjectPrxI)proxy;
+ return h.__reference().toString();
+ }
+ else
+ {
+ return "";
+ }
+ }
+
+ public com.zeroc.Ice.ObjectPrx
+ propertyToProxy(String prefix)
+ {
+ String proxy = _instance.initializationData().properties.getProperty(prefix);
+ Reference ref = _instance.referenceFactory().create(proxy, prefix);
+ return referenceToProxy(ref);
+ }
+
+ public java.util.Map<String, String>
+ proxyToProperty(com.zeroc.Ice.ObjectPrx proxy, String prefix)
+ {
+ if(proxy != null)
+ {
+ com.zeroc.Ice._ObjectPrxI h = (com.zeroc.Ice._ObjectPrxI)proxy;
+ return h.__reference().toProperty(prefix);
+ }
+ else
+ {
+ return new java.util.HashMap<>();
+ }
+ }
+
+ public com.zeroc.Ice.ObjectPrx
+ streamToProxy(com.zeroc.Ice.InputStream s)
+ {
+ com.zeroc.Ice.Identity ident = com.zeroc.Ice.Identity.read(s, null);
+
+ Reference ref = _instance.referenceFactory().create(ident, s);
+ return referenceToProxy(ref);
+ }
+
+ public com.zeroc.Ice.ObjectPrx
+ referenceToProxy(Reference ref)
+ {
+ if(ref != null)
+ {
+ com.zeroc.Ice._ObjectPrxI proxy = new com.zeroc.Ice._ObjectPrxI();
+ proxy.__setup(ref);
+ return proxy;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public int
+ checkRetryAfterException(com.zeroc.Ice.LocalException ex, Reference ref, Holder<Integer> sleepInterval, int cnt)
+ {
+ TraceLevels traceLevels = _instance.traceLevels();
+ com.zeroc.Ice.Logger logger = _instance.initializationData().logger;
+
+ //
+ // We don't retry batch requests because the exception might have caused
+ // all the requests batched with the connection to be aborted and we
+ // want the application to be notified.
+ //
+ if(ref.getMode() == Reference.ModeBatchOneway || ref.getMode() == Reference.ModeBatchDatagram)
+ {
+ throw ex;
+ }
+
+ if(ex instanceof com.zeroc.Ice.ObjectNotExistException)
+ {
+ com.zeroc.Ice.ObjectNotExistException one = (com.zeroc.Ice.ObjectNotExistException)ex;
+
+ if(ref.getRouterInfo() != null && one.operation.equals("ice_add_proxy"))
+ {
+ //
+ // If we have a router, an ObjectNotExistException with an
+ // operation name "ice_add_proxy" indicates to the client
+ // that the router isn't aware of the proxy (for example,
+ // because it was evicted by the router). In this case, we
+ // must *always* retry, so that the missing proxy is added
+ // to the router.
+ //
+
+ ref.getRouterInfo().clearCache(ref);
+
+ if(traceLevels.retry >= 1)
+ {
+ String s = "retrying operation call to add proxy to router\n" + ex.toString();
+ logger.trace(traceLevels.retryCat, s);
+ }
+
+ if(sleepInterval != null)
+ {
+ sleepInterval.value = 0;
+ }
+ return cnt; // We must always retry, so we don't look at the retry count.
+ }
+ else if(ref.isIndirect())
+ {
+ //
+ // We retry ObjectNotExistException if the reference is
+ // indirect.
+ //
+
+ if(ref.isWellKnown())
+ {
+ LocatorInfo li = ref.getLocatorInfo();
+ if(li != null)
+ {
+ li.clearCache(ref);
+ }
+ }
+ }
+ else
+ {
+ //
+ // For all other cases, we don't retry ObjectNotExistException.
+ //
+ throw ex;
+ }
+ }
+ else if(ex instanceof com.zeroc.Ice.RequestFailedException)
+ {
+ //
+ // For all other cases, we don't retry ObjectNotExistException
+ //
+ throw ex;
+ }
+
+ //
+ // There is no point in retrying an operation that resulted in a
+ // MarshalException. This must have been raised locally (because
+ // if it happened in a server it would result in an
+ // UnknownLocalException instead), which means there was a problem
+ // in this process that will not change if we try again.
+ //
+ // The most likely cause for a MarshalException is exceeding the
+ // maximum message size, which is represented by the subclass
+ // MemoryLimitException. For example, a client can attempt to send
+ // a message that exceeds the maximum memory size, or accumulate
+ // enough batch requests without flushing that the maximum size is
+ // reached.
+ //
+ // This latter case is especially problematic, because if we were
+ // to retry a batch request after a MarshalException, we would in
+ // fact silently discard the accumulated requests and allow new
+ // batch requests to accumulate. If the subsequent batched
+ // requests do not exceed the maximum message size, it appears to
+ // the client that all of the batched requests were accepted, when
+ // in reality only the last few are actually sent.
+ //
+ if(ex instanceof com.zeroc.Ice.MarshalException)
+ {
+ throw ex;
+ }
+
+ //
+ // Don't retry if the communicator is destroyed or object adapter
+ // deactivated.
+ //
+ if(ex instanceof com.zeroc.Ice.CommunicatorDestroyedException ||
+ ex instanceof com.zeroc.Ice.ObjectAdapterDeactivatedException)
+ {
+ throw ex;
+ }
+
+ //
+ // Don't retry invocation timeouts.
+ //
+ if(ex instanceof com.zeroc.Ice.InvocationTimeoutException ||
+ ex instanceof com.zeroc.Ice.InvocationCanceledException)
+ {
+ throw ex;
+ }
+
+ //
+ // Don't retry on OperationInterruptedException.
+ //
+ if(ex instanceof OperationInterruptedException)
+ {
+ throw ex;
+ }
+
+ ++cnt;
+ assert(cnt > 0);
+
+ int interval;
+ if(cnt == (_retryIntervals.length + 1) && ex instanceof com.zeroc.Ice.CloseConnectionException)
+ {
+ //
+ // A close connection exception is always retried at least once, even if the retry
+ // limit is reached.
+ //
+ interval = 0;
+ }
+ else if(cnt > _retryIntervals.length)
+ {
+ if(traceLevels.retry >= 1)
+ {
+ String s = "cannot retry operation call because retry limit has been exceeded\n" + ex.toString();
+ logger.trace(traceLevels.retryCat, s);
+ }
+ throw ex;
+ }
+ else
+ {
+ interval = _retryIntervals[cnt - 1];
+ }
+
+ if(traceLevels.retry >= 1)
+ {
+ String s = "retrying operation call";
+ if(interval > 0)
+ {
+ s += " in " + interval + "ms";
+ }
+ s += " because of exception\n" + ex;
+ logger.trace(traceLevels.retryCat, s);
+ }
+
+ sleepInterval.value = interval;
+ return cnt;
+ }
+
+ //
+ // Only for use by Instance.
+ //
+ ProxyFactory(Instance instance)
+ {
+ _instance = instance;
+
+ String[] arr = _instance.initializationData().properties.getPropertyAsList("Ice.RetryIntervals");
+
+ if(arr.length > 0)
+ {
+ _retryIntervals = new int[arr.length];
+
+ for(int i = 0; i < arr.length; i++)
+ {
+ int v;
+
+ try
+ {
+ v = Integer.parseInt(arr[i]);
+ }
+ catch(NumberFormatException ex)
+ {
+ v = 0;
+ }
+
+ //
+ // If -1 is the first value, no retry and wait intervals.
+ //
+ if(i == 0 && v == -1)
+ {
+ _retryIntervals = new int[0];
+ break;
+ }
+
+ _retryIntervals[i] = v > 0 ? v : 0;
+ }
+ }
+ else
+ {
+ _retryIntervals = new int[1];
+ _retryIntervals[0] = 0;
+ }
+ }
+
+ private Instance _instance;
+ private int[] _retryIntervals;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyFlushBatch.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyFlushBatch.java
new file mode 100644
index 00000000000..5253ecb37b5
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyFlushBatch.java
@@ -0,0 +1,114 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class ProxyFlushBatch extends ProxyOutgoingAsyncBase<Void>
+{
+ public ProxyFlushBatch(com.zeroc.Ice._ObjectPrxI prx)
+ {
+ super(prx, "ice_flushBatchRequests");
+ _observer = ObserverHelper.get(prx, "ice_flushBatchRequests");
+ _batchRequestNum = prx.__getBatchRequestQueue().swap(_os);
+ }
+
+ @Override
+ public boolean completed(com.zeroc.Ice.InputStream is)
+ {
+ assert(false);
+ return false;
+ }
+
+ @Override
+ protected synchronized void __sent()
+ {
+ super.__sent();
+
+ assert((_state & StateOK) != 0);
+ complete(null);
+ }
+
+ @Override
+ protected boolean __needCallback()
+ {
+ return true;
+ }
+
+ @Override
+ protected void __completed()
+ {
+ super.__completed();
+ if(_exception != null)
+ {
+ completeExceptionally(_exception);
+ }
+ }
+
+ @Override
+ public int invokeRemote(com.zeroc.Ice.ConnectionI connection, boolean compress, boolean response)
+ throws RetryException
+ {
+ if(_batchRequestNum == 0)
+ {
+ return sent() ? AsyncStatus.Sent | AsyncStatus.InvokeSentCallback : AsyncStatus.Sent;
+ }
+ _cachedConnection = connection;
+ return connection.sendAsyncRequest(this, compress, false, _batchRequestNum);
+ }
+
+ @Override
+ public int invokeCollocated(CollocatedRequestHandler handler)
+ {
+ if(_batchRequestNum == 0)
+ {
+ return sent() ? AsyncStatus.Sent | AsyncStatus.InvokeSentCallback : AsyncStatus.Sent;
+ }
+ return handler.invokeAsyncRequest(this, _batchRequestNum, false);
+ }
+
+ public void invoke()
+ {
+ Protocol.checkSupportedProtocol(Protocol.getCompatibleProtocol(_proxy.__reference().getProtocol()));
+ invokeImpl(true); // userThread = true
+ }
+
+ public void __wait()
+ {
+ if(Thread.currentThread().interrupted())
+ {
+ throw new com.zeroc.Ice.OperationInterruptedException();
+ }
+
+ try
+ {
+ get();
+ }
+ catch(InterruptedException ex)
+ {
+ throw new com.zeroc.Ice.OperationInterruptedException();
+ }
+ catch(java.util.concurrent.ExecutionException ee)
+ {
+ try
+ {
+ throw ee.getCause();
+ }
+ catch(RuntimeException ex) // Includes LocalException
+ {
+ throw ex;
+ }
+ catch(Throwable ex)
+ {
+ throw new com.zeroc.Ice.UnknownException(ex);
+ }
+ }
+ }
+
+ protected int _batchRequestNum;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyGetConnection.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyGetConnection.java
new file mode 100644
index 00000000000..f7cbaa9a94b
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyGetConnection.java
@@ -0,0 +1,106 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class ProxyGetConnection extends ProxyOutgoingAsyncBase<com.zeroc.Ice.Connection>
+{
+ public ProxyGetConnection(com.zeroc.Ice._ObjectPrxI prx)
+ {
+ super(prx, "ice_getConnection");
+ _observer = ObserverHelper.get(prx, "ice_getConnection");
+ }
+
+ @Override
+ protected boolean __needCallback()
+ {
+ return true;
+ }
+
+ @Override
+ protected void __completed()
+ {
+ super.__completed();
+
+ if(_exception != null)
+ {
+ completeExceptionally(_exception);
+ }
+ else
+ {
+ complete(_cachedConnection);
+ }
+ }
+
+ @Override
+ public boolean completed(com.zeroc.Ice.InputStream is)
+ {
+ assert(false);
+ return false;
+ }
+
+ @Override
+ public int invokeRemote(com.zeroc.Ice.ConnectionI connection, boolean compress, boolean response)
+ throws RetryException
+ {
+ _cachedConnection = connection;
+ if(finished(true))
+ {
+ invokeCompletedAsync();
+ }
+ return AsyncStatus.Sent;
+ }
+
+ @Override
+ public int invokeCollocated(CollocatedRequestHandler handler)
+ {
+ if(finished(true))
+ {
+ invokeCompletedAsync();
+ }
+ return AsyncStatus.Sent;
+ }
+
+ public void invoke()
+ {
+ invokeImpl(true); // userThread = true
+ }
+
+ public com.zeroc.Ice.Connection __wait()
+ {
+ if(Thread.currentThread().interrupted())
+ {
+ throw new com.zeroc.Ice.OperationInterruptedException();
+ }
+
+ try
+ {
+ return get();
+ }
+ catch(InterruptedException ex)
+ {
+ throw new com.zeroc.Ice.OperationInterruptedException();
+ }
+ catch(java.util.concurrent.ExecutionException ee)
+ {
+ try
+ {
+ throw ee.getCause();
+ }
+ catch(RuntimeException ex) // Includes LocalException
+ {
+ throw ex;
+ }
+ catch(Throwable ex)
+ {
+ throw new com.zeroc.Ice.UnknownException(ex);
+ }
+ }
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyIceInvoke.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyIceInvoke.java
new file mode 100644
index 00000000000..05bb8483cf0
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyIceInvoke.java
@@ -0,0 +1,218 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import com.zeroc.Ice.FormatType;
+import com.zeroc.Ice.InputStream;
+import com.zeroc.Ice.OperationInterruptedException;
+import com.zeroc.Ice.OutputStream;
+import com.zeroc.Ice.UserException;
+import com.zeroc.Ice.UnknownException;
+import com.zeroc.Ice.UnknownUserException;
+
+public class ProxyIceInvoke extends ProxyOutgoingAsyncBase<com.zeroc.Ice.Object.Ice_invokeResult>
+{
+ public ProxyIceInvoke(com.zeroc.Ice.ObjectPrx prx, String operation, com.zeroc.Ice.OperationMode mode,
+ boolean synchronous)
+ {
+ super((com.zeroc.Ice._ObjectPrxI)prx, operation);
+ _mode = mode == null ? com.zeroc.Ice.OperationMode.Normal : mode;
+ _synchronous = synchronous;
+ _encoding = Protocol.getCompatibleEncoding(_proxy.__reference().getEncoding());
+ _is = null;
+ }
+
+ public void invoke(byte[] inParams, java.util.Map<String, String> ctx)
+ {
+ try
+ {
+ prepare(ctx);
+ writeParamEncaps(inParams);
+
+ if(isBatch())
+ {
+ //
+ // NOTE: we don't call sent/completed callbacks for batch AMI requests
+ //
+ _sentSynchronously = true;
+ _proxy.__getBatchRequestQueue().finishBatchRequest(_os, _proxy, _operation);
+ finished(true);
+ }
+ else
+ {
+ //
+ // NOTE: invokeImpl doesn't throw so this can be called from the
+ // try block with the catch block calling abort() in case of an
+ // exception.
+ //
+ invokeImpl(true); // userThread = true
+ }
+ }
+ catch(com.zeroc.Ice.Exception ex)
+ {
+ abort(ex);
+ }
+ }
+
+ public com.zeroc.Ice.Object.Ice_invokeResult __wait()
+ {
+ if(isBatch())
+ {
+ //
+ // The future will not be completed for a batch invocation.
+ //
+ return new com.zeroc.Ice.Object.Ice_invokeResult(true, new byte[0]);
+ }
+
+ if(Thread.currentThread().interrupted())
+ {
+ throw new OperationInterruptedException();
+ }
+
+ try
+ {
+ return get();
+ }
+ catch(InterruptedException ex)
+ {
+ throw new OperationInterruptedException();
+ }
+ catch(java.util.concurrent.ExecutionException ee)
+ {
+ try
+ {
+ throw ee.getCause();
+ }
+ catch(RuntimeException ex) // Includes LocalException
+ {
+ throw ex;
+ }
+ catch(Throwable ex)
+ {
+ throw new UnknownException(ex);
+ }
+ }
+ }
+
+ @Override
+ protected void __sent()
+ {
+ super.__sent();
+
+ if(!_proxy.ice_isTwoway())
+ {
+ //
+ // For a non-twoway proxy, the invocation is completed after it is sent.
+ //
+ complete(new com.zeroc.Ice.Object.Ice_invokeResult(true, new byte[0]));
+ }
+ }
+
+ @Override
+ public boolean sent()
+ {
+ return sent(!_proxy.ice_isTwoway()); // done = true if not a two-way proxy (no response expected)
+ }
+
+ @Override
+ public int invokeRemote(com.zeroc.Ice.ConnectionI connection, boolean compress, boolean response)
+ throws RetryException
+ {
+ _cachedConnection = connection;
+ return connection.sendAsyncRequest(this, compress, response, 0);
+ }
+
+ @Override
+ public int invokeCollocated(CollocatedRequestHandler handler)
+ {
+ // The stream cannot be cached if the proxy is not a twoway or there is an invocation timeout set.
+ if(!_proxy.ice_isTwoway() || _proxy.__reference().getInvocationTimeout() > 0)
+ {
+ // Disable caching by marking the streams as cached!
+ _state |= StateCachedBuffers;
+ }
+ return handler.invokeAsyncRequest(this, 0, _synchronous);
+ }
+
+ @Override
+ public void abort(com.zeroc.Ice.Exception ex)
+ {
+ if(isBatch())
+ {
+ //
+ // If we didn't finish a batch oneway or datagram request, we
+ // must notify the connection about that we give up ownership
+ // of the batch stream.
+ //
+ _proxy.__getBatchRequestQueue().abortBatchRequest(_os);
+ }
+
+ super.abort(ex);
+ }
+
+ @Override
+ protected void __completed()
+ {
+ super.__completed();
+
+ if(_exception != null)
+ {
+ completeExceptionally(_exception);
+ }
+ else
+ {
+ com.zeroc.Ice.Object.Ice_invokeResult r = new com.zeroc.Ice.Object.Ice_invokeResult();
+ r.returnValue = (_state & StateOK) > 0;
+ r.outParams = readParamEncaps();
+ complete(r);
+ }
+ }
+
+ @Override
+ public final boolean completed(com.zeroc.Ice.InputStream is)
+ {
+ //
+ // NOTE: this method is called from ConnectionI.parseMessage
+ // with the connection locked. Therefore, it must not invoke
+ // any user callbacks.
+ //
+
+ // _is can already be initialized if the invocation is retried
+ if(_is == null)
+ {
+ _is = new com.zeroc.Ice.InputStream(_instance, Protocol.currentProtocolEncoding);
+ }
+ _is.swap(is);
+
+ return super.completed(_is);
+ }
+
+ private void writeParamEncaps(byte[] encaps)
+ {
+ if(encaps == null || encaps.length == 0)
+ {
+ _os.writeEmptyEncapsulation(_encoding);
+ }
+ else
+ {
+ _os.writeEncapsulation(encaps);
+ }
+ }
+
+ private byte[] readParamEncaps()
+ {
+ return _is.readEncapsulation(null);
+ }
+
+ final private com.zeroc.Ice.EncodingVersion _encoding;
+ private com.zeroc.Ice.InputStream _is;
+
+ private boolean _synchronous; // True if this AMI request is being used for a generated synchronous invocation.
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyOutgoingAsyncBase.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyOutgoingAsyncBase.java
new file mode 100644
index 00000000000..861941470f7
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyOutgoingAsyncBase.java
@@ -0,0 +1,533 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+//
+// Base class for proxy based invocations. This class handles the
+// retry for proxy invocations. It also ensures the child observer is
+// correct notified of failures and make sure the retry task is
+// correctly canceled when the invocation completes.
+//
+public abstract class ProxyOutgoingAsyncBase<T> extends OutgoingAsyncBase<T>
+{
+ public abstract int invokeRemote(com.zeroc.Ice.ConnectionI con, boolean compress, boolean response)
+ throws RetryException;
+
+ public abstract int invokeCollocated(CollocatedRequestHandler handler);
+
+ public boolean isBatch()
+ {
+ return _proxyMode == Reference.ModeBatchOneway || _proxyMode == Reference.ModeBatchDatagram;
+ }
+
+ @Override
+ public com.zeroc.Ice.ObjectPrx getProxy()
+ {
+ return _proxy;
+ }
+
+ @Override
+ public boolean completed(com.zeroc.Ice.InputStream is)
+ {
+ //
+ // NOTE: this method is called from ConnectionI.parseMessage
+ // with the connection locked. Therefore, it must not invoke
+ // any user callbacks.
+ //
+
+ assert(_proxy.ice_isTwoway()); // Can only be called for twoways.
+
+ if(_childObserver != null)
+ {
+ _childObserver.reply(is.size() - Protocol.headerSize - 4);
+ _childObserver.detach();
+ _childObserver = null;
+ }
+
+ byte replyStatus;
+ try
+ {
+ replyStatus = is.readByte();
+
+ switch(replyStatus)
+ {
+ case ReplyStatus.replyOK:
+ {
+ break;
+ }
+
+ case ReplyStatus.replyUserException:
+ {
+ if(_observer != null)
+ {
+ _observer.userException();
+ }
+ break;
+ }
+
+ case ReplyStatus.replyObjectNotExist:
+ case ReplyStatus.replyFacetNotExist:
+ case ReplyStatus.replyOperationNotExist:
+ {
+ com.zeroc.Ice.Identity id = com.zeroc.Ice.Identity.read(is, null);
+
+ //
+ // For compatibility with the old FacetPath.
+ //
+ String[] facetPath = is.readStringSeq();
+ String facet;
+ if(facetPath.length > 0)
+ {
+ if(facetPath.length > 1)
+ {
+ throw new com.zeroc.Ice.MarshalException();
+ }
+ facet = facetPath[0];
+ }
+ else
+ {
+ facet = "";
+ }
+
+ String operation = is.readString();
+
+ com.zeroc.Ice.RequestFailedException ex = null;
+ switch(replyStatus)
+ {
+ case ReplyStatus.replyObjectNotExist:
+ {
+ ex = new com.zeroc.Ice.ObjectNotExistException();
+ break;
+ }
+
+ case ReplyStatus.replyFacetNotExist:
+ {
+ ex = new com.zeroc.Ice.FacetNotExistException();
+ break;
+ }
+
+ case ReplyStatus.replyOperationNotExist:
+ {
+ ex = new com.zeroc.Ice.OperationNotExistException();
+ break;
+ }
+
+ default:
+ {
+ assert(false);
+ break;
+ }
+ }
+
+ ex.id = id;
+ ex.facet = facet;
+ ex.operation = operation;
+ throw ex;
+ }
+
+ case ReplyStatus.replyUnknownException:
+ case ReplyStatus.replyUnknownLocalException:
+ case ReplyStatus.replyUnknownUserException:
+ {
+ String unknown = is.readString();
+
+ com.zeroc.Ice.UnknownException ex = null;
+ switch(replyStatus)
+ {
+ case ReplyStatus.replyUnknownException:
+ {
+ ex = new com.zeroc.Ice.UnknownException();
+ break;
+ }
+
+ case ReplyStatus.replyUnknownLocalException:
+ {
+ ex = new com.zeroc.Ice.UnknownLocalException();
+ break;
+ }
+
+ case ReplyStatus.replyUnknownUserException:
+ {
+ ex = new com.zeroc.Ice.UnknownUserException();
+ break;
+ }
+
+ default:
+ {
+ assert(false);
+ break;
+ }
+ }
+
+ ex.unknown = unknown;
+ throw ex;
+ }
+
+ default:
+ {
+ throw new com.zeroc.Ice.UnknownReplyStatusException();
+ }
+ }
+
+ return finished(replyStatus == ReplyStatus.replyOK);
+ }
+ catch(com.zeroc.Ice.Exception ex)
+ {
+ return completed(ex);
+ }
+ }
+
+ @Override
+ public boolean completed(com.zeroc.Ice.Exception exc)
+ {
+ if(_childObserver != null)
+ {
+ _childObserver.failed(exc.ice_id());
+ _childObserver.detach();
+ _childObserver = null;
+ }
+
+ //
+ // NOTE: at this point, synchronization isn't needed, no other threads should be
+ // calling on the callback.
+ //
+ try
+ {
+ //
+ // It's important to let the retry queue do the retry even if
+ // the retry interval is 0. This method can be called with the
+ // connection locked so we can't just retry here.
+ //
+ _instance.retryQueue().add(this, handleException(exc));
+ return false;
+ }
+ catch(com.zeroc.Ice.Exception ex)
+ {
+ return finished(ex); // No retries, we're done
+ }
+ }
+
+ public void retryException(com.zeroc.Ice.Exception ex)
+ {
+ try
+ {
+ //
+ // It's important to let the retry queue do the retry. This is
+ // called from the connect request handler and the retry might
+ // require could end up waiting for the flush of the
+ // connection to be done.
+ //
+ _proxy.__updateRequestHandler(_handler, null); // Clear request handler and always retry.
+ _instance.retryQueue().add(this, 0);
+ }
+ catch(com.zeroc.Ice.Exception exc)
+ {
+ if(completed(exc))
+ {
+ invokeCompletedAsync();
+ }
+ }
+ }
+
+ public void retry()
+ {
+ invokeImpl(false);
+ }
+
+ public void cancelable(final CancellationHandler handler)
+ {
+ if(_proxy.__reference().getInvocationTimeout() == -2 && _cachedConnection != null)
+ {
+ final int timeout = _cachedConnection.timeout();
+ if(timeout > 0)
+ {
+ _timerFuture = _instance.timer().schedule(
+ new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ cancel(new com.zeroc.Ice.ConnectionTimeoutException());
+ }
+ }, timeout, java.util.concurrent.TimeUnit.MILLISECONDS);
+ }
+ }
+ super.cancelable(handler);
+ }
+
+ public void abort(com.zeroc.Ice.Exception ex)
+ {
+ assert(_childObserver == null);
+ if(finished(ex))
+ {
+ invokeCompletedAsync();
+ }
+ else if(ex instanceof com.zeroc.Ice.CommunicatorDestroyedException)
+ {
+ //
+ // If it's a communicator destroyed exception, don't swallow
+ // it but instead notify the user thread. Even if no callback
+ // was provided.
+ //
+ throw ex;
+ }
+ }
+
+ protected ProxyOutgoingAsyncBase(com.zeroc.Ice._ObjectPrxI prx, String op)
+ {
+ super(prx.ice_getCommunicator(), prx.__reference().getInstance(), op);
+ _proxy = prx;
+ _mode = com.zeroc.Ice.OperationMode.Normal;
+ _cnt = 0;
+ _sent = false;
+ _proxyMode = _proxy.__reference().getMode();
+ }
+
+ protected ProxyOutgoingAsyncBase(com.zeroc.Ice._ObjectPrxI prx, String op, com.zeroc.Ice.OutputStream os)
+ {
+ super(prx.ice_getCommunicator(), prx.__reference().getInstance(), op, os);
+ _proxy = prx;
+ _mode = com.zeroc.Ice.OperationMode.Normal;
+ _cnt = 0;
+ _sent = false;
+ _proxyMode = _proxy.__reference().getMode();
+ }
+
+ @Override
+ protected boolean __needCallback()
+ {
+ return !isBatch();
+ }
+
+ protected void invokeImpl(boolean userThread)
+ {
+ try
+ {
+ if(userThread)
+ {
+ int invocationTimeout = _proxy.__reference().getInvocationTimeout();
+ if(invocationTimeout > 0)
+ {
+ _timerFuture = _instance.timer().schedule(
+ new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ cancel(new com.zeroc.Ice.InvocationTimeoutException());
+ }
+ }, invocationTimeout, java.util.concurrent.TimeUnit.MILLISECONDS);
+ }
+ }
+ else // If not called from the user thread, it's called from the retry queue
+ {
+ if(_observer != null)
+ {
+ _observer.retried();
+ }
+ }
+
+ while(true)
+ {
+ try
+ {
+ _sent = false;
+ _handler = null;
+ _handler = _proxy.__getRequestHandler();
+ int status = _handler.sendAsyncRequest(this);
+ if((status & AsyncStatus.Sent) > 0)
+ {
+ if(userThread)
+ {
+ _sentSynchronously = true;
+ if((status & AsyncStatus.InvokeSentCallback) > 0)
+ {
+ invokeSent(); // Call the sent callback from the user thread.
+ }
+ }
+ else
+ {
+ if((status & AsyncStatus.InvokeSentCallback) > 0)
+ {
+ invokeSentAsync(); // Call the sent callback from a client thread pool thread.
+ }
+ }
+ }
+ return; // We're done!
+ }
+ catch(RetryException ex)
+ {
+ _proxy.__updateRequestHandler(_handler, null); // Clear request handler and always retry.
+ }
+ catch(com.zeroc.Ice.Exception ex)
+ {
+ if(_childObserver != null)
+ {
+ _childObserver.failed(ex.ice_id());
+ _childObserver.detach();
+ _childObserver = null;
+ }
+ final int interval = handleException(ex);
+ if(interval > 0)
+ {
+ _instance.retryQueue().add(this, interval);
+ return;
+ }
+ else if(_observer != null)
+ {
+ _observer.retried();
+ }
+ }
+ }
+ }
+ catch(com.zeroc.Ice.Exception ex)
+ {
+ //
+ // If called from the user thread we re-throw, the exception
+ // will be catch by the caller and abort() will be called.
+ //
+ if(userThread)
+ {
+ throw ex;
+ }
+ else if(finished(ex)) // No retries, we're done
+ {
+ invokeCompletedAsync();
+ }
+ }
+ }
+
+ @Override
+ protected boolean sent(boolean done)
+ {
+ _sent = true;
+ if(done)
+ {
+ if(_timerFuture != null)
+ {
+ _timerFuture.cancel(false);
+ _timerFuture = null;
+ }
+ }
+ return super.sent(done);
+ }
+
+ @Override
+ protected boolean finished(com.zeroc.Ice.Exception ex)
+ {
+ if(_timerFuture != null)
+ {
+ _timerFuture.cancel(false);
+ _timerFuture = null;
+ }
+ return super.finished(ex);
+ }
+
+ @Override
+ protected boolean finished(boolean ok)
+ {
+ if(_timerFuture != null)
+ {
+ _timerFuture.cancel(false);
+ _timerFuture = null;
+ }
+ return super.finished(ok);
+ }
+
+ protected int handleException(com.zeroc.Ice.Exception exc)
+ {
+ Holder<Integer> interval = new Holder<>();
+ _cnt = _proxy.__handleException(exc, _handler, _mode, _sent, interval, _cnt);
+ return interval.value;
+ }
+
+ protected void prepare(java.util.Map<String, String> ctx)
+ {
+ Protocol.checkSupportedProtocol(Protocol.getCompatibleProtocol(_proxy.__reference().getProtocol()));
+
+ _observer = ObserverHelper.get(_proxy, _operation, ctx == null ? _emptyContext : ctx);
+
+ switch(_proxyMode)
+ {
+ case Reference.ModeTwoway:
+ case Reference.ModeOneway:
+ case Reference.ModeDatagram:
+ {
+ _os.writeBlob(Protocol.requestHdr);
+ break;
+ }
+
+ case Reference.ModeBatchOneway:
+ case Reference.ModeBatchDatagram:
+ {
+ _proxy.__getBatchRequestQueue().prepareBatchRequest(_os);
+ break;
+ }
+ }
+
+ Reference ref = _proxy.__reference();
+
+ ref.getIdentity().ice_write(_os);
+
+ //
+ // For compatibility with the old FacetPath.
+ //
+ String facet = ref.getFacet();
+ if(facet == null || facet.length() == 0)
+ {
+ _os.writeStringSeq(null);
+ }
+ else
+ {
+ String[] facetPath = { facet };
+ _os.writeStringSeq(facetPath);
+ }
+
+ _os.writeString(_operation);
+
+ _os.writeByte((byte)_mode.value());
+
+ if(ctx != com.zeroc.Ice.ObjectPrx.noExplicitContext)
+ {
+ //
+ // Explicit context
+ //
+ com.zeroc.Ice.ContextHelper.write(_os, ctx);
+ }
+ else
+ {
+ //
+ // Implicit context
+ //
+ com.zeroc.Ice.ImplicitContextI implicitContext = ref.getInstance().getImplicitContext();
+ java.util.Map<String, String> prxContext = ref.getContext();
+
+ if(implicitContext == null)
+ {
+ com.zeroc.Ice.ContextHelper.write(_os, prxContext);
+ }
+ else
+ {
+ implicitContext.write(prxContext, _os);
+ }
+ }
+ }
+
+ final protected com.zeroc.Ice._ObjectPrxI _proxy;
+ protected RequestHandler _handler;
+ protected com.zeroc.Ice.OperationMode _mode;
+ protected int _proxyMode;
+
+ private java.util.concurrent.Future<?> _timerFuture;
+ private int _cnt;
+ private boolean _sent;
+
+ private static final java.util.Map<String, String> _emptyContext = new java.util.HashMap<>();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/QueueExecutorService.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/QueueExecutorService.java
new file mode 100644
index 00000000000..2524df636d5
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/QueueExecutorService.java
@@ -0,0 +1,118 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Callable;
+import java.util.concurrent.Future;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.RejectedExecutionException;
+
+public final class QueueExecutorService
+{
+ QueueExecutorService(ExecutorService executor)
+ {
+ _executor = executor;
+ _thread = executeNoThrow(new Callable<Thread>()
+ {
+ @Override
+ public Thread call()
+ {
+ return Thread.currentThread();
+ }
+ });
+ }
+
+ public <T> T executeNoThrow(Callable<T> callable)
+ {
+ try
+ {
+ return execute(callable);
+ }
+ catch(RetryException ex)
+ {
+ assert(false);
+ return null;
+ }
+ }
+
+ public <T> T execute(Callable<T> callable)
+ throws RetryException
+ {
+ if(_thread == Thread.currentThread())
+ {
+ try
+ {
+ return callable.call();
+ }
+ catch(RuntimeException ex)
+ {
+ throw ex;
+ }
+ catch(Exception ex)
+ {
+ // RetryException is the only checked exception that
+ // can be raised by Ice internals.
+ assert(ex instanceof RetryException);
+ throw (RetryException)ex;
+ }
+ }
+
+ boolean interrupted = false;
+ try
+ {
+ Future<T> future = _executor.submit(callable);
+ while(true)
+ {
+ try
+ {
+ T value = future.get();
+ return value;
+ }
+ catch(InterruptedException ex)
+ {
+ interrupted = true;
+ }
+ }
+ }
+ catch(RejectedExecutionException e)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+ catch(ExecutionException e)
+ {
+ try
+ {
+ throw e.getCause();
+ }
+ catch(RuntimeException ex)
+ {
+ throw ex;
+ }
+ catch(Throwable ex)
+ {
+ // RetryException is the only checked exception that
+ // can be raised by Ice internals.
+ assert(ex instanceof RetryException);
+ throw (RetryException)ex;
+ }
+ }
+ finally
+ {
+ if(interrupted)
+ {
+ Thread.currentThread().interrupt();
+ }
+ }
+ }
+
+ final ExecutorService _executor;
+ final Thread _thread;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/QueueRequestHandler.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/QueueRequestHandler.java
new file mode 100644
index 00000000000..df255eee76f
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/QueueRequestHandler.java
@@ -0,0 +1,96 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import java.util.concurrent.Callable;
+
+import com.zeroc.Ice.ConnectionI;
+
+public class QueueRequestHandler implements RequestHandler
+{
+ public
+ QueueRequestHandler(Instance instance, RequestHandler delegate)
+ {
+ _executor = instance.getQueueExecutor();
+ assert(delegate != null);
+ _delegate = delegate;
+ }
+
+ @Override
+ public RequestHandler
+ update(RequestHandler previousHandler, RequestHandler newHandler)
+ {
+ //
+ // Only update to new handler if the previous handler matches this one.
+ //
+ try
+ {
+ if(previousHandler == this || previousHandler == _delegate)
+ {
+ return newHandler;
+ }
+ else if(previousHandler.getConnection() == _delegate.getConnection())
+ {
+ return newHandler;
+ }
+ }
+ catch(com.zeroc.Ice.Exception ex)
+ {
+ // Ignore
+ }
+ return this;
+ }
+
+ @Override
+ public int
+ sendAsyncRequest(final ProxyOutgoingAsyncBase out) throws RetryException
+ {
+ return _executor.execute(new Callable<Integer>()
+ {
+ @Override
+ public Integer call() throws RetryException
+ {
+ return _delegate.sendAsyncRequest(out);
+ }
+ });
+ }
+
+ @Override
+ public void
+ asyncRequestCanceled(final OutgoingAsyncBase outAsync, final com.zeroc.Ice.LocalException ex)
+ {
+ _executor.executeNoThrow(new Callable<Void>()
+ {
+ @Override
+ public Void call()
+ {
+ _delegate.asyncRequestCanceled(outAsync, ex);
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public Reference
+ getReference()
+ {
+ return _delegate.getReference();
+ }
+
+ @Override
+ public ConnectionI
+ getConnection()
+ {
+ return _delegate.getConnection();
+ }
+
+ private final RequestHandler _delegate;
+ private final QueueExecutorService _executor;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReadyCallback.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReadyCallback.java
new file mode 100644
index 00000000000..8c8185b5b8a
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReadyCallback.java
@@ -0,0 +1,15 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public interface ReadyCallback
+{
+ void ready(int op, boolean value);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Reference.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Reference.java
new file mode 100644
index 00000000000..e8420c9c6f7
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Reference.java
@@ -0,0 +1,547 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public abstract class Reference implements Cloneable
+{
+ public final static int ModeTwoway = 0;
+ public final static int ModeOneway = 1;
+ public final static int ModeBatchOneway = 2;
+ public final static int ModeDatagram = 3;
+ public final static int ModeBatchDatagram = 4;
+ public final static int ModeLast = ModeBatchDatagram;
+
+ public interface GetConnectionCallback
+ {
+ void setConnection(com.zeroc.Ice.ConnectionI connection, boolean compress);
+ void setException(com.zeroc.Ice.LocalException ex);
+ }
+
+ public final int
+ getMode()
+ {
+ return _mode;
+ }
+
+ public final boolean
+ getSecure()
+ {
+ return _secure;
+ }
+
+ public final com.zeroc.Ice.ProtocolVersion
+ getProtocol()
+ {
+ return _protocol;
+ }
+
+ public final com.zeroc.Ice.EncodingVersion
+ getEncoding()
+ {
+ return _encoding;
+ }
+
+ public final com.zeroc.Ice.Identity
+ getIdentity()
+ {
+ return _identity;
+ }
+
+ public final String
+ getFacet()
+ {
+ return _facet;
+ }
+
+ public final Instance
+ getInstance()
+ {
+ return _instance;
+ }
+
+ public final java.util.Map<String, String>
+ getContext()
+ {
+ return _context;
+ }
+
+ public int
+ getInvocationTimeout()
+ {
+ return _invocationTimeout;
+ }
+
+ public final com.zeroc.Ice.Communicator
+ getCommunicator()
+ {
+ return _communicator;
+ }
+
+ public abstract EndpointI[] getEndpoints();
+ public abstract String getAdapterId();
+ public abstract RouterInfo getRouterInfo();
+ public abstract LocatorInfo getLocatorInfo();
+ public abstract boolean getCollocationOptimized();
+ public abstract boolean getCacheConnection();
+ public abstract boolean getPreferSecure();
+ public abstract com.zeroc.Ice.EndpointSelectionType getEndpointSelection();
+ public abstract int getLocatorCacheTimeout();
+ public abstract String getConnectionId();
+
+ //
+ // The change* methods (here and in derived classes) create
+ // a new reference based on the existing one, with the
+ // corresponding value changed.
+ //
+ public final Reference
+ changeContext(java.util.Map<String, String> newContext)
+ {
+ if(newContext == null)
+ {
+ newContext = _emptyContext;
+ }
+ Reference r = _instance.referenceFactory().copy(this);
+ if(newContext.isEmpty())
+ {
+ r._context = _emptyContext;
+ }
+ else
+ {
+ r._context = new java.util.HashMap<>(newContext);
+ }
+ return r;
+ }
+
+ public final Reference
+ changeMode(int newMode)
+ {
+ if(newMode == _mode)
+ {
+ return this;
+ }
+ Reference r = _instance.referenceFactory().copy(this);
+ r._mode = newMode;
+ return r;
+ }
+
+ public Reference
+ changeSecure(boolean newSecure)
+ {
+ if(newSecure == _secure)
+ {
+ return this;
+ }
+ Reference r = _instance.referenceFactory().copy(this);
+ r._secure = newSecure;
+ return r;
+ }
+
+ public final Reference
+ changeIdentity(com.zeroc.Ice.Identity newIdentity)
+ {
+ if(newIdentity.equals(_identity))
+ {
+ return this;
+ }
+ Reference r = _instance.referenceFactory().copy(this);
+ r._identity = newIdentity.clone();
+ return r;
+ }
+
+ public final Reference
+ changeFacet(String newFacet)
+ {
+ if(newFacet.equals(_facet))
+ {
+ return this;
+ }
+ Reference r = _instance.referenceFactory().copy(this);
+ r._facet = newFacet;
+ return r;
+ }
+
+ public final Reference
+ changeInvocationTimeout(int newTimeout)
+ {
+ if(newTimeout == _invocationTimeout)
+ {
+ return this;
+ }
+ Reference r = _instance.referenceFactory().copy(this);
+ r._invocationTimeout = newTimeout;
+ return r;
+ }
+
+ public Reference
+ changeEncoding(com.zeroc.Ice.EncodingVersion newEncoding)
+ {
+ if(newEncoding.equals(_encoding))
+ {
+ return this;
+ }
+ Reference r = _instance.referenceFactory().copy(this);
+ r._encoding = newEncoding;
+ return r;
+ }
+
+ public Reference
+ changeCompress(boolean newCompress)
+ {
+ if(_overrideCompress && _compress == newCompress)
+ {
+ return this;
+ }
+ Reference r = _instance.referenceFactory().copy(this);
+ r._compress = newCompress;
+ r._overrideCompress = true;
+ return r;
+ }
+
+ public abstract Reference changeAdapterId(String newAdapterId);
+ public abstract Reference changeEndpoints(EndpointI[] newEndpoints);
+ public abstract Reference changeLocator(com.zeroc.Ice.LocatorPrx newLocator);
+ public abstract Reference changeRouter(com.zeroc.Ice.RouterPrx newRouter);
+ public abstract Reference changeCollocationOptimized(boolean newCollocationOptimized);
+ public abstract Reference changeCacheConnection(boolean newCache);
+ public abstract Reference changePreferSecure(boolean newPreferSecure);
+ public abstract Reference changeEndpointSelection(com.zeroc.Ice.EndpointSelectionType newType);
+ public abstract Reference changeLocatorCacheTimeout(int newTimeout);
+
+ public abstract Reference changeTimeout(int newTimeout);
+ public abstract Reference changeConnectionId(String connectionId);
+
+ @Override
+ public synchronized int
+ hashCode()
+ {
+ if(_hashInitialized)
+ {
+ return _hashValue;
+ }
+
+ int h = 5381;
+ h = HashUtil.hashAdd(h, _mode);
+ h = HashUtil.hashAdd(h, _secure);
+ h = HashUtil.hashAdd(h, _identity);
+ h = HashUtil.hashAdd(h, _context);
+ h = HashUtil.hashAdd(h, _facet);
+ h = HashUtil.hashAdd(h, _overrideCompress);
+ if(_overrideCompress)
+ {
+ h = HashUtil.hashAdd(h, _compress);
+ }
+ h = HashUtil.hashAdd(h, _protocol);
+ h = HashUtil.hashAdd(h, _encoding);
+ h = HashUtil.hashAdd(h, _invocationTimeout);
+
+ _hashValue = h;
+ _hashInitialized = true;
+
+ return _hashValue;
+ }
+
+ //
+ // Utility methods
+ //
+ public abstract boolean isIndirect();
+ public abstract boolean isWellKnown();
+
+ //
+ // Marshal the reference.
+ //
+ public void
+ streamWrite(com.zeroc.Ice.OutputStream s)
+ {
+ //
+ // Don't write the identity here. Operations calling streamWrite
+ // write the identity.
+ //
+
+ //
+ // For compatibility with the old FacetPath.
+ //
+ if(_facet.length() == 0)
+ {
+ s.writeStringSeq(null);
+ }
+ else
+ {
+ String[] facetPath = { _facet };
+ s.writeStringSeq(facetPath);
+ }
+
+ s.writeByte((byte)_mode);
+
+ s.writeBool(_secure);
+
+ if(!s.getEncoding().equals(com.zeroc.Ice.Util.Encoding_1_0))
+ {
+ _protocol.ice_write(s);
+ _encoding.ice_write(s);
+ }
+
+ // Derived class writes the remainder of the reference.
+ }
+
+ //
+ // Convert the reference to its string form.
+ //
+ @Override
+ public String
+ toString()
+ {
+ //
+ // WARNING: Certain features, such as proxy validation in Glacier2,
+ // depend on the format of proxy strings. Changes to toString() and
+ // methods called to generate parts of the reference string could break
+ // these features. Please review for all features that depend on the
+ // format of proxyToString() before changing this and related code.
+ //
+ StringBuilder s = new StringBuilder(128);
+
+ //
+ // If the encoded identity string contains characters which
+ // the reference parser uses as separators, then we enclose
+ // the identity string in quotes.
+ //
+ String id = com.zeroc.Ice.Util.identityToString(_identity);
+ if(com.zeroc.IceUtilInternal.StringUtil.findFirstOf(id, " :@") != -1)
+ {
+ s.append('"');
+ s.append(id);
+ s.append('"');
+ }
+ else
+ {
+ s.append(id);
+ }
+
+ if(_facet.length() > 0)
+ {
+ //
+ // If the encoded facet string contains characters which
+ // the reference parser uses as separators, then we enclose
+ // the facet string in quotes.
+ //
+ s.append(" -f ");
+ String fs = com.zeroc.IceUtilInternal.StringUtil.escapeString(_facet, "");
+ if(com.zeroc.IceUtilInternal.StringUtil.findFirstOf(fs, " :@") != -1)
+ {
+ s.append('"');
+ s.append(fs);
+ s.append('"');
+ }
+ else
+ {
+ s.append(fs);
+ }
+ }
+
+ switch(_mode)
+ {
+ case ModeTwoway:
+ {
+ s.append(" -t");
+ break;
+ }
+
+ case ModeOneway:
+ {
+ s.append(" -o");
+ break;
+ }
+
+ case ModeBatchOneway:
+ {
+ s.append(" -O");
+ break;
+ }
+
+ case ModeDatagram:
+ {
+ s.append(" -d");
+ break;
+ }
+
+ case ModeBatchDatagram:
+ {
+ s.append(" -D");
+ break;
+ }
+ }
+
+ if(_secure)
+ {
+ s.append(" -s");
+ }
+
+ if(!_protocol.equals(com.zeroc.Ice.Util.Protocol_1_0))
+ {
+ //
+ // We only print the protocol if it's not 1.0. It's fine as
+ // long as we don't add Ice.Default.ProtocolVersion, a
+ // stringified proxy will convert back to the same proxy with
+ // stringToProxy.
+ //
+ s.append(" -p ");
+ s.append(com.zeroc.Ice.Util.protocolVersionToString(_protocol));
+ }
+
+ //
+ // Always print the encoding version to ensure a stringified proxy
+ // will convert back to a proxy with the same encoding with
+ // stringToProxy (and won't use Ice.Default.EncodingVersion).
+ //
+ s.append(" -e ");
+ s.append(com.zeroc.Ice.Util.encodingVersionToString(_encoding));
+
+ return s.toString();
+
+ // Derived class writes the remainder of the string.
+ }
+
+ //
+ // Convert the reference to its property form.
+ //
+ public abstract java.util.Map<String, String> toProperty(String prefix);
+
+ public abstract RequestHandler getRequestHandler(com.zeroc.Ice._ObjectPrxI proxy);
+
+ public abstract BatchRequestQueue getBatchRequestQueue();
+
+ @Override
+ public boolean
+ equals(java.lang.Object obj)
+ {
+ //
+ // Note: if(this == obj) and type test are performed by each non-abstract derived class.
+ //
+
+ Reference r = (Reference)obj; // Guaranteed to succeed.
+
+ if(_mode != r._mode)
+ {
+ return false;
+ }
+
+ if(_secure != r._secure)
+ {
+ return false;
+ }
+
+ if(!_identity.equals(r._identity))
+ {
+ return false;
+ }
+
+ if(!_context.equals(r._context))
+ {
+ return false;
+ }
+
+ if(!_facet.equals(r._facet))
+ {
+ return false;
+ }
+
+ if(_overrideCompress != r._overrideCompress)
+ {
+ return false;
+ }
+ if(_overrideCompress && _compress != r._compress)
+ {
+ return false;
+ }
+
+ if(!_protocol.equals(r._protocol))
+ {
+ return false;
+ }
+
+ if(!_encoding.equals(r._encoding))
+ {
+ return false;
+ }
+
+ if(_invocationTimeout != r._invocationTimeout)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public Reference clone()
+ {
+ Reference c = null;
+ try
+ {
+ c = (Reference)super.clone();
+ }
+ catch(CloneNotSupportedException ex)
+ {
+ assert false;
+ }
+ return c;
+ }
+
+ protected int _hashValue;
+ protected boolean _hashInitialized;
+ private static java.util.Map<String, String> _emptyContext = new java.util.HashMap<>();
+
+ final private Instance _instance;
+ final private com.zeroc.Ice.Communicator _communicator;
+
+ private int _mode;
+ private boolean _secure;
+ private com.zeroc.Ice.Identity _identity;
+ private java.util.Map<String, String> _context;
+ private String _facet;
+ private com.zeroc.Ice.ProtocolVersion _protocol;
+ private com.zeroc.Ice.EncodingVersion _encoding;
+ private int _invocationTimeout;
+ protected boolean _overrideCompress;
+ protected boolean _compress; // Only used if _overrideCompress == true
+
+ protected
+ Reference(Instance instance,
+ com.zeroc.Ice.Communicator communicator,
+ com.zeroc.Ice.Identity identity,
+ String facet,
+ int mode,
+ boolean secure,
+ com.zeroc.Ice.ProtocolVersion protocol,
+ com.zeroc.Ice.EncodingVersion encoding,
+ int invocationTimeout,
+ java.util.Map<String, String> context)
+ {
+ //
+ // Validate string arguments.
+ //
+ assert(identity.name != null);
+ assert(identity.category != null);
+ assert(facet != null);
+
+ _instance = instance;
+ _communicator = communicator;
+ _mode = mode;
+ _secure = secure;
+ _identity = identity;
+ _context = context != null ? new java.util.HashMap<>(context) : _emptyContext;
+ _facet = facet;
+ _protocol = protocol;
+ _encoding = encoding;
+ _invocationTimeout = invocationTimeout;
+ _hashInitialized = false;
+ _overrideCompress = false;
+ _compress = false;
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReferenceFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReferenceFactory.java
new file mode 100644
index 00000000000..3a89782f1be
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReferenceFactory.java
@@ -0,0 +1,920 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import com.zeroc.Ice.ProxyParseException;
+import com.zeroc.IceUtilInternal.StringUtil;
+
+public final class ReferenceFactory
+{
+ public Reference
+ create(com.zeroc.Ice.Identity ident, String facet, Reference tmpl, EndpointI[] endpoints)
+ {
+ if(ident.name.length() == 0 && ident.category.length() == 0)
+ {
+ return null;
+ }
+
+ return create(ident, facet, tmpl.getMode(), tmpl.getSecure(), tmpl.getProtocol(), tmpl.getEncoding(),
+ endpoints, null, null);
+ }
+
+ public Reference
+ create(com.zeroc.Ice.Identity ident, String facet, Reference tmpl, String adapterId)
+ {
+ if(ident.name.length() == 0 && ident.category.length() == 0)
+ {
+ return null;
+ }
+
+ return create(ident, facet, tmpl.getMode(), tmpl.getSecure(), tmpl.getProtocol(), tmpl.getEncoding(), null,
+ adapterId, null);
+ }
+
+ public Reference
+ create(com.zeroc.Ice.Identity ident, com.zeroc.Ice.ConnectionI fixedConnection)
+ {
+ if(ident.name.length() == 0 && ident.category.length() == 0)
+ {
+ return null;
+ }
+
+ //
+ // Create new reference
+ //
+ return new FixedReference(
+ _instance,
+ _communicator,
+ ident,
+ "", // Facet
+ fixedConnection.endpoint().datagram() ? Reference.ModeDatagram : Reference.ModeTwoway,
+ fixedConnection.endpoint().secure(),
+ _instance.defaultsAndOverrides().defaultEncoding,
+ fixedConnection);
+ }
+
+ public Reference
+ copy(Reference r)
+ {
+ com.zeroc.Ice.Identity ident = r.getIdentity();
+ if(ident.name.length() == 0 && ident.category.length() == 0)
+ {
+ return null;
+ }
+ return r.clone();
+ }
+
+ public Reference
+ create(String s, String propertyPrefix)
+ {
+ if(s == null || s.length() == 0)
+ {
+ return null;
+ }
+
+ final String delim = " \t\n\r";
+
+ int beg;
+ int end = 0;
+
+ beg = StringUtil.findFirstNotOf(s, delim, end);
+ if(beg == -1)
+ {
+ ProxyParseException e = new ProxyParseException();
+ e.str = "no non-whitespace characters found in `" + s + "'";
+ throw e;
+ }
+
+ //
+ // Extract the identity, which may be enclosed in single
+ // or double quotation marks.
+ //
+ String idstr = null;
+ end = StringUtil.checkQuote(s, beg);
+ if(end == -1)
+ {
+ ProxyParseException e = new ProxyParseException();
+ e.str = "mismatched quotes around identity in `" + s + "'";
+ throw e;
+ }
+ else if(end == 0)
+ {
+ end = StringUtil.findFirstOf(s, delim + ":@", beg);
+ if(end == -1)
+ {
+ end = s.length();
+ }
+ idstr = s.substring(beg, end);
+ }
+ else
+ {
+ beg++; // Skip leading quote
+ idstr = s.substring(beg, end);
+ end++; // Skip trailing quote
+ }
+
+ if(beg == end)
+ {
+ ProxyParseException e = new ProxyParseException();
+ e.str = "no identity in `" + s + "'";
+ throw e;
+ }
+
+ //
+ // Parsing the identity may raise IdentityParseException.
+ //
+ com.zeroc.Ice.Identity ident = com.zeroc.Ice.Util.stringToIdentity(idstr);
+
+ if(ident.name.length() == 0)
+ {
+ //
+ // An identity with an empty name and a non-empty
+ // category is illegal.
+ //
+ if(ident.category.length() > 0)
+ {
+ com.zeroc.Ice.IllegalIdentityException e = new com.zeroc.Ice.IllegalIdentityException();
+ e.id = ident;
+ throw e;
+ }
+ //
+ // Treat a stringified proxy containing two double
+ // quotes ("") the same as an empty string, i.e.,
+ // a null proxy, but only if nothing follows the
+ // quotes.
+ //
+ else if(StringUtil.findFirstNotOf(s, delim, end) != -1)
+ {
+ ProxyParseException e = new ProxyParseException();
+ e.str = "invalid characters after identity in `" + s + "'";
+ throw e;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ String facet = "";
+ int mode = Reference.ModeTwoway;
+ boolean secure = false;
+ com.zeroc.Ice.EncodingVersion encoding = _instance.defaultsAndOverrides().defaultEncoding;
+ com.zeroc.Ice.ProtocolVersion protocol = com.zeroc.Ice.Util.Protocol_1_0;
+ String adapter = "";
+
+ while(true)
+ {
+ beg = StringUtil.findFirstNotOf(s, delim, end);
+ if(beg == -1)
+ {
+ break;
+ }
+
+ if(s.charAt(beg) == ':' || s.charAt(beg) == '@')
+ {
+ break;
+ }
+
+ end = StringUtil.findFirstOf(s, delim + ":@", beg);
+ if(end == -1)
+ {
+ end = s.length();
+ }
+
+ if(beg == end)
+ {
+ break;
+ }
+
+ String option = s.substring(beg, end);
+ if(option.length() != 2 || option.charAt(0) != '-')
+ {
+ ProxyParseException e = new ProxyParseException();
+ e.str = "expected a proxy option but found `" + option + "' in `" + s + "'";
+ throw e;
+ }
+
+ //
+ // Check for the presence of an option argument. The
+ // argument may be enclosed in single or double
+ // quotation marks.
+ //
+ String argument = null;
+ int argumentBeg = StringUtil.findFirstNotOf(s, delim, end);
+ if(argumentBeg != -1)
+ {
+ final char ch = s.charAt(argumentBeg);
+ if(ch != '@' && ch != ':' && ch != '-')
+ {
+ beg = argumentBeg;
+ end = StringUtil.checkQuote(s, beg);
+ if(end == -1)
+ {
+ ProxyParseException e = new ProxyParseException();
+ e.str = "mismatched quotes around value for " + option + " option in `" + s + "'";
+ throw e;
+ }
+ else if(end == 0)
+ {
+ end = StringUtil.findFirstOf(s, delim + ":@", beg);
+ if(end == -1)
+ {
+ end = s.length();
+ }
+ argument = s.substring(beg, end);
+ }
+ else
+ {
+ beg++; // Skip leading quote
+ argument = s.substring(beg, end);
+ end++; // Skip trailing quote
+ }
+ }
+ }
+
+ //
+ // If any new options are added here,
+ // IceInternal::Reference::toString() and its derived classes must be updated as well.
+ //
+ switch(option.charAt(1))
+ {
+ case 'f':
+ {
+ if(argument == null)
+ {
+ ProxyParseException e = new ProxyParseException();
+ e.str = "no argument provided for -f option in `" + s + "'";
+ throw e;
+ }
+
+ try
+ {
+ facet = StringUtil.unescapeString(argument, 0, argument.length());
+ }
+ catch(IllegalArgumentException ex)
+ {
+ ProxyParseException e = new ProxyParseException();
+ e.str = "invalid facet in `" + s + "': " + ex.getMessage();
+ throw e;
+ }
+
+ break;
+ }
+
+ case 't':
+ {
+ if(argument != null)
+ {
+ ProxyParseException e = new ProxyParseException();
+ e.str = "unexpected argument `" + argument + "' provided for -t option in `" + s + "'";
+ throw e;
+ }
+ mode = Reference.ModeTwoway;
+ break;
+ }
+
+ case 'o':
+ {
+ if(argument != null)
+ {
+ ProxyParseException e = new ProxyParseException();
+ e.str = "unexpected argument `" + argument + "' provided for -o option in `" + s + "'";
+ throw e;
+ }
+ mode = Reference.ModeOneway;
+ break;
+ }
+
+ case 'O':
+ {
+ if(argument != null)
+ {
+ ProxyParseException e = new ProxyParseException();
+ e.str = "unexpected argument `" + argument + "' provided for -O option in `" + s + "'";
+ throw e;
+ }
+ mode = Reference.ModeBatchOneway;
+ break;
+ }
+
+ case 'd':
+ {
+ if(argument != null)
+ {
+ ProxyParseException e = new ProxyParseException();
+ e.str = "unexpected argument `" + argument + "' provided for -d option in `" + s + "'";
+ throw e;
+ }
+ mode = Reference.ModeDatagram;
+ break;
+ }
+
+ case 'D':
+ {
+ if(argument != null)
+ {
+ ProxyParseException e = new ProxyParseException();
+ e.str = "unexpected argument `" + argument + "' provided for -D option in `" + s + "'";
+ throw e;
+ }
+ mode = Reference.ModeBatchDatagram;
+ break;
+ }
+
+ case 's':
+ {
+ if(argument != null)
+ {
+ ProxyParseException e = new ProxyParseException();
+ e.str = "unexpected argument `" + argument + "' provided for -s option in `" + s + "'";
+ throw e;
+ }
+ secure = true;
+ break;
+ }
+
+ case 'e':
+ {
+ if(argument == null)
+ {
+ throw new ProxyParseException("no argument provided for -e option in `" + s + "'");
+ }
+
+ try
+ {
+ encoding = com.zeroc.Ice.Util.stringToEncodingVersion(argument);
+ }
+ catch(com.zeroc.Ice.VersionParseException e)
+ {
+ throw new ProxyParseException("invalid encoding version `" + argument + "' in `" + s +
+ "':\n" + e.str);
+ }
+ break;
+ }
+
+ case 'p':
+ {
+ if(argument == null)
+ {
+ throw new ProxyParseException("no argument provided for -p option in `" + s + "'");
+ }
+
+ try
+ {
+ protocol = com.zeroc.Ice.Util.stringToProtocolVersion(argument);
+ }
+ catch(com.zeroc.Ice.VersionParseException e)
+ {
+ throw new ProxyParseException("invalid protocol version `" + argument + "' in `" + s +
+ "':\n" + e.str);
+ }
+ break;
+ }
+
+ default:
+ {
+ ProxyParseException e = new ProxyParseException();
+ e.str = "unknown option `" + option + "' in `" + s + "'";
+ throw e;
+ }
+ }
+ }
+
+ if(beg == -1)
+ {
+ return create(ident, facet, mode, secure, protocol, encoding, null, null, propertyPrefix);
+ }
+
+ java.util.ArrayList<EndpointI> endpoints = new java.util.ArrayList<>();
+
+ if(s.charAt(beg) == ':')
+ {
+ java.util.ArrayList<String> unknownEndpoints = new java.util.ArrayList<>();
+ end = beg;
+
+ while(end < s.length() && s.charAt(end) == ':')
+ {
+ beg = end + 1;
+
+ end = beg;
+ while(true)
+ {
+ end = s.indexOf(':', end);
+ if(end == -1)
+ {
+ end = s.length();
+ break;
+ }
+ else
+ {
+ boolean quoted = false;
+ int quote = beg;
+ while(true)
+ {
+ quote = s.indexOf('\"', quote);
+ if(quote == -1 || end < quote)
+ {
+ break;
+ }
+ else
+ {
+ quote = s.indexOf('\"', ++quote);
+ if(quote == -1)
+ {
+ break;
+ }
+ else if(end < quote)
+ {
+ quoted = true;
+ break;
+ }
+ ++quote;
+ }
+ }
+ if(!quoted)
+ {
+ break;
+ }
+ ++end;
+ }
+ }
+
+ String es = s.substring(beg, end);
+ EndpointI endp = _instance.endpointFactoryManager().create(es, false);
+ if(endp != null)
+ {
+ endpoints.add(endp);
+ }
+ else
+ {
+ unknownEndpoints.add(es);
+ }
+ }
+ if(endpoints.size() == 0)
+ {
+ assert(!unknownEndpoints.isEmpty());
+ com.zeroc.Ice.EndpointParseException e = new com.zeroc.Ice.EndpointParseException();
+ e.str = "invalid endpoint `" + unknownEndpoints.get(0) + "' in `" + s + "'";
+ throw e;
+ }
+ else if(unknownEndpoints.size() != 0 &&
+ _instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Endpoints", 1) > 0)
+ {
+ StringBuffer msg = new StringBuffer("Proxy contains unknown endpoints:");
+ for(String e : unknownEndpoints)
+ {
+ msg.append(" `");
+ msg.append(e);
+ msg.append("'");
+ }
+ _instance.initializationData().logger.warning(msg.toString());
+ }
+
+ EndpointI[] endp = new EndpointI[endpoints.size()];
+ endpoints.toArray(endp);
+ return create(ident, facet, mode, secure, protocol, encoding, endp, null, propertyPrefix);
+ }
+ else if(s.charAt(beg) == '@')
+ {
+ beg = StringUtil.findFirstNotOf(s, delim, beg + 1);
+ if(beg == -1)
+ {
+ ProxyParseException e = new ProxyParseException();
+ e.str = "missing adapter id in `" + s + "'";
+ throw e;
+ }
+
+ String adapterstr = null;
+ end = StringUtil.checkQuote(s, beg);
+ if(end == -1)
+ {
+ ProxyParseException e = new ProxyParseException();
+ e.str = "mismatched quotes around adapter id in `" + s + "'";
+ throw e;
+ }
+ else if(end == 0)
+ {
+ end = StringUtil.findFirstOf(s, delim, beg);
+ if(end == -1)
+ {
+ end = s.length();
+ }
+ adapterstr = s.substring(beg, end);
+ }
+ else
+ {
+ beg++; // Skip leading quote
+ adapterstr = s.substring(beg, end);
+ end++; // Skip trailing quote
+ }
+
+ if(end != s.length() && StringUtil.findFirstNotOf(s, delim, end) != -1)
+ {
+ ProxyParseException e = new ProxyParseException();
+ e.str = "invalid trailing characters after `" + s.substring(0, end + 1) + "' in `" + s + "'";
+ throw e;
+ }
+
+ try
+ {
+ adapter = StringUtil.unescapeString(adapterstr, 0, adapterstr.length());
+ }
+ catch(IllegalArgumentException ex)
+ {
+ ProxyParseException e = new ProxyParseException();
+ e.str = "invalid adapter id in `" + s + "': " + ex.getMessage();
+ throw e;
+ }
+ if(adapter.length() == 0)
+ {
+ ProxyParseException e = new ProxyParseException();
+ e.str = "empty adapter id in `" + s + "'";
+ throw e;
+ }
+ return create(ident, facet, mode, secure, protocol, encoding, null, adapter, propertyPrefix);
+ }
+
+ ProxyParseException ex = new ProxyParseException();
+ ex.str = "malformed proxy `" + s + "'";
+ throw ex;
+ }
+
+ public Reference
+ create(com.zeroc.Ice.Identity ident, com.zeroc.Ice.InputStream s)
+ {
+ //
+ // Don't read the identity here. Operations calling this
+ // constructor read the identity, and pass it as a parameter.
+ //
+
+ if(ident.name.length() == 0 && ident.category.length() == 0)
+ {
+ return null;
+ }
+
+ //
+ // For compatibility with the old FacetPath.
+ //
+ String[] facetPath = s.readStringSeq();
+ String facet;
+ if(facetPath.length > 0)
+ {
+ if(facetPath.length > 1)
+ {
+ throw new com.zeroc.Ice.ProxyUnmarshalException();
+ }
+ facet = facetPath[0];
+ }
+ else
+ {
+ facet = "";
+ }
+
+ int mode = s.readByte();
+ if(mode < 0 || mode > Reference.ModeLast)
+ {
+ throw new com.zeroc.Ice.ProxyUnmarshalException();
+ }
+
+ boolean secure = s.readBool();
+
+ com.zeroc.Ice.ProtocolVersion protocol;
+ com.zeroc.Ice.EncodingVersion encoding;
+ if(!s.getEncoding().equals(com.zeroc.Ice.Util.Encoding_1_0))
+ {
+ protocol = com.zeroc.Ice.ProtocolVersion.read(s, null);
+ encoding = com.zeroc.Ice.EncodingVersion.read(s, null);
+ }
+ else
+ {
+ protocol = com.zeroc.Ice.Util.Protocol_1_0;
+ encoding = com.zeroc.Ice.Util.Encoding_1_0;
+ }
+
+ EndpointI[] endpoints = null;
+ String adapterId = null;
+
+ int sz = s.readSize();
+ if(sz > 0)
+ {
+ endpoints = new EndpointI[sz];
+ for(int i = 0; i < sz; i++)
+ {
+ endpoints[i] = _instance.endpointFactoryManager().read(s);
+ }
+ }
+ else
+ {
+ adapterId = s.readString();
+ }
+
+ return create(ident, facet, mode, secure, protocol, encoding, endpoints, adapterId, null);
+ }
+
+ public ReferenceFactory
+ setDefaultRouter(com.zeroc.Ice.RouterPrx defaultRouter)
+ {
+ if(_defaultRouter == null ? defaultRouter == null : _defaultRouter.equals(defaultRouter))
+ {
+ return this;
+ }
+
+ ReferenceFactory factory = new ReferenceFactory(_instance, _communicator);
+ factory._defaultLocator = _defaultLocator;
+ factory._defaultRouter = defaultRouter;
+ return factory;
+ }
+
+ public com.zeroc.Ice.RouterPrx
+ getDefaultRouter()
+ {
+ return _defaultRouter;
+ }
+
+ public ReferenceFactory
+ setDefaultLocator(com.zeroc.Ice.LocatorPrx defaultLocator)
+ {
+ if(_defaultLocator == null ? defaultLocator == null : _defaultLocator.equals(defaultLocator))
+ {
+ return this;
+ }
+
+ ReferenceFactory factory = new ReferenceFactory(_instance, _communicator);
+ factory._defaultRouter = _defaultRouter;
+ factory._defaultLocator = defaultLocator;
+ return factory;
+ }
+
+ public com.zeroc.Ice.LocatorPrx
+ getDefaultLocator()
+ {
+ return _defaultLocator;
+ }
+
+ //
+ // Only for use by Instance
+ //
+ ReferenceFactory(Instance instance, com.zeroc.Ice.Communicator communicator)
+ {
+ _instance = instance;
+ _communicator = communicator;
+ }
+
+ static private String[] _suffixes =
+ {
+ "EndpointSelection",
+ "ConnectionCached",
+ "PreferSecure",
+ "LocatorCacheTimeout",
+ "InvocationTimeout",
+ "Locator",
+ "Router",
+ "CollocationOptimized",
+ "Context\\..*"
+ };
+
+ private void
+ checkForUnknownProperties(String prefix)
+ {
+ //
+ // Do not warn about unknown properties if Ice prefix, ie Ice, Glacier2, etc
+ //
+ for(int i = 0; PropertyNames.clPropNames[i] != null; ++i)
+ {
+ if(prefix.startsWith(PropertyNames.clPropNames[i] + "."))
+ {
+ return;
+ }
+ }
+
+ java.util.ArrayList<String> unknownProps = new java.util.ArrayList<>();
+ java.util.Map<String, String> props =
+ _instance.initializationData().properties.getPropertiesForPrefix(prefix + ".");
+ for(java.util.Map.Entry<String, String> p : props.entrySet())
+ {
+ String prop = p.getKey();
+
+ boolean valid = false;
+ for(String suffix : _suffixes)
+ {
+ String pattern = java.util.regex.Pattern.quote(prefix + ".") + suffix;
+ if(java.util.regex.Pattern.compile(pattern).matcher(prop).matches())
+ {
+ valid = true;
+ break;
+ }
+ }
+
+ if(!valid)
+ {
+ unknownProps.add(prop);
+ }
+ }
+
+ if(unknownProps.size() != 0)
+ {
+ StringBuffer message = new StringBuffer("found unknown properties for proxy '");
+ message.append(prefix);
+ message.append("':");
+ for(String s : unknownProps)
+ {
+ message.append("\n ");
+ message.append(s);
+ }
+ _instance.initializationData().logger.warning(message.toString());
+ }
+ }
+
+ private Reference
+ create(com.zeroc.Ice.Identity ident, String facet, int mode, boolean secure, com.zeroc.Ice.ProtocolVersion protocol,
+ com.zeroc.Ice.EncodingVersion encoding, EndpointI[] endpoints, String adapterId, String propertyPrefix)
+ {
+ DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
+
+ //
+ // Default local proxy options.
+ //
+ LocatorInfo locatorInfo = null;
+ if(_defaultLocator != null)
+ {
+ if(!((com.zeroc.Ice._ObjectPrxI)_defaultLocator).__reference().getEncoding().equals(encoding))
+ {
+ locatorInfo = _instance.locatorManager().get(
+ (com.zeroc.Ice.LocatorPrx)_defaultLocator.ice_encodingVersion(encoding));
+ }
+ else
+ {
+ locatorInfo = _instance.locatorManager().get(_defaultLocator);
+ }
+ }
+ RouterInfo routerInfo = _instance.routerManager().get(_defaultRouter);
+ boolean collocationOptimized = defaultsAndOverrides.defaultCollocationOptimization;
+ boolean cacheConnection = true;
+ boolean preferSecure = defaultsAndOverrides.defaultPreferSecure;
+ com.zeroc.Ice.EndpointSelectionType endpointSelection = defaultsAndOverrides.defaultEndpointSelection;
+ int locatorCacheTimeout = defaultsAndOverrides.defaultLocatorCacheTimeout;
+ int invocationTimeout = defaultsAndOverrides.defaultInvocationTimeout;
+ java.util.Map<String, String> context = null;
+
+ //
+ // Override the defaults with the proxy properties if a property prefix is defined.
+ //
+ if(propertyPrefix != null && propertyPrefix.length() > 0)
+ {
+ com.zeroc.Ice.Properties properties = _instance.initializationData().properties;
+
+ //
+ // Warn about unknown properties.
+ //
+ if(properties.getPropertyAsIntWithDefault("Ice.Warn.UnknownProperties", 1) > 0)
+ {
+ checkForUnknownProperties(propertyPrefix);
+ }
+
+ String property;
+
+ property = propertyPrefix + ".Locator";
+ com.zeroc.Ice.LocatorPrx locator =
+ com.zeroc.Ice.LocatorPrx.uncheckedCast(_communicator.propertyToProxy(property));
+ if(locator != null)
+ {
+ if(!((com.zeroc.Ice._ObjectPrxI)locator).__reference().getEncoding().equals(encoding))
+ {
+ locatorInfo =
+ _instance.locatorManager().get((com.zeroc.Ice.LocatorPrx)locator.ice_encodingVersion(encoding));
+ }
+ else
+ {
+ locatorInfo = _instance.locatorManager().get(locator);
+ }
+ }
+
+ property = propertyPrefix + ".Router";
+ com.zeroc.Ice.RouterPrx router =
+ com.zeroc.Ice.RouterPrx.uncheckedCast(_communicator.propertyToProxy(property));
+ if(router != null)
+ {
+ if(propertyPrefix.endsWith(".Router"))
+ {
+ String s = "`" + property + "=" + properties.getProperty(property) +
+ "': cannot set a router on a router; setting ignored";
+ _instance.initializationData().logger.warning(s);
+ }
+ else
+ {
+ routerInfo = _instance.routerManager().get(router);
+ }
+ }
+
+ property = propertyPrefix + ".CollocationOptimized";
+ collocationOptimized = properties.getPropertyAsIntWithDefault(property, collocationOptimized ? 1 : 0) > 0;
+
+ property = propertyPrefix + ".ConnectionCached";
+ cacheConnection = properties.getPropertyAsIntWithDefault(property, cacheConnection ? 1 : 0) > 0;
+
+ property = propertyPrefix + ".PreferSecure";
+ preferSecure = properties.getPropertyAsIntWithDefault(property, preferSecure ? 1 : 0) > 0;
+
+ property = propertyPrefix + ".EndpointSelection";
+ if(properties.getProperty(property).length() > 0)
+ {
+ String type = properties.getProperty(property);
+ if(type.equals("Random"))
+ {
+ endpointSelection = com.zeroc.Ice.EndpointSelectionType.Random;
+ }
+ else if(type.equals("Ordered"))
+ {
+ endpointSelection = com.zeroc.Ice.EndpointSelectionType.Ordered;
+ }
+ else
+ {
+ throw new com.zeroc.Ice.EndpointSelectionTypeParseException("illegal value `" + type +
+ "'; expected `Random' or `Ordered'");
+ }
+ }
+
+ property = propertyPrefix + ".LocatorCacheTimeout";
+ String value = properties.getProperty(property);
+ if(!value.isEmpty())
+ {
+ locatorCacheTimeout = properties.getPropertyAsIntWithDefault(property, locatorCacheTimeout);
+ if(locatorCacheTimeout < -1)
+ {
+ locatorCacheTimeout = -1;
+
+ StringBuffer msg = new StringBuffer("invalid value for ");
+ msg.append(property);
+ msg.append(" '");
+ msg.append(properties.getProperty(property));
+ msg.append("': defaulting to -1");
+ _instance.initializationData().logger.warning(msg.toString());
+ }
+ }
+
+ property = propertyPrefix + ".InvocationTimeout";
+ value = properties.getProperty(property);
+ if(!value.isEmpty())
+ {
+ invocationTimeout = properties.getPropertyAsIntWithDefault(property, locatorCacheTimeout);
+ if(invocationTimeout < 1 && invocationTimeout != -1)
+ {
+ invocationTimeout = -1;
+
+ StringBuffer msg = new StringBuffer("invalid value for ");
+ msg.append(property);
+ msg.append(" '");
+ msg.append(properties.getProperty(property));
+ msg.append("': defaulting to -1");
+ _instance.initializationData().logger.warning(msg.toString());
+ }
+ }
+
+ property = propertyPrefix + ".Context.";
+ java.util.Map<String, String> contexts = properties.getPropertiesForPrefix(property);
+ if(!contexts.isEmpty())
+ {
+ context = new java.util.HashMap<>();
+ for(java.util.Map.Entry<String, String> e : contexts.entrySet())
+ {
+ context.put(e.getKey().substring(property.length()), e.getValue());
+ }
+ }
+ }
+
+ //
+ // Create new reference
+ //
+ return new RoutableReference(_instance,
+ _communicator,
+ ident,
+ facet,
+ mode,
+ secure,
+ protocol,
+ encoding,
+ endpoints,
+ adapterId,
+ locatorInfo,
+ routerInfo,
+ collocationOptimized,
+ cacheConnection,
+ preferSecure,
+ endpointSelection,
+ locatorCacheTimeout,
+ invocationTimeout,
+ context);
+ }
+
+ final private Instance _instance;
+ final private com.zeroc.Ice.Communicator _communicator;
+ private com.zeroc.Ice.RouterPrx _defaultRouter;
+ private com.zeroc.Ice.LocatorPrx _defaultLocator;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/RemoteObserverI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RemoteObserverI.java
new file mode 100644
index 00000000000..f6a96326ee1
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RemoteObserverI.java
@@ -0,0 +1,33 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class RemoteObserverI
+ extends com.zeroc.IceMX.ObserverWithDelegate<com.zeroc.IceMX.RemoteMetrics,
+ com.zeroc.Ice.Instrumentation.RemoteObserver>
+ implements com.zeroc.Ice.Instrumentation.RemoteObserver
+{
+ @Override
+ public void reply(final int size)
+ {
+ forEach(new MetricsUpdate<com.zeroc.IceMX.RemoteMetrics>()
+ {
+ @Override
+ public void update(com.zeroc.IceMX.RemoteMetrics v)
+ {
+ v.replySize += size;
+ }
+ });
+ if(_delegate != null)
+ {
+ _delegate.reply(size);
+ }
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReplyStatus.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReplyStatus.java
new file mode 100644
index 00000000000..63462113ac9
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReplyStatus.java
@@ -0,0 +1,22 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+interface ReplyStatus
+{
+ static final byte replyOK = 0;
+ static final byte replyUserException = 1;
+ static final byte replyObjectNotExist = 2;
+ static final byte replyFacetNotExist = 3;
+ static final byte replyOperationNotExist = 4;
+ static final byte replyUnknownLocalException = 5;
+ static final byte replyUnknownUserException = 6;
+ static final byte replyUnknownException = 7;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/RequestHandler.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RequestHandler.java
new file mode 100644
index 00000000000..43f3acb0704
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RequestHandler.java
@@ -0,0 +1,22 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public interface RequestHandler extends CancellationHandler
+{
+ RequestHandler update(RequestHandler previousHandler, RequestHandler newHandler);
+
+ int sendAsyncRequest(ProxyOutgoingAsyncBase out)
+ throws RetryException;
+
+ Reference getReference();
+
+ com.zeroc.Ice.ConnectionI getConnection();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/RequestHandlerFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RequestHandlerFactory.java
new file mode 100644
index 00000000000..19b2a85ad9b
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RequestHandlerFactory.java
@@ -0,0 +1,96 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.concurrent.Callable;
+
+public final class RequestHandlerFactory
+{
+ RequestHandlerFactory(Instance instance)
+ {
+ _instance = instance;
+ }
+
+ public RequestHandler
+ getRequestHandler(final RoutableReference ref, com.zeroc.Ice._ObjectPrxI proxy)
+ {
+ if(ref.getCollocationOptimized())
+ {
+ com.zeroc.Ice.ObjectAdapter adapter = _instance.objectAdapterFactory().findObjectAdapter(proxy);
+ if(adapter != null)
+ {
+ return proxy.__setRequestHandler(new CollocatedRequestHandler(ref, adapter));
+ }
+ }
+
+ ConnectRequestHandler handler = null;
+ boolean connect = false;
+ if(ref.getCacheConnection())
+ {
+ synchronized(this)
+ {
+ handler = _handlers.get(ref);
+ if(handler == null)
+ {
+ handler = new ConnectRequestHandler(ref, proxy);
+ _handlers.put(ref, handler);
+ connect = true;
+ }
+ }
+ }
+ else
+ {
+ handler = new ConnectRequestHandler(ref, proxy);
+ connect = true;
+ }
+
+ if(connect)
+ {
+ if(_instance.queueRequests())
+ {
+ final ConnectRequestHandler h = handler;
+ _instance.getQueueExecutor().executeNoThrow(new Callable<Void>()
+ {
+ @Override
+ public Void call()
+ {
+ ref.getConnection(h);
+ return null;
+ }
+ });
+ }
+ else
+ {
+ ref.getConnection(handler);
+ }
+ }
+ return proxy.__setRequestHandler(handler.connect(proxy));
+ }
+
+ void
+ removeRequestHandler(Reference ref, RequestHandler handler)
+ {
+ if(ref.getCacheConnection())
+ {
+ synchronized(this)
+ {
+ if(_handlers.get(ref) == handler)
+ {
+ _handlers.remove(ref);
+ }
+ }
+ }
+ }
+
+ private final Instance _instance;
+ private final Map<Reference, ConnectRequestHandler> _handlers = new HashMap<>();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ResponseHandler.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ResponseHandler.java
new file mode 100644
index 00000000000..0b492b3ce3d
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ResponseHandler.java
@@ -0,0 +1,18 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public interface ResponseHandler
+{
+ void sendResponse(int requestId, com.zeroc.Ice.OutputStream os, byte status, boolean amd);
+ void sendNoResponse();
+ boolean systemException(int requestId, com.zeroc.Ice.SystemException ex, boolean amd);
+ void invokeException(int requestId, com.zeroc.Ice.LocalException ex, int invokeNum, boolean amd);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/RetryException.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RetryException.java
new file mode 100644
index 00000000000..77412c8be73
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RetryException.java
@@ -0,0 +1,27 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class RetryException extends Exception
+{
+ public
+ RetryException(com.zeroc.Ice.LocalException ex)
+ {
+ _ex = ex;
+ }
+
+ public com.zeroc.Ice.LocalException
+ get()
+ {
+ return _ex;
+ }
+
+ private com.zeroc.Ice.LocalException _ex;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/RetryQueue.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RetryQueue.java
new file mode 100644
index 00000000000..5cac12f30d2
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RetryQueue.java
@@ -0,0 +1,84 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class RetryQueue
+{
+ RetryQueue(Instance instance)
+ {
+ _instance = instance;
+ }
+
+ synchronized public void add(ProxyOutgoingAsyncBase outAsync, int interval)
+ {
+ if(_instance == null)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+ RetryTask task = new RetryTask(_instance, this, outAsync);
+ outAsync.cancelable(task); // This will throw if the request is canceled
+ task.setFuture(_instance.timer().schedule(task, interval, java.util.concurrent.TimeUnit.MILLISECONDS));
+ _requests.add(task);
+ }
+
+ synchronized public void destroy()
+ {
+ if(_instance == null)
+ {
+ return; // Already destroyed.
+ }
+
+ java.util.HashSet<RetryTask> keep = new java.util.HashSet<>();
+ for(RetryTask task : _requests)
+ {
+ if(!task.destroy())
+ {
+ keep.add(task);
+ }
+ }
+ _requests = keep;
+ _instance = null;
+
+ //
+ // Wait for the tasks to be executed, it shouldn't take long
+ // since they couldn't be canceled. If interrupted, we
+ // preserve the interrupt.
+ //
+ boolean interrupted = false;
+ while(!_requests.isEmpty())
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ interrupted = true;
+ }
+ }
+ if(interrupted)
+ {
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ synchronized boolean remove(RetryTask task)
+ {
+ boolean removed = _requests.remove(task);
+ if(_instance == null && _requests.isEmpty())
+ {
+ notify();
+ }
+ return removed;
+ }
+
+ private Instance _instance;
+ private java.util.HashSet<RetryTask> _requests = new java.util.HashSet<>();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/RetryTask.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RetryTask.java
new file mode 100644
index 00000000000..426f0a2ebb8
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RetryTask.java
@@ -0,0 +1,80 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+class RetryTask implements Runnable, CancellationHandler
+{
+ RetryTask(Instance instance, RetryQueue queue, ProxyOutgoingAsyncBase outAsync)
+ {
+ _instance = instance;
+ _queue = queue;
+ _outAsync = outAsync;
+ }
+
+ @Override
+ public void run()
+ {
+ _outAsync.retry();
+
+ //
+ // NOTE: this must be called last, destroy() blocks until all task
+ // are removed to prevent the client thread pool to be destroyed
+ // (we still need the client thread pool at this point to call
+ // exception callbacks with CommunicatorDestroyedException).
+ //
+ _queue.remove(this);
+ }
+
+ @Override
+ public void asyncRequestCanceled(OutgoingAsyncBase outAsync, com.zeroc.Ice.LocalException ex)
+ {
+ if(_queue.remove(this) && _future.cancel(false))
+ {
+ if(_instance.traceLevels().retry >= 1)
+ {
+ StringBuilder s = new StringBuilder(128);
+ s.append("operation retry canceled\n");
+ s.append(Ex.toString(ex));
+ _instance.initializationData().logger.trace(_instance.traceLevels().retryCat, s.toString());
+ }
+ if(_outAsync.completed(ex))
+ {
+ _outAsync.invokeCompletedAsync();
+ }
+ }
+ }
+
+ public boolean destroy()
+ {
+ if(_future.cancel(false))
+ {
+ try
+ {
+ _outAsync.abort(new com.zeroc.Ice.CommunicatorDestroyedException());
+ }
+ catch(com.zeroc.Ice.CommunicatorDestroyedException ex)
+ {
+ // Abort can throw if there's no callback, just ignore in this case
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public void setFuture(java.util.concurrent.Future<?> future)
+ {
+ _future = future;
+ }
+
+ private final Instance _instance;
+ private final RetryQueue _queue;
+ private final ProxyOutgoingAsyncBase _outAsync;
+ private java.util.concurrent.Future<?> _future;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/RoutableReference.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RoutableReference.java
new file mode 100644
index 00000000000..968300834d6
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RoutableReference.java
@@ -0,0 +1,974 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class RoutableReference extends Reference
+{
+ @Override
+ public final EndpointI[]
+ getEndpoints()
+ {
+ return _endpoints;
+ }
+
+ @Override
+ public final String
+ getAdapterId()
+ {
+ return _adapterId;
+ }
+
+ @Override
+ public final LocatorInfo
+ getLocatorInfo()
+ {
+ return _locatorInfo;
+ }
+
+ @Override
+ public final RouterInfo
+ getRouterInfo()
+ {
+ return _routerInfo;
+ }
+
+ @Override
+ public final boolean
+ getCollocationOptimized()
+ {
+ return _collocationOptimized;
+ }
+
+ @Override
+ public final boolean
+ getCacheConnection()
+ {
+ return _cacheConnection;
+ }
+
+ @Override
+ public final boolean
+ getPreferSecure()
+ {
+ return _preferSecure;
+ }
+
+ @Override
+ public final com.zeroc.Ice.EndpointSelectionType
+ getEndpointSelection()
+ {
+ return _endpointSelection;
+ }
+
+ @Override
+ public final int
+ getLocatorCacheTimeout()
+ {
+ return _locatorCacheTimeout;
+ }
+
+ @Override
+ public final String
+ getConnectionId()
+ {
+ return _connectionId;
+ }
+
+ @Override
+ public Reference
+ changeEncoding(com.zeroc.Ice.EncodingVersion newEncoding)
+ {
+ RoutableReference r = (RoutableReference)super.changeEncoding(newEncoding);
+ if(r != this)
+ {
+ LocatorInfo locInfo = r._locatorInfo;
+ if(locInfo != null && !locInfo.getLocator().ice_getEncodingVersion().equals(newEncoding))
+ {
+ r._locatorInfo = getInstance().locatorManager().get(
+ (com.zeroc.Ice.LocatorPrx)locInfo.getLocator().ice_encodingVersion(newEncoding));
+ }
+ }
+ return r;
+ }
+
+ @Override
+ public Reference
+ changeCompress(boolean newCompress)
+ {
+ RoutableReference r = (RoutableReference)super.changeCompress(newCompress);
+ if(r != this && _endpoints.length > 0) // Also override the compress flag on the endpoints if it was updated.
+ {
+ EndpointI[] newEndpoints = new EndpointI[_endpoints.length];
+ for(int i = 0; i < _endpoints.length; i++)
+ {
+ newEndpoints[i] = _endpoints[i].compress(newCompress);
+ }
+ r._endpoints = newEndpoints;
+ }
+ return r;
+ }
+
+ @Override
+ public Reference
+ changeEndpoints(EndpointI[] newEndpoints)
+ {
+ if(java.util.Arrays.equals(newEndpoints, _endpoints))
+ {
+ return this;
+ }
+ RoutableReference r = (RoutableReference)getInstance().referenceFactory().copy(this);
+ r._endpoints = newEndpoints;
+ r._adapterId = "";
+ r.applyOverrides(r._endpoints);
+ return r;
+ }
+
+ @Override
+ public Reference
+ changeAdapterId(String newAdapterId)
+ {
+ if(_adapterId.equals(newAdapterId))
+ {
+ return this;
+ }
+ RoutableReference r = (RoutableReference)getInstance().referenceFactory().copy(this);
+ r._adapterId = newAdapterId;
+ r._endpoints = _emptyEndpoints;
+ return r;
+ }
+
+ @Override
+ public Reference
+ changeLocator(com.zeroc.Ice.LocatorPrx newLocator)
+ {
+ LocatorInfo newLocatorInfo = getInstance().locatorManager().get(newLocator);
+ if(newLocatorInfo != null && _locatorInfo != null && newLocatorInfo.equals(_locatorInfo))
+ {
+ return this;
+ }
+ RoutableReference r = (RoutableReference)getInstance().referenceFactory().copy(this);
+ r._locatorInfo = newLocatorInfo;
+ return r;
+ }
+
+ @Override
+ public Reference
+ changeRouter(com.zeroc.Ice.RouterPrx newRouter)
+ {
+ RouterInfo newRouterInfo = getInstance().routerManager().get(newRouter);
+ if(newRouterInfo != null && _routerInfo != null && newRouterInfo.equals(_routerInfo))
+ {
+ return this;
+ }
+ RoutableReference r = (RoutableReference)getInstance().referenceFactory().copy(this);
+ r._routerInfo = newRouterInfo;
+ return r;
+ }
+
+ @Override
+ public Reference
+ changeCollocationOptimized(boolean newCollocationOptimized)
+ {
+ if(newCollocationOptimized == _collocationOptimized)
+ {
+ return this;
+ }
+ RoutableReference r = (RoutableReference)getInstance().referenceFactory().copy(this);
+ r._collocationOptimized = newCollocationOptimized;
+ return r;
+ }
+
+ @Override
+ public final Reference
+ changeCacheConnection(boolean newCache)
+ {
+ if(newCache == _cacheConnection)
+ {
+ return this;
+ }
+ RoutableReference r = (RoutableReference)getInstance().referenceFactory().copy(this);
+ r._cacheConnection = newCache;
+ return r;
+ }
+
+ @Override
+ public Reference
+ changePreferSecure(boolean newPreferSecure)
+ {
+ if(newPreferSecure == _preferSecure)
+ {
+ return this;
+ }
+ RoutableReference r = (RoutableReference)getInstance().referenceFactory().copy(this);
+ r._preferSecure = newPreferSecure;
+ return r;
+ }
+
+ @Override
+ public final Reference
+ changeEndpointSelection(com.zeroc.Ice.EndpointSelectionType newType)
+ {
+ if(newType == _endpointSelection)
+ {
+ return this;
+ }
+ RoutableReference r = (RoutableReference)getInstance().referenceFactory().copy(this);
+ r._endpointSelection = newType;
+ return r;
+ }
+
+ @Override
+ public Reference
+ changeLocatorCacheTimeout(int newTimeout)
+ {
+ if(_locatorCacheTimeout == newTimeout)
+ {
+ return this;
+ }
+ RoutableReference r = (RoutableReference)getInstance().referenceFactory().copy(this);
+ r._locatorCacheTimeout = newTimeout;
+ return r;
+ }
+
+ @Override
+ public Reference
+ changeTimeout(int newTimeout)
+ {
+ if(_overrideTimeout && _timeout == newTimeout)
+ {
+ return this;
+ }
+ RoutableReference r = (RoutableReference)getInstance().referenceFactory().copy(this);
+ r._timeout = newTimeout;
+ r._overrideTimeout = true;
+ if(_endpoints.length > 0)
+ {
+ EndpointI[] newEndpoints = new EndpointI[_endpoints.length];
+ for(int i = 0; i < _endpoints.length; i++)
+ {
+ newEndpoints[i] = _endpoints[i].timeout(newTimeout);
+ }
+ r._endpoints = newEndpoints;
+ }
+ return r;
+ }
+
+ @Override
+ public Reference
+ changeConnectionId(String id)
+ {
+ if(_connectionId.equals(id))
+ {
+ return this;
+ }
+ RoutableReference r = (RoutableReference)getInstance().referenceFactory().copy(this);
+ r._connectionId = id;
+ if(_endpoints.length > 0)
+ {
+ EndpointI[] newEndpoints = new EndpointI[_endpoints.length];
+ for(int i = 0; i < _endpoints.length; i++)
+ {
+ newEndpoints[i] = _endpoints[i].connectionId(id);
+ }
+ r._endpoints = newEndpoints;
+ }
+ return r;
+ }
+
+ @Override
+ public boolean
+ isIndirect()
+ {
+ return _endpoints.length == 0;
+ }
+
+ @Override
+ public boolean
+ isWellKnown()
+ {
+ return _endpoints.length == 0 && _adapterId.length() == 0;
+ }
+
+ @Override
+ public void
+ streamWrite(com.zeroc.Ice.OutputStream s)
+ throws com.zeroc.Ice.MarshalException
+ {
+ super.streamWrite(s);
+
+ s.writeSize(_endpoints.length);
+ if(_endpoints.length > 0)
+ {
+ assert(_adapterId.length() == 0);
+ for(EndpointI endpoint : _endpoints)
+ {
+ s.writeShort(endpoint.type());
+ endpoint.streamWrite(s);
+ }
+ }
+ else
+ {
+ s.writeString(_adapterId); // Adapter id.
+ }
+ }
+
+ @Override
+ public String
+ toString()
+ {
+ //
+ // WARNING: Certain features, such as proxy validation in Glacier2,
+ // depend on the format of proxy strings. Changes to toString() and
+ // methods called to generate parts of the reference string could break
+ // these features. Please review for all features that depend on the
+ // format of proxyToString() before changing this and related code.
+ //
+ StringBuilder s = new StringBuilder(128);
+ s.append(super.toString());
+ if(_endpoints.length > 0)
+ {
+ for(EndpointI endpoint : _endpoints)
+ {
+ String endp = endpoint.toString();
+ if(endp != null && endp.length() > 0)
+ {
+ s.append(':');
+ s.append(endp);
+ }
+ }
+ }
+ else if(_adapterId.length() > 0)
+ {
+ s.append(" @ ");
+
+ //
+ // If the encoded adapter id string contains characters which
+ // the reference parser uses as separators, then we enclose
+ // the adapter id string in quotes.
+ //
+ String a = com.zeroc.IceUtilInternal.StringUtil.escapeString(_adapterId, null);
+ if(com.zeroc.IceUtilInternal.StringUtil.findFirstOf(a, " :@") != -1)
+ {
+ s.append('"');
+ s.append(a);
+ s.append('"');
+ }
+ else
+ {
+ s.append(a);
+ }
+ }
+ return s.toString();
+ }
+
+ @Override
+ public java.util.Map<String, String> toProperty(String prefix)
+ {
+ java.util.Map<String, String> properties = new java.util.HashMap<>();
+
+ properties.put(prefix, toString());
+ properties.put(prefix + ".CollocationOptimized", _collocationOptimized ? "1" : "0");
+ properties.put(prefix + ".ConnectionCached", _cacheConnection ? "1" : "0");
+ properties.put(prefix + ".PreferSecure", _preferSecure ? "1" : "0");
+ properties.put(prefix + ".EndpointSelection",
+ _endpointSelection == com.zeroc.Ice.EndpointSelectionType.Random ? "Random" : "Ordered");
+
+ {
+ StringBuffer s = new StringBuffer();
+ s.append(getInvocationTimeout());
+ properties.put(prefix + ".InvocationTimeout", s.toString());
+ }
+ {
+ StringBuffer s = new StringBuffer();
+ s.append(_locatorCacheTimeout);
+ properties.put(prefix + ".LocatorCacheTimeout", s.toString());
+ }
+
+ if(_routerInfo != null)
+ {
+ com.zeroc.Ice._ObjectPrxI h = (com.zeroc.Ice._ObjectPrxI)_routerInfo.getRouter();
+ java.util.Map<String, String> routerProperties = h.__reference().toProperty(prefix + ".Router");
+ for(java.util.Map.Entry<String, String> p : routerProperties.entrySet())
+ {
+ properties.put(p.getKey(), p.getValue());
+ }
+ }
+
+ if(_locatorInfo != null)
+ {
+ com.zeroc.Ice._ObjectPrxI h = (com.zeroc.Ice._ObjectPrxI)_locatorInfo.getLocator();
+ java.util.Map<String, String> locatorProperties = h.__reference().toProperty(prefix + ".Locator");
+ for(java.util.Map.Entry<String, String> p : locatorProperties.entrySet())
+ {
+ properties.put(p.getKey(), p.getValue());
+ }
+ }
+
+ return properties;
+ }
+
+ @Override
+ public synchronized int
+ hashCode()
+ {
+ if(!_hashInitialized)
+ {
+ super.hashCode(); // Initializes _hashValue.
+ _hashValue = HashUtil.hashAdd(_hashValue, _adapterId);
+ }
+ return _hashValue;
+ }
+
+ @Override
+ public boolean
+ equals(java.lang.Object obj)
+ {
+ if(this == obj)
+ {
+ return true;
+ }
+ if(!(obj instanceof RoutableReference))
+ {
+ return false;
+ }
+
+ if(!super.equals(obj))
+ {
+ return false;
+ }
+ RoutableReference rhs = (RoutableReference)obj; // Guaranteed to succeed.
+ if(_locatorInfo == null ? rhs._locatorInfo != null : !_locatorInfo.equals(rhs._locatorInfo))
+ {
+ return false;
+ }
+ if(_routerInfo == null ? rhs._routerInfo != null : !_routerInfo.equals(rhs._routerInfo))
+ {
+ return false;
+ }
+ if(_collocationOptimized != rhs._collocationOptimized)
+ {
+ return false;
+ }
+ if(_cacheConnection != rhs._cacheConnection)
+ {
+ return false;
+ }
+ if(_preferSecure != rhs._preferSecure)
+ {
+ return false;
+ }
+ if(_endpointSelection != rhs._endpointSelection)
+ {
+ return false;
+ }
+ if(_locatorCacheTimeout != rhs._locatorCacheTimeout)
+ {
+ return false;
+ }
+ if(!_connectionId.equals(rhs._connectionId))
+ {
+ return false;
+ }
+ if(_overrideTimeout != rhs._overrideTimeout)
+ {
+ return false;
+ }
+ if(_overrideTimeout && _timeout != rhs._timeout)
+ {
+ return false;
+ }
+ if(!java.util.Arrays.equals(_endpoints, rhs._endpoints))
+ {
+ return false;
+ }
+ if(!_adapterId.equals(rhs._adapterId))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public RequestHandler
+ getRequestHandler(com.zeroc.Ice._ObjectPrxI proxy)
+ {
+ return getInstance().requestHandlerFactory().getRequestHandler(this, proxy);
+ }
+
+ @Override
+ public BatchRequestQueue
+ getBatchRequestQueue()
+ {
+ return new BatchRequestQueue(getInstance(), getMode() == Reference.ModeBatchDatagram);
+ }
+
+ public void
+ getConnection(final GetConnectionCallback callback)
+ {
+ if(_routerInfo != null)
+ {
+ //
+ // If we route, we send everything to the router's client
+ // proxy endpoints.
+ //
+ _routerInfo.getClientEndpoints(new RouterInfo.GetClientEndpointsCallback()
+ {
+ @Override
+ public void
+ setEndpoints(EndpointI[] endpts)
+ {
+ if(endpts.length > 0)
+ {
+ applyOverrides(endpts);
+ createConnection(endpts, callback);
+ }
+ else
+ {
+ getConnectionNoRouterInfo(callback);
+ }
+ }
+
+ @Override
+ public void
+ setException(com.zeroc.Ice.LocalException ex)
+ {
+ callback.setException(ex);
+ }
+ });
+ }
+ else
+ {
+ getConnectionNoRouterInfo(callback);
+ }
+ }
+
+ public void
+ getConnectionNoRouterInfo(final GetConnectionCallback callback)
+ {
+ if(_endpoints.length > 0)
+ {
+ createConnection(_endpoints, callback);
+ return;
+ }
+
+ final RoutableReference self = this;
+ if(_locatorInfo != null)
+ {
+ _locatorInfo.getEndpoints(this, _locatorCacheTimeout, new LocatorInfo.GetEndpointsCallback()
+ {
+ @Override
+ public void
+ setEndpoints(EndpointI[] endpoints, final boolean cached)
+ {
+ if(endpoints.length == 0)
+ {
+ callback.setException(new com.zeroc.Ice.NoEndpointException(self.toString()));
+ return;
+ }
+
+ applyOverrides(endpoints);
+ createConnection(endpoints, new GetConnectionCallback()
+ {
+ @Override
+ public void
+ setConnection(com.zeroc.Ice.ConnectionI connection, boolean compress)
+ {
+ callback.setConnection(connection, compress);
+ }
+
+ @Override
+ public void
+ setException(com.zeroc.Ice.LocalException exc)
+ {
+ try
+ {
+ throw exc;
+ }
+ catch(com.zeroc.Ice.NoEndpointException ex)
+ {
+ callback.setException(ex); // No need to retry if there's no endpoints.
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ assert(_locatorInfo != null);
+ _locatorInfo.clearCache(self);
+ if(cached)
+ {
+ TraceLevels traceLvls = getInstance().traceLevels();
+ if(traceLvls.retry >= 2)
+ {
+ String s = "connection to cached endpoints failed\n" +
+ "removing endpoints from cache and trying one more time\n" + ex;
+ getInstance().initializationData().logger.trace(traceLvls.retryCat, s);
+ }
+ getConnectionNoRouterInfo(callback); // Retry.
+ return;
+ }
+ callback.setException(ex);
+ }
+ }
+ });
+ }
+
+ @Override
+ public void
+ setException(com.zeroc.Ice.LocalException ex)
+ {
+ callback.setException(ex);
+ }
+ });
+ }
+ else
+ {
+ callback.setException(new com.zeroc.Ice.NoEndpointException(toString()));
+ }
+ }
+
+ protected
+ RoutableReference(Instance instance,
+ com.zeroc.Ice.Communicator communicator,
+ com.zeroc.Ice.Identity identity,
+ String facet,
+ int mode,
+ boolean secure,
+ com.zeroc.Ice.ProtocolVersion protocol,
+ com.zeroc.Ice.EncodingVersion encoding,
+ EndpointI[] endpoints,
+ String adapterId,
+ LocatorInfo locatorInfo,
+ RouterInfo routerInfo,
+ boolean collocationOptimized,
+ boolean cacheConnection,
+ boolean prefereSecure,
+ com.zeroc.Ice.EndpointSelectionType endpointSelection,
+ int locatorCacheTimeout,
+ int invocationTimeout,
+ java.util.Map<String, String> context)
+ {
+ super(instance, communicator, identity, facet, mode, secure, protocol, encoding, invocationTimeout, context);
+ _endpoints = endpoints;
+ _adapterId = adapterId;
+ _locatorInfo = locatorInfo;
+ _routerInfo = routerInfo;
+ _collocationOptimized = collocationOptimized;
+ _cacheConnection = cacheConnection;
+ _preferSecure = prefereSecure;
+ _endpointSelection = endpointSelection;
+ _locatorCacheTimeout = locatorCacheTimeout;
+ _overrideTimeout = false;
+ _timeout = -1;
+
+ if(_endpoints == null)
+ {
+ _endpoints = _emptyEndpoints;
+ }
+ if(_adapterId == null)
+ {
+ _adapterId = "";
+ }
+ assert(_adapterId.length() == 0 || _endpoints.length == 0);
+ }
+
+ protected void
+ applyOverrides(EndpointI[] endpts)
+ {
+ //
+ // Apply the endpoint overrides to each endpoint.
+ //
+ for(int i = 0; i < endpts.length; ++i)
+ {
+ endpts[i] = endpts[i].connectionId(_connectionId);
+ if(_overrideCompress)
+ {
+ endpts[i] = endpts[i].compress(_compress);
+ }
+ if(_overrideTimeout)
+ {
+ endpts[i] = endpts[i].timeout(_timeout);
+ }
+ }
+ }
+
+ private EndpointI[]
+ filterEndpoints(EndpointI[] allEndpoints)
+ {
+ java.util.List<EndpointI> endpoints = new java.util.ArrayList<>();
+
+ //
+ // Filter out opaque endpoints.
+ //
+ for(EndpointI endpoint : allEndpoints)
+ {
+ if(!(endpoint instanceof OpaqueEndpointI))
+ {
+ endpoints.add(endpoint);
+ }
+ }
+
+ //
+ // Filter out endpoints according to the mode of the reference.
+ //
+ switch(getMode())
+ {
+ case Reference.ModeTwoway:
+ case Reference.ModeOneway:
+ case Reference.ModeBatchOneway:
+ {
+ //
+ // Filter out datagram endpoints.
+ //
+ java.util.Iterator<EndpointI> i = endpoints.iterator();
+ while(i.hasNext())
+ {
+ EndpointI endpoint = i.next();
+ if(endpoint.datagram())
+ {
+ i.remove();
+ }
+ }
+ break;
+ }
+
+ case Reference.ModeDatagram:
+ case Reference.ModeBatchDatagram:
+ {
+ //
+ // Filter out non-datagram endpoints.
+ //
+ java.util.Iterator<EndpointI> i = endpoints.iterator();
+ while(i.hasNext())
+ {
+ EndpointI endpoint = i.next();
+ if(!endpoint.datagram())
+ {
+ i.remove();
+ }
+ }
+ break;
+ }
+ }
+
+ //
+ // Sort the endpoints according to the endpoint selection type.
+ //
+ switch(getEndpointSelection())
+ {
+ case Random:
+ {
+ java.util.Collections.shuffle(endpoints);
+ break;
+ }
+ case Ordered:
+ {
+ // Nothing to do.
+ break;
+ }
+ default:
+ {
+ assert(false);
+ break;
+ }
+ }
+
+ //
+ // If a secure connection is requested or secure overrides is
+ // set, remove all non-secure endpoints. Otherwise if preferSecure is set
+ // make secure endpoints prefered. By default make non-secure
+ // endpoints preferred over secure endpoints.
+ //
+ DefaultsAndOverrides overrides = getInstance().defaultsAndOverrides();
+ if(overrides.overrideSecure ? overrides.overrideSecureValue : getSecure())
+ {
+ java.util.Iterator<EndpointI> i = endpoints.iterator();
+ while(i.hasNext())
+ {
+ EndpointI endpoint = i.next();
+ if(!endpoint.secure())
+ {
+ i.remove();
+ }
+ }
+ }
+ else if(getPreferSecure())
+ {
+ java.util.Collections.sort(endpoints, _preferSecureEndpointComparator);
+ }
+ else
+ {
+ java.util.Collections.sort(endpoints, _preferNonSecureEndpointComparator);
+ }
+
+ return endpoints.toArray(new EndpointI[endpoints.size()]);
+ }
+
+ protected void
+ createConnection(EndpointI[] allEndpoints, final GetConnectionCallback callback)
+ {
+ final EndpointI[] endpoints = filterEndpoints(allEndpoints);
+ if(endpoints.length == 0)
+ {
+ callback.setException(new com.zeroc.Ice.NoEndpointException(toString()));
+ return;
+ }
+
+ //
+ // Finally, create the connection.
+ //
+ final OutgoingConnectionFactory factory = getInstance().outgoingConnectionFactory();
+ if(getCacheConnection() || endpoints.length == 1)
+ {
+ //
+ // Get an existing connection or create one if there's no
+ // existing connection to one of the given endpoints.
+ //
+ factory.create(endpoints, false, getEndpointSelection(),
+ new OutgoingConnectionFactory.CreateConnectionCallback()
+ {
+ @Override
+ public void
+ setConnection(com.zeroc.Ice.ConnectionI connection, boolean compress)
+ {
+ //
+ // If we have a router, set the object adapter for this router
+ // (if any) to the new connection, so that callbacks from the
+ // router can be received over this new connection.
+ //
+ if(_routerInfo != null && _routerInfo.getAdapter() != null)
+ {
+ connection.setAdapter(_routerInfo.getAdapter());
+ }
+ callback.setConnection(connection, compress);
+ }
+
+ @Override
+ public void
+ setException(com.zeroc.Ice.LocalException ex)
+ {
+ callback.setException(ex);
+ }
+ });
+ }
+ else
+ {
+ //
+ // Go through the list of endpoints and try to create the
+ // connection until it succeeds. This is different from just
+ // calling create() with the given endpoints since this might
+ // create a new connection even if there's an existing
+ // connection for one of the endpoints.
+ //
+
+ factory.create(new EndpointI[]{ endpoints[0] }, true, getEndpointSelection(),
+ new OutgoingConnectionFactory.CreateConnectionCallback()
+ {
+ @Override
+ public void
+ setConnection(com.zeroc.Ice.ConnectionI connection, boolean compress)
+ {
+ //
+ // If we have a router, set the object adapter for this router
+ // (if any) to the new connection, so that callbacks from the
+ // router can be received over this new connection.
+ //
+ if(_routerInfo != null && _routerInfo.getAdapter() != null)
+ {
+ connection.setAdapter(_routerInfo.getAdapter());
+ }
+ callback.setConnection(connection, compress);
+ }
+
+ @Override
+ public void
+ setException(final com.zeroc.Ice.LocalException ex)
+ {
+ if(_exception == null)
+ {
+ _exception = ex;
+ }
+
+ if(++_i == endpoints.length)
+ {
+ callback.setException(_exception);
+ return;
+ }
+
+ final boolean more = _i != endpoints.length - 1;
+ final EndpointI[] endpoint = new EndpointI[]{ endpoints[_i] };
+ factory.create(endpoint, more, getEndpointSelection(), this);
+ }
+
+ private int _i = 0;
+ private com.zeroc.Ice.LocalException _exception = null;
+ });
+ }
+ }
+
+ static class EndpointComparator implements java.util.Comparator<EndpointI>
+ {
+ EndpointComparator(boolean preferSecure)
+ {
+ _preferSecure = preferSecure;
+ }
+
+ @Override
+ public int
+ compare(EndpointI le, EndpointI re)
+ {
+ boolean ls = le.secure();
+ boolean rs = re.secure();
+ if((ls && rs) || (!ls && !rs))
+ {
+ return 0;
+ }
+ else if(!ls && rs)
+ {
+ if(_preferSecure)
+ {
+ return 1;
+ }
+ else
+ {
+ return -1;
+ }
+ }
+ else
+ {
+ if(_preferSecure)
+ {
+ return -1;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+ }
+
+ private boolean _preferSecure;
+ }
+
+ private static EndpointComparator _preferNonSecureEndpointComparator = new EndpointComparator(false);
+ private static EndpointComparator _preferSecureEndpointComparator = new EndpointComparator(true);
+ private static EndpointI[] _emptyEndpoints = new EndpointI[0];
+
+ private EndpointI[] _endpoints;
+ private String _adapterId;
+ private LocatorInfo _locatorInfo; // Null if no router is used.
+ private RouterInfo _routerInfo; // Null if no router is used.
+ private boolean _collocationOptimized;
+ private boolean _cacheConnection;
+ private boolean _preferSecure;
+ private com.zeroc.Ice.EndpointSelectionType _endpointSelection;
+ private int _locatorCacheTimeout;
+
+ private boolean _overrideTimeout;
+ private int _timeout; // Only used if _overrideTimeout == true
+ private String _connectionId = "";
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/RouterInfo.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RouterInfo.java
new file mode 100644
index 00000000000..e103ead153a
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RouterInfo.java
@@ -0,0 +1,285 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public final class RouterInfo
+{
+ interface GetClientEndpointsCallback
+ {
+ void setEndpoints(EndpointI[] endpoints);
+ void setException(com.zeroc.Ice.LocalException ex);
+ }
+
+ interface AddProxyCallback
+ {
+ void addedProxy();
+ void setException(com.zeroc.Ice.LocalException ex);
+ }
+
+ RouterInfo(com.zeroc.Ice.RouterPrx router)
+ {
+ _router = router;
+
+ assert(_router != null);
+ }
+
+ synchronized public void
+ destroy()
+ {
+ _clientEndpoints = new EndpointI[0];
+ _serverEndpoints = new EndpointI[0];
+ _adapter = null;
+ _identities.clear();
+ }
+
+ @Override
+ public boolean
+ equals(java.lang.Object obj)
+ {
+ if(this == obj)
+ {
+ return true;
+ }
+
+ if(obj instanceof RouterInfo)
+ {
+ return _router.equals(((RouterInfo)obj)._router);
+ }
+
+ return false;
+ }
+
+ @Override
+ public int
+ hashCode()
+ {
+ return _router.hashCode();
+ }
+
+ public com.zeroc.Ice.RouterPrx
+ getRouter()
+ {
+ //
+ // No mutex lock necessary, _router is immutable.
+ //
+ return _router;
+ }
+
+ public EndpointI[]
+ getClientEndpoints()
+ {
+ synchronized(this)
+ {
+ if(_clientEndpoints != null) // Lazy initialization.
+ {
+ return _clientEndpoints;
+ }
+ }
+
+ return setClientEndpoints(_router.getClientProxy());
+ }
+
+ public void
+ getClientEndpoints(final GetClientEndpointsCallback callback)
+ {
+ EndpointI[] clientEndpoints = null;
+ synchronized(this)
+ {
+ clientEndpoints = _clientEndpoints;
+ }
+
+ if(clientEndpoints != null)
+ {
+ callback.setEndpoints(clientEndpoints);
+ return;
+ }
+
+ _router.getClientProxyAsync().whenComplete((com.zeroc.Ice.ObjectPrx clientProxy, Throwable ex) ->
+ {
+ if(ex != null)
+ {
+ if(ex instanceof com.zeroc.Ice.LocalException)
+ {
+ callback.setException((com.zeroc.Ice.LocalException)ex);
+ }
+ else
+ {
+ callback.setException(new com.zeroc.Ice.UnknownException(ex));
+ }
+ }
+ else
+ {
+ callback.setEndpoints(setClientEndpoints(clientProxy));
+ }
+ });
+ }
+
+ public EndpointI[]
+ getServerEndpoints()
+ {
+ synchronized(this)
+ {
+ if(_serverEndpoints != null) // Lazy initialization.
+ {
+ return _serverEndpoints;
+ }
+ }
+
+ return setServerEndpoints(_router.getServerProxy());
+ }
+
+ public boolean
+ addProxy(final com.zeroc.Ice.ObjectPrx proxy, final AddProxyCallback callback)
+ {
+ assert(proxy != null);
+ synchronized(this)
+ {
+ if(_identities.contains(proxy.ice_getIdentity()))
+ {
+ //
+ // Only add the proxy to the router if it's not already in our local map.
+ //
+ return true;
+ }
+ }
+
+ _router.addProxiesAsync(new com.zeroc.Ice.ObjectPrx[] { proxy }).whenComplete(
+ (com.zeroc.Ice.ObjectPrx[] evictedProxies, Throwable ex) ->
+ {
+ if(ex != null)
+ {
+ if(ex instanceof com.zeroc.Ice.LocalException)
+ {
+ callback.setException((com.zeroc.Ice.LocalException)ex);
+ }
+ else
+ {
+ callback.setException(new com.zeroc.Ice.UnknownException(ex));
+ }
+ }
+ else
+ {
+ addAndEvictProxies(proxy, evictedProxies);
+ callback.addedProxy();
+ }
+ });
+
+ return false;
+ }
+
+ public synchronized void
+ setAdapter(com.zeroc.Ice.ObjectAdapter adapter)
+ {
+ _adapter = adapter;
+ }
+
+ public synchronized com.zeroc.Ice.ObjectAdapter
+ getAdapter()
+ {
+ return _adapter;
+ }
+
+ public synchronized void clearCache(Reference ref)
+ {
+ _identities.remove(ref.getIdentity());
+ }
+
+ private synchronized EndpointI[]
+ setClientEndpoints(com.zeroc.Ice.ObjectPrx clientProxy)
+ {
+ if(_clientEndpoints == null)
+ {
+ if(clientProxy == null)
+ {
+ //
+ // If getClientProxy() return nil, use router endpoints.
+ //
+ _clientEndpoints = ((com.zeroc.Ice._ObjectPrxI)_router).__reference().getEndpoints();
+ }
+ else
+ {
+ clientProxy = clientProxy.ice_router(null); // The client proxy cannot be routed.
+
+ //
+ // In order to avoid creating a new connection to the
+ // router, we must use the same timeout as the already
+ // existing connection.
+ //
+ if(_router.ice_getConnection() != null)
+ {
+ clientProxy = clientProxy.ice_timeout(_router.ice_getConnection().timeout());
+ }
+
+ _clientEndpoints = ((com.zeroc.Ice._ObjectPrxI)clientProxy).__reference().getEndpoints();
+ }
+ }
+ return _clientEndpoints;
+ }
+
+ private synchronized EndpointI[]
+ setServerEndpoints(com.zeroc.Ice.ObjectPrx serverProxy)
+ {
+ if(serverProxy == null)
+ {
+ throw new com.zeroc.Ice.NoEndpointException();
+ }
+
+ serverProxy = serverProxy.ice_router(null); // The server proxy cannot be routed.
+ _serverEndpoints = ((com.zeroc.Ice._ObjectPrxI)serverProxy).__reference().getEndpoints();
+ return _serverEndpoints;
+ }
+
+ private synchronized void
+ addAndEvictProxies(com.zeroc.Ice.ObjectPrx proxy, com.zeroc.Ice.ObjectPrx[] evictedProxies)
+ {
+ //
+ // Check if the proxy hasn't already been evicted by a
+ // concurrent addProxies call. If it's the case, don't
+ // add it to our local map.
+ //
+ int index = _evictedIdentities.indexOf(proxy.ice_getIdentity());
+ if(index >= 0)
+ {
+ _evictedIdentities.remove(index);
+ }
+ else
+ {
+ //
+ // If we successfully added the proxy to the router,
+ // we add it to our local map.
+ //
+ _identities.add(proxy.ice_getIdentity());
+ }
+
+ //
+ // We also must remove whatever proxies the router evicted.
+ //
+ for(com.zeroc.Ice.ObjectPrx p : evictedProxies)
+ {
+ if(!_identities.remove(p.ice_getIdentity()))
+ {
+ //
+ // It's possible for the proxy to not have been
+ // added yet in the local map if two threads
+ // concurrently call addProxies.
+ //
+ _evictedIdentities.add(p.ice_getIdentity());
+ }
+ }
+ }
+
+ private final com.zeroc.Ice.RouterPrx _router;
+ private EndpointI[] _clientEndpoints;
+ private EndpointI[] _serverEndpoints;
+ private com.zeroc.Ice.ObjectAdapter _adapter;
+ private java.util.Set<com.zeroc.Ice.Identity> _identities = new java.util.HashSet<com.zeroc.Ice.Identity>();
+ private java.util.List<com.zeroc.Ice.Identity> _evictedIdentities =
+ new java.util.ArrayList<com.zeroc.Ice.Identity>();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/RouterManager.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RouterManager.java
new file mode 100644
index 00000000000..363ba6a454d
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RouterManager.java
@@ -0,0 +1,77 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public final class RouterManager
+{
+ RouterManager()
+ {
+ }
+
+ synchronized void
+ destroy()
+ {
+ for(RouterInfo info : _table.values())
+ {
+ info.destroy();
+ }
+ _table.clear();
+ }
+
+ //
+ // Returns router info for a given router. Automatically creates
+ // the router info if it doesn't exist yet.
+ //
+ public RouterInfo
+ get(com.zeroc.Ice.RouterPrx rtr)
+ {
+ if(rtr == null)
+ {
+ return null;
+ }
+
+ //
+ // The router cannot be routed.
+ //
+ com.zeroc.Ice.RouterPrx router = com.zeroc.Ice.RouterPrx.uncheckedCast(rtr.ice_router(null));
+
+ synchronized(this)
+ {
+ RouterInfo info = _table.get(router);
+ if(info == null)
+ {
+ info = new RouterInfo(router);
+ _table.put(router, info);
+ }
+
+ return info;
+ }
+ }
+
+ public RouterInfo
+ erase(com.zeroc.Ice.RouterPrx rtr)
+ {
+ RouterInfo info = null;
+ if(rtr != null)
+ {
+ // The router cannot be routed.
+ com.zeroc.Ice.RouterPrx router = com.zeroc.Ice.RouterPrx.uncheckedCast(rtr.ice_router(null));
+
+ synchronized(this)
+ {
+ info = _table.remove(router);
+ }
+ }
+ return info;
+ }
+
+ private java.util.HashMap<com.zeroc.Ice.RouterPrx, RouterInfo> _table =
+ new java.util.HashMap<com.zeroc.Ice.RouterPrx, RouterInfo>();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/SOCKSNetworkProxy.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/SOCKSNetworkProxy.java
new file mode 100644
index 00000000000..ce35ab4ee14
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/SOCKSNetworkProxy.java
@@ -0,0 +1,128 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public final class SOCKSNetworkProxy implements NetworkProxy
+{
+ public SOCKSNetworkProxy(String host, int port)
+ {
+ _host = host;
+ _port = port;
+ }
+
+ private SOCKSNetworkProxy(java.net.InetSocketAddress address)
+ {
+ _address = address;
+ }
+
+ @Override
+ public void beginWrite(java.net.InetSocketAddress endpoint, Buffer buf)
+ {
+ final java.net.InetAddress addr = endpoint.getAddress();
+ if(addr == null)
+ {
+ throw new com.zeroc.Ice.FeatureNotSupportedException("SOCKS4 does not support domain names");
+ }
+ else if(!(addr instanceof java.net.Inet4Address))
+ {
+ throw new com.zeroc.Ice.FeatureNotSupportedException("SOCKS4 only supports IPv4 addresses");
+ }
+
+ //
+ // SOCKS connect request
+ //
+ buf.resize(9, false);
+ final java.nio.ByteOrder order = buf.b.order();
+ buf.b.order(java.nio.ByteOrder.BIG_ENDIAN); // Network byte order.
+ buf.b.position(0);
+ buf.b.put((byte)0x04); // SOCKS version 4.
+ buf.b.put((byte)0x01); // Command, establish a TCP/IP stream connection
+ buf.b.putShort((short)endpoint.getPort()); // Port
+ buf.b.put(addr.getAddress()); // IPv4 address
+ buf.b.put((byte)0x00); // User ID.
+ buf.b.position(0);
+ buf.b.limit(buf.size());
+ buf.b.order(order);
+ }
+
+ @Override
+ public int endWrite(Buffer buf)
+ {
+ // Once the request is sent, read the response
+ return buf.b.hasRemaining() ? SocketOperation.Write : SocketOperation.Read;
+ }
+
+ @Override
+ public void beginRead(Buffer buf)
+ {
+ //
+ // Read the SOCKS4 response whose size is 8 bytes.
+ //
+ if(!buf.b.hasRemaining())
+ {
+ buf.resize(8, true);
+ buf.b.position(0);
+ }
+ }
+
+ @Override
+ public int endRead(Buffer buf)
+ {
+ // We're done once we read the response
+ return buf.b.hasRemaining() ? SocketOperation.Read : SocketOperation.None;
+ }
+
+ @Override
+ public void finish(Buffer readBuffer, Buffer writeBuffer)
+ {
+ readBuffer.b.position(0);
+ byte b1 = readBuffer.b.get();
+ byte b2 = readBuffer.b.get();
+ if(b1 != 0x00 || b2 != 0x5a)
+ {
+ throw new com.zeroc.Ice.ConnectFailedException();
+ }
+ }
+
+ @Override
+ public NetworkProxy resolveHost(int protocolSupport)
+ {
+ assert(_host != null);
+ return new SOCKSNetworkProxy(Network.getAddresses(_host,
+ _port,
+ protocolSupport,
+ com.zeroc.Ice.EndpointSelectionType.Random,
+ false,
+ true).get(0));
+ }
+
+ @Override
+ public java.net.InetSocketAddress getAddress()
+ {
+ assert(_address != null); // Host must be resolved.
+ return _address;
+ }
+
+ @Override
+ public String getName()
+ {
+ return "SOCKS";
+ }
+
+ @Override
+ public int getProtocolSupport()
+ {
+ return Network.EnableIPv4;
+ }
+
+ private String _host;
+ private int _port;
+ private java.net.InetSocketAddress _address;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Selector.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Selector.java
new file mode 100644
index 00000000000..a35ddd2a5d5
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Selector.java
@@ -0,0 +1,408 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public final class Selector
+{
+ static final class TimeoutException extends Exception
+ {
+ }
+
+ Selector(Instance instance)
+ {
+ _instance = instance;
+ _selecting = false;
+ _interrupted = false;
+
+ try
+ {
+ _selector = java.nio.channels.Selector.open();
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new com.zeroc.Ice.SyscallException(ex);
+ }
+
+ //
+ // The Selector holds a Set representing the selected keys. The
+ // Set reference doesn't change, so we obtain it once here.
+ //
+ _keys = _selector.selectedKeys();
+ }
+
+ void destroy()
+ {
+ try
+ {
+ _selector.close();
+ }
+ catch(java.io.IOException ex)
+ {
+ }
+ _selector = null;
+ }
+
+ void initialize(EventHandler handler)
+ {
+ if(handler.fd() != null)
+ {
+ updateImpl(handler);
+ }
+ }
+
+ void update(EventHandler handler, int remove, int add)
+ {
+ int previous = handler._registered;
+ handler._registered = handler._registered & ~remove;
+ handler._registered = handler._registered | add;
+ if(previous == handler._registered)
+ {
+ return;
+ }
+
+ if(handler.fd() == null)
+ {
+ return;
+ }
+
+ updateImpl(handler);
+ checkReady(handler);
+ }
+
+ void enable(EventHandler handler, int status)
+ {
+ if(handler.fd() == null || (handler._disabled & status) == 0)
+ {
+ return;
+ }
+ handler._disabled = handler._disabled & ~status;
+
+ if(handler.fd() == null)
+ {
+ return;
+ }
+
+ if(handler._key != null && (handler._registered & status) != 0)
+ {
+ updateImpl(handler); // If registered with the selector, update the registration.
+ }
+ checkReady(handler);
+ }
+
+ void disable(EventHandler handler, int status)
+ {
+ if(handler.fd() == null || (handler._disabled & status) != 0)
+ {
+ return;
+ }
+ handler._disabled = handler._disabled | status;
+
+ if(handler._key != null && (handler._registered & status) != 0)
+ {
+ updateImpl(handler); // If registered with the selector, update the registration.
+ }
+ checkReady(handler);
+ }
+
+ boolean finish(EventHandler handler, boolean closeNow)
+ {
+ handler._registered = 0;
+ if(handler._key != null)
+ {
+ handler._key.cancel();
+ handler._key = null;
+ }
+ _changes.remove(handler);
+ checkReady(handler);
+ return closeNow;
+ }
+
+ void ready(EventHandler handler, int status, boolean value)
+ {
+ if(((handler._ready & status) != 0) == value)
+ {
+ return; // Nothing to do if ready state already correctly set.
+ }
+
+ if(value)
+ {
+ handler._ready |= status;
+ }
+ else
+ {
+ handler._ready &= ~status;
+ }
+ checkReady(handler);
+ }
+
+ void startSelect()
+ {
+ if(!_changes.isEmpty())
+ {
+ updateSelector();
+ }
+ _selecting = true;
+
+ //
+ // If there are ready handlers, don't block in select, just do a non-blocking
+ // select to retrieve new ready handlers from the Java selector.
+ //
+ _selectNow = !_readyHandlers.isEmpty();
+ }
+
+ void finishSelect(java.util.List<EventHandlerOpPair> handlers)
+ {
+ assert(handlers.isEmpty());
+
+ if(_keys.isEmpty() && _readyHandlers.isEmpty() && !_interrupted) // If key set is empty and we weren't woken up.
+ {
+ //
+ // This is necessary to prevent a busy loop in case of a spurious wake-up which
+ // sometime occurs in the client thread pool when the communicator is destroyed.
+ // If there are too many successive spurious wake-ups, we log an error.
+ //
+ try
+ {
+ Thread.sleep(1);
+ }
+ catch(InterruptedException ex)
+ {
+ //
+ // Eat the InterruptedException (as we do in ThreadPool.promoteFollower).
+ //
+ }
+
+ if(++_spuriousWakeUp > 100)
+ {
+ _spuriousWakeUp = 0;
+ _instance.initializationData().logger.warning("spurious selector wake up");
+ }
+ return;
+ }
+ _interrupted = false;
+ _spuriousWakeUp = 0;
+
+ for(java.nio.channels.SelectionKey key : _keys)
+ {
+ EventHandler handler = (EventHandler)key.attachment();
+ try
+ {
+ //
+ // Use the intersection of readyOps and interestOps because we only want to
+ // report the operations in which the handler is still interested.
+ //
+ final int op = fromJavaOps(key.readyOps() & key.interestOps());
+ if(!_readyHandlers.contains(handler)) // Handler will be added by the loop below
+ {
+ handlers.add(new EventHandlerOpPair(handler, op));
+ }
+ }
+ catch(java.nio.channels.CancelledKeyException ex)
+ {
+ assert(handler._registered == 0);
+ }
+ }
+
+ for(EventHandler handler : _readyHandlers)
+ {
+ int op = handler._ready & ~handler._disabled & handler._registered;
+ if(handler._key != null && _keys.contains(handler._key))
+ {
+ op |= fromJavaOps(handler._key.readyOps() & handler._key.interestOps());
+ }
+ if(op > 0)
+ {
+ handlers.add(new EventHandlerOpPair(handler, op));
+ }
+ }
+
+ _keys.clear();
+ _selecting = false;
+ }
+
+ void select(long timeout)
+ throws TimeoutException
+ {
+ while(true)
+ {
+ try
+ {
+ if(_selectNow)
+ {
+ _selector.selectNow();
+ }
+ else if(timeout > 0)
+ {
+ //
+ // NOTE: On some platforms, select() sometime returns slightly before
+ // the timeout (at least according to our monotonic time). To make sure
+ // timeouts are correctly detected, we wait for a little longer than
+ // the configured timeout (10ms).
+ //
+ long before = Time.currentMonotonicTimeMillis();
+ if(_selector.select(timeout * 1000 + 10) == 0)
+ {
+ if(Time.currentMonotonicTimeMillis() - before >= timeout * 1000)
+ {
+ throw new TimeoutException();
+ }
+ }
+ }
+ else
+ {
+ _selector.select();
+ }
+ }
+ catch(java.nio.channels.CancelledKeyException ex)
+ {
+ // This sometime occurs on OS X, ignore.
+ continue;
+ }
+ catch(java.io.IOException ex)
+ {
+ //
+ // Pressing Ctrl-C causes select() to raise an
+ // IOException, which seems like a JDK bug. We trap
+ // for that special case here and ignore it.
+ // Hopefully we're not masking something important!
+ //
+ if(Network.interrupted(ex))
+ {
+ continue;
+ }
+
+ try
+ {
+ String s = "fatal error: selector failed:\n" + ex.getCause().getMessage();
+ _instance.initializationData().logger.error(s);
+ }
+ finally
+ {
+ Runtime.getRuntime().halt(1);
+ }
+ }
+
+ break;
+ }
+ }
+
+ private void updateImpl(EventHandler handler)
+ {
+ _changes.add(handler);
+ wakeup();
+ }
+
+ private void updateSelector()
+ {
+ for(EventHandler handler : _changes)
+ {
+ int status = handler._registered & ~handler._disabled;
+ int ops = toJavaOps(handler, status);
+ if(handler._key == null)
+ {
+ if(handler._registered != 0)
+ {
+ try
+ {
+ handler._key = handler.fd().register(_selector, ops, handler);
+ }
+ catch(java.nio.channels.ClosedChannelException ex)
+ {
+ assert(false);
+ }
+ }
+ }
+ else
+ {
+ handler._key.interestOps(ops);
+ }
+ }
+ _changes.clear();
+ }
+
+ private void checkReady(EventHandler handler)
+ {
+ if((handler._ready & ~handler._disabled & handler._registered) != 0)
+ {
+ _readyHandlers.add(handler);
+ if(_selecting)
+ {
+ wakeup();
+ }
+ }
+ else
+ {
+ _readyHandlers.remove(handler);
+ }
+ }
+
+ private void wakeup()
+ {
+ if(_selecting && !_interrupted)
+ {
+ _selector.wakeup();
+ _interrupted = true;
+ }
+ }
+
+ private int toJavaOps(EventHandler handler, int o)
+ {
+ int op = 0;
+ if((o & SocketOperation.Read) != 0)
+ {
+ if((handler.fd().validOps() & java.nio.channels.SelectionKey.OP_READ) != 0)
+ {
+ op |= java.nio.channels.SelectionKey.OP_READ;
+ }
+ else
+ {
+ op |= java.nio.channels.SelectionKey.OP_ACCEPT;
+ }
+ }
+ if((o & SocketOperation.Write) != 0)
+ {
+ op |= java.nio.channels.SelectionKey.OP_WRITE;
+ }
+ if((o & SocketOperation.Connect) != 0)
+ {
+ op |= java.nio.channels.SelectionKey.OP_CONNECT;
+ }
+ return op;
+ }
+
+ private int fromJavaOps(int o)
+ {
+ int op = 0;
+ if((o & (java.nio.channels.SelectionKey.OP_READ | java.nio.channels.SelectionKey.OP_ACCEPT)) != 0)
+ {
+ op |= SocketOperation.Read;
+ }
+ if((o & java.nio.channels.SelectionKey.OP_WRITE) != 0)
+ {
+ op |= SocketOperation.Write;
+ }
+ if((o & java.nio.channels.SelectionKey.OP_CONNECT) != 0)
+ {
+ op |= SocketOperation.Connect;
+ }
+ return op;
+ }
+
+ final private Instance _instance;
+
+ private java.nio.channels.Selector _selector;
+ private java.util.Set<java.nio.channels.SelectionKey> _keys;
+ private java.util.HashSet<EventHandler> _changes = new java.util.HashSet<>();
+ private java.util.HashSet<EventHandler> _readyHandlers = new java.util.HashSet<>();
+ private boolean _selecting;
+ private boolean _selectNow;
+ private boolean _interrupted;
+ private int _spuriousWakeUp;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/SequencePatcher.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/SequencePatcher.java
new file mode 100644
index 00000000000..22309d162f0
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/SequencePatcher.java
@@ -0,0 +1,39 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class SequencePatcher<T> implements com.zeroc.Ice.ReadValueCallback
+{
+ public SequencePatcher(T[] seq, Class<T> cls, String type, int index)
+ {
+ _seq = seq;
+ _cls = cls;
+ _type = type;
+ _index = index;
+ }
+
+ public void valueReady(com.zeroc.Ice.Value v)
+ {
+ if(v == null || _cls.isInstance(v))
+ {
+ _seq[_index] = _cls.cast(v);
+ }
+ else
+ {
+ Ex.throwUOE(_type, v);
+ }
+
+ }
+
+ private T[] _seq;
+ private Class<T> _cls;
+ private String _type;
+ private int _index;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ServantError.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ServantError.java
new file mode 100644
index 00000000000..998059bee4b
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ServantError.java
@@ -0,0 +1,28 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+final public class ServantError extends java.lang.Error
+{
+ public ServantError(String reason)
+ {
+ super(reason);
+ }
+
+ public ServantError(String reason, Throwable cause)
+ {
+ super(reason, cause);
+ }
+
+ public ServantError(Throwable cause)
+ {
+ super(cause);
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ServantManager.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ServantManager.java
new file mode 100644
index 00000000000..d83dfb8e141
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ServantManager.java
@@ -0,0 +1,325 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public final class ServantManager
+{
+ public synchronized void
+ addServant(com.zeroc.Ice.Object servant, com.zeroc.Ice.Identity ident, String facet)
+ {
+ assert(_instance != null); // Must not be called after destruction.
+
+ if(facet == null)
+ {
+ facet = "";
+ }
+
+ java.util.Map<String, com.zeroc.Ice.Object> m = _servantMapMap.get(ident);
+ if(m == null)
+ {
+ m = new java.util.HashMap<String, com.zeroc.Ice.Object>();
+ _servantMapMap.put(ident, m);
+ }
+ else
+ {
+ if(m.containsKey(facet))
+ {
+ com.zeroc.Ice.AlreadyRegisteredException ex = new com.zeroc.Ice.AlreadyRegisteredException();
+ ex.id = com.zeroc.Ice.Util.identityToString(ident);
+ ex.kindOfObject = "servant";
+ if(facet.length() > 0)
+ {
+ ex.id += " -f " + com.zeroc.IceUtilInternal.StringUtil.escapeString(facet, "");
+ }
+ throw ex;
+ }
+ }
+
+ m.put(facet, servant);
+ }
+
+ public synchronized void
+ addDefaultServant(com.zeroc.Ice.Object servant, String category)
+ {
+ assert(_instance != null); // Must not be called after destruction
+
+ com.zeroc.Ice.Object obj = _defaultServantMap.get(category);
+ if(obj != null)
+ {
+ com.zeroc.Ice.AlreadyRegisteredException ex = new com.zeroc.Ice.AlreadyRegisteredException();
+ ex.kindOfObject = "default servant";
+ ex.id = category;
+ throw ex;
+ }
+
+ _defaultServantMap.put(category, servant);
+ }
+
+ public synchronized com.zeroc.Ice.Object
+ removeServant(com.zeroc.Ice.Identity ident, String facet)
+ {
+ assert(_instance != null); // Must not be called after destruction.
+
+ if(facet == null)
+ {
+ facet = "";
+ }
+
+ java.util.Map<String, com.zeroc.Ice.Object> m = _servantMapMap.get(ident);
+ com.zeroc.Ice.Object obj = null;
+ if(m == null || (obj = m.remove(facet)) == null)
+ {
+ com.zeroc.Ice.NotRegisteredException ex = new com.zeroc.Ice.NotRegisteredException();
+ ex.id = com.zeroc.Ice.Util.identityToString(ident);
+ ex.kindOfObject = "servant";
+ if(facet.length() > 0)
+ {
+ ex.id += " -f " + com.zeroc.IceUtilInternal.StringUtil.escapeString(facet, "");
+ }
+ throw ex;
+ }
+
+ if(m.isEmpty())
+ {
+ _servantMapMap.remove(ident);
+ }
+ return obj;
+ }
+
+ public synchronized com.zeroc.Ice.Object
+ removeDefaultServant(String category)
+ {
+ assert(_instance != null); // Must not be called after destruction.
+
+ com.zeroc.Ice.Object obj = _defaultServantMap.get(category);
+ if(obj == null)
+ {
+ com.zeroc.Ice.NotRegisteredException ex = new com.zeroc.Ice.NotRegisteredException();
+ ex.kindOfObject = "default servant";
+ ex.id = category;
+ throw ex;
+ }
+
+ _defaultServantMap.remove(category);
+ return obj;
+ }
+
+ public synchronized java.util.Map<String, com.zeroc.Ice.Object>
+ removeAllFacets(com.zeroc.Ice.Identity ident)
+ {
+ assert(_instance != null); // Must not be called after destruction.
+
+ java.util.Map<String, com.zeroc.Ice.Object> m = _servantMapMap.get(ident);
+ if(m == null)
+ {
+ com.zeroc.Ice.NotRegisteredException ex = new com.zeroc.Ice.NotRegisteredException();
+ ex.id = com.zeroc.Ice.Util.identityToString(ident);
+ ex.kindOfObject = "servant";
+ throw ex;
+ }
+
+ _servantMapMap.remove(ident);
+
+ return m;
+ }
+
+ public synchronized com.zeroc.Ice.Object
+ findServant(com.zeroc.Ice.Identity ident, String facet)
+ {
+ //
+ // This assert is not valid if the adapter dispatch incoming
+ // requests from bidir connections. This method might be called if
+ // requests are received over the bidir connection after the
+ // adapter was deactivated.
+ //
+ //assert(_instance != null); // Must not be called after destruction.
+
+ if(facet == null)
+ {
+ facet = "";
+ }
+
+ java.util.Map<String, com.zeroc.Ice.Object> m = _servantMapMap.get(ident);
+ com.zeroc.Ice.Object obj = null;
+ if(m == null)
+ {
+ obj = _defaultServantMap.get(ident.category);
+ if(obj == null)
+ {
+ obj = _defaultServantMap.get("");
+ }
+ }
+ else
+ {
+ obj = m.get(facet);
+ }
+
+ return obj;
+ }
+
+ public synchronized com.zeroc.Ice.Object
+ findDefaultServant(String category)
+ {
+ assert(_instance != null); // Must not be called after destruction.
+
+ return _defaultServantMap.get(category);
+ }
+
+ public synchronized java.util.Map<String, com.zeroc.Ice.Object>
+ findAllFacets(com.zeroc.Ice.Identity ident)
+ {
+ assert(_instance != null); // Must not be called after destruction.
+
+ java.util.Map<String, com.zeroc.Ice.Object> m = _servantMapMap.get(ident);
+ if(m != null)
+ {
+ return new java.util.HashMap<String, com.zeroc.Ice.Object>(m);
+ }
+
+ return new java.util.HashMap<String, com.zeroc.Ice.Object>();
+ }
+
+ public synchronized boolean
+ hasServant(com.zeroc.Ice.Identity ident)
+ {
+ //
+ // This assert is not valid if the adapter dispatch incoming
+ // requests from bidir connections. This method might be called if
+ // requests are received over the bidir connection after the
+ // adapter was deactivated.
+ //
+ //assert(_instance != null); // Must not be called after destruction.
+
+ java.util.Map<String, com.zeroc.Ice.Object> m = _servantMapMap.get(ident);
+ if(m == null)
+ {
+ return false;
+ }
+ else
+ {
+ assert(!m.isEmpty());
+ return true;
+ }
+ }
+
+ public synchronized void
+ addServantLocator(com.zeroc.Ice.ServantLocator locator, String category)
+ {
+ assert(_instance != null); // Must not be called after destruction.
+
+ com.zeroc.Ice.ServantLocator l = _locatorMap.get(category);
+ if(l != null)
+ {
+ com.zeroc.Ice.AlreadyRegisteredException ex = new com.zeroc.Ice.AlreadyRegisteredException();
+ ex.id = com.zeroc.IceUtilInternal.StringUtil.escapeString(category, "");
+ ex.kindOfObject = "servant locator";
+ throw ex;
+ }
+
+ _locatorMap.put(category, locator);
+ }
+
+ public synchronized com.zeroc.Ice.ServantLocator
+ removeServantLocator(String category)
+ {
+ com.zeroc.Ice.ServantLocator l = null;
+ assert(_instance != null); // Must not be called after destruction.
+
+ l = _locatorMap.remove(category);
+ if(l == null)
+ {
+ com.zeroc.Ice.NotRegisteredException ex = new com.zeroc.Ice.NotRegisteredException();
+ ex.id = com.zeroc.IceUtilInternal.StringUtil.escapeString(category, "");
+ ex.kindOfObject = "servant locator";
+ throw ex;
+ }
+ return l;
+ }
+
+ public synchronized com.zeroc.Ice.ServantLocator
+ findServantLocator(String category)
+ {
+ //
+ // This assert is not valid if the adapter dispatch incoming
+ // requests from bidir connections. This method might be called if
+ // requests are received over the bidir connection after the
+ // adapter was deactivated.
+ //
+ //assert(_instance != null); // Must not be called after destruction.
+
+ return _locatorMap.get(category);
+ }
+
+ //
+ // Only for use by com.zeroc.Ice.ObjectAdatperI.
+ //
+ public
+ ServantManager(Instance instance, String adapterName)
+ {
+ _instance = instance;
+ _adapterName = adapterName;
+ }
+
+ //
+ // Only for use by com.zeroc.Ice.ObjectAdapterI.
+ //
+ public void
+ destroy()
+ {
+ java.util.Map<String, com.zeroc.Ice.ServantLocator> locatorMap =
+ new java.util.HashMap<String, com.zeroc.Ice.ServantLocator>();
+ com.zeroc.Ice.Logger logger = null;
+ synchronized(this)
+ {
+ //
+ // If the ServantManager has already been destroyed, we're done.
+ //
+ if(_instance == null)
+ {
+ return;
+ }
+
+ logger = _instance.initializationData().logger;
+
+ _servantMapMap.clear();
+
+ _defaultServantMap.clear();
+
+ locatorMap.putAll(_locatorMap);
+ _locatorMap.clear();
+
+ _instance = null;
+ }
+
+ for(java.util.Map.Entry<String, com.zeroc.Ice.ServantLocator> p : locatorMap.entrySet())
+ {
+ com.zeroc.Ice.ServantLocator locator = p.getValue();
+ try
+ {
+ locator.deactivate(p.getKey());
+ }
+ catch(java.lang.Exception ex)
+ {
+ String s = "exception during locator deactivation:\n" + "object adapter: `" + _adapterName + "'\n" +
+ "locator category: `" + p.getKey() + "'\n" + Ex.toString(ex);
+ logger.error(s);
+ }
+ }
+ }
+
+ private Instance _instance;
+ final private String _adapterName;
+ private java.util.Map<com.zeroc.Ice.Identity, java.util.Map<String, com.zeroc.Ice.Object> > _servantMapMap =
+ new java.util.HashMap<com.zeroc.Ice.Identity, java.util.Map<String, com.zeroc.Ice.Object> >();
+ private java.util.Map<String, com.zeroc.Ice.Object> _defaultServantMap =
+ new java.util.HashMap<String, com.zeroc.Ice.Object>();
+ private java.util.Map<String, com.zeroc.Ice.ServantLocator> _locatorMap =
+ new java.util.HashMap<String, com.zeroc.Ice.ServantLocator>();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/SocketOperation.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/SocketOperation.java
new file mode 100644
index 00000000000..362491af202
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/SocketOperation.java
@@ -0,0 +1,20 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import java.nio.channels.SelectionKey;
+
+public class SocketOperation
+{
+ public static final int None = 0;
+ public static final int Read = SelectionKey.OP_READ;
+ public static final int Write = SelectionKey.OP_WRITE;
+ public static final int Connect = SelectionKey.OP_CONNECT;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/StreamSocket.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/StreamSocket.java
new file mode 100644
index 00000000000..811f69ba75a
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/StreamSocket.java
@@ -0,0 +1,329 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class StreamSocket
+{
+ public StreamSocket(ProtocolInstance instance,
+ NetworkProxy proxy,
+ java.net.InetSocketAddress addr,
+ java.net.InetSocketAddress sourceAddr)
+ {
+ _instance = instance;
+ _proxy = proxy;
+ _addr = addr;
+ _fd = Network.createTcpSocket();
+ _state = StateNeedConnect;
+
+ try
+ {
+ init();
+ if(Network.doConnect(_fd, _proxy != null ? _proxy.getAddress() : _addr, sourceAddr))
+ {
+ _state = _proxy != null ? StateProxyWrite : StateConnected;
+ }
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ assert(!_fd.isOpen());
+ _fd = null; // Necessary for the finalizer
+ throw ex;
+ }
+
+ _desc = Network.fdToString(_fd, _proxy, _addr);
+ }
+
+ public StreamSocket(ProtocolInstance instance, java.nio.channels.SocketChannel fd)
+ {
+ _instance = instance;
+ _proxy = null;
+ _addr = null;
+ _fd = fd;
+ _state = StateConnected;
+
+ try
+ {
+ init();
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ assert(!_fd.isOpen());
+ _fd = null; // Necessary for the finalizer
+ throw ex;
+ }
+
+ _desc = Network.fdToString(_fd);
+ }
+
+ @Override
+ protected synchronized void finalize()
+ throws Throwable
+ {
+ try
+ {
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_fd == null);
+ }
+ catch(java.lang.Exception ex)
+ {
+ }
+ finally
+ {
+ super.finalize();
+ }
+ }
+
+ public void setBufferSize(int rcvSize, int sndSize)
+ {
+ Network.setTcpBufSize(_fd, rcvSize, sndSize, _instance);
+ }
+
+ public int connect(Buffer readBuffer, Buffer writeBuffer)
+ {
+ if(_state == StateNeedConnect)
+ {
+ _state = StateConnectPending;
+ return SocketOperation.Connect;
+ }
+ else if(_state <= StateConnectPending)
+ {
+ Network.doFinishConnect(_fd);
+ _desc = Network.fdToString(_fd, _proxy, _addr);
+ _state = _proxy != null ? StateProxyWrite : StateConnected;
+ }
+
+ if(_state == StateProxyWrite)
+ {
+ _proxy.beginWrite(_addr, writeBuffer);
+ return SocketOperation.Write;
+ }
+ else if(_state == StateProxyRead)
+ {
+ _proxy.beginRead(readBuffer);
+ return SocketOperation.Read;
+ }
+ else if(_state == StateProxyConnected)
+ {
+ _proxy.finish(readBuffer, writeBuffer);
+
+ readBuffer.clear();
+ writeBuffer.clear();
+
+ _state = StateConnected;
+ }
+
+ assert(_state == StateConnected);
+ return SocketOperation.None;
+ }
+
+ public boolean isConnected()
+ {
+ return _state == StateConnected;
+ }
+
+ public java.nio.channels.SocketChannel fd()
+ {
+ return _fd;
+ }
+
+ public int read(Buffer buf)
+ {
+ if(_state == StateProxyRead)
+ {
+ while(true)
+ {
+ int ret = read(buf.b);
+ if(ret == 0)
+ {
+ return SocketOperation.Read;
+ }
+ _state = toState(_proxy.endRead(buf));
+ if(_state != StateProxyRead)
+ {
+ return SocketOperation.None;
+ }
+ }
+ }
+ read(buf.b);
+ return buf.b.hasRemaining() ? SocketOperation.Read : SocketOperation.None;
+ }
+
+ public int write(Buffer buf)
+ {
+ if(_state == StateProxyWrite)
+ {
+ while(true)
+ {
+ int ret = write(buf.b);
+ if(ret == 0)
+ {
+ return SocketOperation.Write;
+ }
+ _state = toState(_proxy.endWrite(buf));
+ if(_state != StateProxyWrite)
+ {
+ return SocketOperation.None;
+ }
+ }
+ }
+ write(buf.b);
+ return buf.b.hasRemaining() ? SocketOperation.Write : SocketOperation.None;
+ }
+
+ public int read(java.nio.ByteBuffer buf)
+ {
+ assert(_fd != null);
+
+ int read = 0;
+
+ while(buf.hasRemaining())
+ {
+ try
+ {
+ int ret = _fd.read(buf);
+ if(ret == -1)
+ {
+ throw new com.zeroc.Ice.ConnectionLostException();
+ }
+ else if(ret == 0)
+ {
+ return read;
+ }
+
+ read += ret;
+ }
+ catch(java.io.InterruptedIOException ex)
+ {
+ continue;
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new com.zeroc.Ice.ConnectionLostException(ex);
+ }
+ }
+ return read;
+ }
+
+ public int write(java.nio.ByteBuffer buf)
+ {
+ assert(_fd != null);
+
+ int sent = 0;
+ while(buf.hasRemaining())
+ {
+ try
+ {
+ int ret;
+ if(_maxSendPacketSize > 0 && buf.remaining() > _maxSendPacketSize)
+ {
+ int previous = buf.limit();
+ buf.limit(buf.position() + _maxSendPacketSize);
+ ret = _fd.write(buf);
+ buf.limit(previous);
+ }
+ else
+ {
+ ret = _fd.write(buf);
+ }
+
+ if(ret == -1)
+ {
+ throw new com.zeroc.Ice.ConnectionLostException();
+ }
+ else if(ret == 0)
+ {
+ return sent;
+ }
+ sent += ret;
+ }
+ catch(java.io.InterruptedIOException ex)
+ {
+ continue;
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new com.zeroc.Ice.SocketException(ex);
+ }
+ }
+ return sent;
+ }
+
+ public void close()
+ {
+ assert(_fd != null);
+ try
+ {
+ _fd.close();
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new com.zeroc.Ice.SocketException(ex);
+ }
+ finally
+ {
+ _fd = null;
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ return _desc;
+ }
+
+ private void init()
+ {
+ Network.setBlock(_fd, false);
+ Network.setTcpBufSize(_fd, _instance);
+
+ if(System.getProperty("os.name").startsWith("Windows"))
+ {
+ //
+ // On Windows, limiting the buffer size is important to prevent
+ // poor throughput performances when sending large amount of
+ // data. See Microsoft KB article KB823764.
+ //
+ _maxSendPacketSize = java.lang.Math.max(512, Network.getSendBufferSize(_fd) / 2);
+ }
+ else
+ {
+ _maxSendPacketSize = 0;
+ }
+ }
+
+ private int toState(int operation)
+ {
+ switch(operation)
+ {
+ case SocketOperation.Read:
+ return StateProxyRead;
+ case SocketOperation.Write:
+ return StateProxyWrite;
+ default:
+ return StateProxyConnected;
+ }
+ }
+
+ private final ProtocolInstance _instance;
+
+ final private NetworkProxy _proxy;
+ final private java.net.InetSocketAddress _addr;
+
+ private java.nio.channels.SocketChannel _fd;
+ private int _maxSendPacketSize;
+ private int _state;
+ private String _desc;
+
+ private static final int StateNeedConnect = 0;
+ private static final int StateConnectPending = 1;
+ private static final int StateProxyRead = 2;
+ private static final int StateProxyWrite = 3;
+ private static final int StateProxyConnected = 4;
+ private static final int StateConnected = 5;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpAcceptor.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpAcceptor.java
new file mode 100644
index 00000000000..0a8afadcaa6
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpAcceptor.java
@@ -0,0 +1,150 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+class TcpAcceptor implements Acceptor
+{
+ @Override
+ public java.nio.channels.ServerSocketChannel fd()
+ {
+ return _fd;
+ }
+
+ @Override
+ public void setReadyCallback(ReadyCallback callback)
+ {
+ // No need to for the ready callback.
+ }
+
+ @Override
+ public void close()
+ {
+ if(_fd != null)
+ {
+ Network.closeSocketNoThrow(_fd);
+ _fd = null;
+ }
+ }
+
+ @Override
+ public EndpointI listen()
+ {
+ try
+ {
+ _addr = Network.doBind(_fd, _addr, _backlog);
+ }
+ catch(com.zeroc.Ice.Exception ex)
+ {
+ _fd = null;
+ throw ex;
+ }
+ _endpoint = _endpoint.endpoint(this);
+ return _endpoint;
+ }
+
+ @Override
+ public Transceiver accept()
+ {
+ return new TcpTransceiver(_instance, new StreamSocket(_instance, Network.doAccept(_fd)));
+ }
+
+ @Override
+ public String protocol()
+ {
+ return _instance.protocol();
+ }
+
+ @Override
+ public String toString()
+ {
+ return Network.addrToString(_addr);
+ }
+
+ @Override
+ public String toDetailedString()
+ {
+ StringBuffer s = new StringBuffer("local address = ");
+ s.append(toString());
+
+ java.util.List<String> intfs =
+ Network.getHostsForEndpointExpand(_addr.getAddress().getHostAddress(), _instance.protocolSupport(), true);
+ if(!intfs.isEmpty())
+ {
+ s.append("\nlocal interfaces = ");
+ s.append(com.zeroc.IceUtilInternal.StringUtil.joinString(intfs, ", "));
+ }
+ return s.toString();
+ }
+
+ int effectivePort()
+ {
+ return _addr.getPort();
+ }
+
+ TcpAcceptor(TcpEndpointI endpoint, ProtocolInstance instance, String host, int port)
+ {
+ _endpoint = endpoint;
+ _instance = instance;
+ _backlog = instance.properties().getPropertyAsIntWithDefault("Ice.TCP.Backlog", 511);
+
+ try
+ {
+ _fd = Network.createTcpServerSocket();
+ Network.setBlock(_fd, false);
+ Network.setTcpBufSize(_fd, instance);
+ if(!System.getProperty("os.name").startsWith("Windows"))
+ {
+ //
+ // Enable SO_REUSEADDR on Unix platforms to allow re-using the
+ // socket even if it's in the TIME_WAIT state. On Windows,
+ // this doesn't appear to be necessary and enabling
+ // SO_REUSEADDR would actually not be a good thing since it
+ // allows a second process to bind to an address even it's
+ // already bound by another process.
+ //
+ // TODO: using SO_EXCLUSIVEADDRUSE on Windows would probably
+ // be better but it's only supported by recent Windows
+ // versions (XP SP2, Windows Server 2003).
+ //
+ Network.setReuseAddress(_fd, true);
+ }
+
+ _addr = Network.getAddressForServer(host, port, instance.protocolSupport(), instance.preferIPv6());
+ }
+ catch(RuntimeException ex)
+ {
+ _fd = null;
+ throw ex;
+ }
+ }
+
+ @Override
+ protected synchronized void finalize()
+ throws Throwable
+ {
+ try
+ {
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_fd == null);
+ }
+ catch(java.lang.Exception ex)
+ {
+ }
+ finally
+ {
+ super.finalize();
+ }
+ }
+
+ private TcpEndpointI _endpoint;
+ private ProtocolInstance _instance;
+ private java.nio.channels.ServerSocketChannel _fd;
+ private int _backlog;
+ private java.net.InetSocketAddress _addr;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpConnector.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpConnector.java
new file mode 100644
index 00000000000..11496dd18c8
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpConnector.java
@@ -0,0 +1,101 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+final class TcpConnector implements Connector
+{
+ @Override
+ public Transceiver connect()
+ {
+ return new TcpTransceiver(_instance, new StreamSocket(_instance, _proxy, _addr, _sourceAddr));
+ }
+
+ @Override
+ public short type()
+ {
+ return _instance.type();
+ }
+
+ @Override
+ public String toString()
+ {
+ return Network.addrToString(_proxy == null ? _addr : _proxy.getAddress());
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return _hashCode;
+ }
+
+ //
+ // Only for use by TcpEndpoint
+ //
+ TcpConnector(ProtocolInstance instance, java.net.InetSocketAddress addr, NetworkProxy proxy,
+ java.net.InetSocketAddress sourceAddr, int timeout, String connectionId)
+ {
+ _instance = instance;
+ _addr = addr;
+ _proxy = proxy;
+ _sourceAddr = sourceAddr;
+ _timeout = timeout;
+ _connectionId = connectionId;
+
+ _hashCode = 5381;
+ _hashCode = HashUtil.hashAdd(_hashCode , _addr.getAddress().getHostAddress());
+ _hashCode = HashUtil.hashAdd(_hashCode , _addr.getPort());
+ if(_sourceAddr != null)
+ {
+ _hashCode = HashUtil.hashAdd(_hashCode , _sourceAddr.getAddress().getHostAddress());
+ }
+ _hashCode = HashUtil.hashAdd(_hashCode , _timeout);
+ _hashCode = HashUtil.hashAdd(_hashCode , _connectionId);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj)
+ {
+ if(!(obj instanceof TcpConnector))
+ {
+ return false;
+ }
+
+ if(this == obj)
+ {
+ return true;
+ }
+
+ TcpConnector p = (TcpConnector)obj;
+ if(_timeout != p._timeout)
+ {
+ return false;
+ }
+
+ if(!_connectionId.equals(p._connectionId))
+ {
+ return false;
+ }
+
+ if(Network.compareAddress(_sourceAddr, p._sourceAddr) != 0)
+ {
+ return false;
+ }
+
+ return Network.compareAddress(_addr, p._addr) == 0;
+ }
+
+ private ProtocolInstance _instance;
+ private java.net.InetSocketAddress _addr;
+ private NetworkProxy _proxy;
+ private java.net.InetSocketAddress _sourceAddr;
+ private int _timeout;
+ private String _connectionId = "";
+ private int _hashCode;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpEndpointFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpEndpointFactory.java
new file mode 100644
index 00000000000..dbb773829bd
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpEndpointFactory.java
@@ -0,0 +1,58 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+final class TcpEndpointFactory implements EndpointFactory
+{
+ TcpEndpointFactory(ProtocolInstance instance)
+ {
+ _instance = instance;
+ }
+
+ @Override
+ public short type()
+ {
+ return _instance.type();
+ }
+
+ @Override
+ public String protocol()
+ {
+ return _instance.protocol();
+ }
+
+ @Override
+ public EndpointI create(java.util.ArrayList<String> args, boolean oaEndpoint)
+ {
+ IPEndpointI endpt = new TcpEndpointI(_instance);
+ endpt.initWithOptions(args, oaEndpoint);
+ return endpt;
+ }
+
+ @Override
+ public EndpointI read(com.zeroc.Ice.InputStream s)
+ {
+ return new TcpEndpointI(_instance, s);
+ }
+
+ @Override
+ public void destroy()
+ {
+ _instance = null;
+ }
+
+ @Override
+ public EndpointFactory clone(ProtocolInstance instance, EndpointFactory delegate)
+ {
+ return new TcpEndpointFactory(instance);
+ }
+
+ private ProtocolInstance _instance;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpEndpointI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpEndpointI.java
new file mode 100644
index 00000000000..18560947241
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpEndpointI.java
@@ -0,0 +1,318 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+final class TcpEndpointI extends IPEndpointI
+{
+ public TcpEndpointI(ProtocolInstance instance, String ho, int po, java.net.InetSocketAddress sourceAddr, int ti,
+ String conId, boolean co)
+ {
+ super(instance, ho, po, sourceAddr, conId);
+ _timeout = ti;
+ _compress = co;
+ }
+
+ public TcpEndpointI(ProtocolInstance instance)
+ {
+ super(instance);
+ _timeout = _instance.defaultTimeout();
+ _compress = false;
+ }
+
+ public TcpEndpointI(ProtocolInstance instance, com.zeroc.Ice.InputStream s)
+ {
+ super(instance, s);
+ _timeout = s.readInt();
+ _compress = s.readBool();
+ }
+
+ //
+ // Return the endpoint information.
+ //
+ @Override
+ public com.zeroc.Ice.EndpointInfo getInfo()
+ {
+ com.zeroc.Ice.TCPEndpointInfo info = new com.zeroc.Ice.TCPEndpointInfo()
+ {
+ @Override
+ public short type()
+ {
+ return TcpEndpointI.this.type();
+ }
+
+ @Override
+ public boolean datagram()
+ {
+ return TcpEndpointI.this.datagram();
+ }
+
+ @Override
+ public boolean secure()
+ {
+ return TcpEndpointI.this.secure();
+ }
+ };
+ fillEndpointInfo(info);
+ return info;
+ }
+
+ //
+ // Return the timeout for the endpoint in milliseconds. 0 means
+ // non-blocking, -1 means no timeout.
+ //
+ @Override
+ public int timeout()
+ {
+ return _timeout;
+ }
+
+ //
+ // Return a new endpoint with a different timeout value, provided
+ // that timeouts are supported by the endpoint. Otherwise the same
+ // endpoint is returned.
+ //
+ @Override
+ public EndpointI timeout(int timeout)
+ {
+ if(timeout == _timeout)
+ {
+ return this;
+ }
+ else
+ {
+ return new TcpEndpointI(_instance, _host, _port, _sourceAddr, timeout, _connectionId, _compress);
+ }
+ }
+
+ //
+ // Return true if the endpoints support bzip2 compress, or false
+ // otherwise.
+ //
+ @Override
+ public boolean compress()
+ {
+ return _compress;
+ }
+
+ //
+ // Return a new endpoint with a different compression value,
+ // provided that compression is supported by the
+ // endpoint. Otherwise the same endpoint is returned.
+ //
+ @Override
+ public EndpointI compress(boolean compress)
+ {
+ if(compress == _compress)
+ {
+ return this;
+ }
+ else
+ {
+ return new TcpEndpointI(_instance, _host, _port, _sourceAddr, _timeout, _connectionId, compress);
+ }
+ }
+
+ //
+ // Return true if the endpoint is datagram-based.
+ //
+ @Override
+ public boolean datagram()
+ {
+ return false;
+ }
+
+ //
+ // Return a server side transceiver for this endpoint, or null if a
+ // transceiver can only be created by an acceptor.
+ //
+ @Override
+ public Transceiver transceiver()
+ {
+ return null;
+ }
+
+ //
+ // Return an acceptor for this endpoint, or null if no acceptors
+ // is available.
+ //
+ @Override
+ public Acceptor acceptor(String adapterName)
+ {
+ return new TcpAcceptor(this, _instance, _host, _port);
+ }
+
+ public TcpEndpointI endpoint(TcpAcceptor acceptor)
+ {
+ return new TcpEndpointI(_instance, _host, acceptor.effectivePort(), _sourceAddr, _timeout,
+ _connectionId, _compress);
+ }
+
+ @Override
+ public String options()
+ {
+ //
+ // WARNING: Certain features, such as proxy validation in Glacier2,
+ // depend on the format of proxy strings. Changes to toString() and
+ // methods called to generate parts of the reference string could break
+ // these features. Please review for all features that depend on the
+ // format of proxyToString() before changing this and related code.
+ //
+ String s = super.options();
+
+ if(_timeout == -1)
+ {
+ s += " -t infinite";
+ }
+ else
+ {
+ s += " -t " + _timeout;
+ }
+
+ if(_compress)
+ {
+ s += " -z";
+ }
+
+ return s;
+ }
+
+ //
+ // Compare endpoints for sorting purposes
+ //
+ @Override
+ public int compareTo(EndpointI obj) // From java.lang.Comparable
+ {
+ if(!(obj instanceof TcpEndpointI))
+ {
+ return type() < obj.type() ? -1 : 1;
+ }
+
+ TcpEndpointI p = (TcpEndpointI)obj;
+ if(this == p)
+ {
+ return 0;
+ }
+
+ if(_timeout < p._timeout)
+ {
+ return -1;
+ }
+ else if(p._timeout < _timeout)
+ {
+ return 1;
+ }
+
+ if(!_compress && p._compress)
+ {
+ return -1;
+ }
+ else if(!p._compress && _compress)
+ {
+ return 1;
+ }
+
+ return super.compareTo(obj);
+ }
+
+ @Override
+ public void streamWriteImpl(com.zeroc.Ice.OutputStream s)
+ {
+ super.streamWriteImpl(s);
+ s.writeInt(_timeout);
+ s.writeBool(_compress);
+ }
+
+ @Override
+ public int hashInit(int h)
+ {
+ h = super.hashInit(h);
+ h = HashUtil.hashAdd(h, _timeout);
+ h = HashUtil.hashAdd(h, _compress);
+ return h;
+ }
+
+ @Override
+ protected boolean checkOption(String option, String argument, String endpoint)
+ {
+ if(super.checkOption(option, argument, endpoint))
+ {
+ return true;
+ }
+
+ switch(option.charAt(1))
+ {
+ case 't':
+ {
+ if(argument == null)
+ {
+ throw new com.zeroc.Ice.EndpointParseException("no argument provided for -t option in endpoint " +
+ endpoint);
+ }
+
+ if(argument.equals("infinite"))
+ {
+ _timeout = -1;
+ }
+ else
+ {
+ try
+ {
+ _timeout = Integer.parseInt(argument);
+ if(_timeout < 1)
+ {
+ throw new com.zeroc.Ice.EndpointParseException("invalid timeout value `" + argument +
+ "' in endpoint " + endpoint);
+ }
+ }
+ catch(NumberFormatException ex)
+ {
+ throw new com.zeroc.Ice.EndpointParseException("invalid timeout value `" + argument +
+ "' in endpoint " + endpoint);
+ }
+ }
+
+ return true;
+ }
+
+ case 'z':
+ {
+ if(argument != null)
+ {
+ throw new com.zeroc.Ice.EndpointParseException("unexpected argument `" + argument +
+ "' provided for -z option in " + endpoint);
+ }
+
+ _compress = true;
+
+ return true;
+ }
+
+ default:
+ {
+ return false;
+ }
+ }
+ }
+
+ @Override
+ protected Connector createConnector(java.net.InetSocketAddress addr, NetworkProxy proxy)
+ {
+ return new TcpConnector(_instance, addr, proxy, _sourceAddr, _timeout, _connectionId);
+ }
+
+ @Override
+ protected IPEndpointI createEndpoint(String host, int port, String connectionId)
+ {
+ return new TcpEndpointI(_instance, host, port, _sourceAddr, _timeout, connectionId, _compress);
+ }
+
+ private int _timeout;
+ private boolean _compress;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpTransceiver.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpTransceiver.java
new file mode 100644
index 00000000000..2404953af2b
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpTransceiver.java
@@ -0,0 +1,126 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+final class TcpTransceiver implements Transceiver
+{
+ @Override
+ public java.nio.channels.SelectableChannel fd()
+ {
+ assert(_stream != null);
+ return _stream.fd();
+ }
+
+ @Override
+ public void setReadyCallback(ReadyCallback callback)
+ {
+ // No need of the callback
+ }
+
+ @Override
+ public int initialize(Buffer readBuffer, Buffer writeBuffer)
+ {
+ return _stream.connect(readBuffer, writeBuffer);
+ }
+
+ @Override
+ public int closing(boolean initiator, com.zeroc.Ice.LocalException ex)
+ {
+ // If we are initiating the connection closure, wait for the peer
+ // to close the TCP/IP connection. Otherwise, close immediately.
+ return initiator ? SocketOperation.Read : SocketOperation.None;
+ }
+
+ @Override
+ public void close()
+ {
+ _stream.close();
+ }
+
+ @Override
+ public EndpointI bind()
+ {
+ assert(false);
+ return null;
+ }
+
+ @Override
+ public int write(Buffer buf)
+ {
+ return _stream.write(buf);
+ }
+
+ @Override
+ public int read(Buffer buf)
+ {
+ return _stream.read(buf);
+ }
+
+ @Override
+ public String protocol()
+ {
+ return _instance.protocol();
+ }
+
+ @Override
+ public String toString()
+ {
+ return _stream.toString();
+ }
+
+ @Override
+ public String toDetailedString()
+ {
+ return toString();
+ }
+
+ @Override
+ public com.zeroc.Ice.ConnectionInfo getInfo()
+ {
+ com.zeroc.Ice.TCPConnectionInfo info = new com.zeroc.Ice.TCPConnectionInfo();
+ if(_stream.fd() != null)
+ {
+ java.net.Socket socket = _stream.fd().socket();
+ info.localAddress = socket.getLocalAddress().getHostAddress();
+ info.localPort = socket.getLocalPort();
+ if(socket.getInetAddress() != null)
+ {
+ info.remoteAddress = socket.getInetAddress().getHostAddress();
+ info.remotePort = socket.getPort();
+ }
+ if(!socket.isClosed())
+ {
+ info.rcvSize = Network.getRecvBufferSize(_stream.fd());
+ info.sndSize = Network.getSendBufferSize(_stream.fd());
+ }
+ }
+ return info;
+ }
+
+ @Override
+ public void checkSendSize(Buffer buf)
+ {
+ }
+
+ @Override
+ public void setBufferSize(int rcvSize, int sndSize)
+ {
+ _stream.setBufferSize(rcvSize, sndSize);
+ }
+
+ TcpTransceiver(ProtocolInstance instance, StreamSocket stream)
+ {
+ _instance = instance;
+ _stream = stream;
+ }
+
+ final private ProtocolInstance _instance;
+ final private StreamSocket _stream;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadObserverI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadObserverI.java
new file mode 100644
index 00000000000..81a0290b666
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadObserverI.java
@@ -0,0 +1,69 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public class ThreadObserverI
+ extends com.zeroc.IceMX.ObserverWithDelegate<com.zeroc.IceMX.ThreadMetrics,
+ com.zeroc.Ice.Instrumentation.ThreadObserver>
+ implements com.zeroc.Ice.Instrumentation.ThreadObserver
+{
+ @Override
+ public void stateChanged(final com.zeroc.Ice.Instrumentation.ThreadState oldState,
+ final com.zeroc.Ice.Instrumentation.ThreadState newState)
+ {
+ _oldState = oldState;
+ _newState = newState;
+ forEach(_threadStateUpdate);
+ if(_delegate != null)
+ {
+ _delegate.stateChanged(oldState, newState);
+ }
+ }
+
+ private com.zeroc.IceMX.Observer.MetricsUpdate<com.zeroc.IceMX.ThreadMetrics> _threadStateUpdate =
+ new com.zeroc.IceMX.Observer.MetricsUpdate<com.zeroc.IceMX.ThreadMetrics>()
+ {
+ @Override
+ public void update(com.zeroc.IceMX.ThreadMetrics v)
+ {
+ switch(_oldState)
+ {
+ case ThreadStateInUseForIO:
+ --v.inUseForIO;
+ break;
+ case ThreadStateInUseForUser:
+ --v.inUseForUser;
+ break;
+ case ThreadStateInUseForOther:
+ --v.inUseForOther;
+ break;
+ default:
+ break;
+ }
+ switch(_newState)
+ {
+ case ThreadStateInUseForIO:
+ ++v.inUseForIO;
+ break;
+ case ThreadStateInUseForUser:
+ ++v.inUseForUser;
+ break;
+ case ThreadStateInUseForOther:
+ ++v.inUseForOther;
+ break;
+ default:
+ break;
+ }
+ }
+ };
+
+ private com.zeroc.Ice.Instrumentation.ThreadState _oldState;
+ private com.zeroc.Ice.Instrumentation.ThreadState _newState;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPool.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPool.java
new file mode 100644
index 00000000000..83bb22218df
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPool.java
@@ -0,0 +1,823 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public final class ThreadPool
+{
+ final class ShutdownWorkItem implements ThreadPoolWorkItem
+ {
+ @Override
+ public void execute(ThreadPoolCurrent current)
+ {
+ current.ioCompleted();
+ try
+ {
+ _instance.objectAdapterFactory().shutdown();
+ }
+ catch(com.zeroc.Ice.CommunicatorDestroyedException ex)
+ {
+ }
+ }
+ }
+
+ static final class FinishedWorkItem implements ThreadPoolWorkItem
+ {
+ public
+ FinishedWorkItem(EventHandler handler, boolean close)
+ {
+ _handler = handler;
+ _close = close;
+ }
+
+ @Override
+ public void execute(ThreadPoolCurrent current)
+ {
+ _handler.finished(current, _close);
+ }
+
+ private final EventHandler _handler;
+ private final boolean _close;
+ }
+
+ static final class JoinThreadWorkItem implements ThreadPoolWorkItem
+ {
+ public
+ JoinThreadWorkItem(EventHandlerThread thread)
+ {
+ _thread = thread;
+ }
+
+ @Override
+ public void execute(ThreadPoolCurrent current)
+ {
+ // No call to ioCompleted, this shouldn't block (and we don't want to cause
+ // a new thread to be started).
+ try
+ {
+ _thread.join();
+ }
+ catch (InterruptedException e)
+ {
+ // Ignore.
+ }
+ }
+
+ private final EventHandlerThread _thread;
+ }
+
+ static final class InterruptWorkItem implements ThreadPoolWorkItem
+ {
+ @Override
+ public void execute(ThreadPoolCurrent current)
+ {
+ // Nothing to do, this is just used to interrupt the thread pool selector.
+ }
+ }
+
+ private static ThreadPoolWorkItem _interruptWorkItem = new InterruptWorkItem();
+
+ //
+ // Exception raised by the thread pool work queue when the thread pool
+ // is destroyed.
+ //
+ static final class DestroyedException extends RuntimeException
+ {
+ }
+
+ public
+ ThreadPool(Instance instance, String prefix, int timeout)
+ {
+ com.zeroc.Ice.Properties properties = instance.initializationData().properties;
+
+ _instance = instance;
+ _dispatcher = instance.initializationData().dispatcher;
+ _destroyed = false;
+ _prefix = prefix;
+ _selector = new Selector(instance);
+ _threadIndex = 0;
+ _inUse = 0;
+ _inUseIO = 0;
+ _promote = true;
+ _serialize = properties.getPropertyAsInt(_prefix + ".Serialize") > 0;
+ _serverIdleTime = timeout;
+ _threadPrefix = Util.createThreadName(properties, _prefix);
+
+ int nProcessors = Runtime.getRuntime().availableProcessors();
+
+ //
+ // We use just one thread as the default. This is the fastest
+ // possible setting, still allows one level of nesting, and
+ // doesn't require to make the servants thread safe.
+ //
+ int size = properties.getPropertyAsIntWithDefault(_prefix + ".Size", 1);
+ if(size < 1)
+ {
+ String s = _prefix + ".Size < 1; Size adjusted to 1";
+ _instance.initializationData().logger.warning(s);
+ size = 1;
+ }
+
+ int sizeMax = properties.getPropertyAsIntWithDefault(_prefix + ".SizeMax", size);
+ if(sizeMax == -1)
+ {
+ sizeMax = nProcessors;
+ }
+ if(sizeMax < size)
+ {
+ String s = _prefix + ".SizeMax < " + _prefix + ".Size; SizeMax adjusted to Size (" + size + ")";
+ _instance.initializationData().logger.warning(s);
+ sizeMax = size;
+ }
+
+ int sizeWarn = properties.getPropertyAsInt(_prefix + ".SizeWarn");
+ if(sizeWarn != 0 && sizeWarn < size)
+ {
+ String s = _prefix + ".SizeWarn < " + _prefix + ".Size; adjusted SizeWarn to Size (" + size + ")";
+ _instance.initializationData().logger.warning(s);
+ sizeWarn = size;
+ }
+ else if(sizeWarn > sizeMax)
+ {
+ String s = _prefix + ".SizeWarn > " + _prefix + ".SizeMax; adjusted SizeWarn to SizeMax (" + sizeMax + ")";
+ _instance.initializationData().logger.warning(s);
+ sizeWarn = sizeMax;
+ }
+
+ int threadIdleTime = properties.getPropertyAsIntWithDefault(_prefix + ".ThreadIdleTime", 60);
+ if(threadIdleTime < 0)
+ {
+ String s = _prefix + ".ThreadIdleTime < 0; ThreadIdleTime adjusted to 0";
+ _instance.initializationData().logger.warning(s);
+ threadIdleTime = 0;
+ }
+
+ _size = size;
+ _sizeMax = sizeMax;
+ _sizeWarn = sizeWarn;
+ _sizeIO = Math.min(sizeMax, nProcessors);
+ _threadIdleTime = threadIdleTime;
+
+ int stackSize = properties.getPropertyAsInt( _prefix + ".StackSize");
+ if(stackSize < 0)
+ {
+ String s = _prefix + ".StackSize < 0; Size adjusted to JRE default";
+ _instance.initializationData().logger.warning(s);
+ stackSize = 0;
+ }
+ _stackSize = stackSize;
+
+ boolean hasPriority = properties.getProperty(_prefix + ".ThreadPriority").length() > 0;
+ int priority = properties.getPropertyAsInt(_prefix + ".ThreadPriority");
+ if(!hasPriority)
+ {
+ hasPriority = properties.getProperty("Ice.ThreadPriority").length() > 0;
+ priority = properties.getPropertyAsInt("Ice.ThreadPriority");
+ }
+ _hasPriority = hasPriority;
+ _priority = priority;
+
+ _workQueue = new ThreadPoolWorkQueue(_instance, this, _selector);
+ _nextHandler = _handlers.iterator();
+
+ if(_instance.traceLevels().threadPool >= 1)
+ {
+ String s = "creating " + _prefix + ": Size = " + _size + ", SizeMax = " + _sizeMax + ", SizeWarn = " +
+ _sizeWarn;
+ _instance.initializationData().logger.trace(_instance.traceLevels().threadPoolCat, s);
+ }
+
+ try
+ {
+ for(int i = 0; i < _size; i++)
+ {
+ EventHandlerThread thread = new EventHandlerThread(_threadPrefix + "-" + _threadIndex++);
+ if(_hasPriority)
+ {
+ thread.start(_priority);
+ }
+ else
+ {
+ thread.start(java.lang.Thread.NORM_PRIORITY);
+ }
+ _threads.add(thread);
+ }
+ }
+ catch(RuntimeException ex)
+ {
+ String s = "cannot create thread for `" + _prefix + "':\n" + Ex.toString(ex);
+ _instance.initializationData().logger.error(s);
+
+ destroy();
+ try
+ {
+ joinWithAllThreads();
+ }
+ catch (InterruptedException e)
+ {
+ throw new com.zeroc.Ice.OperationInterruptedException();
+ }
+ throw ex;
+ }
+ }
+
+ @Override
+ protected synchronized void
+ finalize()
+ throws Throwable
+ {
+ try
+ {
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_destroyed);
+ }
+ catch(java.lang.Exception ex)
+ {
+ }
+ finally
+ {
+ super.finalize();
+ }
+ }
+
+ public synchronized void
+ destroy()
+ {
+ if(_destroyed)
+ {
+ return;
+ }
+
+ _destroyed = true;
+ _workQueue.destroy();
+ }
+
+ public synchronized void
+ updateObservers()
+ {
+ for(EventHandlerThread thread : _threads)
+ {
+ thread.updateObserver();
+ }
+ }
+
+ public synchronized void
+ initialize(final EventHandler handler)
+ {
+ assert(!_destroyed);
+ _selector.initialize(handler);
+
+ handler.setReadyCallback(
+ new ReadyCallback()
+ {
+ public void ready(int op, boolean value)
+ {
+ synchronized(ThreadPool.this)
+ {
+ if(_destroyed)
+ {
+ return;
+ }
+ _selector.ready(handler, op, value);
+ }
+ }
+ });
+ }
+
+ public void
+ register(EventHandler handler, int op)
+ {
+ update(handler, SocketOperation.None, op);
+ }
+
+ public synchronized void
+ update(EventHandler handler, int remove, int add)
+ {
+ assert(!_destroyed);
+
+ // Don't remove what needs to be added
+ remove &= ~add;
+
+ // Don't remove/add if already un-registered or registered
+ remove = handler._registered & remove;
+ add = ~handler._registered & add;
+ if(remove == add)
+ {
+ return;
+ }
+ _selector.update(handler, remove, add);
+ }
+
+ public void
+ unregister(EventHandler handler, int op)
+ {
+ update(handler, op, SocketOperation.None);
+ }
+
+ public synchronized boolean
+ finish(EventHandler handler, boolean closeNow)
+ {
+ assert(!_destroyed);
+ closeNow = _selector.finish(handler, closeNow);
+ _workQueue.queue(new FinishedWorkItem(handler, !closeNow));
+ return closeNow;
+ }
+
+ public void
+ dispatchFromThisThread(DispatchWorkItem workItem)
+ {
+ if(_dispatcher != null)
+ {
+ try
+ {
+ _dispatcher.dispatch(workItem, workItem.getConnection());
+ }
+ catch(java.lang.Exception ex)
+ {
+ if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1)
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ ex.printStackTrace(pw);
+ pw.flush();
+ _instance.initializationData().logger.warning("dispatch exception:\n" + sw.toString());
+ }
+ }
+ }
+ else
+ {
+ workItem.run();
+ }
+ }
+
+ synchronized public void
+ dispatch(DispatchWorkItem workItem)
+ {
+ if(_destroyed)
+ {
+ throw new com.zeroc.Ice.CommunicatorDestroyedException();
+ }
+ _workQueue.queue(workItem);
+ }
+
+ public void
+ joinWithAllThreads()
+ throws InterruptedException
+ {
+ //
+ // _threads is immutable after destroy() has been called,
+ // therefore no synchronization is needed. (Synchronization
+ // wouldn't be possible here anyway, because otherwise the
+ // other threads would never terminate.)
+ //
+ for(EventHandlerThread thread : _threads)
+ {
+ thread.join();
+ }
+
+ //
+ // Destroy the selector
+ //
+ _selector.destroy();
+ }
+
+ private void
+ run(EventHandlerThread thread)
+ {
+ ThreadPoolCurrent current = new ThreadPoolCurrent(_instance, this, thread);
+ boolean select = false;
+ while(true)
+ {
+ if(current._handler != null)
+ {
+ try
+ {
+ current._handler.message(current);
+ }
+ catch(DestroyedException ex)
+ {
+ return;
+ }
+ catch(java.lang.Exception ex)
+ {
+ String s = "exception in `" + _prefix + "':\n" + Ex.toString(ex);
+ s += "\nevent handler: " + current._handler.toString();
+ _instance.initializationData().logger.error(s);
+ }
+ }
+ else if(select)
+ {
+ try
+ {
+ _selector.select(_serverIdleTime);
+ }
+ catch(Selector.TimeoutException ex)
+ {
+ synchronized(this)
+ {
+ if(!_destroyed && _inUse == 0)
+ {
+ _workQueue.queue(new ShutdownWorkItem()); // Select timed-out.
+ }
+ continue;
+ }
+ }
+ }
+
+ synchronized(this)
+ {
+ if(current._handler == null)
+ {
+ if(select)
+ {
+ _selector.finishSelect(_handlers);
+ select = false;
+ _nextHandler = _handlers.iterator();
+ }
+ else if(!current._leader && followerWait(current))
+ {
+ return; // Wait timed-out.
+ }
+ }
+ else if(_sizeMax > 1)
+ {
+ if(!current._ioCompleted)
+ {
+ //
+ // The handler didn't call ioCompleted() so we take care of decreasing
+ // the IO thread count now.
+ //
+ --_inUseIO;
+ }
+ else
+ {
+ //
+ // If the handler called ioCompleted(), we re-enable the handler in
+ // case it was disabled and we decrease the number of thread in use.
+ //
+ if(_serialize)
+ {
+ _selector.enable(current._handler, current.operation);
+ }
+ assert(_inUse > 0);
+ --_inUse;
+ }
+
+ if(!current._leader && followerWait(current))
+ {
+ return; // Wait timed-out.
+ }
+ }
+
+ //
+ // Get the next ready handler.
+ //
+ current._handler = null;
+ while(_nextHandler.hasNext())
+ {
+ EventHandlerOpPair n = _nextHandler.next();
+ int op = n.op & ~n.handler._disabled & n.handler._registered;
+ if(op != 0)
+ {
+ current._ioCompleted = false;
+ current._handler = n.handler;
+ current.operation = op;
+ thread.setState(com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateInUseForIO);
+ break;
+ }
+ }
+
+ if(current._handler == null)
+ {
+ //
+ // If there are no more ready handlers and there are still threads busy performing
+ // IO, we give up leadership and promote another follower (which will perform the
+ // select() only once all the IOs are completed). Otherwise, if there's no more
+ // threads peforming IOs, it's time to do another select().
+ //
+ if(_inUseIO > 0)
+ {
+ promoteFollower(current);
+ }
+ else
+ {
+ _handlers.clear();
+ _selector.startSelect();
+ select = true;
+ thread.setState(com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateIdle);
+ }
+ }
+ else if(_sizeMax > 1)
+ {
+ //
+ // Increment the IO thread count and if there's still threads available
+ // to perform IO and more handlers ready, we promote a follower.
+ //
+ ++_inUseIO;
+ if(_nextHandler.hasNext() && _inUseIO < _sizeIO)
+ {
+ promoteFollower(current);
+ }
+ }
+ }
+ }
+ }
+
+ synchronized void
+ ioCompleted(ThreadPoolCurrent current)
+ {
+ current._ioCompleted = true; // Set the IO completed flag to specify that ioCompleted() has been called.
+
+ current._thread.setState(com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateInUseForUser);
+
+ if(_sizeMax > 1)
+ {
+ --_inUseIO;
+
+ if(!_destroyed)
+ {
+ if(_serialize)
+ {
+ _selector.disable(current._handler, current.operation);
+ }
+ }
+
+ if(current._leader)
+ {
+ //
+ // If this thread is still the leader, it's time to promote a new leader.
+ //
+ promoteFollower(current);
+ }
+ else if(_promote && (_nextHandler.hasNext() || _inUseIO == 0))
+ {
+ notify();
+ }
+
+ assert(_inUse >= 0);
+ ++_inUse;
+
+ if(_inUse == _sizeWarn)
+ {
+ String s = "thread pool `" + _prefix + "' is running low on threads\n"
+ + "Size=" + _size + ", " + "SizeMax=" + _sizeMax + ", " + "SizeWarn=" + _sizeWarn;
+ _instance.initializationData().logger.warning(s);
+ }
+
+ if(!_destroyed)
+ {
+ assert(_inUse <= _threads.size());
+ if(_inUse < _sizeMax && _inUse == _threads.size())
+ {
+ if(_instance.traceLevels().threadPool >= 1)
+ {
+ String s = "growing " + _prefix + ": Size=" + (_threads.size() + 1);
+ _instance.initializationData().logger.trace(_instance.traceLevels().threadPoolCat, s);
+ }
+
+ try
+ {
+ EventHandlerThread thread = new EventHandlerThread(_threadPrefix + "-" + _threadIndex++);
+ _threads.add(thread);
+ if(_hasPriority)
+ {
+ thread.start(_priority);
+ }
+ else
+ {
+ thread.start(java.lang.Thread.NORM_PRIORITY);
+ }
+ }
+ catch(RuntimeException ex)
+ {
+ String s = "cannot create thread for `" + _prefix + "':\n" + Ex.toString(ex);
+ _instance.initializationData().logger.error(s);
+ }
+ }
+ }
+ }
+ }
+
+ private synchronized void
+ promoteFollower(ThreadPoolCurrent current)
+ {
+ assert(!_promote && current._leader);
+ _promote = true;
+ if(_inUseIO < _sizeIO && (_nextHandler.hasNext() || _inUseIO == 0))
+ {
+ notify();
+ }
+ current._leader = false;
+ }
+
+ private synchronized boolean
+ followerWait(ThreadPoolCurrent current)
+ {
+ assert(!current._leader);
+
+ current._thread.setState(com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateIdle);
+
+ //
+ // It's important to clear the handler before waiting to make sure that
+ // resources for the handler are released now if it's finished. We also
+ // clear the per-thread stream.
+ //
+ current._handler = null;
+ current.stream.reset();
+
+ //
+ // Wait to be promoted and for all the IO threads to be done.
+ //
+ while(!_promote || _inUseIO == _sizeIO || (!_nextHandler.hasNext() && _inUseIO > 0))
+ {
+ if(_threadIdleTime > 0)
+ {
+ long before = Time.currentMonotonicTimeMillis();
+ boolean interrupted = false;
+ try
+ {
+ //
+ // If the wait is interrupted then we'll let the thread die as if it timed out.
+ //
+ wait(_threadIdleTime * 1000);
+ }
+ catch (InterruptedException e)
+ {
+ interrupted = true;
+ }
+ if(interrupted || Time.currentMonotonicTimeMillis() - before >= _threadIdleTime * 1000)
+ {
+ if(!_destroyed && (!_promote || _inUseIO == _sizeIO || (!_nextHandler.hasNext() && _inUseIO > 0)))
+ {
+ if(_instance.traceLevels().threadPool >= 1)
+ {
+ String s = "shrinking " + _prefix + ": Size=" + (_threads.size() - 1);
+ _instance.initializationData().logger.trace(_instance.traceLevels().threadPoolCat, s);
+ }
+ assert(_threads.size() > 1); // Can only be called by a waiting follower thread.
+ _threads.remove(current._thread);
+ _workQueue.queue(new JoinThreadWorkItem(current._thread));
+ return true;
+ }
+ }
+ }
+ else
+ {
+ try
+ {
+ wait();
+ }
+ catch (InterruptedException e)
+ {
+ //
+ // Eat the InterruptedException.
+ //
+ }
+ }
+ }
+ current._leader = true; // The current thread has become the leader.
+ _promote = false;
+ return false;
+ }
+
+ private final Instance _instance;
+ private final com.zeroc.Ice.Dispatcher _dispatcher;
+ private final ThreadPoolWorkQueue _workQueue;
+ private boolean _destroyed;
+ private final String _prefix;
+ private final String _threadPrefix;
+ private final Selector _selector;
+
+ final class EventHandlerThread implements Runnable
+ {
+ EventHandlerThread(String name)
+ {
+ _name = name;
+ _state = com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateIdle;
+ updateObserver();
+ }
+
+ public void
+ updateObserver()
+ {
+ // Must be called with the thread pool mutex locked
+ com.zeroc.Ice.Instrumentation.CommunicatorObserver obsv = _instance.initializationData().observer;
+ if(obsv != null)
+ {
+ _observer = obsv.getThreadObserver(_prefix, _name, _state, _observer);
+ if(_observer != null)
+ {
+ _observer.attach();
+ }
+ }
+ }
+
+ public void
+ setState(com.zeroc.Ice.Instrumentation.ThreadState s)
+ {
+ // Must be called with the thread pool mutex locked
+ if(_observer != null)
+ {
+ if(_state != s)
+ {
+ _observer.stateChanged(_state, s);
+ }
+ }
+ _state = s;
+ }
+
+ public void
+ join()
+ throws InterruptedException
+ {
+ _thread.join();
+ }
+
+ public void
+ start(int priority)
+ {
+ _thread = new Thread(null, this, _name, _stackSize);
+ _thread.setPriority(priority);
+ _thread.start();
+ }
+
+ @Override
+ public void
+ run()
+ {
+ if(_instance.initializationData().threadHook != null)
+ {
+ try
+ {
+ _instance.initializationData().threadHook.start();
+ }
+ catch(java.lang.Exception ex)
+ {
+ String s = "thread hook start() method raised an unexpected exception in `";
+ s += _prefix + "' thread " + _name + ":\n" + Ex.toString(ex);
+ _instance.initializationData().logger.error(s);
+ }
+ }
+
+ try
+ {
+ ThreadPool.this.run(this);
+ }
+ catch(java.lang.Exception ex)
+ {
+ String s = "exception in `" + _prefix + "' thread " + _name + ":\n" + Ex.toString(ex);
+ _instance.initializationData().logger.error(s);
+ }
+
+ if(_observer != null)
+ {
+ _observer.detach();
+ }
+
+ if(_instance.initializationData().threadHook != null)
+ {
+ try
+ {
+ _instance.initializationData().threadHook.stop();
+ }
+ catch(java.lang.Exception ex)
+ {
+ String s = "thread hook stop() method raised an unexpected exception in `";
+ s += _prefix + "' thread " + _name + ":\n" + Ex.toString(ex);
+ _instance.initializationData().logger.error(s);
+ }
+ }
+ }
+
+ final private String _name;
+ private Thread _thread;
+ private com.zeroc.Ice.Instrumentation.ThreadState _state;
+ private com.zeroc.Ice.Instrumentation.ThreadObserver _observer;
+ }
+
+ private final int _size; // Number of threads that are pre-created.
+ private final int _sizeIO; // Number of threads that can concurrently perform IO.
+ private final int _sizeMax; // Maximum number of threads.
+ private final int _sizeWarn; // If _inUse reaches _sizeWarn, a "low on threads" warning will be printed.
+ private final boolean _serialize; // True if requests need to be serialized over the connection.
+ private final int _priority;
+ private final boolean _hasPriority;
+ private final long _serverIdleTime;
+ private final long _threadIdleTime;
+ private final int _stackSize;
+
+ private java.util.List<EventHandlerThread> _threads = new java.util.ArrayList<>();
+ private int _threadIndex; // For assigning thread names.
+ private int _inUse; // Number of threads that are currently in use.
+ private int _inUseIO; // Number of threads that are currently performing IO.
+
+ private java.util.List<EventHandlerOpPair> _handlers = new java.util.ArrayList<>();
+ private java.util.Iterator<EventHandlerOpPair> _nextHandler;
+
+ private boolean _promote;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPoolCurrent.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPoolCurrent.java
new file mode 100644
index 00000000000..e3eb3c759fa
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPoolCurrent.java
@@ -0,0 +1,51 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public final class ThreadPoolCurrent
+{
+ ThreadPoolCurrent(Instance instance, ThreadPool threadPool, ThreadPool.EventHandlerThread thread)
+ {
+ operation = SocketOperation.None;
+ stream = new com.zeroc.Ice.InputStream(instance, Protocol.currentProtocolEncoding);
+
+ _threadPool = threadPool;
+ _thread = thread;
+ _ioCompleted = false;
+ _leader = false;
+ }
+
+ public int operation;
+ public com.zeroc.Ice.InputStream stream; // A per-thread stream to be used by event handlers for optimization.
+
+ public boolean
+ ioReady()
+ {
+ return (_handler._registered & operation) > 0;
+ }
+
+ public void
+ ioCompleted()
+ {
+ _threadPool.ioCompleted(this);
+ }
+
+ public void
+ dispatchFromThisThread(DispatchWorkItem workItem)
+ {
+ _threadPool.dispatchFromThisThread(workItem);
+ }
+
+ final ThreadPool _threadPool;
+ final ThreadPool.EventHandlerThread _thread;
+ EventHandler _handler;
+ boolean _ioCompleted;
+ boolean _leader;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPoolWorkItem.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPoolWorkItem.java
new file mode 100644
index 00000000000..f39ab05652a
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPoolWorkItem.java
@@ -0,0 +1,15 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public interface ThreadPoolWorkItem
+{
+ void execute(ThreadPoolCurrent current);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPoolWorkQueue.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPoolWorkQueue.java
new file mode 100644
index 00000000000..62990f48b20
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPoolWorkQueue.java
@@ -0,0 +1,116 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import java.util.List;
+
+final class ThreadPoolWorkQueue extends EventHandler
+{
+ ThreadPoolWorkQueue(Instance instance, ThreadPool threadPool, Selector selector)
+ {
+ _threadPool = threadPool;
+ _selector = selector;
+ _destroyed = false;
+ _registered = SocketOperation.Read;
+ }
+
+ @Override
+ protected synchronized void finalize() throws Throwable
+ {
+ try
+ {
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_destroyed);
+ }
+ catch(java.lang.Exception ex)
+ {
+ }
+ finally
+ {
+ super.finalize();
+ }
+ }
+
+ void destroy()
+ {
+ // Called with the thread pool locked
+ assert(!_destroyed);
+ _destroyed = true;
+ _selector.ready(this, SocketOperation.Read, true);
+ }
+
+ void queue(ThreadPoolWorkItem item)
+ {
+ // Called with the thread pool locked
+ assert(item != null);
+ _workItems.add(item);
+ if(_workItems.size() == 1)
+ {
+ _selector.ready(this, SocketOperation.Read, true);
+ }
+ }
+
+ @Override
+ public void message(ThreadPoolCurrent current)
+ {
+ ThreadPoolWorkItem workItem = null;
+ synchronized(_threadPool)
+ {
+ if(!_workItems.isEmpty())
+ {
+ workItem = _workItems.removeFirst();
+ assert(workItem != null);
+ }
+ if(_workItems.isEmpty() && !_destroyed)
+ {
+ _selector.ready(this, SocketOperation.Read, false);
+ }
+ }
+
+ if(workItem != null)
+ {
+ workItem.execute(current);
+ }
+ else
+ {
+ assert(_destroyed);
+ _threadPool.ioCompleted(current);
+ throw new ThreadPool.DestroyedException();
+ }
+ }
+
+ @Override
+ public void finished(ThreadPoolCurrent current, boolean close)
+ {
+ assert(false);
+ }
+
+ @Override
+ public String toString()
+ {
+ return "work queue";
+ }
+
+ @Override
+ public java.nio.channels.SelectableChannel fd()
+ {
+ return null;
+ }
+
+ @Override
+ public void setReadyCallback(ReadyCallback callback)
+ {
+ // Ignore, we don't use the ready callback.
+ }
+
+ private final ThreadPool _threadPool;
+ private boolean _destroyed;
+ private Selector _selector;
+ private java.util.LinkedList<ThreadPoolWorkItem> _workItems = new java.util.LinkedList<>();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Time.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Time.java
new file mode 100644
index 00000000000..1198561400e
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Time.java
@@ -0,0 +1,19 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+final public class Time
+{
+ static public long
+ currentMonotonicTimeMillis()
+ {
+ return System.nanoTime() / 1000000;
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/TraceLevels.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TraceLevels.java
new file mode 100644
index 00000000000..e92fc043732
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TraceLevels.java
@@ -0,0 +1,45 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public final class TraceLevels
+{
+ TraceLevels(com.zeroc.Ice.Properties properties)
+ {
+ networkCat = "Network";
+ protocolCat = "Protocol";
+ retryCat = "Retry";
+ locationCat = "Locator";
+ slicingCat = "Slicing";
+ threadPoolCat = "ThreadPool";
+
+ final String keyBase = "Ice.Trace.";
+
+ network = properties.getPropertyAsInt(keyBase + networkCat);
+ protocol = properties.getPropertyAsInt(keyBase + protocolCat);
+ retry = properties.getPropertyAsInt(keyBase + retryCat);
+ location = properties.getPropertyAsInt(keyBase + locationCat);
+ slicing = properties.getPropertyAsInt(keyBase + slicingCat);
+ threadPool = properties.getPropertyAsInt(keyBase + threadPoolCat);
+ }
+
+ final public int network;
+ final public String networkCat;
+ final public int protocol;
+ final public String protocolCat;
+ final public int retry;
+ final public String retryCat;
+ final public int location;
+ final public String locationCat;
+ final public int slicing;
+ final public String threadPoolCat;
+ final public int threadPool;
+ final public String slicingCat;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/TraceUtil.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TraceUtil.java
new file mode 100644
index 00000000000..4798d1be659
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TraceUtil.java
@@ -0,0 +1,515 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public final class TraceUtil
+{
+ public static void
+ traceSend(com.zeroc.Ice.OutputStream str, com.zeroc.Ice.Logger logger, TraceLevels tl)
+ {
+ if(tl.protocol >= 1)
+ {
+ int p = str.pos();
+ com.zeroc.Ice.InputStream is =
+ new com.zeroc.Ice.InputStream(str.instance(), str.getEncoding(), str.getBuffer(), false);
+ is.pos(0);
+
+ java.io.StringWriter s = new java.io.StringWriter();
+ byte type = printMessage(s, is);
+
+ logger.trace(tl.protocolCat, "sending " + getMessageTypeAsString(type) + " " + s.toString());
+
+ str.pos(p);
+ }
+ }
+
+ public static void
+ traceRecv(com.zeroc.Ice.InputStream str, com.zeroc.Ice.Logger logger, TraceLevels tl)
+ {
+ if(tl.protocol >= 1)
+ {
+ int p = str.pos();
+ str.pos(0);
+
+ java.io.StringWriter s = new java.io.StringWriter();
+ byte type = printMessage(s, str);
+
+ logger.trace(tl.protocolCat, "received " + getMessageTypeAsString(type) + " " + s.toString());
+
+ str.pos(p);
+ }
+ }
+
+ public static void
+ trace(String heading, com.zeroc.Ice.OutputStream str, com.zeroc.Ice.Logger logger, TraceLevels tl)
+ {
+ if(tl.protocol >= 1)
+ {
+ int p = str.pos();
+ com.zeroc.Ice.InputStream is =
+ new com.zeroc.Ice.InputStream(str.instance(), str.getEncoding(), str.getBuffer(), false);
+ is.pos(0);
+
+ java.io.StringWriter s = new java.io.StringWriter();
+ s.write(heading);
+ printMessage(s, is);
+
+ logger.trace(tl.protocolCat, s.toString());
+ str.pos(p);
+ }
+ }
+
+ public static void
+ trace(String heading, com.zeroc.Ice.InputStream str, com.zeroc.Ice.Logger logger, TraceLevels tl)
+ {
+ if(tl.protocol >= 1)
+ {
+ int p = str.pos();
+ str.pos(0);
+
+ java.io.StringWriter s = new java.io.StringWriter();
+ s.write(heading);
+ printMessage(s, str);
+
+ logger.trace(tl.protocolCat, s.toString());
+ str.pos(p);
+ }
+ }
+
+ private static java.util.Set<String> slicingIds = new java.util.HashSet<>();
+
+ public synchronized static void
+ traceSlicing(String kind, String typeId, String slicingCat, com.zeroc.Ice.Logger logger)
+ {
+ if(slicingIds.add(typeId))
+ {
+ java.io.StringWriter s = new java.io.StringWriter();
+ s.write("unknown " + kind + " type `" + typeId + "'");
+ logger.trace(slicingCat, s.toString());
+ }
+ }
+
+ public static void
+ dumpStream(com.zeroc.Ice.InputStream stream)
+ {
+ int pos = stream.pos();
+ stream.pos(0);
+
+ byte[] data = stream.readBlob(stream.size());
+ dumpOctets(data);
+
+ stream.pos(pos);
+ }
+
+ public static void
+ dumpOctets(byte[] data)
+ {
+ final int inc = 8;
+
+ for(int i = 0; i < data.length; i += inc)
+ {
+ for(int j = i; j - i < inc; j++)
+ {
+ if(j < data.length)
+ {
+ int n = data[j];
+ if(n < 0)
+ {
+ n += 256;
+ }
+ String s;
+ if(n < 10)
+ {
+ s = " " + n;
+ }
+ else if(n < 100)
+ {
+ s = " " + n;
+ }
+ else
+ {
+ s = "" + n;
+ }
+ System.out.print(s + " ");
+ }
+ else
+ {
+ System.out.print(" ");
+ }
+ }
+
+ System.out.print('"');
+
+ for(int j = i; j < data.length && j - i < inc; j++)
+ {
+ if(data[j] >= (byte)32 && data[j] < (byte)127)
+ {
+ System.out.print((char)data[j]);
+ }
+ else
+ {
+ System.out.print('.');
+ }
+ }
+
+ System.out.println('"');
+ }
+ }
+
+ private static void
+ printIdentityFacetOperation(java.io.Writer out, com.zeroc.Ice.InputStream stream)
+ {
+ try
+ {
+ com.zeroc.Ice.Identity identity = com.zeroc.Ice.Identity.read(stream, null);
+ out.write("\nidentity = " + com.zeroc.Ice.Util.identityToString(identity));
+
+ String[] facet = stream.readStringSeq();
+ out.write("\nfacet = ");
+ if(facet.length > 0)
+ {
+ out.write(com.zeroc.IceUtilInternal.StringUtil.escapeString(facet[0], ""));
+ }
+
+ String operation = stream.readString();
+ out.write("\noperation = " + operation);
+ }
+ catch(java.io.IOException ex)
+ {
+ assert(false);
+ }
+ }
+
+ private static void
+ printRequest(java.io.StringWriter s, com.zeroc.Ice.InputStream str)
+ {
+ int requestId = str.readInt();
+ s.write("\nrequest id = " + requestId);
+ if(requestId == 0)
+ {
+ s.write(" (oneway)");
+ }
+
+ printRequestHeader(s, str);
+ }
+
+ private static void
+ printBatchRequest(java.io.StringWriter s, com.zeroc.Ice.InputStream str)
+ {
+ int batchRequestNum = str.readInt();
+ s.write("\nnumber of requests = " + batchRequestNum);
+
+ for(int i = 0; i < batchRequestNum; ++i)
+ {
+ s.write("\nrequest #" + i + ':');
+ printRequestHeader(s, str);
+ }
+ }
+
+ private static void
+ printReply(java.io.StringWriter s, com.zeroc.Ice.InputStream str)
+ {
+ int requestId = str.readInt();
+ s.write("\nrequest id = " + requestId);
+
+ byte replyStatus = str.readByte();
+ s.write("\nreply status = " + (int)replyStatus + ' ');
+
+ switch(replyStatus)
+ {
+ case ReplyStatus.replyOK:
+ {
+ s.write("(ok)");
+ break;
+ }
+
+ case ReplyStatus.replyUserException:
+ {
+ s.write("(user exception)");
+ break;
+ }
+
+ case ReplyStatus.replyObjectNotExist:
+ case ReplyStatus.replyFacetNotExist:
+ case ReplyStatus.replyOperationNotExist:
+ {
+ switch(replyStatus)
+ {
+ case ReplyStatus.replyObjectNotExist:
+ {
+ s.write("(object not exist)");
+ break;
+ }
+
+ case ReplyStatus.replyFacetNotExist:
+ {
+ s.write("(facet not exist)");
+ break;
+ }
+
+ case ReplyStatus.replyOperationNotExist:
+ {
+ s.write("(operation not exist)");
+ break;
+ }
+
+ default:
+ {
+ assert(false);
+ break;
+ }
+ }
+
+ printIdentityFacetOperation(s, str);
+ break;
+ }
+
+ case ReplyStatus.replyUnknownException:
+ case ReplyStatus.replyUnknownLocalException:
+ case ReplyStatus.replyUnknownUserException:
+ {
+ switch(replyStatus)
+ {
+ case ReplyStatus.replyUnknownException:
+ {
+ s.write("(unknown exception)");
+ break;
+ }
+
+ case ReplyStatus.replyUnknownLocalException:
+ {
+ s.write("(unknown local exception)");
+ break;
+ }
+
+ case ReplyStatus.replyUnknownUserException:
+ {
+ s.write("(unknown user exception)");
+ break;
+ }
+
+ default:
+ {
+ assert(false);
+ break;
+ }
+ }
+
+ String unknown = str.readString();
+ s.write("\nunknown = " + unknown);
+ break;
+ }
+
+ default:
+ {
+ s.write("(unknown)");
+ break;
+ }
+ }
+
+ if(replyStatus == ReplyStatus.replyOK || replyStatus == ReplyStatus.replyUserException)
+ {
+ com.zeroc.Ice.EncodingVersion v = str.skipEncapsulation();
+ if(!v.equals(com.zeroc.Ice.Util.Encoding_1_0))
+ {
+ s.write("\nencoding = ");
+ s.write(com.zeroc.Ice.Util.encodingVersionToString(v));
+ }
+ }
+ }
+
+ private static void
+ printRequestHeader(java.io.Writer out, com.zeroc.Ice.InputStream stream)
+ {
+ printIdentityFacetOperation(out, stream);
+
+ try
+ {
+ byte mode = stream.readByte();
+ out.write("\nmode = " + (int) mode + ' ');
+ switch(com.zeroc.Ice.OperationMode.values()[mode])
+ {
+ case Normal:
+ {
+ out.write("(normal)");
+ break;
+ }
+
+ case Nonmutating:
+ {
+ out.write("(nonmutating)");
+ break;
+ }
+
+ case Idempotent:
+ {
+ out.write("(idempotent)");
+ break;
+ }
+
+ default:
+ {
+ out.write("(unknown)");
+ break;
+ }
+ }
+
+ int sz = stream.readSize();
+ out.write("\ncontext = ");
+ while(sz-- > 0)
+ {
+ String key = stream.readString();
+ String value = stream.readString();
+ out.write(key + '/' + value);
+ if(sz > 0)
+ {
+ out.write(", ");
+ }
+ }
+
+ com.zeroc.Ice.EncodingVersion v = stream.skipEncapsulation();
+ if(!v.equals(com.zeroc.Ice.Util.Encoding_1_0))
+ {
+ out.write("\nencoding = ");
+ out.write(com.zeroc.Ice.Util.encodingVersionToString(v));
+ }
+ }
+ catch(java.io.IOException ex)
+ {
+ assert(false);
+ }
+ }
+
+ private static byte
+ printHeader(java.io.Writer out, com.zeroc.Ice.InputStream stream)
+ {
+ stream.readByte(); // Don't bother printing the magic number
+ stream.readByte();
+ stream.readByte();
+ stream.readByte();
+
+// byte pMajor = stream.readByte();
+// byte pMinor = stream.readByte();
+// out.write("\nprotocol version = " + (int)pMajor + "." + (int)pMinor);
+ stream.readByte(); // major
+ stream.readByte(); // minor
+
+// byte eMajor = stream.readByte();
+// byte eMinor = stream.readByte();
+// out.write("\nencoding version = " + (int)eMajor + "." + (int)eMinor);
+ stream.readByte(); // major
+ stream.readByte(); // minor
+
+ byte type = stream.readByte();
+
+ try
+ {
+ out.write("\nmessage type = " + (int)type + " (" + getMessageTypeAsString(type) + ')');
+ byte compress = stream.readByte();
+ out.write("\ncompression status = " + (int)compress + ' ');
+ switch(compress)
+ {
+ case (byte)0:
+ {
+ out.write("(not compressed; do not compress response, if any)");
+ break;
+ }
+
+ case (byte)1:
+ {
+ out.write("(not compressed; compress response, if any)");
+ break;
+ }
+
+ case (byte)2:
+ {
+ out.write("(compressed; compress response, if any)");
+ break;
+ }
+
+ default:
+ {
+ out.write("(unknown)");
+ break;
+ }
+ }
+
+ int size = stream.readInt();
+ out.write("\nmessage size = " + size);
+ return type;
+ }
+ catch(java.io.IOException ex)
+ {
+ assert(false);
+ return 0;
+ }
+ }
+
+ static private byte
+ printMessage(java.io.StringWriter s, com.zeroc.Ice.InputStream str)
+ {
+ byte type = printHeader(s, str);
+
+ switch(type)
+ {
+ case Protocol.closeConnectionMsg:
+ case Protocol.validateConnectionMsg:
+ {
+ // We're done.
+ break;
+ }
+
+ case Protocol.requestMsg:
+ {
+ printRequest(s, str);
+ break;
+ }
+
+ case Protocol.requestBatchMsg:
+ {
+ printBatchRequest(s, str);
+ break;
+ }
+
+ case Protocol.replyMsg:
+ {
+ printReply(s, str);
+ break;
+ }
+
+ default:
+ {
+ break;
+ }
+ }
+
+ return type;
+ }
+
+ static private String
+ getMessageTypeAsString(byte type)
+ {
+ switch(type)
+ {
+ case Protocol.requestMsg:
+ return "request";
+ case Protocol.requestBatchMsg:
+ return "batch request";
+ case Protocol.replyMsg:
+ return "reply";
+ case Protocol.closeConnectionMsg:
+ return "close connection";
+ case Protocol.validateConnectionMsg:
+ return "validate connection";
+ default:
+ return "unknown";
+ }
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Transceiver.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Transceiver.java
new file mode 100644
index 00000000000..9fa34e034ce
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Transceiver.java
@@ -0,0 +1,32 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public interface Transceiver
+{
+ java.nio.channels.SelectableChannel fd();
+ void setReadyCallback(ReadyCallback callback);
+
+ int initialize(Buffer readBuffer, Buffer writeBuffer);
+ int closing(boolean initiator, com.zeroc.Ice.LocalException ex);
+ void close();
+
+ EndpointI bind();
+ int write(Buffer buf);
+ int read(Buffer buf);
+
+ String protocol();
+ @Override
+ String toString();
+ String toDetailedString();
+ com.zeroc.Ice.ConnectionInfo getInfo();
+ void checkSendSize(Buffer buf);
+ void setBufferSize(int rcvSize, int sndSize);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpConnector.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpConnector.java
new file mode 100644
index 00000000000..1b9b3a6cdd5
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpConnector.java
@@ -0,0 +1,113 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+final class UdpConnector implements Connector
+{
+ @Override
+ public Transceiver connect()
+ {
+ return new UdpTransceiver(_instance, _addr, _sourceAddr, _mcastInterface, _mcastTtl);
+ }
+
+ public java.nio.channels.SelectableChannel fd()
+ {
+ assert(false); // Shouldn't be called, startConnect always completes immediately.
+ return null;
+ }
+
+ @Override
+ public short type()
+ {
+ return _instance.type();
+ }
+
+ @Override
+ public String toString()
+ {
+ return Network.addrToString(_addr);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return _hashCode;
+ }
+
+ //
+ // Only for use by UdpEndpointI
+ //
+ UdpConnector(ProtocolInstance instance, java.net.InetSocketAddress addr, java.net.InetSocketAddress sourceAddr,
+ String mcastInterface, int mcastTtl, String connectionId)
+ {
+ _instance = instance;
+ _addr = addr;
+ _sourceAddr = sourceAddr;
+ _mcastInterface = mcastInterface;
+ _mcastTtl = mcastTtl;
+ _connectionId = connectionId;
+
+ _hashCode = 5381;
+ _hashCode = HashUtil.hashAdd(_hashCode , _addr.getAddress().getHostAddress());
+ _hashCode = HashUtil.hashAdd(_hashCode , _addr.getPort());
+ if(_sourceAddr != null)
+ {
+ _hashCode = HashUtil.hashAdd(_hashCode , _sourceAddr.getAddress().getHostAddress());
+ }
+ _hashCode = HashUtil.hashAdd(_hashCode , _mcastInterface);
+ _hashCode = HashUtil.hashAdd(_hashCode , _mcastTtl);
+ _hashCode = HashUtil.hashAdd(_hashCode , _connectionId);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj)
+ {
+ if(!(obj instanceof UdpConnector))
+ {
+ return false;
+ }
+
+ if(this == obj)
+ {
+ return true;
+ }
+
+ UdpConnector p = (UdpConnector)obj;
+ if(!_connectionId.equals(p._connectionId))
+ {
+ return false;
+ }
+
+ if(_mcastTtl != p._mcastTtl)
+ {
+ return false;
+ }
+
+ if(_mcastInterface.compareTo(p._mcastInterface) != 0)
+ {
+ return false;
+ }
+
+ if(Network.compareAddress(_sourceAddr, p._sourceAddr) != 0)
+ {
+ return false;
+ }
+
+ return Network.compareAddress(_addr, p._addr) == 0;
+ }
+
+ private ProtocolInstance _instance;
+ private java.net.InetSocketAddress _addr;
+ private java.net.InetSocketAddress _sourceAddr;
+ private String _mcastInterface;
+ private int _mcastTtl;
+ private String _connectionId;
+ private int _hashCode;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpEndpointFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpEndpointFactory.java
new file mode 100644
index 00000000000..0ce60175f5d
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpEndpointFactory.java
@@ -0,0 +1,58 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+final class UdpEndpointFactory implements EndpointFactory
+{
+ UdpEndpointFactory(ProtocolInstance instance)
+ {
+ _instance = instance;
+ }
+
+ @Override
+ public short type()
+ {
+ return _instance.type();
+ }
+
+ @Override
+ public String protocol()
+ {
+ return _instance.protocol();
+ }
+
+ @Override
+ public EndpointI create(java.util.ArrayList<String> args, boolean oaEndpoint)
+ {
+ IPEndpointI endpt = new UdpEndpointI(_instance);
+ endpt.initWithOptions(args, oaEndpoint);
+ return endpt;
+ }
+
+ @Override
+ public EndpointI read(com.zeroc.Ice.InputStream s)
+ {
+ return new UdpEndpointI(_instance, s);
+ }
+
+ @Override
+ public void destroy()
+ {
+ _instance = null;
+ }
+
+ @Override
+ public EndpointFactory clone(ProtocolInstance instance, EndpointFactory delegate)
+ {
+ return new UdpEndpointFactory(instance);
+ }
+
+ private ProtocolInstance _instance;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpEndpointI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpEndpointI.java
new file mode 100644
index 00000000000..d11b031271f
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpEndpointI.java
@@ -0,0 +1,395 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import com.zeroc.Ice.EndpointParseException;
+
+final class UdpEndpointI extends IPEndpointI
+{
+ public UdpEndpointI(ProtocolInstance instance, String ho, int po, java.net.InetSocketAddress sourceAddr,
+ String mcastInterface, int mttl, boolean conn, String conId, boolean co)
+ {
+ super(instance, ho, po, sourceAddr, conId);
+ _mcastInterface = mcastInterface;
+ _mcastTtl = mttl;
+ _connect = conn;
+ _compress = co;
+ }
+
+ public UdpEndpointI(ProtocolInstance instance)
+ {
+ super(instance);
+ _connect = false;
+ _compress = false;
+ }
+
+ public UdpEndpointI(ProtocolInstance instance, com.zeroc.Ice.InputStream s)
+ {
+ super(instance, s);
+ if(s.getEncoding().equals(com.zeroc.Ice.Util.Encoding_1_0))
+ {
+ s.readByte();
+ s.readByte();
+ s.readByte();
+ s.readByte();
+ }
+ // Not transmitted.
+ //_connect = s.readBool();
+ _connect = false;
+ _compress = s.readBool();
+ }
+
+ //
+ // Return the endpoint information.
+ //
+ @Override
+ public com.zeroc.Ice.EndpointInfo getInfo()
+ {
+ com.zeroc.Ice.UDPEndpointInfo info = new com.zeroc.Ice.UDPEndpointInfo()
+ {
+ @Override
+ public short type()
+ {
+ return UdpEndpointI.this.type();
+ }
+
+ @Override
+ public boolean datagram()
+ {
+ return UdpEndpointI.this.datagram();
+ }
+
+ @Override
+ public boolean secure()
+ {
+ return UdpEndpointI.this.secure();
+ }
+ };
+ fillEndpointInfo(info);
+ return info;
+ }
+
+ //
+ // Return the timeout for the endpoint in milliseconds. 0 means
+ // non-blocking, -1 means no timeout.
+ //
+ @Override
+ public int timeout()
+ {
+ return -1;
+ }
+
+ //
+ // Return a new endpoint with a different timeout value, provided
+ // that timeouts are supported by the endpoint. Otherwise the same
+ // endpoint is returned.
+ //
+ @Override
+ public EndpointI timeout(int timeout)
+ {
+ return this;
+ }
+
+ //
+ // Return true if the endpoints support bzip2 compress, or false
+ // otherwise.
+ //
+ @Override
+ public boolean compress()
+ {
+ return _compress;
+ }
+
+ //
+ // Return a new endpoint with a different compression value,
+ // provided that compression is supported by the
+ // endpoint. Otherwise the same endpoint is returned.
+ //
+ @Override
+ public EndpointI compress(boolean compress)
+ {
+ if(compress == _compress)
+ {
+ return this;
+ }
+ else
+ {
+ return new UdpEndpointI(_instance, _host, _port, _sourceAddr, _mcastInterface, _mcastTtl, _connect,
+ _connectionId, compress);
+ }
+ }
+
+ //
+ // Return true if the endpoint is datagram-based.
+ //
+ @Override
+ public boolean datagram()
+ {
+ return true;
+ }
+
+ //
+ // Return a server side transceiver for this endpoint, or null if a
+ // transceiver can only be created by an acceptor.
+ //
+ @Override
+ public Transceiver transceiver()
+ {
+ return new UdpTransceiver(this, _instance, _host, _port, _mcastInterface, _connect);
+ }
+
+ //
+ // Return an acceptor for this endpoint, or null if no acceptors
+ // is available.
+ //
+ @Override
+ public Acceptor acceptor(String adapterName)
+ {
+ return null;
+ }
+
+ public UdpEndpointI endpoint(UdpTransceiver transceiver)
+ {
+ return new UdpEndpointI(_instance, _host, transceiver.effectivePort(), _sourceAddr, _mcastInterface,_mcastTtl,
+ _connect, _connectionId, _compress);
+ }
+
+ //
+ // Convert the endpoint to its string form
+ //
+ @Override
+ public String options()
+ {
+ //
+ // WARNING: Certain features, such as proxy validation in Glacier2,
+ // depend on the format of proxy strings. Changes to toString() and
+ // methods called to generate parts of the reference string could break
+ // these features. Please review for all features that depend on the
+ // format of proxyToString() before changing this and related code.
+ //
+ String s = super.options();
+
+ if(_mcastInterface.length() != 0)
+ {
+ s += " --interface " + _mcastInterface;
+ }
+
+ if(_mcastTtl != -1)
+ {
+ s += " --ttl " + _mcastTtl;
+ }
+
+ if(_connect)
+ {
+ s += " -c";
+ }
+
+ if(_compress)
+ {
+ s += " -z";
+ }
+
+ return s;
+ }
+
+ @Override
+ public int compareTo(EndpointI obj) // From java.lang.Comparable
+ {
+ if(!(obj instanceof UdpEndpointI))
+ {
+ return type() < obj.type() ? -1 : 1;
+ }
+
+ UdpEndpointI p = (UdpEndpointI)obj;
+ if(this == p)
+ {
+ return 0;
+ }
+
+ if(!_connect && p._connect)
+ {
+ return -1;
+ }
+ else if(!p._connect && _connect)
+ {
+ return 1;
+ }
+
+ if(!_compress && p._compress)
+ {
+ return -1;
+ }
+ else if(!p._compress && _compress)
+ {
+ return 1;
+ }
+
+ if(_mcastTtl < p._mcastTtl)
+ {
+ return -1;
+ }
+ else if(p._mcastTtl < _mcastTtl)
+ {
+ return 1;
+ }
+
+ int rc = _mcastInterface.compareTo(p._mcastInterface);
+ if(rc != 0)
+ {
+ return rc;
+ }
+
+ return super.compareTo(obj);
+ }
+
+ //
+ // Marshal the endpoint
+ //
+ @Override
+ public void streamWriteImpl(com.zeroc.Ice.OutputStream s)
+ {
+ super.streamWriteImpl(s);
+ if(s.getEncoding().equals(com.zeroc.Ice.Util.Encoding_1_0))
+ {
+ com.zeroc.Ice.Util.Protocol_1_0.ice_write(s);
+ com.zeroc.Ice.Util.Encoding_1_0.ice_write(s);
+ }
+ // Not transmitted.
+ //s.writeBool(_connect);
+ s.writeBool(_compress);
+ }
+
+ @Override
+ public int hashInit(int h)
+ {
+ h = super.hashInit(h);
+ h = HashUtil.hashAdd(h, _mcastInterface);
+ h = HashUtil.hashAdd(h, _mcastTtl);
+ h = HashUtil.hashAdd(h, _connect);
+ h = HashUtil.hashAdd(h, _compress);
+ return h;
+ }
+
+ @Override
+ public void fillEndpointInfo(com.zeroc.Ice.IPEndpointInfo info)
+ {
+ super.fillEndpointInfo(info);
+ if(info instanceof com.zeroc.Ice.UDPEndpointInfo)
+ {
+ com.zeroc.Ice.UDPEndpointInfo udpInfo = (com.zeroc.Ice.UDPEndpointInfo)info;
+ udpInfo.mcastInterface = _mcastInterface;
+ udpInfo.mcastTtl = _mcastTtl;
+ }
+ }
+
+ @Override
+ protected boolean checkOption(String option, String argument, String endpoint)
+ {
+ if(super.checkOption(option, argument, endpoint))
+ {
+ return true;
+ }
+
+ if(option.equals("-c"))
+ {
+ if(argument != null)
+ {
+ throw new EndpointParseException("unexpected argument `" + argument + "' provided for -c option in " +
+ endpoint);
+ }
+
+ _connect = true;
+ }
+ else if(option.equals("-z"))
+ {
+ if(argument != null)
+ {
+ throw new EndpointParseException("unexpected argument `" + argument + "' provided for -z option in " +
+ endpoint);
+ }
+
+ _compress = true;
+ }
+ else if(option.equals("-v") || option.equals("-e"))
+ {
+ if(argument == null)
+ {
+ throw new EndpointParseException("no argument provided for " + option + " option in endpoint " +
+ endpoint);
+ }
+
+ try
+ {
+ com.zeroc.Ice.EncodingVersion v = com.zeroc.Ice.Util.stringToEncodingVersion(argument);
+ if(v.major != 1 || v.minor != 0)
+ {
+ _instance.logger().warning("deprecated udp endpoint option: " + option);
+ }
+ }
+ catch(com.zeroc.Ice.VersionParseException e)
+ {
+ throw new EndpointParseException("invalid version `" + argument + "' in endpoint " + endpoint + ":\n" +
+ e.str);
+ }
+ }
+ else if(option.equals("--ttl"))
+ {
+ if(argument == null)
+ {
+ throw new EndpointParseException("no argument provided for --ttl option in endpoint " + endpoint);
+ }
+
+ try
+ {
+ _mcastTtl = Integer.parseInt(argument);
+ }
+ catch(NumberFormatException ex)
+ {
+ throw new EndpointParseException("invalid TTL value `" + argument + "' in endpoint " + endpoint);
+ }
+
+ if(_mcastTtl < 0)
+ {
+ throw new EndpointParseException("TTL value `" + argument + "' out of range in endpoint " + endpoint);
+ }
+ }
+ else if(option.equals("--interface"))
+ {
+ if(argument == null)
+ {
+ throw new EndpointParseException("no argument provided for --interface option in endpoint " + endpoint);
+ }
+ _mcastInterface = argument;
+ }
+ else
+ {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ protected Connector createConnector(java.net.InetSocketAddress addr, NetworkProxy proxy)
+ {
+ return new UdpConnector(_instance, addr, _sourceAddr, _mcastInterface, _mcastTtl, _connectionId);
+ }
+
+ @Override
+ protected IPEndpointI createEndpoint(String host, int port, String connectionId)
+ {
+ return new UdpEndpointI(_instance, host, port, _sourceAddr, _mcastInterface,_mcastTtl, _connect,
+ connectionId, _compress);
+ }
+
+ private String _mcastInterface = "";
+ private int _mcastTtl = -1;
+ private boolean _connect;
+ private boolean _compress;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpTransceiver.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpTransceiver.java
new file mode 100644
index 00000000000..7090b6b27d4
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpTransceiver.java
@@ -0,0 +1,653 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+final class UdpTransceiver implements Transceiver
+{
+ @Override
+ public java.nio.channels.SelectableChannel fd()
+ {
+ assert(_fd != null);
+ return _fd;
+ }
+
+ @Override
+ public void setReadyCallback(ReadyCallback callback)
+ {
+ }
+
+ @Override
+ public int initialize(Buffer readBuffer, Buffer writeBuffer)
+ {
+ //
+ // Nothing to do.
+ //
+ return SocketOperation.None;
+ }
+
+ @Override
+ public int closing(boolean initiator, com.zeroc.Ice.LocalException ex)
+ {
+ //
+ // Nothing to do.
+ //
+ return SocketOperation.None;
+ }
+
+ @Override
+ public void close()
+ {
+ assert(_fd != null);
+
+ try
+ {
+ _fd.close();
+ }
+ catch(java.io.IOException ex)
+ {
+ }
+ _fd = null;
+ }
+
+ @Override
+ public EndpointI bind()
+ {
+ if(_addr.getAddress().isMulticastAddress())
+ {
+ Network.setReuseAddress(_fd, true);
+ _mcastAddr = _addr;
+ if(System.getProperty("os.name").startsWith("Windows") ||
+ System.getProperty("java.vm.name").startsWith("OpenJDK"))
+ {
+ //
+ // Windows does not allow binding to the mcast address itself
+ // so we bind to INADDR_ANY (0.0.0.0) instead. As a result,
+ // bi-directional connection won't work because the source
+ // address won't be the multicast address and the client will
+ // therefore reject the datagram.
+ //
+ int protocol =
+ _mcastAddr.getAddress().getAddress().length == 4 ? Network.EnableIPv4 : Network.EnableIPv6;
+ _addr = Network.getAddressForServer("", _port, protocol, _instance.preferIPv6());
+ }
+ _addr = Network.doBind(_fd, _addr);
+ configureMulticast(_mcastAddr, _mcastInterface, -1);
+
+ if(_port == 0)
+ {
+ _mcastAddr = new java.net.InetSocketAddress(_mcastAddr.getAddress(), _addr.getPort());
+ }
+ }
+ else
+ {
+ if(!System.getProperty("os.name").startsWith("Windows"))
+ {
+ //
+ // Enable SO_REUSEADDR on Unix platforms to allow
+ // re-using the socket even if it's in the TIME_WAIT
+ // state. On Windows, this doesn't appear to be
+ // necessary and enabling SO_REUSEADDR would actually
+ // not be a good thing since it allows a second
+ // process to bind to an address even it's already
+ // bound by another process.
+ //
+ // TODO: using SO_EXCLUSIVEADDRUSE on Windows would
+ // probably be better but it's only supported by recent
+ // Windows versions (XP SP2, Windows Server 2003).
+ //
+ Network.setReuseAddress(_fd, true);
+ }
+ _addr = Network.doBind(_fd, _addr);
+ }
+
+ _bound = true;
+ _endpoint = _endpoint.endpoint(this);
+ return _endpoint;
+ }
+
+ @Override
+ public int write(Buffer buf)
+ {
+ if(!buf.b.hasRemaining())
+ {
+ return SocketOperation.None;
+ }
+
+ assert(buf.b.position() == 0);
+ assert(_fd != null && _state >= StateConnected);
+
+ // The caller is supposed to check the send size before by calling checkSendSize
+ assert(java.lang.Math.min(_maxPacketSize, _sndSize - _udpOverhead) >= buf.size());
+
+ int ret = 0;
+ while(true)
+ {
+ try
+ {
+ if(_state == StateConnected)
+ {
+ ret = _fd.write(buf.b);
+ }
+ else
+ {
+ if(_peerAddr == null)
+ {
+ throw new com.zeroc.Ice.SocketException(); // No peer has sent a datagram yet.
+ }
+ ret = _fd.send(buf.b, _peerAddr);
+ }
+ break;
+ }
+ catch(java.nio.channels.AsynchronousCloseException ex)
+ {
+ throw new com.zeroc.Ice.ConnectionLostException(ex);
+ }
+ catch(java.net.PortUnreachableException ex)
+ {
+ throw new com.zeroc.Ice.ConnectionLostException(ex);
+ }
+ catch(java.io.InterruptedIOException ex)
+ {
+ continue;
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new com.zeroc.Ice.SocketException(ex);
+ }
+ }
+
+ if(ret == 0)
+ {
+ return SocketOperation.Write;
+ }
+
+ assert(ret == buf.b.limit());
+ buf.b.position(buf.b.limit());
+ return SocketOperation.None;
+ }
+
+ @Override
+ public int read(Buffer buf)
+ {
+ if(!buf.b.hasRemaining())
+ {
+ return SocketOperation.None;
+ }
+
+ assert(buf.b.position() == 0);
+
+ final int packetSize = java.lang.Math.min(_maxPacketSize, _rcvSize - _udpOverhead);
+ buf.resize(packetSize, true);
+ buf.b.position(0);
+
+ int ret = 0;
+ while(true)
+ {
+ try
+ {
+ java.net.SocketAddress peerAddr = _fd.receive(buf.b);
+ if(peerAddr == null || buf.b.position() == 0)
+ {
+ return SocketOperation.Read;
+ }
+
+ _peerAddr = (java.net.InetSocketAddress)peerAddr;
+ ret = buf.b.position();
+ break;
+ }
+ catch(java.nio.channels.AsynchronousCloseException ex)
+ {
+ throw new com.zeroc.Ice.ConnectionLostException(ex);
+ }
+ catch(java.net.PortUnreachableException ex)
+ {
+ throw new com.zeroc.Ice.ConnectionLostException(ex);
+ }
+ catch(java.io.InterruptedIOException ex)
+ {
+ continue;
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new com.zeroc.Ice.ConnectionLostException(ex);
+ }
+ }
+
+ if(_state == StateNeedConnect)
+ {
+ //
+ // If we must connect, we connect to the first peer that sends us a packet.
+ //
+ Network.doConnect(_fd, _peerAddr, null);
+ _state = StateConnected;
+
+ if(_instance.traceLevel() >= 1)
+ {
+ String s = "connected " + _instance.protocol() + " socket\n" + toString();
+ _instance.logger().trace(_instance.traceCategory(), s);
+ }
+ }
+
+ buf.resize(ret, true);
+ buf.b.position(ret);
+
+ return SocketOperation.None;
+ }
+
+ @Override
+ public String protocol()
+ {
+ return _instance.protocol();
+ }
+
+ @Override
+ public String toString()
+ {
+ if(_fd == null)
+ {
+ return "<closed>";
+ }
+
+ String s;
+ if(_incoming && !_bound)
+ {
+ s = "local address = " + Network.addrToString(_addr);
+ }
+ else if(_state == StateNotConnected)
+ {
+ java.net.DatagramSocket socket = _fd.socket();
+ s = "local address = " + Network.addrToString((java.net.InetSocketAddress)socket.getLocalSocketAddress());
+ if(_peerAddr != null)
+ {
+ s += "\nremote address = " + Network.addrToString(_peerAddr);
+ }
+ }
+ else
+ {
+ s = Network.fdToString(_fd);
+ }
+
+ if(_mcastAddr != null)
+ {
+ s += "\nmulticast address = " + Network.addrToString(_mcastAddr);
+ }
+ return s;
+ }
+
+ @Override
+ public String toDetailedString()
+ {
+ StringBuilder s = new StringBuilder(toString());
+ java.util.List<String> intfs =
+ Network.getHostsForEndpointExpand(_addr.getAddress().getHostAddress(), _instance.protocolSupport(), true);
+ if(!intfs.isEmpty())
+ {
+ s.append("\nlocal interfaces = ");
+ s.append(com.zeroc.IceUtilInternal.StringUtil.joinString(intfs, ", "));
+ }
+ return s.toString();
+ }
+
+ @Override
+ public com.zeroc.Ice.ConnectionInfo getInfo()
+ {
+ com.zeroc.Ice.UDPConnectionInfo info = new com.zeroc.Ice.UDPConnectionInfo();
+ if(_fd != null)
+ {
+ java.net.DatagramSocket socket = _fd.socket();
+ info.localAddress = socket.getLocalAddress().getHostAddress();
+ info.localPort = socket.getLocalPort();
+ if(_state == StateNotConnected)
+ {
+ if(_peerAddr != null)
+ {
+ info.remoteAddress = _peerAddr.getAddress().getHostAddress();
+ info.remotePort = _peerAddr.getPort();
+ }
+ }
+ else
+ {
+ if(socket.getInetAddress() != null)
+ {
+ info.remoteAddress = socket.getInetAddress().getHostAddress();
+ info.remotePort = socket.getPort();
+ }
+ }
+ if(!socket.isClosed())
+ {
+ info.rcvSize = Network.getRecvBufferSize(_fd);
+ info.sndSize = Network.getSendBufferSize(_fd);
+ }
+ }
+ if(_mcastAddr != null)
+ {
+ info.mcastAddress = _mcastAddr.getAddress().getHostAddress();
+ info.mcastPort = _mcastAddr.getPort();
+ }
+ return info;
+ }
+
+ @Override
+ public void checkSendSize(Buffer buf)
+ {
+ //
+ // The maximum packetSize is either the maximum allowable UDP packet size, or
+ // the UDP send buffer size (which ever is smaller).
+ //
+ final int packetSize = java.lang.Math.min(_maxPacketSize, _sndSize - _udpOverhead);
+ if(packetSize < buf.size())
+ {
+ throw new com.zeroc.Ice.DatagramLimitException();
+ }
+ }
+
+ @Override
+ public void setBufferSize(int rcvSize, int sndSize)
+ {
+ setBufSize(rcvSize, sndSize);
+ }
+
+ public final int effectivePort()
+ {
+ return _addr.getPort();
+ }
+
+ //
+ // Only for use by UdpEndpoint
+ //
+ UdpTransceiver(ProtocolInstance instance, java.net.InetSocketAddress addr, java.net.InetSocketAddress sourceAddr,
+ String mcastInterface, int mcastTtl)
+ {
+ _instance = instance;
+ _state = StateNeedConnect;
+ _addr = addr;
+
+ try
+ {
+ _fd = Network.createUdpSocket(_addr);
+ setBufSize(-1, -1);
+ Network.setBlock(_fd, false);
+ //
+ // NOTE: setting the multicast interface before performing the
+ // connect is important for some OS such as OS X.
+ //
+ if(_addr.getAddress().isMulticastAddress())
+ {
+ configureMulticast(null, mcastInterface, mcastTtl);
+ }
+ Network.doConnect(_fd, _addr, sourceAddr);
+ _state = StateConnected; // We're connected now
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ _fd = null;
+ throw ex;
+ }
+ }
+
+ //
+ // Only for use by UdpEndpoint
+ //
+ UdpTransceiver(UdpEndpointI endpoint, ProtocolInstance instance, String host, int port, String mcastInterface,
+ boolean connect)
+ {
+ _endpoint = endpoint;
+ _instance = instance;
+ _state = connect ? StateNeedConnect : StateNotConnected;
+ _mcastInterface = mcastInterface;
+ _incoming = true;
+ _port = port;
+
+ try
+ {
+ _addr = Network.getAddressForServer(host, port, instance.protocolSupport(), instance.preferIPv6());
+ _fd = Network.createUdpSocket(_addr);
+ setBufSize(-1, -1);
+ Network.setBlock(_fd, false);
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ _fd = null;
+ throw ex;
+ }
+ }
+
+ private synchronized void setBufSize(int rcvSize, int sndSize)
+ {
+ assert(_fd != null);
+
+ for(int i = 0; i < 2; ++i)
+ {
+ boolean isSnd;
+ String direction;
+ String prop;
+ int dfltSize;
+ int sizeRequested;
+ if(i == 0)
+ {
+ isSnd = false;
+ direction = "receive";
+ prop = "Ice.UDP.RcvSize";
+ dfltSize = Network.getRecvBufferSize(_fd);
+ sizeRequested = rcvSize;
+ _rcvSize = dfltSize;
+ }
+ else
+ {
+ isSnd = true;
+ direction = "send";
+ prop = "Ice.UDP.SndSize";
+ dfltSize = Network.getSendBufferSize(_fd);
+ sizeRequested = sndSize;
+ _sndSize = dfltSize;
+ }
+
+ //
+ // Get property for buffer size if size not passed in.
+ //
+ if(sizeRequested == -1)
+ {
+ sizeRequested = _instance.properties().getPropertyAsIntWithDefault(prop, dfltSize);
+ }
+ //
+ // Check for sanity.
+ //
+ if(sizeRequested < (_udpOverhead + Protocol.headerSize))
+ {
+ _instance.logger().warning("Invalid " + prop + " value of " + sizeRequested + " adjusted to " +
+ dfltSize);
+ sizeRequested = dfltSize;
+ }
+
+ if(sizeRequested != dfltSize)
+ {
+ //
+ // Try to set the buffer size. The kernel will silently adjust
+ // the size to an acceptable value. Then read the size back to
+ // get the size that was actually set.
+ //
+ int sizeSet;
+ if(i == 0)
+ {
+ Network.setRecvBufferSize(_fd, sizeRequested);
+ _rcvSize = Network.getRecvBufferSize(_fd);
+ sizeSet = _rcvSize;
+ }
+ else
+ {
+ Network.setSendBufferSize(_fd, sizeRequested);
+ _sndSize = Network.getSendBufferSize(_fd);
+ sizeSet = _sndSize;
+ }
+
+ //
+ // Warn if the size that was set is less than the requested size
+ // and we have not already warned
+ //
+ if(sizeSet < sizeRequested)
+ {
+ BufSizeWarnInfo winfo = _instance.getBufSizeWarn(com.zeroc.Ice.UDPEndpointType.value);
+ if((isSnd && (!winfo.sndWarn || winfo.sndSize != sizeRequested)) ||
+ (!isSnd && (!winfo.rcvWarn || winfo.rcvSize != sizeRequested)))
+ {
+ _instance.logger().warning("UDP " + direction + " buffer size: requested size of "
+ + sizeRequested + " adjusted to " + sizeSet);
+
+ if(isSnd)
+ {
+ _instance.setSndBufSizeWarn(com.zeroc.Ice.UDPEndpointType.value, sizeRequested);
+ }
+ else
+ {
+ _instance.setRcvBufSizeWarn(com.zeroc.Ice.UDPEndpointType.value, sizeRequested);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void configureMulticast(java.net.InetSocketAddress group, String interfaceAddr, int ttl)
+ {
+ try
+ {
+ java.net.NetworkInterface intf = null;
+
+ if(interfaceAddr.length() != 0)
+ {
+ intf = java.net.NetworkInterface.getByName(interfaceAddr);
+ if(intf == null)
+ {
+ try
+ {
+ intf = java.net.NetworkInterface.getByInetAddress(
+ java.net.InetAddress.getByName(interfaceAddr));
+ }
+ catch(Exception ex)
+ {
+ }
+ }
+ }
+
+ if(group != null)
+ {
+ //
+ // Join multicast group.
+ //
+ if(intf != null)
+ {
+ _fd.join(group.getAddress(), intf);
+ }
+ else
+ {
+ boolean join = false;
+ //
+ // If the user doesn't specify an interface, we join to the multicast group with every
+ // interface that supports multicast and has a configured address with the same protocol
+ // as the group address protocol.
+ //
+ int protocol = group.getAddress().getAddress().length == 4 ? Network.EnableIPv4 :
+ Network.EnableIPv6;
+
+ java.util.List<java.net.NetworkInterface> interfaces =
+ java.util.Collections.list(java.net.NetworkInterface.getNetworkInterfaces());
+ for(java.net.NetworkInterface iface : interfaces)
+ {
+ boolean hasProtocolAddress = false;
+ java.util.List<java.net.InetAddress> addresses =
+ java.util.Collections.list(iface.getInetAddresses());
+ for(java.net.InetAddress address : addresses)
+ {
+ if(address.getAddress().length == 4 && protocol == Network.EnableIPv4 ||
+ address.getAddress().length != 4 && protocol == Network.EnableIPv6)
+ {
+ hasProtocolAddress = true;
+ break;
+ }
+ }
+
+ if(hasProtocolAddress)
+ {
+ _fd.join(group.getAddress(), iface);
+ join = true;
+ }
+ }
+
+ if(!join)
+ {
+ throw new com.zeroc.Ice.SocketException(new IllegalArgumentException(
+ "There are no interfaces that are configured for the group protocol.\n" +
+ "Cannot join the multicast group."));
+ }
+ }
+ }
+ else if(intf != null)
+ {
+ //
+ // Otherwise, set the multicast interface if specified.
+ //
+ _fd.setOption(java.net.StandardSocketOptions.IP_MULTICAST_IF, intf);
+ }
+
+ if(ttl != -1)
+ {
+ _fd.setOption(java.net.StandardSocketOptions.IP_MULTICAST_TTL, ttl);
+ }
+ }
+ catch(Exception ex)
+ {
+ throw new com.zeroc.Ice.SocketException(ex);
+ }
+ }
+
+ @Override
+ protected synchronized void finalize()
+ throws Throwable
+ {
+ try
+ {
+ com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_fd == null);
+ }
+ catch(java.lang.Exception ex)
+ {
+ }
+ finally
+ {
+ super.finalize();
+ }
+ }
+
+ private UdpEndpointI _endpoint = null;
+ private ProtocolInstance _instance;
+
+ private int _state;
+ private int _rcvSize;
+ private int _sndSize;
+ private java.nio.channels.DatagramChannel _fd;
+ private java.net.InetSocketAddress _addr;
+ private java.net.InetSocketAddress _mcastAddr = null;
+ private String _mcastInterface;
+ private java.net.InetSocketAddress _peerAddr = null;
+
+ private boolean _incoming = false;
+ private int _port = 0;
+ private boolean _bound = false;
+
+ //
+ // The maximum IP datagram size is 65535. Subtract 20 bytes for the IP header and 8 bytes for the UDP header
+ // to get the maximum payload.
+ //
+ private final static int _udpOverhead = 20 + 8;
+ private final static int _maxPacketSize = 65535 - _udpOverhead;
+
+ private static final int StateNeedConnect = 0;
+ private static final int StateConnected = 1;
+ private static final int StateNotConnected = 2;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Util.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Util.java
new file mode 100644
index 00000000000..77d57aa5837
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Util.java
@@ -0,0 +1,301 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import java.util.concurrent.ThreadFactory;
+
+public final class Util
+{
+ static String
+ createThreadName(final com.zeroc.Ice.Properties properties, final String name)
+ {
+ String threadName = properties.getProperty("Ice.ProgramName");
+ if(threadName.length() > 0)
+ {
+ threadName += "-";
+ }
+
+ threadName = threadName + name;
+ return threadName;
+ }
+
+ static ThreadFactory
+ createThreadFactory(final com.zeroc.Ice.Properties properties, final String name)
+ {
+ return new java.util.concurrent.ThreadFactory()
+ {
+ @Override
+ public Thread newThread(Runnable r)
+ {
+ Thread t = new Thread(r);
+ t.setName(name);
+
+ if(properties.getProperty("Ice.ThreadPriority").length() > 0)
+ {
+ t.setPriority(Util.getThreadPriorityProperty(properties, "Ice"));
+ }
+ return t;
+ }
+ };
+ }
+
+ public static Instance
+ getInstance(com.zeroc.Ice.Communicator communicator)
+ {
+ com.zeroc.Ice.CommunicatorI p = (com.zeroc.Ice.CommunicatorI)communicator;
+ return p.getInstance();
+ }
+
+ public static ProtocolPluginFacade
+ getProtocolPluginFacade(com.zeroc.Ice.Communicator communicator)
+ {
+ return new ProtocolPluginFacadeI(communicator);
+ }
+
+ //
+ // Given a path name, first try to open it as a class path resource (the path is
+ // treated as absolute). If that fails, fall back to the file system. Returns null
+ // if the file does not exist and raises IOException if an error occurs.
+ //
+ public static java.io.InputStream
+ openResource(ClassLoader cl, String path)
+ throws java.io.IOException
+ {
+ //
+ // Calling getResourceAsStream on the class loader means all paths are absolute,
+ // whereas calling it on the class means all paths are relative to the class
+ // unless the path has a leading forward slash. We call it on the class loader.
+ //
+ // getResourceAsStream returns null if the resource can't be found.
+ //
+ java.io.InputStream stream = null;
+ try
+ {
+ stream = cl.getResourceAsStream(path);
+ }
+ catch(IllegalArgumentException ex)
+ {
+ //
+ // With JDK-7 this can happen if the result url (base url + path) produces a
+ // malformed url for an URLClassLoader. For example the code in following
+ // comment will produce this exception under Windows.
+ //
+ // URLClassLoader cl = new URLClassLoader(new URL[] {new URL("http://localhost:8080/")});
+ // java.io.InputStream in = Util.openResource(cl, "c:\\foo.txt");
+ //
+ }
+ if(stream == null)
+ {
+ try
+ {
+ java.io.File f = new java.io.File(path);
+ if(f.exists())
+ {
+ stream = new java.io.FileInputStream(f);
+ }
+ }
+ catch(java.lang.SecurityException ex)
+ {
+ // Ignore - a security manager may forbid access to the local file system.
+ }
+ }
+
+ return stream;
+ }
+
+ public static Class<?>
+ findClass(String className, ClassLoader cl)
+ throws LinkageError
+ {
+ //
+ // Try to load the class using the given class loader (if any). If that fails (or
+ // none is provided), we try to load the class a few more ways before giving up.
+ //
+ // Calling Class.forName() doesn't always work. For example, if Ice.jar is installed
+ // as an extension (in $JAVA_HOME/jre/lib/ext), calling Class.forName(name) uses the
+ // extension class loader, which will not look in CLASSPATH for the target class.
+ //
+
+ Class<?> c = null;
+
+ if(cl != null)
+ {
+ c = loadClass(className, cl);
+ }
+
+ //
+ // Try using the current thread's class loader.
+ //
+ if(c == null)
+ {
+ try
+ {
+ cl = Thread.currentThread().getContextClassLoader();
+ if(cl != null)
+ {
+ c = loadClass(className, cl);
+ }
+ }
+ catch(SecurityException ex)
+ {
+ }
+ }
+
+ //
+ // Try using Class.forName().
+ //
+ try
+ {
+ if(c == null)
+ {
+ c = Class.forName(className);
+ }
+ }
+ catch(ClassNotFoundException ex)
+ {
+ // Ignore
+ }
+
+ //
+ // Fall back to the system class loader (which knows about CLASSPATH).
+ //
+ if(c == null)
+ {
+ try
+ {
+ cl = ClassLoader.getSystemClassLoader();
+ if(cl != null)
+ {
+ c = loadClass(className, cl);
+ }
+ }
+ catch(SecurityException ex)
+ {
+ }
+ }
+
+ return c;
+ }
+
+ private static Class<?>
+ loadClass(String className, ClassLoader cl)
+ {
+ if(cl != null)
+ {
+ try
+ {
+ return cl.loadClass(className);
+ }
+ catch(ClassNotFoundException ex)
+ {
+ // Ignore
+ }
+ }
+
+ return null;
+ }
+
+ public static int
+ getThreadPriorityProperty(com.zeroc.Ice.Properties properties, String prefix)
+ {
+ String pri = properties.getProperty(prefix + ".ThreadPriority");
+ if(pri.equals("MIN_PRIORITY") || pri.equals("java.lang.Thread.MIN_PRIORITY"))
+ {
+ return java.lang.Thread.MIN_PRIORITY;
+ }
+ else if(pri.equals("NORM_PRIORITY") || pri.equals("java.lang.Thread.NORM_PRIORITY"))
+ {
+ return java.lang.Thread.NORM_PRIORITY;
+ }
+ else if(pri.equals("MAX_PRIORITY") || pri.equals("java.lang.Thread.MAX_PRIORITY"))
+ {
+ return java.lang.Thread.MAX_PRIORITY;
+ }
+
+ try
+ {
+ return Integer.parseInt(pri);
+ }
+ catch(NumberFormatException ex)
+ {
+ }
+ return java.lang.Thread.NORM_PRIORITY;
+ }
+
+ //
+ // Translate a Slice type id (such as "::Module::Type") into its equivalent
+ // Java class name (such as "Module.Type").
+ //
+ public static String typeIdToClassName(String typeId)
+ {
+ if(!typeId.startsWith("::"))
+ {
+ return null;
+ }
+
+ StringBuilder buf = new StringBuilder(typeId.length());
+
+ int start = 2;
+ boolean done = false;
+ while(!done)
+ {
+ int end = typeId.indexOf(':', start);
+ String s;
+ if(end != -1)
+ {
+ s = typeId.substring(start, end);
+ start = end + 2;
+ }
+ else
+ {
+ s = typeId.substring(start);
+ done = true;
+ }
+ if(buf.length() > 0)
+ {
+ buf.append('.');
+ }
+ buf.append(fixKwd(s));
+ }
+
+ return buf.toString();
+ }
+
+ private static String fixKwd(String name)
+ {
+ //
+ // Keyword list. *Must* be kept in alphabetical order. Note that checkedCast and uncheckedCast
+ // are not Java keywords, but are in this list to prevent illegal code being generated if
+ // someone defines Slice operations with that name.
+ //
+ final String[] keywordList =
+ {
+ "abstract", "assert", "boolean", "break", "byte", "case", "catch",
+ "char", "checkedCast", "class", "clone", "const", "continue", "default", "do",
+ "double", "else", "enum", "equals", "extends", "false", "final", "finalize",
+ "finally", "float", "for", "getClass", "goto", "hashCode", "if",
+ "implements", "import", "instanceof", "int", "interface", "long",
+ "native", "new", "notify", "notifyAll", "null", "package", "private",
+ "protected", "public", "return", "short", "static", "strictfp", "super", "switch",
+ "synchronized", "this", "throw", "throws", "toString", "transient",
+ "true", "try", "uncheckedCast", "void", "volatile", "wait", "while"
+ };
+ boolean found = java.util.Arrays.binarySearch(keywordList, name) >= 0;
+ return found ? "_" + name : name;
+ }
+
+ //
+ // Return true if we're running on Android.
+ //
+ public static boolean isAndroid()
+ {
+ return System.getProperty("java.vm.name").startsWith("Dalvik");
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ValueFactoryManagerI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ValueFactoryManagerI.java
new file mode 100644
index 00000000000..da94133eed3
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ValueFactoryManagerI.java
@@ -0,0 +1,35 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import com.zeroc.Ice.ValueFactory;
+
+final class ValueFactoryManagerI implements com.zeroc.Ice.ValueFactoryManager
+{
+ public synchronized void add(ValueFactory factory, String id)
+ {
+ Object o = _factoryMap.get(id);
+ if(o != null)
+ {
+ com.zeroc.Ice.AlreadyRegisteredException ex = new com.zeroc.Ice.AlreadyRegisteredException();
+ ex.id = id;
+ ex.kindOfObject = "value factory";
+ throw ex;
+ }
+ _factoryMap.put(id, factory);
+ }
+
+ public synchronized ValueFactory find(String id)
+ {
+ return _factoryMap.get(id);
+ }
+
+ private java.util.Map<String, ValueFactory> _factoryMap = new java.util.HashMap<>();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ValueWriter.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ValueWriter.java
new file mode 100644
index 00000000000..45f4c8e8a94
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ValueWriter.java
@@ -0,0 +1,191 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+public final class ValueWriter
+{
+ public static void
+ write(java.lang.Object obj, com.zeroc.IceUtilInternal.OutputBase out)
+ {
+ writeValue(null, obj, null, out);
+ }
+
+ private static void
+ writeValue(String name, java.lang.Object value, java.util.Map<java.lang.Object, java.lang.Object> objectTable,
+ com.zeroc.IceUtilInternal.OutputBase out)
+ {
+ if(value == null)
+ {
+ writeName(name, out);
+ out.print("(null)");
+ }
+ else
+ {
+ Class<?> c = value.getClass();
+ if(c.equals(Byte.class) || c.equals(Short.class) || c.equals(Integer.class) || c.equals(Long.class) ||
+ c.equals(Double.class) || c.equals(Float.class) || c.equals(Boolean.class))
+ {
+ writeName(name, out);
+ out.print(value.toString());
+ }
+ else if(c.equals(String.class))
+ {
+ //
+ // Indent the lines of a string value.
+ //
+ writeName(name, out);
+ out.print("\"");
+ out.useCurrentPosAsIndent();
+ String str = value.toString();
+ int start = 0, pos;
+ while(start < str.length() && (pos = str.indexOf('\n', start)) != -1)
+ {
+ out.print(str.substring(start, pos));
+ out.nl();
+ start = pos + 1;
+ }
+ if(start < str.length())
+ {
+ out.print(str.substring(start));
+ }
+ out.print("\"");
+ out.restoreIndent();
+ }
+ else if(c.isArray())
+ {
+ int n = java.lang.reflect.Array.getLength(value);
+ for(int i = 0; i < n; i++)
+ {
+ String elem = (name != null ? name : "");
+ elem += "[" + i + "]";
+ writeValue(elem, java.lang.reflect.Array.get(value, i), objectTable, out);
+ }
+ }
+ else if(value instanceof java.util.Map)
+ {
+ java.util.Map<?,?> map = (java.util.Map<?,?>)value;
+ java.util.Iterator<?> i = map.entrySet().iterator();
+ while(i.hasNext())
+ {
+ java.util.Map.Entry<?,?> entry = (java.util.Map.Entry<?,?>)i.next();
+ String elem = (name != null ? name + "." : "");
+ writeValue(elem + "key", entry.getKey(), objectTable, out);
+ writeValue(elem + "value", entry.getValue(), objectTable, out);
+ }
+ }
+ else if(value instanceof com.zeroc.Ice._ObjectPrxI)
+ {
+ writeName(name, out);
+ com.zeroc.Ice._ObjectPrxI proxy = (com.zeroc.Ice._ObjectPrxI)value;
+ out.print(proxy.__reference().toString());
+ }
+ else if(value instanceof com.zeroc.Ice.Value)
+ {
+ //
+ // Check for recursion.
+ //
+ if(objectTable != null && objectTable.containsKey(value))
+ {
+ writeName(name, out);
+ out.print("(recursive)");
+ }
+ else
+ {
+ if(objectTable == null)
+ {
+ objectTable = new java.util.IdentityHashMap<java.lang.Object, java.lang.Object>();
+ }
+ objectTable.put(value, null);
+ writeFields(name, value, c, objectTable, out);
+ }
+ }
+ else if(value instanceof java.lang.Enum)
+ {
+ writeName(name, out);
+ out.print(((java.lang.Enum<?>)value).name());
+ }
+ else
+ {
+ //
+ // Must be struct.
+ //
+ writeFields(name, value, c, objectTable, out);
+ }
+ }
+ }
+
+ private static void
+ writeFields(String name, java.lang.Object obj, Class<?> c,
+ java.util.Map<java.lang.Object, java.lang.Object> objectTable, com.zeroc.IceUtilInternal.OutputBase out)
+ {
+ if(!c.equals(java.lang.Object.class))
+ {
+ //
+ // Write the superclass first.
+ //
+ writeFields(name, obj, c.getSuperclass(), objectTable, out);
+
+ //
+ // Write the declared fields of the given class. We prefer to use the declared
+ // fields because it includes protected fields that may have been defined using
+ // the Slice "protected" metadata. However, if a security manager prevents us
+ // from obtaining the declared fields, we will fall back to using the public ones.
+ //
+ java.lang.reflect.Field[] fields = null;
+ try
+ {
+ fields = c.getDeclaredFields();
+ }
+ catch(java.lang.SecurityException ex)
+ {
+ try
+ {
+ fields = c.getFields();
+ }
+ catch(java.lang.SecurityException e)
+ {
+ return; // Nothing else we can do.
+ }
+ }
+ assert(fields != null);
+ for(java.lang.reflect.Field field : fields)
+ {
+ //
+ // Only write public, non-static fields.
+ //
+ int mods = field.getModifiers();
+ if(java.lang.reflect.Modifier.isPublic(mods) && !java.lang.reflect.Modifier.isStatic(mods))
+ {
+ String fieldName = (name != null ? name + '.' + field.getName() : field.getName());
+
+ try
+ {
+ java.lang.Object value = field.get(obj);
+ writeValue(fieldName, value, objectTable, out);
+ }
+ catch(IllegalAccessException ex)
+ {
+ assert(false);
+ }
+ }
+ }
+ }
+ }
+
+ private static void
+ writeName(String name, com.zeroc.IceUtilInternal.OutputBase out)
+ {
+ if(name != null)
+ {
+ out.nl();
+ out.print(name + " = ");
+ }
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSAcceptor.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSAcceptor.java
new file mode 100644
index 00000000000..0e8b0d1ecb8
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSAcceptor.java
@@ -0,0 +1,82 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+final class WSAcceptor implements Acceptor
+{
+ @Override
+ public java.nio.channels.ServerSocketChannel fd()
+ {
+ return _delegate.fd();
+ }
+
+ @Override
+ public void setReadyCallback(ReadyCallback callback)
+ {
+ _delegate.setReadyCallback(callback);
+ }
+
+ @Override
+ public void close()
+ {
+ _delegate.close();
+ }
+
+ @Override
+ public EndpointI listen()
+ {
+ _endpoint = _endpoint.endpoint(_delegate.listen());
+ return _endpoint;
+ }
+
+ @Override
+ public Transceiver accept()
+ {
+ //
+ // WebSocket handshaking is performed in TransceiverI::initialize, since
+ // accept must not block.
+ //
+ return new WSTransceiver(_instance, _delegate.accept());
+ }
+
+ @Override
+ public String protocol()
+ {
+ return _delegate.protocol();
+ }
+
+ @Override
+ public String toString()
+ {
+ return _delegate.toString();
+ }
+
+ @Override
+ public String toDetailedString()
+ {
+ return _delegate.toDetailedString();
+ }
+
+ public Acceptor delegate()
+ {
+ return _delegate;
+ }
+
+ WSAcceptor(WSEndpoint endpoint, ProtocolInstance instance, Acceptor del)
+ {
+ _endpoint = endpoint;
+ _instance = instance;
+ _delegate = del;
+ }
+
+ private WSEndpoint _endpoint;
+ private ProtocolInstance _instance;
+ private Acceptor _delegate;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSConnector.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSConnector.java
new file mode 100644
index 00000000000..cf4fff54e2c
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSConnector.java
@@ -0,0 +1,77 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+final class WSConnector implements Connector
+{
+ @Override
+ public Transceiver connect()
+ {
+ return new WSTransceiver(_instance, _delegate.connect(), _host, _resource);
+ }
+
+ @Override
+ public short type()
+ {
+ return _delegate.type();
+ }
+
+ @Override
+ public String toString()
+ {
+ return _delegate.toString();
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return _delegate.hashCode();
+ }
+
+ WSConnector(ProtocolInstance instance, Connector del, String host, String resource)
+ {
+ _instance = instance;
+ _delegate = del;
+ _host = host;
+ _resource = resource;
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj)
+ {
+ if(!(obj instanceof WSConnector))
+ {
+ return false;
+ }
+
+ if(this == obj)
+ {
+ return true;
+ }
+
+ WSConnector p = (WSConnector)obj;
+ if(!_delegate.equals(p._delegate))
+ {
+ return false;
+ }
+
+ if(!_resource.equals(p._resource))
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ private ProtocolInstance _instance;
+ private Connector _delegate;
+ private String _host;
+ private String _resource;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSEndpoint.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSEndpoint.java
new file mode 100644
index 00000000000..8f15c5a324c
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSEndpoint.java
@@ -0,0 +1,326 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import com.zeroc.Ice.WSEndpointInfo;
+
+final class WSEndpoint extends EndpointI
+{
+ public WSEndpoint(ProtocolInstance instance, EndpointI del, String res)
+ {
+ _instance = instance;
+ _delegate = del;
+ _resource = res;
+ }
+
+ public WSEndpoint(ProtocolInstance instance, EndpointI del, java.util.ArrayList<String> args)
+ {
+ _instance = instance;
+ _delegate = del;
+
+ initWithOptions(args);
+
+ if(_resource == null)
+ {
+ _resource = "/";
+ }
+ }
+
+ public WSEndpoint(ProtocolInstance instance, EndpointI del, com.zeroc.Ice.InputStream s)
+ {
+ _instance = instance;
+ _delegate = del;
+ _resource = s.readString();
+ }
+
+ @Override
+ public com.zeroc.Ice.EndpointInfo getInfo()
+ {
+ WSEndpointInfo info = new WSEndpointInfo(_delegate.getInfo(), timeout(), compress(), _resource)
+ {
+ @Override
+ public short type()
+ {
+ return WSEndpoint.this.type();
+ }
+
+ @Override
+ public boolean datagram()
+ {
+ return WSEndpoint.this.datagram();
+ }
+
+ @Override
+ public boolean secure()
+ {
+ return WSEndpoint.this.secure();
+ }
+ };
+ info.compress = info.underlying.compress;
+ info.timeout = info.underlying.timeout;
+ return info;
+ }
+
+ @Override
+ public short type()
+ {
+ return _delegate.type();
+ }
+
+ @Override
+ public String protocol()
+ {
+ return _delegate.protocol();
+ }
+
+ @Override
+ public void streamWriteImpl(com.zeroc.Ice.OutputStream s)
+ {
+ _delegate.streamWriteImpl(s);
+ s.writeString(_resource);
+ }
+
+ @Override
+ public int timeout()
+ {
+ return _delegate.timeout();
+ }
+
+ @Override
+ public EndpointI timeout(int timeout)
+ {
+ if(timeout == _delegate.timeout())
+ {
+ return this;
+ }
+ else
+ {
+ return new WSEndpoint(_instance, _delegate.timeout(timeout), _resource);
+ }
+ }
+
+ @Override
+ public String connectionId()
+ {
+ return _delegate.connectionId();
+ }
+
+ @Override
+ public EndpointI connectionId(String connectionId)
+ {
+ if(connectionId.equals(_delegate.connectionId()))
+ {
+ return this;
+ }
+ else
+ {
+ return new WSEndpoint(_instance, _delegate.connectionId(connectionId), _resource);
+ }
+ }
+
+ @Override
+ public boolean compress()
+ {
+ return _delegate.compress();
+ }
+
+ @Override
+ public EndpointI compress(boolean compress)
+ {
+ if(compress == _delegate.compress())
+ {
+ return this;
+ }
+ else
+ {
+ return new WSEndpoint(_instance, _delegate.compress(compress), _resource);
+ }
+ }
+
+ @Override
+ public boolean datagram()
+ {
+ return _delegate.datagram();
+ }
+
+ @Override
+ public boolean secure()
+ {
+ return _delegate.secure();
+ }
+
+ @Override
+ public Transceiver transceiver()
+ {
+ return null;
+ }
+
+ @Override
+ public void connectors_async(com.zeroc.Ice.EndpointSelectionType selType, final EndpointI_connectors callback)
+ {
+ com.zeroc.Ice.IPEndpointInfo ipInfo = null;
+ for(com.zeroc.Ice.EndpointInfo p = _delegate.getInfo(); p != null; p = p.underlying)
+ {
+ if(p instanceof com.zeroc.Ice.IPEndpointInfo)
+ {
+ ipInfo = (com.zeroc.Ice.IPEndpointInfo)p;
+ }
+ }
+ final String host = ipInfo != null ? (ipInfo.host + ":" + ipInfo.port) : "";
+ EndpointI_connectors cb = new EndpointI_connectors()
+ {
+ @Override
+ public void connectors(java.util.List<Connector> connectors)
+ {
+ java.util.List<Connector> l = new java.util.ArrayList<>();
+ for(Connector c : connectors)
+ {
+ l.add(new WSConnector(_instance, c, host, _resource));
+ }
+ callback.connectors(l);
+ }
+
+ @Override
+ public void exception(com.zeroc.Ice.LocalException ex)
+ {
+ callback.exception(ex);
+ }
+ };
+ _delegate.connectors_async(selType, cb);
+ }
+
+ @Override
+ public Acceptor acceptor(String adapterName)
+ {
+ Acceptor delAcc = _delegate.acceptor(adapterName);
+ return new WSAcceptor(this, _instance, delAcc);
+ }
+
+ public WSEndpoint endpoint(EndpointI delEndp)
+ {
+ return new WSEndpoint(_instance, delEndp, _resource);
+ }
+
+ @Override
+ public java.util.List<EndpointI> expand()
+ {
+ java.util.List<EndpointI> endps = _delegate.expand();
+ java.util.List<EndpointI> l = new java.util.ArrayList<>();
+ for(EndpointI e : endps)
+ {
+ l.add(e == _delegate ? this : new WSEndpoint(_instance, e, _resource));
+ }
+ return l;
+ }
+
+ @Override
+ public boolean equivalent(EndpointI endpoint)
+ {
+ if(!(endpoint instanceof WSEndpoint))
+ {
+ return false;
+ }
+ WSEndpoint wsEndpointI = (WSEndpoint)endpoint;
+ return _delegate.equivalent(wsEndpointI._delegate);
+ }
+
+ @Override
+ synchronized public int hashCode()
+ {
+ int h = _delegate.hashCode();
+ h = HashUtil.hashAdd(h, _resource);
+ return h;
+ }
+
+ @Override
+ public String options()
+ {
+ //
+ // WARNING: Certain features, such as proxy validation in Glacier2,
+ // depend on the format of proxy strings. Changes to toString() and
+ // methods called to generate parts of the reference string could break
+ // these features. Please review for all features that depend on the
+ // format of proxyToString() before changing this and related code.
+ //
+ String s = _delegate.options();
+
+ if(_resource != null && _resource.length() > 0)
+ {
+ s += " -r ";
+ boolean addQuote = _resource.indexOf(':') != -1;
+ if(addQuote)
+ {
+ s += "\"";
+ }
+ s += _resource;
+ if(addQuote)
+ {
+ s += "\"";
+ }
+ }
+
+ return s;
+ }
+
+ @Override
+ public int compareTo(EndpointI obj) // From java.lang.Comparable
+ {
+ if(!(obj instanceof WSEndpoint))
+ {
+ return type() < obj.type() ? -1 : 1;
+ }
+
+ WSEndpoint p = (WSEndpoint)obj;
+ if(this == p)
+ {
+ return 0;
+ }
+
+ int v = _resource.compareTo(p._resource);
+ if(v != 0)
+ {
+ return v;
+ }
+
+ return _delegate.compareTo(p._delegate);
+ }
+
+ public EndpointI delegate()
+ {
+ return _delegate;
+ }
+
+ @Override
+ protected boolean checkOption(String option, String argument, String endpoint)
+ {
+ switch(option.charAt(1))
+ {
+ case 'r':
+ {
+ if(argument == null)
+ {
+ throw new com.zeroc.Ice.EndpointParseException("no argument provided for -r option in endpoint " +
+ endpoint + _delegate.options());
+ }
+ _resource = argument;
+ return true;
+ }
+
+ default:
+ {
+ return false;
+ }
+ }
+ }
+
+ private ProtocolInstance _instance;
+ private EndpointI _delegate;
+ private String _resource;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSEndpointFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSEndpointFactory.java
new file mode 100644
index 00000000000..0c5c0ba1498
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSEndpointFactory.java
@@ -0,0 +1,59 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+final public class WSEndpointFactory implements EndpointFactory
+{
+ public WSEndpointFactory(ProtocolInstance instance, EndpointFactory delegate)
+ {
+ _instance = instance;
+ _delegate = delegate;
+ }
+
+ @Override
+ public short type()
+ {
+ return _instance.type();
+ }
+
+ @Override
+ public String protocol()
+ {
+ return _instance.protocol();
+ }
+
+ @Override
+ public EndpointI create(java.util.ArrayList<String> args, boolean oaEndpoint)
+ {
+ return new WSEndpoint(_instance, _delegate.create(args, oaEndpoint), args);
+ }
+
+ @Override
+ public EndpointI read(com.zeroc.Ice.InputStream s)
+ {
+ return new WSEndpoint(_instance, _delegate.read(s), s);
+ }
+
+ @Override
+ public void destroy()
+ {
+ _delegate.destroy();
+ _instance = null;
+ }
+
+ @Override
+ public EndpointFactory clone(ProtocolInstance instance, EndpointFactory delegate)
+ {
+ return new WSEndpointFactory(instance, delegate);
+ }
+
+ private ProtocolInstance _instance;
+ private EndpointFactory _delegate;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSTransceiver.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSTransceiver.java
new file mode 100644
index 00000000000..63d7325b599
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSTransceiver.java
@@ -0,0 +1,1616 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+import java.security.*;
+import java.util.Base64;
+
+final class WSTransceiver implements Transceiver
+{
+ @Override
+ public java.nio.channels.SelectableChannel fd()
+ {
+ return _delegate.fd();
+ }
+
+ @Override
+ public void setReadyCallback(ReadyCallback callback)
+ {
+ _readyCallback = callback;
+ _delegate.setReadyCallback(callback);
+ }
+
+ @Override
+ public int initialize(Buffer readBuffer, Buffer writeBuffer)
+ {
+ //
+ // Delegate logs exceptions that occur during initialize(), so there's no need to trap them here.
+ //
+ if(_state == StateInitializeDelegate)
+ {
+ int op = _delegate.initialize(readBuffer, writeBuffer);
+ if(op != 0)
+ {
+ return op;
+ }
+ _state = StateConnected;
+ }
+
+ try
+ {
+ if(_state == StateConnected)
+ {
+ //
+ // We don't know how much we'll need to read.
+ //
+ _readBuffer.resize(1024, true);
+ _readBuffer.b.position(0);
+ _readBufferPos = 0;
+
+ //
+ // The server waits for the client's upgrade request, the
+ // client sends the upgrade request.
+ //
+ _state = StateUpgradeRequestPending;
+ if(!_incoming)
+ {
+ //
+ // Compose the upgrade request.
+ //
+ StringBuffer out = new StringBuffer();
+ out.append("GET " + _resource + " HTTP/1.1\r\n");
+ out.append("Host: " + _host);
+ out.append("\r\n");
+ out.append("Upgrade: websocket\r\n");
+ out.append("Connection: Upgrade\r\n");
+ out.append("Sec-WebSocket-Protocol: " + _iceProtocol + "\r\n");
+ out.append("Sec-WebSocket-Version: 13\r\n");
+ out.append("Sec-WebSocket-Key: ");
+
+ //
+ // The value for Sec-WebSocket-Key is a 16-byte random number, encoded with Base64.
+ //
+ byte[] key = new byte[16];
+ _rand.nextBytes(key);
+ _key = Base64.getEncoder().encodeToString(key);
+ out.append(_key + "\r\n\r\n"); // EOM
+
+ _writeBuffer.resize(out.length(), false);
+ _writeBuffer.b.position(0);
+ _writeBuffer.b.put(out.toString().getBytes(_ascii));
+ _writeBuffer.b.flip();
+ }
+ }
+
+ //
+ // Try to write the client's upgrade request.
+ //
+ if(_state == StateUpgradeRequestPending && !_incoming)
+ {
+ if(_writeBuffer.b.hasRemaining())
+ {
+ int s = _delegate.write(_writeBuffer);
+ if(s != 0)
+ {
+ return s;
+ }
+ }
+ assert(!_writeBuffer.b.hasRemaining());
+ _state = StateUpgradeResponsePending;
+ }
+
+ while(true)
+ {
+ if(_readBuffer.b.hasRemaining())
+ {
+ int s = _delegate.read(_readBuffer);
+ if(s == SocketOperation.Write || _readBuffer.b.position() == 0)
+ {
+ return s;
+ }
+ }
+
+ //
+ // Try to read the client's upgrade request or the server's response.
+ //
+ if((_state == StateUpgradeRequestPending && _incoming) ||
+ (_state == StateUpgradeResponsePending && !_incoming))
+ {
+ //
+ // Check if we have enough data for a complete message.
+ //
+ int p = _parser.isCompleteMessage(_readBuffer.b, 0, _readBuffer.b.position());
+ if(p == -1)
+ {
+ if(_readBuffer.b.hasRemaining())
+ {
+ return SocketOperation.Read;
+ }
+
+ //
+ // Enlarge the buffer and try to read more.
+ //
+ final int oldSize = _readBuffer.b.position();
+ if(oldSize + 1024 > _instance.messageSizeMax())
+ {
+ throw new com.zeroc.Ice.MemoryLimitException();
+ }
+ _readBuffer.resize(oldSize + 1024, true);
+ _readBuffer.b.position(oldSize);
+ continue; // Try again to read the response/request
+ }
+
+ //
+ // Set _readBufferPos at the end of the response/request message.
+ //
+ _readBufferPos = p;
+ }
+
+ //
+ // We're done, the client's upgrade request or server's response is read.
+ //
+ break;
+ }
+
+ try
+ {
+ //
+ // Parse the client's upgrade request.
+ //
+ if(_state == StateUpgradeRequestPending && _incoming)
+ {
+ if(_parser.parse(_readBuffer.b, 0, _readBufferPos))
+ {
+ handleRequest(_writeBuffer);
+ _state = StateUpgradeResponsePending;
+ }
+ else
+ {
+ throw new com.zeroc.Ice.ProtocolException("incomplete request message");
+ }
+ }
+
+ if(_state == StateUpgradeResponsePending)
+ {
+ if(_incoming)
+ {
+ if(_writeBuffer.b.hasRemaining())
+ {
+ int s = _delegate.write(_writeBuffer);
+ if(s != 0)
+ {
+ return s;
+ }
+ }
+ }
+ else
+ {
+ //
+ // Parse the server's response
+ //
+ if(_parser.parse(_readBuffer.b, 0, _readBufferPos))
+ {
+ handleResponse();
+ }
+ else
+ {
+ throw new com.zeroc.Ice.ProtocolException("incomplete response message");
+ }
+ }
+ }
+ }
+ catch(WebSocketException ex)
+ {
+ throw new com.zeroc.Ice.ProtocolException(ex.getMessage(), ex);
+ }
+
+ _state = StateOpened;
+ _nextState = StateOpened;
+
+ if(_readBufferPos < _readBuffer.b.position())
+ {
+ _readyCallback.ready(SocketOperation.Read, true);
+ }
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ if(_instance.traceLevel() >= 2)
+ {
+ _instance.logger().trace(_instance.traceCategory(),
+ protocol() + " connection HTTP upgrade request failed\n" + toString() + "\n" + ex);
+ }
+ throw ex;
+ }
+
+ if(_instance.traceLevel() >= 1)
+ {
+ if(_incoming)
+ {
+ _instance.logger().trace(_instance.traceCategory(),
+ "accepted " + protocol() + " connection HTTP upgrade request\n" + toString());
+ }
+ else
+ {
+ _instance.logger().trace(_instance.traceCategory(),
+ protocol() + " connection HTTP upgrade request accepted\n" + toString());
+ }
+ }
+
+ return SocketOperation.None;
+ }
+
+ @Override
+ public int closing(boolean initiator, com.zeroc.Ice.LocalException reason)
+ {
+ if(_instance.traceLevel() >= 1)
+ {
+ _instance.logger().trace(_instance.traceCategory(),
+ "gracefully closing " + protocol() + " connection\n" + toString());
+ }
+
+ int s = _nextState == StateOpened ? _state : _nextState;
+
+ if(s == StateClosingRequestPending && _closingInitiator)
+ {
+ //
+ // If we initiated a close connection but also received a
+ // close connection, we assume we didn't initiated the
+ // connection and we send the close frame now. This is to
+ // ensure that if both peers close the connection at the same
+ // time we don't hang having both peer waiting for the close
+ // frame of the other.
+ //
+ assert(!initiator);
+ _closingInitiator = false;
+ return SocketOperation.Write;
+ }
+ else if(s >= StateClosingRequestPending)
+ {
+ return SocketOperation.None;
+ }
+
+ _closingInitiator = initiator;
+ if(reason instanceof com.zeroc.Ice.CloseConnectionException)
+ {
+ _closingReason = CLOSURE_NORMAL;
+ }
+ else if(reason instanceof com.zeroc.Ice.ObjectAdapterDeactivatedException ||
+ reason instanceof com.zeroc.Ice.CommunicatorDestroyedException)
+ {
+ _closingReason = CLOSURE_SHUTDOWN;
+ }
+ else if(reason instanceof com.zeroc.Ice.ProtocolException)
+ {
+ _closingReason = CLOSURE_PROTOCOL_ERROR;
+ }
+ else if(reason instanceof com.zeroc.Ice.MemoryLimitException)
+ {
+ _closingReason = CLOSURE_TOO_BIG;
+ }
+
+ if(_state == StateOpened)
+ {
+ _state = StateClosingRequestPending;
+ return initiator ? SocketOperation.Read : SocketOperation.Write;
+ }
+ else
+ {
+ _nextState = StateClosingRequestPending;
+ return SocketOperation.None;
+ }
+ }
+
+ @Override
+ public void close()
+ {
+ _delegate.close();
+ _state = StateClosed;
+
+ //
+ // Clear the buffers now instead of waiting for destruction.
+ //
+ _writeBuffer.clear();
+ _readBuffer.clear();
+ }
+
+ @Override
+ public EndpointI bind()
+ {
+ assert(false);
+ return null;
+ }
+
+ @Override
+ public int write(Buffer buf)
+ {
+ if(_state < StateOpened)
+ {
+ if(_state < StateConnected)
+ {
+ return _delegate.write(buf);
+ }
+ else
+ {
+ return _delegate.write(_writeBuffer);
+ }
+ }
+
+ int s = SocketOperation.None;
+ do
+ {
+ if(preWrite(buf))
+ {
+ if(_writeState == WriteStateFlush)
+ {
+ //
+ // Invoke write() even though there's nothing to write.
+ //
+ assert(!buf.b.hasRemaining());
+ s = _delegate.write(buf);
+ }
+
+ if(s == SocketOperation.None && _writeBuffer.b.hasRemaining())
+ {
+ s = _delegate.write(_writeBuffer);
+ }
+ else if(s == SocketOperation.None && _incoming && !buf.empty() && _writeState == WriteStatePayload)
+ {
+ s = _delegate.write(buf);
+ }
+ }
+ }
+ while(postWrite(buf, s));
+
+ if(s != SocketOperation.None)
+ {
+ return s;
+ }
+ if(_state == StateClosingResponsePending && !_closingInitiator)
+ {
+ return SocketOperation.Read;
+ }
+ return SocketOperation.None;
+ }
+
+ @Override
+ public int read(Buffer buf)
+ {
+ if(_state < StateOpened)
+ {
+ if(_state < StateConnected)
+ {
+ return _delegate.read(buf);
+ }
+ else
+ {
+ if(_delegate.read(_readBuffer) == SocketOperation.Write)
+ {
+ return SocketOperation.Write;
+ }
+ else
+ {
+ return SocketOperation.None;
+ }
+ }
+ }
+
+ if(!buf.b.hasRemaining())
+ {
+ if(_readBufferPos < _readBuffer.b.position())
+ {
+ _readyCallback.ready(SocketOperation.Read, true);
+ }
+ return SocketOperation.None;
+ }
+
+ int s = SocketOperation.None;
+ do
+ {
+ if(preRead(buf))
+ {
+ if(_readState == ReadStatePayload)
+ {
+ //
+ // If the payload length is smaller than what remains to be read, we read
+ // no more than the payload length. The remaining of the buffer will be
+ // sent over in another frame.
+ //
+ int readSz = _readPayloadLength - (buf.b.position() - _readStart);
+ if(buf.b.remaining() > readSz)
+ {
+ int size = buf.size();
+ buf.resize(buf.b.position() + readSz, true);
+ s = _delegate.read(buf);
+ buf.resize(size, true);
+ }
+ else
+ {
+ s = _delegate.read(buf);
+ }
+ }
+ else
+ {
+ s = _delegate.read(_readBuffer);
+ }
+
+ if(s == SocketOperation.Write)
+ {
+ postRead(buf);
+ return s;
+ }
+ }
+ }
+ while(postRead(buf));
+
+ if(!buf.b.hasRemaining())
+ {
+ if(_readBufferPos < _readBuffer.b.position())
+ {
+ _readyCallback.ready(SocketOperation.Read, true);
+ }
+ s = SocketOperation.None;
+ }
+ else
+ {
+ _readyCallback.ready(SocketOperation.Read, false);
+ s = SocketOperation.Read;
+ }
+
+ if(((_state == StateClosingRequestPending && !_closingInitiator) ||
+ (_state == StateClosingResponsePending && _closingInitiator) ||
+ _state == StatePingPending ||
+ _state == StatePongPending) &&
+ _writeState == WriteStateHeader)
+ {
+ // We have things to write, ask to be notified when writes are ready.
+ s |= SocketOperation.Write;
+ }
+
+ return s;
+ }
+
+ @Override
+ public String protocol()
+ {
+ return _instance.protocol();
+ }
+
+ @Override
+ public String toString()
+ {
+ return _delegate.toString();
+ }
+
+ @Override
+ public String toDetailedString()
+ {
+ return _delegate.toDetailedString();
+ }
+
+ @Override
+ public com.zeroc.Ice.ConnectionInfo getInfo()
+ {
+ com.zeroc.Ice.WSConnectionInfo info = new com.zeroc.Ice.WSConnectionInfo();
+ info.underlying = _delegate.getInfo();
+ info.headers = _parser.getHeaders();
+ return info;
+ }
+
+ @Override
+ public void checkSendSize(Buffer buf)
+ {
+ _delegate.checkSendSize(buf);
+ }
+
+ @Override
+ public void setBufferSize(int rcvSize, int sndSize)
+ {
+ _delegate.setBufferSize(rcvSize, sndSize);
+ }
+
+ WSTransceiver(ProtocolInstance instance, Transceiver del, String host, String resource)
+ {
+ init(instance, del);
+ _host = host;
+ _resource = resource;
+ _incoming = false;
+
+ //
+ // Use a 16KB write buffer size. We use 16KB for the write
+ // buffer size because all the data needs to be copied to the
+ // write buffer for the purpose of masking. A 16KB buffer
+ // appears to be a good compromise to reduce the number of
+ // socket write calls and not consume too much memory.
+ //
+ _writeBufferSize = 16 * 1024;
+
+ //
+ // Write and read buffer size must be large enough to hold the frame header!
+ //
+ assert(_writeBufferSize > 256);
+ assert(_readBufferSize > 256);
+ }
+
+ WSTransceiver(ProtocolInstance instance, Transceiver del)
+ {
+ init(instance, del);
+ _host = "";
+ _resource = "";
+ _incoming = true;
+
+ //
+ // Write and read buffer size must be large enough to hold the frame header!
+ //
+ assert(_writeBufferSize > 256);
+ assert(_readBufferSize > 256);
+ }
+
+ private void init(ProtocolInstance instance, Transceiver del)
+ {
+ _instance = instance;
+ _delegate = del;
+ _state = StateInitializeDelegate;
+ _parser = new HttpParser();
+ _readState = ReadStateOpcode;
+ _readBuffer = new Buffer(false, java.nio.ByteOrder.BIG_ENDIAN); // Use network byte order.
+ _readBufferSize = 1024;
+ _readLastFrame = true;
+ _readOpCode = 0;
+ _readHeaderLength = 0;
+ _readPayloadLength = 0;
+ _readMask = new byte[4];
+ _writeState = WriteStateHeader;
+ _writeBuffer = new Buffer(false, java.nio.ByteOrder.BIG_ENDIAN); // Use network byte order.
+ _writeBufferSize = 1024;
+ _readMask = new byte[4];
+ _writeMask = new byte[4];
+ _key = "";
+ _pingPayload = new byte[0];
+ _rand = new java.util.Random();
+ }
+
+ private void handleRequest(Buffer responseBuffer)
+ {
+ //
+ // HTTP/1.1
+ //
+ if(_parser.versionMajor() != 1 || _parser.versionMinor() != 1)
+ {
+ throw new WebSocketException("unsupported HTTP version");
+ }
+
+ //
+ // "An |Upgrade| header field containing the value 'websocket',
+ // treated as an ASCII case-insensitive value."
+ //
+ String val = _parser.getHeader("Upgrade", true);
+ if(val == null)
+ {
+ throw new WebSocketException("missing value for Upgrade field");
+ }
+ else if(!val.equals("websocket"))
+ {
+ throw new WebSocketException("invalid value `" + val + "' for Upgrade field");
+ }
+
+ //
+ // "A |Connection| header field that includes the token 'Upgrade',
+ // treated as an ASCII case-insensitive value.
+ //
+ val = _parser.getHeader("Connection", true);
+ if(val == null)
+ {
+ throw new WebSocketException("missing value for Connection field");
+ }
+ else if(val.indexOf("upgrade") == -1)
+ {
+ throw new WebSocketException("invalid value `" + val + "' for Connection field");
+ }
+
+ //
+ // "A |Sec-WebSocket-Version| header field, with a value of 13."
+ //
+ val = _parser.getHeader("Sec-WebSocket-Version", false);
+ if(val == null)
+ {
+ throw new WebSocketException("missing value for WebSocket version");
+ }
+ else if(!val.equals("13"))
+ {
+ throw new WebSocketException("unsupported WebSocket version `" + val + "'");
+ }
+
+ //
+ // "Optionally, a |Sec-WebSocket-Protocol| header field, with a list
+ // of values indicating which protocols the client would like to
+ // speak, ordered by preference."
+ //
+ boolean addProtocol = false;
+ val = _parser.getHeader("Sec-WebSocket-Protocol", true);
+ if(val != null)
+ {
+ String[] protocols = com.zeroc.IceUtilInternal.StringUtil.splitString(val, ",");
+ if(protocols == null)
+ {
+ throw new WebSocketException("invalid value `" + val + "' for WebSocket protocol");
+ }
+ for(String p : protocols)
+ {
+ if(!p.trim().equals(_iceProtocol))
+ {
+ throw new WebSocketException("unknown value `" + p + "' for WebSocket protocol");
+ }
+ addProtocol = true;
+ }
+ }
+
+ //
+ // "A |Sec-WebSocket-Key| header field with a base64-encoded
+ // value that, when decoded, is 16 bytes in length."
+ //
+ String key = _parser.getHeader("Sec-WebSocket-Key", false);
+ if(key == null)
+ {
+ throw new WebSocketException("missing value for WebSocket key");
+ }
+
+ byte[] decodedKey = Base64.getDecoder().decode(key);
+ if(decodedKey.length != 16)
+ {
+ throw new WebSocketException("invalid value `" + key + "' for WebSocket key");
+ }
+
+ //
+ // Retain the target resource.
+ //
+ _resource = _parser.uri();
+
+ //
+ // Compose the response.
+ //
+ StringBuffer out = new StringBuffer();
+ out.append("HTTP/1.1 101 Switching Protocols\r\n");
+ out.append("Upgrade: websocket\r\n");
+ out.append("Connection: Upgrade\r\n");
+ if(addProtocol)
+ {
+ out.append("Sec-WebSocket-Protocol: " + _iceProtocol + "\r\n");
+ }
+
+ //
+ // The response includes:
+ //
+ // "A |Sec-WebSocket-Accept| header field. The value of this
+ // header field is constructed by concatenating /key/, defined
+ // above in step 4 in Section 4.2.2, with the string "258EAFA5-
+ // E914-47DA-95CA-C5AB0DC85B11", taking the SHA-1 hash of this
+ // concatenated value to obtain a 20-byte value and base64-
+ // encoding (see Section 4 of [RFC4648]) this 20-byte hash.
+ //
+ out.append("Sec-WebSocket-Accept: ");
+ final String input = key + _wsUUID;
+ try
+ {
+ final MessageDigest sha1 = MessageDigest.getInstance("SHA1");
+ sha1.update(input.getBytes(_ascii));
+ final byte[] hash = sha1.digest();
+ out.append(Base64.getEncoder().encodeToString(hash) + "\r\n" + "\r\n"); // EOM
+ }
+ catch(NoSuchAlgorithmException ex)
+ {
+ throw new WebSocketException(ex);
+ }
+
+ final byte[] bytes = out.toString().getBytes(_ascii);
+ assert(bytes.length == out.length());
+ responseBuffer.resize(bytes.length, false);
+ responseBuffer.b.position(0);
+ responseBuffer.b.put(bytes);
+ responseBuffer.b.flip();
+ }
+
+ private void handleResponse()
+ {
+ String val;
+
+ //
+ // HTTP/1.1
+ //
+ if(_parser.versionMajor() != 1 || _parser.versionMinor() != 1)
+ {
+ throw new WebSocketException("unsupported HTTP version");
+ }
+
+ //
+ // "If the status code received from the server is not 101, the
+ // client handles the response per HTTP [RFC2616] procedures. In
+ // particular, the client might perform authentication if it
+ // receives a 401 status code; the server might redirect the client
+ // using a 3xx status code (but clients are not required to follow
+ // them), etc."
+ //
+ if(_parser.status() != 101)
+ {
+ StringBuffer out = new StringBuffer("unexpected status value " + _parser.status());
+ if(_parser.reason().length() > 0)
+ {
+ out.append(":\n" + _parser.reason());
+ }
+ throw new WebSocketException(out.toString());
+ }
+
+ //
+ // "If the response lacks an |Upgrade| header field or the |Upgrade|
+ // header field contains a value that is not an ASCII case-
+ // insensitive match for the value "websocket", the client MUST
+ // _Fail the WebSocket Connection_."
+ //
+ val = _parser.getHeader("Upgrade", true);
+ if(val == null)
+ {
+ throw new WebSocketException("missing value for Upgrade field");
+ }
+ else if(!val.equals("websocket"))
+ {
+ throw new WebSocketException("invalid value `" + val + "' for Upgrade field");
+ }
+
+ //
+ // "If the response lacks a |Connection| header field or the
+ // |Connection| header field doesn't contain a token that is an
+ // ASCII case-insensitive match for the value "Upgrade", the client
+ // MUST _Fail the WebSocket Connection_."
+ //
+ val = _parser.getHeader("Connection", true);
+ if(val == null)
+ {
+ throw new WebSocketException("missing value for Connection field");
+ }
+ else if(val.indexOf("upgrade") == -1)
+ {
+ throw new WebSocketException("invalid value `" + val + "' for Connection field");
+ }
+
+ //
+ // "If the response includes a |Sec-WebSocket-Protocol| header field
+ // and this header field indicates the use of a subprotocol that was
+ // not present in the client's handshake (the server has indicated a
+ // subprotocol not requested by the client), the client MUST _Fail
+ // the WebSocket Connection_."
+ //
+ val = _parser.getHeader("Sec-WebSocket-Protocol", true);
+ if(val != null && !val.equals(_iceProtocol))
+ {
+ throw new WebSocketException("invalid value `" + val + "' for WebSocket protocol");
+ }
+
+ //
+ // "If the response lacks a |Sec-WebSocket-Accept| header field or
+ // the |Sec-WebSocket-Accept| contains a value other than the
+ // base64-encoded SHA-1 of the concatenation of the |Sec-WebSocket-
+ // Key| (as a string, not base64-decoded) with the string "258EAFA5-
+ // E914-47DA-95CA-C5AB0DC85B11" but ignoring any leading and
+ // trailing whitespace, the client MUST _Fail the WebSocket
+ // Connection_."
+ //
+ val = _parser.getHeader("Sec-WebSocket-Accept", false);
+ if(val == null)
+ {
+ throw new WebSocketException("missing value for Sec-WebSocket-Accept");
+ }
+
+ try
+ {
+ final String input = _key + _wsUUID;
+ final MessageDigest sha1 = MessageDigest.getInstance("SHA1");
+ sha1.update(input.getBytes(_ascii));
+ if(!val.equals(Base64.getEncoder().encodeToString(sha1.digest())))
+ {
+ throw new WebSocketException("invalid value `" + val + "' for Sec-WebSocket-Accept");
+ }
+ }
+ catch(NoSuchAlgorithmException ex)
+ {
+ throw new WebSocketException(ex);
+ }
+ }
+
+ private boolean preRead(Buffer buf)
+ {
+ while(true)
+ {
+ if(_readState == ReadStateOpcode)
+ {
+ //
+ // Is there enough data available to read the opcode?
+ //
+ if(!readBuffered(2))
+ {
+ return true;
+ }
+
+ //
+ // Most-significant bit indicates whether this is the
+ // last frame. Least-significant four bits hold the
+ // opcode.
+ //
+ int ch = _readBuffer.b.get(_readBufferPos++);
+ if(ch < 0)
+ {
+ ch += 256;
+ }
+ _readOpCode = ch & 0xf;
+
+ //
+ // Remember if last frame if we're going to read a data or
+ // continuation frame, this is only for protocol
+ // correctness checking purpose.
+ //
+ if(_readOpCode == OP_DATA)
+ {
+ if(!_readLastFrame)
+ {
+ throw new com.zeroc.Ice.ProtocolException("invalid data frame, no FIN on previous frame");
+ }
+ _readLastFrame = (ch & FLAG_FINAL) == FLAG_FINAL;
+ }
+ else if(_readOpCode == OP_CONT)
+ {
+ if(_readLastFrame)
+ {
+ throw new com.zeroc.Ice.ProtocolException("invalid continuation frame, previous frame FIN set");
+ }
+ _readLastFrame = (ch & FLAG_FINAL) == FLAG_FINAL;
+ }
+
+ ch = _readBuffer.b.get(_readBufferPos++);
+ if(ch < 0)
+ {
+ ch += 256;
+ }
+
+ //
+ // Check the MASK bit. Messages sent by a client must be masked;
+ // messages sent by a server must not be masked.
+ //
+ final boolean masked = (ch & FLAG_MASKED) == FLAG_MASKED;
+ if(masked != _incoming)
+ {
+ throw new com.zeroc.Ice.ProtocolException("invalid masking");
+ }
+
+ //
+ // Extract the payload length, which can have the following values:
+ //
+ // 0-125: The payload length
+ // 126: The subsequent two bytes contain the payload length
+ // 127: The subsequent eight bytes contain the payload length
+ //
+ _readPayloadLength = (ch & 0x7f);
+ if(_readPayloadLength < 126)
+ {
+ _readHeaderLength = 0;
+ }
+ else if(_readPayloadLength == 126)
+ {
+ _readHeaderLength = 2; // Need to read a 16-bit payload length.
+ }
+ else
+ {
+ _readHeaderLength = 8; // Need to read a 64-bit payload length.
+ }
+ if(masked)
+ {
+ _readHeaderLength += 4; // Need to read a 32-bit mask.
+ }
+
+ _readState = ReadStateHeader;
+ }
+
+ if(_readState == ReadStateHeader)
+ {
+ //
+ // Is there enough data available to read the header?
+ //
+ if(_readHeaderLength > 0 && !readBuffered(_readHeaderLength))
+ {
+ return true;
+ }
+
+ if(_readPayloadLength == 126)
+ {
+ _readPayloadLength = _readBuffer.b.getShort(_readBufferPos); // Uses network byte order.
+ if(_readPayloadLength < 0)
+ {
+ _readPayloadLength += 65536;
+ }
+ _readBufferPos += 2;
+ }
+ else if(_readPayloadLength == 127)
+ {
+ long l = _readBuffer.b.getLong(_readBufferPos); // Uses network byte order.
+ _readBufferPos += 8;
+ if(l < 0 || l > Integer.MAX_VALUE)
+ {
+ throw new com.zeroc.Ice.ProtocolException("invalid WebSocket payload length: " + l);
+ }
+ _readPayloadLength = (int)l;
+ }
+
+ //
+ // Read the mask if this is an incoming connection.
+ //
+ if(_incoming)
+ {
+ assert(_readBuffer.b.position() - _readBufferPos >= 4); // We must have needed to read the mask.
+ for(int i = 0; i < 4; ++i)
+ {
+ _readMask[i] = _readBuffer.b.get(_readBufferPos++); // Copy the mask.
+ }
+ }
+
+ switch(_readOpCode)
+ {
+ case OP_TEXT: // Text frame
+ {
+ throw new com.zeroc.Ice.ProtocolException("text frames not supported");
+ }
+ case OP_CONT: // Continuation frame
+ case OP_DATA: // Data frame
+ {
+ if(_instance.traceLevel() >= 2)
+ {
+ _instance.logger().trace(_instance.traceCategory(), "received " + protocol() +
+ (_readOpCode == OP_DATA ? " data" : " continuation") +
+ " frame with payload length of " + _readPayloadLength + " bytes\n" +
+ toString());
+ }
+
+ if(_readPayloadLength <= 0)
+ {
+ throw new com.zeroc.Ice.ProtocolException("payload length is 0");
+ }
+ _readState = ReadStatePayload;
+ assert(buf.b.hasRemaining());
+ _readFrameStart = buf.b.position();
+ break;
+ }
+ case OP_CLOSE: // Connection close
+ {
+ if(_instance.traceLevel() >= 2)
+ {
+ _instance.logger().trace(_instance.traceCategory(), "received " + protocol() +
+ " connection close frame\n" + toString());
+ }
+
+ int s = _nextState == StateOpened ? _state : _nextState;
+ if(s == StateClosingRequestPending)
+ {
+ //
+ // If we receive a close frame while we were actually
+ // waiting to send one, change the role and send a
+ // close frame response.
+ //
+ if(!_closingInitiator)
+ {
+ _closingInitiator = true;
+ }
+ if(_state == StateClosingRequestPending)
+ {
+ _state = StateClosingResponsePending;
+ }
+ else
+ {
+ _nextState = StateClosingResponsePending;
+ }
+ return false; // No longer interested in reading
+ }
+ else
+ {
+ throw new com.zeroc.Ice.ConnectionLostException();
+ }
+ }
+ case OP_PING:
+ {
+ if(_instance.traceLevel() >= 2)
+ {
+ _instance.logger().trace(_instance.traceCategory(),
+ "received " + protocol() + " connection ping frame\n" + toString());
+ }
+ _readState = ReadStateControlFrame;
+ break;
+ }
+ case OP_PONG: // Pong
+ {
+ if(_instance.traceLevel() >= 2)
+ {
+ _instance.logger().trace(_instance.traceCategory(),
+ "received " + protocol() + " connection pong frame\n" + toString());
+ }
+ _readState = ReadStateControlFrame;
+ break;
+ }
+ default:
+ {
+ throw new com.zeroc.Ice.ProtocolException("unsupported opcode: " + _readOpCode);
+ }
+ }
+ }
+
+ if(_readState == ReadStateControlFrame)
+ {
+ if(_readPayloadLength > 0 && !readBuffered(_readPayloadLength))
+ {
+ return true;
+ }
+
+ if(_readPayloadLength > 0 && _readOpCode == OP_PING)
+ {
+ _pingPayload = new byte[_readPayloadLength];
+ if(_readBuffer.b.hasArray())
+ {
+ System.arraycopy(_readBuffer.b.array(), _readBuffer.b.arrayOffset() + _readBufferPos,
+ _pingPayload, 0, _readPayloadLength);
+ }
+ else
+ {
+ for(int i = 0; i < _readPayloadLength; ++i)
+ {
+ _pingPayload[i] = _readBuffer.b.get(_readBufferPos + i);
+ }
+ }
+ }
+
+ _readBufferPos += _readPayloadLength;
+ _readPayloadLength = 0;
+
+ if(_readOpCode == OP_PING)
+ {
+ if(_state == StateOpened)
+ {
+ _state = StatePongPending; // Send pong frame now
+ }
+ else if(_nextState < StatePongPending)
+ {
+ _nextState = StatePongPending; // Send pong frame next
+ }
+ }
+
+ //
+ // We've read the payload of the PING/PONG frame, we're ready
+ // to read a new frame.
+ //
+ _readState = ReadStateOpcode;
+ }
+
+ if(_readState == ReadStatePayload)
+ {
+ //
+ // This must be assigned before the check for the buffer. If the buffer is empty
+ // or already read, postRead will return false.
+ //
+ _readStart = buf.b.position();
+
+ if(buf.empty() || !buf.b.hasRemaining())
+ {
+ return false;
+ }
+
+ int n = Math.min(_readBuffer.b.position() - _readBufferPos, buf.b.remaining());
+ if(n > _readPayloadLength)
+ {
+ n = _readPayloadLength;
+ }
+ if(n > 0)
+ {
+ if(buf.b.hasArray() && _readBuffer.b.hasArray())
+ {
+ System.arraycopy(_readBuffer.b.array(), _readBuffer.b.arrayOffset() + _readBufferPos,
+ buf.b.array(), buf.b.arrayOffset() + buf.b.position(), n);
+ buf.b.position(buf.b.position() + n);
+ }
+ else
+ {
+ for(int i = 0; i < n; ++i)
+ {
+ buf.b.put(_readBuffer.b.get(_readBufferPos + i));
+ }
+ }
+ _readBufferPos += n;
+ }
+
+ //
+ // Continue reading if we didn't read the full message or there's more payload data to read.
+ //
+ return buf.b.hasRemaining() && n < _readPayloadLength;
+ }
+ }
+ }
+
+ private boolean postRead(Buffer buf)
+ {
+ if(_readState != ReadStatePayload)
+ {
+ return _readStart < _readBuffer.b.position(); // Returns true if data was read.
+ }
+
+ if(_readStart == buf.b.position())
+ {
+ return false; // Nothing was read or nothing to read.
+ }
+ assert(_readStart < buf.b.position());
+
+ if(_incoming)
+ {
+ //
+ // Unmask the data we just read.
+ //
+ final int pos = buf.b.position();
+ if(buf.b.hasArray())
+ {
+ byte[] arr = buf.b.array();
+ int offset = buf.b.arrayOffset();
+ for(int n = _readStart; n < pos; ++n)
+ {
+ arr[n + offset] = (byte)(arr[n + offset] ^ _readMask[(n - _readFrameStart) % 4]);
+ }
+ }
+ else
+ {
+ for(int n = _readStart; n < pos; ++n)
+ {
+ final byte b = (byte)(buf.b.get(n) ^ _readMask[(n - _readFrameStart) % 4]);
+ buf.b.put(n, b);
+ }
+ }
+ }
+
+ _readPayloadLength -= buf.b.position() - _readStart;
+ _readStart = buf.b.position();
+ if(_readPayloadLength == 0)
+ {
+ //
+ // We've read the complete payload, we're ready to read a new frame.
+ //
+ _readState = ReadStateOpcode;
+ }
+ return buf.b.hasRemaining();
+ }
+
+ private boolean preWrite(Buffer buf)
+ {
+ if(_writeState == WriteStateHeader)
+ {
+ if(_state == StateOpened)
+ {
+ if(buf.empty() || !buf.b.hasRemaining())
+ {
+ return false;
+ }
+
+ assert(buf.b.position() == 0);
+ prepareWriteHeader((byte)OP_DATA, buf.size());
+
+ _writeState = WriteStatePayload;
+ }
+ else if(_state == StatePingPending)
+ {
+ prepareWriteHeader((byte)OP_PING, 0); // Don't send any payload
+
+ _writeState = WriteStateControlFrame;
+ _writeBuffer.b.flip();
+ }
+ else if(_state == StatePongPending)
+ {
+ prepareWriteHeader((byte)OP_PONG, _pingPayload.length);
+ if(_pingPayload.length > _writeBuffer.b.remaining())
+ {
+ final int pos = _writeBuffer.b.position();
+ _writeBuffer.resize(pos + _pingPayload.length, false);
+ _writeBuffer.b.position(pos);
+ }
+ _writeBuffer.b.put(_pingPayload);
+ _pingPayload = new byte[0];
+
+ _writeState = WriteStateControlFrame;
+ _writeBuffer.b.flip();
+ }
+ else if((_state == StateClosingRequestPending && !_closingInitiator) ||
+ (_state == StateClosingResponsePending && _closingInitiator))
+ {
+ prepareWriteHeader((byte)OP_CLOSE, 2);
+
+ // Write closing reason
+ _writeBuffer.b.putShort((short)_closingReason);
+
+ if(!_incoming)
+ {
+ byte b;
+ int pos = _writeBuffer.b.position() - 2;
+ b = (byte)(_writeBuffer.b.get(pos) ^ _writeMask[0]);
+ _writeBuffer.b.put(pos, b);
+ pos++;
+ b = (byte)(_writeBuffer.b.get(pos) ^ _writeMask[1]);
+ _writeBuffer.b.put(pos, b);
+ }
+
+ _writeState = WriteStateControlFrame;
+ _writeBuffer.b.flip();
+ }
+ else
+ {
+ assert(_state != StateClosed);
+ return false; // Nothing to write in this state
+ }
+
+ _writePayloadLength = 0;
+ }
+
+ if(_writeState == WriteStatePayload)
+ {
+ //
+ // For an outgoing connection, each message must be masked with a random
+ // 32-bit value, so we copy the entire message into the internal buffer
+ // for writing. For incoming connections, we just copy the start of the
+ // message in the internal buffer after the hedaer. If the message is
+ // larger, the reminder is sent directly from the message buffer to avoid
+ // copying.
+ //
+
+ if(!_incoming && (_writePayloadLength == 0 || !_writeBuffer.b.hasRemaining()))
+ {
+ if(!_writeBuffer.b.hasRemaining())
+ {
+ _writeBuffer.b.position(0);
+ }
+
+ int n = buf.b.position();
+ final int sz = buf.size();
+ if(buf.b.hasArray() && _writeBuffer.b.hasArray())
+ {
+ int pos = _writeBuffer.b.position();
+ final int count = Math.min(sz - n, _writeBuffer.b.remaining());
+ final byte[] src = buf.b.array();
+ final int srcOff = buf.b.arrayOffset();
+ final byte[] dest = _writeBuffer.b.array();
+ final int destOff = _writeBuffer.b.arrayOffset();
+ for(int i = 0; i < count; ++i, ++n, ++pos)
+ {
+ dest[destOff + pos] = (byte)(src[srcOff + n] ^ _writeMask[n % 4]);
+ }
+ _writeBuffer.b.position(pos);
+ }
+ else
+ {
+ for(; n < sz && _writeBuffer.b.hasRemaining(); ++n)
+ {
+ final byte b = (byte)(buf.b.get(n) ^ _writeMask[n % 4]);
+ _writeBuffer.b.put(b);
+ }
+ }
+ _writePayloadLength = n;
+ _writeBuffer.b.flip();
+ }
+ else if(_writePayloadLength == 0)
+ {
+ assert(_incoming);
+ if(_writeBuffer.b.hasRemaining())
+ {
+ assert(buf.b.position() == 0);
+ int n = _writeBuffer.b.remaining();
+ if(buf.b.remaining() > n)
+ {
+ int limit = buf.b.limit();
+ buf.b.limit(n);
+ _writeBuffer.b.put(buf.b);
+ buf.b.limit(limit);
+ _writePayloadLength = n;
+ }
+ else
+ {
+ _writePayloadLength = buf.b.remaining();
+ _writeBuffer.b.put(buf.b);
+ }
+ buf.b.position(0);
+ }
+ _writeBuffer.b.flip();
+ }
+ return true;
+ }
+ else if(_writeState == WriteStateControlFrame)
+ {
+ return _writeBuffer.b.hasRemaining();
+ }
+ else
+ {
+ assert(_writeState == WriteStateFlush);
+ return true;
+ }
+ }
+
+ private boolean postWrite(Buffer buf, int status)
+ {
+ if(_state > StateOpened && _writeState == WriteStateControlFrame)
+ {
+ if(!_writeBuffer.b.hasRemaining())
+ {
+ if(_state == StatePingPending)
+ {
+ if(_instance.traceLevel() >= 2)
+ {
+ _instance.logger().trace(_instance.traceCategory(),
+ "sent " + protocol() + " connection ping frame\n" + toString());
+ }
+ }
+ else if(_state == StatePongPending)
+ {
+ if(_instance.traceLevel() >= 2)
+ {
+ _instance.logger().trace(_instance.traceCategory(),
+ "sent " + protocol() + " connection pong frame\n" + toString());
+ }
+ }
+ else if((_state == StateClosingRequestPending && !_closingInitiator) ||
+ (_state == StateClosingResponsePending && _closingInitiator))
+ {
+ if(_instance.traceLevel() >= 2)
+ {
+ _instance.logger().trace(_instance.traceCategory(),
+ "sent " + protocol() + " connection close frame\n" + toString());
+ }
+
+ if(_state == StateClosingRequestPending && !_closingInitiator)
+ {
+ _writeState = WriteStateHeader;
+ _state = StateClosingResponsePending;
+ return false;
+ }
+ else
+ {
+ throw new com.zeroc.Ice.ConnectionLostException();
+ }
+ }
+ else if(_state == StateClosed)
+ {
+ return false;
+ }
+
+ _state = _nextState;
+ _nextState = StateOpened;
+ _writeState = WriteStateHeader;
+ }
+ else
+ {
+ return status == SocketOperation.None;
+ }
+ }
+
+ if((!_incoming || buf.b.position() == 0) && _writePayloadLength > 0)
+ {
+ if(!_writeBuffer.b.hasRemaining())
+ {
+ buf.b.position(_writePayloadLength);
+ }
+ }
+
+ if(status == SocketOperation.Write && !buf.b.hasRemaining() && !_writeBuffer.b.hasRemaining())
+ {
+ //
+ // Our buffers are empty but the delegate needs another call to write().
+ //
+ _writeState = WriteStateFlush;
+ return false;
+ }
+ else if(!buf.b.hasRemaining())
+ {
+ _writeState = WriteStateHeader;
+ if(_state == StatePingPending ||
+ _state == StatePongPending ||
+ (_state == StateClosingRequestPending && !_closingInitiator) ||
+ (_state == StateClosingResponsePending && _closingInitiator))
+ {
+ return true;
+ }
+ }
+ else if(_state == StateOpened)
+ {
+ return status == SocketOperation.None;
+ }
+
+ return false;
+ }
+
+ private boolean readBuffered(int sz)
+ {
+ if(_readBufferPos == _readBuffer.b.position())
+ {
+ _readBuffer.resize(_readBufferSize, true);
+ _readBufferPos = 0;
+ _readBuffer.b.position(0);
+ }
+ else
+ {
+ final int available = _readBuffer.b.position() - _readBufferPos;
+ if(available < sz)
+ {
+ if(_readBufferPos > 0)
+ {
+ _readBuffer.b.limit(_readBuffer.b.position());
+ _readBuffer.b.position(_readBufferPos);
+ _readBuffer.b.compact();
+ assert(_readBuffer.b.position() == available);
+ }
+ _readBuffer.resize(Math.max(_readBufferSize, sz), true);
+ _readBufferPos = 0;
+ _readBuffer.b.position(available);
+ }
+ }
+
+ _readStart = _readBuffer.b.position();
+ if(_readBufferPos + sz > _readBuffer.b.position())
+ {
+ return false; // Not enough read.
+ }
+ assert(_readBuffer.b.position() > _readBufferPos);
+ return true;
+ }
+
+ private void prepareWriteHeader(byte opCode, int payloadLength)
+ {
+ //
+ // We need to prepare the frame header.
+ //
+ _writeBuffer.resize(_writeBufferSize, false);
+ _writeBuffer.b.limit(_writeBufferSize);
+ _writeBuffer.b.position(0);
+
+ //
+ // Set the opcode - this is the one and only data frame.
+ //
+ _writeBuffer.b.put((byte)(opCode | FLAG_FINAL));
+
+ //
+ // Set the payload length.
+ //
+ if(payloadLength <= 125)
+ {
+ _writeBuffer.b.put((byte)payloadLength);
+ }
+ else if(payloadLength > 125 && payloadLength <= 65535)
+ {
+ //
+ // Use an extra 16 bits to encode the payload length.
+ //
+ _writeBuffer.b.put((byte)126);
+ _writeBuffer.b.putShort((short)payloadLength);
+ }
+ else if(payloadLength > 65535)
+ {
+ //
+ // Use an extra 64 bits to encode the payload length.
+ //
+ _writeBuffer.b.put((byte)127);
+ _writeBuffer.b.putLong(payloadLength);
+ }
+
+ if(!_incoming)
+ {
+ //
+ // Add a random 32-bit mask to every outgoing frame, copy the payload data,
+ // and apply the mask.
+ //
+ _writeBuffer.b.put(1, (byte)(_writeBuffer.b.get(1) | FLAG_MASKED));
+ _rand.nextBytes(_writeMask);
+ _writeBuffer.b.put(_writeMask);
+ }
+ }
+
+ private ProtocolInstance _instance;
+ private Transceiver _delegate;
+ private String _host;
+ private String _resource;
+ private boolean _incoming;
+ private ReadyCallback _readyCallback;
+
+ private static final int StateInitializeDelegate = 0;
+ private static final int StateConnected = 1;
+ private static final int StateUpgradeRequestPending = 2;
+ private static final int StateUpgradeResponsePending = 3;
+ private static final int StateOpened = 4;
+ private static final int StatePingPending = 5;
+ private static final int StatePongPending = 6;
+ private static final int StateClosingRequestPending = 7;
+ private static final int StateClosingResponsePending = 8;
+ private static final int StateClosed = 9;
+
+ private int _state;
+ private int _nextState;
+
+ private HttpParser _parser;
+ private String _key;
+
+ private static final int ReadStateOpcode = 0;
+ private static final int ReadStateHeader = 1;
+ private static final int ReadStateControlFrame = 2;
+ private static final int ReadStatePayload = 3;
+
+ private int _readState;
+ private Buffer _readBuffer;
+ private int _readBufferPos;
+ private int _readBufferSize;
+
+ private boolean _readLastFrame;
+ private int _readOpCode;
+ private int _readHeaderLength;
+ private int _readPayloadLength;
+ private int _readStart;
+ private int _readFrameStart;
+ private byte[] _readMask;
+
+ private static final int WriteStateHeader = 0;
+ private static final int WriteStatePayload = 1;
+ private static final int WriteStateControlFrame = 2;
+ private static final int WriteStateFlush = 3;
+
+ private int _writeState;
+ private Buffer _writeBuffer;
+ private int _writeBufferSize;
+ private byte[] _writeMask;
+ private int _writePayloadLength;
+
+ private boolean _closingInitiator;
+ private int _closingReason;
+
+ private byte[] _pingPayload;
+
+ private java.util.Random _rand;
+
+ //
+ // WebSocket opcodes
+ //
+ final static private int OP_CONT = 0x0; // Continuation frame
+ final static private int OP_TEXT = 0x1; // Text frame
+ final static private int OP_DATA = 0x2; // Data frame
+ @SuppressWarnings("unused")
+ final static private int OP_RES_0x3 = 0x3; // Reserved
+ @SuppressWarnings("unused")
+ final static private int OP_RES_0x4 = 0x4; // Reserved
+ @SuppressWarnings("unused")
+ final static private int OP_RES_0x5 = 0x5; // Reserved
+ @SuppressWarnings("unused")
+ final static private int OP_RES_0x6 = 0x6; // Reserved
+ @SuppressWarnings("unused")
+ final static private int OP_RES_0x7 = 0x7; // Reserved
+ final static private int OP_CLOSE = 0x8; // Connection close
+ final static private int OP_PING = 0x9; // Ping
+ final static private int OP_PONG = 0xA; // Pong
+ @SuppressWarnings("unused")
+ final static private int OP_RES_0xB = 0xB; // Reserved
+ @SuppressWarnings("unused")
+ final static private int OP_RES_0xC = 0xC; // Reserved
+ @SuppressWarnings("unused")
+ final static private int OP_RES_0xD = 0xD; // Reserved
+ @SuppressWarnings("unused")
+ final static private int OP_RES_0xE = 0xE; // Reserved
+ @SuppressWarnings("unused")
+ final static private int OP_RES_0xF = 0xF; // Reserved
+ final static private int FLAG_FINAL = 0x80; // Last frame
+ final static private int FLAG_MASKED = 0x80; // Payload is masked
+
+ final static private int CLOSURE_NORMAL = 1000;
+ final static private int CLOSURE_SHUTDOWN = 1001;
+ final static private int CLOSURE_PROTOCOL_ERROR = 1002;
+ final static private int CLOSURE_TOO_BIG = 1009;
+
+ final static private String _iceProtocol = "ice.zeroc.com";
+ final static private String _wsUUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
+
+ final static java.nio.charset.Charset _ascii = java.nio.charset.Charset.forName("US-ASCII");
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/WebSocketException.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WebSocketException.java
new file mode 100644
index 00000000000..d8b3b4b6e23
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WebSocketException.java
@@ -0,0 +1,28 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceInternal;
+
+final class WebSocketException extends java.lang.RuntimeException
+{
+ public WebSocketException(String reason)
+ {
+ super(reason);
+ }
+
+ public WebSocketException(String reason, Throwable cause)
+ {
+ super(reason, cause);
+ }
+
+ public WebSocketException(Throwable cause)
+ {
+ super(cause);
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceMX/MetricsHelper.java b/java/src/Ice/src/main/java/com/zeroc/IceMX/MetricsHelper.java
new file mode 100644
index 00000000000..4f769fc1aa5
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceMX/MetricsHelper.java
@@ -0,0 +1,188 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceMX;
+
+public class MetricsHelper<T>
+{
+ public static class AttributeResolver
+ {
+ private abstract class Resolver
+ {
+ abstract Object resolve(Object obj) throws Exception;
+
+ String resolveImpl(Object obj)
+ {
+ try
+ {
+ Object result = resolve(obj);
+ if(result != null)
+ {
+ return result.toString();
+ }
+ return "";
+ }
+ catch(IllegalArgumentException ex)
+ {
+ throw ex;
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ assert(false);
+ return null;
+ }
+ }
+ }
+
+ protected
+ AttributeResolver()
+ {
+ }
+
+ public String
+ resolve(MetricsHelper<?> helper, String attribute)
+ {
+ Resolver resolver = _attributes.get(attribute);
+ if(resolver == null)
+ {
+ if(attribute.equals("none"))
+ {
+ return "";
+ }
+ String v = helper.defaultResolve(attribute);
+ if(v != null)
+ {
+ return v;
+ }
+ throw new IllegalArgumentException(attribute);
+ }
+ return resolver.resolveImpl(helper);
+ }
+
+ public void
+ add(final String name, final java.lang.reflect.Method method)
+ {
+ _attributes.put(name, new Resolver()
+ {
+ @Override
+ public Object
+ resolve(Object obj) throws Exception
+ {
+ return method.invoke(obj);
+ }
+ });
+ }
+
+ public void
+ add(final String name, final java.lang.reflect.Field field)
+ {
+ _attributes.put(name, new Resolver()
+ {
+ @Override
+ public Object
+ resolve(Object obj) throws Exception
+ {
+ return getField(name, field, obj);
+ }
+ });
+ }
+
+ public void
+ add(final String name, final java.lang.reflect.Method method, final java.lang.reflect.Field field)
+ {
+ _attributes.put(name, new Resolver()
+ {
+ @Override
+ public Object
+ resolve(Object obj) throws Exception
+ {
+ return getField(name, field, method.invoke(obj));
+ }
+ });
+ }
+
+ public void
+ add(final String name, final java.lang.reflect.Method method, final java.lang.reflect.Method subMethod)
+ {
+ _attributes.put(name, new Resolver()
+ {
+ @Override
+ public Object
+ resolve(Object obj) throws Exception
+ {
+ Object o = method.invoke(obj);
+ if(o != null)
+ {
+ return subMethod.invoke(o);
+ }
+ throw new IllegalArgumentException(name);
+ }
+ });
+ }
+
+ private Object getField(String name, java.lang.reflect.Field field, Object o)
+ throws IllegalArgumentException, IllegalAccessException
+ {
+ while(o != null)
+ {
+ try
+ {
+ return field.get(o);
+ }
+ catch(IllegalArgumentException ex)
+ {
+ // If we're dealing with an endpoint/connection information class,
+ // check if the field is from the underlying info objects.
+ if(o instanceof com.zeroc.Ice.EndpointInfo)
+ {
+ o = ((com.zeroc.Ice.EndpointInfo)o).underlying;
+ }
+ else if(o instanceof com.zeroc.Ice.ConnectionInfo)
+ {
+ o = ((com.zeroc.Ice.ConnectionInfo)o).underlying;
+ }
+ else
+ {
+ throw ex;
+ }
+ }
+ }
+ throw new IllegalArgumentException(name);
+ }
+
+ private java.util.Map<String, Resolver> _attributes = new java.util.HashMap<>();
+ }
+
+ protected
+ MetricsHelper(AttributeResolver attributes)
+ {
+ _attributes = attributes;
+ }
+
+ public String
+ resolve(String attribute)
+ {
+ return _attributes.resolve(this, attribute);
+ }
+
+ public void
+ initMetrics(T metrics)
+ {
+ // Override in specialized helpers.
+ }
+
+ protected String
+ defaultResolve(String attribute)
+ {
+ return null;
+ }
+
+ private AttributeResolver _attributes;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceMX/Observer.java b/java/src/Ice/src/main/java/com/zeroc/IceMX/Observer.java
new file mode 100644
index 00000000000..0474ca87f49
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceMX/Observer.java
@@ -0,0 +1,137 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceMX;
+
+import com.zeroc.IceInternal.MetricsMap;
+
+public class Observer<T extends Metrics> extends com.zeroc.IceUtilInternal.StopWatch
+ implements com.zeroc.Ice.Instrumentation.Observer
+{
+ public interface MetricsUpdate<T>
+ {
+ void update(T m);
+ }
+
+ @Override
+ public void
+ attach()
+ {
+ if(!isStarted())
+ {
+ start();
+ }
+ }
+
+ @Override
+ public void
+ detach()
+ {
+ long lifetime = _previousDelay + stop();
+ for(MetricsMap<T>.Entry e : _objects)
+ {
+ e.detach(lifetime);
+ }
+ }
+
+ @Override
+ public void
+ failed(String exceptionName)
+ {
+ for(MetricsMap<T>.Entry e : _objects)
+ {
+ e.failed(exceptionName);
+ }
+ }
+
+ public void
+ forEach(MetricsUpdate<T> u)
+ {
+ for(MetricsMap<T>.Entry e : _objects)
+ {
+ e.execute(u);
+ }
+ }
+
+ public void
+ init(MetricsHelper<T> helper, java.util.List<MetricsMap<T>.Entry> objects, Observer<T> previous)
+ {
+ _objects = objects;
+
+ if(previous == null)
+ {
+ return;
+ }
+
+ _previousDelay = previous._previousDelay + previous.delay();
+
+ //
+ // Detach entries from previous observer which are no longer
+ // attached to this new observer.
+ //
+ for(MetricsMap<T>.Entry p : previous._objects)
+ {
+ if(!_objects.contains(p))
+ {
+ p.detach(_previousDelay);
+ }
+ }
+ }
+
+ public <S extends Metrics, ObserverImpl extends Observer<S>> ObserverImpl
+ getObserver(String mapName, MetricsHelper<S> helper, Class<S> mcl, Class<ObserverImpl> ocl)
+ {
+ java.util.List<MetricsMap<S>.Entry> metricsObjects = null;
+ for(MetricsMap<T>.Entry entry : _objects)
+ {
+ MetricsMap<S>.Entry e = entry.getMatching(mapName, helper, mcl);
+ if(e != null)
+ {
+ if(metricsObjects == null)
+ {
+ metricsObjects = new java.util.ArrayList<>(_objects.size());
+ }
+ metricsObjects.add(e);
+ }
+ }
+
+ if(metricsObjects == null)
+ {
+ return null;
+ }
+
+ try
+ {
+ ObserverImpl obsv = ocl.newInstance();
+ obsv.init(helper, metricsObjects, null);
+ return obsv;
+ }
+ catch(Exception ex)
+ {
+ assert(false);
+ return null;
+ }
+ }
+
+ public MetricsMap<T>.Entry
+ getEntry(MetricsMap<?> map)
+ {
+ for(MetricsMap<T>.Entry e : _objects)
+ {
+ if(e.getMap() == map)
+ {
+ return e;
+ }
+ }
+ return null;
+ }
+
+ private java.util.List<MetricsMap<T>.Entry> _objects;
+ private long _previousDelay = 0;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverFactory.java
new file mode 100644
index 00000000000..d0df4bcc5d4
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverFactory.java
@@ -0,0 +1,142 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceMX;
+
+import com.zeroc.IceInternal.MetricsMap;
+
+public class ObserverFactory<T extends Metrics, O extends Observer<T>>
+{
+ public
+ ObserverFactory(com.zeroc.IceInternal.MetricsAdminI metrics, String name, Class<T> cl)
+ {
+ _metrics = metrics;
+ _name = name;
+ _class = cl;
+ _metrics.registerMap(name, _class, new Runnable()
+ {
+ @Override
+ public void
+ run()
+ {
+ update();
+ }
+ });
+ }
+
+ public void
+ destroy()
+ {
+ if(_metrics != null)
+ {
+ _metrics.unregisterMap(_name);
+ }
+ }
+
+ public O
+ getObserver(MetricsHelper<T> helper, Class<O> cl)
+ {
+ return getObserver(helper, null, cl);
+ }
+
+ @SuppressWarnings("unchecked")
+ public synchronized O
+ getObserver(MetricsHelper<T> helper, Object observer, Class<O> cl)
+ {
+ O old = null;
+ try
+ {
+ old = (O)observer;
+ }
+ catch(ClassCastException ex)
+ {
+ }
+ java.util.List<MetricsMap<T>.Entry> metricsObjects = null;
+ for(MetricsMap<T> m : _maps)
+ {
+ MetricsMap<T>.Entry e = m.getMatching(helper, old != null ? old.getEntry(m) : null);
+ if(e != null)
+ {
+ if(metricsObjects == null)
+ {
+ metricsObjects = new java.util.ArrayList<>(_maps.size());
+ }
+ metricsObjects.add(e);
+ }
+ }
+
+ if(metricsObjects == null)
+ {
+ if(old != null)
+ {
+ old.detach();
+ }
+ return null;
+ }
+
+ O obsv;
+ try
+ {
+ obsv = cl.newInstance();
+ }
+ catch(Exception ex)
+ {
+ assert(false);
+ return null;
+ }
+ obsv.init(helper, metricsObjects, old);
+ return obsv;
+ }
+
+ public <S extends com.zeroc.IceMX.Metrics> void
+ registerSubMap(String subMap, Class<S> cl, java.lang.reflect.Field field)
+ {
+ _metrics.registerSubMap(_name, subMap, cl, field);
+ }
+
+ public boolean
+ isEnabled()
+ {
+ return _enabled;
+ }
+
+ public void
+ update()
+ {
+ Runnable updater;
+ synchronized(this)
+ {
+ _maps.clear();
+ for(MetricsMap<T> m : _metrics.getMaps(_name, _class))
+ {
+ _maps.add(m);
+ }
+ _enabled = !_maps.isEmpty();
+ updater = _updater;
+ }
+
+ if(updater != null)
+ {
+ updater.run();
+ }
+ }
+
+ public synchronized void
+ setUpdater(Runnable updater)
+ {
+ _updater = updater;
+ }
+
+ private final com.zeroc.IceInternal.MetricsAdminI _metrics;
+ private final String _name;
+ private final Class<T> _class;
+ private java.util.List<MetricsMap<T>> _maps = new java.util.ArrayList<>();
+ private volatile boolean _enabled;
+ private Runnable _updater;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverFactoryWithDelegate.java b/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverFactoryWithDelegate.java
new file mode 100644
index 00000000000..9854fef1f9f
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverFactoryWithDelegate.java
@@ -0,0 +1,48 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceMX;
+
+public class ObserverFactoryWithDelegate<T extends Metrics,
+ OImpl extends ObserverWithDelegate<T, O>,
+ O extends com.zeroc.Ice.Instrumentation.Observer>
+ extends ObserverFactory<T, OImpl>
+{
+ public
+ ObserverFactoryWithDelegate(com.zeroc.IceInternal.MetricsAdminI metrics, String name, Class<T> cl)
+ {
+ super(metrics, name, cl);
+ }
+
+ @SuppressWarnings("unchecked")
+ public O
+ getObserver(MetricsHelper<T> helper, Class<OImpl> cl, O delegate)
+ {
+ OImpl o = super.getObserver(helper, cl);
+ if(o != null)
+ {
+ o.setDelegate(delegate);
+ return (O)o;
+ }
+ return delegate;
+ }
+
+ @SuppressWarnings("unchecked")
+ public O
+ getObserver(MetricsHelper<T> helper, Object observer, Class<OImpl> cl, O delegate)
+ {
+ OImpl o = super.getObserver(helper, observer, cl);
+ if(o != null)
+ {
+ o.setDelegate(delegate);
+ return (O)o;
+ }
+ return delegate;
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverWithDelegate.java b/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverWithDelegate.java
new file mode 100644
index 00000000000..242906b27ce
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverWithDelegate.java
@@ -0,0 +1,75 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceMX;
+
+public class ObserverWithDelegate<T extends Metrics, O extends com.zeroc.Ice.Instrumentation.Observer>
+ extends Observer<T>
+{
+ @Override
+ public void
+ attach()
+ {
+ super.attach();
+ if(_delegate != null)
+ {
+ _delegate.attach();
+ }
+ }
+
+ @Override
+ public void
+ detach()
+ {
+ super.detach();
+ if(_delegate != null)
+ {
+ _delegate.detach();
+ }
+ }
+
+ @Override
+ public void
+ failed(String exceptionName)
+ {
+ super.failed(exceptionName);
+ if(_delegate != null)
+ {
+ _delegate.failed(exceptionName);
+ }
+ }
+
+ public O
+ getDelegate()
+ {
+ return _delegate;
+ }
+
+ public void
+ setDelegate(O del)
+ {
+ _delegate = del;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <S extends Metrics, ObserverImpl extends ObserverWithDelegate<S, Obs>,
+ Obs extends com.zeroc.Ice.Instrumentation.Observer> Obs
+ getObserver(String mapName, MetricsHelper<S> helper, Class<S> mcl, Class<ObserverImpl> ocl, Obs delegate)
+ {
+ ObserverImpl obsv = super.getObserver(mapName, helper, mcl, ocl);
+ if(obsv != null)
+ {
+ obsv.setDelegate(delegate);
+ return (Obs)obsv;
+ }
+ return delegate;
+ }
+
+ protected O _delegate;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverWithDelegateI.java b/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverWithDelegateI.java
new file mode 100644
index 00000000000..d0b02d96abf
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverWithDelegateI.java
@@ -0,0 +1,14 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceMX;
+
+public class ObserverWithDelegateI extends ObserverWithDelegate<Metrics, com.zeroc.Ice.Instrumentation.Observer>
+{
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceSSL/AcceptorI.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/AcceptorI.java
new file mode 100644
index 00000000000..f0df8ffe4ae
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/AcceptorI.java
@@ -0,0 +1,85 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceSSL;
+
+final class AcceptorI implements com.zeroc.IceInternal.Acceptor
+{
+ @Override
+ public java.nio.channels.ServerSocketChannel fd()
+ {
+ return _delegate.fd();
+ }
+
+ @Override
+ public void setReadyCallback(com.zeroc.IceInternal.ReadyCallback callback)
+ {
+ _delegate.setReadyCallback(callback);
+ }
+
+ @Override
+ public void close()
+ {
+ _delegate.close();
+ }
+
+ @Override
+ public com.zeroc.IceInternal.EndpointI listen()
+ {
+ _endpoint = _endpoint.endpoint(_delegate.listen());
+ return _endpoint;
+ }
+
+ @Override
+ public com.zeroc.IceInternal.Transceiver accept()
+ {
+ //
+ // The plug-in may not be fully initialized.
+ //
+ if(!_instance.initialized())
+ {
+ com.zeroc.Ice.PluginInitializationException ex = new com.zeroc.Ice.PluginInitializationException();
+ ex.reason = "IceSSL: plug-in is not initialized";
+ throw ex;
+ }
+
+ return new TransceiverI(_instance, _delegate.accept(), _adapterName, true);
+ }
+
+ @Override
+ public String protocol()
+ {
+ return _delegate.protocol();
+ }
+
+ @Override
+ public String toString()
+ {
+ return _delegate.toString();
+ }
+
+ @Override
+ public String toDetailedString()
+ {
+ return _delegate.toDetailedString();
+ }
+
+ AcceptorI(EndpointI endpoint, Instance instance, com.zeroc.IceInternal.Acceptor delegate, String adapterName)
+ {
+ _endpoint = endpoint;
+ _instance = instance;
+ _delegate = delegate;
+ _adapterName = adapterName;
+ }
+
+ private EndpointI _endpoint;
+ private Instance _instance;
+ private com.zeroc.IceInternal.Acceptor _delegate;
+ private String _adapterName;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceSSL/CertificateVerifier.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/CertificateVerifier.java
new file mode 100644
index 00000000000..da27b27c76e
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/CertificateVerifier.java
@@ -0,0 +1,26 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceSSL;
+
+/**
+ * An application can customize the certificate verification process
+ * by implementing the CertificateVerifier interface.
+ **/
+public interface CertificateVerifier
+{
+ /**
+ * Determines whether a connection should be accepted or rejected.
+ *
+ * @param info The details of the connection.
+ * @return <code>true</code> if the connection should be accepted;
+ * <code>false</code>, otherwise.
+ **/
+ boolean verify(NativeConnectionInfo info);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceSSL/ConnectorI.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/ConnectorI.java
new file mode 100644
index 00000000000..cb86f2920cf
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/ConnectorI.java
@@ -0,0 +1,80 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceSSL;
+
+import com.zeroc.IceInternal.Network;
+
+final class ConnectorI implements com.zeroc.IceInternal.Connector
+{
+ @Override
+ public com.zeroc.IceInternal.Transceiver connect()
+ {
+ //
+ // The plug-in may not be fully initialized.
+ //
+ if(!_instance.initialized())
+ {
+ com.zeroc.Ice.PluginInitializationException ex = new com.zeroc.Ice.PluginInitializationException();
+ ex.reason = "IceSSL: plug-in is not initialized";
+ throw ex;
+ }
+
+ return new TransceiverI(_instance, _delegate.connect(), _host, false);
+ }
+
+ @Override
+ public short type()
+ {
+ return _delegate.type();
+ }
+
+ @Override
+ public String toString()
+ {
+ return _delegate.toString();
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return _delegate.hashCode();
+ }
+
+ //
+ // Only for use by EndpointI.
+ //
+ ConnectorI(Instance instance, com.zeroc.IceInternal.Connector delegate, String host)
+ {
+ _instance = instance;
+ _delegate = delegate;
+ _host = host;
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj)
+ {
+ if(!(obj instanceof ConnectorI))
+ {
+ return false;
+ }
+
+ if(this == obj)
+ {
+ return true;
+ }
+
+ ConnectorI p = (ConnectorI)obj;
+ return p._delegate.equals(_delegate);
+ }
+
+ private Instance _instance;
+ private com.zeroc.IceInternal.Connector _delegate;
+ private String _host;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceSSL/EndpointFactoryI.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/EndpointFactoryI.java
new file mode 100644
index 00000000000..73b41deb9c4
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/EndpointFactoryI.java
@@ -0,0 +1,62 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceSSL;
+
+import com.zeroc.IceInternal.EndpointFactory;
+
+final class EndpointFactoryI implements EndpointFactory
+{
+ EndpointFactoryI(Instance instance, EndpointFactory delegate)
+ {
+ _instance = instance;
+ _delegate = delegate;
+ }
+
+ @Override
+ public short type()
+ {
+ return _instance.type();
+ }
+
+ @Override
+ public String protocol()
+ {
+ return _instance.protocol();
+ }
+
+ @Override
+ public com.zeroc.IceInternal.EndpointI create(java.util.ArrayList<String> args, boolean oaEndpoint)
+ {
+ return new EndpointI(_instance, _delegate.create(args, oaEndpoint));
+ }
+
+ @Override
+ public com.zeroc.IceInternal.EndpointI read(com.zeroc.Ice.InputStream s)
+ {
+ return new EndpointI(_instance, _delegate.read(s));
+ }
+
+ @Override
+ public void destroy()
+ {
+ _delegate.destroy();
+ _instance = null;
+ }
+
+ @Override
+ public EndpointFactory clone(com.zeroc.IceInternal.ProtocolInstance inst, EndpointFactory delegate)
+ {
+ Instance instance = new Instance(_instance.engine(), inst.type(), inst.protocol());
+ return new EndpointFactoryI(instance, delegate != null ? delegate : _delegate.clone(instance, null));
+ }
+
+ private Instance _instance;
+ private com.zeroc.IceInternal.EndpointFactory _delegate;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceSSL/EndpointI.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/EndpointI.java
new file mode 100644
index 00000000000..e7120a73f9c
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/EndpointI.java
@@ -0,0 +1,262 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceSSL;
+
+final class EndpointI extends com.zeroc.IceInternal.EndpointI
+{
+ public EndpointI(Instance instance, com.zeroc.IceInternal.EndpointI delegate)
+ {
+ _instance = instance;
+ _delegate = delegate;
+ }
+
+ @Override
+ public void streamWriteImpl(com.zeroc.Ice.OutputStream s)
+ {
+ _delegate.streamWriteImpl(s);
+ }
+
+ //
+ // Return the endpoint information.
+ //
+ @Override
+ public com.zeroc.Ice.EndpointInfo getInfo()
+ {
+ EndpointInfo info = new EndpointInfo(_delegate.getInfo(), timeout(), compress())
+ {
+ @Override
+ public short type()
+ {
+ return EndpointI.this.type();
+ }
+
+ @Override
+ public boolean datagram()
+ {
+ return EndpointI.this.datagram();
+ }
+
+ @Override
+ public boolean secure()
+ {
+ return EndpointI.this.secure();
+ }
+ };
+ info.compress = info.underlying.compress;
+ info.timeout = info.underlying.timeout;
+ return info;
+ }
+
+ @Override
+ public short type()
+ {
+ return _delegate.type();
+ }
+
+ @Override
+ public String protocol()
+ {
+ return _delegate.protocol();
+ }
+
+ @Override
+ public int timeout()
+ {
+ return _delegate.timeout();
+ }
+
+ @Override
+ public com.zeroc.IceInternal.EndpointI timeout(int timeout)
+ {
+ if(timeout == _delegate.timeout())
+ {
+ return this;
+ }
+ else
+ {
+ return new EndpointI(_instance, _delegate.timeout(timeout));
+ }
+ }
+
+ @Override
+ public String connectionId()
+ {
+ return _delegate.connectionId();
+ }
+
+ @Override
+ public com.zeroc.IceInternal.EndpointI connectionId(String connectionId)
+ {
+ if(connectionId == _delegate.connectionId())
+ {
+ return this;
+ }
+ else
+ {
+ return new EndpointI(_instance, _delegate.connectionId(connectionId));
+ }
+ }
+
+ @Override
+ public boolean compress()
+ {
+ return _delegate.compress();
+ }
+
+ @Override
+ public com.zeroc.IceInternal.EndpointI compress(boolean compress)
+ {
+ if(compress == _delegate.compress())
+ {
+ return this;
+ }
+ else
+ {
+ return new EndpointI(_instance, _delegate.compress(compress));
+ }
+ }
+
+ @Override
+ public boolean datagram()
+ {
+ return _delegate.datagram();
+ }
+
+ @Override
+ public boolean secure()
+ {
+ return _delegate.secure();
+ }
+
+ //
+ // Return a server side transceiver for this endpoint, or null if a
+ // transceiver can only be created by an acceptor.
+ //
+ @Override
+ public com.zeroc.IceInternal.Transceiver transceiver()
+ {
+ return null;
+ }
+
+ @Override
+ public void connectors_async(com.zeroc.Ice.EndpointSelectionType selType,
+ final com.zeroc.IceInternal.EndpointI_connectors callback)
+ {
+ com.zeroc.Ice.IPEndpointInfo ipInfo = null;
+ for(com.zeroc.Ice.EndpointInfo p = _delegate.getInfo(); p != null; p = p.underlying)
+ {
+ if(p instanceof com.zeroc.Ice.IPEndpointInfo)
+ {
+ ipInfo = (com.zeroc.Ice.IPEndpointInfo)p;
+ }
+ }
+ final String host = ipInfo != null ? ipInfo.host : "";
+ com.zeroc.IceInternal.EndpointI_connectors cb = new com.zeroc.IceInternal.EndpointI_connectors()
+ {
+ @Override
+ public void connectors(java.util.List<com.zeroc.IceInternal.Connector> connectors)
+ {
+ java.util.List<com.zeroc.IceInternal.Connector> l =
+ new java.util.ArrayList<com.zeroc.IceInternal.Connector>();
+ for(com.zeroc.IceInternal.Connector c : connectors)
+ {
+ l.add(new ConnectorI(_instance, c, host));
+ }
+ callback.connectors(l);
+ }
+
+ @Override
+ public void exception(com.zeroc.Ice.LocalException ex)
+ {
+ callback.exception(ex);
+ }
+ };
+ _delegate.connectors_async(selType, cb);
+ }
+
+ //
+ // Return an acceptor for this endpoint, or null if no acceptors
+ // is available.
+ //
+ @Override
+ public com.zeroc.IceInternal.Acceptor acceptor(String adapterName)
+ {
+ return new AcceptorI(this, _instance, _delegate.acceptor(adapterName), adapterName);
+ }
+
+ public EndpointI endpoint(com.zeroc.IceInternal.EndpointI delEndpt)
+ {
+ return new EndpointI(_instance, delEndpt);
+ }
+
+ @Override
+ public java.util.List<com.zeroc.IceInternal.EndpointI> expand()
+ {
+ java.util.List<com.zeroc.IceInternal.EndpointI> endps = _delegate.expand();
+ java.util.List<com.zeroc.IceInternal.EndpointI> l = new java.util.ArrayList<com.zeroc.IceInternal.EndpointI>();
+ for(com.zeroc.IceInternal.EndpointI e : endps)
+ {
+ l.add(e == _delegate ? this : new EndpointI(_instance, e));
+ }
+ return l;
+ }
+
+ @Override
+ public boolean equivalent(com.zeroc.IceInternal.EndpointI endpoint)
+ {
+ if(!(endpoint instanceof EndpointI))
+ {
+ return false;
+ }
+ EndpointI endpointI = (EndpointI)endpoint;
+ return _delegate.equivalent(endpointI._delegate);
+ }
+
+ @Override
+ synchronized public int hashCode()
+ {
+ return _delegate.hashCode();
+ }
+
+ @Override
+ public String options()
+ {
+ return _delegate.options();
+ }
+
+ //
+ // Compare endpoints for sorting purposes
+ //
+ @Override
+ public int compareTo(com.zeroc.IceInternal.EndpointI obj) // From java.lang.Comparable
+ {
+ if(!(obj instanceof EndpointI))
+ {
+ return type() < obj.type() ? -1 : 1;
+ }
+
+ EndpointI p = (EndpointI)obj;
+ if(this == p)
+ {
+ return 0;
+ }
+
+ return _delegate.compareTo(p._delegate);
+ }
+
+ @Override
+ protected boolean checkOption(String option, String argument, String endpoint)
+ {
+ return false;
+ }
+
+ private Instance _instance;
+ private com.zeroc.IceInternal.EndpointI _delegate;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceSSL/Instance.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/Instance.java
new file mode 100644
index 00000000000..634690ce098
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/Instance.java
@@ -0,0 +1,62 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceSSL;
+
+class Instance extends com.zeroc.IceInternal.ProtocolInstance
+{
+ Instance(SSLEngine engine, short type, String protocol)
+ {
+ super(engine.communicator(), type, protocol, true);
+ _engine = engine;
+ }
+
+ SSLEngine engine()
+ {
+ return _engine;
+ }
+
+ int securityTraceLevel()
+ {
+ return _engine.securityTraceLevel();
+ }
+
+ String securityTraceCategory()
+ {
+ return _engine.securityTraceCategory();
+ }
+
+ boolean initialized()
+ {
+ return _engine.initialized();
+ }
+
+ javax.net.ssl.SSLEngine createSSLEngine(boolean incoming, String host, int port)
+ {
+ return _engine.createSSLEngine(incoming, host, port);
+ }
+
+ void traceConnection(String desc, javax.net.ssl.SSLEngine engine, boolean incoming)
+ {
+ _engine.traceConnection(desc, engine, incoming);
+ }
+
+ void verifyPeer(String address, NativeConnectionInfo info, String desc)
+ {
+ _engine.verifyPeer(address, info, desc);
+ }
+
+ void trustManagerFailure(boolean incoming, java.security.cert.CertificateException ex)
+ throws java.security.cert.CertificateException
+ {
+ _engine.trustManagerFailure(incoming, ex);
+ }
+
+ private SSLEngine _engine;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceSSL/NativeConnectionInfo.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/NativeConnectionInfo.java
new file mode 100644
index 00000000000..3d02b7b4896
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/NativeConnectionInfo.java
@@ -0,0 +1,28 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceSSL;
+
+/**
+ *
+ * This class is a native extension of the Slice local class
+ * IceSSL::ConnectionInfo. It provides access to the native Java
+ * certificates.
+ *
+ * @see CertificateVerifier
+ **/
+public class NativeConnectionInfo extends ConnectionInfo
+{
+ /**
+ * The certificate chain. This may be null if the peer did not
+ * supply a certificate. The peer's certificate (if any) is the
+ * first one in the chain.
+ **/
+ public java.security.cert.Certificate[] nativeCerts;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceSSL/PasswordCallback.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/PasswordCallback.java
new file mode 100644
index 00000000000..fd9ac813396
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/PasswordCallback.java
@@ -0,0 +1,45 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceSSL;
+
+/**
+ * A password callback is an alternate way to supply the plug-in with
+ * passwords; this avoids using plain text configuration properties.
+ **/
+public interface PasswordCallback
+{
+ /**
+ * Returns the password for the key. If an alias was selected
+ * by setting the <code>IceSSL.Alias</code> property, <code>alias</code>
+ * contains the property's value.
+ *
+ * @param alias The value of the property <code>IceSSL.Alias</code>, if that
+ * property is set; <code>null</code>, otherwise.
+ * @return The password for the key. The return value must not be <code>null</code>.
+ *
+ **/
+ char[] getPassword(String alias);
+
+ /**
+ * Returns the password for validating the truststore.
+ *
+ * @return The password. To skip truststore validation,
+ * return <code>null</code>.
+ **/
+ char[] getTruststorePassword();
+
+ /**
+ * Returns the password for validating the keystore.
+ *
+ * @return The password. To skip keystore validation,
+ * return <code>null</code>.
+ **/
+ char[] getKeystorePassword();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceSSL/Plugin.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/Plugin.java
new file mode 100644
index 00000000000..d005aabbf45
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/Plugin.java
@@ -0,0 +1,94 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceSSL;
+
+/**
+ * Interface that allows applications to interact with the IceSSL plug-in.
+ **/
+public interface Plugin extends com.zeroc.Ice.Plugin
+{
+ /**
+ * Establishes the SSL context. The context must be established before
+ * plug-in is initialized. Therefore, the application must set
+ * the property <code>Ice.InitPlugins</code> to zero, call
+ * <code>setContext</code> to set the context, and finally
+ * invoke {@link PluginManager#initializePlugins}.
+ * <p>
+ * If an application supplies its own SSL context, the
+ * plug-in skips its normal property-based configuration.
+ *
+ * @param context The SSL context for the plug-in.
+ **/
+ void setContext(javax.net.ssl.SSLContext context);
+
+ /**
+ * Returns the SSL context. Use caution when modifying the returned
+ * value: changes made to this value do not affect existing connections.
+ *
+ * @return The SSL context for the plug-in.
+ **/
+ javax.net.ssl.SSLContext getContext();
+
+ /**
+ * Establishes the certificate verifier. This must be
+ * done before any connections are established.
+ *
+ * @param verifier The certificate verifier.
+ **/
+ void setCertificateVerifier(CertificateVerifier verifier);
+
+ /**
+ * Returns the certificate verifier.
+ *
+ * @return The certificate verifier (<code>null</code> if not set).
+ **/
+ CertificateVerifier getCertificateVerifier();
+
+ /**
+ * Establishes the password callback. This must be
+ * done before the plug-in is initialized.
+ *
+ * @param callback The password callback.
+ **/
+ void setPasswordCallback(PasswordCallback callback);
+
+ /**
+ * Returns the password callback.
+ *
+ * @return The password callback (<code>null</code> if not set).
+ **/
+ PasswordCallback getPasswordCallback();
+
+ /**
+ * Supplies an input stream for the keystore. Calling this method
+ * causes IceSSL to ignore the <code>IceSSL.Keystore</code> property.
+ *
+ * @param stream The input stream for the keystore.
+ **/
+ void setKeystoreStream(java.io.InputStream stream);
+
+ /**
+ * Supplies an input stream for the truststore. Calling this method
+ * causes IceSSL to ignore the <code>IceSSL.Truststore</code> property. It is
+ * legal to supply the same input stream as the one for {@link #setKeystoreStream},
+ * in which case IceSSL uses the certificates contained in the keystore.
+ *
+ * @param stream The input stream for the truststore.
+ **/
+ void setTruststoreStream(java.io.InputStream stream);
+
+ /**
+ * Adds an input stream for the random number seed. You may call
+ * this method multiple times if necessary.
+ *
+ * @param stream The input stream for the random number seed.
+ **/
+ void addSeedStream(java.io.InputStream stream);
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceSSL/PluginFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/PluginFactory.java
new file mode 100644
index 00000000000..0ae8459755d
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/PluginFactory.java
@@ -0,0 +1,34 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceSSL;
+
+/**
+ * Plug-in factories must implement this interface.
+ **/
+public class PluginFactory implements com.zeroc.Ice.PluginFactory
+{
+ /**
+ * Returns a new plug-in.
+ *
+ * @param communicator The communicator for the plug-in.
+ * @param name The name of the plug-in.
+ * @param args The arguments that are specified in the plug-in's configuration.
+ *
+ * @return The new plug-in. <code>null</code> can be returned to indicate
+ * that a general error occurred. Alternatively, <code>create</code> can throw
+ * {@link PluginInitializationException} to provide more detailed information.
+ **/
+ @Override
+ public com.zeroc.Ice.Plugin
+ create(com.zeroc.Ice.Communicator communicator, String name, String[] args)
+ {
+ return new PluginI(communicator);
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceSSL/PluginI.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/PluginI.java
new file mode 100644
index 00000000000..047fe67057b
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/PluginI.java
@@ -0,0 +1,109 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceSSL;
+
+class PluginI implements Plugin
+{
+ public PluginI(com.zeroc.Ice.Communicator communicator)
+ {
+ final com.zeroc.IceInternal.ProtocolPluginFacade facade =
+ com.zeroc.IceInternal.Util.getProtocolPluginFacade(communicator);
+ _engine = new SSLEngine(facade);
+
+ //
+ // Register the endpoint factory. We have to do this now, rather than
+ // in initialize, because the communicator may need to interpret
+ // proxies before the plug-in is fully initialized.
+ //
+
+ // SSL based on TCP
+ com.zeroc.IceInternal.EndpointFactory tcp = facade.getEndpointFactory(com.zeroc.Ice.TCPEndpointType.value);
+ if(tcp != null)
+ {
+ Instance instance = new Instance(_engine, com.zeroc.Ice.SSLEndpointType.value, "ssl");
+ facade.addEndpointFactory(new EndpointFactoryI(instance, tcp.clone(instance, null)));
+ }
+
+ // SSL based on Bluetooth
+ com.zeroc.IceInternal.EndpointFactory bluetooth = facade.getEndpointFactory(com.zeroc.Ice.BTEndpointType.value);
+ if(bluetooth != null)
+ {
+ Instance instance = new Instance(_engine, com.zeroc.Ice.BTSEndpointType.value, "bts");
+ facade.addEndpointFactory(new EndpointFactoryI(instance, bluetooth.clone(instance, null)));
+ }
+ }
+
+ @Override
+ public void initialize()
+ {
+ _engine.initialize();
+ }
+
+ @Override
+ public void destroy()
+ {
+ }
+
+ @Override
+ public void setContext(javax.net.ssl.SSLContext context)
+ {
+ _engine.context(context);
+ }
+
+ @Override
+ public javax.net.ssl.SSLContext getContext()
+ {
+ return _engine.context();
+ }
+
+ @Override
+ public void setCertificateVerifier(CertificateVerifier verifier)
+ {
+ _engine.setCertificateVerifier(verifier);
+ }
+
+ @Override
+ public CertificateVerifier getCertificateVerifier()
+ {
+ return _engine.getCertificateVerifier();
+ }
+
+ @Override
+ public void setPasswordCallback(PasswordCallback callback)
+ {
+ _engine.setPasswordCallback(callback);
+ }
+
+ @Override
+ public PasswordCallback getPasswordCallback()
+ {
+ return _engine.getPasswordCallback();
+ }
+
+ @Override
+ public void setKeystoreStream(java.io.InputStream stream)
+ {
+ _engine.setKeystoreStream(stream);
+ }
+
+ @Override
+ public void setTruststoreStream(java.io.InputStream stream)
+ {
+ _engine.setTruststoreStream(stream);
+ }
+
+ @Override
+ public void addSeedStream(java.io.InputStream stream)
+ {
+ _engine.addSeedStream(stream);
+ }
+
+ private SSLEngine _engine;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceSSL/RFC2253.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/RFC2253.java
new file mode 100644
index 00000000000..27b0908a431
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/RFC2253.java
@@ -0,0 +1,434 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceSSL;
+
+//
+// See RFC 2253 and RFC 1779.
+//
+class RFC2253
+{
+ static class ParseException extends com.zeroc.Ice.LocalException
+ {
+ public ParseException()
+ {
+ }
+
+ public ParseException(String reason)
+ {
+ this.reason = reason;
+ }
+
+ @Override
+ public String
+ ice_id()
+ {
+ return "::RFC2253::ParseException";
+ }
+
+ public String reason;
+ }
+
+ static class RDNPair
+ {
+ String key;
+ String value;
+ }
+
+ static class RDNEntry
+ {
+ java.util.List<RDNPair> rdn = new java.util.LinkedList<>();
+ boolean negate = false;
+ }
+
+ static private class ParseState
+ {
+ String data;
+ int pos;
+ }
+
+ public static java.util.List<RDNEntry>
+ parse(String data)
+ throws ParseException
+ {
+ java.util.List<RDNEntry> results = new java.util.LinkedList<>();
+ RDNEntry current = new RDNEntry();
+ ParseState state = new ParseState();
+ state.data = data;
+ state.pos = 0;
+ while(state.pos < state.data.length())
+ {
+ eatWhite(state);
+ if(state.pos < state.data.length() && state.data.charAt(state.pos) == '!')
+ {
+ if(!current.rdn.isEmpty())
+ {
+ throw new ParseException("negation symbol '!' must appear at start of list");
+ }
+ ++state.pos;
+ current.negate = true;
+ }
+ current.rdn.add(parseNameComponent(state));
+ eatWhite(state);
+ if(state.pos < state.data.length() && state.data.charAt(state.pos) == ',')
+ {
+ ++state.pos;
+ }
+ else if(state.pos < state.data.length() && state.data.charAt(state.pos) == ';')
+ {
+ ++state.pos;
+ results.add(current);
+ current = new RDNEntry();
+ }
+ else if(state.pos < state.data.length())
+ {
+ throw new ParseException("expected ',' or ';' at `" + state.data.substring(state.pos) + "'");
+ }
+ }
+ if(!current.rdn.isEmpty())
+ {
+ results.add(current);
+ }
+
+ return results;
+ }
+
+ public static java.util.List<RDNPair>
+ parseStrict(String data)
+ throws ParseException
+ {
+ java.util.List<RDNPair> results = new java.util.LinkedList<>();
+ ParseState state = new ParseState();
+ state.data = data;
+ state.pos = 0;
+ while(state.pos < state.data.length())
+ {
+ results.add(parseNameComponent(state));
+ eatWhite(state);
+ if(state.pos < state.data.length() &&
+ (state.data.charAt(state.pos) == ',' || state.data.charAt(state.pos) == ';'))
+ {
+ ++state.pos;
+ }
+ else if(state.pos < state.data.length())
+ {
+ throw new ParseException("expected ',' or ';' at `" + state.data.substring(state.pos) + "'");
+ }
+ }
+ return results;
+ }
+
+ private static RDNPair
+ parseNameComponent(ParseState state)
+ throws ParseException
+ {
+ RDNPair result = parseAttributeTypeAndValue(state);
+ while(state.pos < state.data.length())
+ {
+ eatWhite(state);
+ if(state.pos < state.data.length() && state.data.charAt(state.pos) == '+')
+ {
+ ++state.pos;
+ }
+ else
+ {
+ break;
+ }
+ RDNPair p = parseAttributeTypeAndValue(state);
+ result.value += "+";
+ result.value += p.key;
+ result.value += '=';
+ result.value += p.value;
+ }
+ return result;
+ }
+
+ private static RDNPair
+ parseAttributeTypeAndValue(ParseState state)
+ throws ParseException
+ {
+ RDNPair p = new RDNPair();
+ p.key = parseAttributeType(state);
+ eatWhite(state);
+ if(state.pos >= state.data.length())
+ {
+ throw new ParseException("invalid attribute type/value pair (unexpected end of state.data)");
+ }
+ if(state.data.charAt(state.pos) != '=')
+ {
+ throw new ParseException("invalid attribute type/value pair (missing =)");
+ }
+ ++state.pos;
+ p.value = parseAttributeValue(state);
+ return p;
+ }
+
+ private static String
+ parseAttributeType(ParseState state)
+ throws ParseException
+ {
+ eatWhite(state);
+ if(state.pos >= state.data.length())
+ {
+ throw new ParseException("invalid attribute type (expected end of state.data)");
+ }
+
+ StringBuffer result = new StringBuffer();
+
+ //
+ // RFC 1779.
+ // <key> ::= 1*( <keychar> ) | "OID." <oid> | "oid." <oid>
+ // <oid> ::= <digitString> | <digitstring> "." <oid>
+ // RFC 2253:
+ // attributeType = (ALPHA 1*keychar) | oid
+ // keychar = ALPHA | DIGIT | "-"
+ // oid = 1*DIGIT *("." 1*DIGIT)
+ //
+ // In section 4 of RFC 2253 the document says:
+ // Implementations MUST allow an oid in the attribute type to be
+ // prefixed by one of the character Strings "oid." or "OID.".
+ //
+ // Here we must also check for "oid." and "OID." before parsing
+ // according to the ALPHA KEYCHAR* rule.
+ //
+ // First the OID case.
+ //
+ if(Character.isDigit(state.data.charAt(state.pos)) ||
+ (state.data.length() - state.pos >= 4 && (state.data.substring(state.pos, state.pos + 4).equals("oid.") ||
+ state.data.substring(state.pos, state.pos + 4).equals("OID."))))
+ {
+ if(!Character.isDigit(state.data.charAt(state.pos)))
+ {
+ result.append(state.data.substring(state.pos, state.pos + 4));
+ state.pos += 4;
+ }
+
+ while(true)
+ {
+ // 1*DIGIT
+ while(state.pos < state.data.length() && Character.isDigit(state.data.charAt(state.pos)))
+ {
+ result.append(state.data.charAt(state.pos));
+ ++state.pos;
+ }
+ // "." 1*DIGIT
+ if(state.pos < state.data.length() && state.data.charAt(state.pos) == '.')
+ {
+ result.append(state.data.charAt(state.pos));
+ ++state.pos;
+ // 1*DIGIT must follow "."
+ if(state.pos < state.data.length() && !Character.isDigit(state.data.charAt(state.pos)))
+ {
+ throw new ParseException("invalid attribute type (expected end of state.data)");
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ else if(Character.isUpperCase(state.data.charAt(state.pos)) ||
+ Character.isLowerCase(state.data.charAt(state.pos)))
+ {
+ //
+ // The grammar is wrong in this case. It should be ALPHA
+ // KEYCHAR* otherwise it will not accept "O" as a valid
+ // attribute type.
+ //
+ result.append(state.data.charAt(state.pos));
+ ++state.pos;
+ // 1* KEYCHAR
+ while(state.pos < state.data.length() &&
+ (Character.isDigit(state.data.charAt(state.pos)) ||
+ Character.isUpperCase(state.data.charAt(state.pos)) ||
+ Character.isLowerCase(state.data.charAt(state.pos)) ||
+ state.data.charAt(state.pos) == '-'))
+ {
+ result.append(state.data.charAt(state.pos));
+ ++state.pos;
+ }
+ }
+ else
+ {
+ throw new ParseException("invalid attribute type");
+ }
+ return result.toString();
+ }
+
+ private static String
+ parseAttributeValue(ParseState state)
+ throws ParseException
+ {
+ eatWhite(state);
+ if(state.pos >= state.data.length())
+ {
+ return "";
+ }
+
+ //
+ // RFC 2253
+ // # hexString
+ //
+ StringBuffer result = new StringBuffer();
+ if(state.data.charAt(state.pos) == '#')
+ {
+ result.append(state.data.charAt(state.pos));
+ ++state.pos;
+ while(true)
+ {
+ String h = parseHexPair(state, true);
+ if(h.length() == 0)
+ {
+ break;
+ }
+ result.append(h);
+ }
+ }
+ //
+ // RFC 2253
+ // QUOTATION *( quotechar | pair ) QUOTATION ; only from v2
+ // quotechar = <any character except "\" or QUOTATION >
+ //
+ else if(state.data.charAt(state.pos) == '"')
+ {
+ result.append(state.data.charAt(state.pos));
+ ++state.pos;
+ while(true)
+ {
+ if(state.pos >= state.data.length())
+ {
+ throw new ParseException("invalid attribute value (unexpected end of state.data)");
+ }
+ // final terminating "
+ if(state.data.charAt(state.pos) == '"')
+ {
+ result.append(state.data.charAt(state.pos));
+ ++state.pos;
+ break;
+ }
+ // any character except '\'
+ else if(state.data.charAt(state.pos) != '\\')
+ {
+ result.append(state.data.charAt(state.pos));
+ ++state.pos;
+ }
+ // pair '\'
+ else
+ {
+ result.append(parsePair(state));
+ }
+ }
+ }
+ //
+ // RFC 2253
+ // * (Stringchar | pair)
+ // Stringchar = <any character except one of special, "\" or QUOTATION >
+ //
+ else
+ {
+ while(state.pos < state.data.length())
+ {
+ if(state.data.charAt(state.pos) == '\\')
+ {
+ result.append(parsePair(state));
+ }
+ else if(special.indexOf(state.data.charAt(state.pos)) == -1 && state.data.charAt(state.pos) != '"')
+ {
+ result.append(state.data.charAt(state.pos));
+ ++state.pos;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ return result.toString();
+ }
+
+ //
+ // RFC2253:
+ // pair = "\" ( special | "\" | QUOTATION | hexpair )
+ //
+ private static String
+ parsePair(ParseState state)
+ throws ParseException
+ {
+ String result = "";
+
+ assert(state.data.charAt(state.pos) == '\\');
+ result += state.data.charAt(state.pos);
+ ++state.pos;
+
+ if(state.pos >= state.data.length())
+ {
+ throw new ParseException("invalid escape format (unexpected end of state.data)");
+ }
+
+ if(special.indexOf(state.data.charAt(state.pos)) != -1 || state.data.charAt(state.pos) != '\\' ||
+ state.data.charAt(state.pos) != '"')
+ {
+ result += state.data.charAt(state.pos);
+ ++state.pos;
+ return result;
+ }
+ return parseHexPair(state, false);
+ }
+
+ //
+ // RFC 2253
+ // hexpair = hexchar hexchar
+ //
+ private static String
+ parseHexPair(ParseState state, boolean allowEmpty)
+ throws ParseException
+ {
+ String result = "";
+ if(state.pos < state.data.length() && hexvalid.indexOf(state.data.charAt(state.pos)) != -1)
+ {
+ result += state.data.charAt(state.pos);
+ ++state.pos;
+ }
+ if(state.pos < state.data.length() && hexvalid.indexOf(state.data.charAt(state.pos)) != -1)
+ {
+ result += state.data.charAt(state.pos);
+ ++state.pos;
+ }
+ if(result.length() != 2)
+ {
+ if(allowEmpty && result.length() == 0)
+ {
+ return result;
+ }
+ throw new ParseException("invalid hex format");
+ }
+ return result;
+ }
+
+ //
+ // RFC 2253:
+ //
+ // Implementations MUST allow for space (' ' ASCII 32) characters to be
+ // present between name-component and ',', between attributeTypeAndValue
+ // and '+', between attributeType and '=', and between '=' and
+ // attributeValue. These space characters are ignored when parsing.
+ //
+ private static void
+ eatWhite(ParseState state)
+ {
+ while(state.pos < state.data.length() && state.data.charAt(state.pos) == ' ')
+ {
+ ++state.pos;
+ }
+ }
+
+ private final static String special = ",=+<>#;";
+ private final static String hexvalid = "0123456789abcdefABCDEF";
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceSSL/SSLEngine.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/SSLEngine.java
new file mode 100644
index 00000000000..cf40b19c53d
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/SSLEngine.java
@@ -0,0 +1,1320 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceSSL;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.security.cert.*;
+import com.zeroc.Ice.PluginInitializationException;
+
+class SSLEngine
+{
+ SSLEngine(com.zeroc.IceInternal.ProtocolPluginFacade facade)
+ {
+ _communicator = facade.getCommunicator();
+ _logger = _communicator.getLogger();
+ _facade = facade;
+ _securityTraceLevel = _communicator.getProperties().getPropertyAsIntWithDefault("IceSSL.Trace.Security", 0);
+ _securityTraceCategory = "Security";
+ _trustManager = new TrustManager(_communicator);
+ }
+
+ void initialize()
+ {
+ if(_initialized)
+ {
+ return;
+ }
+
+ final String prefix = "IceSSL.";
+ com.zeroc.Ice.Properties properties = communicator().getProperties();
+
+ //
+ // Parse the cipher list.
+ //
+ String ciphers = properties.getProperty(prefix + "Ciphers");
+ if(ciphers.length() > 0)
+ {
+ parseCiphers(ciphers);
+ }
+
+ String[] protocols = properties.getPropertyAsList(prefix + "Protocols");
+ if(protocols.length != 0)
+ {
+ java.util.ArrayList<String> l = new java.util.ArrayList<>();
+ for(String prot : protocols)
+ {
+ String s = prot.toUpperCase();
+ if(s.equals("SSL3") || s.equals("SSLV3"))
+ {
+ l.add("SSLv3");
+ }
+ else if(s.equals("TLS") || s.equals("TLS1") || s.equals("TLSV1") || s.equals("TLS1_0") ||
+ s.equals("TLSV1_0"))
+ {
+ l.add("TLSv1");
+ }
+ else if(s.equals("TLS1_1") || s.equals("TLSV1_1"))
+ {
+ l.add("TLSv1.1");
+ }
+ else if(s.equals("TLS1_2") || s.equals("TLSV1_2"))
+ {
+ l.add("TLSv1.2");
+ }
+ else
+ {
+ PluginInitializationException e = new PluginInitializationException();
+ e.reason = "IceSSL: unrecognized protocol `" + prot + "'";
+ throw e;
+ }
+ }
+ _protocols = new String[l.size()];
+ l.toArray(_protocols);
+ }
+
+ //
+ // CheckCertName determines whether we compare the name in a peer's
+ // certificate against its hostname.
+ //
+ _checkCertName = properties.getPropertyAsIntWithDefault(prefix + "CheckCertName", 0) > 0;
+
+ //
+ // VerifyDepthMax establishes the maximum length of a peer's certificate
+ // chain, including the peer's certificate. A value of 0 means there is
+ // no maximum.
+ //
+ _verifyDepthMax = properties.getPropertyAsIntWithDefault(prefix + "VerifyDepthMax", 3);
+
+ //
+ // VerifyPeer determines whether certificate validation failures abort a connection.
+ //
+ _verifyPeer = properties.getPropertyAsIntWithDefault("IceSSL.VerifyPeer", 2);
+
+ //
+ // Check for a certificate verifier.
+ //
+ final String certVerifierClass = properties.getProperty(prefix + "CertVerifier");
+ if(certVerifierClass.length() > 0)
+ {
+ if(_verifier != null)
+ {
+ PluginInitializationException e = new PluginInitializationException();
+ e.reason = "IceSSL: certificate verifier already installed";
+ throw e;
+ }
+
+ Class<?> cls = null;
+ try
+ {
+ cls = _facade.findClass(certVerifierClass);
+ }
+ catch(Throwable ex)
+ {
+ throw new PluginInitializationException(
+ "IceSSL: unable to load certificate verifier class " + certVerifierClass, ex);
+ }
+
+ try
+ {
+ _verifier = (CertificateVerifier)cls.newInstance();
+ }
+ catch(Throwable ex)
+ {
+ throw new PluginInitializationException(
+ "IceSSL: unable to instantiate certificate verifier class " + certVerifierClass, ex);
+ }
+ }
+
+ //
+ // Check for a password callback.
+ //
+ final String passwordCallbackClass = properties.getProperty(prefix + "PasswordCallback");
+ if(passwordCallbackClass.length() > 0)
+ {
+ if(_passwordCallback != null)
+ {
+ PluginInitializationException e = new PluginInitializationException();
+ e.reason = "IceSSL: password callback already installed";
+ throw e;
+ }
+
+ Class<?> cls = null;
+ try
+ {
+ cls = _facade.findClass(passwordCallbackClass);
+ }
+ catch(Throwable ex)
+ {
+ throw new PluginInitializationException(
+ "IceSSL: unable to load password callback class " + passwordCallbackClass, ex);
+ }
+
+ try
+ {
+ _passwordCallback = (PasswordCallback)cls.newInstance();
+ }
+ catch(Throwable ex)
+ {
+ throw new PluginInitializationException(
+ "IceSSL: unable to instantiate password callback class " + passwordCallbackClass, ex);
+ }
+ }
+
+ //
+ // If the user doesn't supply an SSLContext, we need to create one based
+ // on property settings.
+ //
+ if(_context == null)
+ {
+ try
+ {
+ //
+ // Check for a default directory. We look in this directory for
+ // files mentioned in the configuration.
+ //
+ _defaultDir = properties.getProperty(prefix + "DefaultDir");
+
+ //
+ // We need a SecureRandom object.
+ //
+ // NOTE: The JDK recommends obtaining a SecureRandom object like this:
+ //
+ // java.security.SecureRandom rand = java.security.SecureRandom.getInstance("SHA1PRNG");
+ //
+ // However, there is a bug (6202721) which causes it to always use /dev/random,
+ // which can lead to long delays at program startup. The workaround is to use
+ // the default constructor.
+ //
+ java.security.SecureRandom rand = new java.security.SecureRandom();
+
+ //
+ // Check for seed data for the random number generator.
+ //
+ final String seedFiles = properties.getProperty(prefix + "Random");
+ if(seedFiles.length() > 0)
+ {
+ final String[] arr = seedFiles.split(java.io.File.pathSeparator);
+ for(String file : arr)
+ {
+ try
+ {
+ java.io.InputStream seedStream = openResource(file);
+ if(seedStream == null)
+ {
+ PluginInitializationException e =
+ new PluginInitializationException();
+ e.reason = "IceSSL: random seed file not found:\n" + file;
+ throw e;
+ }
+
+ _seeds.add(seedStream);
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new PluginInitializationException(
+ "IceSSL: unable to access random seed file:\n" + file, ex);
+ }
+ }
+ }
+
+ if(!_seeds.isEmpty())
+ {
+ byte[] seed = null;
+ int start = 0;
+ for(InputStream in : _seeds)
+ {
+ try
+ {
+ int num = in.available();
+ if(seed == null)
+ {
+ seed = new byte[num];
+ }
+ else
+ {
+ byte[] tmp = new byte[seed.length + num];
+ System.arraycopy(seed, 0, tmp, 0, seed.length);
+ start = seed.length;
+ seed = tmp;
+ }
+ in.read(seed, start, num);
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new PluginInitializationException(
+ "IceSSL: error while reading random seed", ex);
+ }
+ finally
+ {
+ try
+ {
+ in.close();
+ }
+ catch(java.io.IOException e)
+ {
+ // Ignore.
+ }
+ }
+ }
+ rand.setSeed(seed);
+ }
+ _seeds.clear();
+
+ //
+ // We call nextInt() in order to force the object to perform any time-consuming
+ // initialization tasks now.
+ //
+ rand.nextInt();
+
+ //
+ // The keystore holds private keys and associated certificates.
+ //
+ String keystorePath = properties.getProperty(prefix + "Keystore");
+
+ //
+ // The password for the keys.
+ //
+ String password = properties.getProperty(prefix + "Password");
+
+ //
+ // The password for the keystore.
+ //
+ String keystorePassword = properties.getProperty(prefix + "KeystorePassword");
+
+ //
+ // The default keystore type is usually "JKS", but the legal values are determined
+ // by the JVM implementation. Other possibilities include "PKCS12" and "BKS".
+ //
+ final String defaultType = java.security.KeyStore.getDefaultType();
+ final String keystoreType = properties.getPropertyWithDefault(prefix + "KeystoreType", defaultType);
+
+ //
+ // The alias of the key to use in authentication.
+ //
+ String alias = properties.getProperty(prefix + "Alias");
+ boolean overrideAlias = !alias.isEmpty(); // Always use the configured alias
+
+ //
+ // The truststore holds the certificates of trusted CAs.
+ //
+ String truststorePath = properties.getProperty(prefix + "Truststore");
+
+ //
+ // The password for the truststore.
+ //
+ String truststorePassword = properties.getProperty(prefix + "TruststorePassword");
+
+ //
+ // The default truststore type is usually "JKS", but the legal values are determined
+ // by the JVM implementation. Other possibilities include "PKCS12" and "BKS".
+ //
+ final String truststoreType =
+ properties.getPropertyWithDefault(prefix + "TruststoreType",
+ java.security.KeyStore.getDefaultType());
+
+ //
+ // Collect the key managers.
+ //
+ javax.net.ssl.KeyManager[] keyManagers = null;
+ java.security.KeyStore keys = null;
+ if(_keystoreStream != null || keystorePath.length() > 0)
+ {
+ java.io.InputStream keystoreStream = null;
+ try
+ {
+ if(_keystoreStream != null)
+ {
+ keystoreStream = _keystoreStream;
+ }
+ else
+ {
+ keystoreStream = openResource(keystorePath);
+ if(keystoreStream == null)
+ {
+ PluginInitializationException e =
+ new PluginInitializationException();
+ e.reason = "IceSSL: keystore not found:\n" + keystorePath;
+ throw e;
+ }
+ }
+
+ keys = java.security.KeyStore.getInstance(keystoreType);
+ char[] passwordChars = null;
+ if(keystorePassword.length() > 0)
+ {
+ passwordChars = keystorePassword.toCharArray();
+ }
+ else if(_passwordCallback != null)
+ {
+ passwordChars = _passwordCallback.getKeystorePassword();
+ }
+ else if(keystoreType.equals("BKS") || keystoreType.equals("PKCS12"))
+ {
+ // Bouncy Castle or PKCS12 does not permit null passwords.
+ passwordChars = new char[0];
+ }
+
+ keys.load(keystoreStream, passwordChars);
+
+ if(passwordChars != null)
+ {
+ java.util.Arrays.fill(passwordChars, '\0');
+ }
+ keystorePassword = null;
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new PluginInitializationException(
+ "IceSSL: unable to load keystore:\n" + keystorePath, ex);
+ }
+ finally
+ {
+ if(keystoreStream != null)
+ {
+ try
+ {
+ keystoreStream.close();
+ }
+ catch(java.io.IOException e)
+ {
+ // Ignore.
+ }
+ }
+ }
+
+ String algorithm = javax.net.ssl.KeyManagerFactory.getDefaultAlgorithm();
+ javax.net.ssl.KeyManagerFactory kmf = javax.net.ssl.KeyManagerFactory.getInstance(algorithm);
+ char[] passwordChars = new char[0]; // This password cannot be null.
+ if(password.length() > 0)
+ {
+ passwordChars = password.toCharArray();
+ }
+ else if(_passwordCallback != null)
+ {
+ passwordChars = _passwordCallback.getPassword(alias);
+ }
+ kmf.init(keys, passwordChars);
+ if(passwordChars.length > 0)
+ {
+ java.util.Arrays.fill(passwordChars, '\0');
+ }
+ password = null;
+ keyManagers = kmf.getKeyManagers();
+
+ //
+ // If no alias is specified, we look for the first key entry in the key store.
+ //
+ // This is required to force the key manager to always choose a certificate
+ // even if there's no certificate signed by any of the CA names sent by the
+ // server. Ice servers might indeed not always send the CA names of their
+ // trusted roots.
+ //
+ if(alias.isEmpty())
+ {
+ for(java.util.Enumeration<String> e = keys.aliases(); e.hasMoreElements();)
+ {
+ String a = e.nextElement();
+ if(keys.isKeyEntry(a))
+ {
+ alias = a;
+ break;
+ }
+ }
+ }
+
+ if(!alias.isEmpty())
+ {
+ //
+ // If the user selected a specific alias, we need to wrap the key managers
+ // in order to return the desired alias.
+ //
+ if(!keys.isKeyEntry(alias))
+ {
+ PluginInitializationException e =
+ new PluginInitializationException();
+ e.reason = "IceSSL: keystore does not contain an entry with alias `" + alias + "'";
+ throw e;
+ }
+
+ for(int i = 0; i < keyManagers.length; ++i)
+ {
+ keyManagers[i] = new X509KeyManagerI((javax.net.ssl.X509ExtendedKeyManager)keyManagers[i],
+ alias, overrideAlias);
+ }
+ }
+ }
+
+ //
+ // Load the truststore.
+ //
+ java.security.KeyStore ts = null;
+ if(_truststoreStream != null || truststorePath.length() > 0)
+ {
+ //
+ // If the trust store and the key store are the same input
+ // stream or file, don't create another key store.
+ //
+ if((_truststoreStream != null && _truststoreStream == _keystoreStream) ||
+ (truststorePath.length() > 0 && truststorePath.equals(keystorePath)))
+ {
+ assert keys != null;
+ ts = keys;
+ }
+ else
+ {
+ java.io.InputStream truststoreStream = null;
+ try
+ {
+ if(_truststoreStream != null)
+ {
+ truststoreStream = _truststoreStream;
+ }
+ else
+ {
+ truststoreStream = openResource(truststorePath);
+ if(truststoreStream == null)
+ {
+ PluginInitializationException e =
+ new PluginInitializationException();
+ e.reason = "IceSSL: truststore not found:\n" + truststorePath;
+ throw e;
+ }
+ }
+
+ ts = java.security.KeyStore.getInstance(truststoreType);
+
+ char[] passwordChars = null;
+ if(truststorePassword.length() > 0)
+ {
+ passwordChars = truststorePassword.toCharArray();
+ }
+ else if(_passwordCallback != null)
+ {
+ passwordChars = _passwordCallback.getTruststorePassword();
+ }
+ else if(truststoreType.equals("BKS") || truststoreType.equals("PKCS12"))
+ {
+ // Bouncy Castle or PKCS12 does not permit null passwords.
+ passwordChars = new char[0];
+ }
+
+ ts.load(truststoreStream, passwordChars);
+
+ if(passwordChars != null)
+ {
+ java.util.Arrays.fill(passwordChars, '\0');
+ }
+ truststorePassword = null;
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new PluginInitializationException(
+ "IceSSL: unable to load truststore:\n" + truststorePath, ex);
+ }
+ finally
+ {
+ if(truststoreStream != null)
+ {
+ try
+ {
+ truststoreStream.close();
+ }
+ catch(java.io.IOException e)
+ {
+ // Ignore.
+ }
+ }
+ }
+ }
+ }
+
+ //
+ // Collect the trust managers. Use IceSSL.Truststore if
+ // specified, otherwise use the Java root CAs if
+ // Ice.Use.PlatformCAs is enabled. If none of these are enabled,
+ // use the keystore or a dummy trust manager which rejects any
+ // certificate.
+ //
+ javax.net.ssl.TrustManager[] trustManagers = null;
+ {
+ String algorithm = javax.net.ssl.TrustManagerFactory.getDefaultAlgorithm();
+ javax.net.ssl.TrustManagerFactory tmf = javax.net.ssl.TrustManagerFactory.getInstance(algorithm);
+ java.security.KeyStore trustStore = null;
+ if(ts != null)
+ {
+ trustStore = ts;
+ }
+ else if(properties.getPropertyAsInt("IceSSL.UsePlatformCAs") <= 0)
+ {
+ if(keys != null)
+ {
+ trustStore = keys;
+ }
+ else
+ {
+ trustManagers = new javax.net.ssl.TrustManager[]
+ {
+ new javax.net.ssl.X509TrustManager()
+ {
+ @Override
+ public void
+ checkClientTrusted(X509Certificate[] chain, String authType)
+ throws CertificateException
+ {
+ throw new CertificateException("no trust anchors");
+ }
+
+ @Override
+ public void
+ checkServerTrusted(X509Certificate[] chain, String authType)
+ throws CertificateException
+ {
+ throw new CertificateException("no trust anchors");
+ }
+
+ @Override
+ public X509Certificate[]
+ getAcceptedIssuers()
+ {
+ return new X509Certificate[0];
+ }
+ }
+ };
+ }
+ }
+ else
+ {
+ trustStore = null;
+ }
+
+ //
+ // Attempting to establish an outgoing connection with an empty truststore can
+ // cause hangs that eventually result in an exception such as:
+ //
+ // java.security.InvalidAlgorithmParameterException: the trustAnchors parameter
+ // must be non-empty
+ //
+ if(trustStore != null && trustStore.size() == 0)
+ {
+ throw new PluginInitializationException("IceSSL: truststore is empty");
+ }
+
+ if(trustManagers == null)
+ {
+ tmf.init(trustStore);
+ trustManagers = tmf.getTrustManagers();
+ }
+ assert(trustManagers != null);
+ }
+
+ //
+ // Create a certificate path validator to build the full
+ // certificate chain of the peer certificate. NOTE: this must
+ // be done before wrapping the trust manager since our wrappers
+ // return an empty list of accepted issuers.
+ //
+ _validator = CertPathValidator.getInstance("PKIX");
+ java.util.Set<TrustAnchor> anchors = new java.util.HashSet<>();
+ for(javax.net.ssl.TrustManager tm : trustManagers)
+ {
+ X509Certificate[] certs = ((javax.net.ssl.X509TrustManager)tm).getAcceptedIssuers();
+ for(X509Certificate cert : certs)
+ {
+ if(cert.getBasicConstraints() >= 0) // Only add CAs
+ {
+ anchors.add(new TrustAnchor(cert, null));
+ }
+ }
+ }
+ if(!anchors.isEmpty())
+ {
+ _validatorParams = new PKIXParameters(anchors);
+ _validatorParams.setRevocationEnabled(false);
+ }
+
+ //
+ // Wrap each trust manager.
+ //
+ for(int i = 0; i < trustManagers.length; ++i)
+ {
+ trustManagers[i] = new X509TrustManagerI(this, (javax.net.ssl.X509TrustManager)trustManagers[i]);
+ }
+
+ //
+ // Initialize the SSL context.
+ //
+ _context = javax.net.ssl.SSLContext.getInstance("TLS");
+ _context.init(keyManagers, trustManagers, rand);
+ }
+ catch(java.security.GeneralSecurityException ex)
+ {
+ throw new PluginInitializationException("IceSSL: unable to initialize context", ex);
+ }
+ }
+
+ //
+ // Clear cached input streams.
+ //
+ _seeds.clear();
+ _keystoreStream = null;
+ _truststoreStream = null;
+
+ _initialized = true;
+ }
+
+ Certificate[] getVerifiedCertificateChain(Certificate[] chain)
+ {
+ if(_validator == null)
+ {
+ return chain; // The user provided a custom SSLContext
+ }
+
+ if(_validatorParams == null)
+ {
+ return null; // Couldn't validate the given certificate chain, no trust anchors configured.
+ }
+
+ List<Certificate> certs = new ArrayList<>(java.util.Arrays.asList(chain));
+ try
+ {
+ CertPath path = CertificateFactory.getInstance("X.509").generateCertPath(certs);
+ CertPathValidatorResult result = _validator.validate(path, _validatorParams);
+ Certificate root = ((PKIXCertPathValidatorResult)result).getTrustAnchor().getTrustedCert();
+ if(!root.equals(chain[chain.length - 1])) // Only add the root certificate if it's not already in the chain
+ {
+ certs.add(root);
+ }
+ return certs.toArray(new Certificate[certs.size()]);
+ }
+ catch(Exception ex)
+ {
+ return null; // Couldn't validate the given certificate chain.
+ }
+ }
+
+ void context(javax.net.ssl.SSLContext context)
+ {
+ if(_initialized)
+ {
+ PluginInitializationException ex = new PluginInitializationException();
+ ex.reason = "IceSSL: plug-in is already initialized";
+ throw ex;
+ }
+
+ assert(_context == null);
+ _context = context;
+ }
+
+ javax.net.ssl.SSLContext context()
+ {
+ return _context;
+ }
+
+ void setCertificateVerifier(CertificateVerifier verifier)
+ {
+ _verifier = verifier;
+ }
+
+ CertificateVerifier getCertificateVerifier()
+ {
+ return _verifier;
+ }
+
+ void setPasswordCallback(PasswordCallback callback)
+ {
+ _passwordCallback = callback;
+ }
+
+ PasswordCallback getPasswordCallback()
+ {
+ return _passwordCallback;
+ }
+
+ void setKeystoreStream(java.io.InputStream stream)
+ {
+ if(_initialized)
+ {
+ PluginInitializationException ex = new PluginInitializationException();
+ ex.reason = "IceSSL: plugin is already initialized";
+ throw ex;
+ }
+
+ _keystoreStream = stream;
+ }
+
+ void setTruststoreStream(java.io.InputStream stream)
+ {
+ if(_initialized)
+ {
+ PluginInitializationException ex = new PluginInitializationException();
+ ex.reason = "IceSSL: plugin is already initialized";
+ throw ex;
+ }
+
+ _truststoreStream = stream;
+ }
+
+ void addSeedStream(java.io.InputStream stream)
+ {
+ _seeds.add(stream);
+ }
+
+ int securityTraceLevel()
+ {
+ return _securityTraceLevel;
+ }
+
+ String securityTraceCategory()
+ {
+ return _securityTraceCategory;
+ }
+
+ boolean initialized()
+ {
+ return _initialized;
+ }
+
+ javax.net.ssl.SSLEngine createSSLEngine(boolean incoming, String host, int port)
+ {
+ javax.net.ssl.SSLEngine engine;
+ if(host != null)
+ {
+ engine = _context.createSSLEngine(host, port);
+ }
+ else
+ {
+ engine = _context.createSSLEngine();
+ }
+ engine.setUseClientMode(!incoming);
+
+ String[] cipherSuites = filterCiphers(engine.getSupportedCipherSuites(), engine.getEnabledCipherSuites());
+ try
+ {
+ engine.setEnabledCipherSuites(cipherSuites);
+ }
+ catch(IllegalArgumentException ex)
+ {
+ throw new com.zeroc.Ice.SecurityException("IceSSL: invalid ciphersuite", ex);
+ }
+
+ if(_securityTraceLevel >= 1)
+ {
+ StringBuilder s = new StringBuilder(128);
+ s.append("enabling SSL ciphersuites:");
+ for(String suite : cipherSuites)
+ {
+ s.append("\n ");
+ s.append(suite);
+ }
+ _logger.trace(_securityTraceCategory, s.toString());
+ }
+
+ if(_protocols != null)
+ {
+ try
+ {
+ engine.setEnabledProtocols(_protocols);
+ }
+ catch(IllegalArgumentException ex)
+ {
+ throw new com.zeroc.Ice.SecurityException("IceSSL: invalid protocol", ex);
+ }
+ }
+ else
+ {
+ //
+ // Disable SSLv3
+ //
+ List<String> protocols = new ArrayList<>(java.util.Arrays.asList(engine.getEnabledProtocols()));
+ protocols.remove("SSLv3");
+ engine.setEnabledProtocols(protocols.toArray(new String[protocols.size()]));
+ }
+
+
+ if(incoming)
+ {
+ if(_verifyPeer == 0)
+ {
+ engine.setWantClientAuth(false);
+ engine.setNeedClientAuth(false);
+ }
+ else if(_verifyPeer == 1)
+ {
+ engine.setWantClientAuth(true);
+ }
+ else
+ {
+ engine.setNeedClientAuth(true);
+ }
+ }
+
+ try
+ {
+ engine.beginHandshake();
+ }
+ catch(javax.net.ssl.SSLException ex)
+ {
+ throw new com.zeroc.Ice.SecurityException("IceSSL: handshake error", ex);
+ }
+
+ return engine;
+ }
+
+ String[] filterCiphers(String[] supportedCiphers, String[] defaultCiphers)
+ {
+ java.util.LinkedList<String> result = new java.util.LinkedList<>();
+ if(_allCiphers)
+ {
+ for(String cipher : supportedCiphers)
+ {
+ result.add(cipher);
+ }
+ }
+ else if(!_noCiphers)
+ {
+ for(String cipher : defaultCiphers)
+ {
+ result.add(cipher);
+ }
+ }
+
+ if(_ciphers != null)
+ {
+ for(CipherExpression ce : _ciphers)
+ {
+ if(ce.not)
+ {
+ java.util.Iterator<String> e = result.iterator();
+ while(e.hasNext())
+ {
+ String cipher = e.next();
+ if(ce.cipher != null)
+ {
+ if(ce.cipher.equals(cipher))
+ {
+ e.remove();
+ }
+ }
+ else
+ {
+ assert(ce.re != null);
+ java.util.regex.Matcher m = ce.re.matcher(cipher);
+ if(m.find())
+ {
+ e.remove();
+ }
+ }
+ }
+ }
+ else
+ {
+ if(ce.cipher != null)
+ {
+ result.add(0, ce.cipher);
+ }
+ else
+ {
+ assert(ce.re != null);
+ for(String cipher : supportedCiphers)
+ {
+ java.util.regex.Matcher m = ce.re.matcher(cipher);
+ if(m.find())
+ {
+ result.add(0, cipher);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ String[] arr = new String[result.size()];
+ result.toArray(arr);
+ return arr;
+ }
+
+ String[] protocols()
+ {
+ return _protocols;
+ }
+
+ void traceConnection(String desc, javax.net.ssl.SSLEngine engine, boolean incoming)
+ {
+ javax.net.ssl.SSLSession session = engine.getSession();
+ String msg = "SSL summary for " + (incoming ? "incoming" : "outgoing") + " connection\n" +
+ "cipher = " + session.getCipherSuite() + "\n" +
+ "protocol = " + session.getProtocol() + "\n" + desc;
+ _logger.trace(_securityTraceCategory, msg);
+ }
+
+ com.zeroc.Ice.Communicator communicator()
+ {
+ return _communicator;
+ }
+
+ void verifyPeer(String address, NativeConnectionInfo info, String desc)
+ {
+ //
+ // IceSSL.VerifyPeer is translated into the proper SSLEngine configuration
+ // for a server, but we have to do it ourselves for a client.
+ //
+ if(!info.incoming)
+ {
+ if(_verifyPeer > 0 && !info.verified)
+ {
+ throw new com.zeroc.Ice.SecurityException("IceSSL: server did not supply a certificate");
+ }
+ }
+
+ //
+ // For an outgoing connection, we compare the proxy address (if any) against
+ // fields in the server's certificate (if any).
+ //
+ if(info.nativeCerts != null && info.nativeCerts.length > 0 && address.length() > 0)
+ {
+ X509Certificate cert = (X509Certificate)info.nativeCerts[0];
+
+ //
+ // Extract the IP addresses and the DNS names from the subject
+ // alternative names.
+ //
+ java.util.ArrayList<String> ipAddresses = new java.util.ArrayList<>();
+ java.util.ArrayList<String> dnsNames = new java.util.ArrayList<>();
+ try
+ {
+ java.util.Collection<java.util.List<?> > subjectAltNames = cert.getSubjectAlternativeNames();
+ if(subjectAltNames != null)
+ {
+ for(java.util.List<?> l : subjectAltNames)
+ {
+ assert(!l.isEmpty());
+ Integer n = (Integer)l.get(0);
+ if(n.intValue() == 7)
+ {
+ ipAddresses.add((String)l.get(1));
+ }
+ else if(n.intValue() == 2)
+ {
+ dnsNames.add(((String)l.get(1)).toLowerCase());
+ }
+ }
+ }
+ }
+ catch(CertificateParsingException ex)
+ {
+ assert(false);
+ }
+
+ //
+ // Compare the peer's address against the common name as well as
+ // the dnsName and ipAddress values in the subject alternative name.
+ //
+ boolean certNameOK = false;
+ String dn = "";
+ String addrLower = address.toLowerCase();
+ {
+ javax.security.auth.x500.X500Principal principal = cert.getSubjectX500Principal();
+ dn = principal.getName(javax.security.auth.x500.X500Principal.CANONICAL);
+ //
+ // Canonical format is already in lower case.
+ //
+ String cn = "cn=" + addrLower;
+ int pos = dn.indexOf(cn);
+ if(pos >= 0)
+ {
+ //
+ // Ensure we match the entire common name.
+ //
+ certNameOK = (pos + cn.length() == dn.length()) || (dn.charAt(pos + cn.length()) == ',');
+ }
+ }
+
+ //
+ // Compare the peer's address against the dnsName and ipAddress
+ // values in the subject alternative name.
+ //
+ if(!certNameOK)
+ {
+ certNameOK = ipAddresses.contains(addrLower);
+ }
+ if(!certNameOK)
+ {
+ certNameOK = dnsNames.contains(addrLower);
+ }
+
+ //
+ // Log a message if the name comparison fails. If CheckCertName is defined,
+ // we also raise an exception to abort the connection. Don't log a message if
+ // CheckCertName is not defined and a verifier is present.
+ //
+ if(!certNameOK && (_checkCertName || (_securityTraceLevel >= 1 && _verifier == null)))
+ {
+ StringBuilder sb = new StringBuilder(128);
+ sb.append("IceSSL: ");
+ if(!_checkCertName)
+ {
+ sb.append("ignoring ");
+ }
+ sb.append("certificate validation failure:\npeer certificate does not have `");
+ sb.append(address);
+ sb.append("' as its commonName or in its subjectAltName extension");
+ if(dn.length() > 0)
+ {
+ sb.append("\nSubject DN: ");
+ sb.append(dn);
+ }
+ if(!dnsNames.isEmpty())
+ {
+ sb.append("\nDNS names found in certificate: ");
+ for(int j = 0; j < dnsNames.size(); ++j)
+ {
+ if(j > 0)
+ {
+ sb.append(", ");
+ }
+ sb.append(dnsNames.get(j));
+ }
+ }
+ if(!ipAddresses.isEmpty())
+ {
+ sb.append("\nIP addresses found in certificate: ");
+ for(int j = 0; j < ipAddresses.size(); ++j)
+ {
+ if(j > 0)
+ {
+ sb.append(", ");
+ }
+ sb.append(ipAddresses.get(j));
+ }
+ }
+ if(_securityTraceLevel >= 1)
+ {
+ _logger.trace(_securityTraceCategory, sb.toString());
+ }
+ if(_checkCertName)
+ {
+ com.zeroc.Ice.SecurityException ex = new com.zeroc.Ice.SecurityException();
+ ex.reason = sb.toString();
+ throw ex;
+ }
+ }
+ }
+
+ if(_verifyDepthMax > 0 && info.nativeCerts != null && info.nativeCerts.length > _verifyDepthMax)
+ {
+ String msg = (info.incoming ? "incoming" : "outgoing") + " connection rejected:\n" +
+ "length of peer's certificate chain (" + info.nativeCerts.length + ") exceeds maximum of " +
+ _verifyDepthMax + "\n" + desc;
+ if(_securityTraceLevel >= 1)
+ {
+ _logger.trace(_securityTraceCategory, msg);
+ }
+ com.zeroc.Ice.SecurityException ex = new com.zeroc.Ice.SecurityException();
+ ex.reason = msg;
+ throw ex;
+ }
+
+ if(!_trustManager.verify(info, desc))
+ {
+ String msg = (info.incoming ? "incoming" : "outgoing") + " connection rejected by trust manager\n" + desc;
+ if(_securityTraceLevel >= 1)
+ {
+ _logger.trace(_securityTraceCategory, msg);
+ }
+ com.zeroc.Ice.SecurityException ex = new com.zeroc.Ice.SecurityException();
+ ex.reason = msg;
+ throw ex;
+ }
+
+ if(_verifier != null && !_verifier.verify(info))
+ {
+ String msg = (info.incoming ? "incoming" : "outgoing") + " connection rejected by certificate verifier\n" +
+ desc;
+ if(_securityTraceLevel >= 1)
+ {
+ _logger.trace(_securityTraceCategory, msg);
+ }
+ com.zeroc.Ice.SecurityException ex = new com.zeroc.Ice.SecurityException();
+ ex.reason = msg;
+ throw ex;
+ }
+ }
+
+ void trustManagerFailure(boolean incoming, CertificateException ex)
+ throws CertificateException
+ {
+ if(_verifyPeer == 0)
+ {
+ if(_securityTraceLevel >= 1)
+ {
+ String msg = "ignoring peer verification failure";
+ if(_securityTraceLevel > 1)
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ ex.printStackTrace(pw);
+ pw.flush();
+ msg += ":\n" + sw.toString();
+ }
+ _logger.trace(_securityTraceCategory, msg);
+ }
+ }
+ else
+ {
+ throw ex;
+ }
+ }
+
+ private void parseCiphers(String ciphers)
+ {
+ java.util.ArrayList<CipherExpression> cipherList = new java.util.ArrayList<>();
+ String[] expr = ciphers.split("[ \t]+");
+ for(int i = 0; i < expr.length; ++i)
+ {
+ if(expr[i].equals("ALL"))
+ {
+ if(i != 0)
+ {
+ PluginInitializationException ex = new PluginInitializationException();
+ ex.reason = "IceSSL: `ALL' must be first in cipher list `" + ciphers + "'";
+ throw ex;
+ }
+ _allCiphers = true;
+ }
+ else if(expr[i].equals("NONE"))
+ {
+ if(i != 0)
+ {
+ PluginInitializationException ex = new PluginInitializationException();
+ ex.reason = "IceSSL: `NONE' must be first in cipher list `" + ciphers + "'";
+ throw ex;
+ }
+ _noCiphers = true;
+ }
+ else
+ {
+ CipherExpression ce = new CipherExpression();
+ String exp = expr[i];
+ if(exp.charAt(0) == '!')
+ {
+ ce.not = true;
+ if(exp.length() > 1)
+ {
+ exp = exp.substring(1);
+ }
+ else
+ {
+ PluginInitializationException ex =
+ new PluginInitializationException();
+ ex.reason = "IceSSL: invalid cipher expression `" + exp + "'";
+ throw ex;
+ }
+ }
+
+ if(exp.charAt(0) == '(')
+ {
+ if(!exp.endsWith(")"))
+ {
+ PluginInitializationException ex = new PluginInitializationException();
+ ex.reason = "IceSSL: invalid cipher expression `" + exp + "'";
+ throw ex;
+ }
+
+ try
+ {
+ ce.re = java.util.regex.Pattern.compile(exp.substring(1, exp.length() - 2));
+ }
+ catch(java.util.regex.PatternSyntaxException ex)
+ {
+ throw new PluginInitializationException("IceSSL: invalid cipher expression `" + exp + "'", ex);
+ }
+ }
+ else
+ {
+ ce.cipher = exp;
+ }
+
+ cipherList.add(ce);
+ }
+ }
+ _ciphers = new CipherExpression[cipherList.size()];
+ cipherList.toArray(_ciphers);
+ }
+
+ private java.io.InputStream openResource(String path)
+ throws java.io.IOException
+ {
+ boolean isAbsolute = false;
+ try
+ {
+ new java.net.URL(path);
+ isAbsolute = true;
+ }
+ catch(java.net.MalformedURLException ex)
+ {
+ java.io.File f = new java.io.File(path);
+ isAbsolute = f.isAbsolute();
+ }
+
+ java.io.InputStream stream = com.zeroc.IceInternal.Util.openResource(getClass().getClassLoader(), path);
+
+ //
+ // If the first attempt fails and IceSSL.DefaultDir is defined and the original path is relative,
+ // we prepend the default directory and try again.
+ //
+ if(stream == null && _defaultDir.length() > 0 && !isAbsolute)
+ {
+ stream = com.zeroc.IceInternal.Util.openResource(getClass().getClassLoader(),
+ _defaultDir + java.io.File.separator + path);
+ }
+
+ if(stream != null)
+ {
+ stream = new java.io.BufferedInputStream(stream);
+ }
+
+ return stream;
+ }
+
+ private static class CipherExpression
+ {
+ boolean not;
+ String cipher;
+ java.util.regex.Pattern re;
+ }
+
+ private com.zeroc.Ice.Communicator _communicator;
+ private com.zeroc.Ice.Logger _logger;
+ private com.zeroc.IceInternal.ProtocolPluginFacade _facade;
+ private int _securityTraceLevel;
+ private String _securityTraceCategory;
+ private boolean _initialized;
+ private javax.net.ssl.SSLContext _context;
+ private String _defaultDir;
+ private CipherExpression[] _ciphers;
+ private boolean _allCiphers;
+ private boolean _noCiphers;
+ private String[] _protocols;
+ private boolean _checkCertName;
+ private int _verifyDepthMax;
+ private int _verifyPeer;
+ private CertificateVerifier _verifier;
+ private PasswordCallback _passwordCallback;
+ private TrustManager _trustManager;
+
+ private InputStream _keystoreStream;
+ private InputStream _truststoreStream;
+ private List<InputStream> _seeds = new ArrayList<>();
+
+ private CertPathValidator _validator;
+ private PKIXParameters _validatorParams;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceSSL/TransceiverI.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/TransceiverI.java
new file mode 100644
index 00000000000..c56430ec4f3
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/TransceiverI.java
@@ -0,0 +1,591 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceSSL;
+
+import java.nio.*;
+import java.util.Base64;
+import javax.net.ssl.*;
+import javax.net.ssl.SSLEngineResult.*;
+import com.zeroc.IceInternal.SocketOperation;
+
+final class TransceiverI implements com.zeroc.IceInternal.Transceiver
+{
+ @Override
+ public java.nio.channels.SelectableChannel fd()
+ {
+ return _delegate.fd();
+ }
+
+ @Override
+ public void setReadyCallback(com.zeroc.IceInternal.ReadyCallback callback)
+ {
+ _readyCallback = callback;
+ _delegate.setReadyCallback(callback);
+ }
+
+ @Override
+ public int initialize(com.zeroc.IceInternal.Buffer readBuffer, com.zeroc.IceInternal.Buffer writeBuffer)
+ {
+ if(!_isConnected)
+ {
+ int status = _delegate.initialize(readBuffer, writeBuffer);
+ if(status != SocketOperation.None)
+ {
+ return status;
+ }
+ _isConnected = true;
+
+ com.zeroc.Ice.IPConnectionInfo ipInfo = null;
+ for(com.zeroc.Ice.ConnectionInfo p = _delegate.getInfo(); p != null; p = p.underlying)
+ {
+ if(p instanceof com.zeroc.Ice.IPConnectionInfo)
+ {
+ ipInfo = (com.zeroc.Ice.IPConnectionInfo)p;
+ }
+ }
+ final String host = _incoming ? (ipInfo != null ? ipInfo.remoteAddress : "") : _host;
+ final int port = ipInfo != null ? ipInfo.remotePort : -1;
+ _engine = _instance.createSSLEngine(_incoming, host, port);
+ _appInput = ByteBuffer.allocateDirect(_engine.getSession().getApplicationBufferSize() * 2);
+ int bufSize = _engine.getSession().getPacketBufferSize() * 2;
+ _netInput = new com.zeroc.IceInternal.Buffer(ByteBuffer.allocateDirect(bufSize * 2));
+ _netOutput = new com.zeroc.IceInternal.Buffer(ByteBuffer.allocateDirect(bufSize * 2));
+ }
+
+ int status = handshakeNonBlocking();
+ if(status != SocketOperation.None)
+ {
+ return status;
+ }
+
+ //
+ // Additional verification.
+ //
+ _instance.verifyPeer(_host, (NativeConnectionInfo)getInfo(), _delegate.toString());
+
+ if(_instance.securityTraceLevel() >= 1)
+ {
+ _instance.traceConnection(_delegate.toString(), _engine, _incoming);
+ }
+ return SocketOperation.None;
+ }
+
+ @Override
+ public int closing(boolean initiator, com.zeroc.Ice.LocalException ex)
+ {
+ // If we are initiating the connection closure, wait for the peer
+ // to close the TCP/IP connection. Otherwise, close immediately.
+ return initiator ? SocketOperation.Read : SocketOperation.None;
+ }
+
+ @Override
+ public void close()
+ {
+ if(_engine != null)
+ {
+ try
+ {
+ //
+ // Send the close_notify message.
+ //
+ _engine.closeOutbound();
+ _netOutput.b.clear();
+ while(!_engine.isOutboundDone())
+ {
+ _engine.wrap(_emptyBuffer, _netOutput.b);
+ try
+ {
+ //
+ // Note: we can't block to send the close_notify message. In some cases, the
+ // close_notify message might therefore not be received by the peer. This is
+ // not a big issue since the Ice protocol isn't subject to truncation attacks.
+ //
+ flushNonBlocking();
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ // Ignore.
+ }
+ }
+ }
+ catch(SSLException ex)
+ {
+ //
+ // We can't throw in close.
+ //
+ // Ice.SecurityException se = new Ice.SecurityException(
+ // "IceSSL: SSL failure while shutting down socket", ex);
+ //
+ }
+
+ try
+ {
+ _engine.closeInbound();
+ }
+ catch(SSLException ex)
+ {
+ //
+ // SSLEngine always raises an exception with this message:
+ //
+ // Inbound closed before receiving peer's close_notify: possible truncation attack?
+ //
+ // We would probably need to wait for a response in shutdown() to avoid this.
+ // For now, we'll ignore this exception.
+ //
+ //_instance.logger().error("IceSSL: error during close\n" + ex.getMessage());
+ }
+ }
+
+ _delegate.close();
+ }
+
+ @Override
+ public com.zeroc.IceInternal.EndpointI bind()
+ {
+ assert(false);
+ return null;
+ }
+
+ @Override
+ public int write(com.zeroc.IceInternal.Buffer buf)
+ {
+ if(!_isConnected)
+ {
+ return _delegate.write(buf);
+ }
+
+ int status = writeNonBlocking(buf.b);
+ assert(status == SocketOperation.None || status == SocketOperation.Write);
+ return status;
+ }
+
+ @Override
+ public int read(com.zeroc.IceInternal.Buffer buf)
+ {
+ if(!_isConnected)
+ {
+ return _delegate.read(buf);
+ }
+
+ _readyCallback.ready(SocketOperation.Read, false);
+
+ //
+ // Try to satisfy the request from data we've already decrypted.
+ //
+ fill(buf.b);
+
+ //
+ // Read and decrypt more data if necessary. Note that we might read
+ // more data from the socket than is actually necessary to fill the
+ // caller's stream.
+ //
+ try
+ {
+ while(buf.b.hasRemaining())
+ {
+ _netInput.b.flip();
+ SSLEngineResult result = _engine.unwrap(_netInput.b, _appInput);
+ _netInput.b.compact();
+
+ Status status = result.getStatus();
+ assert status != Status.BUFFER_OVERFLOW;
+
+ if(status == Status.CLOSED)
+ {
+ throw new com.zeroc.Ice.ConnectionLostException();
+ }
+ // Android API 21 SSLEngine doesn't report underflow, so look at the absence of
+ // network data and application data to signal a network read.
+ else if(status == Status.BUFFER_UNDERFLOW || (_appInput.position() == 0 && _netInput.b.position() == 0))
+ {
+ int s = _delegate.read(_netInput);
+ if(s != SocketOperation.None && _netInput.b.position() == 0)
+ {
+ return s;
+ }
+ continue;
+ }
+
+ fill(buf.b);
+ }
+
+ // If there is no more application data, do one further unwrap to ensure
+ // that the SSLEngine has no buffered data (Android R21 and greater only).
+ if(_appInput.position() == 0)
+ {
+ _netInput.b.flip();
+ _engine.unwrap(_netInput.b, _appInput);
+ _netInput.b.compact();
+
+ // Don't check the status here since we may have already filled
+ // the buffer with a complete request which must be processed.
+ }
+ }
+ catch(SSLException ex)
+ {
+ throw new com.zeroc.Ice.SecurityException("IceSSL: error during read", ex);
+ }
+
+ //
+ // Indicate whether more data is available.
+ //
+ if(_netInput.b.position() > 0 || _appInput.position() > 0)
+ {
+ _readyCallback.ready(SocketOperation.Read, true);
+ }
+
+ return SocketOperation.None;
+ }
+
+ @Override
+ public String protocol()
+ {
+ return _delegate.protocol();
+ }
+
+ @Override
+ public String toString()
+ {
+ return _delegate.toString();
+ }
+
+ @Override
+ public String toDetailedString()
+ {
+ return toString();
+ }
+
+ @Override
+ public com.zeroc.Ice.ConnectionInfo getInfo()
+ {
+ NativeConnectionInfo info = new NativeConnectionInfo();
+ info.underlying = _delegate.getInfo();
+ info.incoming = _incoming;
+ info.adapterName = _adapterName;
+ if(_engine != null)
+ {
+ SSLSession session = _engine.getSession();
+ info.cipher = session.getCipherSuite();
+ try
+ {
+ java.security.cert.Certificate[] pcerts = session.getPeerCertificates();
+ java.security.cert.Certificate[] vcerts = _instance.engine().getVerifiedCertificateChain(pcerts);
+ info.verified = vcerts != null;
+ info.nativeCerts = vcerts != null ? vcerts : pcerts;
+ java.util.ArrayList<String> certs = new java.util.ArrayList<>();
+ for(java.security.cert.Certificate c : info.nativeCerts)
+ {
+ StringBuilder s = new StringBuilder("-----BEGIN CERTIFICATE-----\n");
+ s.append(Base64.getEncoder().encodeToString(c.getEncoded()));
+ s.append("\n-----END CERTIFICATE-----");
+ certs.add(s.toString());
+ }
+ info.certs = certs.toArray(new String[certs.size()]);
+ }
+ catch(javax.net.ssl.SSLPeerUnverifiedException ex)
+ {
+ // No peer certificates.
+ }
+ catch(java.security.cert.CertificateEncodingException ex)
+ {
+ }
+ }
+ return info;
+ }
+
+ @Override
+ public void setBufferSize(int rcvSize, int sndSize)
+ {
+ _delegate.setBufferSize(rcvSize, sndSize);
+ }
+
+ @Override
+ public void checkSendSize(com.zeroc.IceInternal.Buffer buf)
+ {
+ _delegate.checkSendSize(buf);
+ }
+
+ TransceiverI(Instance instance, com.zeroc.IceInternal.Transceiver delegate, String hostOrAdapterName,
+ boolean incoming)
+ {
+ _instance = instance;
+ _delegate = delegate;
+ _incoming = incoming;
+ if(_incoming)
+ {
+ _adapterName = hostOrAdapterName;
+ }
+ else
+ {
+ _host = hostOrAdapterName;
+ }
+ }
+
+ private int handshakeNonBlocking()
+ {
+ try
+ {
+ HandshakeStatus status = _engine.getHandshakeStatus();
+ while(!_engine.isOutboundDone() && !_engine.isInboundDone())
+ {
+ SSLEngineResult result = null;
+ switch(status)
+ {
+ case FINISHED:
+ case NOT_HANDSHAKING:
+ {
+ return SocketOperation.None;
+ }
+ case NEED_TASK:
+ {
+ Runnable task;
+ while((task = _engine.getDelegatedTask()) != null)
+ {
+ task.run();
+ }
+ status = _engine.getHandshakeStatus();
+ break;
+ }
+ case NEED_UNWRAP:
+ {
+ if(_netInput.b.position() == 0)
+ {
+ int s = _delegate.read(_netInput);
+ if(s != SocketOperation.None && _netInput.b.position() == 0)
+ {
+ return s;
+ }
+ }
+
+ //
+ // The engine needs more data. We might already have enough data in
+ // the _netInput buffer to satisfy the engine. If not, the engine
+ // responds with BUFFER_UNDERFLOW and we'll read from the socket.
+ //
+ _netInput.b.flip();
+ result = _engine.unwrap(_netInput.b, _appInput);
+ _netInput.b.compact();
+ //
+ // FINISHED is only returned from wrap or unwrap, not from engine.getHandshakeResult().
+ //
+ status = result.getHandshakeStatus();
+ switch(result.getStatus())
+ {
+ case BUFFER_OVERFLOW:
+ {
+ assert(false);
+ break;
+ }
+ case BUFFER_UNDERFLOW:
+ {
+ assert(status == javax.net.ssl.SSLEngineResult.HandshakeStatus.NEED_UNWRAP);
+ int position = _netInput.b.position();
+ int s = _delegate.read(_netInput);
+ if(s != SocketOperation.None && _netInput.b.position() == position)
+ {
+ return s;
+ }
+ break;
+ }
+ case CLOSED:
+ {
+ throw new com.zeroc.Ice.ConnectionLostException();
+ }
+ case OK:
+ {
+ break;
+ }
+ }
+ break;
+ }
+ case NEED_WRAP:
+ {
+ //
+ // The engine needs to send a message.
+ //
+ result = _engine.wrap(_emptyBuffer, _netOutput.b);
+ if(result.bytesProduced() > 0)
+ {
+ int s = flushNonBlocking();
+ if(s != SocketOperation.None)
+ {
+ return s;
+ }
+ }
+
+ //
+ // FINISHED is only returned from wrap or unwrap, not from engine.getHandshakeResult().
+ //
+ status = result.getHandshakeStatus();
+ break;
+ }
+ }
+
+ if(result != null)
+ {
+ switch(result.getStatus())
+ {
+ case BUFFER_OVERFLOW:
+ assert(false);
+ break;
+ case BUFFER_UNDERFLOW:
+ // Need to read again.
+ assert(status == HandshakeStatus.NEED_UNWRAP);
+ break;
+ case CLOSED:
+ throw new com.zeroc.Ice.ConnectionLostException();
+ case OK:
+ break;
+ }
+ }
+ }
+ }
+ catch(SSLException ex)
+ {
+ throw new com.zeroc.Ice.SecurityException("IceSSL: handshake error", ex);
+ }
+ return SocketOperation.None;
+ }
+
+ private int writeNonBlocking(ByteBuffer buf)
+ {
+ //
+ // This method has two purposes: encrypt the application's message buffer into our
+ // _netOutput buffer, and write the contents of _netOutput to the socket without
+ // blocking.
+ //
+ try
+ {
+ while(buf.hasRemaining() || _netOutput.b.position() > 0)
+ {
+ if(buf.hasRemaining())
+ {
+ //
+ // Encrypt the buffer.
+ //
+ SSLEngineResult result = _engine.wrap(buf, _netOutput.b);
+ switch(result.getStatus())
+ {
+ case BUFFER_OVERFLOW:
+ //
+ // Need to make room in _netOutput.b.
+ //
+ break;
+ case BUFFER_UNDERFLOW:
+ assert(false);
+ break;
+ case CLOSED:
+ throw new com.zeroc.Ice.ConnectionLostException();
+ case OK:
+ break;
+ }
+ }
+
+ //
+ // Write the encrypted data to the socket. We continue writing until we've written
+ // all of _netOutput, or until flushNonBlocking indicates that it cannot write
+ // (i.e., by returning SocketOperation.Write).
+ //
+ if(_netOutput.b.position() > 0)
+ {
+ int s = flushNonBlocking();
+ if(s != SocketOperation.None)
+ {
+ return s;
+ }
+ }
+ }
+ }
+ catch(SSLException ex)
+ {
+ throw new com.zeroc.Ice.SecurityException("IceSSL: error while encoding message", ex);
+ }
+
+ assert(_netOutput.b.position() == 0);
+ return SocketOperation.None;
+ }
+
+ private int flushNonBlocking()
+ {
+ _netOutput.b.flip();
+
+ try
+ {
+ int s = _delegate.write(_netOutput);
+ if(s != SocketOperation.None)
+ {
+ _netOutput.b.compact();
+ return s;
+ }
+ }
+ catch(com.zeroc.Ice.SocketException ex)
+ {
+ throw new com.zeroc.Ice.ConnectionLostException(ex);
+ }
+ _netOutput.b.clear();
+ return SocketOperation.None;
+ }
+
+ private void fill(ByteBuffer buf)
+ {
+ _appInput.flip();
+ if(_appInput.hasRemaining())
+ {
+ int bytesAvailable = _appInput.remaining();
+ int bytesNeeded = buf.remaining();
+ if(bytesAvailable > bytesNeeded)
+ {
+ bytesAvailable = bytesNeeded;
+ }
+ if(buf.hasArray())
+ {
+ //
+ // Copy directly into the destination buffer's backing array.
+ //
+ byte[] arr = buf.array();
+ _appInput.get(arr, buf.arrayOffset() + buf.position(), bytesAvailable);
+ buf.position(buf.position() + bytesAvailable);
+ }
+ else if(_appInput.hasArray())
+ {
+ //
+ // Copy directly from the source buffer's backing array.
+ //
+ byte[] arr = _appInput.array();
+ buf.put(arr, _appInput.arrayOffset() + _appInput.position(), bytesAvailable);
+ _appInput.position(_appInput.position() + bytesAvailable);
+ }
+ else
+ {
+ //
+ // Copy using a temporary array.
+ //
+ byte[] arr = new byte[bytesAvailable];
+ _appInput.get(arr);
+ buf.put(arr);
+ }
+ }
+ _appInput.compact();
+ }
+
+ private Instance _instance;
+ private com.zeroc.IceInternal.Transceiver _delegate;
+ private javax.net.ssl.SSLEngine _engine;
+ private String _host = "";
+ private String _adapterName = "";
+ private boolean _incoming;
+ private com.zeroc.IceInternal.ReadyCallback _readyCallback;
+ private boolean _isConnected = false;
+
+ private ByteBuffer _appInput; // Holds clear-text data to be read by the application.
+ private com.zeroc.IceInternal.Buffer _netInput; // Holds encrypted data read from the socket.
+ private com.zeroc.IceInternal.Buffer _netOutput; // Holds encrypted data to be written to the socket.
+ private static ByteBuffer _emptyBuffer = ByteBuffer.allocate(0); // Used during handshaking.
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceSSL/TrustManager.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/TrustManager.java
new file mode 100644
index 00000000000..a2713702c16
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/TrustManager.java
@@ -0,0 +1,363 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceSSL;
+
+class TrustManager
+{
+ TrustManager(com.zeroc.Ice.Communicator communicator)
+ {
+ assert communicator != null;
+ _communicator = communicator;
+ com.zeroc.Ice.Properties properties = communicator.getProperties();
+ _traceLevel = properties.getPropertyAsInt("IceSSL.Trace.Security");
+ String key = null;
+ try
+ {
+ key = "IceSSL.TrustOnly";
+ parse(properties.getProperty(key), _rejectAll, _acceptAll);
+ key = "IceSSL.TrustOnly.Client";
+ parse(properties.getProperty(key), _rejectClient, _acceptClient);
+ key = "IceSSL.TrustOnly.Server";
+ parse(properties.getProperty(key), _rejectAllServer, _acceptAllServer);
+ java.util.Map<String, String> dict = properties.getPropertiesForPrefix("IceSSL.TrustOnly.Server.");
+ for(java.util.Map.Entry<String, String> p : dict.entrySet())
+ {
+ key = p.getKey();
+ String name = key.substring("IceSSL.TrustOnly.Server.".length());
+ java.util.List<java.util.List<RFC2253.RDNPair> > reject =
+ new java.util.LinkedList<java.util.List<RFC2253.RDNPair> >();
+ java.util.List<java.util.List<RFC2253.RDNPair> > accept =
+ new java.util.LinkedList<java.util.List<RFC2253.RDNPair> >();
+ parse(p.getValue(), reject, accept);
+ if(!reject.isEmpty())
+ {
+ _rejectServer.put(name, reject);
+ }
+ if(!accept.isEmpty())
+ {
+ _acceptServer.put(name, accept);
+ }
+ }
+ }
+ catch(RFC2253.ParseException e)
+ {
+ com.zeroc.Ice.PluginInitializationException ex = new com.zeroc.Ice.PluginInitializationException();
+ ex.reason = "IceSSL: invalid property " + key + ":\n" + e.reason;
+ throw ex;
+ }
+ }
+
+ boolean
+ verify(NativeConnectionInfo info, String desc)
+ {
+ java.util.List<java.util.List<java.util.List<RFC2253.RDNPair> > >
+ reject = new java.util.LinkedList<java.util.List<java.util.List<RFC2253.RDNPair> > >(),
+ accept = new java.util.LinkedList<java.util.List<java.util.List<RFC2253.RDNPair> > >();
+
+ if(!_rejectAll.isEmpty())
+ {
+ reject.add(_rejectAll);
+ }
+ if(info.incoming)
+ {
+ if(!_rejectAllServer.isEmpty())
+ {
+ reject.add(_rejectAllServer);
+ }
+ if(info.adapterName.length() > 0)
+ {
+ java.util.List<java.util.List<RFC2253.RDNPair> > p = _rejectServer.get(info.adapterName);
+ if(p != null)
+ {
+ reject.add(p);
+ }
+ }
+ }
+ else
+ {
+ if(!_rejectClient.isEmpty())
+ {
+ reject.add(_rejectClient);
+ }
+ }
+
+ if(!_acceptAll.isEmpty())
+ {
+ accept.add(_acceptAll);
+ }
+ if(info.incoming)
+ {
+ if(!_acceptAllServer.isEmpty())
+ {
+ accept.add(_acceptAllServer);
+ }
+ if(info.adapterName.length() > 0)
+ {
+ java.util.List<java.util.List<RFC2253.RDNPair> > p = _acceptServer.get(info.adapterName);
+ if(p != null)
+ {
+ accept.add(p);
+ }
+ }
+ }
+ else
+ {
+ if(!_acceptClient.isEmpty())
+ {
+ accept.add(_acceptClient);
+ }
+ }
+
+ //
+ // If there is nothing to match against, then we accept the cert.
+ //
+ if(reject.isEmpty() && accept.isEmpty())
+ {
+ return true;
+ }
+
+ //
+ // If there is no certificate then we match false.
+ //
+ if(info.nativeCerts != null && info.nativeCerts.length > 0)
+ {
+ javax.security.auth.x500.X500Principal subjectDN =
+ ((java.security.cert.X509Certificate)info.nativeCerts[0]).getSubjectX500Principal();
+ String subjectName = subjectDN.getName(javax.security.auth.x500.X500Principal.RFC2253);
+ assert subjectName != null;
+ try
+ {
+ //
+ // Decompose the subject DN into the RDNs.
+ //
+ if(_traceLevel > 0)
+ {
+ if(info.incoming)
+ {
+ _communicator.getLogger().trace("Security", "trust manager evaluating client:\n" +
+ "subject = " + subjectName + "\n" +
+ "adapter = " + info.adapterName + "\n" +
+ desc);
+ }
+ else
+ {
+ _communicator.getLogger().trace("Security", "trust manager evaluating server:\n" +
+ "subject = " + subjectName + "\n" + desc);
+ }
+ }
+ java.util.List<RFC2253.RDNPair> dn = RFC2253.parseStrict(subjectName);
+
+ //
+ // Fail if we match anything in the reject set.
+ //
+ for(java.util.List<java.util.List<RFC2253.RDNPair>> matchSet : reject)
+ {
+ if(_traceLevel > 1)
+ {
+ StringBuilder s = new StringBuilder("trust manager rejecting PDNs:\n");
+ stringify(matchSet, s);
+ _communicator.getLogger().trace("Security", s.toString());
+ }
+ if(match(matchSet, dn))
+ {
+ return false;
+ }
+ }
+
+ //
+ // Succeed if we match anything in the accept set.
+ //
+ for(java.util.List<java.util.List<RFC2253.RDNPair>> matchSet : accept)
+ {
+ if(_traceLevel > 1)
+ {
+ StringBuilder s = new StringBuilder("trust manager accepting PDNs:\n");
+ stringify(matchSet, s);
+ _communicator.getLogger().trace("Security", s.toString());
+ }
+ if(match(matchSet, dn))
+ {
+ return true;
+ }
+ }
+ }
+ catch(RFC2253.ParseException e)
+ {
+ _communicator.getLogger().warning(
+ "IceSSL: unable to parse certificate DN `" + subjectName + "'\nreason: " + e.reason);
+ }
+
+ //
+ // At this point we accept the connection if there are no explicit accept rules.
+ //
+ return accept.isEmpty();
+ }
+
+ return false;
+ }
+
+ private boolean
+ match(java.util.List<java.util.List<RFC2253.RDNPair> > matchSet, java.util.List<RFC2253.RDNPair> subject)
+ {
+ for(java.util.List<RFC2253.RDNPair> r : matchSet)
+ {
+ if(matchRDNs(r, subject))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean
+ matchRDNs(java.util.List<RFC2253.RDNPair> match, java.util.List<RFC2253.RDNPair> subject)
+ {
+ for(RFC2253.RDNPair matchRDN : match)
+ {
+ boolean found = false;
+ for(RFC2253.RDNPair subjectRDN : subject)
+ {
+ if(matchRDN.key.equals(subjectRDN.key))
+ {
+ found = true;
+ if(!matchRDN.value.equals(subjectRDN.value))
+ {
+ return false;
+ }
+ }
+ }
+ if(!found)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ void
+ parse(String value, java.util.List<java.util.List<RFC2253.RDNPair> > reject,
+ java.util.List<java.util.List<RFC2253.RDNPair> > accept)
+ throws RFC2253.ParseException
+ {
+ //
+ // Java X500Principal.getName says:
+ //
+ // If "RFC2253" is specified as the format, this method emits
+ // the attribute type keywords defined in RFC 2253 (CN, L, ST,
+ // O, OU, C, STREET, DC, UID). Any other attribute type is
+ // emitted as an OID. Under a strict reading, RFC 2253 only
+ // specifies a UTF-8 string representation. The String
+ // returned by this method is the Unicode string achieved by
+ // decoding this UTF-8 representation.
+ //
+ // This means that things like emailAddress and such will be turned into
+ // something like:
+ //
+ // 1.2.840.113549.1.9.1=#160e696e666f407a65726f632e636f6d
+ //
+ // The left hand side is the OID (see
+ // http://www.columbia.edu/~ariel/ssleay/asn1-oids.html) for a
+ // list. The right hand side is a BER encoding of the value.
+ //
+ // This means that the user input, unless it uses the
+ // unfriendly OID format, will not directly match the
+ // principal.
+ //
+ // Two possible solutions:
+ //
+ // Have the RFC2253 parser convert anything that is not CN, L,
+ // ST, O, OU, C, STREET, DC, UID into OID format, and have it
+ // convert the values into a BER encoding.
+ //
+ // Send the user data through X500Principal to string form and
+ // then through the RFC2253 encoder. This uses the
+ // X500Principal to do the encoding for us.
+ //
+ // The latter is much simpler, however, it means we need to
+ // send the data through the parser twice because we split the
+ // DNs on ';' which cannot be blindly split because of quotes,
+ // \ and such.
+ //
+ java.util.List<RFC2253.RDNEntry> l = RFC2253.parse(value);
+ for(RFC2253.RDNEntry e : l)
+ {
+ StringBuilder v = new StringBuilder();
+ boolean first = true;
+ for(RFC2253.RDNPair pair : e.rdn)
+ {
+ if(!first)
+ {
+ v.append(",");
+ }
+ first = false;
+ v.append(pair.key);
+ v.append("=");
+ v.append(pair.value);
+ }
+ javax.security.auth.x500.X500Principal princ = new javax.security.auth.x500.X500Principal(v.toString());
+ String subjectName = princ.getName(javax.security.auth.x500.X500Principal.RFC2253);
+ if(e.negate)
+ {
+ reject.add(RFC2253.parseStrict(subjectName));
+ }
+ else
+ {
+ accept.add(RFC2253.parseStrict(subjectName));
+ }
+ }
+ }
+
+ private static void
+ stringify(java.util.List<java.util.List<RFC2253.RDNPair>> matchSet, StringBuilder s)
+ {
+ boolean addSemi = false;
+ for(java.util.List<RFC2253.RDNPair> rdnSet : matchSet)
+ {
+ if(addSemi)
+ {
+ s.append(';');
+ }
+ addSemi = true;
+ boolean addComma = false;
+ for(RFC2253.RDNPair rdn : rdnSet)
+ {
+ if(addComma)
+ {
+ s.append(',');
+ }
+ addComma = true;
+ s.append(rdn.key);
+ s.append('=');
+ s.append(rdn.value);
+ }
+ }
+ }
+
+ private com.zeroc.Ice.Communicator _communicator;
+ private int _traceLevel;
+
+ private java.util.List<java.util.List<RFC2253.RDNPair> > _rejectAll =
+ new java.util.LinkedList<java.util.List<RFC2253.RDNPair> >();
+ private java.util.List<java.util.List<RFC2253.RDNPair> > _rejectClient =
+ new java.util.LinkedList<java.util.List<RFC2253.RDNPair> >();
+ private java.util.List<java.util.List<RFC2253.RDNPair> > _rejectAllServer =
+ new java.util.LinkedList<java.util.List<RFC2253.RDNPair> >();
+ private java.util.Map<String, java.util.List<java.util.List<RFC2253.RDNPair> > > _rejectServer =
+ new java.util.HashMap<String, java.util.List<java.util.List<RFC2253.RDNPair> > >();
+
+ private java.util.List<java.util.List<RFC2253.RDNPair> > _acceptAll =
+ new java.util.LinkedList<java.util.List<RFC2253.RDNPair> >();
+ private java.util.List<java.util.List<RFC2253.RDNPair> > _acceptClient =
+ new java.util.LinkedList<java.util.List<RFC2253.RDNPair> >();
+ private java.util.List<java.util.List<RFC2253.RDNPair> > _acceptAllServer =
+ new java.util.LinkedList<java.util.List<RFC2253.RDNPair> >();
+ private java.util.Map<String, java.util.List<java.util.List<RFC2253.RDNPair> > > _acceptServer =
+ new java.util.HashMap<String, java.util.List<java.util.List<RFC2253.RDNPair> > >();
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceSSL/Util.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/Util.java
new file mode 100644
index 00000000000..eab2851d8f1
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/Util.java
@@ -0,0 +1,72 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceSSL;
+
+public final class Util
+{
+ //
+ // Create a certificate from a PEM-encoded string.
+ //
+ public static java.security.cert.X509Certificate
+ createCertificate(String certPEM)
+ throws java.security.cert.CertificateException
+ {
+ final String header = "-----BEGIN CERTIFICATE-----";
+ final String footer = "-----END CERTIFICATE-----";
+
+ //
+ // The generateCertificate method requires that its input begin
+ // with the PEM header.
+ //
+ int pos = certPEM.indexOf(header);
+ if(pos == -1)
+ {
+ certPEM = header + "\n" + certPEM;
+ }
+ else if(pos > 0)
+ {
+ certPEM = certPEM.substring(pos);
+ }
+
+ //
+ // Add the footer if necessary.
+ //
+ if(certPEM.indexOf(footer) == -1)
+ {
+ certPEM = certPEM + footer;
+ }
+
+ byte[] bytes = null;
+ try
+ {
+ bytes = certPEM.getBytes("UTF8");
+ }
+ catch(java.io.UnsupportedEncodingException ex)
+ {
+ assert(false);
+ return null;
+ }
+
+ java.io.ByteArrayInputStream in = new java.io.ByteArrayInputStream(bytes);
+ java.security.cert.CertificateFactory cf = java.security.cert.CertificateFactory.getInstance("X.509");
+ return (java.security.cert.X509Certificate)cf.generateCertificate(in);
+ }
+
+ public final static String jdkTarget = "1.5";
+
+ //
+ // Needed by the test scripts to determine the JDK target of the SSL plug-in.
+ //
+ public static void
+ main(String[] args)
+ {
+ System.out.println(jdkTarget);
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceSSL/X509KeyManagerI.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/X509KeyManagerI.java
new file mode 100644
index 00000000000..4ba37d93e9e
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/X509KeyManagerI.java
@@ -0,0 +1,114 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceSSL;
+
+import javax.net.ssl.X509ExtendedKeyManager;
+
+final class X509KeyManagerI extends X509ExtendedKeyManager
+{
+ X509KeyManagerI(javax.net.ssl.X509ExtendedKeyManager del, String alias, boolean override)
+ {
+ _delegate = del;
+ _alias = alias;
+ _override = override; // Always use the configured alias, don't check for acceptable issuers
+ }
+
+ @Override
+ public String
+ chooseClientAlias(String[] keyType, java.security.Principal[] issuers, java.net.Socket socket)
+ {
+ if(!_override) // Don't bother checking for acceptable issuers if the user configured IceSSL.Alias
+ {
+ String alias = _delegate.chooseClientAlias(keyType, issuers, socket);
+ if(alias != null && !alias.isEmpty())
+ {
+ return alias;
+ }
+ }
+ return _alias;
+ }
+
+ @Override
+ public String
+ chooseEngineClientAlias(String[] keyType, java.security.Principal[] issuers, javax.net.ssl.SSLEngine engine)
+ {
+ if(!_override) // Don't bother checking for acceptable issuers if the user configured IceSSL.Alias
+ {
+ String alias = _delegate.chooseEngineClientAlias(keyType, issuers, engine);
+ if(alias != null && !alias.isEmpty())
+ {
+ return alias;
+ }
+ }
+ return _alias;
+ }
+
+ @Override
+ public String
+ chooseServerAlias(String keyType, java.security.Principal[] issuers, java.net.Socket socket)
+ {
+ if(!_override) // Don't bother checking for acceptable issuers if the user configured IceSSL.Alias
+ {
+ String alias = _delegate.chooseServerAlias(keyType, issuers, socket);
+ if(alias != null && !alias.isEmpty())
+ {
+ return alias;
+ }
+ }
+ return _alias;
+ }
+
+ @Override
+ public String
+ chooseEngineServerAlias(String keyType, java.security.Principal[] issuers, javax.net.ssl.SSLEngine engine)
+ {
+ if(!_override) // Don't bother checking for acceptable issuers if the user configured IceSSL.Alias
+ {
+ String alias = _delegate.chooseEngineServerAlias(keyType, issuers, engine);
+ if(alias != null && !alias.isEmpty())
+ {
+ return alias;
+ }
+ }
+ return _alias;
+ }
+
+ @Override
+ public java.security.cert.X509Certificate[]
+ getCertificateChain(String alias)
+ {
+ return _delegate.getCertificateChain(alias);
+ }
+
+ @Override
+ public String[]
+ getClientAliases(String keyType, java.security.Principal[] issuers)
+ {
+ return _delegate.getClientAliases(keyType, issuers);
+ }
+
+ @Override
+ public String[]
+ getServerAliases(String keyType, java.security.Principal[] issuers)
+ {
+ return _delegate.getServerAliases(keyType, issuers);
+ }
+
+ @Override
+ public java.security.PrivateKey
+ getPrivateKey(String alias)
+ {
+ return _delegate.getPrivateKey(alias);
+ }
+
+ private javax.net.ssl.X509ExtendedKeyManager _delegate;
+ private String _alias;
+ private boolean _override;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceSSL/X509TrustManagerI.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/X509TrustManagerI.java
new file mode 100644
index 00000000000..da241df6e2a
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/X509TrustManagerI.java
@@ -0,0 +1,82 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceSSL;
+
+final class X509TrustManagerI implements javax.net.ssl.X509TrustManager
+{
+ X509TrustManagerI(SSLEngine engine, javax.net.ssl.X509TrustManager delegate)
+ {
+ _engine = engine;
+ _delegate = delegate;
+ }
+
+ @Override
+ public void
+ checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType)
+ throws java.security.cert.CertificateException
+ {
+ //
+ // Do not invoke the wrapped trust manager for anonymous ciphers.
+ //
+ // Possible values for authType are "DH_anon" and "ECDH_anon" (IBM JDK).
+ //
+ if(authType.indexOf("DH_anon") == -1)
+ {
+ try
+ {
+ _delegate.checkClientTrusted(chain, authType);
+ }
+ catch(java.security.cert.CertificateException ex)
+ {
+ _engine.trustManagerFailure(true, ex);
+ }
+ }
+ }
+
+ @Override
+ public void
+ checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType)
+ throws java.security.cert.CertificateException
+ {
+ //
+ // Do not invoke the wrapped trust manager for anonymous ciphers.
+ //
+ // Possible values for authType are "DH_anon" and "ECDH_anon" (IBM JDK).
+ //
+ if(authType.indexOf("DH_anon") == -1)
+ {
+ try
+ {
+ _delegate.checkServerTrusted(chain, authType);
+ }
+ catch(java.security.cert.CertificateException ex)
+ {
+ _engine.trustManagerFailure(false, ex);
+ }
+ }
+ }
+
+ @Override
+ public java.security.cert.X509Certificate[]
+ getAcceptedIssuers()
+ {
+ //
+ // This method is used to send CA names to the client as part of the CertificateRequest
+ // message sent by the server to request a client certificate. We want the client to always
+ // send its certificate so we don't provide any CAs here.
+ //
+ //return _delegate.getAcceptedIssuers();
+ return EMPTY;
+ }
+
+ private SSLEngine _engine;
+ private javax.net.ssl.X509TrustManager _delegate;
+ private java.security.cert.X509Certificate[] EMPTY = new java.security.cert.X509Certificate[0];
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/Assert.java b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/Assert.java
new file mode 100644
index 00000000000..8f344d00510
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/Assert.java
@@ -0,0 +1,45 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceUtilInternal;
+
+public final class Assert
+{
+ //
+ // The JVM ignores exceptions raised in finalizers, therefore finalizers
+ // that use assertions should call this method instead of assert().
+ //
+ public static void
+ FinalizerAssert(boolean b)
+ {
+ if(!b)
+ {
+ //
+ // Create a Throwable to obtain the stack trace.
+ //
+ Throwable t = new Throwable();
+ StackTraceElement[] trace = t.getStackTrace();
+ if(trace.length > 1)
+ {
+ //
+ // Skip the first frame, which represents this method.
+ //
+ System.err.println("Assertion failure:");
+ for(StackTraceElement e : trace)
+ {
+ System.err.println("\tat " + e);
+ }
+ }
+ else
+ {
+ System.err.println("Assertion failure (no stack trace information)");
+ }
+ }
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/Options.java b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/Options.java
new file mode 100644
index 00000000000..7aee137b60f
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/Options.java
@@ -0,0 +1,403 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceUtilInternal;
+
+public final class Options
+{
+ static public final class BadQuote extends Exception
+ {
+ BadQuote(String message)
+ {
+ super(message);
+ }
+ }
+
+ static public String[]
+ split(String line)
+ throws BadQuote
+ {
+ final String IFS = " \t\n";
+ final int NormalState = 1;
+ final int DoubleQuoteState = 2;
+ final int SingleQuoteState = 3;
+ final int ANSIQuoteState = 4;
+
+ line = line.trim();
+ if(line.length() == 0)
+ {
+ return new String[0];
+ }
+
+ int state = NormalState;
+
+ StringBuilder arg = new StringBuilder(128);
+ java.util.List<String> vec = new java.util.ArrayList<>();
+
+ for(int i = 0; i < line.length(); ++i)
+ {
+ char c = line.charAt(i);
+ switch(state)
+ {
+ case NormalState:
+ {
+ switch(c)
+ {
+ case '\\':
+ {
+ //
+ // Ignore a backslash at the end of the string,
+ // and strip backslash-newline pairs. If a
+ // backslash is followed by a space, single quote,
+ // double quote, or dollar sign, we drop the backslash
+ // and write the space, single quote, double quote,
+ // or dollar sign. This is necessary to allow quotes
+ // to be escaped. Dropping the backslash preceding a
+ // space deviates from bash quoting rules, but is
+ // necessary so we don't drop backslashes from Windows
+ // path names.)
+ //
+ if(i < line.length() - 1 && line.charAt(++i) != '\n')
+ {
+ switch(line.charAt(i))
+ {
+ case ' ':
+ case '$':
+ case '\\':
+ case '"':
+ {
+ arg.append(line.charAt(i));
+ break;
+ }
+ default:
+ {
+ arg.append('\\');
+ arg.append(line.charAt(i));
+ break;
+ }
+ }
+ }
+ break;
+ }
+ case '\'':
+ {
+ state = SingleQuoteState;
+ break;
+ }
+ case '"':
+ {
+ state = DoubleQuoteState;
+ break;
+ }
+ case '$':
+ {
+ if(i < line.length() - 1 && line.charAt(i + 1) == '\'')
+ {
+ state = ANSIQuoteState; // Bash uses $'<text>' to allow ANSI escape sequences within <text>.
+ ++i;
+ }
+ else
+ {
+ arg.append('$');
+ }
+ break;
+ }
+ default:
+ {
+ if(IFS.indexOf(line.charAt(i)) != -1)
+ {
+ vec.add(arg.toString());
+ arg = new StringBuilder(128);
+
+ //
+ // Move to start of next argument.
+ //
+ while(++i < line.length() && IFS.indexOf(line.charAt(i)) != -1);
+ --i;
+ }
+ else
+ {
+ arg.append(line.charAt(i));
+ }
+ break;
+ }
+ }
+ break;
+ }
+ case DoubleQuoteState:
+ {
+ //
+ // Within double quotes, only backslash retains its special
+ // meaning, and only if followed by double quote, backslash,
+ // or newline. If not followed by one of these characters,
+ // both the backslash and the character are preserved.
+ //
+ if(c == '\\' && i < line.length() - 1)
+ {
+ switch(c = line.charAt(++i))
+ {
+ case '"':
+ case '\\':
+ case '\n':
+ {
+ arg.append(c);
+ break;
+ }
+ default:
+ {
+ arg.append('\\');
+ arg.append(c);
+ break;
+ }
+ }
+ }
+ else if(c == '"') // End of double-quote mode.
+ {
+ state = NormalState;
+ }
+ else
+ {
+ arg.append(c); // Everything else is taken literally.
+ }
+ break;
+ }
+ case SingleQuoteState:
+ {
+ if(c == '\'') // End of single-quote mode.
+ {
+ state = NormalState;
+ }
+ else
+ {
+ arg.append(c); // Everything else is taken literally.
+ }
+ break;
+ }
+ case ANSIQuoteState:
+ {
+ switch(c)
+ {
+ case '\\':
+ {
+ if(i == line.length() - 1)
+ {
+ break;
+ }
+ switch(c = line.charAt(++i))
+ {
+ //
+ // Single-letter escape sequences.
+ //
+ case 'a':
+ {
+ arg.append('\007');
+ break;
+ }
+ case 'b':
+ {
+ arg.append('\b');
+ break;
+ }
+ case 'f':
+ {
+ arg.append('\f');
+ break;
+ }
+ case 'n':
+ {
+ arg.append('\n');
+ break;
+ }
+ case 'r':
+ {
+ arg.append('\r');
+ break;
+ }
+ case 't':
+ {
+ arg.append('\t');
+ break;
+ }
+ case 'v':
+ {
+ arg.append('\013');
+ break;
+ }
+ case '\\':
+ {
+ arg.append('\\');
+ break;
+ }
+ case '\'':
+ {
+ arg.append('\'');
+ break;
+ }
+ case 'e': // Not ANSI-C, but used by bash.
+ {
+ arg.append('\033');
+ break;
+ }
+
+ //
+ // Process up to three octal digits.
+ //
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ {
+ final String octalDigits = "01234567";
+ short us = 0;
+ int j;
+ for(j = i;
+ j < i + 3 && j < line.length() && octalDigits.indexOf(c = line.charAt(j)) != -1;
+ ++j)
+ {
+ us = (short)(us * 8 + c - '0');
+ }
+ i = j - 1;
+ arg.append((char)us);
+ break;
+ }
+
+ //
+ // Process up to two hex digits.
+ //
+ case 'x':
+ {
+ final String hexDigits = "0123456789abcdefABCDEF";
+ if(i < line.length() - 1 && hexDigits.indexOf(line.charAt(i + 1)) == -1)
+ {
+ arg.append('\\');
+ arg.append('x');
+ break;
+ }
+
+ short s = 0;
+ int j;
+ for(j = i + 1;
+ j < i + 3 && j < line.length() && hexDigits.indexOf(c = line.charAt(j)) != -1;
+ ++j)
+ {
+ s *= 16;
+ if(Character.isDigit(c))
+ {
+ s += (short)(c - '0');
+ }
+ else if(Character.isLowerCase(c))
+ {
+ s += (short)(c - 'a' + 10);
+ }
+ else
+ {
+ s += (short)(c - 'A' + 10);
+ }
+ }
+ i = j - 1;
+ arg.append((char)s);
+ break;
+ }
+
+ //
+ // Process control-chars.
+ //
+ case 'c':
+ {
+ c = line.charAt(++i);
+ if((Character.toUpperCase(c) >= 'A' && Character.toUpperCase(c) <= 'Z') ||
+ c == '@' ||
+ (c >= '[' && c <= '_'))
+ {
+ arg.append((char)(Character.toUpperCase(c) - '@'));
+ }
+ else
+ {
+ //
+ // Bash does not define what should happen if a \c
+ // is not followed by a recognized control character.
+ // We simply treat this case like other unrecognized
+ // escape sequences, that is, we preserve the escape
+ // sequence unchanged.
+ //
+ arg.append('\\');
+ arg.append('c');
+ arg.append(c);
+ }
+ break;
+ }
+
+ //
+ // If inside an ANSI-quoted string, a backslash isn't followed by
+ // one of the recognized characters, both the backslash and the
+ // character are preserved.
+ //
+ default:
+ {
+ arg.append('\\');
+ arg.append(c);
+ break;
+ }
+ }
+ break;
+ }
+ case '\'': // End of ANSI-quote mode.
+ {
+ state = NormalState;
+ break;
+ }
+ default:
+ {
+ arg.append(c); // Everything else is taken literally.
+ break;
+ }
+ }
+ break;
+ }
+ default:
+ assert(false);
+ break;
+ }
+ }
+
+ switch(state)
+ {
+ case NormalState:
+ {
+ vec.add(arg.toString());
+ break;
+ }
+ case SingleQuoteState:
+ {
+ throw new BadQuote("missing closing single quote");
+ }
+ case DoubleQuoteState:
+ {
+ throw new BadQuote("missing closing double quote");
+ }
+ case ANSIQuoteState:
+ {
+ throw new BadQuote("unterminated $' quote");
+ }
+ default:
+ {
+ assert(false);
+ break;
+ }
+ }
+
+ return vec.toArray(new String[0]);
+ }
+
+
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/OutputBase.java b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/OutputBase.java
new file mode 100644
index 00000000000..065d8d84ff7
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/OutputBase.java
@@ -0,0 +1,188 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceUtilInternal;
+
+public class OutputBase
+{
+ public
+ OutputBase()
+ {
+ _out = null;
+ _pos = 0;
+ _indent = 0;
+ _indentSize = 4;
+ _useTab = true;
+ _separator = true;
+ }
+
+ public
+ OutputBase(java.io.PrintWriter out)
+ {
+ _out = out;
+ _pos = 0;
+ _indent = 0;
+ _indentSize = 4;
+ _useTab = true;
+ _separator = true;
+ }
+
+ public
+ OutputBase(String s)
+ {
+ _out = null;
+ _pos = 0;
+ _indent = 0;
+ _indentSize = 4;
+ _useTab = true;
+ _separator = true;
+
+ open(s);
+ }
+
+ public void
+ setIndent(int indentSize)
+ {
+ _indentSize = indentSize;
+ }
+
+ public void
+ setUseTab(boolean useTab)
+ {
+ _useTab = useTab;
+ }
+
+ public void
+ open(String s)
+ {
+ try
+ {
+ java.io.FileWriter fw = new java.io.FileWriter(s);
+ java.io.BufferedWriter bw = new java.io.BufferedWriter(fw);
+ _out = new java.io.PrintWriter(bw);
+ }
+ catch(java.io.IOException ex)
+ {
+ }
+ }
+
+ public void
+ print(String s)
+ {
+ final char[] arr = s.toCharArray();
+ for(int i = 0; i < arr.length; i++)
+ {
+ if(arr[i] == '\n')
+ {
+ _pos = 0;
+ }
+ else
+ {
+ ++_pos;
+ }
+ }
+
+ _out.print(s);
+ }
+
+ public void
+ inc()
+ {
+ _indent += _indentSize;
+ }
+
+ public void
+ dec()
+ {
+ assert(_indent >= _indentSize);
+ _indent -= _indentSize;
+ }
+
+ public void
+ useCurrentPosAsIndent()
+ {
+ _indentSave.addFirst(_indent);
+ _indent = _pos;
+ }
+
+ public void
+ zeroIndent()
+ {
+ _indentSave.addFirst(_indent);
+ _indent = 0;
+ }
+
+ public void
+ restoreIndent()
+ {
+ assert(!_indentSave.isEmpty());
+ _indent = _indentSave.removeFirst().intValue();
+ }
+
+ public void
+ nl()
+ {
+ _out.println();
+ _pos = 0;
+ _separator = true;
+
+ int indent = _indent;
+
+ if(_useTab)
+ {
+ while(indent >= 8)
+ {
+ indent -= 8;
+ _out.print('\t');
+ _pos += 8;
+ }
+ }
+ else
+ {
+ while(indent >= _indentSize)
+ {
+ indent -= _indentSize;
+ _out.print(" ");
+ _pos += _indentSize;
+ }
+ }
+
+ while(indent > 0)
+ {
+ --indent;
+ _out.print(' ');
+ ++_pos;
+ }
+
+ _out.flush();
+ }
+
+ public void
+ sp()
+ {
+ if(_separator)
+ {
+ _out.println();
+ }
+ }
+
+ public boolean
+ valid()
+ {
+ return (_out != null);
+ }
+
+ protected java.io.PrintWriter _out;
+ protected int _pos;
+ protected int _indent;
+ protected int _indentSize;
+ protected java.util.LinkedList<Integer> _indentSave = new java.util.LinkedList<>();
+ protected boolean _useTab;
+ protected boolean _separator;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/StopWatch.java b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/StopWatch.java
new file mode 100644
index 00000000000..abaf7691a1f
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/StopWatch.java
@@ -0,0 +1,42 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceUtilInternal;
+
+public class StopWatch
+{
+ public void
+ start()
+ {
+ _s = System.nanoTime();
+ }
+
+ public long
+ stop()
+ {
+ assert(isStarted());
+ long d = (System.nanoTime() - _s) / 1000;
+ _s = 0;
+ return d;
+ }
+
+ public boolean
+ isStarted()
+ {
+ return _s != 0;
+ }
+
+ public long
+ delay()
+ {
+ return (System.nanoTime() - _s) / 1000;
+ }
+
+ private long _s = 0;
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/StringUtil.java b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/StringUtil.java
new file mode 100644
index 00000000000..cf6de757a9c
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/StringUtil.java
@@ -0,0 +1,554 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceUtilInternal;
+
+public final class StringUtil
+{
+ //
+ // Return the index of the first character in str to
+ // appear in match, starting from 0. Returns -1 if none is
+ // found.
+ //
+ public static int
+ findFirstOf(String str, String match)
+ {
+ return findFirstOf(str, match, 0);
+ }
+
+ //
+ // Return the index of the first character in str to
+ // appear in match, starting from start. Returns -1 if none is
+ // found.
+ //
+ public static int
+ findFirstOf(String str, String match, int start)
+ {
+ final int len = str.length();
+ for(int i = start; i < len; i++)
+ {
+ char ch = str.charAt(i);
+ if(match.indexOf(ch) != -1)
+ {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ //
+ // Return the index of the first character in str which does
+ // not appear in match, starting from 0. Returns -1 if none is
+ // found.
+ //
+ public static int
+ findFirstNotOf(String str, String match)
+ {
+ return findFirstNotOf(str, match, 0);
+ }
+
+ //
+ // Return the index of the first character in str which does
+ // not appear in match, starting from start. Returns -1 if none is
+ // found.
+ //
+ public static int
+ findFirstNotOf(String str, String match, int start)
+ {
+ final int len = str.length();
+ for(int i = start; i < len; i++)
+ {
+ char ch = str.charAt(i);
+ if(match.indexOf(ch) == -1)
+ {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ //
+ // Write the byte b as an escape sequence if it isn't a printable ASCII
+ // character and append the escape sequence to sb. Additional characters
+ // that should be escaped can be passed in special. If b is any of these
+ // characters, b is preceded by a backslash in sb.
+ //
+ private static void
+ encodeChar(byte b, StringBuilder sb, String special)
+ {
+ switch(b)
+ {
+ case (byte)'\\':
+ {
+ sb.append("\\\\");
+ break;
+ }
+ case (byte)'\'':
+ {
+ sb.append("\\'");
+ break;
+ }
+ case (byte)'"':
+ {
+ sb.append("\\\"");
+ break;
+ }
+ case (byte)'\b':
+ {
+ sb.append("\\b");
+ break;
+ }
+ case (byte)'\f':
+ {
+ sb.append("\\f");
+ break;
+ }
+ case (byte)'\n':
+ {
+ sb.append("\\n");
+ break;
+ }
+ case (byte)'\r':
+ {
+ sb.append("\\r");
+ break;
+ }
+ case (byte)'\t':
+ {
+ sb.append("\\t");
+ break;
+ }
+ default:
+ {
+ if(!(b >= 32 && b <= 126))
+ {
+ sb.append('\\');
+ String octal = Integer.toOctalString(b < 0 ? b + 256 : b);
+ //
+ // Add leading zeroes so that we avoid problems during
+ // decoding. For example, consider the encoded string
+ // \0013 (i.e., a character with value 1 followed by
+ // the character '3'). If the leading zeroes were omitted,
+ // the result would be incorrectly interpreted by the
+ // decoder as a single character with value 11.
+ //
+ for(int j = octal.length(); j < 3; j++)
+ {
+ sb.append('0');
+ }
+ sb.append(octal);
+ }
+ else if(special != null && special.indexOf((char)b) != -1)
+ {
+ sb.append('\\');
+ sb.append((char)b);
+ }
+ else
+ {
+ sb.append((char)b);
+ }
+ }
+ }
+ }
+
+ //
+ // Add escape sequences (such as "\n", or "\007") to make a string
+ // readable in ASCII. Any characters that appear in special are
+ // prefixed with a backlash in the returned string.
+ //
+ public static String
+ escapeString(String s, String special)
+ {
+ if(special != null)
+ {
+ for(int i = 0; i < special.length(); ++i)
+ {
+ if(special.charAt(i) < 32 || special.charAt(i) > 126)
+ {
+ throw new IllegalArgumentException("special characters must be in ASCII range 32-126");
+ }
+ }
+ }
+
+ byte[] bytes = null;
+ try
+ {
+ bytes = s.getBytes("UTF8");
+ }
+ catch(java.io.UnsupportedEncodingException ex)
+ {
+ assert(false);
+ return null;
+ }
+
+ StringBuilder result = new StringBuilder(bytes.length);
+ for(int i = 0; i < bytes.length; i++)
+ {
+ encodeChar(bytes[i], result, special);
+ }
+
+ return result.toString();
+ }
+
+ private static char
+ checkChar(String s, int pos)
+ {
+ char c = s.charAt(pos);
+ if(!(c >= 32 && c <= 126))
+ {
+ String msg;
+ if(pos > 0)
+ {
+ msg = "character after `" + s.substring(0, pos) + "'";
+ }
+ else
+ {
+ msg = "first character";
+ }
+ msg += " is not a printable ASCII character (ordinal " + (int)c + ")";
+ throw new IllegalArgumentException(msg);
+ }
+ return c;
+ }
+
+ static class Holder<T>
+ {
+ public Holder()
+ {
+ }
+
+ public Holder(T value)
+ {
+ this.value = value;
+ }
+
+ public T value;
+ }
+
+ //
+ // Decode the character or escape sequence starting at start and return it.
+ // newStart is set to the index of the first character following the decoded character
+ // or escape sequence.
+ //
+ private static char decodeChar(String s, int start, int end, Holder<Integer> nextStart)
+ {
+ assert(start >= 0);
+ assert(start < end);
+ assert(end <= s.length());
+
+ char c;
+
+ if(s.charAt(start) != '\\')
+ {
+ c = checkChar(s, start++);
+ }
+ else
+ {
+ if(start + 1 == end)
+ {
+ throw new IllegalArgumentException("trailing backslash");
+ }
+ switch(s.charAt(++start))
+ {
+ case '\\':
+ case '\'':
+ case '"':
+ {
+ c = s.charAt(start++);
+ break;
+ }
+ case 'b':
+ {
+ ++start;
+ c = '\b';
+ break;
+ }
+ case 'f':
+ {
+ ++start;
+ c = '\f';
+ break;
+ }
+ case 'n':
+ {
+ ++start;
+ c = '\n';
+ break;
+ }
+ case 'r':
+ {
+ ++start;
+ c = '\r';
+ break;
+ }
+ case 't':
+ {
+ ++start;
+ c = '\t';
+ break;
+ }
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ {
+ int val = 0;
+ for(int j = 0; j < 3 && start < end; ++j)
+ {
+ int charVal = s.charAt(start++) - '0';
+ if(charVal < 0 || charVal > 7)
+ {
+ --start;
+ break;
+ }
+ val = val * 8 + charVal;
+ }
+ if(val > 255)
+ {
+ String msg = "octal value \\" + Integer.toOctalString(val) + " (" + val + ") is out of range";
+ throw new IllegalArgumentException(msg);
+ }
+ c = (char)val;
+ break;
+ }
+ default:
+ {
+ c = checkChar(s, start++);
+ break;
+ }
+ }
+ }
+ nextStart.value = start;
+ return c;
+ }
+
+ //
+ // Remove escape sequences from s and append the result to sb.
+ // Return true if successful, false otherwise.
+ //
+ private static void
+ decodeString(String s, int start, int end, StringBuilder sb)
+ {
+ Holder<Integer> nextStart = new Holder<>();
+ while(start < end)
+ {
+ sb.append(decodeChar(s, start, end, nextStart));
+ start = nextStart.value;
+ }
+ }
+
+ //
+ // Remove escape sequences added by escapeString. Throws IllegalArgumentException
+ // for an invalid input string.
+ //
+ public static String
+ unescapeString(String s, int start, int end)
+ {
+ assert(start >= 0 && start <= end && end <= s.length());
+
+ StringBuilder sb = new StringBuilder(end - start);
+ decodeString(s, start, end, sb);
+ String decodedString = sb.toString();
+
+ byte[] arr = new byte[decodedString.length()];
+ for(int i = 0; i < arr.length; ++i)
+ {
+ arr[i] = (byte)decodedString.charAt(i);
+ }
+
+ try
+ {
+ return new String(arr, 0, arr.length, "UTF8");
+ }
+ catch(java.io.UnsupportedEncodingException ex)
+ {
+ throw new IllegalArgumentException("unsupported encoding", ex);
+ }
+ }
+
+ //
+ // Join a list of strings using the given delimiter.
+ //
+ public static String
+ joinString(java.util.List<String> values, String delimiter)
+ {
+ StringBuffer s = new StringBuffer();
+ boolean first = true;
+ for(String v : values)
+ {
+ if(!first)
+ {
+ s.append(delimiter);
+ }
+ s.append(v);
+ first = false;
+ }
+ return s.toString();
+ }
+
+ //
+ // Split string helper; returns null for unmatched quotes
+ //
+ static public String[]
+ splitString(String str, String delim)
+ {
+ java.util.List<String> l = new java.util.ArrayList<>();
+ char[] arr = new char[str.length()];
+ int pos = 0;
+
+ int n = 0;
+ char quoteChar = '\0';
+ while(pos < str.length())
+ {
+ if(quoteChar == '\0' && (str.charAt(pos) == '"' || str.charAt(pos) == '\''))
+ {
+ quoteChar = str.charAt(pos++);
+ continue; // Skip the quote.
+ }
+ else if(quoteChar == '\0' && str.charAt(pos) == '\\' && pos + 1 < str.length() &&
+ (str.charAt(pos + 1) == '"' || str.charAt(pos + 1) == '\''))
+ {
+ ++pos; // Skip the backslash
+ }
+ else if(quoteChar != '\0' && str.charAt(pos) == '\\' && pos + 1 < str.length() &&
+ str.charAt(pos + 1) == quoteChar)
+ {
+ ++pos; // Skip the backslash
+ }
+ else if(quoteChar != '\0' && str.charAt(pos) == quoteChar)
+ {
+ ++pos;
+ quoteChar = '\0';
+ continue; // Skip the quote.
+ }
+ else if(delim.indexOf(str.charAt(pos)) != -1)
+ {
+ if(quoteChar == '\0')
+ {
+ ++pos;
+ if(n > 0)
+ {
+ l.add(new String(arr, 0, n));
+ n = 0;
+ }
+ continue;
+ }
+ }
+
+ if(pos < str.length())
+ {
+ arr[n++] = str.charAt(pos++);
+ }
+ }
+
+ if(n > 0)
+ {
+ l.add(new String(arr, 0, n));
+ }
+ if(quoteChar != '\0')
+ {
+ return null; // Unmatched quote.
+ }
+ return l.toArray(new String[0]);
+ }
+
+ public static int
+ checkQuote(String s)
+ {
+ return checkQuote(s, 0);
+ }
+
+ //
+ // If a single or double quotation mark is found at the start position,
+ // then the position of the matching closing quote is returned. If no
+ // quotation mark is found at the start position, then 0 is returned.
+ // If no matching closing quote is found, then -1 is returned.
+ //
+ public static int
+ checkQuote(String s, int start)
+ {
+ char quoteChar = s.charAt(start);
+ if(quoteChar == '"' || quoteChar == '\'')
+ {
+ start++;
+ final int len = s.length();
+ int pos;
+ while(start < len && (pos = s.indexOf(quoteChar, start)) != -1)
+ {
+ if(s.charAt(pos - 1) != '\\')
+ {
+ return pos;
+ }
+ start = pos + 1;
+ }
+ return -1; // Unmatched quote
+ }
+ return 0; // Not quoted
+ }
+
+ public static boolean
+ match(String s, String pat, boolean emptyMatch)
+ {
+ assert(s.length() > 0);
+ assert(pat.length() > 0);
+
+ //
+ // If pattern does not contain a wildcard just compare strings.
+ //
+ int beginIndex = pat.indexOf('*');
+ if(beginIndex < 0)
+ {
+ return s.equals(pat);
+ }
+
+ //
+ // Make sure start of the strings match
+ //
+ if(beginIndex > s.length() || !s.substring(0, beginIndex).equals(pat.substring(0, beginIndex)))
+ {
+ return false;
+ }
+
+ //
+ // Make sure there is something present in the middle to match the
+ // wildcard. If emptyMatch is true, allow a match of "".
+ //
+ int endLength = pat.length() - beginIndex - 1;
+ if(endLength == 0)
+ {
+ return true;
+ }
+ if(endLength > s.length())
+ {
+ return false;
+ }
+ int endIndex = s.length() - endLength;
+ if(endIndex < beginIndex || (!emptyMatch && endIndex == beginIndex))
+ {
+ return false;
+ }
+
+ //
+ // Make sure end of the strings match
+ //
+ if(!s.substring(endIndex, s.length() - endIndex).equals(
+ pat.substring(beginIndex + 1, pat.length() - beginIndex - 1)))
+ {
+ return false;
+ }
+
+ return true;
+ }
+}
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/XMLOutput.java b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/XMLOutput.java
new file mode 100644
index 00000000000..ed8428fc236
--- /dev/null
+++ b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/XMLOutput.java
@@ -0,0 +1,275 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceUtilInternal;
+
+public class XMLOutput extends OutputBase
+{
+ public
+ XMLOutput()
+ {
+ super();
+ _se = false;
+ _text = false;
+ _sgml = false;
+ _escape = false;
+ }
+
+ public
+ XMLOutput(java.io.PrintWriter writer)
+ {
+ super(writer);
+ _se = false;
+ _text = false;
+ _sgml = false;
+ _escape = false;
+ }
+
+ public
+ XMLOutput(String s)
+ {
+ super(s);
+ _se = false;
+ _text = false;
+ _sgml = false;
+ _escape = false;
+ }
+
+ public void
+ setSGML(boolean sgml)
+ {
+ _sgml = true;
+ }
+
+ @Override
+ public void
+ print(String s)
+ {
+ if(_se)
+ {
+ _out.print('>');
+ _se = false;
+ }
+ _text = true;
+
+ if(_escape)
+ {
+ String escaped = escape(s);
+ super.print(escaped);
+ }
+ else
+ {
+ super.print(s);
+ }
+ }
+
+ public XMLOutput
+ write(String s)
+ {
+ print(s);
+ return this;
+ }
+
+ @Override
+ public void
+ nl()
+ {
+ if(_se)
+ {
+ _se = false;
+ _out.print('>');
+ }
+ super.nl();
+ }
+
+ public XMLOutput
+ se(String element)
+ {
+ nl();
+
+ //
+ // If we're not in SGML mode the output of the '>' character is
+ // deferred until either the end-element (in which case a /> is
+ // emitted) or until something is displayed.
+ //
+ if(_escape)
+ {
+ _out.print('<');
+ _out.print(escape(element));
+ }
+ else
+ {
+ _out.print('<');
+ _out.print(element);
+ }
+ _se = true;
+ _text = false;
+
+ int pos = element.indexOf(' ');
+ if(pos == -1)
+ {
+ pos = element.indexOf('\t');
+ }
+ if(pos == -1)
+ {
+ _elementStack.addFirst(element);
+ }
+ else
+ {
+ _elementStack.addFirst(element.substring(0, pos));
+ }
+
+ ++_pos; // TODO: ???
+ inc();
+ _separator = false;
+ return this;
+ }
+
+ public XMLOutput
+ ee()
+ {
+ String element = _elementStack.removeFirst();
+
+ dec();
+ if(_se)
+ {
+ //
+ // SGML (docbook) doesn't support <foo/>
+ //
+ if(_sgml)
+ {
+ _out.print("></");
+ _out.print(element);
+ _out.print(">");
+ }
+ else
+ {
+ _out.print("/>");
+ }
+ }
+ else
+ {
+ if(!_text)
+ {
+ nl();
+ }
+ _out.print("</");
+ _out.print(element);
+ _out.print(">");
+ }
+ --_pos; // TODO: ???
+
+ _se = false;
+ _text = false;
+ return this;
+ }
+
+ public XMLOutput
+ attr(String name, String value)
+ {
+ //
+ // Precondition: Attributes can only be attached to elements.
+ //
+ assert(_se);
+ _out.print(" ");
+ _out.print(name);
+ _out.print("=\"");
+ _out.print(escape(value));
+ _out.print("\"");
+ return this;
+ }
+
+ public XMLOutput
+ startEscapes()
+ {
+ _escape = true;
+ return this;
+ }
+
+ public XMLOutput
+ endEscapes()
+ {
+ _escape = false;
+ return this;
+ }
+
+ public String
+ currentElement()
+ {
+ if(_elementStack.size() > 0)
+ {
+ return _elementStack.getFirst();
+ }
+ else
+ {
+ return "";
+ }
+ }
+
+ private String
+ escape(String input)
+ {
+ String v = input;
+
+ //
+ // Find out whether there is a reserved character to avoid
+ // conversion if not necessary.
+ //
+ final String allReserved = "<>'\"&";
+ boolean hasReserved = false;
+ char[] arr = input.toCharArray();
+ for(int i = 0; i < arr.length; i++)
+ {
+ if(allReserved.indexOf(arr[i]) != -1)
+ {
+ hasReserved = true;
+ break;
+ }
+ }
+ if(hasReserved)
+ {
+ //
+ // First convert all & to &amp;
+ //
+ if(v.indexOf('&') != -1)
+ {
+ v = v.replaceAll("&", "&amp;");
+ }
+
+ //
+ // Next convert remaining reserved characters.
+ //
+ if(v.indexOf('>') != -1)
+ {
+ v = v.replaceAll(">", "&gt;");
+ }
+ if(v.indexOf('<') != -1)
+ {
+ v = v.replaceAll("<", "&lt;");
+ }
+ if(v.indexOf('\'') != -1)
+ {
+ v = v.replaceAll("'", "&apos;");
+ }
+ if(v.indexOf('"') != -1)
+ {
+ v = v.replaceAll("\"", "&quot;");
+ }
+ }
+ return v;
+ }
+
+ private java.util.LinkedList<String> _elementStack = new java.util.LinkedList<>();
+
+ boolean _se;
+ boolean _text;
+
+ private boolean _sgml;
+ private boolean _escape;
+}
diff --git a/java/src/IceBox/build.gradle b/java/src/IceBox/build.gradle
index 8ef453cc9fb..7d8bad65ca1 100644
--- a/java/src/IceBox/build.gradle
+++ b/java/src/IceBox/build.gradle
@@ -7,8 +7,10 @@
//
// **********************************************************************
-sourceCompatibility = iceSourceCompatibility
-targetCompatibility = iceTargetCompatibility
+//sourceCompatibility = iceSourceCompatibility
+//targetCompatibility = iceTargetCompatibility
+sourceCompatibility = 1.8
+targetCompatibility = 1.8
project.ext.displayName = "IceBox"
project.ext.description = "IceBox is an easy-to-use framework for Ice application services"
@@ -16,7 +18,7 @@ project.ext.description = "IceBox is an easy-to-use framework for Ice applicatio
slice {
java {
set1 {
- args = "--ice --tie --checksum IceBox.SliceChecksums"
+ args = "--ice --checksum com.zeroc.IceBox.SliceChecksums"
files = fileTree(dir: "$sliceDir/IceBox", includes:['*.ice'], excludes:["*F.ice"])
}
}
diff --git a/java/src/IceBox/src/main/java/com/zeroc/IceBox/Admin.java b/java/src/IceBox/src/main/java/com/zeroc/IceBox/Admin.java
new file mode 100644
index 00000000000..ace16b7d0b7
--- /dev/null
+++ b/java/src/IceBox/src/main/java/com/zeroc/IceBox/Admin.java
@@ -0,0 +1,183 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceBox;
+
+public final class Admin
+{
+ private static class Client extends com.zeroc.Ice.Application
+ {
+ private void usage()
+ {
+ System.err.println(
+ "Usage: " + appName() + " [options] [command...]\n" +
+ "Options:\n" +
+ "-h, --help Show this message.\n" +
+ "\n" +
+ "Commands:\n" +
+ "start SERVICE Start a service.\n" +
+ "stop SERVICE Stop a service.\n" +
+ "shutdown Shutdown the server.");
+ }
+
+ @Override
+ public int run(String[] args)
+ {
+ java.util.List<String> commands = new java.util.ArrayList<>();
+
+ int idx = 0;
+ while(idx < args.length)
+ {
+ if(args[idx].equals("-h") || args[idx].equals("--help"))
+ {
+ usage();
+ return 1;
+ }
+ else if(args[idx].charAt(0) == '-')
+ {
+ System.err.println(appName() + ": unknown option `" + args[idx] + "'");
+ usage();
+ return 1;
+ }
+ else
+ {
+ commands.add(args[idx]);
+ ++idx;
+ }
+ }
+
+ if(commands.isEmpty())
+ {
+ usage();
+ return 0;
+ }
+
+ com.zeroc.Ice.ObjectPrx base = communicator().propertyToProxy("IceBoxAdmin.ServiceManager.Proxy");
+
+ if(base == null)
+ {
+ //
+ // The old deprecated way to retrieve the service manager proxy
+ //
+
+ com.zeroc.Ice.Properties properties = communicator().getProperties();
+
+ com.zeroc.Ice.Identity managerIdentity = new com.zeroc.Ice.Identity();
+ managerIdentity.category = properties.getPropertyWithDefault("IceBox.InstanceName", "IceBox");
+ managerIdentity.name = "ServiceManager";
+
+ String managerProxy;
+ if(properties.getProperty("Ice.Default.Locator").length() == 0)
+ {
+ String managerEndpoints = properties.getProperty("IceBox.ServiceManager.Endpoints");
+ if(managerEndpoints.length() == 0)
+ {
+ System.err.println(appName() + ": property `IceBoxAdmin.ServiceManager.Proxy' is not set");
+ return 1;
+ }
+
+ managerProxy = "\"" + com.zeroc.Ice.Util.identityToString(managerIdentity) + "\" :" +
+ managerEndpoints;
+ }
+ else
+ {
+ String managerAdapterId = properties.getProperty("IceBox.ServiceManager.AdapterId");
+ if(managerAdapterId.length() == 0)
+ {
+ System.err.println(appName() + ": property `IceBoxAdmin.ServiceManager.Proxy' is not set");
+ return 1;
+ }
+
+ managerProxy = "\"" + com.zeroc.Ice.Util.identityToString(managerIdentity) + "\" @" +
+ managerAdapterId;
+ }
+
+ base = communicator().stringToProxy(managerProxy);
+ }
+
+ com.zeroc.IceBox.ServiceManagerPrx manager = com.zeroc.IceBox.ServiceManagerPrx.checkedCast(base);
+ if(manager == null)
+ {
+ System.err.println(appName() + ": `" + base.toString() + "' is not an IceBox::ServiceManager");
+ return 1;
+ }
+
+ for(int i = 0; i < commands.size(); i++)
+ {
+ String command = commands.get(i);
+ if(command.equals("shutdown"))
+ {
+ manager.shutdown();
+ }
+ else if(command.equals("start"))
+ {
+ if(++i >= commands.size())
+ {
+ System.err.println(appName() + ": no service name specified.");
+ return 1;
+ }
+
+ String service = commands.get(i);
+ try
+ {
+ manager.startService(service);
+ }
+ catch(com.zeroc.IceBox.NoSuchServiceException ex)
+ {
+ System.err.println(appName() + ": unknown service `" + service + "'");
+ return 1;
+ }
+ catch(com.zeroc.IceBox.AlreadyStartedException ex)
+ {
+ System.err.println(appName() + "service already started.");
+ }
+ }
+ else if(command.equals("stop"))
+ {
+ if(++i >= commands.size())
+ {
+ System.err.println(appName() + ": no service name specified.");
+ return 1;
+ }
+
+ String service = commands.get(i);
+ try
+ {
+ manager.stopService(service);
+ }
+ catch(com.zeroc.IceBox.NoSuchServiceException ex)
+ {
+ System.err.println(appName() + ": unknown service `" + service + "'");
+ return 1;
+ }
+ catch(com.zeroc.IceBox.AlreadyStoppedException ex)
+ {
+ System.err.println(appName() + "service already stopped.");
+ }
+ }
+ else
+ {
+ System.err.println(appName() + ": unknown command `" + command + "'");
+ usage();
+ return 1;
+ }
+ }
+
+ return 0;
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ Client app = new Client();
+ int rc = app.main("IceBox.Admin", args);
+
+ System.exit(rc);
+ }
+}
diff --git a/java/src/IceBox/src/main/java/com/zeroc/IceBox/Server.java b/java/src/IceBox/src/main/java/com/zeroc/IceBox/Server.java
new file mode 100644
index 00000000000..0ceb87215d8
--- /dev/null
+++ b/java/src/IceBox/src/main/java/com/zeroc/IceBox/Server.java
@@ -0,0 +1,76 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceBox;
+
+public final class Server extends com.zeroc.Ice.Application
+{
+ private static void usage()
+ {
+ System.err.println("Usage: com.zeroc.IceBox.Server [options] --Ice.Config=<file>\n");
+ System.err.println(
+ "Options:\n" +
+ "-h, --help Show this message.\n"
+ );
+ }
+
+ public static void main(String[] args)
+ {
+ com.zeroc.Ice.InitializationData initData = new com.zeroc.Ice.InitializationData();
+ initData.properties = com.zeroc.Ice.Util.createProperties();
+ initData.properties.setProperty("Ice.Admin.DelayCreation", "1");
+
+ Server server = new Server();
+ System.exit(server.main("IceBox.Server", args, initData));
+ }
+
+ @Override
+ public int run(String[] args)
+ {
+ final String prefix = "IceBox.Service.";
+ com.zeroc.Ice.Properties properties = communicator().getProperties();
+ java.util.Map<String, String> services = properties.getPropertiesForPrefix(prefix);
+ java.util.List<String> argSeq = new java.util.ArrayList<>(args.length);
+ for(String s : args)
+ {
+ argSeq.add(s);
+ }
+
+ for(java.util.Map.Entry<String, String> entry : services.entrySet())
+ {
+ String name = entry.getKey().substring(prefix.length());
+ for(int i = 0; i < argSeq.size(); ++i)
+ {
+ if(argSeq.get(i).startsWith("--" + name))
+ {
+ argSeq.remove(i);
+ i--;
+ }
+ }
+ }
+
+ for(String arg : argSeq)
+ {
+ if(arg.equals("-h") || arg.equals("--help"))
+ {
+ usage();
+ return 0;
+ }
+ else
+ {
+ System.err.println("Server: unknown option `" + arg + "'");
+ usage();
+ return 1;
+ }
+ }
+
+ ServiceManagerI serviceManagerImpl = new ServiceManagerI(communicator(), args);
+ return serviceManagerImpl.run();
+ }
+}
diff --git a/java/src/IceBox/src/main/java/com/zeroc/IceBox/ServiceManagerI.java b/java/src/IceBox/src/main/java/com/zeroc/IceBox/ServiceManagerI.java
new file mode 100644
index 00000000000..17ec55be0db
--- /dev/null
+++ b/java/src/IceBox/src/main/java/com/zeroc/IceBox/ServiceManagerI.java
@@ -0,0 +1,1177 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceBox;
+
+import java.net.URLEncoder;
+
+import com.zeroc.Ice.Current;
+import com.zeroc.Ice.Properties;
+import com.zeroc.Ice.Util;
+
+//
+// NOTE: the class isn't final on purpose to allow users to eventually
+// extend it.
+//
+public class ServiceManagerI implements ServiceManager
+{
+ public ServiceManagerI(com.zeroc.Ice.Communicator communicator, String[] args)
+ {
+ _communicator = communicator;
+ _logger = _communicator.getLogger();
+
+ Properties props = _communicator.getProperties();
+
+ if(props.getProperty("Ice.Admin.Enabled").isEmpty())
+ {
+ _adminEnabled = !props.getProperty("Ice.Admin.Endpoints").isEmpty();
+ }
+ else
+ {
+ _adminEnabled = props.getPropertyAsInt("Ice.Admin.Enabled") > 0;
+ }
+
+ if(_adminEnabled)
+ {
+ String[] facetFilter = props.getPropertyAsList("Ice.Admin.Facets");
+ if(facetFilter.length > 0)
+ {
+ _adminFacetFilter = new java.util.HashSet<>(java.util.Arrays.asList(facetFilter));
+ }
+ else
+ {
+ _adminFacetFilter = new java.util.HashSet<>();
+ }
+ }
+
+ _argv = args;
+ _traceServiceObserver = props.getPropertyAsInt("IceBox.Trace.ServiceObserver");
+ }
+
+ @Override
+ public java.util.Map<String, String> getSliceChecksums(Current current)
+ {
+ return SliceChecksums.checksums;
+ }
+
+ @Override
+ public void
+ startService(String name, Current current)
+ throws AlreadyStartedException, NoSuchServiceException
+ {
+ ServiceInfo info = null;
+ synchronized(this)
+ {
+ //
+ // Search would be more efficient if services were contained in
+ // a map, but order is required for shutdown.
+ //
+ for(ServiceInfo p : _services)
+ {
+ if(p.name.equals(name))
+ {
+ if(p.status == StatusStarted)
+ {
+ throw new AlreadyStartedException();
+ }
+ p.status = StatusStarting;
+ info = p.clone();
+ break;
+ }
+ }
+ if(info == null)
+ {
+ throw new NoSuchServiceException();
+ }
+ _pendingStatusChanges = true;
+ }
+
+ boolean started = false;
+ try
+ {
+ info.service.start(name, info.communicator == null ? _sharedCommunicator : info.communicator, info.args);
+ started = true;
+ }
+ catch(java.lang.Exception e)
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ e.printStackTrace(pw);
+ pw.flush();
+ _logger.warning("ServiceManager: exception while starting service " + info.name + ":\n" + sw.toString());
+ }
+
+ synchronized(this)
+ {
+ for(ServiceInfo p : _services)
+ {
+ if(p.name.equals(name))
+ {
+ if(started)
+ {
+ p.status = StatusStarted;
+
+ java.util.List<String> services = new java.util.ArrayList<>();
+ services.add(name);
+ servicesStarted(services, _observers);
+ }
+ else
+ {
+ p.status = StatusStopped;
+ }
+ break;
+ }
+ }
+ _pendingStatusChanges = false;
+ notifyAll();
+ }
+ }
+
+ @Override
+ public void stopService(String name, Current current)
+ throws AlreadyStoppedException, NoSuchServiceException
+ {
+ ServiceInfo info = null;
+ synchronized(this)
+ {
+ //
+ // Search would be more efficient if services were contained in
+ // a map, but order is required for shutdown.
+ //
+ for(ServiceInfo p : _services)
+ {
+ if(p.name.equals(name))
+ {
+ if(p.status == StatusStopped)
+ {
+ throw new AlreadyStoppedException();
+ }
+ p.status = StatusStopping;
+ info = p.clone();
+ break;
+ }
+ }
+ if(info == null)
+ {
+ throw new NoSuchServiceException();
+ }
+ _pendingStatusChanges = true;
+ }
+
+ boolean stopped = false;
+ try
+ {
+ info.service.stop();
+ stopped = true;
+ }
+ catch(java.lang.Exception e)
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ e.printStackTrace(pw);
+ pw.flush();
+ _logger.warning("ServiceManager: exception while stopping service " + info.name + ":\n" + sw.toString());
+ }
+
+ synchronized(this)
+ {
+ for(ServiceInfo p : _services)
+ {
+ if(p.name.equals(name))
+ {
+ if(stopped)
+ {
+ p.status = StatusStopped;
+
+ java.util.List<String> services = new java.util.ArrayList<>();
+ services.add(name);
+ servicesStopped(services, _observers);
+ }
+ else
+ {
+ p.status = StatusStarted;
+ }
+ break;
+ }
+ }
+ _pendingStatusChanges = false;
+ notifyAll();
+ }
+ }
+
+ @Override
+ public void addObserver(final ServiceObserverPrx observer, Current current)
+ {
+ java.util.List<String> activeServices = new java.util.LinkedList<>();
+
+ //
+ // Null observers and duplicate registrations are ignored
+ //
+
+ synchronized(this)
+ {
+ if(observer != null && _observers.add(observer))
+ {
+ if(_traceServiceObserver >= 1)
+ {
+ _logger.trace("IceBox.ServiceObserver",
+ "Added service observer " + _communicator.proxyToString(observer));
+ }
+
+ for(ServiceInfo info: _services)
+ {
+ if(info.status == StatusStarted)
+ {
+ activeServices.add(info.name);
+ }
+ }
+ }
+ }
+
+ if(activeServices.size() > 0)
+ {
+ observer.servicesStartedAsync(activeServices.toArray(new String[0])).exceptionally(ex ->
+ {
+ observerFailed(observer, ex);
+ return null;
+ });
+ }
+ }
+
+ @Override
+ public void shutdown(Current current)
+ {
+ _communicator.shutdown();
+ }
+
+ public int run()
+ {
+ try
+ {
+ Properties properties = _communicator.getProperties();
+
+ //
+ // Create an object adapter. Services probably should NOT share
+ // this object adapter, as the endpoint(s) for this object adapter
+ // will most likely need to be firewalled for security reasons.
+ //
+ com.zeroc.Ice.ObjectAdapter adapter = null;
+ if(properties.getProperty("IceBox.ServiceManager.Endpoints").length() != 0)
+ {
+ adapter = _communicator.createObjectAdapter("IceBox.ServiceManager");
+
+ com.zeroc.Ice.Identity identity = new com.zeroc.Ice.Identity();
+ identity.category = properties.getPropertyWithDefault("IceBox.InstanceName", "IceBox");
+ identity.name = "ServiceManager";
+ adapter.add(this, identity);
+ }
+
+ //
+ // Parse the property set with the prefix "IceBox.Service.". These
+ // properties should have the following format:
+ //
+ // IceBox.Service.Foo=[jar-or-dir:]Package.Foo [args]
+ //
+ // We parse the service properties specified in IceBox.LoadOrder
+ // first, then the ones from remaining services.
+ //
+ final String prefix = "IceBox.Service.";
+ java.util.Map<String, String> services = properties.getPropertiesForPrefix(prefix);
+ String[] loadOrder = properties.getPropertyAsList("IceBox.LoadOrder");
+ java.util.List<StartServiceInfo> servicesInfo = new java.util.ArrayList<>();
+ for(String name : loadOrder)
+ {
+ if(name.length() > 0)
+ {
+ String key = prefix + name;
+ String value = services.get(key);
+ if(value == null)
+ {
+ FailureException ex = new FailureException();
+ ex.reason = "ServiceManager: no service definition for `" + name + "'";
+ throw ex;
+ }
+ servicesInfo.add(new StartServiceInfo(name, value, _argv));
+ services.remove(key);
+ }
+ }
+ for(java.util.Map.Entry<String, String> p : services.entrySet())
+ {
+ String name = p.getKey().substring(prefix.length());
+ String value = p.getValue();
+ servicesInfo.add(new StartServiceInfo(name, value, _argv));
+ }
+
+ //
+ // Check if some services are using the shared communicator in which
+ // case we create the shared communicator now with a property set that
+ // is the union of all the service properties (from services that use
+ // the shared communicator).
+ //
+ if(properties.getPropertiesForPrefix("IceBox.UseSharedCommunicator.").size() > 0)
+ {
+ com.zeroc.Ice.InitializationData initData = new com.zeroc.Ice.InitializationData();
+ initData.properties = createServiceProperties("SharedCommunicator");
+ for(StartServiceInfo service : servicesInfo)
+ {
+ if(properties.getPropertyAsInt("IceBox.UseSharedCommunicator." + service.name) <= 0)
+ {
+ continue;
+ }
+
+ //
+ // Load the service properties using the shared communicator properties as
+ // the default properties.
+ //
+ Util.CreatePropertiesResult cpr = Util.createProperties(service.args, initData.properties);
+ service.args = cpr.args;
+
+ //
+ // Remove properties from the shared property set that a service explicitly clears.
+ //
+ java.util.Map<String, String> allProps = initData.properties.getPropertiesForPrefix("");
+ for(String key : allProps.keySet())
+ {
+ if(cpr.properties.getProperty(key).length() == 0)
+ {
+ initData.properties.setProperty(key, "");
+ }
+ }
+
+ //
+ // Add the service properties to the shared communicator properties.
+ //
+ for(java.util.Map.Entry<String, String> p : cpr.properties.getPropertiesForPrefix("").entrySet())
+ {
+ initData.properties.setProperty(p.getKey(), p.getValue());
+ }
+
+ //
+ // Parse <service>.* command line options (the Ice command line options
+ // were parsed by the call to createProperties above).
+ //
+ service.args = initData.properties.parseCommandLineOptions(service.name, service.args);
+ }
+
+ String facetNamePrefix = "IceBox.SharedCommunicator.";
+ boolean addFacets = configureAdmin(initData.properties, facetNamePrefix);
+
+ _sharedCommunicator = Util.initialize(initData);
+
+ if(addFacets)
+ {
+ // Add all facets created on shared communicator to the IceBox communicator
+ // but renamed <prefix>.<facet-name>, except for the Process facet which is
+ // never added.
+ for(java.util.Map.Entry<String, com.zeroc.Ice.Object> p :
+ _sharedCommunicator.findAllAdminFacets().entrySet())
+ {
+ if(!p.getKey().equals("Process"))
+ {
+ _communicator.addAdminFacet(p.getValue(), facetNamePrefix + p.getKey());
+ }
+ }
+ }
+ }
+
+ for(StartServiceInfo s : servicesInfo)
+ {
+ start(s.name, s.className, s.classDir, s.absolutePath, s.args);
+ }
+
+ //
+ // We may want to notify external scripts that the services
+ // have started. This is done by defining the property:
+ //
+ // IceBox.PrintServicesReady=bundleName
+ //
+ // Where bundleName is whatever you choose to call this set of
+ // services. It will be echoed back as "bundleName ready".
+ //
+ // This must be done after start() has been invoked on the
+ // services.
+ //
+ String bundleName = properties.getProperty("IceBox.PrintServicesReady");
+ if(bundleName.length() > 0)
+ {
+ System.out.println(bundleName + " ready");
+ }
+
+ //
+ // Don't move after the adapter activation. This allows
+ // applications to wait for the service manager to be
+ // reachable before sending a signal to shutdown the
+ // IceBox.
+ //
+ com.zeroc.Ice.Application.shutdownOnInterrupt();
+
+ //
+ // Register "this" as a facet to the Admin object and
+ // create Admin object
+ //
+ try
+ {
+ _communicator.addAdminFacet(this, "IceBox.ServiceManager");
+ _communicator.getAdmin();
+ }
+ catch(com.zeroc.Ice.ObjectAdapterDeactivatedException ex)
+ {
+ //
+ // Expected if the communicator has been shutdown.
+ //
+ }
+
+ //
+ // Start request dispatching after we've started the services.
+ //
+ if(adapter != null)
+ {
+ try
+ {
+ adapter.activate();
+ }
+ catch(com.zeroc.Ice.ObjectAdapterDeactivatedException ex)
+ {
+ //
+ // Expected if the communicator has been shutdown.
+ //
+ }
+ }
+
+ _communicator.waitForShutdown();
+ com.zeroc.Ice.Application.defaultInterrupt();
+ }
+ catch(FailureException ex)
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ pw.println(ex.reason);
+ ex.printStackTrace(pw);
+ pw.flush();
+ _logger.error(sw.toString());
+ return 1;
+ }
+ catch(Throwable ex)
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ ex.printStackTrace(pw);
+ pw.flush();
+ _logger.error("ServiceManager: caught exception:\n" + sw.toString());
+ return 1;
+ }
+ finally
+ {
+ //
+ // Invoke stop() on the services.
+ //
+ stopAll();
+ }
+
+ return 0;
+ }
+
+ synchronized private void start(String service, String className, String classDir, boolean absolutePath,
+ String[] args)
+ throws FailureException
+ {
+ //
+ // Load the class.
+ //
+
+ //
+ // Use a class loader if the user specified a JAR file or class directory.
+ //
+ Class<?> c = null;
+ if(classDir != null)
+ {
+ try
+ {
+ if(!absolutePath)
+ {
+ classDir = new java.io.File(System.getProperty("user.dir") + java.io.File.separator +
+ classDir).getCanonicalPath();
+ }
+
+ if(!classDir.endsWith(java.io.File.separator) && !classDir.endsWith(".jar"))
+ {
+ classDir += java.io.File.separator;
+ }
+ classDir = URLEncoder.encode(classDir, "UTF-8");
+
+ //
+ // Reuse an existing class loader if we have already loaded a plug-in with
+ // the same value for classDir, otherwise create a new one.
+ //
+ ClassLoader cl = null;
+
+ if(_classLoaders == null)
+ {
+ _classLoaders = new java.util.HashMap<>();
+ }
+ else
+ {
+ cl = _classLoaders.get(classDir);
+ }
+
+ if(cl == null)
+ {
+ final java.net.URL[] url = new java.net.URL[] { new java.net.URL("file:///" + classDir) };
+
+ cl = new java.net.URLClassLoader(url);
+
+ _classLoaders.put(classDir, cl);
+ }
+
+ c = cl.loadClass(className);
+ }
+ catch(java.net.MalformedURLException ex)
+ {
+ throw new FailureException("ServiceManager: invalid entry point format `" + classDir + "'", ex);
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new FailureException("ServiceManager: invalid path in plug-in entry point `" + classDir +
+ "'", ex);
+ }
+ catch(java.lang.ClassNotFoundException ex)
+ {
+ // Ignored
+ }
+ }
+ else
+ {
+ c = com.zeroc.IceInternal.Util.findClass(className, null);
+ }
+
+ if(c == null)
+ {
+ throw new FailureException("ServiceManager: class " + className + " not found");
+ }
+
+ ServiceInfo info = new ServiceInfo();
+ info.name = service;
+ info.status = StatusStopped;
+ info.args = args;
+
+ //
+ // If Ice.UseSharedCommunicator.<name> is defined, create a
+ // communicator for the service. The communicator inherits
+ // from the shared communicator properties. If it's not
+ // defined, add the service properties to the shared
+ // commnunicator property set.
+ //
+ com.zeroc.Ice.Communicator communicator;
+ if(_communicator.getProperties().getPropertyAsInt("IceBox.UseSharedCommunicator." + service) > 0)
+ {
+ assert(_sharedCommunicator != null);
+ communicator = _sharedCommunicator;
+ }
+ else
+ {
+ try
+ {
+ //
+ // Create the service properties. We use the communicator properties as the default
+ // properties if IceBox.InheritProperties is set.
+ //
+ com.zeroc.Ice.InitializationData initData = new com.zeroc.Ice.InitializationData();
+ initData.properties = createServiceProperties(service);
+ String[] serviceArgs = info.args;
+ if(serviceArgs.length > 0)
+ {
+ //
+ // Create the service properties with the given service arguments. This should
+ // read the service config file if it's specified with --Ice.Config.
+ //
+ Util.CreatePropertiesResult cpr = Util.createProperties(serviceArgs, initData.properties);
+ initData.properties = cpr.properties;
+
+ //
+ // Next, parse the service "<service>.*" command line options (the Ice command
+ // line options were parsed by the createProperties above).
+ //
+ serviceArgs = initData.properties.parseCommandLineOptions(service, cpr.args);
+ }
+
+ //
+ // Clone the logger to assign a new prefix. If one of the built-in loggers is configured
+ // don't set any logger.
+ //
+ if(initData.properties.getProperty("Ice.LogFile").length() == 0 &&
+ (initData.properties.getPropertyAsInt("Ice.UseSyslog") <= 0 ||
+ System.getProperty("os.name").startsWith("Windows")))
+ {
+ initData.logger = _logger.cloneWithPrefix(initData.properties.getProperty("Ice.ProgramName"));
+ }
+
+ //
+ // If Admin is enabled on the IceBox communicator, for each service that does not set
+ // Ice.Admin.Enabled, we set Ice.Admin.Enabled=1 to have this service create facets; then
+ // we add these facets to the IceBox Admin object as IceBox.Service.<service>.<facet>.
+ //
+ String serviceFacetNamePrefix = "IceBox.Service." + service + ".";
+ boolean addFacets = configureAdmin(initData.properties, serviceFacetNamePrefix);
+
+ //
+ // Remaining command line options are passed to the communicator. This is
+ // necessary for Ice plug-in properties (e.g.: IceSSL).
+ //
+ Util.InitializeResult ir = Util.initialize(serviceArgs, initData);
+ info.communicator = ir.communicator;
+ info.args = ir.args;
+ communicator = info.communicator;
+
+ if(addFacets)
+ {
+ // Add all facets created on the service communicator to the IceBox communicator
+ // but renamed IceBox.Service.<service>.<facet-name>, except for the Process facet
+ // which is never added
+ for(java.util.Map.Entry<String, com.zeroc.Ice.Object> p :
+ communicator.findAllAdminFacets().entrySet())
+ {
+ if(!p.getKey().equals("Process"))
+ {
+ _communicator.addAdminFacet(p.getValue(), serviceFacetNamePrefix + p.getKey());
+ }
+ }
+ }
+ }
+ catch(Throwable ex)
+ {
+ FailureException e = new FailureException();
+ e.reason = "ServiceManager: exception while starting service " + service;
+ e.initCause(ex);
+ throw e;
+ }
+ }
+
+ try
+ {
+ //
+ // Instantiate the service.
+ //
+ try
+ {
+ //
+ // If the service class provides a constructor that accepts an com.zeroc.Ice.Communicator argument,
+ // use that in preference to the default constructor.
+ //
+ java.lang.Object obj = null;
+ try
+ {
+ java.lang.reflect.Constructor<?> con = c.getDeclaredConstructor(com.zeroc.Ice.Communicator.class);
+ obj = con.newInstance(_communicator);
+ }
+ catch(IllegalAccessException ex)
+ {
+ throw new FailureException(
+ "ServiceManager: unable to access service constructor " + className +
+ "(com.zeroc.Ice.Communicator)", ex);
+ }
+ catch(NoSuchMethodException ex)
+ {
+ // Ignore.
+ }
+ catch(java.lang.reflect.InvocationTargetException ex)
+ {
+ if(ex.getCause() != null)
+ {
+ throw ex.getCause();
+ }
+ else
+ {
+ throw new FailureException("ServiceManager: exception in service constructor for " +
+ className, ex);
+ }
+ }
+
+ if(obj == null)
+ {
+ //
+ // Fall back to the default constructor.
+ //
+ try
+ {
+ obj = c.newInstance();
+ }
+ catch(IllegalAccessException ex)
+ {
+ throw new FailureException(
+ "ServiceManager: unable to access default service constructor in class " + className, ex);
+ }
+ }
+
+ try
+ {
+ info.service = (Service)obj;
+ }
+ catch(ClassCastException ex)
+ {
+ throw new FailureException("ServiceManager: class " + className +
+ " does not implement com.zeroc.IceBox.Service");
+ }
+ }
+ catch(InstantiationException ex)
+ {
+ throw new FailureException("ServiceManager: unable to instantiate class " + className, ex);
+ }
+ catch(FailureException ex)
+ {
+ throw ex;
+ }
+ catch(Throwable ex)
+ {
+ throw new FailureException("ServiceManager: exception in service constructor for " + className, ex);
+ }
+
+ try
+ {
+ info.service.start(service, communicator, info.args);
+
+ //
+ // There is no need to notify the observers since the 'start all'
+ // (that indirectly calls this method) occurs before the creation of
+ // the Server Admin object, and before the activation of the main
+ // object adapter (so before any observer can be registered)
+ //
+ }
+ catch(FailureException ex)
+ {
+ throw ex;
+ }
+ catch(Throwable ex)
+ {
+ FailureException e = new FailureException();
+ e.reason = "ServiceManager: exception while starting service " + service;
+ e.initCause(ex);
+ throw e;
+ }
+
+ info.status = StatusStarted;
+ _services.add(info);
+ }
+ catch(RuntimeException ex)
+ {
+ if(info.communicator != null)
+ {
+ destroyServiceCommunicator(service, info.communicator);
+ }
+
+ throw ex;
+ }
+ }
+
+ private synchronized void stopAll()
+ {
+ //
+ // First wait for any active startService/stopService calls to complete.
+ //
+ while(_pendingStatusChanges)
+ {
+ try
+ {
+ wait();
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+
+ //
+ // For each service, we call stop on the service and flush its database environment to
+ // the disk. Services are stopped in the reverse order of the order they were started.
+ //
+ java.util.List<String> stoppedServices = new java.util.ArrayList<>();
+ java.util.ListIterator<ServiceInfo> p = _services.listIterator(_services.size());
+ while(p.hasPrevious())
+ {
+ ServiceInfo info = p.previous();
+ if(info.status == StatusStarted)
+ {
+ try
+ {
+ info.service.stop();
+ info.status = StatusStopped;
+ stoppedServices.add(info.name);
+ }
+ catch(Throwable e)
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ e.printStackTrace(pw);
+ pw.flush();
+ _logger.warning("ServiceManager: exception while stopping service " + info.name + ":\n" +
+ sw.toString());
+ }
+ }
+
+ if(info.communicator != null)
+ {
+ destroyServiceCommunicator(info.name, info.communicator);
+ }
+ }
+
+ if(_sharedCommunicator != null)
+ {
+ removeAdminFacets("IceBox.SharedCommunicator.");
+
+ try
+ {
+ _sharedCommunicator.destroy();
+ }
+ catch(java.lang.Exception e)
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ e.printStackTrace(pw);
+ pw.flush();
+ _logger.warning("ServiceManager: exception while destroying shared communicator:\n" + sw.toString());
+ }
+ _sharedCommunicator = null;
+ }
+
+ _services.clear();
+ servicesStopped(stoppedServices, _observers);
+ }
+
+ private void servicesStarted(java.util.List<String> services, java.util.Set<ServiceObserverPrx> observers)
+ {
+ if(services.size() > 0)
+ {
+ String[] servicesArray = services.toArray(new String[0]);
+
+ for(final ServiceObserverPrx observer: observers)
+ {
+ observer.servicesStartedAsync(servicesArray).exceptionally(ex ->
+ {
+ observerFailed(observer, ex);
+ return null;
+ });
+ }
+ }
+ }
+
+ private void servicesStopped(java.util.List<String> services, java.util.Set<ServiceObserverPrx> observers)
+ {
+ if(services.size() > 0)
+ {
+ String[] servicesArray = services.toArray(new String[0]);
+
+ for(final ServiceObserverPrx observer: observers)
+ {
+ observer.servicesStoppedAsync(servicesArray).exceptionally(ex ->
+ {
+ observerFailed(observer, ex);
+ return null;
+ });
+ }
+ }
+ }
+
+ private synchronized void observerFailed(ServiceObserverPrx observer, Throwable ex)
+ {
+ if(ex instanceof com.zeroc.Ice.LocalException)
+ {
+ if(_observers.remove(observer))
+ {
+ observerRemoved(observer, (com.zeroc.Ice.LocalException)ex);
+ }
+ }
+ }
+
+ private void observerRemoved(ServiceObserverPrx observer, RuntimeException ex)
+ {
+ if(_traceServiceObserver >= 1)
+ {
+ //
+ // CommunicatorDestroyedException may occur during shutdown. The observer notification has
+ // been sent, but the communicator was destroyed before the reply was received. We do not
+ // log a message for this exception.
+ //
+ if(!(ex instanceof com.zeroc.Ice.CommunicatorDestroyedException))
+ {
+ _logger.trace("IceBox.ServiceObserver",
+ "Removed service observer " + _communicator.proxyToString(observer)
+ + "\nafter catching " + ex.toString());
+ }
+ }
+ }
+
+ public final static int StatusStopping = 0;
+ public final static int StatusStopped = 1;
+ public final static int StatusStarting = 2;
+ public final static int StatusStarted = 3;
+
+ static final class ServiceInfo implements Cloneable
+ {
+ @Override
+ public ServiceInfo clone()
+ {
+ ServiceInfo c = null;
+ try
+ {
+ c = (ServiceInfo)super.clone();
+ }
+ catch(CloneNotSupportedException ex)
+ {
+ }
+ return c;
+ }
+
+ public String name;
+ public Service service;
+ public com.zeroc.Ice.Communicator communicator;
+ public int status;
+ public String[] args;
+ }
+
+ static class StartServiceInfo
+ {
+ StartServiceInfo(String service, String value, String[] serverArgs)
+ {
+ name = service;
+
+ //
+ // We support the following formats:
+ //
+ // <class-name> [args]
+ // <jar-file>:<class-name> [args]
+ // <class-dir>:<class-name> [args]
+ // "<path with spaces>":<class-name> [args]
+ // "<path with spaces>:<class-name>" [args]
+ //
+
+ try
+ {
+ args = com.zeroc.IceUtilInternal.Options.split(value);
+ }
+ catch(com.zeroc.IceUtilInternal.Options.BadQuote ex)
+ {
+ throw new FailureException("ServiceManager: invalid arguments for service `" + name + "':\n" +
+ ex.getMessage());
+ }
+
+ assert(args.length > 0);
+
+ final String entryPoint = args[0];
+
+ final boolean isWindows = System.getProperty("os.name").startsWith("Windows");
+ absolutePath = false;
+
+ //
+ // Find first ':' that isn't part of the file path.
+ //
+ int pos = entryPoint.indexOf(':');
+ if(isWindows)
+ {
+ final String driveLetters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ if(pos == 1 && entryPoint.length() > 2 && driveLetters.indexOf(entryPoint.charAt(0)) != -1 &&
+ (entryPoint.charAt(2) == '\\' || entryPoint.charAt(2) == '/'))
+ {
+ absolutePath = true;
+ pos = entryPoint.indexOf(':', pos + 1);
+ }
+ if(!absolutePath)
+ {
+ absolutePath = entryPoint.startsWith("\\\\");
+ }
+ }
+ else
+ {
+ absolutePath = entryPoint.startsWith("/");
+ }
+
+ if((pos == -1 && absolutePath) || (pos != -1 && entryPoint.length() <= pos + 1))
+ {
+ //
+ // Class name is missing.
+ //
+ throw new FailureException("ServiceManager: invalid entry point for service `" + name + "':\n" +
+ entryPoint);
+ }
+
+ //
+ // Extract the JAR file or subdirectory, if any.
+ //
+ classDir = null; // Path name of JAR file or subdirectory.
+
+ if(pos == -1)
+ {
+ className = entryPoint;
+ }
+ else
+ {
+ classDir = entryPoint.substring(0, pos).trim();
+ className = entryPoint.substring(pos + 1).trim();
+ }
+
+ //
+ // Shift the arguments.
+ //
+ String[] tmp = new String[args.length - 1];
+ System.arraycopy(args, 1, tmp, 0, args.length - 1);
+ args = tmp;
+
+ if(serverArgs.length > 0)
+ {
+ java.util.List<String> l = new java.util.ArrayList<>(java.util.Arrays.asList(args));
+ for(String arg : serverArgs)
+ {
+ if(arg.startsWith("--" + service + "."))
+ {
+ l.add(arg);
+ }
+ }
+ args = l.toArray(args);
+ }
+ }
+
+ String name;
+ String[] args;
+ String className;
+ String classDir;
+ boolean absolutePath;
+ }
+
+ private Properties createServiceProperties(String service)
+ {
+ Properties properties;
+ Properties communicatorProperties = _communicator.getProperties();
+ if(communicatorProperties.getPropertyAsInt("IceBox.InheritProperties") > 0)
+ {
+ properties = communicatorProperties._clone();
+ // Inherit all except Ice.Admin.xxx properties
+ for(String p : properties.getPropertiesForPrefix("Ice.Admin.").keySet())
+ {
+ properties.setProperty(p, "");
+ }
+ }
+ else
+ {
+ properties = Util.createProperties();
+ }
+
+ String programName = communicatorProperties.getProperty("Ice.ProgramName");
+ if(programName.length() == 0)
+ {
+ properties.setProperty("Ice.ProgramName", service);
+ }
+ else
+ {
+ properties.setProperty("Ice.ProgramName", programName + "-" + service);
+ }
+ return properties;
+ }
+
+ private void destroyServiceCommunicator(String service, com.zeroc.Ice.Communicator communicator)
+ {
+ try
+ {
+ communicator.shutdown();
+ communicator.waitForShutdown();
+ }
+ catch(com.zeroc.Ice.CommunicatorDestroyedException e)
+ {
+ //
+ // Ignore, the service might have already destroyed
+ // the communicator for its own reasons.
+ //
+ }
+ catch(java.lang.Exception e)
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ e.printStackTrace(pw);
+ pw.flush();
+ _logger.warning("ServiceManager: exception in shutting down communicator for service "
+ + service + "\n" + sw.toString());
+ }
+
+ removeAdminFacets("IceBox.Service." + service + ".");
+
+ try
+ {
+ communicator.destroy();
+ }
+ catch(java.lang.Exception e)
+ {
+ java.io.StringWriter sw = new java.io.StringWriter();
+ java.io.PrintWriter pw = new java.io.PrintWriter(sw);
+ e.printStackTrace(pw);
+ pw.flush();
+ _logger.warning("ServiceManager: exception in destroying communicator for service "
+ + service + "\n" + sw.toString());
+ }
+ }
+
+ private boolean configureAdmin(Properties properties, String prefix)
+ {
+ if(_adminEnabled && properties.getProperty("Ice.Admin.Enabled").isEmpty())
+ {
+ java.util.List<String> facetNames = new java.util.LinkedList<>();
+ for(String p : _adminFacetFilter)
+ {
+ if(p.startsWith(prefix))
+ {
+ facetNames.add(p.substring(prefix.length()));
+ }
+ }
+
+ if(_adminFacetFilter.isEmpty() || !facetNames.isEmpty())
+ {
+ properties.setProperty("Ice.Admin.Enabled", "1");
+
+ if(!facetNames.isEmpty())
+ {
+ // TODO: need joinString with escape!
+ properties.setProperty("Ice.Admin.Facets",
+ com.zeroc.IceUtilInternal.StringUtil.joinString(facetNames, " "));
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void removeAdminFacets(String prefix)
+ {
+ try
+ {
+ for(String p : _communicator.findAllAdminFacets().keySet())
+ {
+ if(p.startsWith(prefix))
+ {
+ _communicator.removeAdminFacet(p);
+ }
+ }
+ }
+ catch(com.zeroc.Ice.CommunicatorDestroyedException ex)
+ {
+ // Ignored
+ }
+ catch(com.zeroc.Ice.ObjectAdapterDeactivatedException ex)
+ {
+ // Ignored
+ }
+ }
+
+
+ private com.zeroc.Ice.Communicator _communicator;
+ private boolean _adminEnabled = false;
+ private java.util.Set<String> _adminFacetFilter;
+ private com.zeroc.Ice.Communicator _sharedCommunicator;
+ private com.zeroc.Ice.Logger _logger;
+ private String[] _argv; // Filtered server argument vector
+ private java.util.List<ServiceInfo> _services = new java.util.LinkedList<>();
+ private boolean _pendingStatusChanges = false;
+ private java.util.HashSet<ServiceObserverPrx> _observers = new java.util.HashSet<>();
+ private int _traceServiceObserver = 0;
+ private java.util.Map<String, ClassLoader> _classLoaders;
+}
diff --git a/java/src/IceDiscovery/build.gradle b/java/src/IceDiscovery/build.gradle
index 9c7b78cfcc1..75e09daf79a 100644
--- a/java/src/IceDiscovery/build.gradle
+++ b/java/src/IceDiscovery/build.gradle
@@ -7,8 +7,10 @@
//
// **********************************************************************
-sourceCompatibility = iceSourceCompatibility
-targetCompatibility = iceTargetCompatibility
+//sourceCompatibility = iceSourceCompatibility
+//targetCompatibility = iceTargetCompatibility
+sourceCompatibility = 1.8
+targetCompatibility = 1.8
project.ext.displayName = "IceDiscovery"
project.ext.description = "Allow Ice applications to discover objects and object adapters"
diff --git a/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LocatorI.java b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LocatorI.java
new file mode 100644
index 00000000000..a46267911ca
--- /dev/null
+++ b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LocatorI.java
@@ -0,0 +1,49 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceDiscovery;
+
+import java.util.concurrent.CompletionStage;
+import java.util.concurrent.CompletableFuture;
+
+class LocatorI implements com.zeroc.Ice.Locator
+{
+ public LocatorI(LookupI lookup, com.zeroc.Ice.LocatorRegistryPrx registry)
+ {
+ _lookup = lookup;
+ _registry = registry;
+ }
+
+ @Override
+ public CompletionStage<com.zeroc.Ice.ObjectPrx> findObjectByIdAsync(com.zeroc.Ice.Identity id,
+ com.zeroc.Ice.Current current)
+ {
+ CompletableFuture<com.zeroc.Ice.ObjectPrx> f = new CompletableFuture<com.zeroc.Ice.ObjectPrx>();
+ _lookup.findObject(f, id);
+ return f;
+ }
+
+ @Override
+ public CompletionStage<com.zeroc.Ice.ObjectPrx> findAdapterByIdAsync(String adapterId,
+ com.zeroc.Ice.Current current)
+ {
+ CompletableFuture<com.zeroc.Ice.ObjectPrx> f = new CompletableFuture<com.zeroc.Ice.ObjectPrx>();
+ _lookup.findAdapter(f, adapterId);
+ return f;
+ }
+
+ @Override
+ public com.zeroc.Ice.LocatorRegistryPrx getRegistry(com.zeroc.Ice.Current current)
+ {
+ return _registry;
+ }
+
+ private final LookupI _lookup;
+ private final com.zeroc.Ice.LocatorRegistryPrx _registry;
+}
diff --git a/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LocatorRegistryI.java b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LocatorRegistryI.java
new file mode 100644
index 00000000000..b256daa07ca
--- /dev/null
+++ b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LocatorRegistryI.java
@@ -0,0 +1,186 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceDiscovery;
+
+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.concurrent.CompletionStage;
+import java.util.concurrent.CompletableFuture;
+
+class LocatorRegistryI implements com.zeroc.Ice.LocatorRegistry
+{
+ public LocatorRegistryI(com.zeroc.Ice.Communicator com)
+ {
+ _wellKnownProxy = com.stringToProxy("p").ice_locator(null).ice_router(null).ice_collocationOptimized(true);
+ }
+
+ @Override
+ synchronized public CompletionStage<Void> setAdapterDirectProxyAsync(
+ String adapterId,
+ com.zeroc.Ice.ObjectPrx proxy,
+ com.zeroc.Ice.Current current)
+ {
+ if(proxy != null)
+ {
+ _adapters.put(adapterId, proxy);
+ }
+ else
+ {
+ _adapters.remove(adapterId);
+ }
+ return CompletableFuture.completedFuture((Void)null);
+ }
+
+ @Override
+ synchronized public CompletionStage<Void> setReplicatedAdapterDirectProxyAsync(
+ String adapterId,
+ String replicaGroupId,
+ com.zeroc.Ice.ObjectPrx proxy,
+ com.zeroc.Ice.Current current)
+ {
+ if(proxy != null)
+ {
+ _adapters.put(adapterId, proxy);
+ Set<String> s = _replicaGroups.get(replicaGroupId);
+ if(s == null)
+ {
+ s = new HashSet<>();
+ _replicaGroups.put(replicaGroupId, s);
+ }
+ s.add(adapterId);
+ }
+ else
+ {
+ _adapters.remove(adapterId);
+ Set<String> s = _replicaGroups.get(replicaGroupId);
+ if(s != null)
+ {
+ s.remove(adapterId);
+ if(s.isEmpty())
+ {
+ _replicaGroups.remove(adapterId);
+ }
+ }
+ }
+ return CompletableFuture.completedFuture((Void)null);
+ }
+
+ @Override
+ public CompletionStage<Void> setServerProcessProxyAsync(
+ String serverId,
+ com.zeroc.Ice.ProcessPrx process,
+ com.zeroc.Ice.Current current)
+ {
+ return CompletableFuture.completedFuture((Void)null);
+ }
+
+ synchronized com.zeroc.Ice.ObjectPrx findObject(com.zeroc.Ice.Identity id)
+ {
+ if(id.name.length() == 0)
+ {
+ return null;
+ }
+
+ com.zeroc.Ice.ObjectPrx prx = _wellKnownProxy.ice_identity(id);
+
+ List<String> adapterIds = new ArrayList<>();
+ for(String a : _replicaGroups.keySet())
+ {
+ try
+ {
+ prx.ice_adapterId(a).ice_ping();
+ adapterIds.add(a);
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ }
+ }
+ if(adapterIds.isEmpty())
+ {
+ for(String a : _adapters.keySet())
+ {
+ try
+ {
+ prx.ice_adapterId(a).ice_ping();
+ adapterIds.add(a);
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ }
+ }
+ }
+
+ if(adapterIds.isEmpty())
+ {
+ return null;
+ }
+ java.util.Collections.shuffle(adapterIds);
+ return prx.ice_adapterId(adapterIds.get(0));
+ }
+
+ static class FindAdapterResult
+ {
+ com.zeroc.Ice.ObjectPrx returnValue;
+ boolean isReplicaGroup;
+ }
+
+ synchronized FindAdapterResult findAdapter(String adapterId)
+ {
+ FindAdapterResult r = new FindAdapterResult();
+
+ com.zeroc.Ice.ObjectPrx proxy = _adapters.get(adapterId);
+ if(proxy != null)
+ {
+ r.isReplicaGroup = false;
+ r.returnValue = proxy;
+ return r;
+ }
+
+ Set<String> s = _replicaGroups.get(adapterId);
+ if(s != null)
+ {
+ List<com.zeroc.Ice.Endpoint> endpoints = new ArrayList<>();
+ com.zeroc.Ice.ObjectPrx prx = null;
+ for(String a : s)
+ {
+ proxy = _adapters.get(a);
+ if(proxy == null)
+ {
+ continue; // TODO: Inconsistency
+ }
+
+ if(prx == null)
+ {
+ prx = proxy;
+ }
+
+ endpoints.addAll(java.util.Arrays.asList(proxy.ice_getEndpoints()));
+ }
+
+ if(prx != null)
+ {
+ r.isReplicaGroup = true;
+ r.returnValue = prx.ice_endpoints(endpoints.toArray(new com.zeroc.Ice.Endpoint[endpoints.size()]));
+ return r;
+ }
+ }
+ r.isReplicaGroup = false;
+ r.returnValue = null;
+ return r;
+ }
+
+ final com.zeroc.Ice.ObjectPrx _wellKnownProxy;
+ final Map<String, com.zeroc.Ice.ObjectPrx> _adapters = new HashMap<>();
+ final Map<String, Set<String>> _replicaGroups = new HashMap<>();
+}
diff --git a/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LookupI.java b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LookupI.java
new file mode 100644
index 00000000000..5190180b12e
--- /dev/null
+++ b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LookupI.java
@@ -0,0 +1,378 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceDiscovery;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.concurrent.CompletableFuture;
+
+class LookupI implements Lookup
+{
+ abstract private class Request<T, Ret> implements Runnable
+ {
+ Request(T id, int retryCount)
+ {
+ _id = id;
+ _nRetry = retryCount;
+ }
+
+ T getId()
+ {
+ return _id;
+ }
+
+ boolean addFuture(CompletableFuture<Ret> f)
+ {
+ _futures.add(f);
+ return _futures.size() == 1;
+ }
+
+ boolean retry()
+ {
+ return --_nRetry >= 0;
+ }
+
+ void scheduleTimer(long timeout)
+ {
+ _future = _timer.schedule(this, timeout, java.util.concurrent.TimeUnit.MILLISECONDS);
+ }
+
+ void cancelTimer()
+ {
+ assert _future != null;
+ _future.cancel(false);
+ _future = null;
+ }
+
+ protected int _nRetry;
+ protected List<CompletableFuture<Ret>> _futures = new ArrayList<>();
+ private T _id;
+ protected java.util.concurrent.Future<?> _future;
+ }
+
+ private class AdapterRequest extends Request<String, com.zeroc.Ice.ObjectPrx>
+ {
+ AdapterRequest(String id, int retryCount)
+ {
+ super(id, retryCount);
+ _start = System.nanoTime();
+ _latency = 0;
+ }
+
+ @Override
+ boolean retry()
+ {
+ return _proxies.size() == 0 && --_nRetry >= 0;
+ }
+
+ boolean response(com.zeroc.Ice.ObjectPrx proxy, boolean isReplicaGroup)
+ {
+ if(isReplicaGroup)
+ {
+ _proxies.add(proxy);
+ if(_latency == 0)
+ {
+ _latency = (long)((System.nanoTime() - _start) * _latencyMultiplier / 100000.0);
+ if(_latency == 0)
+ {
+ _latency = 1; // 1ms
+ }
+ cancelTimer();
+ scheduleTimer(_latency);
+ }
+ return false;
+ }
+ finished(proxy);
+ return true;
+ }
+
+ void finished(com.zeroc.Ice.ObjectPrx proxy)
+ {
+ if(proxy != null || _proxies.isEmpty())
+ {
+ sendResponse(proxy);
+ return;
+ }
+ else if(_proxies.size() == 1)
+ {
+ sendResponse(_proxies.get(0));
+ return;
+ }
+
+ List<com.zeroc.Ice.Endpoint> endpoints = new ArrayList<>();
+ com.zeroc.Ice.ObjectPrx result = null;
+ for(com.zeroc.Ice.ObjectPrx prx : _proxies)
+ {
+ if(result == null)
+ {
+ result = prx;
+ }
+ endpoints.addAll(java.util.Arrays.asList(prx.ice_getEndpoints()));
+ }
+ sendResponse(result.ice_endpoints(endpoints.toArray(new com.zeroc.Ice.Endpoint[endpoints.size()])));
+ }
+
+ @Override
+ public void run()
+ {
+ adapterRequestTimedOut(this);
+ }
+
+ private void sendResponse(com.zeroc.Ice.ObjectPrx proxy)
+ {
+ for(CompletableFuture<com.zeroc.Ice.ObjectPrx> f : _futures)
+ {
+ f.complete(proxy);
+ }
+ _futures.clear();
+ }
+
+ private List<com.zeroc.Ice.ObjectPrx> _proxies = new ArrayList<>();
+ private long _start;
+ private long _latency;
+ }
+
+ private class ObjectRequest extends Request<com.zeroc.Ice.Identity, com.zeroc.Ice.ObjectPrx>
+ {
+ ObjectRequest(com.zeroc.Ice.Identity id, int retryCount)
+ {
+ super(id, retryCount);
+ }
+
+ void response(com.zeroc.Ice.ObjectPrx proxy)
+ {
+ finished(proxy);
+ }
+
+ void finished(com.zeroc.Ice.ObjectPrx proxy)
+ {
+ for(CompletableFuture<com.zeroc.Ice.ObjectPrx> f : _futures)
+ {
+ f.complete(proxy);
+ }
+ _futures.clear();
+ }
+
+ @Override
+ public void run()
+ {
+ objectRequestTimedOut(this);
+ }
+ }
+
+ public LookupI(LocatorRegistryI registry, LookupPrx lookup, com.zeroc.Ice.Properties properties)
+ {
+ _registry = registry;
+ _lookup = lookup;
+ _timeout = properties.getPropertyAsIntWithDefault("IceDiscovery.Timeout", 300);
+ _retryCount = properties.getPropertyAsIntWithDefault("IceDiscovery.RetryCount", 3);
+ _latencyMultiplier = properties.getPropertyAsIntWithDefault("IceDiscovery.LatencyMultiplier", 1);
+ _domainId = properties.getProperty("IceDiscovery.DomainId");
+ _timer = com.zeroc.IceInternal.Util.getInstance(lookup.ice_getCommunicator()).timer();
+ }
+
+ void setLookupReply(LookupReplyPrx lookupReply)
+ {
+ _lookupReply = lookupReply;
+ }
+
+ @Override
+ public void findObjectById(String domainId, com.zeroc.Ice.Identity id, com.zeroc.IceDiscovery.LookupReplyPrx reply,
+ com.zeroc.Ice.Current c)
+ {
+ if(!domainId.equals(_domainId))
+ {
+ return; // Ignore.
+ }
+
+ com.zeroc.Ice.ObjectPrx proxy = _registry.findObject(id);
+ if(proxy != null)
+ {
+ //
+ // Reply to the mulicast request using the given proxy.
+ //
+ try
+ {
+ reply.foundObjectByIdAsync(id, proxy);
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ // Ignore
+ }
+ }
+ }
+
+ @Override
+ public void findAdapterById(String domainId, String adapterId, com.zeroc.IceDiscovery.LookupReplyPrx reply,
+ com.zeroc.Ice.Current c)
+ {
+ if(!domainId.equals(_domainId))
+ {
+ return; // Ignore.
+ }
+
+ LocatorRegistryI.FindAdapterResult r = _registry.findAdapter(adapterId);
+ if(r.returnValue != null)
+ {
+ //
+ // Reply to the multicast request using the given proxy.
+ //
+ try
+ {
+ reply.foundAdapterByIdAsync(adapterId, r.returnValue, r.isReplicaGroup);
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ // Ignore
+ }
+ }
+ }
+
+ synchronized void findObject(CompletableFuture<com.zeroc.Ice.ObjectPrx> f, com.zeroc.Ice.Identity id)
+ {
+ ObjectRequest request = _objectRequests.get(id);
+ if(request == null)
+ {
+ request = new ObjectRequest(id, _retryCount);
+ _objectRequests.put(id, request);
+ }
+
+ if(request.addFuture(f))
+ {
+ try
+ {
+ _lookup.findObjectByIdAsync(_domainId, id, _lookupReply);
+ request.scheduleTimer(_timeout);
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ request.finished(null);
+ _objectRequests.remove(id);
+ }
+ }
+ }
+
+ synchronized void findAdapter(CompletableFuture<com.zeroc.Ice.ObjectPrx> f, String adapterId)
+ {
+ AdapterRequest request = _adapterRequests.get(adapterId);
+ if(request == null)
+ {
+ request = new AdapterRequest(adapterId, _retryCount);
+ _adapterRequests.put(adapterId, request);
+ }
+
+ if(request.addFuture(f))
+ {
+ try
+ {
+ _lookup.findAdapterByIdAsync(_domainId, adapterId, _lookupReply);
+ request.scheduleTimer(_timeout);
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ request.finished(null);
+ _adapterRequests.remove(adapterId);
+ }
+ }
+ }
+
+ synchronized void foundObject(com.zeroc.Ice.Identity id, com.zeroc.Ice.ObjectPrx proxy)
+ {
+ ObjectRequest request = _objectRequests.get(id);
+ if(request == null)
+ {
+ return;
+ }
+
+ request.response(proxy);
+ request.cancelTimer();
+ _objectRequests.remove(id);
+ }
+
+ synchronized void foundAdapter(String adapterId, com.zeroc.Ice.ObjectPrx proxy, boolean isReplicaGroup)
+ {
+ AdapterRequest request = _adapterRequests.get(adapterId);
+ if(request == null)
+ {
+ return;
+ }
+
+ if(request.response(proxy, isReplicaGroup))
+ {
+ request.cancelTimer();
+ _adapterRequests.remove(adapterId);
+ }
+ }
+
+ synchronized void objectRequestTimedOut(ObjectRequest request)
+ {
+ ObjectRequest r = _objectRequests.get(request.getId());
+ if(r == null || request != r)
+ {
+ return;
+ }
+
+ if(request.retry())
+ {
+ try
+ {
+ _lookup.findObjectByIdAsync(_domainId, request.getId(), _lookupReply);
+ request.scheduleTimer(_timeout);
+ return;
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ }
+ }
+
+ request.finished(null);
+ _objectRequests.remove(request.getId());
+ }
+
+ synchronized void adapterRequestTimedOut(AdapterRequest request)
+ {
+ AdapterRequest r = _adapterRequests.get(request.getId());
+ if(r == null || r != request)
+ {
+ return;
+ }
+
+ if(request.retry())
+ {
+ try
+ {
+ _lookup.findAdapterByIdAsync(_domainId, request.getId(), _lookupReply);
+ request.scheduleTimer(_timeout);
+ return;
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ }
+ }
+
+ request.finished(null);
+ _adapterRequests.remove(request.getId());
+ }
+
+ private LocatorRegistryI _registry;
+ private final LookupPrx _lookup;
+ private LookupReplyPrx _lookupReply;
+ private final int _timeout;
+ private final int _retryCount;
+ private final int _latencyMultiplier;
+ private final String _domainId;
+
+ private final java.util.concurrent.ScheduledExecutorService _timer;
+
+ private Map<com.zeroc.Ice.Identity, ObjectRequest> _objectRequests = new HashMap<>();
+ private Map<String, AdapterRequest> _adapterRequests = new HashMap<>();
+}
diff --git a/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LookupReplyI.java b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LookupReplyI.java
new file mode 100644
index 00000000000..dd7585faede
--- /dev/null
+++ b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LookupReplyI.java
@@ -0,0 +1,33 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceDiscovery;
+
+class LookupReplyI implements LookupReply
+{
+ public LookupReplyI(LookupI lookup)
+ {
+ _lookup = lookup;
+ }
+
+ @Override
+ public void foundObjectById(com.zeroc.Ice.Identity id, com.zeroc.Ice.ObjectPrx proxy, com.zeroc.Ice.Current current)
+ {
+ _lookup.foundObject(id, proxy);
+ }
+
+ @Override
+ public void foundAdapterById(String adapterId, com.zeroc.Ice.ObjectPrx proxy, boolean isReplicaGroup,
+ com.zeroc.Ice.Current current)
+ {
+ _lookup.foundAdapter(adapterId, proxy, isReplicaGroup);
+ }
+
+ private final LookupI _lookup;
+}
diff --git a/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/PluginFactory.java b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/PluginFactory.java
new file mode 100644
index 00000000000..15bbd2ab04f
--- /dev/null
+++ b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/PluginFactory.java
@@ -0,0 +1,19 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceDiscovery;
+
+public class PluginFactory implements com.zeroc.Ice.PluginFactory
+{
+ @Override
+ public com.zeroc.Ice.Plugin create(com.zeroc.Ice.Communicator communicator, String name, String[] args)
+ {
+ return new PluginI(communicator);
+ }
+}
diff --git a/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/PluginI.java b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/PluginI.java
new file mode 100644
index 00000000000..0c2f494a02b
--- /dev/null
+++ b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/PluginI.java
@@ -0,0 +1,135 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceDiscovery;
+
+public class PluginI implements com.zeroc.Ice.Plugin
+{
+ public PluginI(com.zeroc.Ice.Communicator communicator)
+ {
+ _communicator = communicator;
+ }
+
+ @Override
+ public void initialize()
+ {
+ com.zeroc.Ice.Properties properties = _communicator.getProperties();
+
+ boolean ipv4 = properties.getPropertyAsIntWithDefault("Ice.IPv4", 1) > 0;
+ boolean preferIPv6 = properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0;
+ String address;
+ if(ipv4 && !preferIPv6)
+ {
+ address = properties.getPropertyWithDefault("IceDiscovery.Address", "239.255.0.1");
+ }
+ else
+ {
+ address = properties.getPropertyWithDefault("IceDiscovery.Address", "ff15::1");
+ }
+ int port = properties.getPropertyAsIntWithDefault("IceDiscovery.Port", 4061);
+ String intf = properties.getProperty("IceDiscovery.Interface");
+
+ if(properties.getProperty("IceDiscovery.Multicast.Endpoints").isEmpty())
+ {
+ StringBuilder s = new StringBuilder();
+ s.append("udp -h \"").append(address).append("\" -p ").append(port);
+ if(!intf.isEmpty())
+ {
+ s.append(" --interface \"").append(intf).append("\"");
+ }
+ properties.setProperty("IceDiscovery.Multicast.Endpoints", s.toString());
+ }
+ if(properties.getProperty("IceDiscovery.Reply.Endpoints").isEmpty())
+ {
+ StringBuilder s = new StringBuilder();
+ s.append("udp");
+ if(!intf.isEmpty())
+ {
+ s.append(" -h \"").append(intf).append("\"");
+ }
+ properties.setProperty("IceDiscovery.Reply.Endpoints", s.toString());
+ }
+ if(properties.getProperty("IceDiscovery.Locator.Endpoints").isEmpty())
+ {
+ properties.setProperty("IceDiscovery.Locator.AdapterId", java.util.UUID.randomUUID().toString());
+ }
+
+ _multicastAdapter = _communicator.createObjectAdapter("IceDiscovery.Multicast");
+ _replyAdapter = _communicator.createObjectAdapter("IceDiscovery.Reply");
+ _locatorAdapter = _communicator.createObjectAdapter("IceDiscovery.Locator");
+
+ //
+ // Setup locatory registry.
+ //
+ LocatorRegistryI locatorRegistry = new LocatorRegistryI(_communicator);
+ com.zeroc.Ice.LocatorRegistryPrx locatorRegistryPrx = com.zeroc.Ice.LocatorRegistryPrx.uncheckedCast(
+ _locatorAdapter.addWithUUID(locatorRegistry));
+
+ String lookupEndpoints = properties.getProperty("IceDiscovery.Lookup");
+ if(lookupEndpoints.isEmpty())
+ {
+ StringBuilder s = new StringBuilder();
+ s.append("udp -h \"").append(address).append("\" -p ").append(port);
+ if(!intf.isEmpty())
+ {
+ s.append(" --interface \"").append(intf).append("\"");
+ }
+ lookupEndpoints = s.toString();
+ }
+
+ com.zeroc.Ice.ObjectPrx lookupPrx = _communicator.stringToProxy("IceDiscovery/Lookup -d:" + lookupEndpoints);
+ lookupPrx = lookupPrx.ice_collocationOptimized(false); // No collocation optimization for the multicast proxy!
+ try
+ {
+ lookupPrx.ice_getConnection();
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ StringBuilder b = new StringBuilder();
+ b.append("IceDiscovery is unable to establish a multicast connection:\n");
+ b.append("proxy = ");
+ b.append(lookupPrx.toString());
+ b.append('\n');
+ b.append(ex.toString());
+ throw new com.zeroc.Ice.PluginInitializationException(b.toString());
+ }
+
+ //
+ // Add lookup and lookup reply Ice objects
+ //
+ LookupI lookup = new LookupI(locatorRegistry, LookupPrx.uncheckedCast(lookupPrx), properties);
+ _multicastAdapter.add(lookup, com.zeroc.Ice.Util.stringToIdentity("IceDiscovery/Lookup"));
+
+ com.zeroc.Ice.ObjectPrx lookupReply = _replyAdapter.addWithUUID(new LookupReplyI(lookup)).ice_datagram();
+ lookup.setLookupReply(LookupReplyPrx.uncheckedCast(lookupReply));
+
+ //
+ // Setup locator on the communicator.
+ //
+ com.zeroc.Ice.ObjectPrx locator = _locatorAdapter.addWithUUID(new LocatorI(lookup, locatorRegistryPrx));
+ _communicator.setDefaultLocator(com.zeroc.Ice.LocatorPrx.uncheckedCast(locator));
+
+ _multicastAdapter.activate();
+ _replyAdapter.activate();
+ _locatorAdapter.activate();
+ }
+
+ @Override
+ public void destroy()
+ {
+ _multicastAdapter.destroy();
+ _replyAdapter.destroy();
+ _locatorAdapter.destroy();
+ }
+
+ private com.zeroc.Ice.Communicator _communicator;
+ private com.zeroc.Ice.ObjectAdapter _multicastAdapter;
+ private com.zeroc.Ice.ObjectAdapter _replyAdapter;
+ private com.zeroc.Ice.ObjectAdapter _locatorAdapter;
+}
diff --git a/java/src/IceGrid/build.gradle b/java/src/IceGrid/build.gradle
index 8e72c858086..30ec3c3d50d 100644
--- a/java/src/IceGrid/build.gradle
+++ b/java/src/IceGrid/build.gradle
@@ -7,8 +7,10 @@
//
// **********************************************************************
-sourceCompatibility = iceSourceCompatibility
-targetCompatibility = iceTargetCompatibility
+//sourceCompatibility = iceSourceCompatibility
+//targetCompatibility = iceTargetCompatibility
+sourceCompatibility = 1.8
+targetCompatibility = 1.8
project.ext.displayName = "IceGrid"
project.ext.description = "Locate, deploy, and manage Ice servers"
@@ -16,7 +18,7 @@ project.ext.description = "Locate, deploy, and manage Ice servers"
slice {
java {
set1 {
- args = "--ice --tie --checksum IceGrid.SliceChecksums"
+ args = "--ice --checksum com.zeroc.IceGrid.SliceChecksums"
files = fileTree(dir: "$sliceDir/IceGrid", includes:['*.ice'], excludes:["*F.ice"])
}
}
diff --git a/java/src/IceGridGUI/build.gradle b/java/src/IceGridGUI/build.gradle
index fa6a55a150f..fe6fc517a29 100644
--- a/java/src/IceGridGUI/build.gradle
+++ b/java/src/IceGridGUI/build.gradle
@@ -7,10 +7,12 @@
//
// **********************************************************************
-sourceCompatibility = iceSourceCompatibility
-targetCompatibility = iceTargetCompatibility
+//sourceCompatibility = iceSourceCompatibility
+//targetCompatibility = iceTargetCompatibility
+sourceCompatibility = 1.8
+targetCompatibility = 1.8
-project.ext.displayName = "IceGridGUI"
+project.ext.displayName = "IceGridGUI Compat"
project.ext.description = ""
def macosx = System.properties['os.name'] == "Mac OS X"
@@ -61,7 +63,7 @@ jar {
archiveName = tmpJarName
if (!hasJavaFx) {
manifest {
- attributes 'Main-Class': "IceGridGUI.Main"
+ attributes 'Main-Class': "com.zeroc.IceGridGUI.Main"
}
}
}
@@ -107,13 +109,13 @@ if(icegridguiProguard.toBoolean()) {
if (hasJavaFx) {
ant.jar(update: true, destfile: "${libDir}/${jarName}") {
delegate.manifest {
- attribute(name: 'Main-Class', value: 'IceGridGUI.MainProxy')
+ attribute(name: 'Main-Class', value: 'com.zeroc.IceGridGUI.MainProxy')
attribute(name: 'Built-By', value: 'Zeroc, Inc.')
}
}
}
}
-
+
task copyJars(type: Copy, dependsOn: updateManifest) {
from new File("${libDir}/${jarName}")
into "${DESTDIR}${jarDir}"
@@ -127,11 +129,11 @@ if(icegridguiProguard.toBoolean()) {
rename("${tmpJarName}", "${jarName}")
}
-
+
task updateManifest(dependsOn: copyTmpJars) << {
ant.jar(update: true, destfile: "${libDir}/${jarName}") {
delegate.manifest {
- attribute(name: "Main-Class", value: "IceGridGUI.Main")
+ attribute(name: "Main-Class", value: "com.zeroc.IceGridGUI.Main")
attribute(name: "Built-By", value: "ZeroC, Inc.")
attribute(name: "Class-Path", value: configurations.runtime.resolve().collect { "file://${it.absolutePath}" }.join(' '))
}
@@ -146,7 +148,7 @@ if(icegridguiProguard.toBoolean()) {
into "${DESTDIR}${jarDir}"
rename("${tmpJarName}", "${jarName}")
}
-
+
//
// We need to update the manifest of the installed IceGridGUI jar and fix the
// Class-Path to point to the installed JAR files.
@@ -154,17 +156,17 @@ if(icegridguiProguard.toBoolean()) {
task updateInstallManifest(dependsOn: copyJars) << {
ant.jar(update: true, destfile: "${DESTDIR}${jarDir}/${jarName}") {
delegate.manifest {
- attribute(name: "Main-Class", value: "IceGridGUI.Main")
+ attribute(name: "Main-Class", value: "com.zeroc.IceGridGUI.Main")
attribute(name: "Built-By", value: "ZeroC, Inc.")
attribute(name: "Class-Path", value: configurations.runtime.resolve().collect { "file://${it.absolutePath}" }.join(' ').replaceAll("${libDir}", "${jarDir}"))
}
}
}
-
+
//
// We need to sign the install JARs after updating the manifest.
//
- task signInstalJar(dependsOn: updateInstallManifest) << {
+ task signInstalJar(dependsOn: updateInstallManifest) << {
if(keystore != null && keystore.length() > 0) {
ant.signjar(jar: "${DESTDIR}${jarDir}/${jarName}",
alias: "zeroc.com",
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/MetricsView.java b/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/MetricsView.java
deleted file mode 100644
index 9fa1b6132fe..00000000000
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/MetricsView.java
+++ /dev/null
@@ -1,376 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-package IceGridGUI.LiveDeployment;
-
-import java.awt.Component;
-
-import javax.swing.Icon;
-import javax.swing.JTree;
-import javax.swing.tree.DefaultTreeCellRenderer;
-import javax.swing.SwingUtilities;
-import javax.swing.JOptionPane;
-import javax.swing.JPopupMenu;
-
-import IceGridGUI.*;
-
-class MetricsView extends TreeNode
-{
- @Override
- public Editor getEditor()
- {
- return _editor;
- }
-
- //
- // Actions
- //
- @Override
- public boolean[] getAvailableActions()
- {
- boolean[] actions = new boolean[IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT];
- actions[ENABLE_METRICS_VIEW] = !_enabled;
- actions[DISABLE_METRICS_VIEW] = _enabled;
- return actions;
- }
-
- @Override
- public Component getTreeCellRendererComponent(
- JTree tree,
- Object value,
- boolean sel,
- boolean expanded,
- boolean leaf,
- int row,
- boolean hasFocus)
- {
- if(_cellRenderer == null)
- {
- _cellRenderer = new DefaultTreeCellRenderer();
-
- _enabledIcon = Utils.getIcon("/icons/16x16/metrics.png");
- _disabledIcon = Utils.getIcon("/icons/16x16/metrics_disabled.png");
- }
-
- Icon icon = _enabled ? _enabledIcon : _disabledIcon;
- _cellRenderer.setLeafIcon(icon);
- return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
- }
-
- MetricsView(TreeNode parent, String name, IceMX.MetricsAdminPrx admin, boolean enabled)
- {
- super(parent, name);
- _name = name;
- _admin = admin;
- _editor = new MetricsViewEditor(getRoot());
- _enabled = enabled;
- }
-
- @Override
- public void enableMetricsView(boolean enabled)
- {
- IceMX.MetricsAdminPrx metricsAdmin = getMetricsAdmin();
- if(metricsAdmin != null)
- {
- if(enabled)
- {
- IceMX.Callback_MetricsAdmin_enableMetricsView cb = new IceMX.Callback_MetricsAdmin_enableMetricsView()
- {
- @Override
- public void response()
- {
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _enabled = true;
- getRoot().getTreeModel().nodeChanged(MetricsView.this);
- getRoot().getCoordinator().showActions(MetricsView.this);
- if(getRoot().getTree().getLastSelectedPathComponent() == MetricsView.this)
- {
- //
- // If the metrics view is selected when enabled success,
- // we must start the refresh thread to pull updates.
- //
- MetricsViewEditor.startRefresh(MetricsView.this);
- }
- }
- });
- }
-
- @Override
- public void exception(final Ice.LocalException e)
- {
- MetricsViewEditor.stopRefresh();
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- if(e instanceof Ice.ObjectNotExistException ||
- e instanceof Ice.ConnectionRefusedException)
- {
- // Server is down.
- }
- else if(e instanceof Ice.CommunicatorDestroyedException)
- {
- }
- else
- {
- e.printStackTrace();
- JOptionPane.showMessageDialog(getCoordinator().getMainFrame(),
- "Error: " + e.toString(), "Error",
- JOptionPane.ERROR_MESSAGE);
- }
- }
- });
- }
-
- @Override
- public void exception(final Ice.UserException e)
- {
- MetricsViewEditor.stopRefresh();
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- e.printStackTrace();
- JOptionPane.showMessageDialog(getCoordinator().getMainFrame(),
- "Error: " + e.toString(), "Error",
- JOptionPane.ERROR_MESSAGE);
- }
- });
- }
- };
- metricsAdmin.begin_enableMetricsView(_name, cb);
- }
- else
- {
- IceMX.Callback_MetricsAdmin_disableMetricsView cb = new IceMX.Callback_MetricsAdmin_disableMetricsView()
- {
- @Override
- public void response()
- {
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _enabled = false;
- _editor.show(MetricsView.this, null, 0);
- getRoot().getTreeModel().nodeChanged(MetricsView.this);
- getRoot().getCoordinator().showActions(MetricsView.this);
- if(getRoot().getTree().getLastSelectedPathComponent() == MetricsView.this)
- {
- //
- // If the metrics view is selected when disabled success,
- // we stop the refresh.
- //
- MetricsViewEditor.stopRefresh();
- }
- }
- });
- }
-
- @Override
- public void exception(final Ice.LocalException e)
- {
- MetricsViewEditor.stopRefresh();
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- if(e instanceof Ice.ObjectNotExistException ||
- e instanceof Ice.ConnectionRefusedException)
- {
- // Server is down.
- }
- else if(e instanceof Ice.CommunicatorDestroyedException)
- {
- }
- else
- {
- e.printStackTrace();
- JOptionPane.showMessageDialog(getCoordinator().getMainFrame(),
- "Error: " + e.toString(), "Error",
- JOptionPane.ERROR_MESSAGE);
- }
- }
- });
- }
-
- @Override
- public void exception(final Ice.UserException e)
- {
- MetricsViewEditor.stopRefresh();
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- e.printStackTrace();
- JOptionPane.showMessageDialog(getCoordinator().getMainFrame(),
- "Error: " + e.toString(), "Error",
- JOptionPane.ERROR_MESSAGE);
- }
- });
- }
- };
- metricsAdmin.begin_disableMetricsView(_name, cb);
- }
- }
- }
-
- public boolean isEnabled()
- {
- return _enabled;
- }
-
- public String name()
- {
- return _name;
- }
-
- IceMX.MetricsAdminPrx getMetricsAdmin()
- {
- return _admin;
- }
-
- @Override
- public JPopupMenu getPopupMenu()
- {
- LiveActions la = getCoordinator().getLiveActionsForPopup();
-
- if(_popup == null)
- {
- _popup = new JPopupMenu();
- _popup.add(la.get(ENABLE_METRICS_VIEW));
- _popup.add(la.get(DISABLE_METRICS_VIEW));
- }
-
- la.setTarget(this);
- return _popup;
- }
-
- public void fetchMetricsFailures(String map, String id, IceMX.Callback_MetricsAdmin_getMetricsFailures cb)
- {
- IceMX.MetricsAdminPrx metricsAdmin = getMetricsAdmin();
- if(metricsAdmin != null)
- {
- try
- {
- metricsAdmin.begin_getMetricsFailures(_name, map, id, cb);
- }
- catch(Ice.LocalException e)
- {
- JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Error: " + e.toString(), "Error",
- JOptionPane.ERROR_MESSAGE);
- }
- }
- }
-
- public void fetchMetricsView()
- {
- IceMX.MetricsAdminPrx metricsAdmin = getMetricsAdmin();
- if(metricsAdmin != null)
- {
- IceMX.Callback_MetricsAdmin_getMetricsView cb = new IceMX.Callback_MetricsAdmin_getMetricsView()
- {
- @Override
- public void response(final java.util.Map<java.lang.String, IceMX.Metrics[]> data,
- final long timestamp)
- {
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _editor.show(MetricsView.this, data, timestamp);
- }
- });
- }
-
- @Override
- public void exception(final Ice.LocalException e)
- {
- MetricsViewEditor.stopRefresh();
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- if(e instanceof Ice.ObjectNotExistException ||
- e instanceof Ice.ConnectionRefusedException)
- {
- // Server is down.
- }
- else if(e instanceof Ice.FacetNotExistException)
- {
- // MetricsAdmin facet not present.
- }
- else if(e instanceof Ice.CommunicatorDestroyedException)
- {
- }
- else
- {
- e.printStackTrace();
- JOptionPane.showMessageDialog(getCoordinator().getMainFrame(),
- "Error: " + e.toString(), "Error",
- JOptionPane.ERROR_MESSAGE);
- }
- }
- });
- }
-
- @Override
- public void exception(final Ice.UserException e)
- {
- MetricsViewEditor.stopRefresh();
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- e.printStackTrace();
- JOptionPane.showMessageDialog(getCoordinator().getMainFrame(),
- "Error: " + e.toString(), "Error",
- JOptionPane.ERROR_MESSAGE);
- }
- });
- }
- };
- try
- {
- metricsAdmin.begin_getMetricsView(_name, cb);
- }
- catch(Ice.CommunicatorDestroyedException e)
- {
- }
- catch(Ice.LocalException e)
- {
- MetricsViewEditor.stopRefresh();
- JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Error: " + e.toString(), "Error",
- JOptionPane.ERROR_MESSAGE);
- }
- }
- }
-
-
- private String _name;
- private IceMX.MetricsAdminPrx _admin;
- private MetricsViewEditor _editor;
- private boolean _enabled;
- static private JPopupMenu _popup;
- static private DefaultTreeCellRenderer _cellRenderer;
- static private Icon _enabledIcon;
- static private Icon _disabledIcon;
-}
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/AdapterObserverI.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/AdapterObserverI.java
index c4cd71d6745..00c59ac2a7b 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/AdapterObserverI.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/AdapterObserverI.java
@@ -7,12 +7,12 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
import javax.swing.SwingUtilities;
-import IceGrid.*;
+import com.zeroc.IceGrid.*;
-class AdapterObserverI extends _AdapterObserverDisp
+class AdapterObserverI implements AdapterObserver
{
AdapterObserverI(Coordinator coordinator)
{
@@ -21,7 +21,7 @@ class AdapterObserverI extends _AdapterObserverDisp
}
@Override
- public synchronized void adapterInit(final AdapterInfo[] adapters, Ice.Current current)
+ public synchronized void adapterInit(final AdapterInfo[] adapters, com.zeroc.Ice.Current current)
{
if(_trace)
{
@@ -52,7 +52,7 @@ class AdapterObserverI extends _AdapterObserverDisp
}
@Override
- public void adapterAdded(final AdapterInfo info, Ice.Current current)
+ public void adapterAdded(final AdapterInfo info, com.zeroc.Ice.Current current)
{
if(_trace)
{
@@ -70,7 +70,7 @@ class AdapterObserverI extends _AdapterObserverDisp
}
@Override
- public void adapterUpdated(final AdapterInfo info, Ice.Current current)
+ public void adapterUpdated(final AdapterInfo info, com.zeroc.Ice.Current current)
{
if(_trace)
{
@@ -88,7 +88,7 @@ class AdapterObserverI extends _AdapterObserverDisp
}
@Override
- public void adapterRemoved(final String id, Ice.Current current)
+ public void adapterRemoved(final String id, com.zeroc.Ice.Current current)
{
if(_trace)
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/AdminRouter.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/AdminRouter.java
index 195e0240e57..f51a9b9708d 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/AdminRouter.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/AdminRouter.java
@@ -7,18 +7,18 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
-import IceGrid.*;
+import com.zeroc.IceGrid.*;
-class AdminRouter extends Ice.Blobject
+class AdminRouter implements com.zeroc.Ice.Blobject
{
@Override
- public boolean ice_invoke(byte[] inParams, Ice.ByteSeqHolder outParams, Ice.Current current)
+ public com.zeroc.Ice.Object.Ice_invokeResult ice_invoke(byte[] inParams, com.zeroc.Ice.Current current)
{
if(_admin == null)
{
- throw new Ice.ObjectNotExistException(current.id, current.facet, current.operation);
+ throw new com.zeroc.Ice.ObjectNotExistException(current.id, current.facet, current.operation);
}
else if(current.operation.equals("ice_id") ||
current.operation.equals("ice_ids") ||
@@ -26,14 +26,14 @@ class AdminRouter extends Ice.Blobject
current.operation.equals("ice_ping") ||
current.operation.equals("getDefaultApplicationDescriptor"))
{
- return _admin.ice_invoke(current.operation, current.mode, inParams, outParams, current.ctx);
+ return _admin.ice_invoke(current.operation, current.mode, inParams, current.ctx);
}
else
{
//
// Routing other operations could be a security risk
//
- throw new Ice.OperationNotExistException(current.id, current.facet, current.operation);
+ throw new com.zeroc.Ice.OperationNotExistException(current.id, current.facet, current.operation);
}
}
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/AbstractServerEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/AbstractServerEditor.java
index b90f51fba8d..3f933d444d7 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/AbstractServerEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/AbstractServerEditor.java
@@ -7,10 +7,10 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import javax.swing.JOptionPane;
-import IceGrid.*;
+import com.zeroc.IceGrid.*;
//
// Base class for ServerEditor and ServerInstanceEditor
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Adapter.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Adapter.java
index bb694fa4029..94525630141 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Adapter.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Adapter.java
@@ -7,14 +7,14 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import java.awt.Component;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class Adapter extends TreeNode implements DescriptorHolder
{
@@ -32,7 +32,7 @@ class Adapter extends TreeNode implements DescriptorHolder
static public java.util.List<AdapterDescriptor>
copyDescriptors(java.util.List<AdapterDescriptor> descriptors)
{
- java.util.List<AdapterDescriptor> copy = new java.util.LinkedList<AdapterDescriptor>();
+ java.util.List<AdapterDescriptor> copy = new java.util.LinkedList<>();
for(AdapterDescriptor p : descriptors)
{
copy.add(copyDescriptor(p));
@@ -174,7 +174,7 @@ class Adapter extends TreeNode implements DescriptorHolder
{
if(!_ephemeral)
{
- java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
+ java.util.List<String[]> attributes = new java.util.LinkedList<>();
attributes.add(createAttribute("name", _descriptor.name));
String oaPrefix = _descriptor.name + ".";
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/AdapterEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/AdapterEditor.java
index e026b78b883..6b2477854f8 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/AdapterEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/AdapterEditor.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
@@ -29,8 +29,8 @@ import javax.swing.event.DocumentListener;
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.layout.CellConstraints;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
@SuppressWarnings("unchecked")
class AdapterEditor extends CommunicatorChildEditor
@@ -165,7 +165,7 @@ class AdapterEditor extends CommunicatorChildEditor
JTextField idTextField = (JTextField)_id.getEditor().getEditorComponent();
idTextField.getDocument().addDocumentListener(_updateListener);
- _id.setToolTipText("Identities this object adapter within an IceGrid deployment");
+ _id.setToolTipText("Identifies this object adapter within an IceGrid deployment");
JTextField replicaGroupIdTextField = (JTextField)_replicaGroupId.getEditor().getEditorComponent();
replicaGroupIdTextField.getDocument().addDocumentListener(_updateListener);
@@ -386,11 +386,9 @@ class AdapterEditor extends CommunicatorChildEditor
}
else
{
- ReplicaGroups replicaGroups =
- getAdapter().getRoot().getReplicaGroups();
+ ReplicaGroups replicaGroups = getAdapter().getRoot().getReplicaGroups();
- ReplicaGroup replicaGroup =
- (ReplicaGroup)replicaGroups.findChild(replicaGroupId);
+ ReplicaGroup replicaGroup = (ReplicaGroup)replicaGroups.findChild(replicaGroupId);
if(replicaGroup != null)
{
@@ -576,10 +574,10 @@ class AdapterEditor extends CommunicatorChildEditor
private java.util.Map<String, String[]> objectDescriptorSeqToMap(java.util.List<ObjectDescriptor> objects)
{
- java.util.Map<String, String[]> result = new java.util.TreeMap<String, String[]>();
+ java.util.Map<String, String[]> result = new java.util.TreeMap<>();
for(ObjectDescriptor p : objects)
{
- String k = Ice.Util.identityToString(p.id);
+ String k = com.zeroc.Ice.Util.identityToString(p.id);
result.put(k, new String[]{p.type, getAdapter().lookupPropertyValue(k),p.proxyOptions});
}
return result;
@@ -588,16 +586,16 @@ class AdapterEditor extends CommunicatorChildEditor
private java.util.LinkedList<ObjectDescriptor> mapToObjectDescriptorSeq(java.util.Map<String, String[]> map)
{
String badIdentities = "";
- java.util.LinkedList<ObjectDescriptor> result = new java.util.LinkedList<ObjectDescriptor>();
+ java.util.LinkedList<ObjectDescriptor> result = new java.util.LinkedList<>();
for(java.util.Map.Entry<String, String[]> p : map.entrySet())
{
try
{
- Ice.Identity id = Ice.Util.stringToIdentity(p.getKey());
+ com.zeroc.Ice.Identity id = com.zeroc.Ice.Util.stringToIdentity(p.getKey());
String[] val = p.getValue();
result.add(new ObjectDescriptor(id, val[0], val[2]));
}
- catch(Ice.IdentityParseException ex)
+ catch(com.zeroc.Ice.IdentityParseException ex)
{
badIdentities += "- " + p.getKey() + "\n";
}
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ApplicationEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ApplicationEditor.java
index b46369a6130..0e72572a063 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ApplicationEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ApplicationEditor.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import javax.swing.JComponent;
import javax.swing.JComboBox;
@@ -19,8 +19,8 @@ import javax.swing.JTextField;
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.layout.CellConstraints;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
@SuppressWarnings("unchecked")
class ApplicationEditor extends Editor
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ArrayMapField.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ArrayMapField.java
index e7d2fb0b490..acd11be666c 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ArrayMapField.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ArrayMapField.java
@@ -7,9 +7,9 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
-import IceGridGUI.*;
+import com.zeroc.IceGridGUI.*;
import java.awt.event.ActionEvent;
@@ -34,7 +34,7 @@ public class ArrayMapField extends JTable
_substituteKey = substituteKey;
_vectorSize = columns.length;
- _columnNames = new java.util.Vector<String>(_vectorSize);
+ _columnNames = new java.util.Vector<>(_vectorSize);
for(String name : columns)
{
_columnNames.add(name);
@@ -91,10 +91,10 @@ public class ArrayMapField extends JTable
//
// Transform map into vector of vectors
//
- java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<java.util.Vector<String>>(map.size());
+ java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<>(map.size());
for(java.util.Map.Entry<String, String[]> p : map.entrySet())
{
- java.util.Vector<String> row = new java.util.Vector<String>(_vectorSize);
+ java.util.Vector<String> row = new java.util.Vector<>(_vectorSize);
if(_substituteKey)
{
@@ -115,7 +115,7 @@ public class ArrayMapField extends JTable
if(_editable)
{
- java.util.Vector<String> newRow = new java.util.Vector<String>(_vectorSize);
+ java.util.Vector<String> newRow = new java.util.Vector<>(_vectorSize);
for(int i = 0; i < _vectorSize; ++i)
{
newRow.add("");
@@ -176,7 +176,7 @@ public class ArrayMapField extends JTable
java.util.Vector<java.util.Vector<String>> vector =
_model.getDataVector();
- java.util.TreeMap<String, String[]> result = new java.util.TreeMap<String, String[]>();
+ java.util.TreeMap<String, String[]> result = new java.util.TreeMap<>();
for(java.util.Vector<String> row : vector)
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Communicator.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Communicator.java
index 931d26883df..3e526a56ace 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Communicator.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Communicator.java
@@ -7,15 +7,15 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import java.util.Enumeration;
import javax.swing.JOptionPane;
import javax.swing.tree.DefaultTreeModel;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
//
// The base class for Server, Service, ServerTemplate and ServiceTemplate
@@ -179,7 +179,7 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
{
Adapter.AdapterCopy copy = (Adapter.AdapterCopy)descriptor;
_adapters.newAdapter(Adapter.copyDescriptor(copy.descriptor),
- new java.util.HashMap<String, String>(copy.parentProperties));
+ new java.util.HashMap<>(copy.parentProperties));
}
else if(descriptor instanceof DbEnvDescriptor)
{
@@ -206,7 +206,7 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
//
java.util.List<? extends TemplateInstance> findInstances()
{
- java.util.List<TemplateInstance> result = new java.util.LinkedList<TemplateInstance>();
+ java.util.List<TemplateInstance> result = new java.util.LinkedList<>();
result.add((TemplateInstance)this);
return result;
}
@@ -482,7 +482,7 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
return id;
}
- protected java.util.List<TreeNode> _children = new java.util.LinkedList<TreeNode>();
+ protected java.util.List<TreeNode> _children = new java.util.LinkedList<>();
protected java.util.List<T> _descriptors;
protected boolean _sorted;
}
@@ -826,7 +826,7 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
{
t = (ServiceTemplate)getRoot().getServiceTemplates().getChildAt(0);
descriptor.template = t.getId();
- descriptor.parameterValues = new java.util.HashMap<String, String>();
+ descriptor.parameterValues = new java.util.HashMap<>();
}
}
@@ -882,7 +882,7 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
java.util.List<ServiceInstance> findServiceInstances(String template)
{
- java.util.List<ServiceInstance> result = new java.util.LinkedList<ServiceInstance>();
+ java.util.List<ServiceInstance> result = new java.util.LinkedList<>();
java.util.Iterator<TreeNode> p = _services.iterator();
while(p.hasNext())
{
@@ -987,7 +987,7 @@ abstract class Communicator extends TreeNode implements DescriptorHolder
java.util.Map<String, String> propertiesMap()
{
- java.util.Map<String, String> result = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> result = new java.util.HashMap<>();
CommunicatorDescriptor descriptor = getCommunicatorDescriptor();
for(PropertyDescriptor p : descriptor.propertySet.properties)
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/CommunicatorChildEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/CommunicatorChildEditor.java
index c0e323f1496..63569c0e469 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/CommunicatorChildEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/CommunicatorChildEditor.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import javax.swing.JOptionPane;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/CommunicatorSubEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/CommunicatorSubEditor.java
index dadfc906cfc..a58ae91b36d 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/CommunicatorSubEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/CommunicatorSubEditor.java
@@ -7,15 +7,15 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.layout.CellConstraints;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class CommunicatorSubEditor
{
@@ -107,7 +107,7 @@ class CommunicatorSubEditor
//
// Note that we don't substitute in the lookup
//
- java.util.Map<String, String> map = new java.util.TreeMap<String, String>();
+ java.util.Map<String, String> map = new java.util.TreeMap<>();
for(String log : descriptor.logs)
{
String prop = lookupKey(descriptor.propertySet.properties, log);
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/DbEnv.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/DbEnv.java
index 5117e6b0ec9..e02fc499b85 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/DbEnv.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/DbEnv.java
@@ -7,14 +7,14 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import java.awt.Component;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class DbEnv extends TreeNode implements DescriptorHolder
{
@@ -25,7 +25,7 @@ class DbEnv extends TreeNode implements DescriptorHolder
static public java.util.List<DbEnvDescriptor> copyDescriptors(java.util.List<DbEnvDescriptor> list)
{
- java.util.List<DbEnvDescriptor> copy = new java.util.LinkedList<DbEnvDescriptor>();
+ java.util.List<DbEnvDescriptor> copy = new java.util.LinkedList<>();
for(DbEnvDescriptor p : list)
{
copy.add(copyDescriptor(p));
@@ -156,7 +156,7 @@ class DbEnv extends TreeNode implements DescriptorHolder
{
for(PropertyDescriptor p : properties)
{
- java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
+ java.util.List<String[]> attributes = new java.util.LinkedList<>();
attributes.add(createAttribute("name", p.name));
attributes.add(createAttribute("value", p.value));
writer.writeElement("dbproperty", attributes);
@@ -169,7 +169,7 @@ class DbEnv extends TreeNode implements DescriptorHolder
{
if(!_ephemeral)
{
- java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
+ java.util.List<String[]> attributes = new java.util.LinkedList<>();
attributes.add(createAttribute("name", _descriptor.name));
if(_descriptor.dbHome.length() > 0)
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/DbEnvEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/DbEnvEditor.java
index 4fd753aef1f..233c488059d 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/DbEnvEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/DbEnvEditor.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import javax.swing.JComboBox;
import javax.swing.JScrollPane;
@@ -17,8 +17,8 @@ import javax.swing.JTextField;
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.layout.CellConstraints;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class DbEnvEditor extends CommunicatorChildEditor
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/DescriptorHolder.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/DescriptorHolder.java
index fd5b7dcad52..646c44a8952 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/DescriptorHolder.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/DescriptorHolder.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
interface DescriptorHolder
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Editable.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Editable.java
index e60d09adc5d..696c435b8ef 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Editable.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Editable.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
class Editable implements Cloneable
{
@@ -50,7 +50,7 @@ class Editable implements Cloneable
java.util.TreeSet<String> set = _removedElements.get(forClass);
if(set == null)
{
- set = new java.util.TreeSet<String>();
+ set = new java.util.TreeSet<>();
_removedElements.put(forClass, set);
}
set.add(id);
@@ -75,11 +75,10 @@ class Editable implements Cloneable
try
{
Editable result = (Editable)clone();
- java.util.HashMap<Class, java.util.TreeSet<String>> removedElements =
- new java.util.HashMap<Class, java.util.TreeSet<String>>();
+ java.util.HashMap<Class, java.util.TreeSet<String>> removedElements = new java.util.HashMap<>();
for(java.util.Map.Entry<Class, java.util.TreeSet<String>> p : result._removedElements.entrySet())
{
- java.util.TreeSet<String> val = new java.util.TreeSet<String>(p.getValue());
+ java.util.TreeSet<String> val = new java.util.TreeSet<>(p.getValue());
removedElements.put(p.getKey(), val);
}
result._removedElements = removedElements;
@@ -102,6 +101,5 @@ class Editable implements Cloneable
private boolean _isNew = false;
private boolean _modified = false;
- private java.util.HashMap<Class, java.util.TreeSet<String>> _removedElements =
- new java.util.HashMap<Class, java.util.TreeSet<String>>();
+ private java.util.HashMap<Class, java.util.TreeSet<String>> _removedElements = new java.util.HashMap<>();
}
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Editor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Editor.java
index fc0570421f2..8763214cf8f 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Editor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Editor.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
@@ -22,7 +22,7 @@ import javax.swing.event.DocumentListener;
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.builder.ButtonBarBuilder;
import com.jgoodies.forms.factories.Borders;
-import IceGridGUI.*;
+import com.zeroc.IceGridGUI.*;
public class Editor extends EditorBase
{
@@ -30,7 +30,7 @@ public class Editor extends EditorBase
java.util.Map<String, String> oldParameterValues,
java.util.List<String> newParameters)
{
- java.util.Map<String, String> result = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> result = new java.util.HashMap<>();
for(String name : newParameters)
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ListTextField.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ListTextField.java
index e554a95188e..ea3e1aa230f 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ListTextField.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ListTextField.java
@@ -7,15 +7,14 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
-import IceGridGUI.*;
+import com.zeroc.IceGridGUI.*;
import javax.swing.JTextField;
//
-// A special field used to show/edit a list of strings separated
-// by whitespace
+// A special field used to show/edit a list of strings separated by whitespace
//
public class ListTextField extends JTextField
@@ -36,13 +35,13 @@ public class ListTextField extends JTextField
}
};
- setText(Utils.stringify(list, stringifier, " ", null));
+ setText(Utils.stringify(list, stringifier, " ").returnValue);
}
public java.util.LinkedList<String> getList()
{
String text = getText().trim();
- java.util.LinkedList<String> result = new java.util.LinkedList<String>();
+ java.util.LinkedList<String> result = new java.util.LinkedList<>();
while(text.length() > 0)
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ListTreeNode.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ListTreeNode.java
index a5f2eec59cf..ddb9aa97249 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ListTreeNode.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ListTreeNode.java
@@ -7,13 +7,13 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import javax.swing.tree.DefaultTreeModel;
import java.util.Enumeration;
-import IceGridGUI.*;
+import com.zeroc.IceGridGUI.*;
//
// An editable TreeNode that holds a list of children
@@ -242,7 +242,7 @@ abstract class ListTreeNode extends TreeNode
private Object _selectedItem;
}
- protected final java.util.LinkedList<TreeNodeBase> _children = new java.util.LinkedList<TreeNodeBase>();
+ protected final java.util.LinkedList<TreeNodeBase> _children = new java.util.LinkedList<>();
protected Editable _editable;
static private Editor _editor;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Node.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Node.java
index 00c9592aeca..0662b573eb8 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Node.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Node.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import java.awt.Component;
import java.util.Enumeration;
@@ -20,8 +20,8 @@ import javax.swing.JTree;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.DefaultTreeCellRenderer;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class Node extends TreeNode implements PropertySetParent
{
@@ -32,13 +32,13 @@ class Node extends TreeNode implements PropertySetParent
copy.propertySets = PropertySets.copyDescriptors(copy.propertySets);
- copy.serverInstances = new java.util.LinkedList<ServerInstanceDescriptor>();
+ copy.serverInstances = new java.util.LinkedList<>();
for(ServerInstanceDescriptor p : nd.serverInstances)
{
copy.serverInstances.add(ServerInstance.copyDescriptor(p));
}
- copy.servers = new java.util.LinkedList<ServerDescriptor>();
+ copy.servers = new java.util.LinkedList<>();
for(ServerDescriptor p : nd.servers)
{
copy.servers.add(PlainServer.copyDescriptor(p));
@@ -453,7 +453,7 @@ class Node extends TreeNode implements PropertySetParent
{
if(!_ephemeral)
{
- java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
+ java.util.List<String[]> attributes = new java.util.LinkedList<>();
attributes.add(createAttribute("name", _id));
if(_descriptor.loadFactor.length() > 0)
{
@@ -511,8 +511,8 @@ class Node extends TreeNode implements PropertySetParent
_resolver.put("application", root.getId());
_resolver.put("node", _id);
- backup.backupList = new java.util.Vector<Object>();
- backup.servers = new java.util.LinkedList<Server>(_servers);
+ backup.backupList = new java.util.Vector<>();
+ backup.servers = new java.util.LinkedList<>(_servers);
for(Server p : backup.servers)
{
@@ -626,7 +626,7 @@ class Node extends TreeNode implements PropertySetParent
else
{
update.removePropertySets = _editable.removedElements(PropertySet.class);
- update.propertySets = new java.util.HashMap<String, PropertySetDescriptor>();
+ update.propertySets = new java.util.HashMap<>();
for(PropertySet p : _propertySets)
{
@@ -649,8 +649,8 @@ class Node extends TreeNode implements PropertySetParent
update.removeServers = _editable.removedElements(Server.class);
}
- update.serverInstances = new java.util.LinkedList<ServerInstanceDescriptor>();
- update.servers = new java.util.LinkedList<ServerDescriptor>();
+ update.serverInstances = new java.util.LinkedList<>();
+ update.servers = new java.util.LinkedList<>();
for(Server p : _servers)
{
@@ -684,26 +684,26 @@ class Node extends TreeNode implements PropertySetParent
{
update.variables = _descriptor.variables;
update.removeVariables = new String[0];
- update.loadFactor = new IceGrid.BoxedString(_descriptor.loadFactor);
- update.description = new IceGrid.BoxedString(_descriptor.description);
+ update.loadFactor = new com.zeroc.IceGrid.BoxedString(_descriptor.loadFactor);
+ update.description = new com.zeroc.IceGrid.BoxedString(_descriptor.description);
}
else
{
if(!_descriptor.description.equals(_origDescription))
{
- update.description = new IceGrid.BoxedString(_descriptor.description);
+ update.description = new com.zeroc.IceGrid.BoxedString(_descriptor.description);
}
if(!_descriptor.loadFactor.equals(_origLoadFactor))
{
- update.loadFactor = new IceGrid.BoxedString(_descriptor.loadFactor);
+ update.loadFactor = new com.zeroc.IceGrid.BoxedString(_descriptor.loadFactor);
}
//
// Diff variables (TODO: avoid duplication with same code in Root)
//
- update.variables = new java.util.TreeMap<String, String>(_descriptor.variables);
- java.util.List<String> removeVariables = new java.util.LinkedList<String>();
+ update.variables = new java.util.TreeMap<>(_descriptor.variables);
+ java.util.List<String> removeVariables = new java.util.LinkedList<>();
for(java.util.Map.Entry<String, String> p : _origVariables.entrySet())
{
@@ -734,8 +734,8 @@ class Node extends TreeNode implements PropertySetParent
{
Root root = getRoot();
- java.util.Vector<Server> newServers = new java.util.Vector<Server>();
- java.util.Vector<Server> updatedServers = new java.util.Vector<Server>();
+ java.util.Vector<Server> newServers = new java.util.Vector<>();
+ java.util.Vector<Server> updatedServers = new java.util.Vector<>();
if(update != null)
{
@@ -775,8 +775,8 @@ class Node extends TreeNode implements PropertySetParent
_descriptor.propertySets.remove(id);
}
- java.util.Vector<PropertySet> newPropertySets = new java.util.Vector<PropertySet>();
- java.util.Vector<PropertySet> updatedPropertySets = new java.util.Vector<PropertySet>();
+ java.util.Vector<PropertySet> newPropertySets = new java.util.Vector<>();
+ java.util.Vector<PropertySet> updatedPropertySets = new java.util.Vector<>();
for(java.util.Map.Entry<String, PropertySetDescriptor> p : update.propertySets.entrySet())
{
@@ -897,7 +897,7 @@ class Node extends TreeNode implements PropertySetParent
//
// Find servers affected by template updates
//
- java.util.Set<Server> serverSet = new java.util.HashSet<Server>();
+ java.util.Set<Server> serverSet = new java.util.HashSet<>();
for(String p : serverTemplates)
{
@@ -1028,7 +1028,7 @@ class Node extends TreeNode implements PropertySetParent
java.util.List<ServerInstance> findServerInstances(String template)
{
- java.util.List<ServerInstance> result = new java.util.LinkedList<ServerInstance>();
+ java.util.List<ServerInstance> result = new java.util.LinkedList<>();
for(Server p : _servers)
{
if(p instanceof ServerInstance)
@@ -1046,7 +1046,7 @@ class Node extends TreeNode implements PropertySetParent
void removeServerInstances(String template)
{
- java.util.List<String> toRemove = new java.util.LinkedList<String>();
+ java.util.List<String> toRemove = new java.util.LinkedList<>();
for(Server p : _servers)
{
@@ -1075,7 +1075,7 @@ class Node extends TreeNode implements PropertySetParent
java.util.List<ServiceInstance> findServiceInstances(String template)
{
- java.util.List<ServiceInstance> result = new java.util.LinkedList<ServiceInstance>();
+ java.util.List<ServiceInstance> result = new java.util.LinkedList<>();
for(Server p : _servers)
{
if(p instanceof PlainServer)
@@ -1264,7 +1264,7 @@ class Node extends TreeNode implements PropertySetParent
t = (ServerTemplate)root.getServerTemplates().getChildAt(0);
descriptor.template = t.getId();
- descriptor.parameterValues = new java.util.HashMap<String, String>();
+ descriptor.parameterValues = new java.util.HashMap<>();
}
ServerInstance server = new ServerInstance(this, id, descriptor);
@@ -1289,8 +1289,8 @@ class Node extends TreeNode implements PropertySetParent
private final boolean _ephemeral;
private NodeEditor _editor;
- private java.util.LinkedList<PropertySet> _propertySets = new java.util.LinkedList<PropertySet>();
- private java.util.LinkedList<Server> _servers = new java.util.LinkedList<Server>();
+ private java.util.LinkedList<PropertySet> _propertySets = new java.util.LinkedList<>();
+ private java.util.LinkedList<Server> _servers = new java.util.LinkedList<>();
private Editable _editable;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/NodeEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/NodeEditor.java
index d5c854ac2a7..d276d10df33 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/NodeEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/NodeEditor.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
@@ -16,8 +16,8 @@ import javax.swing.JTextField;
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.layout.CellConstraints;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class NodeEditor extends Editor
{
@@ -97,7 +97,7 @@ class NodeEditor extends Editor
// Rebuild node; don't need the backup
// since it's just one node
//
- java.util.List<Editable> editables = new java.util.LinkedList<Editable>();
+ java.util.List<Editable> editables = new java.util.LinkedList<>();
try
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Nodes.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Nodes.java
index e2d2c058417..55fe24431e7 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Nodes.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Nodes.java
@@ -7,19 +7,19 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class Nodes extends ListTreeNode
{
static public java.util.Map<String, NodeDescriptor>
copyDescriptors(java.util.Map<String, NodeDescriptor> descriptors)
{
- java.util.Map<String, NodeDescriptor> copy = new java.util.HashMap<String, NodeDescriptor>();
+ java.util.Map<String, NodeDescriptor> copy = new java.util.HashMap<>();
for(java.util.Map.Entry<String, NodeDescriptor> p : descriptors.entrySet())
{
copy.put(p.getKey(), Node.copyDescriptor(p.getValue()));
@@ -129,8 +129,8 @@ class Nodes extends ListTreeNode
void rebuild()
throws UpdateFailedException
{
- java.util.List<Node.Backup> backupList = new java.util.ArrayList<Node.Backup>();
- java.util.List<Editable> editables = new java.util.LinkedList<Editable>();
+ java.util.List<Node.Backup> backupList = new java.util.ArrayList<>();
+ java.util.List<Editable> editables = new java.util.LinkedList<>();
for(TreeNodeBase p : _children)
{
@@ -170,7 +170,7 @@ class Nodes extends ListTreeNode
java.util.LinkedList<NodeUpdateDescriptor> getUpdates()
{
- java.util.LinkedList<NodeUpdateDescriptor> updates = new java.util.LinkedList<NodeUpdateDescriptor>();
+ java.util.LinkedList<NodeUpdateDescriptor> updates = new java.util.LinkedList<>();
for(TreeNodeBase p : _children)
{
Node node = (Node)p;
@@ -194,7 +194,7 @@ class Nodes extends ListTreeNode
java.util.List<ServiceInstance> findServiceInstances(String template)
{
- java.util.List<ServiceInstance> result = new java.util.LinkedList<ServiceInstance>();
+ java.util.List<ServiceInstance> result = new java.util.LinkedList<>();
for(TreeNodeBase p : _children)
{
Node node = (Node)p;
@@ -231,8 +231,8 @@ class Nodes extends ListTreeNode
//
// One big set of updates, followed by inserts
//
- java.util.List<TreeNodeBase> newChildren = new java.util.ArrayList<TreeNodeBase>();
- java.util.Set<Node> updatedNodes = new java.util.HashSet<Node>();
+ java.util.List<TreeNodeBase> newChildren = new java.util.ArrayList<>();
+ java.util.Set<Node> updatedNodes = new java.util.HashSet<>();
for(NodeUpdateDescriptor update : updates)
{
@@ -280,7 +280,7 @@ class Nodes extends ListTreeNode
java.util.List<ServerInstance> findServerInstances(String template)
{
- java.util.List<ServerInstance> result = new java.util.LinkedList<ServerInstance>();
+ java.util.List<ServerInstance> result = new java.util.LinkedList<>();
for(TreeNodeBase p : _children)
{
Node node = (Node)p;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ParameterValuesField.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ParameterValuesField.java
index 5f1ef398f85..3bd2a85208f 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ParameterValuesField.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ParameterValuesField.java
@@ -7,9 +7,9 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
-import IceGridGUI.*;
+import com.zeroc.IceGridGUI.*;
import javax.swing.DefaultCellEditor;
import javax.swing.JComboBox;
@@ -30,7 +30,7 @@ public class ParameterValuesField extends JTable
{
_editor = editor;
- _columnNames = new java.util.Vector<String>(2);
+ _columnNames = new java.util.Vector<>(2);
_columnNames.add("Name");
_columnNames.add("Value");
@@ -56,15 +56,14 @@ public class ParameterValuesField extends JTable
//
// Transform map into vector of vectors
//
- java.util.Vector<java.util.Vector<String>> vector =
- new java.util.Vector<java.util.Vector<String>>(names.size());
+ java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<>(names.size());
_hasDefault = new boolean[names.size()];
int i = 0;
for(String name : names)
{
- java.util.Vector<String> row = new java.util.Vector<String>(2);
+ java.util.Vector<String> row = new java.util.Vector<>(2);
row.add(name);
_hasDefault[i] = (defaultValues.get(name) != null);
@@ -118,7 +117,7 @@ public class ParameterValuesField extends JTable
public java.util.Map<String, String> getValues()
{
- java.util.Map<String, String> values = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> values = new java.util.HashMap<>();
if(isEditing())
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ParametersField.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ParametersField.java
index 5f293678d32..c18b8c8cfa0 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ParametersField.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ParametersField.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import java.awt.event.ActionEvent;
@@ -34,7 +34,7 @@ public class ParametersField extends JTable
{
_editor = editor;
- _columnNames = new java.util.Vector<String>(2);
+ _columnNames = new java.util.Vector<>(2);
_columnNames.add("Name");
_columnNames.add("Default value");
@@ -85,11 +85,10 @@ public class ParametersField extends JTable
//
// Transform map into vector of vectors
//
- java.util.Vector<java.util.Vector<String>> vector =
- new java.util.Vector<java.util.Vector<String>>(names.size());
+ java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<>(names.size());
for(String name : names)
{
- java.util.Vector<String> row = new java.util.Vector<String>(2);
+ java.util.Vector<String> row = new java.util.Vector<>(2);
row.add(name);
@@ -105,7 +104,7 @@ public class ParametersField extends JTable
vector.add(row);
}
- java.util.Vector<String> newRow = new java.util.Vector<String>(2);
+ java.util.Vector<String> newRow = new java.util.Vector<>(2);
newRow.add("");
newRow.add(_noDefault);
vector.add(newRow);
@@ -138,7 +137,7 @@ public class ParametersField extends JTable
{
assert names != null;
- java.util.Map<String, String> values = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> values = new java.util.HashMap<>();
if(isEditing())
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PlainServer.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PlainServer.java
index bd72656f482..0a810ac22b4 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PlainServer.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PlainServer.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import java.awt.Component;
@@ -17,8 +17,8 @@ import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class PlainServer extends Communicator implements Server
{
@@ -284,7 +284,7 @@ class PlainServer extends Communicator implements Server
static java.util.List<String[]> createAttributes(ServerDescriptor descriptor)
{
- java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
+ java.util.List<String[]> attributes = new java.util.LinkedList<>();
attributes.add(createAttribute("id", descriptor.id));
if(descriptor.activation.length() > 0)
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PlainServerEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PlainServerEditor.java
index 0c6d9c548c0..ae1edaa3f96 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PlainServerEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PlainServerEditor.java
@@ -7,11 +7,11 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import com.jgoodies.forms.builder.DefaultFormBuilder;
-import IceGridGUI.*;
+import com.zeroc.IceGridGUI.*;
class PlainServerEditor extends AbstractServerEditor
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PlainService.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PlainService.java
index 07d182b08f6..d3788e1e0f5 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PlainService.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PlainService.java
@@ -7,15 +7,15 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import java.awt.Component;
import javax.swing.JPopupMenu;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class PlainService extends Communicator implements Service, Cloneable
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PlainServiceEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PlainServiceEditor.java
index 8a600e6198f..3aaa2e8f826 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PlainServiceEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PlainServiceEditor.java
@@ -7,12 +7,12 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import com.jgoodies.forms.builder.DefaultFormBuilder;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class PlainServiceEditor extends CommunicatorChildEditor
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertiesField.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertiesField.java
index 0ca5979e848..782c476376e 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertiesField.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertiesField.java
@@ -7,10 +7,10 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
import java.awt.event.ActionEvent;
@@ -31,7 +31,7 @@ public class PropertiesField extends JTable
{
public PropertiesField(Editor editor)
{
- _columnNames = new java.util.Vector<String>(2);
+ _columnNames = new java.util.Vector<>(2);
_columnNames.add("Name");
_columnNames.add("Value");
@@ -88,12 +88,12 @@ public class PropertiesField extends JTable
// We don't show the .Endpoint and .PublishedEndpoints of adapters,
// since they already appear in the Adapter pages
//
- java.util.Set<String> hiddenPropertyNames = new java.util.HashSet<String>();
+ java.util.Set<String> hiddenPropertyNames = new java.util.HashSet<>();
//
// We also hide properties whose value match an object or allocatable
//
- java.util.Set<String> hiddenPropertyValues = new java.util.HashSet<String>();
+ java.util.Set<String> hiddenPropertyValues = new java.util.HashSet<>();
_hiddenProperties.clear();
@@ -111,11 +111,11 @@ public class PropertiesField extends JTable
for(ObjectDescriptor q : p.objects)
{
- hiddenPropertyValues.add(Ice.Util.identityToString(q.id));
+ hiddenPropertyValues.add(com.zeroc.Ice.Util.identityToString(q.id));
}
for(ObjectDescriptor q : p.allocatables)
{
- hiddenPropertyValues.add(Ice.Util.identityToString(q.id));
+ hiddenPropertyValues.add(com.zeroc.Ice.Util.identityToString(q.id));
}
}
}
@@ -131,8 +131,7 @@ public class PropertiesField extends JTable
//
// Transform list into vector of vectors
//
- java.util.Vector<java.util.Vector<String>> vector =
- new java.util.Vector<java.util.Vector<String>>(properties.size());
+ java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<>(properties.size());
for(PropertyDescriptor p : properties)
{
if(hiddenPropertyNames.contains(p.name))
@@ -167,7 +166,7 @@ public class PropertiesField extends JTable
}
else
{
- java.util.Vector<String> row = new java.util.Vector<String>(2);
+ java.util.Vector<String> row = new java.util.Vector<>(2);
row.add(Utils.substitute(p.name, resolver));
row.add(Utils.substitute(p.value, resolver));
vector.add(row);
@@ -176,7 +175,7 @@ public class PropertiesField extends JTable
if(_editable)
{
- java.util.Vector<String> newRow = new java.util.Vector<String>(2);
+ java.util.Vector<String> newRow = new java.util.Vector<>(2);
newRow.add("");
newRow.add("");
vector.add(newRow);
@@ -229,8 +228,7 @@ public class PropertiesField extends JTable
java.util.Vector<java.util.Vector<String>> vector =
_model.getDataVector();
- java.util.LinkedList<PropertyDescriptor> result =
- new java.util.LinkedList<PropertyDescriptor>(_hiddenProperties);
+ java.util.LinkedList<PropertyDescriptor> result = new java.util.LinkedList<>(_hiddenProperties);
for(java.util.Vector<String> row : vector)
{
@@ -260,8 +258,7 @@ public class PropertiesField extends JTable
private java.util.Vector<String> _columnNames;
private boolean _editable = false;
- private java.util.LinkedList<PropertyDescriptor> _hiddenProperties =
- new java.util.LinkedList<PropertyDescriptor>();
+ private java.util.LinkedList<PropertyDescriptor> _hiddenProperties = new java.util.LinkedList<>();
private Editor _editor;
}
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertySet.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertySet.java
index 1d6c0aa2500..87bc5163cf7 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertySet.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertySet.java
@@ -7,14 +7,14 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import java.awt.Component;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class PropertySet extends TreeNode
{
@@ -22,7 +22,7 @@ class PropertySet extends TreeNode
copyDescriptor(PropertySetDescriptor d)
{
PropertySetDescriptor psd = d.clone();
- psd.properties = new java.util.LinkedList<PropertyDescriptor>(psd.properties);
+ psd.properties = new java.util.LinkedList<>(psd.properties);
return psd;
}
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertySetEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertySetEditor.java
index 623b3b6cf48..97dfa5aa198 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertySetEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertySetEditor.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import javax.swing.JComponent;
import javax.swing.JLabel;
@@ -18,8 +18,8 @@ import javax.swing.JTextField;
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.layout.CellConstraints;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class PropertySetEditor extends Editor
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertySetParent.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertySetParent.java
index c08553f31fe..333cfb5c4f0 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertySetParent.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertySetParent.java
@@ -7,9 +7,9 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
-import IceGrid.*;
+import com.zeroc.IceGrid.*;
interface PropertySetParent
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertySets.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertySets.java
index cf2870c2a87..2793451a08e 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertySets.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertySets.java
@@ -7,19 +7,19 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import javax.swing.JPopupMenu;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class PropertySets extends ListTreeNode implements PropertySetParent
{
static public java.util.Map<String, PropertySetDescriptor>
copyDescriptors(java.util.Map<String, PropertySetDescriptor> descriptors)
{
- java.util.Map<String, PropertySetDescriptor> copy = new java.util.HashMap<String, PropertySetDescriptor>();
+ java.util.Map<String, PropertySetDescriptor> copy = new java.util.HashMap<>();
for(java.util.Map.Entry<String, PropertySetDescriptor> p : descriptors.entrySet())
{
copy.put(p.getKey(), PropertySet.copyDescriptor(p.getValue()));
@@ -103,7 +103,7 @@ class PropertySets extends ListTreeNode implements PropertySetParent
//
// One big set of updates, followed by inserts
//
- java.util.List<PropertySet> newChildren = new java.util.ArrayList<PropertySet>();
+ java.util.List<PropertySet> newChildren = new java.util.ArrayList<>();
for(java.util.Map.Entry<String, PropertySetDescriptor> p : updates.entrySet())
{
@@ -124,7 +124,7 @@ class PropertySets extends ListTreeNode implements PropertySetParent
java.util.Map<String, PropertySetDescriptor> getUpdates()
{
- java.util.Map<String, PropertySetDescriptor> updates = new java.util.HashMap<String, PropertySetDescriptor>();
+ java.util.Map<String, PropertySetDescriptor> updates = new java.util.HashMap<>();
for(TreeNodeBase p : _children)
{
PropertySet ps = (PropertySet)p;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ReplicaGroup.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ReplicaGroup.java
index afe5e306403..b681c515109 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ReplicaGroup.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ReplicaGroup.java
@@ -7,14 +7,14 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import java.awt.Component;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class ReplicaGroup extends TreeNode
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ReplicaGroupEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ReplicaGroupEditor.java
index 72e06ec9696..4f1642b15e8 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ReplicaGroupEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ReplicaGroupEditor.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
@@ -22,8 +22,8 @@ import javax.swing.JTextField;
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.layout.CellConstraints;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
@SuppressWarnings("unchecked")
class ReplicaGroupEditor extends Editor
@@ -421,10 +421,10 @@ class ReplicaGroupEditor extends Editor
private java.util.Map<String, String[]> objectDescriptorSeqToMap(java.util.List<ObjectDescriptor> objects)
{
- java.util.Map<String, String[]> result = new java.util.TreeMap<String, String[]>();
+ java.util.Map<String, String[]> result = new java.util.TreeMap<>();
for(ObjectDescriptor p : objects)
{
- result.put(Ice.Util.identityToString(p.id), new String[]{p.type, p.proxyOptions});
+ result.put(com.zeroc.Ice.Util.identityToString(p.id), new String[]{p.type, p.proxyOptions});
}
return result;
}
@@ -432,17 +432,17 @@ class ReplicaGroupEditor extends Editor
private java.util.LinkedList<ObjectDescriptor> mapToObjectDescriptorSeq(java.util.Map<String, String[]> map)
{
String badIdentities = "";
- java.util.LinkedList<ObjectDescriptor> result = new java.util.LinkedList<ObjectDescriptor>();
+ java.util.LinkedList<ObjectDescriptor> result = new java.util.LinkedList<>();
for(java.util.Map.Entry<String, String[]> p : map.entrySet())
{
try
{
- Ice.Identity id = Ice.Util.stringToIdentity(p.getKey());
+ com.zeroc.Ice.Identity id = com.zeroc.Ice.Util.stringToIdentity(p.getKey());
String[] val = p.getValue();
result.add(new ObjectDescriptor(id, val[0], val[1]));
}
- catch(Ice.IdentityParseException ex)
+ catch(com.zeroc.Ice.IdentityParseException ex)
{
badIdentities += "- " + p.getKey() + "\n";
}
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ReplicaGroups.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ReplicaGroups.java
index 9a4f4e52028..1743923d859 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ReplicaGroups.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ReplicaGroups.java
@@ -7,19 +7,19 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import javax.swing.JPopupMenu;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class ReplicaGroups extends ListTreeNode
{
static public java.util.List<ReplicaGroupDescriptor>
copyDescriptors(java.util.List<ReplicaGroupDescriptor> descriptors)
{
- java.util.List<ReplicaGroupDescriptor> copy = new java.util.LinkedList<ReplicaGroupDescriptor>();
+ java.util.List<ReplicaGroupDescriptor> copy = new java.util.LinkedList<>();
for(ReplicaGroupDescriptor p : descriptors)
{
copy.add(ReplicaGroup.copyDescriptor(p));
@@ -97,7 +97,7 @@ class ReplicaGroups extends ListTreeNode
java.util.LinkedList<ReplicaGroupDescriptor> getUpdates()
{
- java.util.LinkedList<ReplicaGroupDescriptor> updates = new java.util.LinkedList<ReplicaGroupDescriptor>();
+ java.util.LinkedList<ReplicaGroupDescriptor> updates = new java.util.LinkedList<>();
for(TreeNodeBase p : _children)
{
ReplicaGroup ra = (ReplicaGroup)p;
@@ -131,7 +131,7 @@ class ReplicaGroups extends ListTreeNode
//
// Updates and inserts
//
- java.util.List<TreeNodeBase> updatedChildren = new java.util.ArrayList<TreeNodeBase>();
+ java.util.List<TreeNodeBase> updatedChildren = new java.util.ArrayList<>();
for(ReplicaGroupDescriptor p : descriptors)
{
ReplicaGroup child = (ReplicaGroup)findChild(p.id);
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Root.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Root.java
index e06818d3aa1..30c125db157 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Root.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Root.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import java.awt.Component;
import java.awt.Cursor;
@@ -22,8 +22,8 @@ import javax.swing.tree.TreePath;
import java.io.File;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
public class Root extends ListTreeNode
{
@@ -434,85 +434,57 @@ public class Root extends ListTreeNode
final String prefix = "Updating application '" + _id + "'...";
_coordinator.getStatusBar().setText(prefix);
-
- Ice.Callback cb = new Ice.Callback()
- {
- @Override
- public void completed(Ice.AsyncResult result)
- {
- try
- {
- if(restart)
- {
- _coordinator.getAdmin().end_updateApplication(result);
- }
- else
- {
- _coordinator.getAdmin().end_updateApplicationWithoutRestart(result);
- }
-
- if(_traceSaveToRegistry)
- {
- _coordinator.traceSaveToRegistry(
- "updateApplication for application " + _id + ": success");
- }
-
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- commit();
- release();
- _coordinator.getStatusBar().setText(prefix + "done.");
- }
- });
- }
- catch(final Exception ex)
- {
- if(_traceSaveToRegistry)
- {
- _coordinator.traceSaveToRegistry(
- "updateApplication for application " + _id + ": failed");
- }
-
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _skipUpdates--;
- if(ex instanceof Ice.UserException)
- {
- handleFailure(prefix, "Update failed",
- "IceGrid exception: " + ex.toString());
- }
- else
- {
- handleFailure(prefix, "Update failed",
- "Communication exception: " +
- ex.toString());
- }
- }
-
- });
- }
- }
- };
-
if(_traceSaveToRegistry)
{
_coordinator.traceSaveToRegistry("sending updateApplication for application " + _id);
}
+ java.util.concurrent.CompletableFuture<Void> r;
if(restart)
{
- _coordinator.getAdmin().begin_updateApplication(updateDescriptor, cb);
+ r = _coordinator.getAdmin().updateApplicationAsync(updateDescriptor);
}
else
{
- _coordinator.getAdmin().begin_updateApplicationWithoutRestart(updateDescriptor, cb);
+ r = _coordinator.getAdmin().updateApplicationWithoutRestartAsync(updateDescriptor);
}
+
+ r.whenComplete((result, ex) ->
+ {
+ if(_traceSaveToRegistry)
+ {
+ _coordinator.traceSaveToRegistry("updateApplication for application " +
+ _id +
+ (ex == null ? ": success" : ": failed"));
+ }
+
+ if(ex == null)
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ commit();
+ release();
+ _coordinator.getStatusBar().setText(prefix + "done.");
+ });
+ }
+ else
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ _skipUpdates--;
+ if(ex instanceof com.zeroc.Ice.UserException)
+ {
+ handleFailure(prefix, "Update failed",
+ "IceGrid exception: " + ex.toString());
+ }
+ else
+ {
+ handleFailure(prefix, "Update failed",
+ "Communication exception: " + ex.toString());
+ }
+ });
+ }
+ });
asyncRelease = true;
//
@@ -540,192 +512,135 @@ public class Root extends ListTreeNode
final String prefix = "Adding application '" + _id + "'...";
_coordinator.getStatusBar().setText(prefix);
- Callback_Admin_addApplication cb = new Callback_Admin_addApplication()
+ if(_traceSaveToRegistry)
+ {
+ _coordinator.traceSaveToRegistry("sending addApplication for application " + _id);
+ }
+
+ _coordinator.getAdmin().addApplicationAsync(_descriptor).whenComplete((result, ex) ->
{
- @Override
- public void response()
+ if(_traceSaveToRegistry)
{
- if(_traceSaveToRegistry)
- {
- _coordinator.traceSaveToRegistry("addApplication for application " +
- _id + ": success");
- }
-
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- commit();
- liveReset();
- _coordinator.addLiveApplication(Root.this);
- release();
- _coordinator.getStatusBar().setText(prefix + "done.");
- }
- });
+ _coordinator.traceSaveToRegistry("addApplication for application " + _id +
+ (ex == null ? ": success" : ": failed"));
}
- @Override
- public void exception(final Ice.UserException e)
+ if(ex == null)
{
- if(_traceSaveToRegistry)
- {
- _coordinator.traceSaveToRegistry("addApplication for application " +
- _id + ": failed");
- }
-
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
- {
- handleFailure(prefix, "Add failed",
- "IceGrid exception: " + e.toString());
- }
-
+ commit();
+ liveReset();
+ _coordinator.addLiveApplication(Root.this);
+ release();
+ _coordinator.getStatusBar().setText(prefix + "done.");
});
}
-
- @Override
- public void exception(final Ice.LocalException e)
+ else
{
- if(_traceSaveToRegistry)
+ if(ex instanceof com.zeroc.Ice.UserException)
{
- _coordinator.traceSaveToRegistry("addApplication for application " +
- _id + ": failed");
+ SwingUtilities.invokeLater(() ->
+ {
+ handleFailure(prefix, "Add failed",
+ "IceGrid exception: " + ex.toString());
+ });
}
-
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
+ else
+ {
+ SwingUtilities.invokeLater(() ->
{
handleFailure(prefix, "Add failed",
- "Communication exception: " + e.toString());
- }
- });
+ "Communication exception: " + ex.toString());
+ });
+ }
}
-
- };
-
- if(_traceSaveToRegistry)
- {
- _coordinator.traceSaveToRegistry("sending addApplication for application " + _id);
- }
-
- _coordinator.getAdmin().begin_addApplication(_descriptor, cb);
+ });
asyncRelease = true;
}
else
{
final String prefix = "Synchronizing application '" + _id + "'...";
_coordinator.getStatusBar().setText(prefix);
-
- Ice.Callback cb = new Ice.Callback()
+
+ if(_traceSaveToRegistry)
+ {
+ _coordinator.traceSaveToRegistry("sending syncApplication for application " + _id);
+ }
+
+ java.util.concurrent.CompletableFuture<Void> r;
+ if(restart)
+ {
+ r = _coordinator.getAdmin().syncApplicationAsync(_descriptor);
+ }
+ else
+ {
+ r = _coordinator.getAdmin().syncApplicationWithoutRestartAsync(_descriptor);
+ }
+
+ r.whenComplete((result, ex) ->
{
- @Override
- public void completed(Ice.AsyncResult result)
+ if(_traceSaveToRegistry)
{
- try
- {
- if(restart)
- {
- _coordinator.getAdmin().end_syncApplication(result);
- }
- else
- {
- _coordinator.getAdmin().end_syncApplicationWithoutRestart(result);
- }
-
- if(_traceSaveToRegistry)
- {
- _coordinator.traceSaveToRegistry("syncApplication for application " +
- _id + ": success");
- }
-
- SwingUtilities.invokeLater(new Runnable()
+ _coordinator.traceSaveToRegistry("syncApplication for application " + _id +
+ (ex == null ? ": success" : ": failed"));
+ }
+
+ if(ex == null)
+ {
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
+ commit();
+ if(!_live)
{
- commit();
- if(!_live)
+ //
+ // Make this tab live or close it if there is one already
+ // open
+ //
+ ApplicationPane app = _coordinator.getLiveApplication(_id);
+ if(app == null)
{
- //
- // Make this tab live or close it if there is one already
- // open
- //
- ApplicationPane app = _coordinator.getLiveApplication(_id);
- if(app == null)
- {
- liveReset();
- _coordinator.addLiveApplication(Root.this);
- }
- else
+ liveReset();
+ _coordinator.addLiveApplication(Root.this);
+ }
+ else
+ {
+ boolean selected = isSelected();
+ _coordinator.getMainPane().removeApplication(Root.this);
+ if(selected)
{
- boolean selected = isSelected();
- _coordinator.getMainPane().removeApplication(Root.this);
- if(selected)
- {
- _coordinator.getMainPane().setSelectedComponent(app);
- }
+ _coordinator.getMainPane().setSelectedComponent(app);
}
}
-
- release();
- _coordinator.getStatusBar().setText(prefix + "done.");
}
- });
- }
- catch(final Exception ex)
- {
- if(_traceSaveToRegistry)
- {
- _coordinator.traceSaveToRegistry("syncApplication for application " +
- _id + ": failed");
- }
- SwingUtilities.invokeLater(new Runnable()
+ release();
+ _coordinator.getStatusBar().setText(prefix + "done.");
+ });
+ }
+ else
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ if(_live)
{
- @Override
- public void run()
- {
- if(_live)
- {
- _skipUpdates--;
- }
-
- if(ex instanceof Ice.UserException)
- {
- handleFailure(prefix, "Sync failed",
- "IceGrid exception: " + ex.toString());
- }
- else
- {
- handleFailure(prefix, "Sync failed",
- "Communication exception: " +
- ex.toString());
- }
- }
+ _skipUpdates--;
+ }
- });
- }
+ if(ex instanceof com.zeroc.Ice.UserException)
+ {
+ handleFailure(prefix, "Sync failed",
+ "IceGrid exception: " + ex.toString());
+ }
+ else
+ {
+ handleFailure(prefix, "Sync failed",
+ "Communication exception: " +
+ ex.toString());
+ }
+ });
}
- };
-
- if(_traceSaveToRegistry)
- {
- _coordinator.traceSaveToRegistry("sending syncApplication for application " + _id);
- }
-
- if(restart)
- {
- _coordinator.getAdmin().begin_syncApplication(_descriptor, cb);
- }
- else
- {
- _coordinator.getAdmin().begin_syncApplicationWithoutRestart(_descriptor, cb);
- }
+ });
asyncRelease = true;
if(_live)
@@ -743,13 +658,13 @@ public class Root extends ListTreeNode
_coordinator.getDiscardUpdatesAction().setEnabled(false);
}
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
if(_traceSaveToRegistry)
{
_coordinator.traceSaveToRegistry("Ice communications exception while saving application " +
_id);
- }
+ }
JOptionPane.showMessageDialog(
_coordinator.getMainFrame(),
@@ -776,7 +691,7 @@ public class Root extends ListTreeNode
{
_coordinator.accessDenied(e);
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
JOptionPane.showMessageDialog(
_coordinator.getMainFrame(),
@@ -813,7 +728,7 @@ public class Root extends ListTreeNode
{
desc = _coordinator.getLiveDeploymentRoot().getApplicationDescriptor(_id);
assert desc != null;
- desc = IceGridGUI.Application.Root.copyDescriptor(desc);
+ desc = com.zeroc.IceGridGUI.Application.Root.copyDescriptor(desc);
}
else if(_file != null)
{
@@ -879,14 +794,14 @@ public class Root extends ListTreeNode
//
if(!_descriptor.description.equals(_origDescription))
{
- update.description = new IceGrid.BoxedString(_descriptor.description);
+ update.description = new com.zeroc.IceGrid.BoxedString(_descriptor.description);
}
//
// Diff variables
//
- update.variables = new java.util.TreeMap<String, String>(_descriptor.variables);
- java.util.List<String> removeVariables = new java.util.LinkedList<String>();
+ update.variables = new java.util.TreeMap<>(_descriptor.variables);
+ java.util.List<String> removeVariables = new java.util.LinkedList<>();
for(java.util.Map.Entry<String, String> p : _origVariables.entrySet())
{
@@ -912,12 +827,12 @@ public class Root extends ListTreeNode
//
if(!_descriptor.distrib.equals(_origDistrib))
{
- update.distrib = new IceGrid.BoxedDistributionDescriptor(_descriptor.distrib);
+ update.distrib = new com.zeroc.IceGrid.BoxedDistributionDescriptor(_descriptor.distrib);
}
}
else
{
- update.variables = new java.util.TreeMap<String, String>();
+ update.variables = new java.util.TreeMap<>();
update.removeVariables = new String[0];
}
@@ -1299,7 +1214,7 @@ public class Root extends ListTreeNode
{
writer.writeStartTag("icegrid");
- java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
+ java.util.List<String[]> attributes = new java.util.LinkedList<>();
attributes.add(createAttribute("name", _id));
writer.writeStartTag("application", attributes);
@@ -1547,8 +1462,7 @@ public class Root extends ListTreeNode
// Updates saved when _updated == false and
// _registryUpdatesEnabled == false
//
- private java.util.List<ApplicationUpdateDescriptor> _concurrentUpdates =
- new java.util.LinkedList<ApplicationUpdateDescriptor>();
+ private java.util.List<ApplicationUpdateDescriptor> _concurrentUpdates = new java.util.LinkedList<>();
//
// When _live is true and _canUseUpdateDescriptor is true, we can
@@ -1573,7 +1487,7 @@ public class Root extends ListTreeNode
//
// Map editor-class to Editor object
//
- private java.util.Map<Class, Editor> _editorMap = new java.util.HashMap<Class, Editor>();
+ private java.util.Map<Class, Editor> _editorMap = new java.util.HashMap<>();
private ApplicationPane _applicationPane;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Server.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Server.java
index 730065269fe..a16d6fac0c2 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Server.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Server.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
interface Server extends TemplateInstance
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerInstance.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerInstance.java
index 0d9d71c72a4..958119a384d 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerInstance.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerInstance.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import java.awt.Component;
@@ -17,8 +17,8 @@ import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class ServerInstance extends ListTreeNode implements Server, PropertySetParent
{
@@ -300,7 +300,7 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent
TemplateDescriptor templateDescriptor = getRoot().findServerTemplateDescriptor(_descriptor.template);
- java.util.Set<String> parameters = new java.util.HashSet<String>(templateDescriptor.parameters);
+ java.util.Set<String> parameters = new java.util.HashSet<>(templateDescriptor.parameters);
if(!parameters.equals(_descriptor.parameterValues.keySet()))
{
backup.parameterValues = _descriptor.parameterValues;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerInstanceEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerInstanceEditor.java
index 0336bf1496d..5191af06dc9 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerInstanceEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerInstanceEditor.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import java.awt.event.ActionEvent;
@@ -22,8 +22,8 @@ import javax.swing.event.ListDataListener;
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.layout.CellConstraints;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
@SuppressWarnings("unchecked")
class ServerInstanceEditor extends AbstractServerEditor
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerInstancePropertySetEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerInstancePropertySetEditor.java
index ada8db7630f..e609b38d28d 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerInstancePropertySetEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerInstancePropertySetEditor.java
@@ -7,14 +7,14 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JTextField;
-import IceGridGUI.*;
+import com.zeroc.IceGridGUI.*;
class ServerInstancePropertySetEditor extends PropertySetEditor
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerSubEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerSubEditor.java
index 210f74a96a5..16829817e5b 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerSubEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerSubEditor.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import java.awt.event.ActionEvent;
@@ -22,8 +22,8 @@ import javax.swing.JTextField;
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.layout.CellConstraints;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
@SuppressWarnings("unchecked")
class ServerSubEditor extends CommunicatorSubEditor
@@ -206,7 +206,7 @@ class ServerSubEditor extends CommunicatorSubEditor
descriptor.options = _options.getList();
descriptor.user = _user.getText().trim();
- descriptor.envs = new java.util.LinkedList<String>();
+ descriptor.envs = new java.util.LinkedList<>();
for(java.util.Map.Entry<String, String> p : _envs.get().entrySet())
{
descriptor.envs.add(p.getKey() + "=" + p.getValue());
@@ -276,7 +276,7 @@ class ServerSubEditor extends CommunicatorSubEditor
_user.setText(Utils.substitute(descriptor.user, detailResolver));
_user.setEditable(isEditable);
- java.util.Map<String, String> envMap = new java.util.TreeMap<String, String>();
+ java.util.Map<String, String> envMap = new java.util.TreeMap<>();
for(String p : descriptor.envs)
{
int equal = p.indexOf('=');
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerTemplate.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerTemplate.java
index a4d6cd21fa8..197a162e749 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerTemplate.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerTemplate.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import java.awt.Component;
import javax.swing.Icon;
@@ -16,8 +16,8 @@ import javax.swing.JPopupMenu;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class ServerTemplate extends Communicator
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerTemplateEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerTemplateEditor.java
index 8f220cd5016..3265c555b96 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerTemplateEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerTemplateEditor.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import com.jgoodies.forms.builder.DefaultFormBuilder;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerTemplates.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerTemplates.java
index 4f4556a663c..cfafffe1de7 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerTemplates.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerTemplates.java
@@ -7,19 +7,19 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import javax.swing.JPopupMenu;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class ServerTemplates extends Templates
{
static public java.util.Map<String, TemplateDescriptor>
copyDescriptors(java.util.Map<String, TemplateDescriptor> descriptors)
{
- java.util.Map<String, TemplateDescriptor> copy = new java.util.HashMap<String, TemplateDescriptor>();
+ java.util.Map<String, TemplateDescriptor> copy = new java.util.HashMap<>();
for(java.util.Map.Entry<String, TemplateDescriptor> p : descriptors.entrySet())
{
copy.put(p.getKey(), ServerTemplate.copyDescriptor(p.getValue()));
@@ -119,7 +119,7 @@ class ServerTemplates extends Templates
java.util.Map<String, TemplateDescriptor> getUpdates()
{
- java.util.Map<String, TemplateDescriptor> updates = new java.util.HashMap<String, TemplateDescriptor>();
+ java.util.Map<String, TemplateDescriptor> updates = new java.util.HashMap<>();
for(TreeNodeBase p : _children)
{
ServerTemplate t = (ServerTemplate)p;
@@ -143,7 +143,7 @@ class ServerTemplates extends Templates
java.util.List<ServiceInstance> findServiceInstances(String template)
{
- java.util.List<ServiceInstance> result = new java.util.LinkedList<ServiceInstance>();
+ java.util.List<ServiceInstance> result = new java.util.LinkedList<>();
for(TreeNodeBase p : _children)
{
ServerTemplate t = (ServerTemplate)p;
@@ -211,8 +211,8 @@ class ServerTemplates extends Templates
//
// One big set of updates, followed by inserts
//
- java.util.List<TreeNodeBase> newChildren = new java.util.ArrayList<TreeNodeBase>();
- java.util.List<TreeNodeBase> updatedChildren = new java.util.LinkedList<TreeNodeBase>();
+ java.util.List<TreeNodeBase> newChildren = new java.util.ArrayList<>();
+ java.util.List<TreeNodeBase> updatedChildren = new java.util.LinkedList<>();
for(java.util.Map.Entry<String, TemplateDescriptor> p : updates.entrySet())
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Service.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Service.java
index ac0bb8455c5..034effd125e 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Service.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Service.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
interface Service extends TemplateInstance, DescriptorHolder
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceInstance.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceInstance.java
index d68c1436be1..aaa4cc4bc0a 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceInstance.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceInstance.java
@@ -7,15 +7,15 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import java.awt.Component;
import javax.swing.JPopupMenu;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class ServiceInstance extends TreeNode implements Service, Cloneable
{
@@ -36,7 +36,7 @@ class ServiceInstance extends TreeNode implements Service, Cloneable
static public java.util.List<ServiceInstanceDescriptor>
copyDescriptors(java.util.List<ServiceInstanceDescriptor> descriptors)
{
- java.util.List<ServiceInstanceDescriptor> copy = new java.util.LinkedList<ServiceInstanceDescriptor>();
+ java.util.List<ServiceInstanceDescriptor> copy = new java.util.LinkedList<>();
for(ServiceInstanceDescriptor p : descriptors)
{
copy.add(copyDescriptor(p));
@@ -233,7 +233,7 @@ class ServiceInstance extends TreeNode implements Service, Cloneable
{
TemplateDescriptor templateDescriptor = getRoot().findServiceTemplateDescriptor(_descriptor.template);
- java.util.Set<String> parameters = new java.util.HashSet<String>(templateDescriptor.parameters);
+ java.util.Set<String> parameters = new java.util.HashSet<>(templateDescriptor.parameters);
if(!parameters.equals(_descriptor.parameterValues.keySet()))
{
backup.parameterValues = _descriptor.parameterValues;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceInstanceEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceInstanceEditor.java
index 544cf5fa1b7..c2b7f04a8e9 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceInstanceEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceInstanceEditor.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import java.awt.event.ActionEvent;
@@ -22,8 +22,8 @@ import javax.swing.event.ListDataListener;
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.layout.CellConstraints;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
@SuppressWarnings("unchecked")
class ServiceInstanceEditor extends CommunicatorChildEditor
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceSubEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceSubEditor.java
index 51a049173d4..de919f2a14c 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceSubEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceSubEditor.java
@@ -7,14 +7,14 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import javax.swing.JTextField;
import com.jgoodies.forms.builder.DefaultFormBuilder;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class ServiceSubEditor extends CommunicatorSubEditor
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceTemplate.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceTemplate.java
index 98630c9fa3f..fe87092dacf 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceTemplate.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceTemplate.java
@@ -7,15 +7,15 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import java.awt.Component;
import javax.swing.JPopupMenu;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class ServiceTemplate extends Communicator
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceTemplateEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceTemplateEditor.java
index 9a82352a390..a50ea4b27e8 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceTemplateEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceTemplateEditor.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import com.jgoodies.forms.builder.DefaultFormBuilder;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceTemplates.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceTemplates.java
index 841e7f9b3b3..dada1ff903b 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceTemplates.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceTemplates.java
@@ -7,19 +7,19 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import javax.swing.JPopupMenu;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class ServiceTemplates extends Templates
{
static public java.util.Map<String, TemplateDescriptor>
copyDescriptors(java.util.Map<String, TemplateDescriptor> descriptors)
{
- java.util.Map<String, TemplateDescriptor> copy = new java.util.HashMap<String, TemplateDescriptor>();
+ java.util.Map<String, TemplateDescriptor> copy = new java.util.HashMap<>();
for(java.util.Map.Entry<String, TemplateDescriptor> p : descriptors.entrySet())
{
copy.put(p.getKey(), ServiceTemplate.copyDescriptor(p.getValue()));
@@ -130,7 +130,7 @@ class ServiceTemplates extends Templates
java.util.Map<String, TemplateDescriptor> getUpdates()
{
- java.util.Map<String, TemplateDescriptor> updates = new java.util.HashMap<String, TemplateDescriptor>();
+ java.util.Map<String, TemplateDescriptor> updates = new java.util.HashMap<>();
for(TreeNodeBase p : _children)
{
ServiceTemplate t = (ServiceTemplate)p;
@@ -167,8 +167,8 @@ class ServiceTemplates extends Templates
//
// One big set of updates, followed by inserts
//
- java.util.List<TreeNodeBase> newChildren = new java.util.ArrayList<TreeNodeBase>();
- java.util.List<TreeNodeBase> updatedChildren = new java.util.LinkedList<TreeNodeBase>();
+ java.util.List<TreeNodeBase> newChildren = new java.util.ArrayList<>();
+ java.util.List<TreeNodeBase> updatedChildren = new java.util.LinkedList<>();
for(java.util.Map.Entry<String, TemplateDescriptor> p : descriptors.entrySet())
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/SimpleMapField.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/SimpleMapField.java
index 4bc4173dd9e..9e02d8b2f51 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/SimpleMapField.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/SimpleMapField.java
@@ -7,9 +7,9 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
-import IceGridGUI.*;
+import com.zeroc.IceGridGUI.*;
import java.awt.event.ActionEvent;
@@ -33,7 +33,7 @@ public class SimpleMapField extends JTable
_editor = editor;
_substituteKey = substituteKey;
- _columnNames = new java.util.Vector<String>(2);
+ _columnNames = new java.util.Vector<>(2);
_columnNames.add(headKey);
_columnNames.add(headValue);
@@ -85,10 +85,10 @@ public class SimpleMapField extends JTable
//
// Transform map into vector of vectors
//
- java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<java.util.Vector<String>>(map.size());
+ java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<>(map.size());
for(java.util.Map.Entry<String, String> p : map.entrySet())
{
- java.util.Vector<String> row = new java.util.Vector<String>(2);
+ java.util.Vector<String> row = new java.util.Vector<>(2);
if(_substituteKey)
{
@@ -105,7 +105,7 @@ public class SimpleMapField extends JTable
if(_editable)
{
- java.util.Vector<String> newRow = new java.util.Vector<String>(2);
+ java.util.Vector<String> newRow = new java.util.Vector<>(2);
newRow.add("");
newRow.add("");
vector.add(newRow);
@@ -159,7 +159,7 @@ public class SimpleMapField extends JTable
java.util.Vector<java.util.Vector<String>> vector =
_model.getDataVector();
- java.util.TreeMap<String, String> result = new java.util.TreeMap<String, String>();
+ java.util.TreeMap<String, String> result = new java.util.TreeMap<>();
for(java.util.Vector<String> row : vector)
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/TemplateEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/TemplateEditor.java
index 661e35ea217..b24b86f93e4 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/TemplateEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/TemplateEditor.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
@@ -16,7 +16,7 @@ import javax.swing.JTextField;
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.layout.CellConstraints;
-import IceGrid.*;
+import com.zeroc.IceGrid.*;
class TemplateEditor extends Editor
{
@@ -42,7 +42,7 @@ class TemplateEditor extends Editor
void writeDescriptor()
{
TemplateDescriptor descriptor = getDescriptor();
- java.util.LinkedList<String> parameters = new java.util.LinkedList<String>();
+ java.util.LinkedList<String> parameters = new java.util.LinkedList<>();
descriptor.parameterDefaults = _parameters.get(parameters);
descriptor.parameters = parameters;
}
@@ -50,7 +50,7 @@ class TemplateEditor extends Editor
boolean isSimpleUpdate()
{
TemplateDescriptor descriptor = getDescriptor();
- java.util.List<String> parameters = new java.util.LinkedList<String>();
+ java.util.List<String> parameters = new java.util.LinkedList<>();
java.util.Map<String, String> defaultValues = _parameters.get(parameters);
return descriptor.parameters.equals(parameters) && descriptor.parameterDefaults.equals(defaultValues);
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/TemplateInstance.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/TemplateInstance.java
index c780c7cd9a2..e05e2a1f323 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/TemplateInstance.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/TemplateInstance.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
interface TemplateInstance
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Templates.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Templates.java
index 4251fa67f86..bdb04178da0 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Templates.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Templates.java
@@ -7,9 +7,9 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
-import IceGrid.*;
+import com.zeroc.IceGrid.*;
abstract class Templates extends ListTreeNode
{
@@ -25,9 +25,9 @@ abstract class Templates extends ListTreeNode
throws UpdateFailedException
{
java.util.List<? extends TemplateInstance> instanceList = child.findInstances();
- java.util.List<Object> backupList = new java.util.Vector<Object>();
+ java.util.List<Object> backupList = new java.util.Vector<>();
- java.util.List<Editable> editables = new java.util.LinkedList<Editable>();
+ java.util.List<Editable> editables = new java.util.LinkedList<>();
for(TemplateInstance p : instanceList)
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/TreeNode.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/TreeNode.java
index e72a51aed04..f8276f2dc2c 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/TreeNode.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/TreeNode.java
@@ -7,12 +7,12 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
import java.util.Enumeration;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
public abstract class TreeNode extends TreeNodeBase
{
@@ -99,7 +99,7 @@ public abstract class TreeNode extends TreeNodeBase
{
for(java.util.Map.Entry<String, String> p : variables.entrySet())
{
- java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
+ java.util.List<String[]> attributes = new java.util.LinkedList<>();
attributes.add(createAttribute("name", p.getKey()));
attributes.add(createAttribute("value", p.getValue()));
@@ -128,8 +128,8 @@ public abstract class TreeNode extends TreeNodeBase
// We don't show the .Endpoint of adapters,
// since they already appear in the Adapter descriptors
//
- java.util.Set<String> hiddenPropertyNames = new java.util.HashSet<String>();
- java.util.Set<String> hiddenPropertyValues = new java.util.HashSet<String>();
+ java.util.Set<String> hiddenPropertyNames = new java.util.HashSet<>();
+ java.util.Set<String> hiddenPropertyValues = new java.util.HashSet<>();
if(adapters != null)
{
@@ -140,11 +140,11 @@ public abstract class TreeNode extends TreeNodeBase
for(ObjectDescriptor q : p.objects)
{
- hiddenPropertyValues.add(Ice.Util.identityToString(q.id));
+ hiddenPropertyValues.add(com.zeroc.Ice.Util.identityToString(q.id));
}
for(ObjectDescriptor q : p.allocatables)
{
- hiddenPropertyValues.add(Ice.Util.identityToString(q.id));
+ hiddenPropertyValues.add(com.zeroc.Ice.Util.identityToString(q.id));
}
}
}
@@ -157,7 +157,7 @@ public abstract class TreeNode extends TreeNodeBase
}
}
- java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
+ java.util.List<String[]> attributes = new java.util.LinkedList<>();
if(id.length() > 0)
{
attributes.add(createAttribute(idAttrName, id));
@@ -207,7 +207,7 @@ public abstract class TreeNode extends TreeNodeBase
{
for(String log : logs)
{
- java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
+ java.util.List<String[]> attributes = new java.util.LinkedList<>();
attributes.add(createAttribute("path", log));
String prop = lookupName(log, properties);
if(prop != null)
@@ -235,7 +235,7 @@ public abstract class TreeNode extends TreeNodeBase
{
if(descriptor.icepatch.length() > 0)
{
- java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
+ java.util.List<String[]> attributes = new java.util.LinkedList<>();
attributes.add(createAttribute("icepatch", descriptor.icepatch));
if(descriptor.directories.isEmpty())
@@ -260,8 +260,8 @@ public abstract class TreeNode extends TreeNodeBase
{
for(ObjectDescriptor p : objects)
{
- java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
- String strId = Ice.Util.identityToString(p.id);
+ java.util.List<String[]> attributes = new java.util.LinkedList<>();
+ String strId = com.zeroc.Ice.Util.identityToString(p.id);
attributes.add(createAttribute("identity", strId));
if(p.type.length() > 0)
{
@@ -290,7 +290,7 @@ public abstract class TreeNode extends TreeNodeBase
for(String p : new java.util.LinkedHashSet<String>(parameters))
{
String val = defaultValues.get(p);
- java.util.List<String[]> attributes = new java.util.LinkedList<String[]>();
+ java.util.List<String[]> attributes = new java.util.LinkedList<>();
attributes.add(createAttribute("name", p));
if(val != null)
{
@@ -303,7 +303,7 @@ public abstract class TreeNode extends TreeNodeBase
static java.util.LinkedList<String[]>
parameterValuesToAttributes(java.util.Map<String, String> parameterValues, java.util.List<String> parameters)
{
- java.util.LinkedList<String[]> result = new java.util.LinkedList<String[]>();
+ java.util.LinkedList<String[]> result = new java.util.LinkedList<>();
//
// We use a LinkedHashSet to maintain order while eliminating duplicates
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/UpdateFailedException.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/UpdateFailedException.java
index b64452e6bc5..30cce1ffcb8 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/UpdateFailedException.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/UpdateFailedException.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.Application;
+package com.zeroc.IceGridGUI.Application;
public class UpdateFailedException extends Exception
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/ApplicationActions.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ApplicationActions.java
index ffe0526f439..6029c2c52ca 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/ApplicationActions.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ApplicationActions.java
@@ -7,12 +7,12 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
-import IceGridGUI.Application.*;
+import com.zeroc.IceGridGUI.Application.*;
//
// Holds all actions for the Application view
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/ApplicationObserverI.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ApplicationObserverI.java
index 2016ac3b0f8..7589bd2c61b 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/ApplicationObserverI.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ApplicationObserverI.java
@@ -7,12 +7,12 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
import javax.swing.SwingUtilities;
-import IceGrid.*;
+import com.zeroc.IceGrid.*;
-class ApplicationObserverI extends _ApplicationObserverDisp
+class ApplicationObserverI implements ApplicationObserver
{
ApplicationObserverI(String instanceName, Coordinator coordinator)
{
@@ -48,13 +48,13 @@ class ApplicationObserverI extends _ApplicationObserverDisp
}
else
{
- throw new Ice.TimeoutException();
+ throw new com.zeroc.Ice.TimeoutException();
}
}
@Override
public synchronized void applicationInit(int serial, java.util.List<ApplicationInfo> applications,
- Ice.Current current)
+ com.zeroc.Ice.Current current)
{
if(_trace)
{
@@ -86,7 +86,7 @@ class ApplicationObserverI extends _ApplicationObserverDisp
}
@Override
- public void applicationAdded(final int serial, final ApplicationInfo info, Ice.Current current)
+ public void applicationAdded(final int serial, final ApplicationInfo info, com.zeroc.Ice.Current current)
{
if(_trace)
{
@@ -106,7 +106,7 @@ class ApplicationObserverI extends _ApplicationObserverDisp
}
@Override
- public void applicationRemoved(final int serial, final String name, final Ice.Current current)
+ public void applicationRemoved(final int serial, final String name, final com.zeroc.Ice.Current current)
{
if(_trace)
{
@@ -126,7 +126,7 @@ class ApplicationObserverI extends _ApplicationObserverDisp
}
@Override
- public void applicationUpdated(final int serial, final ApplicationUpdateInfo info, Ice.Current current)
+ public void applicationUpdated(final int serial, final ApplicationUpdateInfo info, com.zeroc.Ice.Current current)
{
if(_trace)
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/ApplicationPane.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ApplicationPane.java
index b02e075d58d..a0c44c1b75a 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/ApplicationPane.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ApplicationPane.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
import java.awt.*;
import java.awt.event.MouseAdapter;
@@ -25,9 +25,9 @@ import javax.swing.tree.TreeSelectionModel;
import com.jgoodies.forms.factories.Borders;
-import IceGridGUI.Application.Editor;
-import IceGridGUI.Application.Root;
-import IceGridGUI.Application.TreeNode;
+import com.zeroc.IceGridGUI.Application.Editor;
+import com.zeroc.IceGridGUI.Application.Root;
+import com.zeroc.IceGridGUI.Application.TreeNode;
public class ApplicationPane extends JSplitPane implements Tab
{
@@ -484,8 +484,8 @@ public class ApplicationPane extends JSplitPane implements Tab
//
// back/forward navigation
//
- private java.util.LinkedList<TreeNode> _previousNodes = new java.util.LinkedList<TreeNode>();
- private java.util.LinkedList<TreeNode> _nextNodes = new java.util.LinkedList<TreeNode>();
+ private java.util.LinkedList<TreeNode> _previousNodes = new java.util.LinkedList<>();
+ private java.util.LinkedList<TreeNode> _nextNodes = new java.util.LinkedList<>();
private TreeNode _currentNode;
private Editor _currentEditor;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/CellRenderer.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/CellRenderer.java
index e9c5adb16a0..da00e67dc98 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/CellRenderer.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/CellRenderer.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
import java.awt.Component;
import javax.swing.JTree;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Coordinator.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Coordinator.java
index a06e8617f97..63a307cbe63 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Coordinator.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Coordinator.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
import java.lang.reflect.Constructor;
import java.net.URI;
@@ -42,13 +42,13 @@ import java.security.KeyStore;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
-import Ice.LocatorFinderPrxHelper;
-import IceGrid.*;
+import com.zeroc.Ice.LocatorFinderPrx;
+import com.zeroc.IceGrid.*;
import javax.naming.ldap.LdapName;
import javax.naming.ldap.Rdn;
-import IceGridGUI.LiveDeployment.MetricsViewEditor.MetricsViewTransferableData;
+import com.zeroc.IceGridGUI.LiveDeployment.MetricsViewEditor.MetricsViewTransferableData;
//
// This class coordinates the communications between the various objects
@@ -204,7 +204,7 @@ public class Coordinator
else if(o instanceof JTree)
{
JTree tree = (JTree)o;
- if(tree.getModel().getRoot() instanceof IceGridGUI.Application.Root)
+ if(tree.getModel().getRoot() instanceof com.zeroc.IceGridGUI.Application.Root)
{
enableTreeEditActions();
}
@@ -265,11 +265,11 @@ public class Coordinator
private void enableTreeEditActions()
{
_cut.setTarget(null);
- _copy.setTarget(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.COPY));
- _paste.setTarget(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.PASTE));
- _delete.setTarget(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.DELETE));
- _moveUp.setTarget(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.MOVE_UP));
- _moveDown.setTarget(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.MOVE_DOWN));
+ _copy.setTarget(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.COPY));
+ _paste.setTarget(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.PASTE));
+ _delete.setTarget(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.DELETE));
+ _moveUp.setTarget(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.MOVE_UP));
+ _moveDown.setTarget(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.MOVE_DOWN));
}
private class MenuBar extends JMenuBar
@@ -295,11 +295,11 @@ public class Coordinator
_newMenu.add(_newApplicationWithDefaultTemplates);
_newMenu.addSeparator();
- _newMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_ADAPTER));
- _newMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_DBENV));
- _newMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_NODE));
- _newMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_PROPERTY_SET));
- _newMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_REPLICA_GROUP));
+ _newMenu.add(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_ADAPTER));
+ _newMenu.add(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_DBENV));
+ _newMenu.add(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_NODE));
+ _newMenu.add(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_PROPERTY_SET));
+ _newMenu.add(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_REPLICA_GROUP));
//
// Open sub-menu
@@ -314,9 +314,10 @@ public class Coordinator
_newServerMenu = new JMenu("Server");
_newServerMenu.setEnabled(false);
_newMenu.add(_newServerMenu);
- _newServerMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_SERVER));
- _newServerMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_SERVER_ICEBOX));
- _newServerMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_SERVER_FROM_TEMPLATE));
+ _newServerMenu.add(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_SERVER));
+ _newServerMenu.add(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_SERVER_ICEBOX));
+ _newServerMenu.add(
+ _appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_SERVER_FROM_TEMPLATE));
//
// New service sub-sub-menu
@@ -324,8 +325,9 @@ public class Coordinator
_newServiceMenu = new JMenu("Service");
_newServiceMenu.setEnabled(false);
_newMenu.add(_newServiceMenu);
- _newServiceMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_SERVICE));
- _newServiceMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_SERVICE_FROM_TEMPLATE));
+ _newServiceMenu.add(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_SERVICE));
+ _newServiceMenu.add(
+ _appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_SERVICE_FROM_TEMPLATE));
//
// New template sub-sub-menu
@@ -333,9 +335,11 @@ public class Coordinator
_newTemplateMenu = new JMenu("Template");
_newTemplateMenu.setEnabled(false);
_newMenu.add(_newTemplateMenu);
- _newTemplateMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVER));
- _newTemplateMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVER_ICEBOX));
- _newTemplateMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVICE));
+ _newTemplateMenu.add(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVER));
+ _newTemplateMenu.add(
+ _appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVER_ICEBOX));
+ _newTemplateMenu.add(
+ _appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVICE));
//
// New Graph sub-menu
@@ -419,8 +423,10 @@ public class Coordinator
_metricsViewMenu = new JMenu("Metrics View");
_metricsViewMenu.setEnabled(false);
toolsMenu.add(_metricsViewMenu);
- _metricsViewMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.ENABLE_METRICS_VIEW));
- _metricsViewMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.DISABLE_METRICS_VIEW));
+ _metricsViewMenu.add(
+ _liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.ENABLE_METRICS_VIEW));
+ _metricsViewMenu.add(
+ _liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.DISABLE_METRICS_VIEW));
//
// Node sub-menu
@@ -428,11 +434,11 @@ public class Coordinator
_nodeMenu = new JMenu("Node");
_nodeMenu.setEnabled(false);
toolsMenu.add(_nodeMenu);
- _nodeMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_ICE_LOG));
- _nodeMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDOUT));
- _nodeMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDERR));
+ _nodeMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_ICE_LOG));
+ _nodeMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDOUT));
+ _nodeMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDERR));
_nodeMenu.addSeparator();
- _nodeMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_NODE));
+ _nodeMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_NODE));
//
// Registry sub-menu
@@ -440,13 +446,13 @@ public class Coordinator
_registryMenu = new JMenu("Registry");
_registryMenu.setEnabled(false);
toolsMenu.add(_registryMenu);
- _registryMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.ADD_OBJECT));
+ _registryMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.ADD_OBJECT));
_registryMenu.addSeparator();
- _registryMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_ICE_LOG));
- _registryMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDOUT));
- _registryMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDERR));
+ _registryMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_ICE_LOG));
+ _registryMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDOUT));
+ _registryMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDERR));
_registryMenu.addSeparator();
- _registryMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_REGISTRY));
+ _registryMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_REGISTRY));
//
// Server sub-menu
@@ -454,31 +460,31 @@ public class Coordinator
_serverMenu = new JMenu("Server");
_serverMenu.setEnabled(false);
toolsMenu.add(_serverMenu);
- _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.START));
- _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.STOP));
+ _serverMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.START));
+ _serverMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.STOP));
_serverMenu.addSeparator();
- _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.ENABLE));
- _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.DISABLE));
+ _serverMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.ENABLE));
+ _serverMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.DISABLE));
_serverMenu.addSeparator();
- _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.PATCH_SERVER));
+ _serverMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.PATCH_SERVER));
_serverMenu.addSeparator();
- _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.WRITE_MESSAGE));
- _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_ICE_LOG));
- _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDOUT));
- _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDERR));
- _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_LOG_FILE));
+ _serverMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.WRITE_MESSAGE));
+ _serverMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_ICE_LOG));
+ _serverMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDOUT));
+ _serverMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDERR));
+ _serverMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_LOG_FILE));
_serverMenu.addSeparator();
_signalMenu = new JMenu("Send Signal");
_serverMenu.add(_signalMenu);
- _signalMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.SIGHUP));
- _signalMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.SIGINT));
- _signalMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.SIGQUIT));
- _signalMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.SIGKILL));
- _signalMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.SIGUSR1));
- _signalMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.SIGUSR2));
- _signalMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.SIGTERM));
+ _signalMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SIGHUP));
+ _signalMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SIGINT));
+ _signalMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SIGQUIT));
+ _signalMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SIGKILL));
+ _signalMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SIGUSR1));
+ _signalMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SIGUSR2));
+ _signalMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SIGTERM));
_serverMenu.addSeparator();
- _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.OPEN_DEFINITION));
+ _serverMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.OPEN_DEFINITION));
//
// Service sub-menu
@@ -486,11 +492,11 @@ public class Coordinator
_serviceMenu = new JMenu("Service");
_serviceMenu.setEnabled(false);
toolsMenu.add(_serviceMenu);
- _serviceMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.START));
- _serviceMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.STOP));
+ _serviceMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.START));
+ _serviceMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.STOP));
_serviceMenu.addSeparator();
- _serviceMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_ICE_LOG));
- _serviceMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_LOG_FILE));
+ _serviceMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_ICE_LOG));
+ _serviceMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_LOG_FILE));
//
// Help menu
@@ -598,48 +604,48 @@ public class Coordinator
}
}
- static private class ReuseConnectionRouter extends Ice._RouterDisp
+ static private class ReuseConnectionRouter implements com.zeroc.Ice.Router
{
public
- ReuseConnectionRouter(Ice.ObjectPrx proxy)
+ ReuseConnectionRouter(com.zeroc.Ice.ObjectPrx proxy)
{
_clientProxy = proxy;
}
@Override
- public Ice.ObjectPrx
- getClientProxy(Ice.Current current)
+ public com.zeroc.Ice.ObjectPrx
+ getClientProxy(com.zeroc.Ice.Current current)
{
return _clientProxy;
}
@Override
- public Ice.ObjectPrx
- getServerProxy(Ice.Current current)
+ public com.zeroc.Ice.ObjectPrx
+ getServerProxy(com.zeroc.Ice.Current current)
{
return null;
}
@Override
- public Ice.ObjectPrx[]
- addProxies(Ice.ObjectPrx[] proxies, Ice.Current current)
+ public com.zeroc.Ice.ObjectPrx[]
+ addProxies(com.zeroc.Ice.ObjectPrx[] proxies, com.zeroc.Ice.Current current)
{
- return new Ice.ObjectPrx[0];
+ return new com.zeroc.Ice.ObjectPrx[0];
}
- private final Ice.ObjectPrx _clientProxy;
+ private final com.zeroc.Ice.ObjectPrx _clientProxy;
}
- public Ice.Communicator getCommunicator()
+ public com.zeroc.Ice.Communicator getCommunicator()
{
if(_communicator == null)
{
- _communicator = Ice.Util.initialize(_initData);
+ _communicator = com.zeroc.Ice.Util.initialize(_initData);
}
return _communicator;
}
- public Ice.Properties getProperties()
+ public com.zeroc.Ice.Properties getProperties()
{
return _initData.properties;
}
@@ -715,13 +721,13 @@ public class Coordinator
//
// Essential: deep-copy desc!
//
- desc = IceGridGUI.Application.Root.copyDescriptor(desc);
- IceGridGUI.Application.Root root;
+ desc = com.zeroc.IceGridGUI.Application.Root.copyDescriptor(desc);
+ com.zeroc.IceGridGUI.Application.Root root;
try
{
- root = new IceGridGUI.Application.Root(this, desc, true, null);
+ root = new com.zeroc.IceGridGUI.Application.Root(this, desc, true, null);
}
- catch(IceGridGUI.Application.UpdateFailedException e)
+ catch(com.zeroc.IceGridGUI.Application.UpdateFailedException e)
{
JOptionPane.showMessageDialog(
_mainFrame,
@@ -744,7 +750,7 @@ public class Coordinator
_liveApplications.remove(name);
}
- public void addLiveApplication(IceGridGUI.Application.Root root)
+ public void addLiveApplication(com.zeroc.IceGridGUI.Application.Root root)
{
ApplicationPane app = _mainPane.findApplication(root);
assert app != null;
@@ -864,7 +870,7 @@ public class Coordinator
_liveDeploymentPane.refresh();
}
- void objectRemoved(Ice.Identity id)
+ void objectRemoved(com.zeroc.Ice.Identity id)
{
_liveDeploymentRoot.objectRemoved(id);
_liveDeploymentPane.refresh();
@@ -883,9 +889,10 @@ public class Coordinator
public void pasteApplication()
{
Object descriptor = getClipboard();
- ApplicationDescriptor desc = IceGridGUI.Application.Root.copyDescriptor((ApplicationDescriptor)descriptor);
+ ApplicationDescriptor desc =
+ com.zeroc.IceGridGUI.Application.Root.copyDescriptor((ApplicationDescriptor)descriptor);
- IceGridGUI.Application.Root root = new IceGridGUI.Application.Root(this, desc);
+ com.zeroc.IceGridGUI.Application.Root root = new com.zeroc.IceGridGUI.Application.Root(this, desc);
ApplicationPane app = new ApplicationPane(root);
_mainPane.addApplication(app);
_mainPane.setSelectedComponent(app);
@@ -925,78 +932,53 @@ public class Coordinator
boolean asyncRelease = false;
final String prefix = "Deleting application '" + name + "'...";
- Callback_Admin_removeApplication cb = new Callback_Admin_removeApplication()
- {
- @Override
- public void response()
+
+ if(_traceSaveToRegistry)
+ {
+ traceSaveToRegistry("sending removeApplication for application " + name);
+ }
+
+ try
+ {
+ _sessionKeeper.getAdmin().removeApplicationAsync(name).whenComplete((result, ex) ->
{
if(_traceSaveToRegistry)
{
- traceSaveToRegistry("removeApplication for application " + name + ": success");
+ traceSaveToRegistry("removeApplication for application " + name +
+ (ex == null ? ": success" : ": failed"));
}
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
+ if(ex == null)
+ {
+ SwingUtilities.invokeLater(() ->
{
release();
getStatusBar().setText(prefix + "done.");
- }
- });
- }
-
- @Override
- public void exception(final Ice.UserException e)
- {
- if(_traceSaveToRegistry)
- {
- traceSaveToRegistry("removeApplication for application " + name + ": failed");
+ });
}
-
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- handleFailure(prefix, "Delete failed",
- "IceGrid exception: " + e.toString());
- }
-
- });
- }
-
- @Override
- public void exception(final Ice.LocalException e)
- {
- if(_traceSaveToRegistry)
+ else
{
- traceSaveToRegistry("removeApplication for application " + name + ": failed");
- }
-
- SwingUtilities.invokeLater(new Runnable()
+ if(ex instanceof com.zeroc.Ice.UserException)
{
- @Override
- public void run()
- {
- handleFailure(prefix, "Delete failed",
- "Communication exception: " + e.toString());
- }
- });
- }
- };
-
- if(_traceSaveToRegistry)
- {
- traceSaveToRegistry("sending removeApplication for application " + name);
- }
-
- try
- {
- _sessionKeeper.getAdmin().begin_removeApplication(name, cb);
+ SwingUtilities.invokeLater(() ->
+ {
+ handleFailure(prefix, "Delete failed",
+ "IceGrid exception: " + ex.toString());
+ });
+ }
+ else
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ handleFailure(prefix, "Delete failed",
+ "Communication exception: " + ex.toString());
+ });
+ }
+ }
+ });
asyncRelease = true;
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
if(_traceSaveToRegistry)
{
@@ -1026,7 +1008,7 @@ public class Coordinator
{
accessDenied(e);
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
JOptionPane.showMessageDialog(
_mainFrame,
@@ -1117,13 +1099,13 @@ public class Coordinator
{
accessDenied(e);
}
- catch(Ice.ObjectNotExistException e)
+ catch(com.zeroc.Ice.ObjectNotExistException e)
{
//
// Ignored, the session is gone, and so is the exclusive access.
//
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
JOptionPane.showMessageDialog(
_mainFrame,
@@ -1226,7 +1208,7 @@ public class Coordinator
//
// Close al graphs
//
- java.util.List<IGraphView> views = new java.util.ArrayList<IGraphView>(_graphViews);
+ java.util.List<IGraphView> views = new java.util.ArrayList<>(_graphViews);
for(IGraphView v : views)
{
v.close();
@@ -1246,7 +1228,7 @@ public class Coordinator
_saveToRegistryWithoutRestart.setEnabled(false);
}
- enum TrustDecision{YesAlways, YesThisTime, No};
+ enum TrustDecision { YesAlways, YesThisTime, No };
void
login(final SessionKeeper sessionKeeper,
@@ -1254,7 +1236,6 @@ public class Coordinator
final JDialog parent,
final Cursor oldCursor)
{
-
//
// Keep certificates arround for connection retry
//
@@ -1263,10 +1244,10 @@ public class Coordinator
destroyCommunicator();
- Ice.InitializationData initData = _initData;
+ com.zeroc.Ice.InitializationData initData = _initData;
initData = initData.clone();
initData.properties = initData.properties._clone();
- initData.properties.setProperty("Ice.Plugin.IceSSL", "IceSSL.PluginFactory");
+ initData.properties.setProperty("Ice.Plugin.IceSSL", "com.zeroc.IceSSL.PluginFactory");
initData.properties.setProperty("IceSSL.VerifyPeer", "0");
if(info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType | info.getUseX509Certificate())
@@ -1297,9 +1278,9 @@ public class Coordinator
try
{
- _communicator = Ice.Util.initialize(initData);
+ _communicator = com.zeroc.Ice.Util.initialize(initData);
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
JOptionPane.showMessageDialog(parent,
e.toString(),
@@ -1309,9 +1290,10 @@ public class Coordinator
return;
}
- class CertificateVerifier implements IceSSL.CertificateVerifier
+ class CertificateVerifier implements com.zeroc.IceSSL.CertificateVerifier
{
- public CertificateVerifier() throws java.io.IOException, java.security.GeneralSecurityException, java.lang.Exception
+ public CertificateVerifier()
+ throws java.io.IOException, java.security.GeneralSecurityException, java.lang.Exception
{
{
_trustedCaKeyStore = KeyStore.getInstance("JKS");
@@ -1342,7 +1324,7 @@ public class Coordinator
class AcceptInvalidCertDialog implements Runnable
{
- public TrustDecision show(IceSSL.NativeConnectionInfo info, boolean validDate,
+ public TrustDecision show(com.zeroc.IceSSL.NativeConnectionInfo info, boolean validDate,
boolean validAlternateName, boolean trustedCA)
{
_info = info;
@@ -1388,7 +1370,7 @@ public class Coordinator
}
}
- private IceSSL.NativeConnectionInfo _info;
+ private com.zeroc.IceSSL.NativeConnectionInfo _info;
private boolean _validDate;
private boolean _validAlternateName;
private boolean _trustedCA;
@@ -1396,7 +1378,7 @@ public class Coordinator
}
@Override
- public boolean verify(IceSSL.NativeConnectionInfo info)
+ public boolean verify(com.zeroc.IceSSL.NativeConnectionInfo info)
{
if(!(info.nativeCerts[0] instanceof X509Certificate))
{
@@ -1499,11 +1481,11 @@ public class Coordinator
}
String remoteAddress = null;
- for(Ice.ConnectionInfo p = info.underlying; p != null; p = p.underlying)
+ for(com.zeroc.Ice.ConnectionInfo p = info.underlying; p != null; p = p.underlying)
{
- if(p instanceof Ice.IPConnectionInfo)
+ if(p instanceof com.zeroc.Ice.IPConnectionInfo)
{
- remoteAddress = ((Ice.IPConnectionInfo)p).remoteAddress;
+ remoteAddress = ((com.zeroc.Ice.IPConnectionInfo)p).remoteAddress;
break;
}
}
@@ -1638,7 +1620,8 @@ public class Coordinator
@Override
public void run()
{
- JOptionPane.showMessageDialog(parent, ex.toString(), "Error saving certificate",
+ JOptionPane.showMessageDialog(parent, ex.toString(),
+ "Error saving certificate",
JOptionPane.ERROR_MESSAGE);
}
});
@@ -1661,7 +1644,7 @@ public class Coordinator
private KeyStore _trustedServerKeyStore;
}
- IceSSL.Plugin plugin = (IceSSL.Plugin)_communicator.getPluginManager().getPlugin("IceSSL");
+ com.zeroc.IceSSL.Plugin plugin = (com.zeroc.IceSSL.Plugin)_communicator.getPluginManager().getPlugin("IceSSL");
try
{
plugin.setCertificateVerifier(new CertificateVerifier());
@@ -1772,169 +1755,126 @@ public class Coordinator
{
try
{
- Ice.RouterFinderPrx finder = Ice.RouterFinderPrxHelper.uncheckedCast(
- _communicator.stringToProxy(finderStr));
+ com.zeroc.Ice.RouterFinderPrx finder = com.zeroc.Ice.RouterFinderPrx.uncheckedCast(
+ _communicator.stringToProxy(finderStr));
info.setInstanceName(finder.getRouter().ice_getIdentity().category);
info.save();
- Glacier2.RouterPrx router = Glacier2.RouterPrxHelper.uncheckedCast(
- finder.ice_identity(new Ice.Identity("router", info.getInstanceName())));
+ com.zeroc.Glacier2.RouterPrx router = com.zeroc.Glacier2.RouterPrx.uncheckedCast(
+ finder.ice_identity(new com.zeroc.Ice.Identity("router", info.getInstanceName())));
//
// The session must be routed through this router
//
_communicator.setDefaultRouter(router);
-
- Glacier2.SessionPrx s;
+ com.zeroc.Glacier2.SessionPrx s;
if(info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType)
{
- router = Glacier2.RouterPrxHelper.uncheckedCast(router.ice_secure(true));
+ router = com.zeroc.Glacier2.RouterPrx.uncheckedCast(router.ice_secure(true));
s = router.createSessionFromSecureConnection();
if(s == null)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
- {
- JOptionPane.showMessageDialog(
- parent,
- "createSessionFromSecureConnection returned a null session: \n"
- + "verify that Glacier2.SSLSessionManager is set to "
- + "<IceGridInstanceName>/AdminSSLSessionManager in your Glacier2 "
- + "router configuration",
- "Login failed",
- JOptionPane.ERROR_MESSAGE);
- cb.loginFailed();
- }
+ JOptionPane.showMessageDialog(
+ parent,
+ "createSessionFromSecureConnection returned a null session: \n"
+ + "verify that Glacier2.SSLSessionManager is set to "
+ + "<IceGridInstanceName>/AdminSSLSessionManager in your Glacier2 "
+ + "router configuration",
+ "Login failed",
+ JOptionPane.ERROR_MESSAGE);
+ cb.loginFailed();
});
return;
}
}
else
{
- router = Glacier2.RouterPrxHelper.uncheckedCast(router.ice_preferSecure(true));
+ router = com.zeroc.Glacier2.RouterPrx.uncheckedCast(router.ice_preferSecure(true));
s = router.createSession(info.getUsername(), info.getPassword() != null ?
new String(info.getPassword()) : "");
if(s == null)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
- {
- JOptionPane.showMessageDialog(
- parent,
- "createSession returned a null session: \n"
- + "verify that Glacier2.SessionManager is set to "
- + "<IceGridInstanceName>/AdminSessionManager in your Glacier2 "
- + "router configuration",
- "Login failed",
- JOptionPane.ERROR_MESSAGE);
- cb.loginFailed();
- }
+ JOptionPane.showMessageDialog(
+ parent,
+ "createSession returned a null session: \n"
+ + "verify that Glacier2.SessionManager is set to "
+ + "<IceGridInstanceName>/AdminSessionManager in your Glacier2 "
+ + "router configuration",
+ "Login failed",
+ JOptionPane.ERROR_MESSAGE);
+ cb.loginFailed();
});
return;
}
}
- cb.setSession(AdminSessionPrxHelper.uncheckedCast(s));
+ cb.setSession(AdminSessionPrx.uncheckedCast(s));
cb.setSessionTimeout(router.getSessionTimeout());
try
{
cb.setACMTimeout(router.getACMTimeout());
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- cb.loginSuccess();
- }
- });
+ SwingUtilities.invokeLater(() -> cb.loginSuccess());
}
- catch(final Glacier2.PermissionDeniedException e)
+ catch(final com.zeroc.Glacier2.PermissionDeniedException e)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
+ String msg = e.reason;
+ if(msg.length() == 0)
{
- String msg = e.reason;
- if(msg.length() == 0)
- {
- msg = info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType ?
- "Invalid credentials" : "Invalid username/password";
- }
- if(info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType)
- {
- JOptionPane.showMessageDialog(parent,
- "Permission denied: "
- + msg,
- "Login failed",
- JOptionPane.ERROR_MESSAGE);
- cb.loginFailed();
- }
- else
- {
- cb.permissionDenied(msg);
- }
+ msg = info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType ?
+ "Invalid credentials" : "Invalid username/password";
+ }
+ if(info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType)
+ {
+ JOptionPane.showMessageDialog(parent, "Permission denied: " + msg,
+ "Login failed", JOptionPane.ERROR_MESSAGE);
+ cb.loginFailed();
+ }
+ else
+ {
+ cb.permissionDenied(msg);
}
});
return;
}
- catch(final Glacier2.CannotCreateSessionException e)
+ catch(final com.zeroc.Glacier2.CannotCreateSessionException e)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
- {
- JOptionPane.showMessageDialog(parent, "Could not create session: "
- + e.reason,
- "Login failed",
- JOptionPane.ERROR_MESSAGE);
- cb.loginFailed();
- }
+ JOptionPane.showMessageDialog(parent, "Could not create session: " + e.reason,
+ "Login failed", JOptionPane.ERROR_MESSAGE);
+ cb.loginFailed();
});
return;
}
catch(final java.util.prefs.BackingStoreException ex)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
- {
- JOptionPane.showMessageDialog(
- getMainFrame(),
- ex.toString(),
- "Error saving connection",
- JOptionPane.ERROR_MESSAGE);
- }
+ JOptionPane.showMessageDialog(getMainFrame(), ex.toString(),
+ "Error saving connection", JOptionPane.ERROR_MESSAGE);
});
return;
}
- catch(final Ice.LocalException e)
+ catch(final com.zeroc.Ice.LocalException e)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
- {
- JOptionPane.showMessageDialog(parent,
- "Could not create session: "
- + e.toString(),
- "Login failed",
- JOptionPane.ERROR_MESSAGE);
- cb.loginFailed();
- }
+ JOptionPane.showMessageDialog(parent, "Could not create session: " + e.toString(),
+ "Login failed", JOptionPane.ERROR_MESSAGE);
+ cb.loginFailed();
});
return;
}
@@ -1965,17 +1905,17 @@ public class Coordinator
return _currentRegistry;
}
- synchronized public void setLocator(IceGrid.LocatorPrx locator)
+ synchronized public void setLocator(com.zeroc.IceGrid.LocatorPrx locator)
{
_locator = locator;
}
- synchronized public IceGrid.LocatorPrx getLocator()
+ synchronized public com.zeroc.IceGrid.LocatorPrx getLocator()
{
return _locator;
}
- private IceGrid.LocatorPrx _locator;
+ private com.zeroc.IceGrid.LocatorPrx _locator;
private RegistryPrx _registry;
private RegistryPrx _currentRegistry;
}
@@ -2002,8 +1942,8 @@ public class Coordinator
{
try
{
- Ice.LocatorFinderPrx finder = LocatorFinderPrxHelper.uncheckedCast(
- _communicator.stringToProxy(finderStr));
+ LocatorFinderPrx finder = LocatorFinderPrx.uncheckedCast(
+ _communicator.stringToProxy(finderStr));
info.setInstanceName(finder.getLocator().ice_getIdentity().category);
info.save();
@@ -2011,24 +1951,21 @@ public class Coordinator
//
// The client uses the locator only without routing
//
- cb.setLocator(IceGrid.LocatorPrxHelper.checkedCast(
- finder.ice_identity(new Ice.Identity("Locator", info.getInstanceName()))));
+ cb.setLocator(com.zeroc.IceGrid.LocatorPrx.checkedCast(
+ finder.ice_identity(
+ new com.zeroc.Ice.Identity("Locator", info.getInstanceName()))));
if(cb.getLocator() == null)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
- {
- JOptionPane.showMessageDialog(
- parent,
- "This version of IceGrid Admin requires an IceGrid Registry "
- + "version 3.3",
- "Version Mismatch",
- JOptionPane.ERROR_MESSAGE);
- cb.loginFailed();
- }
+ JOptionPane.showMessageDialog(
+ parent,
+ "This version of IceGrid Admin requires an IceGrid Registry "
+ + "version 3.3",
+ "Version Mismatch",
+ JOptionPane.ERROR_MESSAGE);
+ cb.loginFailed();
});
return;
}
@@ -2051,20 +1988,16 @@ public class Coordinator
});
return;
}
- catch(final Ice.LocalException e)
+ catch(final com.zeroc.Ice.LocalException e)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
- {
- JOptionPane.showMessageDialog(
- parent,
- "Could not create session: " + e.toString(),
- "Login failed",
- JOptionPane.ERROR_MESSAGE);
- cb.loginFailed();
- }
+ JOptionPane.showMessageDialog(
+ parent,
+ "Could not create session: " + e.toString(),
+ "Login failed",
+ JOptionPane.ERROR_MESSAGE);
+ cb.loginFailed();
});
return;
}
@@ -2073,13 +2006,13 @@ public class Coordinator
if(info.getConnectToMaster() &&
!cb.getCurrentRegistry().ice_getIdentity().name.equals("Registry"))
{
- Ice.Identity masterRegistryId = new Ice.Identity();
+ com.zeroc.Ice.Identity masterRegistryId = new com.zeroc.Ice.Identity();
masterRegistryId.category = info.getInstanceName();
masterRegistryId.name = "Registry";
- cb.setRegistry(RegistryPrxHelper.
- uncheckedCast(_communicator.stringToProxy(
- "\"" + Ice.Util.identityToString(masterRegistryId) + "\"")));
+ cb.setRegistry(RegistryPrx.uncheckedCast(_communicator.stringToProxy(
+ "\"" + com.zeroc.Ice.Util.identityToString(masterRegistryId) +
+ "\"")));
}
//
@@ -2091,24 +2024,21 @@ public class Coordinator
{
try
{
- Ice.ObjectAdapter colloc = _communicator.createObjectAdapter("");
- Ice.ObjectPrx router = colloc.addWithUUID(new ReuseConnectionRouter(cb.getLocator()));
- _communicator.setDefaultRouter(Ice.RouterPrxHelper.uncheckedCast(router));
- cb.setRegistry(RegistryPrxHelper.uncheckedCast(cb.getRegistry().ice_router(
- _communicator.getDefaultRouter())));
+ com.zeroc.Ice.ObjectAdapter colloc = _communicator.createObjectAdapter("");
+ com.zeroc.Ice.ObjectPrx router =
+ colloc.addWithUUID(new ReuseConnectionRouter(cb.getLocator()));
+ _communicator.setDefaultRouter(com.zeroc.Ice.RouterPrx.uncheckedCast(router));
+ cb.setRegistry(cb.getRegistry().ice_router(_communicator.getDefaultRouter()));
}
- catch(final Ice.LocalException e)
+ catch(final com.zeroc.Ice.LocalException e)
{
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
+ SwingUtilities.invokeLater(() ->
{
- JOptionPane.showMessageDialog(parent, "Could not create session: " + e.toString(),
- "Login failed", JOptionPane.ERROR_MESSAGE);
+ JOptionPane.showMessageDialog(parent, "Could not create session: " +
+ e.toString(), "Login failed",
+ JOptionPane.ERROR_MESSAGE);
cb.loginFailed();
- }
- });
+ });
return;
}
}
@@ -2118,15 +2048,13 @@ public class Coordinator
{
if(info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType)
{
- cb.setRegistry(RegistryPrxHelper.uncheckedCast(
- cb.getRegistry().ice_secure(true)));
+ cb.setRegistry(cb.getRegistry().ice_secure(true));
cb.setSession(cb.getRegistry().createAdminSessionFromSecureConnection());
assert cb.getSession() != null;
}
else
{
- cb.setRegistry(RegistryPrxHelper.uncheckedCast(
- cb.getRegistry().ice_preferSecure(true)));
+ cb.setRegistry(cb.getRegistry().ice_preferSecure(true));
cb.setSession(cb.getRegistry().createAdminSession(info.getUsername(),
info.getPassword() != null ? new String(info.getPassword()) : ""));
@@ -2137,58 +2065,46 @@ public class Coordinator
{
cb.setACMTimeout(cb.getRegistry().getACMTimeout());
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
}
- catch(final IceGrid.PermissionDeniedException e)
+ catch(final com.zeroc.IceGrid.PermissionDeniedException e)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
+ String msg = e.reason;
+ if(msg.length() == 0)
{
- String msg = e.reason;
- if(msg.length() == 0)
- {
- msg = info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType ?
- "Invalid credentials" : "Invalid username/password";
- }
+ msg = info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType ?
+ "Invalid credentials" : "Invalid username/password";
+ }
- if(info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType)
- {
- JOptionPane.showMessageDialog(parent,
- "Permission denied: "
- + e.reason,
- "Login failed",
- JOptionPane.ERROR_MESSAGE);
- cb.loginFailed();
- }
- else
- {
- cb.permissionDenied(msg);
- }
+ if(info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType)
+ {
+ JOptionPane.showMessageDialog(parent, "Permission denied: " + e.reason,
+ "Login failed",
+ JOptionPane.ERROR_MESSAGE);
+ cb.loginFailed();
+ }
+ else
+ {
+ cb.permissionDenied(msg);
}
});
return;
}
-
- catch(final Ice.LocalException e)
+ catch(final com.zeroc.Ice.LocalException e)
{
- if(cb.getRegistry().ice_getIdentity().equals(cb.getCurrentRegistry().ice_getIdentity()))
+ if(cb.getRegistry().ice_getIdentity().equals(
+ cb.getCurrentRegistry().ice_getIdentity()))
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
- {
- JOptionPane.showMessageDialog(parent,
- "Could not create session: "
- + e.toString(),
- "Login failed",
- JOptionPane.ERROR_MESSAGE);
- cb.loginFailed();
- }
+ JOptionPane.showMessageDialog(parent, "Could not create session: " +
+ e.toString(), "Login failed",
+ JOptionPane.ERROR_MESSAGE);
+ cb.loginFailed();
});
return;
}
@@ -2198,25 +2114,22 @@ public class Coordinator
{
try
{
- SwingUtilities.invokeAndWait(new Runnable()
+ SwingUtilities.invokeAndWait(() ->
{
- @Override
- public void run()
+ if(JOptionPane.showConfirmDialog(
+ parent,
+ "Unable to connect to the Master Registry:\n " +
+ e.toString() +
+ "\n\nDo you want to connect to a Slave Registry?",
+ "Cannot connect to Master Registry",
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION)
+ {
+ cb.setRegistry(cb.getCurrentRegistry());
+ }
+ else
{
- if(JOptionPane.showConfirmDialog(
- parent,
- "Unable to connect to the Master Registry:\n " + e.toString()
- + "\n\nDo you want to connect to a Slave Registry?",
- "Cannot connect to Master Registry",
- JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION)
- {
- cb.setRegistry(cb.getCurrentRegistry());
- }
- else
- {
- cb.loginFailed();
- }
+ cb.loginFailed();
}
});
break;
@@ -2239,14 +2152,7 @@ public class Coordinator
}
} while(cb.getSession() == null);
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- cb.loginSuccess();
- }
- });
+ SwingUtilities.invokeLater(() -> cb.loginSuccess());
}
}
}).start();
@@ -2261,14 +2167,14 @@ public class Coordinator
{
if(!routed)
{
- session.begin_destroy();
+ session.destroyAsync();
}
else
{
- Glacier2.RouterPrxHelper.uncheckedCast(_communicator.getDefaultRouter()).begin_destroySession();
+ com.zeroc.Glacier2.RouterPrx.uncheckedCast(_communicator.getDefaultRouter()).destroySessionAsync();
}
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
}
}
@@ -2333,17 +2239,17 @@ public class Coordinator
return _sessionKeeper.getServerAdminCategory();
}
- public Ice.ObjectPrx addCallback(Ice.Object servant, String name, String facet)
+ public com.zeroc.Ice.ObjectPrx addCallback(com.zeroc.Ice.Object servant, String name, String facet)
{
return _sessionKeeper.addCallback(servant, name, facet);
}
- public Ice.ObjectPrx retrieveCallback(String name, String facet)
+ public com.zeroc.Ice.ObjectPrx retrieveCallback(String name, String facet)
{
return _sessionKeeper.retrieveCallback(name, facet);
}
- public Ice.Object removeCallback(String name, String facet)
+ public com.zeroc.Ice.Object removeCallback(String name, String facet)
{
return _sessionKeeper.removeCallback(name, facet);
}
@@ -2424,7 +2330,7 @@ public class Coordinator
try
{
- FileParserPrx fileParser = FileParserPrxHelper.checkedCast(
+ FileParserPrx fileParser = FileParserPrx.checkedCast(
getCommunicator().stringToProxy(_fileParser).ice_router(null));
return fileParser.parse(file.getAbsolutePath(), _sessionKeeper.getRoutedAdmin());
}
@@ -2437,7 +2343,7 @@ public class Coordinator
JOptionPane.ERROR_MESSAGE);
return null;
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
JOptionPane.showMessageDialog(
_mainFrame,
@@ -2458,13 +2364,14 @@ public class Coordinator
_icegridadminProcess.destroy();
}
catch(Exception e)
- {}
+ {
+ }
_icegridadminProcess = null;
_fileParser = null;
}
}
- public File saveToFile(boolean ask, IceGridGUI.Application.Root root, File file)
+ public File saveToFile(boolean ask, com.zeroc.IceGridGUI.Application.Root root, File file)
{
if(ask || file == null)
{
@@ -2541,9 +2448,9 @@ public class Coordinator
return _saveIceLogChooser;
}
- static private Ice.Properties createProperties(Ice.StringSeqHolder args)
+ static private com.zeroc.Ice.Util.CreatePropertiesResult createProperties(String[] args)
{
- Ice.Properties properties = Ice.Util.createProperties();
+ com.zeroc.Ice.Properties properties = com.zeroc.Ice.Util.createProperties();
//
// Set various default values
@@ -2555,28 +2462,27 @@ public class Coordinator
//
properties.setProperty("Ice.RetryIntervals", "-1");
- return Ice.Util.createProperties(args, properties);
+ return com.zeroc.Ice.Util.createProperties(args, properties);
}
- Coordinator(JFrame mainFrame, Ice.StringSeqHolder args, Preferences prefs)
+ Coordinator(JFrame mainFrame, String[] args, Preferences prefs)
{
_connected = false;
_mainFrame = mainFrame;
_prefs = prefs;
- _initData = new Ice.InitializationData();
+ _initData = new com.zeroc.Ice.InitializationData();
_initData.logger = new Logger(mainFrame);
- _initData.properties = createProperties(args);
+ _initData.properties = createProperties(args).properties;
//
- // We enable IceSSL so the communicator knows how to parse ssl
- // endpoints.
+ // We enable IceSSL so the communicator knows how to parse ssl endpoints.
//
- _initData.properties.setProperty("Ice.Plugin.IceSSL", "IceSSL.PluginFactory");
+ _initData.properties.setProperty("Ice.Plugin.IceSSL", "com.zeroc.IceSSL.PluginFactory");
- if(args.value.length > 0)
+ if(args.length > 0)
{
String msg = "Extra command-line arguments: ";
- for(String arg : args.value)
+ for(String arg : args)
{
msg += arg + " ";
}
@@ -2586,7 +2492,7 @@ public class Coordinator
_traceObservers = _initData.properties.getPropertyAsInt("IceGridAdmin.Trace.Observers") > 0;
_traceSaveToRegistry = _initData.properties.getPropertyAsInt("IceGridAdmin.Trace.SaveToRegistry") > 0;
- _liveDeploymentRoot = new IceGridGUI.LiveDeployment.Root(this);
+ _liveDeploymentRoot = new com.zeroc.IceGridGUI.LiveDeployment.Root(this);
_sessionKeeper = new SessionKeeper(this);
@@ -2710,15 +2616,14 @@ public class Coordinator
{
if(_graphViews.size() > 0)
{
- if(JOptionPane.YES_OPTION != JOptionPane.showConfirmDialog(getMainFrame(),
- "Close all open Metrics Graph Views and logout?",
- "Confirm logout",
- JOptionPane.YES_NO_OPTION))
+ if(JOptionPane.YES_OPTION != JOptionPane.showConfirmDialog(
+ getMainFrame(), "Close all open Metrics Graph Views and logout?", "Confirm logout",
+ JOptionPane.YES_NO_OPTION))
{
return;
}
- java.util.List<IGraphView> views = new java.util.ArrayList<IGraphView>(_graphViews);
+ java.util.List<IGraphView> views = new java.util.ArrayList<>(_graphViews);
for(IGraphView v : views)
{
v.close();
@@ -2794,7 +2699,7 @@ public class Coordinator
}
else
{
- java.util.List<Object> names = new java.util.ArrayList<Object>();
+ java.util.List<Object> names = new java.util.ArrayList<>();
names.add("<All>");
names.addAll(java.util.Arrays.asList(applicationNames));
String appName = (String)JOptionPane.showInputDialog(
@@ -2834,12 +2739,12 @@ public class Coordinator
if(desc != null)
{
- IceGridGUI.Application.Root root;
+ com.zeroc.IceGridGUI.Application.Root root;
try
{
- root = new IceGridGUI.Application.Root(Coordinator.this, desc, false, file);
+ root = new com.zeroc.IceGridGUI.Application.Root(Coordinator.this, desc, false, file);
}
- catch(IceGridGUI.Application.UpdateFailedException ex)
+ catch(com.zeroc.IceGridGUI.Application.UpdateFailedException ex)
{
JOptionPane.showMessageDialog(
_mainFrame,
@@ -2888,7 +2793,7 @@ public class Coordinator
ApplicationPane app = openLiveApplication(appName);
if(app != null)
{
- IceGridGUI.Application.Root root = app.getRoot();
+ com.zeroc.IceGridGUI.Application.Root root = app.getRoot();
if(root.getSelectedNode() == null)
{
root.setSelectedNode(root);
@@ -3084,7 +2989,7 @@ public class Coordinator
else
{
String appName = (String)JOptionPane.showInputDialog(
- _mainFrame, "Which Application do you want to patch?",
+ _mainFrame, "Which application do you want to patch?",
"Patch application",
JOptionPane.QUESTION_MESSAGE, null,
applicationNames, applicationNames[0]);
@@ -3119,7 +3024,7 @@ public class Coordinator
if(appName == null)
{
appName = (String)JOptionPane.showInputDialog(
- _mainFrame, "Which Application do you to display",
+ _mainFrame, "Which application do you to display",
"Show details",
JOptionPane.QUESTION_MESSAGE, null,
applicationNames, applicationNames[0]);
@@ -3152,7 +3057,7 @@ public class Coordinator
else
{
String appName = (String)JOptionPane.showInputDialog(
- _mainFrame, "Which Application do you want to remove?",
+ _mainFrame, "Which application do you want to remove?",
"Remove application",
JOptionPane.QUESTION_MESSAGE, null,
applicationNames, applicationNames[0]);
@@ -3185,14 +3090,16 @@ public class Coordinator
_moveUp = new ActionWrapper("Move Up");
_moveDown = new ActionWrapper("Move Down");
- _showVarsMenuItem = new JCheckBoxMenuItem(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.SHOW_VARS));
- _showVarsTool = new JToggleButton(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.SHOW_VARS));
+ _showVarsMenuItem =
+ new JCheckBoxMenuItem(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.SHOW_VARS));
+ _showVarsTool = new JToggleButton(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.SHOW_VARS));
_showVarsTool.setIcon(Utils.getIcon("/icons/24x24/show_vars.png"));
_showVarsTool.setText("");
_substituteMenuItem = new
- JCheckBoxMenuItem(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.SUBSTITUTE_VARS));
- _substituteTool = new JToggleButton(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.SUBSTITUTE_VARS));
+ JCheckBoxMenuItem(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.SUBSTITUTE_VARS));
+ _substituteTool =
+ new JToggleButton(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.SUBSTITUTE_VARS));
_substituteTool.setIcon(Utils.getIcon("/icons/24x24/substitute.png"));
_substituteTool.setText("");
@@ -3238,7 +3145,7 @@ public class Coordinator
public IGraphView createGraphView()
{
IGraphView view = null;
- Class<?> c1 = IceInternal.Util.findClass("IceGridGUI.LiveDeployment.GraphView", null);
+ Class<?> c1 = com.zeroc.IceInternal.Util.findClass("com.zeroc.IceGridGUI.LiveDeployment.GraphView", null);
if(c1 == null)
{
JOptionPane.showMessageDialog(_mainFrame,
@@ -3246,7 +3153,7 @@ public class Coordinator
"IceGrid Admin Info",
JOptionPane.INFORMATION_MESSAGE);
}
- else if(IceInternal.Util.findClass("javafx.embed.swing.JFXPanel", null) == null)
+ else if(com.zeroc.IceInternal.Util.findClass("javafx.embed.swing.JFXPanel", null) == null)
{
JOptionPane.showMessageDialog(_mainFrame,
"The Metrics Graph view requires JavaFX 2",
@@ -3290,7 +3197,7 @@ public class Coordinator
return _liveDeploymentPane;
}
- public IceGridGUI.LiveDeployment.Root getLiveDeploymentRoot()
+ public com.zeroc.IceGridGUI.LiveDeployment.Root getLiveDeploymentRoot()
{
return _liveDeploymentRoot;
}
@@ -3307,7 +3214,7 @@ public class Coordinator
"", new java.util.LinkedList<String>()),
"",
new java.util.HashMap<String, PropertySetDescriptor>());
- IceGridGUI.Application.Root root = new IceGridGUI.Application.Root(this, desc);
+ com.zeroc.IceGridGUI.Application.Root root = new com.zeroc.IceGridGUI.Application.Root(this, desc);
ApplicationPane app = new ApplicationPane(root);
_mainPane.addApplication(app);
_mainPane.setSelectedComponent(app);
@@ -3321,7 +3228,7 @@ public class Coordinator
{
ApplicationDescriptor descriptor = getAdmin().getDefaultApplicationDescriptor();
descriptor.name = "NewApplication";
- IceGridGUI.Application.Root root = new IceGridGUI.Application.Root(this, descriptor);
+ com.zeroc.IceGridGUI.Application.Root root = new com.zeroc.IceGridGUI.Application.Root(this, descriptor);
ApplicationPane app = new ApplicationPane(root);
_mainPane.addApplication(app);
_mainPane.setSelectedComponent(app);
@@ -3336,7 +3243,7 @@ public class Coordinator
"Deployment Exception",
JOptionPane.ERROR_MESSAGE);
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
JOptionPane.showMessageDialog(
_mainFrame,
@@ -3353,14 +3260,14 @@ public class Coordinator
private void helpContents()
{
- int pos = Ice.Util.stringVersion().indexOf('b');
+ int pos = com.zeroc.Ice.Util.stringVersion().indexOf('b');
if(pos == -1)
{
- pos = Ice.Util.stringVersion().lastIndexOf('.');
+ pos = com.zeroc.Ice.Util.stringVersion().lastIndexOf('.');
assert(pos != -1);
}
- String version = Ice.Util.stringVersion().substring(0, pos);
+ String version = com.zeroc.Ice.Util.stringVersion().substring(0, pos);
Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
if(desktop != null && desktop.isSupported(Desktop.Action.BROWSE))
@@ -3384,7 +3291,7 @@ public class Coordinator
private void about()
{
String text = "IceGrid Admin version "
- + Ice.Util.stringVersion() + "\n"
+ + com.zeroc.Ice.Util.stringVersion() + "\n"
+ "Copyright \u00A9 2005-2016 ZeroC, Inc. All rights reserved.\n";
JOptionPane.showMessageDialog(
@@ -3426,7 +3333,7 @@ public class Coordinator
return;
}
- java.util.List<IGraphView> views = new java.util.ArrayList<IGraphView>(_graphViews);
+ java.util.List<IGraphView> views = new java.util.ArrayList<>(_graphViews);
for(IGraphView v : views)
{
v.close();
@@ -3468,7 +3375,7 @@ public class Coordinator
{
_communicator.destroy();
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
}
_communicator = null;
@@ -3553,7 +3460,7 @@ public class Coordinator
return _appActionsForPopup;
}
- public void showActions(IceGridGUI.LiveDeployment.TreeNode node)
+ public void showActions(com.zeroc.IceGridGUI.LiveDeployment.TreeNode node)
{
boolean[] availableActions = _liveActionsForMenu.setTarget(node);
_appActionsForMenu.setTarget(null);
@@ -3564,42 +3471,42 @@ public class Coordinator
_appMenu.setEnabled(true);
- _metricsViewMenu.setEnabled(availableActions[IceGridGUI.LiveDeployment.TreeNode.ENABLE_METRICS_VIEW] ||
- availableActions[IceGridGUI.LiveDeployment.TreeNode.DISABLE_METRICS_VIEW]);
+ _metricsViewMenu.setEnabled(availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.ENABLE_METRICS_VIEW] ||
+ availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.DISABLE_METRICS_VIEW]);
- _nodeMenu.setEnabled(availableActions[IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_NODE]);
+ _nodeMenu.setEnabled(availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_NODE]);
- _registryMenu.setEnabled(availableActions[IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_REGISTRY]);
+ _registryMenu.setEnabled(availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_REGISTRY]);
- _signalMenu.setEnabled(availableActions[IceGridGUI.LiveDeployment.TreeNode.SIGHUP]);
+ _signalMenu.setEnabled(availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SIGHUP]);
- _serverMenu.setEnabled(availableActions[IceGridGUI.LiveDeployment.TreeNode.OPEN_DEFINITION]);
+ _serverMenu.setEnabled(availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.OPEN_DEFINITION]);
- _serviceMenu.setEnabled(node instanceof IceGridGUI.LiveDeployment.Service &&
- (availableActions[IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_ICE_LOG] ||
- availableActions[IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_LOG_FILE] ||
- availableActions[IceGridGUI.LiveDeployment.TreeNode.START] ||
- availableActions[IceGridGUI.LiveDeployment.TreeNode.STOP]));
+ _serviceMenu.setEnabled(node instanceof com.zeroc.IceGridGUI.LiveDeployment.Service &&
+ (availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_ICE_LOG] ||
+ availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_LOG_FILE] ||
+ availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.START] ||
+ availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.STOP]));
}
- public void showActions(IceGridGUI.Application.TreeNode node)
+ public void showActions(com.zeroc.IceGridGUI.Application.TreeNode node)
{
boolean[] availableActions = _appActionsForMenu.setTarget(node);
_liveActionsForMenu.setTarget(null);
_newServerMenu.setEnabled(
- availableActions[IceGridGUI.Application.TreeNode.NEW_SERVER] ||
- availableActions[IceGridGUI.Application.TreeNode.NEW_SERVER_ICEBOX] ||
- availableActions[IceGridGUI.Application.TreeNode.NEW_SERVER_FROM_TEMPLATE]);
+ availableActions[com.zeroc.IceGridGUI.Application.TreeNode.NEW_SERVER] ||
+ availableActions[com.zeroc.IceGridGUI.Application.TreeNode.NEW_SERVER_ICEBOX] ||
+ availableActions[com.zeroc.IceGridGUI.Application.TreeNode.NEW_SERVER_FROM_TEMPLATE]);
_newServiceMenu.setEnabled(
- availableActions[IceGridGUI.Application.TreeNode.NEW_SERVICE] ||
- availableActions[IceGridGUI.Application.TreeNode.NEW_SERVICE_FROM_TEMPLATE]);
+ availableActions[com.zeroc.IceGridGUI.Application.TreeNode.NEW_SERVICE] ||
+ availableActions[com.zeroc.IceGridGUI.Application.TreeNode.NEW_SERVICE_FROM_TEMPLATE]);
_newTemplateMenu.setEnabled(
- availableActions[IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVER] ||
- availableActions[IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVER_ICEBOX] ||
- availableActions[IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVICE]);
+ availableActions[com.zeroc.IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVER] ||
+ availableActions[com.zeroc.IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVER_ICEBOX] ||
+ availableActions[com.zeroc.IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVICE]);
_appMenu.setEnabled(false);
_metricsViewMenu.setEnabled(false);
@@ -3692,7 +3599,8 @@ public class Coordinator
{
throw new Exception("Could not get Documents dir from Windows registry key `" + regKey + "'");
}
- _dataDir += File.separator + "ZeroC" + File.separator + "IceGrid Admin" + File.separator + "KeyStore";
+ _dataDir += File.separator + "ZeroC" + File.separator + "IceGrid Admin" + File.separator +
+ "KeyStore";
}
catch(java.io.IOException ex)
{
@@ -3705,8 +3613,8 @@ public class Coordinator
}
else
{
- _dataDir = System.getProperty("user.home") + File.separator + ".ZeroC" + File.separator + "IceGrid Admin" +
- File.separator + "KeyStore";
+ _dataDir = System.getProperty("user.home") + File.separator + ".ZeroC" + File.separator +
+ "IceGrid Admin" + File.separator + "KeyStore";
}
}
if(!new File(_dataDir).isDirectory())
@@ -3758,8 +3666,8 @@ public class Coordinator
static class UntrustedCertificateDialog extends JDialog
{
- public UntrustedCertificateDialog(java.awt.Window owner, IceSSL.NativeConnectionInfo info, boolean validDate,
- boolean validAlternateName, boolean trustedCA)
+ public UntrustedCertificateDialog(java.awt.Window owner, com.zeroc.IceSSL.NativeConnectionInfo info,
+ boolean validDate, boolean validAlternateName, boolean trustedCA)
throws java.security.GeneralSecurityException, java.io.IOException,
javax.naming.InvalidNameException
{
@@ -3864,16 +3772,18 @@ public class Coordinator
}
private TrustDecision _decision = TrustDecision.No;
- private static Icon _infoIcon = new ImageIcon(Utils.iconToImage(UIManager.getIcon("OptionPane.informationIcon")).
- getScaledInstance(16, 16, java.awt.Image.SCALE_SMOOTH ));
+ private static Icon _infoIcon = new ImageIcon(
+ Utils.iconToImage(UIManager.getIcon("OptionPane.informationIcon")).
+ getScaledInstance(16, 16, java.awt.Image.SCALE_SMOOTH ));
- private static Icon _warnIcon = new ImageIcon(Utils.iconToImage(UIManager.getIcon("OptionPane.warningIcon")).
- getScaledInstance(16, 16, java.awt.Image.SCALE_SMOOTH ));
+ private static Icon _warnIcon = new ImageIcon(
+ Utils.iconToImage(UIManager.getIcon("OptionPane.warningIcon")).
+ getScaledInstance(16, 16, java.awt.Image.SCALE_SMOOTH ));
}
private String _dataDir;
- private final Ice.InitializationData _initData;
- private Ice.Communicator _communicator;
+ private final com.zeroc.Ice.InitializationData _initData;
+ private com.zeroc.Ice.Communicator _communicator;
private boolean _traceObservers;
private boolean _traceSaveToRegistry;
@@ -3881,13 +3791,13 @@ public class Coordinator
private Preferences _prefs;
private StatusBarI _statusBar = new StatusBarI();
- private IceGridGUI.LiveDeployment.Root _liveDeploymentRoot;
+ private com.zeroc.IceGridGUI.LiveDeployment.Root _liveDeploymentRoot;
private LiveDeploymentPane _liveDeploymentPane;
//
// Maps application-name to ApplicationPane (only for 'live' applications)
//
- private java.util.Map<String, ApplicationPane> _liveApplications = new java.util.HashMap<String, ApplicationPane>();
+ private java.util.Map<String, ApplicationPane> _liveApplications = new java.util.HashMap<>();
private MainPane _mainPane;
@@ -3993,7 +3903,7 @@ public class Coordinator
private X509Certificate _transientCert;
- private java.util.List<IGraphView> _graphViews = new java.util.ArrayList<IGraphView>();
+ private java.util.List<IGraphView> _graphViews = new java.util.ArrayList<>();
private java.util.concurrent.ScheduledExecutorService _executor;
}
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/EditorBase.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/EditorBase.java
index 36c9491a752..01f4c97b318 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/EditorBase.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/EditorBase.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
import java.awt.BorderLayout;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Fallback.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Fallback.java
index 4c21bee85bd..2db4e32b2e2 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Fallback.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Fallback.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
import javax.swing.JOptionPane;
@@ -20,11 +20,11 @@ public class Fallback extends javax.swing.JApplet
{
java.net.URL jar = Fallback.class.getProtectionDomain().getCodeSource().getLocation();
- java.util.List<String> command = new java.util.ArrayList<String>();
+ java.util.List<String> command = new java.util.ArrayList<>();
command.add("java");
command.add("-cp");
command.add(jar.toURI().getPath());
- command.add("IceGridGUI.Main");
+ command.add("com.zeroc.IceGridGUI.Main");
String[] args = MainProxy.args();
for(String arg : args)
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveActions.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveActions.java
index 3f6dde703ef..b61253780a2 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveActions.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveActions.java
@@ -7,13 +7,13 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
-import IceGridGUI.LiveDeployment.*;
+import com.zeroc.IceGridGUI.LiveDeployment.*;
//
// Holds all actions for the "Live Deployment" view
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Adapter.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Adapter.java
index d7262e3e304..73a097ead7b 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Adapter.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Adapter.java
@@ -7,15 +7,15 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import java.awt.Component;
import javax.swing.Icon;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class Adapter extends TreeNode
{
@@ -61,7 +61,7 @@ class Adapter extends TreeNode
}
Adapter(TreeNode parent, String adapterName, Utils.Resolver resolver, String adapterId,
- AdapterDescriptor descriptor, Ice.ObjectPrx proxy)
+ AdapterDescriptor descriptor, com.zeroc.Ice.ObjectPrx proxy)
{
super(parent, adapterName);
_resolver = resolver;
@@ -130,7 +130,7 @@ class Adapter extends TreeNode
return false;
}
- private void setCurrentEndpoints(Ice.ObjectPrx proxy)
+ private void setCurrentEndpoints(com.zeroc.Ice.ObjectPrx proxy)
{
if(proxy == null)
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/AdapterEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/AdapterEditor.java
index ae33b88598c..fb80900b721 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/AdapterEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/AdapterEditor.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import javax.swing.JCheckBox;
import javax.swing.JScrollPane;
@@ -17,8 +17,8 @@ import javax.swing.JTextField;
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.layout.CellConstraints;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class AdapterEditor extends Editor
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ApplicationDetailsDialog.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ApplicationDetailsDialog.java
index 544052a7333..4429acf61aa 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ApplicationDetailsDialog.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ApplicationDetailsDialog.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import java.awt.Container;
import javax.swing.JDialog;
@@ -20,7 +20,7 @@ import com.jgoodies.forms.factories.Borders;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.util.LayoutStyle;
-import IceGrid.*;
+import com.zeroc.IceGrid.*;
class ApplicationDetailsDialog extends JDialog
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/CommunicatorEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/CommunicatorEditor.java
index 115048fb3ac..8a9ddd62a09 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/CommunicatorEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/CommunicatorEditor.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
@@ -15,8 +15,8 @@ import javax.swing.JTextArea;
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.layout.CellConstraints;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class CommunicatorEditor extends Editor
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/DbEnv.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/DbEnv.java
index f93e3b0a71b..5dc54f5bcc4 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/DbEnv.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/DbEnv.java
@@ -7,13 +7,13 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import java.awt.Component;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class DbEnv extends TreeNode
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/DbEnvEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/DbEnvEditor.java
index 7a70666d9e3..925ce972363 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/DbEnvEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/DbEnvEditor.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
@@ -16,8 +16,8 @@ import javax.swing.JTextField;
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.layout.CellConstraints;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class DbEnvEditor extends Editor
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Editor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Editor.java
index f9fd8665874..d618070900a 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Editor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Editor.java
@@ -7,9 +7,9 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
-import IceGridGUI.*;
+import com.zeroc.IceGridGUI.*;
public abstract class Editor extends EditorBase
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/GraphView.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/GraphView.java
index 0276ee8ce03..c344a4e35cc 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/GraphView.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/GraphView.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import java.util.Map;
import java.util.List;
@@ -94,11 +94,11 @@ import com.jgoodies.looks.HeaderStyle;
import com.jgoodies.looks.BorderStyle;
import com.jgoodies.looks.plastic.PlasticLookAndFeel;
-import IceGridGUI.*;
-import IceGridGUI.LiveDeployment.MetricsViewEditor.MetricsViewInfo;
-import IceGridGUI.LiveDeployment.MetricsViewEditor.MetricsCell;
-import IceGridGUI.LiveDeployment.MetricsViewEditor.MetricsViewTransferableData;
-import IceGridGUI.LiveDeployment.MetricsViewEditor.FormatedNumberRenderer;
+import com.zeroc.IceGridGUI.*;
+import com.zeroc.IceGridGUI.LiveDeployment.MetricsViewEditor.MetricsViewInfo;
+import com.zeroc.IceGridGUI.LiveDeployment.MetricsViewEditor.MetricsCell;
+import com.zeroc.IceGridGUI.LiveDeployment.MetricsViewEditor.MetricsViewTransferableData;
+import com.zeroc.IceGridGUI.LiveDeployment.MetricsViewEditor.FormatedNumberRenderer;
import java.util.prefs.Preferences;
import java.util.prefs.BackingStoreException;
@@ -155,7 +155,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
class TransferHandler extends javax.swing.TransferHandler
{
@Override
- public boolean
+ public boolean
canImport(TransferHandler.TransferSupport support)
{
boolean supported = false;
@@ -180,7 +180,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
}
Transferable t = support.getTransferable();
-
+
for(DataFlavor flavor : support.getDataFlavors())
{
try
@@ -219,7 +219,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
addWindowListener(new WindowAdapter()
{
@Override
- public void windowClosing(WindowEvent e)
+ public void windowClosing(WindowEvent e)
{
close();
}
@@ -231,7 +231,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
Action preferences = new AbstractAction("Preferences")
{
@Override
- public void actionPerformed(ActionEvent event)
+ public void actionPerformed(ActionEvent event)
{
//
// Set the title
@@ -248,13 +248,13 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
//
// SpinnerNumberModel to set a refresh period.
//
- SpinnerNumberModel refreshPeriod = new SpinnerNumberModel(getRefreshPeriod(), _minRefreshPeriod,
+ SpinnerNumberModel refreshPeriod = new SpinnerNumberModel(getRefreshPeriod(), _minRefreshPeriod,
_maxRefreshPeriod, 1);
//
// SpinnerNumberModel to set the maximum number of samples to keep in X axis.
//
- final SpinnerNumberModel samples = new SpinnerNumberModel(_samples, _minSamples,
+ final SpinnerNumberModel samples = new SpinnerNumberModel(_samples, _minSamples,
_maxSamples, 1);
JPanel refreshPanel;
@@ -272,12 +272,12 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
//
// JComboBox to select time format used in X Axis
//
- JComboBox<String> dateFormats = new JComboBox<String>(_dateFormats);
+ JComboBox<String> dateFormats = new JComboBox<>(_dateFormats);
dateFormats.setSelectedItem(getDateFormat());
JPanel xAxisPanel;
{
- DefaultFormBuilder builder =
- new DefaultFormBuilder(new FormLayout("pref,2dlu,pref:grow", "pref"));
+ DefaultFormBuilder builder =
+ new DefaultFormBuilder(new FormLayout("pref,2dlu,pref:grow", "pref"));
builder.append("Samples displayed:", new JSpinner(samples));
builder.append("", new JLabel("<html><p>The number of samples displayed on a graph;" +
"<br/>must be between 2 and 300." + "</p></html>"));
@@ -295,7 +295,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
builder.nextLine();
builder.append(xAxisPanel);
- if(JOptionPane.showConfirmDialog(GraphView.this, builder.getPanel(), "Metrics Graph Preferences",
+ if(JOptionPane.showConfirmDialog(GraphView.this, builder.getPanel(), "Metrics Graph Preferences",
JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) != JOptionPane.OK_OPTION)
{
return;
@@ -317,7 +317,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
if(convertColumnIndexToModel(columnAtPoint(e.getPoint())) == 6)
{
return _legendModel.getRows(new int[]{rowAtPoint(e.getPoint())})[0].cell.getField().
- getColumnToolTip();
+ getColumnToolTip();
}
else
{
@@ -325,7 +325,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
}
}
};
-
+
//
// Adjust row height for larger fonts
//
@@ -335,14 +335,14 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
{
_legendTable.setRowHeight(minRowHeight);
}
-
+
//
// Graph preferences.
//
final Action delete = new AbstractAction("Delete")
{
@Override
- public void actionPerformed(ActionEvent event)
+ public void actionPerformed(ActionEvent event)
{
int[] selectedRows = _legendTable.getSelectedRows();
for(int i = 0; i < selectedRows.length; ++i)
@@ -477,16 +477,16 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
//
// Set a combobox to edit the scale factors.
//
- JComboBox<Double> scales = new JComboBox<Double>(_scales);
+ JComboBox<Double> scales = new JComboBox<>(_scales);
scales.setRenderer(new DecimalRenderer(scales.getRenderer()));
_legendTable.getColumnModel().getColumn(7).setCellEditor(new DefaultCellEditor(scales));
//
- //Set default renderer and editor for Color.class column.
+ // Set default renderer and editor for Color.class column.
//
_legendTable.setDefaultRenderer(Color.class, new ColorRenderer(true));
_legendTable.setDefaultEditor(Color.class, new ColorEditor());
-
+
_legendTable.setAutoCreateRowSorter(true);
final JFXPanel fxPanel = new JFXPanel();
@@ -502,7 +502,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
scrollPane.setMinimumSize(new Dimension(0, 50));
scrollPane.setPreferredSize(new Dimension(800, 200));
_splitPane.setBottomComponent(scrollPane);
-
+
DefaultFormBuilder builder = new DefaultFormBuilder(new FormLayout("fill:pref:grow", "fill:pref:grow, pref"));
builder.append(_splitPane);
builder.nextLine();
@@ -516,65 +516,61 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
//
// initialize the scene in JavaFX thread.
//
- enqueueJFX(new Runnable()
+ enqueueJFX(() ->
{
- @Override
- public void run()
- {
- _xAxis = new NumberAxis();
- _yAxis = new NumberAxis();
-
- _chart = new LineChart<Number, Number>(_xAxis, _yAxis);
- _chart.setCreateSymbols(false);
- _xAxis.setLabel("Time (" + getDateFormat() + ")");
- _xAxis.setTickLabelFormatter(_timeFormater);
- _xAxis.setForceZeroInRange(false);
- _chart.setAnimated(true);
- _chart.setLegendVisible(false);
-
- final Scene scene = new Scene(_chart);
- scene.setOnDragOver(
- new EventHandler<DragEvent>()
+ _xAxis = new NumberAxis();
+ _yAxis = new NumberAxis();
+
+ _chart = new LineChart<>(_xAxis, _yAxis);
+ _chart.setCreateSymbols(false);
+ _xAxis.setLabel("Time (" + getDateFormat() + ")");
+ _xAxis.setTickLabelFormatter(_timeFormater);
+ _xAxis.setForceZeroInRange(false);
+ _chart.setAnimated(true);
+ _chart.setLegendVisible(false);
+
+ final Scene scene = new Scene(_chart);
+ scene.setOnDragOver(
+ new EventHandler<DragEvent>()
+ {
+ @Override
+ public void handle(DragEvent event)
{
- @Override
- public void handle(DragEvent event)
+ Dragboard db = event.getDragboard();
+ if(event.getGestureSource() != scene && db.hasContent(LocalObjectMimeType))
{
- Dragboard db = event.getDragboard();
- if(event.getGestureSource() != scene && db.hasContent(LocalObjectMimeType))
+ Object object = db.getContent(LocalObjectMimeType);
+ if(object instanceof MetricsViewTransferableData)
{
- Object object = db.getContent(LocalObjectMimeType);
- if(object instanceof MetricsViewTransferableData)
- {
- event.acceptTransferModes(TransferMode.COPY);
- }
+ event.acceptTransferModes(TransferMode.COPY);
}
- event.consume();
}
- });
+ event.consume();
+ }
+ });
- scene.setOnDragDropped(
- new EventHandler<DragEvent>()
+ scene.setOnDragDropped(
+ new EventHandler<DragEvent>()
+ {
+ @Override
+ public void handle(DragEvent event)
{
- @Override
- public void handle(DragEvent event)
+ boolean success = false;
+ Dragboard db = event.getDragboard();
+ if(event.getGestureSource() != scene && db.hasContent(LocalObjectMimeType))
{
- boolean success = false;
- Dragboard db = event.getDragboard();
- if(event.getGestureSource() != scene && db.hasContent(LocalObjectMimeType))
+ Object object = db.getContent(LocalObjectMimeType);
+ if(object instanceof MetricsViewTransferableData)
{
- Object object = db.getContent(LocalObjectMimeType);
- if(object instanceof MetricsViewTransferableData)
- {
- addSeries((MetricsViewTransferableData)object);
- success = true;
- }
+ addSeries((MetricsViewTransferableData)object);
+ success = true;
}
- event.setDropCompleted(success);
- event.consume();
}
- });
- fxPanel.setScene(scene);
- }
+ event.setDropCompleted(success);
+ event.consume();
+ }
+ });
+ fxPanel.setScene(scene);
});
pack();
@@ -599,11 +595,11 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
//
if(showInfo())
{
- JCheckBox checkbox = new JCheckBox("Do not show this message again.");
- String message = "Drop metrics cells to add them to the graph.";
+ JCheckBox checkbox = new JCheckBox("Do not show this message again.");
+ String message = "Drop metrics cells to add them to the graph.";
- JOptionPane.showConfirmDialog(this, new Object[]{message, checkbox}, "Information",
- JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE);
+ JOptionPane.showConfirmDialog(this, new Object[]{message, checkbox}, "Information",
+ JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE);
if(checkbox.isSelected())
{
_preferences.node("GraphView").putBoolean("showInfo", false);
@@ -682,14 +678,14 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
if(i != pos)
{
_legendTable.getColumnModel().moveColumn(pos, i);
- }
+ }
int columnWidth = preferences.getInt("colWidth" + Integer.toString(i), -1);
if(columnWidth != -1)
{
_legendTable.getColumnModel().getColumn(i).setPreferredWidth(columnWidth);
}
}
-
+
int refreshPeriod = preferences.getInt("refreshPeriod", _defaultRefreshPeriod);
if(refreshPeriod < _minRefreshPeriod)
{
@@ -732,117 +728,102 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
//
// Must run in JavaFX thread.
//
- enqueueJFX(new Runnable()
+ enqueueJFX(() ->
{
- @Override
- public void run()
+ Map<String, Map<String, Map<String, MetricsRow>>> metrics = _series.get(data.info);
+ if(metrics == null)
{
- Map<String, Map<String, Map<String, MetricsRow>>> metrics = _series.get(data.info);
- if(metrics == null)
- {
- metrics = new HashMap<String, Map<String, Map<String, MetricsRow>>>();
- _series.put(data.info, metrics);
- }
+ metrics = new HashMap<>();
+ _series.put(data.info, metrics);
+ }
+
+ Map<String, Map<String, MetricsRow>> rows = metrics.get(data.name);
+ if(rows == null)
+ {
+ rows = new HashMap<>();
+ metrics.put(data.name, rows);
+ }
- Map<String, Map<String, MetricsRow>> rows = metrics.get(data.name);
- if(rows == null)
+ for(Map.Entry<String, List<MetricsCell>> i : data.rows.entrySet())
+ {
+ final String rowId = i.getKey();
+ Map<String, MetricsRow> columns = rows.get(rowId);
+ if(columns == null)
{
- rows = new HashMap<String, Map<String, MetricsRow>>();
- metrics.put(data.name, rows);
+ columns = new HashMap<>();
+ rows.put(rowId, columns);
}
- for(Map.Entry<String, List<MetricsCell>> i : data.rows.entrySet())
+ for(MetricsCell j : i.getValue())
{
- final String rowId = i.getKey();
- Map<String, MetricsRow> columns = rows.get(rowId);
- if(columns == null)
+ if(columns.get(j.getField().getFieldName()) == null)
{
- columns = new HashMap<String, MetricsRow>();
- rows.put(rowId, columns);
- }
-
- for(MetricsCell j : i.getValue())
- {
- if(columns.get(j.getField().getFieldName()) == null)
+ String color = DefaultColors[_chart.getData().size() % DefaultColors.length];
+ final MetricsRow row = new MetricsRow(data.info, j, color,
+ new XYChart.Series<Number, Number>());
+
+ XYChart.Series<Number, Number> series = row.series.peek();
+ _chart.getData().add(series);
+
+ String styleClass = getSeriesClass(series);
+ addStyle(series, styleClass, color);
+ setNodesStyle(styleClass);
+
+ columns.put(j.getField().getFieldName(), row);
+ j.getField().setContext(GraphView.this);
+ //
+ // When a line is clicked we select the correspoding row in the legend table.
+ //
+ javafx.scene.Node n = _chart.lookup(".chart-series-line." + styleClass);
+ if(n != null)
{
- String color = DefaultColors[_chart.getData().size() % DefaultColors.length];
- final MetricsRow row = new MetricsRow(data.info, j, color,
- new XYChart.Series<Number, Number>());
-
- XYChart.Series<Number, Number> series = row.series.peek();
- _chart.getData().add(series);
-
- String styleClass = getSeriesClass(series);
- addStyle(series, styleClass, color);
- setNodesStyle(styleClass);
-
- columns.put(j.getField().getFieldName(), row);
- j.getField().setContext(GraphView.this);
- //
- // When a line is clicked we select the correspoding row in the legend table.
- //
- javafx.scene.Node n = _chart.lookup(".chart-series-line." + styleClass);
- if(n != null)
+ n.setOnMousePressed(new EventHandler<MouseEvent>()
{
- n.setOnMousePressed(new EventHandler<MouseEvent>()
+ @Override public void
+ handle(MouseEvent e)
{
- @Override public void
- handle(MouseEvent e)
+ if(e.getEventType() == MouseEvent.MOUSE_PRESSED &&
+ e.getButton() == MouseButton.PRIMARY)
{
- if(e.getEventType() == MouseEvent.MOUSE_PRESSED &&
- e.getButton() == MouseButton.PRIMARY)
- {
- //
- // Must run in Swing thread.
- //
- enqueueSwing(new Runnable()
+ //
+ // Must run in Swing thread.
+ //
+ enqueueSwing(() ->
+ {
+ int i = _legendModel.getRowIndex(row);
+ if(i != -1)
{
- @Override
- public void run()
- {
- int i = _legendModel.getRowIndex(row);
- if(i != -1)
- {
- i = _legendTable.convertRowIndexToView(i);
- _legendTable.setRowSelectionInterval(i, i);
- }
- }
- });
- }
- }
- });
- }
- //
- // Add the serie to the legend, must run in Swing thread.
- //
- enqueueSwing(new Runnable()
- {
- @Override
- public void run()
- {
- _legendModel.addRow(row);
+ i = _legendTable.convertRowIndexToView(i);
+ _legendTable.setRowSelectionInterval(i, i);
+ }
+ });
}
- });
- }
+ }
+ });
+ }
+ //
+ // Add the serie to the legend, must run in Swing thread.
+ //
+ enqueueSwing(() -> _legendModel.addRow(row));
}
}
- if(_chart.getData().size() > 0)
- {
- startRefresh();
- }
+ }
+ if(_chart.getData().size() > 0)
+ {
+ startRefresh();
}
});
}
//
// Added a new chart series to an existing row, the graph series will use the
- // same configuration, the row cell field must be reset so calculations doesn't
+ // same configuration, the row cell field must be reset so calculations doesn't
// take into account previous data. If we don't reset fields here caculations
// can be bogus in case the view was disabled and the data in the view was reset.
//
void addSeries(final MetricsRow row)
{
- XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>();
+ XYChart.Series<Number, Number> series = new XYChart.Series<>();
row.series.push(series);
_chart.getData().add(series);
@@ -860,9 +841,9 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
row.cell.resetField();
//
- // We need also a new click handler so click works in all segments
+ // We need also a new click handler so click works in all segments
// of the line.
- //
+ //
// When a line is clicked we select the correspoding row in the legend table.
//
javafx.scene.Node n = _chart.lookup(".chart-series-line." + styleClass);
@@ -870,7 +851,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
{
n.setOnMousePressed(new EventHandler<MouseEvent>()
{
- @Override public void
+ @Override public void
handle(MouseEvent e)
{
if(e.getEventType() == MouseEvent.MOUSE_PRESSED &&
@@ -879,17 +860,13 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
//
// Must run in Swing thread.
//
- enqueueSwing(new Runnable()
+ enqueueSwing(() ->
{
- @Override
- public void run()
+ int i = _legendModel.getRowIndex(row);
+ if(i != -1)
{
- int i = _legendModel.getRowIndex(row);
- if(i != -1)
- {
- i = _legendTable.convertRowIndexToView(i);
- _legendTable.setRowSelectionInterval(i, i);
- }
+ i = _legendTable.convertRowIndexToView(i);
+ _legendTable.setRowSelectionInterval(i, i);
}
});
}
@@ -898,127 +875,119 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
}
}
- private void addData(final MetricsViewInfo info, final Map<String, IceMX.Metrics[]> data,
+ private void addData(final MetricsViewInfo info, final Map<String, com.zeroc.IceMX.Metrics[]> data,
final long timestamp)
{
//
// Update the graph series in JavaFX thread.
//
- enqueueJFX(new Runnable()
+ enqueueJFX(() ->
{
- @Override
- public void run()
+ Map<String, Map<String, Map<String, MetricsRow>>> series = _series.get(info);
+ if(series == null)
{
- Map<String, Map<String, Map<String, MetricsRow>>> series = _series.get(info);
- if(series == null)
+ return;
+ }
+
+ for(Map.Entry<String, Map<String, Map<String, MetricsRow>>> i : series.entrySet())
+ {
+ com.zeroc.IceMX.Metrics[] metricsSeq = null;
+ if(data != null)
{
- return;
+ metricsSeq = data.get(i.getKey());
}
- for(Map.Entry<String, Map<String, Map<String, MetricsRow>>> i : series.entrySet())
- {
- IceMX.Metrics[] metricsSeq = null;
- if(data != null)
- {
- metricsSeq = data.get(i.getKey());
- }
+ //
+ // Iterate over all configured values, if there isn't data for one configured
+ // field we need to add a gap.
+ //
- //
- // Iterate over all configured values, if there isn't data for one configured
- // field we need to add a gap.
- //
+ for(Map.Entry<String, Map<String, MetricsRow>> j : i.getValue().entrySet())
+ {
+ com.zeroc.IceMX.Metrics metrics = null;
- for(Map.Entry<String, Map<String, MetricsRow>> j : i.getValue().entrySet())
+ if(metricsSeq != null)
{
- IceMX.Metrics metrics = null;
-
- if(metricsSeq != null)
+ for(com.zeroc.IceMX.Metrics m : metricsSeq)
{
- for(IceMX.Metrics m : metricsSeq)
+ if(m.id.equals(j.getKey()))
{
- if(m.id.equals(j.getKey()))
- {
- metrics = m;
- break;
- }
+ metrics = m;
+ break;
}
}
- for(Map.Entry<String, MetricsRow> k : j.getValue().entrySet())
+ }
+ for(Map.Entry<String, MetricsRow> k : j.getValue().entrySet())
+ {
+ MetricsRow row = k.getValue();
+ //
+ // If there isn't a metrics object we disable the row and add a dummy value.
+ //
+ if(metrics == null)
{
- MetricsRow row = k.getValue();
//
- // If there isn't a metrics object we disable the row and add a dummy value.
+ // If the row isn't disabled we add a new serie to represent the gap
+ // and mark the row as disabled.
//
- if(metrics == null)
+ if(!row.disabled)
{
- //
- // If the row isn't disabled we add a new serie to represent the gap
- // and mark the row as disabled.
- //
- if(!row.disabled)
- {
- row.series.push(new XYChart.Series<Number, Number>());
- row.disabled = true;
- }
- //
- // This dummy value is added to represent gap sizes, but isn't displayed
- // as the series isn't added to the graph.
- //
- row.series.peek().getData().add(new XYChart.Data<Number, Number>(0, 0));
+ row.series.push(new XYChart.Series<Number, Number>());
+ row.disabled = true;
}
- else
+ //
+ // This dummy value is added to represent gap sizes, but isn't displayed
+ // as the series isn't added to the graph.
+ //
+ row.series.peek().getData().add(new XYChart.Data<Number, Number>(0, 0));
+ }
+ else
+ {
+ try
{
- try
+ if(row.disabled)
{
- if(row.disabled)
- {
- addSeries(row);
- row.disabled = false;
- }
-
- Number value = row.cell.getValue(metrics, timestamp);
- //
- // The cell returns null to indicate the value must be skipped,
- // this is usually because it needs two values to calculate
- // the average.
- //
- if(value == null)
- {
- continue;
- }
-
- row.series.peek().getData().add(
- new XYChart.Data<Number, Number>(timestamp, value));
+ addSeries(row);
+ row.disabled = false;
}
- catch(java.lang.RuntimeException ex)
+
+ Number value = row.cell.getValue(metrics, timestamp);
+ //
+ // The cell returns null to indicate the value must be skipped,
+ // this is usually because it needs two values to calculate
+ // the average.
+ //
+ if(value == null)
{
- ex.printStackTrace();
+ continue;
}
- }
- //
- // Remove the vertices from the beginning of the series that exceeded
- // the maximum number of samples.
- //
- adjustSize(row);
+ row.series.peek().getData().add(
+ new XYChart.Data<Number, Number>(timestamp, value));
+ }
+ catch(java.lang.RuntimeException ex)
+ {
+ ex.printStackTrace();
+ }
}
+
+ //
+ // Remove the vertices from the beginning of the series that exceeded
+ // the maximum number of samples.
+ //
+ adjustSize(row);
}
}
- //
- // Fire an event on the legend model to update all cells.
- //
- enqueueSwing(new Runnable()
- {
- @Override
- public void run()
- {
- _legendModel.fireTableChanged(
- new TableModelEvent(_legendModel, 0, _legendModel.getRowCount() - 1,
- TableModelEvent.ALL_COLUMNS,
- TableModelEvent.UPDATE));
- }
- });
}
+ //
+ // Fire an event on the legend model to update all cells.
+ //
+ enqueueSwing(() ->
+ {
+ _legendModel.fireTableChanged(
+ new TableModelEvent(_legendModel, 0, _legendModel.getRowCount() - 1,
+ TableModelEvent.ALL_COLUMNS,
+ TableModelEvent.UPDATE));
+ });
});
}
@@ -1071,51 +1040,36 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
{
if(_refreshFuture == null)
{
- _refreshFuture = _coordinator.getExecutor().scheduleAtFixedRate(new Runnable()
- {
- @Override
- public void run()
+ _refreshFuture = _coordinator.getExecutor().scheduleAtFixedRate(() ->
{
java.util.Set<MetricsViewInfo> metrics = null;
synchronized(GraphView.this)
{
- metrics = new java.util.HashSet<MetricsViewInfo>(_series.keySet());
+ metrics = new java.util.HashSet<>(_series.keySet());
}
for(final MetricsViewInfo m : metrics)
{
- IceMX.Callback_MetricsAdmin_getMetricsView cb = new IceMX.Callback_MetricsAdmin_getMetricsView()
- {
- @Override
- public void response(final java.util.Map<java.lang.String, IceMX.Metrics[]> data,
- long timestamp)
- {
- addData(m, data, timestamp);
- }
-
- @Override
- public void exception(final Ice.LocalException e)
- {
- addData(m, null, 0);
- }
-
- @Override
- public void exception(final Ice.UserException e)
- {
- addData(m, null, 0);
- }
- };
try
{
- m.admin.begin_getMetricsView(m.view, cb);
+ m.admin.getMetricsViewAsync(m.view).whenComplete((result, ex) ->
+ {
+ if(ex == null)
+ {
+ addData(m, result.returnValue, result.timestamp);
+ }
+ else
+ {
+ addData(m, null, 0);
+ }
+ });
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
addData(m, null, 0);
}
}
- }
- }, 0, _refreshPeriod, java.util.concurrent.TimeUnit.SECONDS);
+ }, 0, _refreshPeriod, java.util.concurrent.TimeUnit.SECONDS);
}
}
@@ -1149,7 +1103,6 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
startRefresh();
}
-
}
synchronized String getDateFormat()
@@ -1164,14 +1117,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
//
// Update the horizontal axis label, in JavaFx thread.
//
- enqueueJFX(new Runnable()
- {
- @Override
- public void run()
- {
- _xAxis.setLabel("Time (" + getDateFormat() + ")");
- }
- });
+ enqueueJFX(() -> _xAxis.setLabel("Time (" + getDateFormat() + ")"));
}
synchronized private void setMaximumSamples(final int samples)
@@ -1187,16 +1133,12 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
//
// If maximum samples change, we remove older samples.
//
- enqueueJFX(new Runnable()
+ enqueueJFX(() ->
{
- @Override
- public void run()
+ MetricsRow[] rows = _legendModel.getRows();
+ for(MetricsRow row : rows)
{
- MetricsRow[] rows = _legendModel.getRows();
- for(MetricsRow row : rows)
- {
- adjustSize(row);
- }
+ adjustSize(row);
}
});
}
@@ -1232,7 +1174,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
// Stack of all the chart series used to represent this metrics object
// new values are added to the chart series at the top.
//
- Stack<XYChart.Series<Number, Number>> series = new Stack<XYChart.Series<Number, Number>>();
+ Stack<XYChart.Series<Number, Number>> series = new Stack<>();
}
class LegendTableModel extends javax.swing.table.AbstractTableModel
@@ -1391,7 +1333,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
@Override
public boolean isCellEditable(int row, int col)
{
- if(col < _columnNames.length && (_columnNames[col].equals("Show") ||
+ if(col < _columnNames.length && (_columnNames[col].equals("Show") ||
_columnNames[col].equals("Scale") ||
_columnNames[col].equals("Color")))
{
@@ -1412,15 +1354,11 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
if(_columnNames[columnIndex].equals("Show"))
{
row.visible = ((Boolean)value).booleanValue();
- enqueueJFX(new Runnable()
+ enqueueJFX(() ->
{
- @Override
- public void run()
+ for(int i = 0; i < row.series.size(); ++i)
{
- for(int i = 0; i < row.series.size(); ++i)
- {
- setNodesVisible(getSeriesClass(row.series.get(i)), row.visible);
- }
+ setNodesVisible(getSeriesClass(row.series.get(i)), row.visible);
}
});
}
@@ -1441,7 +1379,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
// Convert color to the CSS representation used by JavaFX style.
// example: #ff00aa
//
- row.color = "#" + String.format("%02X", color.getRed()) +
+ row.color = "#" + String.format("%02X", color.getRed()) +
String.format("%02X", color.getGreen()) +
String.format("%02X", color.getBlue());
for(int i = 0; i < row.series.size(); ++i)
@@ -1467,7 +1405,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
{
deletedRows[i] = _rows.remove(rowIndexes[i]);
}
- Map<Integer, MetricsRow> rows = new HashMap<Integer, MetricsRow>();
+ Map<Integer, MetricsRow> rows = new HashMap<>();
for(Map.Entry<Integer, MetricsRow> e : _rows.entrySet())
{
rows.put(rows.size(), e.getValue());
@@ -1506,7 +1444,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
return index;
}
- private Map<Integer, MetricsRow> _rows = new HashMap<Integer, MetricsRow>();
+ private Map<Integer, MetricsRow> _rows = new HashMap<>();
}
void
@@ -1515,15 +1453,11 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
//
// Must run in JavaFX thread.
//
- enqueueJFX(new Runnable()
+ enqueueJFX(() ->
{
- @Override
- public void run()
+ for(XYChart.Data<Number, Number> i : series.getData())
{
- for(XYChart.Data<Number, Number> i : series.getData())
- {
- i.setYValue(i.getYValue().doubleValue() * s2 / s1);
- }
+ i.setYValue(i.getYValue().doubleValue() * s2 / s1);
}
});
}
@@ -1534,17 +1468,13 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
//
// Must run in JavaFX thread.
//
- enqueueJFX(new Runnable()
+ enqueueJFX(() ->
{
- @Override
- public void run()
+ String styleClass = getSeriesClass(series);
+ if(styleClass != null)
{
- String styleClass = getSeriesClass(series);
- if(styleClass != null)
- {
- addStyle(series, styleClass, color);
- setNodesStyle(styleClass);
- }
+ addStyle(series, styleClass, color);
+ setNodesStyle(styleClass);
}
});
}
@@ -1616,69 +1546,55 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
sb.append(color);
sb.append(", white;");
sb.append("-fx-stroke-width: 3;");
- _styles.put(seriesClass, sb.toString());
+ _styles.put(seriesClass, sb.toString());
}
- private void enqueueJFX(final Runnable runnable) {
- _queue.submit(new Runnable()
- {
- @Override
- public void run()
+ private void enqueueJFX(final Runnable runnable)
+ {
+ _queue.submit(() ->
{
- Platform.runLater(new Runnable()
+ Platform.runLater(() ->
{
- @Override
- public void run()
+ try
{
- try
- {
- runnable.run();
- }
- finally
- {
- _sem.release();
- }
+ runnable.run();
+ }
+ finally
+ {
+ _sem.release();
}
});
_sem.acquireUninterruptibly();
- }
- });
+ });
}
- private void enqueueSwing(final Runnable runnable) {
- _queue.submit(new Runnable()
- {
- @Override
- public void run()
+ private void enqueueSwing(final Runnable runnable)
+ {
+ _queue.submit(() ->
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
+ try
{
- try
- {
- runnable.run();
- }
- finally
- {
- _sem.release();
- }
+ runnable.run();
+ }
+ finally
+ {
+ _sem.release();
}
});
_sem.acquireUninterruptibly();
- }
- });
+ });
}
- @SuppressWarnings("rawtypes")
+ @SuppressWarnings("rawtypes")
static class DecimalRenderer extends DefaultListCellRenderer
- {
+ {
public DecimalRenderer(ListCellRenderer renderer)
{
this._renderer = renderer;
}
-
+
@Override
public Component
getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
@@ -1722,7 +1638,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
}
_dialog = JColorChooser.createDialog(_button, "Select the metrics color", true, _colorChooser, this, null);
-
+
}
@Override
@@ -1733,7 +1649,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
_button.setBackground(_currentColor);
_colorChooser.setColor(_currentColor);
_dialog.setVisible(true);
- //Make the renderer reappear.
+ // Make the renderer reappear.
fireEditingStopped();
}
else
@@ -1768,13 +1684,13 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
Border unselectedBorder = null;
Border selectedBorder = null;
boolean isBordered = true;
-
+
public ColorRenderer(boolean isBordered)
{
this.isBordered = isBordered;
setOpaque(true); //MUST do this for background to show up.
}
-
+
@Override
public Component getTableCellRendererComponent(JTable table, Object color, boolean isSelected, boolean hasFocus,
int row, int column)
@@ -1825,8 +1741,8 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
private NumberAxis _xAxis;
private NumberAxis _yAxis;
- private final static String[] _columnNames = new String[]{"Show", "Node", "Server", "Metrics View Name",
- "Metrics Name", "Metrics Id", "Metrics Field", "Scale",
+ private final static String[] _columnNames = new String[]{"Show", "Node", "Server", "Metrics View Name",
+ "Metrics Name", "Metrics Id", "Metrics Field", "Scale",
"Last", "Average", "Minimum", "Maximum", "Color"};
@@ -1841,10 +1757,9 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
// Field name
//
private final Map<MetricsViewInfo,
- Map<String,
- Map<String,
- Map<String, MetricsRow>>>> _series =
- new HashMap<MetricsViewInfo, Map<String, Map<String, Map<String, MetricsRow>>>>();
+ Map<String,
+ Map<String,
+ Map<String, MetricsRow>>>> _series = new HashMap<>();
private final static String[] DefaultColors = new String[]
{
@@ -1870,29 +1785,29 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
private final LegendTableModel _legendModel = new LegendTableModel();
private JSplitPane _splitPane;
- private final Map<String, String> _styles = new HashMap<String, String>();
+ private final Map<String, String> _styles = new HashMap<>();
- private final Double[] _scales = new Double[]{0.000000001d,
+ private final Double[] _scales = new Double[]{0.000000001d,
0.00000001d,
- 0.0000001d,
- 0.000001d,
+ 0.0000001d,
+ 0.000001d,
0.00001d,
- 0.0001d,
- 0.001d,
- 0.01d,
- 0.1d,
- 1.0d,
- 10.0d,
+ 0.0001d,
+ 0.001d,
+ 0.01d,
+ 0.1d,
+ 1.0d,
+ 10.0d,
100.0d,
1000.0d,
- 10000.0d,
- 100000.0d,
- 1000000.0d,
+ 10000.0d,
+ 100000.0d,
+ 1000000.0d,
10000000.0d,
100000000.0d,
1000000000.0d};
-
- private final java.util.concurrent.Semaphore _sem = new java.util.concurrent.Semaphore(0);
+
+ private final java.util.concurrent.Semaphore _sem = new java.util.concurrent.Semaphore(0);
private final java.util.concurrent.ExecutorService _queue = java.util.concurrent.Executors.newSingleThreadExecutor(
new java.util.concurrent.ThreadFactory()
{
@@ -1909,4 +1824,3 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato
private final static DataFormat LocalObjectMimeType = new DataFormat("application/x-java-jvm-local-objectref");
}
-
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ListArrayTreeNode.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ListArrayTreeNode.java
index e90422ee5e0..b07a14f30f1 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ListArrayTreeNode.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ListArrayTreeNode.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import java.util.Enumeration;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ListTreeNode.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ListTreeNode.java
index 0a04ae307d9..f22a715f32b 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ListTreeNode.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ListTreeNode.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import java.util.Enumeration;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/LogFilterDialog.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/LogFilterDialog.java
index f6a99ac942e..e2f5733a685 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/LogFilterDialog.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/LogFilterDialog.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -22,6 +22,8 @@ import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.WindowConstants;
+import com.zeroc.Ice.LogMessageType;
+
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.builder.ButtonBarBuilder;
import com.jgoodies.forms.factories.Borders;
@@ -36,20 +38,20 @@ class LogFilterDialog extends JDialog
super(dialog, "Ice log filter - IceGrid Admin", true);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
- java.util.Set<Ice.LogMessageType> messageTypeFilterSet = null;
+ java.util.Set<com.zeroc.Ice.LogMessageType> messageTypeFilterSet = null;
if(dialog.getMessageTypeFilter() != null)
{
messageTypeFilterSet = new java.util.HashSet<>(java.util.Arrays.asList(dialog.getMessageTypeFilter()));
}
final JCheckBox error = new JCheckBox("Error",
- messageTypeFilterSet == null || messageTypeFilterSet.contains(Ice.LogMessageType.ErrorMessage));
+ messageTypeFilterSet == null || messageTypeFilterSet.contains(LogMessageType.ErrorMessage));
final JCheckBox warning = new JCheckBox("Warning",
- messageTypeFilterSet == null || messageTypeFilterSet.contains(Ice.LogMessageType.WarningMessage));
+ messageTypeFilterSet == null || messageTypeFilterSet.contains(LogMessageType.WarningMessage));
final JCheckBox print = new JCheckBox("Print",
- messageTypeFilterSet == null || messageTypeFilterSet.contains(Ice.LogMessageType.PrintMessage));
+ messageTypeFilterSet == null || messageTypeFilterSet.contains(LogMessageType.PrintMessage));
final JCheckBox trace = new JCheckBox("Trace",
- messageTypeFilterSet == null || messageTypeFilterSet.contains(Ice.LogMessageType.TraceMessage));
+ messageTypeFilterSet == null || messageTypeFilterSet.contains(LogMessageType.TraceMessage));
final JTextArea traceCategories = new JTextArea(3, 40);
traceCategories.setLineWrap(true);
@@ -58,7 +60,8 @@ class LogFilterDialog extends JDialog
if(traceCategoryFilter != null)
{
// TODO: join with escapes!
- traceCategories.setText(IceUtilInternal.StringUtil.joinString(java.util.Arrays.asList(traceCategoryFilter), ", "));
+ traceCategories.setText(
+ com.zeroc.IceUtilInternal.StringUtil.joinString(java.util.Arrays.asList(traceCategoryFilter), ", "));
}
else
{
@@ -78,12 +81,13 @@ class LogFilterDialog extends JDialog
String txt = traceCategories.getText();
if(txt != null && !txt.isEmpty())
{
- traceCategoryFilter = IceUtilInternal.StringUtil.splitString(txt, ", \t\r\n");
+ traceCategoryFilter = com.zeroc.IceUtilInternal.StringUtil.splitString(txt, ", \t\r\n");
if(traceCategoryFilter == null)
{
// unmatched quote
- JOptionPane.showMessageDialog(LogFilterDialog.this, "Unmatched quote in Trace categories field",
- "Invalid entry", JOptionPane.ERROR_MESSAGE);
+ JOptionPane.showMessageDialog(LogFilterDialog.this,
+ "Unmatched quote in Trace categories field",
+ "Invalid entry", JOptionPane.ERROR_MESSAGE);
return;
}
@@ -93,32 +97,32 @@ class LogFilterDialog extends JDialog
}
}
- java.util.Set<Ice.LogMessageType> messageTypeFilterSet = new java.util.HashSet<>();
+ java.util.Set<LogMessageType> messageTypeFilterSet = new java.util.HashSet<>();
if(error.isSelected())
{
- messageTypeFilterSet.add(Ice.LogMessageType.ErrorMessage);
+ messageTypeFilterSet.add(LogMessageType.ErrorMessage);
}
if(warning.isSelected())
{
- messageTypeFilterSet.add(Ice.LogMessageType.WarningMessage);
+ messageTypeFilterSet.add(LogMessageType.WarningMessage);
}
if(print.isSelected())
{
- messageTypeFilterSet.add(Ice.LogMessageType.PrintMessage);
+ messageTypeFilterSet.add(LogMessageType.PrintMessage);
}
if(trace.isSelected())
{
- messageTypeFilterSet.add(Ice.LogMessageType.TraceMessage);
+ messageTypeFilterSet.add(LogMessageType.TraceMessage);
}
if(messageTypeFilterSet.size() == 0 || messageTypeFilterSet.size() == 4)
{
// All or nothing checked equivalent of getting everything!
messageTypeFilterSet = null;
}
- Ice.LogMessageType[] messageTypeFilter = null;
+ LogMessageType[] messageTypeFilter = null;
if(messageTypeFilterSet != null)
{
- messageTypeFilter = messageTypeFilterSet.toArray(new Ice.LogMessageType[0]);
+ messageTypeFilter = messageTypeFilterSet.toArray(new LogMessageType[0]);
}
dispose();
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/LogPrefsDialog.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/LogPrefsDialog.java
index 413ad2d7133..03dc4acf9bd 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/LogPrefsDialog.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/LogPrefsDialog.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -132,7 +132,8 @@ class LogPrefsDialog extends JDialog
final JTextField initialMessagesField = new JTextField(10);
initialMessagesField.setText(Integer.toString(dialog.getInitialMessages()));
- initialMessagesField.setToolTipText("Start by retrieving <num> log messages from the server; -1 means retrieve all");
+ initialMessagesField.setToolTipText(
+ "Start by retrieving <num> log messages from the server; -1 means retrieve all");
JButton okButton = new JButton("OK");
ActionListener okListener = new ActionListener()
@@ -143,7 +144,8 @@ class LogPrefsDialog extends JDialog
try
{
int maxMessages = parseInt(maxMessagesField, "Max log messages in buffer");
- int initialMessages = parseInt(initialMessagesField, "Number of log messages retrieved initially");
+ int initialMessages =
+ parseInt(initialMessagesField, "Number of log messages retrieved initially");
dialog.setPrefs(maxMessages, initialMessages);
dispose();
}
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/MetricsFieldContext.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/MetricsFieldContext.java
index 71ad2658f8a..3969a3b20f1 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/MetricsFieldContext.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/MetricsFieldContext.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
public interface MetricsFieldContext
{
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/MetricsView.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/MetricsView.java
new file mode 100644
index 00000000000..b1cd0b55bd8
--- /dev/null
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/MetricsView.java
@@ -0,0 +1,280 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceGridGUI.LiveDeployment;
+
+import java.awt.Component;
+
+import javax.swing.Icon;
+import javax.swing.JTree;
+import javax.swing.tree.DefaultTreeCellRenderer;
+import javax.swing.SwingUtilities;
+import javax.swing.JOptionPane;
+import javax.swing.JPopupMenu;
+
+import com.zeroc.IceGridGUI.*;
+
+class MetricsView extends TreeNode
+{
+ @Override
+ public Editor getEditor()
+ {
+ return _editor;
+ }
+
+ //
+ // Actions
+ //
+ @Override
+ public boolean[] getAvailableActions()
+ {
+ boolean[] actions = new boolean[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT];
+ actions[ENABLE_METRICS_VIEW] = !_enabled;
+ actions[DISABLE_METRICS_VIEW] = _enabled;
+ return actions;
+ }
+
+ @Override
+ public Component getTreeCellRendererComponent(
+ JTree tree,
+ Object value,
+ boolean sel,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus)
+ {
+ if(_cellRenderer == null)
+ {
+ _cellRenderer = new DefaultTreeCellRenderer();
+
+ _enabledIcon = Utils.getIcon("/icons/16x16/metrics.png");
+ _disabledIcon = Utils.getIcon("/icons/16x16/metrics_disabled.png");
+ }
+
+ Icon icon = _enabled ? _enabledIcon : _disabledIcon;
+ _cellRenderer.setLeafIcon(icon);
+ return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
+ }
+
+ MetricsView(TreeNode parent, String name, com.zeroc.IceMX.MetricsAdminPrx admin, boolean enabled)
+ {
+ super(parent, name);
+ _name = name;
+ _admin = admin;
+ _editor = new MetricsViewEditor(getRoot());
+ _enabled = enabled;
+ }
+
+ @Override
+ public void enableMetricsView(boolean enabled)
+ {
+ com.zeroc.IceMX.MetricsAdminPrx metricsAdmin = getMetricsAdmin();
+ if(metricsAdmin != null)
+ {
+ if(enabled)
+ {
+ metricsAdmin.enableMetricsViewAsync(_name).whenComplete((result, ex) ->
+ {
+ if(ex == null)
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ _enabled = true;
+ getRoot().getTreeModel().nodeChanged(MetricsView.this);
+ getRoot().getCoordinator().showActions(MetricsView.this);
+ if(getRoot().getTree().getLastSelectedPathComponent() == MetricsView.this)
+ {
+ //
+ // If the metrics view is selected when enabled success,
+ // we must start the refresh thread to pull updates.
+ //
+ MetricsViewEditor.startRefresh(MetricsView.this);
+ }
+ });
+ }
+ else
+ {
+ MetricsViewEditor.stopRefresh();
+ SwingUtilities.invokeLater(() ->
+ {
+ if(ex instanceof com.zeroc.Ice.ObjectNotExistException ||
+ ex instanceof com.zeroc.Ice.ConnectionRefusedException)
+ {
+ // Server is down.
+ }
+ else if(!(ex instanceof com.zeroc.Ice.CommunicatorDestroyedException))
+ {
+ ex.printStackTrace();
+ JOptionPane.showMessageDialog(getCoordinator().getMainFrame(),
+ "Error: " + ex.toString(), "Error",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ });
+ }
+ });
+ }
+ else
+ {
+ metricsAdmin.disableMetricsViewAsync(_name).whenComplete((result, ex) ->
+ {
+ if(ex == null)
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ _enabled = false;
+ _editor.show(MetricsView.this, null, 0);
+ getRoot().getTreeModel().nodeChanged(MetricsView.this);
+ getRoot().getCoordinator().showActions(MetricsView.this);
+ if(getRoot().getTree().getLastSelectedPathComponent() == MetricsView.this)
+ {
+ //
+ // If the metrics view is selected when disabled success,
+ // we stop the refresh.
+ //
+ MetricsViewEditor.stopRefresh();
+ }
+ });
+ }
+ else
+ {
+ MetricsViewEditor.stopRefresh();
+ SwingUtilities.invokeLater(() ->
+ {
+ if(ex instanceof com.zeroc.Ice.ObjectNotExistException ||
+ ex instanceof com.zeroc.Ice.ConnectionRefusedException)
+ {
+ // Server is down.
+ }
+ else if(!(ex instanceof com.zeroc.Ice.CommunicatorDestroyedException))
+ {
+ ex.printStackTrace();
+ JOptionPane.showMessageDialog(getCoordinator().getMainFrame(),
+ "Error: " + ex.toString(), "Error",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ });
+ }
+ });
+ }
+ }
+ }
+
+ public boolean isEnabled()
+ {
+ return _enabled;
+ }
+
+ public String name()
+ {
+ return _name;
+ }
+
+ com.zeroc.IceMX.MetricsAdminPrx getMetricsAdmin()
+ {
+ return _admin;
+ }
+
+ @Override
+ public JPopupMenu getPopupMenu()
+ {
+ LiveActions la = getCoordinator().getLiveActionsForPopup();
+
+ if(_popup == null)
+ {
+ _popup = new JPopupMenu();
+ _popup.add(la.get(ENABLE_METRICS_VIEW));
+ _popup.add(la.get(DISABLE_METRICS_VIEW));
+ }
+
+ la.setTarget(this);
+ return _popup;
+ }
+
+ public java.util.concurrent.CompletableFuture<com.zeroc.IceMX.MetricsFailures> fetchMetricsFailures(String map,
+ String id)
+ {
+ com.zeroc.IceMX.MetricsAdminPrx metricsAdmin = getMetricsAdmin();
+ if(metricsAdmin != null)
+ {
+ try
+ {
+ return metricsAdmin.getMetricsFailuresAsync(_name, map, id);
+ }
+ catch(com.zeroc.Ice.LocalException e)
+ {
+ JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Error: " + e.toString(), "Error",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
+ return null;
+ }
+
+ public void fetchMetricsView()
+ {
+ com.zeroc.IceMX.MetricsAdminPrx metricsAdmin = getMetricsAdmin();
+ if(metricsAdmin != null)
+ {
+ try
+ {
+ metricsAdmin.getMetricsViewAsync(_name).whenComplete((result, ex) ->
+ {
+ if(ex == null)
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ _editor.show(MetricsView.this, result.returnValue, result.timestamp);
+ });
+ }
+ else
+ {
+ MetricsViewEditor.stopRefresh();
+ SwingUtilities.invokeLater(() ->
+ {
+ if(ex instanceof com.zeroc.Ice.ObjectNotExistException ||
+ ex instanceof com.zeroc.Ice.ConnectionRefusedException)
+ {
+ // Server is down.
+ }
+ else if(ex instanceof com.zeroc.Ice.FacetNotExistException)
+ {
+ // MetricsAdmin facet not present.
+ }
+ else if(!(ex instanceof com.zeroc.Ice.CommunicatorDestroyedException))
+ {
+ ex.printStackTrace();
+ JOptionPane.showMessageDialog(getCoordinator().getMainFrame(),
+ "Error: " + ex.toString(), "Error",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ });
+ }
+ });
+ }
+ catch(com.zeroc.Ice.CommunicatorDestroyedException e)
+ {
+ }
+ catch(com.zeroc.Ice.LocalException e)
+ {
+ MetricsViewEditor.stopRefresh();
+ JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Error: " + e.toString(), "Error",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
+ }
+
+ private String _name;
+ private com.zeroc.IceMX.MetricsAdminPrx _admin;
+ private MetricsViewEditor _editor;
+ private boolean _enabled;
+ static private JPopupMenu _popup;
+ static private DefaultTreeCellRenderer _cellRenderer;
+ static private Icon _enabledIcon;
+ static private Icon _disabledIcon;
+}
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/MetricsViewEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/MetricsViewEditor.java
index fda820b74b9..edac26fd911 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/MetricsViewEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/MetricsViewEditor.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import java.lang.reflect.Field;
@@ -64,7 +64,7 @@ import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.JTableHeader;
-import IceGridGUI.*;
+import com.zeroc.IceGridGUI.*;
public class MetricsViewEditor extends Editor implements MetricsFieldContext
{
@@ -101,7 +101,6 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
//
public static class FormatedNumberRenderer extends DefaultTableCellRenderer
{
-
public FormatedNumberRenderer(String format)
{
_format = new DecimalFormat(format);
@@ -203,8 +202,8 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
JTree tree = root.getTree();
tree.addTreeSelectionListener(new SelectionListener());
- Set<String> sectionSort = new LinkedHashSet<String>();
- _properties = Ice.Util.createProperties();
+ Set<String> sectionSort = new LinkedHashSet<>();
+ _properties = com.zeroc.Ice.Util.createProperties();
_properties.load("metrics.cfg");
sectionSort.addAll(java.util.Arrays.asList(_properties.getPropertyAsList("IceGridGUI.Metrics")));
@@ -218,7 +217,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
{
_properties.load(s.trim());
}
- catch(Ice.FileException ex)
+ catch(com.zeroc.Ice.FileException ex)
{
coord.getCommunicator().getLogger().warning("unable to load `" + ex.path + "'");
}
@@ -248,15 +247,10 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
synchronized static void startRefresh(final MetricsView node)
{
assert(_refreshFuture == null);
- _refreshFuture = node.getCoordinator().getExecutor().scheduleAtFixedRate(new Runnable()
- {
- @Override
- public void run()
+ _refreshFuture = node.getCoordinator().getExecutor().scheduleAtFixedRate(() ->
{
node.fetchMetricsView();
- }
-
- }, 0, _refreshPeriod, java.util.concurrent.TimeUnit.SECONDS);
+ }, 0, _refreshPeriod, java.util.concurrent.TimeUnit.SECONDS);
}
synchronized static void stopRefresh()
@@ -326,15 +320,15 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
@Override
public int hashCode()
{
- int h = IceInternal.HashUtil.hashAdd(5381, node);
- h = IceInternal.HashUtil.hashAdd(h, server);
- return IceInternal.HashUtil.hashAdd(h, view);
+ int h = com.zeroc.IceInternal.HashUtil.hashAdd(5381, node);
+ h = com.zeroc.IceInternal.HashUtil.hashAdd(h, server);
+ return com.zeroc.IceInternal.HashUtil.hashAdd(h, view);
}
public String node;
public String server;
public String view;
- public IceMX.MetricsAdminPrx admin;
+ public com.zeroc.IceMX.MetricsAdminPrx admin;
}
public static class MetricsCell
@@ -377,8 +371,8 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
@Override
public int hashCode()
{
- int h = IceInternal.HashUtil.hashAdd(5381, _id);
- return IceInternal.HashUtil.hashAdd(h, _field.getFieldName());
+ int h = com.zeroc.IceInternal.HashUtil.hashAdd(5381, _id);
+ return com.zeroc.IceInternal.HashUtil.hashAdd(h, _field.getFieldName());
}
public double getScaleFactor()
@@ -391,7 +385,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
_scaleFactor = scaleFactor;
}
- public Number getValue(IceMX.Metrics m, long timestamp)
+ public Number getValue(com.zeroc.IceMX.Metrics m, long timestamp)
{
Number value = ((Number)getField().getValue(m, timestamp));
if(value == null)
@@ -532,7 +526,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
{
int[] selectedRows = table.getSelectedRows();
int[] selectedColumns = table.getSelectedColumns();
- Map<String, List<MetricsCell>> rows = new HashMap<String, List<MetricsCell>>();
+ Map<String, List<MetricsCell>> rows = new HashMap<>();
if(selectedRows.length > 0 && selectedColumns.length > 0)
{
@@ -543,7 +537,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
for(int row : selectedRows)
{
- List<MetricsCell> cells = new ArrayList<MetricsCell>();
+ List<MetricsCell> cells = new ArrayList<>();
String id = model.getValueAt(table.convertRowIndexToModel(row), idColumn).toString();
for(int col : selectedColumns)
{
@@ -612,7 +606,8 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
private MetricsView _node;
}
- public void show(final MetricsView node, final Map<java.lang.String, IceMX.Metrics[]> data, final long timestamp)
+ public void show(final MetricsView node, final Map<java.lang.String, com.zeroc.IceMX.Metrics[]> data,
+ final long timestamp)
{
boolean rebuildPanel = false;
if(!node.isEnabled())
@@ -622,14 +617,14 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
}
else if(data != null)
{
- for(final Map.Entry<String, IceMX.Metrics[]> entry : data.entrySet())
+ for(final Map.Entry<String, com.zeroc.IceMX.Metrics[]> entry : data.entrySet())
{
if(_tables.get(entry.getKey()) != null)
{
continue;
}
- IceMX.Metrics[] objects = entry.getValue();
+ com.zeroc.IceMX.Metrics[] objects = entry.getValue();
if(objects == null || objects.length == 0)
{
continue;
@@ -647,7 +642,8 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
catch(NoSuchFieldException ex)
{
}
- MetricsField field = createField(node, prefix + "." + name, entry.getKey(), name, objectField, this);
+ MetricsField field =
+ createField(node, prefix + "." + name, entry.getKey(), name, objectField, this);
if(field != null)
{
model.addField(field);
@@ -671,7 +667,8 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
@Override
public String getToolTipText(MouseEvent e)
{
- int index = columnModel.getColumn(columnModel.getColumnIndexAtX(e.getPoint().x)).getModelIndex();
+ int index = columnModel.getColumn(
+ columnModel.getColumnIndexAtX(e.getPoint().x)).getModelIndex();
return model.getMetricFields().get(index).getColumnToolTip();
}
};
@@ -719,18 +716,19 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
addToGraph.setEnabled(rows.size() > 0);
JMenuItem newGraph = new JMenuItem("New Metrics Graph");
newGraph.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
{
- @Override
- public void actionPerformed(ActionEvent e)
+ Coordinator.IGraphView view = node.getCoordinator().createGraphView();
+ if(view != null)
{
- Coordinator.IGraphView view = node.getCoordinator().createGraphView();
- if(view != null)
- {
- view.addSeries(new MetricsViewTransferableData(new MetricsViewInfo(node),
- entry.getKey(), rows));
- }
+ view.addSeries(
+ new MetricsViewTransferableData(new MetricsViewInfo(node),
+ entry.getKey(), rows));
}
- });
+ }
+ });
addToGraph.add(newGraph);
Coordinator.IGraphView[] graphs = node.getCoordinator().getGraphViews();
@@ -743,8 +741,9 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
@Override
public void actionPerformed(ActionEvent e)
{
- view.addSeries(new MetricsViewTransferableData(new MetricsViewInfo(node),
- entry.getKey(), rows));
+ view.addSeries(
+ new MetricsViewTransferableData(new MetricsViewInfo(node),
+ entry.getKey(), rows));
}
});
}
@@ -758,7 +757,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
if(fieldEntry.getValue().getCellRenderer() != null)
{
table.getColumnModel().getColumn(fieldEntry.getKey().intValue()).setCellRenderer(
- fieldEntry.getValue().getCellRenderer());
+ fieldEntry.getValue().getCellRenderer());
}
}
@@ -777,10 +776,10 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
//
// Load the data.
//
- for(Map.Entry<String, IceMX.Metrics[]> entry : data.entrySet())
+ for(Map.Entry<String, com.zeroc.IceMX.Metrics[]> entry : data.entrySet())
{
String key = entry.getKey();
- IceMX.Metrics[] values = entry.getValue();
+ com.zeroc.IceMX.Metrics[] values = entry.getValue();
JTable table = _tables.get(key);
if(table == null)
{
@@ -792,13 +791,13 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
model.getDataVector().removeAllElements();
model.fireTableDataChanged();
- for(IceMX.Metrics m : values)
+ for(com.zeroc.IceMX.Metrics m : values)
{
model.addMetrics(m, timestamp);
}
int idColumn = table.getColumnModel().getColumnIndex(_properties.getProperty(
- "IceGridGUI.Metrics." + key + ".id.columnName"));
+ "IceGridGUI.Metrics." + key + ".id.columnName"));
if(rows.size() > 0)
{
for(int i = table.getRowCount() - 1; i >= 0; --i)
@@ -825,10 +824,14 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
Field objectField, MetricsFieldContext context)
{
String className = _properties.getPropertyWithDefault(
- prefix + ".fieldClass",
- "IceGridGUI.LiveDeployment.MetricsViewEditor$DeclaredMetricsField");
+ prefix + ".fieldClass", "com.zeroc.IceGridGUI.LiveDeployment.MetricsViewEditor$DeclaredMetricsField");
+
+ if(!className.startsWith("com.zeroc."))
+ {
+ className = "com.zeroc." + className;
+ }
- Class<?> cls = IceInternal.Util.findClass(className, null);
+ Class<?> cls = com.zeroc.IceInternal.Util.findClass(className, null);
if(cls == null)
{
System.err.println("Could not find class " + className);
@@ -899,7 +902,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
{
JSplitPane current = null;
JSplitPane top = null;
- Map<String, JTable> tables = new HashMap<String, JTable>(_tables);
+ Map<String, JTable> tables = new HashMap<>(_tables);
StringBuilder sb = new StringBuilder();
Object[] elements = _selectedPath.getPath();
@@ -996,7 +999,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
_metricsName = metricsName;
}
- public void addMetrics(IceMX.Metrics m, long timestamp)
+ public void addMetrics(com.zeroc.IceMX.Metrics m, long timestamp)
{
Object[] row = new Object[_fields.size()];
@@ -1040,11 +1043,11 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
return false;
}
- @Override
- public Class getColumnClass(int index)
- {
- return _fields.get(index).getColumnClass();
- }
+ @Override
+ public Class getColumnClass(int index)
+ {
+ return _fields.get(index).getColumnClass();
+ }
public Map<Integer, MetricsField> getMetricFields()
{
@@ -1057,12 +1060,11 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
}
String _metricsName;
- Map<Integer, MetricsField> _fields = new HashMap<Integer, MetricsField>();
+ Map<Integer, MetricsField> _fields = new HashMap<>();
}
private static java.util.concurrent.Future<?> _refreshFuture;
- private Map<String, JTable> _tables = new HashMap<String, JTable>();
-
+ private Map<String, JTable> _tables = new HashMap<>();
static class ColumnInfo
{
@@ -1101,7 +1103,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
//
// Name for display.
//
- public String getColumnName();
+ public String getColumnName();
//
// ToolTip
@@ -1111,7 +1113,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
//
// The Java class correspoding to the field, is used in the table models.
//
- public Class getColumnClass();
+ public Class getColumnClass();
//
// Renderer used by JTable to render the field.
@@ -1121,7 +1123,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
//
// Return the value of the field for the given metrics object.
//
- public Object getValue(IceMX.Metrics m, long timestamp);
+ public Object getValue(com.zeroc.IceMX.Metrics m, long timestamp);
//
// Set up a field identical to this but without the transient data.
@@ -1271,7 +1273,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
}
@Override
- public Object getValue(IceMX.Metrics m, long timestamp)
+ public Object getValue(com.zeroc.IceMX.Metrics m, long timestamp)
{
try
{
@@ -1305,11 +1307,11 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
_cellRenderer = new FormatedNumberRenderer(format);
}
- @Override
- public Class getColumnClass()
- {
- return Float.class;
- }
+ @Override
+ public Class getColumnClass()
+ {
+ return Float.class;
+ }
@Override
public TableCellRenderer getCellRenderer()
@@ -1323,9 +1325,9 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
}
@Override
- public Object getValue(IceMX.Metrics m2, long timestamp)
+ public Object getValue(com.zeroc.IceMX.Metrics m2, long timestamp)
{
- IceMX.Metrics m1 = _deltas.get(m2.id);
+ com.zeroc.IceMX.Metrics m1 = _deltas.get(m2.id);
_deltas.put(m2.id, m2);
if(m1 == null)
{
@@ -1343,10 +1345,10 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
}
}
- private double _scaleFactor = 1.0d;
- private String _columnName;
+ private double _scaleFactor = 1.0d;
+ private String _columnName;
private TableCellRenderer _cellRenderer;
- private final Map<String, IceMX.Metrics> _deltas = new HashMap<String, IceMX.Metrics>();
+ private final Map<String, com.zeroc.IceMX.Metrics> _deltas = new HashMap<>();
}
static public class DeltaMeasurement
@@ -1359,10 +1361,10 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
{
public DeltaAverageMetricsField(MetricsView node, String prefix, String metricsName, String fieldName,
Field field)
- {
+ {
super(node, prefix, metricsName, fieldName, field);
setFormat("#0.000"); // Set the default format
- }
+ }
public void setFormat(String format)
{
@@ -1392,7 +1394,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
}
@Override
- public Object getValue(IceMX.Metrics m, long timestamp)
+ public Object getValue(com.zeroc.IceMX.Metrics m, long timestamp)
{
DeltaMeasurement d1 = _deltas.get(m.id);
DeltaMeasurement d2 = new DeltaMeasurement();
@@ -1472,8 +1474,8 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
private double _scaleFactor = 1.0d;
private String _dataField;
- private final Map<String, DeltaMeasurement> _deltas = new HashMap<String, DeltaMeasurement>();
- private final Map<String, Double> _last = new HashMap<String, Double>();
+ private final Map<String, DeltaMeasurement> _deltas = new HashMap<>();
+ private final Map<String, Double> _last = new HashMap<>();
private TableCellRenderer _cellRenderer;
}
@@ -1496,9 +1498,9 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
return _cellRenderer;
}
- @Override
- public Object getValue(final IceMX.Metrics m, long timestamp)
- {
+ @Override
+ public Object getValue(final com.zeroc.IceMX.Metrics m, long timestamp)
+ {
JButton button = new JButton(Integer.toString(m.failures));
if(m.failures > 0)
{
@@ -1535,89 +1537,61 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
JScrollPane scrollPane = new JScrollPane(table);
- IceMX.Callback_MetricsAdmin_getMetricsFailures cb =
- new IceMX.Callback_MetricsAdmin_getMetricsFailures()
+ getMetricsNode().getCoordinator().getMainFrame().setCursor(
+ Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ java.util.concurrent.CompletableFuture<com.zeroc.IceMX.MetricsFailures> r =
+ getMetricsNode().fetchMetricsFailures(getMetricsName(), m.id);
+ if(r != null)
+ {
+ r.whenComplete((result, ex) ->
{
- @Override
- public void response(final IceMX.MetricsFailures data)
+ if(ex == null)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
+ for(Map.Entry<String, Integer> entry : result.failures.entrySet())
{
- for(Map.Entry<String, Integer> entry : data.failures.entrySet())
- {
- Object[] row = new Object[3];
- row[0] = entry.getValue().toString();
- row[1] = entry.getKey();
- row[2] = m.id;
- model.addRow(row);
- }
- getMetricsNode().getCoordinator().getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ Object[] row = new Object[3];
+ row[0] = entry.getValue().toString();
+ row[1] = entry.getKey();
+ row[2] = m.id;
+ model.addRow(row);
}
+ getMetricsNode().getCoordinator().getMainFrame().setCursor(
+ Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
});
- }
-
- @Override
- public void exception(final Ice.LocalException e)
+ }
+ else
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
+ getMetricsNode().getCoordinator().getMainFrame().setCursor(
+ Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ if(ex instanceof com.zeroc.Ice.ObjectNotExistException)
{
- getMetricsNode().getCoordinator().getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
- if(e instanceof Ice.ObjectNotExistException)
- {
- // Server is down.
- }
- else if(e instanceof Ice.FacetNotExistException)
- {
- // MetricsAdmin facet not present.
- }
- else
- {
- e.printStackTrace();
- JOptionPane.showMessageDialog(
- getMetricsNode().getCoordinator().getMainFrame(),
- "Error: " + e.toString(), "Error",
- JOptionPane.ERROR_MESSAGE);
- }
+ // Server is down.
}
- });
- }
-
- @Override
- public void exception(final Ice.UserException e)
- {
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
+ else if(ex instanceof com.zeroc.Ice.FacetNotExistException)
{
- getMetricsNode().getCoordinator().getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
- e.printStackTrace();
+ // MetricsAdmin facet not present.
+ }
+ else
+ {
+ ex.printStackTrace();
JOptionPane.showMessageDialog(
- getMetricsNode().getCoordinator().getMainFrame(),
- "Error: " + e.toString(), "Error",
- JOptionPane.ERROR_MESSAGE);
+ getMetricsNode().getCoordinator().getMainFrame(),
+ "Error: " + ex.toString(), "Error",
+ JOptionPane.ERROR_MESSAGE);
}
});
}
- };
-
- getMetricsNode().getCoordinator().getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- getMetricsNode().fetchMetricsFailures(getMetricsName(), m.id, cb);
+ });
+ }
JOptionPane.showMessageDialog(getMetricsNode().getCoordinator().getMainFrame(), scrollPane,
"Metrics Failures", JOptionPane.PLAIN_MESSAGE);
getMetricsNode().getCoordinator().getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
});
}
@@ -1626,7 +1600,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
button.setEnabled(false);
}
return button;
- }
+ }
private static final TableCellRenderer _cellRenderer = new ButtonRenderer();
}
@@ -1651,11 +1625,12 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
}
@Override
- public Object getValue(final IceMX.Metrics m, final long timestamp)
+ public Object getValue(final com.zeroc.IceMX.Metrics m, final long timestamp)
{
try
{
- final IceMX.Metrics[] objects = (IceMX.Metrics[])m.getClass().getField(getFieldName()).get(m);
+ final com.zeroc.IceMX.Metrics[] objects =
+ (com.zeroc.IceMX.Metrics[])m.getClass().getField(getFieldName()).get(m);
JButton button = new JButton(Integer.toString(objects.length));
button.setEnabled(objects.length > 0);
if(objects.length > 0)
@@ -1696,7 +1671,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
final JTable table = new JTable(model)
{
//
- //Implement table header tool tips.
+ // Implement table header tool tips.
//
@Override
protected JTableHeader createDefaultTableHeader()
@@ -1738,7 +1713,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
int idColumn = table.getColumnModel().getColumnIndex(_properties.getProperty(prefix +
".id.columnName"));
- for(IceMX.Metrics m : objects)
+ for(com.zeroc.IceMX.Metrics m : objects)
{
model.addMetrics(m, timestamp);
}
@@ -1767,9 +1742,9 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext
}
private static final int _refreshPeriod = 5;
- private static Ice.Properties _properties;
+ private static com.zeroc.Ice.Properties _properties;
private static String[] _sectionSort;
- private static Map<String, String> _sectionNames = new HashMap<String, String>();
+ private static Map<String, String> _sectionNames = new HashMap<>();
private static TreePath _selectedPath;
final private Preferences _prefs;
}
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Node.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Node.java
index 74eaaeddf93..1a08e655d7e 100755
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Node.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Node.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import java.awt.Component;
import java.awt.Cursor;
@@ -20,8 +20,8 @@ import javax.swing.tree.DefaultTreeCellRenderer;
import java.text.NumberFormat;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class Node extends ListTreeNode
{
@@ -31,7 +31,7 @@ class Node extends ListTreeNode
@Override
public boolean[] getAvailableActions()
{
- boolean[] actions = new boolean[IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT];
+ boolean[] actions = new boolean[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT];
actions[SHUTDOWN_NODE] = _up;
actions[RETRIEVE_ICE_LOG] = _up;
actions[RETRIEVE_STDOUT] = _up;
@@ -48,52 +48,44 @@ class Node extends ListTreeNode
final String errorTitle = "Failed to retrieve Admin Proxy for Node " + _id;
getRoot().getCoordinator().getStatusBar().setText(prefix);
- Callback_Admin_getNodeAdmin cb = new Callback_Admin_getNodeAdmin()
+ try
{
- @Override
- public void response(Ice.ObjectPrx prx)
- {
- final Ice.LoggerAdminPrx loggerAdmin = Ice.LoggerAdminPrxHelper.uncheckedCast(prx.ice_facet("Logger"));
- final String title = "Node " + _id + " Ice log";
- final String defaultFileName = "node-" + _id;
-
- SwingUtilities.invokeLater(new Runnable()
+ getRoot().getCoordinator().getSession().getAdmin().getNodeAdminAsync(_id).whenComplete((result, ex) ->
{
- @Override
- public void run()
+ if(ex == null)
{
- success(prefix);
- if(_showIceLogDialog == null)
- {
- _showIceLogDialog = new ShowIceLogDialog(Node.this, title, loggerAdmin, defaultFileName,
- getRoot().getLogMaxLines(), getRoot().getLogInitialLines());
- }
- else
- {
- _showIceLogDialog.toFront();
- }
+ final com.zeroc.Ice.LoggerAdminPrx loggerAdmin =
+ com.zeroc.Ice.LoggerAdminPrx.uncheckedCast(result.ice_facet("Logger"));
+ final String title = "Node " + _id + " Ice log";
+ final String defaultFileName = "node-" + _id;
+
+ SwingUtilities.invokeLater(() ->
+ {
+ success(prefix);
+ if(_showIceLogDialog == null)
+ {
+ _showIceLogDialog = new ShowIceLogDialog(Node.this, title, loggerAdmin,
+ defaultFileName,
+ getRoot().getLogMaxLines(),
+ getRoot().getLogInitialLines());
+ }
+ else
+ {
+ _showIceLogDialog.toFront();
+ }
+ });
+ }
+ else if(ex instanceof com.zeroc.Ice.UserException)
+ {
+ amiFailure(prefix, errorTitle, (com.zeroc.Ice.UserException)ex);
+ }
+ else
+ {
+ amiFailure(prefix, errorTitle, ex.toString());
}
});
- }
-
- @Override
- public void exception(Ice.UserException e)
- {
- amiFailure(prefix, errorTitle, e);
- }
-
- @Override
- public void exception(Ice.LocalException e)
- {
- amiFailure(prefix, errorTitle, e.toString());
- }
- };
-
- try
- {
- getRoot().getCoordinator().getSession().getAdmin().begin_getNodeAdmin(_id, cb);
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
failure(prefix, errorTitle, e.toString());
}
@@ -146,39 +138,17 @@ class Node extends ListTreeNode
final String prefix = "Shutting down node '" + _id + "'...";
getCoordinator().getStatusBar().setText(prefix);
- Callback_Admin_shutdownNode cb = new Callback_Admin_shutdownNode()
- {
- //
- // Called by another thread!
- //
- @Override
- public void response()
- {
- amiSuccess(prefix);
- }
-
- @Override
- public void exception(Ice.UserException e)
- {
- amiFailure(prefix, "Failed to shutdown " + _id, e);
- }
-
- @Override
- public void exception(Ice.LocalException e)
- {
- amiFailure(prefix, "Failed to shutdown " + _id,
- e.toString());
- }
- };
-
try
{
getCoordinator().getMainFrame().setCursor(
Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- getCoordinator().getAdmin().begin_shutdownNode(_id, cb);
+ getCoordinator().getAdmin().shutdownNodeAsync(_id).whenComplete((result, ex) ->
+ {
+ amiComplete(prefix, "Failed to shutdown " + _id, ex);
+ });
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
failure(prefix, "Failed to shutdown " + _id, e.toString());
}
@@ -280,8 +250,7 @@ class Node extends ListTreeNode
up(info, false);
}
- Node(Root parent, ApplicationDescriptor appDesc,
- String nodeName, NodeDescriptor nodeDesc)
+ Node(Root parent, ApplicationDescriptor appDesc, String nodeName, NodeDescriptor nodeDesc)
{
super(parent, nodeName);
add(appDesc, nodeDesc);
@@ -371,7 +340,7 @@ class Node extends ListTreeNode
return true;
}
- java.util.List<Server> toRemove = new java.util.LinkedList<Server>();
+ java.util.List<Server> toRemove = new java.util.LinkedList<>();
int[] toRemoveIndices = new int[_children.size()];
int i = 0;
@@ -419,7 +388,7 @@ class Node extends ListTreeNode
}
NodeDescriptor nodeDesc = data.descriptor;
- java.util.Set<Server> freshServers = new java.util.HashSet<Server>();
+ java.util.Set<Server> freshServers = new java.util.HashSet<>();
if(update != null)
{
@@ -600,7 +569,7 @@ class Node extends ListTreeNode
//
// Tell every server on this node
//
- java.util.Set<Server> updatedServers = new java.util.HashSet<Server>();
+ java.util.Set<Server> updatedServers = new java.util.HashSet<>();
for(ServerDynamicInfo sinfo : _info.servers)
{
Server server = findServer(sinfo.id);
@@ -726,7 +695,7 @@ class Node extends ListTreeNode
}
}
- Ice.ObjectPrx getProxy(String adapterId)
+ com.zeroc.Ice.ObjectPrx getProxy(String adapterId)
{
if(_info != null)
{
@@ -745,7 +714,7 @@ class Node extends ListTreeNode
java.util.SortedMap<String, String> getLoadFactors()
{
- java.util.SortedMap<String, String> result = new java.util.TreeMap<String, String>();
+ java.util.SortedMap<String, String> result = new java.util.TreeMap<>();
for(java.util.Map.Entry<String, ApplicationData> p : _map.entrySet())
{
@@ -764,103 +733,72 @@ class Node extends ListTreeNode
void showLoad()
{
- Callback_Admin_getNodeLoad cb = new Callback_Admin_getNodeLoad()
- {
- @Override
- public void response(LoadInfo loadInfo)
- {
- NumberFormat format;
- if(_windows)
- {
- format = NumberFormat.getPercentInstance();
- format.setMaximumFractionDigits(1);
- format.setMinimumFractionDigits(1);
- }
- else
- {
- format = NumberFormat.getNumberInstance();
- format.setMaximumFractionDigits(2);
- format.setMinimumFractionDigits(2);
- }
-
- final String load =
- format.format(loadInfo.avg1) + " " +
- format.format(loadInfo.avg5) + " " +
- format.format(loadInfo.avg15);
-
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _editor.setLoad(load, Node.this);
- }
- });
- }
-
- @Override
- public void exception(final Ice.UserException e)
- {
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- if(e instanceof IceGrid.NodeNotExistException)
- {
- _editor.setLoad(
- "Error: this node is not known to this IceGrid Registry",
- Node.this);
- }
- else if(e instanceof IceGrid.NodeUnreachableException)
- {
- _editor.setLoad("Error: cannot reach this node", Node.this);
- }
- else
- {
- _editor.setLoad("Error: " + e.toString(), Node.this);
- }
- }
- });
- }
-
- @Override
- public void exception(final Ice.LocalException e)
- {
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _editor.setLoad("Error: " + e.toString(), Node.this);
- }
- });
- }
- };
-
try
{
- getCoordinator().getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ getCoordinator().getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- IceGrid.AdminPrx admin = getCoordinator().getAdmin();
+ com.zeroc.IceGrid.AdminPrx admin = getCoordinator().getAdmin();
if(admin == null)
{
_editor.setLoad("Unknown", this);
}
else
{
- admin.begin_getNodeLoad(_id, cb);
+ admin.getNodeLoadAsync(_id).whenComplete((result, ex) ->
+ {
+ if(ex == null)
+ {
+ NumberFormat format;
+ if(_windows)
+ {
+ format = NumberFormat.getPercentInstance();
+ format.setMaximumFractionDigits(1);
+ format.setMinimumFractionDigits(1);
+ }
+ else
+ {
+ format = NumberFormat.getNumberInstance();
+ format.setMaximumFractionDigits(2);
+ format.setMinimumFractionDigits(2);
+ }
+
+ final String load =
+ format.format(result.avg1) + " " +
+ format.format(result.avg5) + " " +
+ format.format(result.avg15);
+
+ SwingUtilities.invokeLater(() -> _editor.setLoad(load, Node.this));
+ }
+ else
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ if(ex instanceof com.zeroc.IceGrid.NodeNotExistException)
+ {
+ _editor.setLoad(
+ "Error: this node is not known to this IceGrid Registry",
+ Node.this);
+ }
+ else if(ex instanceof com.zeroc.IceGrid.NodeUnreachableException)
+ {
+ _editor.setLoad("Error: cannot reach this node", Node.this);
+ }
+ else
+ {
+ _editor.setLoad("Error: " + ex.toString(), Node.this);
+ }
+ });
+ }
+ });
}
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
_editor.setLoad("Error: " + e.toString(), this);
}
finally
{
- getCoordinator().getMainFrame().setCursor(
- Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ getCoordinator().getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
@@ -870,8 +808,7 @@ class Node extends ListTreeNode
//
// Find template
//
- TemplateDescriptor templateDescriptor =
- application.serverTemplates.get(instanceDescriptor.template);
+ TemplateDescriptor templateDescriptor = application.serverTemplates.get(instanceDescriptor.template);
assert templateDescriptor != null;
ServerDescriptor serverDescriptor = (ServerDescriptor)templateDescriptor.descriptor;
@@ -1014,10 +951,9 @@ class Node extends ListTreeNode
Utils.Resolver resolver;
}
- public java.util.List<Server>
- getServers()
+ public java.util.List<Server> getServers()
{
- java.util.List<Server> servers = new java.util.ArrayList<Server>();
+ java.util.List<Server> servers = new java.util.ArrayList<>();
for(Object obj : _children)
{
servers.add((Server)obj);
@@ -1028,7 +964,7 @@ class Node extends ListTreeNode
//
// Application name to ApplicationData
//
- private final java.util.SortedMap<String, ApplicationData> _map = new java.util.TreeMap<String, ApplicationData>();
+ private final java.util.SortedMap<String, ApplicationData> _map = new java.util.TreeMap<>();
private boolean _up = false;
private NodeDynamicInfo _info;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/NodeEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/NodeEditor.java
index e05d0b1197c..d1bee1e968d 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/NodeEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/NodeEditor.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import java.awt.event.ActionEvent;
@@ -21,7 +21,7 @@ import javax.swing.JTextField;
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.layout.CellConstraints;
-import IceGrid.*;
+import com.zeroc.IceGrid.*;
class NodeEditor extends Editor
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ObjectDialog.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ObjectDialog.java
index 46a0365f7e7..f9ac9d656f7 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ObjectDialog.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ObjectDialog.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import java.awt.Container;
import java.awt.event.ActionEvent;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/RegistryEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/RegistryEditor.java
index 916d1215c64..5513f430400 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/RegistryEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/RegistryEditor.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
@@ -24,8 +24,8 @@ import javax.swing.KeyStroke;
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.layout.CellConstraints;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class RegistryEditor extends Editor
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Root.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Root.java
index da7141277ab..277e5c34a56 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Root.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Root.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import java.awt.Component;
import java.awt.Cursor;
@@ -23,15 +23,14 @@ import javax.swing.tree.DefaultTreeModel;
import java.util.prefs.Preferences;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
//
// The Root node of the Live Deployment view
//
public class Root extends ListArrayTreeNode
{
-
//
// A custom tree model to filter tree views.
//
@@ -56,8 +55,7 @@ public class Root extends ListArrayTreeNode
}
@Override
- public int
- getChildCount(Object parent)
+ public int getChildCount(Object parent)
{
if(!filterEnabled())
{
@@ -151,7 +149,7 @@ public class Root extends ListArrayTreeNode
{
return _applicationNameFilter;
}
-
+
@Override
public void clearShowIceLogDialog()
{
@@ -208,7 +206,7 @@ public class Root extends ListArrayTreeNode
@Override
public boolean[] getAvailableActions()
{
- boolean[] actions = new boolean[IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT];
+ boolean[] actions = new boolean[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT];
actions[ADD_OBJECT] = _coordinator.connectedToMaster();
actions[SHUTDOWN_REGISTRY] = true;
actions[RETRIEVE_ICE_LOG] = true;
@@ -226,28 +224,12 @@ public class Root extends ListArrayTreeNode
try
{
final AdminPrx admin = _coordinator.getAdmin();
- admin.begin_shutdownRegistry(_replicaName, new Ice.Callback()
+ admin.shutdownRegistryAsync(_replicaName).whenComplete((result, ex) ->
{
- @Override
- public void completed(final Ice.AsyncResult r)
- {
- try
- {
- admin.end_shutdownRegistry(r);
- amiSuccess(prefix);
- }
- catch(Ice.UserException ex)
- {
- amiFailure(prefix, errorTitle, ex);
- }
- catch(Ice.LocalException ex)
- {
- amiFailure(prefix, errorTitle, ex.toString());
- }
- }
+ amiComplete(prefix, errorTitle, ex);
});
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
failure(prefix, errorTitle, ex.toString());
}
@@ -273,7 +255,7 @@ public class Root extends ListArrayTreeNode
public Object[] getPatchableApplicationNames()
{
- java.util.List<String> result = new java.util.ArrayList<String>();
+ java.util.List<String> result = new java.util.ArrayList<>();
for(java.util.Map.Entry<String, ApplicationInfo> p : _infoMap.entrySet())
{
@@ -288,7 +270,7 @@ public class Root extends ListArrayTreeNode
public java.util.SortedMap<String, String> getApplicationMap()
{
- java.util.SortedMap<String, String> r = new java.util.TreeMap<String, String>();
+ java.util.SortedMap<String, String> r = new java.util.TreeMap<>();
for(java.util.Map.Entry<String, ApplicationInfo> p : _infoMap.entrySet())
{
@@ -370,8 +352,7 @@ public class Root extends ListArrayTreeNode
{
int shutdown = JOptionPane.showConfirmDialog(
_coordinator.getMainFrame(),
- "You are about to install or refresh your"
- + " application distribution.\n"
+ "You are about to install or refresh your application distribution.\n"
+ " Do you want shut down all servers affected by this update?",
"Patch Confirmation",
JOptionPane.YES_NO_CANCEL_OPTION);
@@ -388,29 +369,13 @@ public class Root extends ListArrayTreeNode
try
{
final AdminPrx admin = _coordinator.getAdmin();
- admin.begin_patchApplication(applicationName, shutdown == JOptionPane.YES_OPTION,
- new Ice.Callback()
+ admin.patchApplicationAsync(applicationName, shutdown == JOptionPane.YES_OPTION).whenComplete(
+ (result, ex) ->
{
- @Override
- public void completed(final Ice.AsyncResult r)
- {
- try
- {
- admin.end_patchApplication(r);
- amiSuccess(prefix);
- }
- catch(Ice.UserException ex)
- {
- amiFailure(prefix, errorTitle, ex);
- }
- catch(Ice.LocalException ex)
- {
- amiFailure(prefix, errorTitle, ex.toString());
- }
- }
+ amiComplete(prefix, errorTitle, ex);
});
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
failure(prefix, errorTitle, ex.toString());
}
@@ -458,7 +423,7 @@ public class Root extends ListArrayTreeNode
{
_infoMap.remove(name);
- java.util.List<Node> toRemove = new java.util.LinkedList<Node>();
+ java.util.List<Node> toRemove = new java.util.LinkedList<>();
int[] toRemoveIndices = new int[_nodes.size()];
int i = 0;
@@ -572,7 +537,7 @@ public class Root extends ListArrayTreeNode
//
// Add/update
//
- java.util.Set<Node> freshNodes = new java.util.HashSet<Node>();
+ java.util.Set<Node> freshNodes = new java.util.HashSet<>();
for(NodeUpdateDescriptor desc : update.descriptor.nodes)
{
String nodeName = desc.name;
@@ -635,23 +600,23 @@ public class Root extends ListArrayTreeNode
{
for(ObjectInfo info : objects)
{
- _objects.put(Ice.Util.identityToString(info.proxy.ice_getIdentity()), info);
+ _objects.put(com.zeroc.Ice.Util.identityToString(info.proxy.ice_getIdentity()), info);
}
}
public void objectAdded(ObjectInfo info)
{
- _objects.put(Ice.Util.identityToString(info.proxy.ice_getIdentity()), info);
+ _objects.put(com.zeroc.Ice.Util.identityToString(info.proxy.ice_getIdentity()), info);
}
public void objectUpdated(ObjectInfo info)
{
- _objects.put(Ice.Util.identityToString(info.proxy.ice_getIdentity()), info);
+ _objects.put(com.zeroc.Ice.Util.identityToString(info.proxy.ice_getIdentity()), info);
}
- public void objectRemoved(Ice.Identity id)
+ public void objectRemoved(com.zeroc.Ice.Identity id)
{
- _objects.remove(Ice.Util.identityToString(id));
+ _objects.remove(com.zeroc.Ice.Util.identityToString(id));
}
//
@@ -847,13 +812,13 @@ public class Root extends ListArrayTreeNode
void addObject(String strProxy, final String type, final JDialog dialog)
{
- Ice.ObjectPrx proxy = null;
+ com.zeroc.Ice.ObjectPrx proxy = null;
try
{
proxy = _coordinator.getCommunicator().stringToProxy(strProxy);
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
JOptionPane.showMessageDialog(
_coordinator.getMainFrame(),
@@ -871,66 +836,48 @@ public class Root extends ListArrayTreeNode
JOptionPane.ERROR_MESSAGE);
}
- String strIdentity = Ice.Util.identityToString(proxy.ice_getIdentity());
+ String strIdentity = com.zeroc.Ice.Util.identityToString(proxy.ice_getIdentity());
final String prefix = "Adding well-known object '" + strIdentity + "'...";
final AdminPrx admin = _coordinator.getAdmin();
- Ice.Callback cb = new Ice.Callback()
- {
- @Override
- public void completed(final Ice.AsyncResult r)
- {
- try
- {
- if(type == null)
- {
- admin.end_addObject(r);
- }
- else
- {
- admin.end_addObjectWithType(r);
- }
-
- amiSuccess(prefix);
-
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- dialog.setVisible(false);
- }
- });
- }
- catch(ObjectExistsException e)
- {
- amiFailure(prefix, "addObject failed",
- "An object with this identity is already registered as a well-known object");
- }
- catch(DeploymentException ex)
- {
- amiFailure(prefix, "addObject failed", "Deployment exception: " + ex.reason);
- }
- catch(Ice.LocalException ex)
- {
- amiFailure(prefix, "addObject failed", ex.toString());
- }
- }
- };
_coordinator.getStatusBar().setText(prefix);
try
{
+ java.util.concurrent.CompletableFuture<Void> r;
if(type == null)
{
- admin.begin_addObject(proxy, cb);
+ r = admin.addObjectAsync(proxy);
}
else
{
- admin.begin_addObjectWithType(proxy, type, cb);
+ r = admin.addObjectWithTypeAsync(proxy, type);
}
+ r.whenComplete((result, ex) ->
+ {
+ if(ex == null)
+ {
+ amiSuccess(prefix);
+
+ SwingUtilities.invokeLater(() -> dialog.setVisible(false));
+ }
+ else if(ex instanceof ObjectExistsException)
+ {
+ amiFailure(prefix, "addObject failed",
+ "An object with this identity is already registered as a well-known object");
+ }
+ else if(ex instanceof DeploymentException)
+ {
+ amiFailure(prefix, "addObject failed", "Deployment exception: " +
+ ((DeploymentException)ex).reason);
+ }
+ else
+ {
+ amiFailure(prefix, "addObject failed", ex.toString());
+ }
+ });
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
failure(prefix, "addObject failed", ex.toString());
}
@@ -938,9 +885,9 @@ public class Root extends ListArrayTreeNode
void removeObject(String strProxy)
{
- Ice.ObjectPrx proxy = _coordinator.getCommunicator().stringToProxy(strProxy);
- Ice.Identity identity = proxy.ice_getIdentity();
- final String strIdentity = Ice.Util.identityToString(identity);
+ com.zeroc.Ice.ObjectPrx proxy = _coordinator.getCommunicator().stringToProxy(strProxy);
+ com.zeroc.Ice.Identity identity = proxy.ice_getIdentity();
+ final String strIdentity = com.zeroc.Ice.Util.identityToString(identity);
final String prefix = "Removing well-known object '" + strIdentity + "'...";
final String errorTitle = "Failed to remove object '" + strIdentity + "'";
@@ -949,29 +896,12 @@ public class Root extends ListArrayTreeNode
try
{
final AdminPrx admin = _coordinator.getAdmin();
- admin.begin_removeObject(identity,
- new Ice.Callback()
- {
- @Override
- public void completed(final Ice.AsyncResult r)
- {
- try
- {
- admin.end_removeObject(r);
- amiSuccess(prefix);
- }
- catch(Ice.UserException ex)
- {
- amiFailure(prefix, errorTitle, ex);
- }
- catch(Ice.LocalException ex)
- {
- amiFailure(prefix, errorTitle, ex.toString());
- }
- }
- });
+ admin.removeObjectAsync(identity).whenComplete((result, ex) ->
+ {
+ amiComplete(prefix, errorTitle, ex);
+ });
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
failure(prefix, errorTitle, ex.toString());
}
@@ -985,32 +915,15 @@ public class Root extends ListArrayTreeNode
try
{
final AdminPrx admin = _coordinator.getAdmin();
- admin.begin_removeAdapter(adapterId, new Ice.Callback()
+ admin.removeAdapterAsync(adapterId).whenComplete((result, ex) ->
{
- @Override
- public void completed(final Ice.AsyncResult r)
- {
- try
- {
- admin.end_removeAdapter(r);
- amiSuccess(prefix);
- }
- catch(Ice.UserException ex)
- {
- amiFailure(prefix, errorTitle, ex);
- }
- catch(Ice.LocalException ex)
- {
- amiFailure(prefix, errorTitle, ex.toString());
- }
- }
+ amiComplete(prefix, errorTitle, ex);
});
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
failure(prefix, errorTitle, ex.toString());
}
-
}
@Override
@@ -1021,53 +934,44 @@ public class Root extends ListArrayTreeNode
final String prefix = "Retrieving Admin proxy for Registry...";
final String errorTitle = "Failed to retrieve Admin Proxy for Registry";
_coordinator.getStatusBar().setText(prefix);
-
- Callback_Admin_getRegistryAdmin cb = new Callback_Admin_getRegistryAdmin()
+
+ try
{
- @Override
- public void response(Ice.ObjectPrx prx)
- {
- final Ice.LoggerAdminPrx loggerAdmin = Ice.LoggerAdminPrxHelper.uncheckedCast(prx.ice_facet("Logger"));
- final String title = "Registry " + _label + " Ice log";
- final String defaultFileName = "registry-" + _instanceName + "-" + _replicaName;
-
- SwingUtilities.invokeLater(new Runnable()
+ _coordinator.getSession().getAdmin().getRegistryAdminAsync(_replicaName).whenComplete((result, ex) ->
{
- @Override
- public void run()
+ if(ex == null)
+ {
+ final com.zeroc.Ice.LoggerAdminPrx loggerAdmin =
+ com.zeroc.Ice.LoggerAdminPrx.uncheckedCast(result.ice_facet("Logger"));
+ final String title = "Registry " + _label + " Ice log";
+ final String defaultFileName = "registry-" + _instanceName + "-" + _replicaName;
+
+ SwingUtilities.invokeLater(() ->
+ {
+ success(prefix);
+ if(_showIceLogDialog == null)
+ {
+ _showIceLogDialog = new ShowIceLogDialog(Root.this, title, loggerAdmin,
+ defaultFileName, getLogMaxLines(),
+ getLogInitialLines());
+ }
+ else
+ {
+ _showIceLogDialog.toFront();
+ }
+ });
+ }
+ else if(ex instanceof com.zeroc.Ice.UserException)
+ {
+ amiFailure(prefix, errorTitle, (com.zeroc.Ice.UserException)ex);
+ }
+ else
{
- success(prefix);
- if(_showIceLogDialog == null)
- {
- _showIceLogDialog = new ShowIceLogDialog(Root.this, title, loggerAdmin, defaultFileName,
- getLogMaxLines(), getLogInitialLines());
- }
- else
- {
- _showIceLogDialog.toFront();
- }
+ amiFailure(prefix, errorTitle, ex.toString());
}
});
- }
-
- @Override
- public void exception(Ice.UserException e)
- {
- amiFailure(prefix, errorTitle, e);
- }
-
- @Override
- public void exception(Ice.LocalException e)
- {
- amiFailure(prefix, errorTitle, e.toString());
- }
- };
-
- try
- {
- _coordinator.getSession().getAdmin().begin_getRegistryAdmin(_replicaName, cb);
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
failure(prefix, errorTitle, e.toString());
}
@@ -1077,7 +981,7 @@ public class Root extends ListArrayTreeNode
_showIceLogDialog.toFront();
}
}
-
+
@Override
public void retrieveOutput(final boolean stdout)
{
@@ -1120,17 +1024,17 @@ public class Root extends ListArrayTreeNode
ApplicationInfo app = _infoMap.get(applicationName);
return app.descriptor.propertySets.get(name);
}
-
+
void addShowIceLogDialog(String title, ShowIceLogDialog dialog)
{
_showIceLogDialogMap.put(title, dialog);
}
-
+
void removeShowIceLogDialog(String title)
{
_showIceLogDialogMap.remove(title);
}
-
+
void openShowLogFileDialog(ShowLogFileDialog.FileIteratorFactory factory)
{
ShowLogFileDialog d = _showLogFileDialogMap.get(factory.getTitle());
@@ -1159,14 +1063,14 @@ public class Root extends ListArrayTreeNode
p.close(false);
}
_showIceLogDialogMap.clear();
-
+
for(ShowLogFileDialog p : _showLogFileDialogMap.values())
{
p.close(false);
}
_showLogFileDialogMap.clear();
}
-
+
public int getMessageSizeMax()
{
return _messageSizeMax;
@@ -1182,25 +1086,25 @@ public class Root extends ListArrayTreeNode
storeLogPrefs();
}
-
+
public void setLogPrefs(int maxLines, int initialLines)
{
_logMaxLines = maxLines;
_logInitialLines = initialLines;
-
+
storeLogPrefs();
}
-
+
public int getLogMaxLines()
{
return _logMaxLines;
}
-
+
public int getLogInitialLines()
{
return _logInitialLines;
}
-
+
private void loadLogPrefs()
{
Preferences logPrefs = _coordinator.getPrefs().node("Log");
@@ -1279,23 +1183,23 @@ public class Root extends ListArrayTreeNode
private String _instanceName = "";
private String _replicaName;
- private final java.util.List<Node> _nodes = new java.util.LinkedList<Node>();
- private final java.util.List<Slave> _slaves = new java.util.LinkedList<Slave>();
+ private final java.util.List<Node> _nodes = new java.util.LinkedList<>();
+ private final java.util.List<Slave> _slaves = new java.util.LinkedList<>();
//
// Maps application name to current application info
//
- private final java.util.Map<String, ApplicationInfo> _infoMap = new java.util.TreeMap<String, ApplicationInfo>();
+ private final java.util.Map<String, ApplicationInfo> _infoMap = new java.util.TreeMap<>();
//
// Map AdapterId => AdapterInfo
//
- private java.util.SortedMap<String, AdapterInfo> _adapters = new java.util.TreeMap<String, AdapterInfo>();
+ private java.util.SortedMap<String, AdapterInfo> _adapters = new java.util.TreeMap<>();
//
// Map stringified identity => ObjectInfo
//
- private java.util.SortedMap<String, ObjectInfo> _objects = new java.util.TreeMap<String, ObjectInfo>();
+ private java.util.SortedMap<String, ObjectInfo> _objects = new java.util.TreeMap<>();
//
// 'this' is the root of the tree
@@ -1314,16 +1218,16 @@ public class Root extends ListArrayTreeNode
// ShowLogFileDialog and ShowIceLogFileDialog
//
private final int _messageSizeMax;
-
- private final java.util.Map<String, ShowIceLogDialog> _showIceLogDialogMap = new java.util.HashMap<String, ShowIceLogDialog>();
- private final java.util.Map<String, ShowLogFileDialog> _showLogFileDialogMap = new java.util.HashMap<String, ShowLogFileDialog>();
-
+
+ private final java.util.Map<String, ShowIceLogDialog> _showIceLogDialogMap = new java.util.HashMap<>();
+ private final java.util.Map<String, ShowLogFileDialog> _showLogFileDialogMap = new java.util.HashMap<>();
+
int _logMaxLines;
int _logMaxSize;
int _logInitialLines;
int _logMaxReadSize;
int _logPeriod;
-
+
private ShowIceLogDialog _showIceLogDialog;
private ApplicationDetailsDialog _applicationDetailsDialog;
@@ -1332,7 +1236,6 @@ public class Root extends ListArrayTreeNode
static private JPopupMenu _popup;
static private DefaultTreeCellRenderer _cellRenderer;
-
//
// Application name to filter, if empty all applications are displayed.
//
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Server.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Server.java
index cff44ce57e6..af9e19a9867 100755
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Server.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Server.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import java.awt.Component;
import java.awt.Cursor;
@@ -20,8 +20,8 @@ import javax.swing.JTree;
import javax.swing.SwingUtilities;
import javax.swing.tree.DefaultTreeCellRenderer;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
public class Server extends ListArrayTreeNode
{
@@ -31,7 +31,7 @@ public class Server extends ListArrayTreeNode
@Override
public boolean[] getAvailableActions()
{
- boolean[] actions = new boolean[IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT];
+ boolean[] actions = new boolean[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT];
if(_state != null)
{
@@ -77,28 +77,12 @@ public class Server extends ListArrayTreeNode
try
{
final AdminPrx admin = getCoordinator().getAdmin();
- admin.begin_startServer(_id, new Ice.Callback()
+ admin.startServerAsync(_id).whenComplete((result, ex) ->
{
- @Override
- public void completed(final Ice.AsyncResult r)
- {
- try
- {
- admin.end_startServer(r);
- amiSuccess(prefix);
- }
- catch(Ice.UserException ex)
- {
- amiFailure(prefix, errorTitle, ex);
- }
- catch(Ice.LocalException ex)
- {
- amiFailure(prefix, errorTitle, ex.toString());
- }
- }
+ amiComplete(prefix, errorTitle, ex);
});
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
failure(prefix, errorTitle, ex.toString());
}
@@ -108,42 +92,29 @@ public class Server extends ListArrayTreeNode
public void stop()
{
final String prefix = "Stopping server '" + _id + "'...";
- final String errorTitle = "Failed to stop " + _id;
+ final String errorTitle = "Failed to stop " + _id;
getCoordinator().getStatusBar().setText(prefix);
try
{
final AdminPrx admin = getCoordinator().getAdmin();
- admin.begin_stopServer(_id,
- new Ice.Callback()
+ admin.stopServerAsync(_id).whenComplete((result, ex) ->
+ {
+ if(ex == null)
{
- @Override
- public void completed(final Ice.AsyncResult r)
- {
- try
- {
- admin.end_stopServer(r);
- amiSuccess(prefix);
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- rebuild(Server.this, false);
- }
- });
- }
- catch(Ice.UserException ex)
- {
- amiFailure(prefix, errorTitle, ex);
- }
- catch(Ice.LocalException ex)
- {
- amiFailure(prefix, errorTitle, ex.toString());
- }
- }
- });
+ amiSuccess(prefix);
+ SwingUtilities.invokeLater(() -> rebuild(Server.this, false));
+ }
+ else if(ex instanceof com.zeroc.Ice.UserException)
+ {
+ amiFailure(prefix, errorTitle, (com.zeroc.Ice.UserException)ex);
+ }
+ else
+ {
+ amiFailure(prefix, errorTitle, ex.toString());
+ }
+ });
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
failure(prefix, errorTitle, ex.toString());
}
@@ -176,25 +147,26 @@ public class Server extends ListArrayTreeNode
{
if(_showIceLogDialog == null)
{
- Ice.ObjectPrx serverAdmin = getServerAdmin();
+ com.zeroc.Ice.ObjectPrx serverAdmin = getServerAdmin();
if(serverAdmin == null)
{
- JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Admin not available",
+ JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Admin not available",
"No Admin for server " + _id, JOptionPane.ERROR_MESSAGE);
return;
}
-
- Ice.LoggerAdminPrx loggerAdmin = Ice.LoggerAdminPrxHelper.uncheckedCast(serverAdmin.ice_facet("Logger"));
+
+ com.zeroc.Ice.LoggerAdminPrx loggerAdmin =
+ com.zeroc.Ice.LoggerAdminPrx.uncheckedCast(serverAdmin.ice_facet("Logger"));
String title = "Server " + _id + " Ice log";
_showIceLogDialog = new ShowIceLogDialog(this, title, loggerAdmin, _id, getRoot().getLogMaxLines(),
- getRoot().getLogInitialLines());
- }
+ getRoot().getLogInitialLines());
+ }
else
{
_showIceLogDialog.toFront();
}
}
-
+
@Override
public void retrieveOutput(final boolean stdout)
{
@@ -252,7 +224,7 @@ public class Server extends ListArrayTreeNode
pathArray[i++] = _resolver.substitute(log);
}
- path = (String)JOptionPane.showInputDialog(
+ path = (String)JOptionPane.showInputDialog(
getCoordinator().getMainFrame(),
"Which log file do you want to retrieve?",
"Retrieve Log File",
@@ -299,29 +271,12 @@ public class Server extends ListArrayTreeNode
try
{
final AdminPrx admin = getCoordinator().getAdmin();
- admin.begin_sendSignal(_id, s,
- new Ice.Callback()
- {
- @Override
- public void completed(final Ice.AsyncResult r)
- {
- try
- {
- admin.end_sendSignal(r);
- amiSuccess(prefix);
- }
- catch(Ice.UserException ex)
- {
- amiFailure(prefix, errorTitle, ex);
- }
- catch(Ice.LocalException ex)
- {
- amiFailure(prefix, errorTitle, ex.toString());
- }
- }
- });
+ admin.sendSignalAsync(_id, s).whenComplete((result, ex) ->
+ {
+ amiComplete(prefix, errorTitle, ex);
+ });
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
failure(prefix, errorTitle, ex.toString());
}
@@ -355,29 +310,12 @@ public class Server extends ListArrayTreeNode
try
{
final AdminPrx admin = getCoordinator().getAdmin();
- admin.begin_patchServer(_id, shutdown == JOptionPane.YES_OPTION,
- new Ice.Callback()
+ admin.patchServerAsync(_id, shutdown == JOptionPane.YES_OPTION).whenComplete((result, ex) ->
{
- @Override
- public void completed(final Ice.AsyncResult r)
- {
- try
- {
- admin.end_patchServer(r);
- amiSuccess(prefix);
- }
- catch(Ice.UserException ex)
- {
- amiFailure(prefix, errorTitle, ex);
- }
- catch(Ice.LocalException ex)
- {
- amiFailure(prefix, errorTitle, ex.toString());
- }
- }
+ amiComplete(prefix, errorTitle, ex);
});
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
failure(prefix, errorTitle, ex.toString());
}
@@ -391,29 +329,12 @@ public class Server extends ListArrayTreeNode
try
{
final AdminPrx admin = getCoordinator().getAdmin();
- admin.begin_enableServer(_id, enable,
- new Ice.Callback()
+ admin.enableServerAsync(_id, enable).whenComplete((result, ex) ->
{
- @Override
- public void completed(final Ice.AsyncResult r)
- {
- try
- {
- admin.end_enableServer(r);
- amiSuccess(prefix);
- }
- catch(Ice.UserException ex)
- {
- amiFailure(prefix, errorTitle, ex);
- }
- catch(Ice.LocalException ex)
- {
- amiFailure(prefix, errorTitle, ex.toString());
- }
- }
+ amiComplete(prefix, errorTitle, ex);
});
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
failure(prefix, errorTitle, ex.toString());
}
@@ -426,70 +347,60 @@ public class Server extends ListArrayTreeNode
return; // Already loaded.
}
- Ice.ObjectPrx admin = getServerAdmin();
+ com.zeroc.Ice.ObjectPrx admin = getServerAdmin();
if(admin == null)
{
return;
}
_metricsRetrieved = true;
- final IceMX.MetricsAdminPrx metricsAdmin =
- IceMX.MetricsAdminPrxHelper.uncheckedCast(admin.ice_facet("Metrics"));
- IceMX.Callback_MetricsAdmin_getMetricsViewNames cb = new IceMX.Callback_MetricsAdmin_getMetricsViewNames()
- {
- @Override
- public void response(final String[] enabledViews, final String[] disabledViews)
+ final com.zeroc.IceMX.MetricsAdminPrx metricsAdmin =
+ com.zeroc.IceMX.MetricsAdminPrx.uncheckedCast(admin.ice_facet("Metrics"));
+ try
+ {
+ metricsAdmin.getMetricsViewNamesAsync().whenComplete((result, ex) ->
{
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
+ if(ex == null)
+ {
+ SwingUtilities.invokeLater(() ->
{
- for(String name : enabledViews)
+ for(String name : result.returnValue)
{
- insertSortedChild(new MetricsView(Server.this, name, metricsAdmin, true), _metrics, null);
+ insertSortedChild(
+ new MetricsView(Server.this, name, metricsAdmin, true), _metrics, null);
}
- for(String name : disabledViews)
+ for(String name : result.disabledViews)
{
- insertSortedChild(new MetricsView(Server.this, name, metricsAdmin, false), _metrics, null);
+ insertSortedChild(
+ new MetricsView(Server.this, name, metricsAdmin, false), _metrics, null);
}
rebuild(Server.this, false);
- }
- });
- }
-
- @Override
- public void exception(final Ice.LocalException e)
- {
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
+ });
+ }
+ else
+ {
+ SwingUtilities.invokeLater(() ->
{
_metricsRetrieved = false;
- if(e instanceof Ice.ObjectNotExistException)
+ if(ex instanceof com.zeroc.Ice.ObjectNotExistException)
{
// Server is down.
}
- else if(e instanceof Ice.FacetNotExistException)
+ else if(ex instanceof com.zeroc.Ice.FacetNotExistException)
{
// MetricsAdmin facet not present. Old server version?
}
else
{
- e.printStackTrace();
- JOptionPane.showMessageDialog(getCoordinator().getMainFrame(),
- "Error: " + e.toString(), "Error",
+ ex.printStackTrace();
+ JOptionPane.showMessageDialog(getCoordinator().getMainFrame(),
+ "Error: " + ex.toString(), "Error",
JOptionPane.ERROR_MESSAGE);
}
- }
- });
- }
- };
- try
- {
- metricsAdmin.begin_getMetricsViewNames(cb);
+ });
+ }
+ });
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
_metricsRetrieved = false;
JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Error: " + e.toString(), "Error",
@@ -499,7 +410,7 @@ public class Server extends ListArrayTreeNode
void showRuntimeProperties()
{
- Ice.ObjectPrx serverAdmin = getServerAdmin();
+ com.zeroc.Ice.ObjectPrx serverAdmin = getServerAdmin();
if(serverAdmin == null)
{
@@ -507,58 +418,44 @@ public class Server extends ListArrayTreeNode
}
else
{
- Ice.Callback_PropertiesAdmin_getPropertiesForPrefix cb = new Ice.Callback_PropertiesAdmin_getPropertiesForPrefix()
- {
- @Override
- public void response(final java.util.Map<String, String> properties)
+ try
+ {
+ com.zeroc.Ice.PropertiesAdminPrx propAdmin =
+ com.zeroc.Ice.PropertiesAdminPrx.uncheckedCast(serverAdmin.ice_facet("Properties"));
+ propAdmin.getPropertiesForPrefixAsync("").whenComplete((result, ex) ->
{
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
+ if(ex == null)
+ {
+ SwingUtilities.invokeLater(() ->
{
- _editor.setRuntimeProperties((java.util.SortedMap<String, String>)properties,
+ _editor.setRuntimeProperties((java.util.SortedMap<String, String>)result,
Server.this);
- }
- });
- }
-
- @Override
- public void exception(final Ice.LocalException e)
- {
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
+ });
+ }
+ else
+ {
+ SwingUtilities.invokeLater(() ->
{
- if(e instanceof Ice.ObjectNotExistException)
+ if(ex instanceof com.zeroc.Ice.ObjectNotExistException)
{
_editor.setBuildId("Error: can't reach this server's Admin object",
Server.this);
}
- else if(e instanceof Ice.FacetNotExistException)
+ else if(ex instanceof com.zeroc.Ice.FacetNotExistException)
{
_editor.setBuildId("Error: this server's Admin object does not provide a " +
"'Properties' facet", Server.this);
}
else
{
- e.printStackTrace();
- _editor.setBuildId("Error: " + e.toString(), Server.this);
+ ex.printStackTrace();
+ _editor.setBuildId("Error: " + ex.toString(), Server.this);
}
- }
- });
- }
- };
-
-
- try
- {
- Ice.PropertiesAdminPrx propAdmin =
- Ice.PropertiesAdminPrxHelper.uncheckedCast(serverAdmin.ice_facet("Properties"));
- propAdmin.begin_getPropertiesForPrefix("", cb);
+ });
+ }
+ });
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
_editor.setBuildId("Error: " + e.toString(), this);
}
@@ -665,7 +562,7 @@ public class Server extends ListArrayTreeNode
// IceBox servers
//
_icons[0][1][0] = Utils.getIcon("/icons/16x16/icebox_server_unknown.png");
- _icons[ServerState.Inactive.value() + 1][1][0] =
+ _icons[ServerState.Inactive.value() + 1][1][0] =
Utils.getIcon("/icons/16x16/icebox_server_inactive.png");
_icons[ServerState.Activating.value() + 1][1][0] =
Utils.getIcon("/icons/16x16/icebox_server_activating.png");
@@ -738,7 +635,7 @@ public class Server extends ListArrayTreeNode
{
_showIceLogDialog = null;
}
-
+
Server(Node parent, String serverId, Utils.Resolver resolver, ServerInstanceDescriptor instanceDescriptor,
ServerDescriptor serverDescriptor, ApplicationDescriptor application, ServerState state, int pid,
boolean enabled)
@@ -876,7 +773,7 @@ public class Server extends ListArrayTreeNode
}
updateServices();
-
+
getRoot().getTreeModel().nodeStructureChanged(this);
if(fetchMetrics)
@@ -952,7 +849,7 @@ public class Server extends ListArrayTreeNode
{
_stateIconIndex = _state.value() + 1;
}
-
+
if(_state == ServerState.Active && getRoot().getTree().isExpanded(getPath()))
{
fetchMetricsViewNames();
@@ -966,7 +863,7 @@ public class Server extends ListArrayTreeNode
rebuild(this, false);
}
}
-
+
if(_state == ServerState.Inactive)
{
if(_showIceLogDialog != null)
@@ -981,64 +878,56 @@ public class Server extends ListArrayTreeNode
{
if(_serviceObserver == null)
{
- _serviceObserver = IceBox.ServiceObserverPrxHelper.uncheckedCast(
+ _serviceObserver = com.zeroc.IceBox.ServiceObserverPrx.uncheckedCast(
getCoordinator().retrieveCallback(_id, "IceBox.ServiceManager"));
if(_serviceObserver == null)
{
- IceBox.ServiceObserver servant = new IceBox._ServiceObserverDisp()
+ com.zeroc.IceBox.ServiceObserver servant = new com.zeroc.IceBox.ServiceObserver()
{
@Override
- public void servicesStarted(final String[] services, Ice.Current current)
+ public void servicesStarted(final String[] services, com.zeroc.Ice.Current current)
{
final java.util.Set<String> serviceSet =
- new java.util.HashSet<String>(java.util.Arrays.asList(services));
+ new java.util.HashSet<>(java.util.Arrays.asList(services));
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
+ for(Service service: _services)
{
- for(Service service: _services)
+ if(serviceSet.contains(service.getId()))
{
- if(serviceSet.contains(service.getId()))
- {
- service.started();
- }
+ service.started();
}
- _startedServices.addAll(serviceSet);
- getCoordinator().getLiveDeploymentPane().refresh();
}
+ _startedServices.addAll(serviceSet);
+ getCoordinator().getLiveDeploymentPane().refresh();
});
}
@Override
- public void servicesStopped(final String[] services, Ice.Current current)
+ public void servicesStopped(final String[] services, com.zeroc.Ice.Current current)
{
final java.util.Set<String> serviceSet =
- new java.util.HashSet<String>(java.util.Arrays.asList(services));
+ new java.util.HashSet<>(java.util.Arrays.asList(services));
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
+ for(Service service: _services)
{
- for(Service service: _services)
+ if(serviceSet.contains(service.getId()))
{
- if(serviceSet.contains(service.getId()))
- {
- service.stopped();
- }
+ service.stopped();
}
- _startedServices.removeAll(serviceSet);
- getCoordinator().getLiveDeploymentPane().refresh();
}
+ _startedServices.removeAll(serviceSet);
+ getCoordinator().getLiveDeploymentPane().refresh();
});
}
};
- _serviceObserver = IceBox.ServiceObserverPrxHelper.uncheckedCast(
+ _serviceObserver = com.zeroc.IceBox.ServiceObserverPrx.uncheckedCast(
getCoordinator().addCallback(servant, _id, "IceBox.ServiceManager"));
if(_serviceObserver == null)
@@ -1059,37 +948,28 @@ public class Server extends ListArrayTreeNode
// Note that duplicate registrations are ignored
//
- IceBox.Callback_ServiceManager_addObserver cb = new IceBox.Callback_ServiceManager_addObserver()
- {
- @Override
- public void response()
- {
- // all is good
- }
-
- @Override
- public void exception(Ice.LocalException e)
- {
- JOptionPane.showMessageDialog(
- getCoordinator().getMainFrame(),
- "Failed to register service-manager observer: " + e.toString(),
- "Observer registration error",
- JOptionPane.ERROR_MESSAGE);
- }
- };
-
- Ice.ObjectPrx serverAdmin = getServerAdmin();
+ com.zeroc.Ice.ObjectPrx serverAdmin = getServerAdmin();
if(serverAdmin != null)
{
- IceBox.ServiceManagerPrx serviceManager =
- IceBox.ServiceManagerPrxHelper.uncheckedCast(
+ com.zeroc.IceBox.ServiceManagerPrx serviceManager =
+ com.zeroc.IceBox.ServiceManagerPrx.uncheckedCast(
serverAdmin.ice_facet("IceBox.ServiceManager"));
try
{
- serviceManager.begin_addObserver(_serviceObserver, cb);
+ serviceManager.addObserverAsync(_serviceObserver).whenComplete((result, ex) ->
+ {
+ if(ex != null)
+ {
+ JOptionPane.showMessageDialog(
+ getCoordinator().getMainFrame(),
+ "Failed to register service-manager observer: " + ex.toString(),
+ "Observer registration error",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ });
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
JOptionPane.showMessageDialog(
getCoordinator().getMainFrame(),
@@ -1109,7 +989,7 @@ public class Server extends ListArrayTreeNode
}
}
}
-
+
if(fireEvent)
{
getRoot().getTreeModel().nodeChanged(this);
@@ -1188,7 +1068,7 @@ public class Server extends ListArrayTreeNode
java.util.SortedMap<String, String> getProperties()
{
- java.util.List<Utils.ExpandedPropertySet> psList = new java.util.LinkedList<Utils.ExpandedPropertySet>();
+ java.util.List<Utils.ExpandedPropertySet> psList = new java.util.LinkedList<>();
Node node = (Node)_parent;
psList.add(node.expand(_serverDescriptor.propertySet, _application.name, _resolver));
@@ -1212,7 +1092,7 @@ public class Server extends ListArrayTreeNode
{
String adapterName = Utils.substitute(p.name, _resolver);
String adapterId = Utils.substitute(p.id, _resolver);
- Ice.ObjectPrx proxy = null;
+ com.zeroc.Ice.ObjectPrx proxy = null;
if(adapterId.length() > 0)
{
proxy = ((Node)_parent).getProxy(adapterId);
@@ -1290,7 +1170,7 @@ public class Server extends ListArrayTreeNode
serverInstancePSDescriptor));
}
- Ice.ObjectPrx getServerAdmin()
+ com.zeroc.Ice.ObjectPrx getServerAdmin()
{
if(_state != ServerState.Active)
{
@@ -1303,7 +1183,7 @@ public class Server extends ListArrayTreeNode
}
else
{
- Ice.Identity adminId = new Ice.Identity(_id, getCoordinator().getServerAdminCategory());
+ com.zeroc.Ice.Identity adminId = new com.zeroc.Ice.Identity(_id, getCoordinator().getServerAdminCategory());
return admin.ice_identity(adminId);
}
}
@@ -1327,23 +1207,23 @@ public class Server extends ListArrayTreeNode
public java.util.List<MetricsView>
getMetrics()
{
- return new java.util.ArrayList<MetricsView>(_metrics);
+ return new java.util.ArrayList<>(_metrics);
}
private ServerInstanceDescriptor _instanceDescriptor;
private java.util.Map<String, PropertySetDescriptor> _servicePropertySets =
- new java.util.HashMap<String, PropertySetDescriptor>(); // with substituted names!
+ new java.util.HashMap<>(); // with substituted names!
private ServerDescriptor _serverDescriptor;
private ApplicationDescriptor _application;
private Utils.Resolver _resolver;
- private java.util.List<Adapter> _adapters = new java.util.LinkedList<Adapter>();
- private java.util.List<DbEnv> _dbEnvs = new java.util.LinkedList<DbEnv>();
- private java.util.List<Service> _services = new java.util.LinkedList<Service>();
- private java.util.List<MetricsView> _metrics = new java.util.LinkedList<MetricsView>();
+ private java.util.List<Adapter> _adapters = new java.util.LinkedList<>();
+ private java.util.List<DbEnv> _dbEnvs = new java.util.LinkedList<>();
+ private java.util.List<Service> _services = new java.util.LinkedList<>();
+ private java.util.List<MetricsView> _metrics = new java.util.LinkedList<>();
- private java.util.Set<String> _startedServices = new java.util.HashSet<String>();
+ private java.util.Set<String> _startedServices = new java.util.HashSet<>();
private ServerState _state;
private boolean _enabled;
@@ -1352,7 +1232,7 @@ public class Server extends ListArrayTreeNode
private String _toolTip;
private boolean _metricsRetrieved = false;
- private IceBox.ServiceObserverPrx _serviceObserver;
+ private com.zeroc.IceBox.ServiceObserverPrx _serviceObserver;
private ShowIceLogDialog _showIceLogDialog;
static private DefaultTreeCellRenderer _cellRenderer;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ServerEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ServerEditor.java
index 43f6e759228..85f15377ab4 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ServerEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ServerEditor.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import java.awt.event.ActionEvent;
@@ -28,8 +28,8 @@ import com.jgoodies.looks.HeaderStyle;
import com.jgoodies.looks.BorderStyle;
import com.jgoodies.looks.plastic.PlasticLookAndFeel;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class ServerEditor extends CommunicatorEditor
{
@@ -165,7 +165,6 @@ class ServerEditor extends CommunicatorEditor
_iceVersion.setText(resolver.substitute(descriptor.iceVersion));
_pwd.setText(resolver.substitute(descriptor.pwd));
- Ice.StringHolder toolTipHolder = new Ice.StringHolder();
Utils.Stringifier stringifier = new Utils.Stringifier()
{
@Override
@@ -175,8 +174,9 @@ class ServerEditor extends CommunicatorEditor
}
};
- _options.setText(Utils.stringify(descriptor.options, stringifier, " ", toolTipHolder));
- _options.setToolTipText(toolTipHolder.value);
+ Utils.StringifyResult r = Utils.stringify(descriptor.options, stringifier, " ");
+ _options.setText(r.returnValue);
+ _options.setToolTipText(r.toolTip);
_envs.setEnvs(descriptor.envs, resolver);
@@ -191,17 +191,14 @@ class ServerEditor extends CommunicatorEditor
_applicationDistrib.setSelected(descriptor.applicationDistrib);
_icepatch.setText(resolver.substitute(resolver.substitute(descriptor.distrib.icepatch)));
- toolTipHolder = new Ice.StringHolder();
-
- _directories.setText(
- Utils.stringify(descriptor.distrib.directories, stringifier, ", ",
- toolTipHolder));
+ r = Utils.stringify(descriptor.distrib.directories, stringifier, ", ");
+ _directories.setText(r.returnValue);
String toolTip = "<html>Include only these directories";
- if(toolTipHolder.value != null)
+ if(r.toolTip != null)
{
- toolTip += ":<br>" + toolTipHolder.value;
+ toolTip += ":<br>" + r.toolTip;
}
toolTip += "</html>";
_directories.setToolTipText(toolTip);
@@ -406,4 +403,3 @@ class ServerEditor extends CommunicatorEditor
private JToolBar _toolBar;
}
-
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Service.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Service.java
index 0e9c108595f..64451a9a5be 100755
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Service.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Service.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import java.awt.Component;
@@ -18,8 +18,8 @@ import javax.swing.JTree;
import javax.swing.SwingUtilities;
import javax.swing.tree.DefaultTreeCellRenderer;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
public class Service extends ListArrayTreeNode
{
@@ -29,7 +29,7 @@ public class Service extends ListArrayTreeNode
@Override
public boolean[] getAvailableActions()
{
- boolean[] actions = new boolean[IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT];
+ boolean[] actions = new boolean[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT];
ServerState serverState = ((Server)_parent).getState();
@@ -58,52 +58,31 @@ public class Service extends ListArrayTreeNode
@Override
public void start()
{
- Ice.ObjectPrx serverAdmin = ((Server)_parent).getServerAdmin();
+ com.zeroc.Ice.ObjectPrx serverAdmin = ((Server)_parent).getServerAdmin();
if(serverAdmin != null)
{
final String prefix = "Starting service '" + _id + "'...";
getCoordinator().getStatusBar().setText(prefix);
- IceBox.Callback_ServiceManager_startService cb = new IceBox.Callback_ServiceManager_startService()
- {
- //
- // Called by another thread!
- //
- @Override
- public void response()
- {
- amiSuccess(prefix);
- }
-
- @Override
- public void exception(Ice.UserException e)
- {
- if(e instanceof IceBox.AlreadyStartedException)
- {
- amiSuccess(prefix);
- }
- else
- {
- amiFailure(prefix, "Failed to start service " + _id, e.toString());
- }
- }
-
- @Override
- public void exception(Ice.LocalException e)
- {
- amiFailure(prefix, "Failed to start service " + _id, e.toString());
- }
- };
-
- IceBox.ServiceManagerPrx serviceManager = IceBox.ServiceManagerPrxHelper.
- uncheckedCast(serverAdmin.ice_facet("IceBox.ServiceManager"));
+ com.zeroc.IceBox.ServiceManagerPrx serviceManager = com.zeroc.IceBox.ServiceManagerPrx.uncheckedCast(
+ serverAdmin.ice_facet("IceBox.ServiceManager"));
try
{
- serviceManager.begin_startService(_id, cb);
+ serviceManager.startServiceAsync(_id).whenComplete((result, ex) ->
+ {
+ if(ex == null || ex instanceof com.zeroc.IceBox.AlreadyStartedException)
+ {
+ amiSuccess(prefix);
+ }
+ else
+ {
+ amiFailure(prefix, "Failed to start service " + _id, ex.toString());
+ }
+ });
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
failure(prefix, "Failed to start service " + _id, e.toString());
}
@@ -113,52 +92,31 @@ public class Service extends ListArrayTreeNode
@Override
public void stop()
{
- Ice.ObjectPrx serverAdmin = ((Server)_parent).getServerAdmin();
+ com.zeroc.Ice.ObjectPrx serverAdmin = ((Server)_parent).getServerAdmin();
if(serverAdmin != null)
{
final String prefix = "Stopping service '" + _id + "'...";
getCoordinator().getStatusBar().setText(prefix);
- IceBox.Callback_ServiceManager_stopService cb = new IceBox.Callback_ServiceManager_stopService()
- {
- //
- // Called by another thread!
- //
- @Override
- public void response()
- {
- amiSuccess(prefix);
- }
-
- @Override
- public void exception(Ice.UserException e)
- {
- if(e instanceof IceBox.AlreadyStoppedException)
- {
- amiSuccess(prefix);
- }
- else
- {
- amiFailure(prefix, "Failed to stop service " + _id, e.toString());
- }
- }
-
- @Override
- public void exception(Ice.LocalException e)
- {
- amiFailure(prefix, "Failed to stop service " + _id, e.toString());
- }
- };
-
- IceBox.ServiceManagerPrx serviceManager = IceBox.ServiceManagerPrxHelper.
- uncheckedCast(serverAdmin.ice_facet("IceBox.ServiceManager"));
+ com.zeroc.IceBox.ServiceManagerPrx serviceManager = com.zeroc.IceBox.ServiceManagerPrx.uncheckedCast(
+ serverAdmin.ice_facet("IceBox.ServiceManager"));
try
{
- serviceManager.begin_stopService(_id, cb);
+ serviceManager.stopServiceAsync(_id).whenComplete((result, ex) ->
+ {
+ if(ex == null || ex instanceof com.zeroc.IceBox.AlreadyStoppedException)
+ {
+ amiSuccess(prefix);
+ }
+ else
+ {
+ amiFailure(prefix, "Failed to stop service " + _id, ex.toString());
+ }
+ });
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
failure(prefix, "Failed to stop service " + _id, e.toString());
}
@@ -170,7 +128,8 @@ public class Service extends ListArrayTreeNode
{
if(_showIceLogDialog == null)
{
- Ice.LoggerAdminPrx loggerAdmin = Ice.LoggerAdminPrxHelper.uncheckedCast(getAdminFacet("Logger"));
+ com.zeroc.Ice.LoggerAdminPrx loggerAdmin =
+ com.zeroc.Ice.LoggerAdminPrx.uncheckedCast(getAdminFacet("Logger"));
if(loggerAdmin == null)
{
JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Admin not available",
@@ -314,7 +273,6 @@ public class Service extends ListArrayTreeNode
_showIceLogDialog = null;
}
-
Service(Server parent, String serviceName, Utils.Resolver resolver, ServiceInstanceDescriptor descriptor,
ServiceDescriptor serviceDescriptor, PropertySetDescriptor serverInstancePSDescriptor)
{
@@ -411,60 +369,48 @@ public class Service extends ListArrayTreeNode
void showRuntimeProperties()
{
- Ice.PropertiesAdminPrx propAdmin = Ice.PropertiesAdminPrxHelper.uncheckedCast(getAdminFacet("Properties"));
+ com.zeroc.Ice.PropertiesAdminPrx propAdmin =
+ com.zeroc.Ice.PropertiesAdminPrx.uncheckedCast(getAdminFacet("Properties"));
if(propAdmin == null)
{
_editor.setBuildId("", this);
}
else
{
- Ice.Callback_PropertiesAdmin_getPropertiesForPrefix cb = new Ice.Callback_PropertiesAdmin_getPropertiesForPrefix()
- {
- @Override
- public void response(final java.util.Map<String, String> properties)
+ try
+ {
+ propAdmin.getPropertiesForPrefixAsync("").whenComplete((result, ex) ->
{
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
+ if(ex == null)
+ {
+ SwingUtilities.invokeLater(() ->
{
- _editor.setRuntimeProperties((java.util.SortedMap<String, String>)properties,
+ _editor.setRuntimeProperties((java.util.SortedMap<String, String>)result,
Service.this);
- }
- });
- }
-
- @Override
- public void exception(final Ice.LocalException e)
- {
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
+ });
+ }
+ else
+ {
+ SwingUtilities.invokeLater(() ->
{
- if(e instanceof Ice.ObjectNotExistException)
+ if(ex instanceof com.zeroc.Ice.ObjectNotExistException)
{
_editor.setBuildId("Error: can't reach the icebox Admin object", Service.this);
}
- else if(e instanceof Ice.FacetNotExistException)
+ else if(ex instanceof com.zeroc.Ice.FacetNotExistException)
{
_editor.setBuildId("Error: this icebox Admin object does not provide a " +
"'Properties' facet for this service", Service.this);
}
else
{
- _editor.setBuildId("Error: " + e.toString(), Service.this);
+ _editor.setBuildId("Error: " + ex.toString(), Service.this);
}
- }
- });
- }
- };
-
- try
- {
- propAdmin.begin_getPropertiesForPrefix("", cb);
+ });
+ }
+ });
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
_editor.setBuildId("Error: " + e.toString(), this);
}
@@ -488,7 +434,7 @@ public class Service extends ListArrayTreeNode
java.util.SortedMap<String, String> getProperties()
{
- java.util.List<Utils.ExpandedPropertySet> psList = new java.util.LinkedList<Utils.ExpandedPropertySet>();
+ java.util.List<Utils.ExpandedPropertySet> psList = new java.util.LinkedList<>();
Node node = (Node)_parent.getParent();
String applicationName = ((Server)_parent).getApplication().name;
@@ -516,7 +462,7 @@ public class Service extends ListArrayTreeNode
String adapterName = Utils.substitute(p.name, _resolver);
String adapterId = Utils.substitute(p.id, _resolver);
- Ice.ObjectPrx proxy = null;
+ com.zeroc.Ice.ObjectPrx proxy = null;
if(adapterId.length() > 0)
{
proxy = ((Node)_parent.getParent()).getProxy(adapterId);
@@ -542,69 +488,57 @@ public class Service extends ListArrayTreeNode
return; // Already loaded.
}
- final IceMX.MetricsAdminPrx metricsAdmin = IceMX.MetricsAdminPrxHelper.uncheckedCast(getAdminFacet("Metrics"));
+ final com.zeroc.IceMX.MetricsAdminPrx metricsAdmin =
+ com.zeroc.IceMX.MetricsAdminPrx.uncheckedCast(getAdminFacet("Metrics"));
if(metricsAdmin == null)
{
return;
}
_metricsRetrieved = true;
- IceMX.Callback_MetricsAdmin_getMetricsViewNames cb = new IceMX.Callback_MetricsAdmin_getMetricsViewNames()
- {
- @Override
- public void response(final String[] enabledViews, final String[] disabledViews)
+ try
+ {
+ metricsAdmin.getMetricsViewNamesAsync().whenComplete((result, ex) ->
{
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
+ if(ex == null)
+ {
+ SwingUtilities.invokeLater(() ->
{
- for(String name : enabledViews)
+ for(String name : result.returnValue)
{
- insertSortedChild(new MetricsView(Service.this, name, metricsAdmin, true), _metrics, null);
+ insertSortedChild(
+ new MetricsView(Service.this, name, metricsAdmin, true), _metrics, null);
}
- for(String name : disabledViews)
+ for(String name : result.disabledViews)
{
- insertSortedChild(new MetricsView(Service.this, name, metricsAdmin, false), _metrics, null);
+ insertSortedChild(
+ new MetricsView(Service.this, name, metricsAdmin, false), _metrics, null);
}
rebuild(Service.this);
- }
- });
- }
-
- @Override
- public void exception(final Ice.LocalException e)
- {
- SwingUtilities.invokeLater(new Runnable()
+ });
+ }
+ else
+ {
+ _metricsRetrieved = false;
+ if(ex instanceof com.zeroc.Ice.ObjectNotExistException)
{
- @Override
- public void run()
- {
- _metricsRetrieved = false;
- if(e instanceof Ice.ObjectNotExistException)
- {
- // Server is down.
- }
- else if(e instanceof Ice.FacetNotExistException)
- {
- // MetricsAdmin facet not present. Old server version?
- }
- else
- {
- e.printStackTrace();
- JOptionPane.showMessageDialog(getCoordinator().getMainFrame(),
- "Error: " + e.toString(), "Error",
- JOptionPane.ERROR_MESSAGE);
- }
- }
- });
- }
- };
- try
- {
- metricsAdmin.begin_getMetricsViewNames(cb);
+ // Server is down.
+ }
+ else if(ex instanceof com.zeroc.Ice.FacetNotExistException)
+ {
+ // MetricsAdmin facet not present. Old server version?
+ }
+ else
+ {
+ ex.printStackTrace();
+ JOptionPane.showMessageDialog(getCoordinator().getMainFrame(),
+ "Error: " + ex.toString(), "Error",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
+ });
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
_metricsRetrieved = false;
JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Error: " + e.toString(), "Error",
@@ -642,10 +576,10 @@ public class Service extends ListArrayTreeNode
getRoot().getTreeModel().nodeStructureChanged(this);
}
- private Ice.ObjectPrx getAdminFacet(String facet)
+ private com.zeroc.Ice.ObjectPrx getAdminFacet(String facet)
{
Server parent = (Server)_parent;
- Ice.ObjectPrx serverAdmin = parent.getServerAdmin();
+ com.zeroc.Ice.ObjectPrx serverAdmin = parent.getServerAdmin();
if(serverAdmin == null)
{
return null;
@@ -668,9 +602,9 @@ public class Service extends ListArrayTreeNode
private final PropertySetDescriptor _serverInstancePSDescriptor;
private final Utils.Resolver _resolver;
- private java.util.List<Adapter> _adapters = new java.util.LinkedList<Adapter>();
- private java.util.List<DbEnv> _dbEnvs = new java.util.LinkedList<DbEnv>();
- private java.util.List<MetricsView> _metrics = new java.util.LinkedList<MetricsView>();
+ private java.util.List<Adapter> _adapters = new java.util.LinkedList<>();
+ private java.util.List<DbEnv> _dbEnvs = new java.util.LinkedList<>();
+ private java.util.List<MetricsView> _metrics = new java.util.LinkedList<>();
private boolean _started = false;
private boolean _metricsRetrieved = false;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ServiceEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ServiceEditor.java
index a34b6ee04af..477b9f78ed7 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ServiceEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ServiceEditor.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import java.awt.event.ActionEvent;
@@ -27,8 +27,8 @@ import com.jgoodies.looks.HeaderStyle;
import com.jgoodies.looks.BorderStyle;
import com.jgoodies.looks.plastic.PlasticLookAndFeel;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class ServiceEditor extends CommunicatorEditor
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ShowIceLogDialog.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ShowIceLogDialog.java
index e34965c40ce..f99cc2144a0 100755
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ShowIceLogDialog.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ShowIceLogDialog.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import java.awt.BorderLayout;
import java.awt.Color;
@@ -39,13 +39,13 @@ import com.jgoodies.looks.HeaderStyle;
import com.jgoodies.looks.Options;
import com.jgoodies.looks.plastic.PlasticLookAndFeel;
-import Ice.Current;
-import Ice.LocalException;
-import Ice.LogMessage;
-import Ice.LogMessageType;
-import Ice.RemoteLoggerPrxHelper;
-import Ice.UserException;
-import IceGridGUI.*;
+import com.zeroc.Ice.Current;
+import com.zeroc.Ice.LocalException;
+import com.zeroc.Ice.LogMessage;
+import com.zeroc.Ice.LogMessageType;
+import com.zeroc.Ice.RemoteLoggerPrx;
+import com.zeroc.Ice.UserException;
+import com.zeroc.IceGridGUI.*;
class ShowIceLogDialog extends JDialog
{
@@ -85,7 +85,8 @@ class ShowIceLogDialog extends JDialog
{
JFileChooser fileChooser = _parent.getRoot().getCoordinator().getSaveIceLogChooser();
- fileChooser.setSelectedFile(new java.io.File(fileChooser.getCurrentDirectory(), _defaultFileName + ".csv"));
+ fileChooser.setSelectedFile(
+ new java.io.File(fileChooser.getCurrentDirectory(), _defaultFileName + ".csv"));
java.io.File file = null;
@@ -108,7 +109,7 @@ class ShowIceLogDialog extends JDialog
try
{
os = new java.io.OutputStreamWriter(new java.io.FileOutputStream(file));
-
+
for(Object p : _tableModel.getDataVector())
{
@SuppressWarnings("unchecked")
@@ -117,7 +118,7 @@ class ShowIceLogDialog extends JDialog
renderLogMessageType((LogMessageType) row.elementAt(1)) + ",\"" +
row.elementAt(2).toString().replace("\"", "\"\"") + "\",\"" +
row.elementAt(3).toString().replace("\"", "\"\"") + "\"";
-
+
txt += "\r\n";
os.write(txt, 0, txt.length());
}
@@ -178,15 +179,15 @@ class ShowIceLogDialog extends JDialog
for(int i : _table.getSelectedRows())
{
int j = _table.convertRowIndexToModel(i);
-
+
txt += renderDate((java.util.Date)_tableModel.getValueAt(j, 0)) + "\t" +
renderLogMessageType((LogMessageType)_tableModel.getValueAt(j, 1)) + "\t" +
_tableModel.getValueAt(j, 2).toString() + "\t" +
renderMessage(_tableModel.getValueAt(j, 3).toString()) + "\n";
}
-
+
java.awt.datatransfer.StringSelection ss = new java.awt.datatransfer.StringSelection(txt);
-
+
java.awt.Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
}
@@ -194,7 +195,7 @@ class ShowIceLogDialog extends JDialog
copy.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_C, MENU_MASK));
copy.putValue(Action.SHORT_DESCRIPTION, "Copy");
_table.getActionMap().put("copy", copy);
-
+
editMenu.add(copy);
editMenu.addSeparator();
@@ -260,26 +261,27 @@ class ShowIceLogDialog extends JDialog
bg.add(_stopButton);
}
}
-
- private class RemoteLoggerI extends Ice._RemoteLoggerDisp
+
+ private class RemoteLoggerI implements com.zeroc.Ice.RemoteLogger
{
@Override
public synchronized void init(String prefix, LogMessage[] logMessages, Current current)
- {
+ {
// Ignore prefix
-
+
if(!_destroyed)
- {
- _rowCount = logMessages.length + _queue.size() < _maxRows ? logMessages.length + _queue.size() : _maxRows;
+ {
+ _rowCount = logMessages.length +
+ _queue.size() < _maxRows ? logMessages.length + _queue.size() : _maxRows;
final Object[][] data = new Object[_rowCount][];
-
+
int i = _rowCount - 1;
-
+
for(java.util.Iterator<LogMessage> p = _queue.descendingIterator(); p.hasNext() && i >= 0; i--)
{
data[i] = logMessageToRow(p.next());
}
-
+
int j = logMessages.length - 1;
while(i >= 0 && j >= 0)
{
@@ -287,23 +289,18 @@ class ShowIceLogDialog extends JDialog
i--;
j--;
}
-
+
_queue.clear();
_paused = false;
-
- SwingUtilities.invokeLater(
- new Runnable()
- {
- @Override
- public void run()
- {
- _tableModel.setDataVector(data, _columnNames);
- _table.scrollRectToVisible(_table.getCellRect(_table.getRowCount() - 1, 0, true));
- _pause.setEnabled(true);
- }
- });
+
+ SwingUtilities.invokeLater(() ->
+ {
+ _tableModel.setDataVector(data, _columnNames);
+ _table.scrollRectToVisible(_table.getCellRect(_table.getRowCount() - 1, 0, true));
+ _pause.setEnabled(true);
+ });
}
-
+
}
@Override
@@ -327,40 +324,34 @@ class ShowIceLogDialog extends JDialog
showLogMessage(message);
}
}
-
+
private synchronized void setMaxRows(int maxRows)
{
_maxRows = maxRows;
-
+
final int rowsToRemove = _rowCount - _maxRows;
-
+
if(rowsToRemove > 0)
{
_rowCount -= rowsToRemove;
-
- SwingUtilities.invokeLater(
- new Runnable()
+
+ SwingUtilities.invokeLater(() ->
+ {
+ int i = rowsToRemove;
+ while(i-- > 0)
{
- @Override
- public void run()
- {
-
- int i = rowsToRemove;
- while(i-- > 0)
- {
- _tableModel.removeRow(0);
- }
- }
+ _tableModel.removeRow(0);
+ }
});
}
}
-
+
private synchronized void pause()
{
assert(!_destroyed);
_paused = true;
}
-
+
private synchronized void play()
{
assert(!_destroyed);
@@ -371,50 +362,45 @@ class ShowIceLogDialog extends JDialog
_queue.clear();
_paused = false;
}
-
+
private synchronized void stop()
{
_destroyed = true;
}
-
+
private void showLogMessage(LogMessage msg)
{
final Object[] row = logMessageToRow(msg);
_rowCount++;
- final int rowsToRemove = _rowCount - _maxRows;
+ final int rowsToRemove = _rowCount - _maxRows;
if(rowsToRemove > 0)
{
_rowCount -= rowsToRemove;
}
-
- SwingUtilities.invokeLater(
- new Runnable()
+
+ SwingUtilities.invokeLater(() ->
+ {
+ _tableModel.addRow(row);
+ int i = rowsToRemove;
+ while(i-- > 0)
{
- @Override
- public void run()
- {
- _tableModel.addRow(row);
- int i = rowsToRemove;
- while(i-- > 0)
- {
- _tableModel.removeRow(0);
- }
- _table.scrollRectToVisible(_table.getCellRect(_table.getRowCount() - 1, 0, true));
- }
- });
+ _tableModel.removeRow(0);
+ }
+ _table.scrollRectToVisible(_table.getCellRect(_table.getRowCount() - 1, 0, true));
+ });
}
-
+
private boolean _paused = true;
private boolean _destroyed = false;
- private final java.util.Deque<LogMessage> _queue = new java.util.ArrayDeque<LogMessage>();
+ private final java.util.Deque<LogMessage> _queue = new java.util.ArrayDeque<>();
private int _rowCount = 0;
private int _maxRows = _maxMessages;
}
-
- static private class DateRenderer extends DefaultTableCellRenderer
+
+ static private class DateRenderer extends DefaultTableCellRenderer
{
@Override
- public void setValue(Object value)
+ public void setValue(Object value)
{
if(value == null)
{
@@ -426,11 +412,11 @@ class ShowIceLogDialog extends JDialog
}
}
}
-
- static private class LogMessageTypeRenderer extends DefaultTableCellRenderer
+
+ static private class LogMessageTypeRenderer extends DefaultTableCellRenderer
{
@Override
- public void setValue(Object value)
+ public void setValue(Object value)
{
if(value == null)
{
@@ -442,11 +428,11 @@ class ShowIceLogDialog extends JDialog
}
}
}
-
- static private class MessageRenderer extends DefaultTableCellRenderer
+
+ static private class MessageRenderer extends DefaultTableCellRenderer
{
@Override
- public void setValue(Object value)
+ public void setValue(Object value)
{
if(value == null)
{
@@ -458,8 +444,9 @@ class ShowIceLogDialog extends JDialog
}
}
}
-
- ShowIceLogDialog(TreeNode parent, String title, Ice.LoggerAdminPrx loggerAdmin, String defaultFileName, int maxMessages, int initialMessages)
+
+ ShowIceLogDialog(TreeNode parent, String title, com.zeroc.Ice.LoggerAdminPrx loggerAdmin, String defaultFileName,
+ int maxMessages, int initialMessages)
{
super(parent.getRoot().getCoordinator().getMainFrame(), title + " - IceGrid Admin", false);
@@ -469,7 +456,7 @@ class ShowIceLogDialog extends JDialog
_defaultFileName = defaultFileName;
_maxMessages = maxMessages;
_initialMessages = initialMessages;
-
+
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
addWindowListener(new java.awt.event.WindowAdapter()
{
@@ -506,24 +493,24 @@ class ShowIceLogDialog extends JDialog
stop();
}
};
-
-
+
_tableModel = new DefaultTableModel(_columnNames, 0)
{
@Override
public boolean isCellEditable(int row, int column)
{
return false;
- }
- };
-
+ }
+ };
+
_table = new JTable(_tableModel)
{
@Override
- public java.awt.Component prepareRenderer(javax.swing.table.TableCellRenderer renderer, int row, int column)
+ public java.awt.Component prepareRenderer(javax.swing.table.TableCellRenderer renderer,
+ int row, int column)
{
java.awt.Component c = super.prepareRenderer(renderer, row, column);
-
+
if (!isRowSelected(row))
{
int modelRow = convertRowIndexToModel(row);
@@ -536,7 +523,7 @@ class ShowIceLogDialog extends JDialog
{
c.setBackground(Color.RED);
break;
- }
+ }
case WarningMessage:
{
c.setBackground(Color.ORANGE);
@@ -557,7 +544,7 @@ class ShowIceLogDialog extends JDialog
}
return c;
}
-
+
@Override
public String getToolTipText(java.awt.event.MouseEvent e)
{
@@ -565,9 +552,9 @@ class ShowIceLogDialog extends JDialog
java.awt.Point p = e.getPoint();
int row = rowAtPoint(p);
int col = columnAtPoint(p);
-
+
if(col == 3 && row >= 0) // Log message
- {
+ {
Object obj = getValueAt(row, col);
if(obj != null)
{
@@ -576,7 +563,6 @@ class ShowIceLogDialog extends JDialog
}
return tip;
}
-
};
_table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
@@ -603,7 +589,7 @@ class ShowIceLogDialog extends JDialog
{
_table.setRowHeight(minRowHeight);
}
-
+
_table.setRowSelectionAllowed(true);
_table.setOpaque(false);
_table.setPreferredScrollableViewportSize(new Dimension(800, 400));
@@ -611,7 +597,7 @@ class ShowIceLogDialog extends JDialog
setJMenuBar(new MenuBar());
getContentPane().add(new ToolBar(), BorderLayout.PAGE_START);
-
+
JScrollPane scrollPane = new JScrollPane(_table,
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
@@ -622,11 +608,11 @@ class ShowIceLogDialog extends JDialog
setResizable(true);
setLocationRelativeTo(_parent.getRoot().getCoordinator().getMainFrame());
-
+
_parent.getRoot().addShowIceLogDialog(_title, this);
-
+
setVisible(true);
-
+
play();
}
@@ -642,7 +628,7 @@ class ShowIceLogDialog extends JDialog
{
if(_remoteLogger == null)
{
- _tableModel.setRowCount(0);
+ _tableModel.setRowCount(0);
if(_messageTypeFilter != null || _traceCategoryFilter != null)
{
setTitle(_title + " (Filtered) - IceGrid Admin");
@@ -651,59 +637,38 @@ class ShowIceLogDialog extends JDialog
{
setTitle(_title + " (No filter) - IceGrid Admin");
}
-
+
_playItem.setSelected(true);
_playButton.setSelected(true);
_pause.setEnabled(false); // Init will enable Pause
-
+
String id = _loggerAdmin.ice_getIdentity().name + "-" + java.util.UUID.randomUUID().toString();
_remoteLogger = new RemoteLoggerI();
- _remoteLoggerPrx = RemoteLoggerPrxHelper.uncheckedCast(_parent.getRoot().getCoordinator().addCallback(_remoteLogger, id, ""));
-
+ _remoteLoggerPrx = RemoteLoggerPrx.uncheckedCast(
+ _parent.getRoot().getCoordinator().addCallback(_remoteLogger, id, ""));
+
final String prefix = "Attaching remote logger to " + _loggerAdmin.ice_getIdentity().name + "...";
final String errorTitle = "Failed to attach remote logger to " + _loggerAdmin.ice_getIdentity().name;
_parent.getRoot().getCoordinator().getStatusBar().setText(prefix);
-
- Ice.Callback_LoggerAdmin_attachRemoteLogger cb = new Ice.Callback_LoggerAdmin_attachRemoteLogger()
- {
- @Override
- public void response()
- {
- _parent.getRoot().amiSuccess(prefix);
- }
- @Override
- public void exception(final UserException ex)
- {
- SwingUtilities.invokeLater(new Runnable()
+ try
+ {
+ _loggerAdmin.attachRemoteLoggerAsync(_remoteLoggerPrx, _messageTypeFilter, _traceCategoryFilter,
+ _initialMessages).whenComplete((result, ex) ->
{
- @Override
- public void run()
+ if(ex == null)
{
- _parent.getRoot().failure(prefix, errorTitle, ex.toString());
- stopped();
+ _parent.getRoot().amiSuccess(prefix);
}
- });
- }
-
- @Override
- public void exception(final LocalException ex)
- {
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
+ else
{
- _parent.getRoot().failure(prefix, errorTitle, ex.toString());
- stopped();
+ SwingUtilities.invokeLater(() ->
+ {
+ _parent.getRoot().failure(prefix, errorTitle, ex.toString());
+ stopped();
+ });
}
});
- }
- };
-
- try
- {
- _loggerAdmin.begin_attachRemoteLogger(_remoteLoggerPrx, _messageTypeFilter, _traceCategoryFilter, _initialMessages, cb);
}
catch(LocalException ex)
{
@@ -714,10 +679,10 @@ class ShowIceLogDialog extends JDialog
else
{
_remoteLogger.play();
- _pause.setEnabled(true);
+ _pause.setEnabled(true);
}
}
-
+
private void stop(boolean detach)
{
if(_remoteLogger != null)
@@ -726,32 +691,27 @@ class ShowIceLogDialog extends JDialog
{
final String prefix = "Detaching remote logger from " + _loggerAdmin.ice_getIdentity().name + "...";
_parent.getRoot().getCoordinator().getStatusBar().setText(prefix);
-
- Ice.Callback_LoggerAdmin_detachRemoteLogger cb = new Ice.Callback_LoggerAdmin_detachRemoteLogger()
- {
- @Override
- public void response(boolean detached)
- {
- if(detached)
- {
- _parent.getRoot().amiSuccess(prefix);
- }
- else
- {
- _parent.getRoot().amiSuccess(prefix, "not found");
- }
- }
- @Override
- public void exception(LocalException ex)
- {
- _parent.getRoot().amiSuccess(prefix, ex.ice_id());
- }
- };
-
try
{
- _loggerAdmin.begin_detachRemoteLogger(_remoteLoggerPrx, cb);
+ _loggerAdmin.detachRemoteLoggerAsync(_remoteLoggerPrx).whenComplete((result, ex) ->
+ {
+ if(ex == null)
+ {
+ if(result)
+ {
+ _parent.getRoot().amiSuccess(prefix);
+ }
+ else
+ {
+ _parent.getRoot().amiSuccess(prefix, "not found");
+ }
+ }
+ else
+ {
+ _parent.getRoot().amiSuccess(prefix, ex.toString());
+ }
+ });
}
catch(LocalException ex)
{
@@ -800,25 +760,25 @@ class ShowIceLogDialog extends JDialog
{
_remoteLogger.setMaxRows(_maxMessages);
}
-
+
_parent.getRoot().setLogPrefs(_maxMessages, _initialMessages);
}
-
+
LogMessageType[] getMessageTypeFilter()
{
return _messageTypeFilter;
}
-
+
String[] getTraceCategoryFilter()
{
return _traceCategoryFilter;
}
-
+
void setFilters(LogMessageType[] messageTypeFilter, String[] traceCategoryFilter)
{
_messageTypeFilter = messageTypeFilter;
_traceCategoryFilter = traceCategoryFilter;
-
+
if(_remoteLogger != null)
{
stop();
@@ -847,34 +807,33 @@ class ShowIceLogDialog extends JDialog
}
dispose();
}
-
+
private Object[] logMessageToRow(LogMessage msg)
{
Object[] row = new Object[4];
-
+
row[0] = new java.util.Date(msg.timestamp / 1000);
row[1] = msg.type;
row[2] = msg.traceCategory;
row[3] = msg.message;
-
+
return row;
}
-
private final TreeNode _parent;
- private final Ice.LoggerAdminPrx _loggerAdmin;
+ private final com.zeroc.Ice.LoggerAdminPrx _loggerAdmin;
private final String _title;
private final String _defaultFileName;
-
+
private RemoteLoggerI _remoteLogger;
- private Ice.RemoteLoggerPrx _remoteLoggerPrx;
-
+ private com.zeroc.Ice.RemoteLoggerPrx _remoteLoggerPrx;
+
private int _maxMessages;
private int _initialMessages;
-
+
private LogMessageType[] _messageTypeFilter;
private String[] _traceCategoryFilter;
-
+
private Action _play;
private Action _pause;
private Action _stop;
@@ -890,12 +849,12 @@ class ShowIceLogDialog extends JDialog
private final Object[] _columnNames = new Object[]{"Timestamp", "Type", "Trace Category", "Log Message"};
private final DefaultTableModel _tableModel;
private final JTable _table;
-
+
private static String renderDate(java.util.Date date)
{
return _dateFormat.format(date) + _timeFormat.format(date);
}
-
+
private static String renderLogMessageType(LogMessageType type)
{
// Remove "Message" from end of string.
@@ -903,13 +862,14 @@ class ShowIceLogDialog extends JDialog
assert(s.length() > 7);
return s.substring(0, s.length() - 7);
}
-
+
private static String renderMessage(String msg)
{
return msg.replace("\n", " ");
}
-
- private static final java.text.DateFormat _dateFormat = java.text.DateFormat.getDateInstance(java.text.DateFormat.SHORT);
+
+ private static final java.text.DateFormat _dateFormat =
+ java.text.DateFormat.getDateInstance(java.text.DateFormat.SHORT);
private static final java.text.DateFormat _timeFormat = new java.text.SimpleDateFormat(" HH:mm:ss:SSS");
}
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ShowLogFileDialog.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ShowLogFileDialog.java
index 574c972fbdf..40e9a97ea5f 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ShowLogFileDialog.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ShowLogFileDialog.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
@@ -36,15 +36,15 @@ import com.jgoodies.looks.HeaderStyle;
import com.jgoodies.looks.Options;
import com.jgoodies.looks.plastic.PlasticLookAndFeel;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class ShowLogFileDialog extends JDialog
{
static interface FileIteratorFactory
{
FileIteratorPrx open(int count)
- throws Ice.UserException;
+ throws com.zeroc.Ice.UserException;
String getTitle();
@@ -62,26 +62,22 @@ class ShowLogFileDialog extends JDialog
void appendLines(final String[] lines, final int maxLines, final int maxSize)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
+ for(int i = 0; i < lines.length; ++i)
{
- for(int i = 0; i < lines.length; ++i)
+ //
+ // The last line is always incomplete
+ //
+ if(i + 1 != lines.length)
{
- //
- // The last line is always incomplete
- //
- if(i + 1 != lines.length)
- {
- append(lines[i] + "\n");
- }
- else
- {
- append(lines[i]);
- }
- removeLines(maxLines, maxSize);
+ append(lines[i] + "\n");
+ }
+ else
+ {
+ append(lines[i]);
}
+ removeLines(maxLines, maxSize);
}
});
}
@@ -129,27 +125,22 @@ class ShowLogFileDialog extends JDialog
private void openError(final String message)
{
- SwingUtilities.invokeLater(
- new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
+ if(_textArea.getText() == null || _textArea.getText().length() == 0)
{
- if(_textArea.getText() == null || _textArea.getText().length() == 0)
- {
- close(true);
- }
- else
- {
- stopReading();
- }
-
- JOptionPane.showMessageDialog(
- ShowLogFileDialog.this,
- message,
- _factory.getTitle() + ": cannot open file",
- JOptionPane.ERROR_MESSAGE);
+ close(true);
}
+ else
+ {
+ stopReading();
+ }
+
+ JOptionPane.showMessageDialog(
+ ShowLogFileDialog.this,
+ message,
+ _factory.getTitle() + ": cannot open file",
+ JOptionPane.ERROR_MESSAGE);
});
}
@@ -170,31 +161,26 @@ class ShowLogFileDialog extends JDialog
{
_p = _factory.open(initialLines);
}
- catch(Ice.UserException e)
+ catch(com.zeroc.Ice.UserException e)
{
openError(e.toString());
return;
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
openError(e.toString());
return;
}
- SwingUtilities.invokeLater(
- new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
+ if(isVisible())
{
- if(isVisible())
- {
- _textArea.setText(null);
- }
- else
- {
- setVisible(true);
- }
+ _textArea.setText(null);
+ }
+ else
+ {
+ setVisible(true);
}
});
@@ -261,13 +247,14 @@ class ShowLogFileDialog extends JDialog
maxReadSize = _threadMaxReadSize;
}
- Ice.StringSeqHolder linesHolder = new Ice.StringSeqHolder();
+ FileIterator.ReadResult r = null;
try
{
- eofEncountered = _p.read(maxReadSize, linesHolder);
+ r = _p.read(maxReadSize);
+ eofEncountered = r.returnValue;
}
- catch(IceGrid.FileNotAvailableException e)
+ catch(com.zeroc.IceGrid.FileNotAvailableException e)
{
_textArea.appendLines(new String[]
{
@@ -275,19 +262,11 @@ class ShowLogFileDialog extends JDialog
"IceGridAdmin caught: " + e.toString(),
"---------------------------"
}, maxLines, maxSize);
- SwingUtilities.invokeLater(
- new Runnable()
- {
- @Override
- public void run()
- {
- stopReading();
- }
- });
+ SwingUtilities.invokeLater(() -> stopReading());
cleanupIterator();
return;
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
_textArea.appendLines(new String[]
{
@@ -295,19 +274,11 @@ class ShowLogFileDialog extends JDialog
"IceGridAdmin caught: " + e.toString(),
"---------------------------"
}, maxLines, maxSize);
- SwingUtilities.invokeLater(
- new Runnable()
- {
- @Override
- public void run()
- {
- stopReading();
- }
- });
+ SwingUtilities.invokeLater(() -> stopReading());
return;
}
- _textArea.appendLines(linesHolder.value, maxLines, maxSize);
+ _textArea.appendLines(r.lines, maxLines, maxSize);
}
}
}
@@ -318,7 +289,7 @@ class ShowLogFileDialog extends JDialog
{
_p.destroy();
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
// Ignored, maybe should log warning
}
@@ -360,7 +331,7 @@ class ShowLogFileDialog extends JDialog
_threadPeriod = _period;
}
- private FileIteratorPrx _p;
+ private FileIteratorPrx _p;
private boolean _done = false;
private boolean _paused = false;
@@ -553,8 +524,8 @@ class ShowLogFileDialog extends JDialog
}
}
- ShowLogFileDialog(Root root, FileIteratorFactory factory, int maxLines, int maxSize, int initialLines, int maxReadSize,
- int period)
+ ShowLogFileDialog(Root root, FileIteratorFactory factory, int maxLines, int maxSize, int initialLines,
+ int maxReadSize, int period)
{
super(root.getCoordinator().getMainFrame(), factory.getTitle() + " - IceGrid Admin", false);
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Slave.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Slave.java
index 61b6fee4156..256b8db17f9 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Slave.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Slave.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import java.awt.Component;
import java.awt.Cursor;
@@ -15,8 +15,8 @@ import java.awt.Cursor;
import javax.swing.JPopupMenu;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class Slave extends TreeNode
{
@@ -26,7 +26,7 @@ class Slave extends TreeNode
@Override
public boolean[] getAvailableActions()
{
- boolean[] actions = new boolean[IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT];
+ boolean[] actions = new boolean[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT];
actions[SHUTDOWN_REGISTRY] = true;
actions[RETRIEVE_STDOUT] = true;
actions[RETRIEVE_STDERR] = true;
@@ -39,38 +39,17 @@ class Slave extends TreeNode
final String prefix = "Shutting down registry '" + _id + "'...";
getCoordinator().getStatusBar().setText(prefix);
- Callback_Admin_shutdownRegistry cb = new Callback_Admin_shutdownRegistry()
- {
- //
- // Called by another thread!
- //
- @Override
- public void response()
- {
- amiSuccess(prefix);
- }
-
- @Override
- public void exception(Ice.UserException e)
- {
- amiFailure(prefix, "Failed to shutdown " + _id, e);
- }
-
- @Override
- public void exception(Ice.LocalException e)
- {
- amiFailure(prefix, "Failed to shutdown " + _id,
- e.toString());
- }
- };
-
try
{
getCoordinator().getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- getCoordinator().getAdmin().begin_shutdownRegistry(_id, cb);
+ getCoordinator().getAdmin().shutdownRegistryAsync(_id).whenComplete((result, ex) ->
+ {
+ amiComplete(prefix, "Failed to shutdown " + _id, ex);
+ });
+
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
failure(prefix, "Failed to shutdown " + _id, e.toString());
}
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/SlaveEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/SlaveEditor.java
index 14479497ab2..681fe1f022e 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/SlaveEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/SlaveEditor.java
@@ -7,13 +7,13 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import javax.swing.JTextField;
import com.jgoodies.forms.builder.DefaultFormBuilder;
-import IceGrid.*;
+import com.zeroc.IceGrid.*;
class SlaveEditor extends Editor
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/TableField.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/TableField.java
index f1b4400d2ec..77ac0980e60 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/TableField.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/TableField.java
@@ -7,10 +7,10 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
@@ -24,7 +24,7 @@ public class TableField extends JTable
{
public TableField(String... columns)
{
- _columnNames = new java.util.Vector<String>(columns.length);
+ _columnNames = new java.util.Vector<>(columns.length);
for(String name : columns)
{
_columnNames.add(name);
@@ -62,7 +62,7 @@ public class TableField extends JTable
public void setProperties(java.util.List<PropertyDescriptor> properties, Utils.Resolver resolver)
{
- java.util.SortedMap<String, String> map = new java.util.TreeMap<String, String>();
+ java.util.SortedMap<String, String> map = new java.util.TreeMap<>();
for(PropertyDescriptor p : properties)
{
map.put(resolver.substitute(p.name), resolver.substitute(p.value));
@@ -72,18 +72,19 @@ public class TableField extends JTable
public void setObjects(java.util.List<ObjectDescriptor> objects, Utils.Resolver resolver)
{
- java.util.SortedMap<String, String> map = new java.util.TreeMap<String, String>();
+ java.util.SortedMap<String, String> map = new java.util.TreeMap<>();
for(ObjectDescriptor p : objects)
{
- Ice.Identity id = new Ice.Identity( resolver.substitute(p.id.name), resolver.substitute(p.id.category));
- map.put(Ice.Util.identityToString(id), resolver.substitute(p.type));
+ com.zeroc.Ice.Identity id =
+ new com.zeroc.Ice.Identity(resolver.substitute(p.id.name), resolver.substitute(p.id.category));
+ map.put(com.zeroc.Ice.Util.identityToString(id), resolver.substitute(p.type));
}
setSortedMap(map);
}
public void setObjects(java.util.SortedMap<String, ObjectInfo> objects)
{
- java.util.SortedMap<String, String> map = new java.util.TreeMap<String, String>();
+ java.util.SortedMap<String, String> map = new java.util.TreeMap<>();
for(ObjectInfo p : objects.values())
{
map.put(p.proxy.toString(), p.type);
@@ -93,7 +94,7 @@ public class TableField extends JTable
public void setEnvs(java.util.List<String> envs, Utils.Resolver resolver)
{
- java.util.SortedMap<String, String> map = new java.util.TreeMap<String, String>();
+ java.util.SortedMap<String, String> map = new java.util.TreeMap<>();
for(String p : envs)
{
@@ -114,11 +115,10 @@ public class TableField extends JTable
public void setAdapters(java.util.SortedMap<String, AdapterInfo> adapters)
{
- java.util.Vector<java.util.Vector<String>> vector =
- new java.util.Vector<java.util.Vector<String>>(adapters.size());
+ java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<>(adapters.size());
for(java.util.Map.Entry<String, AdapterInfo> p : adapters.entrySet())
{
- java.util.Vector<String> row = new java.util.Vector<String>(3);
+ java.util.Vector<String> row = new java.util.Vector<>(3);
row.add(p.getKey());
AdapterInfo ai = p.getValue();
@@ -153,10 +153,10 @@ public class TableField extends JTable
public void setSortedMap(java.util.SortedMap<String, String> map)
{
- java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<java.util.Vector<String>>(map.size());
+ java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<>(map.size());
for(java.util.Map.Entry<String, String> p : map.entrySet())
{
- java.util.Vector<String> row = new java.util.Vector<String>(2);
+ java.util.Vector<String> row = new java.util.Vector<>(2);
row.add(p.getKey());
row.add(p.getValue());
vector.add(row);
@@ -170,7 +170,7 @@ public class TableField extends JTable
public void clear()
{
- _model.setDataVector(new java.util.Vector<java.util.Vector<String>>(), _columnNames);
+ _model.setDataVector(new java.util.Vector<>(), _columnNames);
DefaultTableCellRenderer cr = (DefaultTableCellRenderer)getDefaultRenderer(String.class);
cr.setOpaque(false);
}
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/TreeNode.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/TreeNode.java
index ce7183e43d1..dee7468efe0 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/TreeNode.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/TreeNode.java
@@ -7,12 +7,12 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import javax.swing.SwingUtilities;
import javax.swing.JOptionPane;
-import IceGridGUI.*;
+import com.zeroc.IceGridGUI.*;
public abstract class TreeNode extends TreeNodeBase
{
@@ -51,7 +51,6 @@ public abstract class TreeNode extends TreeNodeBase
public static final int RETRIEVE_STDOUT = 13;
public static final int RETRIEVE_STDERR = 14;
public static final int RETRIEVE_LOG_FILE = 15;
-
public static final int SHUTDOWN_NODE = 16;
public static final int SHUTDOWN_REGISTRY = 17;
@@ -133,7 +132,7 @@ public abstract class TreeNode extends TreeNodeBase
{
assert false;
}
-
+
public void clearShowIceLogDialog()
{
assert false;
@@ -142,50 +141,52 @@ public abstract class TreeNode extends TreeNodeBase
//
// Helpers
//
+ protected void amiComplete(final String prefix, final String title, final Throwable ex)
+ {
+ if(ex == null)
+ {
+ amiSuccess(prefix);
+ }
+ else if(ex instanceof com.zeroc.Ice.UserException)
+ {
+ amiFailure(prefix, title, (com.zeroc.Ice.UserException)ex);
+ }
+ else
+ {
+ amiFailure(prefix, title, ex.toString());
+ }
+ }
+
protected void amiSuccess(final String prefix)
{
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- success(prefix);
- }
- });
+ SwingUtilities.invokeLater(() -> success(prefix));
}
-
+
protected void amiSuccess(final String prefix, final String detail)
{
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- success(prefix, detail);
- }
- });
+ SwingUtilities.invokeLater(() -> success(prefix, detail));
}
- protected void amiFailure(String prefix, String title, Ice.UserException e)
+ protected void amiFailure(String prefix, String title, com.zeroc.Ice.UserException e)
{
- if(e instanceof IceGrid.ServerNotExistException)
+ if(e instanceof com.zeroc.IceGrid.ServerNotExistException)
{
- IceGrid.ServerNotExistException sne = (IceGrid.ServerNotExistException)e;
+ com.zeroc.IceGrid.ServerNotExistException sne = (com.zeroc.IceGrid.ServerNotExistException)e;
amiFailure(prefix, title, "Server '" + sne.id + "' was not registered with the IceGrid Registry");
}
- else if(e instanceof IceGrid.ServerStartException)
+ else if(e instanceof com.zeroc.IceGrid.ServerStartException)
{
- IceGrid.ServerStartException ste = (IceGrid.ServerStartException)e;
+ com.zeroc.IceGrid.ServerStartException ste = (com.zeroc.IceGrid.ServerStartException)e;
amiFailure(prefix, title, "Server '" + ste.id + "' did not start: " + ste.reason);
}
- else if(e instanceof IceGrid.ApplicationNotExistException)
+ else if(e instanceof com.zeroc.IceGrid.ApplicationNotExistException)
{
amiFailure(prefix, title, "This application was not registered with the IceGrid Registry");
}
- else if(e instanceof IceGrid.PatchException)
+ else if(e instanceof com.zeroc.IceGrid.PatchException)
{
- IceGrid.PatchException pe = (IceGrid.PatchException)e;
+ com.zeroc.IceGrid.PatchException pe = (com.zeroc.IceGrid.PatchException)e;
String message = "";
for(String s : pe.reasons)
@@ -198,20 +199,20 @@ public abstract class TreeNode extends TreeNodeBase
}
amiFailure(prefix, title, message);
}
- else if(e instanceof IceGrid.NodeNotExistException)
+ else if(e instanceof com.zeroc.IceGrid.NodeNotExistException)
{
- IceGrid.NodeNotExistException nnee = (IceGrid.NodeNotExistException)e;
+ com.zeroc.IceGrid.NodeNotExistException nnee = (com.zeroc.IceGrid.NodeNotExistException)e;
amiFailure(prefix, title, "Node '" + nnee.name + " 'was not registered with the IceGrid Registry.");
}
- else if(e instanceof IceGrid.NodeUnreachableException)
+ else if(e instanceof com.zeroc.IceGrid.NodeUnreachableException)
{
- IceGrid.NodeUnreachableException nue = (IceGrid.NodeUnreachableException)e;
+ com.zeroc.IceGrid.NodeUnreachableException nue = (com.zeroc.IceGrid.NodeUnreachableException)e;
amiFailure(prefix, title, "Node '" + nue.name + "' is unreachable: " + nue.reason);
}
- else if(e instanceof IceGrid.DeploymentException)
+ else if(e instanceof com.zeroc.IceGrid.DeploymentException)
{
- IceGrid.DeploymentException de = (IceGrid.DeploymentException)e;
+ com.zeroc.IceGrid.DeploymentException de = (com.zeroc.IceGrid.DeploymentException)e;
amiFailure(prefix, title, "Deployment exception: " + de.reason);
}
else
@@ -222,14 +223,7 @@ public abstract class TreeNode extends TreeNodeBase
protected void amiFailure(final String prefix, final String title, final String message)
{
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- failure(prefix, title, message);
- }
- });
+ SwingUtilities.invokeLater(() -> failure(prefix, title, message));
}
protected void failure(String prefix, String title, String message)
@@ -242,17 +236,17 @@ public abstract class TreeNode extends TreeNodeBase
title,
JOptionPane.ERROR_MESSAGE);
}
-
+
protected void success(String prefix, String detail)
{
getCoordinator().getStatusBar().setText(prefix + " done (" + detail + ").");
}
-
+
protected void success(String prefix)
{
getCoordinator().getStatusBar().setText(prefix + " done.");
}
-
+
void reparent(TreeNode newParent)
{
assert newParent != null;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/WriteMessageDialog.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/WriteMessageDialog.java
index 2270e25b48f..50bb07c73b9 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/WriteMessageDialog.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/WriteMessageDialog.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI.LiveDeployment;
+package com.zeroc.IceGridGUI.LiveDeployment;
import java.awt.Container;
import java.awt.event.ActionEvent;
@@ -33,8 +33,8 @@ import com.jgoodies.forms.factories.Borders;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.util.LayoutStyle;
-import IceGrid.*;
-import IceGridGUI.*;
+import com.zeroc.IceGrid.*;
+import com.zeroc.IceGridGUI.*;
class WriteMessageDialog extends JDialog
{
@@ -71,60 +71,45 @@ class WriteMessageDialog extends JDialog
}
else
{
+ com.zeroc.Ice.Identity adminId =
+ new com.zeroc.Ice.Identity(_target, c.getServerAdminCategory());
- Ice.Identity adminId = new Ice.Identity(_target, c.getServerAdminCategory());
-
- final Ice.ProcessPrx process = Ice.ProcessPrxHelper.uncheckedCast(
+ final com.zeroc.Ice.ProcessPrx process = com.zeroc.Ice.ProcessPrx.uncheckedCast(
admin.ice_identity(adminId).ice_facet("Process"));
final String prefix = "Writing message to server '" + _target + "'...";
c.getStatusBar().setText(prefix);
- Ice.Callback_Process_writeMessage cb = new Ice.Callback_Process_writeMessage()
- {
- @Override
- public void response()
- {
- SwingUtilities.invokeLater(new Runnable()
+ try
+ {
+ process.writeMessageAsync(_message.getText(), _stdOut.isSelected() ? 1 : 2). whenComplete(
+ (result, ex) ->
+ {
+ if(ex == null)
{
- @Override
- public void run()
- {
- c.getStatusBar().setText(prefix + "done.");
- }
- });
- }
-
- @Override
- public void exception(final Ice.LocalException e)
- {
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
+ {
+ c.getStatusBar().setText(prefix + "done.");
+ });
+ }
+ else
{
- @Override
- public void run()
- {
- handleFailure("Communication exception: " + e.toString());
- }
- });
- }
-
- private void handleFailure(String message)
- {
- c.getStatusBar().setText(prefix + "failed!");
-
- JOptionPane.showMessageDialog(
- _mainFrame,
- message,
- "Writing message to server '" + process.ice_getIdentity().name + "' failed",
- JOptionPane.ERROR_MESSAGE);
- }
- };
+ SwingUtilities.invokeLater(() ->
+ {
+ c.getStatusBar().setText(prefix + "failed!");
+
+ JOptionPane.showMessageDialog(
+ _mainFrame,
+ "Communication exception: " + ex.toString(),
+ "Writing message to server '" +
+ process.ice_getIdentity().name + "' failed",
+ JOptionPane.ERROR_MESSAGE);
+ });
+ }
+ });
- try
- {
- process.begin_writeMessage(_message.getText(), _stdOut.isSelected() ? 1 : 2, cb);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
c.getStatusBar().setText(prefix + "failed.");
JOptionPane.showMessageDialog(
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeploymentPane.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeploymentPane.java
index e5814767fac..3a2a8c4cb41 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeploymentPane.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeploymentPane.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
import java.awt.*;
import java.awt.event.MouseAdapter;
@@ -24,9 +24,9 @@ import javax.swing.tree.TreeSelectionModel;
import javax.swing.tree.TreePath;
import com.jgoodies.forms.factories.Borders;
-import IceGridGUI.LiveDeployment.Editor;
-import IceGridGUI.LiveDeployment.Root;
-import IceGridGUI.LiveDeployment.TreeNode;
+import com.zeroc.IceGridGUI.LiveDeployment.Editor;
+import com.zeroc.IceGridGUI.LiveDeployment.Root;
+import com.zeroc.IceGridGUI.LiveDeployment.TreeNode;
public class LiveDeploymentPane extends JSplitPane implements Tab
{
@@ -346,8 +346,8 @@ public class LiveDeploymentPane extends JSplitPane implements Tab
//
// back/forward navigation
//
- private java.util.LinkedList<TreeNode> _previousNodes = new java.util.LinkedList<TreeNode>();
- private java.util.LinkedList<TreeNode> _nextNodes = new java.util.LinkedList<TreeNode>();
+ private java.util.LinkedList<TreeNode> _previousNodes = new java.util.LinkedList<>();
+ private java.util.LinkedList<TreeNode> _nextNodes = new java.util.LinkedList<>();
private TreeNode _currentNode;
private boolean _selectionListenerEnabled = true;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Logger.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Logger.java
index a9a20006a51..8ec0145ea29 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Logger.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Logger.java
@@ -7,13 +7,13 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
-public class Logger extends Ice.LoggerI
+public class Logger extends com.zeroc.Ice.LoggerI
{
public
Logger(JFrame mainFrame)
@@ -34,17 +34,10 @@ public class Logger extends Ice.LoggerI
{
return;
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
- {
- JOptionPane.showMessageDialog(
- _mainFrame,
- message,
- "Warning - IceGrid Admin Logger",
- JOptionPane.WARNING_MESSAGE);
- }
+ JOptionPane.showMessageDialog(_mainFrame, message, "Warning - IceGrid Admin Logger",
+ JOptionPane.WARNING_MESSAGE);
});
}
@@ -52,17 +45,10 @@ public class Logger extends Ice.LoggerI
public void
error(final String message)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
- {
- JOptionPane.showMessageDialog(
- _mainFrame,
- message,
- "Error - IceGrid Admin Logger",
- JOptionPane.ERROR_MESSAGE);
- }
+ JOptionPane.showMessageDialog(_mainFrame, message, "Error - IceGrid Admin Logger",
+ JOptionPane.ERROR_MESSAGE);
});
}
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Main.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Main.java
index 338af04e384..609407a77c5 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Main.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Main.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
@@ -61,7 +61,7 @@ public class Main extends JFrame
//
new Main(args);
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
JOptionPane.showMessageDialog(null,
e.toString(),
@@ -93,11 +93,11 @@ public class Main extends JFrame
if(_coordinator.needsSaving())
{
if(JOptionPane.showOptionDialog(
- Main.this,
- "The application has unsave changes, if you exit all unsaved changes will be lost.\n" +
- "Exit and discard changes?",
- "Save application", JOptionPane.YES_NO_OPTION,
- JOptionPane.YES_NO_OPTION, null, null, null) == JOptionPane.YES_OPTION)
+ Main.this,
+ "The application has unsaved changes, if you exit all unsaved changes " +
+ "will be lost.\nExit and discard changes?",
+ "Save application", JOptionPane.YES_NO_OPTION,
+ JOptionPane.YES_NO_OPTION, null, null, null) == JOptionPane.YES_OPTION)
{
_coordinator.exit(0);
}
@@ -110,7 +110,7 @@ public class Main extends JFrame
}
});
- _coordinator = new Coordinator(this, new Ice.StringSeqHolder(args), Preferences.userNodeForPackage(getClass()));
+ _coordinator = new Coordinator(this, args, Preferences.userNodeForPackage(getClass()));
_coordinator.showMainFrame();
}
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/MainPane.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/MainPane.java
index cbc30f579b0..4ade68f2dba 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/MainPane.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/MainPane.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
@@ -18,7 +18,7 @@ public class MainPane extends JTabbedPane
{
public void addApplication(ApplicationPane application)
{
- IceGridGUI.Application.Root root = application.getRoot();
+ com.zeroc.IceGridGUI.Application.Root root = application.getRoot();
super.addTab(computeTitle(root.getId()), getIcon(root), application);
}
@@ -28,7 +28,7 @@ public class MainPane extends JTabbedPane
super.setTitleAt(index, computeTitle(title));
}
- public void resetTitle(IceGridGUI.Application.Root root)
+ public void resetTitle(com.zeroc.IceGridGUI.Application.Root root)
{
int i = findIndex(root);
if(i > 0)
@@ -37,7 +37,7 @@ public class MainPane extends JTabbedPane
}
}
- public void resetIcon(IceGridGUI.Application.Root root)
+ public void resetIcon(com.zeroc.IceGridGUI.Application.Root root)
{
int i = findIndex(root);
if(i > 0)
@@ -46,7 +46,7 @@ public class MainPane extends JTabbedPane
}
}
- public int findIndex(IceGridGUI.Application.Root root)
+ public int findIndex(com.zeroc.IceGridGUI.Application.Root root)
{
for(int i = 1; i < getTabCount(); ++i)
{
@@ -59,7 +59,7 @@ public class MainPane extends JTabbedPane
return -1;
}
- public ApplicationPane findApplication(IceGridGUI.Application.Root root)
+ public ApplicationPane findApplication(com.zeroc.IceGridGUI.Application.Root root)
{
for(int i = 1; i < getTabCount(); ++i)
{
@@ -72,7 +72,7 @@ public class MainPane extends JTabbedPane
return null;
}
- public void removeApplication(IceGridGUI.Application.Root root)
+ public void removeApplication(com.zeroc.IceGridGUI.Application.Root root)
{
for(int i = 1; i < getTabCount(); ++i)
{
@@ -132,7 +132,7 @@ public class MainPane extends JTabbedPane
return false;
}
- private ImageIcon getIcon(IceGridGUI.Application.Root root)
+ private ImageIcon getIcon(com.zeroc.IceGridGUI.Application.Root root)
{
if(root.isLive())
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/MainProxy.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/MainProxy.java
index 4e6ad314dce..4f0d5425b9d 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/MainProxy.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/MainProxy.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
import javax.swing.JOptionPane;
@@ -21,8 +21,8 @@ public class MainProxy
_args = java.util.Arrays.copyOf(args, args.length);
String version = System.getProperty("java.version");
-
- Class<?> cls = IceInternal.Util.findClass("com.javafx.main.Main", null);
+
+ Class<?> cls = com.zeroc.IceInternal.Util.findClass("com.javafx.main.Main", null);
if(cls != null && version.indexOf("1.7") == 0)
{
try
@@ -34,30 +34,27 @@ public class MainProxy
catch(NoSuchMethodException ex)
{
ex.printStackTrace();
- JOptionPane.showMessageDialog(null,
- "Unable to find method `main(String[] args)' in class `com.javafx.main.Main'",
- "IceGrid Admin Error",
- JOptionPane.ERROR_MESSAGE);
+ JOptionPane.showMessageDialog(
+ null, "Unable to find method `main(String[] args)' in class `com.javafx.main.Main'",
+ "IceGrid Admin Error", JOptionPane.ERROR_MESSAGE);
}
catch(IllegalAccessException ex)
{
ex.printStackTrace();
- JOptionPane.showMessageDialog(null,
- "IllegalAccessException invoking method `main(String[] args)' in class `com.javafx.main.Main'",
- "IceGrid Admin Error",
- JOptionPane.ERROR_MESSAGE);
+ JOptionPane.showMessageDialog(
+ null,
+ "IllegalAccessException invoking method `main(String[] args)' in class `com.javafx.main.Main'",
+ "IceGrid Admin Error", JOptionPane.ERROR_MESSAGE);
}
catch(java.lang.reflect.InvocationTargetException ex)
{
}
}
- cls = IceInternal.Util.findClass("IceGridGUI.Main", null);
+ cls = com.zeroc.IceInternal.Util.findClass("com.zeroc.IceGridGUI.Main", null);
if(cls == null)
{
- JOptionPane.showMessageDialog(null,
- "Unable to find class `IceGridGUI.Main'",
- "IceGrid Admin Error",
- JOptionPane.ERROR_MESSAGE);
+ JOptionPane.showMessageDialog(null, "Unable to find class `com.zeroc.IceGridGUI.Main'",
+ "IceGrid Admin Error", JOptionPane.ERROR_MESSAGE);
return;
}
try
@@ -69,18 +66,16 @@ public class MainProxy
catch(NoSuchMethodException ex)
{
ex.printStackTrace();
- JOptionPane.showMessageDialog(null,
- "Unable to find method `main(String[] args)' in class `com.javafx.main.Main'",
- "IceGrid Admin Error",
- JOptionPane.ERROR_MESSAGE);
+ JOptionPane.showMessageDialog(
+ null, "Unable to find method `main(String[] args)' in class `com.javafx.main.Main'",
+ "IceGrid Admin Error", JOptionPane.ERROR_MESSAGE);
}
catch(IllegalAccessException ex)
{
ex.printStackTrace();
- JOptionPane.showMessageDialog(null,
- "IllegalAccessException invoking method `main(String[] args)' in class `com.javafx.main.Main'",
- "IceGrid Admin Error",
- JOptionPane.ERROR_MESSAGE);
+ JOptionPane.showMessageDialog(
+ null, "IllegalAccessException invoking method `main(String[] args)' in class `com.javafx.main.Main'",
+ "IceGrid Admin Error", JOptionPane.ERROR_MESSAGE);
}
catch(java.lang.reflect.InvocationTargetException ex)
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/NodeObserverI.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/NodeObserverI.java
index 3d16a3ed61a..bc8e0375cf0 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/NodeObserverI.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/NodeObserverI.java
@@ -7,12 +7,12 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
import javax.swing.SwingUtilities;
-import IceGrid.*;
+import com.zeroc.IceGrid.*;
-class NodeObserverI extends _NodeObserverDisp
+class NodeObserverI implements NodeObserver
{
NodeObserverI(Coordinator coordinator)
{
@@ -21,7 +21,7 @@ class NodeObserverI extends _NodeObserverDisp
}
@Override
- public void nodeInit(final NodeDynamicInfo[] nodes, Ice.Current current)
+ public void nodeInit(final NodeDynamicInfo[] nodes, com.zeroc.Ice.Current current)
{
if(_trace)
{
@@ -40,57 +40,39 @@ class NodeObserverI extends _NodeObserverDisp
}
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
+ for(NodeDynamicInfo node : nodes)
{
- for(NodeDynamicInfo node : nodes)
- {
- _coordinator.nodeUp(node);
- }
+ _coordinator.nodeUp(node);
}
});
}
@Override
- public void nodeUp(final NodeDynamicInfo nodeInfo, Ice.Current current)
+ public void nodeUp(final NodeDynamicInfo nodeInfo, com.zeroc.Ice.Current current)
{
if(_trace)
{
_coordinator.traceObserver("nodeUp for node " + nodeInfo.info.name);
}
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _coordinator.nodeUp(nodeInfo);
- }
- });
+ SwingUtilities.invokeLater(() -> _coordinator.nodeUp(nodeInfo));
}
@Override
- public void nodeDown(final String nodeName, Ice.Current current)
+ public void nodeDown(final String nodeName, com.zeroc.Ice.Current current)
{
if(_trace)
{
_coordinator.traceObserver("nodeUp for node " + nodeName);
}
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _coordinator.nodeDown(nodeName);
- }
- });
+ SwingUtilities.invokeLater(() -> _coordinator.nodeDown(nodeName));
}
@Override
- public void updateServer(final String node, final ServerDynamicInfo updatedInfo, Ice.Current current)
+ public void updateServer(final String node, final ServerDynamicInfo updatedInfo, com.zeroc.Ice.Current current)
{
if(_trace)
{
@@ -99,18 +81,11 @@ class NodeObserverI extends _NodeObserverDisp
+ updatedInfo.state.toString());
}
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _coordinator.updateServer(node, updatedInfo);
- }
- });
+ SwingUtilities.invokeLater(() -> _coordinator.updateServer(node, updatedInfo));
}
@Override
- public void updateAdapter(final String node, final AdapterDynamicInfo updatedInfo, Ice.Current current)
+ public void updateAdapter(final String node, final AdapterDynamicInfo updatedInfo, com.zeroc.Ice.Current current)
{
if(_trace)
{
@@ -120,14 +95,7 @@ class NodeObserverI extends _NodeObserverDisp
: updatedInfo.proxy.toString()));
}
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _coordinator.updateAdapter(node, updatedInfo);
- }
- });
+ SwingUtilities.invokeLater(() -> _coordinator.updateAdapter(node, updatedInfo));
}
private final Coordinator _coordinator;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/ObjectObserverI.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ObjectObserverI.java
index a04c2b12dd5..f68074429f7 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/ObjectObserverI.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ObjectObserverI.java
@@ -7,12 +7,12 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
import javax.swing.SwingUtilities;
-import IceGrid.*;
+import com.zeroc.IceGrid.*;
-class ObjectObserverI extends _ObjectObserverDisp
+class ObjectObserverI implements ObjectObserver
{
ObjectObserverI(Coordinator coordinator)
{
@@ -21,7 +21,7 @@ class ObjectObserverI extends _ObjectObserverDisp
}
@Override
- public synchronized void objectInit(final ObjectInfo[] objects, Ice.Current current)
+ public synchronized void objectInit(final ObjectInfo[] objects, com.zeroc.Ice.Current current)
{
if(_trace)
{
@@ -41,68 +41,40 @@ class ObjectObserverI extends _ObjectObserverDisp
}
}
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _coordinator.objectInit(objects);
- }
- });
+ SwingUtilities.invokeLater(() -> _coordinator.objectInit(objects));
}
@Override
- public void objectAdded(final ObjectInfo info, Ice.Current current)
+ public void objectAdded(final ObjectInfo info, com.zeroc.Ice.Current current)
{
if(_trace)
{
_coordinator.traceObserver("objectAdded for object " + info.proxy.toString());
}
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _coordinator.objectAdded(info);
- }
- });
+ SwingUtilities.invokeLater(() -> _coordinator.objectAdded(info));
}
@Override
- public void objectUpdated(final ObjectInfo info, Ice.Current current)
+ public void objectUpdated(final ObjectInfo info, com.zeroc.Ice.Current current)
{
if(_trace)
{
_coordinator.traceObserver("objectUpdated for object " + info.proxy.toString());
}
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _coordinator.objectUpdated(info);
- }
- });
+ SwingUtilities.invokeLater(() -> _coordinator.objectUpdated(info));
}
@Override
- public void objectRemoved(final Ice.Identity id, Ice.Current current)
+ public void objectRemoved(final com.zeroc.Ice.Identity id, com.zeroc.Ice.Current current)
{
if(_trace)
{
- _coordinator.traceObserver("objectRemoved for object " + Ice.Util.identityToString(id));
+ _coordinator.traceObserver("objectRemoved for object " + com.zeroc.Ice.Util.identityToString(id));
}
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _coordinator.objectRemoved(id);
- }
- });
+ SwingUtilities.invokeLater(() -> _coordinator.objectRemoved(id));
}
private final Coordinator _coordinator;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/RegistryObserverI.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/RegistryObserverI.java
index b07304a204b..24ddb706483 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/RegistryObserverI.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/RegistryObserverI.java
@@ -7,12 +7,12 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
import javax.swing.SwingUtilities;
-import IceGrid.*;
+import com.zeroc.IceGrid.*;
-class RegistryObserverI extends _RegistryObserverDisp
+class RegistryObserverI implements RegistryObserver
{
RegistryObserverI(Coordinator coordinator)
{
@@ -21,7 +21,7 @@ class RegistryObserverI extends _RegistryObserverDisp
}
@Override
- public void registryInit(final RegistryInfo[] registryInfos, Ice.Current current)
+ public void registryInit(final RegistryInfo[] registryInfos, com.zeroc.Ice.Current current)
{
if(_trace)
{
@@ -42,53 +42,35 @@ class RegistryObserverI extends _RegistryObserverDisp
}
}
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
+ for(RegistryInfo info : registryInfos)
{
- for(RegistryInfo info : registryInfos)
- {
- _coordinator.registryUp(info);
- }
+ _coordinator.registryUp(info);
}
});
}
@Override
- public void registryUp(final RegistryInfo registryInfo, Ice.Current current)
+ public void registryUp(final RegistryInfo registryInfo, com.zeroc.Ice.Current current)
{
if(_trace)
{
_coordinator.traceObserver("registryUp for registry " + registryInfo.name);
}
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _coordinator.registryUp(registryInfo);
- }
- });
+ SwingUtilities.invokeLater(() -> _coordinator.registryUp(registryInfo));
}
@Override
- public void registryDown(final String registryName, Ice.Current current)
+ public void registryDown(final String registryName, com.zeroc.Ice.Current current)
{
if(_trace)
{
_coordinator.traceObserver("registryDown for registry " + registryName);
}
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _coordinator.registryDown(registryName);
- }
- });
+ SwingUtilities.invokeLater(() -> _coordinator.registryDown(registryName));
}
private final Coordinator _coordinator;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/SessionKeeper.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/SessionKeeper.java
index fa178e40271..53d4f2a83ca 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/SessionKeeper.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/SessionKeeper.java
@@ -7,7 +7,8 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
+
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.event.DocumentListener;
@@ -58,13 +59,11 @@ import java.security.MessageDigest;
import javax.naming.ldap.LdapName;
import javax.naming.ldap.Rdn;
-import IceLocatorDiscovery.LookupPrx;
-import IceLocatorDiscovery.LookupPrxHelper;
-import IceLocatorDiscovery.LookupReplyPrx;
-import IceLocatorDiscovery.LookupReplyPrxHelper;
-import IceLocatorDiscovery._LookupReplyDisp;
+import com.zeroc.IceLocatorDiscovery.LookupPrx;
+import com.zeroc.IceLocatorDiscovery.LookupReplyPrx;
+import com.zeroc.IceLocatorDiscovery.LookupReply;
-import IceGrid.*;
+import com.zeroc.IceGrid.*;
//
// The SessionKeeper is responsible for establishing sessions (one at a time)
@@ -88,24 +87,20 @@ public class SessionKeeper
{
_admin = _session.getAdmin();
}
- catch(final Ice.LocalException e)
+ catch(final com.zeroc.Ice.LocalException e)
{
while(true)
{
try
{
- SwingUtilities.invokeAndWait(new Runnable()
+ SwingUtilities.invokeAndWait(() ->
{
- @Override
- public void run()
- {
- logout(true);
- JOptionPane.showMessageDialog(
- parent,
- "Could not retrieve Admin proxy: " + e.toString(),
- "Login failed",
- JOptionPane.ERROR_MESSAGE);
- }
+ logout(true);
+ JOptionPane.showMessageDialog(
+ parent,
+ "Could not retrieve Admin proxy: " + e.toString(),
+ "Login failed",
+ JOptionPane.ERROR_MESSAGE);
});
break;
}
@@ -125,14 +120,14 @@ public class SessionKeeper
{
if(!routed)
{
- Ice.ObjectPrx adminCallbackTemplate = _session.getAdminCallbackTemplate();
+ com.zeroc.Ice.ObjectPrx adminCallbackTemplate = _session.getAdminCallbackTemplate();
if(adminCallbackTemplate != null)
{
_adminCallbackCategory = adminCallbackTemplate.ice_getIdentity().category;
String publishedEndpoints = null;
- for(Ice.Endpoint endpoint : adminCallbackTemplate.ice_getEndpoints())
+ for(com.zeroc.Ice.Endpoint endpoint : adminCallbackTemplate.ice_getEndpoints())
{
String endpointString = endpoint.toString();
if(publishedEndpoints == null)
@@ -150,24 +145,20 @@ public class SessionKeeper
}
_serverAdminCategory = _admin.getServerAdminCategory();
}
- catch(final Ice.OperationNotExistException e)
+ catch(final com.zeroc.Ice.OperationNotExistException e)
{
while(true)
{
try
{
- SwingUtilities.invokeAndWait(new Runnable()
+ SwingUtilities.invokeAndWait(() ->
{
- @Override
- public void run()
- {
- logout(true);
- JOptionPane.showMessageDialog(
- parent,
- "This version of IceGrid Admin requires an IceGrid Registry version 3.3",
- "Login failed: Version Mismatch",
- JOptionPane.ERROR_MESSAGE);
- }
+ logout(true);
+ JOptionPane.showMessageDialog(
+ parent,
+ "This version of IceGrid Admin requires an IceGrid Registry version 3.3",
+ "Login failed: Version Mismatch",
+ JOptionPane.ERROR_MESSAGE);
});
break;
}
@@ -181,27 +172,22 @@ public class SessionKeeper
}
}
throw e;
-
}
- catch(final Ice.LocalException e)
+ catch(final com.zeroc.Ice.LocalException e)
{
while(true)
{
try
{
- SwingUtilities.invokeAndWait(new Runnable()
+ SwingUtilities.invokeAndWait(() ->
{
- @Override
- public void run()
- {
- logout(true);
- JOptionPane.showMessageDialog(
- parent,
- "Could not retrieve admin callback template or server admin category: " +
- e.toString(),
- "Login failed",
- JOptionPane.ERROR_MESSAGE);
- }
+ logout(true);
+ JOptionPane.showMessageDialog(
+ parent,
+ "Could not retrieve admin callback template or server admin category: " +
+ e.toString(),
+ "Login failed",
+ JOptionPane.ERROR_MESSAGE);
});
break;
}
@@ -220,96 +206,58 @@ public class SessionKeeper
if(acmTimeout > 0)
{
_session.ice_getConnection().setACM(
- new Ice.IntOptional(acmTimeout),
+ java.util.OptionalInt.of(acmTimeout),
null,
- new Ice.Optional<Ice.ACMHeartbeat>(Ice.ACMHeartbeat.HeartbeatAlways));
+ java.util.Optional.of(com.zeroc.Ice.ACMHeartbeat.HeartbeatAlways));
- _session.ice_getConnection().setCloseCallback(
- new Ice.CloseCallback()
+ _session.ice_getConnection().setCloseCallback(con ->
{
- @Override
- public void
- closed(Ice.Connection con)
+ try
{
- try
- {
- con.getInfo(); // This throws when the connection is closed.
- assert(false);
- }
- catch(final Ice.LocalException ex)
- {
- SwingUtilities.invokeLater(
- new Runnable()
- {
- @Override
- public void run()
- {
- sessionLost("Failed to contact the IceGrid registry: " + ex.toString());
- }
- });
- }
+ con.getInfo(); // This throws when the connection is closed.
+ assert(false);
+ }
+ catch(final com.zeroc.Ice.LocalException ex)
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ sessionLost("Failed to contact the IceGrid registry: " + ex.toString());
+ });
}
});
}
else
{
- _keepAliveFuture = _coordinator.getExecutor().scheduleAtFixedRate(new Runnable() {
- private void error(final Exception e)
+ _keepAliveFuture = _coordinator.getExecutor().scheduleAtFixedRate(() ->
{
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
+ _session.keepAliveAsync().whenComplete((result, ex) ->
{
- sessionLost("Failed to contact the IceGrid registry: " + e.toString());
- }
- });
- }
-
- @Override
- public void run()
- {
- _session.begin_keepAlive(new Callback_AdminSession_keepAlive()
- {
- @Override
- public void
- response()
+ if(ex != null)
{
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- error(ex);
+ SwingUtilities.invokeLater(() ->
+ {
+ sessionLost("Failed to contact the IceGrid registry: " + ex.toString());
+ });
}
});
- }
- }, sessionTimeout / 2, sessionTimeout / 2, java.util.concurrent.TimeUnit.SECONDS);
+ }, sessionTimeout / 2, sessionTimeout / 2, java.util.concurrent.TimeUnit.SECONDS);
}
try
{
registerObservers();
}
- catch(final Ice.LocalException e)
+ catch(final com.zeroc.Ice.LocalException e)
{
while(true)
{
try
{
- SwingUtilities.invokeAndWait(new Runnable()
+ SwingUtilities.invokeAndWait(() ->
{
- @Override
- public void run()
- {
- logout(true);
- JOptionPane.showMessageDialog(parent,
- "Could not register observers: "
- + e.toString(),
- "Login failed",
- JOptionPane.ERROR_MESSAGE);
- }
+ logout(true);
+ JOptionPane.showMessageDialog(parent, "Could not register observers: " + e.toString(),
+ "Login failed", JOptionPane.ERROR_MESSAGE);
});
break;
}
@@ -362,18 +310,17 @@ public class SessionKeeper
// since the Admin object provided by the registry is a well-known object
// (indirect, locator-dependent).
//
- Ice.ObjectAdapter adminRouterAdapter = _coordinator.getCommunicator().
+ com.zeroc.Ice.ObjectAdapter adminRouterAdapter = _coordinator.getCommunicator().
createObjectAdapterWithEndpoints("IceGrid.AdminRouter", "tcp -h localhost");
- _routedAdmin = AdminPrxHelper.uncheckedCast(
- adminRouterAdapter.addWithUUID(new AdminRouter(_admin)));
+ _routedAdmin = AdminPrx.uncheckedCast(adminRouterAdapter.addWithUUID(new AdminRouter(_admin)));
adminRouterAdapter.activate();
}
return _routedAdmin;
}
- Ice.ObjectPrx addCallback(Ice.Object servant, String name, String facet)
+ com.zeroc.Ice.ObjectPrx addCallback(com.zeroc.Ice.Object servant, String name, String facet)
{
if(_adminCallbackCategory == null)
{
@@ -381,11 +328,11 @@ public class SessionKeeper
}
else
{
- return _adapter.addFacet(servant, new Ice.Identity(name, _adminCallbackCategory), facet);
+ return _adapter.addFacet(servant, new com.zeroc.Ice.Identity(name, _adminCallbackCategory), facet);
}
}
- Ice.ObjectPrx retrieveCallback(String name, String facet)
+ com.zeroc.Ice.ObjectPrx retrieveCallback(String name, String facet)
{
if(_adminCallbackCategory == null)
{
@@ -393,7 +340,7 @@ public class SessionKeeper
}
else
{
- Ice.Identity ident = new Ice.Identity(name, _adminCallbackCategory);
+ com.zeroc.Ice.Identity ident = new com.zeroc.Ice.Identity(name, _adminCallbackCategory);
if(_adapter.findFacet(ident, facet) == null)
{
return null;
@@ -405,7 +352,7 @@ public class SessionKeeper
}
}
- Ice.Object removeCallback(String name, String facet)
+ com.zeroc.Ice.Object removeCallback(String name, String facet)
{
if(_adminCallbackCategory == null || _adapter == null)
{
@@ -413,7 +360,7 @@ public class SessionKeeper
}
else
{
- return _adapter.removeFacet(new Ice.Identity(name, _adminCallbackCategory), facet);
+ return _adapter.removeFacet(new com.zeroc.Ice.Identity(name, _adminCallbackCategory), facet);
}
}
@@ -459,7 +406,7 @@ public class SessionKeeper
}
else
{
- Glacier2.RouterPrx router = Glacier2.RouterPrxHelper.uncheckedCast(
+ com.zeroc.Glacier2.RouterPrx router = com.zeroc.Glacier2.RouterPrx.uncheckedCast(
_coordinator.getCommunicator().getDefaultRouter());
category = router.getCategoryForClient();
_adminCallbackCategory = category;
@@ -486,66 +433,57 @@ public class SessionKeeper
{
try
{
- SwingUtilities.invokeAndWait(new Runnable()
+ SwingUtilities.invokeAndWait(() ->
{
- @Override
- public void run()
- {
- ApplicationObserverI applicationObserverServant = new ApplicationObserverI(
- _admin.ice_getIdentity().category, _coordinator);
-
- ApplicationObserverPrx applicationObserver =
- ApplicationObserverPrxHelper.uncheckedCast(
- _adapter.add(
- applicationObserverServant, _applicationObserverIdentity));
-
- AdapterObserverPrx adapterObserver =
- AdapterObserverPrxHelper.uncheckedCast(
- _adapter.add(
- new AdapterObserverI(_coordinator), _adapterObserverIdentity));
-
- ObjectObserverPrx objectObserver =
- ObjectObserverPrxHelper.uncheckedCast(
- _adapter.add(
- new ObjectObserverI(_coordinator), _objectObserverIdentity));
-
- RegistryObserverPrx registryObserver =
- RegistryObserverPrxHelper.uncheckedCast(
- _adapter.add(
- new RegistryObserverI(_coordinator), _registryObserverIdentity));
-
- NodeObserverPrx nodeObserver =
- NodeObserverPrxHelper.uncheckedCast(
- _adapter.add(
- new NodeObserverI(_coordinator), _nodeObserverIdentity));
+ ApplicationObserverI applicationObserverServant = new ApplicationObserverI(
+ _admin.ice_getIdentity().category, _coordinator);
- try
+ ApplicationObserverPrx applicationObserver =
+ ApplicationObserverPrx.uncheckedCast(
+ _adapter.add(applicationObserverServant, _applicationObserverIdentity));
+
+ AdapterObserverPrx adapterObserver =
+ AdapterObserverPrx.uncheckedCast(
+ _adapter.add(new AdapterObserverI(_coordinator), _adapterObserverIdentity));
+
+ ObjectObserverPrx objectObserver =
+ ObjectObserverPrx.uncheckedCast(
+ _adapter.add(new ObjectObserverI(_coordinator), _objectObserverIdentity));
+
+ RegistryObserverPrx registryObserver =
+ RegistryObserverPrx.uncheckedCast(
+ _adapter.add(new RegistryObserverI(_coordinator), _registryObserverIdentity));
+
+ NodeObserverPrx nodeObserver =
+ NodeObserverPrx.uncheckedCast(
+ _adapter.add(new NodeObserverI(_coordinator), _nodeObserverIdentity));
+
+ try
+ {
+ if(_routed)
{
- if(_routed)
- {
- _session.setObservers(registryObserver,
- nodeObserver,
- applicationObserver,
- adapterObserver,
- objectObserver);
- }
- else
- {
- _session.setObserversByIdentity(
- _registryObserverIdentity,
- _nodeObserverIdentity,
- _applicationObserverIdentity,
- _adapterObserverIdentity,
- _objectObserverIdentity);
- }
+ _session.setObservers(registryObserver,
+ nodeObserver,
+ applicationObserver,
+ adapterObserver,
+ objectObserver);
}
- catch(ObserverAlreadyRegisteredException ex)
+ else
{
- assert false; // We use UUIDs for the observer identities.
+ _session.setObserversByIdentity(
+ _registryObserverIdentity,
+ _nodeObserverIdentity,
+ _applicationObserverIdentity,
+ _adapterObserverIdentity,
+ _objectObserverIdentity);
}
-
- applicationObserverServant.waitForInit();
}
+ catch(ObserverAlreadyRegisteredException ex)
+ {
+ assert false; // We use UUIDs for the observer identities.
+ }
+
+ applicationObserverServant.waitForInit();
});
break;
}
@@ -565,16 +503,16 @@ public class SessionKeeper
private java.util.concurrent.Future<?> _keepAliveFuture;
- private Ice.ObjectAdapter _adapter;
+ private com.zeroc.Ice.ObjectAdapter _adapter;
private AdminPrx _admin;
private String _serverAdminCategory;
private String _adminCallbackCategory;
private AdminPrx _routedAdmin;
- private Ice.Identity _applicationObserverIdentity = new Ice.Identity();
- private Ice.Identity _adapterObserverIdentity = new Ice.Identity();
- private Ice.Identity _objectObserverIdentity = new Ice.Identity();
- private Ice.Identity _registryObserverIdentity = new Ice.Identity();
- private Ice.Identity _nodeObserverIdentity = new Ice.Identity();
+ private com.zeroc.Ice.Identity _applicationObserverIdentity = new com.zeroc.Ice.Identity();
+ private com.zeroc.Ice.Identity _adapterObserverIdentity = new com.zeroc.Ice.Identity();
+ private com.zeroc.Ice.Identity _objectObserverIdentity = new com.zeroc.Ice.Identity();
+ private com.zeroc.Ice.Identity _registryObserverIdentity = new com.zeroc.Ice.Identity();
+ private com.zeroc.Ice.Identity _nodeObserverIdentity = new com.zeroc.Ice.Identity();
}
private static JScrollPane createStrippedScrollPane(Component component)
@@ -1086,7 +1024,6 @@ public class SessionKeeper
private char[] _keyPassword;
private boolean _storeKeyPassword;
private boolean _isDefault;
-
}
@@ -1141,19 +1078,15 @@ public class SessionKeeper
{
if(_discoveryAdapter != null)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
+ if(_directDiscoveryEndpointModel.size() > 0)
{
- if(_directDiscoveryEndpointModel.size() > 0)
- {
- _discoveryStatus.setText("");
- }
- else
- {
- _discoveryStatus.setText("No registries found");
- }
+ _discoveryStatus.setText("");
+ }
+ else
+ {
+ _discoveryStatus.setText("No registries found");
}
});
_discoveryAdapter.destroy();
@@ -1164,45 +1097,41 @@ public class SessionKeeper
public void refreshDiscoveryEndpoints()
{
- final Ice.Communicator communicator = _coordinator.getCommunicator();
+ final com.zeroc.Ice.Communicator communicator = _coordinator.getCommunicator();
if(_discoveryLookupReply == null)
{
- _discoveryLookupReply = new _LookupReplyDisp()
+ _discoveryLookupReply = new LookupReply()
{
@Override
- public void foundLocator(final Ice.LocatorPrx locator, Ice.Current curr)
+ public void foundLocator(final com.zeroc.Ice.LocatorPrx locator, com.zeroc.Ice.Current curr)
{
- SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(() ->
{
- @Override
- public void run()
+ try
{
- try
+ com.zeroc.Ice.Endpoint[] endps = locator.ice_getEndpoints();
+ for(com.zeroc.Ice.Endpoint e : endps)
{
- Ice.Endpoint[] endps = locator.ice_getEndpoints();
- for(Ice.Endpoint e : endps)
- {
- Ice.LocatorPrx prx = Ice.LocatorPrxHelper.uncheckedCast(
- communicator.stringToProxy(
- Ice.Util.identityToString(locator.ice_getIdentity()) +
- ":" + e.toString()));
-
- if(_directDiscoveryEndpointModel.indexOf(prx) == -1)
- {
- _directDiscoveryEndpointModel.addElement(prx);
- }
- }
+ com.zeroc.Ice.LocatorPrx prx = com.zeroc.Ice.LocatorPrx.uncheckedCast(
+ communicator.stringToProxy(
+ com.zeroc.Ice.Util.identityToString(locator.ice_getIdentity()) +
+ ":" + e.toString()));
- if(_directDiscoveryEndpointModel.size() > 0 &&
- _directDiscoveryEndpointList.getSelectedIndex() == -1)
+ if(_directDiscoveryEndpointModel.indexOf(prx) == -1)
{
- _directDiscoveryEndpointList.setSelectedIndex(0);
+ _directDiscoveryEndpointModel.addElement(prx);
}
}
- catch(Ice.LocalException ex)
+
+ if(_directDiscoveryEndpointModel.size() > 0 &&
+ _directDiscoveryEndpointList.getSelectedIndex() == -1)
{
+ _directDiscoveryEndpointList.setSelectedIndex(0);
}
}
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ }
});
}
};
@@ -1221,7 +1150,7 @@ public class SessionKeeper
}
}
- final Ice.Properties properties = communicator.getProperties();
+ final com.zeroc.Ice.Properties properties = communicator.getProperties();
final String intf = properties.getProperty("IceGridAdmin.Discovery.Interface");
String lookupEndpoints = properties.getProperty("IceGridAdmin.Discovery.Lookup");
String address;
@@ -1250,14 +1179,11 @@ public class SessionKeeper
try
{
- final LookupPrx lookupPrx = LookupPrxHelper.uncheckedCast(
+ final LookupPrx lookupPrx = LookupPrx.uncheckedCast(
communicator.stringToProxy("IceLocatorDiscovery/Lookup -d:" +
lookupEndpoints).ice_collocationOptimized(false).ice_router(null));
- new Thread(new Runnable()
- {
- @Override
- public void run()
+ new Thread(() ->
{
synchronized(SessionKeeper.this)
{
@@ -1289,28 +1215,23 @@ public class SessionKeeper
_discoveryAdapter = communicator.createObjectAdapter(
"IceGridAdmin.Discovery.Reply");
_discoveryAdapter.activate();
- _discoveryReplyPrx =
- LookupReplyPrxHelper.uncheckedCast(
- _discoveryAdapter.addWithUUID(_discoveryLookupReply).ice_datagram());
+ _discoveryReplyPrx = LookupReplyPrx.uncheckedCast(
+ _discoveryAdapter.addWithUUID(_discoveryLookupReply).ice_datagram());
}
lookupPrx.findLocator("", _discoveryReplyPrx);
}
- catch(final Ice.LocalException ex)
+ catch(final com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
destroyDisconveryAdapter();
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
+ SwingUtilities.invokeLater(() ->
{
JOptionPane.showMessageDialog(ConnectionWizardDialog.this,
ex.toString(),
"Error while looking up locator endpoints",
JOptionPane.ERROR_MESSAGE);
- }
- });
+ });
}
//
@@ -1328,15 +1249,12 @@ public class SessionKeeper
};
new java.util.Timer().schedule(_discoveryFinishTask, 2000);
}
- }
- }).start();
+ }).start();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
- JOptionPane.showMessageDialog(ConnectionWizardDialog.this,
- ex.toString(),
- "Error while looking up locator endpoints",
- JOptionPane.ERROR_MESSAGE);
+ JOptionPane.showMessageDialog(ConnectionWizardDialog.this, ex.toString(),
+ "Error while looking up locator endpoints", JOptionPane.ERROR_MESSAGE);
}
}
@@ -1394,8 +1312,8 @@ public class SessionKeeper
// Direct Discovery Endpoint List
{
- _directDiscoveryEndpointModel = new DefaultListModel<Ice.LocatorPrx>();
- _directDiscoveryEndpointList = new JList<Ice.LocatorPrx>(_directDiscoveryEndpointModel);
+ _directDiscoveryEndpointModel = new DefaultListModel<>();
+ _directDiscoveryEndpointList = new JList<>(_directDiscoveryEndpointModel);
_directDiscoveryEndpointList.setVisibleRowCount(7);
_directDiscoveryEndpointList.addMouseListener(
new MouseAdapter()
@@ -1407,7 +1325,7 @@ public class SessionKeeper
{
Object obj = _directDiscoveryEndpointModel.getElementAt(
_directDiscoveryEndpointList.locationToIndex(e.getPoint()));
- if(obj != null && obj instanceof Ice.LocatorPrx)
+ if(obj != null && obj instanceof com.zeroc.Ice.LocatorPrx)
{
_nextButton.doClick(0);
}
@@ -1427,15 +1345,15 @@ public class SessionKeeper
ButtonGroup group = new ButtonGroup();
_directDiscoveryDiscoveredEndpoint = new JRadioButton(new AbstractAction("Discovered Endpoints")
{
- @Override
- public void actionPerformed(ActionEvent e)
- {
- _directDiscoveryEndpointList.setEnabled(true);
- _discoveryStatus.setEnabled(true);
- _discoveryRefresh.setEnabled(true);
- validatePanel();
- refreshDiscoveryEndpoints();
- }
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ _directDiscoveryEndpointList.setEnabled(true);
+ _discoveryStatus.setEnabled(true);
+ _discoveryRefresh.setEnabled(true);
+ validatePanel();
+ refreshDiscoveryEndpoints();
+ }
});
_directDiscoveryDiscoveredEndpoint.setSelected(true);
group.add(_directDiscoveryDiscoveredEndpoint);
@@ -1634,7 +1552,7 @@ public class SessionKeeper
});
builder.append("<html><b>Port number:</b></html>", _directDefaultEndpointPort);
builder.append("", new JLabel("<html>The port number the IceGrid registry listens on; " +
- "leave empty to use the default <br/>IceGrid registry port number.</html>"));
+ "leave empty to use the default <br/>IceGrid registry port number.</html>"));
builder.nextLine();
ButtonGroup group = new ButtonGroup();
_directDefaultEndpointTCP = new JRadioButton(new AbstractAction("TCP")
@@ -1657,8 +1575,8 @@ public class SessionKeeper
_directDefaultEndpointTCP.setSelected(true);
JPanel protocolOptionPane;
{
- DefaultFormBuilder protocolBuilder = new DefaultFormBuilder(
- new FormLayout("pref, 2dlu, pref", "pref"));
+ DefaultFormBuilder protocolBuilder =
+ new DefaultFormBuilder(new FormLayout("pref, 2dlu, pref", "pref"));
protocolBuilder.append(_directDefaultEndpointTCP,_directDefaultEndpointSSL);
protocolOptionPane = protocolBuilder.getPanel();
}
@@ -1683,12 +1601,14 @@ public class SessionKeeper
validatePanel();
_routedDefaultEndpointHost.requestFocusInWindow();
}
+
@Override
public void removeUpdate(DocumentEvent e)
{
validatePanel();
_routedDefaultEndpointHost.requestFocusInWindow();
}
+
@Override
public void insertUpdate(DocumentEvent e)
{
@@ -1710,12 +1630,14 @@ public class SessionKeeper
validatePanel();
_routedDefaultEndpointPort.requestFocusInWindow();
}
+
@Override
public void removeUpdate(DocumentEvent e)
{
validatePanel();
_routedDefaultEndpointPort.requestFocusInWindow();
}
+
@Override
public void insertUpdate(DocumentEvent e)
{
@@ -1725,7 +1647,7 @@ public class SessionKeeper
});
builder.append("<html><b>Port:</b></html>", _routedDefaultEndpointPort);
builder.append("", new JLabel("<html>The port number the Glacier2 router listens on; " +
- "leave empty to use the default <br/>Glacier2 router port number.</html>"));
+ "leave empty to use the default <br/>Glacier2 router port number.</html>"));
builder.nextLine();
ButtonGroup group = new ButtonGroup();
@@ -1751,7 +1673,7 @@ public class SessionKeeper
JPanel protocolOptionPane;
{
DefaultFormBuilder protocolBuilder =
- new DefaultFormBuilder(new FormLayout("pref, 2dlu, pref", "pref"));
+ new DefaultFormBuilder(new FormLayout("pref, 2dlu, pref", "pref"));
protocolBuilder.append(_routedDefaultEndpointTCP,_routedDefaultEndpointSSL);
protocolOptionPane = protocolBuilder.getPanel();
}
@@ -1775,11 +1697,13 @@ public class SessionKeeper
{
validatePanel();
}
+
@Override
public void removeUpdate(DocumentEvent e)
{
validatePanel();
}
+
@Override
public void insertUpdate(DocumentEvent e)
{
@@ -1810,11 +1734,13 @@ public class SessionKeeper
{
validatePanel();
}
+
@Override
public void removeUpdate(DocumentEvent e)
{
validatePanel();
}
+
@Override
public void insertUpdate(DocumentEvent e)
{
@@ -1861,7 +1787,9 @@ public class SessionKeeper
});
group.add(_x509CertificateYesButton);
- builder.append(new JLabel("<html><b>Do you want to provide an X.509 certificate for SSL authentication?</b></html>"));
+ builder.append(
+ new JLabel(
+ "<html><b>Do you want to provide an X.509 certificate for SSL authentication?</b></html>"));
builder.append(_x509CertificateNoButton);
builder.append(_x509CertificateYesButton);
@@ -1871,7 +1799,7 @@ public class SessionKeeper
// Direct X509 credentials panel
{
_directCertificateAliases = new JComboBox();
- _directCertificateAliases.addActionListener (new ActionListener ()
+ _directCertificateAliases.addActionListener(new ActionListener ()
{
@Override
public void actionPerformed(ActionEvent e)
@@ -1913,12 +1841,14 @@ public class SessionKeeper
builder.rowGroupingEnabled(true);
builder.append("<html><b>Alias:</b></html>", alias);
- builder.append("", new JLabel("<html><p>Your X.509 certificate for SSL authentication.</p></html>"));
+ builder.append("", new JLabel(
+ "<html><p>Your X.509 certificate for SSL authentication.</p></html>"));
_directCertificatePassword = new JPasswordField();
builder.append("<html><b>Password:</b></html>", _directCertificatePassword);
- builder.append("", new JLabel("<html>Enter your certificate password above to save it with this connection; otherwise<br>" +
- "you will need to enter this password each time you connect.</p></html>"));
+ builder.append("", new JLabel("<html>Enter your certificate password above to save it " +
+ "with this connection; otherwise<br>you will need to enter " +
+ "this password each time you connect.</p></html>"));
panel = builder.getPanel();
}
@@ -1977,12 +1907,14 @@ public class SessionKeeper
builder.rowGroupingEnabled(true);
builder.append("<html><b>Alias:</b></html>", alias);
- builder.append("", new JLabel("<html><p>Your X.509 certificate for SSL authentication.</p></html>"));
+ builder.append("", new JLabel(
+ "<html><p>Your X.509 certificate for SSL authentication.</p></html>"));
_routedCertificatePassword = new JPasswordField();
builder.append("<html><b>Password:</b></html>", _routedCertificatePassword);
- builder.append("", new JLabel("<html>Enter your certificate password above to save it with this connection; otherwise<br>" +
- "you will need to enter this password each time you connect.</p></html>"));
+ builder.append("", new JLabel("<html>Enter your certificate password above to save it " +
+ "with this connection; otherwise<br>you will need to enter " +
+ "this password each time you connect.</p></html>"));
panel = builder.getPanel();
}
@@ -2049,12 +1981,14 @@ public class SessionKeeper
validatePanel();
_directUsername.requestFocusInWindow();
}
+
@Override
public void removeUpdate(DocumentEvent e)
{
validatePanel();
_directUsername.requestFocusInWindow();
}
+
@Override
public void insertUpdate(DocumentEvent e)
{
@@ -2066,8 +2000,9 @@ public class SessionKeeper
builder.append("<html><b>Username:</b></html>", _directUsername);
_directPassword = new JPasswordField();
builder.append("<html><b>Password:</b></html>", _directPassword);
- builder.append("", new JLabel("<html>Enter your password above to save it with this connection; otherwise you will<br>" +
- "need to enter your password each time you connect.</p></html>"));
+ builder.append("", new JLabel("<html>Enter your password above to save it with this connection; " +
+ "otherwise you will<br>need to enter your password each time " +
+ "you connect.</p></html>"));
_cardPanel.add(builder.getPanel(), WizardStep.DirectUsernamePasswordCredentialsStep.toString());
}
@@ -2088,12 +2023,14 @@ public class SessionKeeper
validatePanel();
_routedUsername.requestFocusInWindow();
}
+
@Override
public void removeUpdate(DocumentEvent e)
{
validatePanel();
_routedUsername.requestFocusInWindow();
}
+
@Override
public void insertUpdate(DocumentEvent e)
{
@@ -2105,8 +2042,9 @@ public class SessionKeeper
builder.append("<html><b>Username:</b></html>", _routedUsername);
_routedPassword = new JPasswordField();
builder.append("<html><b>Password:</b></html>", _routedPassword);
- builder.append("", new JLabel("<html>Enter your Glacier2 password above to save it with this connection; otherwise<br>" +
- "you will need to enter your password each time you connect.</p></html>"));
+ builder.append("", new JLabel("<html>Enter your Glacier2 password above to save it with this " +
+ "connection; otherwise<br>you will need to enter your password " +
+ "each time you connect.</p></html>"));
_cardPanel.add(builder.getPanel(), WizardStep.RoutedUsernamePasswordCredentialsStep.toString());
}
@@ -2181,7 +2119,7 @@ public class SessionKeeper
}
else
{
- Ice.LocatorPrx locator = _directDiscoveryEndpointList.getSelectedValue();
+ com.zeroc.Ice.LocatorPrx locator = _directDiscoveryEndpointList.getSelectedValue();
_directInstanceName.setText(locator.ice_getIdentity().category);
_directCustomEndpointValue.setText(locator.ice_getEndpoints()[0].toString());
_directCustomEndpoints.setSelected(true);
@@ -2284,11 +2222,11 @@ public class SessionKeeper
{
try
{
- Ice.Identity id = new Ice.Identity();
+ com.zeroc.Ice.Identity id = new com.zeroc.Ice.Identity();
id.name = "Locator";
id.category = _directInstanceName.getText();
StringBuilder endpoint = new StringBuilder();
- endpoint.append(Ice.Util.identityToString(id));
+ endpoint.append(com.zeroc.Ice.Util.identityToString(id));
endpoint.append(":");
endpoint.append(_directCustomEndpointValue.getText());
_coordinator.getCommunicator().stringToProxy(endpoint.toString());
@@ -2300,11 +2238,11 @@ public class SessionKeeper
else
{
_cardLayout.show(_cardPanel,
- WizardStep.DirectUsernamePasswordCredentialsStep.toString());
+ WizardStep.DirectUsernamePasswordCredentialsStep.toString());
_wizardSteps.push(WizardStep.DirectUsernamePasswordCredentialsStep);
}
}
- catch(Ice.EndpointParseException ex)
+ catch(com.zeroc.Ice.EndpointParseException ex)
{
JOptionPane.showMessageDialog(
ConnectionWizardDialog.this,
@@ -2313,7 +2251,7 @@ public class SessionKeeper
JOptionPane.ERROR_MESSAGE);
return;
}
- catch(Ice.ProxyParseException ex)
+ catch(com.zeroc.Ice.ProxyParseException ex)
{
JOptionPane.showMessageDialog(
ConnectionWizardDialog.this,
@@ -2341,11 +2279,11 @@ public class SessionKeeper
{
try
{
- Ice.Identity id = new Ice.Identity();
+ com.zeroc.Ice.Identity id = new com.zeroc.Ice.Identity();
id.name = "router";
id.category = _routedInstanceName.getText();
StringBuilder endpoint = new StringBuilder();
- endpoint.append(Ice.Util.identityToString(id));
+ endpoint.append(com.zeroc.Ice.Util.identityToString(id));
endpoint.append(":");
endpoint.append(_routedCustomEndpointValue.getText());
_coordinator.getCommunicator().stringToProxy(endpoint.toString());
@@ -2361,7 +2299,7 @@ public class SessionKeeper
_wizardSteps.push(WizardStep.RoutedUsernamePasswordCredentialsStep);
}
}
- catch(Ice.EndpointParseException ex)
+ catch(com.zeroc.Ice.EndpointParseException ex)
{
JOptionPane.showMessageDialog(
ConnectionWizardDialog.this,
@@ -2370,7 +2308,7 @@ public class SessionKeeper
JOptionPane.ERROR_MESSAGE);
return;
}
- catch(Ice.ProxyParseException ex)
+ catch(com.zeroc.Ice.ProxyParseException ex)
{
JOptionPane.showMessageDialog(
ConnectionWizardDialog.this,
@@ -2510,7 +2448,8 @@ public class SessionKeeper
if(_x509CertificateYesButton.isSelected())
{
inf.setAlias((String)_directCertificateAliases.getSelectedItem());
- if(_directCertificatePassword.getPassword() != null && _directCertificatePassword.getPassword().length > 0)
+ if(_directCertificatePassword.getPassword() != null &&
+ _directCertificatePassword.getPassword().length > 0)
{
inf.setKeyPassword(_directCertificatePassword.getPassword());
inf.setStoreKeyPassword(true);
@@ -2658,7 +2597,7 @@ public class SessionKeeper
_cancelButton.setAction(cancelAction);
JComponent buttonBar = new ButtonBarBuilder().addGlue().addButton(_backButton, _nextButton).
- addUnrelatedGap().addButton(_finishButton, _cancelButton).build();
+ addUnrelatedGap().addButton(_finishButton, _cancelButton).build();
buttonBar.setBorder(Borders.DIALOG);
getContentPane().add(buttonBar, java.awt.BorderLayout.SOUTH);
@@ -2680,17 +2619,16 @@ public class SessionKeeper
boolean lastStep = false; // No next step
switch(step)
{
-
case DirectDiscoveryChooseStep:
{
- if(_directDiscoveryManualEndpoint.isSelected())
- {
- _directDiscoveryManualEndpoint.requestFocusInWindow();
- }
- else
- {
- _directDiscoveryEndpointList.requestFocusInWindow();
- }
+ if(_directDiscoveryManualEndpoint.isSelected())
+ {
+ _directDiscoveryManualEndpoint.requestFocusInWindow();
+ }
+ else
+ {
+ _directDiscoveryEndpointList.requestFocusInWindow();
+ }
break;
}
@@ -2775,13 +2713,13 @@ public class SessionKeeper
}
case DirectUsernamePasswordCredentialsStep:
{
- lastStep = true;
+ lastStep = true;
_directUsername.requestFocusInWindow();
break;
}
case RoutedUsernamePasswordCredentialsStep:
{
- lastStep = true;
+ lastStep = true;
_routedUsername.requestFocusInWindow();
break;
}
@@ -2970,7 +2908,6 @@ public class SessionKeeper
}
else // Routed
{
-
if(_routedDefaultEndpoints.isSelected())
{
if(!validateWizardStep(WizardStep.RoutedDefaultEndpointStep))
@@ -3073,7 +3010,6 @@ public class SessionKeeper
_directDefaultEndpoints.setSelected(true);
_directDefaultEndpointHost.setText(_conf.getHost());
-
if(_conf.getSSL())
{
_directDefaultEndpointSSL.setSelected(true);
@@ -3185,11 +3121,11 @@ public class SessionKeeper
}
else
{
- Ice.Identity id = new Ice.Identity();
+ com.zeroc.Ice.Identity id = new com.zeroc.Ice.Identity();
id.name = "Locator";
id.category = _directInstanceName.getText();
StringBuilder endpoint = new StringBuilder();
- endpoint.append(Ice.Util.identityToString(id));
+ endpoint.append(com.zeroc.Ice.Util.identityToString(id));
endpoint.append(":");
endpoint.append(_directCustomEndpointValue.getText());
return containsSecureEndpoints(endpoint.toString());
@@ -3203,11 +3139,11 @@ public class SessionKeeper
}
else
{
- Ice.Identity id = new Ice.Identity();
+ com.zeroc.Ice.Identity id = new com.zeroc.Ice.Identity();
id.name = "router";
id.category = _routedInstanceName.getText();
StringBuilder endpoint = new StringBuilder();
- endpoint.append(Ice.Util.identityToString(id));
+ endpoint.append(com.zeroc.Ice.Util.identityToString(id));
endpoint.append(":");
endpoint.append(_routedCustomEndpointValue.getText());
return containsSecureEndpoints(endpoint.toString());
@@ -3231,16 +3167,16 @@ public class SessionKeeper
private JCheckBox _directConnectToMaster;
// Direct Discovery Endpoints
- private JList<Ice.LocatorPrx> _directDiscoveryEndpointList;
- private DefaultListModel<Ice.LocatorPrx> _directDiscoveryEndpointModel;
+ private JList<com.zeroc.Ice.LocatorPrx> _directDiscoveryEndpointList;
+ private DefaultListModel<com.zeroc.Ice.LocatorPrx> _directDiscoveryEndpointModel;
private JRadioButton _directDiscoveryDiscoveredEndpoint;
private JLabel _discoveryStatus;
private JButton _discoveryRefresh;
private java.util.TimerTask _discoveryFinishTask;
- private Ice.ObjectAdapter _discoveryAdapter;
+ private com.zeroc.Ice.ObjectAdapter _discoveryAdapter;
private LookupReplyPrx _discoveryReplyPrx;
- private _LookupReplyDisp _discoveryLookupReply;
+ private LookupReply _discoveryLookupReply;
private JRadioButton _directDiscoveryManualEndpoint;
// Direct Endpoints panel components
@@ -3304,7 +3240,7 @@ public class SessionKeeper
//
// The wizard steps the user has walked throw.
//
- java.util.Stack<WizardStep> _wizardSteps = new java.util.Stack<WizardStep>();
+ java.util.Stack<WizardStep> _wizardSteps = new java.util.Stack<>();
ConnectionInfo _conf;
private boolean _x509CertificateDefault;
@@ -3314,7 +3250,7 @@ public class SessionKeeper
{
try
{
- for(Ice.Endpoint endpoint : _coordinator.getCommunicator().stringToProxy(str).ice_getEndpoints())
+ for(com.zeroc.Ice.Endpoint endpoint : _coordinator.getCommunicator().stringToProxy(str).ice_getEndpoints())
{
if(endpoint.getInfo().secure())
{
@@ -3322,10 +3258,10 @@ public class SessionKeeper
}
}
}
- catch(Ice.EndpointParseException ex)
+ catch(com.zeroc.Ice.EndpointParseException ex)
{
}
- catch(Ice.ProxyParseException ex)
+ catch(com.zeroc.Ice.ProxyParseException ex)
{
}
return false;
@@ -3395,11 +3331,11 @@ public class SessionKeeper
builder.append(new JLabel("<html><b>Endpoints:</b></html>"),
new JLabel(inf.getEndpoint()));
- Ice.Identity id = new Ice.Identity();
+ com.zeroc.Ice.Identity id = new com.zeroc.Ice.Identity();
id.name = inf.getDirect() ? "Locator" : "router";
id.category = inf.getInstanceName();
StringBuilder endpoint = new StringBuilder();
- endpoint.append(Ice.Util.identityToString(id));
+ endpoint.append(com.zeroc.Ice.Util.identityToString(id));
endpoint.append(":");
endpoint.append(inf.getEndpoint());
ssl = containsSecureEndpoints(endpoint.toString());
@@ -3454,7 +3390,6 @@ public class SessionKeeper
}
}
-
private class ConnectionManagerDialog extends JDialog
{
ConnectionManagerDialog()
@@ -3691,7 +3626,7 @@ public class SessionKeeper
if(e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1)
{
Object obj = _connectionListModel.getElementAt(
- _connectionList.locationToIndex(e.getPoint()));
+ _connectionList.locationToIndex(e.getPoint()));
if(obj != null && obj instanceof ConnectionInfo)
{
ConnectionInfo inf = (ConnectionInfo)obj;
@@ -3907,11 +3842,16 @@ public class SessionKeeper
public class KeyStorePanel extends JPanel
{
+ public class RequestPasswordResult
+ {
+ public char[] password;
+ public boolean accepted;
+ }
- public char[] requestPassword(String title, String label, Ice.BooleanHolder accepted)
+ public RequestPasswordResult requestPassword(String title, String label)
{
+ RequestPasswordResult r = new RequestPasswordResult();
final JPasswordField passwordField = new JPasswordField();
- char[] password = null;
JOptionPane optionPane = new JOptionPane(new JComponent[]{new JLabel(label), passwordField},
JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
JDialog dialog = optionPane.createDialog(KeyStorePanel.this, title);
@@ -3921,14 +3861,7 @@ public class SessionKeeper
@Override
public void componentShown(ComponentEvent e)
{
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- passwordField.requestFocusInWindow();
- }
- });
+ SwingUtilities.invokeLater(() -> passwordField.requestFocusInWindow());
}
});
dialog.setLocationRelativeTo(KeyStorePanel.this);
@@ -3938,14 +3871,14 @@ public class SessionKeeper
if(result != null && result instanceof Integer && ((Integer)result).intValue() == JOptionPane.OK_OPTION)
{
- password = passwordField.getPassword();
- accepted.value = true;
+ r.password = passwordField.getPassword();
+ r.accepted = true;
}
else
{
- accepted.value = false;
+ r.accepted = false;
}
- return password;
+ return r;
}
public KeyStorePanel() throws java.security.KeyStoreException
@@ -4070,7 +4003,7 @@ public class SessionKeeper
chooser.setFileFilter(new FileFilter()
{
- //Accept all directories and *.pem, *.crt files.
+ // Accept all directories and *.pem, *.crt files.
@Override
public boolean accept(File f)
{
@@ -4130,19 +4063,17 @@ public class SessionKeeper
if(pkcs12)
{
KeyStore keyStore = null;
- char[] password = null;
boolean loaded = false;
while(true)
{
try
{
- Ice.BooleanHolder accepted = new Ice.BooleanHolder();
keyStore = KeyStore.getInstance("pkcs12");
- password = requestPassword("KeyStore Password - IceGrid Admin",
- "KeyStore password:", accepted);
- if(accepted.value)
+ RequestPasswordResult r = requestPassword("KeyStore Password - IceGrid Admin",
+ "KeyStore password:");
+ if(r.accepted)
{
- keyStore.load(new FileInputStream(keyFile), password);
+ keyStore.load(new FileInputStream(keyFile), r.password);
loaded = true;
}
break;
@@ -4168,7 +4099,6 @@ public class SessionKeeper
{
try
{
-
importKeyStore(keyStore);
}
catch(java.lang.Exception ex)
@@ -4315,7 +4245,6 @@ public class SessionKeeper
_removeButton.setAction(removeAction);
}
-
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
add(builder.getPanel());
JComponent buttonBar = new ButtonBarBuilder().addButton(_importButton, _viewButton, _removeButton).
@@ -4337,18 +4266,17 @@ public class SessionKeeper
String alias = aliases.nextElement();
if(keyStore.isKeyEntry(alias))
{
- char[] password = null;
+ RequestPasswordResult r = null;
Key key = null;
while(true)
{
try
{
- Ice.BooleanHolder accepted = new Ice.BooleanHolder();
- password = requestPassword("Certificate Password For <" + alias + "> - IceGrid Admin",
- "Certificate password for <" + alias + ">:", accepted);
- if(accepted.value)
+ r = requestPassword("Certificate Password For <" + alias + "> - IceGrid Admin",
+ "Certificate password for <" + alias + ">:");
+ if(r.accepted)
{
- key = keyStore.getKey(alias, password);
+ key = keyStore.getKey(alias, r.password);
}
break;
}
@@ -4391,7 +4319,7 @@ public class SessionKeeper
continue;
}
}
- _keyStore.setKeyEntry(newAlias, key, password, chain);
+ _keyStore.setKeyEntry(newAlias, key, r.password, chain);
}
else if(keyStore.isCertificateEntry(alias))
{
@@ -4442,7 +4370,7 @@ public class SessionKeeper
_keyStore.store(new FileOutputStream(_keyStorePath), new char[]{});
}
- _aliases = new java.util.Vector<String>();
+ _aliases = new java.util.Vector<>();
for(Enumeration<String> e = _keyStore.aliases(); e.hasMoreElements() ;)
{
_aliases.add(e.nextElement());
@@ -4470,7 +4398,7 @@ public class SessionKeeper
//
public static JPanel getSubjectPanel(X509Certificate cert) throws javax.naming.InvalidNameException
{
- java.util.HashMap< String, Object> details = new java.util.HashMap< String, Object>();
+ java.util.HashMap< String, Object> details = new java.util.HashMap<>();
LdapName dn = new LdapName(cert.getSubjectX500Principal().getName());
for(Rdn rdn: dn.getRdns())
{
@@ -4488,7 +4416,7 @@ public class SessionKeeper
if(details.get("CN") != null)
{
builder.append(new JLabel("<html><b>Common Name (CN):</b></html>"),
- new JLabel(details.get("CN").toString()));
+ new JLabel(details.get("CN").toString()));
}
else
{
@@ -4498,7 +4426,7 @@ public class SessionKeeper
if(details.get("O") != null)
{
builder.append(new JLabel("<html><b>Organization (O):</b></html>"),
- new JLabel(details.get("O").toString()));
+ new JLabel(details.get("O").toString()));
}
else
{
@@ -4508,21 +4436,21 @@ public class SessionKeeper
if(details.get("OU") != null)
{
builder.append(new JLabel("<html><b>Organization Unit (OU):</b></html>"),
- new JLabel(details.get("OU").toString()));
+ new JLabel(details.get("OU").toString()));
}
else
{
builder.append(new JLabel("<html><b>Organization Unit (OU):</b></html>"));
}
builder.append(new JLabel("<html><b>Serial Number:</b></html>"),
- new JLabel(cert.getSerialNumber().toString()));
+ new JLabel(cert.getSerialNumber().toString()));
return builder.getPanel();
}
public static JPanel getIssuerPanel(X509Certificate cert) throws javax.naming.InvalidNameException
{
- java.util.HashMap< String, Object> details = new java.util.HashMap< String, Object>();
+ java.util.HashMap< String, Object> details = new java.util.HashMap<>();
LdapName dn = new LdapName(cert.getIssuerX500Principal().getName());
for(Rdn rdn: dn.getRdns())
@@ -4540,7 +4468,7 @@ public class SessionKeeper
if(details.get("CN") != null)
{
builder.append(new JLabel("<html><b>Common Name (CN):</b></html>"),
- new JLabel(details.get("CN").toString()));
+ new JLabel(details.get("CN").toString()));
}
else
{
@@ -4550,7 +4478,7 @@ public class SessionKeeper
if(details.get("O") != null)
{
builder.append(new JLabel("<html><b>Organization (O):</b></html>"),
- new JLabel(details.get("O").toString()));
+ new JLabel(details.get("O").toString()));
}
else
{
@@ -4560,7 +4488,7 @@ public class SessionKeeper
if(details.get("OU") != null)
{
builder.append(new JLabel("<html><b>Organization Unit (OU):</b></html>"),
- new JLabel(details.get("OU").toString()));
+ new JLabel(details.get("OU").toString()));
}
else
{
@@ -4631,7 +4559,6 @@ public class SessionKeeper
new JLabel(sha1Fingerprint));
builder.nextLine();
-
String md5Fingerprint = "";
{
MessageDigest md = MessageDigest.getInstance("MD5");
@@ -4660,8 +4587,7 @@ public class SessionKeeper
}
md5Fingerprint = sb.toString().toUpperCase();
}
- builder.append(new JLabel("<html><b>MD5 Fingerprint:</b></html>"),
- new JLabel(md5Fingerprint));
+ builder.append(new JLabel("<html><b>MD5 Fingerprint:</b></html>"), new JLabel(md5Fingerprint));
builder.nextLine();
return builder.getPanel();
@@ -4925,12 +4851,14 @@ public class SessionKeeper
_storePassword.setEnabled(_password.getPassword() != null &&
_password.getPassword().length > 0);
}
+
@Override
public void removeUpdate(DocumentEvent e)
{
_storePassword.setEnabled(_password.getPassword() != null &&
_password.getPassword().length > 0);
}
+
@Override
public void insertUpdate(DocumentEvent e)
{
@@ -4964,12 +4892,14 @@ public class SessionKeeper
_storeKeyPassword.setEnabled(_keyPassword.getPassword() != null &&
_keyPassword.getPassword().length > 0);
}
+
@Override
public void removeUpdate(DocumentEvent e)
{
_storeKeyPassword.setEnabled(_keyPassword.getPassword() != null &&
_keyPassword.getPassword().length > 0);
}
+
@Override
public void insertUpdate(DocumentEvent e)
{
@@ -5114,12 +5044,14 @@ public class SessionKeeper
_storeKeyPassword.setEnabled(_keyPassword.getPassword() != null &&
_keyPassword.getPassword().length > 0);
}
+
@Override
public void removeUpdate(DocumentEvent e)
{
_storeKeyPassword.setEnabled(_keyPassword.getPassword() != null &&
_keyPassword.getPassword().length > 0);
}
+
@Override
public void insertUpdate(DocumentEvent e)
{
@@ -5175,7 +5107,7 @@ public class SessionKeeper
cancelButton.setAction(cancelAction);
JComponent buttonBar = new ButtonBarBuilder().addGlue().addButton(okButton, cancelButton).
- addGlue().build();
+ addGlue().build();
buttonBar.setBorder(Borders.DIALOG);
contentPane.add(buttonBar);
@@ -5230,7 +5162,7 @@ public class SessionKeeper
{
_replicaName = session.getReplicaName();
}
- catch(Ice.LocalException e)
+ catch(com.zeroc.Ice.LocalException e)
{
logout(true);
JOptionPane.showMessageDialog(
@@ -5256,63 +5188,48 @@ public class SessionKeeper
//
// Create the session in is own thread as it made remote calls
//
- new Thread(new Runnable()
+ new Thread(() ->
{
- @Override
- public void run()
+ try
{
- try
- {
- setSession(new Session(session, sessionTimeout, acmTimeout, !info.getDirect(), parent));
- }
- catch(java.lang.Throwable e)
+ setSession(new Session(session, sessionTimeout, acmTimeout, !info.getDirect(), parent));
+ }
+ catch(java.lang.Throwable e)
+ {
+ SwingUtilities.invokeLater(() -> _connectionManagerDialog.setCursor(oldCursor));
+ return;
+ }
+
+ SwingUtilities.invokeLater(() ->
{
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- _connectionManagerDialog.setCursor(oldCursor);
- }
- });
- return;
- }
+ _connectionManagerDialog.setCursor(oldCursor);
+ _connectionManagerDialog.setVisible(false);
+ if(!info.getStorePassword())
+ {
+ info.setPassword(null);
+ }
+ if(!info.getStoreKeyPassword())
+ {
+ info.setKeyPassword(null);
+ }
- SwingUtilities.invokeLater(new Runnable()
+ if(info.getStorePassword() || info.getStoreKeyPassword())
{
- @Override
- public void run()
+ try
{
- _connectionManagerDialog.setCursor(oldCursor);
- _connectionManagerDialog.setVisible(false);
- if(!info.getStorePassword())
- {
- info.setPassword(null);
- }
- if(!info.getStoreKeyPassword())
- {
- info.setKeyPassword(null);
- }
-
- if(info.getStorePassword() || info.getStoreKeyPassword())
- {
- try
- {
- info.save();
- }
- catch(java.util.prefs.BackingStoreException ex)
- {
- JOptionPane.showMessageDialog(
- _coordinator.getMainFrame(),
- ex.toString(),
- "Error saving connection",
- JOptionPane.ERROR_MESSAGE);
- }
- _connectionManagerDialog.load();
- }
+ info.save();
}
- });
- }
+ catch(java.util.prefs.BackingStoreException ex)
+ {
+ JOptionPane.showMessageDialog(
+ _coordinator.getMainFrame(),
+ ex.toString(),
+ "Error saving connection",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ _connectionManagerDialog.load();
+ }
+ });
}).start();
}
@@ -5358,12 +5275,14 @@ public class SessionKeeper
_storePassword.setEnabled(_password.getPassword() != null &&
_password.getPassword().length > 0);
}
+
@Override
public void removeUpdate(DocumentEvent e)
{
_storePassword.setEnabled(_password.getPassword() != null &&
_password.getPassword().length > 0);
}
+
@Override
public void insertUpdate(DocumentEvent e)
{
@@ -5401,12 +5320,14 @@ public class SessionKeeper
_storeKeyPassword.setEnabled(_keyPassword.getPassword() != null &&
_keyPassword.getPassword().length > 0);
}
+
@Override
public void removeUpdate(DocumentEvent e)
{
_storeKeyPassword.setEnabled(_keyPassword.getPassword() != null &&
_keyPassword.getPassword().length > 0);
}
+
@Override
public void insertUpdate(DocumentEvent e)
{
@@ -5488,7 +5409,7 @@ public class SessionKeeper
});
JComponent buttonBar = new ButtonBarBuilder().addGlue().addButton(okButton, editConnectionButton,
- cancelButton).addGlue().build();
+ cancelButton).addGlue().build();
buttonBar.setBorder(Borders.DIALOG);
contentPane.add(buttonBar);
@@ -5553,17 +5474,17 @@ public class SessionKeeper
return _session == null ? null : _session.getServerAdminCategory();
}
- Ice.ObjectPrx addCallback(Ice.Object servant, String name, String facet)
+ com.zeroc.Ice.ObjectPrx addCallback(com.zeroc.Ice.Object servant, String name, String facet)
{
return _session == null ? null : _session.addCallback(servant, name, facet);
}
- Ice.ObjectPrx retrieveCallback(String name, String facet)
+ com.zeroc.Ice.ObjectPrx retrieveCallback(String name, String facet)
{
return _session == null ? null : _session.retrieveCallback(name, facet);
}
- Ice.Object removeCallback(String name, String facet)
+ com.zeroc.Ice.Object removeCallback(String name, String facet)
{
return _session == null ? null : _session.removeCallback(name, facet);
}
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/SimpleInternalFrame.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/SimpleInternalFrame.java
index 14b0a514911..860e203da78 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/SimpleInternalFrame.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/SimpleInternalFrame.java
@@ -28,7 +28,7 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
import java.awt.*;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/StatusBar.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/StatusBar.java
index 8e994f5f3fe..ed489da0bd2 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/StatusBar.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/StatusBar.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
public interface StatusBar
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Tab.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Tab.java
index 58f70f1d405..6db8dd99fef 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Tab.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Tab.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
public interface Tab
{
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/TreeNodeBase.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/TreeNodeBase.java
index 5c961cc7547..c4e877adf6a 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/TreeNodeBase.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/TreeNodeBase.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
import java.util.Enumeration;
@@ -127,9 +127,7 @@ public class TreeNodeBase implements javax.swing.tree.TreeNode, TreeCellRenderer
public java.util.LinkedList<String> getFullId()
{
- java.util.LinkedList<String> result = _parent == null ?
- new java.util.LinkedList<String>() :
- _parent.getFullId();
+ java.util.LinkedList<String> result = _parent == null ? new java.util.LinkedList<>() : _parent.getFullId();
result.add(_id);
return result;
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Utils.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Utils.java
index 9ae439c5d52..b91cc49f677 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Utils.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Utils.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.awt.Graphics2D;
@@ -20,7 +20,7 @@ import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JComponent;
import javax.swing.KeyStroke;
-import IceGrid.*;
+import com.zeroc.IceGrid.*;
public class Utils
{
@@ -136,19 +136,19 @@ public class Utils
public String toString(Object obj);
}
+ static public class StringifyResult
+ {
+ public String returnValue;
+ public String toolTip;
+ }
+
//
// Stringify helpers
//
- static public String stringify(java.util.Collection<?> col,
- Stringifier stringifier,
- String separator,
- Ice.StringHolder toolTipHolder)
+ static public StringifyResult stringify(java.util.Collection<?> col, Stringifier stringifier, String separator)
{
- String result = "";
- if(toolTipHolder != null)
- {
- toolTipHolder.value = null;
- }
+ StringifyResult r = new StringifyResult();
+ r.returnValue = "";
java.util.Iterator<?> p = col.iterator();
@@ -161,53 +161,43 @@ public class Utils
if(firstElement)
{
firstElement = false;
- if(toolTipHolder != null)
- {
- toolTipHolder.value = "<html>";
- }
+ r.toolTip = "<html>";
}
else
{
- result += separator;
- if(toolTipHolder != null)
- {
- toolTipHolder.value += "<br>";
- }
+ r.returnValue += separator;
+ r.toolTip += "<br>";
}
if(elt.length() == 0)
{
- result += "\"\"";
+ r.returnValue += "\"\"";
}
else if(elt.matches("\\S*"))
{
//
// Only non-whitespace characters
//
- result += elt;
+ r.returnValue += elt;
}
else
{
- result += '"' + elt + '"';
+ r.returnValue += '"' + elt + '"';
}
- if(toolTipHolder != null)
- {
- toolTipHolder.value += elt;
- }
+ r.toolTip += elt;
}
}
- if(toolTipHolder != null && toolTipHolder.value != null)
+ if(r.toolTip != null)
{
- toolTipHolder.value += "</html>";
+ r.toolTip += "</html>";
}
- return result;
+ return r;
}
- static public String stringify(java.util.Collection<?> col, String separator, Ice.StringHolder toolTipHolder)
+ static public StringifyResult stringify(java.util.Collection<?> col, String separator)
{
-
Stringifier stringifier = new Stringifier()
{
@Override
@@ -216,20 +206,17 @@ public class Utils
return (String)obj;
}
};
- return stringify(col, stringifier, separator, toolTipHolder);
-
+ return stringify(col, stringifier, separator);
}
- static public String stringify(String[] stringSeq, String separator, Ice.StringHolder toolTipHolder)
+ static public StringifyResult stringify(String[] stringSeq, String separator)
{
-
- return stringify(java.util.Arrays.asList(stringSeq), separator, toolTipHolder);
+ return stringify(java.util.Arrays.asList(stringSeq), separator);
}
- static public String stringify(java.util.Map<String, String> stringMap,
- final String pairSeparator,
- String separator,
- Ice.StringHolder toolTipHolder)
+ static public StringifyResult stringify(java.util.Map<String, String> stringMap,
+ final String pairSeparator,
+ String separator)
{
Stringifier stringifier = new Stringifier()
{
@@ -242,7 +229,7 @@ public class Utils
}
};
- return stringify(stringMap.entrySet(), stringifier, separator, toolTipHolder);
+ return stringify(stringMap.entrySet(), stringifier, separator);
}
static public class Resolver
@@ -260,7 +247,7 @@ public class Utils
public Resolver(java.util.Map<String, String>[] variables)
{
_variables = variables;
- _predefinedVariables = new java.util.HashMap<String, String>();
+ _predefinedVariables = new java.util.HashMap<>();
_parameters = null;
_subResolver = this;
@@ -287,7 +274,7 @@ public class Utils
public Resolver(Resolver parent)
{
_variables = parent._variables;
- _predefinedVariables = new java.util.HashMap<String, String>(parent._predefinedVariables);
+ _predefinedVariables = new java.util.HashMap<>(parent._predefinedVariables);
_parameters = parent._parameters;
if(_parameters == null)
{
@@ -360,7 +347,7 @@ public class Utils
java.util.Map<String, String> defaults)
{
assert _variables == parent._variables;
- _predefinedVariables = new java.util.HashMap<String, String>(parent._predefinedVariables);
+ _predefinedVariables = new java.util.HashMap<>(parent._predefinedVariables);
_parameters = parent.substituteParameterValues(parameters, defaults);
_subResolver = new Resolver(_variables, _predefinedVariables);
@@ -369,7 +356,7 @@ public class Utils
public void reset(Resolver parent)
{
assert _variables == parent._variables;
- _predefinedVariables = new java.util.HashMap<String, String>(parent._predefinedVariables);
+ _predefinedVariables = new java.util.HashMap<>(parent._predefinedVariables);
assert _parameters == parent._parameters;
if(_parameters == null)
@@ -459,7 +446,7 @@ public class Utils
public java.util.Map<String, String> substituteParameterValues(java.util.Map<String, String> input,
java.util.Map<String, String> defaults)
{
- java.util.Map<String, String> result = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> result = new java.util.HashMap<>();
for(java.util.Map.Entry<String, String> p : input.entrySet())
{
result.put(p.getKey(), substitute(p.getValue()));
@@ -506,7 +493,7 @@ public class Utils
java.util.List<ExpandedPropertySet> propertySets,
Resolver resolver)
{
- java.util.SortedMap<String, String> toMap = new java.util.TreeMap<String, String>();
+ java.util.SortedMap<String, String> toMap = new java.util.TreeMap<>();
for(ExpandedPropertySet p : propertySets)
{
addSet(p, resolver, toMap);
@@ -517,7 +504,7 @@ public class Utils
static public java.util.SortedMap<String, String>
propertySetToMap(ExpandedPropertySet propertySet, Resolver resolver)
{
- java.util.List<ExpandedPropertySet> list = new java.util.LinkedList<ExpandedPropertySet>();
+ java.util.List<ExpandedPropertySet> list = new java.util.LinkedList<>();
list.add(propertySet);
return propertySetsToMap(list, resolver);
}
@@ -537,4 +524,3 @@ public class Utils
}
}
}
-
diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/XMLWriter.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/XMLWriter.java
index 48e5df943df..efa69f50a7f 100644
--- a/java/src/IceGridGUI/src/main/java/IceGridGUI/XMLWriter.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/XMLWriter.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
-package IceGridGUI;
+package com.zeroc.IceGridGUI;
import java.io.*;
@@ -110,8 +110,7 @@ public class XMLWriter
}
}
- private String
- escape(String input)
+ private String escape(String input)
{
String v = input;
diff --git a/java/src/IceLocatorDiscovery/build.gradle b/java/src/IceLocatorDiscovery/build.gradle
index 0ef49c788be..5d567924de1 100644
--- a/java/src/IceLocatorDiscovery/build.gradle
+++ b/java/src/IceLocatorDiscovery/build.gradle
@@ -7,8 +7,10 @@
//
// **********************************************************************
-sourceCompatibility = iceSourceCompatibility
-targetCompatibility = iceTargetCompatibility
+//sourceCompatibility = iceSourceCompatibility
+//targetCompatibility = iceTargetCompatibility
+sourceCompatibility = 1.8
+targetCompatibility = 1.8
project.ext.displayName = "IceLocatorDiscovery"
project.ext.description = "Ice plug-in that enables the discovery of IceGrid and custom locators via UDP multicast"
diff --git a/java/src/IceLocatorDiscovery/src/main/java/com/zeroc/IceLocatorDiscovery/PluginFactory.java b/java/src/IceLocatorDiscovery/src/main/java/com/zeroc/IceLocatorDiscovery/PluginFactory.java
new file mode 100644
index 00000000000..98ac988ed37
--- /dev/null
+++ b/java/src/IceLocatorDiscovery/src/main/java/com/zeroc/IceLocatorDiscovery/PluginFactory.java
@@ -0,0 +1,19 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceLocatorDiscovery;
+
+public class PluginFactory implements com.zeroc.Ice.PluginFactory
+{
+ @Override
+ public com.zeroc.Ice.Plugin create(com.zeroc.Ice.Communicator communicator, String name, String[] args)
+ {
+ return new PluginI(communicator);
+ }
+}
diff --git a/java/src/IceLocatorDiscovery/src/main/java/com/zeroc/IceLocatorDiscovery/PluginI.java b/java/src/IceLocatorDiscovery/src/main/java/com/zeroc/IceLocatorDiscovery/PluginI.java
new file mode 100644
index 00000000000..8253ad0a9f5
--- /dev/null
+++ b/java/src/IceLocatorDiscovery/src/main/java/com/zeroc/IceLocatorDiscovery/PluginI.java
@@ -0,0 +1,447 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceLocatorDiscovery;
+
+import java.util.List;
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionStage;
+
+class PluginI implements com.zeroc.Ice.Plugin
+{
+ private static class Request
+ {
+ Request(LocatorI locator,
+ String operation,
+ com.zeroc.Ice.OperationMode mode,
+ byte[] inParams,
+ java.util.Map<String, String> context,
+ CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> f)
+ {
+ _locator = locator;
+ _operation = operation;
+ _mode = mode;
+ _inParams = inParams;
+ _context = context;
+ _future = f;
+ }
+
+ void invoke(com.zeroc.Ice.LocatorPrx l)
+ {
+ _locatorPrx = l;
+ try
+ {
+ final CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> f =
+ l.ice_invokeAsync(_operation, _mode, _inParams, _context);
+ f.whenComplete((result, ex) ->
+ {
+ if(ex != null)
+ {
+ exception((com.zeroc.Ice.LocalException)ex);
+ }
+ else
+ {
+ _future.complete(result);
+ }
+ });
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ exception(ex);
+ }
+ }
+
+ private void exception(com.zeroc.Ice.LocalException ex)
+ {
+ try
+ {
+ throw ex;
+ }
+ catch(com.zeroc.Ice.RequestFailedException exc)
+ {
+ _future.completeExceptionally(ex);
+ }
+ catch(com.zeroc.Ice.UnknownException exc)
+ {
+ _future.completeExceptionally(ex);
+ }
+ catch(com.zeroc.Ice.NoEndpointException exc)
+ {
+ _future.completeExceptionally(new com.zeroc.Ice.ObjectNotExistException());
+ }
+ catch(com.zeroc.Ice.ObjectAdapterDeactivatedException exc)
+ {
+ _future.completeExceptionally(new com.zeroc.Ice.ObjectNotExistException());
+ }
+ catch(com.zeroc.Ice.CommunicatorDestroyedException exc)
+ {
+ _future.completeExceptionally(new com.zeroc.Ice.ObjectNotExistException());
+ }
+ catch(com.zeroc.Ice.LocalException exc)
+ {
+ _locator.invoke(_locatorPrx, Request.this); // Retry with new locator proxy
+ }
+ }
+
+ private final LocatorI _locator;
+ private final String _operation;
+ private final com.zeroc.Ice.OperationMode _mode;
+ private final java.util.Map<String, String> _context;
+ private final byte[] _inParams;
+ private final CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> _future;
+
+ private com.zeroc.Ice.LocatorPrx _locatorPrx;
+ }
+
+ static private class VoidLocatorI implements com.zeroc.Ice.Locator
+ {
+ @Override
+ public CompletionStage<com.zeroc.Ice.ObjectPrx> findObjectByIdAsync(com.zeroc.Ice.Identity id,
+ com.zeroc.Ice.Current current)
+ {
+ return CompletableFuture.completedFuture((com.zeroc.Ice.ObjectPrx)null);
+ }
+
+ @Override
+ public CompletionStage<com.zeroc.Ice.ObjectPrx> findAdapterByIdAsync(String id, com.zeroc.Ice.Current current)
+ {
+ return CompletableFuture.completedFuture((com.zeroc.Ice.ObjectPrx)null);
+ }
+
+ @Override
+ public com.zeroc.Ice.LocatorRegistryPrx getRegistry(com.zeroc.Ice.Current current)
+ {
+ return null;
+ }
+ }
+
+ private static class LocatorI implements com.zeroc.Ice.BlobjectAsync
+ {
+ LocatorI(LookupPrx lookup, com.zeroc.Ice.Properties properties, String instanceName,
+ com.zeroc.Ice.LocatorPrx voidLocator)
+ {
+ _lookup = lookup;
+ _timeout = properties.getPropertyAsIntWithDefault("IceLocatorDiscovery.Timeout", 300);
+ _retryCount = properties.getPropertyAsIntWithDefault("IceLocatorDiscovery.RetryCount", 3);
+ _retryDelay = properties.getPropertyAsIntWithDefault("IceLocatorDiscovery.RetryDelay", 2000);
+ _timer = com.zeroc.IceInternal.Util.getInstance(lookup.ice_getCommunicator()).timer();
+ _instanceName = instanceName;
+ _warned = false;
+ _locator = lookup.ice_getCommunicator().getDefaultLocator();
+ _voidLocator = voidLocator;
+ _pendingRetryCount = 0;
+ }
+
+ public void setLookupReply(LookupReplyPrx lookupReply)
+ {
+ _lookupReply = lookupReply;
+ }
+
+ @Override
+ public CompletionStage<com.zeroc.Ice.Object.Ice_invokeResult> ice_invokeAsync(byte[] inParams,
+ com.zeroc.Ice.Current current)
+ {
+ CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> f = new CompletableFuture<>();
+ invoke(null, new Request(this, current.operation, current.mode, inParams, current.ctx, f));
+ return f;
+ }
+
+ public synchronized void foundLocator(com.zeroc.Ice.LocatorPrx locator)
+ {
+ if(locator == null ||
+ (!_instanceName.isEmpty() && !locator.ice_getIdentity().category.equals(_instanceName)))
+ {
+ return;
+ }
+
+ //
+ // If we already have a locator assigned, ensure the given locator
+ // has the same identity, otherwise ignore it.
+ //
+ if(_locator != null && !locator.ice_getIdentity().category.equals(_locator.ice_getIdentity().category))
+ {
+ if(!_warned)
+ {
+ _warned = true; // Only warn once
+
+ locator.ice_getCommunicator().getLogger().warning(
+ "received Ice locator with different instance name:\n" +
+ "using = `" + _locator.ice_getIdentity().category + "'\n" +
+ "received = `" + locator.ice_getIdentity().category + "'\n" +
+ "This is typically the case if multiple Ice locators with different " +
+ "instance names are deployed and the property `IceLocatorDiscovery.InstanceName'" +
+ "is not set.");
+ }
+ return;
+ }
+
+ if(_pendingRetryCount > 0) // No need to retry, we found a locator
+ {
+ _future.cancel(false);
+ _future = null;
+
+ _pendingRetryCount = 0;
+ }
+
+ if(_locator != null)
+ {
+ //
+ // We found another locator replica, append its endpoints to the
+ // current locator proxy endpoints.
+ //
+ List<com.zeroc.Ice.Endpoint> newEndpoints = new ArrayList<>(
+ Arrays.asList(_locator.ice_getEndpoints()));
+ for(com.zeroc.Ice.Endpoint p : locator.ice_getEndpoints())
+ {
+ //
+ // Only add endpoints if not already in the locator proxy endpoints
+ //
+ boolean found = false;
+ for(com.zeroc.Ice.Endpoint q : newEndpoints)
+ {
+ if(p.equals(q))
+ {
+ found = true;
+ break;
+ }
+ }
+ if(!found)
+ {
+ newEndpoints.add(p);
+ }
+
+ }
+ _locator = (com.zeroc.Ice.LocatorPrx)_locator.ice_endpoints(
+ newEndpoints.toArray(new com.zeroc.Ice.Endpoint[newEndpoints.size()]));
+ }
+ else
+ {
+ _locator = locator;
+ if(_instanceName.isEmpty())
+ {
+ _instanceName = _locator.ice_getIdentity().category; // Stick to the first locator
+ }
+ }
+
+ //
+ // Send pending requests if any.
+ //
+ for(Request req : _pendingRequests)
+ {
+ req.invoke(_locator);
+ }
+ _pendingRequests.clear();
+ }
+
+ public synchronized void invoke(com.zeroc.Ice.LocatorPrx locator, Request request)
+ {
+ if(_locator != null && _locator != locator)
+ {
+ request.invoke(_locator);
+ }
+ else if(com.zeroc.IceInternal.Time.currentMonotonicTimeMillis() < _nextRetry)
+ {
+ request.invoke(_voidLocator); // Don't retry to find a locator before the retry delay expires
+ }
+ else
+ {
+ _locator = null;
+
+ _pendingRequests.add(request);
+
+ if(_pendingRetryCount == 0) // No request in progress
+ {
+ _pendingRetryCount = _retryCount;
+ try
+ {
+ _lookup.findLocatorAsync(_instanceName, _lookupReply); // Send multicast request.
+ _future = _timer.schedule(_retryTask, _timeout, java.util.concurrent.TimeUnit.MILLISECONDS);
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ for(Request req : _pendingRequests)
+ {
+ req.invoke(_voidLocator);
+ }
+ _pendingRequests.clear();
+ _pendingRetryCount = 0;
+ }
+ }
+ }
+ }
+
+ private Runnable _retryTask = new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ synchronized(LocatorI.this)
+ {
+ if(--_pendingRetryCount > 0)
+ {
+ try
+ {
+ _lookup.findLocatorAsync(_instanceName, _lookupReply); // Send multicast request.
+ _future = _timer.schedule(_retryTask, _timeout, java.util.concurrent.TimeUnit.MILLISECONDS);
+ return;
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ }
+ _pendingRetryCount = 0;
+ }
+
+ for(Request req : _pendingRequests)
+ {
+ req.invoke(_voidLocator);
+ }
+ _pendingRequests.clear();
+ _nextRetry = com.zeroc.IceInternal.Time.currentMonotonicTimeMillis() + _retryDelay;
+ }
+
+ }
+ };
+
+ private final LookupPrx _lookup;
+ private final int _timeout;
+ private java.util.concurrent.Future<?> _future;
+ private final java.util.concurrent.ScheduledExecutorService _timer;
+ private final int _retryCount;
+ private final int _retryDelay;
+
+ private String _instanceName;
+ private boolean _warned;
+ private LookupReplyPrx _lookupReply;
+ private com.zeroc.Ice.LocatorPrx _locator;
+ private com.zeroc.Ice.LocatorPrx _voidLocator;
+
+ private int _pendingRetryCount;
+ private List<Request> _pendingRequests = new ArrayList<>();
+ private long _nextRetry;
+ }
+
+ private class LookupReplyI implements LookupReply
+ {
+ LookupReplyI(LocatorI locator)
+ {
+ _locator = locator;
+ }
+
+ @Override
+ public void foundLocator(com.zeroc.Ice.LocatorPrx locator, com.zeroc.Ice.Current curr)
+ {
+ _locator.foundLocator(locator);
+ }
+
+ private final LocatorI _locator;
+ }
+
+ public PluginI(com.zeroc.Ice.Communicator communicator)
+ {
+ _communicator = communicator;
+ }
+
+ @Override
+ public void initialize()
+ {
+ com.zeroc.Ice.Properties properties = _communicator.getProperties();
+
+ boolean ipv4 = properties.getPropertyAsIntWithDefault("Ice.IPv4", 1) > 0;
+ boolean preferIPv6 = properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0;
+ String address;
+ if(ipv4 && !preferIPv6)
+ {
+ address = properties.getPropertyWithDefault("IceLocatorDiscovery.Address", "239.255.0.1");
+ }
+ else
+ {
+ address = properties.getPropertyWithDefault("IceLocatorDiscovery.Address", "ff15::1");
+ }
+ int port = properties.getPropertyAsIntWithDefault("IceLocatorDiscovery.Port", 4061);
+ String intf = properties.getProperty("IceLocatorDiscovery.Interface");
+
+ if(properties.getProperty("IceLocatorDiscovery.Reply.Endpoints").isEmpty())
+ {
+ StringBuilder s = new StringBuilder();
+ s.append("udp");
+ if(!intf.isEmpty())
+ {
+ s.append(" -h \"").append(intf).append("\"");
+ }
+ properties.setProperty("IceLocatorDiscovery.Reply.Endpoints", s.toString());
+ }
+ if(properties.getProperty("IceLocatorDiscovery.Locator.Endpoints").isEmpty())
+ {
+ properties.setProperty("IceLocatorDiscovery.Locator.AdapterId", java.util.UUID.randomUUID().toString());
+ }
+
+ _replyAdapter = _communicator.createObjectAdapter("IceLocatorDiscovery.Reply");
+ _locatorAdapter = _communicator.createObjectAdapter("IceLocatorDiscovery.Locator");
+
+ // We don't want those adapters to be registered with the locator so clear their locator.
+ _replyAdapter.setLocator(null);
+ _locatorAdapter.setLocator(null);
+
+ String lookupEndpoints = properties.getProperty("IceLocatorDiscovery.Lookup");
+ if(lookupEndpoints.isEmpty())
+ {
+ StringBuilder s = new StringBuilder();
+ s.append("udp -h \"").append(address).append("\" -p ").append(port);
+ if(!intf.isEmpty())
+ {
+ s.append(" --interface \"").append(intf).append("\"");
+ }
+ lookupEndpoints = s.toString();
+ }
+
+ com.zeroc.Ice.ObjectPrx lookupPrx =
+ _communicator.stringToProxy("IceLocatorDiscovery/Lookup -d:" + lookupEndpoints);
+ lookupPrx = lookupPrx.ice_collocationOptimized(false); // No collocation optimization for the multicast proxy!
+ try
+ {
+ lookupPrx.ice_getConnection(); // Ensure we can establish a connection to the multicast proxy
+ }
+ catch(com.zeroc.Ice.LocalException ex)
+ {
+ StringBuilder s = new StringBuilder();
+ s.append("IceLocatorDiscovery is unable to establish a multicast connection:\n");
+ s.append("proxy = ").append(lookupPrx.toString()).append("\n").append(ex);
+ throw new com.zeroc.Ice.PluginInitializationException(s.toString());
+ }
+
+ com.zeroc.Ice.LocatorPrx voidLoc =
+ com.zeroc.Ice.LocatorPrx.uncheckedCast(_locatorAdapter.addWithUUID(new VoidLocatorI()));
+
+ String instanceName = properties.getProperty("IceLocatorDiscovery.InstanceName");
+ com.zeroc.Ice.Identity id = new com.zeroc.Ice.Identity();
+ id.name = "Locator";
+ id.category = !instanceName.isEmpty() ? instanceName : java.util.UUID.randomUUID().toString();
+ LocatorI locator = new LocatorI(LookupPrx.uncheckedCast(lookupPrx), properties, instanceName, voidLoc);
+ _communicator.setDefaultLocator(com.zeroc.Ice.LocatorPrx.uncheckedCast(_locatorAdapter.addWithUUID(locator)));
+
+ com.zeroc.Ice.ObjectPrx lookupReply = _replyAdapter.addWithUUID(new LookupReplyI(locator)).ice_datagram();
+ locator.setLookupReply(LookupReplyPrx.uncheckedCast(lookupReply));
+
+ _replyAdapter.activate();
+ _locatorAdapter.activate();
+ }
+
+ @Override
+ public void destroy()
+ {
+ _replyAdapter.destroy();
+ _locatorAdapter.destroy();
+ }
+
+ private com.zeroc.Ice.Communicator _communicator;
+ private com.zeroc.Ice.ObjectAdapter _locatorAdapter;
+ private com.zeroc.Ice.ObjectAdapter _replyAdapter;
+}
diff --git a/java/src/IcePatch2/build.gradle b/java/src/IcePatch2/build.gradle
index 4fc3e88e8a3..4d30cffa9ae 100644
--- a/java/src/IcePatch2/build.gradle
+++ b/java/src/IcePatch2/build.gradle
@@ -7,8 +7,10 @@
//
// **********************************************************************
-sourceCompatibility = iceSourceCompatibility
-targetCompatibility = iceTargetCompatibility
+//sourceCompatibility = iceSourceCompatibility
+//targetCompatibility = iceTargetCompatibility
+sourceCompatibility = 1.8
+targetCompatibility = 1.8
project.ext.displayName = "IcePatch2"
project.ext.description = "File distribution and patching for Ice"
@@ -16,7 +18,7 @@ project.ext.description = "File distribution and patching for Ice"
slice {
java {
set1 {
- args = "--ice --tie --checksum IcePatch2.SliceChecksums"
+ args = "--ice --checksum com.zeroc.IcePatch2.SliceChecksums"
files = fileTree(dir: "$sliceDir/IcePatch2", includes:['*.ice'], excludes:["*F.ice"])
}
}
diff --git a/java/src/IceStorm/build.gradle b/java/src/IceStorm/build.gradle
index af5afb24b1d..2644a8da018 100644
--- a/java/src/IceStorm/build.gradle
+++ b/java/src/IceStorm/build.gradle
@@ -7,16 +7,27 @@
//
// **********************************************************************
-sourceCompatibility = iceSourceCompatibility
-targetCompatibility = iceTargetCompatibility
+//sourceCompatibility = iceSourceCompatibility
+//targetCompatibility = iceTargetCompatibility
+sourceCompatibility = 1.8
+targetCompatibility = 1.8
project.ext.displayName = "IceStorm"
project.ext.description = "Publish-subscribe event distribution service"
+sourceSets {
+ main {
+ java {
+ // ice.jar already includes a marker for the IceMX package.
+ exclude '**/com/zeroc/IceMX/_Marker.java'
+ }
+ }
+}
+
slice {
java {
set1 {
- args = "--ice --tie --checksum IceStorm.SliceChecksums"
+ args = "--ice --checksum com.zeroc.IceStorm.SliceChecksums"
files = fileTree(dir: "$sliceDir/IceStorm", includes:['*.ice'], excludes:["*F.ice"])
}
}
diff --git a/java/test/build.gradle b/java/test/build.gradle
index 729ff7baaee..67b15955c3d 100644
--- a/java/test/build.gradle
+++ b/java/test/build.gradle
@@ -10,14 +10,9 @@
ext.testDir = "${projectDir}/src/main/java/test"
apply from: "slice.gradle"
-def hasLambda = org.gradle.internal.jvm.Jvm.current().getJavaVersion().toString().toFloat() >= 1.8f
-
sourceSets {
main {
java {
- if (!hasLambda) {
- exclude '**/lambda'
- }
exclude 'plugins'
exclude 'controller'
exclude 'ejb'
diff --git a/java/test/controller/build.gradle b/java/test/controller/build.gradle
index 9dd0187b74b..328d107222b 100644
--- a/java/test/controller/build.gradle
+++ b/java/test/controller/build.gradle
@@ -7,8 +7,10 @@
//
// **********************************************************************
-sourceCompatibility = iceSourceCompatibility
-targetCompatibility = iceTargetCompatibility
+//sourceCompatibility = iceSourceCompatibility
+//targetCompatibility = iceTargetCompatibility
+sourceCompatibility = 1.8
+targetCompatibility = 1.8
dependencies {
compile localDependency('ice')
diff --git a/java/test/controller/src/main/java/Test/Common/ControllerServer.java b/java/test/controller/src/main/java/Test/Common/ControllerServer.java
index c90efc8e272..b3161cfd83c 100644
--- a/java/test/controller/src/main/java/Test/Common/ControllerServer.java
+++ b/java/test/controller/src/main/java/Test/Common/ControllerServer.java
@@ -9,19 +9,15 @@
package Test.Common;
-import Test.Common._ControllerDisp;
-import Test.Common._ServerDisp;
-import Test.Common.ServerPrx;
-
import java.io.File;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.regex.Pattern;
-public class ControllerServer extends Ice.Application
+public class ControllerServer extends com.zeroc.Ice.Application
{
- class ServerI extends _ServerDisp
+ class ServerI implements Server
{
public ServerI(Process process, String name)
{
@@ -54,8 +50,6 @@ public class ControllerServer extends Ice.Application
if(line.matches(Pattern.quote("starting server...") + ".*ok.*") ||
line.matches(Pattern.quote("starting serveramd...") + ".*ok.*") ||
- line.matches(Pattern.quote("starting servertie...") + ".*ok.*") ||
- line.matches(Pattern.quote("starting serveramdtie...") + ".*ok.*") ||
line.matches("starting test.*" + Pattern.quote("Server...") + ".*ok.*"))
{
synchronized(ServerI.this)
@@ -66,8 +60,6 @@ public class ControllerServer extends Ice.Application
}
else if(line.matches(Pattern.quote("starting server...") + ".*") ||
line.matches(Pattern.quote("starting serveramd...") + ".*") ||
- line.matches(Pattern.quote("starting servertie...") + ".*") ||
- line.matches(Pattern.quote("starting serveramdtie...") + ".*") ||
line.matches("starting test.*" + Pattern.quote("Server...") + ".*"))
{
String s = reader.readLine();
@@ -101,7 +93,7 @@ public class ControllerServer extends Ice.Application
new Reader(_process.getInputStream()).start();
}
- public synchronized void terminate(Ice.Current current)
+ public synchronized void terminate(com.zeroc.Ice.Current current)
{
try
{
@@ -133,7 +125,7 @@ public class ControllerServer extends Ice.Application
}
}
- public void waitTestSuccess(Ice.Current current)
+ public void waitTestSuccess(com.zeroc.Ice.Current current)
{
Process p = null;
synchronized(this)
@@ -157,7 +149,7 @@ public class ControllerServer extends Ice.Application
}
}
- public synchronized void waitForServer(Ice.Current current)
+ public synchronized void waitForServer(com.zeroc.Ice.Current current)
throws ServerFailedException
{
while(!_terminated)
@@ -189,7 +181,7 @@ public class ControllerServer extends Ice.Application
private boolean _terminated;
}
- public class ControllerI extends _ControllerDisp
+ public class ControllerI implements Controller
{
public ControllerI(String[] args)
{
@@ -198,7 +190,7 @@ public class ControllerServer extends Ice.Application
@Override
public ServerPrx runServer(String lang, final String name, String protocol, String host,
- boolean winrt, String configName, String[] options, Ice.Current current)
+ boolean winrt, String configName, String[] options, com.zeroc.Ice.Current current)
{
if(_server != null)
{
@@ -206,14 +198,14 @@ public class ControllerServer extends Ice.Application
{
_server.terminate();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
}
String script = lang + (lang.equals("java") ? "/test/src/main/java/" : "/") + "test/" + name + "/run.py";
- java.util.List<String> args = new java.util.ArrayList<String>();
+ java.util.List<String> args = new java.util.ArrayList<>();
args.add("python");
args.add(script);
args.add("--server");
@@ -256,7 +248,7 @@ public class ControllerServer extends Ice.Application
.directory(_toplevel)
.redirectErrorStream(true)
.start();
- _server = ServerPrxHelper.uncheckedCast(current.adapter.addWithUUID(new ServerI(process, name)));
+ _server = ServerPrx.uncheckedCast(current.adapter.addWithUUID(new ServerI(process, name)));
}
catch(java.io.IOException ex)
{
@@ -270,11 +262,10 @@ public class ControllerServer extends Ice.Application
}
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("ControllerAdapter");
- adapter.add(new ControllerI(args), Ice.Util.stringToIdentity("controller"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("ControllerAdapter");
+ adapter.add(new ControllerI(args), com.zeroc.Ice.Util.stringToIdentity("controller"));
adapter.activate();
communicator().waitForShutdown();
return 0;
@@ -285,8 +276,7 @@ public class ControllerServer extends Ice.Application
_toplevel = toplevel;
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
try
{
@@ -295,8 +285,9 @@ public class ControllerServer extends Ice.Application
"../../../../../");
ControllerServer app = new ControllerServer(toplevel);
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(args);
+ com.zeroc.Ice.InitializationData initData = new com.zeroc.Ice.InitializationData();
+ com.zeroc.Ice.Util.CreatePropertiesResult cpr = com.zeroc.Ice.Util.createProperties(args);
+ initData.properties = cpr.properties;
initData.properties.setProperty("Ice.Plugin.IceSSL", "IceSSL.PluginFactory");
initData.properties.setProperty("IceSSL.DefaultDir", new File(toplevel, "certs").getCanonicalPath());
initData.properties.setProperty("IceSSL.Keystore", "server.jks");
@@ -306,7 +297,7 @@ public class ControllerServer extends Ice.Application
initData.properties.setProperty("ControllerAdapter.Endpoints",
"tcp -p 15000:ssl -p 15001: ws -p 15002:wss -p 15003");
- int status = app.main("ControllerServer", args, initData);
+ int status = app.main("ControllerServer", cpr.args, initData);
System.exit(status);
}
catch(java.net.URISyntaxException ex)
diff --git a/java/test/ejb/src/common/com/zeroc/ice/IceAdapter.java b/java/test/ejb/src/common/com/zeroc/ice/IceAdapter.java
index 61ea69ca263..1f43dc17566 100644
--- a/java/test/ejb/src/common/com/zeroc/ice/IceAdapter.java
+++ b/java/test/ejb/src/common/com/zeroc/ice/IceAdapter.java
@@ -11,16 +11,15 @@ package com.zeroc.ice;
public class IceAdapter
{
- synchronized static public void
- add(Ice.Object servant, Ice.Identity id)
+ synchronized static public void add(com.zeroc.Ice.Object servant, com.zeroc.Ice.Identity id)
{
if(_objectAdapter == null)
{
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties();
+ com.zeroc.Ice.InitializationData initData = new com.zeroc.Ice.InitializationData();
+ initData.properties = com.zeroc.Ice.Util.createProperties();
initData.properties.setProperty("Ice.Default.Package", "com.zeroc.ice");
initData.properties.setProperty("Ice.UseApplicationClassLoader", "1");
- Ice.Communicator communicator = Ice.Util.initialize(initData);
+ com.zeroc.Ice.Communicator communicator = com.zeroc.Ice.Util.initialize(initData);
_objectAdapter = communicator.createObjectAdapterWithEndpoints("EJB", "tcp -h localhost -p 10000");
_objectAdapter.activate();
}
@@ -28,8 +27,7 @@ public class IceAdapter
_objectAdapter.add(servant, id);
}
- synchronized static public void
- remove(Ice.Identity id)
+ synchronized static public void remove(com.zeroc.Ice.Identity id)
{
assert _servantCount > 0;
_objectAdapter.remove(id);
@@ -40,13 +38,12 @@ public class IceAdapter
}
}
- synchronized static public Ice.ObjectPrx
- stringToProxy(String str)
+ synchronized static public com.zeroc.Ice.ObjectPrx stringToProxy(String str)
{
assert _objectAdapter != null;
return _objectAdapter.getCommunicator().stringToProxy(str);
}
- static private Ice.ObjectAdapter _objectAdapter = null;
+ static private com.zeroc.Ice.ObjectAdapter _objectAdapter = null;
static private int _servantCount;
-};
+}
diff --git a/java/test/ejb/src/ejb1/com/zeroc/ejb/Client.java b/java/test/ejb/src/ejb1/com/zeroc/ejb/Client.java
index b5314502149..57f231383e8 100644
--- a/java/test/ejb/src/ejb1/com/zeroc/ejb/Client.java
+++ b/java/test/ejb/src/ejb1/com/zeroc/ejb/Client.java
@@ -13,10 +13,9 @@ import javax.naming.*;
import com.zeroc.ice.Test.*;
-public class Client extends Ice.Application
+public class Client extends com.zeroc.Ice.Application
{
- public int
- run(String[] args)
+ public int run(String[] args)
{
System.out.print("initializing EJBs... ");
System.out.flush();
@@ -37,7 +36,7 @@ public class Client extends Ice.Application
System.out.print("setting and getting account... ");
System.out.flush();
String str = "ejb1/service:tcp -h localhost -p 10000";
- ServicePrx proxy = ServicePrxHelper.checkedCast(communicator().stringToProxy(str));
+ ServicePrx proxy = ServicePrx.checkedCast(communicator().stringToProxy(str));
proxy.addAccount(new Account("id1"));
Account s = proxy.getAccount("id1");
if(!s.id.equals("id1"))
@@ -55,14 +54,13 @@ public class Client extends Ice.Application
return 0;
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
Client app = new Client();
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties();
+ com.zeroc.Ice.InitializationData initData = new com.zeroc.Ice.InitializationData();
+ initData.properties = com.zeroc.Ice.Util.createProperties();
initData.properties.setProperty("Ice.Default.Package", "com.zeroc.ice");
int status = app.main("Client", args, initData);
System.exit(status);
}
-};
+}
diff --git a/java/test/ejb/src/ejb1/com/zeroc/ejb/DatabaseI.java b/java/test/ejb/src/ejb1/com/zeroc/ejb/DatabaseI.java
index ccc7c2551d2..2afca2414a8 100644
--- a/java/test/ejb/src/ejb1/com/zeroc/ejb/DatabaseI.java
+++ b/java/test/ejb/src/ejb1/com/zeroc/ejb/DatabaseI.java
@@ -11,10 +11,9 @@ package com.zeroc.ejb;
import com.zeroc.ice.Test.*;
-public class DatabaseI extends _DatabaseDisp
+public class DatabaseI implements Database
{
- public final Account
- getAccount(String id, Ice.Current current)
+ public final Account getAccount(String id, com.zeroc.Ice.Current current)
throws AccountNotExistException
{
Account account = accounts.get(id);
@@ -25,11 +24,10 @@ public class DatabaseI extends _DatabaseDisp
return account;
}
- public final void
- addAccount(Account s, Ice.Current current)
+ public final void addAccount(Account s, com.zeroc.Ice.Current current)
{
accounts.put(s.id, s);
}
- private java.util.Map<String, Account> accounts = new java.util.HashMap<String, Account>();
+ private java.util.Map<String, Account> accounts = new java.util.HashMap<>();
}
diff --git a/java/test/ejb/src/ejb1/com/zeroc/ejb/DatabaseServer.java b/java/test/ejb/src/ejb1/com/zeroc/ejb/DatabaseServer.java
index 04cc84e9dbd..835662b3884 100644
--- a/java/test/ejb/src/ejb1/com/zeroc/ejb/DatabaseServer.java
+++ b/java/test/ejb/src/ejb1/com/zeroc/ejb/DatabaseServer.java
@@ -11,10 +11,9 @@ package com.zeroc.ejb;
import com.zeroc.ice.Test.*;
-public class DatabaseServer extends Ice.Application
+public class DatabaseServer extends com.zeroc.Ice.Application
{
- public int
- run(String[] args)
+ public int run(String[] args)
{
if(args.length > 0)
{
@@ -22,18 +21,18 @@ public class DatabaseServer extends Ice.Application
return 1;
}
- Ice.ObjectAdapter adapter = communicator().createObjectAdapterWithEndpoints("DB", "tcp -h localhost -p 10001");
- adapter.add(new DatabaseI(), Ice.Util.stringToIdentity("db"));
+ com.zeroc.Ice.ObjectAdapter adapter =
+ communicator().createObjectAdapterWithEndpoints("DB", "tcp -h localhost -p 10001");
+ adapter.add(new DatabaseI(), com.zeroc.Ice.Util.stringToIdentity("db"));
adapter.activate();
communicator().waitForShutdown();
return 0;
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties();
+ com.zeroc.Ice.InitializationData initData = new com.zeroc.Ice.InitializationData();
+ initData.properties = com.zeroc.Ice.Util.createProperties();
initData.properties.setProperty("Ice.Default.Package", "com.zeroc.ice");
DatabaseServer app = new DatabaseServer();
diff --git a/java/test/ejb/src/ejb1/com/zeroc/ejb/InitBean.java b/java/test/ejb/src/ejb1/com/zeroc/ejb/InitBean.java
index eb0fa9a3a01..6ed54b255c5 100644
--- a/java/test/ejb/src/ejb1/com/zeroc/ejb/InitBean.java
+++ b/java/test/ejb/src/ejb1/com/zeroc/ejb/InitBean.java
@@ -24,17 +24,15 @@ public class InitBean implements Init
private @EJB Service service;
@PostConstruct
- public void
- create()
+ public void create()
{
- IceAdapter.add(new ServiceI(service), new Ice.Identity("service", "ejb1"));
+ IceAdapter.add(new ServiceI(service), new com.zeroc.Ice.Identity("service", "ejb1"));
}
@PreDestroy
- public void
- destroy()
+ public void destroy()
{
- IceAdapter.remove(new Ice.Identity("service", "ejb1"));
+ IceAdapter.remove(new com.zeroc.Ice.Identity("service", "ejb1"));
}
public void
diff --git a/java/test/ejb/src/ejb1/com/zeroc/ejb/ServiceBean.java b/java/test/ejb/src/ejb1/com/zeroc/ejb/ServiceBean.java
index df983cdc455..21df96cda64 100644
--- a/java/test/ejb/src/ejb1/com/zeroc/ejb/ServiceBean.java
+++ b/java/test/ejb/src/ejb1/com/zeroc/ejb/ServiceBean.java
@@ -18,15 +18,13 @@ import com.zeroc.ice.Test.*;
public class ServiceBean implements Service
{
@PostConstruct
- public void
- create()
+ public void create()
{
- Ice.ObjectPrx db = IceAdapter.stringToProxy("db:tcp -h localhost -p 10001");
- database = DatabasePrxHelper.uncheckedCast(db);
+ com.zeroc.Ice.ObjectPrx db = IceAdapter.stringToProxy("db:tcp -h localhost -p 10001");
+ database = DatabasePrx.uncheckedCast(db);
}
- public final Account
- getAccount(String id)
+ public final Account getAccount(String id)
{
try
{
@@ -40,8 +38,7 @@ public class ServiceBean implements Service
}
}
- public final void
- addAccount(Account s)
+ public final void addAccount(Account s)
{
database.addAccount(s);
}
diff --git a/java/test/ejb/src/ejb1/com/zeroc/ejb/ServiceI.java b/java/test/ejb/src/ejb1/com/zeroc/ejb/ServiceI.java
index da731b86903..6c8ee472e51 100644
--- a/java/test/ejb/src/ejb1/com/zeroc/ejb/ServiceI.java
+++ b/java/test/ejb/src/ejb1/com/zeroc/ejb/ServiceI.java
@@ -11,14 +11,13 @@ package com.zeroc.ejb;
import javax.ejb.*;
-import com.zeroc.ice.Test._ServiceDisp;
import com.zeroc.ice.Test.Account;
import com.zeroc.ice.Test.AccountNotExistException;
//
// This Ice servant delegates the calls to the Service EJB
//
-public class ServiceI extends _ServiceDisp
+public class ServiceI implements com.zeroc.ice.Test.Service
{
final private Service service;
@@ -27,14 +26,12 @@ public class ServiceI extends _ServiceDisp
this.service = service;
}
- public final Account
- getAccount(String id, Ice.Current current)
+ public final Account getAccount(String id, com.zeroc.Ice.Current current)
{
return service.getAccount(id);
}
- public final void
- addAccount(Account s, Ice.Current current)
+ public final void addAccount(Account s, com.zeroc.Ice.Current current)
{
service.addAccount(s);
}
diff --git a/java/test/ejb/src/ejb2/com/zeroc/ejb/Client.java b/java/test/ejb/src/ejb2/com/zeroc/ejb/Client.java
index 9abfe9a5e99..04c4f38b982 100644
--- a/java/test/ejb/src/ejb2/com/zeroc/ejb/Client.java
+++ b/java/test/ejb/src/ejb2/com/zeroc/ejb/Client.java
@@ -13,10 +13,9 @@ import javax.naming.*;
import com.zeroc.ice.Test.*;
-public class Client extends Ice.Application
+public class Client extends com.zeroc.Ice.Application
{
- public int
- run(String[] args)
+ public int run(String[] args)
{
System.out.print("initializing EJBs... ");
System.out.flush();
@@ -37,7 +36,7 @@ public class Client extends Ice.Application
System.out.print("setting and getting account... ");
System.out.flush();
String str = "ejb2/service:tcp -h localhost -p 10000";
- ServicePrx proxy = ServicePrxHelper.checkedCast(communicator().stringToProxy(str));
+ ServicePrx proxy = ServicePrx.checkedCast(communicator().stringToProxy(str));
proxy.addAccount(new Account("id1", "foo"));
Account s = proxy.getAccount("id1");
if(!s.id.equals("id1") || !s.foo.equals("foo"))
@@ -55,14 +54,13 @@ public class Client extends Ice.Application
return 0;
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
Client app = new Client();
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties();
+ com.zeroc.Ice.InitializationData initData = new com.zeroc.Ice.InitializationData();
+ initData.properties = com.zeroc.Ice.Util.createProperties();
initData.properties.setProperty("Ice.Default.Package", "com.zeroc.ice");
int status = app.main("Client", args, initData);
System.exit(status);
}
-};
+}
diff --git a/java/test/ejb/src/ejb2/com/zeroc/ejb/DatabaseI.java b/java/test/ejb/src/ejb2/com/zeroc/ejb/DatabaseI.java
index 9787c5c4885..8c02eb6bad6 100644
--- a/java/test/ejb/src/ejb2/com/zeroc/ejb/DatabaseI.java
+++ b/java/test/ejb/src/ejb2/com/zeroc/ejb/DatabaseI.java
@@ -11,10 +11,9 @@ package com.zeroc.ejb;
import com.zeroc.ice.Test.*;
-public class DatabaseI extends _DatabaseDisp
+public class DatabaseI implements Database
{
- public final Account
- getAccount(String id, Ice.Current current)
+ public final Account getAccount(String id, com.zeroc.Ice.Current current)
throws AccountNotExistException
{
Account account = accounts.get(id);
@@ -25,11 +24,10 @@ public class DatabaseI extends _DatabaseDisp
return account;
}
- public final void
- addAccount(Account s, Ice.Current current)
+ public final void addAccount(Account s, com.zeroc.Ice.Current current)
{
accounts.put(s.id, s);
}
- private java.util.Map<String, Account> accounts = new java.util.HashMap<String, Account>();
+ private java.util.Map<String, Account> accounts = new java.util.HashMap<>();
}
diff --git a/java/test/ejb/src/ejb2/com/zeroc/ejb/DatabaseServer.java b/java/test/ejb/src/ejb2/com/zeroc/ejb/DatabaseServer.java
index f7ad76bd657..e149e682ff3 100644
--- a/java/test/ejb/src/ejb2/com/zeroc/ejb/DatabaseServer.java
+++ b/java/test/ejb/src/ejb2/com/zeroc/ejb/DatabaseServer.java
@@ -11,10 +11,9 @@ package com.zeroc.ejb;
import com.zeroc.ice.Test.*;
-public class DatabaseServer extends Ice.Application
+public class DatabaseServer extends com.zeroc.Ice.Application
{
- public int
- run(String[] args)
+ public int run(String[] args)
{
if(args.length > 0)
{
@@ -22,18 +21,18 @@ public class DatabaseServer extends Ice.Application
return 1;
}
- Ice.ObjectAdapter adapter = communicator().createObjectAdapterWithEndpoints("DB", "tcp -h localhost -p 10002");
- adapter.add(new DatabaseI(), Ice.Util.stringToIdentity("db"));
+ com.zeroc.Ice.ObjectAdapter adapter =
+ communicator().createObjectAdapterWithEndpoints("DB", "tcp -h localhost -p 10002");
+ adapter.add(new DatabaseI(), com.zeroc.Ice.Util.stringToIdentity("db"));
adapter.activate();
communicator().waitForShutdown();
return 0;
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties();
+ com.zeroc.Ice.InitializationData initData = new com.zeroc.Ice.InitializationData();
+ initData.properties = com.zeroc.Ice.Util.createProperties();
initData.properties.setProperty("Ice.Default.Package", "com.zeroc.ice");
DatabaseServer app = new DatabaseServer();
diff --git a/java/test/ejb/src/ejb2/com/zeroc/ejb/InitBean.java b/java/test/ejb/src/ejb2/com/zeroc/ejb/InitBean.java
index 236add0a74f..831f44e9ae9 100644
--- a/java/test/ejb/src/ejb2/com/zeroc/ejb/InitBean.java
+++ b/java/test/ejb/src/ejb2/com/zeroc/ejb/InitBean.java
@@ -24,17 +24,15 @@ public class InitBean implements Init
private @EJB Service service;
@PostConstruct
- public void
- create()
+ public void create()
{
- IceAdapter.add(new ServiceI(service), new Ice.Identity("service", "ejb2"));
+ IceAdapter.add(new ServiceI(service), new com.zeroc.Ice.Identity("service", "ejb2"));
}
@PreDestroy
- public void
- destroy()
+ public void destroy()
{
- IceAdapter.remove(new Ice.Identity("service", "ejb2"));
+ IceAdapter.remove(new com.zeroc.Ice.Identity("service", "ejb2"));
}
public void
diff --git a/java/test/ejb/src/ejb2/com/zeroc/ejb/ServiceBean.java b/java/test/ejb/src/ejb2/com/zeroc/ejb/ServiceBean.java
index c3811e34a29..40663592d9e 100644
--- a/java/test/ejb/src/ejb2/com/zeroc/ejb/ServiceBean.java
+++ b/java/test/ejb/src/ejb2/com/zeroc/ejb/ServiceBean.java
@@ -18,48 +18,50 @@ import com.zeroc.ice.Test.*;
public class ServiceBean implements Service
{
@PostConstruct
- public void
- create()
+ public void create()
{
- Ice.ObjectPrx db = IceAdapter.stringToProxy("db:tcp -h localhost -p 10002");
- database = DatabasePrxHelper.uncheckedCast(db);
+ com.zeroc.Ice.ObjectPrx db = IceAdapter.stringToProxy("db:tcp -h localhost -p 10002");
+ database = DatabasePrx.uncheckedCast(db);
}
- public final Account
- getAccount(String id)
+ static class AccountHolder
+ {
+ Account value;
+ }
+
+ public final Account getAccount(String id)
{
final AccountHolder holder = new AccountHolder();
- database.begin_getAccount(id, new Callback_Database_getAccount() {
- public void
- response(Account a)
+ database.getAccountAsync(id).whenComplete((result, ex) ->
+ {
+ if(ex != null)
{
- synchronized(holder)
+ if(ex instanceof AccountNotExistException)
{
- holder.value = a;
- holder.notify();
+ Account a = new Account(((AccountNotExistException)ex).id, "");
+ database.addAccountAsync(a);
+ synchronized(holder)
+ {
+ holder.value = a;
+ holder.notify();
+ }
+ }
+ else
+ {
+ ex.printStackTrace();
+ assert(false);
}
}
-
- public void
- exception(Ice.LocalException ex)
- {
- ex.printStackTrace();
- assert(false);
- }
-
- public void
- exception(Ice.UserException ex)
+ else
{
- Account a = new Account(((AccountNotExistException)ex).id, "");
- database.begin_addAccount(a);
synchronized(holder)
{
- holder.value = a;
+ holder.value = result;
holder.notify();
}
}
});
-
+
synchronized(holder)
{
while(holder.value == null)
@@ -76,8 +78,7 @@ public class ServiceBean implements Service
return holder.value;
}
- public final void
- addAccount(Account s)
+ public final void addAccount(Account s)
{
database.addAccount(s);
}
diff --git a/java/test/ejb/src/ejb2/com/zeroc/ejb/ServiceI.java b/java/test/ejb/src/ejb2/com/zeroc/ejb/ServiceI.java
index da731b86903..6c8ee472e51 100644
--- a/java/test/ejb/src/ejb2/com/zeroc/ejb/ServiceI.java
+++ b/java/test/ejb/src/ejb2/com/zeroc/ejb/ServiceI.java
@@ -11,14 +11,13 @@ package com.zeroc.ejb;
import javax.ejb.*;
-import com.zeroc.ice.Test._ServiceDisp;
import com.zeroc.ice.Test.Account;
import com.zeroc.ice.Test.AccountNotExistException;
//
// This Ice servant delegates the calls to the Service EJB
//
-public class ServiceI extends _ServiceDisp
+public class ServiceI implements com.zeroc.ice.Test.Service
{
final private Service service;
@@ -27,14 +26,12 @@ public class ServiceI extends _ServiceDisp
this.service = service;
}
- public final Account
- getAccount(String id, Ice.Current current)
+ public final Account getAccount(String id, com.zeroc.Ice.Current current)
{
return service.getAccount(id);
}
- public final void
- addAccount(Account s, Ice.Current current)
+ public final void addAccount(Account s, com.zeroc.Ice.Current current)
{
service.addAccount(s);
}
diff --git a/java/test/plugins/build.gradle b/java/test/plugins/build.gradle
index 9a51cd6008e..bf778db1cfa 100644
--- a/java/test/plugins/build.gradle
+++ b/java/test/plugins/build.gradle
@@ -27,4 +27,3 @@ jar {
clean {
delete("$rootProject.projectDir/lib/IceTestPlugins.jar")
}
-
diff --git a/java/test/plugins/src/main/java/test/Ice/plugin/plugins/BasePlugin.java b/java/test/plugins/src/main/java/test/Ice/plugin/plugins/BasePlugin.java
index 5e896525b80..1888e8c1ade 100644
--- a/java/test/plugins/src/main/java/test/Ice/plugin/plugins/BasePlugin.java
+++ b/java/test/plugins/src/main/java/test/Ice/plugin/plugins/BasePlugin.java
@@ -9,9 +9,9 @@
package test.Ice.plugin.plugins;
-public abstract class BasePlugin implements Ice.Plugin
+public abstract class BasePlugin implements com.zeroc.Ice.Plugin
{
- public BasePlugin(Ice.Communicator communicator)
+ public BasePlugin(com.zeroc.Ice.Communicator communicator)
{
_communicator = communicator;
}
@@ -34,7 +34,7 @@ public abstract class BasePlugin implements Ice.Plugin
}
}
- protected Ice.Communicator _communicator;
+ protected com.zeroc.Ice.Communicator _communicator;
protected boolean _initialized = false;
protected boolean _destroyed = false;
protected BasePlugin _other = null;
diff --git a/java/test/plugins/src/main/java/test/Ice/plugin/plugins/BasePluginFail.java b/java/test/plugins/src/main/java/test/Ice/plugin/plugins/BasePluginFail.java
index 5305936ab38..7b0b5fa500f 100644
--- a/java/test/plugins/src/main/java/test/Ice/plugin/plugins/BasePluginFail.java
+++ b/java/test/plugins/src/main/java/test/Ice/plugin/plugins/BasePluginFail.java
@@ -9,9 +9,9 @@
package test.Ice.plugin.plugins;
-public abstract class BasePluginFail implements Ice.Plugin
+public abstract class BasePluginFail implements com.zeroc.Ice.Plugin
{
- public BasePluginFail(Ice.Communicator communicator)
+ public BasePluginFail(com.zeroc.Ice.Communicator communicator)
{
_communicator = communicator;
_initialized = false;
@@ -36,7 +36,7 @@ public abstract class BasePluginFail implements Ice.Plugin
}
}
- protected Ice.Communicator _communicator;
+ protected com.zeroc.Ice.Communicator _communicator;
protected boolean _initialized;
protected boolean _destroyed;
protected BasePluginFail _one;
diff --git a/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginFactory.java b/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginFactory.java
index 1cf88f4fafa..f9306414a16 100644
--- a/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginFactory.java
+++ b/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginFactory.java
@@ -9,15 +9,15 @@
package test.Ice.plugin.plugins;
-public class PluginFactory implements Ice.PluginFactory
+public class PluginFactory implements com.zeroc.Ice.PluginFactory
{
@Override
- public Ice.Plugin create(Ice.Communicator communicator, String name, String[] args)
+ public com.zeroc.Ice.Plugin create(com.zeroc.Ice.Communicator communicator, String name, String[] args)
{
return new Plugin(args);
}
- static class Plugin implements Ice.Plugin
+ static class Plugin implements com.zeroc.Ice.Plugin
{
public Plugin(String[] args)
{
diff --git a/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginInitializeFailFactory.java b/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginInitializeFailFactory.java
index 549932b96a0..49982461cd6 100644
--- a/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginInitializeFailFactory.java
+++ b/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginInitializeFailFactory.java
@@ -9,15 +9,15 @@
package test.Ice.plugin.plugins;
-public class PluginInitializeFailFactory implements Ice.PluginFactory
+public class PluginInitializeFailFactory implements com.zeroc.Ice.PluginFactory
{
@Override
- public Ice.Plugin create(Ice.Communicator communicator, String name, String[] args)
+ public com.zeroc.Ice.Plugin create(com.zeroc.Ice.Communicator communicator, String name, String[] args)
{
return new PluginInitializeFail();
}
- static class PluginInitializeFail implements Ice.Plugin
+ static class PluginInitializeFail implements com.zeroc.Ice.Plugin
{
@Override
public void initialize()
diff --git a/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginOneFactory.java b/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginOneFactory.java
index d9199835764..69683144854 100644
--- a/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginOneFactory.java
+++ b/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginOneFactory.java
@@ -9,17 +9,17 @@
package test.Ice.plugin.plugins;
-public class PluginOneFactory implements Ice.PluginFactory
+public class PluginOneFactory implements com.zeroc.Ice.PluginFactory
{
@Override
- public Ice.Plugin create(Ice.Communicator communicator, String name, String[] args)
+ public com.zeroc.Ice.Plugin create(com.zeroc.Ice.Communicator communicator, String name, String[] args)
{
return new PluginOne(communicator);
}
static class PluginOne extends BasePlugin
{
- public PluginOne(Ice.Communicator communicator)
+ public PluginOne(com.zeroc.Ice.Communicator communicator)
{
super(communicator);
}
diff --git a/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginOneFailFactory.java b/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginOneFailFactory.java
index 120004ed73c..a497b72faf3 100644
--- a/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginOneFailFactory.java
+++ b/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginOneFailFactory.java
@@ -9,17 +9,17 @@
package test.Ice.plugin.plugins;
-public class PluginOneFailFactory implements Ice.PluginFactory
+public class PluginOneFailFactory implements com.zeroc.Ice.PluginFactory
{
@Override
- public Ice.Plugin create(Ice.Communicator communicator, String name, String[] args)
+ public com.zeroc.Ice.Plugin create(com.zeroc.Ice.Communicator communicator, String name, String[] args)
{
return new PluginOneFail(communicator);
}
static class PluginOneFail extends BasePluginFail
{
- public PluginOneFail(Ice.Communicator communicator)
+ public PluginOneFail(com.zeroc.Ice.Communicator communicator)
{
super(communicator);
}
diff --git a/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginThreeFactory.java b/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginThreeFactory.java
index 983c595e2f7..7a21f6f9c29 100644
--- a/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginThreeFactory.java
+++ b/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginThreeFactory.java
@@ -9,17 +9,17 @@
package test.Ice.plugin.plugins;
-public class PluginThreeFactory implements Ice.PluginFactory
+public class PluginThreeFactory implements com.zeroc.Ice.PluginFactory
{
@Override
- public Ice.Plugin create(Ice.Communicator communicator, String name, String[] args)
+ public com.zeroc.Ice.Plugin create(com.zeroc.Ice.Communicator communicator, String name, String[] args)
{
return new PluginThree(communicator);
}
static class PluginThree extends BasePlugin
{
- public PluginThree(Ice.Communicator communicator)
+ public PluginThree(com.zeroc.Ice.Communicator communicator)
{
super(communicator);
}
diff --git a/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginThreeFailFactory.java b/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginThreeFailFactory.java
index c0b139d9395..7a94082af34 100644
--- a/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginThreeFailFactory.java
+++ b/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginThreeFailFactory.java
@@ -9,17 +9,17 @@
package test.Ice.plugin.plugins;
-public class PluginThreeFailFactory implements Ice.PluginFactory
+public class PluginThreeFailFactory implements com.zeroc.Ice.PluginFactory
{
@Override
- public Ice.Plugin create(Ice.Communicator communicator, String name, String[] args)
+ public com.zeroc.Ice.Plugin create(com.zeroc.Ice.Communicator communicator, String name, String[] args)
{
return new PluginThreeFail(communicator);
}
public class PluginThreeFail extends BasePluginFail
{
- public PluginThreeFail(Ice.Communicator communicator)
+ public PluginThreeFail(com.zeroc.Ice.Communicator communicator)
{
super(communicator);
}
diff --git a/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginTwoFactory.java b/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginTwoFactory.java
index 40b4658abdc..92de94e9940 100644
--- a/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginTwoFactory.java
+++ b/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginTwoFactory.java
@@ -9,17 +9,17 @@
package test.Ice.plugin.plugins;
-public class PluginTwoFactory implements Ice.PluginFactory
+public class PluginTwoFactory implements com.zeroc.Ice.PluginFactory
{
@Override
- public Ice.Plugin create(Ice.Communicator communicator, String name, String[] args)
+ public com.zeroc.Ice.Plugin create(com.zeroc.Ice.Communicator communicator, String name, String[] args)
{
return new PluginTwo(communicator);
}
static class PluginTwo extends BasePlugin
{
- public PluginTwo(Ice.Communicator communicator)
+ public PluginTwo(com.zeroc.Ice.Communicator communicator)
{
super(communicator);
}
diff --git a/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginTwoFailFactory.java b/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginTwoFailFactory.java
index 8d4928953ce..8d9562f98b7 100644
--- a/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginTwoFailFactory.java
+++ b/java/test/plugins/src/main/java/test/Ice/plugin/plugins/PluginTwoFailFactory.java
@@ -9,17 +9,17 @@
package test.Ice.plugin.plugins;
-public class PluginTwoFailFactory implements Ice.PluginFactory
+public class PluginTwoFailFactory implements com.zeroc.Ice.PluginFactory
{
@Override
- public Ice.Plugin create(Ice.Communicator communicator, String name, String[] args)
+ public com.zeroc.Ice.Plugin create(com.zeroc.Ice.Communicator communicator, String name, String[] args)
{
return new PluginTwoFail(communicator);
}
static class PluginTwoFail extends BasePluginFail
{
- public PluginTwoFail(Ice.Communicator communicator)
+ public PluginTwoFail(com.zeroc.Ice.Communicator communicator)
{
super(communicator);
}
diff --git a/java/test/slice.gradle b/java/test/slice.gradle
index 5987a702d63..dca89b97428 100644
--- a/java/test/slice.gradle
+++ b/java/test/slice.gradle
@@ -35,6 +35,7 @@ task testSliceTask {
'Ice/location/*.ice',
'Ice/metrics/*.ice',
'Ice/networkProxy/*.ice',
+ 'Ice/operations/*.ice',
'Ice/proxy/*.ice',
'Ice/retry/*.ice',
'Ice/seqMapping/*.ice',
@@ -63,23 +64,19 @@ task testSliceTask {
'Slice/structure/*.ice'])
}
set2 {
- args = "--tie"
- files = fileTree(dir: testDir, includes:['Ice/operations/*.ice'])
- }
- set4 {
args = "--checksum test.Ice.checksum.Test.SliceChecksums"
files = fileTree(dir: testDir, includes:['Ice/checksum/Test.ice',
'Ice/checksum/Types.ice'])
}
- set5 {
- include = ["${testDir}/Ice/packagemd"]
- files = fileTree(dir: testDir, includes:['Ice/packagemd/*.ice'])
- }
- set6 {
+ set3 {
args = "--checksum test.Ice.checksum.server.Test.SliceChecksums"
files = fileTree(dir: testDir, includes:['Ice/checksum/TestServer.ice',
'Ice/checksum/TypesServer.ice'])
}
+ set4 {
+ include = ["${testDir}/Ice/packagemd"]
+ files = fileTree(dir: testDir, includes:['Ice/packagemd/*.ice'])
+ }
}
}
}
diff --git a/java/test/src/main/java/test/Glacier2/router/CallbackI.java b/java/test/src/main/java/test/Glacier2/router/CallbackI.java
index 238b760b11f..fd46c51b863 100644
--- a/java/test/src/main/java/test/Glacier2/router/CallbackI.java
+++ b/java/test/src/main/java/test/Glacier2/router/CallbackI.java
@@ -11,29 +11,26 @@ package test.Glacier2.router;
import test.Glacier2.router.Test.CallbackException;
import test.Glacier2.router.Test.CallbackReceiverPrx;
-import test.Glacier2.router.Test._CallbackDisp;
+import test.Glacier2.router.Test.Callback;
-final class CallbackI extends _CallbackDisp
+final class CallbackI implements Callback
{
CallbackI()
{
}
- public void
- initiateCallback(CallbackReceiverPrx proxy, Ice.Current current)
+ public void initiateCallback(CallbackReceiverPrx proxy, com.zeroc.Ice.Current current)
{
proxy.callback(current.ctx);
}
- public void
- initiateCallbackEx(CallbackReceiverPrx proxy, Ice.Current current)
+ public void initiateCallbackEx(CallbackReceiverPrx proxy, com.zeroc.Ice.Current current)
throws CallbackException
{
proxy.callbackEx(current.ctx);
}
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
diff --git a/java/test/src/main/java/test/Glacier2/router/CallbackReceiverI.java b/java/test/src/main/java/test/Glacier2/router/CallbackReceiverI.java
index 27c1778087d..415508c1867 100644
--- a/java/test/src/main/java/test/Glacier2/router/CallbackReceiverI.java
+++ b/java/test/src/main/java/test/Glacier2/router/CallbackReceiverI.java
@@ -10,25 +10,23 @@
package test.Glacier2.router;
import test.Glacier2.router.Test.CallbackException;
-import test.Glacier2.router.Test._CallbackReceiverDisp;
+import test.Glacier2.router.Test.CallbackReceiver;
-final class CallbackReceiverI extends _CallbackReceiverDisp
+final class CallbackReceiverI implements CallbackReceiver
{
CallbackReceiverI()
{
_callback = false;
}
- public synchronized void
- callback(Ice.Current current)
+ public synchronized void callback(com.zeroc.Ice.Current current)
{
assert(!_callback);
_callback = true;
notify();
}
- public void
- callbackEx(Ice.Current current)
+ public void callbackEx(com.zeroc.Ice.Current current)
throws CallbackException
{
callback(current);
@@ -38,8 +36,7 @@ final class CallbackReceiverI extends _CallbackReceiverDisp
throw ex;
}
- synchronized void
- callbackOK()
+ synchronized void callbackOK()
{
while(!_callback)
{
diff --git a/java/test/src/main/java/test/Glacier2/router/Client.java b/java/test/src/main/java/test/Glacier2/router/Client.java
index 5bec46a2cec..c8fe174ee29 100644
--- a/java/test/src/main/java/test/Glacier2/router/Client.java
+++ b/java/test/src/main/java/test/Glacier2/router/Client.java
@@ -13,15 +13,11 @@ import java.io.PrintWriter;
import test.Glacier2.router.Test.CallbackException;
import test.Glacier2.router.Test.CallbackPrx;
-import test.Glacier2.router.Test.CallbackPrxHelper;
import test.Glacier2.router.Test.CallbackReceiverPrx;
-import test.Glacier2.router.Test.CallbackReceiverPrxHelper;
-
public class Client extends test.Util.Application
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -29,10 +25,9 @@ public class Client extends test.Util.Application
}
}
- public int
- run(String[] args)
+ public int run(String[] args)
{
- Ice.ObjectPrx routerBase;
+ com.zeroc.Ice.ObjectPrx routerBase;
PrintWriter out = getWriter();
{
@@ -41,13 +36,13 @@ public class Client extends test.Util.Application
routerBase = communicator().stringToProxy("Glacier2/router:default -p 12347");
out.println("ok");
}
-
- Glacier2.RouterPrx router;
+
+ com.zeroc.Glacier2.RouterPrx router;
{
out.print("testing checked cast for router... ");
out.flush();
- router = Glacier2.RouterPrxHelper.checkedCast(routerBase);
+ router = com.zeroc.Glacier2.RouterPrx.checkedCast(routerBase);
test(router != null);
out.println("ok");
}
@@ -55,7 +50,7 @@ public class Client extends test.Util.Application
{
out.print("testing router finder... ");
out.flush();
- Ice.RouterFinderPrx finder = Ice.RouterFinderPrxHelper.uncheckedCast(
+ com.zeroc.Ice.RouterFinderPrx finder = com.zeroc.Ice.RouterFinderPrx.uncheckedCast(
communicator().stringToProxy("Ice/RouterFinder:default -p 12347"));
test(finder.getRouter().ice_getIdentity().equals(router.ice_getIdentity()));
out.println("ok");
@@ -76,7 +71,7 @@ public class Client extends test.Util.Application
out.println("ok");
}
- Ice.ObjectPrx base;
+ com.zeroc.Ice.ObjectPrx base;
{
out.print("testing stringToProxy for server object... ");
@@ -84,7 +79,7 @@ public class Client extends test.Util.Application
base = communicator().stringToProxy("c1/callback:tcp -p 12010");
out.println("ok");
}
-
+
{
out.print("trying to ping server before session creation... ");
out.flush();
@@ -93,11 +88,11 @@ public class Client extends test.Util.Application
base.ice_ping();
test(false);
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
out.println("ok");
}
- catch(Ice.SocketException ex)
+ catch(com.zeroc.Ice.SocketException ex)
{
//
// The JSSE implementation in the AIX JDK appears to have a
@@ -123,11 +118,11 @@ public class Client extends test.Util.Application
router.createSession("userid", "xxx");
test(false);
}
- catch(Glacier2.PermissionDeniedException ex)
+ catch(com.zeroc.Glacier2.PermissionDeniedException ex)
{
out.println("ok");
}
- catch(Glacier2.CannotCreateSessionException ex)
+ catch(com.zeroc.Glacier2.CannotCreateSessionException ex)
{
test(false);
}
@@ -141,7 +136,7 @@ public class Client extends test.Util.Application
router.destroySession();
test(false);
}
- catch(Glacier2.SessionNotExistException ex)
+ catch(com.zeroc.Glacier2.SessionNotExistException ex)
{
out.println("ok");
}
@@ -154,11 +149,11 @@ public class Client extends test.Util.Application
{
router.createSession("userid", "abc123");
}
- catch(Glacier2.PermissionDeniedException ex)
+ catch(com.zeroc.Glacier2.PermissionDeniedException ex)
{
test(false);
}
- catch(Glacier2.CannotCreateSessionException ex)
+ catch(com.zeroc.Glacier2.CannotCreateSessionException ex)
{
test(false);
}
@@ -173,11 +168,11 @@ public class Client extends test.Util.Application
router.createSession("userid", "abc123");
test(false);
}
- catch(Glacier2.PermissionDeniedException ex)
+ catch(com.zeroc.Glacier2.PermissionDeniedException ex)
{
test(false);
}
- catch(Glacier2.CannotCreateSessionException ex)
+ catch(com.zeroc.Glacier2.CannotCreateSessionException ex)
{
out.println("ok");
}
@@ -195,12 +190,12 @@ public class Client extends test.Util.Application
{
out.print("testing checked cast for server object... ");
out.flush();
- twoway = CallbackPrxHelper.checkedCast(base);
+ twoway = CallbackPrx.checkedCast(base);
test(twoway != null);
out.println("ok");
}
- Ice.ObjectAdapter adapter;
+ com.zeroc.Ice.ObjectAdapter adapter;
{
out.print("creating and activating callback receiver adapter... ");
@@ -221,33 +216,32 @@ public class Client extends test.Util.Application
}
CallbackReceiverI callbackReceiverImpl;
- Ice.Object callbackReceiver;
+ com.zeroc.Ice.Object callbackReceiver;
CallbackReceiverPrx twowayR;
CallbackReceiverPrx fakeTwowayR;
-
+
{
out.print("creating and adding callback receiver object... ");
out.flush();
callbackReceiverImpl = new CallbackReceiverI();
callbackReceiver = callbackReceiverImpl;
- Ice.Identity callbackReceiverIdent = new Ice.Identity();
+ com.zeroc.Ice.Identity callbackReceiverIdent = new com.zeroc.Ice.Identity();
callbackReceiverIdent.name = "callbackReceiver";
callbackReceiverIdent.category = category;
- twowayR = CallbackReceiverPrxHelper.uncheckedCast(adapter.add(callbackReceiver, callbackReceiverIdent));
- Ice.Identity fakeCallbackReceiverIdent = new Ice.Identity();
+ twowayR = CallbackReceiverPrx.uncheckedCast(adapter.add(callbackReceiver, callbackReceiverIdent));
+ com.zeroc.Ice.Identity fakeCallbackReceiverIdent = new com.zeroc.Ice.Identity();
fakeCallbackReceiverIdent.name = "callbackReceiver";
fakeCallbackReceiverIdent.category = "dummy";
- fakeTwowayR = CallbackReceiverPrxHelper.uncheckedCast(
- adapter.add(callbackReceiver, fakeCallbackReceiverIdent));
+ fakeTwowayR = CallbackReceiverPrx.uncheckedCast(adapter.add(callbackReceiver, fakeCallbackReceiverIdent));
out.println("ok");
}
-
+
{
out.print("testing oneway callback... ");
out.flush();
- CallbackPrx oneway = CallbackPrxHelper.uncheckedCast(twoway.ice_oneway());
- CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_oneway());
- java.util.Map<String, String> context = new java.util.HashMap<String, String>();
+ CallbackPrx oneway = twoway.ice_oneway();
+ CallbackReceiverPrx onewayR = twowayR.ice_oneway();
+ java.util.Map<String, String> context = new java.util.HashMap<>();
context.put("_fwd", "o");
oneway.initiateCallback(onewayR, context);
callbackReceiverImpl.callbackOK();
@@ -257,7 +251,7 @@ public class Client extends test.Util.Application
{
out.print("testing twoway callback... ");
out.flush();
- java.util.Map<String, String> context = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> context = new java.util.HashMap<>();
context.put("_fwd", "t");
twoway.initiateCallback(twowayR, context);
callbackReceiverImpl.callbackOK();
@@ -267,7 +261,7 @@ public class Client extends test.Util.Application
{
out.print("ditto, but with user exception... ");
out.flush();
- java.util.Map<String, String> context = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> context = new java.util.HashMap<>();
context.put("_fwd", "t");
try
{
@@ -286,14 +280,14 @@ public class Client extends test.Util.Application
{
out.print("trying twoway callback with fake category... ");
out.flush();
- java.util.Map<String, String> context = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> context = new java.util.HashMap<>();
context.put("_fwd", "t");
try
{
twoway.initiateCallback(fakeTwowayR, context);
test(false);
}
- catch(Ice.ObjectNotExistException ex)
+ catch(com.zeroc.Ice.ObjectNotExistException ex)
{
out.println("ok");
}
@@ -302,45 +296,45 @@ public class Client extends test.Util.Application
{
out.print("testing whether other allowed category is accepted... ");
out.flush();
- java.util.Map<String, String> context = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> context = new java.util.HashMap<>();
context.put("_fwd", "t");
- CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast(
- twoway.ice_identity(Ice.Util.stringToIdentity("c2/callback")));
+ CallbackPrx otherCategoryTwoway = CallbackPrx.uncheckedCast(
+ twoway.ice_identity(com.zeroc.Ice.Util.stringToIdentity("c2/callback")));
otherCategoryTwoway.initiateCallback(twowayR, context);
callbackReceiverImpl.callbackOK();
out.println("ok");
}
-
+
{
out.print("testing whether disallowed category gets rejected... ");
out.flush();
- java.util.Map<String, String> context = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> context = new java.util.HashMap<>();
context.put("_fwd", "t");
try
{
- CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast(
- twoway.ice_identity(Ice.Util.stringToIdentity("c3/callback")));
+ CallbackPrx otherCategoryTwoway = CallbackPrx.uncheckedCast(
+ twoway.ice_identity(com.zeroc.Ice.Util.stringToIdentity("c3/callback")));
otherCategoryTwoway.initiateCallback(twowayR, context);
test(false);
}
- catch(Ice.ObjectNotExistException ex)
+ catch(com.zeroc.Ice.ObjectNotExistException ex)
{
out.println("ok");
}
}
-
+
{
out.print("testing whether user-id as category is accepted... ");
out.flush();
- java.util.Map<String, String> context = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> context = new java.util.HashMap<>();
context.put("_fwd", "t");
- CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast(
- twoway.ice_identity(Ice.Util.stringToIdentity("_userid/callback")));
+ CallbackPrx otherCategoryTwoway = CallbackPrx.uncheckedCast(
+ twoway.ice_identity(com.zeroc.Ice.Util.stringToIdentity("_userid/callback")));
otherCategoryTwoway.initiateCallback(twowayR, context);
callbackReceiverImpl.callbackOK();
out.println("ok");
}
-
+
{
out.print("testing server shutdown... ");
out.flush();
@@ -356,13 +350,13 @@ public class Client extends test.Util.Application
}
// If we use the glacier router, the exact exception reason gets
// lost.
- catch(Ice.UnknownLocalException ex)
+ catch(com.zeroc.Ice.UnknownLocalException ex)
{
System.out.println("ok");
}
*/
}
-
+
{
out.print("destroying session... ");
out.flush();
@@ -370,17 +364,17 @@ public class Client extends test.Util.Application
{
router.destroySession();
}
- catch(Glacier2.SessionNotExistException ex)
+ catch(com.zeroc.Glacier2.SessionNotExistException ex)
{
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
out.println("ok");
}
-
+
{
out.print("trying to ping server after session destruction... ");
out.flush();
@@ -389,11 +383,11 @@ public class Client extends test.Util.Application
base.ice_ping();
test(false);
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
out.println("ok");
}
- catch(Ice.SocketException ex)
+ catch(com.zeroc.Ice.SocketException ex)
{
//
// The JSSE implementation in the AIX JDK appears to have a
@@ -410,7 +404,7 @@ public class Client extends test.Util.Application
}
}
}
-
+
if(args.length >= 1 && args[0].equals("--shutdown"))
{
{
@@ -419,15 +413,15 @@ public class Client extends test.Util.Application
communicator().setDefaultRouter(null);
out.println("ok");
}
-
- Ice.ObjectPrx processBase;
-
+
+ com.zeroc.Ice.ObjectPrx processBase;
+
{
out.print("testing stringToProxy for process object... ");
processBase = communicator().stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348");
out.println("ok");
}
-
+
/*
{
out.print("uninstalling router with process object... ");
@@ -435,16 +429,16 @@ public class Client extends test.Util.Application
out.println("ok");
}
*/
-
- Ice.ProcessPrx process;
-
+
+ com.zeroc.Ice.ProcessPrx process;
+
{
out.print("testing checked cast for admin object... ");
- process = Ice.ProcessPrxHelper.checkedCast(processBase);
+ process = com.zeroc.Ice.ProcessPrx.checkedCast(processBase);
test(process != null);
out.println("ok");
}
-
+
out.print("testing Glacier2 shutdown... ");
process.shutdown();
try
@@ -452,32 +446,30 @@ public class Client extends test.Util.Application
process.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
out.println("ok");
}
}
-
+
return 0;
}
-
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
- {
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("Ice.Package.Test", "test.Glacier2.router");
- return initData;
+ @Override
+ protected GetInitDataResult getInitData(String[] args)
+ {
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ r.initData.properties.setProperty("Ice.Warn.Connections", "0");
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Glacier2.router");
+ return r;
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
Client c = new Client();
int status = c.main("Client", args);
-
+
System.gc();
System.exit(status);
}
diff --git a/java/test/src/main/java/test/Glacier2/router/Server.java b/java/test/src/main/java/test/Glacier2/router/Server.java
index 562b8647b4e..210ff1e4348 100644
--- a/java/test/src/main/java/test/Glacier2/router/Server.java
+++ b/java/test/src/main/java/test/Glacier2/router/Server.java
@@ -11,40 +11,36 @@ package test.Glacier2.router;
public class Server extends test.Util.Application
{
- public int
- run(String[] args)
+ public int run(String[] args)
{
communicator().getProperties().setProperty("CallbackAdapter.Endpoints", "tcp -p 12010");
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter");
adapter.add(new CallbackI(),
- Ice.Util.stringToIdentity("c1/callback")); // The test allows "c1" as category.
+ com.zeroc.Ice.Util.stringToIdentity("c1/callback")); // The test allows "c1" as category.
adapter.add(new CallbackI(),
- Ice.Util.stringToIdentity("c2/callback")); // The test allows "c2" as category.
+ com.zeroc.Ice.Util.stringToIdentity("c2/callback")); // The test allows "c2" as category.
adapter.add(new CallbackI(),
- Ice.Util.stringToIdentity("c3/callback")); // The test rejects "c3" as category.
+ com.zeroc.Ice.Util.stringToIdentity("c3/callback")); // The test rejects "c3" as category.
adapter.add(new CallbackI(),
- Ice.Util.stringToIdentity("_userid/callback")); // The test allows the prefixed userid.
+ com.zeroc.Ice.Util.stringToIdentity("_userid/callback")); // The test allows the prefixed userid.
adapter.activate();
communicator().waitForShutdown();
return 0;
}
-
-
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
- {
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Glacier2.router");
- return initData;
+ @Override
+ protected GetInitDataResult getInitData(String[] args)
+ {
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Glacier2.router");
+ return r;
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
Server c = new Server();
int status = c.main("Server", args);
-
+
System.gc();
System.exit(status);
}
diff --git a/java/test/src/main/java/test/Glacier2/sessionHelper/CallbackI.java b/java/test/src/main/java/test/Glacier2/sessionHelper/CallbackI.java
index 94826cf89dc..8803f15cba6 100644
--- a/java/test/src/main/java/test/Glacier2/sessionHelper/CallbackI.java
+++ b/java/test/src/main/java/test/Glacier2/sessionHelper/CallbackI.java
@@ -11,29 +11,26 @@ package test.Glacier2.sessionHelper;
import test.Glacier2.sessionHelper.Test.CallbackException;
import test.Glacier2.sessionHelper.Test.CallbackReceiverPrx;
-import test.Glacier2.sessionHelper.Test._CallbackDisp;
+import test.Glacier2.sessionHelper.Test.Callback;
-final class CallbackI extends _CallbackDisp
+final class CallbackI implements Callback
{
CallbackI()
{
}
- public void
- initiateCallback(CallbackReceiverPrx proxy, Ice.Current current)
+ public void initiateCallback(CallbackReceiverPrx proxy, com.zeroc.Ice.Current current)
{
proxy.callback(current.ctx);
}
- public void
- initiateCallbackEx(CallbackReceiverPrx proxy, Ice.Current current)
+ public void initiateCallbackEx(CallbackReceiverPrx proxy, com.zeroc.Ice.Current current)
throws CallbackException
{
proxy.callbackEx(current.ctx);
}
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
diff --git a/java/test/src/main/java/test/Glacier2/sessionHelper/Client.java b/java/test/src/main/java/test/Glacier2/sessionHelper/Client.java
index 94325f9a9c7..b7c9010785b 100644
--- a/java/test/src/main/java/test/Glacier2/sessionHelper/Client.java
+++ b/java/test/src/main/java/test/Glacier2/sessionHelper/Client.java
@@ -12,7 +12,6 @@ package test.Glacier2.sessionHelper;
import javax.swing.SwingUtilities;
import java.io.PrintWriter;
import test.Glacier2.sessionHelper.Test.CallbackPrx;
-import test.Glacier2.sessionHelper.Test.CallbackPrxHelper;
public class Client extends test.Util.Application
{
@@ -22,8 +21,7 @@ public class Client extends test.Util.Application
me = this;
}
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -32,22 +30,20 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- _initData = createInitializationData();
- _initData.properties = Ice.Util.createProperties(argsH);
+ GetInitDataResult r = super.getInitData(args);
+ _initData = r.initData;
_initData.properties.setProperty("Ice.Default.Router", "Glacier2/router:default -p 12347");
- _initData.dispatcher = new Ice.Dispatcher()
+ _initData.dispatcher = new com.zeroc.Ice.Dispatcher()
{
@Override
- public void
- dispatch(Runnable runnable, Ice.Connection connection)
+ public void dispatch(Runnable runnable, com.zeroc.Ice.Connection connection)
{
SwingUtilities.invokeLater(runnable);
}
};
-
- return _initData;
+ return r;
}
@Override
@@ -56,32 +52,29 @@ public class Client extends test.Util.Application
String protocol = communicator().getProperties().getPropertyWithDefault("Ice.Default.Protocol", "tcp");
String host = communicator().getProperties().getPropertyWithDefault("Ice.Default.Host", "127.0.0.1");
- _factory = new Glacier2.SessionFactoryHelper(_initData, new Glacier2.SessionCallback()
+ _factory = new com.zeroc.Glacier2.SessionFactoryHelper(_initData, new com.zeroc.Glacier2.SessionCallback()
{
@Override
- public void
- connected(Glacier2.SessionHelper session)
- throws Glacier2.SessionNotExistException
+ public void connected(com.zeroc.Glacier2.SessionHelper session)
+ throws com.zeroc.Glacier2.SessionNotExistException
{
test(false);
}
@Override
- public void
- disconnected(Glacier2.SessionHelper session)
+ public void disconnected(com.zeroc.Glacier2.SessionHelper session)
{
test(false);
}
@Override
- public void
- connectFailed(Glacier2.SessionHelper session, Throwable exception)
+ public void connectFailed(com.zeroc.Glacier2.SessionHelper session, Throwable exception)
{
try
{
throw exception;
}
- catch(Glacier2.PermissionDeniedException ex)
+ catch(com.zeroc.Glacier2.PermissionDeniedException ex)
{
out.println("ok");
synchronized(test.Glacier2.sessionHelper.Client.this)
@@ -91,13 +84,13 @@ public class Client extends test.Util.Application
}
catch(Throwable ex)
{
+ ex.printStackTrace();
test(false);
}
}
@Override
- public void
- createdCommunicator(Glacier2.SessionHelper session)
+ public void createdCommunicator(com.zeroc.Glacier2.SessionHelper session)
{
test(session.communicator() != null);
}
@@ -126,32 +119,29 @@ public class Client extends test.Util.Application
}
_initData.properties.setProperty("Ice.Default.Router", "");
- _factory = new Glacier2.SessionFactoryHelper(_initData, new Glacier2.SessionCallback()
+ _factory = new com.zeroc.Glacier2.SessionFactoryHelper(_initData, new com.zeroc.Glacier2.SessionCallback()
{
@Override
- public void
- connected(Glacier2.SessionHelper session)
- throws Glacier2.SessionNotExistException
+ public void connected(com.zeroc.Glacier2.SessionHelper session)
+ throws com.zeroc.Glacier2.SessionNotExistException
{
test(false);
}
@Override
- public void
- disconnected(Glacier2.SessionHelper session)
+ public void disconnected(com.zeroc.Glacier2.SessionHelper session)
{
test(false);
}
@Override
- public void
- connectFailed(Glacier2.SessionHelper session, Throwable exception)
+ public void connectFailed(com.zeroc.Glacier2.SessionHelper session, Throwable exception)
{
try
{
throw exception;
}
- catch(Ice.CommunicatorDestroyedException ex)
+ catch(com.zeroc.Ice.CommunicatorDestroyedException ex)
{
out.println("ok");
synchronized(test.Glacier2.sessionHelper.Client.this)
@@ -166,8 +156,7 @@ public class Client extends test.Util.Application
}
@Override
- public void
- createdCommunicator(Glacier2.SessionHelper session)
+ public void createdCommunicator(com.zeroc.Glacier2.SessionHelper session)
{
test(session.communicator() != null);
}
@@ -208,12 +197,11 @@ public class Client extends test.Util.Application
}
};
- _factory = new Glacier2.SessionFactoryHelper(_initData, new Glacier2.SessionCallback()
+ _factory = new com.zeroc.Glacier2.SessionFactoryHelper(_initData, new com.zeroc.Glacier2.SessionCallback()
{
@Override
- public void
- connected(Glacier2.SessionHelper session)
- throws Glacier2.SessionNotExistException
+ public void connected(com.zeroc.Glacier2.SessionHelper session)
+ throws com.zeroc.Glacier2.SessionNotExistException
{
out.println("ok");
synchronized(test.Glacier2.sessionHelper.Client.this)
@@ -223,8 +211,7 @@ public class Client extends test.Util.Application
}
@Override
- public void
- disconnected(Glacier2.SessionHelper session)
+ public void disconnected(com.zeroc.Glacier2.SessionHelper session)
{
out.println("ok");
synchronized(test.Glacier2.sessionHelper.Client.this)
@@ -234,15 +221,13 @@ public class Client extends test.Util.Application
}
@Override
- public void
- connectFailed(Glacier2.SessionHelper session, Throwable ex)
+ public void connectFailed(com.zeroc.Glacier2.SessionHelper session, Throwable ex)
{
test(false);
}
@Override
- public void
- createdCommunicator(Glacier2.SessionHelper session)
+ public void createdCommunicator(com.zeroc.Glacier2.SessionHelper session)
{
test(session.communicator() != null);
}
@@ -279,7 +264,7 @@ public class Client extends test.Util.Application
{
test(!_session.categoryForClient().equals(""));
}
- catch(Glacier2.SessionNotExistException ex)
+ catch(com.zeroc.Glacier2.SessionNotExistException ex)
{
test(false);
}
@@ -289,14 +274,14 @@ public class Client extends test.Util.Application
// {
// test(_session.session() != null);
// }
-// catch(Glacier2.SessionNotExistException ex)
+// catch(com.zeroc.Glacier2.SessionNotExistException ex)
// {
// test(false);
// }
out.print("testing stringToProxy for server object... ");
out.flush();
- Ice.ObjectPrx base = _session.communicator().stringToProxy("callback:default -p 12010");
+ com.zeroc.Ice.ObjectPrx base = _session.communicator().stringToProxy("callback:default -p 12010");
out.println("ok");
out.print("pinging server after session creation... ");
@@ -306,7 +291,7 @@ public class Client extends test.Util.Application
out.print("testing checked cast for server object... ");
out.flush();
- CallbackPrx twoway = CallbackPrxHelper.checkedCast(base);
+ CallbackPrx twoway = CallbackPrx.checkedCast(base);
test(twoway != null);
out.println("ok");
@@ -343,7 +328,7 @@ public class Client extends test.Util.Application
test(!_session.categoryForClient().equals(""));
test(false);
}
- catch(Glacier2.SessionNotExistException ex)
+ catch(com.zeroc.Glacier2.SessionNotExistException ex)
{
}
out.println("ok");
@@ -354,7 +339,7 @@ public class Client extends test.Util.Application
_session.session();
test(false);
}
- catch(Glacier2.SessionNotExistException ex)
+ catch(com.zeroc.Glacier2.SessionNotExistException ex)
{
}
out.println("ok");
@@ -367,7 +352,7 @@ public class Client extends test.Util.Application
_session.communicator().stringToProxy("dummy");
test(false);
}
- catch(Ice.CommunicatorDestroyedException ex)
+ catch(com.zeroc.Ice.CommunicatorDestroyedException ex)
{
}
out.println("ok");
@@ -378,18 +363,18 @@ public class Client extends test.Util.Application
communicator().setDefaultRouter(null);
out.println("ok");
- Ice.ObjectPrx processBase;
+ com.zeroc.Ice.ObjectPrx processBase;
{
out.print("testing stringToProxy for process object... ");
- processBase = communicator().stringToProxy("Glacier2/admin -f Process:default -h \"" + host + "\" -p 12348");
+ processBase = communicator().stringToProxy("Glacier2/admin -f Process:default -h \"" + host +
+ "\" -p 12348");
out.println("ok");
}
-
- Ice.ProcessPrx process;
+ com.zeroc.Ice.ProcessPrx process;
{
out.print("testing checked cast for admin object... ");
- process = Ice.ProcessPrxHelper.checkedCast(processBase);
+ process = com.zeroc.Ice.ProcessPrx.checkedCast(processBase);
test(process != null);
out.println("ok");
}
@@ -401,38 +386,35 @@ public class Client extends test.Util.Application
process.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
out.println("ok");
}
}
- _factory = new Glacier2.SessionFactoryHelper(_initData, new Glacier2.SessionCallback()
+ _factory = new com.zeroc.Glacier2.SessionFactoryHelper(_initData, new com.zeroc.Glacier2.SessionCallback()
{
@Override
- public void
- connected(Glacier2.SessionHelper session)
- throws Glacier2.SessionNotExistException
+ public void connected(com.zeroc.Glacier2.SessionHelper session)
+ throws com.zeroc.Glacier2.SessionNotExistException
{
test(false);
}
@Override
- public void
- disconnected(Glacier2.SessionHelper session)
+ public void disconnected(com.zeroc.Glacier2.SessionHelper session)
{
test(false);
}
@Override
- public void
- connectFailed(Glacier2.SessionHelper session, Throwable exception)
+ public void connectFailed(com.zeroc.Glacier2.SessionHelper session, Throwable exception)
{
try
{
throw exception;
}
- catch(Ice.ConnectFailedException ex)
+ catch(com.zeroc.Ice.ConnectFailedException ex)
{
out.println("ok");
synchronized(test.Glacier2.sessionHelper.Client.this)
@@ -447,8 +429,7 @@ public class Client extends test.Util.Application
}
@Override
- public void
- createdCommunicator(Glacier2.SessionHelper session)
+ public void createdCommunicator(com.zeroc.Glacier2.SessionHelper session)
{
test(session.communicator() != null);
}
@@ -503,7 +484,7 @@ public class Client extends test.Util.Application
_session.communicator().stringToProxy("dummy");
test(false);
}
- catch(Ice.CommunicatorDestroyedException ex)
+ catch(com.zeroc.Ice.CommunicatorDestroyedException ex)
{
}
out.println("ok");
@@ -517,14 +498,12 @@ public class Client extends test.Util.Application
return 0;
}
- public static void
- wakeUp()
+ public static void wakeUp()
{
me.notify();
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
Client c = new Client();
int status = c.main("Client", args);
@@ -533,9 +512,9 @@ public class Client extends test.Util.Application
System.exit(status);
}
- private Glacier2.SessionHelper _session;
- private Glacier2.SessionFactoryHelper _factory;
- private Ice.InitializationData _initData;
+ private com.zeroc.Glacier2.SessionHelper _session;
+ private com.zeroc.Glacier2.SessionFactoryHelper _factory;
+ private com.zeroc.Ice.InitializationData _initData;
static public Client me;
final public PrintWriter out;
}
diff --git a/java/test/src/main/java/test/Glacier2/sessionHelper/Server.java b/java/test/src/main/java/test/Glacier2/sessionHelper/Server.java
index 5e2108c78e0..e7bb210aaf2 100644
--- a/java/test/src/main/java/test/Glacier2/sessionHelper/Server.java
+++ b/java/test/src/main/java/test/Glacier2/sessionHelper/Server.java
@@ -11,32 +11,28 @@ package test.Glacier2.sessionHelper;
public class Server extends test.Util.Application
{
- public int
- run(String[] args)
+ public int run(String[] args)
{
communicator().getProperties().setProperty("DeactivatedAdapter.Endpoints", "default -p 12011");
communicator().createObjectAdapter("DeactivatedAdapter");
communicator().getProperties().setProperty("CallbackAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter");
- adapter.add(new CallbackI(), Ice.Util.stringToIdentity("callback"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter");
+ adapter.add(new CallbackI(), com.zeroc.Ice.Util.stringToIdentity("callback"));
adapter.activate();
communicator().waitForShutdown();
return 0;
}
-
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ @Override
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Glacier2.router");
-
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Glacier2.router");
+ return r;
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
Server c = new Server();
int status = c.main("Server", args);
diff --git a/java/test/src/main/java/test/Ice/acm/AllTests.java b/java/test/src/main/java/test/Ice/acm/AllTests.java
index c68ba2166f5..9611da859aa 100644
--- a/java/test/src/main/java/test/Ice/acm/AllTests.java
+++ b/java/test/src/main/java/test/Ice/acm/AllTests.java
@@ -12,17 +12,18 @@ package test.Ice.acm;
import java.io.PrintWriter;
import test.Ice.acm.Test.RemoteCommunicatorPrx;
-import test.Ice.acm.Test.RemoteCommunicatorPrxHelper;
import test.Ice.acm.Test.RemoteObjectAdapterPrx;
import test.Ice.acm.Test.TestIntfPrx;
-import test.Ice.acm.Test.TestIntfPrxHelper;
import test.Util.Application;
+import com.zeroc.Ice.ACMClose;
+import com.zeroc.Ice.ACMHeartbeat;
+
public class AllTests
{
- private static Ice.Communicator communicator;
- private static void
- test(boolean b)
+ private static com.zeroc.Ice.Communicator communicator;
+
+ private static void test(boolean b)
{
if(!b)
{
@@ -30,7 +31,7 @@ public class AllTests
}
}
- static class LoggerI implements Ice.Logger
+ static class LoggerI implements com.zeroc.Ice.Logger
{
LoggerI(java.io.PrintWriter out)
{
@@ -99,7 +100,7 @@ public class AllTests
return "";
}
- public Ice.Logger cloneWithPrefix(String prefix)
+ public com.zeroc.Ice.Logger cloneWithPrefix(String prefix)
{
return this;
}
@@ -114,9 +115,9 @@ public class AllTests
}
private boolean _started;
- private java.util.List<String> _messages = new java.util.ArrayList<String>();
+ private java.util.List<String> _messages = new java.util.ArrayList<>();
private java.io.PrintWriter _out;
- };
+ }
static abstract class TestCase
{
@@ -143,7 +144,7 @@ public class AllTests
{
_adapter = _com.createObjectAdapter(_serverACMTimeout, _serverACMClose, _serverACMHeartbeat);
- Ice.InitializationData initData = _app.createInitializationData();
+ com.zeroc.Ice.InitializationData initData = _app.createInitializationData();
initData.properties = _app.communicator().getProperties()._clone();
initData.logger = _logger;
initData.properties.setProperty("Ice.ACM.Timeout", "1");
@@ -211,40 +212,32 @@ public class AllTests
public void run()
{
- TestIntfPrx proxy = TestIntfPrxHelper.uncheckedCast(_communicator.stringToProxy(
- _adapter.getTestIntf().toString()));
+ TestIntfPrx proxy = TestIntfPrx.uncheckedCast(_communicator.stringToProxy(
+ _adapter.getTestIntf().toString()));
try
{
- proxy.ice_getConnection().setCloseCallback(new Ice.CloseCallback()
- {
- @Override
- public void closed(Ice.Connection con)
+ proxy.ice_getConnection().setCloseCallback(con ->
{
synchronized(TestCase.this)
{
_closed = true;
TestCase.this.notify();
}
- }
- });
+ });
- proxy.ice_getConnection().setHeartbeatCallback(new Ice.HeartbeatCallback()
- {
- @Override
- public void heartbeat(Ice.Connection con)
+ proxy.ice_getConnection().setHeartbeatCallback(con ->
{
synchronized(TestCase.this)
{
++_heartbeat;
}
- }
- });
+ });
runTestCase(_adapter, proxy);
}
catch(Exception ex)
{
- _msg = "unexpected exception:\n" + IceInternal.Ex.toString(ex);
+ _msg = "unexpected exception:\n" + com.zeroc.IceInternal.Ex.toString(ex);
}
}
@@ -252,11 +245,11 @@ public class AllTests
{
while(!_closed)
{
- long now = IceInternal.Time.currentMonotonicTimeMillis();
+ long now = com.zeroc.IceInternal.Time.currentMonotonicTimeMillis();
try
{
wait(1000);
- if(IceInternal.Time.currentMonotonicTimeMillis() - now > 1000)
+ if(com.zeroc.IceInternal.Time.currentMonotonicTimeMillis() - now > 1000)
{
test(false); // Waited for more than 1s for close, something's wrong.
}
@@ -290,7 +283,7 @@ public class AllTests
private LoggerI _logger;
private Thread _thread;
- private Ice.Communicator _communicator;
+ private com.zeroc.Ice.Communicator _communicator;
private RemoteObjectAdapterPrx _adapter;
private int _clientACMTimeout;
@@ -302,7 +295,7 @@ public class AllTests
protected int _heartbeat;
protected boolean _closed;
- };
+ }
static class InvocationHeartbeatTest extends TestCase
{
@@ -336,7 +329,7 @@ public class AllTests
proxy.sleepAndHold(10);
test(false);
}
- catch(Ice.ConnectionTimeoutException ex)
+ catch(com.zeroc.Ice.ConnectionTimeoutException ex)
{
adapter.activate();
proxy.interruptSleep();
@@ -363,7 +356,7 @@ public class AllTests
proxy.sleep(10);
test(false);
}
- catch(Ice.ConnectionTimeoutException ex)
+ catch(com.zeroc.Ice.ConnectionTimeoutException ex)
{
proxy.interruptSleep();
waitForClosed();
@@ -585,26 +578,26 @@ public class AllTests
public void runTestCase(RemoteObjectAdapterPrx adapter, TestIntfPrx proxy)
{
- Ice.ACM acm = new Ice.ACM();
+ com.zeroc.Ice.ACM acm = new com.zeroc.Ice.ACM();
acm = proxy.ice_getCachedConnection().getACM();
test(acm.timeout == 15);
- test(acm.close == Ice.ACMClose.CloseOnIdleForceful);
- test(acm.heartbeat == Ice.ACMHeartbeat.HeartbeatOff);
+ test(acm.close == ACMClose.CloseOnIdleForceful);
+ test(acm.heartbeat == ACMHeartbeat.HeartbeatOff);
proxy.ice_getCachedConnection().setACM(null, null, null);
acm = proxy.ice_getCachedConnection().getACM();
test(acm.timeout == 15);
- test(acm.close == Ice.ACMClose.CloseOnIdleForceful);
- test(acm.heartbeat == Ice.ACMHeartbeat.HeartbeatOff);
+ test(acm.close == ACMClose.CloseOnIdleForceful);
+ test(acm.heartbeat == ACMHeartbeat.HeartbeatOff);
proxy.ice_getCachedConnection().setACM(
- new Ice.IntOptional(1),
- new Ice.Optional<Ice.ACMClose>(Ice.ACMClose.CloseOnInvocationAndIdle),
- new Ice.Optional<Ice.ACMHeartbeat>(Ice.ACMHeartbeat.HeartbeatAlways));
+ java.util.OptionalInt.of(1),
+ java.util.Optional.of(ACMClose.CloseOnInvocationAndIdle),
+ java.util.Optional.of(ACMHeartbeat.HeartbeatAlways));
acm = proxy.ice_getCachedConnection().getACM();
test(acm.timeout == 1);
- test(acm.close == Ice.ACMClose.CloseOnInvocationAndIdle);
- test(acm.heartbeat == Ice.ACMHeartbeat.HeartbeatAlways);
+ test(acm.close == ACMClose.CloseOnInvocationAndIdle);
+ test(acm.heartbeat == ACMHeartbeat.HeartbeatAlways);
// Make sure the client sends few heartbeats to the server
proxy.waitForHeartbeat(2);
@@ -614,11 +607,11 @@ public class AllTests
public static void
allTests(test.Util.Application app, PrintWriter out)
{
- Ice.Communicator communicator = app.communicator();
+ com.zeroc.Ice.Communicator communicator = app.communicator();
String ref = "communicator:default -p 12010";
- RemoteCommunicatorPrx com = RemoteCommunicatorPrxHelper.uncheckedCast(communicator.stringToProxy(ref));
+ RemoteCommunicatorPrx com = RemoteCommunicatorPrx.uncheckedCast(communicator.stringToProxy(ref));
- java.util.List<TestCase> tests = new java.util.ArrayList<TestCase>();
+ java.util.List<TestCase> tests = new java.util.ArrayList<>();
tests.add(new InvocationHeartbeatTest(app, com, out));
tests.add(new InvocationHeartbeatOnHoldTest(app, com, out));
diff --git a/java/test/src/main/java/test/Ice/acm/Client.java b/java/test/src/main/java/test/Ice/acm/Client.java
index 0b77fa4ff82..9378ec7a8c9 100644
--- a/java/test/src/main/java/test/Ice/acm/Client.java
+++ b/java/test/src/main/java/test/Ice/acm/Client.java
@@ -17,13 +17,12 @@ public class Client extends test.Util.Application
return 0;
}
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.acm");
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.acm");
+ r.initData.properties.setProperty("Ice.Warn.Connections", "0");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/acm/RemoteCommunicatorI.java b/java/test/src/main/java/test/Ice/acm/RemoteCommunicatorI.java
index 5c55f0f6b87..649fb279d5e 100644
--- a/java/test/src/main/java/test/Ice/acm/RemoteCommunicatorI.java
+++ b/java/test/src/main/java/test/Ice/acm/RemoteCommunicatorI.java
@@ -10,16 +10,15 @@
package test.Ice.acm;
import test.Ice.acm.Test.RemoteObjectAdapterPrx;
-import test.Ice.acm.Test.RemoteObjectAdapterPrxHelper;
-import test.Ice.acm.Test._RemoteCommunicatorDisp;
+import test.Ice.acm.Test.RemoteCommunicator;
-public class RemoteCommunicatorI extends _RemoteCommunicatorDisp
+public class RemoteCommunicatorI implements RemoteCommunicator
{
- public RemoteObjectAdapterPrx
- createObjectAdapter(int timeout, int close, int heartbeat, Ice.Current current)
+ public RemoteObjectAdapterPrx createObjectAdapter(int timeout, int close, int heartbeat,
+ com.zeroc.Ice.Current current)
{
- Ice.Communicator com = current.adapter.getCommunicator();
- Ice.Properties properties = com.getProperties();
+ com.zeroc.Ice.Communicator com = current.adapter.getCommunicator();
+ com.zeroc.Ice.Properties properties = com.getProperties();
String protocol = properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp");
String host = properties.getPropertyWithDefault("Ice.Default.Host", "127.0.0.1");
@@ -37,14 +36,13 @@ public class RemoteCommunicatorI extends _RemoteCommunicatorDisp
properties.setProperty(name + ".ACM.Heartbeat", Integer.toString(heartbeat));
}
properties.setProperty(name + ".ThreadPool.Size", "2");
- Ice.ObjectAdapter adapter = com.createObjectAdapterWithEndpoints(name, protocol + " -h \"" + host + "\"");
- return RemoteObjectAdapterPrxHelper.uncheckedCast(
- current.adapter.addWithUUID(new RemoteObjectAdapterI(adapter)));
+ com.zeroc.Ice.ObjectAdapter adapter =
+ com.createObjectAdapterWithEndpoints(name, protocol + " -h \"" + host + "\"");
+ return RemoteObjectAdapterPrx.uncheckedCast(current.adapter.addWithUUID(new RemoteObjectAdapterI(adapter)));
}
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
-};
+}
diff --git a/java/test/src/main/java/test/Ice/acm/RemoteObjectAdapterI.java b/java/test/src/main/java/test/Ice/acm/RemoteObjectAdapterI.java
index f31b0030fbf..e68d368d3d2 100644
--- a/java/test/src/main/java/test/Ice/acm/RemoteObjectAdapterI.java
+++ b/java/test/src/main/java/test/Ice/acm/RemoteObjectAdapterI.java
@@ -10,45 +10,43 @@
package test.Ice.acm;
import test.Ice.acm.Test.TestIntfPrx;
-import test.Ice.acm.Test.TestIntfPrxHelper;
-import test.Ice.acm.Test._RemoteObjectAdapterDisp;
+import test.Ice.acm.Test.RemoteObjectAdapter;
-public class RemoteObjectAdapterI extends _RemoteObjectAdapterDisp
+public class RemoteObjectAdapterI implements RemoteObjectAdapter
{
- public RemoteObjectAdapterI(Ice.ObjectAdapter adapter)
+ public RemoteObjectAdapterI(com.zeroc.Ice.ObjectAdapter adapter)
{
_adapter = adapter;
- _testIntf = TestIntfPrxHelper.uncheckedCast(_adapter.add(new TestI(),
- Ice.Util.stringToIdentity("test")));
+ _testIntf = TestIntfPrx.uncheckedCast(_adapter.add(new TestI(), com.zeroc.Ice.Util.stringToIdentity("test")));
_adapter.activate();
}
- public TestIntfPrx getTestIntf(Ice.Current current)
+ public TestIntfPrx getTestIntf(com.zeroc.Ice.Current current)
{
return _testIntf;
}
- public void activate(Ice.Current current)
+ public void activate(com.zeroc.Ice.Current current)
{
_adapter.activate();
}
- public void hold(Ice.Current current)
+ public void hold(com.zeroc.Ice.Current current)
{
_adapter.hold();
}
- public void deactivate(Ice.Current current)
+ public void deactivate(com.zeroc.Ice.Current current)
{
try
{
_adapter.destroy();
}
- catch(Ice.ObjectAdapterDeactivatedException ex)
+ catch(com.zeroc.Ice.ObjectAdapterDeactivatedException ex)
{
}
}
- private Ice.ObjectAdapter _adapter;
+ private com.zeroc.Ice.ObjectAdapter _adapter;
private TestIntfPrx _testIntf;
-};
+}
diff --git a/java/test/src/main/java/test/Ice/acm/Server.java b/java/test/src/main/java/test/Ice/acm/Server.java
index 8df16e0f21a..e80a0b6f359 100644
--- a/java/test/src/main/java/test/Ice/acm/Server.java
+++ b/java/test/src/main/java/test/Ice/acm/Server.java
@@ -11,12 +11,11 @@ package test.Ice.acm;
public class Server extends test.Util.Application
{
- public int
- run(String[] args)
+ public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Identity id = Ice.Util.stringToIdentity("communicator");
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.Identity id = com.zeroc.Ice.Util.stringToIdentity("communicator");
adapter.add(new RemoteCommunicatorI(), id);
adapter.activate();
@@ -26,19 +25,17 @@ public class Server extends test.Util.Application
return WAIT;
}
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.acm");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("Ice.ACM.Timeout", "1");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.acm");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ r.initData.properties.setProperty("Ice.Warn.Connections", "0");
+ r.initData.properties.setProperty("Ice.ACM.Timeout", "1");
+ return r;
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
Server app = new Server();
int result = app.main("Server", args);
diff --git a/java/test/src/main/java/test/Ice/acm/TestI.java b/java/test/src/main/java/test/Ice/acm/TestI.java
index 00620c07dd0..7b9c369e4f3 100644
--- a/java/test/src/main/java/test/Ice/acm/TestI.java
+++ b/java/test/src/main/java/test/Ice/acm/TestI.java
@@ -8,11 +8,12 @@
// **********************************************************************
package test.Ice.acm;
-import test.Ice.acm.Test._TestIntfDisp;
-public class TestI extends _TestIntfDisp
+import test.Ice.acm.Test.TestIntf;
+
+public class TestI implements TestIntf
{
- public void sleep(int delay, Ice.Current current)
+ public void sleep(int delay, com.zeroc.Ice.Current current)
{
synchronized(this)
{
@@ -26,7 +27,7 @@ public class TestI extends _TestIntfDisp
}
}
- public void sleepAndHold(int delay, Ice.Current current)
+ public void sleepAndHold(int delay, com.zeroc.Ice.Current current)
{
synchronized(this)
{
@@ -41,7 +42,7 @@ public class TestI extends _TestIntfDisp
}
}
- public void interruptSleep(Ice.Current current)
+ public void interruptSleep(com.zeroc.Ice.Current current)
{
synchronized(this)
{
@@ -49,27 +50,35 @@ public class TestI extends _TestIntfDisp
}
}
- public void waitForHeartbeat(int count, Ice.Current current)
+ static class Counter
{
- final Ice.Holder<Integer> c = new Ice.Holder<Integer>(count);
- Ice.HeartbeatCallback callback = new Ice.HeartbeatCallback()
+ Counter(int v)
{
- synchronized public void heartbeat(Ice.Connection connection)
- {
- --c.value;
- notifyAll();
- }
+ value = v;
+ }
+
+ int value;
+ }
- };
- current.con.setHeartbeatCallback(callback);
+ public void waitForHeartbeat(int count, com.zeroc.Ice.Current current)
+ {
+ final Counter c = new Counter(count);
+ current.con.setHeartbeatCallback(con ->
+ {
+ synchronized(c)
+ {
+ --c.value;
+ c.notifyAll();
+ }
+ });
- synchronized(callback)
+ synchronized(c)
{
while(c.value > 0)
{
try
{
- callback.wait();
+ c.wait();
}
catch(InterruptedException ex)
{
@@ -77,4 +86,4 @@ public class TestI extends _TestIntfDisp
}
}
}
-};
+}
diff --git a/java/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java b/java/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java
index d198d02414e..a70c46dfb02 100644
--- a/java/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java
+++ b/java/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java
@@ -10,12 +10,10 @@
package test.Ice.adapterDeactivation;
import test.Ice.adapterDeactivation.Test.TestIntfPrx;
-import test.Ice.adapterDeactivation.Test.TestIntfPrxHelper;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -23,20 +21,19 @@ public class AllTests
}
}
- public static TestIntfPrx
- allTests(test.Util.Application app, java.io.PrintWriter out)
+ public static TestIntfPrx allTests(test.Util.Application app, java.io.PrintWriter out)
{
- Ice.Communicator communicator = app.communicator();
+ com.zeroc.Ice.Communicator communicator = app.communicator();
out.print("testing stringToProxy... ");
out.flush();
String ref = "test:default -p 12010";
- Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref);
test(base != null);
out.println("ok");
out.print("testing checked cast... ");
out.flush();
- TestIntfPrx obj = TestIntfPrxHelper.checkedCast(base);
+ TestIntfPrx obj = TestIntfPrx.checkedCast(base);
test(obj != null);
test(obj.equals(base));
out.println("ok");
@@ -44,14 +41,14 @@ public class AllTests
{
out.print("creating/destroying/recreating object adapter... ");
out.flush();
- Ice.ObjectAdapter adapter =
+ com.zeroc.Ice.ObjectAdapter adapter =
communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default");
try
{
communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default");
test(false);
}
- catch(Ice.AlreadyRegisteredException ex)
+ catch(com.zeroc.Ice.AlreadyRegisteredException ex)
{
}
adapter.destroy();
@@ -66,7 +63,7 @@ public class AllTests
out.print("creating/activating/deactivating object adapter in one operation... ");
out.flush();
obj._transient();
- obj.end_transient(obj.begin_transient());
+ obj.transientAsync().join();
out.println("ok");
{
@@ -74,10 +71,10 @@ public class AllTests
out.flush();
for(int i = 0; i < 10; ++i)
{
- Ice.InitializationData initData = app.createInitializationData();
+ com.zeroc.Ice.InitializationData initData = app.createInitializationData();
initData.properties = communicator.getProperties()._clone();
- Ice.Communicator comm = app.initialize(initData);
- comm.stringToProxy("test:default -p 12010").begin_ice_ping();
+ com.zeroc.Ice.Communicator comm = app.initialize(initData);
+ comm.stringToProxy("test:default -p 12010").ice_pingAsync();
comm.destroy();
}
out.println("ok");
@@ -95,7 +92,7 @@ public class AllTests
obj.ice_ping();
throw new RuntimeException();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
out.println("ok");
}
diff --git a/java/test/src/main/java/test/Ice/adapterDeactivation/Client.java b/java/test/src/main/java/test/Ice/adapterDeactivation/Client.java
index df01944e4e8..11d93d4fd6e 100644
--- a/java/test/src/main/java/test/Ice/adapterDeactivation/Client.java
+++ b/java/test/src/main/java/test/Ice/adapterDeactivation/Client.java
@@ -11,24 +11,20 @@ package test.Ice.adapterDeactivation;
public class Client extends test.Util.Application
{
- public int
- run(String[] args)
+ public int run(String[] args)
{
AllTests.allTests(this, getWriter());
return 0;
}
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.adapterDeactivation");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.adapterDeactivation");
+ return r;
}
-
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
Client app = new Client();
int result = app.main("Client", args);
diff --git a/java/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java b/java/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java
index c5c800aab52..6fd0e950cf8 100644
--- a/java/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java
+++ b/java/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java
@@ -11,11 +11,10 @@ package test.Ice.adapterDeactivation;
public class Collocated extends test.Util.Application
{
- public int
- run(String[] args)
+ public int run(String[] args)
{
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- Ice.ServantLocator locator = new ServantLocatorI();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.ServantLocator locator = new ServantLocatorI();
adapter.addServantLocator(locator, "");
AllTests.allTests(this, getWriter());
@@ -24,23 +23,21 @@ public class Collocated extends test.Util.Application
return 0;
}
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
+ GetInitDataResult r = super.getInitData(args);
//
// 2 threads are necessary to dispatch the collocated transient() call with AMI
//
- initData.properties.setProperty("TestAdapter.ThreadPool.Size", "2");
+ r.initData.properties.setProperty("TestAdapter.ThreadPool.Size", "2");
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.adapterDeactivation");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- return initData;
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.adapterDeactivation");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ return r;
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
Collocated app = new Collocated();
int result = app.main("Collocated", args);
diff --git a/java/test/src/main/java/test/Ice/adapterDeactivation/CookieI.java b/java/test/src/main/java/test/Ice/adapterDeactivation/CookieI.java
index 5bf4a864299..184bf562ee6 100644
--- a/java/test/src/main/java/test/Ice/adapterDeactivation/CookieI.java
+++ b/java/test/src/main/java/test/Ice/adapterDeactivation/CookieI.java
@@ -13,8 +13,7 @@ import test.Ice.adapterDeactivation.Test.Cookie;
public final class CookieI extends Cookie
{
- public String
- message()
+ public String message()
{
return "blahblah";
}
diff --git a/java/test/src/main/java/test/Ice/adapterDeactivation/ServantLocatorI.java b/java/test/src/main/java/test/Ice/adapterDeactivation/ServantLocatorI.java
index 405004aae8c..91dafedcdc5 100644
--- a/java/test/src/main/java/test/Ice/adapterDeactivation/ServantLocatorI.java
+++ b/java/test/src/main/java/test/Ice/adapterDeactivation/ServantLocatorI.java
@@ -10,24 +10,22 @@
package test.Ice.adapterDeactivation;
import test.Ice.adapterDeactivation.Test.Cookie;
+import com.zeroc.Ice.ServantLocator;
-public final class ServantLocatorI implements Ice.ServantLocator
+public final class ServantLocatorI implements ServantLocator
{
- public
- ServantLocatorI()
+ public ServantLocatorI()
{
_deactivated = false;
}
- protected synchronized void
- finalize()
+ protected synchronized void finalize()
throws Throwable
{
test(_deactivated);
}
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -35,8 +33,7 @@ public final class ServantLocatorI implements Ice.ServantLocator
}
}
- public Ice.Object
- locate(Ice.Current current, Ice.LocalObjectHolder cookie)
+ public ServantLocator.LocateResult locate(com.zeroc.Ice.Current current)
{
synchronized(this)
{
@@ -46,13 +43,10 @@ public final class ServantLocatorI implements Ice.ServantLocator
test(current.id.category.length() == 0);
test(current.id.name.equals("test"));
- cookie.value = new CookieI();
-
- return new TestI();
+ return new ServantLocator.LocateResult(new TestI(), new CookieI());
}
- public void
- finished(Ice.Current current, Ice.Object servant, java.lang.Object cookie)
+ public void finished(com.zeroc.Ice.Current current, com.zeroc.Ice.Object servant, java.lang.Object cookie)
{
synchronized(this)
{
@@ -63,8 +57,7 @@ public final class ServantLocatorI implements Ice.ServantLocator
test(co.message().equals("blahblah"));
}
- public synchronized void
- deactivate(String category)
+ public synchronized void deactivate(String category)
{
synchronized(this)
{
diff --git a/java/test/src/main/java/test/Ice/adapterDeactivation/Server.java b/java/test/src/main/java/test/Ice/adapterDeactivation/Server.java
index 4edeea0c554..60aab57c2a1 100644
--- a/java/test/src/main/java/test/Ice/adapterDeactivation/Server.java
+++ b/java/test/src/main/java/test/Ice/adapterDeactivation/Server.java
@@ -11,11 +11,10 @@ package test.Ice.adapterDeactivation;
public class Server extends test.Util.Application
{
- public int
- run(String[] args)
+ public int run(String[] args)
{
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- Ice.ServantLocator locator = new ServantLocatorI();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.ServantLocator locator = new ServantLocatorI();
adapter.addServantLocator(locator, "");
adapter.activate();
@@ -24,17 +23,15 @@ public class Server extends test.Util.Application
return 0;
}
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.adapterDeactivation");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.adapterDeactivation");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ return r;
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
Server app = new Server();
int result = app.main("Server", args);
diff --git a/java/test/src/main/java/test/Ice/adapterDeactivation/TestI.java b/java/test/src/main/java/test/Ice/adapterDeactivation/TestI.java
index ad0f396c039..7b630a3f5b1 100644
--- a/java/test/src/main/java/test/Ice/adapterDeactivation/TestI.java
+++ b/java/test/src/main/java/test/Ice/adapterDeactivation/TestI.java
@@ -11,21 +11,19 @@ package test.Ice.adapterDeactivation;
import test.Ice.adapterDeactivation.Test.*;
-public final class TestI extends _TestIntfDisp
+public final class TestI implements TestIntf
{
- public void
- _transient(Ice.Current current)
+ public void _transient(com.zeroc.Ice.Current current)
{
- Ice.Communicator communicator = current.adapter.getCommunicator();
+ com.zeroc.Ice.Communicator communicator = current.adapter.getCommunicator();
- Ice.ObjectAdapter adapter =
+ com.zeroc.Ice.ObjectAdapter adapter =
communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999");
adapter.activate();
adapter.destroy();
}
- public void
- deactivate(Ice.Current current)
+ public void deactivate(com.zeroc.Ice.Current current)
{
current.adapter.deactivate();
try
diff --git a/java/test/src/main/java/test/Ice/admin/AllTests.java b/java/test/src/main/java/test/Ice/admin/AllTests.java
index b1e622947c8..1d430d7f59e 100644
--- a/java/test/src/main/java/test/Ice/admin/AllTests.java
+++ b/java/test/src/main/java/test/Ice/admin/AllTests.java
@@ -12,10 +12,13 @@ package test.Ice.admin;
import java.io.PrintWriter;
import test.Ice.admin.Test.*;
+import com.zeroc.Ice.LogMessageType;
+import com.zeroc.Ice.ProcessPrx;
+import com.zeroc.Ice.PropertiesAdminPrx;
+
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -23,8 +26,7 @@ public class AllTests
}
}
- static void
- testFacets(Ice.Communicator com, boolean builtInFacets)
+ static void testFacets(com.zeroc.Ice.Communicator com, boolean builtInFacets)
{
if(builtInFacets)
{
@@ -47,7 +49,7 @@ public class AllTests
test(com.findAdminFacet("Facet3") == f3);
test(com.findAdminFacet("Bogus") == null);
- java.util.Map<String, Ice.Object> facetMap = com.findAllAdminFacets();
+ java.util.Map<String, com.zeroc.Ice.Object> facetMap = com.findAllAdminFacets();
if(builtInFacets)
{
test(facetMap.size() == 7);
@@ -69,7 +71,7 @@ public class AllTests
com.addAdminFacet(f1, "Facet1");
test(false);
}
- catch(Ice.AlreadyRegisteredException ex)
+ catch(com.zeroc.Ice.AlreadyRegisteredException ex)
{
// Expected
}
@@ -79,7 +81,7 @@ public class AllTests
com.removeAdminFacet("Bogus");
test(false);
}
- catch(Ice.NotRegisteredException ex)
+ catch(com.zeroc.Ice.NotRegisteredException ex)
{
// Expected
}
@@ -93,14 +95,13 @@ public class AllTests
com.removeAdminFacet("Facet1");
test(false);
}
- catch(Ice.NotRegisteredException ex)
+ catch(com.zeroc.Ice.NotRegisteredException ex)
{
// Expected
}
}
- public static void
- allTests(test.Util.Application app, PrintWriter out)
+ public static void allTests(test.Util.Application app, PrintWriter out)
{
out.print("testing communicator operations... ");
out.flush();
@@ -108,81 +109,81 @@ public class AllTests
//
// Test: Exercise addAdminFacet, findAdminFacet, removeAdminFacet with a typical configuration.
//
- Ice.InitializationData init = app.createInitializationData();
- init.properties = Ice.Util.createProperties();
+ com.zeroc.Ice.InitializationData init = app.createInitializationData();
+ init.properties = com.zeroc.Ice.Util.createProperties();
init.properties.setProperty("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
init.properties.setProperty("Ice.Admin.InstanceName", "Test");
- Ice.Communicator com = Ice.Util.initialize(init);
- testFacets(com, true);
- com.destroy();
+ com.zeroc.Ice.Communicator comm = com.zeroc.Ice.Util.initialize(init);
+ testFacets(comm, true);
+ comm.destroy();
}
{
//
// Test: Verify that the operations work correctly in the presence of facet filters.
//
- Ice.InitializationData init = app.createInitializationData();
- init.properties = Ice.Util.createProperties();
+ com.zeroc.Ice.InitializationData init = app.createInitializationData();
+ init.properties = com.zeroc.Ice.Util.createProperties();
init.properties.setProperty("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
init.properties.setProperty("Ice.Admin.InstanceName", "Test");
init.properties.setProperty("Ice.Admin.Facets", "Properties");
- Ice.Communicator com = Ice.Util.initialize(init);
- testFacets(com, false);
- com.destroy();
+ com.zeroc.Ice.Communicator comm = com.zeroc.Ice.Util.initialize(init);
+ testFacets(comm, false);
+ comm.destroy();
}
{
//
// Test: Verify that the operations work correctly with the Admin object disabled.
//
- Ice.Communicator com = Ice.Util.initialize();
- testFacets(com, false);
- com.destroy();
+ com.zeroc.Ice.Communicator comm = com.zeroc.Ice.Util.initialize();
+ testFacets(comm, false);
+ comm.destroy();
}
{
//
// Test: Verify that the operations work correctly when Ice.Admin.Enabled is set
//
- Ice.InitializationData init = app.createInitializationData();
- init.properties = Ice.Util.createProperties();
+ com.zeroc.Ice.InitializationData init = app.createInitializationData();
+ init.properties = com.zeroc.Ice.Util.createProperties();
init.properties.setProperty("Ice.Admin.Enabled", "1");
- Ice.Communicator com = Ice.Util.initialize(init);
+ com.zeroc.Ice.Communicator comm = com.zeroc.Ice.Util.initialize(init);
- test(com.getAdmin() == null);
- Ice.Identity id = Ice.Util.stringToIdentity("test-admin");
+ test(comm.getAdmin() == null);
+ com.zeroc.Ice.Identity id = com.zeroc.Ice.Util.stringToIdentity("test-admin");
try
{
- com.createAdmin(null, id);
+ comm.createAdmin(null, id);
test(false);
}
- catch(Ice.InitializationException ex)
+ catch(com.zeroc.Ice.InitializationException ex)
{
}
- Ice.ObjectAdapter adapter = com.createObjectAdapter("");
- test(com.createAdmin(adapter, id) != null);
- test(com.getAdmin() != null);
- testFacets(com, true);
- com.destroy();
+ com.zeroc.Ice.ObjectAdapter adapter = comm.createObjectAdapter("");
+ test(comm.createAdmin(adapter, id) != null);
+ test(comm.getAdmin() != null);
+ testFacets(comm, true);
+ comm.destroy();
}
{
//
// Test: Verify that the operations work correctly when creation of the Admin object is delayed.
//
- Ice.InitializationData init = app.createInitializationData();
- init.properties = Ice.Util.createProperties();
+ com.zeroc.Ice.InitializationData init = app.createInitializationData();
+ init.properties = com.zeroc.Ice.Util.createProperties();
init.properties.setProperty("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
init.properties.setProperty("Ice.Admin.InstanceName", "Test");
init.properties.setProperty("Ice.Admin.DelayCreation", "1");
- Ice.Communicator com = Ice.Util.initialize(init);
- testFacets(com, true);
- com.getAdmin();
- testFacets(com, true);
- com.destroy();
+ com.zeroc.Ice.Communicator comm = com.zeroc.Ice.Util.initialize(init);
+ testFacets(comm, true);
+ comm.getAdmin();
+ testFacets(comm, true);
+ comm.destroy();
}
out.println("ok");
String ref = "factory:default -p 12010 -t 10000";
RemoteCommunicatorFactoryPrx factory =
- RemoteCommunicatorFactoryPrxHelper.uncheckedCast(app.communicator().stringToProxy(ref));
+ RemoteCommunicatorFactoryPrx.uncheckedCast(app.communicator().stringToProxy(ref));
out.print("testing process facet... ");
out.flush();
@@ -190,30 +191,30 @@ public class AllTests
//
// Test: Verify that Process::shutdown() operation shuts down the communicator.
//
- java.util.Map<String, String> props = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> props = new java.util.HashMap<>();
props.put("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
props.put("Ice.Admin.InstanceName", "Test");
- RemoteCommunicatorPrx com = factory.createCommunicator(props);
- Ice.ObjectPrx obj = com.getAdmin();
- Ice.ProcessPrx proc = Ice.ProcessPrxHelper.checkedCast(obj, "Process");
+ RemoteCommunicatorPrx rcom = factory.createCommunicator(props);
+ com.zeroc.Ice.ObjectPrx obj = rcom.getAdmin();
+ ProcessPrx proc = ProcessPrx.checkedCast(obj, "Process");
proc.shutdown();
- com.waitForShutdown();
- com.destroy();
+ rcom.waitForShutdown();
+ rcom.destroy();
}
out.println("ok");
out.print("testing properties facet... ");
out.flush();
{
- java.util.Map<String, String> props = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> props = new java.util.HashMap<>();
props.put("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
props.put("Ice.Admin.InstanceName", "Test");
props.put("Prop1", "1");
props.put("Prop2", "2");
props.put("Prop3", "3");
- RemoteCommunicatorPrx com = factory.createCommunicator(props);
- Ice.ObjectPrx obj = com.getAdmin();
- Ice.PropertiesAdminPrx pa = Ice.PropertiesAdminPrxHelper.checkedCast(obj, "Properties");
+ RemoteCommunicatorPrx rcom = factory.createCommunicator(props);
+ com.zeroc.Ice.ObjectPrx obj = rcom.getAdmin();
+ PropertiesAdminPrx pa = PropertiesAdminPrx.checkedCast(obj, "Properties");
//
// Test: PropertiesAdmin::getProperty()
@@ -237,7 +238,7 @@ public class AllTests
//
// Test: PropertiesAdmin::setProperties()
//
- java.util.Map<String, String> setProps = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> setProps = new java.util.HashMap<>();
setProps.put("Prop1", "10"); // Changed
setProps.put("Prop2", "20"); // Changed
setProps.put("Prop3", ""); // Removed
@@ -249,7 +250,7 @@ public class AllTests
test(pa.getProperty("Prop3").equals(""));
test(pa.getProperty("Prop4").equals("4"));
test(pa.getProperty("Prop5").equals("5"));
- changes = com.getChanges();
+ changes = rcom.getChanges();
test(changes.size() == 5);
test(changes.get("Prop1").equals("10"));
test(changes.get("Prop2").equals("20"));
@@ -257,200 +258,207 @@ public class AllTests
test(changes.get("Prop4").equals("4"));
test(changes.get("Prop5").equals("5"));
pa.setProperties(setProps);
- changes = com.getChanges();
+ changes = rcom.getChanges();
test(changes.isEmpty());
- com.destroy();
+ rcom.destroy();
}
out.println("ok");
out.print("testing logger facet... ");
out.flush();
{
- java.util.Map<String, String> props = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> props = new java.util.HashMap<>();
props.put("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
props.put("Ice.Admin.InstanceName", "Test");
props.put("NullLogger", "1");
- RemoteCommunicatorPrx com = factory.createCommunicator(props);
-
- com.trace("testCat", "trace");
- com.warning("warning");
- com.error("error");
- com.print("print");
-
- Ice.ObjectPrx obj = com.getAdmin();
- Ice.LoggerAdminPrx logger = Ice.LoggerAdminPrxHelper.checkedCast(obj, "Logger");
+ RemoteCommunicatorPrx rcom = factory.createCommunicator(props);
+
+ rcom.trace("testCat", "trace");
+ rcom.warning("warning");
+ rcom.error("error");
+ rcom.print("print");
+
+ com.zeroc.Ice.ObjectPrx obj = rcom.getAdmin();
+ com.zeroc.Ice.LoggerAdminPrx logger = com.zeroc.Ice.LoggerAdminPrx.checkedCast(obj, "Logger");
test(logger != null);
- Ice.StringHolder prefix = new Ice.StringHolder();
-
//
// Get all
//
- Ice.LogMessage[] logMessages = logger.getLog(null, null, -1, prefix);
-
- test(logMessages.length == 4);
- test(prefix.value.equals("NullLogger"));
- test(logMessages[0].traceCategory.equals("testCat") && logMessages[0].message.equals("trace"));
- test(logMessages[1].message.equals("warning"));
- test(logMessages[2].message.equals("error"));
- test(logMessages[3].message.equals("print"));
-
+ com.zeroc.Ice.LoggerAdmin.GetLogResult r = logger.getLog(null, null, -1);
+
+ test(r.returnValue.length == 4);
+ test(r.prefix.equals("NullLogger"));
+ test(r.returnValue[0].traceCategory.equals("testCat") && r.returnValue[0].message.equals("trace"));
+ test(r.returnValue[1].message.equals("warning"));
+ test(r.returnValue[2].message.equals("error"));
+ test(r.returnValue[3].message.equals("print"));
+
//
// Get only errors and warnings
//
- com.error("error2");
- com.print("print2");
- com.trace("testCat", "trace2");
- com.warning("warning2");
-
- Ice.LogMessageType[] messageTypes = {Ice.LogMessageType.ErrorMessage, Ice.LogMessageType.WarningMessage};
-
- logMessages = logger.getLog(messageTypes, null, -1, prefix);
- test(logMessages.length == 4);
- test(prefix.value.equals("NullLogger"));
-
- for(Ice.LogMessage msg : java.util.Arrays.asList(logMessages))
+ rcom.error("error2");
+ rcom.print("print2");
+ rcom.trace("testCat", "trace2");
+ rcom.warning("warning2");
+
+ LogMessageType[] messageTypes =
+ {
+ LogMessageType.ErrorMessage,
+ LogMessageType.WarningMessage
+ };
+
+ r = logger.getLog(messageTypes, null, -1);
+ test(r.returnValue.length == 4);
+ test(r.prefix.equals("NullLogger"));
+
+ for(com.zeroc.Ice.LogMessage msg : java.util.Arrays.asList(r.returnValue))
{
- test(msg.type == Ice.LogMessageType.ErrorMessage || msg.type == Ice.LogMessageType.WarningMessage);
+ test(msg.type == LogMessageType.ErrorMessage ||
+ msg.type == LogMessageType.WarningMessage);
}
-
+
//
// Get only errors and traces with Cat = "testCat"
//
- com.trace("testCat2", "A");
- com.trace("testCat", "trace3");
- com.trace("testCat2", "B");
-
- messageTypes = new Ice.LogMessageType[]{Ice.LogMessageType.ErrorMessage, Ice.LogMessageType.TraceMessage};
+ rcom.trace("testCat2", "A");
+ rcom.trace("testCat", "trace3");
+ rcom.trace("testCat2", "B");
+
+ messageTypes = new LogMessageType[]
+ {
+ LogMessageType.ErrorMessage,
+ LogMessageType.TraceMessage
+ };
String[] categories = {"testCat"};
- logMessages = logger.getLog(messageTypes, categories, -1, prefix);
- test(logMessages.length == 5);
- test(prefix.value.equals("NullLogger"));
-
- for(Ice.LogMessage msg : java.util.Arrays.asList(logMessages))
- {
- test(msg.type == Ice.LogMessageType.ErrorMessage ||
- (msg.type == Ice.LogMessageType.TraceMessage && msg.traceCategory.equals("testCat")));
+ r = logger.getLog(messageTypes, categories, -1);
+ test(r.returnValue.length == 5);
+ test(r.prefix.equals("NullLogger"));
+
+ for(com.zeroc.Ice.LogMessage msg : java.util.Arrays.asList(r.returnValue))
+ {
+ test(msg.type == LogMessageType.ErrorMessage ||
+ (msg.type == LogMessageType.TraceMessage && msg.traceCategory.equals("testCat")));
}
//
// Same, but limited to last 2 messages (trace3 + error3)
//
- com.error("error3");
+ rcom.error("error3");
+
+ r = logger.getLog(messageTypes, categories, 2);
+ test(r.returnValue.length == 2);
+ test(r.prefix.equals("NullLogger"));
+
+ test(r.returnValue[0].message.equals("trace3"));
+ test(r.returnValue[1].message.equals("error3"));
- logMessages = logger.getLog(messageTypes, categories, 2, prefix);
- test(logMessages.length == 2);
- test(prefix.value.equals("NullLogger"));
-
- test(logMessages[0].message.equals("trace3"));
- test(logMessages[1].message.equals("error3"));
-
//
// Now, test RemoteLogger
//
- Ice.ObjectAdapter adapter =
+ com.zeroc.Ice.ObjectAdapter adapter =
app.communicator().createObjectAdapterWithEndpoints("RemoteLoggerAdapter", "tcp -h localhost");
-
+
RemoteLoggerI remoteLogger = new RemoteLoggerI();
-
- Ice.RemoteLoggerPrx myProxy = Ice.RemoteLoggerPrxHelper.uncheckedCast(adapter.addWithUUID(remoteLogger));
-
+
+ com.zeroc.Ice.RemoteLoggerPrx myProxy =
+ com.zeroc.Ice.RemoteLoggerPrx.uncheckedCast(adapter.addWithUUID(remoteLogger));
+
adapter.activate();
//
// No filtering
//
- logMessages = logger.getLog(null, null, -1, prefix);
- remoteLogger.checkNextInit(prefix.value, logMessages);
-
+ r = logger.getLog(null, null, -1);
+ remoteLogger.checkNextInit(r.prefix, r.returnValue);
+
try
{
logger.attachRemoteLogger(myProxy, null, null, -1);
}
- catch(Ice.RemoteLoggerAlreadyAttachedException ex)
+ catch(com.zeroc.Ice.RemoteLoggerAlreadyAttachedException ex)
{
test(false);
}
remoteLogger.wait(1);
-
- remoteLogger.checkNextLog(Ice.LogMessageType.TraceMessage, "rtrace", "testCat");
- remoteLogger.checkNextLog(Ice.LogMessageType.WarningMessage, "rwarning", "");
- remoteLogger.checkNextLog(Ice.LogMessageType.ErrorMessage, "rerror", "");
- remoteLogger.checkNextLog(Ice.LogMessageType.PrintMessage, "rprint", "");
-
- com.trace("testCat", "rtrace");
- com.warning("rwarning");
- com.error("rerror");
- com.print("rprint");
+
+ remoteLogger.checkNextLog(LogMessageType.TraceMessage, "rtrace", "testCat");
+ remoteLogger.checkNextLog(LogMessageType.WarningMessage, "rwarning", "");
+ remoteLogger.checkNextLog(LogMessageType.ErrorMessage, "rerror", "");
+ remoteLogger.checkNextLog(LogMessageType.PrintMessage, "rprint", "");
+
+ rcom.trace("testCat", "rtrace");
+ rcom.warning("rwarning");
+ rcom.error("rerror");
+ rcom.print("rprint");
remoteLogger.wait(4);
-
+
test(logger.detachRemoteLogger(myProxy));
test(!logger.detachRemoteLogger(myProxy));
-
+
//
// Use Error + Trace with "traceCat" filter with 4 limit
//
- logMessages = logger.getLog(messageTypes, categories, 4, prefix);
- test(logMessages.length == 4);
- remoteLogger.checkNextInit(prefix.value, logMessages);
+ r = logger.getLog(messageTypes, categories, 4);
+ test(r.returnValue.length == 4);
+ remoteLogger.checkNextInit(r.prefix, r.returnValue);
try
{
logger.attachRemoteLogger(myProxy, messageTypes, categories, 4);
}
- catch(Ice.RemoteLoggerAlreadyAttachedException ex)
+ catch(com.zeroc.Ice.RemoteLoggerAlreadyAttachedException ex)
{
test(false);
}
remoteLogger.wait(1);
-
- remoteLogger.checkNextLog(Ice.LogMessageType.TraceMessage, "rtrace2", "testCat");
- remoteLogger.checkNextLog(Ice.LogMessageType.ErrorMessage, "rerror2", "");
-
- com.warning("rwarning2");
- com.trace("testCat", "rtrace2");
- com.warning("rwarning3");
- com.error("rerror2");
- com.print("rprint2");
+
+ remoteLogger.checkNextLog(LogMessageType.TraceMessage, "rtrace2", "testCat");
+ remoteLogger.checkNextLog(LogMessageType.ErrorMessage, "rerror2", "");
+
+ rcom.warning("rwarning2");
+ rcom.trace("testCat", "rtrace2");
+ rcom.warning("rwarning3");
+ rcom.error("rerror2");
+ rcom.print("rprint2");
remoteLogger.wait(2);
-
+
//
// Attempt reconnection with slightly different proxy
//
try
{
- logger.attachRemoteLogger(Ice.RemoteLoggerPrxHelper.uncheckedCast(myProxy.ice_oneway()),
- messageTypes, categories, 4);
+ logger.attachRemoteLogger(myProxy.ice_oneway(), messageTypes, categories, 4);
test(false);
}
- catch(Ice.RemoteLoggerAlreadyAttachedException ex)
+ catch(com.zeroc.Ice.RemoteLoggerAlreadyAttachedException ex)
{
// expected
}
-
- com.destroy();
+
+ rcom.destroy();
}
out.println("ok");
-
+
out.print("testing custom facet... ");
out.flush();
{
//
// Test: Verify that the custom facet is present.
//
- java.util.Map<String, String> props = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> props = new java.util.HashMap<>();
props.put("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
props.put("Ice.Admin.InstanceName", "Test");
- RemoteCommunicatorPrx com = factory.createCommunicator(props);
- Ice.ObjectPrx obj = com.getAdmin();
- TestFacetPrx tf = TestFacetPrxHelper.checkedCast(obj, "TestFacet");
+ RemoteCommunicatorPrx rcom = factory.createCommunicator(props);
+ com.zeroc.Ice.ObjectPrx obj = rcom.getAdmin();
+ TestFacetPrx tf = TestFacetPrx.checkedCast(obj, "TestFacet");
tf.op();
- com.destroy();
+ rcom.destroy();
}
out.println("ok");
@@ -461,90 +469,90 @@ public class AllTests
// Test: Set Ice.Admin.Facets to expose only the Properties facet,
// meaning no other facet is available.
//
- java.util.Map<String, String> props = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> props = new java.util.HashMap<>();
props.put("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
props.put("Ice.Admin.InstanceName", "Test");
props.put("Ice.Admin.Facets", "Properties");
- RemoteCommunicatorPrx com = factory.createCommunicator(props);
- Ice.ObjectPrx obj = com.getAdmin();
- Ice.ProcessPrx proc = Ice.ProcessPrxHelper.checkedCast(obj, "Process");
+ RemoteCommunicatorPrx rcom = factory.createCommunicator(props);
+ com.zeroc.Ice.ObjectPrx obj = rcom.getAdmin();
+ ProcessPrx proc = ProcessPrx.checkedCast(obj, "Process");
test(proc == null);
- TestFacetPrx tf = TestFacetPrxHelper.checkedCast(obj, "TestFacet");
+ TestFacetPrx tf = TestFacetPrx.checkedCast(obj, "TestFacet");
test(tf == null);
- com.destroy();
+ rcom.destroy();
}
{
//
// Test: Set Ice.Admin.Facets to expose only the Process facet,
// meaning no other facet is available.
//
- java.util.Map<String, String> props = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> props = new java.util.HashMap<>();
props.put("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
props.put("Ice.Admin.InstanceName", "Test");
props.put("Ice.Admin.Facets", "Process");
- RemoteCommunicatorPrx com = factory.createCommunicator(props);
- Ice.ObjectPrx obj = com.getAdmin();
- Ice.PropertiesAdminPrx pa = Ice.PropertiesAdminPrxHelper.checkedCast(obj, "Properties");
+ RemoteCommunicatorPrx rcom = factory.createCommunicator(props);
+ com.zeroc.Ice.ObjectPrx obj = rcom.getAdmin();
+ PropertiesAdminPrx pa = PropertiesAdminPrx.checkedCast(obj, "Properties");
test(pa == null);
- TestFacetPrx tf = TestFacetPrxHelper.checkedCast(obj, "TestFacet");
+ TestFacetPrx tf = TestFacetPrx.checkedCast(obj, "TestFacet");
test(tf == null);
- com.destroy();
+ rcom.destroy();
}
{
//
// Test: Set Ice.Admin.Facets to expose only the TestFacet facet,
// meaning no other facet is available.
//
- java.util.Map<String, String> props = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> props = new java.util.HashMap<>();
props.put("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
props.put("Ice.Admin.InstanceName", "Test");
props.put("Ice.Admin.Facets", "TestFacet");
- RemoteCommunicatorPrx com = factory.createCommunicator(props);
- Ice.ObjectPrx obj = com.getAdmin();
- Ice.PropertiesAdminPrx pa = Ice.PropertiesAdminPrxHelper.checkedCast(obj, "Properties");
+ RemoteCommunicatorPrx rcom = factory.createCommunicator(props);
+ com.zeroc.Ice.ObjectPrx obj = rcom.getAdmin();
+ PropertiesAdminPrx pa = PropertiesAdminPrx.checkedCast(obj, "Properties");
test(pa == null);
- Ice.ProcessPrx proc = Ice.ProcessPrxHelper.checkedCast(obj, "Process");
+ ProcessPrx proc = ProcessPrx.checkedCast(obj, "Process");
test(proc == null);
- com.destroy();
+ rcom.destroy();
}
{
//
// Test: Set Ice.Admin.Facets to expose two facets. Use whitespace to separate the
// facet names.
//
- java.util.Map<String, String> props = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> props = new java.util.HashMap<>();
props.put("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
props.put("Ice.Admin.InstanceName", "Test");
props.put("Ice.Admin.Facets", "Properties TestFacet");
- RemoteCommunicatorPrx com = factory.createCommunicator(props);
- Ice.ObjectPrx obj = com.getAdmin();
- Ice.PropertiesAdminPrx pa = Ice.PropertiesAdminPrxHelper.checkedCast(obj, "Properties");
+ RemoteCommunicatorPrx rcom = factory.createCommunicator(props);
+ com.zeroc.Ice.ObjectPrx obj = rcom.getAdmin();
+ PropertiesAdminPrx pa = PropertiesAdminPrx.checkedCast(obj, "Properties");
test(pa.getProperty("Ice.Admin.InstanceName").equals("Test"));
- TestFacetPrx tf = TestFacetPrxHelper.checkedCast(obj, "TestFacet");
+ TestFacetPrx tf = TestFacetPrx.checkedCast(obj, "TestFacet");
tf.op();
- Ice.ProcessPrx proc = Ice.ProcessPrxHelper.checkedCast(obj, "Process");
+ ProcessPrx proc = ProcessPrx.checkedCast(obj, "Process");
test(proc == null);
- com.destroy();
+ rcom.destroy();
}
{
//
// Test: Set Ice.Admin.Facets to expose two facets. Use a comma to separate the
// facet names.
//
- java.util.Map<String, String> props = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> props = new java.util.HashMap<>();
props.put("Ice.Admin.Endpoints", "tcp -h 127.0.0.1");
props.put("Ice.Admin.InstanceName", "Test");
props.put("Ice.Admin.Facets", "TestFacet, Process");
- RemoteCommunicatorPrx com = factory.createCommunicator(props);
- Ice.ObjectPrx obj = com.getAdmin();
- Ice.PropertiesAdminPrx pa = Ice.PropertiesAdminPrxHelper.checkedCast(obj, "Properties");
+ RemoteCommunicatorPrx rcom = factory.createCommunicator(props);
+ com.zeroc.Ice.ObjectPrx obj = rcom.getAdmin();
+ PropertiesAdminPrx pa = PropertiesAdminPrx.checkedCast(obj, "Properties");
test(pa == null);
- TestFacetPrx tf = TestFacetPrxHelper.checkedCast(obj, "TestFacet");
+ TestFacetPrx tf = TestFacetPrx.checkedCast(obj, "TestFacet");
tf.op();
- Ice.ProcessPrx proc = Ice.ProcessPrxHelper.checkedCast(obj, "Process");
+ ProcessPrx proc = ProcessPrx.checkedCast(obj, "Process");
proc.shutdown();
- com.waitForShutdown();
- com.destroy();
+ rcom.waitForShutdown();
+ rcom.destroy();
}
out.println("ok");
diff --git a/java/test/src/main/java/test/Ice/admin/RemoteCommunicatorFactoryI.java b/java/test/src/main/java/test/Ice/admin/RemoteCommunicatorFactoryI.java
index 1bd6bb3ccfa..9727c68e5f3 100644
--- a/java/test/src/main/java/test/Ice/admin/RemoteCommunicatorFactoryI.java
+++ b/java/test/src/main/java/test/Ice/admin/RemoteCommunicatorFactoryI.java
@@ -11,17 +11,18 @@ package test.Ice.admin;
import test.Ice.admin.Test.*;
-public class RemoteCommunicatorFactoryI extends _RemoteCommunicatorFactoryDisp
+public class RemoteCommunicatorFactoryI implements RemoteCommunicatorFactory
{
@Override
- public RemoteCommunicatorPrx createCommunicator(java.util.Map<String, String> props, Ice.Current current)
+ public RemoteCommunicatorPrx createCommunicator(java.util.Map<String, String> props, com.zeroc.Ice.Current current)
{
//
// Prepare the property set using the given properties.
//
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.classLoader = IceInternal.Util.getInstance(current.adapter.getCommunicator()).getClassLoader();
- initData.properties = Ice.Util.createProperties();
+ com.zeroc.Ice.InitializationData initData = new com.zeroc.Ice.InitializationData();
+ initData.classLoader =
+ com.zeroc.IceInternal.Util.getInstance(current.adapter.getCommunicator()).getClassLoader();
+ initData.properties = com.zeroc.Ice.Util.createProperties();
for(java.util.Map.Entry<String, String> e : props.entrySet())
{
initData.properties.setProperty(e.getKey(), e.getValue());
@@ -29,7 +30,7 @@ public class RemoteCommunicatorFactoryI extends _RemoteCommunicatorFactoryDisp
if(initData.properties.getPropertyAsInt("NullLogger") > 0)
{
- initData.logger = new Ice.Logger() {
+ initData.logger = new com.zeroc.Ice.Logger() {
@Override public void print(String message)
{
}
@@ -50,8 +51,8 @@ public class RemoteCommunicatorFactoryI extends _RemoteCommunicatorFactoryDisp
{
return "NullLogger";
}
-
- @Override public Ice.Logger cloneWithPrefix(String prefix)
+
+ @Override public com.zeroc.Ice.Logger cloneWithPrefix(String prefix)
{
return this;
}
@@ -61,7 +62,7 @@ public class RemoteCommunicatorFactoryI extends _RemoteCommunicatorFactoryDisp
//
// Initialize a new communicator.
//
- Ice.Communicator communicator = Ice.Util.initialize(initData);
+ com.zeroc.Ice.Communicator communicator = com.zeroc.Ice.Util.initialize(initData);
//
// Install a custom admin facet.
@@ -73,21 +74,21 @@ public class RemoteCommunicatorFactoryI extends _RemoteCommunicatorFactoryDisp
// Set the callback on the admin facet.
//
RemoteCommunicatorI servant = new RemoteCommunicatorI(communicator);
- Ice.Object propFacet = communicator.findAdminFacet("Properties");
+ com.zeroc.Ice.Object propFacet = communicator.findAdminFacet("Properties");
if(propFacet != null)
{
- Ice.NativePropertiesAdmin admin = (Ice.NativePropertiesAdmin)propFacet;
+ com.zeroc.Ice.NativePropertiesAdmin admin = (com.zeroc.Ice.NativePropertiesAdmin)propFacet;
assert admin != null;
admin.addUpdateCallback(servant);
}
- Ice.ObjectPrx proxy = current.adapter.addWithUUID(servant);
- return RemoteCommunicatorPrxHelper.uncheckedCast(proxy);
+ com.zeroc.Ice.ObjectPrx proxy = current.adapter.addWithUUID(servant);
+ return RemoteCommunicatorPrx.uncheckedCast(proxy);
}
@Override
- public void shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
diff --git a/java/test/src/main/java/test/Ice/admin/RemoteCommunicatorI.java b/java/test/src/main/java/test/Ice/admin/RemoteCommunicatorI.java
index d101b3c68cc..978f57c8d08 100644
--- a/java/test/src/main/java/test/Ice/admin/RemoteCommunicatorI.java
+++ b/java/test/src/main/java/test/Ice/admin/RemoteCommunicatorI.java
@@ -11,57 +11,57 @@ package test.Ice.admin;
import test.Ice.admin.Test.*;
-public class RemoteCommunicatorI extends _RemoteCommunicatorDisp implements Ice.PropertiesAdminUpdateCallback
+public class RemoteCommunicatorI implements RemoteCommunicator, com.zeroc.Ice.PropertiesAdminUpdateCallback
{
- RemoteCommunicatorI(Ice.Communicator communicator)
+ RemoteCommunicatorI(com.zeroc.Ice.Communicator communicator)
{
_communicator = communicator;
}
@Override
- public Ice.ObjectPrx getAdmin(Ice.Current current)
+ public com.zeroc.Ice.ObjectPrx getAdmin(com.zeroc.Ice.Current current)
{
return _communicator.getAdmin();
}
@Override
- public synchronized java.util.Map<String, String> getChanges(Ice.Current current)
+ public synchronized java.util.Map<String, String> getChanges(com.zeroc.Ice.Current current)
{
return _changes;
}
@Override
- public void print(String message, Ice.Current current)
+ public void print(String message, com.zeroc.Ice.Current current)
{
_communicator.getLogger().print(message);
}
@Override
- public void trace(String category, String message, Ice.Current current)
+ public void trace(String category, String message, com.zeroc.Ice.Current current)
{
_communicator.getLogger().trace(category, message);
}
@Override
- public void warning(String message, Ice.Current current)
+ public void warning(String message, com.zeroc.Ice.Current current)
{
_communicator.getLogger().warning(message);
}
@Override
- public void error(String message, Ice.Current current)
+ public void error(String message, com.zeroc.Ice.Current current)
{
_communicator.getLogger().error(message);
}
@Override
- public void shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
_communicator.shutdown();
}
@Override
- public void waitForShutdown(Ice.Current current)
+ public void waitForShutdown(com.zeroc.Ice.Current current)
{
//
// Note that we are executing in a thread of the *main* communicator,
@@ -71,7 +71,7 @@ public class RemoteCommunicatorI extends _RemoteCommunicatorDisp implements Ice.
}
@Override
- public void destroy(Ice.Current current)
+ public void destroy(com.zeroc.Ice.Current current)
{
_communicator.destroy();
}
@@ -82,6 +82,6 @@ public class RemoteCommunicatorI extends _RemoteCommunicatorDisp implements Ice.
_changes = changes;
}
- private Ice.Communicator _communicator;
+ private com.zeroc.Ice.Communicator _communicator;
private java.util.Map<String, String> _changes;
}
diff --git a/java/test/src/main/java/test/Ice/admin/RemoteLoggerI.java b/java/test/src/main/java/test/Ice/admin/RemoteLoggerI.java
index 8f93be0db91..5cd196afec5 100644
--- a/java/test/src/main/java/test/Ice/admin/RemoteLoggerI.java
+++ b/java/test/src/main/java/test/Ice/admin/RemoteLoggerI.java
@@ -9,11 +9,10 @@
package test.Ice.admin;
-class RemoteLoggerI extends Ice._RemoteLoggerDisp
+class RemoteLoggerI implements com.zeroc.Ice.RemoteLogger
{
-
@Override
- public synchronized void init(String prefix, Ice.LogMessage[] logMessages, Ice.Current current)
+ public synchronized void init(String prefix, com.zeroc.Ice.LogMessage[] logMessages, com.zeroc.Ice.Current current)
{
test(prefix.equals(_expectedPrefix));
test(java.util.Arrays.equals(logMessages, _expectedInitMessages));
@@ -22,25 +21,25 @@ class RemoteLoggerI extends Ice._RemoteLoggerDisp
}
@Override
- public synchronized void log(Ice.LogMessage logMessage, Ice.Current current)
+ public synchronized void log(com.zeroc.Ice.LogMessage logMessage, com.zeroc.Ice.Current current)
{
- Ice.LogMessage front = _expectedLogMessages.pollFirst();
+ com.zeroc.Ice.LogMessage front = _expectedLogMessages.pollFirst();
test(front.type == logMessage.type && front.message.equals(logMessage.message) &&
front.traceCategory.equals(logMessage.traceCategory));
-
+
_receivedCalls++;
notifyAll();
}
- synchronized void checkNextInit(String prefix, Ice.LogMessage[] logMessages)
+ synchronized void checkNextInit(String prefix, com.zeroc.Ice.LogMessage[] logMessages)
{
_expectedPrefix = prefix;
_expectedInitMessages = logMessages;
}
-
- synchronized void checkNextLog(Ice.LogMessageType messageType, String message, String category)
+
+ synchronized void checkNextLog(com.zeroc.Ice.LogMessageType messageType, String message, String category)
{
- Ice.LogMessage logMessage = new Ice.LogMessage(messageType, 0, category, message);
+ com.zeroc.Ice.LogMessage logMessage = new com.zeroc.Ice.LogMessage(messageType, 0, category, message);
_expectedLogMessages.addLast(logMessage);
}
@@ -61,8 +60,7 @@ class RemoteLoggerI extends Ice._RemoteLoggerDisp
}
}
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -72,6 +70,7 @@ class RemoteLoggerI extends Ice._RemoteLoggerDisp
private int _receivedCalls;
private String _expectedPrefix;
- private Ice.LogMessage[] _expectedInitMessages;
- private java.util.Deque<Ice.LogMessage> _expectedLogMessages = new java.util.ArrayDeque<Ice.LogMessage>();
+ private com.zeroc.Ice.LogMessage[] _expectedInitMessages;
+ private java.util.Deque<com.zeroc.Ice.LogMessage> _expectedLogMessages =
+ new java.util.ArrayDeque<com.zeroc.Ice.LogMessage>();
}
diff --git a/java/test/src/main/java/test/Ice/admin/Server.java b/java/test/src/main/java/test/Ice/admin/Server.java
index f9ca817d7c0..3f358ab5624 100644
--- a/java/test/src/main/java/test/Ice/admin/Server.java
+++ b/java/test/src/main/java/test/Ice/admin/Server.java
@@ -14,22 +14,21 @@ public class Server extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- adapter.add(new RemoteCommunicatorFactoryI(), Ice.Util.stringToIdentity("factory"));
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new RemoteCommunicatorFactoryI(), com.zeroc.Ice.Util.stringToIdentity("factory"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.admin");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.admin");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/admin/TestFacetI.java b/java/test/src/main/java/test/Ice/admin/TestFacetI.java
index a421b5b95d2..d18914885bd 100644
--- a/java/test/src/main/java/test/Ice/admin/TestFacetI.java
+++ b/java/test/src/main/java/test/Ice/admin/TestFacetI.java
@@ -11,10 +11,10 @@ package test.Ice.admin;
import test.Ice.admin.Test.*;
-public class TestFacetI extends _TestFacetDisp
+public class TestFacetI implements TestFacet
{
@Override
- public void op(Ice.Current current)
+ public void op(com.zeroc.Ice.Current current)
{
}
}
diff --git a/java/test/src/main/java/test/Ice/ami/AMI.java b/java/test/src/main/java/test/Ice/ami/AMI.java
index c018ccb8c62..85a543317a4 100644
--- a/java/test/src/main/java/test/Ice/ami/AMI.java
+++ b/java/test/src/main/java/test/Ice/ami/AMI.java
@@ -10,58 +10,35 @@
package test.Ice.ami;
import java.io.PrintWriter;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.CompletionException;
+
+import com.zeroc.Ice.InvocationFuture;
+import com.zeroc.Ice.Util;
import test.Ice.ami.Test.TestIntfPrx;
-import test.Ice.ami.Test.TestIntfPrxHelper;
import test.Ice.ami.Test.TestIntfControllerPrx;
import test.Ice.ami.Test.TestIntfException;
-import test.Ice.ami.Test.Callback_TestIntf_op;
-import test.Ice.ami.Test.Callback_TestIntf_opWithResult;
-import test.Ice.ami.Test.Callback_TestIntf_opWithUE;
-import test.Ice.ami.Test.Callback_TestIntf_opWithPayload;
import test.Util.Application;
public class AMI
{
- private static class Counter
- {
- private int _count = 0;
-
- synchronized void decrement()
- {
- --_count;
- if(_count == 0)
- {
- notifyAll();
- }
- }
-
- synchronized void increment()
- {
- ++_count;
- }
-
- synchronized void waitComplete() throws InterruptedException
- {
- while(_count > 0)
- {
- wait();
- }
- }
- }
-
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
+ new Throwable().printStackTrace();
+ //
+ // Exceptions raised by callbacks are swallowed by CompletableFuture.
+ //
throw new RuntimeException();
}
}
- private static class CallbackBase
+ private static class Callback
{
- CallbackBase()
+ Callback()
{
_called = false;
}
@@ -92,368 +69,20 @@ public class AMI
private boolean _called;
}
- static class AsyncCallback extends CallbackBase
- {
- public AsyncCallback()
- {
- }
-
- public void
- isA(Ice.AsyncResult result)
- {
- test(result.getProxy().end_ice_isA(result));
- called();
- }
-
- public void
- ping(Ice.AsyncResult result)
- {
- result.getProxy().end_ice_ping(result);
- called();
- }
-
- public void
- id(Ice.AsyncResult result)
- {
- test(result.getProxy().end_ice_id(result).equals("::Test::TestIntf"));
- called();
- }
-
- public void
- ids(Ice.AsyncResult result)
- {
- test(result.getProxy().end_ice_ids(result).length == 2);
- called();
- }
-
- public void
- connection(Ice.AsyncResult result)
- {
- test(result.getProxy().end_ice_getConnection(result) != null);
- called();
- }
-
- public void
- op(Ice.AsyncResult result)
- {
- TestIntfPrxHelper.uncheckedCast(result.getProxy()).end_op(result);
- called();
- }
-
- public void
- opWithResult(Ice.AsyncResult result)
- {
- test(TestIntfPrxHelper.uncheckedCast(result.getProxy()).end_opWithResult(result) == 15);
- called();
- }
-
- public void
- opWithUE(Ice.AsyncResult result)
- {
- try
- {
- TestIntfPrxHelper.uncheckedCast(result.getProxy()).end_opWithUE(result);
- test(false);
- }
- catch(TestIntfException ex)
- {
- called();
- }
- catch(Ice.LocalException ex)
- {
- test(false);
- }
- }
-
- public void
- isAEx(Ice.AsyncResult result)
- {
- try
- {
- result.getProxy().end_ice_isA(result);
- test(false);
- }
- catch(Ice.NoEndpointException ex)
- {
- called();
- }
- catch(Ice.LocalException ex)
- {
- test(false);
- }
- }
-
- public void
- pingEx(Ice.AsyncResult result)
- {
- try
- {
- result.getProxy().end_ice_ping(result);
- test(false);
- }
- catch(Ice.NoEndpointException ex)
- {
- called();
- }
- catch(Ice.LocalException ex)
- {
- test(false);
- }
- }
-
- public void
- idEx(Ice.AsyncResult result)
- {
- try
- {
- result.getProxy().end_ice_id(result);
- test(false);
- }
- catch(Ice.NoEndpointException ex)
- {
- called();
- }
- catch(Ice.LocalException ex)
- {
- test(false);
- }
- }
-
- public void
- idsEx(Ice.AsyncResult result)
- {
- try
- {
- result.getProxy().end_ice_ids(result);
- test(false);
- }
- catch(Ice.NoEndpointException ex)
- {
- called();
- }
- catch(Ice.LocalException ex)
- {
- test(false);
- }
- }
-
- public void
- connectionEx(Ice.AsyncResult result)
- {
- try
- {
- result.getProxy().end_ice_getConnection(result);
- test(false);
- }
- catch(Ice.NoEndpointException ex)
- {
- called();
- }
- catch(Ice.LocalException ex)
- {
- test(false);
- }
- }
-
- public void
- opEx(Ice.AsyncResult result)
- {
- try
- {
- TestIntfPrxHelper.uncheckedCast(result.getProxy()).end_op(result);
- test(false);
- }
- catch(Ice.NoEndpointException ex)
- {
- called();
- }
- catch(Ice.LocalException ex)
- {
- test(false);
- }
- }
- }
-
- static class ResponseCallback extends CallbackBase
- {
- ResponseCallback()
- {
- }
-
- public void
- isA(boolean r)
- {
- test(r);
- called();
- }
-
- public void
- ping()
- {
- called();
- }
-
- public void
- id(String id)
- {
- test(id.equals("::Test::TestIntf"));
- called();
- }
-
- public void
- ids(String[] ids)
- {
- test(ids.length == 2);
- called();
- }
-
- public void
- connection(Ice.Connection conn)
- {
- test(conn != null);
- called();
- }
-
- public void
- op()
- {
- called();
- }
-
- public void
- opWithResult(int r)
- {
- test(r == 15);
- called();
- }
-
- public void
- opWithUE(Ice.UserException e)
- {
- try
- {
- throw e;
- }
- catch(TestIntfException ex)
- {
- called();
- }
- catch(Ice.UserException ex)
- {
- test(false);
- }
- }
- }
-
- static class ExceptionCallback extends CallbackBase
- {
- public ExceptionCallback()
- {
- }
-
- public void
- isA(boolean r)
- {
- test(false);
- }
-
- public void
- ping()
- {
- test(false);
- }
-
- public void
- id(String id)
- {
- test(false);
- }
-
- public void
- ids(String[] ids)
- {
- test(false);
- }
-
- public void
- connection(Ice.Connection conn)
- {
- test(false);
- }
-
- public void
- op()
- {
- test(false);
- }
-
- public void
- ex(Ice.LocalException ex)
- {
- test(ex instanceof Ice.NoEndpointException);
- called();
- }
-
- public void
- noEx(Ice.LocalException ex)
- {
- test(false);
- }
- }
-
- static class SentCallback extends CallbackBase
+ static class SentCallback extends Callback
{
SentCallback()
{
_thread = Thread.currentThread().getId();
}
- public void
- isA(boolean r)
- {
- }
-
- public void
- ping()
- {
- }
-
- public void
- id(String s)
- {
- }
-
- public void
- ids(String[] s)
- {
- }
-
- public void
- opAsync(Ice.AsyncResult r)
- {
- }
-
- public void
- op()
- {
- }
-
- public void
- ex(Ice.LocalException ex)
- {
- }
-
- public void
- sent(Ice.AsyncResult r)
- {
- test(r.sentSynchronously() && _thread == Thread.currentThread().getId() ||
- !r.sentSynchronously() && _thread != Thread.currentThread().getId());
- called();
- }
-
- public void
- sent(boolean ss)
+ public void sent(boolean ss)
{
+ //
+ // The documented semantics for the sent callback states that the callback will be
+ // invoked by the calling thread if the request was sent synchronously, otherwise
+ // it will be invoked by a thread pool thread.
+ //
test(ss && _thread == Thread.currentThread().getId() ||
!ss && _thread != Thread.currentThread().getId());
called();
@@ -462,752 +91,108 @@ public class AMI
long _thread;
}
- static class FlushCallback extends CallbackBase
+ static class SentAsyncCallback extends Callback
{
- FlushCallback()
- {
- _thread = Thread.currentThread().getId();
- }
-
- public void
- completedAsync(Ice.AsyncResult r)
- {
- test(false);
- }
-
- public void
- exception(Ice.LocalException ex)
+ SentAsyncCallback(long thread)
{
- test(false);
+ _thread = thread;
}
- public void
- sentAsync(Ice.AsyncResult r)
+ public void sent(boolean ss)
{
- test((r.sentSynchronously() && _thread == Thread.currentThread().getId()) ||
- (!r.sentSynchronously() && _thread != Thread.currentThread().getId()));
- called();
- }
-
- public void
- sent(boolean sentSynchronously)
- {
- test((sentSynchronously && _thread == Thread.currentThread().getId()) ||
- (!sentSynchronously && _thread != Thread.currentThread().getId()));
+ //
+ // For whenSentAsync(), the callback is always invoked from an Executor thread.
+ //
+ test(_thread == Thread.currentThread().getId());
called();
}
long _thread;
}
- static class FlushExCallback extends CallbackBase
+ public static void run(Application app, com.zeroc.Ice.Communicator communicator, boolean collocated, TestIntfPrx p,
+ TestIntfControllerPrx testController)
{
- FlushExCallback()
- {
- }
-
- public void
- completedAsync(Ice.AsyncResult r)
- {
- try
- {
- if(r.getConnection() != null)
- {
- r.getConnection().end_flushBatchRequests(r);
- }
- else
- {
- r.getProxy().end_ice_flushBatchRequests(r);
- }
- test(false);
- }
- catch(Ice.LocalException ex)
- {
- called();
- }
- }
-
- public void
- exception(Ice.LocalException ex)
- {
- called();
- }
-
- public void
- sentAsync(Ice.AsyncResult r)
- {
- test(false);
- }
-
- public void
- sent(boolean sentSynchronously)
- {
- test(false);
- }
- }
-
- enum ThrowType { LocalException, OtherException };
-
- static class Thrower extends CallbackBase
- {
- public Thrower(ThrowType t)
- {
- _t = t;
- }
-
- public void
- opAsync(Ice.AsyncResult r)
- {
- called();
- throwEx();
- }
-
- public void
- op()
- {
- called();
- throwEx();
- }
-
- public void
- noOp()
- {
- }
-
- public void
- ex(Ice.LocalException ex)
- {
- called();
- throwEx();
- }
-
- public void
- sent(boolean ss)
- {
- called();
- throwEx();
- }
-
- private void
- throwEx()
- {
- switch(_t)
- {
- case LocalException:
- {
- throw new Ice.ObjectNotExistException();
- }
- case OtherException:
- {
- throw new RuntimeException();
- }
- default:
- {
- assert(false);
- break;
- }
- }
- }
-
- ThrowType _t;
- }
-
- public static void
- run(Application app, Ice.Communicator communicator, boolean collocated, TestIntfPrx p,
- TestIntfControllerPrx testController)
- {
-
PrintWriter out = app.getWriter();
out.print("testing begin/end invocation... ");
out.flush();
{
- Ice.AsyncResult result;
- java.util.Map<String, String> ctx = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> ctx = new java.util.HashMap<>();
- result = p.begin_ice_isA("::Test::TestIntf");
- test(p.end_ice_isA(result));
- result = p.begin_ice_isA("::Test::TestIntf", ctx);
- test(p.end_ice_isA(result));
+ test(p.ice_isAAsync("::Test::TestIntf").join());
+ test(p.ice_isAAsync("::Test::TestIntf", ctx).join());
- result = p.begin_ice_ping();
- p.end_ice_ping(result);
- result = p.begin_ice_ping(ctx);
- p.end_ice_ping(result);
+ p.ice_pingAsync().join();
+ p.ice_pingAsync(ctx).join();
- result = p.begin_ice_id();
- test(p.end_ice_id(result).equals("::Test::TestIntf"));
- result = p.begin_ice_id(ctx);
- test(p.end_ice_id(result).equals("::Test::TestIntf"));
+ test(p.ice_idAsync().join().equals("::Test::TestIntf"));
+ test(p.ice_idAsync(ctx).join().equals("::Test::TestIntf"));
- result = p.begin_ice_ids();
- test(p.end_ice_ids(result).length == 2);
- result = p.begin_ice_ids(ctx);
- test(p.end_ice_ids(result).length == 2);
+ test(p.ice_idsAsync().join().length == 2);
+ test(p.ice_idsAsync(ctx).join().length == 2);
if(!collocated)
{
- result = p.begin_ice_getConnection();
- test(p.end_ice_getConnection(result) != null);
+ test(p.ice_getConnectionAsync().join() != null);
}
- result = p.begin_op();
- p.end_op(result);
- result = p.begin_op(ctx);
- p.end_op(result);
+ p.opAsync().join();
+ p.opAsync(ctx).join();
- result = p.begin_opWithResult();
- test(p.end_opWithResult(result) == 15);
- result = p.begin_opWithResult(ctx);
- test(p.end_opWithResult(result) == 15);
+ test(p.opWithResultAsync().join() == 15);
+ test(p.opWithResultAsync(ctx).join() == 15);
- result = p.begin_opWithUE();
- try
- {
- p.end_opWithUE(result);
- test(false);
- }
- catch(TestIntfException ex)
- {
- }
- result = p.begin_opWithUE(ctx);
- try
- {
- p.end_opWithUE(result);
- test(false);
- }
- catch(TestIntfException ex)
- {
- }
+ p.opWithUEAsync().whenComplete((result, ex) -> { test(ex != null && ex instanceof TestIntfException); });
+ p.opWithUEAsync(ctx).whenComplete((result, ex) -> { test(ex != null && ex instanceof TestIntfException); });
if(p.supportsFunctionalTests())
{
- result = p.begin_opBool(true);
- test(p.end_opBool(result));
-
- result = p.begin_opByte((byte)0xff);
- test(p.end_opByte(result) == (byte)0xff);
-
- result = p.begin_opShort(Short.MIN_VALUE);
- test(p.end_opShort(result) == Short.MIN_VALUE);
+ test(p.opBoolAsync(true).join());
- result = p.begin_opInt(Integer.MIN_VALUE);
- test(p.end_opInt(result) == Integer.MIN_VALUE);
+ test(p.opByteAsync((byte)0xff).join() == (byte)0xff);
- result = p.begin_opLong(Long.MIN_VALUE);
- test(p.end_opLong(result) == Long.MIN_VALUE);
-
- result = p.begin_opFloat(3.14f);
- test(p.end_opFloat(result) == 3.14f);
-
- result = p.begin_opDouble(1.1E10);
- test(p.end_opDouble(result) == 1.1E10);
- }
- }
- out.println("ok");
-
- out.print("testing async callback... ");
- out.flush();
- {
- final AsyncCallback cb = new AsyncCallback();
- java.util.Map<String, String> ctx = new java.util.HashMap<String, String>();
-
- p.begin_ice_isA("::Test::TestIntf", new Ice.Callback()
- {
- @Override
- public void
- completed(Ice.AsyncResult r)
- {
- cb.isA(r);
- }
- });
- cb.check();
-
- p.begin_ice_isA("::Test::TestIntf", ctx, new Ice.Callback()
- {
- @Override
- public void
- completed(Ice.AsyncResult r)
- {
- cb.isA(r);
- }
- });
- cb.check();
+ test(p.opShortAsync(Short.MIN_VALUE).join() == Short.MIN_VALUE);
- p.begin_ice_ping(new Ice.Callback()
- {
- @Override
- public void
- completed(Ice.AsyncResult r)
- {
- cb.ping(r);
- }
- });
- cb.check();
- p.begin_ice_ping(ctx, new Ice.Callback()
- {
- @Override
- public void
- completed(Ice.AsyncResult r)
- {
- cb.ping(r);
- }
- });
- cb.check();
+ test(p.opIntAsync(Integer.MIN_VALUE).join() == Integer.MIN_VALUE);
- p.begin_ice_id(new Ice.Callback()
- {
- @Override
- public void
- completed(Ice.AsyncResult r)
- {
- cb.id(r);
- }
- });
- cb.check();
- p.begin_ice_id(ctx, new Ice.Callback()
- {
- @Override
- public void
- completed(Ice.AsyncResult r)
- {
- cb.id(r);
- }
- });
- cb.check();
+ test(p.opLongAsync(Long.MIN_VALUE).join() == Long.MIN_VALUE);
- p.begin_ice_ids(new Ice.Callback()
- {
- @Override
- public void
- completed(Ice.AsyncResult r)
- {
- cb.ids(r);
- }
- });
- cb.check();
- p.begin_ice_ids(ctx, new Ice.Callback()
- {
- @Override
- public void
- completed(Ice.AsyncResult r)
- {
- cb.ids(r);
- }
- });
- cb.check();
+ test(p.opFloatAsync(3.14f).join() == 3.14f);
- if(!collocated)
- {
- p.begin_ice_getConnection(new Ice.Callback()
- {
- @Override
- public void
- completed(Ice.AsyncResult r)
- {
- cb.connection(r);
- }
- });
- cb.check();
+ test(p.opDoubleAsync(1.1E10).join() == 1.1E10);
}
-
- p.begin_op(new Ice.Callback()
- {
- @Override
- public void
- completed(Ice.AsyncResult r)
- {
- cb.op(r);
- }
- });
- cb.check();
- p.begin_op(ctx, new Ice.Callback()
- {
- @Override
- public void
- completed(Ice.AsyncResult r)
- {
- cb.op(r);
- }
- });
- cb.check();
-
- p.begin_opWithResult(new Ice.Callback()
- {
- @Override
- public void
- completed(Ice.AsyncResult r)
- {
- cb.opWithResult(r);
- }
- });
- cb.check();
- p.begin_opWithResult(ctx, new Ice.Callback()
- {
- @Override
- public void
- completed(Ice.AsyncResult r)
- {
- cb.opWithResult(r);
- }
- });
- cb.check();
-
- p.begin_opWithUE(new Ice.Callback()
- {
- @Override
- public void
- completed(Ice.AsyncResult r)
- {
- cb.opWithUE(r);
- }
- });
- cb.check();
- p.begin_opWithUE(ctx, new Ice.Callback()
- {
- @Override
- public void
- completed(Ice.AsyncResult r)
- {
- cb.opWithUE(r);
- }
- });
- cb.check();
}
out.println("ok");
- out.print("testing response callback... ");
+ out.print("testing local exceptions... ");
out.flush();
{
- final ResponseCallback cb = new ResponseCallback();
- java.util.Map<String, String> ctx = new java.util.HashMap<String, String>();
+ TestIntfPrx indirect = p.ice_adapterId("dummy");
- p.begin_ice_isA("::Test::TestIntf", new Ice.Callback_Object_ice_isA()
+ indirect.opAsync().whenComplete((result, ex) ->
{
- @Override
- public void
- response(boolean r)
- {
- cb.isA(r);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(false);
- }
- });
- cb.check();
- p.begin_ice_isA("::Test::TestIntf", ctx, new Ice.Callback_Object_ice_isA()
- {
- @Override
- public void
- response(boolean r)
- {
- cb.isA(r);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(false);
- }
- });
- cb.check();
-
- p.begin_ice_ping(new Ice.Callback_Object_ice_ping()
- {
- @Override
- public void
- response()
- {
- cb.ping();
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(false);
- }
- });
- cb.check();
- p.begin_ice_ping(ctx, new Ice.Callback_Object_ice_ping()
- {
- @Override
- public void
- response()
- {
- cb.ping();
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(false);
- }
- });
- cb.check();
-
- p.begin_ice_id(new Ice.Callback_Object_ice_id()
- {
- @Override
- public void
- response(String id)
- {
- cb.id(id);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(false);
- }
- });
- cb.check();
- p.begin_ice_id(ctx, new Ice.Callback_Object_ice_id()
- {
- @Override
- public void
- response(String id)
- {
- cb.id(id);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(false);
- }
- });
- cb.check();
-
- p.begin_ice_ids(new Ice.Callback_Object_ice_ids()
- {
- @Override
- public void
- response(String[] ids)
- {
- cb.ids(ids);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(false);
- }
- });
- cb.check();
- p.begin_ice_ids(ctx, new Ice.Callback_Object_ice_ids()
- {
- @Override
- public void
- response(String[] ids)
- {
- cb.ids(ids);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(false);
- }
- });
- cb.check();
-
- if(!collocated)
- {
- p.begin_ice_getConnection(new Ice.Callback_Object_ice_getConnection()
- {
- @Override
- public void
- response(Ice.Connection conn)
- {
- cb.connection(conn);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(false);
- }
- });
- cb.check();
- }
-
- p.begin_op(new Callback_TestIntf_op()
- {
- @Override
- public void
- response()
- {
- cb.op();
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(false);
- }
- });
- cb.check();
- p.begin_op(ctx, new Callback_TestIntf_op()
- {
- @Override
- public void
- response()
- {
- cb.op();
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(false);
- }
+ test(ex != null && ex instanceof com.zeroc.Ice.NoEndpointException);
});
- cb.check();
-
- p.begin_opWithResult(new Callback_TestIntf_opWithResult()
- {
- @Override
- public void
- response(int r)
- {
- cb.opWithResult(r);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(false);
- }
- });
- cb.check();
- p.begin_opWithResult(ctx, new Callback_TestIntf_opWithResult()
- {
- @Override
- public void
- response(int r)
- {
- cb.opWithResult(r);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(false);
- }
- });
- cb.check();
-
- p.begin_opWithUE(new Callback_TestIntf_opWithUE()
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.UserException ex)
- {
- cb.opWithUE(ex);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(false);
- }
- });
- cb.check();
- p.begin_opWithUE(ctx, new Callback_TestIntf_opWithUE()
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.UserException ex)
- {
- cb.opWithUE(ex);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(false);
- }
- });
- cb.check();
- }
- out.println("ok");
-
- out.print("testing local exceptions... ");
- out.flush();
- {
- TestIntfPrx indirect = TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy"));
- Ice.AsyncResult r;
-
- r = indirect.begin_op();
- try
- {
- indirect.end_op(r);
- test(false);
- }
- catch(Ice.NoEndpointException ex)
- {
- }
-
-
- try
- {
- r = ((TestIntfPrx)p.ice_oneway()).begin_opWithResult();
- test(false);
- }
- catch(java.lang.IllegalArgumentException ex)
- {
- }
//
// Check that CommunicatorDestroyedException is raised directly.
//
if(p.ice_getConnection() != null)
{
- Ice.InitializationData initData = app.createInitializationData();
+ com.zeroc.Ice.InitializationData initData = app.createInitializationData();
initData.properties = communicator.getProperties()._clone();
- Ice.Communicator ic = app.initialize(initData);
- Ice.ObjectPrx o = ic.stringToProxy(p.toString());
- TestIntfPrx p2 = TestIntfPrxHelper.checkedCast(o);
+ com.zeroc.Ice.Communicator ic = app.initialize(initData);
+ com.zeroc.Ice.ObjectPrx o = ic.stringToProxy(p.toString());
+ TestIntfPrx p2 = TestIntfPrx.checkedCast(o);
ic.destroy();
try
{
- p2.begin_op();
+ p2.opAsync();
test(false);
}
- catch(Ice.CommunicatorDestroyedException ex)
+ catch(com.zeroc.Ice.CommunicatorDestroyedException ex)
{
// Expected.
}
@@ -1215,690 +200,163 @@ public class AMI
}
out.println("ok");
- out.print("testing local exceptions with async callback... ");
+ out.print("testing sent callback... ");
out.flush();
{
- TestIntfPrx i = TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy"));
- final AsyncCallback cb = new AsyncCallback();
-
- i.begin_ice_isA("::Test::TestIntf", new Ice.Callback()
- {
- @Override
- public void
- completed(Ice.AsyncResult r)
- {
- cb.isAEx(r);
- }
- });
- cb.check();
-
- i.begin_ice_ping(new Ice.Callback()
- {
- @Override
- public void
- completed(Ice.AsyncResult r)
- {
- cb.pingEx(r);
- }
- });
- cb.check();
-
- i.begin_ice_id(new Ice.Callback()
- {
- @Override
- public void
- completed(Ice.AsyncResult r)
- {
- cb.idEx(r);
- }
- });
- cb.check();
-
- i.begin_ice_ids(new Ice.Callback()
- {
- @Override
- public void
- completed(Ice.AsyncResult r)
- {
- cb.idsEx(r);
- }
- });
- cb.check();
+ final SentCallback cb = new SentCallback();
- if(!collocated)
{
- i.begin_ice_getConnection(new Ice.Callback()
- {
- @Override
- public void
- completed(Ice.AsyncResult r)
+ CompletableFuture<Boolean> r = p.ice_isAAsync("");
+ Util.getInvocationFuture(r).whenSent((sentSynchronously, ex) ->
{
- cb.connectionEx(r);
- }
- });
+ test(ex == null);
+ cb.sent(sentSynchronously);
+ });
cb.check();
}
- i.begin_op(new Ice.Callback()
- {
- @Override
- public void
- completed(Ice.AsyncResult r)
- {
- cb.opEx(r);
- }
- });
- cb.check();
- }
- out.println("ok");
-
- out.print("testing local exceptions with response callback... ");
- out.flush();
- {
- TestIntfPrx i = TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy"));
- final ExceptionCallback cb = new ExceptionCallback();
-
- i.begin_ice_isA("::Test::TestIntf", new Ice.Callback_Object_ice_isA()
- {
- @Override
- public void
- response(boolean r)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- cb.ex(ex);
- }
- });
- cb.check();
-
- i.begin_ice_ping(new Ice.Callback_Object_ice_ping()
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- cb.ex(ex);
- }
- });
- cb.check();
-
- i.begin_ice_id(new Ice.Callback_Object_ice_id()
- {
- @Override
- public void
- response(String id)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- cb.ex(ex);
- }
- });
- cb.check();
-
- i.begin_ice_ids(new Ice.Callback_Object_ice_ids()
- {
- @Override
- public void
- response(String[] ids)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- cb.ex(ex);
- }
- });
- cb.check();
-
- if(!collocated)
{
- i.begin_ice_getConnection(new Ice.Callback_Object_ice_getConnection()
+ CompletableFuture<Void> r = p.ice_pingAsync();
+ Util.getInvocationFuture(r).whenSent((sentSynchronously, ex) ->
{
- @Override
- public void
- response(Ice.Connection conn)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- cb.ex(ex);
- }
+ test(ex == null);
+ cb.sent(sentSynchronously);
});
cb.check();
}
- i.begin_op(new Callback_TestIntf_op()
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- cb.ex(ex);
- }
- });
- cb.check();
- }
- out.println("ok");
-
- out.print("testing sent callback... ");
- out.flush();
- {
- final SentCallback cb = new SentCallback();
-
- p.begin_ice_isA("", new Ice.Callback_Object_ice_isA()
- {
- @Override
- public void
- response(boolean r)
- {
- cb.isA(r);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- cb.ex(ex);
- }
-
- @Override
- public void
- sent(boolean ss)
- {
- cb.sent(ss);
- }
- });
- cb.check();
-
- p.begin_ice_ping(new Ice.Callback_Object_ice_ping()
- {
- @Override
- public void
- response()
- {
- cb.ping();
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- cb.ex(ex);
- }
-
- @Override
- public void
- sent(boolean ss)
- {
- cb.sent(ss);
- }
- });
- cb.check();
-
- p.begin_ice_id(new Ice.Callback_Object_ice_id()
- {
- @Override
- public void
- response(String id)
- {
- cb.id(id);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- cb.ex(ex);
- }
-
- @Override
- public void
- sent(boolean ss)
- {
- cb.sent(ss);
- }
- });
- cb.check();
-
- p.begin_ice_ids(new Ice.Callback_Object_ice_ids()
{
- @Override
- public void
- response(String[] ids)
- {
- cb.ids(ids);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- cb.ex(ex);
- }
-
- @Override
- public void
- sent(boolean ss)
- {
- cb.sent(ss);
- }
- });
- cb.check();
-
- p.begin_op(new Callback_TestIntf_op()
- {
- @Override
- public void
- response()
- {
- cb.op();
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- cb.ex(ex);
- }
-
- @Override
- public void
- sent(boolean ss)
- {
- cb.sent(ss);
- }
- });
- cb.check();
-
- p.begin_op(new Ice.Callback()
- {
- @Override
- public void
- completed(Ice.AsyncResult result)
- {
- cb.opAsync(result);
- }
-
- @Override
- public void
- sent(Ice.AsyncResult result)
- {
- cb.sent(result);
- }
- });
- cb.check();
-
- java.util.List<SentCallback> cbs = new java.util.ArrayList<SentCallback>();
- byte[] seq = new byte[10024];
- Ice.AsyncResult r;
- testController.holdAdapter();
-
- final Counter counter = new Counter();
- try
- {
- do
- {
- final SentCallback cb2 = new SentCallback();
- r = p.begin_opWithPayload(seq, new Callback_TestIntf_opWithPayload()
+ CompletableFuture<String> r = p.ice_idAsync();
+ Util.getInvocationFuture(r).whenSent((sentSynchronously, ex) ->
{
- @Override
- public void
- response()
- {
- counter.decrement();
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- counter.decrement();
- cb2.ex(ex);
- }
-
- @Override
- public void
- sent(boolean ss)
- {
- cb2.sent(ss);
- }
+ test(ex == null);
+ cb.sent(sentSynchronously);
});
- counter.increment();
- cbs.add(cb2);
- }
- while(r.sentSynchronously());
- }
- finally
- {
- testController.resumeAdapter();
- }
- for(SentCallback cb3 : cbs)
- {
- cb3.check();
- }
- try
- {
- counter.waitComplete();
+ cb.check();
}
- catch(InterruptedException e)
+
{
+ CompletableFuture<String[]> r = p.ice_idsAsync();
+ Util.getInvocationFuture(r).whenSent((sentSynchronously, ex) ->
+ {
+ test(ex == null);
+ cb.sent(sentSynchronously);
+ });
+ cb.check();
}
}
- out.println("ok");
- out.print("testing illegal arguments... ");
+ out.print("testing sent async callback... ");
out.flush();
{
- Ice.AsyncResult result;
-
- result = p.begin_op();
- p.end_op(result);
- try
- {
- p.end_op(result);
- test(false);
- }
- catch(IllegalArgumentException ex)
- {
- }
+ //
+ // Create an executor to use for dispatching completed futures.
+ //
+ java.util.concurrent.ExecutorService executor = java.util.concurrent.Executors.newSingleThreadExecutor();
- result = p.begin_op();
+ //
+ // Determine the id of the executor's thread.
+ //
+ long executorThread = 0;
try
{
- p.end_opWithResult(result);
- test(false);
- }
- catch(IllegalArgumentException ex)
- {
+ executorThread = executor.submit(() -> { return Thread.currentThread().getId(); }).get();
}
-
- try
+ catch(Exception ex)
{
- p.end_op(null);
test(false);
}
- catch(IllegalArgumentException ex)
- {
- }
- // try
-// {
-// p.begin_op((Ice.Callback)null);
-// test(false);
-// }
-// catch(IllegalArgumentException ex)
-// {
-// }
-
-// try
-// {
-// p.begin_op((Callback_TestIntf_op)null);
-// test(false);
-// }
-// catch(IllegalArgumentException ex)
-// {
-// }
- }
- out.println("ok");
-
- out.print("testing unexpected exceptions from callback... ");
- out.flush();
- {
- TestIntfPrx q = TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy"));
- ThrowType throwEx[] = { ThrowType.LocalException, ThrowType.OtherException };
+ final SentAsyncCallback cb = new SentAsyncCallback(executorThread);
- for(int i = 0; i < 2; ++i)
{
- final Thrower cb = new Thrower(throwEx[i]);
-
- p.begin_op(new Ice.Callback()
+ CompletableFuture<Boolean> r = p.ice_isAAsync("");
+ Util.getInvocationFuture(r).whenSentAsync((sentSynchronously, ex) ->
{
- @Override
- public void
- completed(Ice.AsyncResult result)
- {
- cb.opAsync(result);
- }
- });
+ test(ex == null);
+ cb.sent(sentSynchronously);
+ }, executor);
cb.check();
+ }
- p.begin_op(new Callback_TestIntf_op()
+ {
+ CompletableFuture<Void> r = p.ice_pingAsync();
+ Util.getInvocationFuture(r).whenSentAsync((sentSynchronously, ex) ->
{
- @Override
- public void
- response()
- {
- cb.op();
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- }
- });
+ test(ex == null);
+ cb.sent(sentSynchronously);
+ }, executor);
cb.check();
+ }
- q.begin_op(new Callback_TestIntf_op()
+ {
+ CompletableFuture<String> r = p.ice_idAsync();
+ Util.getInvocationFuture(r).whenSentAsync((sentSynchronously, ex) ->
{
- @Override
- public void
- response()
- {
- cb.op();
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- cb.ex(ex);
- }
- });
+ test(ex == null);
+ cb.sent(sentSynchronously);
+ }, executor);
cb.check();
+ }
- p.begin_op(new Callback_TestIntf_op()
+ {
+ CompletableFuture<String[]> r = p.ice_idsAsync();
+ Util.getInvocationFuture(r).whenSentAsync((sentSynchronously, ex) ->
{
- @Override
- public void
- response()
- {
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- }
-
- @Override
- public void
- sent(boolean ss)
- {
- cb.sent(ss);
- }
- });
+ test(ex == null);
+ cb.sent(sentSynchronously);
+ }, executor);
cb.check();
}
+
+ executor.shutdown();
}
out.println("ok");
out.print("testing batch requests with proxy... ");
out.flush();
{
- test(p.ice_batchOneway().begin_ice_flushBatchRequests().sentSynchronously());
-
{
- //
- // AsyncResult.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- b1.opBatch();
- b1.opBatch();
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = b1.begin_ice_flushBatchRequests(
- new Ice.Callback()
- {
- @Override
- public void completed(Ice.AsyncResult result)
- {
- cb.completedAsync(result);
- }
-
- @Override
- public void sent(Ice.AsyncResult result)
- {
- cb.sentAsync(result);
- }
- });
- cb.check();
- test(r.isSent());
- test(r.isCompleted());
- test(p.waitForBatch(2));
-
- final FlushCallback cb2 = new FlushCallback();
- Ice.AsyncResult r2 = b1.begin_ice_flushBatchRequests(
- new Ice.Callback()
- {
- @Override
- public void completed(Ice.AsyncResult result)
- {
- cb2.completedAsync(result);
- }
-
- @Override
- public void sent(Ice.AsyncResult result)
- {
- cb2.sentAsync(result);
- }
- });
- cb2.check();
- test(r2.isSent());
- test(r2.isCompleted());
+ CompletableFuture<Void> r = p.ice_batchOneway().ice_flushBatchRequestsAsync();
+ test(Util.getInvocationFuture(r).sentSynchronously());
+ test(Util.getInvocationFuture(r).isSent());
+ test(Util.getInvocationFuture(r).isDone());
}
- if(p.ice_getConnection() != null)
{
- //
- // AsyncResult exception.
- //
+ final SentCallback cb = new SentCallback();
test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- b1.opBatch();
- b1.ice_getConnection().close(false);
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = b1.begin_ice_flushBatchRequests(
- new Ice.Callback()
- {
- @Override
- public void completed(Ice.AsyncResult result)
- {
- cb.completedAsync(result);
- }
-
- @Override
- public void sent(Ice.AsyncResult result)
- {
- cb.sentAsync(result);
- }
- });
- cb.check();
- test(r.isSent());
- test(r.isCompleted());
- test(p.waitForBatch(1));
- }
-
- {
- //
- // Type-safe.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
+ TestIntfPrx b1 = p.ice_batchOneway();
b1.opBatch();
b1.opBatch();
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = b1.begin_ice_flushBatchRequests(
- new Ice.Callback_Object_ice_flushBatchRequests()
+ CompletableFuture<Void> r = b1.ice_flushBatchRequestsAsync();
+ Util.getInvocationFuture(r).whenSent((sentSynchronously, ex) ->
{
- @Override
- public void exception(Ice.LocalException ex)
- {
- cb.exception(ex);
- }
-
- @Override
- public void sent(boolean sentSynchronously)
- {
- cb.sent(sentSynchronously);
- }
+ test(ex == null);
+ cb.sent(sentSynchronously);
});
cb.check();
- test(r.isSent());
- test(r.isCompleted());
+ test(Util.getInvocationFuture(r).isSent());
+ test(r.isDone());
test(p.waitForBatch(2));
}
if(p.ice_getConnection() != null)
{
- //
- // Type-safe exception.
- //
+ final SentCallback cb = new SentCallback();
test(p.opBatchCount() == 0);
- TestIntfPrx b1 = (TestIntfPrx)p.ice_batchOneway();
- b1.ice_getConnection();
+ TestIntfPrx b1 = p.ice_batchOneway();
b1.opBatch();
b1.ice_getConnection().close(false);
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = b1.begin_ice_flushBatchRequests(
- new Ice.Callback_Object_ice_flushBatchRequests()
+ CompletableFuture<Void> r = b1.ice_flushBatchRequestsAsync();
+ Util.getInvocationFuture(r).whenSent((sentSynchronously, ex) ->
{
- @Override
- public void exception(Ice.LocalException ex)
- {
- cb.exception(ex);
- }
-
- @Override
- public void sent(boolean sentSynchronously)
- {
- cb.sent(sentSynchronously);
- }
+ test(ex == null);
+ cb.sent(sentSynchronously);
});
cb.check();
- test(r.isSent());
- test(r.isCompleted());
+ test(Util.getInvocationFuture(r).isSent());
+ test(r.isDone());
test(p.waitForBatch(1));
}
}
@@ -1910,126 +368,43 @@ public class AMI
out.flush();
{
{
- //
- // AsyncResult.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy(
- p.ice_getIdentity()).ice_batchOneway());
- b1.opBatch();
- b1.opBatch();
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(
- new Ice.Callback()
- {
- @Override
- public void completed(Ice.AsyncResult result)
- {
- cb.completedAsync(result);
- }
-
- @Override
- public void sent(Ice.AsyncResult result)
- {
- cb.sentAsync(result);
- }
- });
- cb.check();
- test(r.isSent());
- test(r.isCompleted());
- test(p.waitForBatch(2));
- }
-
- {
- //
- // AsyncResult exception.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy(
- p.ice_getIdentity()).ice_batchOneway());
- b1.opBatch();
- b1.ice_getConnection().close(false);
- final FlushExCallback cb = new FlushExCallback();
- Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(
- new Ice.Callback()
- {
- @Override
- public void completed(Ice.AsyncResult result)
- {
- cb.completedAsync(result);
- }
-
- @Override
- public void sent(Ice.AsyncResult result)
- {
- cb.sentAsync(result);
- }
- });
- cb.check();
- test(!r.isSent());
- test(r.isCompleted());
- test(p.opBatchCount() == 0);
- }
-
- {
- //
- // Type-safe.
- //
+ final SentCallback cb = new SentCallback();
test(p.opBatchCount() == 0);
- TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy(
- p.ice_getIdentity()).ice_batchOneway());
+ TestIntfPrx b1 = TestIntfPrx.uncheckedCast(p.ice_getConnection().createProxy(p.ice_getIdentity())).
+ ice_batchOneway();
b1.opBatch();
b1.opBatch();
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(
- new Ice.Callback_Connection_flushBatchRequests()
+ CompletableFuture<Void> r = b1.ice_getConnection().flushBatchRequestsAsync();
+ Util.getInvocationFuture(r).whenSent((sentSynchronously, ex) ->
{
- @Override
- public void exception(Ice.LocalException ex)
- {
- cb.exception(ex);
- }
-
- @Override
- public void sent(boolean sentSynchronously)
- {
- cb.sent(sentSynchronously);
- }
+ test(ex == null);
+ cb.sent(sentSynchronously);
});
cb.check();
- test(r.isSent());
- test(r.isCompleted());
+ test(Util.getInvocationFuture(r).isSent());
+ test(r.isDone());
test(p.waitForBatch(2));
}
{
//
- // Type-safe exception.
+ // Exception.
//
+ final Callback cb = new Callback();
test(p.opBatchCount() == 0);
- TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy(
- p.ice_getIdentity()).ice_batchOneway());
+ TestIntfPrx b1 = TestIntfPrx.uncheckedCast(p.ice_getConnection().createProxy(p.ice_getIdentity())).
+ ice_batchOneway();
b1.opBatch();
b1.ice_getConnection().close(false);
- final FlushExCallback cb = new FlushExCallback();
- Ice.AsyncResult r = b1.ice_getConnection().begin_flushBatchRequests(
- new Ice.Callback_Connection_flushBatchRequests()
+ CompletableFuture<Void> r = b1.ice_getConnection().flushBatchRequestsAsync();
+ Util.getInvocationFuture(r).whenSent((sentSynchronously, ex) ->
{
- @Override
- public void exception(Ice.LocalException ex)
- {
- cb.exception(ex);
- }
-
- @Override
- public void sent(boolean sentSynchronously)
- {
- cb.sent(sentSynchronously);
- }
+ test(ex != null);
+ cb.called();
});
cb.check();
- test(!r.isSent());
- test(r.isCompleted());
+ test(!Util.getInvocationFuture(r).isSent());
+ test(r.isDone());
test(p.opBatchCount() == 0);
}
}
@@ -2040,237 +415,45 @@ public class AMI
{
{
//
- // AsyncResult - 1 connection.
+ // 1 connection.
//
+ final SentCallback cb = new SentCallback();
test(p.opBatchCount() == 0);
- TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy(
- p.ice_getIdentity()).ice_batchOneway());
+ TestIntfPrx b1 = TestIntfPrx.uncheckedCast(p.ice_getConnection().createProxy(p.ice_getIdentity())).
+ ice_batchOneway();
b1.opBatch();
b1.opBatch();
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- new Ice.Callback()
- {
- @Override
- public void completed(Ice.AsyncResult result)
- {
- cb.completedAsync(result);
- }
-
- @Override
- public void sent(Ice.AsyncResult result)
- {
- cb.sentAsync(result);
- }
- });
- cb.check();
- test(r.isSent());
- test(r.isCompleted());
- test(p.waitForBatch(2));
- }
-
- {
- //
- // AsyncResult exception - 1 connection.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(p.ice_getConnection().createProxy(
- p.ice_getIdentity()).ice_batchOneway());
- b1.opBatch();
- b1.ice_getConnection().close(false);
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- new Ice.Callback()
+ CompletableFuture<Void> r = communicator.flushBatchRequestsAsync();
+ Util.getInvocationFuture(r).whenSent((sentSynchronously, ex) ->
{
- @Override
- public void completed(Ice.AsyncResult result)
- {
- cb.completedAsync(result);
- }
-
- @Override
- public void sent(Ice.AsyncResult result)
- {
- cb.sentAsync(result);
- }
- });
- cb.check();
- test(r.isSent()); // Exceptions are ignored!
- test(r.isCompleted());
- test(p.opBatchCount() == 0);
- }
-
- {
- //
- // AsyncResult - 2 connections.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(
- p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
- TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast(
- p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
- b2.ice_getConnection(); // Ensure connection is established.
- b1.opBatch();
- b1.opBatch();
- b2.opBatch();
- b2.opBatch();
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- new Ice.Callback()
- {
- @Override
- public void completed(Ice.AsyncResult result)
- {
- cb.completedAsync(result);
- }
-
- @Override
- public void sent(Ice.AsyncResult result)
- {
- cb.sentAsync(result);
- }
- });
- cb.check();
- test(r.isSent());
- test(r.isCompleted());
- test(p.waitForBatch(4));
- }
-
- {
- //
- // AsyncResult exception - 2 connections - 1 failure.
- //
- // All connections should be flushed even if there are failures on some connections.
- // Exceptions should not be reported.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(
- p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
- TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast(
- p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
- b2.ice_getConnection(); // Ensure connection is established.
- b1.opBatch();
- b2.opBatch();
- b1.ice_getConnection().close(false);
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- new Ice.Callback()
- {
- @Override
- public void completed(Ice.AsyncResult result)
- {
- cb.completedAsync(result);
- }
-
- @Override
- public void sent(Ice.AsyncResult result)
- {
- cb.sentAsync(result);
- }
- });
- cb.check();
- test(r.isSent()); // Exceptions are ignored!
- test(r.isCompleted());
- test(p.waitForBatch(1));
- }
-
- {
- //
- // AsyncResult exception - 2 connections - 2 failures.
- //
- // The sent callback should be invoked even if all connections fail.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(
- p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
- TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast(
- p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
- b2.ice_getConnection(); // Ensure connection is established.
- b1.opBatch();
- b2.opBatch();
- b1.ice_getConnection().close(false);
- b2.ice_getConnection().close(false);
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- new Ice.Callback()
- {
- @Override
- public void completed(Ice.AsyncResult result)
- {
- cb.completedAsync(result);
- }
-
- @Override
- public void sent(Ice.AsyncResult result)
- {
- cb.sentAsync(result);
- }
- });
- cb.check();
- test(r.isSent()); // Exceptions are ignored!
- test(r.isCompleted());
- test(p.opBatchCount() == 0);
- }
-
- {
- //
- // Type-safe - 1 connection.
- //
- test(p.opBatchCount() == 0);
- TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(
- p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
- b1.opBatch();
- b1.opBatch();
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- new Ice.Callback_Communicator_flushBatchRequests()
- {
- @Override
- public void exception(Ice.LocalException ex)
- {
- cb.exception(ex);
- }
-
- @Override
- public void sent(boolean sentSynchronously)
- {
- cb.sent(sentSynchronously);
- }
+ test(ex == null);
+ cb.sent(sentSynchronously);
});
cb.check();
- test(r.isSent());
- test(r.isCompleted());
+ test(Util.getInvocationFuture(r).isSent());
+ test(r.isDone());
test(p.waitForBatch(2));
}
{
//
- // Type-safe exception - 1 connection.
+ // Exception - 1 connection.
//
+ final SentCallback cb = new SentCallback();
test(p.opBatchCount() == 0);
- TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(
- p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
+ TestIntfPrx b1 = TestIntfPrx.uncheckedCast(p.ice_getConnection().createProxy(p.ice_getIdentity())).
+ ice_batchOneway();
b1.opBatch();
b1.ice_getConnection().close(false);
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- new Ice.Callback_Communicator_flushBatchRequests()
+ CompletableFuture<Void> r = communicator.flushBatchRequestsAsync();
+ Util.getInvocationFuture(r).whenSent((sentSynchronously, ex) ->
{
- @Override
- public void exception(Ice.LocalException ex)
- {
- cb.exception(ex);
- }
-
- @Override
- public void sent(boolean sentSynchronously)
- {
- cb.sent(sentSynchronously);
- }
+ test(ex == null);
+ cb.sent(sentSynchronously);
});
cb.check();
- test(r.isSent()); // Exceptions are ignored!
- test(r.isCompleted());
+ test(Util.getInvocationFuture(r).isSent()); // Exceptions are ignored!
+ test(r.isDone());
test(p.opBatchCount() == 0);
}
@@ -2278,35 +461,26 @@ public class AMI
//
// 2 connections.
//
+ final SentCallback cb = new SentCallback();
test(p.opBatchCount() == 0);
- TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(
- p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
- TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast(
- p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
+ TestIntfPrx b1 = TestIntfPrx.uncheckedCast(
+ p.ice_getConnection().createProxy(p.ice_getIdentity())).ice_batchOneway();
+ TestIntfPrx b2 = TestIntfPrx.uncheckedCast(
+ p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity())).ice_batchOneway();
b2.ice_getConnection(); // Ensure connection is established.
b1.opBatch();
b1.opBatch();
b2.opBatch();
b2.opBatch();
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- new Ice.Callback_Communicator_flushBatchRequests()
+ CompletableFuture<Void> r = communicator.flushBatchRequestsAsync();
+ Util.getInvocationFuture(r).whenSent((sentSynchronously, ex) ->
{
- @Override
- public void exception(Ice.LocalException ex)
- {
- cb.exception(ex);
- }
-
- @Override
- public void sent(boolean sentSynchronously)
- {
- cb.sent(sentSynchronously);
- }
+ test(ex == null);
+ cb.sent(sentSynchronously);
});
cb.check();
- test(r.isSent());
- test(r.isCompleted());
+ test(Util.getInvocationFuture(r).isSent()); // Exceptions are ignored!
+ test(r.isDone());
test(p.waitForBatch(4));
}
@@ -2317,34 +491,25 @@ public class AMI
// All connections should be flushed even if there are failures on some connections.
// Exceptions should not be reported.
//
+ final SentCallback cb = new SentCallback();
test(p.opBatchCount() == 0);
- TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(
- p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
- TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast(
- p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
+ TestIntfPrx b1 = TestIntfPrx.uncheckedCast(
+ p.ice_getConnection().createProxy(p.ice_getIdentity())).ice_batchOneway();
+ TestIntfPrx b2 = TestIntfPrx.uncheckedCast(
+ p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity())).ice_batchOneway();
b2.ice_getConnection(); // Ensure connection is established.
b1.opBatch();
b2.opBatch();
b1.ice_getConnection().close(false);
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- new Ice.Callback_Communicator_flushBatchRequests()
+ CompletableFuture<Void> r = communicator.flushBatchRequestsAsync();
+ Util.getInvocationFuture(r).whenSent((sentSynchronously, ex) ->
{
- @Override
- public void exception(Ice.LocalException ex)
- {
- cb.exception(ex);
- }
-
- @Override
- public void sent(boolean sentSynchronously)
- {
- cb.sent(sentSynchronously);
- }
+ test(ex == null);
+ cb.sent(sentSynchronously);
});
cb.check();
- test(r.isSent()); // Exceptions are ignored!
- test(r.isCompleted());
+ test(Util.getInvocationFuture(r).isSent()); // Exceptions are ignored!
+ test(r.isDone());
test(p.waitForBatch(1));
}
@@ -2354,72 +519,71 @@ public class AMI
//
// The sent callback should be invoked even if all connections fail.
//
+ final SentCallback cb = new SentCallback();
test(p.opBatchCount() == 0);
- TestIntfPrx b1 = TestIntfPrxHelper.uncheckedCast(
- p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
- TestIntfPrx b2 = TestIntfPrxHelper.uncheckedCast(
- p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway());
+ TestIntfPrx b1 = TestIntfPrx.uncheckedCast(
+ p.ice_getConnection().createProxy(p.ice_getIdentity())).ice_batchOneway();
+ TestIntfPrx b2 = TestIntfPrx.uncheckedCast(
+ p.ice_connectionId("2").ice_getConnection().createProxy(p.ice_getIdentity())).ice_batchOneway();
b2.ice_getConnection(); // Ensure connection is established.
b1.opBatch();
b2.opBatch();
b1.ice_getConnection().close(false);
b2.ice_getConnection().close(false);
- final FlushCallback cb = new FlushCallback();
- Ice.AsyncResult r = communicator.begin_flushBatchRequests(
- new Ice.Callback_Communicator_flushBatchRequests()
+ CompletableFuture<Void> r = communicator.flushBatchRequestsAsync();
+ Util.getInvocationFuture(r).whenSent((sentSynchronously, ex) ->
{
- @Override
- public void exception(Ice.LocalException ex)
- {
- cb.exception(ex);
- }
-
- @Override
- public void sent(boolean sentSynchronously)
- {
- cb.sent(sentSynchronously);
- }
+ test(ex == null);
+ cb.sent(sentSynchronously);
});
cb.check();
- test(r.isSent()); // Exceptions are ignored!
- test(r.isCompleted());
+ test(Util.getInvocationFuture(r).isSent()); // Exceptions are ignored!
+ test(r.isDone());
test(p.opBatchCount() == 0);
}
}
out.println("ok");
}
- out.print("testing AsyncResult operations... ");
+ out.print("testing future operations... ");
out.flush();
{
{
- TestIntfPrx indirect = TestIntfPrxHelper.uncheckedCast(p.ice_adapterId("dummy"));
- Ice.AsyncResult r = indirect.begin_op();
+ TestIntfPrx indirect = p.ice_adapterId("dummy");
+ CompletableFuture<Void> r = indirect.opAsync();
+ Util.getInvocationFuture(r).waitForCompleted();
try
{
- r.waitForCompleted();
- r.throwLocalException();
+ r.join();
test(false);
}
- catch(Ice.NoEndpointException ex)
+ catch(CompletionException ex)
{
+ test(ex.getCause() instanceof com.zeroc.Ice.NoEndpointException);
}
testController.holdAdapter();
- Ice.AsyncResult r1;
- Ice.AsyncResult r2;
+ InvocationFuture<Void> r1;
+ InvocationFuture<Void> r2;
try
{
- r1 = p.begin_op();
+ r1 = Util.getInvocationFuture(p.opAsync());
byte[] seq = new byte[10024];
- while((r2 = p.begin_opWithPayload(seq)).sentSynchronously());
+ while(true)
+ {
+ r2 = Util.getInvocationFuture(p.opWithPayloadAsync(seq));
+ if(!r2.sentSynchronously())
+ {
+ break;
+ }
+ }
if(p.ice_getConnection() != null)
{
- test(r1.sentSynchronously() && r1.isSent() && !r1.isCompleted() ||
- !r1.sentSynchronously() && !r1.isCompleted());
+ test(r1.sentSynchronously() && r1.isSent() && !r1.isDone() ||
+ !r1.sentSynchronously() && !r1.isDone());
- test(!r2.sentSynchronously() && !r2.isCompleted());
+ test(!r2.sentSynchronously() && !r2.isDone());
}
}
finally
@@ -2434,113 +598,115 @@ public class AMI
test(r2.isSent());
r1.waitForCompleted();
- test(r1.isCompleted());
+ test(r1.isDone());
r2.waitForCompleted();
- test(r2.isCompleted());
+ test(r2.isDone());
test(r1.getOperation().equals("op"));
test(r2.getOperation().equals("opWithPayload"));
}
{
- Ice.AsyncResult r;
-
- //
- // Twoway
- //
- r = p.begin_ice_ping();
- test(r.getOperation().equals("ice_ping"));
- test(r.getConnection() == null); // Expected
- test(r.getCommunicator() == communicator);
- test(r.getProxy() == p);
- p.end_ice_ping(r);
-
- TestIntfPrx p2;
+ {
+ //
+ // Twoway
+ //
+ InvocationFuture<Void> r = Util.getInvocationFuture(p.ice_pingAsync());
+ test(r.getOperation().equals("ice_ping"));
+ test(r.getConnection() == null); // Expected
+ test(r.getCommunicator() == communicator);
+ test(r.getProxy() == p);
+ r.join();
+ }
- //
- // Oneway
- //
- p2 = (TestIntfPrx)p.ice_oneway();
- r = p2.begin_ice_ping();
- test(r.getOperation().equals("ice_ping"));
- test(r.getConnection() == null); // Expected
- test(r.getCommunicator() == communicator);
- test(r.getProxy() == p2);
+ {
+ //
+ // Oneway
+ //
+ TestIntfPrx p2 = p.ice_oneway();
+ InvocationFuture<Void> r = Util.getInvocationFuture(p2.ice_pingAsync());
+ test(r.getOperation().equals("ice_ping"));
+ test(r.getConnection() == null); // Expected
+ test(r.getCommunicator() == communicator);
+ test(r.getProxy() == p2);
+ }
- //
- // Batch request via proxy
- //
- p2 = (TestIntfPrx)p.ice_batchOneway();
- p2.ice_ping();
- r = p2.begin_ice_flushBatchRequests();
- test(r.getConnection() == null); // Expected
- test(r.getCommunicator() == communicator);
- test(r.getProxy() == p2);
- p2.end_ice_flushBatchRequests(r);
+ {
+ //
+ // Batch request via proxy
+ //
+ TestIntfPrx p2 = p.ice_batchOneway();
+ p2.ice_ping();
+ InvocationFuture<Void> r = Util.getInvocationFuture(p2.ice_flushBatchRequestsAsync());
+ test(r.getConnection() == null); // Expected
+ test(r.getCommunicator() == communicator);
+ test(r.getProxy() == p2);
+ r.join();
+ }
if(p.ice_getConnection() != null)
{
//
// Batch request via connection
//
- Ice.Connection con = p.ice_getConnection();
- p2 = (TestIntfPrx)p.ice_batchOneway();
+ com.zeroc.Ice.Connection con = p.ice_getConnection();
+ TestIntfPrx p2 = p.ice_batchOneway();
p2.ice_ping();
- r = con.begin_flushBatchRequests();
+ InvocationFuture<Void> r = Util.getInvocationFuture(con.flushBatchRequestsAsync());
test(r.getConnection() == con);
test(r.getCommunicator() == communicator);
test(r.getProxy() == null); // Expected
- con.end_flushBatchRequests(r);
+ r.join();
//
// Batch request via communicator
//
- p2 = (TestIntfPrx)p.ice_batchOneway();
+ p2 = p.ice_batchOneway();
p2.ice_ping();
- r = communicator.begin_flushBatchRequests();
+ r = Util.getInvocationFuture(communicator.flushBatchRequestsAsync());
test(r.getConnection() == null); // Expected
test(r.getCommunicator() == communicator);
test(r.getProxy() == null); // Expected
- communicator.end_flushBatchRequests(r);
+ r.join();
}
}
if(p.ice_getConnection() != null)
{
- Ice.AsyncResult r1 = null;
- Ice.AsyncResult r2 = null;
+ InvocationFuture<Void> r1 = null;
+ InvocationFuture<String> r2 = null;
testController.holdAdapter();
try
{
- Ice.AsyncResult r = null;
+ InvocationFuture<Void> r = null;
byte[] seq = new byte[10024];
for(int i = 0; i < 200; ++i) // 2MB
{
- r = p.begin_opWithPayload(seq);
+ r = Util.getInvocationFuture(p.opWithPayloadAsync(seq));
}
test(!r.isSent());
- r1 = p.begin_ice_ping();
- r2 = p.begin_ice_id();
- r1.cancel();
- r2.cancel();
+ r1 = Util.getInvocationFuture(p.ice_pingAsync());
+ r2 = Util.getInvocationFuture(p.ice_idAsync());
+ r1.cancel(false);
+ r2.cancel(false);
try
{
- p.end_ice_ping(r1);
+ r1.join();
test(false);
}
- catch(Ice.InvocationCanceledException ex)
+ catch(CancellationException ex)
{
}
try
{
- p.end_ice_id(r2);
+ r2.join();
test(false);
}
- catch(Ice.InvocationCanceledException ex)
+ catch(CancellationException ex)
{
}
}
@@ -2549,32 +715,34 @@ public class AMI
testController.resumeAdapter();
}
p.ice_ping();
- test(!r1.isSent() && r1.isCompleted());
- test(!r2.isSent() && r2.isCompleted());
+ //test(!r1.isSent() && r1.isDone());
+ test(!r1.isSent());
+ test(r1.isDone());
+ test(!r2.isSent() && r2.isDone());
testController.holdAdapter();
try
{
- r1 = p.begin_op();
- r2 = p.begin_ice_id();
+ r1 = Util.getInvocationFuture(p.opAsync());
+ r2 = Util.getInvocationFuture(p.ice_idAsync());
r1.waitForSent();
r2.waitForSent();
- r1.cancel();
- r2.cancel();
+ r1.cancel(false);
+ r2.cancel(false);
try
{
- p.end_op(r1);
+ r1.join();
test(false);
}
- catch(Ice.InvocationCanceledException ex)
+ catch(CancellationException ex)
{
}
try
{
- p.end_ice_id(r2);
+ r2.join();
test(false);
}
- catch(Ice.InvocationCanceledException ex)
+ catch(CancellationException ex)
{
}
}
@@ -2604,16 +772,16 @@ public class AMI
{
done = true;
p.ice_ping();
- java.util.List<Ice.AsyncResult> results = new java.util.ArrayList<Ice.AsyncResult>();
+ java.util.List<InvocationFuture<Void>> results = new java.util.ArrayList<>();
for(int i = 0; i < maxQueue; ++i)
{
- results.add(p.begin_opWithPayload(seq));
+ results.add(Util.getInvocationFuture(p.opWithPayloadAsync(seq)));
}
- if(!p.begin_close(false).isSent())
+ if(!Util.getInvocationFuture(p.closeAsync(false)).isSent())
{
for(int i = 0; i < maxQueue; i++)
{
- Ice.AsyncResult r = p.begin_opWithPayload(seq);
+ InvocationFuture<Void> r = Util.getInvocationFuture(p.opWithPayloadAsync(seq));
results.add(r);
if(r.isSent())
{
@@ -2628,17 +796,9 @@ public class AMI
maxQueue *= 2;
done = false;
}
- for(Ice.AsyncResult q : results)
+ for(InvocationFuture<Void> q : results)
{
- q.waitForCompleted();
- try
- {
- q.throwLocalException();
- }
- catch(Ice.LocalException ex)
- {
- test(false);
- }
+ q.join();
}
}
}
diff --git a/java/test/src/main/java/test/Ice/ami/AllTests.java b/java/test/src/main/java/test/Ice/ami/AllTests.java
index c7dbc15a539..7ba6494dedf 100644
--- a/java/test/src/main/java/test/Ice/ami/AllTests.java
+++ b/java/test/src/main/java/test/Ice/ami/AllTests.java
@@ -12,15 +12,12 @@ package test.Ice.ami;
import java.io.PrintWriter;
import test.Ice.ami.Test.TestIntfPrx;
-import test.Ice.ami.Test.TestIntfPrxHelper;
import test.Ice.ami.Test.TestIntfControllerPrx;
-import test.Ice.ami.Test.TestIntfControllerPrxHelper;
import test.Util.Application;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -28,63 +25,25 @@ public class AllTests
}
}
- public static void
- allTests(Application app, boolean collocated)
+ public static void allTests(Application app, boolean collocated)
{
- Ice.Communicator communicator = app.communicator();
+ com.zeroc.Ice.Communicator communicator = app.communicator();
PrintWriter out = app.getWriter();
String sref = "test:default -p 12010";
- Ice.ObjectPrx obj = communicator.stringToProxy(sref);
+ com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(sref);
test(obj != null);
- TestIntfPrx p = TestIntfPrxHelper.uncheckedCast(obj);
+ TestIntfPrx p = TestIntfPrx.uncheckedCast(obj);
sref = "testController:default -p 12011";
obj = communicator.stringToProxy(sref);
test(obj != null);
- TestIntfControllerPrx testController = TestIntfControllerPrxHelper.uncheckedCast(obj);
+ TestIntfControllerPrx testController = TestIntfControllerPrx.uncheckedCast(obj);
- out.println("testing with new AMI mapping... ");
test.Ice.ami.AMI.run(app, communicator, collocated, p, testController);
- //
- // Use reflection to load TwowaysLambdaAMI as that is only supported with Java >= 1.8
- //
- try
- {
- Class<?> cls = IceInternal.Util.findClass("test.Ice.ami.lambda.AMI", null);
- if(cls != null)
- {
- java.lang.reflect.Method run = cls.getDeclaredMethod(
- "run",
- new Class<?>[]
- {
- test.Util.Application.class,
- Ice.Communicator.class,
- boolean.class,
- TestIntfPrx.class,
- TestIntfControllerPrx.class
- });
- out.println("testing with lambda AMI mapping... ");
- out.flush();
- run.invoke(null, app, communicator, collocated, p, testController);
- }
- }
- catch(java.lang.NoSuchMethodException ex)
- {
- throw new RuntimeException(ex);
- }
- catch(java.lang.IllegalAccessException ex)
- {
- throw new RuntimeException(ex);
- }
- catch(java.lang.reflect.InvocationTargetException ex)
- {
- throw new RuntimeException(ex);
- }
-
p.shutdown();
}
}
diff --git a/java/test/src/main/java/test/Ice/ami/Client.java b/java/test/src/main/java/test/Ice/ami/Client.java
index e08515e7d62..f0992f5bece 100644
--- a/java/test/src/main/java/test/Ice/ami/Client.java
+++ b/java/test/src/main/java/test/Ice/ami/Client.java
@@ -19,20 +19,19 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami");
- initData.properties.setProperty("Ice.Warn.AMICallback", "0");
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami");
+ r.initData.properties.setProperty("Ice.Warn.AMICallback", "0");
//
// Limit the send buffer size, this test relies on the socket
// send() blocking after sending a given amount of data.
//
- initData.properties.setProperty("Ice.TCP.SndSize", "50000");
+ r.initData.properties.setProperty("Ice.TCP.SndSize", "50000");
- return initData;
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/ami/Collocated.java b/java/test/src/main/java/test/Ice/ami/Collocated.java
index 429d4ed2dfd..950ff2e2c08 100644
--- a/java/test/src/main/java/test/Ice/ami/Collocated.java
+++ b/java/test/src/main/java/test/Ice/ami/Collocated.java
@@ -14,12 +14,12 @@ public class Collocated extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
- adapter.add(new TestI(), Ice.Util.stringToIdentity("test"));
+ adapter.add(new TestI(), com.zeroc.Ice.Util.stringToIdentity("test"));
//adapter.activate(); // Collocated test doesn't need to activate the OA
- adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController"));
+ adapter2.add(new TestControllerI(adapter), com.zeroc.Ice.Util.stringToIdentity("testController"));
//adapter2.activate(); // Collocated test doesn't need to activate the OA
AllTests.allTests(this, true);
@@ -27,16 +27,15 @@ public class Collocated extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- initData.properties.setProperty("ControllerAdapter.Endpoints", "default -p 12011");
- initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
- initData.properties.setProperty("Ice.Warn.AMICallback", "0");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ r.initData.properties.setProperty("ControllerAdapter.Endpoints", "default -p 12011");
+ r.initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
+ r.initData.properties.setProperty("Ice.Warn.AMICallback", "0");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/ami/Server.java b/java/test/src/main/java/test/Ice/ami/Server.java
index 92c745419dd..6c009fb4b0b 100644
--- a/java/test/src/main/java/test/Ice/ami/Server.java
+++ b/java/test/src/main/java/test/Ice/ami/Server.java
@@ -12,39 +12,36 @@ package test.Ice.ami;
public class Server extends test.Util.Application
{
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
- adapter.add(new TestI(), Ice.Util.stringToIdentity("test"));
+ adapter.add(new TestI(), com.zeroc.Ice.Util.stringToIdentity("test"));
adapter.activate();
- adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController"));
+ adapter2.add(new TestControllerI(adapter), com.zeroc.Ice.Util.stringToIdentity("testController"));
adapter2.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- initData.properties.setProperty("ControllerAdapter.Endpoints", "default -p 12011");
- initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ r.initData.properties.setProperty("ControllerAdapter.Endpoints", "default -p 12011");
+ r.initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
//
// Limit the recv buffer size, this test relies on the socket
// send() blocking after sending a given amount of data.
//
- initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
- return initData;
+ r.initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
+ return r;
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
Server app = new Server();
int result = app.main("Server", args);
diff --git a/java/test/src/main/java/test/Ice/ami/TestControllerI.java b/java/test/src/main/java/test/Ice/ami/TestControllerI.java
index b27b82abda4..a8f1261979f 100644
--- a/java/test/src/main/java/test/Ice/ami/TestControllerI.java
+++ b/java/test/src/main/java/test/Ice/ami/TestControllerI.java
@@ -6,31 +6,29 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package test.Ice.ami;
-import test.Ice.ami.Test._TestIntfControllerDisp;
+import test.Ice.ami.Test.TestIntfController;
-class TestControllerI extends _TestIntfControllerDisp
+class TestControllerI implements TestIntfController
{
@Override
- public void
- holdAdapter(Ice.Current current)
+ public void holdAdapter(com.zeroc.Ice.Current current)
{
_adapter.hold();
}
@Override
- public void
- resumeAdapter(Ice.Current current)
+ public void resumeAdapter(com.zeroc.Ice.Current current)
{
_adapter.activate();
}
- public
- TestControllerI(Ice.ObjectAdapter adapter)
+ public TestControllerI(com.zeroc.Ice.ObjectAdapter adapter)
{
_adapter = adapter;
}
- final private Ice.ObjectAdapter _adapter;
+ final private com.zeroc.Ice.ObjectAdapter _adapter;
}
diff --git a/java/test/src/main/java/test/Ice/ami/TestI.java b/java/test/src/main/java/test/Ice/ami/TestI.java
index b0c6df0cf4a..0153f138dd0 100644
--- a/java/test/src/main/java/test/Ice/ami/TestI.java
+++ b/java/test/src/main/java/test/Ice/ami/TestI.java
@@ -9,108 +9,102 @@
package test.Ice.ami;
-import test.Ice.ami.Test._TestIntfDisp;
+import test.Ice.ami.Test.TestIntf;
import test.Ice.ami.Test.TestIntfException;
-public class TestI extends _TestIntfDisp
+public class TestI implements TestIntf
{
TestI()
{
}
@Override
- public void
- op(Ice.Current current)
+ public void op(com.zeroc.Ice.Current current)
{
}
@Override
- public int
- opWithResult(Ice.Current current)
+ public int opWithResult(com.zeroc.Ice.Current current)
{
return 15;
}
@Override
- public void
- opWithUE(Ice.Current current)
+ public void opWithUE(com.zeroc.Ice.Current current)
throws TestIntfException
{
throw new TestIntfException();
}
@Override
- public void
- opWithPayload(byte[] seq, Ice.Current current)
+ public void opWithPayload(byte[] seq, com.zeroc.Ice.Current current)
{
}
@Override
- public synchronized void
- opBatch(Ice.Current current)
+ public synchronized void opBatch(com.zeroc.Ice.Current current)
{
++_batchCount;
notify();
}
@Override
- public synchronized int
- opBatchCount(Ice.Current current)
+ public synchronized int opBatchCount(com.zeroc.Ice.Current current)
{
return _batchCount;
}
@Override
- public boolean supportsFunctionalTests(Ice.Current current)
+ public boolean supportsFunctionalTests(com.zeroc.Ice.Current current)
{
return true;
}
@Override
- public boolean opBool(boolean b, Ice.Current current)
+ public boolean opBool(boolean b, com.zeroc.Ice.Current current)
{
return b;
}
@Override
- public byte opByte(byte b, Ice.Current current)
+ public byte opByte(byte b, com.zeroc.Ice.Current current)
{
return b;
}
@Override
- public short opShort(short s, Ice.Current current)
+ public short opShort(short s, com.zeroc.Ice.Current current)
{
return s;
}
@Override
- public int opInt(int i, Ice.Current current)
+ public int opInt(int i, com.zeroc.Ice.Current current)
{
return i;
}
@Override
- public long opLong(long l, Ice.Current current)
+ public long opLong(long l, com.zeroc.Ice.Current current)
{
return l;
}
@Override
- public float opFloat(float f, Ice.Current current)
+ public float opFloat(float f, com.zeroc.Ice.Current current)
{
return f;
}
@Override
- public double opDouble(double d, Ice.Current current)
+ public double opDouble(double d, com.zeroc.Ice.Current current)
{
return d;
}
@Override
public synchronized boolean
- waitForBatch(int count, Ice.Current current)
+ waitForBatch(int count, com.zeroc.Ice.Current current)
{
while(_batchCount < count)
{
@@ -129,14 +123,14 @@ public class TestI extends _TestIntfDisp
@Override
public void
- close(boolean force, Ice.Current current)
+ close(boolean force, com.zeroc.Ice.Current current)
{
current.con.close(force);
}
@Override
public void
- shutdown(Ice.Current current)
+ shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
diff --git a/java/test/src/main/java/test/Ice/background/Acceptor.java b/java/test/src/main/java/test/Ice/background/Acceptor.java
index c97479ec1b7..0aba000c3cd 100644
--- a/java/test/src/main/java/test/Ice/background/Acceptor.java
+++ b/java/test/src/main/java/test/Ice/background/Acceptor.java
@@ -9,71 +9,63 @@
package test.Ice.background;
-class Acceptor implements IceInternal.Acceptor
+class Acceptor implements com.zeroc.IceInternal.Acceptor
{
@Override
- public java.nio.channels.ServerSocketChannel
- fd()
+ public java.nio.channels.ServerSocketChannel fd()
{
return _acceptor.fd();
}
@Override
- public void setReadyCallback(IceInternal.ReadyCallback callback)
+ public void setReadyCallback(com.zeroc.IceInternal.ReadyCallback callback)
{
// No need to for the ready callback.
}
@Override
- public void
- close()
+ public void close()
{
_acceptor.close();
}
@Override
- public IceInternal.EndpointI
- listen()
+ public com.zeroc.IceInternal.EndpointI listen()
{
_endpoint = _endpoint.endpoint(_acceptor.listen());
return _endpoint;
}
@Override
- public IceInternal.Transceiver
- accept()
+ public com.zeroc.IceInternal.Transceiver accept()
{
return new Transceiver(_configuration, _acceptor.accept());
}
@Override
- public String
- protocol()
+ public String protocol()
{
return _acceptor.protocol();
}
@Override
- public String
- toString()
+ public String toString()
{
return _acceptor.toString();
}
@Override
- public String
- toDetailedString()
+ public String toDetailedString()
{
return _acceptor.toDetailedString();
}
- public IceInternal.Acceptor
- delegate()
+ public com.zeroc.IceInternal.Acceptor delegate()
{
return _acceptor;
}
- Acceptor(EndpointI endpoint, Configuration configuration, IceInternal.Acceptor acceptor)
+ Acceptor(EndpointI endpoint, Configuration configuration, com.zeroc.IceInternal.Acceptor acceptor)
{
_endpoint = endpoint;
_configuration = configuration;
@@ -81,6 +73,6 @@ class Acceptor implements IceInternal.Acceptor
}
private EndpointI _endpoint;
- final private IceInternal.Acceptor _acceptor;
+ final private com.zeroc.IceInternal.Acceptor _acceptor;
private Configuration _configuration;
}
diff --git a/java/test/src/main/java/test/Ice/background/AllTests.java b/java/test/src/main/java/test/Ice/background/AllTests.java
index 627b2346744..4eb1ba9fe78 100644
--- a/java/test/src/main/java/test/Ice/background/AllTests.java
+++ b/java/test/src/main/java/test/Ice/background/AllTests.java
@@ -6,16 +6,18 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package test.Ice.background;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
import java.io.PrintWriter;
+import com.zeroc.Ice.InvocationFuture;
+import com.zeroc.Ice.Util;
+
import test.Ice.background.Test.BackgroundControllerPrx;
-import test.Ice.background.Test.BackgroundControllerPrxHelper;
import test.Ice.background.Test.BackgroundPrx;
-import test.Ice.background.Test.BackgroundPrxHelper;
-import test.Ice.background.Test.Callback_Background_op;
-import test.Ice.background.Test.Callback_Background_opWithPayload;
public class AllTests
{
@@ -64,22 +66,19 @@ public class AllTests
private boolean _called;
}
- private static class OpAMICallback extends Callback_Background_op
+ private static class OpAMICallback
{
- @Override
public void response()
{
_response.called();
}
- @Override
- public void exception(Ice.LocalException ex)
+ public void exception(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
}
- @Override
public void sent(boolean ss)
{
_sent.called();
@@ -108,117 +107,17 @@ public class AllTests
private Callback _sent = new Callback();
}
- private static class OpAMICallbackEx extends Callback_Background_op
- {
- @Override
- public void response()
- {
- test(false);
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- _response.called();
- }
-
- @Override
- public void sent(boolean ss)
- {
- _sent.called();
- }
-
- public boolean exception(boolean wait)
- {
- if(wait)
- {
- _response.check();
- return true;
- }
- else
- {
- return _response.isCalled();
- }
- }
-
- private Callback _response = new Callback();
- private Callback _sent = new Callback();
- }
-
- private static class OpAMICallbackNoOp extends Callback_Background_op
- {
- @Override
- public void response()
- {
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- ex.printStackTrace();
- test(false);
- }
-
- @Override
- public void sent(boolean ss)
- {
- }
- }
-
- private static class NoResponse extends Callback_Background_opWithPayload
- {
- @Override
- public void response()
- {
- test(false);
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
- }
-
- /*
- private static class OpWithPayloadOnewayAMICallback extends AMI_Background_opWithPayload
- {
- public void
- ice_response()
- {
- test(false);
- }
-
- public void
- ice_exception(Ice.LocalException ex)
- {
- test(false);
- }
- }
-
- private static class FlushBatchRequestsCallback extends Ice.AMI_Object_ice_flushBatchRequests
- {
- public void
- ice_exception(Ice.LocalException ex)
- {
- ex.printStackTrace();
- test(false);
- }
- }
- */
-
static class OpThread extends Thread
{
OpThread(BackgroundPrx background)
{
_destroyed = false;
- _background = BackgroundPrxHelper.uncheckedCast(background.ice_oneway());
+ _background = background.ice_oneway();
start();
}
@Override
- public void
- run()
+ public void run()
{
int count = 0;
while(true)
@@ -247,14 +146,13 @@ public class AllTests
{
}
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
}
}
- public synchronized void
- _destroy() // Thread.destroy is deprecated
+ public synchronized void _destroy() // Thread.destroy is deprecated
{
_destroyed = true;
}
@@ -263,20 +161,20 @@ public class AllTests
private BackgroundPrx _background = null;
}
- public static BackgroundPrx
- allTests(Configuration configuration, Ice.Communicator communicator, PrintWriter out)
+ public static BackgroundPrx allTests(Configuration configuration, com.zeroc.Ice.Communicator communicator,
+ PrintWriter out)
{
String sref = "background:default -p 12010";
- Ice.ObjectPrx obj = communicator.stringToProxy(sref);
+ com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(sref);
test(obj != null);
- BackgroundPrx background = BackgroundPrxHelper.uncheckedCast(obj);
+ BackgroundPrx background = BackgroundPrx.uncheckedCast(obj);
sref = "backgroundController:tcp -p 12011";
obj = communicator.stringToProxy(sref);
test(obj != null);
- BackgroundControllerPrx backgroundController = BackgroundControllerPrxHelper.uncheckedCast(obj);
+ BackgroundControllerPrx backgroundController = BackgroundControllerPrx.uncheckedCast(obj);
out.print("testing connect... ");
out.flush();
@@ -309,9 +207,9 @@ public class AllTests
out.print("testing locator... ");
out.flush();
{
- Ice.LocatorPrx locator;
+ com.zeroc.Ice.LocatorPrx locator;
obj = communicator.stringToProxy("locator:default -p 12010").ice_invocationTimeout(250);
- locator = Ice.LocatorPrxHelper.uncheckedCast(obj);
+ locator = com.zeroc.Ice.LocatorPrx.uncheckedCast(obj);
obj = communicator.stringToProxy("background@Test").ice_locator(locator).ice_oneway();
backgroundController.pauseCall("findAdapterById");
@@ -320,39 +218,39 @@ public class AllTests
obj.ice_ping();
test(false);
}
- catch(Ice.TimeoutException ex)
+ catch(com.zeroc.Ice.TimeoutException ex)
{
}
backgroundController.resumeCall("findAdapterById");
obj = communicator.stringToProxy("locator:default -p 12010");
- locator = Ice.LocatorPrxHelper.uncheckedCast(obj);
+ locator = com.zeroc.Ice.LocatorPrx.uncheckedCast(obj);
obj = obj.ice_locator(locator);
obj.ice_ping();
obj = communicator.stringToProxy("background@Test").ice_locator(locator);
- BackgroundPrx bg = BackgroundPrxHelper.uncheckedCast(obj);
+ BackgroundPrx bg = BackgroundPrx.uncheckedCast(obj);
backgroundController.pauseCall("findAdapterById");
- Ice.AsyncResult r1 = bg.begin_op();
- Ice.AsyncResult r2 = bg.begin_op();
- test(!r1.isCompleted());
- test(!r2.isCompleted());
+ CompletableFuture<Void> r1 = bg.opAsync();
+ CompletableFuture<Void> r2 = bg.opAsync();
+ test(!r1.isDone());
+ test(!r2.isDone());
backgroundController.resumeCall("findAdapterById");
- bg.end_op(r1);
- bg.end_op(r2);
- test(r1.isCompleted());
- test(r2.isCompleted());
+ r1.join();
+ r2.join();
+ test(r1.isDone());
+ test(r2.isDone());
}
out.println("ok");
out.print("testing router... ");
out.flush();
{
- Ice.RouterPrx router;
+ com.zeroc.Ice.RouterPrx router;
obj = communicator.stringToProxy("router:default -p 12010").ice_invocationTimeout(250);
- router = Ice.RouterPrxHelper.uncheckedCast(obj);
+ router = com.zeroc.Ice.RouterPrx.uncheckedCast(obj);
obj = communicator.stringToProxy("background@Test").ice_router(router).ice_oneway();
backgroundController.pauseCall("getClientProxy");
@@ -361,27 +259,27 @@ public class AllTests
obj.ice_ping();
test(false);
}
- catch(Ice.TimeoutException ex)
+ catch(com.zeroc.Ice.TimeoutException ex)
{
}
backgroundController.resumeCall("getClientProxy");
obj = communicator.stringToProxy("router:default -p 12010");
- router = Ice.RouterPrxHelper.uncheckedCast(obj);
+ router = com.zeroc.Ice.RouterPrx.uncheckedCast(obj);
obj = communicator.stringToProxy("background@Test").ice_router(router);
- BackgroundPrx bg = BackgroundPrxHelper.uncheckedCast(obj);
+ BackgroundPrx bg = BackgroundPrx.uncheckedCast(obj);
test(bg.ice_getRouter() != null);
backgroundController.pauseCall("getClientProxy");
- Ice.AsyncResult r1 = bg.begin_op();
- Ice.AsyncResult r2 = bg.begin_op();
- test(!r1.isCompleted());
- test(!r2.isCompleted());
+ CompletableFuture<Void> r1 = bg.opAsync();
+ CompletableFuture<Void> r2 = bg.opAsync();
+ test(!r1.isDone());
+ test(!r2.isDone());
backgroundController.resumeCall("getClientProxy");
- bg.end_op(r1);
- bg.end_op(r2);
- test(r1.isCompleted());
- test(r2.isCompleted());
+ r1.join();
+ r2.join();
+ test(r1.isDone());
+ test(r2.isDone());
}
out.println("ok");
@@ -394,15 +292,14 @@ public class AllTests
configuration.buffered(true);
backgroundController.buffered(true);
- background.begin_op();
+ background.opAsync();
background.ice_getCachedConnection().close(true);
- background.begin_op();
+ background.opAsync();
- OpAMICallbackNoOp cb = new OpAMICallbackNoOp();
- java.util.List<Ice.AsyncResult> results = new java.util.ArrayList<Ice.AsyncResult>();
+ java.util.List<CompletableFuture<Void>> results = new java.util.ArrayList<>();
for(int i = 0; i < 10000; ++i)
{
- Ice.AsyncResult r = background.begin_op(cb);
+ CompletableFuture<Void> r = background.opAsync();
results.add(r);
if(i % 50 == 0)
{
@@ -411,12 +308,12 @@ public class AllTests
}
if(i % 100 == 0)
{
- r.waitForCompleted();
+ r.join();
}
}
- for(Ice.AsyncResult r : results)
+ for(CompletableFuture<Void> r : results)
{
- r.waitForCompleted();
+ r.join();
}
out.println("ok");
@@ -425,14 +322,13 @@ public class AllTests
return background;
}
- private static void
- connectTests(Configuration configuration, BackgroundPrx background)
+ private static void connectTests(Configuration configuration, BackgroundPrx background)
{
try
{
background.op();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -442,40 +338,36 @@ public class AllTests
{
if(i == 0 || i == 2)
{
- configuration.connectorsException(new Ice.DNSException());
+ configuration.connectorsException(new com.zeroc.Ice.DNSException());
}
else
{
- configuration.connectException(new Ice.SocketException());
+ configuration.connectException(new com.zeroc.Ice.SocketException());
}
- BackgroundPrx prx = (i == 1 || i == 3) ? background : (BackgroundPrx)background.ice_oneway();
+ BackgroundPrx prx = (i == 1 || i == 3) ? background : background.ice_oneway();
try
{
prx.op();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
- Ice.AsyncResult r = prx.begin_op();
- test(!r.sentSynchronously());
+ CompletableFuture<Void> r = prx.opAsync();
+ InvocationFuture<Void> f = Util.getInvocationFuture(r);
+ test(!f.sentSynchronously());
try
{
- prx.end_op(r);
+ r.join();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(CompletionException ex)
{
+ test(ex.getCause() instanceof com.zeroc.Ice.LocalException);
}
- test(r.isCompleted());
-
- OpAMICallbackEx cbEx = new OpAMICallbackEx();
- r = prx.begin_op(cbEx);
- test(!r.sentSynchronously());
- cbEx.exception(true);
- test(r.isCompleted());
+ test(r.isDone());
if(i == 0 || i == 2)
{
@@ -496,12 +388,12 @@ public class AllTests
{
background.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
- configuration.connectException(new Ice.SocketException());
+ configuration.connectException(new com.zeroc.Ice.SocketException());
background.ice_getCachedConnection().close(true);
try
{
@@ -515,7 +407,7 @@ public class AllTests
{
background.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
}
@@ -533,14 +425,14 @@ public class AllTests
}
}
- private static void
- initializeTests(Configuration configuration, BackgroundPrx background, BackgroundControllerPrx ctl)
+ private static void initializeTests(Configuration configuration, BackgroundPrx background,
+ BackgroundControllerPrx ctl)
{
try
{
background.op();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
@@ -551,41 +443,37 @@ public class AllTests
{
if(i == 0 || i == 2)
{
- configuration.initializeException(new Ice.SocketException());
+ configuration.initializeException(new com.zeroc.Ice.SocketException());
}
else
{
- configuration.initializeSocketStatus(IceInternal.SocketOperation.Write);
- configuration.initializeException(new Ice.SocketException());
+ configuration.initializeSocketStatus(com.zeroc.IceInternal.SocketOperation.Write);
+ configuration.initializeException(new com.zeroc.Ice.SocketException());
}
- BackgroundPrx prx = (i == 1 || i == 3) ? background : (BackgroundPrx)background.ice_oneway();
+ BackgroundPrx prx = (i == 1 || i == 3) ? background : background.ice_oneway();
try
{
prx.op();
test(false);
}
- catch(Ice.SocketException ex)
+ catch(com.zeroc.Ice.SocketException ex)
{
}
- Ice.AsyncResult r = prx.begin_op();
- test(!r.sentSynchronously());
+ CompletableFuture<Void> r = prx.opAsync();
+ InvocationFuture<Void> f = Util.getInvocationFuture(r);
+ test(!f.sentSynchronously());
try
{
- prx.end_op(r);
+ r.join();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(CompletionException ex)
{
+ test(ex.getCause() instanceof com.zeroc.Ice.LocalException);
}
- test(r.isCompleted());
-
- OpAMICallbackEx cbEx = new OpAMICallbackEx();
- r = prx.begin_op(cbEx);
- test(!r.sentSynchronously());
- cbEx.exception(true);
- test(r.isCompleted());
+ test(r.isDone());
if(i == 0 || i == 2)
{
@@ -593,18 +481,18 @@ public class AllTests
}
else
{
- configuration.initializeSocketStatus(IceInternal.SocketOperation.None);
+ configuration.initializeSocketStatus(com.zeroc.IceInternal.SocketOperation.None);
configuration.initializeException(null);
}
}
try
{
- configuration.initializeSocketStatus(IceInternal.SocketOperation.Connect);
+ configuration.initializeSocketStatus(com.zeroc.IceInternal.SocketOperation.Connect);
background.op();
- configuration.initializeSocketStatus(IceInternal.SocketOperation.None);
+ configuration.initializeSocketStatus(com.zeroc.IceInternal.SocketOperation.None);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -612,11 +500,11 @@ public class AllTests
try
{
- configuration.initializeSocketStatus(IceInternal.SocketOperation.Write);
+ configuration.initializeSocketStatus(com.zeroc.IceInternal.SocketOperation.Write);
background.op();
- configuration.initializeSocketStatus(IceInternal.SocketOperation.None);
+ configuration.initializeSocketStatus(com.zeroc.IceInternal.SocketOperation.None);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -624,15 +512,15 @@ public class AllTests
try
{
- configuration.initializeSocketStatus(IceInternal.SocketOperation.Write);
- configuration.initializeException(new Ice.SocketException());
+ configuration.initializeSocketStatus(com.zeroc.IceInternal.SocketOperation.Write);
+ configuration.initializeException(new com.zeroc.Ice.SocketException());
background.op();
test(false);
}
- catch(Ice.SocketException ex)
+ catch(com.zeroc.Ice.SocketException ex)
{
configuration.initializeException(null);
- configuration.initializeSocketStatus(IceInternal.SocketOperation.None);
+ configuration.initializeSocketStatus(com.zeroc.IceInternal.SocketOperation.None);
}
//
@@ -645,22 +533,22 @@ public class AllTests
background.op();
test(false);
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
ctl.initializeException(false);
}
- catch(Ice.SecurityException ex)
+ catch(com.zeroc.Ice.SecurityException ex)
{
ctl.initializeException(false);
}
try
{
- ctl.initializeSocketStatus(IceInternal.SocketOperation.Write);
+ ctl.initializeSocketStatus(com.zeroc.IceInternal.SocketOperation.Write);
background.op();
- ctl.initializeSocketStatus(IceInternal.SocketOperation.None);
+ ctl.initializeSocketStatus(com.zeroc.IceInternal.SocketOperation.None);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -668,20 +556,20 @@ public class AllTests
try
{
- ctl.initializeSocketStatus(IceInternal.SocketOperation.Write);
+ ctl.initializeSocketStatus(com.zeroc.IceInternal.SocketOperation.Write);
ctl.initializeException(true);
background.op();
test(false);
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
ctl.initializeException(false);
- ctl.initializeSocketStatus(IceInternal.SocketOperation.None);
+ ctl.initializeSocketStatus(com.zeroc.IceInternal.SocketOperation.None);
}
- catch(Ice.SecurityException ex)
+ catch(com.zeroc.Ice.SecurityException ex)
{
ctl.initializeException(false);
- ctl.initializeSocketStatus(IceInternal.SocketOperation.None);
+ ctl.initializeSocketStatus(com.zeroc.IceInternal.SocketOperation.None);
}
OpThread thread1 = new OpThread(background);
@@ -693,12 +581,12 @@ public class AllTests
{
background.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
- configuration.initializeException(new Ice.SocketException());
+ configuration.initializeException(new com.zeroc.Ice.SocketException());
background.ice_getCachedConnection().close(true);
try
{
@@ -712,32 +600,32 @@ public class AllTests
{
background.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
try
{
background.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
- configuration.initializeSocketStatus(IceInternal.SocketOperation.Write);
+ configuration.initializeSocketStatus(com.zeroc.IceInternal.SocketOperation.Write);
background.ice_getCachedConnection().close(true);
try
{
background.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false); // Something's wrong with retries.
}
- configuration.initializeSocketStatus(IceInternal.SocketOperation.None);
+ configuration.initializeSocketStatus(com.zeroc.IceInternal.SocketOperation.None);
ctl.initializeException(true);
background.ice_getCachedConnection().close(true);
@@ -753,26 +641,26 @@ public class AllTests
{
background.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
try
{
background.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
try
{
- ctl.initializeSocketStatus(IceInternal.SocketOperation.Write);
+ ctl.initializeSocketStatus(com.zeroc.IceInternal.SocketOperation.Write);
background.ice_getCachedConnection().close(true);
background.op();
- ctl.initializeSocketStatus(IceInternal.SocketOperation.None);
+ ctl.initializeSocketStatus(com.zeroc.IceInternal.SocketOperation.None);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
@@ -792,14 +680,14 @@ public class AllTests
}
}
- private static void
- validationTests(Configuration configuration, BackgroundPrx background, BackgroundControllerPrx ctl)
+ private static void validationTests(Configuration configuration, BackgroundPrx background,
+ BackgroundControllerPrx ctl)
{
try
{
background.op();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -808,30 +696,32 @@ public class AllTests
try
{
// Get the read() of connection validation to throw right away.
- configuration.readException(new Ice.SocketException());
+ configuration.readException(new com.zeroc.Ice.SocketException());
background.op();
test(false);
}
- catch(Ice.SocketException ex)
+ catch(com.zeroc.Ice.SocketException ex)
{
configuration.readException(null);
}
for(int i = 0; i < 2; i++)
{
- configuration.readException(new Ice.SocketException());
- BackgroundPrx prx = i == 0 ? background : (BackgroundPrx)background.ice_oneway();
- Ice.AsyncResult r = prx.begin_op();
- test(!r.sentSynchronously());
+ configuration.readException(new com.zeroc.Ice.SocketException());
+ BackgroundPrx prx = i == 0 ? background : background.ice_oneway();
+ CompletableFuture<Void> r = prx.opAsync();
+ InvocationFuture<Void> f = Util.getInvocationFuture(r);
+ test(!f.sentSynchronously());
try
{
- prx.end_op(r);
+ r.join();
test(false);
}
- catch(Ice.SocketException ex)
+ catch(CompletionException ex)
{
+ test(ex.getCause() instanceof com.zeroc.Ice.SocketException);
}
- test(r.isCompleted());
+ test(r.isDone());
configuration.readException(null);
}
@@ -844,7 +734,7 @@ public class AllTests
background.op();
configuration.readReady(true);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
@@ -855,11 +745,11 @@ public class AllTests
{
// Get the read() of the connection validation to return "would block" and then throw.
configuration.readReady(false);
- configuration.readException(new Ice.SocketException());
+ configuration.readException(new com.zeroc.Ice.SocketException());
background.op();
test(false);
}
- catch(Ice.SocketException ex)
+ catch(com.zeroc.Ice.SocketException ex)
{
configuration.readException(null);
configuration.readReady(true);
@@ -868,32 +758,36 @@ public class AllTests
for(int i = 0; i < 2; i++)
{
configuration.readReady(false);
- configuration.readException(new Ice.SocketException());
- Ice.AsyncResult r = background.begin_op();
- test(!r.sentSynchronously());
+ configuration.readException(new com.zeroc.Ice.SocketException());
+ CompletableFuture<Void> r = background.opAsync();
+ InvocationFuture<Void> f = Util.getInvocationFuture(r);
+ test(!f.sentSynchronously());
try
{
- background.end_op(r);
+ r.join();
test(false);
}
- catch(Ice.SocketException ex)
+ catch(CompletionException ex)
{
+ test(ex.getCause() instanceof com.zeroc.Ice.SocketException);
}
- test(r.isCompleted());
+ test(r.isDone());
configuration.readException(null);
configuration.readReady(true);
}
}
ctl.holdAdapter(); // Hold to block in connection validation
- Ice.AsyncResult r = background.begin_op();
- Ice.AsyncResult r2 = background.begin_op();
- test(!r.sentSynchronously() && !r2.sentSynchronously());
- test(!r.isCompleted() && !r2.isCompleted());
+ CompletableFuture<Void> r = background.opAsync();
+ CompletableFuture<Void> r2 = background.opAsync();
+ InvocationFuture<Void> f = Util.getInvocationFuture(r);
+ InvocationFuture<Void> f2 = Util.getInvocationFuture(r2);
+ test(!f.sentSynchronously() && !f2.sentSynchronously());
+ test(!r.isDone() && !r2.isDone());
ctl.resumeAdapter();
- background.end_op(r);
- background.end_op(r2);
- test(r.isCompleted() && r2.isCompleted());
+ r.join();
+ r2.join();
+ test(r.isDone() && r2.isDone());
try
{
@@ -902,7 +796,7 @@ public class AllTests
background.op();
test(false);
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
ctl.writeException(false);
}
@@ -914,7 +808,7 @@ public class AllTests
background.op();
ctl.writeReady(true);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
@@ -929,7 +823,7 @@ public class AllTests
background.op();
test(false);
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
ctl.writeException(false);
ctl.writeReady(true);
@@ -937,7 +831,7 @@ public class AllTests
byte[] seq = new byte[512 * 1024];
- BackgroundPrx backgroundBatchOneway = BackgroundPrxHelper.uncheckedCast(background.ice_batchOneway());
+ BackgroundPrx backgroundBatchOneway = background.ice_batchOneway();
//
// First send small requests to test without auto-flushing.
@@ -972,7 +866,7 @@ public class AllTests
backgroundBatchOneway.op();
backgroundBatchOneway.op();
ctl.resumeAdapter();
- backgroundBatchOneway.begin_ice_flushBatchRequests();
+ backgroundBatchOneway.ice_flushBatchRequestsAsync();
backgroundBatchOneway.ice_getConnection().close(false);
ctl.holdAdapter();
@@ -981,19 +875,19 @@ public class AllTests
backgroundBatchOneway.opWithPayload(seq);
backgroundBatchOneway.opWithPayload(seq);
ctl.resumeAdapter();
- r = backgroundBatchOneway.begin_ice_flushBatchRequests();
- backgroundBatchOneway.end_ice_flushBatchRequests(r);
+ r = backgroundBatchOneway.ice_flushBatchRequestsAsync();
+ r.join();
backgroundBatchOneway.ice_getConnection().close(false);
}
- private static void
- readWriteTests(Configuration configuration, BackgroundPrx background, BackgroundControllerPrx ctl)
+ private static void readWriteTests(Configuration configuration, BackgroundPrx background,
+ BackgroundControllerPrx ctl)
{
try
{
background.op();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
@@ -1001,61 +895,64 @@ public class AllTests
for(int i = 0; i < 2; i++)
{
- BackgroundPrx prx = i == 0 ? background : (BackgroundPrx)background.ice_oneway();
+ BackgroundPrx prx = i == 0 ? background : background.ice_oneway();
try
{
background.ice_ping();
- configuration.writeException(new Ice.SocketException());
+ configuration.writeException(new com.zeroc.Ice.SocketException());
prx.op();
test(false);
}
- catch(Ice.SocketException ex)
+ catch(com.zeroc.Ice.SocketException ex)
{
configuration.writeException(null);
}
background.ice_ping();
- configuration.writeException(new Ice.SocketException());
- Ice.AsyncResult r = prx.begin_op();
- test(!r.sentSynchronously());
+ configuration.writeException(new com.zeroc.Ice.SocketException());
+ CompletableFuture<Void> r = prx.opAsync();
+ InvocationFuture<Void> f = Util.getInvocationFuture(r);
+ test(!f.sentSynchronously());
try
{
- prx.end_op(r);
+ r.join();
test(false);
}
- catch(Ice.SocketException ex)
+ catch(CompletionException ex)
{
+ test(ex.getCause() instanceof com.zeroc.Ice.SocketException);
}
- test(r.isCompleted());
+ test(r.isDone());
configuration.writeException(null);
}
try
{
background.ice_ping();
- configuration.readException(new Ice.SocketException());
+ configuration.readException(new com.zeroc.Ice.SocketException());
background.op();
test(false);
}
- catch(Ice.SocketException ex)
+ catch(com.zeroc.Ice.SocketException ex)
{
configuration.readException(null);
}
background.ice_ping();
configuration.readReady(false); // Required in C# to make sure beginRead() doesn't throw too soon.
- configuration.readException(new Ice.SocketException());
- Ice.AsyncResult r = background.begin_op();
+ configuration.readException(new com.zeroc.Ice.SocketException());
+ CompletableFuture<Void> r = background.opAsync();
try
{
- background.end_op(r);
+ r.join();
test(false);
}
- catch(Ice.SocketException ex)
+ catch(CompletionException ex)
{
+ test(ex.getCause() instanceof com.zeroc.Ice.SocketException);
}
- test(r.isCompleted());
+ test(r.isDone());
configuration.readException(null);
configuration.readReady(true);
@@ -1066,7 +963,7 @@ public class AllTests
background.op();
configuration.writeReady(true);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -1078,7 +975,7 @@ public class AllTests
background.op();
configuration.readReady(true);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -1087,11 +984,11 @@ public class AllTests
{
background.ice_ping();
configuration.writeReady(false);
- configuration.writeException(new Ice.SocketException());
+ configuration.writeException(new com.zeroc.Ice.SocketException());
background.op();
test(false);
}
- catch(Ice.SocketException ex)
+ catch(com.zeroc.Ice.SocketException ex)
{
configuration.writeReady(true);
configuration.writeException(null);
@@ -1099,22 +996,24 @@ public class AllTests
for(int i = 0; i < 2; ++i)
{
- BackgroundPrx prx = i == 0 ? background : (BackgroundPrx)background.ice_oneway();
+ BackgroundPrx prx = i == 0 ? background : background.ice_oneway();
background.ice_ping();
configuration.writeReady(false);
- configuration.writeException(new Ice.SocketException());
- r = prx.begin_op();
- test(!r.sentSynchronously());
+ configuration.writeException(new com.zeroc.Ice.SocketException());
+ r = prx.opAsync();
+ InvocationFuture<Void> f = Util.getInvocationFuture(r);
+ test(!f.sentSynchronously());
try
{
- prx.end_op(r);
+ r.join();
test(false);
}
- catch(Ice.SocketException ex)
+ catch(CompletionException ex)
{
+ test(ex.getCause() instanceof com.zeroc.Ice.SocketException);
}
- test(r.isCompleted());
+ test(r.isDone());
configuration.writeReady(true);
configuration.writeException(null);
}
@@ -1123,11 +1022,11 @@ public class AllTests
{
background.ice_ping();
configuration.readReady(false);
- configuration.readException(new Ice.SocketException());
+ configuration.readException(new com.zeroc.Ice.SocketException());
background.op();
test(false);
}
- catch(Ice.SocketException ex)
+ catch(com.zeroc.Ice.SocketException ex)
{
configuration.readException(null);
configuration.readReady(true);
@@ -1136,17 +1035,18 @@ public class AllTests
{
background.ice_ping();
configuration.readReady(false);
- configuration.readException(new Ice.SocketException());
- r = background.begin_op();
+ configuration.readException(new com.zeroc.Ice.SocketException());
+ r = background.opAsync();
try
{
- background.end_op(r);
+ r.join();
test(false);
}
- catch(Ice.SocketException ex)
+ catch(CompletionException ex)
{
+ test(ex.getCause() instanceof com.zeroc.Ice.SocketException);
}
- test(r.isCompleted());
+ test(r.isDone());
configuration.readReady(true);
configuration.readException(null);
}
@@ -1155,19 +1055,21 @@ public class AllTests
background.ice_ping();
configuration.readReady(false);
configuration.writeReady(false);
- configuration.readException(new Ice.SocketException());
- r = background.begin_op();
+ configuration.readException(new com.zeroc.Ice.SocketException());
+ r = background.opAsync();
+ InvocationFuture<Void> f = Util.getInvocationFuture(r);
// The read exception might propagate before the message send is seen as completed on IOCP.
- r.waitForSent();
+ f.waitForSent();
try
{
- background.end_op(r);
+ r.join();
test(false);
}
- catch(Ice.SocketException ex)
+ catch(CompletionException ex)
{
+ test(ex.getCause() instanceof com.zeroc.Ice.SocketException);
}
- test(r.isCompleted());
+ test(r.isDone());
configuration.writeReady(true);
configuration.readReady(true);
configuration.readException(null);
@@ -1175,7 +1077,7 @@ public class AllTests
background.ice_ping(); // Establish the connection
- BackgroundPrx backgroundOneway = BackgroundPrxHelper.uncheckedCast(background.ice_oneway());
+ BackgroundPrx backgroundOneway = background.ice_oneway();
test(backgroundOneway.ice_getConnection() == background.ice_getConnection());
ctl.holdAdapter(); // Hold to block in request send.
@@ -1184,30 +1086,75 @@ public class AllTests
new java.util.Random().nextBytes(seq); // Make sure the request doesn't compress too well.
// Fill up the receive and send buffers
- NoResponse noResponse = new NoResponse();
for(int i = 0; i < 200; ++i) // 2MB
{
- backgroundOneway.begin_opWithPayload(seq, noResponse);
+ backgroundOneway.opWithPayloadAsync(seq).whenComplete((result, ex) -> test(false));
}
OpAMICallback cb = new OpAMICallback();
- Ice.AsyncResult r1 = background.begin_op(cb);
- test(!r1.sentSynchronously() && !r1.isSent());
+ CompletableFuture<Void> r1 = background.opAsync();
+ r1.whenComplete((result, ex) ->
+ {
+ if(ex != null)
+ {
+ cb.exception((com.zeroc.Ice.LocalException)ex);
+ }
+ else
+ {
+ cb.response();
+ }
+ });
+ InvocationFuture<Void> f1 = Util.getInvocationFuture(r1);
+ test(!f1.sentSynchronously() && !f1.isSent());
+ f1.whenSent((sentSynchronously, ex) ->
+ {
+ if(ex != null)
+ {
+ cb.exception((com.zeroc.Ice.LocalException)ex);
+ }
+ else
+ {
+ cb.sent(sentSynchronously);
+ }
+ });
OpAMICallback cb2 = new OpAMICallback();
- Ice.AsyncResult r2 = background.begin_op(cb2);
- test(!r2.sentSynchronously() && !r2.isSent());
+ CompletableFuture<Void> r2 = background.opAsync();
+ r2.whenComplete((result, ex) ->
+ {
+ if(ex != null)
+ {
+ cb2.exception((com.zeroc.Ice.LocalException)ex);
+ }
+ else
+ {
+ cb2.response();
+ }
+ });
+ InvocationFuture<Void> f2 = Util.getInvocationFuture(r2);
+ test(!f2.sentSynchronously() && !f2.isSent());
+ f2.whenSent((sentSynchronously, ex) ->
+ {
+ if(ex != null)
+ {
+ cb2.exception((com.zeroc.Ice.LocalException)ex);
+ }
+ else
+ {
+ cb2.sent(sentSynchronously);
+ }
+ });
- test(!backgroundOneway.begin_opWithPayload(seq, noResponse).sentSynchronously());
- test(!backgroundOneway.begin_opWithPayload(seq, noResponse).sentSynchronously());
+ test(!Util.getInvocationFuture(backgroundOneway.opWithPayloadAsync(seq)).sentSynchronously());
+ test(!Util.getInvocationFuture(backgroundOneway.opWithPayloadAsync(seq)).sentSynchronously());
test(!cb.response(false));
test(!cb2.response(false));
ctl.resumeAdapter();
cb.responseAndSent();
cb2.responseAndSent();
- test(r1.isSent() && r1.isCompleted());
- test(r2.isSent() && r2.isCompleted());
+ test(f1.isSent() && r1.isDone());
+ test(f2.isSent() && r2.isDone());
try
{
@@ -1216,7 +1163,7 @@ public class AllTests
background.op();
test(false);
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
ctl.writeException(false);
}
@@ -1228,7 +1175,7 @@ public class AllTests
background.op();
test(false);
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
ctl.readException(false);
}
@@ -1240,7 +1187,7 @@ public class AllTests
background.op();
ctl.writeReady(true);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -1252,7 +1199,7 @@ public class AllTests
background.op();
ctl.readReady(true);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -1265,7 +1212,7 @@ public class AllTests
background.op();
test(false);
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
ctl.writeException(false);
ctl.writeReady(true);
@@ -1279,7 +1226,7 @@ public class AllTests
background.op();
test(false);
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
ctl.readException(false);
ctl.readReady(true);
@@ -1294,7 +1241,7 @@ public class AllTests
{
background.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -1306,12 +1253,12 @@ public class AllTests
catch(java.lang.InterruptedException ex)
{
}
- configuration.writeException(new Ice.SocketException());
+ configuration.writeException(new com.zeroc.Ice.SocketException());
try
{
background.op();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
configuration.writeException(null);
diff --git a/java/test/src/main/java/test/Ice/background/BackgroundControllerI.java b/java/test/src/main/java/test/Ice/background/BackgroundControllerI.java
index 1724bbe77b9..070c46d8cb3 100644
--- a/java/test/src/main/java/test/Ice/background/BackgroundControllerI.java
+++ b/java/test/src/main/java/test/Ice/background/BackgroundControllerI.java
@@ -6,29 +6,27 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package test.Ice.background;
-import test.Ice.background.Test._BackgroundControllerDisp;
+import test.Ice.background.Test.BackgroundController;
-class BackgroundControllerI extends _BackgroundControllerDisp
+class BackgroundControllerI implements BackgroundController
{
@Override
- synchronized public void
- pauseCall(String opName, Ice.Current current)
+ synchronized public void pauseCall(String opName, com.zeroc.Ice.Current current)
{
_pausedCalls.add(opName);
}
@Override
- synchronized public void
- resumeCall(String opName, Ice.Current current)
+ synchronized public void resumeCall(String opName, com.zeroc.Ice.Current current)
{
_pausedCalls.remove(opName);
notifyAll();
}
- synchronized public void
- checkCallPause(Ice.Current current)
+ synchronized public void checkCallPause(com.zeroc.Ice.Current current)
{
while(_pausedCalls.contains(current.operation))
{
@@ -44,76 +42,66 @@ class BackgroundControllerI extends _BackgroundControllerDisp
}
@Override
- public void
- holdAdapter(Ice.Current current)
+ public void holdAdapter(com.zeroc.Ice.Current current)
{
_adapter.hold();
}
@Override
- public void
- resumeAdapter(Ice.Current current)
+ public void resumeAdapter(com.zeroc.Ice.Current current)
{
_adapter.activate();
}
@Override
- public void
- initializeSocketStatus(int status, Ice.Current current)
+ public void initializeSocketStatus(int status, com.zeroc.Ice.Current current)
{
_configuration.initializeSocketStatus(status);
}
@Override
- public void
- initializeException(boolean enable, Ice.Current current)
+ public void initializeException(boolean enable, com.zeroc.Ice.Current current)
{
- _configuration.initializeException(enable ? new Ice.SocketException() : null);
+ _configuration.initializeException(enable ? new com.zeroc.Ice.SocketException() : null);
}
@Override
- public void
- readReady(boolean enable, Ice.Current current)
+ public void readReady(boolean enable, com.zeroc.Ice.Current current)
{
_configuration.readReady(enable);
}
@Override
- public void
- readException(boolean enable, Ice.Current current)
+ public void readException(boolean enable, com.zeroc.Ice.Current current)
{
- _configuration.readException(enable ? new Ice.SocketException() : null);
+ _configuration.readException(enable ? new com.zeroc.Ice.SocketException() : null);
}
@Override
- public void
- writeReady(boolean enable, Ice.Current current)
+ public void writeReady(boolean enable, com.zeroc.Ice.Current current)
{
_configuration.writeReady(enable);
}
@Override
- public void
- writeException(boolean enable, Ice.Current current)
+ public void writeException(boolean enable, com.zeroc.Ice.Current current)
{
- _configuration.writeException(enable ? new Ice.SocketException() : null);
+ _configuration.writeException(enable ? new com.zeroc.Ice.SocketException() : null);
}
@Override
- public void
- buffered(boolean enable, Ice.Current current)
+ public void buffered(boolean enable, com.zeroc.Ice.Current current)
{
_configuration.buffered(enable);
}
- public
- BackgroundControllerI(Configuration configuration, Ice.ObjectAdapter adapter)
+ public BackgroundControllerI(Configuration configuration, com.zeroc.Ice.ObjectAdapter adapter)
{
_adapter = adapter;
_configuration = configuration;
}
- final private Ice.ObjectAdapter _adapter;
- final private java.util.Set<String> _pausedCalls = new java.util.HashSet<String>();
+ final private com.zeroc.Ice.ObjectAdapter _adapter;
+ final private java.util.Set<String> _pausedCalls = new java.util.HashSet<>();
final private Configuration _configuration;
}
diff --git a/java/test/src/main/java/test/Ice/background/BackgroundI.java b/java/test/src/main/java/test/Ice/background/BackgroundI.java
index 411a04c4a61..a2a980a16c6 100644
--- a/java/test/src/main/java/test/Ice/background/BackgroundI.java
+++ b/java/test/src/main/java/test/Ice/background/BackgroundI.java
@@ -6,29 +6,27 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package test.Ice.background;
-import test.Ice.background.Test._BackgroundDisp;
+import test.Ice.background.Test.Background;
-class BackgroundI extends _BackgroundDisp
+class BackgroundI implements Background
{
@Override
- public void
- op(Ice.Current current)
+ public void op(com.zeroc.Ice.Current current)
{
_controller.checkCallPause(current);
}
@Override
- public void
- opWithPayload(byte[] seq, Ice.Current current)
+ public void opWithPayload(byte[] seq, com.zeroc.Ice.Current current)
{
_controller.checkCallPause(current);
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
diff --git a/java/test/src/main/java/test/Ice/background/Client.java b/java/test/src/main/java/test/Ice/background/Client.java
index 2a4dde11aa5..6f01077c2be 100644
--- a/java/test/src/main/java/test/Ice/background/Client.java
+++ b/java/test/src/main/java/test/Ice/background/Client.java
@@ -6,6 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package test.Ice.background;
import test.Ice.background.PluginFactory.PluginI;
@@ -14,8 +15,7 @@ import test.Ice.background.Test.BackgroundPrx;
public class Client extends test.Util.Application
{
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
Configuration configuration = new Configuration();
PluginI plugin = (PluginI)communicator().getPluginManager().getPlugin("Test");
@@ -26,44 +26,42 @@ public class Client extends test.Util.Application
background.shutdown();
return 0;
}
-
+
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
+ GetInitDataResult r = super.getInitData(args);
// For this test, we want to disable retries.
//
- initData.properties.setProperty("Ice.RetryIntervals", "-1");
+ r.initData.properties.setProperty("Ice.RetryIntervals", "-1");
//
// This test kills connections, so we don't want warnings.
//
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("Ice.MessageSizeMax", "50000");
+ r.initData.properties.setProperty("Ice.Warn.Connections", "0");
+ r.initData.properties.setProperty("Ice.MessageSizeMax", "50000");
// This test relies on filling the TCP send/recv buffer, so
// we rely on a fixed value for these buffers.
- initData.properties.setProperty("Ice.TCP.SndSize", "50000");
+ r.initData.properties.setProperty("Ice.TCP.SndSize", "50000");
//
// Setup the test transport plug-in.
//
- initData.properties.setProperty("Ice.Plugin.Test", "test.Ice.background.PluginFactory");
- String defaultProtocol = initData.properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp");
- initData.properties.setProperty("Ice.Default.Protocol", "test-" + defaultProtocol);
-
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.background");
-
+ r.initData.properties.setProperty("Ice.Plugin.Test", "test.Ice.background.PluginFactory");
+ String defaultProtocol = r.initData.properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp");
+ r.initData.properties.setProperty("Ice.Default.Protocol", "test-" + defaultProtocol);
+
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.background");
+
// Don't initialize the plugin until I've set the configuration.
- initData.properties.setProperty("Ice.InitPlugins", "0");
+ r.initData.properties.setProperty("Ice.InitPlugins", "0");
- return initData;
+ return r;
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
Client app = new Client();
int result = app.main("Client", args);
diff --git a/java/test/src/main/java/test/Ice/background/Collocated.java b/java/test/src/main/java/test/Ice/background/Collocated.java
index 6e4b5774ac9..53d1312a999 100644
--- a/java/test/src/main/java/test/Ice/background/Collocated.java
+++ b/java/test/src/main/java/test/Ice/background/Collocated.java
@@ -23,8 +23,7 @@ public class Collocated extends test.Util.Application
}
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
final Client client = new Client();
client.setClassLoader(getClassLoader());
@@ -60,7 +59,9 @@ public class Collocated extends test.Util.Application
{
String[] args =
{
- "--Ice.NullHandleAbort=1", "--Ice.Warn.Connections=1", "--Ice.Default.Host=127.0.0.1"
+ "--Ice.NullHandleAbort=1",
+ "--Ice.Warn.Connections=1",
+ "--Ice.Default.Host=127.0.0.1"
};
client.main("Client", args);
}
diff --git a/java/test/src/main/java/test/Ice/background/Configuration.java b/java/test/src/main/java/test/Ice/background/Configuration.java
index fe8bc145bb9..d878832c38c 100644
--- a/java/test/src/main/java/test/Ice/background/Configuration.java
+++ b/java/test/src/main/java/test/Ice/background/Configuration.java
@@ -11,14 +11,12 @@ package test.Ice.background;
public final class Configuration
{
- public synchronized void
- connectorsException(Ice.LocalException ex)
+ public synchronized void connectorsException(com.zeroc.Ice.LocalException ex)
{
_connectorsException = ex;
}
- public synchronized void
- checkConnectorsException()
+ public synchronized void checkConnectorsException()
{
if(_connectorsException != null)
{
@@ -26,14 +24,12 @@ public final class Configuration
}
}
- public synchronized void
- connectException(Ice.LocalException ex)
+ public synchronized void connectException(com.zeroc.Ice.LocalException ex)
{
_connectException = ex;
}
- public synchronized void
- checkConnectException()
+ public synchronized void checkConnectException()
{
if(_connectException != null)
{
@@ -41,10 +37,9 @@ public final class Configuration
}
}
- public synchronized void
- initializeSocketStatus(int status)
+ public synchronized void initializeSocketStatus(int status)
{
- if(status == IceInternal.SocketOperation.None)
+ if(status == com.zeroc.IceInternal.SocketOperation.None)
{
_initializeResetCount = 0;
return;
@@ -53,25 +48,22 @@ public final class Configuration
_initializeSocketStatus = status;
}
- public synchronized void
- initializeException(Ice.LocalException ex)
+ public synchronized void initializeException(com.zeroc.Ice.LocalException ex)
{
_initializeException = ex;
}
-
- public synchronized int
- initializeSocketStatus()
+
+ public synchronized int initializeSocketStatus()
{
if(_initializeResetCount == 0)
{
- return IceInternal.SocketOperation.None;
+ return com.zeroc.IceInternal.SocketOperation.None;
}
--_initializeResetCount;
return _initializeSocketStatus;
}
- public synchronized void
- checkInitializeException()
+ public synchronized void checkInitializeException()
{
if(_initializeException != null)
{
@@ -79,20 +71,17 @@ public final class Configuration
}
}
- public synchronized void
- readReady(boolean ready)
+ public synchronized void readReady(boolean ready)
{
_readReadyCount = ready ? 0 : 10;
}
- public synchronized void
- readException(Ice.LocalException ex)
+ public synchronized void readException(com.zeroc.Ice.LocalException ex)
{
_readException = ex;
}
-
- public synchronized boolean
- readReady()
+
+ public synchronized boolean readReady()
{
if(_readReadyCount == 0)
{
@@ -102,8 +91,7 @@ public final class Configuration
return false;
}
- public synchronized void
- checkReadException()
+ public synchronized void checkReadException()
{
if(_readException != null)
{
@@ -111,20 +99,17 @@ public final class Configuration
}
}
- public synchronized void
- writeReady(boolean ready)
+ public synchronized void writeReady(boolean ready)
{
_writeReadyCount = ready ? 0 : 10;
}
- public synchronized void
- writeException(Ice.LocalException ex)
+ public synchronized void writeException(com.zeroc.Ice.LocalException ex)
{
_writeException = ex;
}
-
- public synchronized boolean
- writeReady()
+
+ public synchronized boolean writeReady()
{
if(_writeReadyCount == 0)
{
@@ -134,8 +119,7 @@ public final class Configuration
return false;
}
- public synchronized void
- checkWriteException()
+ public synchronized void checkWriteException()
{
if(_writeException != null)
{
@@ -143,26 +127,24 @@ public final class Configuration
}
}
- public synchronized void
- buffered(boolean b)
+ public synchronized void buffered(boolean b)
{
_buffered = b;
}
- public synchronized boolean
- buffered()
+ public synchronized boolean buffered()
{
return _buffered;
}
- private Ice.LocalException _connectorsException;
- private Ice.LocalException _connectException;
+ private com.zeroc.Ice.LocalException _connectorsException;
+ private com.zeroc.Ice.LocalException _connectException;
private int _initializeSocketStatus;
private int _initializeResetCount;
- private Ice.LocalException _initializeException;
+ private com.zeroc.Ice.LocalException _initializeException;
private int _readReadyCount;
- private Ice.LocalException _readException;
+ private com.zeroc.Ice.LocalException _readException;
private int _writeReadyCount;
- private Ice.LocalException _writeException;
+ private com.zeroc.Ice.LocalException _writeException;
private boolean _buffered;
}
diff --git a/java/test/src/main/java/test/Ice/background/Connector.java b/java/test/src/main/java/test/Ice/background/Connector.java
index 14e710e2454..b0d16f9e123 100644
--- a/java/test/src/main/java/test/Ice/background/Connector.java
+++ b/java/test/src/main/java/test/Ice/background/Connector.java
@@ -6,35 +6,32 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package test.Ice.background;
-final class Connector implements IceInternal.Connector
+final class Connector implements com.zeroc.IceInternal.Connector
{
@Override
- public IceInternal.Transceiver
- connect()
+ public com.zeroc.IceInternal.Transceiver connect()
{
_configuration.checkConnectException();
return new Transceiver(_configuration, _connector.connect());
}
@Override
- public short
- type()
+ public short type()
{
return (short)(EndpointI.TYPE_BASE + _connector.type());
}
@Override
- public String
- toString()
+ public String toString()
{
return _connector.toString();
}
@Override
- public int
- hashCode()
+ public int hashCode()
{
return _connector.hashCode();
}
@@ -42,15 +39,14 @@ final class Connector implements IceInternal.Connector
//
// Only for use by Endpoint
//
- Connector(Configuration configuration, IceInternal.Connector connector)
+ Connector(Configuration configuration, com.zeroc.IceInternal.Connector connector)
{
_configuration = configuration;
_connector = connector;
}
@Override
- public boolean
- equals(java.lang.Object obj)
+ public boolean equals(java.lang.Object obj)
{
Connector p = null;
@@ -71,6 +67,6 @@ final class Connector implements IceInternal.Connector
return _connector.equals(p._connector);
}
- final private IceInternal.Connector _connector;
+ final private com.zeroc.IceInternal.Connector _connector;
final private Configuration _configuration;
}
diff --git a/java/test/src/main/java/test/Ice/background/EndpointFactory.java b/java/test/src/main/java/test/Ice/background/EndpointFactory.java
index 279a7d9d6e3..e8a36976141 100644
--- a/java/test/src/main/java/test/Ice/background/EndpointFactory.java
+++ b/java/test/src/main/java/test/Ice/background/EndpointFactory.java
@@ -6,63 +6,59 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package test.Ice.background;
-final class EndpointFactory implements IceInternal.EndpointFactory
+final class EndpointFactory implements com.zeroc.IceInternal.EndpointFactory
{
- EndpointFactory(Configuration configuration, IceInternal.EndpointFactory factory)
+ EndpointFactory(Configuration configuration, com.zeroc.IceInternal.EndpointFactory factory)
{
_configuration = configuration;
_factory = factory;
}
@Override
- public short
- type()
+ public short type()
{
return (short)(EndpointI.TYPE_BASE + _factory.type());
}
@Override
- public String
- protocol()
+ public String protocol()
{
return "test-" + _factory.protocol();
}
@Override
- public IceInternal.EndpointI
- create(java.util.ArrayList<String> args, boolean server)
+ public com.zeroc.IceInternal.EndpointI create(java.util.ArrayList<String> args, boolean server)
{
return new EndpointI(_configuration, _factory.create(args, server));
}
@Override
- public IceInternal.EndpointI
- read(Ice.InputStream s)
+ public com.zeroc.IceInternal.EndpointI read(com.zeroc.Ice.InputStream s)
{
short type = s.readShort();
assert(type == _factory.type());
s.startEncapsulation();
- IceInternal.EndpointI endpoint = new EndpointI(_configuration, _factory.read(s));
+ com.zeroc.IceInternal.EndpointI endpoint = new EndpointI(_configuration, _factory.read(s));
s.endEncapsulation();
return endpoint;
}
@Override
- public void
- destroy()
+ public void destroy()
{
}
@Override
- public IceInternal.EndpointFactory
- clone(IceInternal.ProtocolInstance instance, IceInternal.EndpointFactory del)
+ public com.zeroc.IceInternal.EndpointFactory clone(com.zeroc.IceInternal.ProtocolInstance instance,
+ com.zeroc.IceInternal.EndpointFactory del)
{
return this;
}
private Configuration _configuration;
- private IceInternal.EndpointFactory _factory;
+ private com.zeroc.IceInternal.EndpointFactory _factory;
}
diff --git a/java/test/src/main/java/test/Ice/background/EndpointI.java b/java/test/src/main/java/test/Ice/background/EndpointI.java
index eb51c2d26f9..bb560839ef8 100644
--- a/java/test/src/main/java/test/Ice/background/EndpointI.java
+++ b/java/test/src/main/java/test/Ice/background/EndpointI.java
@@ -6,67 +6,60 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package test.Ice.background;
-final class EndpointI extends IceInternal.EndpointI
+final class EndpointI extends com.zeroc.IceInternal.EndpointI
{
final static short TYPE_BASE = 100;
- public
- EndpointI(Configuration configuration, IceInternal.EndpointI endpoint)
+ public EndpointI(Configuration configuration, com.zeroc.IceInternal.EndpointI endpoint)
{
_endpoint = endpoint;
_configuration = configuration;
}
@Override
- public String
- _toString()
+ public String _toString()
{
return "test-" + _endpoint.toString();
}
@Override
- public Ice.EndpointInfo
- getInfo()
+ public com.zeroc.Ice.EndpointInfo getInfo()
{
return _endpoint.getInfo();
}
@Override
- public void
- streamWriteImpl(Ice.OutputStream s)
+ public void streamWriteImpl(com.zeroc.Ice.OutputStream s)
{
s.writeShort(_endpoint.type());
_endpoint.streamWrite(s);
}
@Override
- public short
- type()
+ public short type()
{
return (short)(TYPE_BASE + _endpoint.type());
}
@Override
- public String
- protocol()
+ public String protocol()
{
return _endpoint.protocol();
}
@Override
- public int
- timeout()
+ public int timeout()
{
return _endpoint.timeout();
}
@Override
- public IceInternal.EndpointI
- timeout(int timeout)
+ public com.zeroc.IceInternal.EndpointI timeout(int timeout)
{
- IceInternal.EndpointI endpoint = _endpoint.timeout(timeout);
+ com.zeroc.IceInternal.EndpointI endpoint = _endpoint.timeout(timeout);
if(endpoint == _endpoint)
{
return this;
@@ -78,17 +71,15 @@ final class EndpointI extends IceInternal.EndpointI
}
@Override
- public String
- connectionId()
+ public String connectionId()
{
return _endpoint.connectionId();
}
@Override
- public IceInternal.EndpointI
- connectionId(String connectionId)
+ public com.zeroc.IceInternal.EndpointI connectionId(String connectionId)
{
- IceInternal.EndpointI endpoint = _endpoint.connectionId(connectionId);
+ com.zeroc.IceInternal.EndpointI endpoint = _endpoint.connectionId(connectionId);
if(endpoint == _endpoint)
{
return this;
@@ -100,17 +91,15 @@ final class EndpointI extends IceInternal.EndpointI
}
@Override
- public boolean
- compress()
+ public boolean compress()
{
return _endpoint.compress();
}
@Override
- public IceInternal.EndpointI
- compress(boolean compress)
+ public com.zeroc.IceInternal.EndpointI compress(boolean compress)
{
- IceInternal.EndpointI endpoint = _endpoint.compress(compress);
+ com.zeroc.IceInternal.EndpointI endpoint = _endpoint.compress(compress);
if(endpoint == _endpoint)
{
return this;
@@ -122,24 +111,21 @@ final class EndpointI extends IceInternal.EndpointI
}
@Override
- public boolean
- datagram()
+ public boolean datagram()
{
return _endpoint.datagram();
}
@Override
- public boolean
- secure()
+ public boolean secure()
{
return _endpoint.secure();
}
@Override
- public IceInternal.Transceiver
- transceiver()
+ public com.zeroc.IceInternal.Transceiver transceiver()
{
- IceInternal.Transceiver transceiver = _endpoint.transceiver();
+ com.zeroc.IceInternal.Transceiver transceiver = _endpoint.transceiver();
if(transceiver != null)
{
return new Transceiver(_configuration, transceiver);
@@ -151,17 +137,17 @@ final class EndpointI extends IceInternal.EndpointI
}
@Override
- public void
- connectors_async(Ice.EndpointSelectionType selType, final IceInternal.EndpointI_connectors cb)
+ public void connectors_async(com.zeroc.Ice.EndpointSelectionType selType,
+ final com.zeroc.IceInternal.EndpointI_connectors cb)
{
- class Callback implements IceInternal.EndpointI_connectors
+ class Callback implements com.zeroc.IceInternal.EndpointI_connectors
{
@Override
- public void
- connectors(java.util.List<IceInternal.Connector> cons)
+ public void connectors(java.util.List<com.zeroc.IceInternal.Connector> cons)
{
- java.util.List<IceInternal.Connector> connectors = new java.util.ArrayList<IceInternal.Connector>();
- for(IceInternal.Connector p : cons)
+ java.util.List<com.zeroc.IceInternal.Connector> connectors =
+ new java.util.ArrayList<com.zeroc.IceInternal.Connector>();
+ for(com.zeroc.IceInternal.Connector p : cons)
{
connectors.add(new Connector(_configuration, p));
}
@@ -169,8 +155,7 @@ final class EndpointI extends IceInternal.EndpointI
}
@Override
- public void
- exception(Ice.LocalException exception)
+ public void exception(com.zeroc.Ice.LocalException exception)
{
cb.exception(exception);
}
@@ -181,31 +166,29 @@ final class EndpointI extends IceInternal.EndpointI
_configuration.checkConnectorsException();
_endpoint.connectors_async(selType, new Callback());
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
cb.exception(ex);
}
}
@Override
- public IceInternal.Acceptor
- acceptor(String adapterName)
+ public com.zeroc.IceInternal.Acceptor acceptor(String adapterName)
{
return new Acceptor(this, _configuration, _endpoint.acceptor(adapterName));
}
- public EndpointI
- endpoint(IceInternal.EndpointI delEndp)
+ public EndpointI endpoint(com.zeroc.IceInternal.EndpointI delEndp)
{
return new EndpointI(_configuration, delEndp);
}
@Override
- public java.util.List<IceInternal.EndpointI>
- expand()
+ public java.util.List<com.zeroc.IceInternal.EndpointI> expand()
{
- java.util.List<IceInternal.EndpointI> endps = new java.util.ArrayList<IceInternal.EndpointI>();
- for(IceInternal.EndpointI endpt : _endpoint.expand())
+ java.util.List<com.zeroc.IceInternal.EndpointI> endps =
+ new java.util.ArrayList<com.zeroc.IceInternal.EndpointI>();
+ for(com.zeroc.IceInternal.EndpointI endpt : _endpoint.expand())
{
endps.add(endpt == _endpoint ? this : new EndpointI(_configuration, endpt));
}
@@ -213,8 +196,7 @@ final class EndpointI extends IceInternal.EndpointI
}
@Override
- public boolean
- equivalent(IceInternal.EndpointI endpoint)
+ public boolean equivalent(com.zeroc.IceInternal.EndpointI endpoint)
{
EndpointI testEndpoint = null;
try
@@ -229,15 +211,13 @@ final class EndpointI extends IceInternal.EndpointI
}
@Override
- public String
- options()
+ public String options()
{
return _endpoint.options();
}
@Override
- public int
- hashCode()
+ public int hashCode()
{
return _endpoint.hashCode();
}
@@ -246,12 +226,11 @@ final class EndpointI extends IceInternal.EndpointI
// Compare endpoints for sorting purposes
//
@Override
- public boolean
- equals(java.lang.Object obj)
+ public boolean equals(java.lang.Object obj)
{
try
{
- return compareTo((IceInternal.EndpointI)obj) == 0;
+ return compareTo((com.zeroc.IceInternal.EndpointI)obj) == 0;
}
catch(ClassCastException ee)
{
@@ -261,8 +240,7 @@ final class EndpointI extends IceInternal.EndpointI
}
@Override
- public int
- compareTo(IceInternal.EndpointI obj) // From java.lang.Comparable
+ public int compareTo(com.zeroc.IceInternal.EndpointI obj) // From java.lang.Comparable
{
EndpointI p = null;
@@ -283,12 +261,11 @@ final class EndpointI extends IceInternal.EndpointI
return _endpoint.compareTo(p._endpoint);
}
- public IceInternal.EndpointI
- delegate()
+ public com.zeroc.IceInternal.EndpointI delegate()
{
return _endpoint;
}
- private IceInternal.EndpointI _endpoint;
+ private com.zeroc.IceInternal.EndpointI _endpoint;
private Configuration _configuration;
}
diff --git a/java/test/src/main/java/test/Ice/background/PluginFactory.java b/java/test/src/main/java/test/Ice/background/PluginFactory.java
index 8a6b5022b00..881b6c877ab 100644
--- a/java/test/src/main/java/test/Ice/background/PluginFactory.java
+++ b/java/test/src/main/java/test/Ice/background/PluginFactory.java
@@ -9,25 +9,24 @@
package test.Ice.background;
-public class PluginFactory implements Ice.PluginFactory
+public class PluginFactory implements com.zeroc.Ice.PluginFactory
{
- static public class PluginI implements Ice.Plugin
+ static public class PluginI implements com.zeroc.Ice.Plugin
{
- public
- PluginI(Ice.Communicator communicator)
+ public PluginI(com.zeroc.Ice.Communicator communicator)
{
_communicator = communicator;
}
-
+
@Override
- public void
- initialize()
+ public void initialize()
{
assert _configuration != null;
- IceInternal.ProtocolPluginFacade facade = IceInternal.Util.getProtocolPluginFacade(_communicator);
+ com.zeroc.IceInternal.ProtocolPluginFacade facade =
+ com.zeroc.IceInternal.Util.getProtocolPluginFacade(_communicator);
for(short s = 0; s < 100; ++s)
{
- IceInternal.EndpointFactory factory = facade.getEndpointFactory(s);
+ com.zeroc.IceInternal.EndpointFactory factory = facade.getEndpointFactory(s);
if(factory != null)
{
facade.addEndpointFactory(new EndpointFactory(_configuration, factory));
@@ -36,24 +35,21 @@ public class PluginFactory implements Ice.PluginFactory
}
@Override
- public void
- destroy()
+ public void destroy()
{
}
-
- public void
- setConfiguration(Configuration configuration)
+
+ public void setConfiguration(Configuration configuration)
{
_configuration = configuration;
}
- private final Ice.Communicator _communicator;
+ private final com.zeroc.Ice.Communicator _communicator;
private Configuration _configuration;
}
@Override
- public Ice.Plugin
- create(Ice.Communicator communicator, String name, String[] args)
+ public com.zeroc.Ice.Plugin create(com.zeroc.Ice.Communicator communicator, String name, String[] args)
{
return new PluginI(communicator);
}
diff --git a/java/test/src/main/java/test/Ice/background/Server.java b/java/test/src/main/java/test/Ice/background/Server.java
index d0e0d298506..5e78f5aa171 100644
--- a/java/test/src/main/java/test/Ice/background/Server.java
+++ b/java/test/src/main/java/test/Ice/background/Server.java
@@ -6,143 +6,139 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package test.Ice.background;
+import java.util.concurrent.CompletionStage;
+import java.util.concurrent.CompletableFuture;
+
import test.Ice.background.PluginFactory.PluginI;
public class Server extends test.Util.Application
{
- static public class LocatorI extends Ice._LocatorDisp
+ static public class LocatorI implements com.zeroc.Ice.Locator
{
@Override
- public void
- findAdapterById_async(Ice.AMD_Locator_findAdapterById response, String adapter, Ice.Current current)
- throws Ice.AdapterNotFoundException
+ public CompletionStage<com.zeroc.Ice.ObjectPrx> findAdapterByIdAsync(String adapter,
+ com.zeroc.Ice.Current current)
{
_controller.checkCallPause(current);
- Ice.Communicator communicator = current.adapter.getCommunicator();
- response.ice_response(current.adapter.createDirectProxy(Ice.Util.stringToIdentity("dummy")));
+ com.zeroc.Ice.Communicator communicator = current.adapter.getCommunicator();
+ return CompletableFuture.completedFuture(
+ current.adapter.createDirectProxy(com.zeroc.Ice.Util.stringToIdentity("dummy")));
}
@Override
- public void
- findObjectById_async(Ice.AMD_Locator_findObjectById response, Ice.Identity id, Ice.Current current)
- throws Ice.ObjectNotFoundException
+ public CompletionStage<com.zeroc.Ice.ObjectPrx> findObjectByIdAsync(com.zeroc.Ice.Identity id,
+ com.zeroc.Ice.Current current)
{
_controller.checkCallPause(current);
- response.ice_response(current.adapter.createDirectProxy(id));
+ return CompletableFuture.completedFuture(current.adapter.createDirectProxy(id));
}
-
+
@Override
- public Ice.LocatorRegistryPrx
- getRegistry(Ice.Current current)
+ public com.zeroc.Ice.LocatorRegistryPrx getRegistry(com.zeroc.Ice.Current current)
{
return null;
}
-
+
LocatorI(BackgroundControllerI controller)
{
_controller = controller;
}
-
+
final private BackgroundControllerI _controller;
}
- static public class RouterI extends Ice._RouterDisp
+ static public class RouterI implements com.zeroc.Ice.Router
{
@Override
- public Ice.ObjectPrx
- getClientProxy(Ice.Current current)
+ public com.zeroc.Ice.ObjectPrx getClientProxy(com.zeroc.Ice.Current current)
{
_controller.checkCallPause(current);
return null;
}
@Override
- public Ice.ObjectPrx
- getServerProxy(Ice.Current current)
+ public com.zeroc.Ice.ObjectPrx getServerProxy(com.zeroc.Ice.Current current)
{
_controller.checkCallPause(current);
return null;
}
@Override
- public Ice.ObjectPrx[]
- addProxies(Ice.ObjectPrx[] proxies, Ice.Current current)
+ public com.zeroc.Ice.ObjectPrx[] addProxies(com.zeroc.Ice.ObjectPrx[] proxies, com.zeroc.Ice.Current current)
{
- return new Ice.ObjectPrx[0];
+ return new com.zeroc.Ice.ObjectPrx[0];
}
RouterI(BackgroundControllerI controller)
{
_controller = controller;
}
-
+
final private BackgroundControllerI _controller;
}
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
Configuration configuration = new Configuration();
PluginI plugin = (PluginI)communicator().getPluginManager().getPlugin("Test");
plugin.setConfiguration(configuration);
communicator().getPluginManager().initializePlugins();
-
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
+
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
BackgroundControllerI backgroundController = new BackgroundControllerI(configuration, adapter);
- adapter.add(new BackgroundI(backgroundController), Ice.Util.stringToIdentity("background"));
- adapter.add(new LocatorI(backgroundController), Ice.Util.stringToIdentity("locator"));
- adapter.add(new RouterI(backgroundController), Ice.Util.stringToIdentity("router"));
+ adapter.add(new BackgroundI(backgroundController), com.zeroc.Ice.Util.stringToIdentity("background"));
+ adapter.add(new LocatorI(backgroundController), com.zeroc.Ice.Util.stringToIdentity("locator"));
+ adapter.add(new RouterI(backgroundController), com.zeroc.Ice.Util.stringToIdentity("router"));
adapter.activate();
- adapter2.add(backgroundController, Ice.Util.stringToIdentity("backgroundController"));
+ adapter2.add(backgroundController, com.zeroc.Ice.Util.stringToIdentity("backgroundController"));
adapter2.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
-
+ GetInitDataResult r = super.getInitData(args);
+
//
// This test kills connections, so we don't want warnings.
//
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("Ice.MessageSizeMax", "50000");
+ r.initData.properties.setProperty("Ice.Warn.Connections", "0");
+ r.initData.properties.setProperty("Ice.MessageSizeMax", "50000");
// This test relies on filling the TCP send/recv buffer, so
// we rely on a fixed value for these buffers.
- initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
+ r.initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
//
// Setup the test transport plug-in.
//
- initData.properties.setProperty("Ice.Plugin.Test", "test.Ice.background.PluginFactory");
- String defaultProtocol = initData.properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp");
- initData.properties.setProperty("Ice.Default.Protocol", "test-" + defaultProtocol);
-
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.background");
-
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
- initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
-
+ r.initData.properties.setProperty("Ice.Plugin.Test", "test.Ice.background.PluginFactory");
+ String defaultProtocol = r.initData.properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp");
+ r.initData.properties.setProperty("Ice.Default.Protocol", "test-" + defaultProtocol);
+
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.background");
+
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ r.initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
+ r.initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
+
// Don't initialize the plugin until I've set the configuration.
- initData.properties.setProperty("Ice.InitPlugins", "0");
-
- return initData;
+ r.initData.properties.setProperty("Ice.InitPlugins", "0");
+
+ return r;
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
Server app = new Server();
int result = app.main("Server", args);
diff --git a/java/test/src/main/java/test/Ice/background/Transceiver.java b/java/test/src/main/java/test/Ice/background/Transceiver.java
index 5f21f4663f2..04f73cfcea0 100644
--- a/java/test/src/main/java/test/Ice/background/Transceiver.java
+++ b/java/test/src/main/java/test/Ice/background/Transceiver.java
@@ -9,45 +9,45 @@
package test.Ice.background;
-final class Transceiver implements IceInternal.Transceiver
+import com.zeroc.IceInternal.SocketOperation;
+
+final class Transceiver implements com.zeroc.IceInternal.Transceiver
{
@Override
- public java.nio.channels.SelectableChannel
- fd()
+ public java.nio.channels.SelectableChannel fd()
{
return _transceiver.fd();
}
@Override
- public void setReadyCallback(IceInternal.ReadyCallback callback)
+ public void setReadyCallback(com.zeroc.IceInternal.ReadyCallback callback)
{
_transceiver.setReadyCallback(callback);
_readyCallback = callback;
}
@Override
- public int
- initialize(IceInternal.Buffer readBuffer, IceInternal.Buffer writeBuffer)
+ public int initialize(com.zeroc.IceInternal.Buffer readBuffer, com.zeroc.IceInternal.Buffer writeBuffer)
{
int status = _configuration.initializeSocketStatus();
- if(status == IceInternal.SocketOperation.Connect)
+ if(status == SocketOperation.Connect)
{
return status;
}
- else if(status == IceInternal.SocketOperation.Write)
+ else if(status == SocketOperation.Write)
{
if(!_initialized)
{
status = _transceiver.initialize(readBuffer, writeBuffer);
- if(status != IceInternal.SocketOperation.None)
+ if(status != SocketOperation.None)
{
return status;
}
_initialized = true;
}
- return IceInternal.SocketOperation.Write;
+ return SocketOperation.Write;
}
- else if(status == IceInternal.SocketOperation.Read)
+ else if(status == SocketOperation.Read)
{
return status;
}
@@ -56,43 +56,39 @@ final class Transceiver implements IceInternal.Transceiver
if(!_initialized)
{
status = _transceiver.initialize(readBuffer, writeBuffer);
- if(status != IceInternal.SocketOperation.None)
+ if(status != SocketOperation.None)
{
return status;
}
_initialized = true;
}
- return IceInternal.SocketOperation.None;
+ return SocketOperation.None;
}
@Override
- public int
- closing(boolean initiator, Ice.LocalException ex)
+ public int closing(boolean initiator, com.zeroc.Ice.LocalException ex)
{
return _transceiver.closing(initiator, ex);
}
@Override
- public void
- close()
+ public void close()
{
_transceiver.close();
}
@Override
- public IceInternal.EndpointI
- bind()
+ public com.zeroc.IceInternal.EndpointI bind()
{
return _transceiver.bind();
}
@Override
- public int
- write(IceInternal.Buffer buf)
+ public int write(com.zeroc.IceInternal.Buffer buf)
{
if(!_configuration.writeReady() && buf.b.hasRemaining())
{
- return IceInternal.SocketOperation.Write;
+ return SocketOperation.Write;
}
_configuration.checkWriteException();
@@ -100,12 +96,11 @@ final class Transceiver implements IceInternal.Transceiver
}
@Override
- public int
- read(IceInternal.Buffer buf)
+ public int read(com.zeroc.IceInternal.Buffer buf)
{
if(!_configuration.readReady() && buf.b.hasRemaining())
{
- return IceInternal.SocketOperation.Read;
+ return SocketOperation.Read;
}
_configuration.checkReadException();
@@ -121,8 +116,8 @@ final class Transceiver implements IceInternal.Transceiver
_transceiver.read(_readBuffer);
if(_readBufferPos == _readBuffer.b.position())
{
- _readyCallback.ready(IceInternal.SocketOperation.Read, false);
- return IceInternal.SocketOperation.Read;
+ _readyCallback.ready(SocketOperation.Read, false);
+ return SocketOperation.Read;
}
}
final int pos = _readBuffer.b.position();
@@ -143,8 +138,8 @@ final class Transceiver implements IceInternal.Transceiver
_readBuffer.b.position(pos);
}
- _readyCallback.ready(IceInternal.SocketOperation.Read, _readBufferPos < _readBuffer.b.position());
- return IceInternal.SocketOperation.None;
+ _readyCallback.ready(SocketOperation.Read, _readBufferPos < _readBuffer.b.position());
+ return SocketOperation.None;
}
else
{
@@ -153,36 +148,31 @@ final class Transceiver implements IceInternal.Transceiver
}
@Override
- public String
- protocol()
+ public String protocol()
{
return "test-" + _transceiver.protocol();
}
@Override
- public String
- toString()
+ public String toString()
{
return _transceiver.toString();
}
@Override
- public String
- toDetailedString()
+ public String toDetailedString()
{
return _transceiver.toDetailedString();
}
@Override
- public Ice.ConnectionInfo
- getInfo()
+ public com.zeroc.Ice.ConnectionInfo getInfo()
{
return _transceiver.getInfo();
}
@Override
- public void
- checkSendSize(IceInternal.Buffer buf)
+ public void checkSendSize(com.zeroc.IceInternal.Buffer buf)
{
_transceiver.checkSendSize(buf);
}
@@ -193,8 +183,7 @@ final class Transceiver implements IceInternal.Transceiver
_transceiver.setBufferSize(rcvSize, sndSize);
}
- public IceInternal.Transceiver
- delegate()
+ public com.zeroc.IceInternal.Transceiver delegate()
{
return _transceiver;
}
@@ -202,22 +191,22 @@ final class Transceiver implements IceInternal.Transceiver
//
// Only for use by Connector, Acceptor
//
- Transceiver(Configuration configuration, IceInternal.Transceiver transceiver)
+ Transceiver(Configuration configuration, com.zeroc.IceInternal.Transceiver transceiver)
{
_transceiver = transceiver;
_configuration = configuration;
_initialized = false;
_buffered = _configuration.buffered();
- _readBuffer = new IceInternal.Buffer(false);
+ _readBuffer = new com.zeroc.IceInternal.Buffer(false);
_readBuffer.resize(1024 * 8, true); // 8KB buffer
_readBufferPos = 0;
}
- private final IceInternal.Transceiver _transceiver;
+ private final com.zeroc.IceInternal.Transceiver _transceiver;
private final Configuration _configuration;
- private IceInternal.ReadyCallback _readyCallback;
+ private com.zeroc.IceInternal.ReadyCallback _readyCallback;
private boolean _initialized;
private final boolean _buffered;
- private IceInternal.Buffer _readBuffer;
+ private com.zeroc.IceInternal.Buffer _readBuffer;
private int _readBufferPos;
}
diff --git a/java/test/src/main/java/test/Ice/binding/AllTests.java b/java/test/src/main/java/test/Ice/binding/AllTests.java
index 8199b8bd087..d2242539593 100644
--- a/java/test/src/main/java/test/Ice/binding/AllTests.java
+++ b/java/test/src/main/java/test/Ice/binding/AllTests.java
@@ -12,16 +12,16 @@ package test.Ice.binding;
import java.io.PrintWriter;
import test.Ice.binding.Test.RemoteCommunicatorPrx;
-import test.Ice.binding.Test.RemoteCommunicatorPrxHelper;
import test.Ice.binding.Test.RemoteObjectAdapterPrx;
import test.Ice.binding.Test.TestIntfPrx;
-import test.Ice.binding.Test.TestIntfPrxHelper;
import test.Util.Application;
+import com.zeroc.Ice.Endpoint;
+import com.zeroc.Ice.EndpointSelectionType;
+
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -29,67 +29,25 @@ public class AllTests
}
}
- static class GetAdapterNameCB extends Ice.Callback
- {
- @Override
- synchronized public void
- completed(Ice.AsyncResult result)
- {
- try
- {
- _name = TestIntfPrxHelper.uncheckedCast(result.getProxy()).end_getAdapterName(result);
- notify();
- }
- catch(Ice.LocalException ex)
- {
- test(false);
- }
- }
-
- synchronized public String
- getResult()
- {
- while(_name == null)
- {
- try
- {
- wait();
- }
- catch(java.lang.InterruptedException ex)
- {
- }
- }
- return _name;
- }
-
- private String _name = null;
- }
-
- private static String
- getAdapterNameWithAMI(TestIntfPrx test)
+ private static String getAdapterNameWithAMI(TestIntfPrx test)
{
- GetAdapterNameCB cb = new GetAdapterNameCB();
- test.begin_getAdapterName(cb);
- return cb.getResult();
+ return test.getAdapterNameAsync().join();
}
- private static TestIntfPrx
- createTestIntfPrx(java.util.List<RemoteObjectAdapterPrx> adapters)
+ private static TestIntfPrx createTestIntfPrx(java.util.List<RemoteObjectAdapterPrx> adapters)
{
- java.util.List<Ice.Endpoint> endpoints = new java.util.ArrayList<Ice.Endpoint>();
+ java.util.List<Endpoint> endpoints = new java.util.ArrayList<>();
TestIntfPrx test = null;
for(RemoteObjectAdapterPrx p : adapters)
{
test = p.getTestIntf();
- Ice.Endpoint[] edpts = test.ice_getEndpoints();
+ Endpoint[] edpts = test.ice_getEndpoints();
endpoints.addAll(java.util.Arrays.asList(edpts));
}
- return TestIntfPrxHelper.uncheckedCast(
- test.ice_endpoints(endpoints.toArray(new Ice.Endpoint[endpoints.size()])));
+ return test.ice_endpoints(endpoints.toArray(new Endpoint[endpoints.size()]));
}
- private static void
- deactivate(RemoteCommunicatorPrx communicator, java.util.List<RemoteObjectAdapterPrx> adapters)
+ private static void deactivate(RemoteCommunicatorPrx communicator, java.util.List<RemoteObjectAdapterPrx> adapters)
{
for(RemoteObjectAdapterPrx p : adapters)
{
@@ -97,19 +55,18 @@ public class AllTests
}
}
- public static void
- allTests(Application app)
+ public static void allTests(Application app)
{
- Ice.Communicator communicator = app.communicator();
+ com.zeroc.Ice.Communicator communicator = app.communicator();
PrintWriter out = app.getWriter();
String ref = "communicator:default -p 12010";
- RemoteCommunicatorPrx com = RemoteCommunicatorPrxHelper.uncheckedCast(communicator.stringToProxy(ref));
+ RemoteCommunicatorPrx rcom = RemoteCommunicatorPrx.uncheckedCast(communicator.stringToProxy(ref));
out.print("testing binding with single endpoint... ");
out.flush();
{
- RemoteObjectAdapterPrx adapter = com.createObjectAdapter("Adapter", "default");
+ RemoteObjectAdapterPrx adapter = rcom.createObjectAdapter("Adapter", "default");
TestIntfPrx test1 = adapter.getTestIntf();
TestIntfPrx test2 = adapter.getTestIntf();
@@ -118,9 +75,9 @@ public class AllTests
test1.ice_ping();
test2.ice_ping();
- com.deactivateObjectAdapter(adapter);
+ rcom.deactivateObjectAdapter(adapter);
- TestIntfPrx test3 = TestIntfPrxHelper.uncheckedCast(test1);
+ TestIntfPrx test3 = TestIntfPrx.uncheckedCast(test1);
test(test3.ice_getConnection() == test1.ice_getConnection());
test(test3.ice_getConnection() == test2.ice_getConnection());
@@ -129,7 +86,7 @@ public class AllTests
test3.ice_ping();
test(false);
}
- catch(Ice.ConnectFailedException ex)
+ catch(com.zeroc.Ice.ConnectFailedException ex)
{
//
// Usually the actual type of this exception is ConnectionRefusedException,
@@ -142,23 +99,22 @@ public class AllTests
out.print("testing binding with multiple endpoints... ");
out.flush();
{
- java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>();
- adapters.add(com.createObjectAdapter("Adapter11", "default"));
- adapters.add(com.createObjectAdapter("Adapter12", "default"));
- adapters.add(com.createObjectAdapter("Adapter13", "default"));
+ java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<>();
+ adapters.add(rcom.createObjectAdapter("Adapter11", "default"));
+ adapters.add(rcom.createObjectAdapter("Adapter12", "default"));
+ adapters.add(rcom.createObjectAdapter("Adapter13", "default"));
//
// Ensure that when a connection is opened it's reused for new
// proxies and that all endpoints are eventually tried.
//
- java.util.Set<String> names = new java.util.HashSet<String>();
+ java.util.Set<String> names = new java.util.HashSet<>();
names.add("Adapter11");
names.add("Adapter12");
names.add("Adapter13");
while(!names.isEmpty())
{
- java.util.List<RemoteObjectAdapterPrx> adpts =
- new java.util.ArrayList<RemoteObjectAdapterPrx>(adapters);
+ java.util.List<RemoteObjectAdapterPrx> adpts = new java.util.ArrayList<>(adapters);
TestIntfPrx test1 = createTestIntfPrx(adpts);
java.util.Collections.shuffle(adpts);
@@ -200,13 +156,12 @@ public class AllTests
// Deactivate an adapter and ensure that we can still
// establish the connection to the remaining adapters.
//
- com.deactivateObjectAdapter(adapters.get(0));
+ rcom.deactivateObjectAdapter(adapters.get(0));
names.add("Adapter12");
names.add("Adapter13");
while(!names.isEmpty())
{
- java.util.List<RemoteObjectAdapterPrx> adpts =
- new java.util.ArrayList<RemoteObjectAdapterPrx>(adapters);
+ java.util.List<RemoteObjectAdapterPrx> adpts = new java.util.ArrayList<>(adapters);
TestIntfPrx test1 = createTestIntfPrx(adpts);
java.util.Collections.shuffle(adpts);
@@ -225,11 +180,11 @@ public class AllTests
// Deactivate an adapter and ensure that we can still
// establish the connection to the remaining adapter.
//
- com.deactivateObjectAdapter(adapters.get(2));
+ rcom.deactivateObjectAdapter(adapters.get(2));
TestIntfPrx test = createTestIntfPrx(adapters);
test(test.getAdapterName().equals("Adapter12"));
- deactivate(com, adapters);
+ deactivate(rcom, adapters);
}
out.println("ok");
@@ -239,11 +194,11 @@ public class AllTests
java.util.Random rand = new java.util.Random();
RemoteObjectAdapterPrx[] adapters = new RemoteObjectAdapterPrx[5];
- adapters[0] = com.createObjectAdapter("AdapterRandom11", "default");
- adapters[1] = com.createObjectAdapter("AdapterRandom12", "default");
- adapters[2] = com.createObjectAdapter("AdapterRandom13", "default");
- adapters[3] = com.createObjectAdapter("AdapterRandom14", "default");
- adapters[4] = com.createObjectAdapter("AdapterRandom15", "default");
+ adapters[0] = rcom.createObjectAdapter("AdapterRandom11", "default");
+ adapters[1] = rcom.createObjectAdapter("AdapterRandom12", "default");
+ adapters[2] = rcom.createObjectAdapter("AdapterRandom13", "default");
+ adapters[3] = rcom.createObjectAdapter("AdapterRandom14", "default");
+ adapters[4] = rcom.createObjectAdapter("AdapterRandom15", "default");
boolean shortenTest =
System.getProperty("os.name").startsWith("Windows") ||
@@ -267,7 +222,7 @@ public class AllTests
{
if(count == 10)
{
- com.deactivateObjectAdapter(adapters[4]);
+ rcom.deactivateObjectAdapter(adapters[4]);
--adapterCount;
}
proxies = new TestIntfPrx[10];
@@ -276,7 +231,7 @@ public class AllTests
{
if(count < 60 && count % 10 == 0)
{
- com.deactivateObjectAdapter(adapters[count / 10 - 1]);
+ rcom.deactivateObjectAdapter(adapters[count / 10 - 1]);
--adapterCount;
}
proxies = new TestIntfPrx[40];
@@ -299,7 +254,7 @@ public class AllTests
for(TestIntfPrx p : proxies)
{
- p.begin_getAdapterName();
+ p.getAdapterNameAsync();
}
for(TestIntfPrx p : proxies)
{
@@ -307,12 +262,12 @@ public class AllTests
{
p.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
}
- java.util.Set<Ice.Connection> connections = new java.util.HashSet<Ice.Connection>();
+ java.util.Set<com.zeroc.Ice.Connection> connections = new java.util.HashSet<>();
for(TestIntfPrx p : proxies)
{
if(p.ice_getCachedConnection() != null)
@@ -328,7 +283,7 @@ public class AllTests
{
a.getTestIntf().ice_getConnection().close(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
// Expected if adapter is down.
}
@@ -340,23 +295,22 @@ public class AllTests
out.print("testing binding with multiple endpoints and AMI... ");
out.flush();
{
- java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>();
- adapters.add(com.createObjectAdapter("AdapterAMI11", "default"));
- adapters.add(com.createObjectAdapter("AdapterAMI12", "default"));
- adapters.add(com.createObjectAdapter("AdapterAMI13", "default"));
+ java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<>();
+ adapters.add(rcom.createObjectAdapter("AdapterAMI11", "default"));
+ adapters.add(rcom.createObjectAdapter("AdapterAMI12", "default"));
+ adapters.add(rcom.createObjectAdapter("AdapterAMI13", "default"));
//
// Ensure that when a connection is opened it's reused for new
// proxies and that all endpoints are eventually tried.
//
- java.util.Set<String> names = new java.util.HashSet<String>();
+ java.util.Set<String> names = new java.util.HashSet<>();
names.add("AdapterAMI11");
names.add("AdapterAMI12");
names.add("AdapterAMI13");
while(!names.isEmpty())
{
- java.util.List<RemoteObjectAdapterPrx> adpts =
- new java.util.ArrayList<RemoteObjectAdapterPrx>(adapters);
+ java.util.List<RemoteObjectAdapterPrx> adpts = new java.util.ArrayList<>(adapters);
TestIntfPrx test1 = createTestIntfPrx(adpts);
java.util.Collections.shuffle(adpts);
@@ -398,13 +352,12 @@ public class AllTests
// Deactivate an adapter and ensure that we can still
// establish the connection to the remaining adapters.
//
- com.deactivateObjectAdapter(adapters.get(0));
+ rcom.deactivateObjectAdapter(adapters.get(0));
names.add("AdapterAMI12");
names.add("AdapterAMI13");
while(!names.isEmpty())
{
- java.util.List<RemoteObjectAdapterPrx> adpts =
- new java.util.ArrayList<RemoteObjectAdapterPrx>(adapters);
+ java.util.List<RemoteObjectAdapterPrx> adpts = new java.util.ArrayList<>(adapters);
TestIntfPrx test1 = createTestIntfPrx(adpts);
java.util.Collections.shuffle(adpts);
@@ -423,26 +376,26 @@ public class AllTests
// Deactivate an adapter and ensure that we can still
// establish the connection to the remaining adapter.
//
- com.deactivateObjectAdapter(adapters.get(2));
+ rcom.deactivateObjectAdapter(adapters.get(2));
TestIntfPrx test = createTestIntfPrx(adapters);
test(getAdapterNameWithAMI(test).equals("AdapterAMI12"));
- deactivate(com, adapters);
+ deactivate(rcom, adapters);
}
out.println("ok");
out.print("testing random endpoint selection... ");
out.flush();
{
- java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>();
- adapters.add(com.createObjectAdapter("Adapter21", "default"));
- adapters.add(com.createObjectAdapter("Adapter22", "default"));
- adapters.add(com.createObjectAdapter("Adapter23", "default"));
+ java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<>();
+ adapters.add(rcom.createObjectAdapter("Adapter21", "default"));
+ adapters.add(rcom.createObjectAdapter("Adapter22", "default"));
+ adapters.add(rcom.createObjectAdapter("Adapter23", "default"));
TestIntfPrx test = createTestIntfPrx(adapters);
- test(test.ice_getEndpointSelection() == Ice.EndpointSelectionType.Random);
+ test(test.ice_getEndpointSelection() == EndpointSelectionType.Random);
- java.util.Set<String> names = new java.util.HashSet<String>();
+ java.util.Set<String> names = new java.util.HashSet<>();
names.add("Adapter21");
names.add("Adapter22");
names.add("Adapter23");
@@ -452,8 +405,8 @@ public class AllTests
test.ice_getConnection().close(false);
}
- test = TestIntfPrxHelper.uncheckedCast(test.ice_endpointSelection(Ice.EndpointSelectionType.Random));
- test(test.ice_getEndpointSelection() == Ice.EndpointSelectionType.Random);
+ test = test.ice_endpointSelection(EndpointSelectionType.Random);
+ test(test.ice_getEndpointSelection() == EndpointSelectionType.Random);
names.add("Adapter21");
names.add("Adapter22");
@@ -464,21 +417,21 @@ public class AllTests
test.ice_getConnection().close(false);
}
- deactivate(com, adapters);
+ deactivate(rcom, adapters);
}
out.println("ok");
out.print("testing ordered endpoint selection... ");
out.flush();
{
- java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>();
- adapters.add(com.createObjectAdapter("Adapter31", "default"));
- adapters.add(com.createObjectAdapter("Adapter32", "default"));
- adapters.add(com.createObjectAdapter("Adapter33", "default"));
+ java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<>();
+ adapters.add(rcom.createObjectAdapter("Adapter31", "default"));
+ adapters.add(rcom.createObjectAdapter("Adapter32", "default"));
+ adapters.add(rcom.createObjectAdapter("Adapter33", "default"));
TestIntfPrx test = createTestIntfPrx(adapters);
- test = TestIntfPrxHelper.uncheckedCast(test.ice_endpointSelection(Ice.EndpointSelectionType.Ordered));
- test(test.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered);
+ test = test.ice_endpointSelection(EndpointSelectionType.Ordered);
+ test(test.ice_getEndpointSelection() == EndpointSelectionType.Ordered);
int nRetry = 5;
int i;
@@ -488,19 +441,19 @@ public class AllTests
//
for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter31"); i++);
test(i == nRetry);
- com.deactivateObjectAdapter(adapters.get(0));
+ rcom.deactivateObjectAdapter(adapters.get(0));
for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter32"); i++);
test(i == nRetry);
- com.deactivateObjectAdapter(adapters.get(1));
+ rcom.deactivateObjectAdapter(adapters.get(1));
for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter33"); i++);
test(i == nRetry);
- com.deactivateObjectAdapter(adapters.get(2));
+ rcom.deactivateObjectAdapter(adapters.get(2));
try
{
test.getAdapterName();
}
- catch(Ice.ConnectFailedException ex)
+ catch(com.zeroc.Ice.ConnectFailedException ex)
{
//
// Usually the actual type of this exception is ConnectionRefusedException,
@@ -508,7 +461,7 @@ public class AllTests
//
}
- Ice.Endpoint[] endpoints = test.ice_getEndpoints();
+ Endpoint[] endpoints = test.ice_getEndpoints();
adapters.clear();
@@ -516,29 +469,29 @@ public class AllTests
// Now, re-activate the adapters with the same endpoints in the opposite
// order.
//
- adapters.add(com.createObjectAdapter("Adapter36", endpoints[2].toString()));
+ adapters.add(rcom.createObjectAdapter("Adapter36", endpoints[2].toString()));
for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter36"); i++);
test(i == nRetry);
test.ice_getConnection().close(false);
- adapters.add(com.createObjectAdapter("Adapter35", endpoints[1].toString()));
+ adapters.add(rcom.createObjectAdapter("Adapter35", endpoints[1].toString()));
for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter35"); i++);
test(i == nRetry);
test.ice_getConnection().close(false);
- adapters.add(com.createObjectAdapter("Adapter34", endpoints[0].toString()));
+ adapters.add(rcom.createObjectAdapter("Adapter34", endpoints[0].toString()));
for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter34"); i++);
test(i == nRetry);
- deactivate(com, adapters);
+ deactivate(rcom, adapters);
}
out.println("ok");
out.print("testing per request binding with single endpoint... ");
out.flush();
{
- RemoteObjectAdapterPrx adapter = com.createObjectAdapter("Adapter41", "default");
+ RemoteObjectAdapterPrx adapter = rcom.createObjectAdapter("Adapter41", "default");
- TestIntfPrx test1 = TestIntfPrxHelper.uncheckedCast(adapter.getTestIntf().ice_connectionCached(false));
- TestIntfPrx test2 = TestIntfPrxHelper.uncheckedCast(adapter.getTestIntf().ice_connectionCached(false));
+ TestIntfPrx test1 = adapter.getTestIntf().ice_connectionCached(false);
+ TestIntfPrx test2 = adapter.getTestIntf().ice_connectionCached(false);
test(!test1.ice_isConnectionCached());
test(!test2.ice_isConnectionCached());
test(test1.ice_getConnection() != null && test2.ice_getConnection() != null);
@@ -546,15 +499,15 @@ public class AllTests
test1.ice_ping();
- com.deactivateObjectAdapter(adapter);
+ rcom.deactivateObjectAdapter(adapter);
- TestIntfPrx test3 = TestIntfPrxHelper.uncheckedCast(test1);
+ TestIntfPrx test3 = TestIntfPrx.uncheckedCast(test1);
try
{
test(test3.ice_getConnection() == test1.ice_getConnection());
test(false);
}
- catch(Ice.ConnectFailedException ex)
+ catch(com.zeroc.Ice.ConnectFailedException ex)
{
//
// Usually the actual type of this exception is ConnectionRefusedException,
@@ -567,15 +520,15 @@ public class AllTests
out.print("testing per request binding with multiple endpoints... ");
out.flush();
{
- java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>();
- adapters.add(com.createObjectAdapter("Adapter51", "default"));
- adapters.add(com.createObjectAdapter("Adapter52", "default"));
- adapters.add(com.createObjectAdapter("Adapter53", "default"));
+ java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<>();
+ adapters.add(rcom.createObjectAdapter("Adapter51", "default"));
+ adapters.add(rcom.createObjectAdapter("Adapter52", "default"));
+ adapters.add(rcom.createObjectAdapter("Adapter53", "default"));
- TestIntfPrx test = TestIntfPrxHelper.uncheckedCast(createTestIntfPrx(adapters).ice_connectionCached(false));
+ TestIntfPrx test = createTestIntfPrx(adapters).ice_connectionCached(false);
test(!test.ice_isConnectionCached());
- java.util.Set<String> names = new java.util.HashSet<String>();
+ java.util.Set<String> names = new java.util.HashSet<>();
names.add("Adapter51");
names.add("Adapter52");
names.add("Adapter53");
@@ -584,7 +537,7 @@ public class AllTests
names.remove(test.getAdapterName());
}
- com.deactivateObjectAdapter(adapters.get(0));
+ rcom.deactivateObjectAdapter(adapters.get(0));
names.add("Adapter52");
names.add("Adapter53");
@@ -593,26 +546,26 @@ public class AllTests
names.remove(test.getAdapterName());
}
- com.deactivateObjectAdapter(adapters.get(2));
+ rcom.deactivateObjectAdapter(adapters.get(2));
test(test.getAdapterName().equals("Adapter52"));
- deactivate(com, adapters);
+ deactivate(rcom, adapters);
}
out.println("ok");
out.print("testing per request binding with multiple endpoints and AMI... ");
out.flush();
{
- java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>();
- adapters.add(com.createObjectAdapter("AdapterAMI51", "default"));
- adapters.add(com.createObjectAdapter("AdapterAMI52", "default"));
- adapters.add(com.createObjectAdapter("AdapterAMI53", "default"));
+ java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<>();
+ adapters.add(rcom.createObjectAdapter("AdapterAMI51", "default"));
+ adapters.add(rcom.createObjectAdapter("AdapterAMI52", "default"));
+ adapters.add(rcom.createObjectAdapter("AdapterAMI53", "default"));
- TestIntfPrx test = TestIntfPrxHelper.uncheckedCast(createTestIntfPrx(adapters).ice_connectionCached(false));
+ TestIntfPrx test = createTestIntfPrx(adapters).ice_connectionCached(false);
test(!test.ice_isConnectionCached());
- java.util.Set<String> names = new java.util.HashSet<String>();
+ java.util.Set<String> names = new java.util.HashSet<>();
names.add("AdapterAMI51");
names.add("AdapterAMI52");
names.add("AdapterAMI53");
@@ -621,7 +574,7 @@ public class AllTests
names.remove(getAdapterNameWithAMI(test));
}
- com.deactivateObjectAdapter(adapters.get(0));
+ rcom.deactivateObjectAdapter(adapters.get(0));
names.add("AdapterAMI52");
names.add("AdapterAMI53");
@@ -630,26 +583,26 @@ public class AllTests
names.remove(getAdapterNameWithAMI(test));
}
- com.deactivateObjectAdapter(adapters.get(2));
+ rcom.deactivateObjectAdapter(adapters.get(2));
test(getAdapterNameWithAMI(test).equals("AdapterAMI52"));
- deactivate(com, adapters);
+ deactivate(rcom, adapters);
}
out.println("ok");
out.print("testing per request binding and ordered endpoint selection... ");
out.flush();
{
- java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>();
- adapters.add(com.createObjectAdapter("Adapter61", "default"));
- adapters.add(com.createObjectAdapter("Adapter62", "default"));
- adapters.add(com.createObjectAdapter("Adapter63", "default"));
+ java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<>();
+ adapters.add(rcom.createObjectAdapter("Adapter61", "default"));
+ adapters.add(rcom.createObjectAdapter("Adapter62", "default"));
+ adapters.add(rcom.createObjectAdapter("Adapter63", "default"));
TestIntfPrx test = createTestIntfPrx(adapters);
- test = TestIntfPrxHelper.uncheckedCast(test.ice_endpointSelection(Ice.EndpointSelectionType.Ordered));
- test(test.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered);
- test = TestIntfPrxHelper.uncheckedCast(test.ice_connectionCached(false));
+ test = test.ice_endpointSelection(EndpointSelectionType.Ordered);
+ test(test.ice_getEndpointSelection() == EndpointSelectionType.Ordered);
+ test = test.ice_connectionCached(false);
test(!test.ice_isConnectionCached());
int nRetry = 5;
int i;
@@ -660,19 +613,19 @@ public class AllTests
//
for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter61"); i++);
test(i == nRetry);
- com.deactivateObjectAdapter(adapters.get(0));
+ rcom.deactivateObjectAdapter(adapters.get(0));
for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter62"); i++);
test(i == nRetry);
- com.deactivateObjectAdapter(adapters.get(1));
+ rcom.deactivateObjectAdapter(adapters.get(1));
for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter63"); i++);
test(i == nRetry);
- com.deactivateObjectAdapter(adapters.get(2));
+ rcom.deactivateObjectAdapter(adapters.get(2));
try
{
test.getAdapterName();
}
- catch(Ice.ConnectFailedException ex)
+ catch(com.zeroc.Ice.ConnectFailedException ex)
{
//
// Usually the actual type of this exception is ConnectionRefusedException,
@@ -680,7 +633,7 @@ public class AllTests
//
}
- Ice.Endpoint[] endpoints = test.ice_getEndpoints();
+ Endpoint[] endpoints = test.ice_getEndpoints();
adapters.clear();
@@ -688,32 +641,32 @@ public class AllTests
// Now, re-activate the adapters with the same endpoints in the opposite
// order.
//
- adapters.add(com.createObjectAdapter("Adapter66", endpoints[2].toString()));
+ adapters.add(rcom.createObjectAdapter("Adapter66", endpoints[2].toString()));
for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter66"); i++);
test(i == nRetry);
- adapters.add(com.createObjectAdapter("Adapter65", endpoints[1].toString()));
+ adapters.add(rcom.createObjectAdapter("Adapter65", endpoints[1].toString()));
for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter65"); i++);
test(i == nRetry);
- adapters.add(com.createObjectAdapter("Adapter64", endpoints[0].toString()));
+ adapters.add(rcom.createObjectAdapter("Adapter64", endpoints[0].toString()));
for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter64"); i++);
test(i == nRetry);
- deactivate(com, adapters);
+ deactivate(rcom, adapters);
}
out.println("ok");
out.print("testing per request binding and ordered endpoint selection and AMI... ");
out.flush();
{
- java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>();
- adapters.add(com.createObjectAdapter("AdapterAMI61", "default"));
- adapters.add(com.createObjectAdapter("AdapterAMI62", "default"));
- adapters.add(com.createObjectAdapter("AdapterAMI63", "default"));
+ java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<>();
+ adapters.add(rcom.createObjectAdapter("AdapterAMI61", "default"));
+ adapters.add(rcom.createObjectAdapter("AdapterAMI62", "default"));
+ adapters.add(rcom.createObjectAdapter("AdapterAMI63", "default"));
TestIntfPrx test = createTestIntfPrx(adapters);
- test = TestIntfPrxHelper.uncheckedCast(test.ice_endpointSelection(Ice.EndpointSelectionType.Ordered));
- test(test.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered);
- test = TestIntfPrxHelper.uncheckedCast(test.ice_connectionCached(false));
+ test = test.ice_endpointSelection(EndpointSelectionType.Ordered);
+ test(test.ice_getEndpointSelection() == EndpointSelectionType.Ordered);
+ test = test.ice_connectionCached(false);
test(!test.ice_isConnectionCached());
int nRetry = 5;
int i;
@@ -724,19 +677,19 @@ public class AllTests
//
for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI61"); i++);
test(i == nRetry);
- com.deactivateObjectAdapter(adapters.get(0));
+ rcom.deactivateObjectAdapter(adapters.get(0));
for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI62"); i++);
test(i == nRetry);
- com.deactivateObjectAdapter(adapters.get(1));
+ rcom.deactivateObjectAdapter(adapters.get(1));
for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI63"); i++);
test(i == nRetry);
- com.deactivateObjectAdapter(adapters.get(2));
+ rcom.deactivateObjectAdapter(adapters.get(2));
try
{
test.getAdapterName();
}
- catch(Ice.ConnectFailedException ex)
+ catch(com.zeroc.Ice.ConnectFailedException ex)
{
//
// Usually the actual type of this exception is ConnectionRefusedException,
@@ -744,7 +697,7 @@ public class AllTests
//
}
- Ice.Endpoint[] endpoints = test.ice_getEndpoints();
+ Endpoint[] endpoints = test.ice_getEndpoints();
adapters.clear();
@@ -752,37 +705,37 @@ public class AllTests
// Now, re-activate the adapters with the same endpoints in the opposite
// order.
//
- adapters.add(com.createObjectAdapter("AdapterAMI66", endpoints[2].toString()));
+ adapters.add(rcom.createObjectAdapter("AdapterAMI66", endpoints[2].toString()));
for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI66"); i++);
test(i == nRetry);
- adapters.add(com.createObjectAdapter("AdapterAMI65", endpoints[1].toString()));
+ adapters.add(rcom.createObjectAdapter("AdapterAMI65", endpoints[1].toString()));
for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI65"); i++);
test(i == nRetry);
- adapters.add(com.createObjectAdapter("AdapterAMI64", endpoints[0].toString()));
+ adapters.add(rcom.createObjectAdapter("AdapterAMI64", endpoints[0].toString()));
for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI64"); i++);
test(i == nRetry);
- deactivate(com, adapters);
+ deactivate(rcom, adapters);
}
out.println("ok");
out.print("testing endpoint mode filtering... ");
out.flush();
{
- java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>();
- adapters.add(com.createObjectAdapter("Adapter71", "default"));
- adapters.add(com.createObjectAdapter("Adapter72", "udp"));
+ java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<>();
+ adapters.add(rcom.createObjectAdapter("Adapter71", "default"));
+ adapters.add(rcom.createObjectAdapter("Adapter72", "udp"));
TestIntfPrx test = createTestIntfPrx(adapters);
test(test.getAdapterName().equals("Adapter71"));
- TestIntfPrx testUDP = TestIntfPrxHelper.uncheckedCast(test.ice_datagram());
+ TestIntfPrx testUDP = test.ice_datagram();
test(test.ice_getConnection() != testUDP.ice_getConnection());
try
{
testUDP.getAdapterName();
}
- catch(Ice.TwowayOnlyException ex)
+ catch(java.lang.IllegalArgumentException ex)
{
}
}
@@ -793,9 +746,9 @@ public class AllTests
out.print("testing unsecure vs. secure endpoints... ");
out.flush();
{
- java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>();
- adapters.add(com.createObjectAdapter("Adapter81", "ssl"));
- adapters.add(com.createObjectAdapter("Adapter82", "tcp"));
+ java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<>();
+ adapters.add(rcom.createObjectAdapter("Adapter81", "ssl"));
+ adapters.add(rcom.createObjectAdapter("Adapter82", "tcp"));
TestIntfPrx test = createTestIntfPrx(adapters);
int i;
@@ -805,15 +758,15 @@ public class AllTests
test.ice_getConnection().close(false);
}
- TestIntfPrx testSecure = TestIntfPrxHelper.uncheckedCast(test.ice_secure(true));
+ TestIntfPrx testSecure = test.ice_secure(true);
test(testSecure.ice_isSecure());
- testSecure = TestIntfPrxHelper.uncheckedCast(test.ice_secure(false));
+ testSecure = test.ice_secure(false);
test(!testSecure.ice_isSecure());
- testSecure = TestIntfPrxHelper.uncheckedCast(test.ice_secure(true));
+ testSecure = test.ice_secure(true);
test(testSecure.ice_isSecure());
test(test.ice_getConnection() != testSecure.ice_getConnection());
- com.deactivateObjectAdapter(adapters.get(1));
+ rcom.deactivateObjectAdapter(adapters.get(1));
for(i = 0; i < 5; i++)
{
@@ -821,7 +774,7 @@ public class AllTests
test.ice_getConnection().close(false);
}
- com.createObjectAdapter("Adapter83", (test.ice_getEndpoints()[1]).toString()); // Reactive tcp OA.
+ rcom.createObjectAdapter("Adapter83", (test.ice_getEndpoints()[1]).toString()); // Reactive tcp OA.
for(i = 0; i < 5; i++)
{
@@ -829,13 +782,13 @@ public class AllTests
test.ice_getConnection().close(false);
}
- com.deactivateObjectAdapter(adapters.get(0));
+ rcom.deactivateObjectAdapter(adapters.get(0));
try
{
testSecure.ice_ping();
test(false);
}
- catch(Ice.ConnectFailedException ex)
+ catch(com.zeroc.Ice.ConnectFailedException ex)
{
//
// Usually the actual type of this exception is ConnectionRefusedException,
@@ -843,7 +796,7 @@ public class AllTests
//
}
- deactivate(com, adapters);
+ deactivate(rcom, adapters);
}
out.println("ok");
}
@@ -852,55 +805,55 @@ public class AllTests
out.print("testing ipv4 & ipv6 connections... ");
out.flush();
- Ice.Properties ipv4 = Ice.Util.createProperties();
+ com.zeroc.Ice.Properties ipv4 = com.zeroc.Ice.Util.createProperties();
ipv4.setProperty("Ice.IPv4", "1");
ipv4.setProperty("Ice.IPv6", "0");
ipv4.setProperty("Adapter.Endpoints", "tcp -h localhost");
- Ice.Properties ipv6 = Ice.Util.createProperties();
+ com.zeroc.Ice.Properties ipv6 = com.zeroc.Ice.Util.createProperties();
ipv6.setProperty("Ice.IPv4", "0");
ipv6.setProperty("Ice.IPv6", "1");
ipv6.setProperty("Adapter.Endpoints", "tcp -h localhost");
- Ice.Properties bothPreferIPv4 = Ice.Util.createProperties();
+ com.zeroc.Ice.Properties bothPreferIPv4 = com.zeroc.Ice.Util.createProperties();
bothPreferIPv4.setProperty("Ice.IPv4", "1");
bothPreferIPv4.setProperty("Ice.IPv6", "1");
bothPreferIPv4.setProperty("Ice.PreferIPv6Address", "0");
bothPreferIPv4.setProperty("Adapter.Endpoints", "tcp -h localhost");
- Ice.Properties bothPreferIPv6 = Ice.Util.createProperties();
+ com.zeroc.Ice.Properties bothPreferIPv6 = com.zeroc.Ice.Util.createProperties();
bothPreferIPv6.setProperty("Ice.IPv4", "1");
bothPreferIPv6.setProperty("Ice.IPv6", "1");
bothPreferIPv6.setProperty("Ice.PreferIPv6Address", "1");
bothPreferIPv6.setProperty("Adapter.Endpoints", "tcp -h localhost");
- java.util.List<Ice.Properties> clientProps = new java.util.ArrayList<Ice.Properties>();
+ java.util.List<com.zeroc.Ice.Properties> clientProps = new java.util.ArrayList<>();
clientProps.add(ipv4);
clientProps.add(ipv6);
clientProps.add(bothPreferIPv4);
clientProps.add(bothPreferIPv6);
- Ice.Properties anyipv4 = ipv4._clone();
+ com.zeroc.Ice.Properties anyipv4 = ipv4._clone();
anyipv4.setProperty("Adapter.Endpoints", "tcp -p 12012");
anyipv4.setProperty("Adapter.PublishedEndpoints", "tcp -h 127.0.0.1 -p 12012");
- Ice.Properties anyipv6 = ipv6._clone();
+ com.zeroc.Ice.Properties anyipv6 = ipv6._clone();
anyipv6.setProperty("Adapter.Endpoints", "tcp -p 12012");
anyipv6.setProperty("Adapter.PublishedEndpoints", "tcp -h \".1\" -p 12012");
- Ice.Properties anyboth = Ice.Util.createProperties();
+ com.zeroc.Ice.Properties anyboth = com.zeroc.Ice.Util.createProperties();
anyboth.setProperty("Ice.IPv4", "1");
anyboth.setProperty("Ice.IPv6", "1");
anyboth.setProperty("Adapter.Endpoints", "tcp -p 12012");
anyboth.setProperty("Adapter.PublishedEndpoints", "tcp -h \"::1\" -p 12012:tcp -h 127.0.0.1 -p 12012");
- Ice.Properties localipv4 = ipv4._clone();
+ com.zeroc.Ice.Properties localipv4 = ipv4._clone();
localipv4.setProperty("Adapter.Endpoints", "tcp -h 127.0.0.1");
- Ice.Properties localipv6 = ipv6._clone();
+ com.zeroc.Ice.Properties localipv6 = ipv6._clone();
localipv6.setProperty("Adapter.Endpoints", "tcp -h \"::1\"");
- java.util.List<Ice.Properties> serverProps = new java.util.ArrayList<Ice.Properties>(clientProps);
+ java.util.List<com.zeroc.Ice.Properties> serverProps = new java.util.ArrayList<>(clientProps);
serverProps.add(anyipv4);
serverProps.add(anyipv6);
serverProps.add(anyboth);
@@ -908,23 +861,23 @@ public class AllTests
serverProps.add(localipv6);
boolean ipv6NotSupported = false;
- for(Ice.Properties p : serverProps)
+ for(com.zeroc.Ice.Properties p : serverProps)
{
- Ice.InitializationData serverInitData = app.createInitializationData();
+ com.zeroc.Ice.InitializationData serverInitData = app.createInitializationData();
serverInitData.properties = p;
- Ice.Communicator serverCommunicator = app.initialize(serverInitData);
- Ice.ObjectAdapter oa;
+ com.zeroc.Ice.Communicator serverCommunicator = app.initialize(serverInitData);
+ com.zeroc.Ice.ObjectAdapter oa;
try
{
oa = serverCommunicator.createObjectAdapter("Adapter");
oa.activate();
}
- catch(Ice.DNSException ex)
+ catch(com.zeroc.Ice.DNSException ex)
{
serverCommunicator.destroy();
continue; // IP version not supported.
}
- catch(Ice.SocketException ex)
+ catch(com.zeroc.Ice.SocketException ex)
{
if(p == ipv6)
{
@@ -934,23 +887,23 @@ public class AllTests
continue; // IP version not supported.
}
- String strPrx = oa.createProxy(Ice.Util.stringToIdentity("dummy")).toString();
- for(Ice.Properties q : clientProps)
+ String strPrx = oa.createProxy(com.zeroc.Ice.Util.stringToIdentity("dummy")).toString();
+ for(com.zeroc.Ice.Properties q : clientProps)
{
- Ice.InitializationData clientInitData = app.createInitializationData();
+ com.zeroc.Ice.InitializationData clientInitData = app.createInitializationData();
clientInitData.properties = q;
- Ice.Communicator clientCommunicator = app.initialize(clientInitData);
- Ice.ObjectPrx prx = clientCommunicator.stringToProxy(strPrx);
+ com.zeroc.Ice.Communicator clientCommunicator = app.initialize(clientInitData);
+ com.zeroc.Ice.ObjectPrx prx = clientCommunicator.stringToProxy(strPrx);
try
{
prx.ice_ping();
test(false);
}
- catch(Ice.ObjectNotExistException ex)
+ catch(com.zeroc.Ice.ObjectNotExistException ex)
{
// Expected, no object registered.
}
- catch(Ice.DNSException ex)
+ catch(com.zeroc.Ice.DNSException ex)
{
// Expected if no IPv4 or IPv6 address is
// associated to localhost or if trying to connect
@@ -958,7 +911,7 @@ public class AllTests
// e.g.: resolving an IPv4 address when only IPv6
// is enabled fails with a DNS exception.
}
- catch(Ice.SocketException ex)
+ catch(com.zeroc.Ice.SocketException ex)
{
test((p == ipv4 && q == ipv6) || (p == ipv6 && q == ipv4) ||
(p == bothPreferIPv4 && q == ipv6) || (p == bothPreferIPv6 && q == ipv4) ||
@@ -977,6 +930,6 @@ public class AllTests
out.println("ok");
}
- com.shutdown();
+ rcom.shutdown();
}
}
diff --git a/java/test/src/main/java/test/Ice/binding/Client.java b/java/test/src/main/java/test/Ice/binding/Client.java
index 0610017ff98..dd8273ef5c6 100644
--- a/java/test/src/main/java/test/Ice/binding/Client.java
+++ b/java/test/src/main/java/test/Ice/binding/Client.java
@@ -19,12 +19,11 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.binding");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.binding");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java b/java/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java
index 5286442d092..88560cd77c8 100644
--- a/java/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java
+++ b/java/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java
@@ -6,16 +6,16 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
+
package test.Ice.binding;
+
import test.Ice.binding.Test.RemoteObjectAdapterPrx;
-import test.Ice.binding.Test.RemoteObjectAdapterPrxHelper;
-import test.Ice.binding.Test._RemoteCommunicatorDisp;
+import test.Ice.binding.Test.RemoteCommunicator;
-public class RemoteCommunicatorI extends _RemoteCommunicatorDisp
+public class RemoteCommunicatorI implements RemoteCommunicator
{
@Override
- public RemoteObjectAdapterPrx
- createObjectAdapter(String name, String endpts, Ice.Current current)
+ public RemoteObjectAdapterPrx createObjectAdapter(String name, String endpts, com.zeroc.Ice.Current current)
{
String endpoints = endpts;
if(endpoints.indexOf("-p") < 0)
@@ -27,23 +27,20 @@ public class RemoteCommunicatorI extends _RemoteCommunicatorDisp
"\" -p " + _nextPort++;
}
- Ice.Communicator com = current.adapter.getCommunicator();
+ com.zeroc.Ice.Communicator com = current.adapter.getCommunicator();
com.getProperties().setProperty(name + ".ThreadPool.Size", "1");
- Ice.ObjectAdapter adapter = com.createObjectAdapterWithEndpoints(name, endpoints);
- return RemoteObjectAdapterPrxHelper.uncheckedCast(
- current.adapter.addWithUUID(new RemoteObjectAdapterI(adapter)));
+ com.zeroc.Ice.ObjectAdapter adapter = com.createObjectAdapterWithEndpoints(name, endpoints);
+ return RemoteObjectAdapterPrx.uncheckedCast(current.adapter.addWithUUID(new RemoteObjectAdapterI(adapter)));
}
@Override
- public void
- deactivateObjectAdapter(RemoteObjectAdapterPrx adapter, Ice.Current current)
+ public void deactivateObjectAdapter(RemoteObjectAdapterPrx adapter, com.zeroc.Ice.Current current)
{
adapter.deactivate(); // Collocated call.
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
diff --git a/java/test/src/main/java/test/Ice/binding/RemoteObjectAdapterI.java b/java/test/src/main/java/test/Ice/binding/RemoteObjectAdapterI.java
index 51aa5b24c84..20d32719293 100644
--- a/java/test/src/main/java/test/Ice/binding/RemoteObjectAdapterI.java
+++ b/java/test/src/main/java/test/Ice/binding/RemoteObjectAdapterI.java
@@ -10,40 +10,36 @@
package test.Ice.binding;
import test.Ice.binding.Test.TestIntfPrx;
-import test.Ice.binding.Test.TestIntfPrxHelper;
-import test.Ice.binding.Test._RemoteObjectAdapterDisp;
+import test.Ice.binding.Test.RemoteObjectAdapter;
-public class RemoteObjectAdapterI extends _RemoteObjectAdapterDisp
+public class RemoteObjectAdapterI implements RemoteObjectAdapter
{
- public
- RemoteObjectAdapterI(Ice.ObjectAdapter adapter)
+ public RemoteObjectAdapterI(com.zeroc.Ice.ObjectAdapter adapter)
{
_adapter = adapter;
- _testIntf = TestIntfPrxHelper.uncheckedCast(_adapter.add(new TestI(),
- Ice.Util.stringToIdentity("test")));
+ _testIntf = TestIntfPrx.uncheckedCast(_adapter.add(new TestI(),
+ com.zeroc.Ice.Util.stringToIdentity("test")));
_adapter.activate();
}
@Override
- public TestIntfPrx
- getTestIntf(Ice.Current current)
+ public TestIntfPrx getTestIntf(com.zeroc.Ice.Current current)
{
return _testIntf;
}
@Override
- public void
- deactivate(Ice.Current current)
+ public void deactivate(com.zeroc.Ice.Current current)
{
try
{
_adapter.destroy();
}
- catch(Ice.ObjectAdapterDeactivatedException ex)
+ catch(com.zeroc.Ice.ObjectAdapterDeactivatedException ex)
{
}
}
- final Ice.ObjectAdapter _adapter;
+ final com.zeroc.Ice.ObjectAdapter _adapter;
final TestIntfPrx _testIntf;
-};
+}
diff --git a/java/test/src/main/java/test/Ice/binding/Server.java b/java/test/src/main/java/test/Ice/binding/Server.java
index 104b7e1eb03..1e950456eb9 100644
--- a/java/test/src/main/java/test/Ice/binding/Server.java
+++ b/java/test/src/main/java/test/Ice/binding/Server.java
@@ -12,12 +12,11 @@ package test.Ice.binding;
public class Server extends test.Util.Application
{
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Identity id = Ice.Util.stringToIdentity("communicator");
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.Identity id = com.zeroc.Ice.Util.stringToIdentity("communicator");
adapter.add(new RemoteCommunicatorI(), id);
adapter.activate();
@@ -25,17 +24,15 @@ public class Server extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.binding");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.binding");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ return r;
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
Server app = new Server();
int result = app.main("Server", args);
diff --git a/java/test/src/main/java/test/Ice/binding/TestI.java b/java/test/src/main/java/test/Ice/binding/TestI.java
index 2f9780da792..db269b26999 100644
--- a/java/test/src/main/java/test/Ice/binding/TestI.java
+++ b/java/test/src/main/java/test/Ice/binding/TestI.java
@@ -8,17 +8,17 @@
// **********************************************************************
package test.Ice.binding;
-import test.Ice.binding.Test._TestIntfDisp;
-public class TestI extends _TestIntfDisp
+import test.Ice.binding.Test.TestIntf;
+
+public class TestI implements TestIntf
{
TestI()
{
}
@Override
- public String
- getAdapterName(Ice.Current current)
+ public String getAdapterName(com.zeroc.Ice.Current current)
{
return current.adapter.getName();
}
diff --git a/java/test/src/main/java/test/Ice/checksum/AllTests.java b/java/test/src/main/java/test/Ice/checksum/AllTests.java
index 5145912b376..67980ce1e85 100644
--- a/java/test/src/main/java/test/Ice/checksum/AllTests.java
+++ b/java/test/src/main/java/test/Ice/checksum/AllTests.java
@@ -14,8 +14,7 @@ import test.Ice.checksum.Test.*;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -23,14 +22,13 @@ public class AllTests
}
}
- public static ChecksumPrx
- allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out)
+ public static ChecksumPrx allTests(com.zeroc.Ice.Communicator communicator, boolean collocated, PrintWriter out)
{
String ref = "test:default -p 12010";
- Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref);
test(base != null);
- ChecksumPrx checksum = ChecksumPrxHelper.checkedCast(base);
+ ChecksumPrx checksum = ChecksumPrx.checkedCast(base);
test(checksum != null);
//
diff --git a/java/test/src/main/java/test/Ice/checksum/ChecksumI.java b/java/test/src/main/java/test/Ice/checksum/ChecksumI.java
index 3ce9a475e0e..3993f3e39b0 100644
--- a/java/test/src/main/java/test/Ice/checksum/ChecksumI.java
+++ b/java/test/src/main/java/test/Ice/checksum/ChecksumI.java
@@ -11,23 +11,20 @@ package test.Ice.checksum;
import test.Ice.checksum.server.Test.*;
-public final class ChecksumI extends _ChecksumDisp
+public final class ChecksumI implements Checksum
{
- public
- ChecksumI()
+ public ChecksumI()
{
}
@Override
- public java.util.Map<String, String>
- getSliceChecksums(Ice.Current current)
+ public java.util.Map<String, String> getSliceChecksums(com.zeroc.Ice.Current current)
{
return SliceChecksums.checksums;
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
diff --git a/java/test/src/main/java/test/Ice/checksum/Client.java b/java/test/src/main/java/test/Ice/checksum/Client.java
index c98eacbdab3..335fc5f2265 100644
--- a/java/test/src/main/java/test/Ice/checksum/Client.java
+++ b/java/test/src/main/java/test/Ice/checksum/Client.java
@@ -14,27 +14,23 @@ import test.Ice.checksum.Test.ChecksumPrx;
public class Client extends test.Util.Application
{
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.Communicator communicator = communicator();
ChecksumPrx checksum = AllTests.allTests(communicator, false, getWriter());
checksum.shutdown();
return 0;
}
-
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.checksum");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.checksum");
+ return r;
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
Client c = new Client();
int status = c.main("Client", args);
diff --git a/java/test/src/main/java/test/Ice/checksum/Server.java b/java/test/src/main/java/test/Ice/checksum/Server.java
index dffecaff213..bc8b0437b80 100644
--- a/java/test/src/main/java/test/Ice/checksum/Server.java
+++ b/java/test/src/main/java/test/Ice/checksum/Server.java
@@ -12,29 +12,26 @@ package test.Ice.checksum;
public class Server extends test.Util.Application
{
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.Communicator communicator = communicator();
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Object object = new ChecksumI();
- adapter.add(object, Ice.Util.stringToIdentity("test"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.Object object = new ChecksumI();
+ adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("test"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.checksum.server");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.checksum.server");
+ return r;
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
Server c = new Server();
int status = c.main("Server", args);
diff --git a/java/test/src/main/java/test/Ice/classLoader/AbstractClassI.java b/java/test/src/main/java/test/Ice/classLoader/AbstractClassI.java
index 5206642fb7c..3ca0b3aa5d1 100644
--- a/java/test/src/main/java/test/Ice/classLoader/AbstractClassI.java
+++ b/java/test/src/main/java/test/Ice/classLoader/AbstractClassI.java
@@ -13,9 +13,4 @@ import test.Ice.classLoader.Test.AbstractClass;
class AbstractClassI extends AbstractClass
{
- @Override
- public void
- op(Ice.Current current)
- {
- }
}
diff --git a/java/test/src/main/java/test/Ice/classLoader/AllTests.java b/java/test/src/main/java/test/Ice/classLoader/AllTests.java
index f22fa4b816d..bb40bf214d3 100644
--- a/java/test/src/main/java/test/Ice/classLoader/AllTests.java
+++ b/java/test/src/main/java/test/Ice/classLoader/AllTests.java
@@ -15,15 +15,14 @@ import test.Ice.classLoader.Test.AbstractClass;
import test.Ice.classLoader.Test.ConcreteClass;
import test.Ice.classLoader.Test.E;
import test.Ice.classLoader.Test.InitialPrx;
-import test.Ice.classLoader.Test.InitialPrxHelper;
import test.Util.Application;
public class AllTests
{
- private static class MyValueFactory implements Ice.ValueFactory
+ private static class MyValueFactory implements com.zeroc.Ice.ValueFactory
{
@Override
- public Ice.Object create(String type)
+ public com.zeroc.Ice.Value create(String type)
{
if(type.equals("::Test::AbstractClass"))
{
@@ -37,7 +36,8 @@ public class AllTests
private static class MyClassLoader extends ClassLoader
{
- MyClassLoader(ClassLoader parent) {
+ MyClassLoader(ClassLoader parent)
+ {
super(parent);
}
@@ -59,11 +59,10 @@ public class AllTests
return _names.contains(name);
}
- private java.util.List<String> _names = new java.util.LinkedList<String>();
+ private java.util.List<String> _names = new java.util.LinkedList<>();
}
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -71,10 +70,9 @@ public class AllTests
}
}
- public static void
- allTests(Application app, boolean collocated)
+ public static void allTests(Application app, boolean collocated)
{
- Ice.Communicator communicator = app.communicator();
+ com.zeroc.Ice.Communicator communicator = app.communicator();
PrintWriter out = app.getWriter();
//
@@ -83,11 +81,11 @@ public class AllTests
{
out.print("testing package... ");
out.flush();
- Ice.InitializationData initData = app.createInitializationData();
+ com.zeroc.Ice.InitializationData initData = app.createInitializationData();
initData.properties = communicator.getProperties()._clone();
MyClassLoader classLoader = new MyClassLoader(initData.classLoader);
initData.classLoader = classLoader;
- Ice.Communicator ic = app.initialize(initData);
+ com.zeroc.Ice.Communicator ic = app.initialize(initData);
test(classLoader.check("test.Ice.classLoader.Test._Marker"));
ic.destroy();
out.println("ok");
@@ -99,12 +97,12 @@ public class AllTests
{
out.print("testing plug-in... ");
out.flush();
- Ice.InitializationData initData = app.createInitializationData();
+ com.zeroc.Ice.InitializationData initData = app.createInitializationData();
initData.properties = communicator.getProperties()._clone();
initData.properties.setProperty("Ice.Plugin.Test", "test.Ice.classLoader.PluginFactoryI");
MyClassLoader classLoader = new MyClassLoader(initData.classLoader);
initData.classLoader = classLoader;
- Ice.Communicator ic = app.initialize(initData);
+ com.zeroc.Ice.Communicator ic = app.initialize(initData);
test(classLoader.check("test.Ice.classLoader.PluginFactoryI"));
ic.destroy();
out.println("ok");
@@ -117,13 +115,13 @@ public class AllTests
{
out.print("testing IceSSL certificate verifier and password callback... ");
out.flush();
- Ice.InitializationData initData = app.createInitializationData();
+ com.zeroc.Ice.InitializationData initData = app.createInitializationData();
initData.properties = communicator.getProperties()._clone();
initData.properties.setProperty("IceSSL.CertVerifier", "test.Ice.classLoader.CertificateVerifierI");
initData.properties.setProperty("IceSSL.PasswordCallback", "test.Ice.classLoader.PasswordCallbackI");
MyClassLoader classLoader = new MyClassLoader(initData.classLoader);
initData.classLoader = classLoader;
- Ice.Communicator ic = app.initialize(initData);
+ com.zeroc.Ice.Communicator ic = app.initialize(initData);
test(classLoader.check("test.Ice.classLoader.CertificateVerifierI"));
test(classLoader.check("test.Ice.classLoader.PasswordCallbackI"));
ic.destroy();
@@ -134,17 +132,17 @@ public class AllTests
// Marshaling tests.
//
{
- Ice.InitializationData initData = app.createInitializationData();
+ com.zeroc.Ice.InitializationData initData = app.createInitializationData();
initData.properties = communicator.getProperties()._clone();
MyClassLoader classLoader = new MyClassLoader(initData.classLoader);
initData.classLoader = classLoader;
- Ice.Communicator ic = app.initialize(initData);
+ com.zeroc.Ice.Communicator ic = app.initialize(initData);
String ref = "initial:default -p 12010";
- Ice.ObjectPrx base = ic.stringToProxy(ref);
+ com.zeroc.Ice.ObjectPrx base = ic.stringToProxy(ref);
test(base != null);
- InitialPrx initial = InitialPrxHelper.checkedCast(base);
+ InitialPrx initial = InitialPrx.checkedCast(base);
test(initial != null);
//
@@ -173,7 +171,7 @@ public class AllTests
{
initial.getAbstractClass();
}
- catch(Ice.NoValueFactoryException ex)
+ catch(com.zeroc.Ice.NoValueFactoryException ex)
{
// Expected.
}
diff --git a/java/test/src/main/java/test/Ice/classLoader/CertificateVerifierI.java b/java/test/src/main/java/test/Ice/classLoader/CertificateVerifierI.java
index 4555951c3b5..53d7b263baa 100644
--- a/java/test/src/main/java/test/Ice/classLoader/CertificateVerifierI.java
+++ b/java/test/src/main/java/test/Ice/classLoader/CertificateVerifierI.java
@@ -9,10 +9,10 @@
package test.Ice.classLoader;
-public class CertificateVerifierI implements IceSSL.CertificateVerifier
+public class CertificateVerifierI implements com.zeroc.IceSSL.CertificateVerifier
{
@Override
- public boolean verify(IceSSL.NativeConnectionInfo info)
+ public boolean verify(com.zeroc.IceSSL.NativeConnectionInfo info)
{
return true;
}
diff --git a/java/test/src/main/java/test/Ice/classLoader/Client.java b/java/test/src/main/java/test/Ice/classLoader/Client.java
index 6bf2e795ca7..d98409a0d1a 100644
--- a/java/test/src/main/java/test/Ice/classLoader/Client.java
+++ b/java/test/src/main/java/test/Ice/classLoader/Client.java
@@ -19,12 +19,12 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- _initData = createInitializationData();
- _initData.properties = Ice.Util.createProperties(argsH);
+ GetInitDataResult r = super.getInitData(args);
+ _initData = r.initData;
_initData.properties.setProperty("Ice.Package.Test", "test.Ice.classLoader");
- return _initData;
+ return r;
}
public static void main(String[] args)
@@ -35,5 +35,5 @@ public class Client extends test.Util.Application
System.exit(result);
}
- private Ice.InitializationData _initData;
+ private com.zeroc.Ice.InitializationData _initData;
}
diff --git a/java/test/src/main/java/test/Ice/classLoader/InitialI.java b/java/test/src/main/java/test/Ice/classLoader/InitialI.java
index b360c3d84b1..5b3c5cd673d 100644
--- a/java/test/src/main/java/test/Ice/classLoader/InitialI.java
+++ b/java/test/src/main/java/test/Ice/classLoader/InitialI.java
@@ -12,44 +12,39 @@ package test.Ice.classLoader;
import test.Ice.classLoader.Test.AbstractClass;
import test.Ice.classLoader.Test.ConcreteClass;
import test.Ice.classLoader.Test.E;
-import test.Ice.classLoader.Test._InitialDisp;
+import test.Ice.classLoader.Test.Initial;
-public final class InitialI extends _InitialDisp
+public final class InitialI implements Initial
{
- public
- InitialI(Ice.ObjectAdapter adapter)
+ public InitialI(com.zeroc.Ice.ObjectAdapter adapter)
{
_adapter = adapter;
}
@Override
- public ConcreteClass
- getConcreteClass(Ice.Current current)
+ public ConcreteClass getConcreteClass(com.zeroc.Ice.Current current)
{
return new ConcreteClass();
}
@Override
- public AbstractClass
- getAbstractClass(Ice.Current current)
+ public AbstractClass getAbstractClass(com.zeroc.Ice.Current current)
{
return new AbstractClassI();
}
@Override
- public void
- throwException(Ice.Current current)
+ public void throwException(com.zeroc.Ice.Current current)
throws E
{
throw new E();
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
_adapter.getCommunicator().shutdown();
}
- private Ice.ObjectAdapter _adapter;
+ private com.zeroc.Ice.ObjectAdapter _adapter;
}
diff --git a/java/test/src/main/java/test/Ice/classLoader/PasswordCallbackI.java b/java/test/src/main/java/test/Ice/classLoader/PasswordCallbackI.java
index 48c7e6009b7..a12f6d14409 100644
--- a/java/test/src/main/java/test/Ice/classLoader/PasswordCallbackI.java
+++ b/java/test/src/main/java/test/Ice/classLoader/PasswordCallbackI.java
@@ -9,7 +9,7 @@
package test.Ice.classLoader;
-public class PasswordCallbackI implements IceSSL.PasswordCallback
+public class PasswordCallbackI implements com.zeroc.IceSSL.PasswordCallback
{
@Override
public char[] getPassword(String alias)
diff --git a/java/test/src/main/java/test/Ice/classLoader/PluginFactoryI.java b/java/test/src/main/java/test/Ice/classLoader/PluginFactoryI.java
index a6ff043bc85..5bd166208c5 100644
--- a/java/test/src/main/java/test/Ice/classLoader/PluginFactoryI.java
+++ b/java/test/src/main/java/test/Ice/classLoader/PluginFactoryI.java
@@ -9,9 +9,9 @@
package test.Ice.classLoader;
-public class PluginFactoryI implements Ice.PluginFactory
+public class PluginFactoryI implements com.zeroc.Ice.PluginFactory
{
- static class PluginI implements Ice.Plugin
+ static class PluginI implements com.zeroc.Ice.Plugin
{
@Override
public void initialize()
@@ -25,7 +25,7 @@ public class PluginFactoryI implements Ice.PluginFactory
}
@Override
- public Ice.Plugin create(Ice.Communicator communicator, String name, String[] args)
+ public com.zeroc.Ice.Plugin create(com.zeroc.Ice.Communicator communicator, String name, String[] args)
{
return new PluginI();
}
diff --git a/java/test/src/main/java/test/Ice/classLoader/Server.java b/java/test/src/main/java/test/Ice/classLoader/Server.java
index aef65c14aa3..ba93de5f20a 100644
--- a/java/test/src/main/java/test/Ice/classLoader/Server.java
+++ b/java/test/src/main/java/test/Ice/classLoader/Server.java
@@ -14,24 +14,23 @@ public class Server extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Object object = new InitialI(adapter);
- adapter.add(object, Ice.Util.stringToIdentity("initial"));
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.Object object = new InitialI(adapter);
+ adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("initial"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.classLoader");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- initData.properties.setProperty("Ice.Default.SlicedFormat", "1");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.classLoader");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ r.initData.properties.setProperty("Ice.Default.SlicedFormat", "1");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/custom/AllTests.java b/java/test/src/main/java/test/Ice/custom/AllTests.java
index a025deb4992..4087569b91d 100644
--- a/java/test/src/main/java/test/Ice/custom/AllTests.java
+++ b/java/test/src/main/java/test/Ice/custom/AllTests.java
@@ -23,31 +23,15 @@ import java.nio.LongBuffer;
import java.nio.FloatBuffer;
import java.nio.DoubleBuffer;
-import test.Ice.custom.Test.BoolSeqHolder;
-import test.Ice.custom.Test.ByteSeqHolder;
import test.Ice.custom.Test.C;
-import test.Ice.custom.Test.CArrayHolder;
-import test.Ice.custom.Test.CListHolder;
-import test.Ice.custom.Test.CSeqHolder;
-import test.Ice.custom.Test.DSeqHolder;
-import test.Ice.custom.Test.DoubleSeqHolder;
import test.Ice.custom.Test.E;
-import test.Ice.custom.Test.ESeqHolder;
-import test.Ice.custom.Test.FloatSeqHolder;
-import test.Ice.custom.Test.IntSeqHolder;
-import test.Ice.custom.Test.LongSeqHolder;
import test.Ice.custom.Test.S;
-import test.Ice.custom.Test.SSeqHolder;
-import test.Ice.custom.Test.ShortSeqHolder;
-import test.Ice.custom.Test.StringSeqHolder;
-import test.Ice.custom.Test.StringSeqSeqHolder;
+import test.Ice.custom.Test.TestIntf;
import test.Ice.custom.Test.TestIntfPrx;
-import test.Ice.custom.Test.TestIntfPrxHelper;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -55,19 +39,18 @@ public class AllTests
}
}
- public static TestIntfPrx
- allTests(Ice.Communicator communicator, PrintWriter out)
+ public static TestIntfPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out)
{
out.print("testing stringToProxy... ");
out.flush();
String ref = "test:default -p 12010";
- Ice.ObjectPrx obj = communicator.stringToProxy(ref);
+ com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(ref);
test(obj != null);
out.println("ok");
out.print("testing checked cast... ");
out.flush();
- TestIntfPrx t = TestIntfPrxHelper.checkedCast(obj);
+ TestIntfPrx t = TestIntfPrx.checkedCast(obj);
test(t != null);
test(t.equals(obj));
out.println("ok");
@@ -90,121 +73,109 @@ public class AllTests
// Invoke each operation and verify that the returned sequences have the same
// structure as the original.
//
- CSeqHolder seqH = new CSeqHolder();
- C[] seqR = t.opCSeq(seq, seqH);
- test(seqR.length == seq.length);
- test(seqH.value.length == seq.length);
+ TestIntf.OpCSeqResult seqR = t.opCSeq(seq);
+ test(seqR.returnValue.length == seq.length);
+ test(seqR.outSeq.length == seq.length);
for(int i = 1; i < seq.length; i++)
{
- test(seqR[i] != null);
- test(seqR[i] == seqR[0]);
- test(seqR[i] == seqH.value[i]);
+ test(seqR.returnValue[i] != null);
+ test(seqR.returnValue[i] == seqR.returnValue[0]);
+ test(seqR.returnValue[i] == seqR.outSeq[i]);
}
- ArrayList<C> arr = new ArrayList<C>(Arrays.asList(seq));
- CArrayHolder arrH = new CArrayHolder();
- List<C> arrR = t.opCArray(arr, arrH);
- test(arrR.size() == arr.size());
- test(arrH.value.size() == arr.size());
+ ArrayList<C> arr = new ArrayList<>(Arrays.asList(seq));
+ TestIntf.OpCArrayResult arrR = t.opCArray(arr);
+ test(arrR.returnValue.size() == arr.size());
+ test(arrR.outSeq.size() == arr.size());
for(int i = 1; i < arr.size(); i++)
{
- test(arrR.get(i) != null);
- test(arrR.get(i) == arrR.get(0));
- test(arrR.get(i) == arrH.value.get(i));
+ test(arrR.returnValue.get(i) != null);
+ test(arrR.returnValue.get(i) == arrR.returnValue.get(0));
+ test(arrR.returnValue.get(i) == arrR.outSeq.get(i));
}
- LinkedList<C> list = new LinkedList<C>(Arrays.asList(seq));
- CListHolder listH = new CListHolder();
- List<C> listR = t.opCList(list, listH);
- test(listR.size() == list.size());
- test(listH.value.size() == list.size());
+ LinkedList<C> list = new LinkedList<>(Arrays.asList(seq));
+ TestIntf.OpCListResult listR = t.opCList(list);
+ test(listR.returnValue.size() == list.size());
+ test(listR.outSeq.size() == list.size());
for(int i = 1; i < list.size(); i++)
{
- test(listR.get(i) != null);
- test(listR.get(i) == listR.get(0));
- test(listR.get(i) == listH.value.get(i));
+ test(listR.returnValue.get(i) != null);
+ test(listR.returnValue.get(i) == listR.returnValue.get(0));
+ test(listR.returnValue.get(i) == listR.outSeq.get(i));
}
}
{
final Boolean[] seq = { Boolean.TRUE, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, Boolean.TRUE };
- ArrayList<Boolean> list = new ArrayList<Boolean>(Arrays.asList(seq));
- BoolSeqHolder listH = new BoolSeqHolder();
- List<Boolean> listR = t.opBoolSeq(list, listH);
- test(listH.value.equals(listR));
- test(listH.value.equals(list));
+ ArrayList<Boolean> list = new ArrayList<>(Arrays.asList(seq));
+ TestIntf.OpBoolSeqResult listR = t.opBoolSeq(list);
+ test(listR.outSeq.equals(listR.returnValue));
+ test(listR.outSeq.equals(list));
}
{
final Byte[] seq = { new Byte((byte)0), new Byte((byte)1), new Byte((byte)2), new Byte((byte)3) };
- ArrayList<Byte> list = new ArrayList<Byte>(Arrays.asList(seq));
- ByteSeqHolder listH = new ByteSeqHolder();
- List<Byte> listR = t.opByteSeq(list, listH);
- test(listH.value.equals(listR));
- test(listH.value.equals(list));
+ ArrayList<Byte> list = new ArrayList<>(Arrays.asList(seq));
+ TestIntf.OpByteSeqResult listR = t.opByteSeq(list);
+ test(listR.outSeq.equals(listR.returnValue));
+ test(listR.outSeq.equals(list));
}
{
final Short[] seq = { new Short((short)0), new Short((short)1), new Short((short)2), new Short((short)3) };
- ArrayList<Short> list = new ArrayList<Short>(Arrays.asList(seq));
- ShortSeqHolder listH = new ShortSeqHolder();
- List<Short> listR = t.opShortSeq(list, listH);
- test(listH.value.equals(listR));
- test(listH.value.equals(list));
+ ArrayList<Short> list = new ArrayList<>(Arrays.asList(seq));
+ TestIntf.OpShortSeqResult listR = t.opShortSeq(list);
+ test(listR.outSeq.equals(listR.returnValue));
+ test(listR.outSeq.equals(list));
}
{
final Integer[] seq = { new Integer(0), new Integer(1), new Integer(2), new Integer(3) };
- ArrayList<Integer> list = new ArrayList<Integer>(Arrays.asList(seq));
- IntSeqHolder listH = new IntSeqHolder();
- List<Integer> listR = t.opIntSeq(list, listH);
- test(listH.value.equals(listR));
- test(listH.value.equals(list));
+ ArrayList<Integer> list = new ArrayList<>(Arrays.asList(seq));
+ TestIntf.OpIntSeqResult listR = t.opIntSeq(list);
+ test(listR.outSeq.equals(listR.returnValue));
+ test(listR.outSeq.equals(list));
}
{
final Long[] seq = { new Long(0), new Long(1), new Long(2), new Long(3) };
- ArrayList<Long> list = new ArrayList<Long>(Arrays.asList(seq));
- LongSeqHolder listH = new LongSeqHolder();
- List<Long> listR = t.opLongSeq(list, listH);
- test(listH.value.equals(listR));
- test(listH.value.equals(list));
+ ArrayList<Long> list = new ArrayList<>(Arrays.asList(seq));
+ TestIntf.OpLongSeqResult listR = t.opLongSeq(list);
+ test(listR.outSeq.equals(listR.returnValue));
+ test(listR.outSeq.equals(list));
}
{
final Float[] seq = { new Float(0), new Float(1), new Float(2), new Float(3) };
- ArrayList<Float> list = new ArrayList<Float>(Arrays.asList(seq));
- FloatSeqHolder listH = new FloatSeqHolder();
- List<Float> listR = t.opFloatSeq(list, listH);
- test(listH.value.equals(listR));
- test(listH.value.equals(list));
+ ArrayList<Float> list = new ArrayList<>(Arrays.asList(seq));
+ TestIntf.OpFloatSeqResult listR = t.opFloatSeq(list);
+ test(listR.outSeq.equals(listR.returnValue));
+ test(listR.outSeq.equals(list));
}
{
final Double[] seq = { new Double(0), new Double(1), new Double(2), new Double(3) };
- ArrayList<Double> list = new ArrayList<Double>(Arrays.asList(seq));
- DoubleSeqHolder listH = new DoubleSeqHolder();
- List<Double> listR = t.opDoubleSeq(list, listH);
- test(listH.value.equals(listR));
- test(listH.value.equals(list));
+ ArrayList<Double> list = new ArrayList<>(Arrays.asList(seq));
+ TestIntf.OpDoubleSeqResult listR = t.opDoubleSeq(list);
+ test(listR.outSeq.equals(listR.returnValue));
+ test(listR.outSeq.equals(list));
}
{
final String[] seq = { "0", "1", "2", "3", "4" };
- ArrayList<String> list = new ArrayList<String>(Arrays.asList(seq));
- StringSeqHolder listH = new StringSeqHolder();
- List<String> listR = t.opStringSeq(list, listH);
- test(listH.value.equals(listR));
- test(listH.value.equals(list));
+ ArrayList<String> list = new ArrayList<>(Arrays.asList(seq));
+ TestIntf.OpStringSeqResult listR = t.opStringSeq(list);
+ test(listR.outSeq.equals(listR.returnValue));
+ test(listR.outSeq.equals(list));
}
{
final E[] seq = { E.E1, E.E2, E.E3 };
- ArrayList<E> list = new ArrayList<E>(Arrays.asList(seq));
- ESeqHolder listH = new ESeqHolder();
- List<E> listR = t.opESeq(list, listH);
- test(listH.value.equals(listR));
- test(listH.value.equals(list));
+ ArrayList<E> list = new ArrayList<>(Arrays.asList(seq));
+ TestIntf.OpESeqResult listR = t.opESeq(list);
+ test(listR.outSeq.equals(listR.returnValue));
+ test(listR.outSeq.equals(list));
}
{
@@ -214,41 +185,38 @@ public class AllTests
seq[i] = new S();
seq[i].en = E.values()[i % 3];
}
- ArrayList<S> list = new ArrayList<S>(Arrays.asList(seq));
- SSeqHolder listH = new SSeqHolder();
- List<S> listR = t.opSSeq(list, listH);
- test(listH.value.equals(listR));
- test(listH.value.equals(list));
+ ArrayList<S> list = new ArrayList<>(Arrays.asList(seq));
+ TestIntf.OpSSeqResult listR = t.opSSeq(list);
+ test(listR.outSeq.equals(listR.returnValue));
+ test(listR.outSeq.equals(list));
}
{
- ArrayList<Map<Integer, String>> list = new ArrayList<Map<Integer, String>>();
+ ArrayList<Map<Integer, String>> list = new ArrayList<>();
for(int i = 0; i < 5; i++)
{
- Map<Integer, String> m = new HashMap<Integer, String>();
+ Map<Integer, String> m = new HashMap<>();
for(int j = 0; j < 4; j++)
{
m.put(j, "" + j);
}
list.add(m);
}
- DSeqHolder listH = new DSeqHolder();
- List<Map<Integer, String>> listR = t.opDSeq(list, listH);
- test(listH.value.equals(listR));
- test(listH.value.equals(list));
+ TestIntf.OpDSeqResult listR = t.opDSeq(list);
+ test(listR.outSeq.equals(listR.returnValue));
+ test(listR.outSeq.equals(list));
}
{
- List<List<String>> seq = new LinkedList<List<String>>();
+ List<List<String>> seq = new LinkedList<>();
for(int i = 0; i < 5; i++)
{
final String[] arr = { "0", "1", "2", "3", "4" };
- seq.add(new ArrayList<String>(Arrays.asList(arr)));
+ seq.add(new ArrayList<>(Arrays.asList(arr)));
}
- StringSeqSeqHolder listH = new StringSeqSeqHolder();
- List<List<String>> listR = t.opStringSeqSeq(seq, listH);
- test(listH.value.equals(listR));
- test(listH.value.equals(seq));
+ TestIntf.OpStringSeqSeqResult listR = t.opStringSeqSeq(seq);
+ test(listR.outSeq.equals(listR.returnValue));
+ test(listR.outSeq.equals(seq));
}
{
@@ -256,14 +224,13 @@ public class AllTests
final byte[] usedSeq = new byte[] {2, 3, 4, 5};
ByteBuffer buffer = ByteBuffer.wrap(fullSeq, 2, 4);
- Ice.Holder<ByteBuffer> bufferH = new Ice.Holder<ByteBuffer>();
- ByteBuffer bufferR = t.opByteBufferSeq(buffer, bufferH);
+ TestIntf.OpByteBufferSeqResult bufferR = t.opByteBufferSeq(buffer);
- byte[] arr = new byte[bufferH.value.limit()];
- bufferH.value.get(arr, 0, bufferH.value.limit());
+ byte[] arr = new byte[bufferR.outSeq.limit()];
+ bufferR.outSeq.get(arr, 0, bufferR.outSeq.limit());
test(Arrays.equals(arr, usedSeq));
- arr = new byte[bufferR.limit()];
- bufferR.get(arr, 0, bufferR.limit());
+ arr = new byte[bufferR.returnValue.limit()];
+ bufferR.returnValue.get(arr, 0, bufferR.returnValue.limit());
test(Arrays.equals(arr, usedSeq));
}
@@ -272,14 +239,13 @@ public class AllTests
final short[] usedSeq = new short[] {2, 3, 4, 5};
ShortBuffer buffer = ShortBuffer.wrap(fullSeq, 2, 4);
- Ice.Holder<ShortBuffer> bufferH = new Ice.Holder<ShortBuffer>();
- ShortBuffer bufferR = t.opShortBufferSeq(buffer, bufferH);
+ TestIntf.OpShortBufferSeqResult bufferR = t.opShortBufferSeq(buffer);
- short[] arr = new short[bufferH.value.limit()];
- bufferH.value.get(arr, 0, bufferH.value.limit());
+ short[] arr = new short[bufferR.outSeq.limit()];
+ bufferR.outSeq.get(arr, 0, bufferR.outSeq.limit());
test(Arrays.equals(arr, usedSeq));
- arr = new short[bufferR.limit()];
- bufferR.get(arr, 0, bufferR.limit());
+ arr = new short[bufferR.returnValue.limit()];
+ bufferR.returnValue.get(arr, 0, bufferR.returnValue.limit());
test(Arrays.equals(arr, usedSeq));
}
@@ -288,14 +254,13 @@ public class AllTests
final int[] usedSeq = new int[] {2, 3, 4, 5};
IntBuffer buffer = IntBuffer.wrap(fullSeq, 2, 4);
- Ice.Holder<IntBuffer> bufferH = new Ice.Holder<IntBuffer>();
- IntBuffer bufferR = t.opIntBufferSeq(buffer, bufferH);
+ TestIntf.OpIntBufferSeqResult bufferR = t.opIntBufferSeq(buffer);
- int[] arr = new int[bufferH.value.limit()];
- bufferH.value.get(arr, 0, bufferH.value.limit());
+ int[] arr = new int[bufferR.outSeq.limit()];
+ bufferR.outSeq.get(arr, 0, bufferR.outSeq.limit());
test(Arrays.equals(arr, usedSeq));
- arr = new int[bufferR.limit()];
- bufferR.get(arr, 0, bufferR.limit());
+ arr = new int[bufferR.returnValue.limit()];
+ bufferR.returnValue.get(arr, 0, bufferR.returnValue.limit());
test(Arrays.equals(arr, usedSeq));
}
@@ -304,14 +269,13 @@ public class AllTests
final long[] usedSeq = new long[] {2L, 3L, 4L, 5L};
LongBuffer buffer = LongBuffer.wrap(fullSeq, 2, 4);
- Ice.Holder<LongBuffer> bufferH = new Ice.Holder<LongBuffer>();
- LongBuffer bufferR = t.opLongBufferSeq(buffer, bufferH);
+ TestIntf.OpLongBufferSeqResult bufferR = t.opLongBufferSeq(buffer);
- long[] arr = new long[bufferH.value.limit()];
- bufferH.value.get(arr, 0, bufferH.value.limit());
+ long[] arr = new long[bufferR.outSeq.limit()];
+ bufferR.outSeq.get(arr, 0, bufferR.outSeq.limit());
test(Arrays.equals(arr, usedSeq));
- arr = new long[bufferR.limit()];
- bufferR.get(arr, 0, bufferR.limit());
+ arr = new long[bufferR.returnValue.limit()];
+ bufferR.returnValue.get(arr, 0, bufferR.returnValue.limit());
test(Arrays.equals(arr, usedSeq));
}
@@ -320,14 +284,13 @@ public class AllTests
final float[] usedSeq = new float[] {2, 3, 4, 5};
FloatBuffer buffer = FloatBuffer.wrap(fullSeq, 2, 4);
- Ice.Holder<FloatBuffer> bufferH = new Ice.Holder<FloatBuffer>();
- FloatBuffer bufferR = t.opFloatBufferSeq(buffer, bufferH);
+ TestIntf.OpFloatBufferSeqResult bufferR = t.opFloatBufferSeq(buffer);
- float[] arr = new float[bufferH.value.limit()];
- bufferH.value.get(arr, 0, bufferH.value.limit());
+ float[] arr = new float[bufferR.outSeq.limit()];
+ bufferR.outSeq.get(arr, 0, bufferR.outSeq.limit());
test(Arrays.equals(arr, usedSeq));
- arr = new float[bufferR.limit()];
- bufferR.get(arr, 0, bufferR.limit());
+ arr = new float[bufferR.returnValue.limit()];
+ bufferR.returnValue.get(arr, 0, bufferR.returnValue.limit());
test(Arrays.equals(arr, usedSeq));
}
@@ -336,14 +299,13 @@ public class AllTests
final double[] usedSeq = new double[] {2, 3, 4, 5};
DoubleBuffer buffer = DoubleBuffer.wrap(fullSeq, 2, 4);
- Ice.Holder<DoubleBuffer> bufferH = new Ice.Holder<DoubleBuffer>();
- DoubleBuffer bufferR = t.opDoubleBufferSeq(buffer, bufferH);
+ TestIntf.OpDoubleBufferSeqResult bufferR = t.opDoubleBufferSeq(buffer);
- double[] arr = new double[bufferH.value.limit()];
- bufferH.value.get(arr, 0, bufferH.value.limit());
+ double[] arr = new double[bufferR.outSeq.limit()];
+ bufferR.outSeq.get(arr, 0, bufferR.outSeq.limit());
test(Arrays.equals(arr, usedSeq));
- arr = new double[bufferR.limit()];
- bufferR.get(arr, 0, bufferR.limit());
+ arr = new double[bufferR.returnValue.limit()];
+ bufferR.returnValue.get(arr, 0, bufferR.returnValue.limit());
test(Arrays.equals(arr, usedSeq));
}
diff --git a/java/test/src/main/java/test/Ice/custom/Client.java b/java/test/src/main/java/test/Ice/custom/Client.java
index 90ec943086b..59a214bd855 100644
--- a/java/test/src/main/java/test/Ice/custom/Client.java
+++ b/java/test/src/main/java/test/Ice/custom/Client.java
@@ -16,20 +16,19 @@ public class Client extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.Communicator communicator = communicator();
TestIntfPrx test = AllTests.allTests(communicator, getWriter());
test.shutdown();
return 0;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom");
- initData.properties.setProperty("Ice.CacheMessageBuffers", "0");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom");
+ r.initData.properties.setProperty("Ice.CacheMessageBuffers", "0");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/custom/Collocated.java b/java/test/src/main/java/test/Ice/custom/Collocated.java
index 2c1e7b251f1..35c9013250d 100644
--- a/java/test/src/main/java/test/Ice/custom/Collocated.java
+++ b/java/test/src/main/java/test/Ice/custom/Collocated.java
@@ -14,10 +14,10 @@ public class Collocated extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Object test = new TestI(communicator);
- adapter.add(test, Ice.Util.stringToIdentity("test"));
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.Object test = new TestI(communicator);
+ adapter.add(test, com.zeroc.Ice.Util.stringToIdentity("test"));
AllTests.allTests(communicator, getWriter());
@@ -25,14 +25,13 @@ public class Collocated extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- initData.properties.setProperty("Ice.CacheMessageBuffers", "0");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ r.initData.properties.setProperty("Ice.CacheMessageBuffers", "0");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/custom/Server.java b/java/test/src/main/java/test/Ice/custom/Server.java
index 8a4da565414..2d73b389827 100644
--- a/java/test/src/main/java/test/Ice/custom/Server.java
+++ b/java/test/src/main/java/test/Ice/custom/Server.java
@@ -14,10 +14,10 @@ public class Server extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Object test = new TestI(communicator);
- adapter.add(test, Ice.Util.stringToIdentity("test"));
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.Object test = new TestI(communicator);
+ adapter.add(test, com.zeroc.Ice.Util.stringToIdentity("test"));
adapter.activate();
@@ -25,14 +25,13 @@ public class Server extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- initData.properties.setProperty("Ice.CacheMessageBuffers", "0");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ r.initData.properties.setProperty("Ice.CacheMessageBuffers", "0");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/custom/TestI.java b/java/test/src/main/java/test/Ice/custom/TestI.java
index 6ce5451516f..2393f30932a 100644
--- a/java/test/src/main/java/test/Ice/custom/TestI.java
+++ b/java/test/src/main/java/test/Ice/custom/TestI.java
@@ -20,222 +20,186 @@ import java.nio.LongBuffer;
import java.nio.FloatBuffer;
import java.nio.DoubleBuffer;
-import test.Ice.custom.Test.BoolSeqHolder;
-import test.Ice.custom.Test.ByteSeqHolder;
import test.Ice.custom.Test.C;
-import test.Ice.custom.Test.CArrayHolder;
-import test.Ice.custom.Test.CListHolder;
-import test.Ice.custom.Test.CSeqHolder;
-import test.Ice.custom.Test.DSeqHolder;
-import test.Ice.custom.Test.DoubleSeqHolder;
import test.Ice.custom.Test.E;
-import test.Ice.custom.Test.ESeqHolder;
-import test.Ice.custom.Test.FloatSeqHolder;
-import test.Ice.custom.Test.IntSeqHolder;
-import test.Ice.custom.Test.LongSeqHolder;
import test.Ice.custom.Test.S;
-import test.Ice.custom.Test.SSeqHolder;
-import test.Ice.custom.Test.ShortSeqHolder;
-import test.Ice.custom.Test.StringSeqHolder;
-import test.Ice.custom.Test.StringSeqSeqHolder;
import test.Ice.custom.Test.TestIntf;
+import test.Ice.custom.Test._TestIntfDisp;
-public final class TestI extends TestIntf
+public final class TestI implements _TestIntfDisp
{
- public
- TestI(Ice.Communicator communicator)
+ public TestI(com.zeroc.Ice.Communicator communicator)
{
_communicator = communicator;
}
@Override
- public List<C>
- opCArray(List<C> inSeq, CArrayHolder outSeq, Ice.Current current)
+ public TestIntf.OpCArrayResult opCArray(List<C> inSeq, com.zeroc.Ice.Current current)
{
- outSeq.value = inSeq;
- return inSeq;
+ return new TestIntf.OpCArrayResult(inSeq, inSeq);
}
@Override
- public List<C>
- opCList(List<C> inSeq, CListHolder outSeq, Ice.Current current)
+ public TestIntf.OpCListResult opCList(List<C> inSeq, com.zeroc.Ice.Current current)
{
- outSeq.value = inSeq;
- return inSeq;
+ return new TestIntf.OpCListResult(inSeq, inSeq);
}
@Override
- public C[]
- opCSeq(C[] inSeq, CSeqHolder outSeq, Ice.Current current)
+ public TestIntf.OpCSeqResult opCSeq(C[] inSeq, com.zeroc.Ice.Current current)
{
- seq = new ArrayList<C>(Arrays.asList(inSeq));
- outSeq.value = new C[seq.size()];
- seq.toArray(outSeq.value);
- return outSeq.value;
+ TestIntf.OpCSeqResult r = new TestIntf.OpCSeqResult();
+ seq = new ArrayList<>(Arrays.asList(inSeq));
+ r.outSeq = new C[seq.size()];
+ seq.toArray(r.outSeq);
+ r.returnValue = r.outSeq;
+ return r;
}
@Override
- public List<Boolean>
- opBoolSeq(List<Boolean> inSeq, BoolSeqHolder outSeq, Ice.Current current)
+ public TestIntf.OpBoolSeqResult opBoolSeq(List<Boolean> inSeq, com.zeroc.Ice.Current current)
{
- outSeq.value = inSeq;
- return inSeq;
+ return new TestIntf.OpBoolSeqResult(inSeq, inSeq);
}
@Override
- public List<Byte>
- opByteSeq(List<Byte> inSeq, ByteSeqHolder outSeq, Ice.Current current)
+ public TestIntf.OpByteSeqResult opByteSeq(List<Byte> inSeq, com.zeroc.Ice.Current current)
{
- outSeq.value = inSeq;
- return inSeq;
+ return new TestIntf.OpByteSeqResult(inSeq, inSeq);
}
@Override
- public List<Map<Integer,String>>
- opDSeq(List<Map<Integer,String>> inSeq, DSeqHolder outSeq, Ice.Current current)
+ public TestIntf.OpDSeqResult opDSeq(List<Map<Integer,String>> inSeq, com.zeroc.Ice.Current current)
{
- outSeq.value = inSeq;
- return inSeq;
+ return new TestIntf.OpDSeqResult(inSeq, inSeq);
}
@Override
- public List<Double>
- opDoubleSeq(List<Double> inSeq, DoubleSeqHolder outSeq, Ice.Current current)
+ public TestIntf.OpDoubleSeqResult opDoubleSeq(List<Double> inSeq, com.zeroc.Ice.Current current)
{
- outSeq.value = inSeq;
- return inSeq;
+ return new TestIntf.OpDoubleSeqResult(inSeq, inSeq);
}
@Override
- public List<E>
- opESeq(List<E> inSeq, ESeqHolder outSeq, Ice.Current current)
+ public TestIntf.OpESeqResult opESeq(List<E> inSeq, com.zeroc.Ice.Current current)
{
- outSeq.value = inSeq;
- return inSeq;
+ return new TestIntf.OpESeqResult(inSeq, inSeq);
}
@Override
- public List<Float>
- opFloatSeq(List<Float> inSeq, FloatSeqHolder outSeq, Ice.Current current)
+ public TestIntf.OpFloatSeqResult opFloatSeq(List<Float> inSeq, com.zeroc.Ice.Current current)
{
- outSeq.value = inSeq;
- return inSeq;
+ return new TestIntf.OpFloatSeqResult(inSeq, inSeq);
}
@Override
- public List<Integer>
- opIntSeq(List<Integer> inSeq, IntSeqHolder outSeq, Ice.Current current)
+ public TestIntf.OpIntSeqResult opIntSeq(List<Integer> inSeq, com.zeroc.Ice.Current current)
{
- outSeq.value = inSeq;
- return inSeq;
+ return new TestIntf.OpIntSeqResult(inSeq, inSeq);
}
@Override
- public List<Long>
- opLongSeq(List<Long> inSeq, LongSeqHolder outSeq, Ice.Current current)
+ public TestIntf.OpLongSeqResult opLongSeq(List<Long> inSeq, com.zeroc.Ice.Current current)
{
- outSeq.value = inSeq;
- return inSeq;
+ return new TestIntf.OpLongSeqResult(inSeq, inSeq);
}
@Override
- public List<S>
- opSSeq(List<S> inSeq, SSeqHolder outSeq, Ice.Current current)
+ public TestIntf.OpSSeqResult opSSeq(List<S> inSeq, com.zeroc.Ice.Current current)
{
- outSeq.value = inSeq;
- return inSeq;
+ return new TestIntf.OpSSeqResult(inSeq, inSeq);
}
@Override
- public List<Short>
- opShortSeq(List<Short> inSeq, ShortSeqHolder outSeq, Ice.Current current)
+ public TestIntf.OpShortSeqResult opShortSeq(List<Short> inSeq, com.zeroc.Ice.Current current)
{
- outSeq.value = inSeq;
- return inSeq;
+ return new TestIntf.OpShortSeqResult(inSeq, inSeq);
}
@Override
- public List<String>
- opStringSeq(List<String> inSeq, StringSeqHolder outSeq, Ice.Current current)
+ public TestIntf.OpStringSeqResult opStringSeq(List<String> inSeq, com.zeroc.Ice.Current current)
{
- outSeq.value = inSeq;
- return inSeq;
+ return new TestIntf.OpStringSeqResult(inSeq, inSeq);
}
@Override
- public List<List<String>>
- opStringSeqSeq(List<List<String>> inSeq, StringSeqSeqHolder outSeq, Ice.Current current)
+ public TestIntf.OpStringSeqSeqResult opStringSeqSeq(List<List<String>> inSeq, com.zeroc.Ice.Current current)
{
- outSeq.value = inSeq;
- return inSeq;
+ return new TestIntf.OpStringSeqSeqResult(inSeq, inSeq);
}
@Override
- public ByteBuffer
- opByteBufferSeq(ByteBuffer inSeq, Ice.Holder<ByteBuffer> outSeq, Ice.Current current)
+ public TestIntf.OpByteBufferSeqResult opByteBufferSeq(ByteBuffer inSeq, com.zeroc.Ice.Current current)
{
+ TestIntf.OpByteBufferSeqResult r = new TestIntf.OpByteBufferSeqResult();
byte[] arr = new byte[inSeq.limit()];
inSeq.get(arr);
- outSeq.value = ByteBuffer.wrap(arr);
- return ByteBuffer.wrap(arr);
+ r.outSeq = ByteBuffer.wrap(arr);
+ r.returnValue = ByteBuffer.wrap(arr);
+ return r;
}
@Override
- public ShortBuffer
- opShortBufferSeq(ShortBuffer inSeq, Ice.Holder<ShortBuffer> outSeq, Ice.Current current)
+ public TestIntf.OpShortBufferSeqResult opShortBufferSeq(ShortBuffer inSeq, com.zeroc.Ice.Current current)
{
+ TestIntf.OpShortBufferSeqResult r = new TestIntf.OpShortBufferSeqResult();
short[] arr = new short[inSeq.limit()];
inSeq.get(arr);
- outSeq.value = ShortBuffer.wrap(arr);
- return ShortBuffer.wrap(arr);
+ r.outSeq = ShortBuffer.wrap(arr);
+ r.returnValue = ShortBuffer.wrap(arr);
+ return r;
}
@Override
- public IntBuffer
- opIntBufferSeq(IntBuffer inSeq, Ice.Holder<IntBuffer> outSeq, Ice.Current current)
+ public TestIntf.OpIntBufferSeqResult opIntBufferSeq(IntBuffer inSeq, com.zeroc.Ice.Current current)
{
+ TestIntf.OpIntBufferSeqResult r = new TestIntf.OpIntBufferSeqResult();
int[] arr = new int[inSeq.limit()];
inSeq.get(arr);
- outSeq.value = IntBuffer.wrap(arr);
- return IntBuffer.wrap(arr);
+ r.outSeq = IntBuffer.wrap(arr);
+ r.returnValue = IntBuffer.wrap(arr);
+ return r;
}
@Override
- public LongBuffer
- opLongBufferSeq(LongBuffer inSeq, Ice.Holder<LongBuffer> outSeq, Ice.Current current)
+ public TestIntf.OpLongBufferSeqResult opLongBufferSeq(LongBuffer inSeq, com.zeroc.Ice.Current current)
{
+ TestIntf.OpLongBufferSeqResult r = new TestIntf.OpLongBufferSeqResult();
long[] arr = new long[inSeq.limit()];
inSeq.get(arr);
- outSeq.value = LongBuffer.wrap(arr);
- return LongBuffer.wrap(arr);
+ r.outSeq = LongBuffer.wrap(arr);
+ r.returnValue = LongBuffer.wrap(arr);
+ return r;
}
@Override
- public FloatBuffer
- opFloatBufferSeq(FloatBuffer inSeq, Ice.Holder<FloatBuffer> outSeq, Ice.Current current)
+ public TestIntf.OpFloatBufferSeqResult opFloatBufferSeq(FloatBuffer inSeq, com.zeroc.Ice.Current current)
{
+ TestIntf.OpFloatBufferSeqResult r = new TestIntf.OpFloatBufferSeqResult();
float[] arr = new float[inSeq.limit()];
inSeq.get(arr);
- outSeq.value = FloatBuffer.wrap(arr);
- return FloatBuffer.wrap(arr);
+ r.outSeq = FloatBuffer.wrap(arr);
+ r.returnValue = FloatBuffer.wrap(arr);
+ return r;
}
@Override
- public DoubleBuffer
- opDoubleBufferSeq(DoubleBuffer inSeq, Ice.Holder<DoubleBuffer> outSeq, Ice.Current current)
+ public TestIntf.OpDoubleBufferSeqResult opDoubleBufferSeq(DoubleBuffer inSeq, com.zeroc.Ice.Current current)
{
+ TestIntf.OpDoubleBufferSeqResult r = new TestIntf.OpDoubleBufferSeqResult();
double[] arr = new double[inSeq.limit()];
inSeq.get(arr);
- outSeq.value = DoubleBuffer.wrap(arr);
- return DoubleBuffer.wrap(arr);
+ r.outSeq = DoubleBuffer.wrap(arr);
+ r.returnValue = DoubleBuffer.wrap(arr);
+ return r;
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
_communicator.shutdown();
}
- private Ice.Communicator _communicator;
+ private com.zeroc.Ice.Communicator _communicator;
+ private java.util.ArrayList<C> seq;
}
diff --git a/java/test/src/main/java/test/Ice/defaultServant/AllTests.java b/java/test/src/main/java/test/Ice/defaultServant/AllTests.java
index d841881da63..3e22df248de 100644
--- a/java/test/src/main/java/test/Ice/defaultServant/AllTests.java
+++ b/java/test/src/main/java/test/Ice/defaultServant/AllTests.java
@@ -8,14 +8,13 @@
// **********************************************************************
package test.Ice.defaultServant;
+
import java.io.PrintWriter;
import test.Ice.defaultServant.Test.MyObjectPrx;
-import test.Ice.defaultServant.Test.MyObjectPrxHelper;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -23,14 +22,13 @@ public class AllTests
}
}
- public static void
- allTests(test.Util.Application app, PrintWriter out)
+ public static void allTests(test.Util.Application app, PrintWriter out)
{
- Ice.Communicator communicator = app.communicator();
- Ice.ObjectAdapter oa = communicator.createObjectAdapterWithEndpoints("MyOA", "tcp -h localhost");
+ com.zeroc.Ice.Communicator communicator = app.communicator();
+ com.zeroc.Ice.ObjectAdapter oa = communicator.createObjectAdapterWithEndpoints("MyOA", "tcp -h localhost");
oa.activate();
- Ice.Object servant = new MyObjectI();
+ com.zeroc.Ice.Object servant = new MyObjectI();
//
// Register default servant with category "foo"
@@ -43,13 +41,13 @@ public class AllTests
out.print("testing single category... ");
out.flush();
- Ice.Object r = oa.findDefaultServant("foo");
+ com.zeroc.Ice.Object r = oa.findDefaultServant("foo");
test(r == servant);
r = oa.findDefaultServant("bar");
test(r == null);
- Ice.Identity identity = new Ice.Identity();
+ com.zeroc.Ice.Identity identity = new com.zeroc.Ice.Identity();
identity.category = "foo";
String names[] = { "foo", "bar", "x", "y", "abcdefg" };
@@ -57,19 +55,19 @@ public class AllTests
for(int idx = 0; idx < 5; ++idx)
{
identity.name = names[idx];
- MyObjectPrx prx = MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity));
+ MyObjectPrx prx = MyObjectPrx.uncheckedCast(oa.createProxy(identity));
prx.ice_ping();
test(prx.getName().equals(names[idx]));
}
identity.name = "ObjectNotExist";
- MyObjectPrx prx = MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity));
+ MyObjectPrx prx = MyObjectPrx.uncheckedCast(oa.createProxy(identity));
try
{
prx.ice_ping();
test(false);
}
- catch(Ice.ObjectNotExistException ex)
+ catch(com.zeroc.Ice.ObjectNotExistException ex)
{
// Expected
}
@@ -79,19 +77,19 @@ public class AllTests
prx.getName();
test(false);
}
- catch(Ice.ObjectNotExistException ex)
+ catch(com.zeroc.Ice.ObjectNotExistException ex)
{
// Expected
}
identity.name = "FacetNotExist";
- prx = MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity));
+ prx = MyObjectPrx.uncheckedCast(oa.createProxy(identity));
try
{
prx.ice_ping();
test(false);
}
- catch(Ice.FacetNotExistException ex)
+ catch(com.zeroc.Ice.FacetNotExistException ex)
{
// Expected
}
@@ -101,7 +99,7 @@ public class AllTests
prx.getName();
test(false);
}
- catch(Ice.FacetNotExistException ex)
+ catch(com.zeroc.Ice.FacetNotExistException ex)
{
// Expected
}
@@ -110,14 +108,14 @@ public class AllTests
for(int idx = 0; idx < 5; idx++)
{
identity.name = names[idx];
- prx = MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity));
+ prx = MyObjectPrx.uncheckedCast(oa.createProxy(identity));
try
{
prx.ice_ping();
test(false);
}
- catch(Ice.ObjectNotExistException ex)
+ catch(com.zeroc.Ice.ObjectNotExistException ex)
{
// Expected
}
@@ -127,7 +125,7 @@ public class AllTests
prx.getName();
test(false);
}
- catch(Ice.ObjectNotExistException ex)
+ catch(com.zeroc.Ice.ObjectNotExistException ex)
{
// Expected
}
@@ -135,12 +133,12 @@ public class AllTests
oa.removeDefaultServant("foo");
identity.category = "foo";
- prx = MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity));
+ prx = MyObjectPrx.uncheckedCast(oa.createProxy(identity));
try
{
prx.ice_ping();
}
- catch(Ice.ObjectNotExistException ex)
+ catch(com.zeroc.Ice.ObjectNotExistException ex)
{
// Expected
}
@@ -161,7 +159,7 @@ public class AllTests
for(int idx = 0; idx < 5; ++idx)
{
identity.name = names[idx];
- prx = MyObjectPrxHelper.uncheckedCast(oa.createProxy(identity));
+ prx = MyObjectPrx.uncheckedCast(oa.createProxy(identity));
prx.ice_ping();
test(prx.getName().equals(names[idx]));
}
diff --git a/java/test/src/main/java/test/Ice/defaultServant/MyObjectI.java b/java/test/src/main/java/test/Ice/defaultServant/MyObjectI.java
index 055576ef5cd..88bbd439be7 100644
--- a/java/test/src/main/java/test/Ice/defaultServant/MyObjectI.java
+++ b/java/test/src/main/java/test/Ice/defaultServant/MyObjectI.java
@@ -8,39 +8,38 @@
// **********************************************************************
package test.Ice.defaultServant;
+
import test.Ice.defaultServant.Test.*;
-public final class MyObjectI extends _MyObjectDisp
+public final class MyObjectI implements MyObject
{
@Override
- public void
- ice_ping(Ice.Current current)
+ public void ice_ping(com.zeroc.Ice.Current current)
{
String name = current.id.name;
if(name.equals("ObjectNotExist"))
{
- throw new Ice.ObjectNotExistException();
+ throw new com.zeroc.Ice.ObjectNotExistException();
}
else if(name.equals("FacetNotExist"))
{
- throw new Ice.FacetNotExistException();
+ throw new com.zeroc.Ice.FacetNotExistException();
}
}
@Override
- public String
- getName(Ice.Current current)
+ public String getName(com.zeroc.Ice.Current current)
{
String name = current.id.name;
if(name.equals("ObjectNotExist"))
{
- throw new Ice.ObjectNotExistException();
+ throw new com.zeroc.Ice.ObjectNotExistException();
}
else if(name.equals("FacetNotExist"))
{
- throw new Ice.FacetNotExistException();
+ throw new com.zeroc.Ice.FacetNotExistException();
}
return name;
diff --git a/java/test/src/main/java/test/Ice/defaultValue/AllTests.java b/java/test/src/main/java/test/Ice/defaultValue/AllTests.java
index 3c669e17b5b..397f8213d5f 100644
--- a/java/test/src/main/java/test/Ice/defaultValue/AllTests.java
+++ b/java/test/src/main/java/test/Ice/defaultValue/AllTests.java
@@ -14,8 +14,7 @@ import test.Ice.defaultValue.Test.*;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -23,8 +22,7 @@ public class AllTests
}
}
- public static void
- allTests(test.Util.Application app, PrintWriter out)
+ public static void allTests(test.Util.Application app, PrintWriter out)
{
out.print("testing default values... ");
out.flush();
diff --git a/java/test/src/main/java/test/Ice/dispatcher/AllTests.java b/java/test/src/main/java/test/Ice/dispatcher/AllTests.java
index 31116ccb013..52d89c483f4 100644
--- a/java/test/src/main/java/test/Ice/dispatcher/AllTests.java
+++ b/java/test/src/main/java/test/Ice/dispatcher/AllTests.java
@@ -12,18 +12,16 @@ package test.Ice.dispatcher;
import java.io.PrintWriter;
import test.Ice.dispatcher.Test.TestIntfPrx;
-import test.Ice.dispatcher.Test.TestIntfPrxHelper;
import test.Ice.dispatcher.Test.TestIntfControllerPrx;
-import test.Ice.dispatcher.Test.TestIntfControllerPrxHelper;
-import test.Ice.dispatcher.Test.Callback_TestIntf_op;
-import test.Ice.dispatcher.Test.Callback_TestIntf_opWithPayload;
-import test.Ice.dispatcher.Test.Callback_TestIntf_sleep;
+
+import java.util.concurrent.CompletableFuture;
+import com.zeroc.Ice.InvocationFuture;
public class AllTests
{
- private static abstract class OpCallback extends Callback_TestIntf_op
+ private static class Callback
{
- OpCallback()
+ Callback()
{
_called = false;
}
@@ -54,8 +52,7 @@ public class AllTests
private boolean _called;
}
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -63,11 +60,10 @@ public class AllTests
}
}
- public static void
- allTests(Ice.Communicator communicator, PrintWriter out, final Dispatcher dispatcher)
+ public static void allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out, final Dispatcher dispatcher)
{
String sref = "test:default -p 12010";
- Ice.ObjectPrx obj = communicator.stringToProxy(sref);
+ com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(sref);
test(obj != null);
int mult = 1;
@@ -76,151 +72,115 @@ public class AllTests
mult = 4;
}
- TestIntfPrx p = TestIntfPrxHelper.uncheckedCast(obj);
+ TestIntfPrx p = TestIntfPrx.uncheckedCast(obj);
sref = "testController:tcp -p 12011";
obj = communicator.stringToProxy(sref);
test(obj != null);
- TestIntfControllerPrx testController = TestIntfControllerPrxHelper.uncheckedCast(obj);
+ TestIntfControllerPrx testController = TestIntfControllerPrx.uncheckedCast(obj);
out.print("testing dispatcher... ");
out.flush();
{
p.op();
- OpCallback cb = new OpCallback()
- {
- @Override
- public void
- response()
- {
- test(dispatcher.isDispatcherThread());
- called();
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- ex.printStackTrace();
- test(false);
- }
- };
- p.begin_op(cb);
- cb.check();
-
- TestIntfPrx i = (TestIntfPrx)p.ice_adapterId("dummy");
- cb = new OpCallback()
- {
- @Override
- public void
- response()
+ {
+ final Callback cb = new Callback();
+ p.opAsync().whenCompleteAsync((result, ex) ->
{
- test(false);
- }
+ if(ex != null)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ else
+ {
+ test(dispatcher.isDispatcherThread());
+ cb.called();
+ }
+ }, dispatcher);
+ cb.check();
+ }
- @Override
- public void
- exception(Ice.LocalException ex)
+ {
+ TestIntfPrx i = p.ice_adapterId("dummy");
+ final Callback cb = new Callback();
+ i.opAsync().whenCompleteAsync((result, ex) ->
{
- test(ex instanceof Ice.NoEndpointException);
- test(dispatcher.isDispatcherThread());
- called();
- }
- };
- i.begin_op(cb);
- cb.check();
+ if(ex != null)
+ {
+ test(ex instanceof com.zeroc.Ice.NoEndpointException);
+ test(dispatcher.isDispatcherThread());
+ cb.called();
+ }
+ else
+ {
+ test(false);
+ }
+ }, dispatcher);
+ cb.check();
+ }
{
//
// Expect InvocationTimeoutException.
//
- TestIntfPrx to = TestIntfPrxHelper.uncheckedCast(p.ice_invocationTimeout(250));
- class Callback_TestIntf_sleepImpl extends Callback_TestIntf_sleep
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(ex instanceof Ice.InvocationTimeoutException);
- test(dispatcher.isDispatcherThread());
- called();
- }
-
- @Override
- public void
- sent(boolean sentSynchronously)
+ TestIntfPrx to = p.ice_invocationTimeout(250);
+ final Callback cb = new Callback();
+ CompletableFuture<Void> r = to.sleepAsync(500 * mult);
+ r.whenCompleteAsync((result, ex) ->
{
- test(sentSynchronously || dispatcher.isDispatcherThread());
- }
-
- public synchronized void check()
- {
- while(!_called)
+ if(ex != null)
{
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
+ test(ex instanceof com.zeroc.Ice.InvocationTimeoutException);
+ test(dispatcher.isDispatcherThread());
+ cb.called();
}
-
- _called = false;
- }
- private synchronized void called()
+ else
+ {
+ test(false);
+ }
+ }, dispatcher);
+ com.zeroc.Ice.Util.getInvocationFuture(r).whenSentAsync((sentSynchronously, ex) ->
{
- assert(!_called);
- _called = true;
- notify();
- }
- private boolean _called;
- };
- Callback_TestIntf_sleepImpl callback = new Callback_TestIntf_sleepImpl();
- to.begin_sleep(500 * mult, callback);
- callback.check();
+ test(ex == null);
+ test(dispatcher.isDispatcherThread());
+ }, dispatcher);
+ cb.check();
}
testController.holdAdapter();
- Callback_TestIntf_opWithPayload callback = new Callback_TestIntf_opWithPayload()
- {
- @Override
- public void
- response()
- {
- test(dispatcher.isDispatcherThread());
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(ex instanceof Ice.CommunicatorDestroyedException);
- }
-
- @Override
- public void
- sent(boolean sentSynchronously)
- {
- test(sentSynchronously || dispatcher.isDispatcherThread());
- }
- };
-
byte[] seq = new byte[10 * 1024];
new java.util.Random().nextBytes(seq); // Make sure the request doesn't compress too well.
- Ice.AsyncResult r;
- while((r = p.begin_opWithPayload(seq, callback)).sentSynchronously());
+ CompletableFuture<Void> r = null;
+ while(true)
+ {
+ r = p.opWithPayloadAsync(seq);
+ r.whenCompleteAsync((result, ex) ->
+ {
+ if(ex != null)
+ {
+ test(ex instanceof com.zeroc.Ice.CommunicatorDestroyedException);
+ }
+ else
+ {
+ test(dispatcher.isDispatcherThread());
+ }
+ }, dispatcher);
+ InvocationFuture<Void> f = com.zeroc.Ice.Util.getInvocationFuture(r);
+ f.whenSentAsync((sentSynchronously, ex) ->
+ {
+ test(ex == null);
+ test(dispatcher.isDispatcherThread());
+ }, dispatcher);
+ if(!f.sentSynchronously())
+ {
+ break;
+ }
+ }
testController.resumeAdapter();
- r.waitForCompleted();
+ r.join();
}
out.println("ok");
diff --git a/java/test/src/main/java/test/Ice/dispatcher/Client.java b/java/test/src/main/java/test/Ice/dispatcher/Client.java
index 3cfb7a56697..f3de9eb86ed 100644
--- a/java/test/src/main/java/test/Ice/dispatcher/Client.java
+++ b/java/test/src/main/java/test/Ice/dispatcher/Client.java
@@ -19,22 +19,21 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
+ GetInitDataResult r = super.getInitData(args);
assert(_dispatcher == null);
_dispatcher = new Dispatcher();
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.dispatcher");
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.dispatcher");
//
// Limit the send buffer size, this test relies on the socket
// send() blocking after sending a given amount of data.
//
- initData.properties.setProperty("Ice.TCP.SndSize", "50000");
+ r.initData.properties.setProperty("Ice.TCP.SndSize", "50000");
- initData.dispatcher = _dispatcher;
- return initData;
+ r.initData.dispatcher = _dispatcher;
+ return r;
}
Dispatcher getDispatcher()
diff --git a/java/test/src/main/java/test/Ice/dispatcher/Collocated.java b/java/test/src/main/java/test/Ice/dispatcher/Collocated.java
index 230321ada51..5d9e2eeda34 100644
--- a/java/test/src/main/java/test/Ice/dispatcher/Collocated.java
+++ b/java/test/src/main/java/test/Ice/dispatcher/Collocated.java
@@ -14,13 +14,13 @@ public class Collocated extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
assert(_dispatcher != null);
- adapter.add(new TestI(_dispatcher), Ice.Util.stringToIdentity("test"));
+ adapter.add(new TestI(_dispatcher), com.zeroc.Ice.Util.stringToIdentity("test"));
//adapter.activate(); // Don't activate OA to ensure collocation is used.
- adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController"));
+ adapter2.add(new TestControllerI(adapter), com.zeroc.Ice.Util.stringToIdentity("testController"));
//adapter2.activate(); // Don't activate OA to ensure collocation is used.
AllTests.allTests(communicator(), getWriter(), _dispatcher);
@@ -28,18 +28,17 @@ public class Collocated extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
+ GetInitDataResult r = super.getInitData(args);
assert(_dispatcher == null);
_dispatcher = new Dispatcher();
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.dispatcher");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
- initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
- initData.dispatcher = _dispatcher;
- return initData;
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.dispatcher");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ r.initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
+ r.initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
+ r.initData.dispatcher = _dispatcher;
+ return r;
}
Dispatcher getDispatcher()
diff --git a/java/test/src/main/java/test/Ice/dispatcher/Dispatcher.java b/java/test/src/main/java/test/Ice/dispatcher/Dispatcher.java
index 1db9c2c7317..d0c4359a662 100644
--- a/java/test/src/main/java/test/Ice/dispatcher/Dispatcher.java
+++ b/java/test/src/main/java/test/Ice/dispatcher/Dispatcher.java
@@ -9,10 +9,9 @@
package test.Ice.dispatcher;
-public class Dispatcher implements Runnable, Ice.Dispatcher
+public class Dispatcher implements Runnable, com.zeroc.Ice.Dispatcher, java.util.concurrent.Executor
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -27,8 +26,7 @@ public class Dispatcher implements Runnable, Ice.Dispatcher
}
@Override
- public void
- run()
+ public void run()
{
while(true)
{
@@ -45,7 +43,7 @@ public class Dispatcher implements Runnable, Ice.Dispatcher
{
}
}
-
+
if(!_calls.isEmpty())
{
call = _calls.poll();
@@ -56,7 +54,7 @@ public class Dispatcher implements Runnable, Ice.Dispatcher
return;
}
}
-
+
if(call != null)
{
try
@@ -71,10 +69,9 @@ public class Dispatcher implements Runnable, Ice.Dispatcher
}
}
}
-
+
@Override
- synchronized public void
- dispatch(Runnable call, Ice.Connection con)
+ synchronized public void dispatch(Runnable call, com.zeroc.Ice.Connection con)
{
boolean added = _calls.offer(call);
assert(added);
@@ -84,8 +81,13 @@ public class Dispatcher implements Runnable, Ice.Dispatcher
}
}
- public void
- terminate()
+ @Override
+ public void execute(Runnable call)
+ {
+ dispatch(call, null);
+ }
+
+ public void terminate()
{
synchronized(this)
{
@@ -104,14 +106,13 @@ public class Dispatcher implements Runnable, Ice.Dispatcher
}
}
}
-
- public boolean
- isDispatcherThread()
+
+ public boolean isDispatcherThread()
{
return Thread.currentThread() == _thread;
}
- private java.util.Queue<Runnable> _calls = new java.util.LinkedList<Runnable>();
+ private java.util.Queue<Runnable> _calls = new java.util.LinkedList<>();
private Thread _thread;
private boolean _terminated = false;
}
diff --git a/java/test/src/main/java/test/Ice/dispatcher/Server.java b/java/test/src/main/java/test/Ice/dispatcher/Server.java
index d962bbe1e28..79cc2a615e9 100644
--- a/java/test/src/main/java/test/Ice/dispatcher/Server.java
+++ b/java/test/src/main/java/test/Ice/dispatcher/Server.java
@@ -12,39 +12,37 @@ package test.Ice.dispatcher;
public class Server extends test.Util.Application
{
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
assert(_dispatcher != null);
- adapter.add(new TestI(_dispatcher), Ice.Util.stringToIdentity("test"));
+ adapter.add(new TestI(_dispatcher), com.zeroc.Ice.Util.stringToIdentity("test"));
adapter.activate();
- adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController"));
+ adapter2.add(new TestControllerI(adapter), com.zeroc.Ice.Util.stringToIdentity("testController"));
adapter2.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
+ GetInitDataResult r = super.getInitData(args);
assert(_dispatcher == null);
_dispatcher = new Dispatcher();
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.dispatcher");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
- initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.dispatcher");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ r.initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
+ r.initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
//
// Limit the recv buffer size, this test relies on the socket
// send() blocking after sending a given amount of data.
//
- initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
- initData.dispatcher = _dispatcher;
- return initData;
+ r.initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
+ r.initData.dispatcher = _dispatcher;
+ return r;
}
public void terminate()
@@ -55,8 +53,7 @@ public class Server extends test.Util.Application
}
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
Server app = new Server();
int result = app.main("Server", args);
diff --git a/java/test/src/main/java/test/Ice/dispatcher/TestControllerI.java b/java/test/src/main/java/test/Ice/dispatcher/TestControllerI.java
index df5e6cd258f..9a08a1dde7d 100644
--- a/java/test/src/main/java/test/Ice/dispatcher/TestControllerI.java
+++ b/java/test/src/main/java/test/Ice/dispatcher/TestControllerI.java
@@ -9,29 +9,26 @@
package test.Ice.dispatcher;
-import test.Ice.dispatcher.Test._TestIntfControllerDisp;
+import test.Ice.dispatcher.Test.TestIntfController;
-class TestControllerI extends _TestIntfControllerDisp
+class TestControllerI implements TestIntfController
{
@Override
- public void
- holdAdapter(Ice.Current current)
+ public void holdAdapter(com.zeroc.Ice.Current current)
{
_adapter.hold();
}
@Override
- public void
- resumeAdapter(Ice.Current current)
+ public void resumeAdapter(com.zeroc.Ice.Current current)
{
_adapter.activate();
}
- public
- TestControllerI(Ice.ObjectAdapter adapter)
+ public TestControllerI(com.zeroc.Ice.ObjectAdapter adapter)
{
_adapter = adapter;
}
- final private Ice.ObjectAdapter _adapter;
+ final private com.zeroc.Ice.ObjectAdapter _adapter;
}
diff --git a/java/test/src/main/java/test/Ice/dispatcher/TestI.java b/java/test/src/main/java/test/Ice/dispatcher/TestI.java
index c04d5bf44c8..4bbf103f97d 100644
--- a/java/test/src/main/java/test/Ice/dispatcher/TestI.java
+++ b/java/test/src/main/java/test/Ice/dispatcher/TestI.java
@@ -9,12 +9,11 @@
package test.Ice.dispatcher;
-import test.Ice.dispatcher.Test._TestIntfDisp;
+import test.Ice.dispatcher.Test.TestIntf;
-public class TestI extends _TestIntfDisp
+public class TestI implements TestIntf
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -28,15 +27,14 @@ public class TestI extends _TestIntfDisp
}
@Override
- public void
- op(Ice.Current current)
+ public void op(com.zeroc.Ice.Current current)
{
test(_dispatcher.isDispatcherThread());
}
@Override
public void
- sleep(int to, Ice.Current current)
+ sleep(int to, com.zeroc.Ice.Current current)
{
try
{
@@ -49,15 +47,13 @@ public class TestI extends _TestIntfDisp
}
@Override
- public void
- opWithPayload(byte[] seq, Ice.Current current)
+ public void opWithPayload(byte[] seq, com.zeroc.Ice.Current current)
{
test(_dispatcher.isDispatcherThread());
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
diff --git a/java/test/src/main/java/test/Ice/echo/BlobjectI.java b/java/test/src/main/java/test/Ice/echo/BlobjectI.java
index 6c6e9a832ff..09486d2446e 100644
--- a/java/test/src/main/java/test/Ice/echo/BlobjectI.java
+++ b/java/test/src/main/java/test/Ice/echo/BlobjectI.java
@@ -9,41 +9,15 @@
package test.Ice.echo;
-public class BlobjectI extends Ice.BlobjectAsync
-{
- class Callback extends Ice.Callback_Object_ice_invoke
- {
- public Callback(Ice.AMD_Object_ice_invoke cb, boolean twoway)
- {
- _cb = cb;
- _twoway = twoway;
- }
+import com.zeroc.Ice.InvocationFuture;
+import com.zeroc.Ice.ObjectPrx;
+import com.zeroc.Ice.Current;
- @Override
- public void response(boolean ok, byte[] encaps)
- {
- _cb.ice_response(ok, encaps);
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- _cb.ice_exception(ex);
- }
-
- @Override
- public void sent(boolean sync)
- {
- if(!_twoway)
- {
- _cb.ice_response(true, new byte[0]);
- }
- }
-
- final Ice.AMD_Object_ice_invoke _cb;
- final boolean _twoway;
- };
+import java.util.concurrent.CompletionStage;
+import java.util.concurrent.CompletableFuture;
+public class BlobjectI implements com.zeroc.Ice.BlobjectAsync
+{
public void startBatch()
{
assert(_batchProxy == null);
@@ -58,11 +32,10 @@ public class BlobjectI extends Ice.BlobjectAsync
}
@Override
- public void
- ice_invoke_async(Ice.AMD_Object_ice_invoke amdCb, byte[] inEncaps, Ice.Current current)
+ public CompletionStage<com.zeroc.Ice.Object.Ice_invokeResult> ice_invokeAsync(byte[] inEncaps, Current current)
{
boolean twoway = current.requestId > 0;
- Ice.ObjectPrx obj = current.con.createProxy(current.id);
+ ObjectPrx obj = current.con.createProxy(current.id);
if(!twoway)
{
if(_startBatch)
@@ -80,16 +53,32 @@ public class BlobjectI extends Ice.BlobjectAsync
obj = obj.ice_facet(current.facet);
}
+ final com.zeroc.Ice.Object.Ice_invokeResult success =
+ new com.zeroc.Ice.Object.Ice_invokeResult(true, new byte[0]);
+
if(_batchProxy != null)
{
- Ice.ByteSeqHolder out = new Ice.ByteSeqHolder();
- obj.ice_invoke(current.operation, current.mode, inEncaps, out, current.ctx);
- amdCb.ice_response(true, new byte[0]);
+ obj.ice_invoke(current.operation, current.mode, inEncaps, current.ctx);
+ return CompletableFuture.completedFuture(success);
}
else
{
- Callback cb = new Callback(amdCb, false);
- obj.ice_oneway().begin_ice_invoke(current.operation, current.mode, inEncaps, current.ctx, cb);
+ final CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> future =
+ new CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult>();
+ CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> r =
+ obj.ice_oneway().ice_invokeAsync(current.operation, current.mode, inEncaps, current.ctx);
+ com.zeroc.Ice.Util.getInvocationFuture(r).whenSent((sentSynchronously, ex) ->
+ {
+ if(ex != null)
+ {
+ future.completeExceptionally(ex);
+ }
+ else
+ {
+ future.complete(success);
+ }
+ });
+ return future;
}
}
else
@@ -99,11 +88,23 @@ public class BlobjectI extends Ice.BlobjectAsync
obj = obj.ice_facet(current.facet);
}
- Callback cb = new Callback(amdCb, true);
- obj.begin_ice_invoke(current.operation, current.mode, inEncaps, current.ctx, cb);
+ final CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> future =
+ new CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult>();
+ obj.ice_invokeAsync(current.operation, current.mode, inEncaps, current.ctx).whenComplete((result, ex) ->
+ {
+ if(ex != null)
+ {
+ future.completeExceptionally(ex);
+ }
+ else
+ {
+ future.complete(result);
+ }
+ });
+ return future;
}
}
- private Ice.ObjectPrx _batchProxy;
+ private ObjectPrx _batchProxy;
private boolean _startBatch;
}
diff --git a/java/test/src/main/java/test/Ice/echo/Server.java b/java/test/src/main/java/test/Ice/echo/Server.java
index 07648551d38..d53b8092bc8 100644
--- a/java/test/src/main/java/test/Ice/echo/Server.java
+++ b/java/test/src/main/java/test/Ice/echo/Server.java
@@ -11,7 +11,7 @@ package test.Ice.echo;
public class Server extends test.Util.Application
{
- class EchoI extends test.Ice.echo.Test._EchoDisp
+ class EchoI implements test.Ice.echo.Test.Echo
{
public EchoI(BlobjectI blob)
{
@@ -19,45 +19,44 @@ public class Server extends test.Util.Application
}
@Override
- public void startBatch(Ice.Current current)
+ public void startBatch(com.zeroc.Ice.Current current)
{
_blob.startBatch();
}
@Override
- public void flushBatch(Ice.Current current)
+ public void flushBatch(com.zeroc.Ice.Current current)
{
_blob.flushBatch();
}
@Override
- public void shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
final private BlobjectI _blob;
- };
+ }
@Override
public int run(String[] args)
{
communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
BlobjectI blob = new BlobjectI();
adapter.addDefaultServant(blob, "");
- adapter.add(new EchoI(blob), Ice.Util.stringToIdentity("__echo"));
+ adapter.add(new EchoI(blob), com.zeroc.Ice.Util.stringToIdentity("__echo"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.echo");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.echo");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/enums/AllTests.java b/java/test/src/main/java/test/Ice/enums/AllTests.java
index ea044f068ab..98d6ecc862c 100644
--- a/java/test/src/main/java/test/Ice/enums/AllTests.java
+++ b/java/test/src/main/java/test/Ice/enums/AllTests.java
@@ -14,8 +14,7 @@ import java.io.PrintWriter;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -23,13 +22,12 @@ public class AllTests
}
}
- public static TestIntfPrx
- allTests(Ice.Communicator communicator, PrintWriter out)
+ public static TestIntfPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out)
{
String ref = "test:default -p 12010";
- Ice.ObjectPrx obj = communicator.stringToProxy(ref);
+ com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(ref);
test(obj != null);
- TestIntfPrx proxy = TestIntfPrxHelper.checkedCast(obj);
+ TestIntfPrx proxy = TestIntfPrx.checkedCast(obj);
test(proxy != null);
out.print("testing enum values... ");
@@ -122,28 +120,28 @@ public class AllTests
out.print("testing enum streaming... ");
out.flush();
- Ice.OutputStream os;
+ com.zeroc.Ice.OutputStream os;
byte[] bytes;
final boolean encoding_1_0 =
communicator.getProperties().getProperty("Ice.Default.EncodingVersion").equals("1.0");
- os = new Ice.OutputStream(communicator);
+ os = new com.zeroc.Ice.OutputStream(communicator);
ByteEnum.write(os, ByteEnum.benum11);
bytes = os.finished();
test(bytes.length == 1); // ByteEnum should require one byte
- os = new Ice.OutputStream(communicator);
+ os = new com.zeroc.Ice.OutputStream(communicator);
ShortEnum.write(os, ShortEnum.senum11);
bytes = os.finished();
test(bytes.length == (encoding_1_0 ? 2 : 5));
- os = new Ice.OutputStream(communicator);
+ os = new com.zeroc.Ice.OutputStream(communicator);
IntEnum.write(os, IntEnum.ienum11);
bytes = os.finished();
test(bytes.length == (encoding_1_0 ? 4 : 5));
- os = new Ice.OutputStream(communicator);
+ os = new com.zeroc.Ice.OutputStream(communicator);
SimpleEnum.write(os, SimpleEnum.blue);
bytes = os.finished();
test(bytes.length == 1); // SimpleEnum should require one byte
@@ -153,29 +151,37 @@ public class AllTests
out.print("testing enum operations... ");
out.flush();
- ByteEnumHolder byteEnum = new ByteEnumHolder();
- test(proxy.opByte(ByteEnum.benum1, byteEnum) == ByteEnum.benum1);
- test(byteEnum.value == ByteEnum.benum1);
- test(proxy.opByte(ByteEnum.benum11, byteEnum) == ByteEnum.benum11);
- test(byteEnum.value == ByteEnum.benum11);
-
- ShortEnumHolder shortEnum = new ShortEnumHolder();
- test(proxy.opShort(ShortEnum.senum1, shortEnum) == ShortEnum.senum1);
- test(shortEnum.value == ShortEnum.senum1);
- test(proxy.opShort(ShortEnum.senum11, shortEnum) == ShortEnum.senum11);
- test(shortEnum.value == ShortEnum.senum11);
-
- IntEnumHolder intEnum = new IntEnumHolder();
- test(proxy.opInt(IntEnum.ienum1, intEnum) == IntEnum.ienum1);
- test(intEnum.value == IntEnum.ienum1);
- test(proxy.opInt(IntEnum.ienum11, intEnum) == IntEnum.ienum11);
- test(intEnum.value == IntEnum.ienum11);
- test(proxy.opInt(IntEnum.ienum12, intEnum) == IntEnum.ienum12);
- test(intEnum.value == IntEnum.ienum12);
-
- SimpleEnumHolder s = new SimpleEnumHolder();
- test(proxy.opSimple(SimpleEnum.green, s) == SimpleEnum.green);
- test(s.value == SimpleEnum.green);
+ {
+ TestIntf.OpByteResult r;
+ r = proxy.opByte(ByteEnum.benum1);
+ test(r.returnValue == ByteEnum.benum1 && r.b2 == ByteEnum.benum1);
+ r = proxy.opByte(ByteEnum.benum11);
+ test(r.returnValue == ByteEnum.benum11 && r.b2 == ByteEnum.benum11);
+ }
+
+ {
+ TestIntf.OpShortResult r;
+ r = proxy.opShort(ShortEnum.senum1);
+ test(r.returnValue == ShortEnum.senum1 && r.s2 == ShortEnum.senum1);
+ r = proxy.opShort(ShortEnum.senum11);
+ test(r.returnValue == ShortEnum.senum11 && r.s2 == ShortEnum.senum11);
+ }
+
+ {
+ TestIntf.OpIntResult r;
+ r = proxy.opInt(IntEnum.ienum1);
+ test(r.returnValue == IntEnum.ienum1 && r.i2 == IntEnum.ienum1);
+ r = proxy.opInt(IntEnum.ienum11);
+ test(r.returnValue == IntEnum.ienum11 && r.i2 == IntEnum.ienum11);
+ r = proxy.opInt(IntEnum.ienum12);
+ test(r.returnValue == IntEnum.ienum12 && r.i2 == IntEnum.ienum12);
+ }
+
+ {
+ TestIntf.OpSimpleResult r;
+ r = proxy.opSimple(SimpleEnum.green);
+ test(r.returnValue == SimpleEnum.green && r.s2 == SimpleEnum.green);
+ }
out.println("ok");
@@ -187,13 +193,12 @@ public class AllTests
ByteEnum.benum6, ByteEnum.benum7, ByteEnum.benum8, ByteEnum.benum9, ByteEnum.benum10,
ByteEnum.benum11};
- ByteEnumSeqHolder b2 = new ByteEnumSeqHolder();
- ByteEnum b3[] = proxy.opByteSeq(b1, b2);
+ TestIntf.OpByteSeqResult r = proxy.opByteSeq(b1);
for(int i = 0; i < b1.length; ++i)
{
- test(b1[i] == b2.value[i]);
- test(b1[i] == b3[i]);
+ test(b1[i] == r.b2[i]);
+ test(b1[i] == r.returnValue[i]);
}
}
@@ -202,13 +207,12 @@ public class AllTests
ShortEnum.senum6, ShortEnum.senum7, ShortEnum.senum8, ShortEnum.senum9, ShortEnum.senum10,
ShortEnum.senum11};
- ShortEnumSeqHolder s2 = new ShortEnumSeqHolder();
- ShortEnum s3[] = proxy.opShortSeq(s1, s2);
+ TestIntf.OpShortSeqResult r = proxy.opShortSeq(s1);
for(int i = 0; i < s1.length; ++i)
{
- test(s1[i] == s2.value[i]);
- test(s1[i] == s3[i]);
+ test(s1[i] == r.s2[i]);
+ test(s1[i] == r.returnValue[i]);
}
}
@@ -217,26 +221,24 @@ public class AllTests
IntEnum.ienum6, IntEnum.ienum7, IntEnum.ienum8, IntEnum.ienum9, IntEnum.ienum10,
IntEnum.ienum11};
- IntEnumSeqHolder i2 = new IntEnumSeqHolder();
- IntEnum i3[] = proxy.opIntSeq(i1, i2);
+ TestIntf.OpIntSeqResult r = proxy.opIntSeq(i1);
for(int i = 0; i < i1.length; ++i)
{
- test(i1[i] == i2.value[i]);
- test(i1[i] == i3[i]);
+ test(i1[i] == r.i2[i]);
+ test(i1[i] == r.returnValue[i]);
}
}
{
SimpleEnum s1[] = { SimpleEnum.red, SimpleEnum.green, SimpleEnum.blue };
- SimpleEnumSeqHolder s2 = new SimpleEnumSeqHolder();
- SimpleEnum s3[] = proxy.opSimpleSeq(s1, s2);
+ TestIntf.OpSimpleSeqResult r = proxy.opSimpleSeq(s1);
for(int i = 0; i < s1.length; ++i)
{
- test(s1[i] == s2.value[i]);
- test(s1[i] == s3[i]);
+ test(s1[i] == r.s2[i]);
+ test(s1[i] == r.returnValue[i]);
}
}
@@ -247,85 +249,85 @@ public class AllTests
try
{
- os = new Ice.OutputStream(communicator);
+ os = new com.zeroc.Ice.OutputStream(communicator);
os.writeByte((byte)2); // Invalid enumerator
- Ice.InputStream in = new Ice.InputStream(communicator, os.finished());
+ com.zeroc.Ice.InputStream in = new com.zeroc.Ice.InputStream(communicator, os.finished());
ByteEnum.read(in);
test(false);
}
- catch(Ice.MarshalException ex)
+ catch(com.zeroc.Ice.MarshalException ex)
{
}
try
{
- os = new Ice.OutputStream(communicator);
+ os = new com.zeroc.Ice.OutputStream(communicator);
os.writeByte((byte)128); // Invalid enumerator
- Ice.InputStream in = new Ice.InputStream(communicator, os.finished());
+ com.zeroc.Ice.InputStream in = new com.zeroc.Ice.InputStream(communicator, os.finished());
ByteEnum.read(in);
test(false);
}
- catch(Ice.MarshalException ex)
+ catch(com.zeroc.Ice.MarshalException ex)
{
}
try
{
- os = new Ice.OutputStream(communicator);
+ os = new com.zeroc.Ice.OutputStream(communicator);
os.writeShort((short)-1); // Negative enumerators are not supported
- Ice.InputStream in = new Ice.InputStream(communicator, os.finished());
+ com.zeroc.Ice.InputStream in = new com.zeroc.Ice.InputStream(communicator, os.finished());
ShortEnum.read(in);
test(false);
}
- catch(Ice.MarshalException ex)
+ catch(com.zeroc.Ice.MarshalException ex)
{
}
try
{
- os = new Ice.OutputStream(communicator);
+ os = new com.zeroc.Ice.OutputStream(communicator);
os.writeShort((short)0); // Invalid enumerator
- Ice.InputStream in = new Ice.InputStream(communicator, os.finished());
+ com.zeroc.Ice.InputStream in = new com.zeroc.Ice.InputStream(communicator, os.finished());
ShortEnum.read(in);
test(false);
}
- catch(Ice.MarshalException ex)
+ catch(com.zeroc.Ice.MarshalException ex)
{
}
try
{
- os = new Ice.OutputStream(communicator);
+ os = new com.zeroc.Ice.OutputStream(communicator);
os.writeShort((short)32767); // Invalid enumerator
- Ice.InputStream in = new Ice.InputStream(communicator, os.finished());
+ com.zeroc.Ice.InputStream in = new com.zeroc.Ice.InputStream(communicator, os.finished());
ShortEnum.read(in);
test(false);
}
- catch(Ice.MarshalException ex)
+ catch(com.zeroc.Ice.MarshalException ex)
{
}
try
{
- os = new Ice.OutputStream(communicator);
+ os = new com.zeroc.Ice.OutputStream(communicator);
os.writeInt(-1); // Negative enumerators are not supported
- Ice.InputStream in = new Ice.InputStream(communicator, os.finished());
+ com.zeroc.Ice.InputStream in = new com.zeroc.Ice.InputStream(communicator, os.finished());
IntEnum.read(in);
test(false);
}
- catch(Ice.MarshalException ex)
+ catch(com.zeroc.Ice.MarshalException ex)
{
}
try
{
- os = new Ice.OutputStream(communicator);
+ os = new com.zeroc.Ice.OutputStream(communicator);
os.writeInt(2); // Invalid enumerator
- Ice.InputStream in = new Ice.InputStream(communicator, os.finished());
+ com.zeroc.Ice.InputStream in = new com.zeroc.Ice.InputStream(communicator, os.finished());
IntEnum.read(in);
test(false);
}
- catch(Ice.MarshalException ex)
+ catch(com.zeroc.Ice.MarshalException ex)
{
}
diff --git a/java/test/src/main/java/test/Ice/enums/Client.java b/java/test/src/main/java/test/Ice/enums/Client.java
index a27198b8b66..a1bb85c7c7a 100644
--- a/java/test/src/main/java/test/Ice/enums/Client.java
+++ b/java/test/src/main/java/test/Ice/enums/Client.java
@@ -16,19 +16,18 @@ public class Client extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.Communicator communicator = communicator();
TestIntfPrx test = AllTests.allTests(communicator, getWriter());
test.shutdown();
return 0;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.enums");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.enums");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/enums/Server.java b/java/test/src/main/java/test/Ice/enums/Server.java
index 69c4bf6459e..f79e37caf20 100644
--- a/java/test/src/main/java/test/Ice/enums/Server.java
+++ b/java/test/src/main/java/test/Ice/enums/Server.java
@@ -14,10 +14,10 @@ public class Server extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Object test = new TestIntfI();
- adapter.add(test, Ice.Util.stringToIdentity("test"));
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.Object test = new TestIntfI();
+ adapter.add(test, com.zeroc.Ice.Util.stringToIdentity("test"));
adapter.activate();
@@ -25,13 +25,12 @@ public class Server extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.enums");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.enums");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/enums/TestIntfI.java b/java/test/src/main/java/test/Ice/enums/TestIntfI.java
index 811c40a00ce..4dbd49cf2ff 100644
--- a/java/test/src/main/java/test/Ice/enums/TestIntfI.java
+++ b/java/test/src/main/java/test/Ice/enums/TestIntfI.java
@@ -11,75 +11,58 @@ package test.Ice.enums;
import test.Ice.enums.Test.*;
-public final class TestIntfI extends _TestIntfDisp
+public final class TestIntfI implements TestIntf
{
@Override
- public ByteEnum
- opByte(ByteEnum b1, ByteEnumHolder b2, Ice.Current current)
+ public TestIntf.OpByteResult opByte(ByteEnum b1, com.zeroc.Ice.Current current)
{
- b2.value = b1;
- return b1;
+ return new TestIntf.OpByteResult(b1, b1);
}
@Override
- public ShortEnum
- opShort(ShortEnum s1, ShortEnumHolder s2, Ice.Current current)
+ public TestIntf.OpShortResult opShort(ShortEnum s1, com.zeroc.Ice.Current current)
{
- s2.value = s1;
- return s1;
+ return new TestIntf.OpShortResult(s1, s1);
}
@Override
- public IntEnum
- opInt(IntEnum i1, IntEnumHolder i2, Ice.Current current)
+ public TestIntf.OpIntResult opInt(IntEnum i1, com.zeroc.Ice.Current current)
{
- i2.value = i1;
- return i1;
+ return new TestIntf.OpIntResult(i1, i1);
}
@Override
- public SimpleEnum
- opSimple(SimpleEnum s1, SimpleEnumHolder s2, Ice.Current current)
+ public TestIntf.OpSimpleResult opSimple(SimpleEnum s1, com.zeroc.Ice.Current current)
{
- s2.value = s1;
- return s1;
+ return new TestIntf.OpSimpleResult(s1, s1);
}
@Override
- public ByteEnum[]
- opByteSeq(ByteEnum[] b1, ByteEnumSeqHolder b2, Ice.Current current)
+ public TestIntf.OpByteSeqResult opByteSeq(ByteEnum[] b1, com.zeroc.Ice.Current current)
{
- b2.value = b1;
- return b1;
+ return new TestIntf.OpByteSeqResult(b1, b1);
}
@Override
- public ShortEnum[]
- opShortSeq(ShortEnum[] s1, ShortEnumSeqHolder s2, Ice.Current current)
+ public TestIntf.OpShortSeqResult opShortSeq(ShortEnum[] s1, com.zeroc.Ice.Current current)
{
- s2.value = s1;
- return s1;
+ return new TestIntf.OpShortSeqResult(s1, s1);
}
@Override
- public IntEnum[]
- opIntSeq(IntEnum[] i1, IntEnumSeqHolder i2, Ice.Current current)
+ public TestIntf.OpIntSeqResult opIntSeq(IntEnum[] i1, com.zeroc.Ice.Current current)
{
- i2.value = i1;
- return i1;
+ return new TestIntf.OpIntSeqResult(i1, i1);
}
@Override
- public SimpleEnum[]
- opSimpleSeq(SimpleEnum[] s1, SimpleEnumSeqHolder s2, Ice.Current current)
+ public TestIntf.OpSimpleSeqResult opSimpleSeq(SimpleEnum[] s1, com.zeroc.Ice.Current current)
{
- s2.value = s1;
- return s1;
+ return new TestIntf.OpSimpleSeqResult(s1, s1);
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
diff --git a/java/test/src/main/java/test/Ice/exceptions/AMDServer.java b/java/test/src/main/java/test/Ice/exceptions/AMDServer.java
index e7d8f9b0d1e..b4722c076cf 100644
--- a/java/test/src/main/java/test/Ice/exceptions/AMDServer.java
+++ b/java/test/src/main/java/test/Ice/exceptions/AMDServer.java
@@ -14,14 +14,14 @@ public class AMDServer extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("TestAdapter2");
- Ice.ObjectAdapter adapter3 = communicator.createObjectAdapter("TestAdapter3");
- Ice.Object object = new ThrowerI();
- adapter.add(object, Ice.Util.stringToIdentity("thrower"));
- adapter2.add(object, Ice.Util.stringToIdentity("thrower"));
- adapter3.add(object, Ice.Util.stringToIdentity("thrower"));
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("TestAdapter2");
+ com.zeroc.Ice.ObjectAdapter adapter3 = communicator.createObjectAdapter("TestAdapter3");
+ com.zeroc.Ice.Object object = new ThrowerI();
+ adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("thrower"));
+ adapter2.add(object, com.zeroc.Ice.Util.stringToIdentity("thrower"));
+ adapter3.add(object, com.zeroc.Ice.Util.stringToIdentity("thrower"));
adapter.activate();
adapter2.activate();
adapter3.activate();
@@ -29,27 +29,27 @@ public class AMDServer extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
+ GetInitDataResult r = super.getInitData(args);
+
//
// For this test, we need a dummy logger, otherwise the
// assertion test will print an error message.
//
- initData.logger = new DummyLogger();
+ r.initData.logger = new DummyLogger();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions.AMD");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max
- initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011");
- initData.properties.setProperty("TestAdapter2.MessageSizeMax", "0");
- initData.properties.setProperty("TestAdapter3.Endpoints", "default -p 12012");
- initData.properties.setProperty("TestAdapter3.MessageSizeMax", "1");
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ r.initData.properties.setProperty("Ice.Warn.Connections", "0");
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions.AMD");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ r.initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max
+ r.initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011");
+ r.initData.properties.setProperty("TestAdapter2.MessageSizeMax", "0");
+ r.initData.properties.setProperty("TestAdapter3.Endpoints", "default -p 12012");
+ r.initData.properties.setProperty("TestAdapter3.MessageSizeMax", "1");
- return initData;
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/exceptions/AMDThrowerI.java b/java/test/src/main/java/test/Ice/exceptions/AMDThrowerI.java
index 1b7066269a2..157e0697b7d 100644
--- a/java/test/src/main/java/test/Ice/exceptions/AMDThrowerI.java
+++ b/java/test/src/main/java/test/Ice/exceptions/AMDThrowerI.java
@@ -9,231 +9,218 @@
package test.Ice.exceptions;
+import java.util.concurrent.CompletionStage;
+import java.util.concurrent.CompletableFuture;
+
import test.Ice.exceptions.AMD.Test.A;
-import test.Ice.exceptions.AMD.Test.AMD_Thrower_shutdown;
-import test.Ice.exceptions.AMD.Test.AMD_Thrower_supportsAssertException;
-import test.Ice.exceptions.AMD.Test.AMD_Thrower_supportsUndeclaredExceptions;
-import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwAasA;
-import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwAorDasAorD;
-import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwAssertException;
-import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwMemoryLimitException;
-import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwBasA;
-import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwBasB;
-import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwCasA;
-import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwCasB;
-import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwCasC;
-import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwLocalException;
-import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwLocalExceptionIdempotent;
-import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwNonIceException;
-import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwUndeclaredA;
-import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwUndeclaredB;
-import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwUndeclaredC;
-import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwAfterResponse;
-import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwAfterException;
import test.Ice.exceptions.AMD.Test.B;
import test.Ice.exceptions.AMD.Test.C;
import test.Ice.exceptions.AMD.Test.D;
-import test.Ice.exceptions.AMD.Test._ThrowerDisp;
+import test.Ice.exceptions.AMD.Test.Thrower;
-public final class AMDThrowerI extends _ThrowerDisp
+public final class AMDThrowerI implements Thrower
{
- public
- AMDThrowerI()
+ public AMDThrowerI()
{
}
@Override
- public void
- shutdown_async(AMD_Thrower_shutdown cb, Ice.Current current)
+ public CompletionStage<Void> shutdownAsync(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- supportsUndeclaredExceptions_async(AMD_Thrower_supportsUndeclaredExceptions cb, Ice.Current current)
+ public CompletionStage<Boolean> supportsUndeclaredExceptionsAsync(com.zeroc.Ice.Current current)
{
- cb.ice_response(true);
+ return CompletableFuture.completedFuture(true);
}
@Override
- public void
- supportsAssertException_async(AMD_Thrower_supportsAssertException cb, Ice.Current current)
+ public CompletionStage<Boolean> supportsAssertExceptionAsync(com.zeroc.Ice.Current current)
{
- cb.ice_response(true);
+ return CompletableFuture.completedFuture(true);
}
@Override
- public void
- throwAasA_async(AMD_Thrower_throwAasA cb, int a, Ice.Current current)
+ public CompletionStage<Void> throwAasAAsync(int a, com.zeroc.Ice.Current current)
throws A
{
+ CompletableFuture<Void> r = new CompletableFuture<>();
A ex = new A();
ex.aMem = a;
- cb.ice_exception(ex);
+ r.completeExceptionally(ex);
+ return r;
}
@Override
- public void
- throwAorDasAorD_async(AMD_Thrower_throwAorDasAorD cb, int a, Ice.Current current)
+ public CompletionStage<Void> throwAorDasAorDAsync(int a, com.zeroc.Ice.Current current)
throws A,
D
{
+ CompletableFuture<Void> r = new CompletableFuture<>();
if(a > 0)
{
A ex = new A();
ex.aMem = a;
- cb.ice_exception(ex);
+ r.completeExceptionally(ex);
}
else
{
D ex = new D();
ex.dMem = a;
- cb.ice_exception(ex);
+ r.completeExceptionally(ex);
}
+ return r;
}
@Override
- public void
- throwBasA_async(AMD_Thrower_throwBasA cb, int a, int b, Ice.Current current)
+ public CompletionStage<Void> throwBasAAsync(int a, int b, com.zeroc.Ice.Current current)
throws A
{
+ CompletableFuture<Void> r = new CompletableFuture<>();
B ex = new B();
ex.aMem = a;
ex.bMem = b;
throw ex;
- //cb.ice_exception(ex);
+ //r.completeExceptionally(ex);
}
@Override
- public void
- throwBasB_async(AMD_Thrower_throwBasB cb, int a, int b, Ice.Current current)
+ public CompletionStage<Void> throwBasBAsync(int a, int b, com.zeroc.Ice.Current current)
throws B
{
+ CompletableFuture<Void> r = new CompletableFuture<>();
B ex = new B();
ex.aMem = a;
ex.bMem = b;
throw ex;
- //cb.ice_exception(ex);
+ //r.completeExceptionally(ex);
}
@Override
- public void
- throwCasA_async(AMD_Thrower_throwCasA cb, int a, int b, int c, Ice.Current current)
+ public CompletionStage<Void> throwCasAAsync(int a, int b, int c, com.zeroc.Ice.Current current)
throws A
{
+ CompletableFuture<Void> r = new CompletableFuture<>();
C ex = new C();
ex.aMem = a;
ex.bMem = b;
ex.cMem = c;
- cb.ice_exception(ex);
+ r.completeExceptionally(ex);
+ return r;
}
@Override
- public void
- throwCasB_async(AMD_Thrower_throwCasB cb, int a, int b, int c, Ice.Current current)
+ public CompletionStage<Void> throwCasBAsync(int a, int b, int c, com.zeroc.Ice.Current current)
throws B
{
+ CompletableFuture<Void> r = new CompletableFuture<>();
C ex = new C();
ex.aMem = a;
ex.bMem = b;
ex.cMem = c;
- cb.ice_exception(ex);
+ r.completeExceptionally(ex);
+ return r;
}
@Override
- public void
- throwCasC_async(AMD_Thrower_throwCasC cb, int a, int b, int c, Ice.Current current)
+ public CompletionStage<Void> throwCasCAsync(int a, int b, int c, com.zeroc.Ice.Current current)
throws C
{
+ CompletableFuture<Void> r = new CompletableFuture<>();
C ex = new C();
ex.aMem = a;
ex.bMem = b;
ex.cMem = c;
- cb.ice_exception(ex);
+ r.completeExceptionally(ex);
+ return r;
}
@Override
- public void
- throwUndeclaredA_async(AMD_Thrower_throwUndeclaredA cb, int a, Ice.Current current)
+ public CompletionStage<Void> throwUndeclaredAAsync(int a, com.zeroc.Ice.Current current)
{
+ CompletableFuture<Void> r = new CompletableFuture<>();
A ex = new A();
ex.aMem = a;
- cb.ice_exception(ex);
+ r.completeExceptionally(ex);
+ return r;
}
@Override
- public void
- throwUndeclaredB_async(AMD_Thrower_throwUndeclaredB cb, int a, int b, Ice.Current current)
+ public CompletionStage<Void> throwUndeclaredBAsync(int a, int b, com.zeroc.Ice.Current current)
{
+ CompletableFuture<Void> r = new CompletableFuture<>();
B ex = new B();
ex.aMem = a;
ex.bMem = b;
- cb.ice_exception(ex);
+ r.completeExceptionally(ex);
+ return r;
}
@Override
- public void
- throwUndeclaredC_async(AMD_Thrower_throwUndeclaredC cb, int a, int b, int c, Ice.Current current)
+ public CompletionStage<Void> throwUndeclaredCAsync(int a, int b, int c, com.zeroc.Ice.Current current)
{
+ CompletableFuture<Void> r = new CompletableFuture<>();
C ex = new C();
ex.aMem = a;
ex.bMem = b;
ex.cMem = c;
- cb.ice_exception(ex);
+ r.completeExceptionally(ex);
+ return r;
}
@Override
- public void
- throwLocalException_async(AMD_Thrower_throwLocalException cb, Ice.Current current)
+ public CompletionStage<Void> throwLocalExceptionAsync(com.zeroc.Ice.Current current)
{
- cb.ice_exception(new Ice.TimeoutException());
+ CompletableFuture<Void> r = new CompletableFuture<>();
+ r.completeExceptionally(new com.zeroc.Ice.TimeoutException());
+ return r;
}
@Override
- public void
- throwNonIceException_async(AMD_Thrower_throwNonIceException cb, Ice.Current current)
+ public CompletionStage<Void> throwNonIceExceptionAsync(com.zeroc.Ice.Current current)
{
throw new RuntimeException();
}
@Override
- public void
- throwAssertException_async(AMD_Thrower_throwAssertException cb, Ice.Current current)
+ public CompletionStage<Void> throwAssertExceptionAsync(com.zeroc.Ice.Current current)
{
throw new java.lang.AssertionError();
}
@Override
- public void
- throwMemoryLimitException_async(AMD_Thrower_throwMemoryLimitException cb, byte[] seq, Ice.Current current)
+ public CompletionStage<byte[]> throwMemoryLimitExceptionAsync(byte[] seq, com.zeroc.Ice.Current current)
{
- cb.ice_response(new byte[1024 * 20]); // 20KB is over the configured 10KB message size max.
+ //
+ // 20KB is over the configured 10KB message size max.
+ //
+ return CompletableFuture.completedFuture(new byte[1024 * 20]);
}
@Override
- public void
- throwLocalExceptionIdempotent_async(AMD_Thrower_throwLocalExceptionIdempotent cb, Ice.Current current)
+ public CompletionStage<Void> throwLocalExceptionIdempotentAsync(com.zeroc.Ice.Current current)
{
- cb.ice_exception(new Ice.TimeoutException());
+ CompletableFuture<Void> r = new CompletableFuture<>();
+ r.completeExceptionally(new com.zeroc.Ice.TimeoutException());
+ return r;
}
@Override
- public void
- throwAfterResponse_async(AMD_Thrower_throwAfterResponse cb, Ice.Current current)
+ public CompletionStage<Void> throwAfterResponseAsync(com.zeroc.Ice.Current current)
{
- cb.ice_response();
+ // The Java 8 mapping doesn't support completing a request and continuing to use the dispatch thread.
throw new RuntimeException();
}
@Override
- public void
- throwAfterException_async(AMD_Thrower_throwAfterException cb, Ice.Current current)
+ public CompletionStage<Void> throwAfterExceptionAsync(com.zeroc.Ice.Current current)
throws A
{
- cb.ice_exception(new A());
+ // The Java 8 mapping doesn't support completing a request and continuing to use the dispatch thread.
throw new RuntimeException();
}
diff --git a/java/test/src/main/java/test/Ice/exceptions/AllTests.java b/java/test/src/main/java/test/Ice/exceptions/AllTests.java
index b417b1a427d..3d4be1c4ed2 100644
--- a/java/test/src/main/java/test/Ice/exceptions/AllTests.java
+++ b/java/test/src/main/java/test/Ice/exceptions/AllTests.java
@@ -9,35 +9,18 @@
package test.Ice.exceptions;
import java.io.PrintWriter;
+import java.util.concurrent.CompletionException;
import test.Ice.exceptions.Test.A;
import test.Ice.exceptions.Test.B;
import test.Ice.exceptions.Test.C;
import test.Ice.exceptions.Test.D;
import test.Ice.exceptions.Test.ThrowerPrx;
-import test.Ice.exceptions.Test.ThrowerPrxHelper;
import test.Ice.exceptions.Test.WrongOperationPrx;
-import test.Ice.exceptions.Test.WrongOperationPrxHelper;
-import test.Ice.exceptions.Test.Callback_Thrower_throwAasA;
-import test.Ice.exceptions.Test.Callback_Thrower_throwAorDasAorD;
-import test.Ice.exceptions.Test.Callback_Thrower_throwAssertException;
-import test.Ice.exceptions.Test.Callback_Thrower_throwBasA;
-import test.Ice.exceptions.Test.Callback_Thrower_throwBasB;
-import test.Ice.exceptions.Test.Callback_Thrower_throwCasA;
-import test.Ice.exceptions.Test.Callback_Thrower_throwCasB;
-import test.Ice.exceptions.Test.Callback_Thrower_throwCasC;
-import test.Ice.exceptions.Test.Callback_Thrower_throwLocalException;
-import test.Ice.exceptions.Test.Callback_Thrower_throwLocalExceptionIdempotent;
-import test.Ice.exceptions.Test.Callback_Thrower_throwNonIceException;
-import test.Ice.exceptions.Test.Callback_Thrower_throwUndeclaredA;
-import test.Ice.exceptions.Test.Callback_Thrower_throwUndeclaredB;
-import test.Ice.exceptions.Test.Callback_Thrower_throwUndeclaredC;
-import test.Ice.exceptions.Test.Callback_WrongOperation_noSuchOperation;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -45,692 +28,16 @@ public class AllTests
}
}
- private static class Callback
- {
- Callback()
- {
- _called = false;
- }
-
- public synchronized void check()
- {
- while(!_called)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- _called = false;
- }
-
- public synchronized void called()
- {
- assert(!_called);
- _called = true;
- notify();
- }
-
- private boolean _called;
- }
-
- private static class Callback_Thrower_throwAasAI extends Callback_Thrower_throwAasA
- {
- @Override
- public void response()
- {
- test(false);
- }
-
- @Override
- public void exception(Ice.LocalException exc)
- {
- exc.printStackTrace();
- test(false);
- }
-
- @Override
- public void exception(Ice.UserException exc)
- {
- try
- {
- throw exc;
- }
- catch(A ex)
- {
- test(ex.aMem == 1);
- }
- catch(Throwable ex)
- {
- ex.printStackTrace();
- test(false);
- }
- callback.called();
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_Thrower_throwAasAObjectNotExistI extends Callback_Thrower_throwAasA
- {
- Callback_Thrower_throwAasAObjectNotExistI(Ice.Communicator communicator)
- {
- _communicator = communicator;
- }
-
- @Override
- public void response()
- {
- test(false);
- }
-
- @Override
- public void exception(Ice.LocalException exc)
- {
- try
- {
- throw exc;
- }
- catch(Ice.ObjectNotExistException ex)
- {
- Ice.Identity id = Ice.Util.stringToIdentity("does not exist");
- test(ex.id.equals(id));
- }
- catch(Throwable ex)
- {
- ex.printStackTrace();
- test(false);
- }
- callback.called();
- }
-
- @Override
- public void exception(Ice.UserException exc)
- {
- exc.printStackTrace();
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- private Ice.Communicator _communicator;
- }
-
- private static class Callback_Thrower_throwAasAFacetNotExistI extends Callback_Thrower_throwAasA
- {
- @Override
- public void response()
- {
- test(false);
- }
-
- @Override
- public void exception(Ice.LocalException exc)
- {
- try
- {
- throw exc;
- }
- catch(Ice.FacetNotExistException ex)
- {
- test(ex.facet.equals("no such facet"));
- }
- catch(Throwable ex)
- {
- ex.printStackTrace();
- test(false);
- }
- callback.called();
- }
-
- @Override
- public void exception(Ice.UserException exc)
- {
- exc.printStackTrace();
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_Thrower_throwAorDasAorDI extends Callback_Thrower_throwAorDasAorD
- {
- @Override
- public void response()
- {
- test(false);
- }
-
- @Override
- public void exception(Ice.LocalException exc)
- {
- exc.printStackTrace();
- test(false);
- }
-
- @Override
- public void exception(Ice.UserException exc)
- {
- try
- {
- throw exc;
- }
- catch(A ex)
- {
- test(ex.aMem == 1);
- }
- catch(D ex)
- {
- test(ex.dMem == -1);
- }
- catch(Throwable ex)
- {
- ex.printStackTrace();
- test(false);
- }
- callback.called();
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_Thrower_throwBasAI extends Callback_Thrower_throwBasA
- {
- @Override
- public void response()
- {
- test(false);
- }
-
- @Override
- public void exception(Ice.LocalException exc)
- {
- exc.printStackTrace();
- test(false);
- }
-
- @Override
- public void exception(Ice.UserException exc)
- {
- try
- {
- throw exc;
- }
- catch(B ex)
- {
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- }
- catch(Throwable ex)
- {
- ex.printStackTrace();
- test(false);
- }
- callback.called();
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_Thrower_throwCasAI extends Callback_Thrower_throwCasA
- {
- @Override
- public void response()
- {
- test(false);
- }
-
- @Override
- public void exception(Ice.LocalException exc)
- {
- exc.printStackTrace();
- test(false);
- }
-
- @Override
- public void exception(Ice.UserException exc)
- {
- try
- {
- throw exc;
- }
- catch(C ex)
- {
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- test(ex.cMem == 3);
- }
- catch(Throwable ex)
- {
- ex.printStackTrace();
- test(false);
- }
- callback.called();
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_Thrower_throwBasBI extends Callback_Thrower_throwBasB
- {
- @Override
- public void response()
- {
- test(false);
- }
-
- @Override
- public void exception(Ice.LocalException exc)
- {
- exc.printStackTrace();
- test(false);
- }
-
- @Override
- public void exception(Ice.UserException exc)
- {
- try
- {
- throw exc;
- }
- catch(B ex)
- {
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- }
- catch(Throwable ex)
- {
- ex.printStackTrace();
- test(false);
- }
- callback.called();
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_Thrower_throwCasBI extends Callback_Thrower_throwCasB
- {
- @Override
- public void response()
- {
- test(false);
- }
-
- @Override
- public void exception(Ice.LocalException exc)
- {
- exc.printStackTrace();
- test(false);
- }
-
- @Override
- public void exception(Ice.UserException exc)
- {
- try
- {
- throw exc;
- }
- catch(C ex)
- {
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- test(ex.cMem == 3);
- }
- catch(Throwable ex)
- {
- ex.printStackTrace();
- test(false);
- }
- callback.called();
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_Thrower_throwCasCI extends Callback_Thrower_throwCasC
- {
- @Override
- public void response()
- {
- test(false);
- }
-
- @Override
- public void exception(Ice.LocalException exc)
- {
- exc.printStackTrace();
- test(false);
- }
-
- @Override
- public void exception(Ice.UserException exc)
- {
- try
- {
- throw exc;
- }
- catch(C ex)
- {
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- test(ex.cMem == 3);
- }
- catch(Throwable ex)
- {
- ex.printStackTrace();
- test(false);
- }
- callback.called();
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_Thrower_throwUndeclaredAI extends Callback_Thrower_throwUndeclaredA
- {
- @Override
- public void response()
- {
- test(false);
- }
-
- @Override
- public void exception(Ice.LocalException exc)
- {
- try
- {
- throw exc;
- }
- catch(Ice.UnknownUserException ex)
- {
- }
- catch(Throwable ex)
- {
- ex.printStackTrace();
- test(false);
- }
- callback.called();
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_Thrower_throwUndeclaredBI extends Callback_Thrower_throwUndeclaredB
- {
- @Override
- public void response()
- {
- test(false);
- }
-
- @Override
- public void exception(Ice.LocalException exc)
- {
- try
- {
- throw exc;
- }
- catch(Ice.UnknownUserException ex)
- {
- }
- catch(Throwable ex)
- {
- ex.printStackTrace();
- test(false);
- }
- callback.called();
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_Thrower_throwUndeclaredCI extends Callback_Thrower_throwUndeclaredC
- {
- @Override
- public void response()
- {
- test(false);
- }
-
- @Override
- public void exception(Ice.LocalException exc)
- {
- try
- {
- throw exc;
- }
- catch(Ice.UnknownUserException ex)
- {
- }
- catch(Throwable ex)
- {
- ex.printStackTrace();
- test(false);
- }
- callback.called();
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_Thrower_throwLocalExceptionI extends Callback_Thrower_throwLocalException
- {
- @Override
- public void response()
- {
- test(false);
- }
-
- @Override
- public void exception(Ice.LocalException exc)
- {
- try
- {
- throw exc;
- }
- catch(Ice.UnknownLocalException ex)
- {
- }
- catch(Ice.OperationNotExistException ex)
- {
- }
- catch(Throwable ex)
- {
- ex.printStackTrace();
- test(false);
- }
- callback.called();
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_Thrower_throwNonIceExceptionI extends Callback_Thrower_throwNonIceException
- {
- @Override
- public void response()
- {
- test(false);
- }
-
- @Override
- public void exception(Ice.LocalException exc)
- {
- try
- {
- throw exc;
- }
- catch(Ice.UnknownException ex)
- {
- }
- catch(Throwable ex)
- {
- ex.printStackTrace();
- test(false);
- }
- callback.called();
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_Thrower_throwAssertExceptionI extends Callback_Thrower_throwAssertException
- {
- @Override
- public void response()
- {
- test(false);
- }
-
- @Override
- public void exception(Ice.LocalException exc)
- {
- try
- {
- throw exc;
- }
- catch(Ice.ConnectionLostException ex)
- {
- }
- catch(Ice.UnknownException ex)
- {
- }
- catch(Throwable ex)
- {
- ex.printStackTrace();
- test(false);
- }
- callback.called();
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_WrongOperation_noSuchOperationI extends Callback_WrongOperation_noSuchOperation
- {
- @Override
- public void response()
- {
- test(false);
- }
-
- @Override
- public void exception(Ice.LocalException exc)
- {
- try
- {
- throw exc;
- }
- catch(Ice.OperationNotExistException ex)
- {
- test(ex.operation.equals("noSuchOperation"));
- }
- catch(Throwable ex)
- {
- ex.printStackTrace();
- test(false);
- }
- callback.called();
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- public static ThrowerPrx
- allTests(Ice.Communicator communicator, PrintWriter out)
+ public static ThrowerPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out)
{
{
out.print("testing object adapter registration exceptions... ");
- Ice.ObjectAdapter first;
+ com.zeroc.Ice.ObjectAdapter first;
try
{
first = communicator.createObjectAdapter("TestAdapter0");
}
- catch(Ice.InitializationException ex)
+ catch(com.zeroc.Ice.InitializationException ex)
{
// Expected
}
@@ -742,7 +49,7 @@ public class AllTests
communicator.createObjectAdapter("TestAdapter0");
test(false);
}
- catch(Ice.AlreadyRegisteredException ex)
+ catch(com.zeroc.Ice.AlreadyRegisteredException ex)
{
// Expected
}
@@ -752,7 +59,7 @@ public class AllTests
communicator.createObjectAdapterWithEndpoints("TestAdapter0", "ssl -h foo -p 12011");
test(false);
}
- catch(Ice.AlreadyRegisteredException ex)
+ catch(com.zeroc.Ice.AlreadyRegisteredException ex)
{
// Expected
}
@@ -763,43 +70,43 @@ public class AllTests
{
out.print("testing servant registration exceptions... ");
communicator.getProperties().setProperty("TestAdapter1.Endpoints", "default");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter1");
- Ice.Object obj = new EmptyI();
- adapter.add(obj, Ice.Util.stringToIdentity("x"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter1");
+ com.zeroc.Ice.Object obj = new EmptyI();
+ adapter.add(obj, com.zeroc.Ice.Util.stringToIdentity("x"));
try
{
- adapter.add(obj, Ice.Util.stringToIdentity("x"));
+ adapter.add(obj, com.zeroc.Ice.Util.stringToIdentity("x"));
test(false);
}
- catch(Ice.AlreadyRegisteredException ex)
+ catch(com.zeroc.Ice.AlreadyRegisteredException ex)
{
}
try
{
- adapter.add(obj, Ice.Util.stringToIdentity(""));
+ adapter.add(obj, com.zeroc.Ice.Util.stringToIdentity(""));
test(false);
}
- catch(Ice.IllegalIdentityException ex)
+ catch(com.zeroc.Ice.IllegalIdentityException ex)
{
test(ex.id.name.equals(""));
}
try
{
- adapter.add(null, Ice.Util.stringToIdentity("x"));
+ adapter.add(null, com.zeroc.Ice.Util.stringToIdentity("x"));
test(false);
}
- catch(Ice.IllegalServantException ex)
+ catch(com.zeroc.Ice.IllegalServantException ex)
{
}
- adapter.remove(Ice.Util.stringToIdentity("x"));
+ adapter.remove(com.zeroc.Ice.Util.stringToIdentity("x"));
try
{
- adapter.remove(Ice.Util.stringToIdentity("x"));
+ adapter.remove(com.zeroc.Ice.Util.stringToIdentity("x"));
test(false);
}
- catch(Ice.NotRegisteredException ex)
+ catch(com.zeroc.Ice.NotRegisteredException ex)
{
}
adapter.deactivate();
@@ -809,15 +116,15 @@ public class AllTests
{
out.print("testing servant locator registration exceptions... ");
communicator.getProperties().setProperty("TestAdapter2.Endpoints", "default");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter2");
- Ice.ServantLocator loc = new ServantLocatorI();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter2");
+ com.zeroc.Ice.ServantLocator loc = new ServantLocatorI();
adapter.addServantLocator(loc, "x");
try
{
adapter.addServantLocator(loc, "x");
test(false);
}
- catch(Ice.AlreadyRegisteredException ex)
+ catch(com.zeroc.Ice.AlreadyRegisteredException ex)
{
}
@@ -827,14 +134,14 @@ public class AllTests
{
out.print("testing value factory registration exception... ");
- Ice.ValueFactory of = new ValueFactoryI();
+ com.zeroc.Ice.ValueFactory of = new ValueFactoryI();
communicator.getValueFactoryManager().add(of, "::x");
try
{
communicator.getValueFactoryManager().add(of, "::x");
test(false);
}
- catch(Ice.AlreadyRegisteredException ex)
+ catch(com.zeroc.Ice.AlreadyRegisteredException ex)
{
}
out.println("ok");
@@ -843,13 +150,13 @@ public class AllTests
out.print("testing stringToProxy... ");
out.flush();
String ref = "thrower:default -p 12010";
- Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref);
test(base != null);
out.println("ok");
out.print("testing checked cast... ");
out.flush();
- ThrowerPrx thrower = ThrowerPrxHelper.checkedCast(base);
+ ThrowerPrx thrower = ThrowerPrx.checkedCast(base);
test(thrower != null);
test(thrower.equals(base));
out.println("ok");
@@ -1038,7 +345,7 @@ public class AllTests
thrower.throwUndeclaredA(1);
test(false);
}
- catch(Ice.UnknownUserException ex)
+ catch(com.zeroc.Ice.UnknownUserException ex)
{
}
catch(Throwable ex)
@@ -1052,7 +359,7 @@ public class AllTests
thrower.throwUndeclaredB(1, 2);
test(false);
}
- catch(Ice.UnknownUserException ex)
+ catch(com.zeroc.Ice.UnknownUserException ex)
{
}
catch(Throwable ex)
@@ -1066,7 +373,7 @@ public class AllTests
thrower.throwUndeclaredC(1, 2, 3);
test(false);
}
- catch(Ice.UnknownUserException ex)
+ catch(com.zeroc.Ice.UnknownUserException ex)
{
}
catch(Throwable ex)
@@ -1088,10 +395,10 @@ public class AllTests
thrower.throwAssertException();
test(false);
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
}
- catch(Ice.UnknownException ex)
+ catch(com.zeroc.Ice.UnknownException ex)
{
}
catch(Throwable ex)
@@ -1112,7 +419,7 @@ public class AllTests
thrower.throwMemoryLimitException(null);
test(false);
}
- catch(Ice.MemoryLimitException ex)
+ catch(com.zeroc.Ice.MemoryLimitException ex)
{
}
catch(Throwable ex)
@@ -1126,10 +433,10 @@ public class AllTests
thrower.throwMemoryLimitException(new byte[20 * 1024]); // 20KB
test(false);
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
}
- catch(Ice.SocketException ex)
+ catch(com.zeroc.Ice.SocketException ex)
{
// This can be raised if the connection is closed during the client's call to write().
}
@@ -1139,23 +446,21 @@ public class AllTests
test(false);
}
- ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(
- communicator.stringToProxy("thrower:default -p 12011"));
+ ThrowerPrx thrower2 = ThrowerPrx.uncheckedCast(communicator.stringToProxy("thrower:default -p 12011"));
try
{
thrower2.throwMemoryLimitException(new byte[2 * 1024 * 1024]); // 2MB (no limits)
}
- catch(Ice.MemoryLimitException ex)
+ catch(com.zeroc.Ice.MemoryLimitException ex)
{
}
- ThrowerPrx thrower3 = ThrowerPrxHelper.uncheckedCast(
- communicator.stringToProxy("thrower:default -p 12012"));
+ ThrowerPrx thrower3 = ThrowerPrx.uncheckedCast(communicator.stringToProxy("thrower:default -p 12012"));
try
{
thrower3.throwMemoryLimitException(new byte[1024]); // 1KB limit
test(false);
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
}
@@ -1166,14 +471,14 @@ public class AllTests
out.flush();
{
- Ice.Identity id = Ice.Util.stringToIdentity("does not exist");
+ com.zeroc.Ice.Identity id = com.zeroc.Ice.Util.stringToIdentity("does not exist");
try
{
- ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id));
+ ThrowerPrx thrower2 = ThrowerPrx.uncheckedCast(thrower.ice_identity(id));
thrower2.ice_ping();
test(false);
}
- catch(Ice.ObjectNotExistException ex)
+ catch(com.zeroc.Ice.ObjectNotExistException ex)
{
test(ex.id.equals(id));
}
@@ -1191,13 +496,13 @@ public class AllTests
try
{
- ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower, "no such facet");
+ ThrowerPrx thrower2 = ThrowerPrx.uncheckedCast(thrower, "no such facet");
try
{
thrower2.ice_ping();
test(false);
}
- catch(Ice.FacetNotExistException ex)
+ catch(com.zeroc.Ice.FacetNotExistException ex)
{
test(ex.facet.equals("no such facet"));
}
@@ -1215,11 +520,11 @@ public class AllTests
try
{
- WrongOperationPrx thrower2 = WrongOperationPrxHelper.uncheckedCast(thrower);
+ WrongOperationPrx thrower2 = WrongOperationPrx.uncheckedCast(thrower);
thrower2.noSuchOperation();
test(false);
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
test(ex.operation.equals("noSuchOperation"));
}
@@ -1239,7 +544,7 @@ public class AllTests
thrower.throwLocalException();
test(false);
}
- catch(Ice.UnknownLocalException ex)
+ catch(com.zeroc.Ice.UnknownLocalException ex)
{
}
catch(Throwable ex)
@@ -1253,10 +558,10 @@ public class AllTests
thrower.throwLocalExceptionIdempotent();
test(false);
}
- catch(Ice.UnknownLocalException ex)
+ catch(com.zeroc.Ice.UnknownLocalException ex)
{
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
catch(Throwable ex)
@@ -1275,7 +580,7 @@ public class AllTests
thrower.throwNonIceException();
test(false);
}
- catch(Ice.UnknownException ex)
+ catch(com.zeroc.Ice.UnknownException ex)
{
}
catch(Throwable ex)
@@ -1293,7 +598,7 @@ public class AllTests
{
thrower.throwAfterResponse();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -1311,7 +616,7 @@ public class AllTests
catch(A ex)
{
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -1326,82 +631,142 @@ public class AllTests
out.print("catching exact types with AMI mapping... ");
out.flush();
+ try
{
- Callback_Thrower_throwAasAI cb = new Callback_Thrower_throwAasAI();
- thrower.begin_throwAasA(1, cb);
- cb.check();
+ thrower.throwAasAAsync(1).join();
+ test(false);
+ }
+ catch(CompletionException ex)
+ {
+ test(ex.getCause() instanceof A);
+ test(((A)ex.getCause()).aMem == 1);
}
+ try
{
- Callback_Thrower_throwAorDasAorDI cb = new Callback_Thrower_throwAorDasAorDI();
- thrower.begin_throwAorDasAorD(1, cb);
- cb.check();
+ thrower.throwAorDasAorDAsync(1).join();
+ test(false);
+ }
+ catch(CompletionException ex)
+ {
+ test(ex.getCause() instanceof A);
+ test(((A)ex.getCause()).aMem == 1);
}
+ try
{
- Callback_Thrower_throwAorDasAorDI cb = new Callback_Thrower_throwAorDasAorDI();
- thrower.begin_throwAorDasAorD(-1, cb);
- cb.check();
+ thrower.throwAorDasAorDAsync(-1).join();
+ test(false);
+ }
+ catch(CompletionException ex)
+ {
+ test(ex.getCause() instanceof D);
+ test(((D)ex.getCause()).dMem == -1);
}
+ try
{
- Callback_Thrower_throwBasBI cb = new Callback_Thrower_throwBasBI();
- thrower.begin_throwBasB(1, 2, cb);
- cb.check();
+ thrower.throwBasBAsync(1, 2).join();
+ test(false);
+ }
+ catch(CompletionException ex)
+ {
+ test(ex.getCause() instanceof B);
+ test(((B)ex.getCause()).aMem == 1);
+ test(((B)ex.getCause()).bMem == 2);
}
+ try
{
- Callback_Thrower_throwCasCI cb = new Callback_Thrower_throwCasCI();
- thrower.begin_throwCasC(1, 2, 3, cb);
- cb.check();
+ thrower.throwCasCAsync(1, 2, 3).join();
+ test(false);
+ }
+ catch(CompletionException ex)
+ {
+ test(ex.getCause() instanceof C);
+ test(((C)ex.getCause()).aMem == 1);
+ test(((C)ex.getCause()).bMem == 2);
+ test(((C)ex.getCause()).cMem == 3);
}
out.println("ok");
- out.print("catching derived types with mapping... ");
+ out.print("catching derived types with AMI mapping... ");
out.flush();
+ try
{
- Callback_Thrower_throwBasAI cb = new Callback_Thrower_throwBasAI();
- thrower.begin_throwBasA(1, 2, cb);
- cb.check();
+ thrower.throwBasAAsync(1, 2).join();
+ test(false);
+ }
+ catch(CompletionException ex)
+ {
+ test(ex.getCause() instanceof B);
+ test(((B)ex.getCause()).aMem == 1);
+ test(((B)ex.getCause()).bMem == 2);
}
+ try
{
- Callback_Thrower_throwCasAI cb = new Callback_Thrower_throwCasAI();
- thrower.begin_throwCasA(1, 2, 3, cb);
- cb.check();
+ thrower.throwCasAAsync(1, 2, 3).join();
+ test(false);
+ }
+ catch(CompletionException ex)
+ {
+ test(ex.getCause() instanceof C);
+ test(((C)ex.getCause()).aMem == 1);
+ test(((C)ex.getCause()).bMem == 2);
+ test(((C)ex.getCause()).cMem == 3);
}
+ try
{
- Callback_Thrower_throwCasBI cb = new Callback_Thrower_throwCasBI();
- thrower.begin_throwCasB(1, 2, 3, cb);
- cb.check();
+ thrower.throwCasBAsync(1, 2, 3).join();
+ test(false);
+ }
+ catch(CompletionException ex)
+ {
+ test(ex.getCause() instanceof C);
+ test(((C)ex.getCause()).aMem == 1);
+ test(((C)ex.getCause()).bMem == 2);
+ test(((C)ex.getCause()).cMem == 3);
}
out.println("ok");
if(thrower.supportsUndeclaredExceptions())
{
- out.print("catching unknown user exception with mapping... ");
+ out.print("catching unknown user exception with AMI mapping... ");
out.flush();
+ try
{
- Callback_Thrower_throwUndeclaredAI cb = new Callback_Thrower_throwUndeclaredAI();
- thrower.begin_throwUndeclaredA(1, cb);
- cb.check();
+ thrower.throwUndeclaredAAsync(1).join();
+ test(false);
+ }
+ catch(CompletionException ex)
+ {
+ test(ex.getCause() instanceof com.zeroc.Ice.UnknownUserException);
}
+ try
{
- Callback_Thrower_throwUndeclaredBI cb = new Callback_Thrower_throwUndeclaredBI();
- thrower.begin_throwUndeclaredB(1, 2, cb);
- cb.check();
+ thrower.throwUndeclaredBAsync(1, 2).join();
+ test(false);
+ }
+ catch(CompletionException ex)
+ {
+ test(ex.getCause() instanceof com.zeroc.Ice.UnknownUserException);
}
+ try
{
- Callback_Thrower_throwUndeclaredCI cb = new Callback_Thrower_throwUndeclaredCI();
- thrower.begin_throwUndeclaredC(1, 2, 3, cb);
- cb.check();
+ thrower.throwUndeclaredCAsync(1, 2, 3).join();
+ test(false);
+ }
+ catch(CompletionException ex)
+ {
+ test(ex.getCause() instanceof com.zeroc.Ice.UnknownUserException);
}
out.println("ok");
@@ -1409,90 +774,117 @@ public class AllTests
if(thrower.supportsAssertException())
{
- out.print("catching assert in the server with mapping... ");
+ out.print("catching assert in the server with AMI mapping... ");
out.flush();
- Callback_Thrower_throwAssertExceptionI cb = new Callback_Thrower_throwAssertExceptionI();
- thrower.begin_throwAssertException(cb);
- cb.check();
+ try
+ {
+ thrower.throwAssertExceptionAsync().join();
+ test(false);
+ }
+ catch(CompletionException ex)
+ {
+ test(ex.getCause() instanceof com.zeroc.Ice.ConnectionLostException ||
+ ex.getCause() instanceof com.zeroc.Ice.UnknownException);
+ }
out.println("ok");
}
- out.print("catching object not exist exception with mapping... ");
+ out.print("catching object not exist exception with AMI mapping... ");
out.flush();
{
- Ice.Identity id = Ice.Util.stringToIdentity("does not exist");
- ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id));
- Callback_Thrower_throwAasAObjectNotExistI cb = new Callback_Thrower_throwAasAObjectNotExistI(communicator);
- thrower2.begin_throwAasA(1, cb);
- cb.check();
+ com.zeroc.Ice.Identity id = com.zeroc.Ice.Util.stringToIdentity("does not exist");
+ ThrowerPrx thrower2 = ThrowerPrx.uncheckedCast(thrower.ice_identity(id));
+ try
+ {
+ thrower2.throwAasAAsync(1).join();
+ test(false);
+ }
+ catch(CompletionException ex)
+ {
+ test(ex.getCause() instanceof com.zeroc.Ice.ObjectNotExistException);
+ test(((com.zeroc.Ice.ObjectNotExistException)ex.getCause()).id.name.equals("does not exist"));
+ }
}
out.println("ok");
- out.print("catching facet not exist exception with mapping... ");
+ out.print("catching facet not exist exception with AMI mapping... ");
out.flush();
{
- ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower, "no such facet");
- Callback_Thrower_throwAasAFacetNotExistI cb = new Callback_Thrower_throwAasAFacetNotExistI();
- thrower2.begin_throwAasA(1, cb);
- cb.check();
+ ThrowerPrx thrower2 = ThrowerPrx.uncheckedCast(thrower, "no such facet");
+ try
+ {
+ thrower2.throwAasAAsync(1).join();
+ }
+ catch(CompletionException ex)
+ {
+ test(ex.getCause() instanceof com.zeroc.Ice.FacetNotExistException);
+ test(((com.zeroc.Ice.FacetNotExistException)ex.getCause()).facet.equals("no such facet"));
+ }
}
out.println("ok");
- out.print("catching operation not exist exception with mapping... ");
+ out.print("catching operation not exist exception with AMI mapping... ");
out.flush();
{
- Callback_WrongOperation_noSuchOperationI cb = new Callback_WrongOperation_noSuchOperationI();
- WrongOperationPrx thrower2 = WrongOperationPrxHelper.uncheckedCast(thrower);
- thrower2.begin_noSuchOperation(cb);
- cb.check();
+ WrongOperationPrx thrower2 = WrongOperationPrx.uncheckedCast(thrower);
+ try
+ {
+ thrower2.noSuchOperationAsync().join();
+ }
+ catch(CompletionException ex)
+ {
+ test(ex.getCause() instanceof com.zeroc.Ice.OperationNotExistException);
+ test(((com.zeroc.Ice.OperationNotExistException)ex.getCause()).operation.equals("noSuchOperation"));
+ }
}
out.println("ok");
- out.print("catching unknown local exception with mapping... ");
+ out.print("catching unknown local exception with AMI mapping... ");
out.flush();
+ try
{
- Callback_Thrower_throwLocalExceptionI cb = new Callback_Thrower_throwLocalExceptionI();
- thrower.begin_throwLocalException(cb);
- cb.check();
+ thrower.throwLocalExceptionAsync().join();
+ test(false);
}
-
+ catch(CompletionException ex)
{
- final Callback_Thrower_throwLocalExceptionI cb = new Callback_Thrower_throwLocalExceptionI();
- thrower.begin_throwLocalExceptionIdempotent(new Callback_Thrower_throwLocalExceptionIdempotent()
- {
- @Override
- public void response()
- {
- cb.response();
- }
+ test(ex.getCause() instanceof com.zeroc.Ice.UnknownLocalException ||
+ ex.getCause() instanceof com.zeroc.Ice.OperationNotExistException);
+ }
- @Override
- public void exception(Ice.LocalException exc)
- {
- cb.exception(exc);
- }
- });
- cb.check();
+ try
+ {
+ thrower.throwLocalExceptionIdempotentAsync().join();
+ test(false);
+ }
+ catch(CompletionException ex)
+ {
+ test(ex.getCause() instanceof com.zeroc.Ice.UnknownLocalException ||
+ ex.getCause() instanceof com.zeroc.Ice.OperationNotExistException);
}
out.println("ok");
- out.print("catching unknown non-Ice exception with mapping... ");
+ out.print("catching unknown non-Ice exception with AMI mapping... ");
out.flush();
+ try
+ {
+ thrower.throwNonIceExceptionAsync().join();
+ test(false);
+ }
+ catch(CompletionException ex)
{
- Callback_Thrower_throwNonIceExceptionI cb = new Callback_Thrower_throwNonIceExceptionI();
- thrower.begin_throwNonIceException(cb);
- cb.check();
+ test(ex.getCause() instanceof com.zeroc.Ice.UnknownException);
}
out.println("ok");
diff --git a/java/test/src/main/java/test/Ice/exceptions/Client.java b/java/test/src/main/java/test/Ice/exceptions/Client.java
index 741de95a736..250f94e580b 100644
--- a/java/test/src/main/java/test/Ice/exceptions/Client.java
+++ b/java/test/src/main/java/test/Ice/exceptions/Client.java
@@ -16,21 +16,20 @@ public class Client extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.Communicator communicator = communicator();
ThrowerPrx thrower = AllTests.allTests(communicator, getWriter());
thrower.shutdown();
return 0;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions");
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions");
+ r.initData.properties.setProperty("Ice.Warn.Connections", "0");
+ r.initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/exceptions/Collocated.java b/java/test/src/main/java/test/Ice/exceptions/Collocated.java
index 87f9e730a2d..79b3920ff97 100644
--- a/java/test/src/main/java/test/Ice/exceptions/Collocated.java
+++ b/java/test/src/main/java/test/Ice/exceptions/Collocated.java
@@ -12,13 +12,12 @@ package test.Ice.exceptions;
public class Collocated extends test.Util.Application
{
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Object object = new ThrowerI();
- adapter.add(object, Ice.Util.stringToIdentity("thrower"));
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.Object object = new ThrowerI();
+ adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("thrower"));
AllTests.allTests(communicator, getWriter());
@@ -26,27 +25,25 @@ public class Collocated extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
+ GetInitDataResult r = super.getInitData(args);
//
// For this test, we need a dummy logger, otherwise the
// assertion test will print an error message.
//
- initData.logger = new DummyLogger();
+ r.initData.logger = new DummyLogger();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions");
- initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ r.initData.properties.setProperty("Ice.Warn.Connections", "0");
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions");
+ r.initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- return initData;
+ return r;
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
Collocated app = new Collocated();
int result = app.main("Collocated", args);
diff --git a/java/test/src/main/java/test/Ice/exceptions/DummyLogger.java b/java/test/src/main/java/test/Ice/exceptions/DummyLogger.java
index 2a946e09eec..435a6bed68d 100644
--- a/java/test/src/main/java/test/Ice/exceptions/DummyLogger.java
+++ b/java/test/src/main/java/test/Ice/exceptions/DummyLogger.java
@@ -9,58 +9,51 @@
package test.Ice.exceptions;
-
-public final class DummyLogger implements Ice.Logger
+public final class DummyLogger implements com.zeroc.Ice.Logger
{
@Override
- public void
- print(String message)
+ public void print(String message)
{
_logger.print(message);
}
@Override
- public void
- trace(String category, String message)
+ public void trace(String category, String message)
{
_logger.trace(category, message);
}
@Override
- public void
- warning(String message)
+ public void warning(String message)
{
if(!message.contains("test.Ice.exceptions.ThrowerI.throwAssertException") &&
- !message.contains("test.Ice.exceptions.AMDThrowerI.throwAssertException_async"))
+ !message.contains("test.Ice.exceptions.AMDThrowerI.throwAssertExceptionAsync"))
{
_logger.warning(message);
}
}
@Override
- public void
- error(String message)
+ public void error(String message)
{
if(!message.contains("test.Ice.exceptions.ThrowerI.throwAssertException") &&
- !message.contains("test.Ice.exceptions.AMDThrowerI.throwAssertException_async"))
+ !message.contains("test.Ice.exceptions.AMDThrowerI.throwAssertExceptionAsync"))
{
_logger.error(message);
}
}
@Override
- public String
- getPrefix()
+ public String getPrefix()
{
return "";
}
@Override
- public Ice.Logger
- cloneWithPrefix(String prefix)
+ public com.zeroc.Ice.Logger cloneWithPrefix(String prefix)
{
return new DummyLogger();
}
- private Ice.Logger _logger = new Ice.LoggerI("", "");
+ private com.zeroc.Ice.Logger _logger = new com.zeroc.Ice.LoggerI("", "");
}
diff --git a/java/test/src/main/java/test/Ice/exceptions/EmptyI.java b/java/test/src/main/java/test/Ice/exceptions/EmptyI.java
index 445b4548a0b..99e81b71b1f 100644
--- a/java/test/src/main/java/test/Ice/exceptions/EmptyI.java
+++ b/java/test/src/main/java/test/Ice/exceptions/EmptyI.java
@@ -9,9 +9,8 @@
package test.Ice.exceptions;
-import test.Ice.exceptions.Test._EmptyDisp;
+import test.Ice.exceptions.Test.Empty;
-
-public final class EmptyI extends _EmptyDisp
+public final class EmptyI implements Empty
{
}
diff --git a/java/test/src/main/java/test/Ice/exceptions/ServantLocatorI.java b/java/test/src/main/java/test/Ice/exceptions/ServantLocatorI.java
index c4ea0e40952..79ede318272 100644
--- a/java/test/src/main/java/test/Ice/exceptions/ServantLocatorI.java
+++ b/java/test/src/main/java/test/Ice/exceptions/ServantLocatorI.java
@@ -9,17 +9,18 @@
package test.Ice.exceptions;
+import com.zeroc.Ice.ServantLocator;
-public final class ServantLocatorI implements Ice.ServantLocator
+public final class ServantLocatorI implements ServantLocator
{
@Override
- public Ice.Object locate(Ice.Current curr, Ice.LocalObjectHolder cookie)
+ public ServantLocator.LocateResult locate(com.zeroc.Ice.Current curr)
{
- return null;
+ return new ServantLocator.LocateResult();
}
@Override
- public void finished(Ice.Current curr, Ice.Object servant, java.lang.Object cookie)
+ public void finished(com.zeroc.Ice.Current curr, com.zeroc.Ice.Object servant, java.lang.Object cookie)
{
}
diff --git a/java/test/src/main/java/test/Ice/exceptions/Server.java b/java/test/src/main/java/test/Ice/exceptions/Server.java
index d510ac1216f..188e3f5c809 100644
--- a/java/test/src/main/java/test/Ice/exceptions/Server.java
+++ b/java/test/src/main/java/test/Ice/exceptions/Server.java
@@ -14,14 +14,14 @@ public class Server extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("TestAdapter2");
- Ice.ObjectAdapter adapter3 = communicator.createObjectAdapter("TestAdapter3");
- Ice.Object object = new ThrowerI();
- adapter.add(object, Ice.Util.stringToIdentity("thrower"));
- adapter2.add(object, Ice.Util.stringToIdentity("thrower"));
- adapter3.add(object, Ice.Util.stringToIdentity("thrower"));
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("TestAdapter2");
+ com.zeroc.Ice.ObjectAdapter adapter3 = communicator.createObjectAdapter("TestAdapter3");
+ com.zeroc.Ice.Object object = new ThrowerI();
+ adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("thrower"));
+ adapter2.add(object, com.zeroc.Ice.Util.stringToIdentity("thrower"));
+ adapter3.add(object, com.zeroc.Ice.Util.stringToIdentity("thrower"));
adapter.activate();
adapter2.activate();
adapter3.activate();
@@ -29,27 +29,26 @@ public class Server extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
+ GetInitDataResult r = super.getInitData(args);
//
// For this test, we need a dummy logger, otherwise the
// assertion test will print an error message.
//
- initData.logger = new DummyLogger();
+ r.initData.logger = new DummyLogger();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max
- initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011");
- initData.properties.setProperty("TestAdapter2.MessageSizeMax", "0");
- initData.properties.setProperty("TestAdapter3.Endpoints", "default -p 12012");
- initData.properties.setProperty("TestAdapter3.MessageSizeMax", "1");
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ r.initData.properties.setProperty("Ice.Warn.Connections", "0");
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ r.initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max
+ r.initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011");
+ r.initData.properties.setProperty("TestAdapter2.MessageSizeMax", "0");
+ r.initData.properties.setProperty("TestAdapter3.Endpoints", "default -p 12012");
+ r.initData.properties.setProperty("TestAdapter3.MessageSizeMax", "1");
- return initData;
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/exceptions/ThrowerI.java b/java/test/src/main/java/test/Ice/exceptions/ThrowerI.java
index ead93773148..9750f60eb54 100644
--- a/java/test/src/main/java/test/Ice/exceptions/ThrowerI.java
+++ b/java/test/src/main/java/test/Ice/exceptions/ThrowerI.java
@@ -13,39 +13,34 @@ import test.Ice.exceptions.Test.A;
import test.Ice.exceptions.Test.B;
import test.Ice.exceptions.Test.C;
import test.Ice.exceptions.Test.D;
-import test.Ice.exceptions.Test._ThrowerDisp;
+import test.Ice.exceptions.Test.Thrower;
-public final class ThrowerI extends _ThrowerDisp
+public final class ThrowerI implements Thrower
{
- public
- ThrowerI()
+ public ThrowerI()
{
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
@Override
- public boolean
- supportsUndeclaredExceptions(Ice.Current current)
+ public boolean supportsUndeclaredExceptions(com.zeroc.Ice.Current current)
{
return false;
}
@Override
- public boolean
- supportsAssertException(Ice.Current current)
+ public boolean supportsAssertException(com.zeroc.Ice.Current current)
{
return true;
}
@Override
- public void
- throwAasA(int a, Ice.Current current)
+ public void throwAasA(int a, com.zeroc.Ice.Current current)
throws A
{
A ex = new A();
@@ -54,8 +49,7 @@ public final class ThrowerI extends _ThrowerDisp
}
@Override
- public void
- throwAorDasAorD(int a, Ice.Current current)
+ public void throwAorDasAorD(int a, com.zeroc.Ice.Current current)
throws A,
D
{
@@ -74,16 +68,14 @@ public final class ThrowerI extends _ThrowerDisp
}
@Override
- public void
- throwBasA(int a, int b, Ice.Current current)
+ public void throwBasA(int a, int b, com.zeroc.Ice.Current current)
throws A
{
throwBasB(a, b, current);
}
@Override
- public void
- throwBasB(int a, int b, Ice.Current current)
+ public void throwBasB(int a, int b, com.zeroc.Ice.Current current)
throws B
{
B ex = new B();
@@ -93,8 +85,7 @@ public final class ThrowerI extends _ThrowerDisp
}
@Override
- public void
- throwCasA(int a, int b, int c, Ice.Current current)
+ public void throwCasA(int a, int b, int c, com.zeroc.Ice.Current current)
throws A
{
throwCasC(a, b, c, current);
@@ -102,15 +93,14 @@ public final class ThrowerI extends _ThrowerDisp
@Override
public void
- throwCasB(int a, int b, int c, Ice.Current current)
+ throwCasB(int a, int b, int c, com.zeroc.Ice.Current current)
throws B
{
throwCasC(a, b, c, current);
}
@Override
- public void
- throwCasC(int a, int b, int c, Ice.Current current)
+ public void throwCasC(int a, int b, int c, com.zeroc.Ice.Current current)
throws C
{
C ex = new C();
@@ -121,67 +111,58 @@ public final class ThrowerI extends _ThrowerDisp
}
@Override
- public void
- throwUndeclaredA(int a, Ice.Current current)
+ public void throwUndeclaredA(int a, com.zeroc.Ice.Current current)
{
// Not possible in Java.
- throw new Ice.UnknownUserException();
+ throw new com.zeroc.Ice.UnknownUserException();
}
@Override
- public void
- throwUndeclaredB(int a, int b, Ice.Current current)
+ public void throwUndeclaredB(int a, int b, com.zeroc.Ice.Current current)
{
// Not possible in Java.
- throw new Ice.UnknownUserException();
+ throw new com.zeroc.Ice.UnknownUserException();
}
@Override
- public void
- throwUndeclaredC(int a, int b, int c, Ice.Current current)
+ public void throwUndeclaredC(int a, int b, int c, com.zeroc.Ice.Current current)
{
// Not possible in Java.
- throw new Ice.UnknownUserException();
+ throw new com.zeroc.Ice.UnknownUserException();
}
@Override
- public void
- throwLocalException(Ice.Current current)
+ public void throwLocalException(com.zeroc.Ice.Current current)
{
- throw new Ice.TimeoutException();
+ throw new com.zeroc.Ice.TimeoutException();
}
@Override
- public void
- throwLocalExceptionIdempotent(Ice.Current current)
+ public void throwLocalExceptionIdempotent(com.zeroc.Ice.Current current)
{
- throw new Ice.TimeoutException();
+ throw new com.zeroc.Ice.TimeoutException();
}
@Override
- public void
- throwNonIceException(Ice.Current current)
+ public void throwNonIceException(com.zeroc.Ice.Current current)
{
throw new RuntimeException();
}
@Override
- public void
- throwAssertException(Ice.Current current)
+ public void throwAssertException(com.zeroc.Ice.Current current)
{
throw new java.lang.AssertionError();
}
@Override
- public byte[]
- throwMemoryLimitException(byte[] seq, Ice.Current current)
+ public byte[] throwMemoryLimitException(byte[] seq, com.zeroc.Ice.Current current)
{
return new byte[1024 * 20]; // 20KB is over the configured 10KB message size max.
}
@Override
- public void
- throwAfterResponse(Ice.Current current)
+ public void throwAfterResponse(com.zeroc.Ice.Current current)
{
//
// Only relevant for AMD.
@@ -189,8 +170,7 @@ public final class ThrowerI extends _ThrowerDisp
}
@Override
- public void
- throwAfterException(Ice.Current current)
+ public void throwAfterException(com.zeroc.Ice.Current current)
throws A
{
//
diff --git a/java/test/src/main/java/test/Ice/exceptions/ValueFactoryI.java b/java/test/src/main/java/test/Ice/exceptions/ValueFactoryI.java
index c027b58d883..ba6558f7a2c 100644
--- a/java/test/src/main/java/test/Ice/exceptions/ValueFactoryI.java
+++ b/java/test/src/main/java/test/Ice/exceptions/ValueFactoryI.java
@@ -9,11 +9,10 @@
package test.Ice.exceptions;
-
-public final class ValueFactoryI implements Ice.ValueFactory
+public final class ValueFactoryI implements com.zeroc.Ice.ValueFactory
{
@Override
- public Ice.Object create(String s)
+ public com.zeroc.Ice.Value create(String s)
{
return null;
}
diff --git a/java/test/src/main/java/test/Ice/facets/AI.java b/java/test/src/main/java/test/Ice/facets/AI.java
index c3450f404fe..b4175bd7b89 100644
--- a/java/test/src/main/java/test/Ice/facets/AI.java
+++ b/java/test/src/main/java/test/Ice/facets/AI.java
@@ -9,18 +9,16 @@
package test.Ice.facets;
-import test.Ice.facets.Test._ADisp;
+import test.Ice.facets.Test.A;
-public final class AI extends _ADisp
+public final class AI implements A
{
- public
- AI()
+ public AI()
{
}
@Override
- public String
- callA(Ice.Current current)
+ public String callA(com.zeroc.Ice.Current current)
{
return "A";
}
diff --git a/java/test/src/main/java/test/Ice/facets/AllTests.java b/java/test/src/main/java/test/Ice/facets/AllTests.java
index 799a54f4ccf..f59389cd945 100644
--- a/java/test/src/main/java/test/Ice/facets/AllTests.java
+++ b/java/test/src/main/java/test/Ice/facets/AllTests.java
@@ -12,18 +12,15 @@ package test.Ice.facets;
import java.io.PrintWriter;
import test.Ice.facets.Test.DPrx;
-import test.Ice.facets.Test.DPrxHelper;
import test.Ice.facets.Test.FPrx;
-import test.Ice.facets.Test.FPrxHelper;
import test.Ice.facets.Test.GPrx;
-import test.Ice.facets.Test.GPrxHelper;
import test.Ice.facets.Test.HPrx;
-import test.Ice.facets.Test.HPrxHelper;
+
+import com.zeroc.Ice.ObjectPrx;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -31,10 +28,9 @@ public class AllTests
}
}
- public static GPrx
- allTests(Ice.Communicator communicator, PrintWriter out)
+ public static GPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out)
{
- out.print("testing Ice.Admin.Facets property... ");
+ out.print("testing Ice.Admin.Facets property... ");
test(communicator.getProperties().getPropertyAsList("Ice.Admin.Facets").length == 0);
communicator.getProperties().setProperty("Ice.Admin.Facets", "foobar");
String[] facetFilter = communicator.getProperties().getPropertyAsList("Ice.Admin.Facets");
@@ -57,51 +53,52 @@ public class AllTests
out.print("testing facet registration exceptions... ");
communicator.getProperties().setProperty("FacetExceptionTestAdapter.Endpoints", "default");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("FacetExceptionTestAdapter");
- Ice.Object obj = new EmptyI();
- adapter.add(obj, Ice.Util.stringToIdentity("d"));
- adapter.addFacet(obj, Ice.Util.stringToIdentity("d"), "facetABCD");
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("FacetExceptionTestAdapter");
+ com.zeroc.Ice.Object obj = new EmptyI();
+ adapter.add(obj, com.zeroc.Ice.Util.stringToIdentity("d"));
+ adapter.addFacet(obj, com.zeroc.Ice.Util.stringToIdentity("d"), "facetABCD");
try
{
- adapter.addFacet(obj, Ice.Util.stringToIdentity("d"), "facetABCD");
+ adapter.addFacet(obj, com.zeroc.Ice.Util.stringToIdentity("d"), "facetABCD");
test(false);
}
- catch(Ice.AlreadyRegisteredException ex)
+ catch(com.zeroc.Ice.AlreadyRegisteredException ex)
{
}
- adapter.removeFacet(Ice.Util.stringToIdentity("d"), "facetABCD");
+ adapter.removeFacet(com.zeroc.Ice.Util.stringToIdentity("d"), "facetABCD");
try
{
- adapter.removeFacet(Ice.Util.stringToIdentity("d"), "facetABCD");
+ adapter.removeFacet(com.zeroc.Ice.Util.stringToIdentity("d"), "facetABCD");
test(false);
}
- catch(Ice.NotRegisteredException ex)
+ catch(com.zeroc.Ice.NotRegisteredException ex)
{
}
out.println("ok");
out.print("testing removeAllFacets... ");
- Ice.Object obj1 = new EmptyI();
- Ice.Object obj2 = new EmptyI();
- adapter.addFacet(obj1, Ice.Util.stringToIdentity("id1"), "f1");
- adapter.addFacet(obj2, Ice.Util.stringToIdentity("id1"), "f2");
- Ice.Object obj3 = new EmptyI();
- adapter.addFacet(obj1, Ice.Util.stringToIdentity("id2"), "f1");
- adapter.addFacet(obj2, Ice.Util.stringToIdentity("id2"), "f2");
- adapter.addFacet(obj3, Ice.Util.stringToIdentity("id2"), "");
- java.util.Map<String, Ice.Object> fm = adapter.removeAllFacets(Ice.Util.stringToIdentity("id1"));
+ com.zeroc.Ice.Object obj1 = new EmptyI();
+ com.zeroc.Ice.Object obj2 = new EmptyI();
+ adapter.addFacet(obj1, com.zeroc.Ice.Util.stringToIdentity("id1"), "f1");
+ adapter.addFacet(obj2, com.zeroc.Ice.Util.stringToIdentity("id1"), "f2");
+ com.zeroc.Ice.Object obj3 = new EmptyI();
+ adapter.addFacet(obj1, com.zeroc.Ice.Util.stringToIdentity("id2"), "f1");
+ adapter.addFacet(obj2, com.zeroc.Ice.Util.stringToIdentity("id2"), "f2");
+ adapter.addFacet(obj3, com.zeroc.Ice.Util.stringToIdentity("id2"), "");
+ java.util.Map<String, com.zeroc.Ice.Object> fm =
+ adapter.removeAllFacets(com.zeroc.Ice.Util.stringToIdentity("id1"));
test(fm.size() == 2);
test(fm.get("f1") == obj1);
test(fm.get("f2") == obj2);
try
{
- adapter.removeAllFacets(Ice.Util.stringToIdentity("id1"));
+ adapter.removeAllFacets(com.zeroc.Ice.Util.stringToIdentity("id1"));
test(false);
}
- catch(Ice.NotRegisteredException ex)
+ catch(com.zeroc.Ice.NotRegisteredException ex)
{
}
- fm = adapter.removeAllFacets(Ice.Util.stringToIdentity("id2"));
+ fm = adapter.removeAllFacets(com.zeroc.Ice.Util.stringToIdentity("id2"));
test(fm.size() == 3);
test(fm.get("f1") == obj1);
test(fm.get("f2") == obj2);
@@ -113,53 +110,53 @@ public class AllTests
out.print("testing stringToProxy... ");
out.flush();
String ref = "d:default -p 12010";
- Ice.ObjectPrx db = communicator.stringToProxy(ref);
+ ObjectPrx db = communicator.stringToProxy(ref);
test(db != null);
out.println("ok");
out.print("testing unchecked cast... ");
out.flush();
- Ice.ObjectPrx prx = Ice.ObjectPrxHelper.uncheckedCast(db);
+ ObjectPrx prx = ObjectPrx.uncheckedCast(db);
test(prx.ice_getFacet().length() == 0);
- prx = Ice.ObjectPrxHelper.uncheckedCast(db, "facetABCD");
+ prx = ObjectPrx.uncheckedCast(db, "facetABCD");
test(prx.ice_getFacet() == "facetABCD");
- Ice.ObjectPrx prx2 = Ice.ObjectPrxHelper.uncheckedCast(prx);
+ ObjectPrx prx2 = ObjectPrx.uncheckedCast(prx);
test(prx2.ice_getFacet() == "facetABCD");
- Ice.ObjectPrx prx3 = Ice.ObjectPrxHelper.uncheckedCast(prx, "");
+ ObjectPrx prx3 = ObjectPrx.uncheckedCast(prx, "");
test(prx3.ice_getFacet().length() == 0);
- DPrx d = DPrxHelper.uncheckedCast(db);
+ DPrx d = DPrx.uncheckedCast(db);
test(d.ice_getFacet().length() == 0);
- DPrx df = DPrxHelper.uncheckedCast(db, "facetABCD");
+ DPrx df = DPrx.uncheckedCast(db, "facetABCD");
test(df.ice_getFacet() == "facetABCD");
- DPrx df2 = DPrxHelper.uncheckedCast(df);
+ DPrx df2 = DPrx.uncheckedCast(df);
test(df2.ice_getFacet() == "facetABCD");
- DPrx df3 = DPrxHelper.uncheckedCast(df, "");
+ DPrx df3 = DPrx.uncheckedCast(df, "");
test(df3.ice_getFacet().length() == 0);
out.println("ok");
out.print("testing checked cast... ");
out.flush();
- prx = Ice.ObjectPrxHelper.checkedCast(db);
+ prx = ObjectPrx.checkedCast(db);
test(prx.ice_getFacet().length() == 0);
- prx = Ice.ObjectPrxHelper.checkedCast(db, "facetABCD");
+ prx = ObjectPrx.checkedCast(db, "facetABCD");
test(prx.ice_getFacet() == "facetABCD");
- prx2 = Ice.ObjectPrxHelper.checkedCast(prx);
+ prx2 = ObjectPrx.checkedCast(prx);
test(prx2.ice_getFacet() == "facetABCD");
- prx3 = Ice.ObjectPrxHelper.checkedCast(prx, "");
+ prx3 = ObjectPrx.checkedCast(prx, "");
test(prx3.ice_getFacet().length() == 0);
- d = DPrxHelper.checkedCast(db);
+ d = DPrx.checkedCast(db);
test(d.ice_getFacet().length() == 0);
- df = DPrxHelper.checkedCast(db, "facetABCD");
+ df = DPrx.checkedCast(db, "facetABCD");
test(df.ice_getFacet() == "facetABCD");
- df2 = DPrxHelper.checkedCast(df);
+ df2 = DPrx.checkedCast(df);
test(df2.ice_getFacet() == "facetABCD");
- df3 = DPrxHelper.checkedCast(df, "");
+ df3 = DPrx.checkedCast(df, "");
test(df3.ice_getFacet().length() == 0);
out.println("ok");
out.print("testing non-facets A, B, C, and D... ");
out.flush();
- d = DPrxHelper.checkedCast(db);
+ d = DPrx.checkedCast(db);
test(d != null);
test(d.equals(db));
test(d.callA().equals("A"));
@@ -170,7 +167,7 @@ public class AllTests
out.print("testing facets A, B, C, and D... ");
out.flush();
- df = DPrxHelper.checkedCast(d, "facetABCD");
+ df = DPrx.checkedCast(d, "facetABCD");
test(df != null);
test(df.callA().equals("A"));
test(df.callB().equals("B"));
@@ -180,7 +177,7 @@ public class AllTests
out.print("testing facets E and F... ");
out.flush();
- FPrx ff = FPrxHelper.checkedCast(d, "facetEF");
+ FPrx ff = FPrx.checkedCast(d, "facetEF");
test(ff != null);
test(ff.callE().equals("E"));
test(ff.callF().equals("F"));
@@ -188,14 +185,14 @@ public class AllTests
out.print("testing facet G... ");
out.flush();
- GPrx gf = GPrxHelper.checkedCast(ff, "facetGH");
+ GPrx gf = GPrx.checkedCast(ff, "facetGH");
test(gf != null);
test(gf.callG().equals("G"));
out.println("ok");
out.print("testing whether casting preserves the facet... ");
out.flush();
- HPrx hf = HPrxHelper.checkedCast(gf);
+ HPrx hf = HPrx.checkedCast(gf);
test(hf != null);
test(hf.callG().equals("G"));
test(hf.callH().equals("H"));
diff --git a/java/test/src/main/java/test/Ice/facets/BI.java b/java/test/src/main/java/test/Ice/facets/BI.java
index 6bdd538def3..5a637e9b709 100644
--- a/java/test/src/main/java/test/Ice/facets/BI.java
+++ b/java/test/src/main/java/test/Ice/facets/BI.java
@@ -9,25 +9,22 @@
package test.Ice.facets;
-import test.Ice.facets.Test._BDisp;
+import test.Ice.facets.Test.B;
-public final class BI extends _BDisp
+public final class BI implements B
{
- public
- BI()
+ public BI()
{
}
@Override
- public String
- callA(Ice.Current current)
+ public String callA(com.zeroc.Ice.Current current)
{
return "A";
}
@Override
- public String
- callB(Ice.Current current)
+ public String callB(com.zeroc.Ice.Current current)
{
return "B";
}
diff --git a/java/test/src/main/java/test/Ice/facets/CI.java b/java/test/src/main/java/test/Ice/facets/CI.java
index 66330520219..1056e832602 100644
--- a/java/test/src/main/java/test/Ice/facets/CI.java
+++ b/java/test/src/main/java/test/Ice/facets/CI.java
@@ -9,25 +9,22 @@
package test.Ice.facets;
-import test.Ice.facets.Test._CDisp;
+import test.Ice.facets.Test.C;
-public final class CI extends _CDisp
+public final class CI implements C
{
- public
- CI()
+ public CI()
{
}
@Override
- public String
- callA(Ice.Current current)
+ public String callA(com.zeroc.Ice.Current current)
{
return "A";
}
@Override
- public String
- callC(Ice.Current current)
+ public String callC(com.zeroc.Ice.Current current)
{
return "C";
}
diff --git a/java/test/src/main/java/test/Ice/facets/Client.java b/java/test/src/main/java/test/Ice/facets/Client.java
index a67a11d734f..0706f029849 100644
--- a/java/test/src/main/java/test/Ice/facets/Client.java
+++ b/java/test/src/main/java/test/Ice/facets/Client.java
@@ -16,19 +16,18 @@ public class Client extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.Communicator communicator = communicator();
GPrx g = AllTests.allTests(communicator, getWriter());
g.shutdown();
return 0;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.facets");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.facets");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/facets/Collocated.java b/java/test/src/main/java/test/Ice/facets/Collocated.java
index 4d72172d030..bbd89715144 100644
--- a/java/test/src/main/java/test/Ice/facets/Collocated.java
+++ b/java/test/src/main/java/test/Ice/facets/Collocated.java
@@ -14,16 +14,16 @@ public class Collocated extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.Communicator communicator = communicator();
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Object d = new DI();
- adapter.add(d, Ice.Util.stringToIdentity("d"));
- adapter.addFacet(d, Ice.Util.stringToIdentity("d"), "facetABCD");
- Ice.Object f = new FI();
- adapter.addFacet(f, Ice.Util.stringToIdentity("d"), "facetEF");
- Ice.Object h = new HI(communicator);
- adapter.addFacet(h, Ice.Util.stringToIdentity("d"), "facetGH");
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.Object d = new DI();
+ adapter.add(d, com.zeroc.Ice.Util.stringToIdentity("d"));
+ adapter.addFacet(d, com.zeroc.Ice.Util.stringToIdentity("d"), "facetABCD");
+ com.zeroc.Ice.Object f = new FI();
+ adapter.addFacet(f, com.zeroc.Ice.Util.stringToIdentity("d"), "facetEF");
+ com.zeroc.Ice.Object h = new HI(communicator);
+ adapter.addFacet(h, com.zeroc.Ice.Util.stringToIdentity("d"), "facetGH");
AllTests.allTests(communicator, getWriter());
@@ -31,12 +31,11 @@ public class Collocated extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.facets");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.facets");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/facets/DI.java b/java/test/src/main/java/test/Ice/facets/DI.java
index 97b44b0c51d..49cc142a196 100644
--- a/java/test/src/main/java/test/Ice/facets/DI.java
+++ b/java/test/src/main/java/test/Ice/facets/DI.java
@@ -9,39 +9,34 @@
package test.Ice.facets;
-import test.Ice.facets.Test._DDisp;
+import test.Ice.facets.Test.D;
-public final class DI extends _DDisp
+public final class DI implements D
{
- public
- DI()
+ public DI()
{
}
@Override
- public String
- callA(Ice.Current current)
+ public String callA(com.zeroc.Ice.Current current)
{
return "A";
}
@Override
- public String
- callB(Ice.Current current)
+ public String callB(com.zeroc.Ice.Current current)
{
return "B";
}
@Override
- public String
- callC(Ice.Current current)
+ public String callC(com.zeroc.Ice.Current current)
{
return "C";
}
@Override
- public String
- callD(Ice.Current current)
+ public String callD(com.zeroc.Ice.Current current)
{
return "D";
}
diff --git a/java/test/src/main/java/test/Ice/facets/EI.java b/java/test/src/main/java/test/Ice/facets/EI.java
index 9bb15e5c89b..c08008771f3 100644
--- a/java/test/src/main/java/test/Ice/facets/EI.java
+++ b/java/test/src/main/java/test/Ice/facets/EI.java
@@ -9,18 +9,16 @@
package test.Ice.facets;
-import test.Ice.facets.Test._EDisp;
+import test.Ice.facets.Test.E;
-public final class EI extends _EDisp
+public final class EI implements E
{
- public
- EI()
+ public EI()
{
}
@Override
- public String
- callE(Ice.Current current)
+ public String callE(com.zeroc.Ice.Current current)
{
return "E";
}
diff --git a/java/test/src/main/java/test/Ice/facets/EmptyI.java b/java/test/src/main/java/test/Ice/facets/EmptyI.java
index bdf78b9c893..dda98ba6f10 100644
--- a/java/test/src/main/java/test/Ice/facets/EmptyI.java
+++ b/java/test/src/main/java/test/Ice/facets/EmptyI.java
@@ -9,8 +9,8 @@
package test.Ice.facets;
-import test.Ice.facets.Test._EmptyDisp;
+import test.Ice.facets.Test.Empty;
-public final class EmptyI extends _EmptyDisp
+public final class EmptyI implements Empty
{
}
diff --git a/java/test/src/main/java/test/Ice/facets/FI.java b/java/test/src/main/java/test/Ice/facets/FI.java
index a5a52615ebe..7c5cb88361f 100644
--- a/java/test/src/main/java/test/Ice/facets/FI.java
+++ b/java/test/src/main/java/test/Ice/facets/FI.java
@@ -9,25 +9,22 @@
package test.Ice.facets;
-import test.Ice.facets.Test._FDisp;
+import test.Ice.facets.Test.F;
-public final class FI extends _FDisp
+public final class FI implements F
{
- public
- FI()
+ public FI()
{
}
@Override
- public String
- callE(Ice.Current current)
+ public String callE(com.zeroc.Ice.Current current)
{
return "E";
}
@Override
- public String
- callF(Ice.Current current)
+ public String callF(com.zeroc.Ice.Current current)
{
return "F";
}
diff --git a/java/test/src/main/java/test/Ice/facets/GI.java b/java/test/src/main/java/test/Ice/facets/GI.java
index 3dcc2575a5e..f05f478688c 100644
--- a/java/test/src/main/java/test/Ice/facets/GI.java
+++ b/java/test/src/main/java/test/Ice/facets/GI.java
@@ -9,29 +9,26 @@
package test.Ice.facets;
-import test.Ice.facets.Test._GDisp;
+import test.Ice.facets.Test.G;
-public final class GI extends _GDisp
+public final class GI implements G
{
- public
- GI(Ice.Communicator communicator)
+ public GI(com.zeroc.Ice.Communicator communicator)
{
_communicator = communicator;
}
@Override
- public String
- callG(Ice.Current current)
+ public String callG(com.zeroc.Ice.Current current)
{
return "G";
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
_communicator.shutdown();
}
- private Ice.Communicator _communicator;
+ private com.zeroc.Ice.Communicator _communicator;
}
diff --git a/java/test/src/main/java/test/Ice/facets/HI.java b/java/test/src/main/java/test/Ice/facets/HI.java
index 760f52b6a70..22bfd340e28 100644
--- a/java/test/src/main/java/test/Ice/facets/HI.java
+++ b/java/test/src/main/java/test/Ice/facets/HI.java
@@ -9,36 +9,32 @@
package test.Ice.facets;
-import test.Ice.facets.Test._HDisp;
+import test.Ice.facets.Test.H;
-public final class HI extends _HDisp
+public final class HI implements H
{
- public
- HI(Ice.Communicator communicator)
+ public HI(com.zeroc.Ice.Communicator communicator)
{
_communicator = communicator;
}
@Override
- public String
- callG(Ice.Current current)
+ public String callG(com.zeroc.Ice.Current current)
{
return "G";
}
@Override
- public String
- callH(Ice.Current current)
+ public String callH(com.zeroc.Ice.Current current)
{
return "H";
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
_communicator.shutdown();
}
- private Ice.Communicator _communicator;
+ private com.zeroc.Ice.Communicator _communicator;
}
diff --git a/java/test/src/main/java/test/Ice/facets/Server.java b/java/test/src/main/java/test/Ice/facets/Server.java
index 533db9e28e3..fa7361b69e4 100644
--- a/java/test/src/main/java/test/Ice/facets/Server.java
+++ b/java/test/src/main/java/test/Ice/facets/Server.java
@@ -14,15 +14,15 @@ public class Server extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Object d = new DI();
- adapter.add(d, Ice.Util.stringToIdentity("d"));
- adapter.addFacet(d, Ice.Util.stringToIdentity("d"), "facetABCD");
- Ice.Object f = new FI();
- adapter.addFacet(f, Ice.Util.stringToIdentity("d"), "facetEF");
- Ice.Object h = new HI(communicator);
- adapter.addFacet(h, Ice.Util.stringToIdentity("d"), "facetGH");
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.Object d = new DI();
+ adapter.add(d, com.zeroc.Ice.Util.stringToIdentity("d"));
+ adapter.addFacet(d, com.zeroc.Ice.Util.stringToIdentity("d"), "facetABCD");
+ com.zeroc.Ice.Object f = new FI();
+ adapter.addFacet(f, com.zeroc.Ice.Util.stringToIdentity("d"), "facetEF");
+ com.zeroc.Ice.Object h = new HI(communicator);
+ adapter.addFacet(h, com.zeroc.Ice.Util.stringToIdentity("d"), "facetGH");
adapter.activate();
@@ -30,13 +30,12 @@ public class Server extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.facets");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.facets");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/faultTolerance/AllTests.java b/java/test/src/main/java/test/Ice/faultTolerance/AllTests.java
index 30550745185..a5beb3fffb1 100644
--- a/java/test/src/main/java/test/Ice/faultTolerance/AllTests.java
+++ b/java/test/src/main/java/test/Ice/faultTolerance/AllTests.java
@@ -12,14 +12,10 @@ package test.Ice.faultTolerance;
import java.io.PrintWriter;
import test.Ice.faultTolerance.Test.TestIntfPrx;
-import test.Ice.faultTolerance.Test.TestIntfPrxHelper;
-import test.Ice.faultTolerance.Test.Callback_TestIntf_pid;
-import test.Ice.faultTolerance.Test.Callback_TestIntf_shutdown;
public class AllTests
{
- public static void
- test(boolean b)
+ public static void test(boolean b)
{
if(!b)
{
@@ -34,8 +30,7 @@ public class AllTests
_called = false;
}
- public synchronized void
- check()
+ public synchronized void check()
{
while(!_called)
{
@@ -47,12 +42,11 @@ public class AllTests
{
}
}
-
+
_called = false;
}
-
- public synchronized void
- called()
+
+ public synchronized void called()
{
assert(!_called);
_called = true;
@@ -62,111 +56,48 @@ public class AllTests
private boolean _called;
}
- private static class Callback_TestIntf_pidI extends Callback_TestIntf_pid
+ private static class PidCallback extends Callback
{
- @Override
- public void
- response(int pid)
+ public void response(int pid)
{
_pid = pid;
- callback.called();
+ called();
}
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public int
- pid()
+
+ public int pid()
{
return _pid;
}
-
- public void
- check()
- {
- callback.check();
- }
private int _pid;
-
- private Callback callback = new Callback();
}
-
- private static class Callback_TestIntf_shutdownI extends Callback_TestIntf_shutdown
- {
- @Override
- public void
- response()
- {
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
- private Callback callback = new Callback();
- }
-
- private static class AbortCallback extends Ice.Callback
+ private static class AbortCallback extends Callback
{
- @Override
- public void
- completed(Ice.AsyncResult result)
+ public void completed(Throwable ex)
{
try
{
- TestIntfPrx p = TestIntfPrxHelper.uncheckedCast(result.getProxy());
- if(result.getOperation().equals("abort"))
- {
- p.end_abort(result);
- }
- else if(result.getOperation().equals("idempotentAbort"))
- {
- p.end_idempotentAbort(result);
- }
- test(false);
+ throw ex;
}
- catch(Ice.ConnectionLostException exc)
+ catch(com.zeroc.Ice.ConnectionLostException exc)
{
}
- catch(Ice.ConnectFailedException exc)
+ catch(com.zeroc.Ice.ConnectFailedException exc)
{
}
- catch(Ice.SocketException exc)
+ catch(com.zeroc.Ice.SocketException exc)
{
}
- catch(Exception exc)
+ catch(Throwable exc)
{
test(false);
}
- callback.called();
- }
-
- public void
- check()
- {
- callback.check();
+ called();
}
-
- private Callback callback = new Callback();
}
-
- public static void
- allTests(Ice.Communicator communicator, int[] ports, PrintWriter out)
+
+ public static void allTests(com.zeroc.Ice.Communicator communicator, int[] ports, PrintWriter out)
{
out.print("testing stringToProxy... ");
out.flush();
@@ -175,13 +106,13 @@ public class AllTests
{
ref += ":default -p " + port;
}
- Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref);
test(base != null);
out.println("ok");
out.print("testing checked cast... ");
out.flush();
- TestIntfPrx obj = TestIntfPrxHelper.checkedCast(base);
+ TestIntfPrx obj = TestIntfPrx.checkedCast(base);
test(obj != null);
test(obj.equals(base));
out.println("ok");
@@ -209,8 +140,12 @@ public class AllTests
{
out.print("testing server #" + i + " with AMI... ");
out.flush();
- Callback_TestIntf_pidI cb = new Callback_TestIntf_pidI();
- obj.begin_pid(cb);
+ PidCallback cb = new PidCallback();
+ obj.pidAsync().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ cb.response(result);
+ });
cb.check();
int pid = cb.pid();
test(pid != oldPid);
@@ -231,8 +166,12 @@ public class AllTests
{
out.print("shutting down server #" + i + " with AMI... ");
out.flush();
- Callback_TestIntf_shutdownI cb = new Callback_TestIntf_shutdownI();
- obj.begin_shutdown(cb);
+ Callback cb = new Callback();
+ obj.shutdownAsync().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ cb.called();
+ });
cb.check();
out.println("ok");
}
@@ -248,15 +187,15 @@ public class AllTests
obj.abort();
test(false);
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
out.println("ok");
}
- catch(Ice.ConnectFailedException exc)
+ catch(com.zeroc.Ice.ConnectFailedException exc)
{
out.println("ok");
}
- catch(Ice.SocketException ex)
+ catch(com.zeroc.Ice.SocketException ex)
{
out.println("ok");
}
@@ -266,7 +205,11 @@ public class AllTests
out.print("aborting server #" + i + " with AMI... ");
out.flush();
AbortCallback cb = new AbortCallback();
- obj.begin_abort(cb);
+ obj.abortAsync().whenComplete((result, ex) ->
+ {
+ test(ex != null);
+ cb.completed(ex);
+ });
cb.check();
out.println("ok");
}
@@ -282,15 +225,15 @@ public class AllTests
obj.idempotentAbort();
test(false);
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
out.println("ok");
}
- catch(Ice.ConnectFailedException exc)
+ catch(com.zeroc.Ice.ConnectFailedException exc)
{
out.println("ok");
}
- catch(Ice.SocketException ex)
+ catch(com.zeroc.Ice.SocketException ex)
{
out.println("ok");
}
@@ -300,7 +243,11 @@ public class AllTests
out.print("aborting server #" + i + " and #" + (i + 1) + " with idempotent AMI call... ");
out.flush();
AbortCallback cb = new AbortCallback();
- obj.begin_idempotentAbort(cb);
+ obj.idempotentAbortAsync().whenComplete((result, ex) ->
+ {
+ test(ex != null);
+ cb.completed(ex);
+ });
cb.check();
out.println("ok");
}
@@ -320,7 +267,7 @@ public class AllTests
obj.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
out.println("ok");
}
diff --git a/java/test/src/main/java/test/Ice/faultTolerance/Client.java b/java/test/src/main/java/test/Ice/faultTolerance/Client.java
index 9a350872820..0ddd58774e1 100644
--- a/java/test/src/main/java/test/Ice/faultTolerance/Client.java
+++ b/java/test/src/main/java/test/Ice/faultTolerance/Client.java
@@ -21,13 +21,11 @@ public class Client extends test.Util.Application
}
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
PrintWriter out = getWriter();
-
- Ice.Communicator communicator = communicator();
- java.util.List<Integer> ports = new java.util.ArrayList<Integer>(args.length);
+
+ java.util.List<Integer> ports = new java.util.ArrayList<>(args.length);
for(String arg : args)
{
if(arg.charAt(0) == '-')
@@ -57,7 +55,7 @@ public class Client extends test.Util.Application
if(ports.isEmpty())
{
- out.println("Client: no ports specified");
+ out.println("Client: no ports specified");
usage();
return 1;
}
@@ -70,9 +68,9 @@ public class Client extends test.Util.Application
try
{
- AllTests.allTests(communicator, arr, out);
+ AllTests.allTests(communicator(), arr, out);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
AllTests.test(false);
@@ -82,17 +80,16 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.faultTolerance");
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.faultTolerance");
//
// This test aborts servers, so we don't want warnings.
//
- initData.properties.setProperty("Ice.Warn.Connections", "0");
+ r.initData.properties.setProperty("Ice.Warn.Connections", "0");
- return initData;
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/faultTolerance/Server.java b/java/test/src/main/java/test/Ice/faultTolerance/Server.java
index 56e4041a168..f856e8d6f4a 100644
--- a/java/test/src/main/java/test/Ice/faultTolerance/Server.java
+++ b/java/test/src/main/java/test/Ice/faultTolerance/Server.java
@@ -20,10 +20,9 @@ public class Server extends test.Util.Application
}
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.Communicator communicator = communicator();
int port = 0;
PrintWriter out = getWriter();
for(String arg : args)
@@ -63,22 +62,21 @@ public class Server extends test.Util.Application
// Don't move this, it needs the port.
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p " + port + ":udp");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Object object = new TestI(port);
- adapter.add(object, Ice.Util.stringToIdentity("test"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.Object object = new TestI(port);
+ adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("test"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.faultTolerance");
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.faultTolerance");
// Two minutes.
- initData.properties.setProperty("Ice.ServerIdleTime", "120");
- return initData;
+ r.initData.properties.setProperty("Ice.ServerIdleTime", "120");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/faultTolerance/TestI.java b/java/test/src/main/java/test/Ice/faultTolerance/TestI.java
index 65db720e938..70bb1409e77 100644
--- a/java/test/src/main/java/test/Ice/faultTolerance/TestI.java
+++ b/java/test/src/main/java/test/Ice/faultTolerance/TestI.java
@@ -9,40 +9,35 @@
package test.Ice.faultTolerance;
-import test.Ice.faultTolerance.Test._TestIntfDisp;
+import test.Ice.faultTolerance.Test.TestIntf;
-public final class TestI extends _TestIntfDisp
+public final class TestI implements TestIntf
{
- public
- TestI(int port)
+ public TestI(int port)
{
_pseudoPid = port; // We use the port number instead of the process ID in Java.
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
@Override
- public void
- abort(Ice.Current current)
+ public void abort(com.zeroc.Ice.Current current)
{
Runtime.getRuntime().halt(0);
}
@Override
- public void
- idempotentAbort(Ice.Current current)
+ public void idempotentAbort(com.zeroc.Ice.Current current)
{
Runtime.getRuntime().halt(0);
}
@Override
- public int
- pid(Ice.Current current)
+ public int pid(com.zeroc.Ice.Current current)
{
return _pseudoPid;
}
diff --git a/java/test/src/main/java/test/Ice/hash/Client.java b/java/test/src/main/java/test/Ice/hash/Client.java
index 7859559f9ad..4a6756bd2f2 100644
--- a/java/test/src/main/java/test/Ice/hash/Client.java
+++ b/java/test/src/main/java/test/Ice/hash/Client.java
@@ -13,10 +13,14 @@ import java.io.PrintWriter;
import test.Ice.hash.Test.*;
+import com.zeroc.Ice.Endpoint;
+import com.zeroc.Ice.ObjectPrx;
+import com.zeroc.Ice.ProxyIdentityKey;
+import com.zeroc.Ice.ProxyIdentityFacetKey;
+
public class Client extends test.Util.Application
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -40,25 +44,27 @@ public class Client extends test.Util.Application
int status = 0;
try
{
- java.util.Map<Integer, Ice.ObjectPrx> seenProxy = new java.util.HashMap<Integer, Ice.ObjectPrx>();
- java.util.Map<Integer, Ice.Endpoint> seenEndpoint = new java.util.HashMap<Integer, Ice.Endpoint>();
+ java.util.Map<Integer, ObjectPrx> seenProxy = new java.util.HashMap<>();
+ java.util.Map<Integer, Endpoint> seenEndpoint = new java.util.HashMap<>();
int proxyCollisions = 0;
int endpointCollisions = 0;
int i = 0;
int maxCollisions = 10;
int maxIterations = 10000;
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(args);
- initData.properties.setProperty("Ice.Plugin.IceSSL", "IceSSL.PluginFactory");
- Ice.Communicator communicator = Ice.Util.initialize(args, initData);
+ com.zeroc.Ice.InitializationData initData = createInitializationData();
+ com.zeroc.Ice.Util.CreatePropertiesResult cpr = com.zeroc.Ice.Util.createProperties(args);
+ initData.properties = cpr.properties;
+ initData.properties.setProperty("Ice.Plugin.IceSSL", "com.zeroc.IceSSL.PluginFactory");
+ com.zeroc.Ice.Util.InitializeResult ir = com.zeroc.Ice.Util.initialize(args, initData);
+ com.zeroc.Ice.Communicator communicator = ir.communicator;
out.print("testing proxy & endpoint hash algorithm collisions... ");
out.flush();
{
java.util.Random rand = new java.util.Random();
for(i = 0; proxyCollisions < maxCollisions &&
- endpointCollisions < maxCollisions &&
+ endpointCollisions < maxCollisions &&
i < maxIterations; ++i)
{
java.io.StringWriter sw = new java.io.StringWriter();
@@ -72,8 +78,9 @@ public class Client extends test.Util.Application
sw.write(" -h ");
sw.write(Integer.toString(rand.nextInt(100)));
- Ice.ObjectPrx obj = communicator.stringToProxy(sw.toString());
- java.util.List<Ice.Endpoint> endpoints = new java.util.ArrayList<Ice.Endpoint>(java.util.Arrays.asList(obj.ice_getEndpoints()));
+ ObjectPrx obj = communicator.stringToProxy(sw.toString());
+ java.util.List<Endpoint> endpoints =
+ new java.util.ArrayList<>(java.util.Arrays.asList(obj.ice_getEndpoints()));
if(seenProxy.containsKey(obj.hashCode()))
{
if(obj.equals(seenProxy.get(obj.hashCode())))
@@ -87,10 +94,10 @@ public class Client extends test.Util.Application
seenProxy.put(obj.hashCode(), obj);
}
- java.util.Iterator<Ice.Endpoint> j = endpoints.iterator();
+ java.util.Iterator<Endpoint> j = endpoints.iterator();
while(j.hasNext())
{
- Ice.Endpoint endpoint = j.next();
+ Endpoint endpoint = j.next();
if(seenEndpoint.containsKey(endpoint.hashCode()))
{
if(endpoint.equals(seenEndpoint.get(endpoint.hashCode())))
@@ -117,7 +124,7 @@ public class Client extends test.Util.Application
test(endpointCollisions < maxCollisions);
proxyCollisions = 0;
- seenProxy = new java.util.HashMap<Integer, Ice.ObjectPrx>();
+ seenProxy = new java.util.HashMap<>();
for(i = 0; proxyCollisions < maxCollisions &&
endpointCollisions < maxCollisions &&
i < maxIterations; ++i)
@@ -133,7 +140,7 @@ public class Client extends test.Util.Application
sw.write(" -h ");
sw.write(Integer.toString(rand.nextInt(100)));
- Ice.ProxyIdentityKey obj = new Ice.ProxyIdentityKey(communicator.stringToProxy(sw.toString()));
+ ProxyIdentityKey obj = new ProxyIdentityKey(communicator.stringToProxy(sw.toString()));
if(seenProxy.containsKey(obj.hashCode()))
{
++proxyCollisions;
@@ -150,7 +157,7 @@ public class Client extends test.Util.Application
test(proxyCollisions < maxCollisions);
proxyCollisions = 0;
- seenProxy = new java.util.HashMap<Integer, Ice.ObjectPrx>();
+ seenProxy = new java.util.HashMap<>();
for(i = 0; proxyCollisions < maxCollisions &&
endpointCollisions < maxCollisions &&
i < maxIterations; ++i)
@@ -166,7 +173,8 @@ public class Client extends test.Util.Application
sw.write(" -h ");
sw.write(Integer.toString(rand.nextInt(100)));
- Ice.ProxyIdentityFacetKey obj = new Ice.ProxyIdentityFacetKey(communicator.stringToProxy(sw.toString()));
+ com.zeroc.Ice.ProxyIdentityFacetKey obj =
+ new com.zeroc.Ice.ProxyIdentityFacetKey(communicator.stringToProxy(sw.toString()));
if(seenProxy.containsKey(obj.hashCode()))
{
++proxyCollisions;
@@ -182,18 +190,18 @@ public class Client extends test.Util.Application
}
test(proxyCollisions < maxCollisions);
- Ice.ObjectPrx prx1 = communicator.stringToProxy("Glacier2/router:tcp -p 10010");
- Ice.ObjectPrx prx2 = communicator.stringToProxy("Glacier2/router:ssl -p 10011");
- Ice.ObjectPrx prx3 = communicator.stringToProxy("Glacier2/router:udp -p 10012");
- Ice.ObjectPrx prx4 = communicator.stringToProxy("Glacier2/router:tcp -h zeroc.com -p 10010");
- Ice.ObjectPrx prx5 = communicator.stringToProxy("Glacier2/router:ssl -h zeroc.com -p 10011");
- Ice.ObjectPrx prx6 = communicator.stringToProxy("Glacier2/router:udp -h zeroc.com -p 10012");
- Ice.ObjectPrx prx7 = communicator.stringToProxy("Glacier2/router:tcp -p 10010 -t 10000");
- Ice.ObjectPrx prx8 = communicator.stringToProxy("Glacier2/router:ssl -p 10011 -t 10000");
- Ice.ObjectPrx prx9 = communicator.stringToProxy("Glacier2/router:tcp -h zeroc.com -p 10010 -t 10000");
- Ice.ObjectPrx prx10 = communicator.stringToProxy("Glacier2/router:ssl -h zeroc.com -p 10011 -t 10000");
-
- java.util.Map<String, Integer> proxyMap = new java.util.HashMap<String, Integer>();
+ ObjectPrx prx1 = communicator.stringToProxy("Glacier2/router:tcp -p 10010");
+ ObjectPrx prx2 = communicator.stringToProxy("Glacier2/router:ssl -p 10011");
+ ObjectPrx prx3 = communicator.stringToProxy("Glacier2/router:udp -p 10012");
+ ObjectPrx prx4 = communicator.stringToProxy("Glacier2/router:tcp -h zeroc.com -p 10010");
+ ObjectPrx prx5 = communicator.stringToProxy("Glacier2/router:ssl -h zeroc.com -p 10011");
+ ObjectPrx prx6 = communicator.stringToProxy("Glacier2/router:udp -h zeroc.com -p 10012");
+ ObjectPrx prx7 = communicator.stringToProxy("Glacier2/router:tcp -p 10010 -t 10000");
+ ObjectPrx prx8 = communicator.stringToProxy("Glacier2/router:ssl -p 10011 -t 10000");
+ ObjectPrx prx9 = communicator.stringToProxy("Glacier2/router:tcp -h zeroc.com -p 10010 -t 10000");
+ ObjectPrx prx10 = communicator.stringToProxy("Glacier2/router:ssl -h zeroc.com -p 10011 -t 10000");
+
+ java.util.Map<String, Integer> proxyMap = new java.util.HashMap<>();
proxyMap.put("prx1", prx1.hashCode());
proxyMap.put("prx2", prx2.hashCode());
proxyMap.put("prx3", prx3.hashCode());
@@ -208,43 +216,50 @@ public class Client extends test.Util.Application
test(communicator.stringToProxy("Glacier2/router:tcp -p 10010").hashCode() == proxyMap.get("prx1"));
test(communicator.stringToProxy("Glacier2/router:ssl -p 10011").hashCode() == proxyMap.get("prx2"));
test(communicator.stringToProxy("Glacier2/router:udp -p 10012").hashCode() == proxyMap.get("prx3"));
- test(communicator.stringToProxy("Glacier2/router:tcp -h zeroc.com -p 10010").hashCode() == proxyMap.get("prx4"));
- test(communicator.stringToProxy("Glacier2/router:ssl -h zeroc.com -p 10011").hashCode() == proxyMap.get("prx5"));
- test(communicator.stringToProxy("Glacier2/router:udp -h zeroc.com -p 10012").hashCode() == proxyMap.get("prx6"));
- test(communicator.stringToProxy("Glacier2/router:tcp -p 10010 -t 10000").hashCode() == proxyMap.get("prx7"));
- test(communicator.stringToProxy("Glacier2/router:ssl -p 10011 -t 10000").hashCode() == proxyMap.get("prx8"));
- test(communicator.stringToProxy("Glacier2/router:tcp -h zeroc.com -p 10010 -t 10000").hashCode() == proxyMap.get("prx9"));
- test(communicator.stringToProxy("Glacier2/router:ssl -h zeroc.com -p 10011 -t 10000").hashCode() == proxyMap.get("prx10"));
-
- test(new Ice.ProxyIdentityKey(prx1).hashCode() == new Ice.ProxyIdentityKey(prx1).hashCode());
- test(new Ice.ProxyIdentityFacetKey(prx1).hashCode() == new Ice.ProxyIdentityFacetKey(prx1).hashCode());
-
- test(new Ice.ProxyIdentityKey(prx1).hashCode() == new Ice.ProxyIdentityKey(prx2).hashCode());
- test(new Ice.ProxyIdentityFacetKey(prx1).hashCode() == new Ice.ProxyIdentityFacetKey(prx2).hashCode());
-
- test(new Ice.ProxyIdentityKey(prx1).hashCode() == new Ice.ProxyIdentityKey(prx3).hashCode());
- test(new Ice.ProxyIdentityFacetKey(prx1).hashCode() == new Ice.ProxyIdentityFacetKey(prx3).hashCode());
-
- test(new Ice.ProxyIdentityKey(prx1).hashCode() == new Ice.ProxyIdentityKey(prx4).hashCode());
- test(new Ice.ProxyIdentityFacetKey(prx1).hashCode() == new Ice.ProxyIdentityFacetKey(prx4).hashCode());
-
- test(new Ice.ProxyIdentityKey(prx1).hashCode() == new Ice.ProxyIdentityKey(prx5).hashCode());
- test(new Ice.ProxyIdentityFacetKey(prx1).hashCode() == new Ice.ProxyIdentityFacetKey(prx5).hashCode());
-
- test(new Ice.ProxyIdentityKey(prx1).hashCode() == new Ice.ProxyIdentityKey(prx6).hashCode());
- test(new Ice.ProxyIdentityFacetKey(prx1).hashCode() == new Ice.ProxyIdentityFacetKey(prx6).hashCode());
-
- test(new Ice.ProxyIdentityKey(prx1).hashCode() == new Ice.ProxyIdentityKey(prx7).hashCode());
- test(new Ice.ProxyIdentityFacetKey(prx1).hashCode() == new Ice.ProxyIdentityFacetKey(prx7).hashCode());
-
- test(new Ice.ProxyIdentityKey(prx1).hashCode() == new Ice.ProxyIdentityKey(prx8).hashCode());
- test(new Ice.ProxyIdentityFacetKey(prx1).hashCode() == new Ice.ProxyIdentityFacetKey(prx8).hashCode());
-
- test(new Ice.ProxyIdentityKey(prx1).hashCode() == new Ice.ProxyIdentityKey(prx9).hashCode());
- test(new Ice.ProxyIdentityFacetKey(prx1).hashCode() == new Ice.ProxyIdentityFacetKey(prx9).hashCode());
-
- test(new Ice.ProxyIdentityKey(prx1).hashCode() == new Ice.ProxyIdentityKey(prx10).hashCode());
- test(new Ice.ProxyIdentityFacetKey(prx1).hashCode() == new Ice.ProxyIdentityFacetKey(prx10).hashCode());
+ test(communicator.stringToProxy("Glacier2/router:tcp -h zeroc.com -p 10010").hashCode() ==
+ proxyMap.get("prx4"));
+ test(communicator.stringToProxy("Glacier2/router:ssl -h zeroc.com -p 10011").hashCode() ==
+ proxyMap.get("prx5"));
+ test(communicator.stringToProxy("Glacier2/router:udp -h zeroc.com -p 10012").hashCode() ==
+ proxyMap.get("prx6"));
+ test(communicator.stringToProxy("Glacier2/router:tcp -p 10010 -t 10000").hashCode() ==
+ proxyMap.get("prx7"));
+ test(communicator.stringToProxy("Glacier2/router:ssl -p 10011 -t 10000").hashCode() ==
+ proxyMap.get("prx8"));
+ test(communicator.stringToProxy("Glacier2/router:tcp -h zeroc.com -p 10010 -t 10000").hashCode() ==
+ proxyMap.get("prx9"));
+ test(communicator.stringToProxy("Glacier2/router:ssl -h zeroc.com -p 10011 -t 10000").hashCode() ==
+ proxyMap.get("prx10"));
+
+ test(new ProxyIdentityKey(prx1).hashCode() == new ProxyIdentityKey(prx1).hashCode());
+ test(new ProxyIdentityFacetKey(prx1).hashCode() == new ProxyIdentityFacetKey(prx1).hashCode());
+
+ test(new ProxyIdentityKey(prx1).hashCode() == new ProxyIdentityKey(prx2).hashCode());
+ test(new ProxyIdentityFacetKey(prx1).hashCode() == new ProxyIdentityFacetKey(prx2).hashCode());
+
+ test(new ProxyIdentityKey(prx1).hashCode() == new ProxyIdentityKey(prx3).hashCode());
+ test(new ProxyIdentityFacetKey(prx1).hashCode() == new ProxyIdentityFacetKey(prx3).hashCode());
+
+ test(new ProxyIdentityKey(prx1).hashCode() == new ProxyIdentityKey(prx4).hashCode());
+ test(new ProxyIdentityFacetKey(prx1).hashCode() == new ProxyIdentityFacetKey(prx4).hashCode());
+
+ test(new ProxyIdentityKey(prx1).hashCode() == new ProxyIdentityKey(prx5).hashCode());
+ test(new ProxyIdentityFacetKey(prx1).hashCode() == new ProxyIdentityFacetKey(prx5).hashCode());
+
+ test(new ProxyIdentityKey(prx1).hashCode() == new ProxyIdentityKey(prx6).hashCode());
+ test(new ProxyIdentityFacetKey(prx1).hashCode() == new ProxyIdentityFacetKey(prx6).hashCode());
+
+ test(new ProxyIdentityKey(prx1).hashCode() == new ProxyIdentityKey(prx7).hashCode());
+ test(new ProxyIdentityFacetKey(prx1).hashCode() == new ProxyIdentityFacetKey(prx7).hashCode());
+
+ test(new ProxyIdentityKey(prx1).hashCode() == new ProxyIdentityKey(prx8).hashCode());
+ test(new ProxyIdentityFacetKey(prx1).hashCode() == new ProxyIdentityFacetKey(prx8).hashCode());
+
+ test(new ProxyIdentityKey(prx1).hashCode() == new ProxyIdentityKey(prx9).hashCode());
+ test(new ProxyIdentityFacetKey(prx1).hashCode() == new ProxyIdentityFacetKey(prx9).hashCode());
+
+ test(new ProxyIdentityKey(prx1).hashCode() == new ProxyIdentityKey(prx10).hashCode());
+ test(new ProxyIdentityFacetKey(prx1).hashCode() == new ProxyIdentityFacetKey(prx10).hashCode());
}
out.println("ok");
@@ -252,7 +267,7 @@ public class Client extends test.Util.Application
out.print("testing struct hash algorithm collisions... ");
out.flush();
{
- java.util.Map<Integer, PointF> seenPointF = new java.util.HashMap<Integer, PointF>();
+ java.util.Map<Integer, PointF> seenPointF = new java.util.HashMap<>();
java.util.Random rand = new java.util.Random();
int structCollisions = 0;
for(i = 0; i < maxIterations && structCollisions < maxCollisions; ++i)
@@ -277,7 +292,7 @@ public class Client extends test.Util.Application
}
test(structCollisions < maxCollisions);
- java.util.Map<Integer, PointD> seenPointD = new java.util.HashMap<Integer, PointD>();
+ java.util.Map<Integer, PointD> seenPointD = new java.util.HashMap<>();
rand = new java.util.Random();
structCollisions = 0;
for(i = 0; i < maxIterations && structCollisions < maxCollisions; ++i)
@@ -302,12 +317,12 @@ public class Client extends test.Util.Application
}
test(structCollisions < maxCollisions);
- java.util.Map<Integer, Polyline> seenPolyline = new java.util.HashMap<Integer, Polyline>();
+ java.util.Map<Integer, Polyline> seenPolyline = new java.util.HashMap<>();
structCollisions = 0;
for(i = 0; i < maxIterations && structCollisions < maxCollisions; ++i)
{
Polyline polyline = new Polyline();
- java.util.List<Point> vertices = new java.util.ArrayList<Point>();
+ java.util.List<Point> vertices = new java.util.ArrayList<>();
for(int j = 0; j < 100; ++j)
{
vertices.add(new Point(rand.nextInt(100), rand.nextInt(100)));
@@ -334,15 +349,16 @@ public class Client extends test.Util.Application
}
test(structCollisions < maxCollisions);
- java.util.Map<Integer, ColorPalette> seenColorPalette = new java.util.HashMap<Integer, ColorPalette>();
+ java.util.Map<Integer, ColorPalette> seenColorPalette = new java.util.HashMap<>();
structCollisions = 0;
for(i = 0; i < maxIterations && structCollisions < maxCollisions; ++i)
{
ColorPalette colorPalette = new ColorPalette();
- colorPalette.colors = new java.util.HashMap<Integer, Color>();
+ colorPalette.colors = new java.util.HashMap<>();
for(int j = 0; j < 100; ++j)
{
- colorPalette.colors.put(j, new Color(rand.nextInt(255), rand.nextInt(255), rand.nextInt(255), rand.nextInt(255)));
+ colorPalette.colors.put(j, new Color(rand.nextInt(255), rand.nextInt(255), rand.nextInt(255),
+ rand.nextInt(255)));
}
if(seenColorPalette.containsKey(colorPalette.hashCode()))
@@ -364,7 +380,7 @@ public class Client extends test.Util.Application
}
test(structCollisions < maxCollisions);
- java.util.Map<Integer, Color> seenColor = new java.util.HashMap<Integer, Color>();
+ java.util.Map<Integer, Color> seenColor = new java.util.HashMap<>();
rand = new java.util.Random();
structCollisions = 0;
for(i = 0; i < maxIterations && structCollisions < maxCollisions; ++i)
@@ -390,14 +406,15 @@ public class Client extends test.Util.Application
test(structCollisions < maxCollisions);
structCollisions = 0;
- java.util.Map<Integer, Draw> seenDraw = new java.util.HashMap<Integer, Draw>();
+ java.util.Map<Integer, Draw> seenDraw = new java.util.HashMap<>();
structCollisions = 0;
for(i = 0; i < maxIterations && structCollisions < maxCollisions; ++i)
{
- Draw draw = new Draw(
+ Draw draw = new Draw(
new Color(rand.nextInt(255), rand.nextInt(255), rand.nextInt(255), rand.nextInt(255)),
new Pen(rand.nextInt(10),
- new Color(rand.nextInt(255), rand.nextInt(255), rand.nextInt(255), rand.nextInt(255))),
+ new Color(rand.nextInt(255), rand.nextInt(255), rand.nextInt(255),
+ rand.nextInt(255))),
false);
if(seenDraw.containsKey(draw.hashCode()))
@@ -427,7 +444,7 @@ public class Client extends test.Util.Application
{
communicator.destroy();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
System.out.println(ex.toString());
status = 1;
@@ -442,4 +459,3 @@ public class Client extends test.Util.Application
return status;
}
}
-
diff --git a/java/test/src/main/java/test/Ice/hold/AllTests.java b/java/test/src/main/java/test/Ice/hold/AllTests.java
index 1086e9a5875..33e4f97d994 100644
--- a/java/test/src/main/java/test/Ice/hold/AllTests.java
+++ b/java/test/src/main/java/test/Ice/hold/AllTests.java
@@ -10,15 +10,15 @@
package test.Ice.hold;
import java.io.PrintWriter;
+import java.util.concurrent.CompletableFuture;
+
+import com.zeroc.Ice.InvocationFuture;
import test.Ice.hold.Test.HoldPrx;
-import test.Ice.hold.Test.HoldPrxHelper;
-import test.Ice.hold.Test.Callback_Hold_set;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -33,33 +33,28 @@ public class AllTests
_value = value;
}
- synchronized public void
- set(boolean value)
+ synchronized public void set(boolean value)
{
_value = value;
}
- synchronized boolean
- value()
+ synchronized boolean value()
{
return _value;
}
private boolean _value;
- };
+ }
- static class AMICheckSetValue extends Callback_Hold_set
+ static class AMICheckSetValue
{
- public
- AMICheckSetValue(Condition condition, int expected)
+ public AMICheckSetValue(Condition condition, int expected)
{
_condition = condition;
_expected = expected;
}
- @Override
- public void
- response(int value)
+ public void response(int value)
{
if(value != _expected)
{
@@ -67,44 +62,31 @@ public class AllTests
}
}
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- }
-
- @Override
- synchronized public void
- sent(boolean sync)
- {
- }
-
private Condition _condition;
private int _expected;
- };
+ }
- public static void
- allTests(test.Util.Application app, PrintWriter out)
+ public static void allTests(test.Util.Application app, PrintWriter out)
{
- Ice.Communicator communicator = app.communicator();
+ com.zeroc.Ice.Communicator communicator = app.communicator();
out.print("testing stringToProxy... ");
out.flush();
String ref = "hold:default -p 12010";
- Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref);
test(base != null);
String refSerialized = "hold:default -p 12011";
- Ice.ObjectPrx baseSerialized = communicator.stringToProxy(refSerialized);
+ com.zeroc.Ice.ObjectPrx baseSerialized = communicator.stringToProxy(refSerialized);
test(baseSerialized != null);
out.println("ok");
out.print("testing checked cast... ");
out.flush();
- HoldPrx hold = HoldPrxHelper.checkedCast(base);
- HoldPrx holdOneway = HoldPrxHelper.uncheckedCast(base.ice_oneway());
+ HoldPrx hold = HoldPrx.checkedCast(base);
+ HoldPrx holdOneway = hold.ice_oneway();
test(hold != null);
test(hold.equals(base));
- HoldPrx holdSerialized = HoldPrxHelper.checkedCast(baseSerialized);
- HoldPrx holdSerializedOneway = HoldPrxHelper.uncheckedCast(baseSerialized.ice_oneway());
+ HoldPrx holdSerialized = HoldPrx.checkedCast(baseSerialized);
+ HoldPrx holdSerializedOneway = holdSerialized.ice_oneway();
test(holdSerialized != null);
test(holdSerialized.equals(baseSerialized));
out.println("ok");
@@ -135,14 +117,22 @@ public class AllTests
{
Condition cond = new Condition(true);
int value = 0;
- Ice.AsyncResult result = null;
+ CompletableFuture<Integer> r = null;
+ InvocationFuture<Integer> f = null;
while(cond.value())
{
- result = hold.begin_set(value + 1, random.nextInt(5), new AMICheckSetValue(cond, value));
+ AMICheckSetValue cb = new AMICheckSetValue(cond, value);
+ r = hold.setAsync(value + 1, random.nextInt(5));
+ f = com.zeroc.Ice.Util.getInvocationFuture(r);
+ r.whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ cb.response(result);
+ });
++value;
if(value % 100 == 0)
{
- result.waitForSent();
+ f.waitForSent();
}
if(value > 1000000)
@@ -154,7 +144,7 @@ public class AllTests
}
}
test(value > 100000 || !cond.value());
- result.waitForCompleted();
+ r.join();
}
out.println("ok");
@@ -163,17 +153,25 @@ public class AllTests
{
Condition cond = new Condition(true);
int value = 0;
- Ice.AsyncResult result = null;
+ CompletableFuture<Integer> r = null;
+ InvocationFuture<Integer> f = null;
while(value < 3000 && cond.value())
{
- result = holdSerialized.begin_set(value + 1, random.nextInt(1), new AMICheckSetValue(cond, value));
+ AMICheckSetValue cb = new AMICheckSetValue(cond, value);
+ r = holdSerialized.setAsync(value + 1, random.nextInt(1));
+ f = com.zeroc.Ice.Util.getInvocationFuture(r);
+ r.whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ cb.response(result);
+ });
++value;
if(value % 100 == 0)
{
- result.waitForSent();
+ f.waitForSent();
}
}
- result.waitForCompleted();
+ r.join();
test(cond.value());
for(int i = 0; i < 10000; ++i)
@@ -193,21 +191,23 @@ public class AllTests
{
int value = 0;
holdSerialized.set(value, 0);
- Ice.AsyncResult result = null;
+ CompletableFuture<Void> r = null;
+ InvocationFuture<Void> f = null;
int max = app.isAndroid() ? 5000 : 10000;
for(int i = 0; i < max; ++i)
{
// Create a new proxy for each request
- result = ((HoldPrx)holdSerialized.ice_oneway()).begin_setOneway(value + 1, value);
+ r = holdSerialized.ice_oneway().setOnewayAsync(value + 1, value);
+ f = com.zeroc.Ice.Util.getInvocationFuture(r);
++value;
if((i % 100) == 0)
{
- result.waitForSent();
+ f.waitForSent();
holdSerialized.ice_ping(); // Ensure everything's dispatched
holdSerialized.ice_getConnection().close(false);
}
}
- result.waitForCompleted();
+ r.join();
}
out.println("ok");
diff --git a/java/test/src/main/java/test/Ice/hold/Client.java b/java/test/src/main/java/test/Ice/hold/Client.java
index 28c45f9aa08..6ac9c4c10e1 100644
--- a/java/test/src/main/java/test/Ice/hold/Client.java
+++ b/java/test/src/main/java/test/Ice/hold/Client.java
@@ -19,12 +19,11 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.hold");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.hold");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/hold/HoldI.java b/java/test/src/main/java/test/Ice/hold/HoldI.java
index 6fbef57a5d5..b0487ccb605 100644
--- a/java/test/src/main/java/test/Ice/hold/HoldI.java
+++ b/java/test/src/main/java/test/Ice/hold/HoldI.java
@@ -10,12 +10,11 @@
package test.Ice.hold;
-import test.Ice.hold.Test._HoldDisp;
+import test.Ice.hold.Test.Hold;
-public final class HoldI extends _HoldDisp
+public final class HoldI implements Hold
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -23,7 +22,7 @@ public final class HoldI extends _HoldDisp
}
}
- HoldI(java.util.Timer timer, Ice.ObjectAdapter adapter)
+ HoldI(java.util.Timer timer, com.zeroc.Ice.ObjectAdapter adapter)
{
_timer = timer;
_adapter = adapter;
@@ -31,8 +30,7 @@ public final class HoldI extends _HoldDisp
}
@Override
- public void
- putOnHold(int milliSeconds, Ice.Current current)
+ public void putOnHold(int milliSeconds, com.zeroc.Ice.Current current)
{
if(milliSeconds < 0)
{
@@ -54,7 +52,7 @@ public final class HoldI extends _HoldDisp
{
putOnHold(0, null);
}
- catch(Ice.ObjectAdapterDeactivatedException ex)
+ catch(com.zeroc.Ice.ObjectAdapterDeactivatedException ex)
{
}
}
@@ -63,8 +61,7 @@ public final class HoldI extends _HoldDisp
}
@Override
- public void
- waitForHold(final Ice.Current current)
+ public void waitForHold(final com.zeroc.Ice.Current current)
{
_timer.schedule(new java.util.TimerTask()
{
@@ -77,7 +74,7 @@ public final class HoldI extends _HoldDisp
current.adapter.activate();
}
- catch(Ice.ObjectAdapterDeactivatedException ex)
+ catch(com.zeroc.Ice.ObjectAdapterDeactivatedException ex)
{
//
// This shouldn't occur. The test ensures all the
@@ -92,8 +89,7 @@ public final class HoldI extends _HoldDisp
@Override
- public int
- set(int value, int delay, Ice.Current current)
+ public int set(int value, int delay, com.zeroc.Ice.Current current)
{
try
{
@@ -112,22 +108,20 @@ public final class HoldI extends _HoldDisp
}
@Override
- synchronized public void
- setOneway(int value, int expected, Ice.Current current)
+ synchronized public void setOneway(int value, int expected, com.zeroc.Ice.Current current)
{
test(_last == expected);
_last = value;
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
_adapter.hold();
_adapter.getCommunicator().shutdown();
}
final private java.util.Timer _timer;
- final private Ice.ObjectAdapter _adapter;
+ final private com.zeroc.Ice.ObjectAdapter _adapter;
int _last = 0;
}
diff --git a/java/test/src/main/java/test/Ice/hold/Server.java b/java/test/src/main/java/test/Ice/hold/Server.java
index 2d3a1cf9652..0167c743125 100644
--- a/java/test/src/main/java/test/Ice/hold/Server.java
+++ b/java/test/src/main/java/test/Ice/hold/Server.java
@@ -14,14 +14,14 @@ public class Server extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.Communicator communicator = communicator();
java.util.Timer timer = new java.util.Timer();
- Ice.ObjectAdapter adapter1 = communicator.createObjectAdapter("TestAdapter1");
- adapter1.add(new HoldI(timer, adapter1), Ice.Util.stringToIdentity("hold"));
+ com.zeroc.Ice.ObjectAdapter adapter1 = communicator.createObjectAdapter("TestAdapter1");
+ adapter1.add(new HoldI(timer, adapter1), com.zeroc.Ice.Util.stringToIdentity("hold"));
- Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("TestAdapter2");
- adapter2.add(new HoldI(timer, adapter2), Ice.Util.stringToIdentity("hold"));
+ com.zeroc.Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("TestAdapter2");
+ adapter2.add(new HoldI(timer, adapter2), com.zeroc.Ice.Util.stringToIdentity("hold"));
adapter1.activate();
adapter2.activate();
@@ -35,23 +35,22 @@ public class Server extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.hold");
- initData.properties.setProperty("TestAdapter1.Endpoints", "default -p 12010:udp");
- initData.properties.setProperty("TestAdapter1.ThreadPool.Size", "5");
- initData.properties.setProperty("TestAdapter1.ThreadPool.SizeMax", "5");
- initData.properties.setProperty("TestAdapter1.ThreadPool.SizeWarn", "0");
- initData.properties.setProperty("TestAdapter1.ThreadPool.Serialize", "0");
-
- initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011:udp");
- initData.properties.setProperty("TestAdapter2.ThreadPool.Size", "5");
- initData.properties.setProperty("TestAdapter2.ThreadPool.SizeMax", "5");
- initData.properties.setProperty("TestAdapter2.ThreadPool.SizeWarn", "0");
- initData.properties.setProperty("TestAdapter2.ThreadPool.Serialize", "1");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.hold");
+ r.initData.properties.setProperty("TestAdapter1.Endpoints", "default -p 12010:udp");
+ r.initData.properties.setProperty("TestAdapter1.ThreadPool.Size", "5");
+ r.initData.properties.setProperty("TestAdapter1.ThreadPool.SizeMax", "5");
+ r.initData.properties.setProperty("TestAdapter1.ThreadPool.SizeWarn", "0");
+ r.initData.properties.setProperty("TestAdapter1.ThreadPool.Serialize", "0");
+
+ r.initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011:udp");
+ r.initData.properties.setProperty("TestAdapter2.ThreadPool.Size", "5");
+ r.initData.properties.setProperty("TestAdapter2.ThreadPool.SizeMax", "5");
+ r.initData.properties.setProperty("TestAdapter2.ThreadPool.SizeWarn", "0");
+ r.initData.properties.setProperty("TestAdapter2.ThreadPool.Serialize", "1");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/info/AllTests.java b/java/test/src/main/java/test/Ice/info/AllTests.java
index c2e3b3022f2..23594b9548b 100644
--- a/java/test/src/main/java/test/Ice/info/AllTests.java
+++ b/java/test/src/main/java/test/Ice/info/AllTests.java
@@ -11,13 +11,28 @@ package test.Ice.info;
import java.io.PrintWriter;
+import com.zeroc.Ice.ConnectionInfo;
+import com.zeroc.Ice.Endpoint;
+import com.zeroc.Ice.EndpointInfo;
+import com.zeroc.Ice.IPConnectionInfo;
+import com.zeroc.Ice.OpaqueEndpointInfo;
+import com.zeroc.Ice.SSLEndpointType;
+import com.zeroc.Ice.TCPConnectionInfo;
+import com.zeroc.Ice.TCPEndpointInfo;
+import com.zeroc.Ice.TCPEndpointType;
+import com.zeroc.Ice.UDPConnectionInfo;
+import com.zeroc.Ice.UDPEndpointInfo;
+import com.zeroc.Ice.UDPEndpointType;
+import com.zeroc.Ice.WSConnectionInfo;
+import com.zeroc.Ice.WSEndpointInfo;
+import com.zeroc.Ice.WSEndpointType;
+import com.zeroc.Ice.WSSEndpointType;
+
import test.Ice.info.Test.TestIntfPrx;
-import test.Ice.info.Test.TestIntfPrxHelper;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -25,63 +40,60 @@ public class AllTests
}
}
- private static Ice.TCPEndpointInfo
- getTCPEndpointInfo(Ice.EndpointInfo info)
+ private static TCPEndpointInfo getTCPEndpointInfo(EndpointInfo info)
{
- for(Ice.EndpointInfo p = info; p != null; p = p.underlying)
+ for(EndpointInfo p = info; p != null; p = p.underlying)
{
- if(p instanceof Ice.TCPEndpointInfo)
+ if(p instanceof TCPEndpointInfo)
{
- return (Ice.TCPEndpointInfo)p;
+ return (TCPEndpointInfo)p;
}
}
return null;
}
- private static Ice.TCPConnectionInfo
- getTCPConnectionInfo(Ice.ConnectionInfo info)
+ private static TCPConnectionInfo getTCPConnectionInfo(ConnectionInfo info)
{
- for(Ice.ConnectionInfo p = info; p != null; p = p.underlying)
+ for(ConnectionInfo p = info; p != null; p = p.underlying)
{
- if(p instanceof Ice.TCPConnectionInfo)
+ if(p instanceof TCPConnectionInfo)
{
- return (Ice.TCPConnectionInfo)p;
+ return (TCPConnectionInfo)p;
}
}
return null;
}
- public static void
- allTests(Ice.Communicator communicator, PrintWriter out)
+ public static void allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out)
{
out.print("testing proxy endpoint information... ");
out.flush();
{
- Ice.ObjectPrx p1 = communicator.stringToProxy(
+ com.zeroc.Ice.ObjectPrx p1 = communicator.stringToProxy(
"test -t:default -h tcphost -p 10000 -t 1200 -z --sourceAddress 10.10.10.10:" +
"udp -h udphost -p 10001 --interface eth0 --ttl 5 --sourceAddress 10.10.10.10:" +
"opaque -e 1.8 -t 100 -v ABCD");
- Ice.Endpoint[] endps = p1.ice_getEndpoints();
- Ice.EndpointInfo info = endps[0].getInfo();
- Ice.TCPEndpointInfo tcpEndpoint = (Ice.TCPEndpointInfo)getTCPEndpointInfo(info);
+ Endpoint[] endps = p1.ice_getEndpoints();
+ EndpointInfo info = endps[0].getInfo();
+ TCPEndpointInfo tcpEndpoint = (TCPEndpointInfo)getTCPEndpointInfo(info);
test(tcpEndpoint.host.equals("tcphost"));
test(tcpEndpoint.port == 10000);
test(tcpEndpoint.timeout == 1200);
test(tcpEndpoint.sourceAddress.equals("10.10.10.10"));
test(tcpEndpoint.compress);
test(!tcpEndpoint.datagram());
- test(tcpEndpoint.type() == Ice.TCPEndpointType.value && !tcpEndpoint.secure() ||
- tcpEndpoint.type() == Ice.SSLEndpointType.value && tcpEndpoint.secure() ||
- tcpEndpoint.type() == Ice.WSEndpointType.value && !tcpEndpoint.secure() ||
- tcpEndpoint.type() == Ice.WSSEndpointType.value && tcpEndpoint.secure());
+ test(tcpEndpoint.type() == TCPEndpointType.value && !tcpEndpoint.secure() ||
+ tcpEndpoint.type() == SSLEndpointType.value && tcpEndpoint.secure() ||
+ tcpEndpoint.type() == WSEndpointType.value && !tcpEndpoint.secure() ||
+ tcpEndpoint.type() == WSSEndpointType.value && tcpEndpoint.secure());
- test(tcpEndpoint.type() == Ice.TCPEndpointType.value && info instanceof Ice.TCPEndpointInfo ||
- tcpEndpoint.type() == Ice.SSLEndpointType.value && info instanceof IceSSL.EndpointInfo ||
- tcpEndpoint.type() == Ice.WSEndpointType.value && info instanceof Ice.WSEndpointInfo ||
- tcpEndpoint.type() == Ice.WSSEndpointType.value && info instanceof Ice.WSEndpointInfo);
+ test(tcpEndpoint.type() == TCPEndpointType.value && info instanceof TCPEndpointInfo ||
+ tcpEndpoint.type() == SSLEndpointType.value && info instanceof com.zeroc.IceSSL.EndpointInfo ||
+ tcpEndpoint.type() == WSEndpointType.value && info instanceof WSEndpointInfo ||
+ tcpEndpoint.type() == WSSEndpointType.value && info instanceof WSEndpointInfo);
- Ice.UDPEndpointInfo udpEndpoint = (Ice.UDPEndpointInfo)endps[1].getInfo();
+ UDPEndpointInfo udpEndpoint = (UDPEndpointInfo)endps[1].getInfo();
test(udpEndpoint.host.equals("udphost"));
test(udpEndpoint.port == 10001);
test(udpEndpoint.mcastInterface.equals("eth0"));
@@ -91,10 +103,10 @@ public class AllTests
test(!udpEndpoint.compress);
test(!udpEndpoint.secure());
test(udpEndpoint.datagram());
- test(udpEndpoint.type() == Ice.UDPEndpointType.value);
+ test(udpEndpoint.type() == UDPEndpointType.value);
- Ice.OpaqueEndpointInfo opaqueEndpoint = (Ice.OpaqueEndpointInfo)endps[2].getInfo();
- test(opaqueEndpoint.rawEncoding.equals(new Ice.EncodingVersion((byte)1, (byte)8)));
+ OpaqueEndpointInfo opaqueEndpoint = (OpaqueEndpointInfo)endps[2].getInfo();
+ test(opaqueEndpoint.rawEncoding.equals(new com.zeroc.Ice.EncodingVersion((byte)1, (byte)8)));
}
out.println("ok");
@@ -103,21 +115,21 @@ public class AllTests
out.flush();
{
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -t 15000:udp");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Endpoint[] endpoints = adapter.getEndpoints();
+ Endpoint[] endpoints = adapter.getEndpoints();
test(endpoints.length == 2);
- Ice.Endpoint[] publishedEndpoints = adapter.getPublishedEndpoints();
+ Endpoint[] publishedEndpoints = adapter.getPublishedEndpoints();
test(java.util.Arrays.equals(endpoints, publishedEndpoints));
- Ice.TCPEndpointInfo tcpEndpoint = getTCPEndpointInfo(endpoints[0].getInfo());
- test(tcpEndpoint.type() == Ice.TCPEndpointType.value || tcpEndpoint.type() == Ice.SSLEndpointType.value ||
- tcpEndpoint.type() == Ice.WSEndpointType.value || tcpEndpoint.type() == Ice.WSSEndpointType.value);
+ TCPEndpointInfo tcpEndpoint = getTCPEndpointInfo(endpoints[0].getInfo());
+ test(tcpEndpoint.type() == TCPEndpointType.value || tcpEndpoint.type() == SSLEndpointType.value ||
+ tcpEndpoint.type() == WSEndpointType.value || tcpEndpoint.type() == WSSEndpointType.value);
test(tcpEndpoint.host.equals(defaultHost));
test(tcpEndpoint.port > 0);
test(tcpEndpoint.timeout == 15000);
- Ice.UDPEndpointInfo udpEndpoint = (Ice.UDPEndpointInfo)endpoints[1].getInfo();
+ UDPEndpointInfo udpEndpoint = (UDPEndpointInfo)endpoints[1].getInfo();
test(udpEndpoint.host.equals(defaultHost));
test(udpEndpoint.datagram());
test(udpEndpoint.port > 0);
@@ -133,7 +145,7 @@ public class AllTests
publishedEndpoints = adapter.getPublishedEndpoints();
test(publishedEndpoints.length == 1);
- for(Ice.Endpoint endpoint : endpoints)
+ for(Endpoint endpoint : endpoints)
{
tcpEndpoint = getTCPEndpointInfo(endpoint.getInfo());
test(tcpEndpoint.port == 12020);
@@ -147,14 +159,14 @@ public class AllTests
}
out.println("ok");
- Ice.ObjectPrx base = communicator.stringToProxy("test:default -p 12010:udp -p 12010");
- TestIntfPrx testIntf = TestIntfPrxHelper.checkedCast(base);
+ com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy("test:default -p 12010:udp -p 12010");
+ TestIntfPrx testIntf = TestIntfPrx.checkedCast(base);
out.print("test connection endpoint information... ");
out.flush();
{
- Ice.EndpointInfo info = base.ice_getConnection().getEndpoint().getInfo();
- Ice.TCPEndpointInfo tcpinfo = getTCPEndpointInfo(info);
+ EndpointInfo info = base.ice_getConnection().getEndpoint().getInfo();
+ TCPEndpointInfo tcpinfo = getTCPEndpointInfo(info);
test(tcpinfo.port == 12010);
test(!tcpinfo.compress);
test(tcpinfo.host.equals(defaultHost));
@@ -166,7 +178,7 @@ public class AllTests
test(port > 0);
info = base.ice_datagram().ice_getConnection().getEndpoint().getInfo();
- Ice.UDPEndpointInfo udp = (Ice.UDPEndpointInfo)info;
+ UDPEndpointInfo udp = (UDPEndpointInfo)info;
test(udp.port == 12010);
test(udp.host.equals(defaultHost));
}
@@ -175,10 +187,10 @@ public class AllTests
out.print("testing connection information... ");
out.flush();
{
- Ice.Connection connection = base.ice_getConnection();
+ com.zeroc.Ice.Connection connection = base.ice_getConnection();
connection.setBufferSize(1024, 2048);
- Ice.TCPConnectionInfo info = getTCPConnectionInfo(connection.getInfo());
+ TCPConnectionInfo info = getTCPConnectionInfo(connection.getInfo());
test(!info.incoming);
test(info.adapterName.length() == 0);
test(info.localPort > 0);
@@ -201,7 +213,7 @@ public class AllTests
if(base.ice_getConnection().type().equals("ws") || base.ice_getConnection().type().equals("wss"))
{
- java.util.Map<String, String> headers = ((Ice.WSConnectionInfo)connection.getInfo()).headers;
+ java.util.Map<String, String> headers = ((WSConnectionInfo)connection.getInfo()).headers;
test(headers.get("Upgrade").equals("websocket"));
test(headers.get("Connection").equals("Upgrade"));
test(headers.get("Sec-WebSocket-Protocol").equals("ice.zeroc.com"));
@@ -217,7 +229,7 @@ public class AllTests
connection = base.ice_datagram().ice_getConnection();
connection.setBufferSize(2048, 1024);
- Ice.UDPConnectionInfo udpinfo = (Ice.UDPConnectionInfo)connection.getInfo();
+ UDPConnectionInfo udpinfo = (UDPConnectionInfo)connection.getInfo();
test(!udpinfo.incoming);
test(udpinfo.adapterName.length() == 0);
test(udpinfo.localPort > 0);
diff --git a/java/test/src/main/java/test/Ice/info/Client.java b/java/test/src/main/java/test/Ice/info/Client.java
index 600b5008bd4..165bb7e8b2d 100644
--- a/java/test/src/main/java/test/Ice/info/Client.java
+++ b/java/test/src/main/java/test/Ice/info/Client.java
@@ -19,12 +19,11 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.info");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.info");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/info/Server.java b/java/test/src/main/java/test/Ice/info/Server.java
index 455e21046d0..c262bfab160 100644
--- a/java/test/src/main/java/test/Ice/info/Server.java
+++ b/java/test/src/main/java/test/Ice/info/Server.java
@@ -14,21 +14,20 @@ public class Server extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- adapter.add(new TestI(), Ice.Util.stringToIdentity("test"));
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new TestI(), com.zeroc.Ice.Util.stringToIdentity("test"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp -p 12010");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp -p 12010");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/info/TestI.java b/java/test/src/main/java/test/Ice/info/TestI.java
index 71daea00326..777bd8e0632 100644
--- a/java/test/src/main/java/test/Ice/info/TestI.java
+++ b/java/test/src/main/java/test/Ice/info/TestI.java
@@ -8,31 +8,30 @@
// **********************************************************************
package test.Ice.info;
-import test.Ice.info.Test._TestIntfDisp;
-public class TestI extends _TestIntfDisp
+import test.Ice.info.Test.TestIntf;
+
+public class TestI implements TestIntf
{
- private static Ice.IPEndpointInfo
- getIPEndpointInfo(Ice.EndpointInfo info)
+ private static com.zeroc.Ice.IPEndpointInfo getIPEndpointInfo(com.zeroc.Ice.EndpointInfo info)
{
- for(Ice.EndpointInfo p = info; p != null; p = p.underlying)
+ for(com.zeroc.Ice.EndpointInfo p = info; p != null; p = p.underlying)
{
- if(p instanceof Ice.IPEndpointInfo)
+ if(p instanceof com.zeroc.Ice.IPEndpointInfo)
{
- return (Ice.IPEndpointInfo)p;
+ return (com.zeroc.Ice.IPEndpointInfo)p;
}
}
return null;
}
- private static Ice.IPConnectionInfo
- getIPConnectionInfo(Ice.ConnectionInfo info)
+ private static com.zeroc.Ice.IPConnectionInfo getIPConnectionInfo(com.zeroc.Ice.ConnectionInfo info)
{
- for(Ice.ConnectionInfo p = info; p != null; p = p.underlying)
+ for(com.zeroc.Ice.ConnectionInfo p = info; p != null; p = p.underlying)
{
- if(p instanceof Ice.IPConnectionInfo)
+ if(p instanceof com.zeroc.Ice.IPConnectionInfo)
{
- return (Ice.IPConnectionInfo)p;
+ return (com.zeroc.Ice.IPConnectionInfo)p;
}
}
return null;
@@ -43,29 +42,29 @@ public class TestI extends _TestIntfDisp
}
@Override
- public void shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
@Override
- public java.util.Map<String, String> getEndpointInfoAsContext(Ice.Current c)
+ public java.util.Map<String, String> getEndpointInfoAsContext(com.zeroc.Ice.Current c)
{
- java.util.Map<String, String> ctx = new java.util.HashMap<String, String>();
- Ice.EndpointInfo info = c.con.getEndpoint().getInfo();
+ java.util.Map<String, String> ctx = new java.util.HashMap<>();
+ com.zeroc.Ice.EndpointInfo info = c.con.getEndpoint().getInfo();
ctx.put("timeout", Integer.toString(info.timeout));
ctx.put("compress", info.compress ? "true" : "false");
ctx.put("datagram", info.datagram() ? "true" : "false");
ctx.put("secure", info.datagram() ? "true" : "false");
ctx.put("type", Integer.toString(info.type()));
- Ice.IPEndpointInfo ipinfo = getIPEndpointInfo(info);
+ com.zeroc.Ice.IPEndpointInfo ipinfo = getIPEndpointInfo(info);
ctx.put("host", ipinfo.host);
ctx.put("port", Integer.toString(ipinfo.port));
- if(ipinfo instanceof Ice.UDPEndpointInfo)
+ if(ipinfo instanceof com.zeroc.Ice.UDPEndpointInfo)
{
- Ice.UDPEndpointInfo udp = (Ice.UDPEndpointInfo)ipinfo;
+ com.zeroc.Ice.UDPEndpointInfo udp = (com.zeroc.Ice.UDPEndpointInfo)ipinfo;
ctx.put("mcastInterface", udp.mcastInterface);
ctx.put("mcastTtl", Integer.toString(udp.mcastTtl));
}
@@ -74,22 +73,22 @@ public class TestI extends _TestIntfDisp
}
@Override
- public java.util.Map<String, String> getConnectionInfoAsContext(Ice.Current c)
+ public java.util.Map<String, String> getConnectionInfoAsContext(com.zeroc.Ice.Current c)
{
- java.util.Map<String, String> ctx = new java.util.HashMap<String, String>();
- Ice.ConnectionInfo info = c.con.getInfo();
+ java.util.Map<String, String> ctx = new java.util.HashMap<>();
+ com.zeroc.Ice.ConnectionInfo info = c.con.getInfo();
ctx.put("adapterName", info.adapterName);
ctx.put("incoming", info.incoming ? "true" : "false");
- Ice.IPConnectionInfo ipinfo = getIPConnectionInfo(info);
+ com.zeroc.Ice.IPConnectionInfo ipinfo = getIPConnectionInfo(info);
ctx.put("localAddress", ipinfo.localAddress);
ctx.put("localPort", Integer.toString(ipinfo.localPort));
ctx.put("remoteAddress", ipinfo.remoteAddress);
ctx.put("remotePort", Integer.toString(ipinfo.remotePort));
- if(info instanceof Ice.WSConnectionInfo)
+ if(info instanceof com.zeroc.Ice.WSConnectionInfo)
{
- Ice.WSConnectionInfo wsinfo = (Ice.WSConnectionInfo)info;
+ com.zeroc.Ice.WSConnectionInfo wsinfo = (com.zeroc.Ice.WSConnectionInfo)info;
for(java.util.Map.Entry<String, String> e : wsinfo.headers.entrySet())
{
ctx.put("ws." + e.getKey(), e.getValue());
diff --git a/java/test/src/main/java/test/Ice/inheritance/AllTests.java b/java/test/src/main/java/test/Ice/inheritance/AllTests.java
index 360cc09b725..c9b7515c3c0 100644
--- a/java/test/src/main/java/test/Ice/inheritance/AllTests.java
+++ b/java/test/src/main/java/test/Ice/inheritance/AllTests.java
@@ -12,7 +12,6 @@ package test.Ice.inheritance;
import java.io.PrintWriter;
import test.Ice.inheritance.Test.InitialPrx;
-import test.Ice.inheritance.Test.InitialPrxHelper;
import test.Ice.inheritance.Test.MA.CAPrx;
import test.Ice.inheritance.Test.MA.CCPrx;
import test.Ice.inheritance.Test.MA.CDPrx;
@@ -24,8 +23,7 @@ import test.Ice.inheritance.Test.MB.IB2Prx;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -33,19 +31,18 @@ public class AllTests
}
}
- public static InitialPrx
- allTests(Ice.Communicator communicator, PrintWriter out)
+ public static InitialPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out)
{
out.print("testing stringToProxy... ");
out.flush();
String ref = "initial:default -p 12010";
- Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref);
test(base != null);
out.println("ok");
out.print("testing checked cast... ");
out.flush();
- InitialPrx initial = InitialPrxHelper.checkedCast(base);
+ InitialPrx initial = InitialPrx.checkedCast(base);
test(initial != null);
test(initial.equals(base));
out.println("ok");
diff --git a/java/test/src/main/java/test/Ice/inheritance/CAI.java b/java/test/src/main/java/test/Ice/inheritance/CAI.java
index 9c7fbcf2ca6..66690ccc359 100644
--- a/java/test/src/main/java/test/Ice/inheritance/CAI.java
+++ b/java/test/src/main/java/test/Ice/inheritance/CAI.java
@@ -9,19 +9,17 @@
package test.Ice.inheritance;
-import test.Ice.inheritance.Test.MA.CA;
+import test.Ice.inheritance.Test.MA._CADisp;
import test.Ice.inheritance.Test.MA.CAPrx;
-public final class CAI extends CA
+public final class CAI implements _CADisp
{
- public
- CAI()
+ public CAI()
{
}
@Override
- public CAPrx
- caop(CAPrx p, Ice.Current current)
+ public CAPrx caop(CAPrx p, com.zeroc.Ice.Current current)
{
return p;
}
diff --git a/java/test/src/main/java/test/Ice/inheritance/CBI.java b/java/test/src/main/java/test/Ice/inheritance/CBI.java
index 8496a14b7cd..ea7e925ce91 100644
--- a/java/test/src/main/java/test/Ice/inheritance/CBI.java
+++ b/java/test/src/main/java/test/Ice/inheritance/CBI.java
@@ -10,26 +10,23 @@
package test.Ice.inheritance;
import test.Ice.inheritance.Test.MA.CAPrx;
-import test.Ice.inheritance.Test.MB.CB;
+import test.Ice.inheritance.Test.MB._CBDisp;
import test.Ice.inheritance.Test.MB.CBPrx;
-public final class CBI extends CB
+public final class CBI implements _CBDisp
{
- public
- CBI()
+ public CBI()
{
}
@Override
- public CAPrx
- caop(CAPrx p, Ice.Current current)
+ public CAPrx caop(CAPrx p, com.zeroc.Ice.Current current)
{
return p;
}
@Override
- public CBPrx
- cbop(CBPrx p, Ice.Current current)
+ public CBPrx cbop(CBPrx p, com.zeroc.Ice.Current current)
{
return p;
}
diff --git a/java/test/src/main/java/test/Ice/inheritance/CCI.java b/java/test/src/main/java/test/Ice/inheritance/CCI.java
index eb5f905f28a..684558683e2 100644
--- a/java/test/src/main/java/test/Ice/inheritance/CCI.java
+++ b/java/test/src/main/java/test/Ice/inheritance/CCI.java
@@ -10,34 +10,30 @@
package test.Ice.inheritance;
import test.Ice.inheritance.Test.MA.CAPrx;
-import test.Ice.inheritance.Test.MA.CC;
+import test.Ice.inheritance.Test.MA._CCDisp;
import test.Ice.inheritance.Test.MA.CCPrx;
import test.Ice.inheritance.Test.MB.CBPrx;
-public final class CCI extends CC
+public final class CCI implements _CCDisp
{
- public
- CCI()
+ public CCI()
{
}
@Override
- public CAPrx
- caop(CAPrx p, Ice.Current current)
+ public CAPrx caop(CAPrx p, com.zeroc.Ice.Current current)
{
return p;
}
@Override
- public CCPrx
- ccop(CCPrx p, Ice.Current current)
+ public CCPrx ccop(CCPrx p, com.zeroc.Ice.Current current)
{
return p;
}
@Override
- public CBPrx
- cbop(CBPrx p, Ice.Current current)
+ public CBPrx cbop(CBPrx p, com.zeroc.Ice.Current current)
{
return p;
}
diff --git a/java/test/src/main/java/test/Ice/inheritance/CDI.java b/java/test/src/main/java/test/Ice/inheritance/CDI.java
index af80144cae2..2debf67d95a 100644
--- a/java/test/src/main/java/test/Ice/inheritance/CDI.java
+++ b/java/test/src/main/java/test/Ice/inheritance/CDI.java
@@ -11,65 +11,57 @@ package test.Ice.inheritance;
import test.Ice.inheritance.Test.MA.CAPrx;
import test.Ice.inheritance.Test.MA.CCPrx;
-import test.Ice.inheritance.Test.MA.CD;
+import test.Ice.inheritance.Test.MA._CDDisp;
import test.Ice.inheritance.Test.MA.CDPrx;
import test.Ice.inheritance.Test.MA.IAPrx;
import test.Ice.inheritance.Test.MB.CBPrx;
import test.Ice.inheritance.Test.MB.IB1Prx;
import test.Ice.inheritance.Test.MB.IB2Prx;
-public final class CDI extends CD
+public final class CDI implements _CDDisp
{
- public
- CDI()
+ public CDI()
{
}
@Override
- public CAPrx
- caop(CAPrx p, Ice.Current current)
+ public CAPrx caop(CAPrx p, com.zeroc.Ice.Current current)
{
return p;
}
@Override
- public CCPrx
- ccop(CCPrx p, Ice.Current current)
+ public CCPrx ccop(CCPrx p, com.zeroc.Ice.Current current)
{
return p;
}
@Override
- public CDPrx
- cdop(CDPrx p, Ice.Current current)
+ public CDPrx cdop(CDPrx p, com.zeroc.Ice.Current current)
{
return p;
}
@Override
- public IAPrx
- iaop(IAPrx p, Ice.Current current)
+ public IAPrx iaop(IAPrx p, com.zeroc.Ice.Current current)
{
return p;
}
@Override
- public CBPrx
- cbop(CBPrx p, Ice.Current current)
+ public CBPrx cbop(CBPrx p, com.zeroc.Ice.Current current)
{
return p;
}
@Override
- public IB1Prx
- ib1op(IB1Prx p, Ice.Current current)
+ public IB1Prx ib1op(IB1Prx p, com.zeroc.Ice.Current current)
{
return p;
}
@Override
- public IB2Prx
- ib2op(IB2Prx p, Ice.Current current)
+ public IB2Prx ib2op(IB2Prx p, com.zeroc.Ice.Current current)
{
return p;
}
diff --git a/java/test/src/main/java/test/Ice/inheritance/Client.java b/java/test/src/main/java/test/Ice/inheritance/Client.java
index 704cf503752..0094eac4df3 100644
--- a/java/test/src/main/java/test/Ice/inheritance/Client.java
+++ b/java/test/src/main/java/test/Ice/inheritance/Client.java
@@ -16,19 +16,18 @@ public class Client extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.Communicator communicator = communicator();
InitialPrx initial = AllTests.allTests(communicator, getWriter());
initial.shutdown();
return 0;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.inheritance");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.inheritance");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/inheritance/Collocated.java b/java/test/src/main/java/test/Ice/inheritance/Collocated.java
index ac600d8f32c..db86f22a5a0 100644
--- a/java/test/src/main/java/test/Ice/inheritance/Collocated.java
+++ b/java/test/src/main/java/test/Ice/inheritance/Collocated.java
@@ -14,10 +14,10 @@ public class Collocated extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Object object = new InitialI(adapter);
- adapter.add(object, Ice.Util.stringToIdentity("initial"));
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.Object object = new InitialI(adapter);
+ adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("initial"));
AllTests.allTests(communicator, getWriter());
@@ -25,13 +25,12 @@ public class Collocated extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.inheritance");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.inheritance");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/inheritance/IAI.java b/java/test/src/main/java/test/Ice/inheritance/IAI.java
index d1262ed5165..1275da06ccd 100644
--- a/java/test/src/main/java/test/Ice/inheritance/IAI.java
+++ b/java/test/src/main/java/test/Ice/inheritance/IAI.java
@@ -10,18 +10,16 @@
package test.Ice.inheritance;
import test.Ice.inheritance.Test.MA.IAPrx;
-import test.Ice.inheritance.Test.MA._IADisp;
+import test.Ice.inheritance.Test.MA.IA;
-public final class IAI extends _IADisp
+public final class IAI implements IA
{
- public
- IAI()
+ public IAI()
{
}
@Override
- public IAPrx
- iaop(IAPrx p, Ice.Current current)
+ public IAPrx iaop(IAPrx p, com.zeroc.Ice.Current current)
{
return p;
}
diff --git a/java/test/src/main/java/test/Ice/inheritance/IB1I.java b/java/test/src/main/java/test/Ice/inheritance/IB1I.java
index 317662cf423..9f510a0365f 100644
--- a/java/test/src/main/java/test/Ice/inheritance/IB1I.java
+++ b/java/test/src/main/java/test/Ice/inheritance/IB1I.java
@@ -11,25 +11,22 @@ package test.Ice.inheritance;
import test.Ice.inheritance.Test.MA.IAPrx;
import test.Ice.inheritance.Test.MB.IB1Prx;
-import test.Ice.inheritance.Test.MB._IB1Disp;
+import test.Ice.inheritance.Test.MB.IB1;
-public final class IB1I extends _IB1Disp
+public final class IB1I implements IB1
{
- public
- IB1I()
+ public IB1I()
{
}
@Override
- public IAPrx
- iaop(IAPrx p, Ice.Current current)
+ public IAPrx iaop(IAPrx p, com.zeroc.Ice.Current current)
{
return p;
}
@Override
- public IB1Prx
- ib1op(IB1Prx p, Ice.Current current)
+ public IB1Prx ib1op(IB1Prx p, com.zeroc.Ice.Current current)
{
return p;
}
diff --git a/java/test/src/main/java/test/Ice/inheritance/IB2I.java b/java/test/src/main/java/test/Ice/inheritance/IB2I.java
index 0a446b7cb99..04e191c494c 100644
--- a/java/test/src/main/java/test/Ice/inheritance/IB2I.java
+++ b/java/test/src/main/java/test/Ice/inheritance/IB2I.java
@@ -11,25 +11,22 @@ package test.Ice.inheritance;
import test.Ice.inheritance.Test.MA.IAPrx;
import test.Ice.inheritance.Test.MB.IB2Prx;
-import test.Ice.inheritance.Test.MB._IB2Disp;
+import test.Ice.inheritance.Test.MB.IB2;
-public final class IB2I extends _IB2Disp
+public final class IB2I implements IB2
{
- public
- IB2I()
+ public IB2I()
{
}
@Override
- public IAPrx
- iaop(IAPrx p, Ice.Current current)
+ public IAPrx iaop(IAPrx p, com.zeroc.Ice.Current current)
{
return p;
}
@Override
- public IB2Prx
- ib2op(IB2Prx p, Ice.Current current)
+ public IB2Prx ib2op(IB2Prx p, com.zeroc.Ice.Current current)
{
return p;
}
diff --git a/java/test/src/main/java/test/Ice/inheritance/ICI.java b/java/test/src/main/java/test/Ice/inheritance/ICI.java
index af14684d8d2..710a7050f72 100644
--- a/java/test/src/main/java/test/Ice/inheritance/ICI.java
+++ b/java/test/src/main/java/test/Ice/inheritance/ICI.java
@@ -11,41 +11,36 @@ package test.Ice.inheritance;
import test.Ice.inheritance.Test.MA.IAPrx;
import test.Ice.inheritance.Test.MA.ICPrx;
-import test.Ice.inheritance.Test.MA._ICDisp;
+import test.Ice.inheritance.Test.MA.IC;
import test.Ice.inheritance.Test.MB.IB1Prx;
import test.Ice.inheritance.Test.MB.IB2Prx;
-public final class ICI extends _ICDisp
+public final class ICI implements IC
{
- public
- ICI()
+ public ICI()
{
}
@Override
- public IAPrx
- iaop(IAPrx p, Ice.Current current)
+ public IAPrx iaop(IAPrx p, com.zeroc.Ice.Current current)
{
return p;
}
@Override
- public ICPrx
- icop(ICPrx p, Ice.Current current)
+ public ICPrx icop(ICPrx p, com.zeroc.Ice.Current current)
{
return p;
}
@Override
- public IB1Prx
- ib1op(IB1Prx p, Ice.Current current)
+ public IB1Prx ib1op(IB1Prx p, com.zeroc.Ice.Current current)
{
return p;
}
@Override
- public IB2Prx
- ib2op(IB2Prx p, Ice.Current current)
+ public IB2Prx ib2op(IB2Prx p, com.zeroc.Ice.Current current)
{
return p;
}
diff --git a/java/test/src/main/java/test/Ice/inheritance/InitialI.java b/java/test/src/main/java/test/Ice/inheritance/InitialI.java
index 429c467d569..47a4c1469b0 100644
--- a/java/test/src/main/java/test/Ice/inheritance/InitialI.java
+++ b/java/test/src/main/java/test/Ice/inheritance/InitialI.java
@@ -9,98 +9,80 @@
package test.Ice.inheritance;
-import test.Ice.inheritance.Test._InitialDisp;
+import test.Ice.inheritance.Test.Initial;
import test.Ice.inheritance.Test.MA.CAPrx;
-import test.Ice.inheritance.Test.MA.CAPrxHelper;
import test.Ice.inheritance.Test.MA.CCPrx;
-import test.Ice.inheritance.Test.MA.CCPrxHelper;
import test.Ice.inheritance.Test.MA.CDPrx;
-import test.Ice.inheritance.Test.MA.CDPrxHelper;
import test.Ice.inheritance.Test.MA.IAPrx;
-import test.Ice.inheritance.Test.MA.IAPrxHelper;
import test.Ice.inheritance.Test.MA.ICPrx;
-import test.Ice.inheritance.Test.MA.ICPrxHelper;
import test.Ice.inheritance.Test.MB.CBPrx;
-import test.Ice.inheritance.Test.MB.CBPrxHelper;
import test.Ice.inheritance.Test.MB.IB1Prx;
-import test.Ice.inheritance.Test.MB.IB1PrxHelper;
import test.Ice.inheritance.Test.MB.IB2Prx;
-import test.Ice.inheritance.Test.MB.IB2PrxHelper;
-public final class InitialI extends _InitialDisp
+public final class InitialI implements Initial
{
- public
- InitialI(Ice.ObjectAdapter adapter)
+ public InitialI(com.zeroc.Ice.ObjectAdapter adapter)
{
- _ca = CAPrxHelper.uncheckedCast(adapter.addWithUUID(new CAI()));
- _cb = CBPrxHelper.uncheckedCast(adapter.addWithUUID(new CBI()));
- _cc = CCPrxHelper.uncheckedCast(adapter.addWithUUID(new CCI()));
- _cd = CDPrxHelper.uncheckedCast(adapter.addWithUUID(new CDI()));
- _ia = IAPrxHelper.uncheckedCast(adapter.addWithUUID(new IAI()));
- _ib1 = IB1PrxHelper.uncheckedCast(adapter.addWithUUID(new IB1I()));
- _ib2 = IB2PrxHelper.uncheckedCast(adapter.addWithUUID(new IB2I()));
- _ic = ICPrxHelper.uncheckedCast(adapter.addWithUUID(new ICI()));
+ _ca = CAPrx.uncheckedCast(adapter.addWithUUID(new CAI()));
+ _cb = CBPrx.uncheckedCast(adapter.addWithUUID(new CBI()));
+ _cc = CCPrx.uncheckedCast(adapter.addWithUUID(new CCI()));
+ _cd = CDPrx.uncheckedCast(adapter.addWithUUID(new CDI()));
+ _ia = IAPrx.uncheckedCast(adapter.addWithUUID(new IAI()));
+ _ib1 = IB1Prx.uncheckedCast(adapter.addWithUUID(new IB1I()));
+ _ib2 = IB2Prx.uncheckedCast(adapter.addWithUUID(new IB2I()));
+ _ic = ICPrx.uncheckedCast(adapter.addWithUUID(new ICI()));
}
@Override
- public CAPrx
- caop(Ice.Current current)
+ public CAPrx caop(com.zeroc.Ice.Current current)
{
return _ca;
}
@Override
- public CBPrx
- cbop(Ice.Current current)
+ public CBPrx cbop(com.zeroc.Ice.Current current)
{
return _cb;
}
@Override
- public CCPrx
- ccop(Ice.Current current)
+ public CCPrx ccop(com.zeroc.Ice.Current current)
{
return _cc;
}
@Override
- public CDPrx
- cdop(Ice.Current current)
+ public CDPrx cdop(com.zeroc.Ice.Current current)
{
return _cd;
}
@Override
- public IAPrx
- iaop(Ice.Current current)
+ public IAPrx iaop(com.zeroc.Ice.Current current)
{
return _ia;
}
@Override
- public IB1Prx
- ib1op(Ice.Current current)
+ public IB1Prx ib1op(com.zeroc.Ice.Current current)
{
return _ib1;
}
@Override
- public IB2Prx
- ib2op(Ice.Current current)
+ public IB2Prx ib2op(com.zeroc.Ice.Current current)
{
return _ib2;
}
@Override
- public ICPrx
- icop(Ice.Current current)
+ public ICPrx icop(com.zeroc.Ice.Current current)
{
return _ic;
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
diff --git a/java/test/src/main/java/test/Ice/inheritance/Server.java b/java/test/src/main/java/test/Ice/inheritance/Server.java
index a826ae1ec2f..65ebc89e913 100644
--- a/java/test/src/main/java/test/Ice/inheritance/Server.java
+++ b/java/test/src/main/java/test/Ice/inheritance/Server.java
@@ -14,22 +14,21 @@ public class Server extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Object object = new InitialI(adapter);
- adapter.add(object, Ice.Util.stringToIdentity("initial"));
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.Object object = new InitialI(adapter);
+ adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("initial"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.inheritance");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.inheritance");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/interceptor/Client.java b/java/test/src/main/java/test/Ice/interceptor/Client.java
index 1173b5f8f47..f2492fa2757 100644
--- a/java/test/src/main/java/test/Ice/interceptor/Client.java
+++ b/java/test/src/main/java/test/Ice/interceptor/Client.java
@@ -13,12 +13,10 @@ import java.io.PrintWriter;
import test.Ice.interceptor.Test.InvalidInputException;
import test.Ice.interceptor.Test.MyObjectPrx;
-import test.Ice.interceptor.Test.MyObjectPrxHelper;
public class Client extends test.Util.Application
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -26,32 +24,31 @@ public class Client extends test.Util.Application
}
}
- private int
- run(MyObjectPrx prx, InterceptorI interceptor)
+ private int run(MyObjectPrx prx, InterceptorI interceptor)
{
PrintWriter out = getWriter();
out.print("testing simple interceptor... ");
out.flush();
test(interceptor.getLastOperation() == null);
- test(interceptor.getLastStatus() == null);
+ test(!interceptor.getLastStatus());
prx.ice_ping();
test(interceptor.getLastOperation().equals("ice_ping"));
- test(interceptor.getLastStatus() == Ice.DispatchStatus.DispatchOK);
+ test(!interceptor.getLastStatus());
String typeId = prx.ice_id();
test(interceptor.getLastOperation().equals("ice_id"));
- test(interceptor.getLastStatus() == Ice.DispatchStatus.DispatchOK);
+ test(!interceptor.getLastStatus());
test(prx.ice_isA(typeId));
test(interceptor.getLastOperation().equals("ice_isA"));
- test(interceptor.getLastStatus() == Ice.DispatchStatus.DispatchOK);
+ test(!interceptor.getLastStatus());
test(prx.add(33, 12) == 45);
test(interceptor.getLastOperation().equals("add"));
- test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchOK));
+ test(!interceptor.getLastStatus());
out.println("ok");
out.print("testing retry... ");
out.flush();
test(prx.addWithRetry(33, 12) == 45);
test(interceptor.getLastOperation().equals("addWithRetry"));
- test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchOK));
+ test(!interceptor.getLastStatus());
out.println("ok");
out.print("testing user exception... ");
out.flush();
@@ -65,7 +62,7 @@ public class Client extends test.Util.Application
// expected
}
test(interceptor.getLastOperation().equals("badAdd"));
- test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchUserException));
+ test(!interceptor.getLastStatus());
out.println("ok");
out.print("testing ONE... ");
out.flush();
@@ -75,12 +72,12 @@ public class Client extends test.Util.Application
prx.notExistAdd(33, 12);
test(false);
}
- catch(Ice.ObjectNotExistException e)
+ catch(com.zeroc.Ice.ObjectNotExistException e)
{
// expected
}
test(interceptor.getLastOperation().equals("notExistAdd"));
- test(interceptor.getLastStatus() == null);
+ test(!interceptor.getLastStatus());
out.println("ok");
out.print("testing system exception... ");
out.flush();
@@ -90,7 +87,7 @@ public class Client extends test.Util.Application
prx.badSystemAdd(33, 12);
test(false);
}
- catch(Ice.UnknownException e)
+ catch(com.zeroc.Ice.UnknownException e)
{
test(!prx.ice_isCollocationOptimized());
}
@@ -103,37 +100,27 @@ public class Client extends test.Util.Application
test(false);
}
test(interceptor.getLastOperation().equals("badSystemAdd"));
- test(interceptor.getLastStatus() == null);
- out.println("ok");
-
- out.print("testing simple AMD... ");
- out.flush();
- test(prx.amdAdd(33, 12) == 45);
- test(interceptor.getLastOperation().equals("amdAdd"));
- test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchAsync));
+ test(!interceptor.getLastStatus());
out.println("ok");
return 0;
}
-
- private int
- runAmd(MyObjectPrx prx, AMDInterceptorI interceptor, PrintWriter out)
+
+ private int runAmd(MyObjectPrx prx, InterceptorI interceptor, PrintWriter out)
{
out.print("testing simple interceptor... ");
out.flush();
test(interceptor.getLastOperation() == null);
- test(interceptor.getLastStatus() == null);
+ test(!interceptor.getLastStatus());
test(prx.amdAdd(33, 12) == 45);
test(interceptor.getLastOperation().equals("amdAdd"));
- test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchAsync));
- test(interceptor.getActualStatus().equals(Ice.DispatchStatus.DispatchOK));
+ test(interceptor.getLastStatus());
out.println("ok");
out.print("testing retry... ");
out.flush();
test(prx.amdAddWithRetry(33, 12) == 45);
test(interceptor.getLastOperation().equals("amdAddWithRetry"));
- test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchAsync));
- test(interceptor.getActualStatus().equals(Ice.DispatchStatus.DispatchOK));
+ test(interceptor.getLastStatus());
out.println("ok");
out.print("testing user exception... ");
out.flush();
@@ -147,8 +134,7 @@ public class Client extends test.Util.Application
// expected
}
test(interceptor.getLastOperation().equals("amdBadAdd"));
- test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchAsync));
- test(interceptor.getActualStatus().equals(Ice.DispatchStatus.DispatchUserException));
+ test(interceptor.getLastStatus());
out.println("ok");
out.print("testing ONE... ");
out.flush();
@@ -158,14 +144,12 @@ public class Client extends test.Util.Application
prx.amdNotExistAdd(33, 12);
test(false);
}
- catch(Ice.ObjectNotExistException e)
+ catch(com.zeroc.Ice.ObjectNotExistException e)
{
// expected
}
test(interceptor.getLastOperation().equals("amdNotExistAdd"));
- test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchAsync));
- test(interceptor.getActualStatus() == null);
- test(interceptor.getException() instanceof Ice.ObjectNotExistException);
+ test(interceptor.getLastStatus());
out.println("ok");
out.print("testing system exception... ");
out.flush();
@@ -175,7 +159,7 @@ public class Client extends test.Util.Application
prx.amdBadSystemAdd(33, 12);
test(false);
}
- catch(Ice.UnknownException e)
+ catch(com.zeroc.Ice.UnknownException e)
{
test(!prx.ice_isCollocationOptimized());
}
@@ -188,31 +172,26 @@ public class Client extends test.Util.Application
test(false);
}
test(interceptor.getLastOperation().equals("amdBadSystemAdd"));
- test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchAsync));
- test(interceptor.getActualStatus() == null);
- test(interceptor.getException() instanceof MySystemException);
+ test(interceptor.getLastStatus());
out.println("ok");
return 0;
}
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
//
- // Create OA and servants
+ // Create OA and servants
//
communicator().getProperties().setProperty("MyOA.AdapterId", "myOA");
- Ice.ObjectAdapter oa = communicator().createObjectAdapterWithEndpoints("MyOA2", "tcp -h localhost");
+ com.zeroc.Ice.ObjectAdapter oa = communicator().createObjectAdapterWithEndpoints("MyOA2", "tcp -h localhost");
- Ice.Object servant = new MyObjectI();
+ com.zeroc.Ice.Object servant = new MyObjectI();
InterceptorI interceptor = new InterceptorI(servant);
- AMDInterceptorI amdInterceptor = new AMDInterceptorI(servant);
-
- MyObjectPrx prx = MyObjectPrxHelper.uncheckedCast(oa.addWithUUID(interceptor));
- MyObjectPrx prxForAMD = MyObjectPrxHelper.uncheckedCast(oa.addWithUUID(amdInterceptor));
-
+
+ MyObjectPrx prx = MyObjectPrx.uncheckedCast(oa.addWithUUID(interceptor));
+
PrintWriter out = getWriter();
out.println("Collocation optimization on");
int rs = run(prx, interceptor);
@@ -222,7 +201,8 @@ public class Client extends test.Util.Application
}
out.println("Now with AMD");
- rs = runAmd(prxForAMD, amdInterceptor, out);
+ interceptor.clear();
+ rs = runAmd(prx, interceptor, out);
if(rs != 0)
{
return rs;
@@ -232,29 +212,26 @@ public class Client extends test.Util.Application
out.println("Collocation optimization off");
interceptor.clear();
- prx = MyObjectPrxHelper.uncheckedCast(prx.ice_collocationOptimized(false));
+ prx = MyObjectPrx.uncheckedCast(prx.ice_collocationOptimized(false));
rs = run(prx, interceptor);
if(rs != 0)
{
return rs;
}
-
+
out.println("Now with AMD");
- amdInterceptor.clear();
- prxForAMD = MyObjectPrxHelper.uncheckedCast(prxForAMD.ice_collocationOptimized(false));
- rs = runAmd(prxForAMD, amdInterceptor, out);
+ interceptor.clear();
+ rs = runAmd(prx, interceptor, out);
return rs;
}
-
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.interceptor");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.interceptor");
+ return r;
}
public static void main(String[] args)
@@ -265,6 +242,3 @@ public class Client extends test.Util.Application
System.exit(status);
}
}
-
-
-
diff --git a/java/test/src/main/java/test/Ice/interceptor/InterceptorI.java b/java/test/src/main/java/test/Ice/interceptor/InterceptorI.java
index 9eb3e69f324..eeb1ddf6504 100644
--- a/java/test/src/main/java/test/Ice/interceptor/InterceptorI.java
+++ b/java/test/src/main/java/test/Ice/interceptor/InterceptorI.java
@@ -9,17 +9,20 @@
package test.Ice.interceptor;
+import java.util.concurrent.CompletionStage;
+
+import com.zeroc.Ice.OutputStream;
+
import test.Ice.interceptor.Test.RetryException;
-class InterceptorI extends Ice.DispatchInterceptor
+class InterceptorI extends com.zeroc.Ice.DispatchInterceptor
{
- InterceptorI(Ice.Object servant)
+ InterceptorI(com.zeroc.Ice.Object servant)
{
_servant = servant;
}
- protected static void
- test(boolean b)
+ protected static void test(boolean b)
{
if(!b)
{
@@ -27,15 +30,14 @@ class InterceptorI extends Ice.DispatchInterceptor
}
}
-
@Override
- public Ice.DispatchStatus
- dispatch(Ice.Request request)
+ public CompletionStage<OutputStream> dispatch(com.zeroc.Ice.Request request)
+ throws com.zeroc.Ice.UserException
{
- Ice.Current current = request.getCurrent();
+ com.zeroc.Ice.Current current = request.getCurrent();
_lastOperation = current.operation;
- if(_lastOperation.equals("addWithRetry"))
+ if(_lastOperation.equals("addWithRetry") || _lastOperation.equals("amdAddWithRetry"))
{
for(int i = 0; i < 10; ++i)
{
@@ -51,34 +53,32 @@ class InterceptorI extends Ice.DispatchInterceptor
//
}
}
-
+
current.ctx.put("retry", "no");
}
-
- _lastStatus = _servant.ice_dispatch(request);
- return _lastStatus;
+
+ CompletionStage<OutputStream> f = _servant.ice_dispatch(request);
+ _lastStatus = f != null;
+ return f;
}
- Ice.DispatchStatus
- getLastStatus()
+ boolean getLastStatus()
{
return _lastStatus;
}
- String
- getLastOperation()
+ String getLastOperation()
{
return _lastOperation;
}
- void
- clear()
+ void clear()
{
_lastOperation = null;
- _lastStatus = null;
+ _lastStatus = false;
}
- protected final Ice.Object _servant;
+ protected final com.zeroc.Ice.Object _servant;
protected String _lastOperation;
- protected Ice.DispatchStatus _lastStatus;
+ protected boolean _lastStatus;
}
diff --git a/java/test/src/main/java/test/Ice/interceptor/MyObjectI.java b/java/test/src/main/java/test/Ice/interceptor/MyObjectI.java
index c3427f98686..a94505b53f6 100644
--- a/java/test/src/main/java/test/Ice/interceptor/MyObjectI.java
+++ b/java/test/src/main/java/test/Ice/interceptor/MyObjectI.java
@@ -9,98 +9,92 @@
package test.Ice.interceptor;
-import test.Ice.interceptor.Test.AMD_MyObject_amdAdd;
-import test.Ice.interceptor.Test.AMD_MyObject_amdAddWithRetry;
-import test.Ice.interceptor.Test.AMD_MyObject_amdBadAdd;
-import test.Ice.interceptor.Test.AMD_MyObject_amdBadSystemAdd;
-import test.Ice.interceptor.Test.AMD_MyObject_amdNotExistAdd;
+import java.util.concurrent.CompletionStage;
+import java.util.concurrent.CompletableFuture;
+
import test.Ice.interceptor.Test.InvalidInputException;
import test.Ice.interceptor.Test.RetryException;
-import test.Ice.interceptor.Test._MyObjectDisp;
+import test.Ice.interceptor.Test.MyObject;
-class MyObjectI extends _MyObjectDisp
+class MyObjectI implements MyObject
{
-
@Override
- public int
- add(int x, int y, Ice.Current current)
+ public int add(int x, int y, com.zeroc.Ice.Current current)
{
return x + y;
- }
-
+ }
+
@Override
- public int
- addWithRetry(int x, int y, Ice.Current current)
+ public int addWithRetry(int x, int y, com.zeroc.Ice.Current current)
{
String val = current.ctx.get("retry");
-
+
if(val == null || !val.equals("no"))
{
throw new RetryException();
}
return x + y;
- }
+ }
@Override
- public int
- badAdd(int x, int y, Ice.Current current) throws InvalidInputException
+ public int badAdd(int x, int y, com.zeroc.Ice.Current current)
+ throws InvalidInputException
{
throw new InvalidInputException();
- }
+ }
@Override
- public int
- notExistAdd(int x, int y, Ice.Current current)
+ public int notExistAdd(int x, int y, com.zeroc.Ice.Current current)
{
- throw new Ice.ObjectNotExistException();
- }
-
+ throw new com.zeroc.Ice.ObjectNotExistException();
+ }
+
@Override
- public int
- badSystemAdd(int x, int y, Ice.Current current)
+ public int badSystemAdd(int x, int y, com.zeroc.Ice.Current current)
{
throw new MySystemException();
- }
-
+ }
//
// AMD
//
@Override
- public void
- amdAdd_async(final AMD_MyObject_amdAdd cb, final int x, final int y, Ice.Current current)
+ public CompletionStage<Integer> amdAddAsync(final int x, final int y, com.zeroc.Ice.Current current)
{
- Thread thread = new Thread()
+ CompletableFuture<Integer> r = new CompletableFuture<>();
+ Thread thread = new Thread(() ->
{
- @Override
- public void
- run()
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(InterruptedException e)
{
- try
- {
- Thread.sleep(10);
- }
- catch(InterruptedException e)
- {
- }
- cb.ice_response(x + y);
}
- };
-
+ r.complete(x + y);
+ });
+
thread.setDaemon(true);
thread.start();
+ return r;
}
+ /*
+ //
+ // NOTE: we can't use "async" dispatch here because otherwise the exception wouldn't be caught
+ // synchronously by the dispatch interceptor. It would be wrapped into the future as if the
+ // exception was raised asynchronously.
+ //
@Override
- public void
- amdAddWithRetry_async(final AMD_MyObject_amdAddWithRetry cb, final int x, final int y, Ice.Current current)
+ public CompletionStage<Integer> amdAddWithRetryAsync(final int x, final int y, com.zeroc.Ice.Current current)
{
- Thread thread = new Thread()
- {
- @Override
- public void
- run()
+ String val = current.ctx.get("retry");
+
+ if(val != null && val.equals("no"))
+ {
+ CompletableFuture<Integer> r = new CompletableFuture<>();
+ Thread thread = new Thread(() ->
{
try
{
@@ -109,93 +103,98 @@ class MyObjectI extends _MyObjectDisp
catch(InterruptedException e)
{
}
- cb.ice_response(x + y);
- }
- };
-
- thread.setDaemon(true);
- thread.start();
-
+ r.complete(x + y);
+ };
+ thread.setDaemon(true);
+ thread.start();
+ return r;
+ }
+ else
+ {
+ throw new RetryException();
+ }
+ }
+ */
+
+ @Override
+ public CompletionStage<Integer> amdAddWithRetryAsync(final int x, final int y, com.zeroc.Ice.Current current)
+ {
String val = current.ctx.get("retry");
-
- if(val == null || !val.equals("no"))
+
+ if(val != null && val.equals("no"))
+ {
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(InterruptedException e)
+ {
+ }
+ return CompletableFuture.completedFuture(x + y);
+ }
+ else
{
throw new RetryException();
}
- }
-
+ }
+
@Override
- public void
- amdBadAdd_async(final AMD_MyObject_amdBadAdd cb, int x, int y, Ice.Current current)
+ public CompletionStage<Integer> amdBadAddAsync(int x, int y, com.zeroc.Ice.Current current)
{
- Thread thread = new Thread()
+ CompletableFuture<Integer> r = new CompletableFuture<>();
+ Thread thread = new Thread(() ->
{
- @Override
- public void
- run()
+ try
{
- try
- {
- Thread.sleep(10);
- }
- catch(InterruptedException e)
- {
- }
- cb.ice_exception(new InvalidInputException());
+ Thread.sleep(10);
}
- };
-
+ catch(InterruptedException e)
+ {
+ }
+ r.completeExceptionally(new InvalidInputException());
+ });
thread.setDaemon(true);
thread.start();
- }
+ return r;
+ }
@Override
- public void
- amdNotExistAdd_async(final AMD_MyObject_amdNotExistAdd cb, int x, int y, Ice.Current current)
+ public CompletionStage<Integer> amdNotExistAddAsync(int x, int y, com.zeroc.Ice.Current current)
{
- Thread thread = new Thread()
+ CompletableFuture<Integer> r = new CompletableFuture<>();
+ Thread thread = new Thread(() ->
{
- @Override
- public void
- run()
+ try
{
- try
- {
- Thread.sleep(10);
- }
- catch(InterruptedException e)
- {
- }
- cb.ice_exception(new Ice.ObjectNotExistException());
+ Thread.sleep(10);
}
- };
-
+ catch(InterruptedException e)
+ {
+ }
+ r.completeExceptionally(new com.zeroc.Ice.ObjectNotExistException());
+ });
thread.setDaemon(true);
thread.start();
- }
-
+ return r;
+ }
+
@Override
- public void
- amdBadSystemAdd_async(final AMD_MyObject_amdBadSystemAdd cb, int x, int y, Ice.Current current)
+ public CompletionStage<Integer> amdBadSystemAddAsync(int x, int y, com.zeroc.Ice.Current current)
{
- Thread thread = new Thread()
+ CompletableFuture<Integer> r = new CompletableFuture<>();
+ Thread thread = new Thread(() ->
{
- @Override
- public void
- run()
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch(InterruptedException e)
{
- try
- {
- Thread.sleep(10);
- }
- catch(InterruptedException e)
- {
- }
- cb.ice_exception(new MySystemException());
}
- };
-
+ r.completeExceptionally(new MySystemException());
+ });
thread.setDaemon(true);
thread.start();
- }
+ return r;
+ }
}
diff --git a/java/test/src/main/java/test/Ice/interceptor/MySystemException.java b/java/test/src/main/java/test/Ice/interceptor/MySystemException.java
index 9b91678ad97..04cffec3e64 100644
--- a/java/test/src/main/java/test/Ice/interceptor/MySystemException.java
+++ b/java/test/src/main/java/test/Ice/interceptor/MySystemException.java
@@ -9,16 +9,14 @@
package test.Ice.interceptor;
-
-public class MySystemException extends Ice.SystemException
+public class MySystemException extends com.zeroc.Ice.SystemException
{
public MySystemException()
{
}
@Override
- public String
- ice_id()
+ public String ice_id()
{
return "::MySystemException";
}
diff --git a/java/test/src/main/java/test/Ice/interrupt/AllTests.java b/java/test/src/main/java/test/Ice/interrupt/AllTests.java
index 0644cf92fef..44a58339065 100644
--- a/java/test/src/main/java/test/Ice/interrupt/AllTests.java
+++ b/java/test/src/main/java/test/Ice/interrupt/AllTests.java
@@ -11,29 +11,26 @@ package test.Ice.interrupt;
import java.io.PrintWriter;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
-import test.Ice.interrupt.Test.Callback_TestIntf_op;
-import test.Ice.interrupt.Test.Callback_TestIntf_sleep;
+import com.zeroc.Ice.Connection;
+import com.zeroc.Ice.LocalException;
+import com.zeroc.Ice.Util;
+import com.zeroc.Ice.InvocationFuture;
+
import test.Ice.interrupt.Test.CannotInterruptException;
import test.Ice.interrupt.Test.TestIntfControllerPrx;
-import test.Ice.interrupt.Test.TestIntfControllerPrxHelper;
import test.Ice.interrupt.Test.TestIntfPrx;
-import test.Ice.interrupt.Test.TestIntfPrxHelper;
-import Ice.AsyncResult;
-import Ice.Callback_Communicator_flushBatchRequests;
-import Ice.Callback_Connection_flushBatchRequests;
-import Ice.Callback_Object_ice_flushBatchRequests;
-import Ice.Callback_Object_ice_getConnection;
-import Ice.Connection;
-import Ice.LocalException;
public class AllTests
{
- private static class CallbackBase
+ private static class Callback
{
- CallbackBase()
+ Callback()
{
}
@@ -62,16 +59,16 @@ public class AllTests
private boolean _called = false;
}
-
- private static void
- test(boolean b)
+
+ private static void test(boolean b)
{
if(!b)
{
+ new Throwable().printStackTrace();
throw new RuntimeException();
}
}
-
+
private static void failIfNotInterrupted()
{
if(Thread.currentThread().isInterrupted())
@@ -84,23 +81,22 @@ public class AllTests
}
}
- public static void
- allTests(test.Util.Application app)
+ public static void allTests(test.Util.Application app)
throws InterruptedException
{
- Ice.Communicator communicator = app.communicator();
+ com.zeroc.Ice.Communicator communicator = app.communicator();
PrintWriter out = app.getWriter();
String sref = "test:default -p 12010";
- Ice.ObjectPrx obj = communicator.stringToProxy(sref);
+ com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(sref);
test(obj != null);
- final TestIntfPrx p = TestIntfPrxHelper.uncheckedCast(obj);
+ final TestIntfPrx p = TestIntfPrx.uncheckedCast(obj);
sref = "testController:tcp -p 12011";
obj = communicator.stringToProxy(sref);
test(obj != null);
- TestIntfControllerPrx testController = TestIntfControllerPrxHelper.uncheckedCast(obj);
+ TestIntfControllerPrx testController = TestIntfControllerPrx.uncheckedCast(obj);
out.print("testing client interrupt... ");
out.flush();
@@ -115,7 +111,7 @@ public class AllTests
p.op();
test(false);
}
- catch(Ice.OperationInterruptedException ex)
+ catch(com.zeroc.Ice.OperationInterruptedException ex)
{
// Expected
test(!mainThread.isInterrupted());
@@ -124,55 +120,36 @@ public class AllTests
// Same test with the AMI API.
try
{
- Ice.AsyncResult r = p.begin_op();
+ //
+ // We call sleep here to add a small delay. Otherwise there's a chance that the
+ // future will be completed before get() is called, in which case the interrupt
+ // will be ignored.
+ //
+ CompletableFuture<Void> r = p.sleepAsync(250);
mainThread.interrupt();
- p.end_op(r);
+ r.get();
test(false);
}
- catch(Ice.OperationInterruptedException ex)
+ catch(java.lang.InterruptedException ex)
{
// Expected
test(!mainThread.isInterrupted());
}
+ catch(java.util.concurrent.ExecutionException ex)
+ {
+ test(false);
+ }
- final CallbackBase cb = new CallbackBase();
+ final Callback cb = new Callback();
mainThread.interrupt();
- p.begin_op(new Callback_TestIntf_op()
- {
- @Override
- public void response()
+ p.opAsync().whenComplete((result, ex) ->
{
+ test(ex == null);
cb.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
- });
+ });
test(Thread.interrupted());
cb.check();
- p.begin_op(new Ice.Callback()
- {
- @Override
- public void completed(AsyncResult r)
- {
- try
- {
- Thread.currentThread().interrupt();
- p.end_op(r);
- test(false);
- }
- catch(Ice.OperationInterruptedException ex)
- {
- // Expected
- test(!Thread.currentThread().isInterrupted());
- }
- }
- });
-
ExecutorService executor = java.util.concurrent.Executors.newFixedThreadPool(1);
executor.submit(new Runnable() {
@Override
@@ -196,7 +173,7 @@ public class AllTests
p.sleep(2000);
test(false);
}
- catch(Ice.OperationInterruptedException ex)
+ catch(com.zeroc.Ice.OperationInterruptedException ex)
{
// Expected
}
@@ -224,17 +201,16 @@ public class AllTests
try
{
test(!mainThread.isInterrupted());
- Ice.AsyncResult r = p.begin_sleep(2000);
- p.end_sleep(r);
+ p.sleepAsync(2000).get();
test(false);
}
- catch(Ice.OperationInterruptedException ex)
+ catch(ExecutionException ex)
{
- // Expected
+ test(false);
}
- catch(test.Ice.interrupt.Test.InterruptedException e)
+ catch(java.lang.InterruptedException ex)
{
- test(false);
+ // Expected
}
executor.submit(new Runnable() {
@@ -259,34 +235,11 @@ public class AllTests
p.opIdempotent();
test(false);
}
- catch(Ice.OperationInterruptedException ex)
+ catch(com.zeroc.Ice.OperationInterruptedException ex)
{
// Expected
}
- catch(Ice.ConnectionLostException ex)
- {
- test(false);
- }
-
- // Test waitForCompleted is an interruption point.
- try
- {
- Ice.AsyncResult r = p.begin_op();
- try
- {
- Thread.currentThread().interrupt();
- r.waitForCompleted();
- test(false);
- }
- catch(Ice.OperationInterruptedException ex)
- {
- // Expected
- }
-
- // end_ should still work.
- p.end_op(r);
- }
- catch(Ice.OperationInterruptedException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
test(false);
}
@@ -294,22 +247,23 @@ public class AllTests
// Test waitForSent is an interruption point.
try
{
- Ice.AsyncResult r = p.begin_op();
+ CompletableFuture<Void> r = p.opAsync();
try
{
Thread.currentThread().interrupt();
- r.waitForSent();
+ InvocationFuture<Void> f = Util.getInvocationFuture(r);
+ f.waitForSent();
test(false);
}
- catch(Ice.OperationInterruptedException ex)
+ catch(com.zeroc.Ice.OperationInterruptedException ex)
{
// Expected
}
-
- // end_ should still work.
- p.end_op(r);
+
+ // join should still work.
+ r.join();
}
- catch(Ice.OperationInterruptedException ex)
+ catch(CompletionException ex)
{
test(false);
}
@@ -338,18 +292,20 @@ public class AllTests
});
testController.holdAdapter();
- Ice.AsyncResult r = null;
+ CompletableFuture<Void> r = null;
+ InvocationFuture<Void> f = null;
// The sequence needs to be large enough to fill the write/recv buffers
int bufSize = 2000000;
byte[] seq = new byte[bufSize];
- r = p.begin_opWithPayload(seq);
+ r = p.opWithPayloadAsync(seq);
try
{
- r.waitForSent();
+ f = Util.getInvocationFuture(r);
+ f.waitForSent();
test(false);
}
- catch(Ice.OperationInterruptedException ex)
+ catch(com.zeroc.Ice.OperationInterruptedException ex)
{
// Expected
}
@@ -357,11 +313,11 @@ public class AllTests
// Resume the adapter.
//
testController.resumeAdapter();
- r.waitForSent();
- r.waitForCompleted();
- p.end_opWithPayload(r);
+ f.waitForSent();
+ f.waitForCompleted();
+ r.join();
}
-
+
//
// The executor is all done.
//
@@ -372,46 +328,45 @@ public class AllTests
}
}
out.println("ok");
-
- if(p.ice_getCachedConnection() != null)
+
+ if(p.ice_getConnection() != null)
{
out.print("testing getConnection interrupt... ");
out.flush();
{
final Thread mainThread = Thread.currentThread();
-
+
p.ice_getConnection().close(false);
-
- AsyncResult r = p.begin_ice_getConnection();
+
+ CompletableFuture<com.zeroc.Ice.Connection> r = p.ice_getConnectionAsync();
mainThread.interrupt();
try
{
- p.end_ice_getConnection(r);
+ r.get();
+ //
+ // get() won't raise InterruptedException if connection establishment has already completed.
+ //
+ //test(false);
+ mainThread.interrupted();
+ }
+ catch(ExecutionException ex)
+ {
test(false);
}
- catch(Ice.OperationInterruptedException ex)
+ catch(java.lang.InterruptedException ex)
{
// Expected
}
-
+
p.ice_getConnection().close(false);
-
- final CallbackBase cb = new CallbackBase();
+
+ final Callback cb = new Callback();
mainThread.interrupt();
- p.begin_ice_getConnection(new Callback_Object_ice_getConnection()
- {
- @Override
- public void exception(LocalException ex)
- {
- test(false);
- }
-
- @Override
- public void response(Connection con)
+ p.ice_getConnectionAsync().whenComplete((result, ex) ->
{
+ test(ex == null);
cb.called();
- }
- });
+ });
test(Thread.interrupted());
cb.check();
}
@@ -421,143 +376,149 @@ public class AllTests
out.print("testing batch proxy flush interrupt... ");
out.flush();
{
- final TestIntfPrx p2 = TestIntfPrxHelper.uncheckedCast(p.ice_batchOneway());
+ final TestIntfPrx p2 = p.ice_batchOneway();
final Thread mainThread = Thread.currentThread();
+ CompletableFuture<Void> r;
p2.op();
p2.op();
p2.op();
-
- AsyncResult r = p2.begin_ice_flushBatchRequests();
+
+ r = p2.ice_flushBatchRequestsAsync();
mainThread.interrupt();
try
{
- p2.end_ice_flushBatchRequests(r);
+ r.get();
+ //
+ // get() won't raise InterruptedException if the operation has already completed.
+ //
+ //test(false);
+ mainThread.interrupted();
+ }
+ catch(ExecutionException ex)
+ {
test(false);
}
- catch(Ice.OperationInterruptedException ex)
+ catch(java.lang.InterruptedException ex)
{
// Expected
}
-
+
+ p2.op();
p2.op();
p2.op();
- p2.op();
- final CallbackBase cb = new CallbackBase();
+ final Callback cb = new Callback();
mainThread.interrupt();
- p2.begin_ice_flushBatchRequests(new Callback_Object_ice_flushBatchRequests()
- {
- @Override
- public void sent(boolean sentSynchronously)
+ r = p2.ice_flushBatchRequestsAsync();
+ r.whenComplete((result, ex) -> test(ex == null));
+ Util.getInvocationFuture(r).whenSent((sentSynchronously, ex) ->
{
+ test(ex == null);
cb.called();
- }
-
- @Override
- public void exception(LocalException ex)
- {
- test(false);
- }
- });
+ });
test(Thread.interrupted());
- cb.check();
+ cb.check();
}
out.println("ok");
- if(p.ice_getCachedConnection() != null)
+ if(p.ice_getConnection() != null)
{
out.print("testing batch connection flush interrupt... ");
out.flush();
{
- final TestIntfPrx p2 = TestIntfPrxHelper.uncheckedCast(p.ice_batchOneway());
+ final TestIntfPrx p2 = p.ice_batchOneway();
final Thread mainThread = Thread.currentThread();
-
+ CompletableFuture<Void> r;
+
p2.op();
p2.op();
p2.op();
-
- AsyncResult r = p2.ice_getConnection().begin_flushBatchRequests();
+
+ r = p2.ice_getConnection().flushBatchRequestsAsync();
mainThread.interrupt();
try
{
- p2.ice_getCachedConnection().end_flushBatchRequests(r);
+ r.get();
+ //
+ // get() won't raise InterruptedException if the operation has already completed.
+ //
+ //test(false);
+ mainThread.interrupted();
+ }
+ catch(ExecutionException ex)
+ {
test(false);
}
- catch(Ice.OperationInterruptedException ex)
+ catch(java.lang.InterruptedException ex)
{
// Expected
}
-
+
+ p2.op();
p2.op();
p2.op();
- p2.op();
-
- final CallbackBase cb = new CallbackBase();
- Ice.Connection con = p2.ice_getConnection();
+
+ final Callback cb = new Callback();
+ com.zeroc.Ice.Connection con = p2.ice_getConnection();
mainThread.interrupt();
- con.begin_flushBatchRequests(new Callback_Connection_flushBatchRequests()
- {
- @Override
- public void sent(boolean sentSynchronously)
+ r = con.flushBatchRequestsAsync();
+ r.whenComplete((result, ex) -> test(ex == null));
+ Util.getInvocationFuture(r).whenSent((sentSynchronously, ex) ->
{
+ test(ex == null);
cb.called();
- }
-
- @Override
- public void exception(LocalException ex)
- {
- test(false);
- }
- });
+ });
test(Thread.interrupted());
cb.check();
}
out.println("ok");
}
-
+
out.print("testing batch communicator flush interrupt... ");
out.flush();
{
- final TestIntfPrx p2 = TestIntfPrxHelper.uncheckedCast(p.ice_batchOneway());
+ final TestIntfPrx p2 = p.ice_batchOneway();
final Thread mainThread = Thread.currentThread();
+ CompletableFuture<Void> r;
p2.op();
p2.op();
p2.op();
-
- AsyncResult r = communicator.begin_flushBatchRequests();
+
+ r = communicator.flushBatchRequestsAsync();
mainThread.interrupt();
try
{
- communicator.end_flushBatchRequests(r);
+ r.get();
+ //
+ // get() won't raise InterruptedException if the operation has already completed.
+ //
+ //test(false);
+ mainThread.interrupted();
+ }
+ catch(ExecutionException ex)
+ {
test(false);
}
- catch(Ice.OperationInterruptedException ex)
+ catch(java.lang.InterruptedException ex)
{
// Expected
}
-
+
+ p2.op();
p2.op();
p2.op();
- p2.op();
-
- final CallbackBase cb = new CallbackBase();
+
+ final Callback cb = new Callback();
mainThread.interrupt();
- communicator.begin_flushBatchRequests(new Callback_Communicator_flushBatchRequests()
- {
- @Override
- public void sent(boolean sentSynchronously)
+ r = communicator.flushBatchRequestsAsync();
+ r.whenComplete((result, ex) -> test(ex == null));
+ Util.getInvocationFuture(r).whenSent((sentSynchronously, ex) ->
{
+ test(ex == null);
cb.called();
- }
-
- @Override
- public void exception(LocalException ex)
- {
- test(false);
- }
- });
+ });
test(Thread.interrupted());
cb.check();
}
@@ -570,37 +531,55 @@ public class AllTests
//
// Check that CommunicatorDestroyedException is raised directly.
//
- Ice.InitializationData initData = app.createInitializationData();
+ com.zeroc.Ice.InitializationData initData = app.createInitializationData();
initData.properties = communicator.getProperties()._clone();
- Ice.Communicator ic = app.initialize(initData);
-
- Thread.currentThread().interrupt();
+ com.zeroc.Ice.Communicator ic = app.initialize(initData);
+
+ Thread.currentThread().interrupt();
try
{
ic.destroy();
failIfNotInterrupted();
}
- catch(Ice.OperationInterruptedException ex)
+ catch(com.zeroc.Ice.OperationInterruptedException ex)
{
// Expected
}
ic.destroy();
ExecutorService executor = java.util.concurrent.Executors.newFixedThreadPool(2);
-
+
ic = app.initialize(initData);
- Ice.ObjectPrx o = ic.stringToProxy(p.toString());
-
+ com.zeroc.Ice.ObjectPrx o = ic.stringToProxy(p.toString());
+
final Thread[] thread = new Thread[1];
- final CallbackBase cb = new CallbackBase();
- final TestIntfPrx p2 = TestIntfPrxHelper.checkedCast(o);
+ final Callback cb = new Callback();
+ final TestIntfPrx p2 = TestIntfPrx.checkedCast(o);
final CountDownLatch waitSignal = new CountDownLatch(1);
- p2.begin_op(new Callback_TestIntf_op()
- {
+ executor.submit(new Runnable() {
@Override
- public void response()
+ public void run()
+ {
+ try
+ {
+ waitSignal.await();
+ }
+ catch(InterruptedException e)
+ {
+ test(false);
+ }
+ thread[0].interrupt();
+ }
+ });
+ //
+ // The whenComplete() action may be executed in the current thread (if the future is
+ // already completed). We have to submit the runnable to the executor *before*
+ // calling whenComplete() because this thread can block in sleep().
+ //
+ p2.opAsync().whenComplete((result, ex) ->
{
+ test(ex == null);
try
{
Thread.sleep(250);
@@ -621,31 +600,8 @@ public class AllTests
// Expected
}
cb.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
-
- }
- });
- executor.submit(new Runnable() {
- @Override
- public void run()
- {
- try
- {
- waitSignal.await();
- }
- catch(InterruptedException e)
- {
- test(false);
- }
- thread[0].interrupt();
- }
- });
-
+ });
+
try
{
waitSignal.await();
@@ -657,7 +613,7 @@ public class AllTests
ic.destroy();
cb.check();
-
+
executor.shutdown();
while(!executor.isTerminated())
{
@@ -669,28 +625,12 @@ public class AllTests
out.print("testing server interrupt... ");
out.flush();
{
- final CallbackBase cb = new CallbackBase();
- p.begin_sleep(2000, new Callback_TestIntf_sleep()
- {
- @Override
- public void response()
- {
- test(false);
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- @Override
- public void exception(Ice.UserException ex)
+ final Callback cb = new Callback();
+ p.sleepAsync(2000).whenComplete((result, ex) ->
{
- test(ex instanceof test.Ice.interrupt.Test.InterruptedException);
+ test(ex != null && ex instanceof test.Ice.interrupt.Test.InterruptedException);
cb.called();
- }
- });
+ });
try
{
Thread.sleep(250);
@@ -716,11 +656,11 @@ public class AllTests
{
final Thread mainThread = Thread.currentThread();
ExecutorService executor = java.util.concurrent.Executors.newFixedThreadPool(1);
- Ice.InitializationData initData = app.createInitializationData();
+ com.zeroc.Ice.InitializationData initData = app.createInitializationData();
initData.properties = communicator.getProperties()._clone();
initData.properties.setProperty("ClientTestAdapter.Endpoints", "default -p 12030");
- Ice.Communicator ic = app.initialize(initData);
- final Ice.ObjectAdapter adapter = ic.createObjectAdapter("ClientTestAdapter");
+ com.zeroc.Ice.Communicator ic = app.initialize(initData);
+ final com.zeroc.Ice.ObjectAdapter adapter = ic.createObjectAdapter("ClientTestAdapter");
adapter.activate();
try
@@ -729,7 +669,7 @@ public class AllTests
adapter.waitForHold();
test(false);
}
- catch(Ice.OperationInterruptedException e)
+ catch(com.zeroc.Ice.OperationInterruptedException e)
{
// Expected.
}
@@ -740,7 +680,7 @@ public class AllTests
adapter.waitForDeactivate();
test(false);
}
- catch(Ice.OperationInterruptedException e)
+ catch(com.zeroc.Ice.OperationInterruptedException e)
{
// Expected.
}
@@ -751,7 +691,7 @@ public class AllTests
ic.waitForShutdown();
test(false);
}
- catch(Ice.OperationInterruptedException e)
+ catch(com.zeroc.Ice.OperationInterruptedException e)
{
// Expected.
}
@@ -769,7 +709,7 @@ public class AllTests
test(false);
}
mainThread.interrupt();
- }
+ }
};
executor.execute(interruptMainThread);
@@ -778,7 +718,7 @@ public class AllTests
adapter.waitForHold();
test(false);
}
- catch(Ice.OperationInterruptedException e)
+ catch(com.zeroc.Ice.OperationInterruptedException e)
{
// Expected.
}
@@ -789,7 +729,7 @@ public class AllTests
adapter.waitForDeactivate();
test(false);
}
- catch(Ice.OperationInterruptedException e)
+ catch(com.zeroc.Ice.OperationInterruptedException e)
{
// Expected.
}
@@ -800,13 +740,13 @@ public class AllTests
ic.waitForShutdown();
test(false);
}
- catch(Ice.OperationInterruptedException e)
+ catch(com.zeroc.Ice.OperationInterruptedException e)
{
// Expected.
}
ic.destroy();
-
+
executor.shutdown();
while(!executor.isTerminated())
{
@@ -814,7 +754,7 @@ public class AllTests
}
}
out.println("ok");
-
+
p.shutdown();
}
}
diff --git a/java/test/src/main/java/test/Ice/interrupt/Client.java b/java/test/src/main/java/test/Ice/interrupt/Client.java
index 371286e2b20..26f30db8f83 100644
--- a/java/test/src/main/java/test/Ice/interrupt/Client.java
+++ b/java/test/src/main/java/test/Ice/interrupt/Client.java
@@ -18,7 +18,7 @@ public class Client extends test.Util.Application
{
AllTests.allTests(this);
}
- catch (InterruptedException e)
+ catch(InterruptedException e)
{
e.printStackTrace();
throw new RuntimeException();
@@ -27,32 +27,31 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.interrupt");
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.interrupt");
//
// We need to enable the ThreadInterruptSafe property so that Ice is
// interrupt safe for this test.
//
- initData.properties.setProperty("Ice.ThreadInterruptSafe", "1");
+ r.initData.properties.setProperty("Ice.ThreadInterruptSafe", "1");
//
// We need to send messages large enough to cause the transport
// buffers to fill up.
//
- initData.properties.setProperty("Ice.MessageSizeMax", "20000");
+ r.initData.properties.setProperty("Ice.MessageSizeMax", "20000");
//
// Retry up to 2 times, sleep 1s for the last retry. This is
// useful to test interrupting the retry sleep
//
- initData.properties.setProperty("Ice.RetryIntervals", "0 1000");
+ r.initData.properties.setProperty("Ice.RetryIntervals", "0 1000");
//
// Limit the send buffer size, this test relies on the socket
// send() blocking after sending a given amount of data.
//
- initData.properties.setProperty("Ice.TCP.SndSize", "50000");
- return initData;
+ r.initData.properties.setProperty("Ice.TCP.SndSize", "50000");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/interrupt/Collocated.java b/java/test/src/main/java/test/Ice/interrupt/Collocated.java
index 61d24074a80..f770c46515c 100644
--- a/java/test/src/main/java/test/Ice/interrupt/Collocated.java
+++ b/java/test/src/main/java/test/Ice/interrupt/Collocated.java
@@ -14,19 +14,19 @@ public class Collocated extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
TestControllerI controller = new TestControllerI(adapter);
- adapter.add(new TestI(controller), Ice.Util.stringToIdentity("test"));
+ adapter.add(new TestI(controller), com.zeroc.Ice.Util.stringToIdentity("test"));
//adapter.activate(); // Don't activate OA to ensure collocation is used.
- adapter2.add(controller, Ice.Util.stringToIdentity("testController"));
+ adapter2.add(controller, com.zeroc.Ice.Util.stringToIdentity("testController"));
//adapter2.activate(); // Don't activate OA to ensure collocation is used.
try
{
AllTests.allTests(this);
}
- catch (InterruptedException e)
+ catch(InterruptedException e)
{
e.printStackTrace();
throw new RuntimeException();
@@ -36,27 +36,31 @@ public class Collocated extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.interrupt");
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.interrupt");
//
// We need to enable the ThreadInterruptSafe property so that Ice is
// interrupt safe for this test.
//
- initData.properties.setProperty("Ice.ThreadInterruptSafe", "1");
+ r.initData.properties.setProperty("Ice.ThreadInterruptSafe", "1");
//
// We need to send messages large enough to cause the transport
// buffers to fill up.
//
- initData.properties.setProperty("Ice.MessageSizeMax", "20000");
-
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
- initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
-
- return initData;
+ r.initData.properties.setProperty("Ice.MessageSizeMax", "20000");
+ //
+ // opIdempotent raises UnknownException, we disable dispatch
+ // warnings to prevent warnings.
+ //
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ r.initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
+ r.initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
+
+ return r;
}
public static void main(String[] args)
@@ -67,5 +71,4 @@ public class Collocated extends test.Util.Application
System.gc();
System.exit(status);
}
-
}
diff --git a/java/test/src/main/java/test/Ice/interrupt/Server.java b/java/test/src/main/java/test/Ice/interrupt/Server.java
index 0ab16417b99..0ed3bbcd2c1 100644
--- a/java/test/src/main/java/test/Ice/interrupt/Server.java
+++ b/java/test/src/main/java/test/Ice/interrupt/Server.java
@@ -12,52 +12,50 @@ package test.Ice.interrupt;
public class Server extends test.Util.Application
{
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
TestControllerI controller = new TestControllerI(adapter);
- adapter.add(new TestI(controller), Ice.Util.stringToIdentity("test"));
+ adapter.add(new TestI(controller), com.zeroc.Ice.Util.stringToIdentity("test"));
adapter.activate();
- adapter2.add(controller, Ice.Util.stringToIdentity("testController"));
+ adapter2.add(controller, com.zeroc.Ice.Util.stringToIdentity("testController"));
adapter2.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.interrupt");
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.interrupt");
//
// We need to enable the ThreadInterruptSafe property so that Ice is
// interrupt safe for this test.
//
- initData.properties.setProperty("Ice.ThreadInterruptSafe", "1");
+ r.initData.properties.setProperty("Ice.ThreadInterruptSafe", "1");
//
// We need to send messages large enough to cause the transport
// buffers to fill up.
//
- initData.properties.setProperty("Ice.MessageSizeMax", "20000");
+ r.initData.properties.setProperty("Ice.MessageSizeMax", "20000");
//
- // opIndempotent raises UnknownException, we disable dispatch
+ // opIdempotent raises UnknownException, we disable dispatch
// warnings to prevent warnings.
//
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
- initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ r.initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
+ r.initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1");
//
// Limit the recv buffer size, this test relies on the socket
// send() blocking after sending a given amount of data.
//
- initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
- return initData;
+ r.initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
+ return r;
}
public static void
diff --git a/java/test/src/main/java/test/Ice/interrupt/TestControllerI.java b/java/test/src/main/java/test/Ice/interrupt/TestControllerI.java
index 8c63779681c..99d3c94b453 100644
--- a/java/test/src/main/java/test/Ice/interrupt/TestControllerI.java
+++ b/java/test/src/main/java/test/Ice/interrupt/TestControllerI.java
@@ -12,16 +12,14 @@ package test.Ice.interrupt;
import java.util.ArrayList;
import java.util.List;
-class TestControllerI extends test.Ice.interrupt.Test._TestIntfControllerDisp
+class TestControllerI implements test.Ice.interrupt.Test.TestIntfController
{
- synchronized void
- addUpcallThread()
+ synchronized void addUpcallThread()
{
_threads.add(Thread.currentThread());
}
- synchronized void
- removeUpcallThread()
+ synchronized void removeUpcallThread()
{
_threads.remove(Thread.currentThread());
//
@@ -31,8 +29,7 @@ class TestControllerI extends test.Ice.interrupt.Test._TestIntfControllerDisp
}
@Override
- synchronized public void
- interrupt(Ice.Current __current)
+ synchronized public void interrupt(com.zeroc.Ice.Current current)
throws test.Ice.interrupt.Test.CannotInterruptException
{
if(_threads.isEmpty())
@@ -46,24 +43,22 @@ class TestControllerI extends test.Ice.interrupt.Test._TestIntfControllerDisp
}
@Override
- public void
- holdAdapter(Ice.Current current)
+ public void holdAdapter(com.zeroc.Ice.Current current)
{
_adapter.hold();
}
@Override
- public void
- resumeAdapter(Ice.Current current)
+ public void resumeAdapter(com.zeroc.Ice.Current current)
{
_adapter.activate();
}
- TestControllerI(Ice.ObjectAdapter adapter)
+ TestControllerI(com.zeroc.Ice.ObjectAdapter adapter)
{
_adapter = adapter;
}
- final private Ice.ObjectAdapter _adapter;
- final private List<Thread> _threads = new ArrayList<Thread>();
+ final private com.zeroc.Ice.ObjectAdapter _adapter;
+ final private List<Thread> _threads = new ArrayList<>();
}
diff --git a/java/test/src/main/java/test/Ice/interrupt/TestI.java b/java/test/src/main/java/test/Ice/interrupt/TestI.java
index 4442e8f4690..e9416899c63 100644
--- a/java/test/src/main/java/test/Ice/interrupt/TestI.java
+++ b/java/test/src/main/java/test/Ice/interrupt/TestI.java
@@ -9,7 +9,7 @@
package test.Ice.interrupt;
-public class TestI extends test.Ice.interrupt.Test._TestIntfDisp
+public class TestI implements test.Ice.interrupt.Test.TestIntf
{
TestI(TestControllerI controller)
{
@@ -17,22 +17,19 @@ public class TestI extends test.Ice.interrupt.Test._TestIntfDisp
}
@Override
- public void
- op(Ice.Current current)
+ public void op(com.zeroc.Ice.Current current)
{
}
@Override
- public void
- opIdempotent(Ice.Current current)
+ public void opIdempotent(com.zeroc.Ice.Current current)
{
- throw new Ice.UnknownException();
+ throw new com.zeroc.Ice.UnknownException();
}
@Override
- public void
- sleep(int to, Ice.Current current)
+ public void sleep(int to, com.zeroc.Ice.Current current)
throws test.Ice.interrupt.Test.InterruptedException
{
_controller.addUpcallThread();
@@ -51,14 +48,12 @@ public class TestI extends test.Ice.interrupt.Test._TestIntfDisp
}
@Override
- public void
- opWithPayload(byte[] seq, Ice.Current current)
+ public void opWithPayload(byte[] seq, com.zeroc.Ice.Current current)
{
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
diff --git a/java/test/src/main/java/test/Ice/invoke/AllTests.java b/java/test/src/main/java/test/Ice/invoke/AllTests.java
index e8815255312..94f35e76193 100644
--- a/java/test/src/main/java/test/Ice/invoke/AllTests.java
+++ b/java/test/src/main/java/test/Ice/invoke/AllTests.java
@@ -8,18 +8,22 @@
// **********************************************************************
package test.Ice.invoke;
+
import java.io.PrintWriter;
+import java.util.concurrent.CompletableFuture;
+
+import com.zeroc.Ice.InputStream;
+import com.zeroc.Ice.OperationMode;
+import com.zeroc.Ice.OutputStream;
import test.Ice.invoke.Test.MyClassPrx;
-import test.Ice.invoke.Test.MyClassPrxHelper;
import test.Ice.invoke.Test.MyException;
public class AllTests
{
final static String testString = "This is a test string";
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -27,244 +31,37 @@ public class AllTests
}
}
- private static class Callback
- {
- Callback()
- {
- _called = false;
- }
-
- public synchronized void check()
- {
- while(!_called)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- _called = false;
- }
-
- public synchronized void called()
- {
- assert(!_called);
- _called = true;
- notify();
- }
-
- private boolean _called;
- }
-
- private static class opStringI extends Ice.Callback
- {
- public opStringI(Ice.Communicator communicator)
- {
- _communicator = communicator;
- }
-
- @Override
- public void completed(Ice.AsyncResult result)
- {
- Ice.ByteSeqHolder outEncaps = new Ice.ByteSeqHolder();
- if(result.getProxy().end_ice_invoke(outEncaps, result))
- {
- Ice.InputStream inS = new Ice.InputStream(_communicator, outEncaps.value);
- inS.startEncapsulation();
- String s = inS.readString();
- test(s.equals(testString));
- s = inS.readString();
- test(s.equals(testString));
- inS.endEncapsulation();
- callback.called();
- }
- else
- {
- test(false);
- }
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Ice.Communicator _communicator;
- private Callback callback = new Callback();
- }
-
- private static class opExceptionI extends Ice.Callback
- {
- public opExceptionI(Ice.Communicator communicator)
- {
- _communicator = communicator;
- }
-
- @Override
- public void completed(Ice.AsyncResult result)
- {
- Ice.ByteSeqHolder outEncaps = new Ice.ByteSeqHolder();
- if(result.getProxy().end_ice_invoke(outEncaps, result))
- {
- test(false);
- }
- else
- {
- Ice.InputStream inS = new Ice.InputStream(_communicator, outEncaps.value);
- inS.startEncapsulation();
- try
- {
- inS.throwException();
- }
- catch(MyException ex)
- {
- inS.endEncapsulation();
- callback.called();
- }
- catch(java.lang.Exception ex)
- {
- test(false);
- }
- }
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Ice.Communicator _communicator;
- private Callback callback = new Callback();
- }
-
- private static class Callback_Object_opStringI extends Ice.Callback_Object_ice_invoke
- {
- public Callback_Object_opStringI(Ice.Communicator communicator)
- {
- _communicator = communicator;
- }
-
- @Override
- public void response(boolean ok, byte[] outEncaps)
- {
- if(ok)
- {
- Ice.InputStream inS = new Ice.InputStream(_communicator, outEncaps);
- inS.startEncapsulation();
- String s = inS.readString();
- test(s.equals(testString));
- s = inS.readString();
- test(s.equals(testString));
- inS.endEncapsulation();
- callback.called();
- }
- else
- {
- test(false);
- }
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Ice.Communicator _communicator;
- private Callback callback = new Callback();
- }
-
- private static class Callback_Object_opExceptionI extends Ice.Callback_Object_ice_invoke
- {
- public Callback_Object_opExceptionI(Ice.Communicator communicator)
- {
- _communicator = communicator;
- }
-
- @Override
- public void response(boolean ok, byte[] outEncaps)
- {
- if(ok)
- {
- test(false);
- }
- else
- {
- Ice.InputStream inS = new Ice.InputStream(_communicator, outEncaps);
- inS.startEncapsulation();
- try
- {
- inS.throwException();
- }
- catch(MyException ex)
- {
- inS.endEncapsulation();
- callback.called();
- }
- catch(java.lang.Exception ex)
- {
- test(false);
- }
- }
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Ice.Communicator _communicator;
- private Callback callback = new Callback();
- }
-
- public static MyClassPrx
- allTests(Ice.Communicator communicator, PrintWriter out)
+ public static MyClassPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out)
{
String ref = "test:default -p 12010";
- Ice.ObjectPrx base = communicator.stringToProxy(ref);
- MyClassPrx cl = MyClassPrxHelper.checkedCast(base);
- MyClassPrx oneway = MyClassPrxHelper.uncheckedCast(cl.ice_oneway());
- MyClassPrx batchOneway = MyClassPrxHelper.uncheckedCast(cl.ice_batchOneway());
+ com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ MyClassPrx cl = MyClassPrx.checkedCast(base);
+ MyClassPrx oneway = cl.ice_oneway();
+ MyClassPrx batchOneway = cl.ice_batchOneway();
out.print("testing ice_invoke... ");
out.flush();
{
- if(!oneway.ice_invoke("opOneway", Ice.OperationMode.Normal, null, null))
- {
- test(false);
- }
+ com.zeroc.Ice.Object.Ice_invokeResult r;
- test(batchOneway.ice_invoke("opOneway", Ice.OperationMode.Normal, null, null));
- test(batchOneway.ice_invoke("opOneway", Ice.OperationMode.Normal, null, null));
- test(batchOneway.ice_invoke("opOneway", Ice.OperationMode.Normal, null, null));
- test(batchOneway.ice_invoke("opOneway", Ice.OperationMode.Normal, null, null));
+ r = oneway.ice_invoke("opOneway", OperationMode.Normal, null);
+ test(r.returnValue);
+ test(batchOneway.ice_invoke("opOneway", OperationMode.Normal, null).returnValue);
+ test(batchOneway.ice_invoke("opOneway", OperationMode.Normal, null).returnValue);
+ test(batchOneway.ice_invoke("opOneway", OperationMode.Normal, null).returnValue);
+ test(batchOneway.ice_invoke("opOneway", OperationMode.Normal, null).returnValue);
batchOneway.ice_flushBatchRequests();
- Ice.OutputStream outS = new Ice.OutputStream(communicator);
+ OutputStream outS = new OutputStream(communicator);
outS.startEncapsulation();
outS.writeString(testString);
outS.endEncapsulation();
byte[] inEncaps = outS.finished();
- Ice.ByteSeqHolder outEncaps = new Ice.ByteSeqHolder();
- if(cl.ice_invoke("opString", Ice.OperationMode.Normal, inEncaps, outEncaps))
+ r = cl.ice_invoke("opString", OperationMode.Normal, inEncaps);
+ if(r.returnValue)
{
- Ice.InputStream inS = new Ice.InputStream(communicator, outEncaps.value);
+ InputStream inS = new InputStream(communicator, r.outParams);
inS.startEncapsulation();
String s = inS.readString();
test(s.equals(testString));
@@ -279,14 +76,14 @@ public class AllTests
}
{
- Ice.ByteSeqHolder outEncaps = new Ice.ByteSeqHolder();
- if(cl.ice_invoke("opException", Ice.OperationMode.Normal, null, outEncaps))
+ com.zeroc.Ice.Object.Ice_invokeResult r = cl.ice_invoke("opException", OperationMode.Normal, null);
+ if(r.returnValue)
{
test(false);
}
else
{
- Ice.InputStream inS = new Ice.InputStream(communicator, outEncaps.value);
+ InputStream inS = new InputStream(communicator, r.outParams);
inS.startEncapsulation();
try
{
@@ -309,24 +106,22 @@ public class AllTests
out.flush();
{
- Ice.AsyncResult result = oneway.begin_ice_invoke("opOneway", Ice.OperationMode.Normal, null);
- Ice.ByteSeqHolder outEncaps = new Ice.ByteSeqHolder();
- if(!oneway.end_ice_invoke(outEncaps, result))
- {
- test(false);
- }
+ CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> f =
+ oneway.ice_invokeAsync("opOneway", OperationMode.Normal, null);
+ com.zeroc.Ice.Object.Ice_invokeResult r = f.join();
+ test(r.returnValue);
- Ice.OutputStream outS = new Ice.OutputStream(communicator);
+ OutputStream outS = new OutputStream(communicator);
outS.startEncapsulation();
outS.writeString(testString);
outS.endEncapsulation();
byte[] inEncaps = outS.finished();
- // begin_ice_invoke with no callback
- result = cl.begin_ice_invoke("opString", Ice.OperationMode.Normal, inEncaps);
- if(cl.end_ice_invoke(outEncaps, result))
+ f = cl.ice_invokeAsync("opString", OperationMode.Normal, inEncaps);
+ r = f.join();
+ if(r.returnValue)
{
- Ice.InputStream inS = new Ice.InputStream(communicator, outEncaps.value);
+ InputStream inS = new InputStream(communicator, r.outParams);
inS.startEncapsulation();
String s = inS.readString();
test(s.equals(testString));
@@ -338,29 +133,19 @@ public class AllTests
{
test(false);
}
-
- // begin_ice_invoke with Callback
- opStringI cb1 = new opStringI(communicator);
- cl.begin_ice_invoke("opString", Ice.OperationMode.Normal, inEncaps, cb1);
- cb1.check();
-
- // begin_ice_invoke with Callback_Object_ice_invoke
- Callback_Object_opStringI cb2 = new Callback_Object_opStringI(communicator);
- cl.begin_ice_invoke("opString", Ice.OperationMode.Normal, inEncaps, cb2);
- cb2.check();
}
{
- // begin_ice_invoke with no callback
- Ice.AsyncResult result = cl.begin_ice_invoke("opException", Ice.OperationMode.Normal, null);
- Ice.ByteSeqHolder outEncaps = new Ice.ByteSeqHolder();
- if(cl.end_ice_invoke(outEncaps, result))
+ CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> f =
+ cl.ice_invokeAsync("opException", OperationMode.Normal, null);
+ com.zeroc.Ice.Object.Ice_invokeResult r = f.join();
+ if(r.returnValue)
{
test(false);
}
else
{
- Ice.InputStream inS = new Ice.InputStream(communicator, outEncaps.value);
+ InputStream inS = new InputStream(communicator, r.outParams);
inS.startEncapsulation();
try
{
@@ -375,16 +160,6 @@ public class AllTests
}
inS.endEncapsulation();
}
-
- // begin_ice_invoke with Callback
- opExceptionI cb1 = new opExceptionI(communicator);
- cl.begin_ice_invoke("opException", Ice.OperationMode.Normal, null, cb1);
- cb1.check();
-
- // begin_ice_invoke with Callback_Object_ice_invoke
- Callback_Object_opExceptionI cb2 = new Callback_Object_opExceptionI(communicator);
- cl.begin_ice_invoke("opException", Ice.OperationMode.Normal, null, cb2);
- cb2.check();
}
out.println("ok");
diff --git a/java/test/src/main/java/test/Ice/invoke/BlobjectAsyncI.java b/java/test/src/main/java/test/Ice/invoke/BlobjectAsyncI.java
index baf14b2a5fb..bd39ccbba1b 100644
--- a/java/test/src/main/java/test/Ice/invoke/BlobjectAsyncI.java
+++ b/java/test/src/main/java/test/Ice/invoke/BlobjectAsyncI.java
@@ -9,22 +9,28 @@
package test.Ice.invoke;
+import java.util.concurrent.CompletionStage;
+import java.util.concurrent.CompletableFuture;
+
import test.Ice.invoke.Test.MyException;
-public class BlobjectAsyncI extends Ice.BlobjectAsync
+public class BlobjectAsyncI implements com.zeroc.Ice.BlobjectAsync
{
@Override
- public void
- ice_invoke_async(Ice.AMD_Object_ice_invoke cb, byte[] inParams, Ice.Current current)
+ public CompletionStage<com.zeroc.Ice.Object.Ice_invokeResult> ice_invokeAsync(byte[] inParams,
+ com.zeroc.Ice.Current current)
{
- Ice.Communicator communicator = current.adapter.getCommunicator();
- Ice.InputStream in = new Ice.InputStream(communicator, inParams);
+ com.zeroc.Ice.Communicator communicator = current.adapter.getCommunicator();
+ com.zeroc.Ice.InputStream in = new com.zeroc.Ice.InputStream(communicator, inParams);
in.startEncapsulation();
- Ice.OutputStream out = new Ice.OutputStream(communicator);
+ com.zeroc.Ice.OutputStream out = new com.zeroc.Ice.OutputStream(communicator);
out.startEncapsulation();
+ com.zeroc.Ice.Object.Ice_invokeResult r = new com.zeroc.Ice.Object.Ice_invokeResult();
if(current.operation.equals("opOneway"))
{
- cb.ice_response(true, new byte[0]);
+ r.returnValue = true;
+ r.outParams = new byte[0];
+ return CompletableFuture.completedFuture(r);
}
else if(current.operation.equals("opString"))
{
@@ -32,19 +38,25 @@ public class BlobjectAsyncI extends Ice.BlobjectAsync
out.writeString(s);
out.writeString(s);
out.endEncapsulation();
- cb.ice_response(true, out.finished());
+ r.returnValue = true;
+ r.outParams = out.finished();
+ return CompletableFuture.completedFuture(r);
}
else if(current.operation.equals("opException"))
{
MyException ex = new MyException();
out.writeException(ex);
out.endEncapsulation();
- cb.ice_response(false, out.finished());
+ r.returnValue = false;
+ r.outParams = out.finished();
+ return CompletableFuture.completedFuture(r);
}
else if(current.operation.equals("shutdown"))
{
communicator.shutdown();
- cb.ice_response(true, null);
+ r.returnValue = true;
+ r.outParams = new byte[0];
+ return CompletableFuture.completedFuture(r);
}
else if(current.operation.equals("ice_isA"))
{
@@ -58,11 +70,13 @@ public class BlobjectAsyncI extends Ice.BlobjectAsync
out.writeBool(false);
}
out.endEncapsulation();
- cb.ice_response(true, out.finished());
+ r.returnValue = true;
+ r.outParams = out.finished();
+ return CompletableFuture.completedFuture(r);
}
else
{
- Ice.OperationNotExistException ex = new Ice.OperationNotExistException();
+ com.zeroc.Ice.OperationNotExistException ex = new com.zeroc.Ice.OperationNotExistException();
ex.id = current.id;
ex.facet = current.facet;
ex.operation = current.operation;
diff --git a/java/test/src/main/java/test/Ice/invoke/BlobjectI.java b/java/test/src/main/java/test/Ice/invoke/BlobjectI.java
index 8d7d90e71db..e7f18b4d938 100644
--- a/java/test/src/main/java/test/Ice/invoke/BlobjectI.java
+++ b/java/test/src/main/java/test/Ice/invoke/BlobjectI.java
@@ -11,21 +11,22 @@ package test.Ice.invoke;
import test.Ice.invoke.Test.MyException;
-public class BlobjectI extends Ice.Blobject
+public class BlobjectI implements com.zeroc.Ice.Blobject
{
@Override
- public boolean
- ice_invoke(byte[] inParams, Ice.ByteSeqHolder outParams, Ice.Current current)
+ public com.zeroc.Ice.Object.Ice_invokeResult ice_invoke(byte[] inParams, com.zeroc.Ice.Current current)
{
- Ice.Communicator communicator = current.adapter.getCommunicator();
- Ice.InputStream in = new Ice.InputStream(communicator, inParams);
+ com.zeroc.Ice.Communicator communicator = current.adapter.getCommunicator();
+ com.zeroc.Ice.InputStream in = new com.zeroc.Ice.InputStream(communicator, inParams);
in.startEncapsulation();
- Ice.OutputStream out = new Ice.OutputStream(communicator);
+ com.zeroc.Ice.OutputStream out = new com.zeroc.Ice.OutputStream(communicator);
out.startEncapsulation();
+ com.zeroc.Ice.Object.Ice_invokeResult r = new com.zeroc.Ice.Object.Ice_invokeResult();
if(current.operation.equals("opOneway"))
{
- outParams.value = new byte[0];
- return true;
+ r.returnValue = true;
+ r.outParams = new byte[0];
+ return r;
}
else if(current.operation.equals("opString"))
{
@@ -33,21 +34,25 @@ public class BlobjectI extends Ice.Blobject
out.writeString(s);
out.writeString(s);
out.endEncapsulation();
- outParams.value = out.finished();
- return true;
+ r.returnValue = true;
+ r.outParams = out.finished();
+ return r;
}
else if(current.operation.equals("opException"))
{
MyException ex = new MyException();
out.writeException(ex);
out.endEncapsulation();
- outParams.value = out.finished();
- return false;
+ r.returnValue = false;
+ r.outParams = out.finished();
+ return r;
}
else if(current.operation.equals("shutdown"))
{
communicator.shutdown();
- return true;
+ r.returnValue = true;
+ r.outParams = new byte[0];
+ return r;
}
else if(current.operation.equals("ice_isA"))
{
@@ -61,12 +66,13 @@ public class BlobjectI extends Ice.Blobject
out.writeBool(false);
}
out.endEncapsulation();
- outParams.value = out.finished();
- return true;
+ r.returnValue = true;
+ r.outParams = out.finished();
+ return r;
}
else
{
- Ice.OperationNotExistException ex = new Ice.OperationNotExistException();
+ com.zeroc.Ice.OperationNotExistException ex = new com.zeroc.Ice.OperationNotExistException();
ex.id = current.id;
ex.facet = current.facet;
ex.operation = current.operation;
diff --git a/java/test/src/main/java/test/Ice/invoke/Client.java b/java/test/src/main/java/test/Ice/invoke/Client.java
index dc376487ffe..e123ae57359 100644
--- a/java/test/src/main/java/test/Ice/invoke/Client.java
+++ b/java/test/src/main/java/test/Ice/invoke/Client.java
@@ -17,45 +17,18 @@ public class Client extends test.Util.Application
public int run(String[] args)
{
MyClassPrx myClass = AllTests.allTests(communicator(), getWriter());
-
- //
- // Use reflection to load lambda.AllTests as that is only supported with Java >= 1.8
- //
- try
- {
- Class<?> cls = IceInternal.Util.findClass("test.Ice.invoke.lambda.AllTests", null);
- if(cls != null)
- {
- java.lang.reflect.Method allTests = cls.getDeclaredMethod("allTests",
- new Class<?>[]{Ice.Communicator.class, java.io.PrintWriter.class});
- allTests.invoke(null, communicator(), getWriter());
- }
- }
- catch(java.lang.NoSuchMethodException ex)
- {
- throw new RuntimeException(ex);
- }
- catch(java.lang.IllegalAccessException ex)
- {
- throw new RuntimeException(ex);
- }
- catch(java.lang.reflect.InvocationTargetException ex)
- {
- throw new RuntimeException(ex);
- }
-
+
myClass.shutdown();
return 0;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.invoke");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.invoke");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/invoke/ServantLocatorI.java b/java/test/src/main/java/test/Ice/invoke/ServantLocatorI.java
index 93b96a648ff..a7552525dc1 100644
--- a/java/test/src/main/java/test/Ice/invoke/ServantLocatorI.java
+++ b/java/test/src/main/java/test/Ice/invoke/ServantLocatorI.java
@@ -9,38 +9,36 @@
package test.Ice.invoke;
-public class ServantLocatorI implements Ice.ServantLocator
+public class ServantLocatorI implements com.zeroc.Ice.ServantLocator
{
- public ServantLocatorI( boolean async)
+ public ServantLocatorI(boolean async)
{
+ _blobject = new com.zeroc.Ice.ServantLocator.LocateResult();
if(async)
{
- _blobject = new BlobjectAsyncI();
+ _blobject.returnValue = new BlobjectAsyncI();
}
else
{
- _blobject = new BlobjectI();
+ _blobject.returnValue = new BlobjectI();
}
}
@Override
- public Ice.Object
- locate(Ice.Current current, Ice.LocalObjectHolder cookie)
+ public com.zeroc.Ice.ServantLocator.LocateResult locate(com.zeroc.Ice.Current current)
{
return _blobject;
}
@Override
- public void
- finished(Ice.Current current, Ice.Object servant, java.lang.Object cookie)
+ public void finished(com.zeroc.Ice.Current current, com.zeroc.Ice.Object servant, java.lang.Object cookie)
{
}
@Override
- public void
- deactivate(String category)
+ public void deactivate(String category)
{
}
- private Ice.Object _blobject;
+ private com.zeroc.Ice.ServantLocator.LocateResult _blobject;
}
diff --git a/java/test/src/main/java/test/Ice/invoke/Server.java b/java/test/src/main/java/test/Ice/invoke/Server.java
index 9ce06acc55b..daf97fe4c25 100644
--- a/java/test/src/main/java/test/Ice/invoke/Server.java
+++ b/java/test/src/main/java/test/Ice/invoke/Server.java
@@ -24,19 +24,18 @@ public class Server extends test.Util.Application
}
communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.addServantLocator(new ServantLocatorI(async), "");
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.invoke");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.invoke");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/location/AllTests.java b/java/test/src/main/java/test/Ice/location/AllTests.java
index 33bada684a8..164408efc27 100644
--- a/java/test/src/main/java/test/Ice/location/AllTests.java
+++ b/java/test/src/main/java/test/Ice/location/AllTests.java
@@ -10,24 +10,21 @@
package test.Ice.location;
import java.io.PrintWriter;
+import java.util.concurrent.CompletableFuture;
+
+import com.zeroc.Ice.ObjectPrx;
+import com.zeroc.Ice.Util;
-import test.Ice.location.Test.Callback_Hello_sayHello;
import test.Ice.location.Test.HelloPrx;
-import test.Ice.location.Test.HelloPrxHelper;
import test.Ice.location.Test.ServerManagerPrx;
-import test.Ice.location.Test.ServerManagerPrxHelper;
import test.Ice.location.Test.TestIntfPrx;
-import test.Ice.location.Test.TestIntfPrxHelper;
import test.Ice.location.Test.TestLocatorPrx;
-import test.Ice.location.Test.TestLocatorPrxHelper;
import test.Ice.location.Test.TestLocatorRegistryPrx;
-import test.Ice.location.Test.TestLocatorRegistryPrxHelper;
import test.Util.Application;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -37,58 +34,60 @@ public class AllTests
public static void
allTests(Application app)
- throws Ice.AdapterAlreadyActiveException, Ice.AdapterNotFoundException, InterruptedException
+ throws com.zeroc.Ice.AdapterAlreadyActiveException, com.zeroc.Ice.AdapterNotFoundException, InterruptedException
{
- Ice.Communicator communicator = app.communicator();
+ com.zeroc.Ice.Communicator communicator = app.communicator();
PrintWriter out = app.getWriter();
- ServerManagerPrx manager = ServerManagerPrxHelper.checkedCast(
+ ServerManagerPrx manager = ServerManagerPrx.checkedCast(
communicator.stringToProxy("ServerManager :default -p 12010"));
test(manager != null);
- TestLocatorPrx locator = TestLocatorPrxHelper.uncheckedCast(communicator.getDefaultLocator());
+ TestLocatorPrx locator = TestLocatorPrx.uncheckedCast(communicator.getDefaultLocator());
test(locator != null);
- TestLocatorRegistryPrx registry = TestLocatorRegistryPrxHelper.checkedCast(locator.getRegistry());
+ TestLocatorRegistryPrx registry = TestLocatorRegistryPrx.checkedCast(locator.getRegistry());
test(registry != null);
out.print("testing stringToProxy... ");
out.flush();
- Ice.ObjectPrx base = communicator.stringToProxy("test @ TestAdapter");
- Ice.ObjectPrx base2 = communicator.stringToProxy("test @ TestAdapter");
- Ice.ObjectPrx base3 = communicator.stringToProxy("test");
- Ice.ObjectPrx base4 = communicator.stringToProxy("ServerManager");
- Ice.ObjectPrx base5 = communicator.stringToProxy("test2");
- Ice.ObjectPrx base6 = communicator.stringToProxy("test @ ReplicatedAdapter");
+ ObjectPrx base = communicator.stringToProxy("test @ TestAdapter");
+ ObjectPrx base2 = communicator.stringToProxy("test @ TestAdapter");
+ ObjectPrx base3 = communicator.stringToProxy("test");
+ ObjectPrx base4 = communicator.stringToProxy("ServerManager");
+ ObjectPrx base5 = communicator.stringToProxy("test2");
+ ObjectPrx base6 = communicator.stringToProxy("test @ ReplicatedAdapter");
out.println("ok");
out.print("testing ice_locator and ice_getLocator... ");
- test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), communicator.getDefaultLocator()) == 0);
- Ice.LocatorPrx anotherLocator =
- Ice.LocatorPrxHelper.uncheckedCast(communicator.stringToProxy("anotherLocator"));
+ test(Util.proxyIdentityCompare(base.ice_getLocator(), communicator.getDefaultLocator()) == 0);
+ com.zeroc.Ice.LocatorPrx anotherLocator =
+ com.zeroc.Ice.LocatorPrx.uncheckedCast(communicator.stringToProxy("anotherLocator"));
base = base.ice_locator(anotherLocator);
- test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), anotherLocator) == 0);
+ test(Util.proxyIdentityCompare(base.ice_getLocator(), anotherLocator) == 0);
communicator.setDefaultLocator(null);
base = communicator.stringToProxy("test @ TestAdapter");
test(base.ice_getLocator() == null);
base = base.ice_locator(anotherLocator);
- test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), anotherLocator) == 0);
+ test(Util.proxyIdentityCompare(base.ice_getLocator(), anotherLocator) == 0);
communicator.setDefaultLocator(locator);
base = communicator.stringToProxy("test @ TestAdapter");
- test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), communicator.getDefaultLocator()) == 0);
+ test(Util.proxyIdentityCompare(base.ice_getLocator(), communicator.getDefaultLocator()) == 0);
//
// We also test ice_router/ice_getRouter (perhaps we should add a
// test/Ice/router test?)
//
test(base.ice_getRouter() == null);
- Ice.RouterPrx anotherRouter = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("anotherRouter"));
+ com.zeroc.Ice.RouterPrx anotherRouter =
+ com.zeroc.Ice.RouterPrx.uncheckedCast(communicator.stringToProxy("anotherRouter"));
base = base.ice_router(anotherRouter);
- test(Ice.Util.proxyIdentityCompare(base.ice_getRouter(), anotherRouter) == 0);
- Ice.RouterPrx router = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("dummyrouter"));
+ test(Util.proxyIdentityCompare(base.ice_getRouter(), anotherRouter) == 0);
+ com.zeroc.Ice.RouterPrx router =
+ com.zeroc.Ice.RouterPrx.uncheckedCast(communicator.stringToProxy("dummyrouter"));
communicator.setDefaultRouter(router);
base = communicator.stringToProxy("test @ TestAdapter");
- test(Ice.Util.proxyIdentityCompare(base.ice_getRouter(), communicator.getDefaultRouter()) == 0);
+ test(Util.proxyIdentityCompare(base.ice_getRouter(), communicator.getDefaultRouter()) == 0);
communicator.setDefaultRouter(null);
base = communicator.stringToProxy("test @ TestAdapter");
test(base.ice_getRouter() == null);
@@ -101,17 +100,17 @@ public class AllTests
out.print("testing checked cast... ");
out.flush();
- TestIntfPrx obj = TestIntfPrxHelper.checkedCast(base);
+ TestIntfPrx obj = TestIntfPrx.checkedCast(base);
test(obj != null);
- TestIntfPrx obj2 = TestIntfPrxHelper.checkedCast(base2);
+ TestIntfPrx obj2 = TestIntfPrx.checkedCast(base2);
test(obj2 != null);
- TestIntfPrx obj3 = TestIntfPrxHelper.checkedCast(base3);
+ TestIntfPrx obj3 = TestIntfPrx.checkedCast(base3);
test(obj3 != null);
- ServerManagerPrx obj4 = ServerManagerPrxHelper.checkedCast(base4);
+ ServerManagerPrx obj4 = ServerManagerPrx.checkedCast(base4);
test(obj4 != null);
- TestIntfPrx obj5 = TestIntfPrxHelper.checkedCast(base5);
+ TestIntfPrx obj5 = TestIntfPrx.checkedCast(base5);
test(obj5 != null);
- TestIntfPrx obj6 = TestIntfPrxHelper.checkedCast(base6);
+ TestIntfPrx obj6 = TestIntfPrx.checkedCast(base6);
test(obj6 != null);
out.println("ok");
@@ -123,7 +122,7 @@ public class AllTests
{
obj2.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
@@ -138,7 +137,7 @@ public class AllTests
{
obj6.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
@@ -153,7 +152,7 @@ public class AllTests
{
obj3.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
@@ -162,7 +161,7 @@ public class AllTests
{
obj2.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
@@ -173,7 +172,7 @@ public class AllTests
{
obj2.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
@@ -182,7 +181,7 @@ public class AllTests
{
obj3.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
@@ -194,7 +193,7 @@ public class AllTests
{
obj2.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
@@ -205,7 +204,7 @@ public class AllTests
{
obj3.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
@@ -216,7 +215,7 @@ public class AllTests
{
obj2.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
@@ -228,7 +227,7 @@ public class AllTests
{
obj5.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
@@ -243,7 +242,7 @@ public class AllTests
base.ice_ping();
test(false);
}
- catch(Ice.NotRegisteredException ex)
+ catch(com.zeroc.Ice.NotRegisteredException ex)
{
test(ex.kindOfObject.equals("object"));
test(ex.id.equals("unknown/unknown"));
@@ -258,7 +257,7 @@ public class AllTests
base.ice_ping();
test(false);
}
- catch(Ice.NotRegisteredException ex)
+ catch(com.zeroc.Ice.NotRegisteredException ex)
{
test(ex.kindOfObject.equals("object adapter"));
test(ex.id.equals("TestAdapterUnknown"));
@@ -304,7 +303,7 @@ public class AllTests
out.print("testing proxy from server... ");
out.flush();
- obj = TestIntfPrxHelper.checkedCast(communicator.stringToProxy("test@TestAdapter"));
+ obj = TestIntfPrx.checkedCast(communicator.stringToProxy("test@TestAdapter"));
HelloPrx hello = obj.getHello();
test(hello.ice_getAdapterId().equals("TestAdapter"));
hello = obj.getReplicatedHello();
@@ -321,36 +320,28 @@ public class AllTests
out.print("testing locator request queuing... ");
out.flush();
- hello = (HelloPrx)obj.getReplicatedHello().ice_locatorCacheTimeout(0).ice_connectionCached(false);
+ hello = obj.getReplicatedHello().ice_locatorCacheTimeout(0).ice_connectionCached(false);
count = locator.getRequestCount();
hello.ice_ping();
test(++count == locator.getRequestCount());
- java.util.List<Ice.AsyncResult> results = new java.util.LinkedList<Ice.AsyncResult>();
+ java.util.List<CompletableFuture<Void>> results = new java.util.LinkedList<>();
for(int i = 0; i < 1000; i++)
{
- class AMICallback extends Callback_Hello_sayHello
- {
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- ex.printStackTrace();
- test(false);
- }
-
- @Override
- public void
- response()
+ CompletableFuture<Void> f = hello.sayHelloAsync();
+ f.whenComplete((result, ex) ->
{
- }
- };
- Ice.AsyncResult result = hello.begin_sayHello(new AMICallback());
- results.add(result);
+ if(ex != null)
+ {
+ ex.printStackTrace();
+ test(false);
+ }
+ });
+ results.add(f);
}
while(!results.isEmpty())
{
- Ice.AsyncResult result = results.remove(0);
- result.waitForCompleted();
+ CompletableFuture<Void> r = results.remove(0);
+ r.join();
}
test(locator.getRequestCount() > count && locator.getRequestCount() < count + 999);
if(locator.getRequestCount() > count + 800)
@@ -358,37 +349,27 @@ public class AllTests
out.print("queuing = " + (locator.getRequestCount() - count));
}
count = locator.getRequestCount();
- hello = (HelloPrx)hello.ice_adapterId("unknown");
+ hello = hello.ice_adapterId("unknown");
for(int i = 0; i < 1000; i++)
{
- class AMICallback extends Callback_Hello_sayHello
- {
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- if(ex instanceof Ice.CommunicatorDestroyedException)
- {
- ex.printStackTrace();
- assert false;
- }
- test(ex instanceof Ice.NotRegisteredException);
- }
-
- @Override
- public void
- response()
+ CompletableFuture<Void> f = hello.sayHelloAsync();
+ f.whenComplete((result, ex) ->
{
- test(false);
- }
- };
- Ice.AsyncResult result = hello.begin_sayHello(new AMICallback());
- results.add(result);
+ test(ex != null && ex instanceof com.zeroc.Ice.NotRegisteredException);
+ });
+ results.add(f);
}
while(!results.isEmpty())
{
- Ice.AsyncResult result = results.remove(0);
- result.waitForCompleted();
+ CompletableFuture<Void> r = results.remove(0);
+ try
+ {
+ r.join();
+ }
+ catch(java.util.concurrent.CompletionException ex)
+ {
+ test(ex.getCause() instanceof com.zeroc.Ice.NotRegisteredException);
+ }
}
// Take into account the retries.
test(locator.getRequestCount() > count && locator.getRequestCount() < count + 1999);
@@ -405,7 +386,7 @@ public class AllTests
communicator.stringToProxy("test@TestAdapter3").ice_ping();
test(false);
}
- catch(Ice.NotRegisteredException ex)
+ catch(com.zeroc.Ice.NotRegisteredException ex)
{
test(ex.kindOfObject == "object adapter");
test(ex.id.equals("TestAdapter3"));
@@ -417,7 +398,7 @@ public class AllTests
registry.setAdapterDirectProxy("TestAdapter3", communicator.stringToProxy("dummy:tcp"));
communicator.stringToProxy("test@TestAdapter3").ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
@@ -428,7 +409,7 @@ public class AllTests
communicator.stringToProxy("test@TestAdapter3").ice_locatorCacheTimeout(0).ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
try
@@ -436,7 +417,7 @@ public class AllTests
communicator.stringToProxy("test@TestAdapter3").ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
registry.setAdapterDirectProxy("TestAdapter3", locator.findAdapterById("TestAdapter"));
@@ -444,7 +425,7 @@ public class AllTests
{
communicator.stringToProxy("test@TestAdapter3").ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
@@ -460,7 +441,7 @@ public class AllTests
communicator.stringToProxy("test3").ice_ping();
test(false);
}
- catch(Ice.NotRegisteredException ex)
+ catch(com.zeroc.Ice.NotRegisteredException ex)
{
test(ex.kindOfObject == "object adapter");
test(ex.id.equals("TestUnknown"));
@@ -473,7 +454,7 @@ public class AllTests
communicator.stringToProxy("test3").ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
registry.setAdapterDirectProxy("TestAdapter4", locator.findAdapterById("TestAdapter"));
@@ -481,7 +462,7 @@ public class AllTests
{
communicator.stringToProxy("test3").ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
@@ -492,7 +473,7 @@ public class AllTests
{
communicator.stringToProxy("test3").ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
@@ -503,7 +484,7 @@ public class AllTests
communicator.stringToProxy("test@TestAdapter4").ice_locatorCacheTimeout(0).ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
try
@@ -511,7 +492,7 @@ public class AllTests
communicator.stringToProxy("test@TestAdapter4").ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
try
@@ -519,7 +500,7 @@ public class AllTests
communicator.stringToProxy("test3").ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
registry.addObject(communicator.stringToProxy("test3@TestAdapter"));
@@ -527,7 +508,7 @@ public class AllTests
{
communicator.stringToProxy("test3").ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -538,7 +519,7 @@ public class AllTests
communicator.stringToProxy("test4").ice_ping();
test(false);
}
- catch(Ice.NoEndpointException ex)
+ catch(com.zeroc.Ice.NoEndpointException ex)
{
}
out.println("ok");
@@ -546,10 +527,10 @@ public class AllTests
out.print("testing locator cache background updates... ");
out.flush();
{
- Ice.InitializationData initData = app.createInitializationData();
+ com.zeroc.Ice.InitializationData initData = app.createInitializationData();
initData.properties = communicator.getProperties()._clone();
initData.properties.setProperty("Ice.BackgroundLocatorCacheUpdates", "1");
- Ice.Communicator ic = app.initialize(initData);
+ com.zeroc.Ice.Communicator ic = app.initialize(initData);
registry.setAdapterDirectProxy("TestAdapter5", locator.findAdapterById("TestAdapter"));
registry.addObject(communicator.stringToProxy("test3@TestAdapter"));
@@ -579,7 +560,7 @@ public class AllTests
Thread.sleep(10);
}
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
// Expected to fail once they endpoints have been updated in the background.
}
@@ -591,7 +572,7 @@ public class AllTests
Thread.sleep(10);
}
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
// Expected to fail once they endpoints have been updated in the background.
}
@@ -609,7 +590,7 @@ public class AllTests
out.print("testing object migration...");
out.flush();
- hello = HelloPrxHelper.checkedCast(communicator.stringToProxy("hello"));
+ hello = HelloPrx.checkedCast(communicator.stringToProxy("hello"));
obj.migrateHello();
hello.ice_getConnection().close(false);
hello.sayHello();
@@ -621,11 +602,11 @@ public class AllTests
out.print("testing locator encoding resolution... ");
out.flush();
- hello = HelloPrxHelper.checkedCast(communicator.stringToProxy("hello"));
+ hello = HelloPrx.checkedCast(communicator.stringToProxy("hello"));
count = locator.getRequestCount();
- communicator.stringToProxy("test@TestAdapter").ice_encodingVersion(Ice.Util.Encoding_1_1).ice_ping();
+ communicator.stringToProxy("test@TestAdapter").ice_encodingVersion(Util.Encoding_1_1).ice_ping();
test(count == locator.getRequestCount());
- communicator.stringToProxy("test@TestAdapter10").ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping();
+ communicator.stringToProxy("test@TestAdapter10").ice_encodingVersion(Util.Encoding_1_0).ice_ping();
test(++count == locator.getRequestCount());
communicator.stringToProxy("test -e 1.0@TestAdapter10-2").ice_ping();
test(++count == locator.getRequestCount());
@@ -643,7 +624,7 @@ public class AllTests
obj2.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
try
@@ -651,7 +632,7 @@ public class AllTests
obj3.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
try
@@ -659,7 +640,7 @@ public class AllTests
obj5.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
out.println("ok");
@@ -669,20 +650,20 @@ public class AllTests
// Set up test for calling a collocated object through an
// indirect, adapterless reference.
//
- Ice.Properties properties = communicator.getProperties();
+ com.zeroc.Ice.Properties properties = communicator.getProperties();
properties.setProperty("Ice.PrintAdapterReady", "0");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("Hello", "default");
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("Hello", "default");
adapter.setLocator(locator);
- Ice.Identity id = new Ice.Identity();
+ com.zeroc.Ice.Identity id = new com.zeroc.Ice.Identity();
id.name = java.util.UUID.randomUUID().toString();
registry.addObject(adapter.add(new HelloI(), id));
adapter.activate();
// Note the quotes are necessary here due to ":" in the
// java generated UUID.
- HelloPrx helloPrx = HelloPrxHelper.checkedCast(
- communicator.stringToProxy("\"" + Ice.Util.identityToString(id) + "\""));
+ HelloPrx helloPrx = HelloPrx.checkedCast(
+ communicator.stringToProxy("\"" + com.zeroc.Ice.Util.identityToString(id) + "\""));
test(helloPrx.ice_getConnection() == null);
adapter.deactivate();
diff --git a/java/test/src/main/java/test/Ice/location/Client.java b/java/test/src/main/java/test/Ice/location/Client.java
index e792640fb08..696b59f99cd 100644
--- a/java/test/src/main/java/test/Ice/location/Client.java
+++ b/java/test/src/main/java/test/Ice/location/Client.java
@@ -18,12 +18,12 @@ public class Client extends test.Util.Application
{
AllTests.allTests(this);
}
- catch(Ice.AdapterAlreadyActiveException ex)
+ catch(com.zeroc.Ice.AdapterAlreadyActiveException ex)
{
ex.printStackTrace();
throw new RuntimeException();
}
- catch(Ice.AdapterNotFoundException ex)
+ catch(com.zeroc.Ice.AdapterNotFoundException ex)
{
ex.printStackTrace();
throw new RuntimeException();
@@ -38,13 +38,12 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.location");
- initData.properties.setProperty("Ice.Default.Locator", "locator:default -p 12010");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.location");
+ r.initData.properties.setProperty("Ice.Default.Locator", "locator:default -p 12010");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/location/HelloI.java b/java/test/src/main/java/test/Ice/location/HelloI.java
index 2e3d94da141..b04fd93b6d7 100644
--- a/java/test/src/main/java/test/Ice/location/HelloI.java
+++ b/java/test/src/main/java/test/Ice/location/HelloI.java
@@ -9,14 +9,12 @@
package test.Ice.location;
-import test.Ice.location.Test._HelloDisp;
+import test.Ice.location.Test.Hello;
-
-public class HelloI extends _HelloDisp
+public class HelloI implements Hello
{
@Override
- public void
- sayHello(Ice.Current current)
+ public void sayHello(com.zeroc.Ice.Current current)
{
}
}
diff --git a/java/test/src/main/java/test/Ice/location/Server.java b/java/test/src/main/java/test/Ice/location/Server.java
index 1a3a98351be..0b702aedae1 100644
--- a/java/test/src/main/java/test/Ice/location/Server.java
+++ b/java/test/src/main/java/test/Ice/location/Server.java
@@ -11,19 +11,19 @@ package test.Ice.location;
public class Server extends test.Util.Application
{
- private Ice.InitializationData _initData;
+ private com.zeroc.Ice.InitializationData _initData;
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.Communicator communicator = communicator();
//
// Register the server manager. The server manager creates a new
// 'server' (a server isn't a different process, it's just a new
// communicator and object adapter).
//
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ServerManagerAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ServerManagerAdapter");
//
// We also register a sample server locator which implements the
@@ -31,15 +31,16 @@ public class Server extends test.Util.Application
// 'servers' created with the server manager interface.
//
ServerLocatorRegistry registry = new ServerLocatorRegistry();
- registry.addObject(adapter.createProxy(Ice.Util.stringToIdentity("ServerManager")));
- Ice.Object object = new ServerManagerI(registry, _initData, this);
- adapter.add(object, Ice.Util.stringToIdentity("ServerManager"));
+ registry.addObject(adapter.createProxy(com.zeroc.Ice.Util.stringToIdentity("ServerManager")), null);
+ com.zeroc.Ice.Object object = new ServerManagerI(registry, _initData, this);
+ adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("ServerManager"));
- Ice.LocatorRegistryPrx registryPrx = Ice.LocatorRegistryPrxHelper.uncheckedCast(adapter.add(registry,
- Ice.Util.stringToIdentity("registry")));
+ com.zeroc.Ice.LocatorRegistryPrx registryPrx =
+ com.zeroc.Ice.LocatorRegistryPrx.uncheckedCast(adapter.add(registry,
+ com.zeroc.Ice.Util.stringToIdentity("registry")));
ServerLocator locator = new ServerLocator(registry, registryPrx);
- adapter.add(locator, Ice.Util.stringToIdentity("locator"));
+ adapter.add(locator, com.zeroc.Ice.Util.stringToIdentity("locator"));
adapter.activate();
@@ -47,17 +48,16 @@ public class Server extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.location");
- initData.properties.setProperty("Ice.ThreadPool.Server.Size", "2");
- initData.properties.setProperty("Ice.ThreadPool.Server.SizeWarn", "0");
- initData.properties.setProperty("ServerManagerAdapter.Endpoints", "default -p 12010:udp");
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.location");
+ r.initData.properties.setProperty("Ice.ThreadPool.Server.Size", "2");
+ r.initData.properties.setProperty("Ice.ThreadPool.Server.SizeWarn", "0");
+ r.initData.properties.setProperty("ServerManagerAdapter.Endpoints", "default -p 12010:udp");
- _initData = initData;
- return initData;
+ _initData = r.initData;
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/location/ServerLocator.java b/java/test/src/main/java/test/Ice/location/ServerLocator.java
index fd1ca307e42..0ee5c99786a 100644
--- a/java/test/src/main/java/test/Ice/location/ServerLocator.java
+++ b/java/test/src/main/java/test/Ice/location/ServerLocator.java
@@ -9,12 +9,16 @@
package test.Ice.location;
-import test.Ice.location.Test._TestLocatorDisp;
+import java.util.concurrent.CompletionStage;
+import java.util.concurrent.CompletableFuture;
-public class ServerLocator extends _TestLocatorDisp
+import com.zeroc.Ice.ObjectPrx;
+
+import test.Ice.location.Test.TestLocator;
+
+public class ServerLocator implements TestLocator
{
- public
- ServerLocator(ServerLocatorRegistry registry, Ice.LocatorRegistryPrx registryPrx)
+ public ServerLocator(ServerLocatorRegistry registry, com.zeroc.Ice.LocatorRegistryPrx registryPrx)
{
_registry = registry;
_registryPrx = registryPrx;
@@ -22,16 +26,14 @@ public class ServerLocator extends _TestLocatorDisp
}
@Override
- public void
- findAdapterById_async(Ice.AMD_Locator_findAdapterById response, String adapter, Ice.Current current)
- throws Ice.AdapterNotFoundException
+ public CompletionStage<ObjectPrx> findAdapterByIdAsync(String adapter, com.zeroc.Ice.Current current)
+ throws com.zeroc.Ice.AdapterNotFoundException
{
++_requestCount;
if(adapter.equals("TestAdapter10") || adapter.equals("TestAdapter10-2"))
{
- assert(current.encoding.equals(Ice.Util.Encoding_1_0));
- response.ice_response(_registry.getAdapter("TestAdapter"));
- return;
+ assert(current.encoding.equals(com.zeroc.Ice.Util.Encoding_1_0));
+ return CompletableFuture.completedFuture(_registry.getAdapter("TestAdapter"));
}
// We add a small delay to make sure locator request queuing gets tested when
@@ -43,13 +45,12 @@ public class ServerLocator extends _TestLocatorDisp
catch(java.lang.InterruptedException ex)
{
}
- response.ice_response(_registry.getAdapter(adapter));
+ return CompletableFuture.completedFuture(_registry.getAdapter(adapter));
}
@Override
- public void
- findObjectById_async(Ice.AMD_Locator_findObjectById response, Ice.Identity id, Ice.Current current)
- throws Ice.ObjectNotFoundException
+ public CompletionStage<ObjectPrx> findObjectByIdAsync(com.zeroc.Ice.Identity id, com.zeroc.Ice.Current current)
+ throws com.zeroc.Ice.ObjectNotFoundException
{
++_requestCount;
// We add a small delay to make sure locator request queuing gets tested when
@@ -61,26 +62,22 @@ public class ServerLocator extends _TestLocatorDisp
catch(java.lang.InterruptedException ex)
{
}
- response.ice_response(_registry.getObject(id));
+ return CompletableFuture.completedFuture(_registry.getObject(id));
}
-
+
@Override
- public Ice.LocatorRegistryPrx
- getRegistry(Ice.Current current)
+ public com.zeroc.Ice.LocatorRegistryPrx getRegistry(com.zeroc.Ice.Current current)
{
return _registryPrx;
}
@Override
- public int
- getRequestCount(Ice.Current current)
+ public int getRequestCount(com.zeroc.Ice.Current current)
{
return _requestCount;
}
-
+
private ServerLocatorRegistry _registry;
- private Ice.LocatorRegistryPrx _registryPrx;
+ private com.zeroc.Ice.LocatorRegistryPrx _registryPrx;
private int _requestCount;
-
}
-
diff --git a/java/test/src/main/java/test/Ice/location/ServerLocatorRegistry.java b/java/test/src/main/java/test/Ice/location/ServerLocatorRegistry.java
index 3d61e5046f4..005af72f73c 100644
--- a/java/test/src/main/java/test/Ice/location/ServerLocatorRegistry.java
+++ b/java/test/src/main/java/test/Ice/location/ServerLocatorRegistry.java
@@ -9,14 +9,19 @@
package test.Ice.location;
-import test.Ice.location.Test._TestLocatorRegistryDisp;
+import java.util.concurrent.CompletionStage;
+import java.util.concurrent.CompletableFuture;
-public class ServerLocatorRegistry extends _TestLocatorRegistryDisp
+import com.zeroc.Ice.Identity;
+import com.zeroc.Ice.ObjectPrx;
+
+import test.Ice.location.Test.TestLocatorRegistry;
+
+public class ServerLocatorRegistry implements TestLocatorRegistry
{
@Override
- public void
- setAdapterDirectProxy_async(Ice.AMD_LocatorRegistry_setAdapterDirectProxy cb, String adapter,
- Ice.ObjectPrx object, Ice.Current current)
+ public CompletionStage<Void> setAdapterDirectProxyAsync(String adapter, ObjectPrx object,
+ com.zeroc.Ice.Current current)
{
if(object != null)
{
@@ -26,13 +31,12 @@ public class ServerLocatorRegistry extends _TestLocatorRegistryDisp
{
_adapters.remove(adapter);
}
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- setReplicatedAdapterDirectProxy_async(Ice.AMD_LocatorRegistry_setReplicatedAdapterDirectProxy cb, String adapter,
- String replica, Ice.ObjectPrx object, Ice.Current current)
+ public CompletionStage<Void> setReplicatedAdapterDirectProxyAsync(String adapter, String replica,
+ ObjectPrx object, com.zeroc.Ice.Current current)
{
if(object != null)
{
@@ -44,48 +48,44 @@ public class ServerLocatorRegistry extends _TestLocatorRegistryDisp
_adapters.remove(adapter);
_adapters.remove(replica);
}
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- setServerProcessProxy_async(Ice.AMD_LocatorRegistry_setServerProcessProxy cb, String id, Ice.ProcessPrx proxy,
- Ice.Current current)
+ public CompletionStage<Void> setServerProcessProxyAsync(String id, com.zeroc.Ice.ProcessPrx proxy,
+ com.zeroc.Ice.Current current)
{
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- addObject(Ice.ObjectPrx object, Ice.Current current)
+ public void addObject(ObjectPrx object, com.zeroc.Ice.Current current)
{
_objects.put(object.ice_getIdentity(), object);
}
- public Ice.ObjectPrx
- getAdapter(String adapter)
- throws Ice.AdapterNotFoundException
+ public ObjectPrx getAdapter(String adapter)
+ throws com.zeroc.Ice.AdapterNotFoundException
{
- Ice.ObjectPrx obj = _adapters.get(adapter);
+ ObjectPrx obj = _adapters.get(adapter);
if(obj == null)
{
- throw new Ice.AdapterNotFoundException();
+ throw new com.zeroc.Ice.AdapterNotFoundException();
}
return obj;
}
- public Ice.ObjectPrx
- getObject(Ice.Identity id)
- throws Ice.ObjectNotFoundException
+ public ObjectPrx getObject(Identity id)
+ throws com.zeroc.Ice.ObjectNotFoundException
{
- Ice.ObjectPrx obj = _objects.get(id);
+ ObjectPrx obj = _objects.get(id);
if(obj == null)
{
- throw new Ice.ObjectNotFoundException();
+ throw new com.zeroc.Ice.ObjectNotFoundException();
}
return obj;
}
- private java.util.HashMap<String, Ice.ObjectPrx> _adapters = new java.util.HashMap<String, Ice.ObjectPrx>();
- private java.util.HashMap<Ice.Identity, Ice.ObjectPrx> _objects =
- new java.util.HashMap<Ice.Identity, Ice.ObjectPrx>();
+ private java.util.HashMap<String, ObjectPrx> _adapters = new java.util.HashMap<>();
+ private java.util.HashMap<Identity, ObjectPrx> _objects = new java.util.HashMap<>();
}
diff --git a/java/test/src/main/java/test/Ice/location/ServerManagerI.java b/java/test/src/main/java/test/Ice/location/ServerManagerI.java
index 293b9dcfb97..b84c2a31df8 100644
--- a/java/test/src/main/java/test/Ice/location/ServerManagerI.java
+++ b/java/test/src/main/java/test/Ice/location/ServerManagerI.java
@@ -10,15 +10,14 @@
package test.Ice.location;
-import test.Ice.location.Test._ServerManagerDisp;
+import test.Ice.location.Test.ServerManager;
-
-public class ServerManagerI extends _ServerManagerDisp
+public class ServerManagerI implements ServerManager
{
- ServerManagerI(ServerLocatorRegistry registry, Ice.InitializationData initData, test.Util.Application app)
+ ServerManagerI(ServerLocatorRegistry registry, com.zeroc.Ice.InitializationData initData, test.Util.Application app)
{
_registry = registry;
- _communicators = new java.util.ArrayList<Ice.Communicator>();
+ _communicators = new java.util.ArrayList<com.zeroc.Ice.Communicator>();
_app = app;
_initData = initData;
@@ -29,10 +28,9 @@ public class ServerManagerI extends _ServerManagerDisp
}
@Override
- public void
- startServer(Ice.Current current)
+ public void startServer(com.zeroc.Ice.Current current)
{
- for(Ice.Communicator c : _communicators)
+ for(com.zeroc.Ice.Communicator c : _communicators)
{
c.waitForShutdown();
c.destroy();
@@ -47,7 +45,7 @@ public class ServerManagerI extends _ServerManagerDisp
// its endpoints with the locator and create references containing
// the adapter id instead of the endpoints.
//
- Ice.Communicator serverCommunicator = _app.initialize(_initData);
+ com.zeroc.Ice.Communicator serverCommunicator = _app.initialize(_initData);
_communicators.add(serverCommunicator);
//
@@ -57,27 +55,26 @@ public class ServerManagerI extends _ServerManagerDisp
serverCommunicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p " + _nextPort++);
serverCommunicator.getProperties().setProperty("TestAdapter2.Endpoints", "default -p " + _nextPort++);
- Ice.ObjectAdapter adapter = serverCommunicator.createObjectAdapter("TestAdapter");
- Ice.ObjectAdapter adapter2 = serverCommunicator.createObjectAdapter("TestAdapter2");
+ com.zeroc.Ice.ObjectAdapter adapter = serverCommunicator.createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter2 = serverCommunicator.createObjectAdapter("TestAdapter2");
- Ice.ObjectPrx locator = serverCommunicator.stringToProxy("locator:default -p 12010");
- adapter.setLocator(Ice.LocatorPrxHelper.uncheckedCast(locator));
- adapter2.setLocator(Ice.LocatorPrxHelper.uncheckedCast(locator));
+ com.zeroc.Ice.ObjectPrx locator = serverCommunicator.stringToProxy("locator:default -p 12010");
+ adapter.setLocator(com.zeroc.Ice.LocatorPrx.uncheckedCast(locator));
+ adapter2.setLocator(com.zeroc.Ice.LocatorPrx.uncheckedCast(locator));
+
+ com.zeroc.Ice.Object object = new TestI(adapter, adapter2, _registry);
+ _registry.addObject(adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("test")), null);
+ _registry.addObject(adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("test2")), null);
+ adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("test3"));
- Ice.Object object = new TestI(adapter, adapter2, _registry);
- _registry.addObject(adapter.add(object, Ice.Util.stringToIdentity("test")));
- _registry.addObject(adapter.add(object, Ice.Util.stringToIdentity("test2")));
- adapter.add(object, Ice.Util.stringToIdentity("test3"));
-
adapter.activate();
adapter2.activate();
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
- for(Ice.Communicator c : _communicators)
+ for(com.zeroc.Ice.Communicator c : _communicators)
{
c.destroy();
}
@@ -85,8 +82,8 @@ public class ServerManagerI extends _ServerManagerDisp
}
private ServerLocatorRegistry _registry;
- private java.util.List<Ice.Communicator> _communicators;
- private Ice.InitializationData _initData;
+ private java.util.List<com.zeroc.Ice.Communicator> _communicators;
+ private com.zeroc.Ice.InitializationData _initData;
private test.Util.Application _app;
private int _nextPort = 12011;
}
diff --git a/java/test/src/main/java/test/Ice/location/TestI.java b/java/test/src/main/java/test/Ice/location/TestI.java
index 8f6e9eb6490..6b738645071 100644
--- a/java/test/src/main/java/test/Ice/location/TestI.java
+++ b/java/test/src/main/java/test/Ice/location/TestI.java
@@ -10,59 +10,52 @@
package test.Ice.location;
import test.Ice.location.Test.HelloPrx;
-import test.Ice.location.Test.HelloPrxHelper;
-import test.Ice.location.Test._TestIntfDisp;
+import test.Ice.location.Test.TestIntf;
-
-public class TestI extends _TestIntfDisp
+public class TestI implements TestIntf
{
- TestI(Ice.ObjectAdapter adapter1, Ice.ObjectAdapter adapter2, ServerLocatorRegistry registry)
+ TestI(com.zeroc.Ice.ObjectAdapter adapter1, com.zeroc.Ice.ObjectAdapter adapter2, ServerLocatorRegistry registry)
{
_adapter1 = adapter1;
_adapter2 = adapter2;
_registry = registry;
- _registry.addObject(_adapter1.add(new HelloI(), Ice.Util.stringToIdentity("hello")));
+ _registry.addObject(_adapter1.add(new HelloI(), com.zeroc.Ice.Util.stringToIdentity("hello")), null);
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
_adapter1.getCommunicator().shutdown();
}
@Override
- public HelloPrx
- getHello(Ice.Current current)
+ public HelloPrx getHello(com.zeroc.Ice.Current current)
{
- return HelloPrxHelper.uncheckedCast(_adapter1.createIndirectProxy(
- Ice.Util.stringToIdentity("hello")));
+ return HelloPrx.uncheckedCast(_adapter1.createIndirectProxy(com.zeroc.Ice.Util.stringToIdentity("hello")));
}
@Override
- public HelloPrx
- getReplicatedHello(Ice.Current current)
+ public HelloPrx getReplicatedHello(com.zeroc.Ice.Current current)
{
- return HelloPrxHelper.uncheckedCast(_adapter1.createProxy(Ice.Util.stringToIdentity("hello")));
+ return HelloPrx.uncheckedCast(_adapter1.createProxy(com.zeroc.Ice.Util.stringToIdentity("hello")));
}
@Override
- public void
- migrateHello(Ice.Current current)
+ public void migrateHello(com.zeroc.Ice.Current current)
{
- final Ice.Identity id = Ice.Util.stringToIdentity("hello");
+ final com.zeroc.Ice.Identity id = com.zeroc.Ice.Util.stringToIdentity("hello");
try
{
- _registry.addObject(_adapter2.add(_adapter1.remove(id), id));
+ _registry.addObject(_adapter2.add(_adapter1.remove(id), id), null);
}
- catch(Ice.NotRegisteredException ex)
+ catch(com.zeroc.Ice.NotRegisteredException ex)
{
- _registry.addObject(_adapter1.add(_adapter2.remove(id), id));
+ _registry.addObject(_adapter1.add(_adapter2.remove(id), id), null);
}
}
private ServerLocatorRegistry _registry;
- private Ice.ObjectAdapter _adapter1;
- private Ice.ObjectAdapter _adapter2;
+ private com.zeroc.Ice.ObjectAdapter _adapter1;
+ private com.zeroc.Ice.ObjectAdapter _adapter2;
}
diff --git a/java/test/src/main/java/test/Ice/metrics/AMDMetricsI.java b/java/test/src/main/java/test/Ice/metrics/AMDMetricsI.java
index 865db0c83ef..916af54b6ae 100644
--- a/java/test/src/main/java/test/Ice/metrics/AMDMetricsI.java
+++ b/java/test/src/main/java/test/Ice/metrics/AMDMetricsI.java
@@ -8,76 +8,78 @@
// **********************************************************************
package test.Ice.metrics;
+
+import java.util.concurrent.CompletionStage;
+import java.util.concurrent.CompletableFuture;
+
import test.Ice.metrics.AMD.Test.*;
-public final class AMDMetricsI extends _MetricsDisp
+public final class AMDMetricsI implements Metrics
{
- public
- AMDMetricsI()
+ public AMDMetricsI()
{
}
@Override
- public void
- op_async(AMD_Metrics_op cb, Ice.Current current)
+ public CompletionStage<Void> opAsync(com.zeroc.Ice.Current current)
{
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- fail_async(AMD_Metrics_fail cb, Ice.Current current)
+ public CompletionStage<Void> failAsync(com.zeroc.Ice.Current current)
{
current.con.close(true);
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- opWithUserException_async(AMD_Metrics_opWithUserException cb, Ice.Current current)
+ public CompletionStage<Void> opWithUserExceptionAsync(com.zeroc.Ice.Current current)
throws UserEx
{
- cb.ice_exception(new UserEx());
+ CompletableFuture<Void> r = new CompletableFuture<>();
+ r.completeExceptionally(new UserEx());
+ return r;
}
@Override
- public void
- opWithRequestFailedException_async(AMD_Metrics_opWithRequestFailedException cb, Ice.Current current)
+ public CompletionStage<Void> opWithRequestFailedExceptionAsync(com.zeroc.Ice.Current current)
{
- cb.ice_exception(new Ice.ObjectNotExistException());
+ CompletableFuture<Void> r = new CompletableFuture<>();
+ r.completeExceptionally(new com.zeroc.Ice.ObjectNotExistException());
+ return r;
}
@Override
- public void
- opWithLocalException_async(AMD_Metrics_opWithLocalException cb, Ice.Current current)
+ public CompletionStage<Void> opWithLocalExceptionAsync(com.zeroc.Ice.Current current)
{
- cb.ice_exception(new Ice.SyscallException());
+ CompletableFuture<Void> r = new CompletableFuture<>();
+ r.completeExceptionally(new com.zeroc.Ice.SyscallException());
+ return r;
}
@Override
- public void
- opWithUnknownException_async(AMD_Metrics_opWithUnknownException cb, Ice.Current current)
+ public CompletionStage<Void> opWithUnknownExceptionAsync(com.zeroc.Ice.Current current)
{
- cb.ice_exception(new IllegalArgumentException());
+ CompletableFuture<Void> r = new CompletableFuture<>();
+ r.completeExceptionally(new IllegalArgumentException());
+ return r;
}
@Override
- public void
- opByteS_async(AMD_Metrics_opByteS cb, byte[] bs, Ice.Current current)
+ public CompletionStage<Void> opByteSAsync(byte[] bs, com.zeroc.Ice.Current current)
{
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public Ice.ObjectPrx
- getAdmin(Ice.Current current)
+ public com.zeroc.Ice.ObjectPrx getAdmin(com.zeroc.Ice.Current current)
{
return current.adapter.getCommunicator().getAdmin();
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
diff --git a/java/test/src/main/java/test/Ice/metrics/AMDServer.java b/java/test/src/main/java/test/Ice/metrics/AMDServer.java
index c936ca8d989..ab1dd0d83a0 100644
--- a/java/test/src/main/java/test/Ice/metrics/AMDServer.java
+++ b/java/test/src/main/java/test/Ice/metrics/AMDServer.java
@@ -14,32 +14,31 @@ public class AMDServer extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- adapter.add(new AMDMetricsI(), Ice.Util.stringToIdentity("metrics"));
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new AMDMetricsI(), com.zeroc.Ice.Util.stringToIdentity("metrics"));
adapter.activate();
communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011");
- Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter");
- controllerAdapter.add(new ControllerI(adapter), Ice.Util.stringToIdentity("controller"));
+ com.zeroc.Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter");
+ controllerAdapter.add(new ControllerI(adapter), com.zeroc.Ice.Util.stringToIdentity("controller"));
controllerAdapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- initData.properties.setProperty("Ice.Admin.Endpoints", "tcp");
- initData.properties.setProperty("Ice.Admin.InstanceName", "server");
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- initData.properties.setProperty("Ice.MessageSizeMax", "50000");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ r.initData.properties.setProperty("Ice.Admin.Endpoints", "tcp");
+ r.initData.properties.setProperty("Ice.Admin.InstanceName", "server");
+ r.initData.properties.setProperty("Ice.Warn.Connections", "0");
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ r.initData.properties.setProperty("Ice.MessageSizeMax", "50000");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/metrics/AllTests.java b/java/test/src/main/java/test/Ice/metrics/AllTests.java
index 063b066597f..154de71dfd7 100644
--- a/java/test/src/main/java/test/Ice/metrics/AllTests.java
+++ b/java/test/src/main/java/test/Ice/metrics/AllTests.java
@@ -11,13 +11,16 @@ package test.Ice.metrics;
import java.io.PrintWriter;
import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
+
+import com.zeroc.IceMX.*;
import test.Ice.metrics.Test.*;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -25,14 +28,13 @@ public class AllTests
}
}
- static IceMX.ConnectionMetrics
- getServerConnectionMetrics(IceMX.MetricsAdminPrx metrics, long expected)
+ static ConnectionMetrics getServerConnectionMetrics(MetricsAdminPrx metrics, long expected)
{
try
{
- IceMX.ConnectionMetrics s;
- Ice.LongHolder timestamp = new Ice.LongHolder();
- s = (IceMX.ConnectionMetrics)metrics.getMetricsView("View", timestamp).get("Connection")[0];
+ ConnectionMetrics s;
+ MetricsAdmin.GetMetricsViewResult r = metrics.getMetricsView("View");
+ s = (ConnectionMetrics)r.returnValue.get("Connection")[0];
int nRetry = 30;
while(s.sentBytes != expected && nRetry-- > 0)
{
@@ -47,11 +49,12 @@ public class AllTests
catch(InterruptedException ex)
{
}
- s = (IceMX.ConnectionMetrics)metrics.getMetricsView("View", timestamp).get("Connection")[0];
+ r = metrics.getMetricsView("View");
+ s = (ConnectionMetrics)r.returnValue.get("Connection")[0];
}
return s;
}
- catch(IceMX.UnknownMetricsView ex)
+ catch(UnknownMetricsView ex)
{
assert(false);
return null;
@@ -79,15 +82,14 @@ public class AllTests
}
}
- static class Callback extends Ice.Callback
+ static class Callback
{
public Callback()
{
_wait = true;
}
- @Override
- synchronized public void completed(Ice.AsyncResult result)
+ synchronized public void completed()
{
_wait = false;
notify();
@@ -109,10 +111,10 @@ public class AllTests
}
private boolean _wait;
- };
+ }
- static private Map<String, String>
- getClientProps(Ice.PropertiesAdminPrx p, Map<String, String> orig, String m)
+ static private Map<String, String> getClientProps(com.zeroc.Ice.PropertiesAdminPrx p, Map<String, String> orig,
+ String m)
{
Map<String, String> props = p.getPropertiesForPrefix("IceMX.Metrics");
for(Map.Entry<String, String> e : props.entrySet())
@@ -134,8 +136,8 @@ public class AllTests
return props;
}
- static private Map<String, String>
- getServerProps(Ice.PropertiesAdminPrx p, Map<String, String> orig , String m)
+ static private Map<String, String> getServerProps(com.zeroc.Ice.PropertiesAdminPrx p, Map<String, String> orig,
+ String m)
{
Map<String, String> props = p.getPropertiesForPrefix("IceMX.Metrics");
for(Map.Entry<String, String> e : props.entrySet())
@@ -156,17 +158,15 @@ public class AllTests
return props;
}
- static void
- waitForCurrent(IceMX.MetricsAdminPrx metrics, String viewName, String map, int value)
- throws IceMX.UnknownMetricsView
+ static void waitForCurrent(MetricsAdminPrx metrics, String viewName, String map, int value)
+ throws UnknownMetricsView
{
while(true)
{
- Ice.LongHolder timestamp = new Ice.LongHolder();
- Map<String, IceMX.Metrics[]> view = metrics.getMetricsView(viewName, timestamp);
- test(view.containsKey(map));
+ MetricsAdmin.GetMetricsViewResult r = metrics.getMetricsView(viewName);
+ test(r.returnValue.containsKey(map));
boolean ok = true;
- for(IceMX.Metrics m : view.get(map))
+ for(com.zeroc.IceMX.Metrics m : r.returnValue.get(map))
{
if(m.current != value)
{
@@ -188,17 +188,16 @@ public class AllTests
}
}
- static void
- testAttribute(IceMX.MetricsAdminPrx metrics,
- Ice.PropertiesAdminPrx props,
- String map,
- String attr,
- String value,
- Runnable func,
- PrintWriter out)
- throws IceMX.UnknownMetricsView
+ static void testAttribute(MetricsAdminPrx metrics,
+ com.zeroc.Ice.PropertiesAdminPrx props,
+ String map,
+ String attr,
+ String value,
+ Runnable func,
+ PrintWriter out)
+ throws UnknownMetricsView
{
- Map<String, String> dict = new java.util.HashMap<String, String>();
+ Map<String, String> dict = new java.util.HashMap<>();
dict.put("IceMX.Metrics.View.Map." + map + ".GroupBy", attr);
if(props.ice_getIdentity().category.equals("client"))
{
@@ -210,9 +209,8 @@ public class AllTests
}
func.run();
- Ice.LongHolder timestamp = new Ice.LongHolder();
- Map<String, IceMX.Metrics[]> view = metrics.getMetricsView("View", timestamp);
- if(!view.containsKey(map) || view.get(map).length == 0)
+ MetricsAdmin.GetMetricsViewResult r = metrics.getMetricsView("View");
+ if(!r.returnValue.containsKey(map) || r.returnValue.get(map).length == 0)
{
if(!value.isEmpty())
{
@@ -220,9 +218,9 @@ public class AllTests
test(false);
}
}
- else if(!view.get(map)[0].id.equals(value))
+ else if(!r.returnValue.get(map)[0].id.equals(value))
{
- out.println("invalid attribute value: " + attr + " = " + value + " got " + view.get(map)[0].id);
+ out.println("invalid attribute value: " + attr + " = " + value + " got " + r.returnValue.get(map)[0].id);
test(false);
}
@@ -237,17 +235,17 @@ public class AllTests
}
}
- static class Void implements Runnable
+ static class Noop implements Runnable
{
@Override
public void run()
{
}
- };
+ }
static class Connect implements Runnable
{
- public Connect(Ice.ObjectPrx proxy)
+ public Connect(com.zeroc.Ice.ObjectPrx proxy)
{
this.proxy = proxy;
}
@@ -264,7 +262,7 @@ public class AllTests
{
proxy.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
@@ -274,8 +272,8 @@ public class AllTests
}
}
- final private Ice.ObjectPrx proxy;
- };
+ final private com.zeroc.Ice.ObjectPrx proxy;
+ }
static class InvokeOp implements Runnable
{
@@ -287,32 +285,30 @@ public class AllTests
@Override
public void run()
{
- Map<String, String> ctx = new java.util.HashMap<String, String>();
+ Map<String, String> ctx = new java.util.HashMap<>();
ctx.put("entry1", "test");
ctx.put("entry2", "");
proxy.op(ctx);
}
final private MetricsPrx proxy;
- };
-
- static void
- testAttribute(IceMX.MetricsAdminPrx metrics,
- Ice.PropertiesAdminPrx props,
- String map,
- String attr,
- String value,
- PrintWriter out)
- throws IceMX.UnknownMetricsView
+ }
+
+ static void testAttribute(MetricsAdminPrx metrics,
+ com.zeroc.Ice.PropertiesAdminPrx props,
+ String map,
+ String attr,
+ String value,
+ PrintWriter out)
+ throws UnknownMetricsView
{
- testAttribute(metrics, props, map, attr, value, new Void(), out);
+ testAttribute(metrics, props, map, attr, value, new Noop(), out);
}
- static void
- updateProps(Ice.PropertiesAdminPrx cprops,
- Ice.PropertiesAdminPrx sprops,
- Map<String, String> props,
- String map)
+ static void updateProps(com.zeroc.Ice.PropertiesAdminPrx cprops,
+ com.zeroc.Ice.PropertiesAdminPrx sprops,
+ Map<String, String> props,
+ String map)
{
if(sprops.ice_getConnection() != null)
{
@@ -328,8 +324,7 @@ public class AllTests
}
}
- static void
- clearView(Ice.PropertiesAdminPrx cprops, Ice.PropertiesAdminPrx sprops)
+ static void clearView(com.zeroc.Ice.PropertiesAdminPrx cprops, com.zeroc.Ice.PropertiesAdminPrx sprops)
{
Map<String, String> dict;
@@ -350,11 +345,10 @@ public class AllTests
sprops.setProperties(dict);
}
- static void
- checkFailure(IceMX.MetricsAdminPrx m, String map, String id, String failure, int count, PrintWriter out)
- throws IceMX.UnknownMetricsView
+ static void checkFailure(MetricsAdminPrx m, String map, String id, String failure, int count, PrintWriter out)
+ throws UnknownMetricsView
{
- IceMX.MetricsFailures f = m.getMetricsFailures("View", map, id);
+ MetricsFailures f = m.getMetricsFailures("View", map, id);
if(!f.failures.containsKey(failure))
{
out.println("couldn't find failure `" + failure + "' for `" + id + "'");
@@ -368,22 +362,20 @@ public class AllTests
}
}
- static Map<String, IceMX.Metrics>
- toMap(IceMX.Metrics[] mmap)
+ static Map<String, com.zeroc.IceMX.Metrics> toMap(com.zeroc.IceMX.Metrics[] mmap)
{
- Map<String, IceMX.Metrics> m = new java.util.HashMap<String, IceMX.Metrics>();
- for(IceMX.Metrics e : mmap)
+ Map<String, com.zeroc.IceMX.Metrics> m = new java.util.HashMap<>();
+ for(com.zeroc.IceMX.Metrics e : mmap)
{
m.put(e.id, e);
}
return m;
}
- static MetricsPrx
- allTests(Ice.Communicator communicator, PrintWriter out, CommunicatorObserverI obsv)
- throws IceMX.UnknownMetricsView
+ static MetricsPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out, CommunicatorObserverI obsv)
+ throws UnknownMetricsView
{
- MetricsPrx metrics = MetricsPrxHelper.checkedCast(communicator.stringToProxy("metrics:default -p 12010"));
+ MetricsPrx metrics = MetricsPrx.checkedCast(communicator.stringToProxy("metrics:default -p 12010"));
boolean collocated = metrics.ice_getConnection() == null;
int threadCount = 4;
@@ -394,34 +386,35 @@ public class AllTests
out.print("testing metrics admin facet checkedCast... ");
out.flush();
- Ice.ObjectPrx admin = communicator.getAdmin();
- Ice.PropertiesAdminPrx clientProps = Ice.PropertiesAdminPrxHelper.checkedCast(admin, "Properties");
- IceMX.MetricsAdminPrx clientMetrics = IceMX.MetricsAdminPrxHelper.checkedCast(admin, "Metrics");
+ com.zeroc.Ice.ObjectPrx admin = communicator.getAdmin();
+ com.zeroc.Ice.PropertiesAdminPrx clientProps =
+ com.zeroc.Ice.PropertiesAdminPrx.checkedCast(admin, "Properties");
+ MetricsAdminPrx clientMetrics = MetricsAdminPrx.checkedCast(admin, "Metrics");
test(clientProps != null && clientMetrics != null);
admin = metrics.getAdmin();
- Ice.PropertiesAdminPrx serverProps = Ice.PropertiesAdminPrxHelper.checkedCast(admin, "Properties");
- IceMX.MetricsAdminPrx serverMetrics = IceMX.MetricsAdminPrxHelper.checkedCast(admin, "Metrics");
+ com.zeroc.Ice.PropertiesAdminPrx serverProps =
+ com.zeroc.Ice.PropertiesAdminPrx.checkedCast(admin, "Properties");
+ MetricsAdminPrx serverMetrics = MetricsAdminPrx.checkedCast(admin, "Metrics");
test(serverProps != null && serverMetrics != null);
out.println("ok");
- Map<String, String> props = new java.util.HashMap<String, String>();
+ Map<String, String> props = new java.util.HashMap<>();
out.print("testing group by none...");
out.flush();
props.put("IceMX.Metrics.View.GroupBy", "none");
updateProps(clientProps, serverProps, props, "");
- Ice.LongHolder timestamp = new Ice.LongHolder();
- Map<String, IceMX.Metrics[]> view = clientMetrics.getMetricsView("View", timestamp);
+ MetricsAdmin.GetMetricsViewResult r = clientMetrics.getMetricsView("View");
if(!collocated)
{
- test(view.get("Connection").length == 1 && view.get("Connection")[0].current == 1 &&
- view.get("Connection")[0].total == 1);
+ test(r.returnValue.get("Connection").length == 1 && r.returnValue.get("Connection")[0].current == 1 &&
+ r.returnValue.get("Connection")[0].total == 1);
}
- test(view.get("Thread").length == 1 && view.get("Thread")[0].current == threadCount &&
- view.get("Thread")[0].total == threadCount);
+ test(r.returnValue.get("Thread").length == 1 && r.returnValue.get("Thread")[0].current == threadCount &&
+ r.returnValue.get("Thread")[0].total == threadCount);
out.println("ok");
out.print("testing group by id...");
@@ -438,15 +431,15 @@ public class AllTests
waitForCurrent(clientMetrics, "View", "Invocation", 0);
- view = clientMetrics.getMetricsView("View", timestamp);
- test(view.get("Thread").length == threadCount);
+ r = clientMetrics.getMetricsView("View");
+ test(r.returnValue.get("Thread").length == threadCount);
if(!collocated)
{
- test(view.get("Connection").length == 2);
+ test(r.returnValue.get("Connection").length == 2);
}
- test(view.get("Invocation").length == 1);
+ test(r.returnValue.get("Invocation").length == 1);
- IceMX.InvocationMetrics invoke = (IceMX.InvocationMetrics)view.get("Invocation")[0];
+ InvocationMetrics invoke = (InvocationMetrics)r.returnValue.get("Invocation")[0];
test(invoke.id.indexOf("[ice_ping]") > 0 && invoke.current == 0 && invoke.total == 5);
if(!collocated)
{
@@ -459,15 +452,15 @@ public class AllTests
test(invoke.collocated.length == 1);
test(invoke.collocated[0].total == 5);
}
- view = serverMetrics.getMetricsView("View", timestamp);
+ r = serverMetrics.getMetricsView("View");
if(!collocated)
{
- test(view.get("Thread").length > 3);
- test(view.get("Connection").length == 2);
+ test(r.returnValue.get("Thread").length > 3);
+ test(r.returnValue.get("Connection").length == 2);
}
- test(view.get("Dispatch").length == 1);
- test(view.get("Dispatch")[0].current <= 1 && view.get("Dispatch")[0].total == 5);
- test(view.get("Dispatch")[0].id.indexOf("[ice_ping]") > 0);
+ test(r.returnValue.get("Dispatch").length == 1);
+ test(r.returnValue.get("Dispatch")[0].current <= 1 && r.returnValue.get("Dispatch")[0].total == 5);
+ test(r.returnValue.get("Dispatch")[0].id.indexOf("[ice_ping]") > 0);
if(!collocated)
{
@@ -487,12 +480,12 @@ public class AllTests
String isSecure = "";
if(!collocated)
{
- Ice.EndpointInfo endpointInfo = metrics.ice_getConnection().getEndpoint().getInfo();
+ com.zeroc.Ice.EndpointInfo endpointInfo = metrics.ice_getConnection().getEndpoint().getInfo();
type = Short.toString(endpointInfo.type());
isSecure = endpointInfo.secure() ? "true": "false";
}
- Map<String, IceMX.Metrics> map;
+ Map<String, com.zeroc.IceMX.Metrics> map;
if(!collocated)
{
@@ -502,19 +495,19 @@ public class AllTests
props.put("IceMX.Metrics.View.Map.Connection.GroupBy", "none");
updateProps(clientProps, serverProps, props, "Connection");
- test(clientMetrics.getMetricsView("View", timestamp).get("Connection").length == 0);
- test(serverMetrics.getMetricsView("View", timestamp).get("Connection").length == 0);
+ test(clientMetrics.getMetricsView("View").returnValue.get("Connection").length == 0);
+ test(serverMetrics.getMetricsView("View").returnValue.get("Connection").length == 0);
metrics.ice_ping();
- IceMX.ConnectionMetrics cm1, sm1, cm2, sm2;
- cm1 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
+ ConnectionMetrics cm1, sm1, cm2, sm2;
+ cm1 = (ConnectionMetrics)clientMetrics.getMetricsView("View").returnValue.get("Connection")[0];
sm1 = getServerConnectionMetrics(serverMetrics, 25);
test(cm1.total == 1 && sm1.total == 1);
metrics.ice_ping();
- cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
+ cm2 = (ConnectionMetrics)clientMetrics.getMetricsView("View").returnValue.get("Connection")[0];
sm2 = getServerConnectionMetrics(serverMetrics, 50);
test(cm2.sentBytes - cm1.sentBytes == 45); // 45 for ice_ping request
@@ -528,7 +521,7 @@ public class AllTests
byte[] bs = new byte[0];
metrics.opByteS(bs);
- cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
+ cm2 = (ConnectionMetrics)clientMetrics.getMetricsView("View").returnValue.get("Connection")[0];
sm2 = getServerConnectionMetrics(serverMetrics, sm1.sentBytes + cm2.receivedBytes - cm1.receivedBytes);
long requestSz = cm2.sentBytes - cm1.sentBytes;
long replySz = cm2.receivedBytes - cm1.receivedBytes;
@@ -539,7 +532,7 @@ public class AllTests
bs = new byte[456];
metrics.opByteS(bs);
- cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
+ cm2 = (ConnectionMetrics)clientMetrics.getMetricsView("View").returnValue.get("Connection")[0];
sm2 = getServerConnectionMetrics(serverMetrics, sm1.sentBytes + replySz);
test(cm2.sentBytes - cm1.sentBytes == requestSz + bs.length + 4); // 4 is for the seq variable size
@@ -553,7 +546,7 @@ public class AllTests
bs = new byte[1024 * 1024 * 10]; // Try with large amount of data which should be sent in several chunks
metrics.opByteS(bs);
- cm2 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
+ cm2 = (ConnectionMetrics)clientMetrics.getMetricsView("View").returnValue.get("Connection")[0];
sm2 = getServerConnectionMetrics(serverMetrics, sm1.sentBytes + replySz);
test((cm2.sentBytes - cm1.sentBytes) == (requestSz + bs.length + 4)); // 4 is for the seq variable size
@@ -564,29 +557,29 @@ public class AllTests
props.put("IceMX.Metrics.View.Map.Connection.GroupBy", "state");
updateProps(clientProps, serverProps, props, "Connection");
- map = toMap(serverMetrics.getMetricsView("View", timestamp).get("Connection"));
+ map = toMap(serverMetrics.getMetricsView("View").returnValue.get("Connection"));
test(map.get("active").current == 1);
- ControllerPrx controller = ControllerPrxHelper.checkedCast(
+ ControllerPrx controller = ControllerPrx.checkedCast(
communicator.stringToProxy("controller:default -p 12011"));
controller.hold();
- map = toMap(clientMetrics.getMetricsView("View", timestamp).get("Connection"));
+ map = toMap(clientMetrics.getMetricsView("View").returnValue.get("Connection"));
test(map.get("active").current == 1);
- map = toMap(serverMetrics.getMetricsView("View", timestamp).get("Connection"));
+ map = toMap(serverMetrics.getMetricsView("View").returnValue.get("Connection"));
test(map.get("holding").current == 1);
metrics.ice_getConnection().close(false);
- map = toMap(clientMetrics.getMetricsView("View", timestamp).get("Connection"));
+ map = toMap(clientMetrics.getMetricsView("View").returnValue.get("Connection"));
test(map.get("closing").current == 1);
- map = toMap(serverMetrics.getMetricsView("View", timestamp).get("Connection"));
+ map = toMap(serverMetrics.getMetricsView("View").returnValue.get("Connection"));
test(map.get("holding").current == 1);
controller.resume();
- map = toMap(serverMetrics.getMetricsView("View", timestamp).get("Connection"));
+ map = toMap(serverMetrics.getMetricsView("View").returnValue.get("Connection"));
test(map.get("holding").current == 0);
props.put("IceMX.Metrics.View.Map.Connection.GroupBy", "none");
@@ -598,18 +591,18 @@ public class AllTests
controller.hold();
try
{
- ((MetricsPrx)metrics.ice_timeout(500)).opByteS(new byte[10000000]);
+ metrics.ice_timeout(500).opByteS(new byte[10000000]);
test(false);
}
- catch(Ice.TimeoutException ex)
+ catch(com.zeroc.Ice.TimeoutException ex)
{
}
controller.resume();
- cm1 = (IceMX.ConnectionMetrics)clientMetrics.getMetricsView("View", timestamp).get("Connection")[0];
+ cm1 = (ConnectionMetrics)clientMetrics.getMetricsView("View").returnValue.get("Connection")[0];
while(true)
{
- sm1 = (IceMX.ConnectionMetrics)serverMetrics.getMetricsView("View", timestamp).get("Connection")[0];
+ sm1 = (ConnectionMetrics)serverMetrics.getMetricsView("View").returnValue.get("Connection")[0];
if(sm1.failures >= 2)
{
break;
@@ -628,7 +621,7 @@ public class AllTests
checkFailure(clientMetrics, "Connection", cm1.id, "::Ice::ConnectTimeoutException", 1, out);
checkFailure(serverMetrics, "Connection", sm1.id, "::Ice::ConnectionLostException", 0, out);
- MetricsPrx m = (MetricsPrx)metrics.ice_timeout(500).ice_connectionId("Con1");
+ MetricsPrx m = metrics.ice_timeout(500).ice_connectionId("Con1");
m.ice_ping();
testAttribute(clientMetrics, clientProps, "Connection", "parent", "Communicator", out);
@@ -666,12 +659,13 @@ public class AllTests
props.put("IceMX.Metrics.View.Map.ConnectionEstablishment.GroupBy", "id");
updateProps(clientProps, serverProps, props, "ConnectionEstablishment");
- test(clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment").length == 0);
+ test(clientMetrics.getMetricsView("View").returnValue.get("ConnectionEstablishment").length == 0);
metrics.ice_ping();
- test(clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment").length == 1);
- IceMX.Metrics m1 = clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment")[0];
+ test(clientMetrics.getMetricsView("View").returnValue.get("ConnectionEstablishment").length == 1);
+ com.zeroc.IceMX.Metrics m1 =
+ clientMetrics.getMetricsView("View").returnValue.get("ConnectionEstablishment")[0];
test(m1.current == 0 && m1.total == 1 && m1.id.equals("127.0.0.1:12010"));
metrics.ice_getConnection().close(false);
@@ -681,16 +675,16 @@ public class AllTests
communicator.stringToProxy("test:tcp -p 12010 -h 127.0.0.1").ice_timeout(10).ice_ping();
test(false);
}
- catch(Ice.ConnectTimeoutException ex)
+ catch(com.zeroc.Ice.ConnectTimeoutException ex)
{
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
controller.resume();
- test(clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment").length == 1);
- m1 = clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment")[0];
+ test(clientMetrics.getMetricsView("View").returnValue.get("ConnectionEstablishment").length == 1);
+ m1 = clientMetrics.getMetricsView("View").returnValue.get("ConnectionEstablishment")[0];
test(m1.id.equals("127.0.0.1:12010") && m1.total == 3 && m1.failures == 2);
checkFailure(clientMetrics, "ConnectionEstablishment", m1.id, "::Ice::ConnectTimeoutException", 2, out);
@@ -724,13 +718,14 @@ public class AllTests
props.put("IceMX.Metrics.View.Map.ConnectionEstablishment.GroupBy", "id");
updateProps(clientProps, serverProps, props, "EndpointLookup");
- test(clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup").length == 0);
+ test(clientMetrics.getMetricsView("View").returnValue.get("EndpointLookup").length == 0);
- Ice.ObjectPrx prx = communicator.stringToProxy("metrics:default -p 12010 -h localhost -t infinite");
+ com.zeroc.Ice.ObjectPrx prx =
+ communicator.stringToProxy("metrics:default -p 12010 -h localhost -t infinite");
prx.ice_ping();
- test(clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup").length == 1);
- m1 = clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup")[0];
+ test(clientMetrics.getMetricsView("View").returnValue.get("EndpointLookup").length == 1);
+ m1 = clientMetrics.getMetricsView("View").returnValue.get("EndpointLookup")[0];
test(m1.current <= 1 && m1.total == 1 && m1.id.equals(prx.ice_getConnection().getEndpoint().toString()));
prx.ice_getConnection().close(false);
@@ -741,19 +736,19 @@ public class AllTests
communicator.stringToProxy("test:tcp -t 500 -p 12010 -h unknownfoo.zeroc.com").ice_ping();
test(false);
}
- catch(Ice.DNSException ex)
+ catch(com.zeroc.Ice.DNSException ex)
{
dnsException = true;
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
// Some DNS servers don't fail on unknown DNS names.
}
- test(clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup").length == 2);
- m1 = clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup")[0];
+ test(clientMetrics.getMetricsView("View").returnValue.get("EndpointLookup").length == 2);
+ m1 = clientMetrics.getMetricsView("View").returnValue.get("EndpointLookup")[0];
if(!m1.id.equals("tcp -h unknownfoo.zeroc.com -p 12010 -t 500"))
{
- m1 = clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup")[1];
+ m1 = clientMetrics.getMetricsView("View").returnValue.get("EndpointLookup")[1];
}
test(m1.id.equals("tcp -h unknownfoo.zeroc.com -p 12010 -t 500") && m1.total == 2 &&
(!dnsException || m1.failures == 2));
@@ -786,7 +781,7 @@ public class AllTests
props.put("IceMX.Metrics.View.Map.Dispatch.GroupBy", "operation");
updateProps(clientProps, serverProps, props, "Dispatch");
- test(serverMetrics.getMetricsView("View", timestamp).get("Dispatch").length == 0);
+ test(serverMetrics.getMetricsView("View").returnValue.get("Dispatch").length == 0);
metrics.op();
try
@@ -802,7 +797,7 @@ public class AllTests
metrics.opWithRequestFailedException();
test(false);
}
- catch(Ice.RequestFailedException ex)
+ catch(com.zeroc.Ice.RequestFailedException ex)
{
}
try
@@ -810,7 +805,7 @@ public class AllTests
metrics.opWithLocalException();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
try
@@ -818,7 +813,7 @@ public class AllTests
metrics.opWithUnknownException();
test(false);
}
- catch(Ice.UnknownException ex)
+ catch(com.zeroc.Ice.UnknownException ex)
{
}
if(!collocated)
@@ -828,32 +823,32 @@ public class AllTests
metrics.fail();
test(false);
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
}
}
- map = toMap(serverMetrics.getMetricsView("View", timestamp).get("Dispatch"));
+ map = toMap(serverMetrics.getMetricsView("View").returnValue.get("Dispatch"));
test(map.size() == (!collocated ? 6 : 5));
- IceMX.DispatchMetrics dm1 = (IceMX.DispatchMetrics)map.get("op");
+ DispatchMetrics dm1 = (DispatchMetrics)map.get("op");
test(dm1.current <= 1 && dm1.total == 1 && dm1.failures == 0 && dm1.userException == 0);
test(dm1.size == 21 && dm1.replySize == 7);
- dm1 = (IceMX.DispatchMetrics)map.get("opWithUserException");
+ dm1 = (DispatchMetrics)map.get("opWithUserException");
test(dm1.current <= 1 &dm1.total == 1 && dm1.failures == 0 && dm1.userException == 1);
test(dm1.size == 38 && dm1.replySize == 23);
- dm1 = (IceMX.DispatchMetrics)map.get("opWithLocalException");
+ dm1 = (DispatchMetrics)map.get("opWithLocalException");
test(dm1.current <= 1 && dm1.total == 1 && dm1.failures == 1 && dm1.userException == 0);
checkFailure(serverMetrics, "Dispatch", dm1.id, "::Ice::SyscallException", 1, out);
test(dm1.size == 39 && dm1.replySize > 7); // Reply contains the exception stack depending on the OS.
- dm1 = (IceMX.DispatchMetrics)map.get("opWithRequestFailedException");
+ dm1 = (DispatchMetrics)map.get("opWithRequestFailedException");
test(dm1.current <= 1 && dm1.total == 1 && dm1.failures == 1 && dm1.userException == 0);
checkFailure(serverMetrics, "Dispatch", dm1.id, "::Ice::ObjectNotExistException", 1, out);
test(dm1.size == 47 && dm1.replySize == 40);
- dm1 = (IceMX.DispatchMetrics)map.get("opWithUnknownException");
+ dm1 = (DispatchMetrics)map.get("opWithUnknownException");
test(dm1.current <= 1 && dm1.total == 1 && dm1.failures == 1 && dm1.userException == 0);
checkFailure(serverMetrics, "Dispatch", dm1.id, "java.lang.IllegalArgumentException", 1, out);
test(dm1.size == 41 && dm1.replySize > 7); // Reply contains the exception stack depending on the OS.
@@ -905,7 +900,7 @@ public class AllTests
props.put("IceMX.Metrics.View.Map.Invocation.Map.Remote.GroupBy", "localPort");
props.put("IceMX.Metrics.View.Map.Invocation.Map.Collocated.GroupBy", "id");
updateProps(clientProps, serverProps, props, "Invocation");
- test(serverMetrics.getMetricsView("View", timestamp).get("Invocation").length == 0);
+ test(serverMetrics.getMetricsView("View").returnValue.get("Invocation").length == 0);
Callback cb = new Callback();
@@ -913,8 +908,11 @@ public class AllTests
// Twoway tests
//
metrics.op();
- metrics.end_op(metrics.begin_op());
- metrics.begin_op(cb);
+ metrics.opAsync().join();
+ metrics.opAsync().whenComplete((response, ex) ->
+ {
+ cb.completed();
+ });
cb.waitForResponse();
try
@@ -927,13 +925,17 @@ public class AllTests
}
try
{
- metrics.end_opWithUserException(metrics.begin_opWithUserException());
+ metrics.opWithUserExceptionAsync().join();
test(false);
}
- catch(UserEx ex)
+ catch(CompletionException ex)
{
+ test(ex.getCause() instanceof UserEx);
}
- metrics.begin_opWithUserException(cb);
+ metrics.opWithUserExceptionAsync().whenComplete((response, ex) ->
+ {
+ cb.completed();
+ });
cb.waitForResponse();
try
@@ -941,18 +943,22 @@ public class AllTests
metrics.opWithRequestFailedException();
test(false);
}
- catch(Ice.RequestFailedException ex)
+ catch(com.zeroc.Ice.RequestFailedException ex)
{
}
try
{
- metrics.end_opWithRequestFailedException(metrics.begin_opWithRequestFailedException());
+ metrics.opWithRequestFailedExceptionAsync().join();
test(false);
}
- catch(Ice.RequestFailedException ex)
+ catch(CompletionException ex)
{
+ test(ex.getCause() instanceof com.zeroc.Ice.RequestFailedException);
}
- metrics.begin_opWithRequestFailedException(cb);
+ metrics.opWithRequestFailedExceptionAsync().whenComplete((result, ex) ->
+ {
+ cb.completed();
+ });
cb.waitForResponse();
try
@@ -960,18 +966,22 @@ public class AllTests
metrics.opWithLocalException();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
try
{
- metrics.end_opWithLocalException(metrics.begin_opWithLocalException());
+ metrics.opWithLocalExceptionAsync().join();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(CompletionException ex)
{
+ test(ex.getCause() instanceof com.zeroc.Ice.LocalException);
}
- metrics.begin_opWithLocalException(cb);
+ metrics.opWithLocalExceptionAsync().whenComplete((result, ex) ->
+ {
+ cb.completed();
+ });
cb.waitForResponse();
try
@@ -979,18 +989,22 @@ public class AllTests
metrics.opWithUnknownException();
test(false);
}
- catch(Ice.UnknownException ex)
+ catch(com.zeroc.Ice.UnknownException ex)
{
}
try
{
- metrics.end_opWithUnknownException(metrics.begin_opWithUnknownException());
+ metrics.opWithUnknownExceptionAsync().join();
test(false);
}
- catch(Ice.UnknownException ex)
+ catch(CompletionException ex)
{
+ test(ex.getCause() instanceof com.zeroc.Ice.UnknownException);
}
- metrics.begin_opWithUnknownException(cb);
+ metrics.opWithUnknownExceptionAsync().whenComplete((result, ex) ->
+ {
+ cb.completed();
+ });
cb.waitForResponse();
if(!collocated)
@@ -1000,68 +1014,72 @@ public class AllTests
metrics.fail();
test(false);
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
}
try
{
- metrics.end_fail(metrics.begin_fail());
+ metrics.failAsync().join();
test(false);
}
- catch(Ice.ConnectionLostException ex)
+ catch(CompletionException ex)
{
+ test(ex.getCause() instanceof com.zeroc.Ice.ConnectionLostException);
}
- metrics.begin_fail(cb);
+ metrics.failAsync().whenComplete((result, ex) ->
+ {
+ cb.completed();
+ });
cb.waitForResponse();
}
- map = toMap(clientMetrics.getMetricsView("View", timestamp).get("Invocation"));
+ map = toMap(clientMetrics.getMetricsView("View").returnValue.get("Invocation"));
test(map.size() == (!collocated ? 6 : 5));
- IceMX.InvocationMetrics im1;
- IceMX.ChildInvocationMetrics rim1;
- im1 = (IceMX.InvocationMetrics)map.get("op");
+ InvocationMetrics im1;
+ ChildInvocationMetrics rim1;
+ im1 = (InvocationMetrics)map.get("op");
test(im1.current <= 1 && im1.total == 3 && im1.failures == 0 && im1.retry == 0);
test(!collocated ? im1.remotes.length == 1 : im1.collocated.length == 1);
- rim1 = (IceMX.ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
+ rim1 = (ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
test(rim1.current == 0 && rim1.total == 3 && rim1.failures == 0);
test(rim1.size == 63 && rim1.replySize == 21);
- im1 = (IceMX.InvocationMetrics)map.get("opWithUserException");
+ im1 = (InvocationMetrics)map.get("opWithUserException");
test(im1.current == 0 && im1.total == 3 && im1.failures == 0 && im1.retry == 0);
test(!collocated ? im1.remotes.length == 1 : im1.collocated.length == 1);
- rim1 = (IceMX.ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
+ rim1 = (ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
test(rim1.current == 0 && rim1.total == 3 && rim1.failures == 0);
test(rim1.size == 114 && rim1.replySize == 69);
test(im1.userException == 3);
- im1 = (IceMX.InvocationMetrics)map.get("opWithLocalException");
+ im1 = (InvocationMetrics)map.get("opWithLocalException");
test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 0);
test(!collocated ? im1.remotes.length == 1 : im1.collocated.length == 1);
- rim1 = (IceMX.ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
+ rim1 = (ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
test(rim1.current == 0 && rim1.total == 3 && rim1.failures == 0);
test(rim1.size == 117 && rim1.replySize > 7);
checkFailure(clientMetrics, "Invocation", im1.id, "::Ice::UnknownLocalException", 3, out);
- im1 = (IceMX.InvocationMetrics)map.get("opWithRequestFailedException");
+ im1 = (InvocationMetrics)map.get("opWithRequestFailedException");
test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 0);
test(!collocated ? im1.remotes.length == 1 : im1.collocated.length == 1);
- rim1 = (IceMX.ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
+ rim1 = (ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
test(rim1.current == 0 && rim1.total == 3 && rim1.failures == 0);
test(rim1.size == 141 && rim1.replySize == 120);
checkFailure(clientMetrics, "Invocation", im1.id, "::Ice::ObjectNotExistException", 3, out);
- im1 = (IceMX.InvocationMetrics)map.get("opWithUnknownException");
+ im1 = (InvocationMetrics)map.get("opWithUnknownException");
test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 0);
test(!collocated ? im1.remotes.length == 1 : im1.collocated.length == 1);
- rim1 = (IceMX.ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
+ rim1 = (ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
test(rim1.current == 0 && rim1.total == 3 && rim1.failures == 0);
test(rim1.size == 123 && rim1.replySize > 7);
checkFailure(clientMetrics, "Invocation", im1.id, "::Ice::UnknownException", 3, out);
if(!collocated)
{
- im1 = (IceMX.InvocationMetrics)map.get("fail");
+ im1 = (InvocationMetrics)map.get("fail");
test(im1.current <= 1 && im1.total == 3 && im1.failures == 3 && im1.retry == 3 && im1.remotes.length == 6);
test(im1.remotes[0].current == 0 && im1.remotes[0].total == 1 && im1.remotes[0].failures == 1);
test(im1.remotes[1].current == 0 && im1.remotes[1].total == 1 && im1.remotes[1].failures == 1);
@@ -1095,18 +1113,21 @@ public class AllTests
props.put("IceMX.Metrics.View.Map.Invocation.Map.Remote.GroupBy", "localPort");
updateProps(clientProps, serverProps, props, "Invocation");
- MetricsPrx metricsOneway = (MetricsPrx)metrics.ice_oneway();
+ MetricsPrx metricsOneway = metrics.ice_oneway();
metricsOneway.op();
- metricsOneway.end_op(metricsOneway.begin_op());
- metricsOneway.begin_op(cb).waitForSent();
+ metricsOneway.opAsync().join();
+ {
+ CompletableFuture<Void> f = metricsOneway.opAsync();
+ com.zeroc.Ice.Util.getInvocationFuture(f).waitForSent();
+ }
- map = toMap(clientMetrics.getMetricsView("View", timestamp).get("Invocation"));
+ map = toMap(clientMetrics.getMetricsView("View").returnValue.get("Invocation"));
test(map.size() == 1);
- im1 = (IceMX.InvocationMetrics)map.get("op");
+ im1 = (InvocationMetrics)map.get("op");
test(im1.current <= 1 && im1.total == 3 && im1.failures == 0 && im1.retry == 0);
test(!collocated ? (im1.remotes.length == 1) : (im1.collocated.length == 1));
- rim1 = (IceMX.ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
+ rim1 = (ChildInvocationMetrics)(!collocated ? im1.remotes[0] : im1.collocated[0]);
test(rim1.current <= 1 && rim1.total == 3 && rim1.failures == 0);
test(rim1.size == 63 && rim1.replySize == 0);
@@ -1120,15 +1141,15 @@ public class AllTests
props.put("IceMX.Metrics.View.Map.Invocation.Map.Remote.GroupBy", "localPort");
updateProps(clientProps, serverProps, props, "Invocation");
- MetricsPrx metricsBatchOneway = (MetricsPrx)metrics.ice_batchOneway();
+ MetricsPrx metricsBatchOneway = metrics.ice_batchOneway();
metricsBatchOneway.op();
- metricsBatchOneway.end_op(metricsBatchOneway.begin_op());
- //metricsBatchOneway.begin_op(cb).waitForSent();
+ metricsBatchOneway.opAsync();
+ //metricsBatchOneway.opAsync().waitForSent();
- map = toMap(clientMetrics.getMetricsView("View", timestamp).get("Invocation"));
+ map = toMap(clientMetrics.getMetricsView("View").returnValue.get("Invocation"));
test(map.size() == 1);
- im1 = (IceMX.InvocationMetrics)map.get("op");
+ im1 = (InvocationMetrics)map.get("op");
test(im1.current == 0 && im1.total == 2 && im1.failures == 0 && im1.retry == 0);
test(im1.remotes.length == 0);
@@ -1140,31 +1161,35 @@ public class AllTests
out.print("testing metrics view enable/disable...");
out.flush();
- Ice.StringSeqHolder disabledViews = new Ice.StringSeqHolder();
+ MetricsAdmin.GetMetricsViewNamesResult n;
props.put("IceMX.Metrics.View.GroupBy", "none");
props.put("IceMX.Metrics.View.Disabled", "0");
updateProps(clientProps, serverProps, props, "Thread");
- test(clientMetrics.getMetricsView("View", timestamp).get("Thread").length != 0);
- test(clientMetrics.getMetricsViewNames(disabledViews).length == 1 && disabledViews.value.length == 0);
+ test(clientMetrics.getMetricsView("View").returnValue.get("Thread").length != 0);
+ n = clientMetrics.getMetricsViewNames();
+ test(n.returnValue.length == 1 && n.disabledViews.length == 0);
props.put("IceMX.Metrics.View.Disabled", "1");
updateProps(clientProps, serverProps, props, "Thread");
- test(clientMetrics.getMetricsView("View", timestamp).get("Thread") == null);
- test(clientMetrics.getMetricsViewNames(disabledViews).length == 0 && disabledViews.value.length == 1);
+ test(clientMetrics.getMetricsView("View").returnValue.get("Thread") == null);
+ n = clientMetrics.getMetricsViewNames();
+ test(n.returnValue.length == 0 && n.disabledViews.length == 1);
clientMetrics.enableMetricsView("View");
- test(clientMetrics.getMetricsView("View", timestamp).get("Thread").length != 0);
- test(clientMetrics.getMetricsViewNames(disabledViews).length == 1 && disabledViews.value.length == 0);
+ test(clientMetrics.getMetricsView("View").returnValue.get("Thread").length != 0);
+ n = clientMetrics.getMetricsViewNames();
+ test(n.returnValue.length == 1 && n.disabledViews.length == 0);
clientMetrics.disableMetricsView("View");
- test(clientMetrics.getMetricsView("View", timestamp).get("Thread") == null);
- test(clientMetrics.getMetricsViewNames(disabledViews).length == 0 && disabledViews.value.length == 1);
+ test(clientMetrics.getMetricsView("View").returnValue.get("Thread") == null);
+ n = clientMetrics.getMetricsViewNames();
+ test(n.returnValue.length == 0 && n.disabledViews.length == 1);
try
{
clientMetrics.enableMetricsView("UnknownView");
}
- catch(IceMX.UnknownMetricsView ex)
+ catch(UnknownMetricsView ex)
{
}
diff --git a/java/test/src/main/java/test/Ice/metrics/ChildInvocationObserverI.java b/java/test/src/main/java/test/Ice/metrics/ChildInvocationObserverI.java
index 326fe35f269..104e2f824f2 100644
--- a/java/test/src/main/java/test/Ice/metrics/ChildInvocationObserverI.java
+++ b/java/test/src/main/java/test/Ice/metrics/ChildInvocationObserverI.java
@@ -9,23 +9,20 @@
package test.Ice.metrics;
-class ChildInvocationObserverI extends ObserverI implements Ice.Instrumentation.ChildInvocationObserver
+class ChildInvocationObserverI extends ObserverI implements com.zeroc.Ice.Instrumentation.ChildInvocationObserver
{
@Override
- public synchronized void
- reset()
+ public synchronized void reset()
{
super.reset();
replySize = 0;
}
@Override
- public synchronized void
- reply(int s)
+ public synchronized void reply(int s)
{
replySize += s;
}
int replySize;
-};
-
+}
diff --git a/java/test/src/main/java/test/Ice/metrics/Client.java b/java/test/src/main/java/test/Ice/metrics/Client.java
index e2cc47bbdfc..d5bb7488b19 100644
--- a/java/test/src/main/java/test/Ice/metrics/Client.java
+++ b/java/test/src/main/java/test/Ice/metrics/Client.java
@@ -16,13 +16,13 @@ public class Client extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.Communicator communicator = communicator();
try
{
MetricsPrx metrics = AllTests.allTests(communicator, getWriter(), _observer);
metrics.shutdown();
}
- catch(Ice.UserException ex)
+ catch(com.zeroc.Ice.UserException ex)
{
ex.printStackTrace();
assert(false);
@@ -32,20 +32,19 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.metrics");
- initData.properties.setProperty("Ice.Admin.Endpoints", "tcp");
- initData.properties.setProperty("Ice.Admin.InstanceName", "client");
- initData.properties.setProperty("Ice.Admin.DelayCreation", "1");
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("Ice.MessageSizeMax", "50000");
- initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.metrics");
+ r.initData.properties.setProperty("Ice.Admin.Endpoints", "tcp");
+ r.initData.properties.setProperty("Ice.Admin.InstanceName", "client");
+ r.initData.properties.setProperty("Ice.Admin.DelayCreation", "1");
+ r.initData.properties.setProperty("Ice.Warn.Connections", "0");
+ r.initData.properties.setProperty("Ice.MessageSizeMax", "50000");
+ r.initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
- initData.observer = _observer;
- return initData;
+ r.initData.observer = _observer;
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/metrics/Collocated.java b/java/test/src/main/java/test/Ice/metrics/Collocated.java
index 98320001330..2b6775aa029 100644
--- a/java/test/src/main/java/test/Ice/metrics/Collocated.java
+++ b/java/test/src/main/java/test/Ice/metrics/Collocated.java
@@ -16,15 +16,15 @@ public class Collocated extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- adapter.add(new MetricsI(), Ice.Util.stringToIdentity("metrics"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new MetricsI(), com.zeroc.Ice.Util.stringToIdentity("metrics"));
//adapter.activate(); // Don't activate OA to ensure collocation is used.
communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011");
- Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter");
- controllerAdapter.add(new ControllerI(adapter), Ice.Util.stringToIdentity("controller"));
+ com.zeroc.Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter");
+ controllerAdapter.add(new ControllerI(adapter), com.zeroc.Ice.Util.stringToIdentity("controller"));
//controllerAdapter.activate(); // Don't activate OA to ensure collocation is used.
try
@@ -32,7 +32,7 @@ public class Collocated extends test.Util.Application
MetricsPrx metrics = AllTests.allTests(communicator, getWriter(), _observer);
metrics.shutdown();
}
- catch(Ice.UserException ex)
+ catch(com.zeroc.Ice.UserException ex)
{
ex.printStackTrace();
assert(false);
@@ -42,28 +42,27 @@ public class Collocated extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
- if(initData.properties.getPropertyAsInt("Ice.ThreadInterruptSafe") > 0)
+ GetInitDataResult r = super.getInitData(args);
+ if(r.initData.properties.getPropertyAsInt("Ice.ThreadInterruptSafe") > 0)
{
// With background IO, collocated invocations are
// dispatched on the server thread pool. This test needs
// at least 3 threads in the server thread pool to work.
- initData.properties.setProperty("Ice.ThreadPool.Server.Size", "3");
+ r.initData.properties.setProperty("Ice.ThreadPool.Server.Size", "3");
}
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.metrics");
- initData.properties.setProperty("Ice.Admin.Endpoints", "tcp");
- initData.properties.setProperty("Ice.Admin.InstanceName", "client");
- initData.properties.setProperty("Ice.Admin.DelayCreation", "1");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- initData.properties.setProperty("Ice.MessageSizeMax", "50000");
- initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
- initData.observer = _observer;
- return initData;
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.metrics");
+ r.initData.properties.setProperty("Ice.Admin.Endpoints", "tcp");
+ r.initData.properties.setProperty("Ice.Admin.InstanceName", "client");
+ r.initData.properties.setProperty("Ice.Admin.DelayCreation", "1");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ r.initData.properties.setProperty("Ice.Warn.Connections", "0");
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ r.initData.properties.setProperty("Ice.MessageSizeMax", "50000");
+ r.initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
+ r.initData.observer = _observer;
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/metrics/CollocatedObserverI.java b/java/test/src/main/java/test/Ice/metrics/CollocatedObserverI.java
index 52e92df22ac..94922b2ca6b 100644
--- a/java/test/src/main/java/test/Ice/metrics/CollocatedObserverI.java
+++ b/java/test/src/main/java/test/Ice/metrics/CollocatedObserverI.java
@@ -9,7 +9,6 @@
package test.Ice.metrics;
-class CollocatedObserverI extends ChildInvocationObserverI implements Ice.Instrumentation.CollocatedObserver
+class CollocatedObserverI extends ChildInvocationObserverI implements com.zeroc.Ice.Instrumentation.CollocatedObserver
{
-};
-
+}
diff --git a/java/test/src/main/java/test/Ice/metrics/CommunicatorObserverI.java b/java/test/src/main/java/test/Ice/metrics/CommunicatorObserverI.java
index fe33c7a60cc..4eef4bef6f9 100644
--- a/java/test/src/main/java/test/Ice/metrics/CommunicatorObserverI.java
+++ b/java/test/src/main/java/test/Ice/metrics/CommunicatorObserverI.java
@@ -9,10 +9,9 @@
package test.Ice.metrics;
-class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorObserver
+class CommunicatorObserverI implements com.zeroc.Ice.Instrumentation.CommunicatorObserver
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -21,15 +20,14 @@ class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorObserver
}
@Override
- public void
- setObserverUpdater(Ice.Instrumentation.ObserverUpdater u)
+ public void setObserverUpdater(com.zeroc.Ice.Instrumentation.ObserverUpdater u)
{
updater = u;
}
@Override
- synchronized public Ice.Instrumentation.Observer
- getConnectionEstablishmentObserver(Ice.Endpoint e, String s)
+ synchronized public com.zeroc.Ice.Instrumentation.Observer getConnectionEstablishmentObserver(
+ com.zeroc.Ice.Endpoint e, String s)
{
if(connectionEstablishmentObserver == null)
{
@@ -38,11 +36,9 @@ class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorObserver
}
return connectionEstablishmentObserver;
}
-
@Override
- synchronized public Ice.Instrumentation.Observer
- getEndpointLookupObserver(Ice.Endpoint e)
+ synchronized public com.zeroc.Ice.Instrumentation.Observer getEndpointLookupObserver(com.zeroc.Ice.Endpoint e)
{
if(endpointLookupObserver == null)
{
@@ -53,11 +49,11 @@ class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorObserver
}
@Override
- synchronized public Ice.Instrumentation.ConnectionObserver
- getConnectionObserver(Ice.ConnectionInfo c,
- Ice.Endpoint e,
- Ice.Instrumentation.ConnectionState s,
- Ice.Instrumentation.ConnectionObserver old)
+ synchronized public com.zeroc.Ice.Instrumentation.ConnectionObserver getConnectionObserver(
+ com.zeroc.Ice.ConnectionInfo c,
+ com.zeroc.Ice.Endpoint e,
+ com.zeroc.Ice.Instrumentation.ConnectionState s,
+ com.zeroc.Ice.Instrumentation.ConnectionObserver old)
{
test(old == null || old instanceof ConnectionObserverI);
if(connectionObserver == null)
@@ -69,9 +65,11 @@ class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorObserver
}
@Override
- synchronized public Ice.Instrumentation.ThreadObserver
- getThreadObserver(String p, String id, Ice.Instrumentation.ThreadState s,
- Ice.Instrumentation.ThreadObserver old)
+ synchronized public com.zeroc.Ice.Instrumentation.ThreadObserver getThreadObserver(
+ String p,
+ String id,
+ com.zeroc.Ice.Instrumentation.ThreadState s,
+ com.zeroc.Ice.Instrumentation.ThreadObserver old)
{
test(old == null || old instanceof ThreadObserverI);
if(threadObserver == null)
@@ -83,8 +81,10 @@ class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorObserver
}
@Override
- synchronized public Ice.Instrumentation.InvocationObserver
- getInvocationObserver(Ice.ObjectPrx p, String op, java.util.Map<String, String> ctx)
+ synchronized public com.zeroc.Ice.Instrumentation.InvocationObserver getInvocationObserver(
+ com.zeroc.Ice.ObjectPrx p,
+ String op,
+ java.util.Map<String, String> ctx)
{
if(invocationObserver == null)
{
@@ -95,8 +95,9 @@ class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorObserver
}
@Override
- synchronized public Ice.Instrumentation.DispatchObserver
- getDispatchObserver(Ice.Current current, int s)
+ synchronized public com.zeroc.Ice.Instrumentation.DispatchObserver getDispatchObserver(
+ com.zeroc.Ice.Current current,
+ int s)
{
if(dispatchObserver == null)
{
@@ -106,8 +107,7 @@ class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorObserver
return dispatchObserver;
}
- synchronized void
- reset()
+ synchronized void reset()
{
if(connectionEstablishmentObserver != null)
{
@@ -135,7 +135,7 @@ class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorObserver
}
}
- Ice.Instrumentation.ObserverUpdater updater;
+ com.zeroc.Ice.Instrumentation.ObserverUpdater updater;
ObserverI connectionEstablishmentObserver;
ObserverI endpointLookupObserver;
@@ -143,5 +143,4 @@ class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorObserver
ThreadObserverI threadObserver;
InvocationObserverI invocationObserver;
DispatchObserverI dispatchObserver;
-};
-
+}
diff --git a/java/test/src/main/java/test/Ice/metrics/ConnectionObserverI.java b/java/test/src/main/java/test/Ice/metrics/ConnectionObserverI.java
index c163bd6209d..489a146c390 100644
--- a/java/test/src/main/java/test/Ice/metrics/ConnectionObserverI.java
+++ b/java/test/src/main/java/test/Ice/metrics/ConnectionObserverI.java
@@ -9,11 +9,10 @@
package test.Ice.metrics;
-class ConnectionObserverI extends ObserverI implements Ice.Instrumentation.ConnectionObserver
+class ConnectionObserverI extends ObserverI implements com.zeroc.Ice.Instrumentation.ConnectionObserver
{
@Override
- public synchronized void
- reset()
+ public synchronized void reset()
{
super.reset();
received = 0;
@@ -21,20 +20,17 @@ class ConnectionObserverI extends ObserverI implements Ice.Instrumentation.Conne
}
@Override
- public synchronized void
- sentBytes(int s)
+ public synchronized void sentBytes(int s)
{
sent += s;
}
@Override
- public synchronized void
- receivedBytes(int s)
+ public synchronized void receivedBytes(int s)
{
received += s;
}
int sent;
int received;
-};
-
+}
diff --git a/java/test/src/main/java/test/Ice/metrics/ControllerI.java b/java/test/src/main/java/test/Ice/metrics/ControllerI.java
index e40d04ece62..57e32506aba 100644
--- a/java/test/src/main/java/test/Ice/metrics/ControllerI.java
+++ b/java/test/src/main/java/test/Ice/metrics/ControllerI.java
@@ -8,27 +8,28 @@
// **********************************************************************
package test.Ice.metrics;
-import test.Ice.metrics.Test._ControllerDisp;
-public final class ControllerI extends _ControllerDisp
+import test.Ice.metrics.Test.Controller;
+
+public final class ControllerI implements Controller
{
- public ControllerI(Ice.ObjectAdapter adapter)
+ public ControllerI(com.zeroc.Ice.ObjectAdapter adapter)
{
_adapter = adapter;
}
@Override
- public void hold(Ice.Current current)
+ public void hold(com.zeroc.Ice.Current current)
{
_adapter.hold();
_adapter.waitForHold();
}
@Override
- public void resume(Ice.Current current)
+ public void resume(com.zeroc.Ice.Current current)
{
_adapter.activate();
}
- final private Ice.ObjectAdapter _adapter;
-};
+ final private com.zeroc.Ice.ObjectAdapter _adapter;
+}
diff --git a/java/test/src/main/java/test/Ice/metrics/DispatchObserverI.java b/java/test/src/main/java/test/Ice/metrics/DispatchObserverI.java
index 783fcea2791..13f2d8a5fbd 100644
--- a/java/test/src/main/java/test/Ice/metrics/DispatchObserverI.java
+++ b/java/test/src/main/java/test/Ice/metrics/DispatchObserverI.java
@@ -9,11 +9,10 @@
package test.Ice.metrics;
-class DispatchObserverI extends ObserverI implements Ice.Instrumentation.DispatchObserver
+class DispatchObserverI extends ObserverI implements com.zeroc.Ice.Instrumentation.DispatchObserver
{
@Override
- public synchronized void
- reset()
+ public synchronized void reset()
{
super.reset();
userExceptionCount = 0;
@@ -21,20 +20,17 @@ class DispatchObserverI extends ObserverI implements Ice.Instrumentation.Dispatc
}
@Override
- public synchronized void
- userException()
+ public synchronized void userException()
{
++userExceptionCount;
}
@Override
- public synchronized void
- reply(int s)
+ public synchronized void reply(int s)
{
replySize += s;
}
int userExceptionCount;
int replySize;
-};
-
+}
diff --git a/java/test/src/main/java/test/Ice/metrics/InvocationObserverI.java b/java/test/src/main/java/test/Ice/metrics/InvocationObserverI.java
index 91661e43a0e..fa801256af3 100644
--- a/java/test/src/main/java/test/Ice/metrics/InvocationObserverI.java
+++ b/java/test/src/main/java/test/Ice/metrics/InvocationObserverI.java
@@ -9,11 +9,10 @@
package test.Ice.metrics;
-class InvocationObserverI extends ObserverI implements Ice.Instrumentation.InvocationObserver
+class InvocationObserverI extends ObserverI implements com.zeroc.Ice.Instrumentation.InvocationObserver
{
@Override
- public synchronized void
- reset()
+ public synchronized void reset()
{
super.reset();
retriedCount = 0;
@@ -29,22 +28,23 @@ class InvocationObserverI extends ObserverI implements Ice.Instrumentation.Invoc
}
@Override
- public synchronized void
- retried()
+ public synchronized void retried()
{
++retriedCount;
}
@Override
- public synchronized void
- userException()
+ public synchronized void userException()
{
++userExceptionCount;
}
@Override
- public synchronized Ice.Instrumentation.RemoteObserver
- getRemoteObserver(Ice.ConnectionInfo c, Ice.Endpoint e, int a, int b)
+ public synchronized com.zeroc.Ice.Instrumentation.RemoteObserver getRemoteObserver(
+ com.zeroc.Ice.ConnectionInfo c,
+ com.zeroc.Ice.Endpoint e,
+ int a,
+ int b)
{
if(remoteObserver == null)
{
@@ -54,10 +54,11 @@ class InvocationObserverI extends ObserverI implements Ice.Instrumentation.Invoc
return remoteObserver;
}
-
@Override
- public synchronized Ice.Instrumentation.CollocatedObserver
- getCollocatedObserver(Ice.ObjectAdapter adapter, int a, int b)
+ public synchronized com.zeroc.Ice.Instrumentation.CollocatedObserver getCollocatedObserver(
+ com.zeroc.Ice.ObjectAdapter adapter,
+ int a,
+ int b)
{
if(collocatedObserver == null)
{
@@ -72,4 +73,4 @@ class InvocationObserverI extends ObserverI implements Ice.Instrumentation.Invoc
RemoteObserverI remoteObserver = null;
CollocatedObserverI collocatedObserver = null;
-};
+}
diff --git a/java/test/src/main/java/test/Ice/metrics/MetricsI.java b/java/test/src/main/java/test/Ice/metrics/MetricsI.java
index a7cf0f3dccf..8a8342431b1 100644
--- a/java/test/src/main/java/test/Ice/metrics/MetricsI.java
+++ b/java/test/src/main/java/test/Ice/metrics/MetricsI.java
@@ -8,73 +8,64 @@
// **********************************************************************
package test.Ice.metrics;
+
import test.Ice.metrics.Test.*;
-public final class MetricsI extends _MetricsDisp
+public final class MetricsI implements Metrics
{
- public
- MetricsI()
+ public MetricsI()
{
}
@Override
- public void
- op(Ice.Current current)
+ public void op(com.zeroc.Ice.Current current)
{
}
@Override
- public void
- fail(Ice.Current current)
+ public void fail(com.zeroc.Ice.Current current)
{
current.con.close(true);
}
@Override
- public void
- opWithUserException(Ice.Current current)
+ public void opWithUserException(com.zeroc.Ice.Current current)
throws UserEx
{
throw new UserEx();
}
@Override
- public void
- opWithRequestFailedException(Ice.Current current)
+ public void opWithRequestFailedException(com.zeroc.Ice.Current current)
{
- throw new Ice.ObjectNotExistException();
+ throw new com.zeroc.Ice.ObjectNotExistException();
}
@Override
- public void
- opWithLocalException(Ice.Current current)
+ public void opWithLocalException(com.zeroc.Ice.Current current)
{
- throw new Ice.SyscallException();
+ throw new com.zeroc.Ice.SyscallException();
}
@Override
- public void
- opWithUnknownException(Ice.Current current)
+ public void opWithUnknownException(com.zeroc.Ice.Current current)
{
throw new IllegalArgumentException();
}
@Override
- public void
- opByteS(byte[] bs, Ice.Current current)
+ public void opByteS(byte[] bs, com.zeroc.Ice.Current current)
{
}
@Override
- public Ice.ObjectPrx
- getAdmin(Ice.Current current)
+ public com.zeroc.Ice.ObjectPrx getAdmin(com.zeroc.Ice.Current current)
{
return current.adapter.getCommunicator().getAdmin();
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
diff --git a/java/test/src/main/java/test/Ice/metrics/ObserverI.java b/java/test/src/main/java/test/Ice/metrics/ObserverI.java
index 083c6613570..17a186b8564 100644
--- a/java/test/src/main/java/test/Ice/metrics/ObserverI.java
+++ b/java/test/src/main/java/test/Ice/metrics/ObserverI.java
@@ -9,10 +9,9 @@
package test.Ice.metrics;
-class ObserverI implements Ice.Instrumentation.Observer
+class ObserverI implements com.zeroc.Ice.Instrumentation.Observer
{
- synchronized public void
- reset()
+ synchronized public void reset()
{
total = 0;
current = 0;
@@ -20,39 +19,35 @@ class ObserverI implements Ice.Instrumentation.Observer
}
@Override
- synchronized public void
- attach()
+ synchronized public void attach()
{
++total;
++current;
}
+
@Override
- synchronized public void
- detach()
+ synchronized public void detach()
{
--current;
}
+
@Override
- synchronized public void
- failed(String s)
+ synchronized public void failed(String s)
{
++failedCount;
}
- synchronized int
- getTotal()
+ synchronized int getTotal()
{
return total;
}
- synchronized int
- getCurrent()
+ synchronized int getCurrent()
{
return current;
}
- synchronized int
- getFailedCount()
+ synchronized int getFailedCount()
{
return failedCount;
}
@@ -60,4 +55,4 @@ class ObserverI implements Ice.Instrumentation.Observer
int total;
int current;
int failedCount;
-};
+}
diff --git a/java/test/src/main/java/test/Ice/metrics/RemoveObserverI.java b/java/test/src/main/java/test/Ice/metrics/RemoveObserverI.java
index 52e0e6f7011..ca060d00106 100644
--- a/java/test/src/main/java/test/Ice/metrics/RemoveObserverI.java
+++ b/java/test/src/main/java/test/Ice/metrics/RemoveObserverI.java
@@ -9,7 +9,6 @@
package test.Ice.metrics;
-class RemoteObserverI extends ChildInvocationObserverI implements Ice.Instrumentation.RemoteObserver
+class RemoteObserverI extends ChildInvocationObserverI implements com.zeroc.Ice.Instrumentation.RemoteObserver
{
-};
-
+}
diff --git a/java/test/src/main/java/test/Ice/metrics/Server.java b/java/test/src/main/java/test/Ice/metrics/Server.java
index b4512bfdc4b..45e77982a4d 100644
--- a/java/test/src/main/java/test/Ice/metrics/Server.java
+++ b/java/test/src/main/java/test/Ice/metrics/Server.java
@@ -14,33 +14,32 @@ public class Server extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- adapter.add(new MetricsI(), Ice.Util.stringToIdentity("metrics"));
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new MetricsI(), com.zeroc.Ice.Util.stringToIdentity("metrics"));
adapter.activate();
communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011");
- Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter");
- controllerAdapter.add(new ControllerI(adapter), Ice.Util.stringToIdentity("controller"));
+ com.zeroc.Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter");
+ controllerAdapter.add(new ControllerI(adapter), com.zeroc.Ice.Util.stringToIdentity("controller"));
controllerAdapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- initData.properties.setProperty("Ice.Admin.Endpoints", "tcp");
- initData.properties.setProperty("Ice.Admin.InstanceName", "server");
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- initData.properties.setProperty("Ice.MessageSizeMax", "50000");
- initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ r.initData.properties.setProperty("Ice.Admin.Endpoints", "tcp");
+ r.initData.properties.setProperty("Ice.Admin.InstanceName", "server");
+ r.initData.properties.setProperty("Ice.Warn.Connections", "0");
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ r.initData.properties.setProperty("Ice.MessageSizeMax", "50000");
+ r.initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/metrics/ThreadObserverI.java b/java/test/src/main/java/test/Ice/metrics/ThreadObserverI.java
index 218363d72dc..0cb34d6963a 100644
--- a/java/test/src/main/java/test/Ice/metrics/ThreadObserverI.java
+++ b/java/test/src/main/java/test/Ice/metrics/ThreadObserverI.java
@@ -9,23 +9,21 @@
package test.Ice.metrics;
-class ThreadObserverI extends ObserverI implements Ice.Instrumentation.ThreadObserver
+class ThreadObserverI extends ObserverI implements com.zeroc.Ice.Instrumentation.ThreadObserver
{
@Override
- public synchronized void
- reset()
+ public synchronized void reset()
{
super.reset();
states = 0;
}
@Override
- public synchronized void
- stateChanged(Ice.Instrumentation.ThreadState o, Ice.Instrumentation.ThreadState n)
+ public synchronized void stateChanged(com.zeroc.Ice.Instrumentation.ThreadState o,
+ com.zeroc.Ice.Instrumentation.ThreadState n)
{
++states;
}
int states;
-};
-
+}
diff --git a/java/test/src/main/java/test/Ice/networkProxy/AllTests.java b/java/test/src/main/java/test/Ice/networkProxy/AllTests.java
index 4ec21083e4a..021047d3d62 100644
--- a/java/test/src/main/java/test/Ice/networkProxy/AllTests.java
+++ b/java/test/src/main/java/test/Ice/networkProxy/AllTests.java
@@ -12,12 +12,10 @@ package test.Ice.networkProxy;
import java.io.PrintWriter;
import test.Ice.networkProxy.Test.TestIntfPrx;
-import test.Ice.networkProxy.Test.TestIntfPrxHelper;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -25,17 +23,16 @@ public class AllTests
}
}
- public static void
- allTests(test.Util.Application app)
+ public static void allTests(test.Util.Application app)
{
- Ice.Communicator communicator = app.communicator();
+ com.zeroc.Ice.Communicator communicator = app.communicator();
PrintWriter out = app.getWriter();
String sref = "test:default -p 12010";
- Ice.ObjectPrx obj = communicator.stringToProxy(sref);
+ com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(sref);
test(obj != null);
- TestIntfPrx test = TestIntfPrxHelper.checkedCast(obj);
+ TestIntfPrx test = TestIntfPrx.checkedCast(obj);
test(test != null);
out.print("testing connection... ");
@@ -48,12 +45,12 @@ public class AllTests
out.print("testing connection information... ");
out.flush();
{
- Ice.IPConnectionInfo info = null;
- for(Ice.ConnectionInfo p = test.ice_getConnection().getInfo(); p != null; p = p.underlying)
+ com.zeroc.Ice.IPConnectionInfo info = null;
+ for(com.zeroc.Ice.ConnectionInfo p = test.ice_getConnection().getInfo(); p != null; p = p.underlying)
{
- if(p instanceof Ice.IPConnectionInfo)
+ if(p instanceof com.zeroc.Ice.IPConnectionInfo)
{
- info = (Ice.IPConnectionInfo)p;
+ info = (com.zeroc.Ice.IPConnectionInfo)p;
}
}
test(info.remotePort == 12030 || info.remotePort == 12031); // make sure we are connected to the proxy port.
@@ -75,7 +72,7 @@ public class AllTests
test.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
}
diff --git a/java/test/src/main/java/test/Ice/networkProxy/Client.java b/java/test/src/main/java/test/Ice/networkProxy/Client.java
index a3972a06b9b..26b4ea2c758 100644
--- a/java/test/src/main/java/test/Ice/networkProxy/Client.java
+++ b/java/test/src/main/java/test/Ice/networkProxy/Client.java
@@ -21,12 +21,11 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.networkProxy");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.networkProxy");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/networkProxy/Server.java b/java/test/src/main/java/test/Ice/networkProxy/Server.java
index 1c0838f37a3..43b77f86a4e 100644
--- a/java/test/src/main/java/test/Ice/networkProxy/Server.java
+++ b/java/test/src/main/java/test/Ice/networkProxy/Server.java
@@ -9,13 +9,13 @@
package test.Ice.networkProxy;
-import test.Ice.networkProxy.Test._TestIntfDisp;
+import test.Ice.networkProxy.Test.TestIntf;
public class Server extends test.Util.Application
{
- static public class TestI extends _TestIntfDisp
+ static public class TestI implements TestIntf
{
- public void shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
@@ -24,21 +24,20 @@ public class Server extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- adapter.add(new TestI(), Ice.Util.stringToIdentity("test"));
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new TestI(), com.zeroc.Ice.Util.stringToIdentity("test"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.networkProxy");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.networkProxy");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/objects/AllTests.java b/java/test/src/main/java/test/Ice/objects/AllTests.java
index 3dc56053666..695815564cb 100644
--- a/java/test/src/main/java/test/Ice/objects/AllTests.java
+++ b/java/test/src/main/java/test/Ice/objects/AllTests.java
@@ -12,11 +12,8 @@ package test.Ice.objects;
import java.io.PrintWriter;
import test.Ice.objects.Test.B;
-import test.Ice.objects.Test.BHolder;
import test.Ice.objects.Test.C;
-import test.Ice.objects.Test.CHolder;
import test.Ice.objects.Test.D;
-import test.Ice.objects.Test.DHolder;
import test.Ice.objects.Test.E;
import test.Ice.objects.Test.F;
import test.Ice.objects.Test.H;
@@ -27,17 +24,14 @@ import test.Ice.objects.Test.D1;
import test.Ice.objects.Test.EDerived;
import test.Ice.objects.Test.Base;
import test.Ice.objects.Test.S;
-import test.Ice.objects.Test.BaseSeqHolder;
+import test.Ice.objects.Test.Initial;
import test.Ice.objects.Test.InitialPrx;
-import test.Ice.objects.Test.InitialPrxHelper;
import test.Ice.objects.Test.J;
import test.Ice.objects.Test.UnexpectedObjectExceptionTestPrx;
-import test.Ice.objects.Test.UnexpectedObjectExceptionTestPrxHelper;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -45,19 +39,19 @@ public class AllTests
}
}
- public static InitialPrx
- allTests(Ice.Communicator communicator, PrintWriter out)
+ @SuppressWarnings("deprecation")
+ public static InitialPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out)
{
out.print("testing stringToProxy... ");
out.flush();
String ref = "initial:default -p 12010";
- Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref);
test(base != null);
out.println("ok");
out.print("testing checked cast... ");
out.flush();
- InitialPrx initial = InitialPrxHelper.checkedCast(base);
+ InitialPrx initial = InitialPrx.checkedCast(base);
test(initial != null);
test(initial.equals(base));
out.println("ok");
@@ -116,15 +110,12 @@ public class AllTests
out.print("getting B1, B2, C, and D all at once... ");
out.flush();
- BHolder b1H = new BHolder();
- BHolder b2H = new BHolder();
- CHolder cH = new CHolder();
- DHolder dH = new DHolder();
- initial.getAll(b1H, b2H, cH, dH);
- b1 = b1H.value;
- b2 = b2H.value;
- c = cH.value;
- d = dH.value;
+ Initial.GetAllResult r;
+ r = initial.getAll();
+ b1 = r.b1;
+ b2 = r.b2;
+ c = r.theC;
+ d = r.theD;
test(b1 != null);
test(b2 != null);
test(c != null);
@@ -163,7 +154,7 @@ public class AllTests
out.print("testing protected members... ");
out.flush();
E e = initial.getE();
- test(e.checkValues());
+ test(((EI)e).checkValues());
try
{
test((E.class.getDeclaredField("i").getModifiers() & java.lang.reflect.Modifier.PROTECTED) != 0);
@@ -174,8 +165,8 @@ public class AllTests
test(false);
}
F f = initial.getF();
- test(f.checkValues());
- test(f.e2.checkValues());
+ test(((FI)f).checkValues());
+ test(((EI)f.e2).checkValues());
try
{
test((F.class.getDeclaredField("e1").getModifiers() & java.lang.reflect.Modifier.PROTECTED) != 0);
@@ -189,11 +180,11 @@ public class AllTests
out.print("getting I, J and H... ");
out.flush();
- I i = initial.getI();
+ com.zeroc.Ice.Value i = initial.getI();
test(i != null);
- I j = initial.getJ();
- test(j != null && ((J)j) != null);
- I h = initial.getH();
+ com.zeroc.Ice.Value j = initial.getJ();
+ test(j != null && ((H)j) != null);
+ com.zeroc.Ice.Value h = initial.getH();
test(h != null && ((H)h) != null);
out.println("ok");
@@ -235,16 +226,15 @@ public class AllTests
{
out.flush();
Base[] inS = new Base[0];
- BaseSeqHolder outS = new BaseSeqHolder();
- Base[] retS;
- retS = initial.opBaseSeq(inS, outS);
+ Initial.OpBaseSeqResult sr = initial.opBaseSeq(inS);
+ test(sr.returnValue.length == 0 && sr.outSeq.length == 0);
inS = new Base[1];
inS[0] = new Base(new S(), "");
- retS = initial.opBaseSeq(inS, outS);
- test(retS.length == 1 && outS.value.length == 1);
+ sr = initial.opBaseSeq(inS);
+ test(sr.returnValue.length == 1 && sr.outSeq.length == 1);
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
out.println("ok");
@@ -255,7 +245,7 @@ public class AllTests
{
test(initial.getCompact() != null);
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
out.println("ok");
@@ -264,7 +254,7 @@ public class AllTests
out.flush();
b1 = initial.getMB();
test(b1 != null && b1.theB == b1);
- b1 = initial.end_getAMDMB(initial.begin_getAMDMB());
+ b1 = initial.getAMDMBAsync().join();
test(b1 != null && b1.theB == b1);
out.println("ok");
@@ -273,14 +263,14 @@ public class AllTests
ref = "uoet:default -p 12010";
base = communicator.stringToProxy(ref);
test(base != null);
- UnexpectedObjectExceptionTestPrx uoet = UnexpectedObjectExceptionTestPrxHelper.uncheckedCast(base);
+ UnexpectedObjectExceptionTestPrx uoet = UnexpectedObjectExceptionTestPrx.uncheckedCast(base);
test(uoet != null);
try
{
uoet.op();
test(false);
}
- catch(Ice.UnexpectedObjectException ex)
+ catch(com.zeroc.Ice.UnexpectedObjectException ex)
{
test(ex.type.equals("::Test::AlsoEmpty"));
test(ex.expectedType.equals("::Test::Empty"));
diff --git a/java/test/src/main/java/test/Ice/objects/BI.java b/java/test/src/main/java/test/Ice/objects/BI.java
index a5d84c9f7b3..4437d4edf03 100644
--- a/java/test/src/main/java/test/Ice/objects/BI.java
+++ b/java/test/src/main/java/test/Ice/objects/BI.java
@@ -14,15 +14,13 @@ import test.Ice.objects.Test.B;
public final class BI extends B
{
@Override
- public void
- ice_preMarshal()
+ public void ice_preMarshal()
{
preMarshalInvoked = true;
}
@Override
- public void
- ice_postUnmarshal()
+ public void ice_postUnmarshal()
{
postUnmarshalInvoked = true;
}
diff --git a/java/test/src/main/java/test/Ice/objects/CI.java b/java/test/src/main/java/test/Ice/objects/CI.java
index 1e0be8de701..06ee01ed14b 100644
--- a/java/test/src/main/java/test/Ice/objects/CI.java
+++ b/java/test/src/main/java/test/Ice/objects/CI.java
@@ -11,19 +11,16 @@ package test.Ice.objects;
import test.Ice.objects.Test.C;
-
public final class CI extends C
{
@Override
- public void
- ice_preMarshal()
+ public void ice_preMarshal()
{
preMarshalInvoked = true;
}
@Override
- public void
- ice_postUnmarshal()
+ public void ice_postUnmarshal()
{
postUnmarshalInvoked = true;
}
diff --git a/java/test/src/main/java/test/Ice/objects/Client.java b/java/test/src/main/java/test/Ice/objects/Client.java
index aa1039edb9f..2e3f5a58e42 100644
--- a/java/test/src/main/java/test/Ice/objects/Client.java
+++ b/java/test/src/main/java/test/Ice/objects/Client.java
@@ -13,10 +13,10 @@ import test.Ice.objects.Test.InitialPrx;
public class Client extends test.Util.Application
{
- private static class MyValueFactory implements Ice.ValueFactory
+ private static class MyValueFactory implements com.zeroc.Ice.ValueFactory
{
@Override
- public Ice.Object create(String type)
+ public com.zeroc.Ice.Value create(String type)
{
if(type.equals("::Test::B"))
{
@@ -39,13 +39,12 @@ public class Client extends test.Util.Application
return new FI();
}
else if(type.equals("::Test::I"))
-
{
- return new II();
+ return new HI();
}
else if(type.equals("::Test::J"))
{
- return new JI();
+ return new HI();
}
else if(type.equals("::Test::H"))
{
@@ -57,10 +56,11 @@ public class Client extends test.Util.Application
}
}
- private static class MyObjectFactory implements Ice.ObjectFactory
+ @SuppressWarnings("deprecation")
+ private static class MyObjectFactory implements com.zeroc.Ice.ObjectFactory
{
@Override
- public Ice.Object create(String type)
+ public com.zeroc.Ice.Value create(String type)
{
return null;
}
@@ -72,11 +72,12 @@ public class Client extends test.Util.Application
}
}
+ @SuppressWarnings("deprecation")
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ValueFactory factory = new MyValueFactory();
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ValueFactory factory = new MyValueFactory();
communicator.getValueFactoryManager().add(factory, "::Test::B");
communicator.getValueFactoryManager().add(factory, "::Test::C");
communicator.getValueFactoryManager().add(factory, "::Test::D");
@@ -94,12 +95,11 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.objects");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.objects");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/objects/Collocated.java b/java/test/src/main/java/test/Ice/objects/Collocated.java
index 3540ad70b0a..3f1223aa1ac 100644
--- a/java/test/src/main/java/test/Ice/objects/Collocated.java
+++ b/java/test/src/main/java/test/Ice/objects/Collocated.java
@@ -9,14 +9,14 @@
package test.Ice.objects;
-import test.Ice.objects.Test.Initial;
+import test.Ice.objects.Test._InitialDisp;
public class Collocated extends test.Util.Application
{
- private static class MyValueFactory implements Ice.ValueFactory
+ private static class MyValueFactory implements com.zeroc.Ice.ValueFactory
{
@Override
- public Ice.Object create(String type)
+ public com.zeroc.Ice.Value create(String type)
{
if(type.equals("::Test::B"))
{
@@ -40,11 +40,11 @@ public class Collocated extends test.Util.Application
}
else if(type.equals("::Test::I"))
{
- return new II();
+ return new HI();
}
else if(type.equals("::Test::J"))
{
- return new JI();
+ return new HI();
}
else if(type.equals("::Test::H"))
{
@@ -56,10 +56,11 @@ public class Collocated extends test.Util.Application
}
}
- private static class MyObjectFactory implements Ice.ObjectFactory
+ @SuppressWarnings("deprecation")
+ private static class MyObjectFactory implements com.zeroc.Ice.ObjectFactory
{
@Override
- public Ice.Object create(String type)
+ public com.zeroc.Ice.Value create(String type)
{
return null;
}
@@ -71,11 +72,12 @@ public class Collocated extends test.Util.Application
}
}
+ @SuppressWarnings("deprecation")
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ValueFactory factory = new MyValueFactory();
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ValueFactory factory = new MyValueFactory();
communicator.getValueFactoryManager().add(factory, "::Test::B");
communicator.getValueFactoryManager().add(factory, "::Test::C");
communicator.getValueFactoryManager().add(factory, "::Test::D");
@@ -88,25 +90,25 @@ public class Collocated extends test.Util.Application
communicator.addObjectFactory(new MyObjectFactory(), "TestOF");
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Initial initial = new InitialI(adapter);
- adapter.add(initial, Ice.Util.stringToIdentity("initial"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ _InitialDisp initial = new InitialI(adapter);
+ adapter.add(initial, com.zeroc.Ice.Util.stringToIdentity("initial"));
UnexpectedObjectExceptionTestI object = new UnexpectedObjectExceptionTestI();
- adapter.add(object, Ice.Util.stringToIdentity("uoet"));
+ adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("uoet"));
AllTests.allTests(communicator, getWriter());
- // We must call shutdown even in the collocated case for cyclic
- // dependency cleanup
- initial.shutdown();
+ //
+ // We must call shutdown even in the collocated case for cyclic dependency cleanup.
+ //
+ initial.shutdown(null);
return 0;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.objects");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.objects");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/objects/DI.java b/java/test/src/main/java/test/Ice/objects/DI.java
index 66028edf331..b9329f6e756 100644
--- a/java/test/src/main/java/test/Ice/objects/DI.java
+++ b/java/test/src/main/java/test/Ice/objects/DI.java
@@ -11,19 +11,16 @@ package test.Ice.objects;
import test.Ice.objects.Test.D;
-
public final class DI extends D
{
@Override
- public void
- ice_preMarshal()
+ public void ice_preMarshal()
{
preMarshalInvoked = true;
}
@Override
- public void
- ice_postUnmarshal()
+ public void ice_postUnmarshal()
{
postUnmarshalInvoked = true;
}
diff --git a/java/test/src/main/java/test/Ice/objects/EI.java b/java/test/src/main/java/test/Ice/objects/EI.java
index 19da1c0fb9c..fe69ecdf07a 100644
--- a/java/test/src/main/java/test/Ice/objects/EI.java
+++ b/java/test/src/main/java/test/Ice/objects/EI.java
@@ -11,18 +11,14 @@ package test.Ice.objects;
import test.Ice.objects.Test.E;
-
public final class EI extends E
{
- public
- EI()
+ public EI()
{
super(1, "hello");
}
- @Override
- public boolean
- checkValues(Ice.Current current)
+ public boolean checkValues()
{
return i == 1 && s.equals("hello");
}
diff --git a/java/test/src/main/java/test/Ice/objects/FI.java b/java/test/src/main/java/test/Ice/objects/FI.java
index 386910cbba5..73232ab5cef 100644
--- a/java/test/src/main/java/test/Ice/objects/FI.java
+++ b/java/test/src/main/java/test/Ice/objects/FI.java
@@ -12,23 +12,18 @@ package test.Ice.objects;
import test.Ice.objects.Test.E;
import test.Ice.objects.Test.F;
-
public final class FI extends F
{
- public
- FI()
+ public FI()
{
}
- public
- FI(E e)
+ public FI(E e)
{
super(e, e);
}
- @Override
- public boolean
- checkValues(Ice.Current current)
+ public boolean checkValues()
{
return e1 != null && e1 == e2;
}
diff --git a/java/test/src/main/java/test/Ice/objects/HI.java b/java/test/src/main/java/test/Ice/objects/HI.java
index b351561baec..166349b95b0 100644
--- a/java/test/src/main/java/test/Ice/objects/HI.java
+++ b/java/test/src/main/java/test/Ice/objects/HI.java
@@ -11,7 +11,6 @@ package test.Ice.objects;
import test.Ice.objects.Test.H;
-
public final class HI extends H
{
}
diff --git a/java/test/src/main/java/test/Ice/objects/II.java b/java/test/src/main/java/test/Ice/objects/II.java
index 4f8bfcdc43f..57c67eded3c 100644
--- a/java/test/src/main/java/test/Ice/objects/II.java
+++ b/java/test/src/main/java/test/Ice/objects/II.java
@@ -9,8 +9,8 @@
package test.Ice.objects;
-import test.Ice.objects.Test._IDisp;
+import test.Ice.objects.Test.I;
-public final class II extends _IDisp
+public final class II implements I
{
}
diff --git a/java/test/src/main/java/test/Ice/objects/InitialI.java b/java/test/src/main/java/test/Ice/objects/InitialI.java
index feea876d1c9..b19652897c2 100644
--- a/java/test/src/main/java/test/Ice/objects/InitialI.java
+++ b/java/test/src/main/java/test/Ice/objects/InitialI.java
@@ -9,29 +9,14 @@
package test.Ice.objects;
-import test.Ice.objects.Test.B;
-import test.Ice.objects.Test.BHolder;
-import test.Ice.objects.Test.C;
-import test.Ice.objects.Test.CHolder;
-import test.Ice.objects.Test.D;
-import test.Ice.objects.Test.DHolder;
-import test.Ice.objects.Test.E;
-import test.Ice.objects.Test.F;
-import test.Ice.objects.Test.I;
-import test.Ice.objects.Test.A1;
-import test.Ice.objects.Test.D1;
-import test.Ice.objects.Test.EDerived;
-import test.Ice.objects.Test.Base;
-import test.Ice.objects.Test.BaseSeqHolder;
-import test.Ice.objects.Test.Initial;
-import test.Ice.objects.Test.AMD_Initial_getAMDMB;
-import test.Ice.objects.Test.Compact;
-import test.Ice.objects.Test.CompactExt;
-
-public final class InitialI extends Initial
+import test.Ice.objects.Test.*;
+
+import java.util.concurrent.CompletionStage;
+import java.util.concurrent.CompletableFuture;
+
+public final class InitialI implements _InitialDisp
{
- public
- InitialI(Ice.ObjectAdapter adapter)
+ public InitialI(com.zeroc.Ice.ObjectAdapter adapter)
{
_adapter = adapter;
_b1 = new BI();
@@ -57,22 +42,22 @@ public final class InitialI extends Initial
}
@Override
- public void
- getAll(BHolder b1, BHolder b2, CHolder c, DHolder d, Ice.Current current)
+ public Initial.GetAllResult getAll(com.zeroc.Ice.Current current)
{
+ Initial.GetAllResult r = new Initial.GetAllResult();
_b1.preMarshalInvoked = false;
_b2.preMarshalInvoked = false;
_c.preMarshalInvoked = false;
_d.preMarshalInvoked = false;
- b1.value = _b1;
- b2.value = _b2;
- c.value = _c;
- d.value = _d;
+ r.b1 = _b1;
+ r.b2 = _b2;
+ r.theC = _c;
+ r.theD = _d;
+ return r;
}
@Override
- public B
- getB1(Ice.Current current)
+ public B getB1(com.zeroc.Ice.Current current)
{
_b1.preMarshalInvoked = false;
_b2.preMarshalInvoked = false;
@@ -81,8 +66,7 @@ public final class InitialI extends Initial
}
@Override
- public B
- getB2(Ice.Current current)
+ public B getB2(com.zeroc.Ice.Current current)
{
_b1.preMarshalInvoked = false;
_b2.preMarshalInvoked = false;
@@ -91,8 +75,7 @@ public final class InitialI extends Initial
}
@Override
- public C
- getC(Ice.Current current)
+ public C getC(com.zeroc.Ice.Current current)
{
_b1.preMarshalInvoked = false;
_b2.preMarshalInvoked = false;
@@ -101,8 +84,7 @@ public final class InitialI extends Initial
}
@Override
- public D
- getD(Ice.Current current)
+ public D getD(com.zeroc.Ice.Current current)
{
_b1.preMarshalInvoked = false;
_b2.preMarshalInvoked = false;
@@ -112,123 +94,109 @@ public final class InitialI extends Initial
}
@Override
- public E
- getE(Ice.Current current)
+ public E getE(com.zeroc.Ice.Current current)
{
return _e;
}
@Override
- public F
- getF(Ice.Current current)
+ public F getF(com.zeroc.Ice.Current current)
{
return _f;
}
@Override
- public I
- getI(Ice.Current current)
+ public com.zeroc.Ice.Value getI(com.zeroc.Ice.Current current)
{
- return new II();
+ return new HI();
}
@Override
- public I
- getJ(Ice.Current current)
+ public com.zeroc.Ice.Value getJ(com.zeroc.Ice.Current current)
{
- return new JI();
+ return new HI();
}
@Override
- public I
- getH(Ice.Current current)
+ public com.zeroc.Ice.Value getH(com.zeroc.Ice.Current current)
{
return new HI();
}
@Override
- public D1
- getD1(D1 d1, Ice.Current current)
+ public D1 getD1(D1 d1, com.zeroc.Ice.Current current)
{
return d1;
}
@Override
- public B getMB(Ice.Current current)
+ public Initial.GetMBMarshaledResult getMB(com.zeroc.Ice.Current current)
{
- return _b1;
+ return new Initial.GetMBMarshaledResult(_b1, current);
}
@Override
- public void getAMDMB_async(AMD_Initial_getAMDMB cb, Ice.Current current)
+ public CompletionStage<Initial.GetAMDMBMarshaledResult> getAMDMBAsync(com.zeroc.Ice.Current current)
{
- cb.ice_response(_b1);
+ return CompletableFuture.completedFuture(new Initial.GetAMDMBMarshaledResult(_b1, current));
}
@Override
- public void
- throwEDerived(Ice.Current current) throws EDerived
+ public void throwEDerived(com.zeroc.Ice.Current current) throws EDerived
{
throw new EDerived(new A1("a1"), new A1("a2"), new A1("a3"), new A1("a4"));
}
@Override
- public void
- setI(I theI, Ice.Current current)
+ public void setI(com.zeroc.Ice.Value theI, com.zeroc.Ice.Current current)
{
}
@Override
- public Base[]
- opBaseSeq(Base[] inS, BaseSeqHolder outS, Ice.Current current)
+ public Initial.OpBaseSeqResult opBaseSeq(Base[] inS, com.zeroc.Ice.Current current)
{
- outS.value = inS;
- return inS;
+ return new Initial.OpBaseSeqResult(inS, inS);
}
@Override
- public Compact
- getCompact(Ice.Current current)
+ public Compact getCompact(com.zeroc.Ice.Current current)
{
return new CompactExt();
}
@Override
- public test.Ice.objects.Test.Inner.A
- getInnerA(Ice.Current current)
+ public test.Ice.objects.Test.Inner.A getInnerA(com.zeroc.Ice.Current current)
{
return new test.Ice.objects.Test.Inner.A(_b1);
}
@Override
- public test.Ice.objects.Test.Inner.Sub.A
- getInnerSubA(Ice.Current current)
+ public test.Ice.objects.Test.Inner.Sub.A getInnerSubA(com.zeroc.Ice.Current current)
{
return new test.Ice.objects.Test.Inner.Sub.A(new test.Ice.objects.Test.Inner.A(_b1));
}
@Override
- public void throwInnerEx(Ice.Current current)
+ public void throwInnerEx(com.zeroc.Ice.Current current)
throws test.Ice.objects.Test.Inner.Ex
{
throw new test.Ice.objects.Test.Inner.Ex("Inner::Ex");
}
@Override
- public void throwInnerSubEx(Ice.Current current)
+ public void throwInnerSubEx(com.zeroc.Ice.Current current)
throws test.Ice.objects.Test.Inner.Sub.Ex
{
throw new test.Ice.objects.Test.Inner.Sub.Ex("Inner::Sub::Ex");
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
_adapter.getCommunicator().shutdown();
}
- private Ice.ObjectAdapter _adapter;
+ private com.zeroc.Ice.ObjectAdapter _adapter;
private B _b1;
private B _b2;
private C _c;
diff --git a/java/test/src/main/java/test/Ice/objects/JI.java b/java/test/src/main/java/test/Ice/objects/JI.java
index ea8f072ed40..037f5661f8b 100644
--- a/java/test/src/main/java/test/Ice/objects/JI.java
+++ b/java/test/src/main/java/test/Ice/objects/JI.java
@@ -9,9 +9,8 @@
package test.Ice.objects;
-import test.Ice.objects.Test._JDisp;
+import test.Ice.objects.Test.J;
-
-public final class JI extends _JDisp
+public final class JI implements J
{
}
diff --git a/java/test/src/main/java/test/Ice/objects/Server.java b/java/test/src/main/java/test/Ice/objects/Server.java
index 49a7c0fa174..cfdd15f1690 100644
--- a/java/test/src/main/java/test/Ice/objects/Server.java
+++ b/java/test/src/main/java/test/Ice/objects/Server.java
@@ -11,18 +11,18 @@ package test.Ice.objects;
public class Server extends test.Util.Application
{
- private static class MyValueFactory implements Ice.ValueFactory
+ private static class MyValueFactory implements com.zeroc.Ice.ValueFactory
{
@Override
- public Ice.Object create(String type)
+ public com.zeroc.Ice.Value create(String type)
{
if(type.equals("::Test::I"))
{
- return new II();
+ return new HI();
}
else if(type.equals("::Test::J"))
{
- return new JI();
+ return new HI();
}
else if(type.equals("::Test::H"))
{
@@ -37,30 +37,29 @@ public class Server extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ValueFactory factory = new MyValueFactory();
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ValueFactory factory = new MyValueFactory();
communicator.getValueFactoryManager().add(factory, "::Test::I");
communicator.getValueFactoryManager().add(factory, "::Test::J");
communicator.getValueFactoryManager().add(factory, "::Test::H");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Object object = new InitialI(adapter);
- adapter.add(object, Ice.Util.stringToIdentity("initial"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.Object object = new InitialI(adapter);
+ adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("initial"));
object = new UnexpectedObjectExceptionTestI();
- adapter.add(object, Ice.Util.stringToIdentity("uoet"));
+ adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("uoet"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.objects");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.objects");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/objects/Test.ice b/java/test/src/main/java/test/Ice/objects/Test.ice
index 6131e3ac379..6172f7f3323 100644
--- a/java/test/src/main/java/test/Ice/objects/Test.ice
+++ b/java/test/src/main/java/test/Ice/objects/Test.ice
@@ -68,16 +68,12 @@ class D
{
int i;
string s;
-
- bool checkValues();
};
class F
{
["protected"] E e1;
E e2;
-
- bool checkValues();
};
interface I
diff --git a/java/test/src/main/java/test/Ice/objects/UnexpectedObjectExceptionTestI.java b/java/test/src/main/java/test/Ice/objects/UnexpectedObjectExceptionTestI.java
index 62a2be9b817..b2d7f3d964b 100644
--- a/java/test/src/main/java/test/Ice/objects/UnexpectedObjectExceptionTestI.java
+++ b/java/test/src/main/java/test/Ice/objects/UnexpectedObjectExceptionTestI.java
@@ -11,19 +11,20 @@ package test.Ice.objects;
import test.Ice.objects.Test.AlsoEmpty;
-public final class UnexpectedObjectExceptionTestI extends Ice.Blobject
+public final class UnexpectedObjectExceptionTestI implements com.zeroc.Ice.Blobject
{
@Override
- public boolean
- ice_invoke(byte[] inParams, Ice.ByteSeqHolder outParams, Ice.Current current)
+ public com.zeroc.Ice.Object.Ice_invokeResult ice_invoke(byte[] inParams, com.zeroc.Ice.Current current)
{
- Ice.Communicator communicator = current.adapter.getCommunicator();
- Ice.OutputStream out = new Ice.OutputStream(communicator);
- out.startEncapsulation(current.encoding, Ice.FormatType.DefaultFormat);
+ com.zeroc.Ice.Object.Ice_invokeResult r = new com.zeroc.Ice.Object.Ice_invokeResult();
+ com.zeroc.Ice.Communicator communicator = current.adapter.getCommunicator();
+ com.zeroc.Ice.OutputStream out = new com.zeroc.Ice.OutputStream(communicator);
+ out.startEncapsulation(current.encoding, com.zeroc.Ice.FormatType.DefaultFormat);
out.writeValue(new AlsoEmpty());
out.writePendingValues();
out.endEncapsulation();
- outParams.value = out.finished();
- return true;
+ r.outParams = out.finished();
+ r.returnValue = true;
+ return r;
}
}
diff --git a/java/test/src/main/java/test/Ice/operations/AMDMyDerivedClassI.java b/java/test/src/main/java/test/Ice/operations/AMDMyDerivedClassI.java
index df9877ad850..cadaf38e0d2 100644
--- a/java/test/src/main/java/test/Ice/operations/AMDMyDerivedClassI.java
+++ b/java/test/src/main/java/test/Ice/operations/AMDMyDerivedClassI.java
@@ -9,15 +9,17 @@
package test.Ice.operations;
-import Ice.Current;
-import test.Ice.operations.AMD.Test.*;
-
import java.util.*;
+import java.util.concurrent.CompletionStage;
+import java.util.concurrent.CompletableFuture;
+
+import com.zeroc.Ice.Current;
-public final class AMDMyDerivedClassI extends MyDerivedClass
+import test.Ice.operations.AMD.Test.*;
+
+public final class AMDMyDerivedClassI implements _MyDerivedClassDisp
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -27,19 +29,18 @@ public final class AMDMyDerivedClassI extends MyDerivedClass
static class Thread_opVoid extends Thread
{
- public Thread_opVoid(AMD_MyClass_opVoid cb)
+ public Thread_opVoid(CompletableFuture<Void> f)
{
- _cb = cb;
+ _future = f;
}
@Override
- public void
- run()
+ public void run()
{
- _cb.ice_response();
+ _future.complete((Void)null);
}
- private AMD_MyClass_opVoid _cb;
+ private CompletableFuture<Void> _future;
}
//
@@ -47,41 +48,35 @@ public final class AMDMyDerivedClassI extends MyDerivedClass
//
@Override
- public boolean
- ice_isA(String id, Ice.Current current)
+ public boolean ice_isA(String id, Current current)
{
- test(current.mode == Ice.OperationMode.Nonmutating);
- return super.ice_isA(id, current);
+ test(current.mode == com.zeroc.Ice.OperationMode.Nonmutating);
+ return _MyDerivedClassDisp.super.ice_isA(id, current);
}
@Override
- public void
- ice_ping(Ice.Current current)
+ public void ice_ping(Current current)
{
- test(current.mode == Ice.OperationMode.Nonmutating);
- super.ice_ping(current);
+ test(current.mode == com.zeroc.Ice.OperationMode.Nonmutating);
+ _MyDerivedClassDisp.super.ice_ping(current);
}
@Override
- public String[]
- ice_ids(Ice.Current current)
+ public String[] ice_ids(Current current)
{
- test(current.mode == Ice.OperationMode.Nonmutating);
- return super.ice_ids(current);
+ test(current.mode == com.zeroc.Ice.OperationMode.Nonmutating);
+ return _MyDerivedClassDisp.super.ice_ids(current);
}
@Override
- public String
- ice_id(Ice.Current current)
+ public String ice_id(Current current)
{
- test(current.mode == Ice.OperationMode.Nonmutating);
- return super.ice_id(current);
+ test(current.mode == com.zeroc.Ice.OperationMode.Nonmutating);
+ return _MyDerivedClassDisp.super.ice_id(current);
}
@Override
- synchronized public void
- shutdown_async(AMD_MyClass_shutdown cb,
- Ice.Current current)
+ synchronized public CompletionStage<Void> shutdownAsync(Current current)
{
while(_opVoidThread != null)
{
@@ -96,15 +91,13 @@ public final class AMDMyDerivedClassI extends MyDerivedClass
}
current.adapter.getCommunicator().shutdown();
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- synchronized public void
- opVoid_async(AMD_MyClass_opVoid cb,
- Ice.Current current)
+ synchronized public CompletionStage<Void> opVoidAsync(Current current)
{
- test(current.mode == Ice.OperationMode.Normal);
+ test(current.mode == com.zeroc.Ice.OperationMode.Normal);
while(_opVoidThread != null)
{
@@ -118,570 +111,537 @@ public final class AMDMyDerivedClassI extends MyDerivedClass
}
}
- _opVoidThread = new Thread_opVoid(cb);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ _opVoidThread = new Thread_opVoid(f);
_opVoidThread.start();
+ return f;
}
@Override
- public void
- opBool_async(AMD_MyClass_opBool cb,
- boolean p1, boolean p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpBoolResult> opBoolAsync(boolean p1, boolean p2, Current current)
{
- cb.ice_response(p2, p1);
+ return CompletableFuture.completedFuture(new MyClass.OpBoolResult(p2, p1));
}
@Override
- public void
- opBoolS_async(AMD_MyClass_opBoolS cb,
- boolean[] p1, boolean[] p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpBoolSResult> opBoolSAsync(boolean[] p1, boolean[] p2, Current current)
{
- boolean[] p3 = new boolean[p1.length + p2.length];
- System.arraycopy(p1, 0, p3, 0, p1.length);
- System.arraycopy(p2, 0, p3, p1.length, p2.length);
+ MyClass.OpBoolSResult r = new MyClass.OpBoolSResult();
+ r.p3 = new boolean[p1.length + p2.length];
+ System.arraycopy(p1, 0, r.p3, 0, p1.length);
+ System.arraycopy(p2, 0, r.p3, p1.length, p2.length);
- boolean[] r = new boolean[p1.length];
+ r.returnValue = new boolean[p1.length];
for(int i = 0; i < p1.length; i++)
{
- r[i] = p1[p1.length - (i + 1)];
+ r.returnValue[i] = p1[p1.length - (i + 1)];
}
- cb.ice_response(r, p3);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- opBoolSS_async(AMD_MyClass_opBoolSS cb,
- boolean[][] p1, boolean[][] p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpBoolSSResult> opBoolSSAsync(boolean[][] p1, boolean[][] p2, Current current)
{
- boolean[][] p3 = new boolean[p1.length + p2.length][];
- System.arraycopy(p1, 0, p3, 0, p1.length);
- System.arraycopy(p2, 0, p3, p1.length, p2.length);
+ MyClass.OpBoolSSResult r = new MyClass.OpBoolSSResult();
+ r.p3 = new boolean[p1.length + p2.length][];
+ System.arraycopy(p1, 0, r.p3, 0, p1.length);
+ System.arraycopy(p2, 0, r.p3, p1.length, p2.length);
- boolean[][] r = new boolean[p1.length][];
+ r.returnValue = new boolean[p1.length][];
for(int i = 0; i < p1.length; i++)
{
- r[i] = p1[p1.length - (i + 1)];
+ r.returnValue[i] = p1[p1.length - (i + 1)];
}
- cb.ice_response(r, p3);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- opByte_async(AMD_MyClass_opByte cb,
- byte p1, byte p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpByteResult> opByteAsync(byte p1, byte p2, Current current)
{
- cb.ice_response(p1, (byte) (p1 ^ p2));
+ return CompletableFuture.completedFuture(new MyClass.OpByteResult(p1, (byte) (p1 ^ p2)));
}
@Override
- public void
- opByteBoolD_async(AMD_MyClass_opByteBoolD cb,
- java.util.Map<Byte, Boolean> p1, java.util.Map<Byte, Boolean> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpByteBoolDResult> opByteBoolDAsync(java.util.Map<Byte, Boolean> p1,
+ java.util.Map<Byte, Boolean> p2,
+ Current current)
{
- java.util.Map<Byte, Boolean> p3 = p1;
- java.util.Map<Byte, Boolean> r = new java.util.HashMap<Byte, Boolean>();
- r.putAll(p1);
- r.putAll(p2);
- cb.ice_response(r, p3);
+ MyClass.OpByteBoolDResult r = new MyClass.OpByteBoolDResult();
+ r.p3 = p1;
+ r.returnValue = new java.util.HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- opByteS_async(AMD_MyClass_opByteS cb,
- byte[] p1, byte[] p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpByteSResult> opByteSAsync(byte[] p1, byte[] p2, Current current)
{
- byte[] p3 = new byte[p1.length];
+ MyClass.OpByteSResult r = new MyClass.OpByteSResult();
+ r.p3 = new byte[p1.length];
for(int i = 0; i < p1.length; i++)
{
- p3[i] = p1[p1.length - (i + 1)];
+ r.p3[i] = p1[p1.length - (i + 1)];
}
- byte[] r = new byte[p1.length + p2.length];
- System.arraycopy(p1, 0, r, 0, p1.length);
- System.arraycopy(p2, 0, r, p1.length, p2.length);
- cb.ice_response(r, p3);
+ r.returnValue = new byte[p1.length + p2.length];
+ System.arraycopy(p1, 0, r.returnValue, 0, p1.length);
+ System.arraycopy(p2, 0, r.returnValue, p1.length, p2.length);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- opByteSS_async(AMD_MyClass_opByteSS cb,
- byte[][] p1, byte[][] p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpByteSSResult> opByteSSAsync(byte[][] p1, byte[][] p2, Current current)
{
- byte[][] p3 = new byte[p1.length][];
+ MyClass.OpByteSSResult r = new MyClass.OpByteSSResult();
+ r.p3 = new byte[p1.length][];
for(int i = 0; i < p1.length; i++)
{
- p3[i] = p1[p1.length - (i + 1)];
+ r.p3[i] = p1[p1.length - (i + 1)];
}
- byte[][] r = new byte[p1.length + p2.length][];
- System.arraycopy(p1, 0, r, 0, p1.length);
- System.arraycopy(p2, 0, r, p1.length, p2.length);
- cb.ice_response(r, p3);
+ r.returnValue = new byte[p1.length + p2.length][];
+ System.arraycopy(p1, 0, r.returnValue, 0, p1.length);
+ System.arraycopy(p2, 0, r.returnValue, p1.length, p2.length);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- opFloatDouble_async(AMD_MyClass_opFloatDouble cb,
- float p1, double p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpFloatDoubleResult> opFloatDoubleAsync(float p1, double p2, Current current)
{
- cb.ice_response(p2, p1, p2);
+ return CompletableFuture.completedFuture(new MyClass.OpFloatDoubleResult(p2, p1, p2));
}
@Override
- public void
- opFloatDoubleS_async(AMD_MyClass_opFloatDoubleS cb,
- float[] p1, double[] p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpFloatDoubleSResult> opFloatDoubleSAsync(float[] p1, double[] p2, Current current)
{
- float[] p3 = p1;
- double[] p4 = new double[p2.length];
+ MyClass.OpFloatDoubleSResult r = new MyClass.OpFloatDoubleSResult();
+ r.p3 = p1;
+ r.p4 = new double[p2.length];
for(int i = 0; i < p2.length; i++)
{
- p4[i] = p2[p2.length - (i + 1)];
+ r.p4[i] = p2[p2.length - (i + 1)];
}
- double[] r = new double[p2.length + p1.length];
- System.arraycopy(p2, 0, r, 0, p2.length);
+ r.returnValue = new double[p2.length + p1.length];
+ System.arraycopy(p2, 0, r.returnValue, 0, p2.length);
for(int i = 0; i < p1.length; i++)
{
- r[p2.length + i] = p1[i];
+ r.returnValue[p2.length + i] = p1[i];
}
- cb.ice_response(r, p3, p4);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- opFloatDoubleSS_async(AMD_MyClass_opFloatDoubleSS cb,
- float[][] p1, double[][] p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpFloatDoubleSSResult> opFloatDoubleSSAsync(float[][] p1, double[][] p2,
+ Current current)
{
- float[][] p3 = p1;
- double[][] p4 = new double[p2.length][];
+ MyClass.OpFloatDoubleSSResult r = new MyClass.OpFloatDoubleSSResult();
+ r.p3 = p1;
+ r.p4 = new double[p2.length][];
for(int i = 0; i < p2.length; i++)
{
- p4[i] = p2[p2.length - (i + 1)];
+ r.p4[i] = p2[p2.length - (i + 1)];
}
- double[][] r = new double[p2.length * 2][];
- System.arraycopy(p2, 0, r, 0, p2.length);
- System.arraycopy(p2, 0, r, p2.length, p2.length);
- cb.ice_response(r, p3, p4);
+ r.returnValue = new double[p2.length * 2][];
+ System.arraycopy(p2, 0, r.returnValue, 0, p2.length);
+ System.arraycopy(p2, 0, r.returnValue, p2.length, p2.length);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- opLongFloatD_async(AMD_MyClass_opLongFloatD cb,
- java.util.Map<Long, Float> p1, java.util.Map<Long, Float> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpLongFloatDResult> opLongFloatDAsync(java.util.Map<Long, Float> p1,
+ java.util.Map<Long, Float> p2,
+ Current current)
{
- java.util.Map<Long, Float> p3 = p1;
- java.util.Map<Long, Float> r = new java.util.HashMap<Long, Float>();
- r.putAll(p1);
- r.putAll(p2);
- cb.ice_response(r, p3);
+ MyClass.OpLongFloatDResult r = new MyClass.OpLongFloatDResult();
+ r.p3 = p1;
+ r.returnValue = new java.util.HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- opMyClass_async(AMD_MyClass_opMyClass cb,
- MyClassPrx p1,
- Ice.Current current)
+ public CompletionStage<MyClass.OpMyClassResult> opMyClassAsync(MyClassPrx p1, Current current)
{
- MyClassPrx p2 = p1;
- MyClassPrx p3 = MyClassPrxHelper.uncheckedCast(
- current.adapter.createProxy(Ice.Util.stringToIdentity("noSuchIdentity")));
- cb.ice_response(MyClassPrxHelper.uncheckedCast(current.adapter.createProxy(current.id)), p2, p3);
+ MyClass.OpMyClassResult r = new MyClass.OpMyClassResult();
+ r.p2 = p1;
+ r.p3 = MyClassPrx.uncheckedCast(
+ current.adapter.createProxy(com.zeroc.Ice.Util.stringToIdentity("noSuchIdentity")));
+ r.returnValue = MyClassPrx.uncheckedCast(current.adapter.createProxy(current.id));
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- opMyEnum_async(AMD_MyClass_opMyEnum cb,
- MyEnum p1,
- Ice.Current current)
+ public CompletionStage<MyClass.OpMyEnumResult> opMyEnumAsync(MyEnum p1, Current current)
{
- cb.ice_response(MyEnum.enum3, p1);
+ return CompletableFuture.completedFuture(new MyClass.OpMyEnumResult(MyEnum.enum3, p1));
}
@Override
- public void
- opShortIntD_async(AMD_MyClass_opShortIntD cb,
- java.util.Map<Short, Integer> p1, java.util.Map<Short, Integer> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpShortIntDResult> opShortIntDAsync(java.util.Map<Short, Integer> p1,
+ java.util.Map<Short, Integer> p2,
+ Current current)
{
- java.util.Map<Short, Integer> p3 = p1;
- java.util.Map<Short, Integer> r = new java.util.HashMap<Short, Integer>();
- r.putAll(p1);
- r.putAll(p2);
- cb.ice_response(r, p3);
+ MyClass.OpShortIntDResult r = new MyClass.OpShortIntDResult();
+ r.p3 = p1;
+ r.returnValue = new java.util.HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- opShortIntLong_async(AMD_MyClass_opShortIntLong cb,
- short p1, int p2, long p3,
- Ice.Current current)
+ public CompletionStage<MyClass.OpShortIntLongResult> opShortIntLongAsync(short p1, int p2, long p3,
+ Current current)
{
- cb.ice_response(p3, p1, p2, p3);
+ return CompletableFuture.completedFuture(new MyClass.OpShortIntLongResult(p3, p1, p2, p3));
}
@Override
- public void
- opShortIntLongS_async(AMD_MyClass_opShortIntLongS cb,
- short[] p1, int[] p2, long[] p3,
- Ice.Current current)
+ public CompletionStage<MyClass.OpShortIntLongSResult> opShortIntLongSAsync(short[] p1, int[] p2, long[] p3,
+ Current current)
{
- short[] p4 = p1;
- int[] p5 = new int[p2.length];
+ MyClass.OpShortIntLongSResult r = new MyClass.OpShortIntLongSResult();
+ r.p4 = p1;
+ r.p5 = new int[p2.length];
for(int i = 0; i < p2.length; i++)
{
- p5[i] = p2[p2.length - (i + 1)];
+ r.p5[i] = p2[p2.length - (i + 1)];
}
- long[] p6 = new long[p3.length * 2];
- System.arraycopy(p3, 0, p6, 0, p3.length);
- System.arraycopy(p3, 0, p6, p3.length, p3.length);
- cb.ice_response(p3, p4, p5, p6);
+ r.p6 = new long[p3.length * 2];
+ System.arraycopy(p3, 0, r.p6, 0, p3.length);
+ System.arraycopy(p3, 0, r.p6, p3.length, p3.length);
+ r.returnValue = p3;
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- opShortIntLongSS_async(AMD_MyClass_opShortIntLongSS cb,
- short[][] p1, int[][] p2, long[][] p3,
- Ice.Current current)
+ public CompletionStage<MyClass.OpShortIntLongSSResult> opShortIntLongSSAsync(short[][] p1, int[][] p2, long[][] p3,
+ Current current)
{
- short[][] p4 = p1;
- int[][] p5 = new int[p2.length][];
+ MyClass.OpShortIntLongSSResult r = new MyClass.OpShortIntLongSSResult();
+ r.p4 = p1;
+ r.p5 = new int[p2.length][];
for(int i = 0; i < p2.length; i++)
{
- p5[i] = p2[p2.length - (i + 1)];
+ r.p5[i] = p2[p2.length - (i + 1)];
}
- long[][] p6 = new long[p3.length * 2][];
- System.arraycopy(p3, 0, p6, 0, p3.length);
- System.arraycopy(p3, 0, p6, p3.length, p3.length);
- cb.ice_response(p3, p4, p5, p6);
+ r.p6 = new long[p3.length * 2][];
+ System.arraycopy(p3, 0, r.p6, 0, p3.length);
+ System.arraycopy(p3, 0, r.p6, p3.length, p3.length);
+ r.returnValue = p3;
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- opString_async(AMD_MyClass_opString cb,
- String p1, String p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpStringResult> opStringAsync(String p1, String p2, Current current)
{
- cb.ice_response(p1 + " " + p2, p2 + " " + p1);
+ MyClass.OpStringResult r = new MyClass.OpStringResult();
+ r.p3 = p2 + " " + p1;
+ r.returnValue = p1 + " " + p2;
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- opStringMyEnumD_async(AMD_MyClass_opStringMyEnumD cb,
- java.util.Map<String, MyEnum> p1, java.util.Map<String, MyEnum> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpStringMyEnumDResult> opStringMyEnumDAsync(java.util.Map<String, MyEnum> p1,
+ java.util.Map<String, MyEnum> p2,
+ Current current)
{
- java.util.Map<String, MyEnum> p3 = p1;
- java.util.Map<String, MyEnum> r = new java.util.HashMap<String, MyEnum>();
- r.putAll(p1);
- r.putAll(p2);
- cb.ice_response(r, p3);
+ MyClass.OpStringMyEnumDResult r = new MyClass.OpStringMyEnumDResult();
+ r.p3 = p1;
+ r.returnValue = new java.util.HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- opMyEnumStringD_async(AMD_MyClass_opMyEnumStringD cb,
- java.util.Map<MyEnum, String> p1, java.util.Map<MyEnum, String> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpMyEnumStringDResult> opMyEnumStringDAsync(java.util.Map<MyEnum, String> p1,
+ java.util.Map<MyEnum, String> p2,
+ Current current)
{
- java.util.Map<MyEnum, String> p3 = p1;
- java.util.Map<MyEnum, String> r = new java.util.HashMap<MyEnum, String>();
- r.putAll(p1);
- r.putAll(p2);
- cb.ice_response(r, p3);
+ MyClass.OpMyEnumStringDResult r = new MyClass.OpMyEnumStringDResult();
+ r.p3 = p1;
+ r.returnValue = new java.util.HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- opMyStructMyEnumD_async(AMD_MyClass_opMyStructMyEnumD cb,
- java.util.Map<MyStruct, MyEnum> p1, java.util.Map<MyStruct, MyEnum> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpMyStructMyEnumDResult> opMyStructMyEnumDAsync(java.util.Map<MyStruct, MyEnum> p1,
+ java.util.Map<MyStruct, MyEnum> p2,
+ Current current)
{
- java.util.Map<MyStruct, MyEnum> p3 = p1;
- java.util.Map<MyStruct, MyEnum> r = new java.util.HashMap<MyStruct, MyEnum>();
- r.putAll(p1);
- r.putAll(p2);
- cb.ice_response(r, p3);
+ MyClass.OpMyStructMyEnumDResult r = new MyClass.OpMyStructMyEnumDResult();
+ r.p3 = p1;
+ r.returnValue = new java.util.HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void opByteBoolDS_async(AMD_MyClass_opByteBoolDS cb,
- List<Map<Byte, Boolean>> p1,
- List<Map<Byte, Boolean>> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpByteBoolDSResult> opByteBoolDSAsync(List<Map<Byte, Boolean>> p1,
+ List<Map<Byte, Boolean>> p2,
+ Current current)
{
+ MyClass.OpByteBoolDSResult r = new MyClass.OpByteBoolDSResult();
+ r.p3 = new ArrayList<>();
+ r.p3.addAll(p2);
+ r.p3.addAll(p1);
- ArrayList<Map<Byte, Boolean>> p3= new ArrayList<>();
- p3.addAll(p2);
- p3.addAll(p1);
-
- List<Map<Byte, Boolean>> r = new ArrayList<>(p1);
- Collections.reverse(r);
+ r.returnValue = new ArrayList<>(p1);
+ Collections.reverse(r.returnValue);
- cb.ice_response(r, p3);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void opShortIntDS_async(AMD_MyClass_opShortIntDS cb,
- List<Map<Short, Integer>> p1,
- List<Map<Short, Integer>> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpShortIntDSResult> opShortIntDSAsync(List<Map<Short, Integer>> p1,
+ List<Map<Short, Integer>> p2,
+ Current current)
{
- List<Map<Short, Integer>> p3= new ArrayList<>();
- p3.addAll(p2);
- p3.addAll(p1);
+ MyClass.OpShortIntDSResult r = new MyClass.OpShortIntDSResult();
+ r.p3 = new ArrayList<>();
+ r.p3.addAll(p2);
+ r.p3.addAll(p1);
- List<Map<Short, Integer>> r = new ArrayList<>(p1);
- Collections.reverse(r);
+ r.returnValue = new ArrayList<>(p1);
+ Collections.reverse(r.returnValue);
- cb.ice_response(r, p3);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void opLongFloatDS_async(AMD_MyClass_opLongFloatDS cb,
- List<Map<Long, Float>> p1,
- List<Map<Long, Float>> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpLongFloatDSResult> opLongFloatDSAsync(List<Map<Long, Float>> p1,
+ List<Map<Long, Float>> p2,
+ Current current)
{
- List<Map<Long, Float>> p3= new ArrayList<>();
- p3.addAll(p2);
- p3.addAll(p1);
+ MyClass.OpLongFloatDSResult r = new MyClass.OpLongFloatDSResult();
+ r.p3 = new ArrayList<>();
+ r.p3.addAll(p2);
+ r.p3.addAll(p1);
- List<Map<Long, Float>> r = new ArrayList<>(p1);
- Collections.reverse(r);
+ r.returnValue = new ArrayList<>(p1);
+ Collections.reverse(r.returnValue);
- cb.ice_response(r, p3);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void opStringStringDS_async(AMD_MyClass_opStringStringDS cb,
- List<Map<String, String>> p1,
- List<Map<String, String>> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpStringStringDSResult> opStringStringDSAsync(List<Map<String, String>> p1,
+ List<Map<String, String>> p2,
+ Current current)
{
- List<Map<String, String>> p3= new ArrayList<>();
- p3.addAll(p2);
- p3.addAll(p1);
+ MyClass.OpStringStringDSResult r = new MyClass.OpStringStringDSResult();
+ r.p3 = new ArrayList<>();
+ r.p3.addAll(p2);
+ r.p3.addAll(p1);
- List<Map<String, String>> r = new ArrayList<>(p1);
- Collections.reverse(r);
+ r.returnValue = new ArrayList<>(p1);
+ Collections.reverse(r.returnValue);
- cb.ice_response(r, p3);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void opStringMyEnumDS_async(AMD_MyClass_opStringMyEnumDS cb,
- List<Map<String, MyEnum>> p1,
- List<Map<String, MyEnum>> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpStringMyEnumDSResult> opStringMyEnumDSAsync(List<Map<String, MyEnum>> p1,
+ List<Map<String, MyEnum>> p2,
+ Current current)
{
- List<Map<String, MyEnum>> p3= new ArrayList<>();
- p3.addAll(p2);
- p3.addAll(p1);
+ MyClass.OpStringMyEnumDSResult r = new MyClass.OpStringMyEnumDSResult();
+ r.p3 = new ArrayList<>();
+ r.p3.addAll(p2);
+ r.p3.addAll(p1);
- List<Map<String, MyEnum>> r = new ArrayList<>(p1);
- Collections.reverse(r);
+ r.returnValue = new ArrayList<>(p1);
+ Collections.reverse(r.returnValue);
- cb.ice_response(r, p3);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void opMyEnumStringDS_async(AMD_MyClass_opMyEnumStringDS cb,
- List<Map<MyEnum, String>> p1,
- List<Map<MyEnum, String>> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpMyEnumStringDSResult> opMyEnumStringDSAsync(List<Map<MyEnum, String>> p1,
+ List<Map<MyEnum, String>> p2,
+ Current current)
{
- List<Map<MyEnum, String>> p3= new ArrayList<>();
- p3.addAll(p2);
- p3.addAll(p1);
+ MyClass.OpMyEnumStringDSResult r = new MyClass.OpMyEnumStringDSResult();
+ r.p3 = new ArrayList<>();
+ r.p3.addAll(p2);
+ r.p3.addAll(p1);
- List<Map<MyEnum, String>> r = new ArrayList<>(p1);
- Collections.reverse(r);
+ r.returnValue = new ArrayList<>(p1);
+ Collections.reverse(r.returnValue);
- cb.ice_response(r, p3);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void opMyStructMyEnumDS_async(AMD_MyClass_opMyStructMyEnumDS cb,
- List<Map<MyStruct, MyEnum>> p1,
- List<Map<MyStruct, MyEnum>> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpMyStructMyEnumDSResult> opMyStructMyEnumDSAsync(List<Map<MyStruct, MyEnum>> p1,
+ List<Map<MyStruct, MyEnum>> p2,
+ Current current)
{
- List<Map<MyStruct, MyEnum>> p3= new ArrayList<>();
- p3.addAll(p2);
- p3.addAll(p1);
+ MyClass.OpMyStructMyEnumDSResult r = new MyClass.OpMyStructMyEnumDSResult();
+ r.p3 = new ArrayList<>();
+ r.p3.addAll(p2);
+ r.p3.addAll(p1);
- List<Map<MyStruct, MyEnum>> r = new ArrayList<>(p1);
- Collections.reverse(r);
+ r.returnValue = new ArrayList<>(p1);
+ Collections.reverse(r.returnValue);
- cb.ice_response(r, p3);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void opByteByteSD_async(AMD_MyClass_opByteByteSD cb,
- Map<Byte, byte[]> p1,
- Map<Byte, byte[]> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpByteByteSDResult> opByteByteSDAsync(Map<Byte, byte[]> p1, Map<Byte, byte[]> p2,
+ Current current)
{
- Map<Byte, byte[]> p3 = p2;
- Map<Byte, byte[]> r = new HashMap<>();
- r.putAll(p1);
- r.putAll(p2);
- cb.ice_response(r, p3);
+ MyClass.OpByteByteSDResult r = new MyClass.OpByteByteSDResult();
+ r.p3 = p2;
+ r.returnValue = new HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void opBoolBoolSD_async(AMD_MyClass_opBoolBoolSD cb,
- Map<Boolean, boolean[]> p1,
- Map<Boolean, boolean[]> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpBoolBoolSDResult> opBoolBoolSDAsync(Map<Boolean, boolean[]> p1,
+ Map<Boolean, boolean[]> p2,
+ Current current)
{
- Map<Boolean, boolean[]> p3 = p2;
- Map<Boolean, boolean[]> r = new HashMap<>();
- r.putAll(p1);
- r.putAll(p2);
- cb.ice_response(r, p3);
+ MyClass.OpBoolBoolSDResult r = new MyClass.OpBoolBoolSDResult();
+ r.p3 = p2;
+ r.returnValue = new HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void opShortShortSD_async(AMD_MyClass_opShortShortSD cb,
- Map<Short, short[]> p1,
- Map<Short, short[]> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpShortShortSDResult> opShortShortSDAsync(Map<Short, short[]> p1,
+ Map<Short, short[]> p2,
+ Current current)
{
- Map<Short, short[]> p3 = p2;
- Map<Short, short[]> r = new HashMap<>();
- r.putAll(p1);
- r.putAll(p2);
- cb.ice_response(r, p3);
+ MyClass.OpShortShortSDResult r = new MyClass.OpShortShortSDResult();
+ r.p3 = p2;
+ r.returnValue = new HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void opIntIntSD_async(AMD_MyClass_opIntIntSD cb,
- Map<Integer, int[]> p1,
- Map<Integer, int[]> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpIntIntSDResult> opIntIntSDAsync(Map<Integer, int[]> p1, Map<Integer, int[]> p2,
+ Current current)
{
- Map<Integer, int[]> p3 = p2;
- Map<Integer, int[]> r = new HashMap<>();
- r.putAll(p1);
- r.putAll(p2);
- cb.ice_response(r, p3);
+ MyClass.OpIntIntSDResult r = new MyClass.OpIntIntSDResult();
+ r.p3 = p2;
+ r.returnValue = new HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void opLongLongSD_async(AMD_MyClass_opLongLongSD cb,
- Map<Long, long[]> p1,
- Map<Long, long[]> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpLongLongSDResult> opLongLongSDAsync(Map<Long, long[]> p1, Map<Long, long[]> p2,
+ Current current)
{
- Map<Long, long[]> p3 = p2;
- Map<Long, long[]> r = new HashMap<>();
- r.putAll(p1);
- r.putAll(p2);
- cb.ice_response(r, p3);
+ MyClass.OpLongLongSDResult r = new MyClass.OpLongLongSDResult();
+ r.p3 = p2;
+ r.returnValue = new HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void opStringFloatSD_async(AMD_MyClass_opStringFloatSD cb,
- Map<String, float[]> p1,
- Map<String, float[]> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpStringFloatSDResult> opStringFloatSDAsync(Map<String, float[]> p1,
+ Map<String, float[]> p2,
+ Current current)
{
- Map<String, float[]> p3 = p2;
- Map<String, float[]> r = new HashMap<>();
- r.putAll(p1);
- r.putAll(p2);
- cb.ice_response(r, p3);
+ MyClass.OpStringFloatSDResult r = new MyClass.OpStringFloatSDResult();
+ r.p3 = p2;
+ r.returnValue = new HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void opStringDoubleSD_async(AMD_MyClass_opStringDoubleSD cb,
- Map<String, double[]> p1,
- Map<String, double[]> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpStringDoubleSDResult> opStringDoubleSDAsync(Map<String, double[]> p1,
+ Map<String, double[]> p2,
+ Current current)
{
- Map<String, double[]> p3 = p2;
- Map<String, double[]> r = new HashMap<>();
- r.putAll(p1);
- r.putAll(p2);
- cb.ice_response(r, p3);
+ MyClass.OpStringDoubleSDResult r = new MyClass.OpStringDoubleSDResult();
+ r.p3 = p2;
+ r.returnValue = new HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void opStringStringSD_async(AMD_MyClass_opStringStringSD cb,
- Map<String, String[]> p1,
- Map<String, String[]> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpStringStringSDResult> opStringStringSDAsync(Map<String, String[]> p1,
+ Map<String, String[]> p2,
+ Current current)
{
- Map<String, String[]> p3 = p2;
- Map<String, String[]> r = new HashMap<>();
- r.putAll(p1);
- r.putAll(p2);
- cb.ice_response(r, p3);
+ MyClass.OpStringStringSDResult r = new MyClass.OpStringStringSDResult();
+ r.p3 = p2;
+ r.returnValue = new HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void opMyEnumMyEnumSD_async(AMD_MyClass_opMyEnumMyEnumSD cb,
- Map<MyEnum, MyEnum[]> p1,
- Map<MyEnum, MyEnum[]> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpMyEnumMyEnumSDResult> opMyEnumMyEnumSDAsync(Map<MyEnum, MyEnum[]> p1,
+ Map<MyEnum, MyEnum[]> p2,
+ Current current)
{
- Map<MyEnum, MyEnum[]> p3 = p2;
- Map<MyEnum, MyEnum[]> r = new HashMap<>();
- r.putAll(p1);
- r.putAll(p2);
- cb.ice_response(r, p3);
+ MyClass.OpMyEnumMyEnumSDResult r = new MyClass.OpMyEnumMyEnumSDResult();
+ r.p3 = p2;
+ r.returnValue = new HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- opIntS_async(AMD_MyClass_opIntS cb, int[] s, Ice.Current current)
+ public CompletionStage<int[]> opIntSAsync(int[] s, Current current)
{
int[] r = new int[s.length];
for(int i = 0; i < r.length; ++i)
{
r[i] = -s[i];
}
- cb.ice_response(r);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public synchronized void
- opByteSOneway_async(AMD_MyClass_opByteSOneway cb, byte[] s, Ice.Current current)
+ public synchronized CompletionStage<Void> opByteSOnewayAsync(byte[] s, Current current)
{
++_opByteSOnewayCallCount;
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public synchronized void
- opByteSOnewayCallCount_async(AMD_MyClass_opByteSOnewayCallCount cb, Ice.Current current)
+ public synchronized CompletionStage<Integer> opByteSOnewayCallCountAsync(Current current)
{
int count = _opByteSOnewayCallCount;
_opByteSOnewayCallCount = 0;
- cb.ice_response(count);
+ return CompletableFuture.completedFuture(count);
}
@Override
- public void
- opContext_async(AMD_MyClass_opContext cb, Ice.Current current)
+ public CompletionStage<Map<String, String>> opContextAsync(Current current)
{
- cb.ice_response(current.ctx);
+ return CompletableFuture.completedFuture(current.ctx);
}
@Override
- public void
- opDoubleMarshaling_async(AMD_MyClass_opDoubleMarshaling cb, double p1, double[] p2, Ice.Current current)
+ public CompletionStage<Void> opDoubleMarshalingAsync(double p1, double[] p2, Current current)
{
double d = 1278312346.0 / 13.0;
test(p1 == d);
@@ -689,195 +649,183 @@ public final class AMDMyDerivedClassI extends MyDerivedClass
{
test(p2[i] == d);
}
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- opStringS_async(AMD_MyClass_opStringS cb,
- String[] p1, String[] p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpStringSResult> opStringSAsync(String[] p1, String[] p2, Current current)
{
- String[] p3 = new String[p1.length + p2.length];
- System.arraycopy(p1, 0, p3, 0, p1.length);
- System.arraycopy(p2, 0, p3, p1.length, p2.length);
+ MyClass.OpStringSResult r = new MyClass.OpStringSResult();
+ r.p3 = new String[p1.length + p2.length];
+ System.arraycopy(p1, 0, r.p3, 0, p1.length);
+ System.arraycopy(p2, 0, r.p3, p1.length, p2.length);
- String[] r = new String[p1.length];
+ r.returnValue = new String[p1.length];
for(int i = 0; i < p1.length; i++)
{
- r[i] = p1[p1.length - (i + 1)];
+ r.returnValue[i] = p1[p1.length - (i + 1)];
}
- cb.ice_response(r, p3);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- opStringSS_async(AMD_MyClass_opStringSS cb,
- String[][] p1, String[][] p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpStringSSResult> opStringSSAsync(String[][] p1, String[][] p2, Current current)
{
- String[][] p3 = new String[p1.length + p2.length][];
- System.arraycopy(p1, 0, p3, 0, p1.length);
- System.arraycopy(p2, 0, p3, p1.length, p2.length);
+ MyClass.OpStringSSResult r = new MyClass.OpStringSSResult();
+ r.p3 = new String[p1.length + p2.length][];
+ System.arraycopy(p1, 0, r.p3, 0, p1.length);
+ System.arraycopy(p2, 0, r.p3, p1.length, p2.length);
- String[][] r = new String[p2.length][];
+ r.returnValue = new String[p2.length][];
for(int i = 0; i < p2.length; i++)
{
- r[i] = p2[p2.length - (i + 1)];
+ r.returnValue[i] = p2[p2.length - (i + 1)];
}
- cb.ice_response(r, p3);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- opStringSSS_async(AMD_MyClass_opStringSSS cb,
- String[][][] p1, String[][][] p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpStringSSSResult> opStringSSSAsync(String[][][] p1, String[][][] p2,
+ Current current)
{
- String[][][] p3 = new String[p1.length + p2.length][][];
- System.arraycopy(p1, 0, p3, 0, p1.length);
- System.arraycopy(p2, 0, p3, p1.length, p2.length);
+ MyClass.OpStringSSSResult r = new MyClass.OpStringSSSResult();
+ r.p3 = new String[p1.length + p2.length][][];
+ System.arraycopy(p1, 0, r.p3, 0, p1.length);
+ System.arraycopy(p2, 0, r.p3, p1.length, p2.length);
- String[][][] r = new String[p2.length][][];
+ r.returnValue = new String[p2.length][][];
for(int i = 0; i < p2.length; i++)
{
- r[i] = p2[p2.length - (i + 1)];
+ r.returnValue[i] = p2[p2.length - (i + 1)];
}
- cb.ice_response(r, p3);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- opStringStringD_async(AMD_MyClass_opStringStringD cb,
- java.util.Map<String, String> p1, java.util.Map<String, String> p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpStringStringDResult> opStringStringDAsync(java.util.Map<String, String> p1,
+ java.util.Map<String, String> p2,
+ Current current)
{
- java.util.Map<String, String> p3 = p1;
- java.util.Map<String, String> r = new java.util.HashMap<String, String>();
- r.putAll(p1);
- r.putAll(p2);
- cb.ice_response(r, p3);
+ MyClass.OpStringStringDResult r = new MyClass.OpStringStringDResult();
+ r.p3 = p1;
+ r.returnValue = new java.util.HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- opStruct_async(AMD_MyClass_opStruct cb,
- Structure p1, Structure p2,
- Ice.Current current)
+ public CompletionStage<MyClass.OpStructResult> opStructAsync(Structure p1, Structure p2, Current current)
{
- Structure p3 = p1;
- p3.s.s = "a new string";
- cb.ice_response(p2, p3);
+ MyClass.OpStructResult r = new MyClass.OpStructResult();
+ r.p3 = p1;
+ r.p3.s.s = "a new string";
+ r.returnValue = p2;
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- opIdempotent_async(AMD_MyClass_opIdempotent cb,
- Ice.Current current)
+ public CompletionStage<Void> opIdempotentAsync(Current current)
{
- test(current.mode == Ice.OperationMode.Idempotent);
- cb.ice_response();
+ test(current.mode == com.zeroc.Ice.OperationMode.Idempotent);
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- opNonmutating_async(AMD_MyClass_opNonmutating cb,
- Ice.Current current)
+ public CompletionStage<Void> opNonmutatingAsync(Current current)
{
- test(current.mode == Ice.OperationMode.Nonmutating);
- cb.ice_response();
+ test(current.mode == com.zeroc.Ice.OperationMode.Nonmutating);
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- opDerived_async(AMD_MyDerivedClass_opDerived cb,
- Ice.Current current)
+ public CompletionStage<Void> opDerivedAsync(Current current)
{
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void opByte1_async(AMD_MyClass_opByte1 cb, byte value, Ice.Current current)
+ public CompletionStage<Byte> opByte1Async(byte value, Current current)
{
- cb.ice_response(value);
+ return CompletableFuture.completedFuture(value);
}
@Override
- public void opShort1_async(AMD_MyClass_opShort1 cb, short value, Ice.Current current)
+ public CompletionStage<Short> opShort1Async(short value, Current current)
{
- cb.ice_response(value);
+ return CompletableFuture.completedFuture(value);
}
@Override
- public void opInt1_async(AMD_MyClass_opInt1 cb, int value, Ice.Current current)
+ public CompletionStage<Integer> opInt1Async(int value, Current current)
{
- cb.ice_response(value);
+ return CompletableFuture.completedFuture(value);
}
@Override
- public void opLong1_async(AMD_MyClass_opLong1 cb, long value, Ice.Current current)
+ public CompletionStage<Long> opLong1Async(long value, Current current)
{
- cb.ice_response(value);
+ return CompletableFuture.completedFuture(value);
}
@Override
- public void opFloat1_async(AMD_MyClass_opFloat1 cb, float value, Ice.Current current)
+ public CompletionStage<Float> opFloat1Async(float value, Current current)
{
- cb.ice_response(value);
+ return CompletableFuture.completedFuture(value);
}
@Override
- public void opDouble1_async(AMD_MyClass_opDouble1 cb, double value, Ice.Current current)
+ public CompletionStage<Double> opDouble1Async(double value, Current current)
{
- cb.ice_response(value);
+ return CompletableFuture.completedFuture(value);
}
@Override
- public void opString1_async(AMD_MyClass_opString1 cb, String value, Ice.Current current)
+ public CompletionStage<String> opString1Async(String value, Current current)
{
- cb.ice_response(value);
+ return CompletableFuture.completedFuture(value);
}
@Override
- public void opStringS1_async(AMD_MyClass_opStringS1 cb, String[] value, Ice.Current current)
+ public CompletionStage<String[]> opStringS1Async(String[] value, Current current)
{
- cb.ice_response(value);
+ return CompletableFuture.completedFuture(value);
}
@Override
- public void opByteBoolD1_async(AMD_MyClass_opByteBoolD1 cb, Map<Byte, Boolean> value, Ice.Current current)
+ public CompletionStage<Map<Byte, Boolean>> opByteBoolD1Async(Map<Byte, Boolean> value, Current current)
{
- cb.ice_response(value);
+ return CompletableFuture.completedFuture(value);
}
@Override
- public void opStringS2_async(AMD_MyClass_opStringS2 cb, String[] value, Ice.Current current)
+ public CompletionStage<String[]> opStringS2Async(String[] value, Current current)
{
- cb.ice_response(value);
+ return CompletableFuture.completedFuture(value);
}
@Override
- public void opByteBoolD2_async(AMD_MyClass_opByteBoolD2 cb, Map<Byte, Boolean> value, Ice.Current current)
+ public CompletionStage<Map<Byte, Boolean>> opByteBoolD2Async(Map<Byte, Boolean> value, Current current)
{
- cb.ice_response(value);
+ return CompletableFuture.completedFuture(value);
}
@Override
- public void opMyClass1_async(AMD_MyDerivedClass_opMyClass1 cb, MyClass1 value, Ice.Current current)
+ public CompletionStage<MyClass1> opMyClass1Async(MyClass1 value, Current current)
{
- cb.ice_response(value);
+ return CompletableFuture.completedFuture(value);
}
@Override
- public void opMyStruct1_async(AMD_MyDerivedClass_opMyStruct1 cb, MyStruct1 value, Ice.Current current)
+ public CompletionStage<MyStruct1> opMyStruct1Async(MyStruct1 value, Current current)
{
- cb.ice_response(value);
+ return CompletableFuture.completedFuture(value);
}
@Override
- public void opStringLiterals_async(AMD_MyClass_opStringLiterals cb, Ice.Current current)
+ public CompletionStage<String[]> opStringLiteralsAsync(Current current)
{
- cb.ice_response(new String[]
+ return CompletableFuture.completedFuture(new String[]
{
s0.value,
s1.value,
@@ -917,81 +865,45 @@ public final class AMDMyDerivedClassI extends MyDerivedClass
}
@Override
- public void opWStringLiterals_async(AMD_MyClass_opWStringLiterals cb, Ice.Current current)
+ public CompletionStage<String[]> opWStringLiteralsAsync(Current current)
{
- cb.ice_response(new String[]
- {
- s0.value,
- s1.value,
- s2.value,
- s3.value,
- s4.value,
- s5.value,
- s6.value,
- s7.value,
- s8.value,
- s9.value,
- s10.value,
-
- sw0.value,
- sw1.value,
- sw2.value,
- sw3.value,
- sw4.value,
- sw5.value,
- sw6.value,
- sw7.value,
- sw8.value,
- sw9.value,
- sw10.value,
-
- ss0.value,
- ss1.value,
- ss2.value,
- ss3.value,
- ss4.value,
- ss5.value,
-
- su0.value,
- su1.value,
- su2.value
- });
+ return opStringLiteralsAsync(current);
}
@Override
- public void opMStruct1_async(AMD_MyClass_opMStruct1 cb, Ice.Current current)
+ public CompletionStage<MyClass.OpMStruct1MarshaledResult> opMStruct1Async(Current current)
{
- cb.ice_response(new Structure());
+ return CompletableFuture.completedFuture(new MyClass.OpMStruct1MarshaledResult(new Structure(), current));
}
@Override
- public void opMStruct2_async(AMD_MyClass_opMStruct2 cb, Structure p1, Ice.Current current)
+ public CompletionStage<MyClass.OpMStruct2MarshaledResult> opMStruct2Async(Structure p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new MyClass.OpMStruct2MarshaledResult(p1, p1, current));
}
@Override
- public void opMSeq1_async(AMD_MyClass_opMSeq1 cb, Ice.Current current)
+ public CompletionStage<MyClass.OpMSeq1MarshaledResult> opMSeq1Async(Current current)
{
- cb.ice_response(new String[0]);
+ return CompletableFuture.completedFuture(new MyClass.OpMSeq1MarshaledResult(new String[0], current));
}
@Override
- public void opMSeq2_async(AMD_MyClass_opMSeq2 cb, String[] p1, Ice.Current current)
+ public CompletionStage<MyClass.OpMSeq2MarshaledResult> opMSeq2Async(String[] p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new MyClass.OpMSeq2MarshaledResult(p1, p1, current));
}
@Override
- public void opMDict1_async(AMD_MyClass_opMDict1 cb, Ice.Current current)
+ public CompletionStage<MyClass.OpMDict1MarshaledResult> opMDict1Async(Current current)
{
- cb.ice_response(new java.util.HashMap<String, String>());
+ return CompletableFuture.completedFuture(new MyClass.OpMDict1MarshaledResult(new HashMap<>(), current));
}
@Override
- public void opMDict2_async(AMD_MyClass_opMDict2 cb, java.util.Map<String, String> p1, Ice.Current current)
+ public CompletionStage<MyClass.OpMDict2MarshaledResult> opMDict2Async(Map<String, String> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new MyClass.OpMDict2MarshaledResult(p1, p1, current));
}
private Thread _opVoidThread;
diff --git a/java/test/src/main/java/test/Ice/operations/AMDServer.java b/java/test/src/main/java/test/Ice/operations/AMDServer.java
index 25437cbe39b..6a098dc5aa0 100644
--- a/java/test/src/main/java/test/Ice/operations/AMDServer.java
+++ b/java/test/src/main/java/test/Ice/operations/AMDServer.java
@@ -15,26 +15,25 @@ public class AMDServer extends test.Util.Application
public int run(String[] args)
{
communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- adapter.add(new AMDMyDerivedClassI(), Ice.Util.stringToIdentity("test"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.add(new AMDMyDerivedClassI(), com.zeroc.Ice.Util.stringToIdentity("test"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
+ GetInitDataResult r = super.getInitData(args);
//
// It's possible to have batch oneway requests dispatched
// after the adapter is deactivated due to thread
// scheduling so we suppress this warning.
//
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.operations.AMD");
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.operations.AMD");
- return initData;
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/operations/AllTests.java b/java/test/src/main/java/test/Ice/operations/AllTests.java
index 59e6e065ba1..9a9fbbe6d8c 100644
--- a/java/test/src/main/java/test/Ice/operations/AllTests.java
+++ b/java/test/src/main/java/test/Ice/operations/AllTests.java
@@ -8,23 +8,21 @@
// **********************************************************************
package test.Ice.operations;
+
import java.io.PrintWriter;
import test.Ice.operations.Test.MyClassPrx;
-import test.Ice.operations.Test.MyClassPrxHelper;
import test.Ice.operations.Test.MyDerivedClassPrx;
-import test.Ice.operations.Test.MyDerivedClassPrxHelper;
public class AllTests
{
- public static MyClassPrx
- allTests(test.Util.Application app, PrintWriter out)
+ public static MyClassPrx allTests(test.Util.Application app, PrintWriter out)
{
- Ice.Communicator communicator = app.communicator();
+ com.zeroc.Ice.Communicator communicator = app.communicator();
String ref = "test:default -p 12010";
- Ice.ObjectPrx base = communicator.stringToProxy(ref);
- MyClassPrx cl = MyClassPrxHelper.checkedCast(base);
- MyDerivedClassPrx derived = MyDerivedClassPrxHelper.checkedCast(cl);
+ com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ MyClassPrx cl = MyClassPrx.checkedCast(base);
+ MyDerivedClassPrx derived = MyDerivedClassPrx.checkedCast(cl);
out.print("testing twoway operations... ");
out.flush();
@@ -44,73 +42,11 @@ public class AllTests
TwowaysAMI.twowaysAMI(app, derived);
out.println("ok");
- //
- // Use reflection to load TwowaysLambdaAMI as that is only supported with Java >= 1.8
- //
- try
- {
- Class<?> cls = IceInternal.Util.findClass("test.Ice.operations.lambda.TwowaysLambdaAMI", null);
- if(cls != null)
- {
- java.lang.reflect.Method twowaysLambdaAMI =
- cls.getDeclaredMethod("twowaysLambdaAMI",
- new Class<?>[]{test.Util.Application.class, MyClassPrx.class});
- out.print("testing twoway operations with lambda AMI mapping... ");
- out.flush();
- twowaysLambdaAMI.invoke(null, app, cl);
- twowaysLambdaAMI.invoke(null, app, derived);
- out.println("ok");
- }
- }
- catch(java.lang.NoSuchMethodException ex)
- {
- throw new RuntimeException(ex);
- }
- catch(java.lang.IllegalAccessException ex)
- {
- throw new RuntimeException(ex);
- }
- catch(java.lang.reflect.InvocationTargetException ex)
- {
- throw new RuntimeException(ex);
- }
-
out.print("testing oneway operations with AMI... ");
out.flush();
OnewaysAMI.onewaysAMI(app, cl);
out.println("ok");
- //
- // Use reflection to load OnewaysLambdaAMI as that is only supported with Java >= 1.8
- //
- try
- {
- Class<?> cls = IceInternal.Util.findClass("test.Ice.operations.lambda.OnewaysLambdaAMI", null);
- if(cls != null)
- {
- java.lang.reflect.Method onewaysLambdaAMI =
- cls.getDeclaredMethod("onewaysLambdaAMI",
- new Class<?>[]{test.Util.Application.class, MyClassPrx.class});
- out.print("testing twoway operations with lambda AMI mapping... ");
- out.flush();
- onewaysLambdaAMI.invoke(null, app, cl);
- onewaysLambdaAMI.invoke(null, app, derived);
- out.println("ok");
- }
- }
- catch(java.lang.NoSuchMethodException ex)
- {
- throw new RuntimeException(ex);
- }
- catch(java.lang.IllegalAccessException ex)
- {
- throw new RuntimeException(ex);
- }
- catch(java.lang.reflect.InvocationTargetException ex)
- {
- throw new RuntimeException(ex);
- }
-
out.print("testing batch oneway operations... ");
out.flush();
BatchOneways.batchOneways(app, cl, out);
diff --git a/java/test/src/main/java/test/Ice/operations/BatchOneways.java b/java/test/src/main/java/test/Ice/operations/BatchOneways.java
index 75ed24a392e..d47af8c6bc2 100644
--- a/java/test/src/main/java/test/Ice/operations/BatchOneways.java
+++ b/java/test/src/main/java/test/Ice/operations/BatchOneways.java
@@ -12,12 +12,10 @@ package test.Ice.operations;
import java.io.PrintWriter;
import test.Ice.operations.Test.MyClassPrx;
-import test.Ice.operations.Test.MyClassPrxHelper;
class BatchOneways
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -25,10 +23,9 @@ class BatchOneways
}
}
- static class BatchRequestInterceptorI implements Ice.BatchRequestInterceptor
+ static class BatchRequestInterceptorI implements com.zeroc.Ice.BatchRequestInterceptor
{
- public void
- enqueue(Ice.BatchRequest request, int count, int size)
+ public void enqueue(com.zeroc.Ice.BatchRequest request, int count, int size)
{
test(request.getOperation().equals("opByteSOneway") || request.getOperation().equals("ice_ping"));
test(request.getProxy().ice_isBatchOneway());
@@ -42,7 +39,7 @@ class BatchOneways
if(_size + request.getSize() > 25000)
{
- request.getProxy().begin_ice_flushBatchRequests();
+ request.getProxy().ice_flushBatchRequestsAsync();
_size = 18; // header
}
@@ -54,14 +51,12 @@ class BatchOneways
}
}
- public void
- setEnqueue(boolean enabled)
+ public void setEnqueue(boolean enabled)
{
_enabled = enabled;
}
- public int
- count()
+ public int count()
{
return _count;
}
@@ -70,14 +65,13 @@ class BatchOneways
private int _count;
private int _size;
private int _lastRequestSize;
- };
+ }
- static void
- batchOneways(test.Util.Application app, MyClassPrx p, PrintWriter out)
+ static void batchOneways(test.Util.Application app, MyClassPrx p, PrintWriter out)
{
final byte[] bs1 = new byte[10 * 1024];
- MyClassPrx batch = MyClassPrxHelper.uncheckedCast(p.ice_batchOneway());
+ MyClassPrx batch = p.ice_batchOneway();
batch.ice_flushBatchRequests(); // Empty flush
p.opByteSOnewayCallCount(); // Reset the call count
@@ -88,7 +82,7 @@ class BatchOneways
{
batch.opByteSOneway(bs1);
}
- catch(Ice.MemoryLimitException ex)
+ catch(com.zeroc.Ice.MemoryLimitException ex)
{
test(false);
}
@@ -109,8 +103,8 @@ class BatchOneways
if(batch.ice_getConnection() != null)
{
- MyClassPrx batch1 = (MyClassPrx)p.ice_batchOneway();
- MyClassPrx batch2 = (MyClassPrx)p.ice_batchOneway();
+ MyClassPrx batch1 = p.ice_batchOneway();
+ MyClassPrx batch2 = p.ice_batchOneway();
batch1.ice_ping();
batch2.ice_ping();
@@ -128,9 +122,9 @@ class BatchOneways
batch2.ice_ping();
}
- Ice.Identity identity = new Ice.Identity();
+ com.zeroc.Ice.Identity identity = new com.zeroc.Ice.Identity();
identity.name = "invalid";
- Ice.ObjectPrx batch3 = batch.ice_identity(identity);
+ com.zeroc.Ice.ObjectPrx batch3 = batch.ice_identity(identity);
batch3.ice_ping();
batch3.ice_flushBatchRequests();
@@ -142,13 +136,13 @@ class BatchOneways
if(batch.ice_getConnection() != null)
{
- Ice.InitializationData initData = app.createInitializationData();
+ com.zeroc.Ice.InitializationData initData = app.createInitializationData();
initData.properties = p.ice_getCommunicator().getProperties()._clone();
BatchRequestInterceptorI interceptor = new BatchRequestInterceptorI();
initData.batchRequestInterceptor = interceptor;
- Ice.Communicator ic = app.initialize(initData);
+ com.zeroc.Ice.Communicator ic = app.initialize(initData);
- batch = MyClassPrxHelper.uncheckedCast(ic.stringToProxy(p.toString()).ice_batchOneway());
+ batch = MyClassPrx.uncheckedCast(ic.stringToProxy(p.toString())).ice_batchOneway();
test(interceptor.count() == 0);
batch.ice_ping();
diff --git a/java/test/src/main/java/test/Ice/operations/BatchOnewaysAMI.java b/java/test/src/main/java/test/Ice/operations/BatchOnewaysAMI.java
index 34d0cc00a43..c759e3dc6e9 100644
--- a/java/test/src/main/java/test/Ice/operations/BatchOnewaysAMI.java
+++ b/java/test/src/main/java/test/Ice/operations/BatchOnewaysAMI.java
@@ -11,10 +11,10 @@ package test.Ice.operations;
import java.io.PrintWriter;
-import Ice.LocalException;
-import test.Ice.operations.Test.Callback_MyClass_opByteSOneway;
+import com.zeroc.Ice.Util;
+import com.zeroc.Ice.LocalException;
+
import test.Ice.operations.Test.MyClassPrx;
-import test.Ice.operations.Test.MyClassPrxHelper;
class BatchOnewaysAMI
{
@@ -63,28 +63,21 @@ class BatchOnewaysAMI
{
final byte[] bs1 = new byte[10 * 1024];
- MyClassPrx batch = MyClassPrxHelper.uncheckedCast(p.ice_batchOneway());
- batch.end_ice_flushBatchRequests(batch.begin_ice_flushBatchRequests()); // Empty flush
+ MyClassPrx batch = p.ice_batchOneway();
+ batch.ice_flushBatchRequestsAsync().join(); // Empty flush
- test(batch.begin_ice_flushBatchRequests().isCompleted()); // Empty flush
- test(batch.begin_ice_flushBatchRequests().isSent()); // Empty flush
- test(batch.begin_ice_flushBatchRequests().sentSynchronously()); // Empty flush
+ {
+ test(batch.ice_flushBatchRequestsAsync().isDone()); // Empty flush
+ test(Util.getInvocationFuture(batch.ice_flushBatchRequestsAsync()).isSent()); // Empty flush
+ test(Util.getInvocationFuture(batch.ice_flushBatchRequestsAsync()).sentSynchronously()); // Empty flush
+ }
for(int i = 0; i < 30; ++i)
{
- batch.begin_opByteSOneway(bs1, new Callback_MyClass_opByteSOneway()
- {
- @Override
- public void exception(LocalException ex)
+ batch.opByteSOnewayAsync(bs1).whenComplete((result, ex) ->
{
- test(false);
- }
-
- @Override
- public void response()
- {
- }
- });
+ test(ex == null);
+ });
}
int count = 0;
@@ -102,35 +95,35 @@ class BatchOnewaysAMI
if(batch.ice_getConnection() != null)
{
- MyClassPrx batch2 = MyClassPrxHelper.uncheckedCast(p.ice_batchOneway());
+ MyClassPrx batch2 = p.ice_batchOneway();
- batch.begin_ice_ping();
- batch2.begin_ice_ping();
- batch.end_ice_flushBatchRequests(batch.begin_ice_flushBatchRequests());
+ batch.ice_pingAsync();
+ batch2.ice_pingAsync();
+ batch.ice_flushBatchRequestsAsync().join();
batch.ice_getConnection().close(false);
- batch.begin_ice_ping();
- batch2.begin_ice_ping();
+ batch.ice_pingAsync();
+ batch2.ice_pingAsync();
batch.ice_getConnection();
batch2.ice_getConnection();
- batch.begin_ice_ping();
+ batch.ice_pingAsync();
batch.ice_getConnection().close(false);
- batch.begin_ice_ping().throwLocalException();
- batch2.begin_ice_ping().throwLocalException();
+ test(!batch.ice_pingAsync().isCompletedExceptionally());
+ test(!batch2.ice_pingAsync().isCompletedExceptionally());
}
- Ice.Identity identity = new Ice.Identity();
+ com.zeroc.Ice.Identity identity = new com.zeroc.Ice.Identity();
identity.name = "invalid";
- Ice.ObjectPrx batch3 = batch.ice_identity(identity);
- batch3.begin_ice_ping();
- batch3.end_ice_flushBatchRequests(batch3.begin_ice_flushBatchRequests());
+ com.zeroc.Ice.ObjectPrx batch3 = batch.ice_identity(identity);
+ batch3.ice_pingAsync();
+ batch3.ice_flushBatchRequestsAsync().join();
// Make sure that a bogus batch request doesn't cause troubles to other
// ones.
- batch3.begin_ice_ping();
- batch.begin_ice_ping();
- batch.end_ice_flushBatchRequests(batch.begin_ice_flushBatchRequests());
- batch.begin_ice_ping();
+ batch3.ice_pingAsync();
+ batch.ice_pingAsync();
+ batch.ice_flushBatchRequestsAsync().join();
+ batch.ice_pingAsync();
}
}
diff --git a/java/test/src/main/java/test/Ice/operations/Client.java b/java/test/src/main/java/test/Ice/operations/Client.java
index d5f0d7713b5..2679071afb6 100644
--- a/java/test/src/main/java/test/Ice/operations/Client.java
+++ b/java/test/src/main/java/test/Ice/operations/Client.java
@@ -27,7 +27,7 @@ public class Client extends test.Util.Application
myClass.opVoid();
throw new RuntimeException();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
out.println("ok");
}
@@ -36,15 +36,14 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2");
- initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0");
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.operations");
- initData.properties.setProperty("Ice.BatchAutoFlushSize", "100");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2");
+ r.initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0");
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.operations");
+ r.initData.properties.setProperty("Ice.BatchAutoFlushSize", "100");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/operations/Collocated.java b/java/test/src/main/java/test/Ice/operations/Collocated.java
index b10f13a54e0..63b26e2cadd 100644
--- a/java/test/src/main/java/test/Ice/operations/Collocated.java
+++ b/java/test/src/main/java/test/Ice/operations/Collocated.java
@@ -16,8 +16,8 @@ public class Collocated extends test.Util.Application
{
communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
java.io.PrintWriter out = getWriter();
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- Ice.ObjectPrx prx = adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.ObjectPrx prx = adapter.add(new MyDerivedClassI(), com.zeroc.Ice.Util.stringToIdentity("test"));
//adapter.activate(); // Don't activate OA to ensure collocation is used.
if(prx.ice_getConnection() != null)
@@ -31,26 +31,25 @@ public class Collocated extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
- if(initData.properties.getPropertyAsInt("Ice.ThreadInterruptSafe") > 0 || isAndroid())
+ GetInitDataResult r = super.getInitData(args);
+ if(r.initData.properties.getPropertyAsInt("Ice.ThreadInterruptSafe") > 0 || isAndroid())
{
- initData.properties.setProperty("Ice.ThreadPool.Server.Size", "2");
+ r.initData.properties.setProperty("Ice.ThreadPool.Server.Size", "2");
}
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.operations");
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.operations");
- initData.properties.setProperty("Ice.BatchAutoFlushSize", "100");
+ r.initData.properties.setProperty("Ice.BatchAutoFlushSize", "100");
//
// Its possible to have batch oneway requests dispatched
// after the adapter is deactivated due to thread
// scheduling so we supress this warning.
//
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- return initData;
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/operations/MyDerivedClassI.java b/java/test/src/main/java/test/Ice/operations/MyDerivedClassI.java
index 3a72c0c2764..a5e3c1d4cc8 100644
--- a/java/test/src/main/java/test/Ice/operations/MyDerivedClassI.java
+++ b/java/test/src/main/java/test/Ice/operations/MyDerivedClassI.java
@@ -9,15 +9,15 @@
package test.Ice.operations;
-import Ice.Current;
-import test.Ice.operations.Test.*;
-
import java.util.*;
-public final class MyDerivedClassI extends MyDerivedClass
+import com.zeroc.Ice.Current;
+
+import test.Ice.operations.Test.*;
+
+public final class MyDerivedClassI implements _MyDerivedClassDisp
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -30,577 +30,515 @@ public final class MyDerivedClassI extends MyDerivedClass
//
@Override
- public boolean
- ice_isA(String id, Ice.Current current)
+ public boolean ice_isA(String id, Current current)
{
- test(current.mode == Ice.OperationMode.Nonmutating);
- return super.ice_isA(id, current);
+ test(current.mode == com.zeroc.Ice.OperationMode.Nonmutating);
+ return _MyDerivedClassDisp.super.ice_isA(id, current);
}
@Override
- public void
- ice_ping(Ice.Current current)
+ public void ice_ping(Current current)
{
- test(current.mode == Ice.OperationMode.Nonmutating);
- super.ice_ping(current);
+ test(current.mode == com.zeroc.Ice.OperationMode.Nonmutating);
+ _MyDerivedClassDisp.super.ice_ping(current);
}
@Override
- public String[]
- ice_ids(Ice.Current current)
+ public String[] ice_ids(Current current)
{
- test(current.mode == Ice.OperationMode.Nonmutating);
- return super.ice_ids(current);
+ test(current.mode == com.zeroc.Ice.OperationMode.Nonmutating);
+ return _MyDerivedClassDisp.super.ice_ids(current);
}
@Override
- public String
- ice_id(Ice.Current current)
+ public String ice_id(Current current)
{
- test(current.mode == Ice.OperationMode.Nonmutating);
- return super.ice_id(current);
+ test(current.mode == com.zeroc.Ice.OperationMode.Nonmutating);
+ return _MyDerivedClassDisp.super.ice_id(current);
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(Current current)
{
current.adapter.getCommunicator().shutdown();
}
@Override
- public void
- opVoid(Ice.Current current)
+ public void opVoid(Current current)
{
- test(current.mode == Ice.OperationMode.Normal);
+ test(current.mode == com.zeroc.Ice.OperationMode.Normal);
}
@Override
- public boolean
- opBool(boolean p1, boolean p2,
- Ice.BooleanHolder p3,
- Ice.Current current)
+ public MyClass.OpBoolResult opBool(boolean p1, boolean p2, Current current)
{
- p3.value = p1;
- return p2;
+ return new MyClass.OpBoolResult(p2, p1);
}
@Override
- public boolean[]
- opBoolS(boolean[] p1, boolean[] p2,
- BoolSHolder p3,
- Ice.Current current)
+ public MyClass.OpBoolSResult opBoolS(boolean[] p1, boolean[] p2, Current current)
{
- p3.value = new boolean[p1.length + p2.length];
- System.arraycopy(p1, 0, p3.value, 0, p1.length);
- System.arraycopy(p2, 0, p3.value, p1.length, p2.length);
+ MyClass.OpBoolSResult r = new MyClass.OpBoolSResult();
+ r.p3 = new boolean[p1.length + p2.length];
+ System.arraycopy(p1, 0, r.p3, 0, p1.length);
+ System.arraycopy(p2, 0, r.p3, p1.length, p2.length);
- boolean[] r = new boolean[p1.length];
+ r.returnValue = new boolean[p1.length];
for(int i = 0; i < p1.length; i++)
{
- r[i] = p1[p1.length - (i + 1)];
+ r.returnValue[i] = p1[p1.length - (i + 1)];
}
return r;
}
@Override
- public boolean[][]
- opBoolSS(boolean[][] p1, boolean[][] p2,
- BoolSSHolder p3,
- Ice.Current current)
+ public MyClass.OpBoolSSResult opBoolSS(boolean[][] p1, boolean[][] p2, Current current)
{
- p3.value = new boolean[p1.length + p2.length][];
- System.arraycopy(p1, 0, p3.value, 0, p1.length);
- System.arraycopy(p2, 0, p3.value, p1.length, p2.length);
+ MyClass.OpBoolSSResult r = new MyClass.OpBoolSSResult();
+ r.p3 = new boolean[p1.length + p2.length][];
+ System.arraycopy(p1, 0, r.p3, 0, p1.length);
+ System.arraycopy(p2, 0, r.p3, p1.length, p2.length);
- boolean[][] r = new boolean[p1.length][];
+ r.returnValue = new boolean[p1.length][];
for(int i = 0; i < p1.length; i++)
{
- r[i] = p1[p1.length - (i + 1)];
+ r.returnValue[i] = p1[p1.length - (i + 1)];
}
return r;
}
@Override
- public byte
- opByte(byte p1, byte p2,
- Ice.ByteHolder p3,
- Ice.Current current)
+ public MyClass.OpByteResult opByte(byte p1, byte p2, Current current)
{
- p3.value = (byte) (p1 ^ p2);
- return p1;
+ return new MyClass.OpByteResult(p1, (byte) (p1 ^ p2));
}
@Override
- public java.util.Map<Byte, Boolean>
- opByteBoolD(java.util.Map<Byte, Boolean> p1, java.util.Map<Byte, Boolean> p2, ByteBoolDHolder p3,
- Ice.Current current)
+ public MyClass.OpByteBoolDResult opByteBoolD(java.util.Map<Byte, Boolean> p1, java.util.Map<Byte, Boolean> p2,
+ Current current)
{
- p3.value = p1;
- java.util.Map<Byte, Boolean> r = new java.util.HashMap<Byte, Boolean>();
- r.putAll(p1);
- r.putAll(p2);
+ MyClass.OpByteBoolDResult r = new MyClass.OpByteBoolDResult();
+ r.p3 = p1;
+ r.returnValue = new java.util.HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
return r;
}
@Override
- public byte[]
- opByteS(byte[] p1, byte[] p2,
- ByteSHolder p3,
- Ice.Current current)
+ public MyClass.OpByteSResult opByteS(byte[] p1, byte[] p2, Current current)
{
- p3.value = new byte[p1.length];
+ MyClass.OpByteSResult r = new MyClass.OpByteSResult();
+ r.p3 = new byte[p1.length];
for(int i = 0; i < p1.length; i++)
{
- p3.value[i] = p1[p1.length - (i + 1)];
+ r.p3[i] = p1[p1.length - (i + 1)];
}
- byte[] r = new byte[p1.length + p2.length];
- System.arraycopy(p1, 0, r, 0, p1.length);
- System.arraycopy(p2, 0, r, p1.length, p2.length);
+ r.returnValue = new byte[p1.length + p2.length];
+ System.arraycopy(p1, 0, r.returnValue, 0, p1.length);
+ System.arraycopy(p2, 0, r.returnValue, p1.length, p2.length);
return r;
}
@Override
- public byte[][]
- opByteSS(byte[][] p1, byte[][] p2,
- ByteSSHolder p3,
- Ice.Current current)
+ public MyClass.OpByteSSResult opByteSS(byte[][] p1, byte[][] p2, Current current)
{
- p3.value = new byte[p1.length][];
+ MyClass.OpByteSSResult r = new MyClass.OpByteSSResult();
+ r.p3 = new byte[p1.length][];
for(int i = 0; i < p1.length; i++)
{
- p3.value[i] = p1[p1.length - (i + 1)];
+ r.p3[i] = p1[p1.length - (i + 1)];
}
- byte[][] r = new byte[p1.length + p2.length][];
- System.arraycopy(p1, 0, r, 0, p1.length);
- System.arraycopy(p2, 0, r, p1.length, p2.length);
+ r.returnValue = new byte[p1.length + p2.length][];
+ System.arraycopy(p1, 0, r.returnValue, 0, p1.length);
+ System.arraycopy(p2, 0, r.returnValue, p1.length, p2.length);
return r;
}
@Override
- public double
- opFloatDouble(float p1, double p2,
- Ice.FloatHolder p3, Ice.DoubleHolder p4,
- Ice.Current current)
+ public MyClass.OpFloatDoubleResult opFloatDouble(float p1, double p2, Current current)
{
- p3.value = p1;
- p4.value = p2;
- return p2;
+ return new MyClass.OpFloatDoubleResult(p2, p1, p2);
}
@Override
- public double[]
- opFloatDoubleS(float[] p1, double[] p2,
- FloatSHolder p3, DoubleSHolder p4,
- Ice.Current current)
+ public MyClass.OpFloatDoubleSResult opFloatDoubleS(float[] p1, double[] p2, Current current)
{
- p3.value = p1;
- p4.value = new double[p2.length];
+ MyClass.OpFloatDoubleSResult r = new MyClass.OpFloatDoubleSResult();
+ r.p3 = p1;
+ r.p4 = new double[p2.length];
for(int i = 0; i < p2.length; i++)
{
- p4.value[i] = p2[p2.length - (i + 1)];
+ r.p4[i] = p2[p2.length - (i + 1)];
}
- double[] r = new double[p2.length + p1.length];
- System.arraycopy(p2, 0, r, 0, p2.length);
+ r.returnValue = new double[p2.length + p1.length];
+ System.arraycopy(p2, 0, r.returnValue, 0, p2.length);
for(int i = 0; i < p1.length; i++)
{
- r[p2.length + i] = p1[i];
+ r.returnValue[p2.length + i] = p1[i];
}
return r;
}
@Override
- public double[][]
- opFloatDoubleSS(float[][] p1, double[][] p2,
- FloatSSHolder p3, DoubleSSHolder p4,
- Ice.Current current)
+ public MyClass.OpFloatDoubleSSResult opFloatDoubleSS(float[][] p1, double[][] p2, Current current)
{
- p3.value = p1;
- p4.value = new double[p2.length][];
+ MyClass.OpFloatDoubleSSResult r = new MyClass.OpFloatDoubleSSResult();
+ r.p3 = p1;
+ r.p4 = new double[p2.length][];
for(int i = 0; i < p2.length; i++)
{
- p4.value[i] = p2[p2.length - (i + 1)];
+ r.p4[i] = p2[p2.length - (i + 1)];
}
- double[][] r = new double[p2.length * 2][];
- System.arraycopy(p2, 0, r, 0, p2.length);
- System.arraycopy(p2, 0, r, p2.length, p2.length);
+ r.returnValue = new double[p2.length * 2][];
+ System.arraycopy(p2, 0, r.returnValue, 0, p2.length);
+ System.arraycopy(p2, 0, r.returnValue, p2.length, p2.length);
return r;
}
@Override
- public java.util.Map<Long, Float>
- opLongFloatD(java.util.Map<Long, Float> p1, java.util.Map<Long, Float> p2, LongFloatDHolder p3,
- Ice.Current current)
+ public MyClass.OpLongFloatDResult opLongFloatD(java.util.Map<Long, Float> p1, java.util.Map<Long, Float> p2,
+ Current current)
{
- p3.value = p1;
- java.util.Map<Long, Float> r = new java.util.HashMap<Long, Float>();
- r.putAll(p1);
- r.putAll(p2);
+ MyClass.OpLongFloatDResult r = new MyClass.OpLongFloatDResult();
+ r.p3 = p1;
+ r.returnValue = new java.util.HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
return r;
}
@Override
- public MyClassPrx
- opMyClass(MyClassPrx p1,
- MyClassPrxHolder p2, MyClassPrxHolder p3,
- Ice.Current current)
+ public MyClass.OpMyClassResult opMyClass(MyClassPrx p1, Current current)
{
- p2.value = p1;
- p3.value = MyClassPrxHelper.uncheckedCast(
- current.adapter.createProxy(Ice.Util.stringToIdentity("noSuchIdentity")));
- return MyClassPrxHelper.uncheckedCast(current.adapter.createProxy(current.id));
+ MyClass.OpMyClassResult r = new MyClass.OpMyClassResult();
+ r.p2 = p1;
+ r.p3 = MyClassPrx.uncheckedCast(
+ current.adapter.createProxy(com.zeroc.Ice.Util.stringToIdentity("noSuchIdentity")));
+ r.returnValue = MyClassPrx.uncheckedCast(current.adapter.createProxy(current.id));
+ return r;
}
@Override
- public MyEnum
- opMyEnum(MyEnum p1,
- MyEnumHolder p2,
- Ice.Current current)
+ public MyClass.OpMyEnumResult opMyEnum(MyEnum p1, Current current)
{
- p2.value = p1;
- return MyEnum.enum3;
+ return new MyClass.OpMyEnumResult(MyEnum.enum3, p1);
}
@Override
- public java.util.Map<Short, Integer>
- opShortIntD(java.util.Map<Short, Integer> p1, java.util.Map<Short, Integer> p2, ShortIntDHolder p3,
- Ice.Current current)
+ public MyClass.OpShortIntDResult opShortIntD(java.util.Map<Short, Integer> p1, java.util.Map<Short, Integer> p2,
+ Current current)
{
- p3.value = p1;
- java.util.Map<Short, Integer> r = new java.util.HashMap<Short, Integer>();
- r.putAll(p1);
- r.putAll(p2);
+ MyClass.OpShortIntDResult r = new MyClass.OpShortIntDResult();
+ r.p3 = p1;
+ r.returnValue = new java.util.HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
return r;
}
@Override
- public long
- opShortIntLong(short p1, int p2, long p3,
- Ice.ShortHolder p4, Ice.IntHolder p5, Ice.LongHolder p6,
- Ice.Current current)
+ public MyClass.OpShortIntLongResult opShortIntLong(short p1, int p2, long p3, Current current)
{
- p4.value = p1;
- p5.value = p2;
- p6.value = p3;
- return p3;
+ return new MyClass.OpShortIntLongResult(p3, p1, p2, p3);
}
@Override
- public long[]
- opShortIntLongS(short[] p1, int[] p2, long[] p3,
- ShortSHolder p4, IntSHolder p5, LongSHolder p6,
- Ice.Current current)
+ public MyClass.OpShortIntLongSResult opShortIntLongS(short[] p1, int[] p2, long[] p3, Current current)
{
- p4.value = p1;
- p5.value = new int[p2.length];
+ MyClass.OpShortIntLongSResult r = new MyClass.OpShortIntLongSResult();
+ r.p4 = p1;
+ r.p5 = new int[p2.length];
for(int i = 0; i < p2.length; i++)
{
- p5.value[i] = p2[p2.length - (i + 1)];
+ r.p5[i] = p2[p2.length - (i + 1)];
}
- p6.value = new long[p3.length * 2];
- System.arraycopy(p3, 0, p6.value, 0, p3.length);
- System.arraycopy(p3, 0, p6.value, p3.length, p3.length);
- return p3;
+ r.p6 = new long[p3.length * 2];
+ System.arraycopy(p3, 0, r.p6, 0, p3.length);
+ System.arraycopy(p3, 0, r.p6, p3.length, p3.length);
+ r.returnValue = p3;
+ return r;
}
@Override
- public long[][]
- opShortIntLongSS(short[][] p1, int[][] p2, long[][] p3,
- ShortSSHolder p4, IntSSHolder p5, LongSSHolder p6,
- Ice.Current current)
+ public MyClass.OpShortIntLongSSResult opShortIntLongSS(short[][] p1, int[][] p2, long[][] p3, Current current)
{
- p4.value = p1;
- p5.value = new int[p2.length][];
+ MyClass.OpShortIntLongSSResult r = new MyClass.OpShortIntLongSSResult();
+ r.p4 = p1;
+ r.p5 = new int[p2.length][];
for(int i = 0; i < p2.length; i++)
{
- p5.value[i] = p2[p2.length - (i + 1)];
+ r.p5[i] = p2[p2.length - (i + 1)];
}
- p6.value = new long[p3.length * 2][];
- System.arraycopy(p3, 0, p6.value, 0, p3.length);
- System.arraycopy(p3, 0, p6.value, p3.length, p3.length);
- return p3;
+ r.p6 = new long[p3.length * 2][];
+ System.arraycopy(p3, 0, r.p6, 0, p3.length);
+ System.arraycopy(p3, 0, r.p6, p3.length, p3.length);
+ r.returnValue = p3;
+ return r;
}
@Override
- public String
- opString(String p1, String p2,
- Ice.StringHolder p3,
- Ice.Current current)
+ public MyClass.OpStringResult opString(String p1, String p2, Current current)
{
- p3.value = p2 + " " + p1;
- return p1 + " " + p2;
+ MyClass.OpStringResult r = new MyClass.OpStringResult();
+ r.p3 = p2 + " " + p1;
+ r.returnValue = p1 + " " + p2;
+ return r;
}
@Override
- public java.util.Map<String, MyEnum>
- opStringMyEnumD(java.util.Map<String, MyEnum> p1, java.util.Map<String, MyEnum> p2, StringMyEnumDHolder p3,
- Ice.Current current)
+ public MyClass.OpStringMyEnumDResult opStringMyEnumD(java.util.Map<String, MyEnum> p1,
+ java.util.Map<String, MyEnum> p2,
+ Current current)
{
- p3.value = p1;
- java.util.Map<String, MyEnum> r = new java.util.HashMap<String, MyEnum>();
- r.putAll(p1);
- r.putAll(p2);
+ MyClass.OpStringMyEnumDResult r = new MyClass.OpStringMyEnumDResult();
+ r.p3 = p1;
+ r.returnValue = new java.util.HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
return r;
}
@Override
- public java.util.Map<MyEnum, String>
- opMyEnumStringD(java.util.Map<MyEnum, String> p1, java.util.Map<MyEnum, String> p2, MyEnumStringDHolder p3,
- Ice.Current current)
+ public MyClass.OpMyEnumStringDResult opMyEnumStringD(java.util.Map<MyEnum, String> p1,
+ java.util.Map<MyEnum, String> p2,
+ Current current)
{
- p3.value = p1;
- java.util.Map<MyEnum, String> r = new java.util.HashMap<MyEnum, String>();
- r.putAll(p1);
- r.putAll(p2);
+ MyClass.OpMyEnumStringDResult r = new MyClass.OpMyEnumStringDResult();
+ r.p3 = p1;
+ r.returnValue = new java.util.HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
return r;
}
@Override
- public java.util.Map<MyStruct, MyEnum>
- opMyStructMyEnumD(java.util.Map<MyStruct, MyEnum> p1, java.util.Map<MyStruct, MyEnum> p2, MyStructMyEnumDHolder p3,
- Ice.Current current)
+ public MyClass.OpMyStructMyEnumDResult opMyStructMyEnumD(java.util.Map<MyStruct, MyEnum> p1,
+ java.util.Map<MyStruct, MyEnum> p2,
+ Current current)
{
- p3.value = p1;
- java.util.Map<MyStruct, MyEnum> r = new java.util.HashMap<MyStruct, MyEnum>();
- r.putAll(p1);
- r.putAll(p2);
+ MyClass.OpMyStructMyEnumDResult r = new MyClass.OpMyStructMyEnumDResult();
+ r.p3 = p1;
+ r.returnValue = new java.util.HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
return r;
}
@Override
- public List<Map<Byte, Boolean>> opByteBoolDS(List<Map<Byte, Boolean>> p1,
- List<Map<Byte, Boolean>> p2,
- ByteBoolDSHolder p3,
- Ice.Current current)
+ public MyClass.OpByteBoolDSResult opByteBoolDS(List<Map<Byte, Boolean>> p1, List<Map<Byte, Boolean>> p2,
+ Current current)
{
- p3.value = new ArrayList<>();
- p3.value.addAll(p2);
- p3.value.addAll(p1);
+ MyClass.OpByteBoolDSResult r = new MyClass.OpByteBoolDSResult();
+ r.p3 = new ArrayList<>();
+ r.p3.addAll(p2);
+ r.p3.addAll(p1);
- List<Map<Byte, Boolean>> r = new ArrayList<>(p1);
- Collections.reverse(r);
+ r.returnValue = new ArrayList<>(p1);
+ Collections.reverse(r.returnValue);
return r;
}
@Override
- public List<Map<Short, Integer>> opShortIntDS(List<Map<Short, Integer>> p1,
- List<Map<Short, Integer>> p2,
- ShortIntDSHolder p3,
- Ice.Current current)
+ public MyClass.OpShortIntDSResult opShortIntDS(List<Map<Short, Integer>> p1, List<Map<Short, Integer>> p2,
+ Current current)
{
- p3.value = new ArrayList<>();
- p3.value.addAll(p2);
- p3.value.addAll(p1);
+ MyClass.OpShortIntDSResult r = new MyClass.OpShortIntDSResult();
+ r.p3 = new ArrayList<>();
+ r.p3.addAll(p2);
+ r.p3.addAll(p1);
- List<Map<Short, Integer>> r = new ArrayList<>(p1);
- Collections.reverse(r);
+ r.returnValue = new ArrayList<>(p1);
+ Collections.reverse(r.returnValue);
return r;
}
@Override
- public List<Map<Long, Float>> opLongFloatDS(List<Map<Long, Float>> p1,
- List<Map<Long, Float>> p2,
- LongFloatDSHolder p3,
- Ice.Current current)
+ public MyClass.OpLongFloatDSResult opLongFloatDS(List<Map<Long, Float>> p1, List<Map<Long, Float>> p2,
+ Current current)
{
- p3.value = new ArrayList<>();
- p3.value.addAll(p2);
- p3.value.addAll(p1);
+ MyClass.OpLongFloatDSResult r = new MyClass.OpLongFloatDSResult();
+ r.p3 = new ArrayList<>();
+ r.p3.addAll(p2);
+ r.p3.addAll(p1);
- List<Map<Long, Float>> r = new ArrayList<>(p1);
- Collections.reverse(r);
+ r.returnValue = new ArrayList<>(p1);
+ Collections.reverse(r.returnValue);
return r;
}
@Override
- public List<Map<String, String>> opStringStringDS(List<Map<String, String>> p1,
- List<Map<String, String>> p2,
- StringStringDSHolder p3,
- Ice.Current current)
+ public MyClass.OpStringStringDSResult opStringStringDS(List<Map<String, String>> p1, List<Map<String, String>> p2,
+ Current current)
{
- p3.value = new ArrayList<>();
- p3.value.addAll(p2);
- p3.value.addAll(p1);
+ MyClass.OpStringStringDSResult r = new MyClass.OpStringStringDSResult();
+ r.p3 = new ArrayList<>();
+ r.p3.addAll(p2);
+ r.p3.addAll(p1);
- List<Map<String, String>> r = new ArrayList<>(p1);
- Collections.reverse(r);
+ r.returnValue = new ArrayList<>(p1);
+ Collections.reverse(r.returnValue);
return r;
}
@Override
- public List<Map<String, MyEnum>> opStringMyEnumDS(List<Map<String, MyEnum>> p1,
- List<Map<String, MyEnum>> p2,
- StringMyEnumDSHolder p3,
- Ice.Current current)
+ public MyClass.OpStringMyEnumDSResult opStringMyEnumDS(List<Map<String, MyEnum>> p1, List<Map<String, MyEnum>> p2,
+ Current current)
{
- p3.value = new ArrayList<>();
- p3.value.addAll(p2);
- p3.value.addAll(p1);
+ MyClass.OpStringMyEnumDSResult r = new MyClass.OpStringMyEnumDSResult();
+ r.p3 = new ArrayList<>();
+ r.p3.addAll(p2);
+ r.p3.addAll(p1);
- List<Map<String, MyEnum>> r = new ArrayList<>(p1);
- Collections.reverse(r);
+ r.returnValue = new ArrayList<>(p1);
+ Collections.reverse(r.returnValue);
return r;
}
@Override
- public List<Map<MyEnum, String>> opMyEnumStringDS(List<Map<MyEnum, String>> p1,
- List<Map<MyEnum, String>> p2,
- MyEnumStringDSHolder p3,
- Ice.Current current)
+ public MyClass.OpMyEnumStringDSResult opMyEnumStringDS(List<Map<MyEnum, String>> p1, List<Map<MyEnum, String>> p2,
+ Current current)
{
- p3.value = new ArrayList<>();
- p3.value.addAll(p2);
- p3.value.addAll(p1);
+ MyClass.OpMyEnumStringDSResult r = new MyClass.OpMyEnumStringDSResult();
+ r.p3 = new ArrayList<>();
+ r.p3.addAll(p2);
+ r.p3.addAll(p1);
- List<Map<MyEnum, String>> r = new ArrayList<>(p1);
- Collections.reverse(r);
+ r.returnValue = new ArrayList<>(p1);
+ Collections.reverse(r.returnValue);
return r;
}
@Override
- public List<Map<MyStruct, MyEnum>> opMyStructMyEnumDS(List<Map<MyStruct, MyEnum>> p1,
- List<Map<MyStruct, MyEnum>> p2,
- MyStructMyEnumDSHolder p3,
- Ice.Current current)
+ public MyClass.OpMyStructMyEnumDSResult opMyStructMyEnumDS(List<Map<MyStruct, MyEnum>> p1,
+ List<Map<MyStruct, MyEnum>> p2,
+ Current current)
{
- p3.value = new ArrayList<>();
- p3.value.addAll(p2);
- p3.value.addAll(p1);
+ MyClass.OpMyStructMyEnumDSResult r = new MyClass.OpMyStructMyEnumDSResult();
+ r.p3 = new ArrayList<>();
+ r.p3.addAll(p2);
+ r.p3.addAll(p1);
- List<Map<MyStruct, MyEnum>> r = new ArrayList<>(p1);
- Collections.reverse(r);
+ r.returnValue = new ArrayList<>(p1);
+ Collections.reverse(r.returnValue);
return r;
}
@Override
- public Map<Byte, byte[]> opByteByteSD(Map<Byte, byte[]> p1,
- Map<Byte, byte[]> p2,
- ByteByteSDHolder p3,
- Ice.Current current)
+ public MyClass.OpByteByteSDResult opByteByteSD(Map<Byte, byte[]> p1, Map<Byte, byte[]> p2, Current current)
{
- p3.value = p2;
- Map<Byte, byte[]> r = new HashMap<>();
- r.putAll(p1);
- r.putAll(p2);
+ MyClass.OpByteByteSDResult r = new MyClass.OpByteByteSDResult();
+ r.p3 = p2;
+ r.returnValue = new HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
return r;
}
@Override
- public Map<Boolean, boolean[]> opBoolBoolSD(Map<Boolean, boolean[]> p1,
- Map<Boolean, boolean[]> p2,
- BoolBoolSDHolder p3,
- Ice.Current current)
+ public MyClass.OpBoolBoolSDResult opBoolBoolSD(Map<Boolean, boolean[]> p1, Map<Boolean, boolean[]> p2,
+ Current current)
{
- p3.value = p2;
- Map<Boolean, boolean[]> r = new HashMap<>();
- r.putAll(p1);
- r.putAll(p2);
+ MyClass.OpBoolBoolSDResult r = new MyClass.OpBoolBoolSDResult();
+ r.p3 = p2;
+ r.returnValue = new HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
return r;
}
@Override
- public Map<Short, short[]> opShortShortSD(Map<Short, short[]> p1,
- Map<Short, short[]> p2,
- ShortShortSDHolder p3,
- Ice.Current current)
+ public MyClass.OpShortShortSDResult opShortShortSD(Map<Short, short[]> p1, Map<Short, short[]> p2, Current current)
{
- p3.value = p2;
- Map<Short, short[]> r = new HashMap<>();
- r.putAll(p1);
- r.putAll(p2);
+ MyClass.OpShortShortSDResult r = new MyClass.OpShortShortSDResult();
+ r.p3 = p2;
+ r.returnValue = new HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
return r;
}
@Override
- public Map<Integer, int[]> opIntIntSD(Map<Integer, int[]> p1,
- Map<Integer, int[]> p2,
- IntIntSDHolder p3,
- Ice.Current current)
+ public MyClass.OpIntIntSDResult opIntIntSD(Map<Integer, int[]> p1, Map<Integer, int[]> p2, Current current)
{
- p3.value = p2;
- Map<Integer, int[]> r = new HashMap<>();
- r.putAll(p1);
- r.putAll(p2);
+ MyClass.OpIntIntSDResult r = new MyClass.OpIntIntSDResult();
+ r.p3 = p2;
+ r.returnValue = new HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
return r;
}
@Override
- public Map<Long, long[]> opLongLongSD(Map<Long, long[]> p1,
- Map<Long, long[]> p2,
- LongLongSDHolder p3,
- Ice.Current current)
+ public MyClass.OpLongLongSDResult opLongLongSD(Map<Long, long[]> p1, Map<Long, long[]> p2, Current current)
{
- p3.value = p2;
- Map<Long, long[]> r = new HashMap<>();
- r.putAll(p1);
- r.putAll(p2);
+ MyClass.OpLongLongSDResult r = new MyClass.OpLongLongSDResult();
+ r.p3 = p2;
+ r.returnValue = new HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
return r;
}
@Override
- public Map<String, float[]> opStringFloatSD(Map<String, float[]> p1,
- Map<String, float[]> p2,
- StringFloatSDHolder p3,
- Ice.Current current)
+ public MyClass.OpStringFloatSDResult opStringFloatSD(Map<String, float[]> p1, Map<String, float[]> p2,
+ Current current)
{
- p3.value = p2;
- Map<String, float[]> r = new HashMap<>();
- r.putAll(p1);
- r.putAll(p2);
+ MyClass.OpStringFloatSDResult r = new MyClass.OpStringFloatSDResult();
+ r.p3 = p2;
+ r.returnValue = new HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
return r;
}
@Override
- public Map<String, double[]> opStringDoubleSD(Map<String, double[]> p1,
- Map<String, double[]> p2,
- StringDoubleSDHolder p3,
- Ice.Current current)
+ public MyClass.OpStringDoubleSDResult opStringDoubleSD(Map<String, double[]> p1, Map<String, double[]> p2,
+ Current current)
{
- p3.value = p2;
- Map<String, double[]> r = new HashMap<>();
- r.putAll(p1);
- r.putAll(p2);
+ MyClass.OpStringDoubleSDResult r = new MyClass.OpStringDoubleSDResult();
+ r.p3 = p2;
+ r.returnValue = new HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
return r;
}
@Override
- public Map<String, String[]> opStringStringSD(Map<String, String[]> p1,
- Map<String, String[]> p2,
- StringStringSDHolder p3,
- Ice.Current current)
+ public MyClass.OpStringStringSDResult opStringStringSD(Map<String, String[]> p1, Map<String, String[]> p2,
+ Current current)
{
- p3.value = p2;
- Map<String, String[]> r = new HashMap<>();
- r.putAll(p1);
- r.putAll(p2);
+ MyClass.OpStringStringSDResult r = new MyClass.OpStringStringSDResult();
+ r.p3 = p2;
+ r.returnValue = new HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
return r;
}
@Override
- public Map<MyEnum, MyEnum[]> opMyEnumMyEnumSD(Map<MyEnum, MyEnum[]> p1,
- Map<MyEnum, MyEnum[]> p2,
- MyEnumMyEnumSDHolder p3,
- Ice.Current current)
+ public MyClass.OpMyEnumMyEnumSDResult opMyEnumMyEnumSD(Map<MyEnum, MyEnum[]> p1, Map<MyEnum, MyEnum[]> p2,
+ Current current)
{
- p3.value = p2;
- Map<MyEnum, MyEnum[]> r = new HashMap<>();
- r.putAll(p1);
- r.putAll(p2);
+ MyClass.OpMyEnumMyEnumSDResult r = new MyClass.OpMyEnumMyEnumSDResult();
+ r.p3 = p2;
+ r.returnValue = new HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
return r;
}
@Override
- public int[]
- opIntS(int[] s, Ice.Current current)
+ public int[] opIntS(int[] s, Current current)
{
int[] r = new int[s.length];
for(int i = 0; i < r.length; ++i)
@@ -611,15 +549,13 @@ public final class MyDerivedClassI extends MyDerivedClass
}
@Override
- public synchronized void
- opByteSOneway(byte[] s, Ice.Current current)
+ public synchronized void opByteSOneway(byte[] s, Current current)
{
++_opByteSOnewayCallCount;
}
@Override
- public synchronized int
- opByteSOnewayCallCount(Ice.Current current)
+ public synchronized int opByteSOnewayCallCount(Current current)
{
int count = _opByteSOnewayCallCount;
_opByteSOnewayCallCount = 0;
@@ -627,15 +563,13 @@ public final class MyDerivedClassI extends MyDerivedClass
}
@Override
- public java.util.Map<String, String>
- opContext(Ice.Current current)
+ public java.util.Map<String, String> opContext(Current current)
{
return current.ctx;
}
@Override
- public void
- opDoubleMarshaling(double p1, double[] p2, Ice.Current current)
+ public void opDoubleMarshaling(double p1, double[] p2, Current current)
{
double d = 1278312346.0 / 13.0;
test(p1 == d);
@@ -646,182 +580,173 @@ public final class MyDerivedClassI extends MyDerivedClass
}
@Override
- public String[]
- opStringS(String[] p1, String[] p2,
- StringSHolder p3,
- Ice.Current current)
+ public MyClass.OpStringSResult opStringS(String[] p1, String[] p2, Current current)
{
- p3.value = new String[p1.length + p2.length];
- System.arraycopy(p1, 0, p3.value, 0, p1.length);
- System.arraycopy(p2, 0, p3.value, p1.length, p2.length);
+ MyClass.OpStringSResult r = new MyClass.OpStringSResult();
+ r.p3 = new String[p1.length + p2.length];
+ System.arraycopy(p1, 0, r.p3, 0, p1.length);
+ System.arraycopy(p2, 0, r.p3, p1.length, p2.length);
- String[] r = new String[p1.length];
+ r.returnValue = new String[p1.length];
for(int i = 0; i < p1.length; i++)
{
- r[i] = p1[p1.length - (i + 1)];
+ r.returnValue[i] = p1[p1.length - (i + 1)];
}
return r;
}
@Override
- public String[][]
- opStringSS(String[][] p1, String[][] p2,
- StringSSHolder p3,
- Ice.Current current)
+ public MyClass.OpStringSSResult opStringSS(String[][] p1, String[][] p2, Current current)
{
- p3.value = new String[p1.length + p2.length][];
- System.arraycopy(p1, 0, p3.value, 0, p1.length);
- System.arraycopy(p2, 0, p3.value, p1.length, p2.length);
+ MyClass.OpStringSSResult r = new MyClass.OpStringSSResult();
+ r.p3 = new String[p1.length + p2.length][];
+ System.arraycopy(p1, 0, r.p3, 0, p1.length);
+ System.arraycopy(p2, 0, r.p3, p1.length, p2.length);
- String[][] r = new String[p2.length][];
+ r.returnValue = new String[p2.length][];
for(int i = 0; i < p2.length; i++)
{
- r[i] = p2[p2.length - (i + 1)];
+ r.returnValue[i] = p2[p2.length - (i + 1)];
}
return r;
}
@Override
- public String[][][]
- opStringSSS(String[][][] p1, String[][][] p2,
- StringSSSHolder p3,
- Ice.Current current)
+ public MyClass.OpStringSSSResult opStringSSS(String[][][] p1, String[][][] p2, Current current)
{
- p3.value = new String[p1.length + p2.length][][];
- System.arraycopy(p1, 0, p3.value, 0, p1.length);
- System.arraycopy(p2, 0, p3.value, p1.length, p2.length);
+ MyClass.OpStringSSSResult r = new MyClass.OpStringSSSResult();
+ r.p3 = new String[p1.length + p2.length][][];
+ System.arraycopy(p1, 0, r.p3, 0, p1.length);
+ System.arraycopy(p2, 0, r.p3, p1.length, p2.length);
- String[][][] r = new String[p2.length][][];
+ r.returnValue = new String[p2.length][][];
for(int i = 0; i < p2.length; i++)
{
- r[i] = p2[p2.length - (i + 1)];
+ r.returnValue[i] = p2[p2.length - (i + 1)];
}
return r;
}
@Override
- public java.util.Map<String, String>
- opStringStringD(java.util.Map<String, String> p1, java.util.Map<String, String> p2, StringStringDHolder p3,
- Ice.Current current)
+ public MyClass.OpStringStringDResult opStringStringD(java.util.Map<String, String> p1,
+ java.util.Map<String, String> p2,
+ Current current)
{
- p3.value = p1;
- java.util.Map<String, String> r = new java.util.HashMap<String, String>();
- r.putAll(p1);
- r.putAll(p2);
+ MyClass.OpStringStringDResult r = new MyClass.OpStringStringDResult();
+ r.p3 = p1;
+ r.returnValue = new java.util.HashMap<>();
+ r.returnValue.putAll(p1);
+ r.returnValue.putAll(p2);
return r;
}
@Override
- public Structure
- opStruct(Structure p1, Structure p2,
- StructureHolder p3,
- Ice.Current current)
+ public MyClass.OpStructResult opStruct(Structure p1, Structure p2, Current current)
{
- p3.value = p1;
- p3.value.s.s = "a new string";
- return p2;
+ MyClass.OpStructResult r = new MyClass.OpStructResult();
+ r.p3 = p1;
+ r.p3.s.s = "a new string";
+ r.returnValue = p2;
+ return r;
}
@Override
- public void
- opIdempotent(Ice.Current current)
+ public void opIdempotent(Current current)
{
- test(current.mode == Ice.OperationMode.Idempotent);
+ test(current.mode == com.zeroc.Ice.OperationMode.Idempotent);
}
@Override
- public void
- opNonmutating(Ice.Current current)
+ public void opNonmutating(Current current)
{
- test(current.mode == Ice.OperationMode.Nonmutating);
+ test(current.mode == com.zeroc.Ice.OperationMode.Nonmutating);
}
@Override
- public void
- opDerived(Ice.Current current)
+ public void opDerived(Current current)
{
}
@Override
- public byte opByte1(byte value, Ice.Current current)
+ public byte opByte1(byte value, Current current)
{
return value;
}
@Override
- public short opShort1(short value, Ice.Current current)
+ public short opShort1(short value, Current current)
{
return value;
}
@Override
- public int opInt1(int value, Ice.Current current)
+ public int opInt1(int value, Current current)
{
return value;
}
@Override
- public long opLong1(long value, Ice.Current current)
+ public long opLong1(long value, Current current)
{
return value;
}
@Override
- public float opFloat1(float value, Ice.Current current)
+ public float opFloat1(float value, Current current)
{
return value;
}
@Override
- public double opDouble1(double value, Ice.Current current)
+ public double opDouble1(double value, Current current)
{
return value;
}
@Override
- public String opString1(String value, Ice.Current current)
+ public String opString1(String value, Current current)
{
return value;
}
@Override
- public String[] opStringS1(String[] value, Ice.Current current)
+ public String[] opStringS1(String[] value, Current current)
{
return value;
}
@Override
- public Map<Byte, Boolean> opByteBoolD1(Map<Byte, Boolean> value, Ice.Current current)
+ public Map<Byte, Boolean> opByteBoolD1(Map<Byte, Boolean> value, Current current)
{
return value;
}
@Override
- public String[] opStringS2(String[] value, Ice.Current current)
+ public String[] opStringS2(String[] value, Current current)
{
return value;
}
@Override
- public Map<Byte, Boolean> opByteBoolD2(Map<Byte, Boolean> value, Ice.Current current)
+ public Map<Byte, Boolean> opByteBoolD2(Map<Byte, Boolean> value, Current current)
{
return value;
}
@Override
- public MyClass1 opMyClass1(MyClass1 value, Ice.Current current)
+ public MyClass1 opMyClass1(MyClass1 value, Current current)
{
return value;
}
@Override
- public MyStruct1 opMyStruct1(MyStruct1 value, Ice.Current current)
+ public MyStruct1 opMyStruct1(MyStruct1 value, Current current)
{
return value;
}
@Override
- public String[] opStringLiterals(Ice.Current current)
+ public String[] opStringLiterals(Current current)
{
return new String[]
{
@@ -863,50 +788,45 @@ public final class MyDerivedClassI extends MyDerivedClass
}
@Override
- public String[] opWStringLiterals(Ice.Current current)
+ public String[] opWStringLiterals(Current current)
{
return opStringLiterals(current);
}
@Override
- public Structure opMStruct1(Ice.Current current)
+ public MyClass.OpMStruct1MarshaledResult opMStruct1(Current current)
{
- return new Structure();
+ return new MyClass.OpMStruct1MarshaledResult(new Structure(), current);
}
@Override
- public Structure opMStruct2(Structure p1, StructureHolder p2, Ice.Current current)
+ public MyClass.OpMStruct2MarshaledResult opMStruct2(Structure p1, Current current)
{
- p2.value = p1;
- return p1;
+ return new MyClass.OpMStruct2MarshaledResult(p1, p1, current);
}
@Override
- public String[] opMSeq1(Ice.Current current)
+ public MyClass.OpMSeq1MarshaledResult opMSeq1(Current current)
{
- return new String[0];
+ return new MyClass.OpMSeq1MarshaledResult(new String[0], current);
}
@Override
- public String[] opMSeq2(String[] p1, StringSHolder p2, Ice.Current current)
+ public MyClass.OpMSeq2MarshaledResult opMSeq2(String[] p1, Current current)
{
- p2.value = p1;
- return p1;
+ return new MyClass.OpMSeq2MarshaledResult(p1, p1, current);
}
@Override
- public java.util.Map<String, String> opMDict1(Ice.Current current)
+ public MyClass.OpMDict1MarshaledResult opMDict1(Current current)
{
- return new java.util.HashMap<String, String>();
+ return new MyClass.OpMDict1MarshaledResult(new java.util.HashMap<>(), current);
}
@Override
- public java.util.Map<String, String> opMDict2(java.util.Map<String, String> p1,
- StringStringDHolder p2,
- Ice.Current current)
+ public MyClass.OpMDict2MarshaledResult opMDict2(java.util.Map<String, String> p1, Current current)
{
- p2.value = p1;
- return p1;
+ return new MyClass.OpMDict2MarshaledResult(p1, p1, current);
}
private int _opByteSOnewayCallCount = 0;
diff --git a/java/test/src/main/java/test/Ice/operations/Oneways.java b/java/test/src/main/java/test/Ice/operations/Oneways.java
index 7e0badc7326..b72c776deef 100644
--- a/java/test/src/main/java/test/Ice/operations/Oneways.java
+++ b/java/test/src/main/java/test/Ice/operations/Oneways.java
@@ -10,12 +10,10 @@
package test.Ice.operations;
import test.Ice.operations.Test.MyClassPrx;
-import test.Ice.operations.Test.MyClassPrxHelper;
class Oneways
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -23,10 +21,9 @@ class Oneways
}
}
- static void
- oneways(test.Util.Application app, MyClassPrx p)
+ static void oneways(test.Util.Application app, MyClassPrx p)
{
- p = MyClassPrxHelper.uncheckedCast(p.ice_oneway());
+ p = p.ice_oneway();
{
p.ice_ping();
@@ -45,14 +42,12 @@ class Oneways
}
{
-
- Ice.ByteHolder b = new Ice.ByteHolder();
try
{
- p.opByte((byte)0xff, (byte)0x0f, b);
+ p.opByte((byte)0xff, (byte)0x0f);
test(false);
}
- catch(Ice.TwowayOnlyException ex)
+ catch(java.lang.IllegalArgumentException ex)
{
}
}
diff --git a/java/test/src/main/java/test/Ice/operations/OnewaysAMI.java b/java/test/src/main/java/test/Ice/operations/OnewaysAMI.java
index 4750d584e44..e1d7fef69b4 100644
--- a/java/test/src/main/java/test/Ice/operations/OnewaysAMI.java
+++ b/java/test/src/main/java/test/Ice/operations/OnewaysAMI.java
@@ -9,15 +9,17 @@
package test.Ice.operations;
-import test.Ice.operations.Test.Callback_MyClass_opIdempotent;
-import test.Ice.operations.Test.Callback_MyClass_opNonmutating;
-import test.Ice.operations.Test.Callback_MyClass_opVoid;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionException;
+
+import com.zeroc.Ice.Util;
+import com.zeroc.Ice.InvocationFuture;
+
import test.Ice.operations.Test.MyClassPrx;
class OnewaysAMI
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -25,9 +27,9 @@ class OnewaysAMI
}
}
- private static class CallbackBase
+ private static class Callback
{
- CallbackBase()
+ Callback()
{
_called = false;
}
@@ -58,62 +60,26 @@ class OnewaysAMI
private boolean _called;
}
- static class Callback extends CallbackBase
- {
- public Callback()
- {
- }
-
- public void
- sent(boolean sentSynchronously)
- {
- called();
- }
-
- void noException(Ice.LocalException ex)
- {
- test(false);
- }
- }
-
- static void
- onewaysAMI(test.Util.Application app, MyClassPrx proxy)
+ static void onewaysAMI(test.Util.Application app, MyClassPrx proxy)
{
- MyClassPrx p = (MyClassPrx)proxy.ice_oneway();
+ MyClassPrx p = proxy.ice_oneway();
{
final Callback cb = new Callback();
- Ice.Callback_Object_ice_ping callback = new Ice.Callback_Object_ice_ping()
+ CompletableFuture<Void> f = p.ice_pingAsync();
+ f.whenComplete((result, ex) -> test(ex == null));
+ Util.getInvocationFuture(f).whenSent((sentSynchronously, ex) ->
{
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- cb.noException(ex);
- }
-
- @Override
- public void
- sent(boolean sentSynchronously)
- {
- cb.sent(sentSynchronously);
- }
- };
- p.begin_ice_ping(callback);
+ test(ex == null);
+ cb.called();
+ });
cb.check();
}
{
try
{
- p.begin_ice_isA("::Test::MyClass");
+ p.ice_isAAsync("::Test::MyClass").join();
test(false);
}
catch(java.lang.IllegalArgumentException ex)
@@ -124,7 +90,7 @@ class OnewaysAMI
{
try
{
- p.begin_ice_id();
+ p.ice_idAsync();
test(false);
}
catch(java.lang.IllegalArgumentException ex)
@@ -135,7 +101,7 @@ class OnewaysAMI
{
try
{
- p.begin_ice_ids();
+ p.ice_idsAsync();
test(false);
}
catch(java.lang.IllegalArgumentException ex)
@@ -145,95 +111,44 @@ class OnewaysAMI
{
final Callback cb = new Callback();
- Callback_MyClass_opVoid callback = new Callback_MyClass_opVoid()
+ CompletableFuture<Void> f = p.opVoidAsync();
+ f.whenComplete((result, ex) -> test(ex == null));
+ Util.getInvocationFuture(f).whenSent((sentSynchronously, ex) ->
{
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- cb.noException(ex);
- }
-
- @Override
- public void
- sent(boolean sentSynchronously)
- {
- cb.sent(sentSynchronously);
- }
- };
- p.begin_opVoid(callback);
+ test(ex == null);
+ cb.called();
+ });
cb.check();
}
{
final Callback cb = new Callback();
- Callback_MyClass_opIdempotent callback = new Callback_MyClass_opIdempotent()
+ CompletableFuture<Void> f = p.opIdempotentAsync();
+ f.whenComplete((result, ex) -> test(ex == null));
+ Util.getInvocationFuture(f).whenSent((sentSynchronously, ex) ->
{
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- cb.noException(ex);
- }
-
- @Override
- public void
- sent(boolean sentSynchronously)
- {
- cb.sent(sentSynchronously);
- }
- };
- p.begin_opIdempotent(callback);
+ test(ex == null);
+ cb.called();
+ });
cb.check();
}
{
final Callback cb = new Callback();
- Callback_MyClass_opNonmutating callback = new Callback_MyClass_opNonmutating()
+ CompletableFuture<Void> f = p.opNonmutatingAsync();
+ f.whenComplete((result, ex) -> test(ex == null));
+ Util.getInvocationFuture(f).whenSent((sentSynchronously, ex) ->
{
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- cb.noException(ex);
- }
-
- @Override
- public void
- sent(boolean sentSynchronously)
- {
- cb.sent(sentSynchronously);
- }
- };
- p.begin_opNonmutating(callback);
+ test(ex == null);
+ cb.called();
+ });
cb.check();
}
{
try
{
- p.begin_opByte((byte)0xff, (byte)0x0f);
+ p.opByteAsync((byte)0xff, (byte)0x0f);
test(false);
}
catch(java.lang.IllegalArgumentException ex)
diff --git a/java/test/src/main/java/test/Ice/operations/Server.java b/java/test/src/main/java/test/Ice/operations/Server.java
index ae7d1de57bd..bad17efba6b 100644
--- a/java/test/src/main/java/test/Ice/operations/Server.java
+++ b/java/test/src/main/java/test/Ice/operations/Server.java
@@ -15,25 +15,24 @@ public class Server extends test.Util.Application
public int run(String[] args)
{
communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.add(new MyDerivedClassI(), com.zeroc.Ice.Util.stringToIdentity("test"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
+ GetInitDataResult r = super.getInitData(args);
//
// It's possible to have batch oneway requests dispatched
// after the adapter is deactivated due to thread
// scheduling so we suppress this warning.
//
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.operations");
- return initData;
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.operations");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/operations/Twoways.java b/java/test/src/main/java/test/Ice/operations/Twoways.java
index 5fcf878bbde..dbe0a26d14f 100644
--- a/java/test/src/main/java/test/Ice/operations/Twoways.java
+++ b/java/test/src/main/java/test/Ice/operations/Twoways.java
@@ -9,20 +9,19 @@
package test.Ice.operations;
-import Ice.*;
-import Ice.Object;
-import test.Ice.operations.Test.*;
-import test.Util.Application;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import com.zeroc.Ice.*;
+
+import test.Ice.operations.Test.*;
+import test.Util.Application;
+
class Twoways
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -38,8 +37,7 @@ class Twoways
}
@Override
- public void
- run()
+ public void run()
{
java.util.Map<String, String> ctx = _proxy.ice_getCommunicator().getImplicitContext().getContext();
test(ctx.isEmpty());
@@ -51,8 +49,7 @@ class Twoways
final private MyClassPrx _proxy;
}
- static void
- twoways(Application app, MyClassPrx p)
+ static void twoways(Application app, MyClassPrx p)
{
Communicator communicator = app.communicator();
@@ -141,9 +138,9 @@ class Twoways
test(p.ice_id().equals(MyDerivedClass.ice_staticId()));
- test(MyDerivedClassPrxHelper.ice_staticId().equals(MyDerivedClass.ice_staticId()));
- test(ObjectPrxHelper.ice_staticId().equals(Object.ice_staticId));
- test(LocatorPrxHelper.ice_staticId().equals(Locator.ice_staticId));
+ test(MyDerivedClassPrx.ice_staticId().equals(MyDerivedClass.ice_staticId()));
+ test(ObjectPrx.ice_staticId().equals(com.zeroc.Ice.Object.ice_staticId));
+ test(LocatorPrx.ice_staticId().equals(Locator.ice_staticId));
{
String[] ids = p.ice_ids();
@@ -158,125 +155,98 @@ class Twoways
}
{
- ByteHolder b = new ByteHolder();
- byte r;
-
- r = p.opByte((byte) 0xff, (byte) 0x0f, b);
- test(b.value == (byte) 0xf0);
- test(r == (byte) 0xff);
+ MyClass.OpByteResult r = p.opByte((byte) 0xff, (byte) 0x0f);
+ test(r.p3 == (byte) 0xf0);
+ test(r.returnValue == (byte) 0xff);
}
{
- BooleanHolder b = new BooleanHolder();
- boolean r;
-
- r = p.opBool(true, false, b);
- test(b.value);
- test(!r);
+ MyClass.OpBoolResult r = p.opBool(true, false);
+ test(r.p3);
+ test(!r.returnValue);
}
{
- ShortHolder s = new ShortHolder();
- IntHolder i = new IntHolder();
- LongHolder l = new LongHolder();
- long r;
-
- r = p.opShortIntLong((short) 10, 11, 12L, s, i, l);
- test(s.value == 10);
- test(i.value == 11);
- test(l.value == 12);
- test(r == 12L);
-
- r = p.opShortIntLong(Short.MIN_VALUE, Integer.MIN_VALUE,
- Long.MIN_VALUE, s, i, l);
- test(s.value == Short.MIN_VALUE);
- test(i.value == Integer.MIN_VALUE);
- test(l.value == Long.MIN_VALUE);
- test(r == Long.MIN_VALUE);
-
- r = p.opShortIntLong(Short.MAX_VALUE, Integer.MAX_VALUE,
- Long.MAX_VALUE, s, i, l);
- test(s.value == Short.MAX_VALUE);
- test(i.value == Integer.MAX_VALUE);
- test(l.value == Long.MAX_VALUE);
- test(r == Long.MAX_VALUE);
+ MyClass.OpShortIntLongResult r = p.opShortIntLong((short) 10, 11, 12L);
+ test(r.p4 == 10);
+ test(r.p5 == 11);
+ test(r.p6 == 12);
+ test(r.returnValue == 12L);
+
+ r = p.opShortIntLong(Short.MIN_VALUE, Integer.MIN_VALUE, Long.MIN_VALUE);
+ test(r.p4 == Short.MIN_VALUE);
+ test(r.p5 == Integer.MIN_VALUE);
+ test(r.p6 == Long.MIN_VALUE);
+ test(r.returnValue == Long.MIN_VALUE);
+
+ r = p.opShortIntLong(Short.MAX_VALUE, Integer.MAX_VALUE, Long.MAX_VALUE);
+ test(r.p4 == Short.MAX_VALUE);
+ test(r.p5 == Integer.MAX_VALUE);
+ test(r.p6 == Long.MAX_VALUE);
+ test(r.returnValue == Long.MAX_VALUE);
}
{
- FloatHolder f = new FloatHolder();
- DoubleHolder d = new DoubleHolder();
- double r;
-
- r = p.opFloatDouble(3.14f, 1.1E10, f, d);
- test(f.value == 3.14f);
- test(d.value == 1.1E10);
- test(r == 1.1E10);
-
- r = p.opFloatDouble(Float.MIN_VALUE, Double.MIN_VALUE, f, d);
- test(f.value == Float.MIN_VALUE);
- test(d.value == Double.MIN_VALUE);
- test(r == Double.MIN_VALUE);
-
- r = p.opFloatDouble(Float.MAX_VALUE, Double.MAX_VALUE, f, d);
- test(f.value == Float.MAX_VALUE);
- test(d.value == Double.MAX_VALUE);
- test(r == Double.MAX_VALUE);
+ MyClass.OpFloatDoubleResult r = p.opFloatDouble(3.14f, 1.1E10);
+ test(r.p3 == 3.14f);
+ test(r.p4 == 1.1E10);
+ test(r.returnValue == 1.1E10);
+
+ r = p.opFloatDouble(Float.MIN_VALUE, Double.MIN_VALUE);
+ test(r.p3 == Float.MIN_VALUE);
+ test(r.p4 == Double.MIN_VALUE);
+ test(r.returnValue == Double.MIN_VALUE);
+
+ r = p.opFloatDouble(Float.MAX_VALUE, Double.MAX_VALUE);
+ test(r.p3 == Float.MAX_VALUE);
+ test(r.p4 == Double.MAX_VALUE);
+ test(r.returnValue == Double.MAX_VALUE);
}
{
- StringHolder s = new StringHolder();
- String r;
-
- r = p.opString("hello", "world", s);
- test(s.value.equals("world hello"));
- test(r.equals("hello world"));
+ MyClass.OpStringResult r = p.opString("hello", "world");
+ test(r.p3.equals("world hello"));
+ test(r.returnValue.equals("hello world"));
}
{
- MyEnumHolder e = new MyEnumHolder();
- MyEnum r;
-
- r = p.opMyEnum(MyEnum.enum2, e);
- test(e.value == MyEnum.enum2);
- test(r == MyEnum.enum3);
+ MyClass.OpMyEnumResult r = p.opMyEnum(MyEnum.enum2);
+ test(r.p2 == MyEnum.enum2);
+ test(r.returnValue == MyEnum.enum3);
//
- // Test marshalling of null enum (firt enum value is
+ // Test marshalling of null enum (first enum value is
// marshalled in this case).
//
- r = p.opMyEnum(null, e);
- test(e.value == MyEnum.enum1);
- test(r == MyEnum.enum3);
+ r = p.opMyEnum(null);
+ test(r.p2 == MyEnum.enum1);
+ test(r.returnValue == MyEnum.enum3);
}
{
- MyClassPrxHolder c1 = new MyClassPrxHolder();
- MyClassPrxHolder c2 = new MyClassPrxHolder();
- MyClassPrx r;
-
- r = p.opMyClass(p, c1, c2);
- test(Util.proxyIdentityAndFacetCompare(c1.value, p) == 0);
- test(Util.proxyIdentityAndFacetCompare(c2.value, p) != 0);
- test(Util.proxyIdentityAndFacetCompare(r, p) == 0);
- test(c1.value.ice_getIdentity().equals(Ice.Util.stringToIdentity("test")));
- test(c2.value.ice_getIdentity().equals(Ice.Util.stringToIdentity("noSuchIdentity")));
- test(r.ice_getIdentity().equals(Ice.Util.stringToIdentity("test")));
- r.opVoid();
- c1.value.opVoid();
+ MyClass.OpMyClassResult r = p.opMyClass(p);
+ test(Util.proxyIdentityAndFacetCompare(r.p2, p) == 0);
+ test(Util.proxyIdentityAndFacetCompare(r.p3, p) != 0);
+ test(Util.proxyIdentityAndFacetCompare(r.returnValue, p) == 0);
+ test(r.p2.ice_getIdentity().equals(com.zeroc.Ice.Util.stringToIdentity("test")));
+ test(r.p3.ice_getIdentity().equals(com.zeroc.Ice.Util.stringToIdentity("noSuchIdentity")));
+ test(r.returnValue.ice_getIdentity().equals(com.zeroc.Ice.Util.stringToIdentity("test")));
+ r.returnValue.opVoid();
+ r.p2.opVoid();
try
{
- c2.value.opVoid();
+ r.p3.opVoid();
test(false);
}
catch(ObjectNotExistException ex)
{
}
- r = p.opMyClass(null, c1, c2);
- test(c1.value == null);
- test(c2.value != null);
- test(Util.proxyIdentityAndFacetCompare(r, p) == 0);
- r.opVoid();
+ r = p.opMyClass(null);
+ test(r.p2 == null);
+ test(r.p3 != null);
+ test(Util.proxyIdentityAndFacetCompare(r.returnValue, p) == 0);
+ r.returnValue.opVoid();
}
{
@@ -291,30 +261,28 @@ class Twoways
si2.s = new AnotherStruct();
si2.s.s = "def";
- StructureHolder so = new StructureHolder();
- Structure rso = p.opStruct(si1, si2, so);
- test(rso.p == null);
- test(rso.e == MyEnum.enum2);
- test(rso.s.s.equals("def"));
- test(so.value.p.equals(p));
- test(so.value.e == MyEnum.enum3);
- test(so.value.s.s.equals("a new string"));
- so.value.p.opVoid();
+ MyClass.OpStructResult r = p.opStruct(si1, si2);
+ test(r.returnValue.p == null);
+ test(r.returnValue.e == MyEnum.enum2);
+ test(r.returnValue.s.s.equals("def"));
+ test(r.p3.p.equals(p));
+ test(r.p3.e == MyEnum.enum3);
+ test(r.p3.s.s.equals("a new string"));
+ r.p3.p.opVoid();
//
- // Test marshalling of null structs and structs with null members.
+ // Test marshalling of null structs and structs with default member values.
//
si1 = new Structure();
si2 = null;
- so = new StructureHolder();
- rso = p.opStruct(si1, si2, so);
- test(rso.p == null);
- test(rso.e == MyEnum.enum1);
- test(rso.s.s.equals(""));
- test(so.value.p == null);
- test(so.value.e == MyEnum.enum1);
- test(so.value.s.s.equals("a new string"));
+ r = p.opStruct(si1, si2);
+ test(r.returnValue.p == null);
+ test(r.returnValue.e == MyEnum.enum1);
+ test(r.returnValue.s.s.equals(""));
+ test(r.p3.p == null);
+ test(r.p3.e == MyEnum.enum1);
+ test(r.p3.s.s.equals("a new string"));
}
{
@@ -333,43 +301,37 @@ class Twoways
(byte) 0xf4
};
- ByteSHolder bso = new ByteSHolder();
- byte[] rso;
-
- rso = p.opByteS(bsi1, bsi2, bso);
- test(bso.value.length == 4);
- test(bso.value[0] == (byte) 0x22);
- test(bso.value[1] == (byte) 0x12);
- test(bso.value[2] == (byte) 0x11);
- test(bso.value[3] == (byte) 0x01);
- test(rso.length == 8);
- test(rso[0] == (byte) 0x01);
- test(rso[1] == (byte) 0x11);
- test(rso[2] == (byte) 0x12);
- test(rso[3] == (byte) 0x22);
- test(rso[4] == (byte) 0xf1);
- test(rso[5] == (byte) 0xf2);
- test(rso[6] == (byte) 0xf3);
- test(rso[7] == (byte) 0xf4);
+ MyClass.OpByteSResult r = p.opByteS(bsi1, bsi2);
+ test(r.p3.length == 4);
+ test(r.p3[0] == (byte) 0x22);
+ test(r.p3[1] == (byte) 0x12);
+ test(r.p3[2] == (byte) 0x11);
+ test(r.p3[3] == (byte) 0x01);
+ test(r.returnValue.length == 8);
+ test(r.returnValue[0] == (byte) 0x01);
+ test(r.returnValue[1] == (byte) 0x11);
+ test(r.returnValue[2] == (byte) 0x12);
+ test(r.returnValue[3] == (byte) 0x22);
+ test(r.returnValue[4] == (byte) 0xf1);
+ test(r.returnValue[5] == (byte) 0xf2);
+ test(r.returnValue[6] == (byte) 0xf3);
+ test(r.returnValue[7] == (byte) 0xf4);
}
{
final boolean[] bsi1 = {true, true, false};
final boolean[] bsi2 = {false};
- BoolSHolder bso = new BoolSHolder();
- boolean[] rso;
-
- rso = p.opBoolS(bsi1, bsi2, bso);
- test(bso.value.length == 4);
- test(bso.value[0]);
- test(bso.value[1]);
- test(!bso.value[2]);
- test(!bso.value[3]);
- test(rso.length == 3);
- test(!rso[0]);
- test(rso[1]);
- test(rso[2]);
+ MyClass.OpBoolSResult r = p.opBoolS(bsi1, bsi2);
+ test(r.p3.length == 4);
+ test(r.p3[0]);
+ test(r.p3[1]);
+ test(!r.p3[2]);
+ test(!r.p3[3]);
+ test(r.returnValue.length == 3);
+ test(!r.returnValue[0]);
+ test(r.returnValue[1]);
+ test(r.returnValue[2]);
}
{
@@ -377,75 +339,63 @@ class Twoways
final int[] isi = {5, 6, 7, 8};
final long[] lsi = {10, 30, 20};
- ShortSHolder sso = new ShortSHolder();
- IntSHolder iso = new IntSHolder();
- LongSHolder lso = new LongSHolder();
- long[] rso;
-
- rso = p.opShortIntLongS(ssi, isi, lsi, sso, iso, lso);
- test(sso.value.length == 3);
- test(sso.value[0] == 1);
- test(sso.value[1] == 2);
- test(sso.value[2] == 3);
- test(iso.value.length == 4);
- test(iso.value[0] == 8);
- test(iso.value[1] == 7);
- test(iso.value[2] == 6);
- test(iso.value[3] == 5);
- test(lso.value.length == 6);
- test(lso.value[0] == 10);
- test(lso.value[1] == 30);
- test(lso.value[2] == 20);
- test(lso.value[3] == 10);
- test(lso.value[4] == 30);
- test(lso.value[5] == 20);
- test(rso.length == 3);
- test(rso[0] == 10);
- test(rso[1] == 30);
- test(rso[2] == 20);
+ MyClass.OpShortIntLongSResult r = p.opShortIntLongS(ssi, isi, lsi);
+ test(r.p4.length == 3);
+ test(r.p4[0] == 1);
+ test(r.p4[1] == 2);
+ test(r.p4[2] == 3);
+ test(r.p5.length == 4);
+ test(r.p5[0] == 8);
+ test(r.p5[1] == 7);
+ test(r.p5[2] == 6);
+ test(r.p5[3] == 5);
+ test(r.p6.length == 6);
+ test(r.p6[0] == 10);
+ test(r.p6[1] == 30);
+ test(r.p6[2] == 20);
+ test(r.p6[3] == 10);
+ test(r.p6[4] == 30);
+ test(r.p6[5] == 20);
+ test(r.returnValue.length == 3);
+ test(r.returnValue[0] == 10);
+ test(r.returnValue[1] == 30);
+ test(r.returnValue[2] == 20);
}
{
final float[] fsi = {3.14f, 1.11f};
final double[] dsi = {1.1E10, 1.2E10, 1.3E10};
- FloatSHolder fso = new FloatSHolder();
- DoubleSHolder dso = new DoubleSHolder();
- double[] rso;
-
- rso = p.opFloatDoubleS(fsi, dsi, fso, dso);
- test(fso.value.length == 2);
- test(fso.value[0] == 3.14f);
- test(fso.value[1] == 1.11f);
- test(dso.value.length == 3);
- test(dso.value[0] == 1.3E10);
- test(dso.value[1] == 1.2E10);
- test(dso.value[2] == 1.1E10);
- test(rso.length == 5);
- test(rso[0] == 1.1E10);
- test(rso[1] == 1.2E10);
- test(rso[2] == 1.3E10);
- test((float) rso[3] == 3.14f);
- test((float) rso[4] == 1.11f);
+ MyClass.OpFloatDoubleSResult r = p.opFloatDoubleS(fsi, dsi);
+ test(r.p3.length == 2);
+ test(r.p3[0] == 3.14f);
+ test(r.p3[1] == 1.11f);
+ test(r.p4.length == 3);
+ test(r.p4[0] == 1.3E10);
+ test(r.p4[1] == 1.2E10);
+ test(r.p4[2] == 1.1E10);
+ test(r.returnValue.length == 5);
+ test(r.returnValue[0] == 1.1E10);
+ test(r.returnValue[1] == 1.2E10);
+ test(r.returnValue[2] == 1.3E10);
+ test((float) r.returnValue[3] == 3.14f);
+ test((float) r.returnValue[4] == 1.11f);
}
{
final String[] ssi1 = {"abc", "de", "fghi"};
final String[] ssi2 = {"xyz"};
- StringSHolder sso = new StringSHolder();
- String[] rso;
-
- rso = p.opStringS(ssi1, ssi2, sso);
- test(sso.value.length == 4);
- test(sso.value[0].equals("abc"));
- test(sso.value[1].equals("de"));
- test(sso.value[2].equals("fghi"));
- test(sso.value[3].equals("xyz"));
- test(rso.length == 3);
- test(rso[0].equals("fghi"));
- test(rso[1].equals("de"));
- test(rso[2].equals("abc"));
+ MyClass.OpStringSResult r = p.opStringS(ssi1, ssi2);
+ test(r.p3.length == 4);
+ test(r.p3[0].equals("abc"));
+ test(r.p3[1].equals("de"));
+ test(r.p3[2].equals("fghi"));
+ test(r.p3[3].equals("xyz"));
+ test(r.returnValue.length == 3);
+ test(r.returnValue[0].equals("fghi"));
+ test(r.returnValue[1].equals("de"));
+ test(r.returnValue[2].equals("abc"));
}
{
@@ -460,29 +410,26 @@ class Twoways
{(byte) 0xf2, (byte) 0xf1}
};
- ByteSSHolder bso = new ByteSSHolder();
- byte[][] rso;
-
- rso = p.opByteSS(bsi1, bsi2, bso);
- test(bso.value.length == 2);
- test(bso.value[0].length == 1);
- test(bso.value[0][0] == (byte) 0xff);
- test(bso.value[1].length == 3);
- test(bso.value[1][0] == (byte) 0x01);
- test(bso.value[1][1] == (byte) 0x11);
- test(bso.value[1][2] == (byte) 0x12);
- test(rso.length == 4);
- test(rso[0].length == 3);
- test(rso[0][0] == (byte) 0x01);
- test(rso[0][1] == (byte) 0x11);
- test(rso[0][2] == (byte) 0x12);
- test(rso[1].length == 1);
- test(rso[1][0] == (byte) 0xff);
- test(rso[2].length == 1);
- test(rso[2][0] == (byte) 0x0e);
- test(rso[3].length == 2);
- test(rso[3][0] == (byte) 0xf2);
- test(rso[3][1] == (byte) 0xf1);
+ MyClass.OpByteSSResult r = p.opByteSS(bsi1, bsi2);
+ test(r.p3.length == 2);
+ test(r.p3[0].length == 1);
+ test(r.p3[0][0] == (byte) 0xff);
+ test(r.p3[1].length == 3);
+ test(r.p3[1][0] == (byte) 0x01);
+ test(r.p3[1][1] == (byte) 0x11);
+ test(r.p3[1][2] == (byte) 0x12);
+ test(r.returnValue.length == 4);
+ test(r.returnValue[0].length == 3);
+ test(r.returnValue[0][0] == (byte) 0x01);
+ test(r.returnValue[0][1] == (byte) 0x11);
+ test(r.returnValue[0][2] == (byte) 0x12);
+ test(r.returnValue[1].length == 1);
+ test(r.returnValue[1][0] == (byte) 0xff);
+ test(r.returnValue[2].length == 1);
+ test(r.returnValue[2][0] == (byte) 0x0e);
+ test(r.returnValue[3].length == 2);
+ test(r.returnValue[3][0] == (byte) 0xf2);
+ test(r.returnValue[3][1] == (byte) 0xf1);
}
{
@@ -498,30 +445,27 @@ class Twoways
{false, false, true}
};
- BoolSSHolder bso = new BoolSSHolder();
- boolean[][] rso;
-
- rso = p.opBoolSS(bsi1, bsi2, bso);
- test(bso.value.length == 4);
- test(bso.value[0].length == 1);
- test(bso.value[0][0]);
- test(bso.value[1].length == 1);
- test(!bso.value[1][0]);
- test(bso.value[2].length == 2);
- test(bso.value[2][0]);
- test(bso.value[2][1]);
- test(bso.value[3].length == 3);
- test(!bso.value[3][0]);
- test(!bso.value[3][1]);
- test(bso.value[3][2]);
- test(rso.length == 3);
- test(rso[0].length == 2);
- test(rso[0][0]);
- test(rso[0][1]);
- test(rso[1].length == 1);
- test(!rso[1][0]);
- test(rso[2].length == 1);
- test(rso[2][0]);
+ MyClass.OpBoolSSResult r = p.opBoolSS(bsi1, bsi2);
+ test(r.p3.length == 4);
+ test(r.p3[0].length == 1);
+ test(r.p3[0][0]);
+ test(r.p3[1].length == 1);
+ test(!r.p3[1][0]);
+ test(r.p3[2].length == 2);
+ test(r.p3[2][0]);
+ test(r.p3[2][1]);
+ test(r.p3[3].length == 3);
+ test(!r.p3[3][0]);
+ test(!r.p3[3][1]);
+ test(r.p3[3][2]);
+ test(r.returnValue.length == 3);
+ test(r.returnValue[0].length == 2);
+ test(r.returnValue[0][0]);
+ test(r.returnValue[0][1]);
+ test(r.returnValue[1].length == 1);
+ test(!r.returnValue[1][0]);
+ test(r.returnValue[2].length == 1);
+ test(r.returnValue[2][0]);
}
{
@@ -541,37 +485,32 @@ class Twoways
{496, 1729},
};
- ShortSSHolder sso = new ShortSSHolder();
- IntSSHolder iso = new IntSSHolder();
- LongSSHolder lso = new LongSSHolder();
- long[][] rso;
-
- rso = p.opShortIntLongSS(ssi, isi, lsi, sso, iso, lso);
- test(rso.length == 1);
- test(rso[0].length == 2);
- test(rso[0][0] == 496);
- test(rso[0][1] == 1729);
- test(sso.value.length == 3);
- test(sso.value[0].length == 3);
- test(sso.value[0][0] == 1);
- test(sso.value[0][1] == 2);
- test(sso.value[0][2] == 5);
- test(sso.value[1].length == 1);
- test(sso.value[1][0] == 13);
- test(sso.value[2].length == 0);
- test(iso.value.length == 2);
- test(iso.value[0].length == 1);
- test(iso.value[0][0] == 42);
- test(iso.value[1].length == 2);
- test(iso.value[1][0] == 24);
- test(iso.value[1][1] == 98);
- test(lso.value.length == 2);
- test(lso.value[0].length == 2);
- test(lso.value[0][0] == 496);
- test(lso.value[0][1] == 1729);
- test(lso.value[1].length == 2);
- test(lso.value[1][0] == 496);
- test(lso.value[1][1] == 1729);
+ MyClass.OpShortIntLongSSResult r = p.opShortIntLongSS(ssi, isi, lsi);
+ test(r.returnValue.length == 1);
+ test(r.returnValue[0].length == 2);
+ test(r.returnValue[0][0] == 496);
+ test(r.returnValue[0][1] == 1729);
+ test(r.p4.length == 3);
+ test(r.p4[0].length == 3);
+ test(r.p4[0][0] == 1);
+ test(r.p4[0][1] == 2);
+ test(r.p4[0][2] == 5);
+ test(r.p4[1].length == 1);
+ test(r.p4[1][0] == 13);
+ test(r.p4[2].length == 0);
+ test(r.p5.length == 2);
+ test(r.p5[0].length == 1);
+ test(r.p5[0][0] == 42);
+ test(r.p5[1].length == 2);
+ test(r.p5[1][0] == 24);
+ test(r.p5[1][1] == 98);
+ test(r.p6.length == 2);
+ test(r.p6[0].length == 2);
+ test(r.p6[0][0] == 496);
+ test(r.p6[0][1] == 1729);
+ test(r.p6[1].length == 2);
+ test(r.p6[1][0] == 496);
+ test(r.p6[1][1] == 1729);
}
{
@@ -586,31 +525,27 @@ class Twoways
{1.1E10, 1.2E10, 1.3E10}
};
- FloatSSHolder fso = new FloatSSHolder();
- DoubleSSHolder dso = new DoubleSSHolder();
- double[][] rso;
-
- rso = p.opFloatDoubleSS(fsi, dsi, fso, dso);
- test(fso.value.length == 3);
- test(fso.value[0].length == 1);
- test(fso.value[0][0] == 3.14f);
- test(fso.value[1].length == 1);
- test(fso.value[1][0] == 1.11f);
- test(fso.value[2].length == 0);
- test(dso.value.length == 1);
- test(dso.value[0].length == 3);
- test(dso.value[0][0] == 1.1E10);
- test(dso.value[0][1] == 1.2E10);
- test(dso.value[0][2] == 1.3E10);
- test(rso.length == 2);
- test(rso[0].length == 3);
- test(rso[0][0] == 1.1E10);
- test(rso[0][1] == 1.2E10);
- test(rso[0][2] == 1.3E10);
- test(rso[1].length == 3);
- test(rso[1][0] == 1.1E10);
- test(rso[1][1] == 1.2E10);
- test(rso[1][2] == 1.3E10);
+ MyClass.OpFloatDoubleSSResult r = p.opFloatDoubleSS(fsi, dsi);
+ test(r.p3.length == 3);
+ test(r.p3[0].length == 1);
+ test(r.p3[0][0] == 3.14f);
+ test(r.p3[1].length == 1);
+ test(r.p3[1][0] == 1.11f);
+ test(r.p3[2].length == 0);
+ test(r.p4.length == 1);
+ test(r.p4[0].length == 3);
+ test(r.p4[0][0] == 1.1E10);
+ test(r.p4[0][1] == 1.2E10);
+ test(r.p4[0][2] == 1.3E10);
+ test(r.returnValue.length == 2);
+ test(r.returnValue[0].length == 3);
+ test(r.returnValue[0][0] == 1.1E10);
+ test(r.returnValue[0][1] == 1.2E10);
+ test(r.returnValue[0][2] == 1.3E10);
+ test(r.returnValue[1].length == 3);
+ test(r.returnValue[1][0] == 1.1E10);
+ test(r.returnValue[1][1] == 1.2E10);
+ test(r.returnValue[1][2] == 1.3E10);
}
{
@@ -626,25 +561,22 @@ class Twoways
{"xyz"}
};
- StringSSHolder sso = new StringSSHolder();
- String[][] rso;
-
- rso = p.opStringSS(ssi1, ssi2, sso);
- test(sso.value.length == 5);
- test(sso.value[0].length == 1);
- test(sso.value[0][0].equals("abc"));
- test(sso.value[1].length == 2);
- test(sso.value[1][0].equals("de"));
- test(sso.value[1][1].equals("fghi"));
- test(sso.value[2].length == 0);
- test(sso.value[3].length == 0);
- test(sso.value[4].length == 1);
- test(sso.value[4][0].equals("xyz"));
- test(rso.length == 3);
- test(rso[0].length == 1);
- test(rso[0][0].equals("xyz"));
- test(rso[1].length == 0);
- test(rso[2].length == 0);
+ MyClass.OpStringSSResult r = p.opStringSS(ssi1, ssi2);
+ test(r.p3.length == 5);
+ test(r.p3[0].length == 1);
+ test(r.p3[0][0].equals("abc"));
+ test(r.p3[1].length == 2);
+ test(r.p3[1][0].equals("de"));
+ test(r.p3[1][1].equals("fghi"));
+ test(r.p3[2].length == 0);
+ test(r.p3[3].length == 0);
+ test(r.p3[4].length == 1);
+ test(r.p3[4][0].equals("xyz"));
+ test(r.returnValue.length == 3);
+ test(r.returnValue[0].length == 1);
+ test(r.returnValue[0][0].equals("xyz"));
+ test(r.returnValue[1].length == 0);
+ test(r.returnValue[2].length == 0);
}
{
@@ -684,42 +616,39 @@ class Twoways
}
};
- StringSSSHolder ssso = new StringSSSHolder();
- String rsso[][][];
-
- rsso = p.opStringSSS(sssi1, sssi2, ssso);
- test(ssso.value.length == 5);
- test(ssso.value[0].length == 2);
- test(ssso.value[0][0].length == 2);
- test(ssso.value[0][1].length == 1);
- test(ssso.value[1].length == 1);
- test(ssso.value[1][0].length == 1);
- test(ssso.value[2].length == 2);
- test(ssso.value[2][0].length == 2);
- test(ssso.value[2][1].length == 1);
- test(ssso.value[3].length == 1);
- test(ssso.value[3][0].length == 1);
- test(ssso.value[4].length == 0);
- test(ssso.value[0][0][0].equals("abc"));
- test(ssso.value[0][0][1].equals("de"));
- test(ssso.value[0][1][0].equals("xyz"));
- test(ssso.value[1][0][0].equals("hello"));
- test(ssso.value[2][0][0].equals(""));
- test(ssso.value[2][0][1].equals(""));
- test(ssso.value[2][1][0].equals("abcd"));
- test(ssso.value[3][0][0].equals(""));
-
- test(rsso.length == 3);
- test(rsso[0].length == 0);
- test(rsso[1].length == 1);
- test(rsso[1][0].length == 1);
- test(rsso[2].length == 2);
- test(rsso[2][0].length == 2);
- test(rsso[2][1].length == 1);
- test(rsso[1][0][0].equals(""));
- test(rsso[2][0][0].equals(""));
- test(rsso[2][0][1].equals(""));
- test(rsso[2][1][0].equals("abcd"));
+ MyClass.OpStringSSSResult r = p.opStringSSS(sssi1, sssi2);
+ test(r.p3.length == 5);
+ test(r.p3[0].length == 2);
+ test(r.p3[0][0].length == 2);
+ test(r.p3[0][1].length == 1);
+ test(r.p3[1].length == 1);
+ test(r.p3[1][0].length == 1);
+ test(r.p3[2].length == 2);
+ test(r.p3[2][0].length == 2);
+ test(r.p3[2][1].length == 1);
+ test(r.p3[3].length == 1);
+ test(r.p3[3][0].length == 1);
+ test(r.p3[4].length == 0);
+ test(r.p3[0][0][0].equals("abc"));
+ test(r.p3[0][0][1].equals("de"));
+ test(r.p3[0][1][0].equals("xyz"));
+ test(r.p3[1][0][0].equals("hello"));
+ test(r.p3[2][0][0].equals(""));
+ test(r.p3[2][0][1].equals(""));
+ test(r.p3[2][1][0].equals("abcd"));
+ test(r.p3[3][0][0].equals(""));
+
+ test(r.returnValue.length == 3);
+ test(r.returnValue[0].length == 0);
+ test(r.returnValue[1].length == 1);
+ test(r.returnValue[1][0].length == 1);
+ test(r.returnValue[2].length == 2);
+ test(r.returnValue[2][0].length == 2);
+ test(r.returnValue[2][1].length == 1);
+ test(r.returnValue[1][0][0].equals(""));
+ test(r.returnValue[2][0][0].equals(""));
+ test(r.returnValue[2][0][1].equals(""));
+ test(r.returnValue[2][1][0].equals("abcd"));
}
{
@@ -731,15 +660,14 @@ class Twoways
di2.put((byte) 11, Boolean.FALSE);
di2.put((byte) 101, Boolean.TRUE);
- ByteBoolDHolder _do = new ByteBoolDHolder();
- Map<Byte, Boolean> ro = p.opByteBoolD(di1, di2, _do);
+ MyClass.OpByteBoolDResult r = p.opByteBoolD(di1, di2);
- test(_do.value.equals(di1));
- test(ro.size() == 4);
- test(ro.get((byte) 10));
- test(!ro.get((byte) 11));
- test(!ro.get((byte) 100));
- test(ro.get((byte) 101));
+ test(r.p3.equals(di1));
+ test(r.returnValue.size() == 4);
+ test(r.returnValue.get((byte) 10));
+ test(!r.returnValue.get((byte) 11));
+ test(!r.returnValue.get((byte) 100));
+ test(r.returnValue.get((byte) 101));
}
{
@@ -751,15 +679,14 @@ class Twoways
di2.put((short) 111, -100);
di2.put((short) 1101, 0);
- ShortIntDHolder _do = new ShortIntDHolder();
- Map<Short, Integer> ro = p.opShortIntD(di1, di2, _do);
+ MyClass.OpShortIntDResult r = p.opShortIntD(di1, di2);
- test(_do.value.equals(di1));
- test(ro.size() == 4);
- test(ro.get((short) 110) == -1);
- test(ro.get((short) 111) == -100);
- test(ro.get((short) 1100) == 123123);
- test(ro.get((short) 1101) == 0);
+ test(r.p3.equals(di1));
+ test(r.returnValue.size() == 4);
+ test(r.returnValue.get((short) 110) == -1);
+ test(r.returnValue.get((short) 111) == -100);
+ test(r.returnValue.get((short) 1100) == 123123);
+ test(r.returnValue.get((short) 1101) == 0);
}
{
@@ -771,15 +698,14 @@ class Twoways
di2.put(999999120L, -100.4f);
di2.put(999999130L, 0.5f);
- LongFloatDHolder _do = new LongFloatDHolder();
- Map<Long, Float> ro = p.opLongFloatD(di1, di2, _do);
+ MyClass.OpLongFloatDResult r = p.opLongFloatD(di1, di2);
- test(_do.value.equals(di1));
- test(ro.size() == 4);
- test(ro.get(999999110L) == -1.1f);
- test(ro.get(999999120L) == -100.4f);
- test(ro.get(999999111L) == 123123.2f);
- test(ro.get(999999130L) == 0.5f);
+ test(r.p3.equals(di1));
+ test(r.returnValue.size() == 4);
+ test(r.returnValue.get(999999110L) == -1.1f);
+ test(r.returnValue.get(999999120L) == -100.4f);
+ test(r.returnValue.get(999999111L) == 123123.2f);
+ test(r.returnValue.get(999999130L) == 0.5f);
}
{
@@ -791,15 +717,14 @@ class Twoways
di2.put("FOO", "abc -100.4");
di2.put("BAR", "abc 0.5");
- StringStringDHolder _do = new StringStringDHolder();
- Map<String, String> ro = p.opStringStringD(di1, di2, _do);
+ MyClass.OpStringStringDResult r = p.opStringStringD(di1, di2);
- test(_do.value.equals(di1));
- test(ro.size() == 4);
- test(ro.get("foo").equals("abc -1.1"));
- test(ro.get("FOO").equals("abc -100.4"));
- test(ro.get("bar").equals("abc 123123.2"));
- test(ro.get("BAR").equals("abc 0.5"));
+ test(r.p3.equals(di1));
+ test(r.returnValue.size() == 4);
+ test(r.returnValue.get("foo").equals("abc -1.1"));
+ test(r.returnValue.get("FOO").equals("abc -100.4"));
+ test(r.returnValue.get("bar").equals("abc 123123.2"));
+ test(r.returnValue.get("BAR").equals("abc 0.5"));
}
{
@@ -811,15 +736,14 @@ class Twoways
di2.put("qwerty", MyEnum.enum3);
di2.put("Hello!!", MyEnum.enum2);
- StringMyEnumDHolder _do = new StringMyEnumDHolder();
- Map<String, MyEnum> ro = p.opStringMyEnumD(di1, di2, _do);
+ MyClass.OpStringMyEnumDResult r = p.opStringMyEnumD(di1, di2);
- test(_do.value.equals(di1));
- test(ro.size() == 4);
- test(ro.get("abc") == MyEnum.enum1);
- test(ro.get("qwerty") == MyEnum.enum3);
- test(ro.get("") == MyEnum.enum2);
- test(ro.get("Hello!!") == MyEnum.enum2);
+ test(r.p3.equals(di1));
+ test(r.returnValue.size() == 4);
+ test(r.returnValue.get("abc") == MyEnum.enum1);
+ test(r.returnValue.get("qwerty") == MyEnum.enum3);
+ test(r.returnValue.get("") == MyEnum.enum2);
+ test(r.returnValue.get("Hello!!") == MyEnum.enum2);
}
{
@@ -829,14 +753,13 @@ class Twoways
di2.put(MyEnum.enum2, "Hello!!");
di2.put(MyEnum.enum3, "qwerty");
- MyEnumStringDHolder _do = new MyEnumStringDHolder();
- Map<MyEnum, String> ro = p.opMyEnumStringD(di1, di2, _do);
+ MyClass.OpMyEnumStringDResult r = p.opMyEnumStringD(di1, di2);
- test(_do.value.equals(di1));
- test(ro.size() == 3);
- test(ro.get(MyEnum.enum1).equals("abc"));
- test(ro.get(MyEnum.enum2).equals("Hello!!"));
- test(ro.get(MyEnum.enum3).equals("qwerty"));
+ test(r.p3.equals(di1));
+ test(r.returnValue.size() == 3);
+ test(r.returnValue.get(MyEnum.enum1).equals("abc"));
+ test(r.returnValue.get(MyEnum.enum2).equals("Hello!!"));
+ test(r.returnValue.get(MyEnum.enum3).equals("qwerty"));
}
{
@@ -853,15 +776,14 @@ class Twoways
di2.put(s22, MyEnum.enum3);
di2.put(s23, MyEnum.enum2);
- MyStructMyEnumDHolder _do = new MyStructMyEnumDHolder();
- Map<MyStruct, MyEnum> ro = p.opMyStructMyEnumD(di1, di2, _do);
+ MyClass.OpMyStructMyEnumDResult r = p.opMyStructMyEnumD(di1, di2);
- test(_do.value.equals(di1));
- test(ro.size() == 4);
- test(ro.get(s11) == MyEnum.enum1);
- test(ro.get(s12) == MyEnum.enum2);
- test(ro.get(s22) == MyEnum.enum3);
- test(ro.get(s23) == MyEnum.enum2);
+ test(r.p3.equals(di1));
+ test(r.returnValue.size() == 4);
+ test(r.returnValue.get(s11) == MyEnum.enum1);
+ test(r.returnValue.get(s12) == MyEnum.enum2);
+ test(r.returnValue.get(s22) == MyEnum.enum3);
+ test(r.returnValue.get(s23) == MyEnum.enum2);
}
{
@@ -883,29 +805,28 @@ class Twoways
dsi1.add(di2);
dsi2.add(di3);
- ByteBoolDSHolder _do = new ByteBoolDSHolder();
- List<Map<Byte, Boolean>> ro = p.opByteBoolDS(dsi1, dsi2, _do);
-
- test(ro.size() == 2);
- test(ro.get(0).size() == 3);
- test(ro.get(0).get((byte) 10));
- test(!ro.get(0).get((byte) 11));
- test(ro.get(0).get((byte) 101));
- test(ro.get(1).size() == 2);
- test(ro.get(1).get((byte) 10));
- test(!ro.get(1).get((byte) 100));
-
- test(_do.value.size() == 3);
- test(_do.value.get(0).size() == 2);
- test(!_do.value.get(0).get((byte) 100));
- test(!_do.value.get(0).get((byte) 101));
- test(_do.value.get(1).size() == 2);
- test(_do.value.get(1).get((byte) 10));
- test(!_do.value.get(1).get((byte) 100));
- test(_do.value.get(2).size() == 3);
- test(_do.value.get(2).get((byte) 10));
- test(!_do.value.get(2).get((byte) 11));
- test(_do.value.get(2).get((byte) 101));
+ MyClass.OpByteBoolDSResult r = p.opByteBoolDS(dsi1, dsi2);
+
+ test(r.returnValue.size() == 2);
+ test(r.returnValue.get(0).size() == 3);
+ test(r.returnValue.get(0).get((byte) 10));
+ test(!r.returnValue.get(0).get((byte) 11));
+ test(r.returnValue.get(0).get((byte) 101));
+ test(r.returnValue.get(1).size() == 2);
+ test(r.returnValue.get(1).get((byte) 10));
+ test(!r.returnValue.get(1).get((byte) 100));
+
+ test(r.p3.size() == 3);
+ test(r.p3.get(0).size() == 2);
+ test(!r.p3.get(0).get((byte) 100));
+ test(!r.p3.get(0).get((byte) 101));
+ test(r.p3.get(1).size() == 2);
+ test(r.p3.get(1).get((byte) 10));
+ test(!r.p3.get(1).get((byte) 100));
+ test(r.p3.get(2).size() == 3);
+ test(r.p3.get(2).get((byte) 10));
+ test(!r.p3.get(2).get((byte) 11));
+ test(r.p3.get(2).get((byte) 101));
}
{
@@ -926,28 +847,27 @@ class Twoways
dsi1.add(di2);
dsi2.add(di3);
- ShortIntDSHolder _do = new ShortIntDSHolder();
- List<Map<Short, Integer>> ro = p.opShortIntDS(dsi1, dsi2, _do);
-
- test(ro.size() == 2);
- test(ro.get(0).size() == 3);
- test(ro.get(0).get((short) 110) == -1);
- test(ro.get(0).get((short) 111) == -100);
- test(ro.get(0).get((short) 1101) == 0);
- test(ro.get(1).size() == 2);
- test(ro.get(1).get((short) 110) == -1);
- test(ro.get(1).get((short) 1100) == 123123);
-
- test(_do.value.size() == 3);
- test(_do.value.get(0).size() == 1);
- test(_do.value.get(0).get((short) 100) == -1001);
- test(_do.value.get(1).size() == 2);
- test(_do.value.get(1).get((short) 110) == -1);
- test(_do.value.get(1).get((short) 1100) == 123123);
- test(_do.value.get(2).size() == 3);
- test(_do.value.get(2).get((short) 110) == -1);
- test(_do.value.get(2).get((short) 111) == -100);
- test(_do.value.get(2).get((short) 1101) == 0);
+ MyClass.OpShortIntDSResult r = p.opShortIntDS(dsi1, dsi2);
+
+ test(r.returnValue.size() == 2);
+ test(r.returnValue.get(0).size() == 3);
+ test(r.returnValue.get(0).get((short) 110) == -1);
+ test(r.returnValue.get(0).get((short) 111) == -100);
+ test(r.returnValue.get(0).get((short) 1101) == 0);
+ test(r.returnValue.get(1).size() == 2);
+ test(r.returnValue.get(1).get((short) 110) == -1);
+ test(r.returnValue.get(1).get((short) 1100) == 123123);
+
+ test(r.p3.size() == 3);
+ test(r.p3.get(0).size() == 1);
+ test(r.p3.get(0).get((short) 100) == -1001);
+ test(r.p3.get(1).size() == 2);
+ test(r.p3.get(1).get((short) 110) == -1);
+ test(r.p3.get(1).get((short) 1100) == 123123);
+ test(r.p3.get(2).size() == 3);
+ test(r.p3.get(2).get((short) 110) == -1);
+ test(r.p3.get(2).get((short) 111) == -100);
+ test(r.p3.get(2).get((short) 1101) == 0);
}
{
@@ -968,28 +888,27 @@ class Twoways
dsi1.add(di2);
dsi2.add(di3);
- LongFloatDSHolder _do = new LongFloatDSHolder();
- List<Map<Long, Float>> ro = p.opLongFloatDS(dsi1, dsi2, _do);
-
- test(ro.size() == 2);
- test(ro.get(0).size() == 3);
- test(ro.get(0).get(999999110L) == -1.1f);
- test(ro.get(0).get(999999120L) == -100.4f);
- test(ro.get(0).get(999999130L) == 0.5f);
- test(ro.get(1).size() == 2);
- test(ro.get(1).get(999999110L) == -1.1f);
- test(ro.get(1).get(999999111L) == 123123.2f);
-
- test(_do.value.size() == 3);
- test(_do.value.get(0).size() == 1);
- test(_do.value.get(0).get(999999140L) == 3.14f);
- test(_do.value.get(1).size() == 2);
- test(_do.value.get(1).get(999999110L) == -1.1f);
- test(_do.value.get(1).get(999999111L) == 123123.2f);
- test(_do.value.get(2).size() == 3);
- test(_do.value.get(2).get(999999110L) == -1.1f);
- test(_do.value.get(2).get(999999120L) == -100.4f);
- test(_do.value.get(2).get(999999130L) == 0.5f);
+ MyClass.OpLongFloatDSResult r = p.opLongFloatDS(dsi1, dsi2);
+
+ test(r.returnValue.size() == 2);
+ test(r.returnValue.get(0).size() == 3);
+ test(r.returnValue.get(0).get(999999110L) == -1.1f);
+ test(r.returnValue.get(0).get(999999120L) == -100.4f);
+ test(r.returnValue.get(0).get(999999130L) == 0.5f);
+ test(r.returnValue.get(1).size() == 2);
+ test(r.returnValue.get(1).get(999999110L) == -1.1f);
+ test(r.returnValue.get(1).get(999999111L) == 123123.2f);
+
+ test(r.p3.size() == 3);
+ test(r.p3.get(0).size() == 1);
+ test(r.p3.get(0).get(999999140L) == 3.14f);
+ test(r.p3.get(1).size() == 2);
+ test(r.p3.get(1).get(999999110L) == -1.1f);
+ test(r.p3.get(1).get(999999111L) == 123123.2f);
+ test(r.p3.get(2).size() == 3);
+ test(r.p3.get(2).get(999999110L) == -1.1f);
+ test(r.p3.get(2).get(999999120L) == -100.4f);
+ test(r.p3.get(2).get(999999130L) == 0.5f);
}
{
@@ -1010,28 +929,27 @@ class Twoways
dsi1.add(di2);
dsi2.add(di3);
- StringStringDSHolder _do = new StringStringDSHolder();
- List<Map<String, String>> ro = p.opStringStringDS(dsi1, dsi2, _do);
-
- test(ro.size() == 2);
- test(ro.get(0).size() == 3);
- test(ro.get(0).get("foo").equals("abc -1.1"));
- test(ro.get(0).get("FOO").equals("abc -100.4"));
- test(ro.get(0).get("BAR").equals("abc 0.5"));
- test(ro.get(1).size() == 2);
- test(ro.get(1).get("foo").equals("abc -1.1"));
- test(ro.get(1).get("bar").equals("abc 123123.2"));
-
- test(_do.value.size() == 3);
- test(_do.value.get(0).size() == 1);
- test(_do.value.get(0).get("f00").equals("ABC -3.14"));
- test(_do.value.get(1).size() == 2);
- test(_do.value.get(1).get("foo").equals("abc -1.1"));
- test(_do.value.get(1).get("bar").equals("abc 123123.2"));
- test(_do.value.get(2).size() == 3);
- test(_do.value.get(2).get("foo").equals("abc -1.1"));
- test(_do.value.get(2).get("FOO").equals("abc -100.4"));
- test(_do.value.get(2).get("BAR").equals("abc 0.5"));
+ MyClass.OpStringStringDSResult r = p.opStringStringDS(dsi1, dsi2);
+
+ test(r.returnValue.size() == 2);
+ test(r.returnValue.get(0).size() == 3);
+ test(r.returnValue.get(0).get("foo").equals("abc -1.1"));
+ test(r.returnValue.get(0).get("FOO").equals("abc -100.4"));
+ test(r.returnValue.get(0).get("BAR").equals("abc 0.5"));
+ test(r.returnValue.get(1).size() == 2);
+ test(r.returnValue.get(1).get("foo").equals("abc -1.1"));
+ test(r.returnValue.get(1).get("bar").equals("abc 123123.2"));
+
+ test(r.p3.size() == 3);
+ test(r.p3.get(0).size() == 1);
+ test(r.p3.get(0).get("f00").equals("ABC -3.14"));
+ test(r.p3.get(1).size() == 2);
+ test(r.p3.get(1).get("foo").equals("abc -1.1"));
+ test(r.p3.get(1).get("bar").equals("abc 123123.2"));
+ test(r.p3.get(2).size() == 3);
+ test(r.p3.get(2).get("foo").equals("abc -1.1"));
+ test(r.p3.get(2).get("FOO").equals("abc -100.4"));
+ test(r.p3.get(2).get("BAR").equals("abc 0.5"));
}
{
@@ -1052,28 +970,27 @@ class Twoways
dsi1.add(di2);
dsi2.add(di3);
- StringMyEnumDSHolder _do = new StringMyEnumDSHolder();
- List<Map<String, MyEnum>> ro = p.opStringMyEnumDS(dsi1, dsi2, _do);
-
- test(ro.size() == 2);
- test(ro.get(0).size() == 3);
- test(ro.get(0).get("abc") == MyEnum.enum1);
- test(ro.get(0).get("qwerty") == MyEnum.enum3);
- test(ro.get(0).get("Hello!!") == MyEnum.enum2);
- test(ro.get(1).size() == 2);
- test(ro.get(1).get("abc") == MyEnum.enum1);
- test(ro.get(1).get("") == MyEnum.enum2);
-
- test(_do.value.size() == 3);
- test(_do.value.get(0).size() == 1);
- test(_do.value.get(0).get("Goodbye") == MyEnum.enum1);
- test(_do.value.get(1).size() == 2);
- test(_do.value.get(1).get("abc") == MyEnum.enum1);
- test(_do.value.get(1).get("") == MyEnum.enum2);
- test(_do.value.get(2).size() == 3);
- test(_do.value.get(2).get("abc") == MyEnum.enum1);
- test(_do.value.get(2).get("qwerty") == MyEnum.enum3);
- test(_do.value.get(2).get("Hello!!") == MyEnum.enum2);
+ MyClass.OpStringMyEnumDSResult r = p.opStringMyEnumDS(dsi1, dsi2);
+
+ test(r.returnValue.size() == 2);
+ test(r.returnValue.get(0).size() == 3);
+ test(r.returnValue.get(0).get("abc") == MyEnum.enum1);
+ test(r.returnValue.get(0).get("qwerty") == MyEnum.enum3);
+ test(r.returnValue.get(0).get("Hello!!") == MyEnum.enum2);
+ test(r.returnValue.get(1).size() == 2);
+ test(r.returnValue.get(1).get("abc") == MyEnum.enum1);
+ test(r.returnValue.get(1).get("") == MyEnum.enum2);
+
+ test(r.p3.size() == 3);
+ test(r.p3.get(0).size() == 1);
+ test(r.p3.get(0).get("Goodbye") == MyEnum.enum1);
+ test(r.p3.get(1).size() == 2);
+ test(r.p3.get(1).get("abc") == MyEnum.enum1);
+ test(r.p3.get(1).get("") == MyEnum.enum2);
+ test(r.p3.get(2).size() == 3);
+ test(r.p3.get(2).get("abc") == MyEnum.enum1);
+ test(r.p3.get(2).get("qwerty") == MyEnum.enum3);
+ test(r.p3.get(2).get("Hello!!") == MyEnum.enum2);
}
{
@@ -1092,24 +1009,23 @@ class Twoways
dsi1.add(di2);
dsi2.add(di3);
- MyEnumStringDSHolder _do = new MyEnumStringDSHolder();
- List<Map<MyEnum, String>> ro = p.opMyEnumStringDS(dsi1, dsi2, _do);
-
- test(ro.size() == 2);
- test(ro.get(0).size() == 2);
- test(ro.get(0).get(MyEnum.enum2).equals("Hello!!"));
- test(ro.get(0).get(MyEnum.enum3).equals("qwerty"));
- test(ro.get(1).size() == 1);
- test(ro.get(1).get(MyEnum.enum1).equals("abc"));
-
- test(_do.value.size() == 3);
- test(_do.value.get(0).size() == 1);
- test(_do.value.get(0).get(MyEnum.enum1).equals("Goodbye"));
- test(_do.value.get(1).size() == 1);
- test(_do.value.get(1).get(MyEnum.enum1).equals("abc"));
- test(_do.value.get(2).size() == 2);
- test(_do.value.get(2).get(MyEnum.enum2).equals("Hello!!"));
- test(_do.value.get(2).get(MyEnum.enum3).equals("qwerty"));
+ MyClass.OpMyEnumStringDSResult r = p.opMyEnumStringDS(dsi1, dsi2);
+
+ test(r.returnValue.size() == 2);
+ test(r.returnValue.get(0).size() == 2);
+ test(r.returnValue.get(0).get(MyEnum.enum2).equals("Hello!!"));
+ test(r.returnValue.get(0).get(MyEnum.enum3).equals("qwerty"));
+ test(r.returnValue.get(1).size() == 1);
+ test(r.returnValue.get(1).get(MyEnum.enum1).equals("abc"));
+
+ test(r.p3.size() == 3);
+ test(r.p3.get(0).size() == 1);
+ test(r.p3.get(0).get(MyEnum.enum1).equals("Goodbye"));
+ test(r.p3.get(1).size() == 1);
+ test(r.p3.get(1).get(MyEnum.enum1).equals("abc"));
+ test(r.p3.get(2).size() == 2);
+ test(r.p3.get(2).get(MyEnum.enum2).equals("Hello!!"));
+ test(r.p3.get(2).get(MyEnum.enum3).equals("qwerty"));
}
{
@@ -1136,28 +1052,27 @@ class Twoways
dsi1.add(di2);
dsi2.add(di3);
- MyStructMyEnumDSHolder _do = new MyStructMyEnumDSHolder();
- List<Map<MyStruct, MyEnum>> ro = p.opMyStructMyEnumDS(dsi1, dsi2, _do);
-
- test(ro.size() == 2);
- test(ro.get(0).size() == 3);
- test(ro.get(0).get(s11) == MyEnum.enum1);
- test(ro.get(0).get(s22) == MyEnum.enum3);
- test(ro.get(0).get(s23) == MyEnum.enum2);
- test(ro.get(1).size() == 2);
- test(ro.get(1).get(s11) == MyEnum.enum1);
- test(ro.get(1).get(s12) == MyEnum.enum2);
-
- test(_do.value.size() == 3);
- test(_do.value.get(0).size() == 1);
- test(_do.value.get(0).get(s23) == MyEnum.enum3);
- test(_do.value.get(1).size() == 2);
- test(_do.value.get(1).get(s11) == MyEnum.enum1);
- test(_do.value.get(1).get(s12) == MyEnum.enum2);
- test(_do.value.get(2).size() == 3);
- test(_do.value.get(2).get(s11) == MyEnum.enum1);
- test(_do.value.get(2).get(s22) == MyEnum.enum3);
- test(_do.value.get(2).get(s23) == MyEnum.enum2);
+ MyClass.OpMyStructMyEnumDSResult r = p.opMyStructMyEnumDS(dsi1, dsi2);
+
+ test(r.returnValue.size() == 2);
+ test(r.returnValue.get(0).size() == 3);
+ test(r.returnValue.get(0).get(s11) == MyEnum.enum1);
+ test(r.returnValue.get(0).get(s22) == MyEnum.enum3);
+ test(r.returnValue.get(0).get(s23) == MyEnum.enum2);
+ test(r.returnValue.get(1).size() == 2);
+ test(r.returnValue.get(1).get(s11) == MyEnum.enum1);
+ test(r.returnValue.get(1).get(s12) == MyEnum.enum2);
+
+ test(r.p3.size() == 3);
+ test(r.p3.get(0).size() == 1);
+ test(r.p3.get(0).get(s23) == MyEnum.enum3);
+ test(r.p3.get(1).size() == 2);
+ test(r.p3.get(1).get(s11) == MyEnum.enum1);
+ test(r.p3.get(1).get(s12) == MyEnum.enum2);
+ test(r.p3.get(2).size() == 3);
+ test(r.p3.get(2).get(s11) == MyEnum.enum1);
+ test(r.p3.get(2).get(s22) == MyEnum.enum3);
+ test(r.p3.get(2).get(s23) == MyEnum.enum2);
}
{
@@ -1172,22 +1087,21 @@ class Twoways
sdi1.put((byte) 0x22, si2);
sdi2.put((byte) 0xf1, si3);
- ByteByteSDHolder _do = new ByteByteSDHolder();
- java.util.Map<Byte, byte[]> ro = p.opByteByteSD(sdi1, sdi2, _do);
-
- test(_do.value.size() == 1);
- test(_do.value.get((byte) 0xf1).length == 2);
- test(_do.value.get((byte) 0xf1)[0] == (byte) 0xf2);
- test(_do.value.get((byte) 0xf1)[1] == (byte) 0xf3);
- test(ro.size() == 3);
- test(ro.get((byte) 0x01).length == 2);
- test(ro.get((byte) 0x01)[0] == (byte) 0x01);
- test(ro.get((byte) 0x01)[1] == (byte) 0x11);
- test(ro.get((byte) 0x22).length == 1);
- test(ro.get((byte) 0x22)[0] == (byte) 0x12);
- test(ro.get((byte) 0xf1).length == 2);
- test(ro.get((byte) 0xf1)[0] == (byte) 0xf2);
- test(ro.get((byte) 0xf1)[1] == (byte) 0xf3);
+ MyClass.OpByteByteSDResult r = p.opByteByteSD(sdi1, sdi2);
+
+ test(r.p3.size() == 1);
+ test(r.p3.get((byte) 0xf1).length == 2);
+ test(r.p3.get((byte) 0xf1)[0] == (byte) 0xf2);
+ test(r.p3.get((byte) 0xf1)[1] == (byte) 0xf3);
+ test(r.returnValue.size() == 3);
+ test(r.returnValue.get((byte) 0x01).length == 2);
+ test(r.returnValue.get((byte) 0x01)[0] == (byte) 0x01);
+ test(r.returnValue.get((byte) 0x01)[1] == (byte) 0x11);
+ test(r.returnValue.get((byte) 0x22).length == 1);
+ test(r.returnValue.get((byte) 0x22)[0] == (byte) 0x12);
+ test(r.returnValue.get((byte) 0xf1).length == 2);
+ test(r.returnValue.get((byte) 0xf1)[0] == (byte) 0xf2);
+ test(r.returnValue.get((byte) 0xf1)[1] == (byte) 0xf3);
}
{
@@ -1201,21 +1115,20 @@ class Twoways
sdi1.put(true, si2);
sdi2.put(false, si1);
- BoolBoolSDHolder _do = new BoolBoolSDHolder();
- java.util.Map<Boolean, boolean[]> ro = p.opBoolBoolSD(sdi1, sdi2, _do);
-
- test(_do.value.size() == 1);
- test(_do.value.get(false).length == 2);
- test(_do.value.get(false)[0]);
- test(!_do.value.get(false)[1]);
- test(ro.size() == 2);
- test(ro.get(false).length == 2);
- test(ro.get(false)[0]);
- test(!ro.get(false)[1]);
- test(ro.get(true).length == 3);
- test(!ro.get(true)[0]);
- test(ro.get(true)[1]);
- test(ro.get(true)[2]);
+ MyClass.OpBoolBoolSDResult r = p.opBoolBoolSD(sdi1, sdi2);
+
+ test(r.p3.size() == 1);
+ test(r.p3.get(false).length == 2);
+ test(r.p3.get(false)[0]);
+ test(!r.p3.get(false)[1]);
+ test(r.returnValue.size() == 2);
+ test(r.returnValue.get(false).length == 2);
+ test(r.returnValue.get(false)[0]);
+ test(!r.returnValue.get(false)[1]);
+ test(r.returnValue.get(true).length == 3);
+ test(!r.returnValue.get(true)[0]);
+ test(r.returnValue.get(true)[1]);
+ test(r.returnValue.get(true)[2]);
}
{
@@ -1230,24 +1143,23 @@ class Twoways
sdi1.put((short) 2, si2);
sdi2.put((short) 4, si3);
- ShortShortSDHolder _do = new ShortShortSDHolder();
- java.util.Map<Short, short[]> ro = p.opShortShortSD(sdi1, sdi2, _do);
-
- test(_do.value.size() == 1);
- test(_do.value.get((short) 4).length == 2);
- test(_do.value.get((short) 4)[0] == 6);
- test(_do.value.get((short) 4)[1] == 7);
- test(ro.size() == 3);
- test(ro.get((short) 1).length == 3);
- test(ro.get((short) 1)[0] == 1);
- test(ro.get((short) 1)[1] == 2);
- test(ro.get((short) 1)[2] == 3);
- test(ro.get((short) 2).length == 2);
- test(ro.get((short) 2)[0] == 4);
- test(ro.get((short) 2)[1] == 5);
- test(ro.get((short) 4).length == 2);
- test(ro.get((short) 4)[0] == 6);
- test(ro.get((short) 4)[1] == 7);
+ MyClass.OpShortShortSDResult r = p.opShortShortSD(sdi1, sdi2);
+
+ test(r.p3.size() == 1);
+ test(r.p3.get((short) 4).length == 2);
+ test(r.p3.get((short) 4)[0] == 6);
+ test(r.p3.get((short) 4)[1] == 7);
+ test(r.returnValue.size() == 3);
+ test(r.returnValue.get((short) 1).length == 3);
+ test(r.returnValue.get((short) 1)[0] == 1);
+ test(r.returnValue.get((short) 1)[1] == 2);
+ test(r.returnValue.get((short) 1)[2] == 3);
+ test(r.returnValue.get((short) 2).length == 2);
+ test(r.returnValue.get((short) 2)[0] == 4);
+ test(r.returnValue.get((short) 2)[1] == 5);
+ test(r.returnValue.get((short) 4).length == 2);
+ test(r.returnValue.get((short) 4)[0] == 6);
+ test(r.returnValue.get((short) 4)[1] == 7);
}
{
@@ -1262,24 +1174,23 @@ class Twoways
sdi1.put(200, si2);
sdi2.put(400, si3);
- IntIntSDHolder _do = new IntIntSDHolder();
- java.util.Map<Integer, int[]> ro = p.opIntIntSD(sdi1, sdi2, _do);
-
- test(_do.value.size() == 1);
- test(_do.value.get(400).length == 2);
- test(_do.value.get(400)[0] == 600);
- test(_do.value.get(400)[1] == 700);
- test(ro.size() == 3);
- test(ro.get(100).length == 3);
- test(ro.get(100)[0] == 100);
- test(ro.get(100)[1] == 200);
- test(ro.get(100)[2] == 300);
- test(ro.get(200).length == 2);
- test(ro.get(200)[0] == 400);
- test(ro.get(200)[1] == 500);
- test(ro.get(400).length == 2);
- test(ro.get(400)[0] == 600);
- test(ro.get(400)[1] == 700);
+ MyClass.OpIntIntSDResult r = p.opIntIntSD(sdi1, sdi2);
+
+ test(r.p3.size() == 1);
+ test(r.p3.get(400).length == 2);
+ test(r.p3.get(400)[0] == 600);
+ test(r.p3.get(400)[1] == 700);
+ test(r.returnValue.size() == 3);
+ test(r.returnValue.get(100).length == 3);
+ test(r.returnValue.get(100)[0] == 100);
+ test(r.returnValue.get(100)[1] == 200);
+ test(r.returnValue.get(100)[2] == 300);
+ test(r.returnValue.get(200).length == 2);
+ test(r.returnValue.get(200)[0] == 400);
+ test(r.returnValue.get(200)[1] == 500);
+ test(r.returnValue.get(400).length == 2);
+ test(r.returnValue.get(400)[0] == 600);
+ test(r.returnValue.get(400)[1] == 700);
}
{
@@ -1294,24 +1205,23 @@ class Twoways
sdi1.put(999999991L, si2);
sdi2.put(999999992L, si3);
- LongLongSDHolder _do = new LongLongSDHolder();
- java.util.Map<Long, long[]> ro = p.opLongLongSD(sdi1, sdi2, _do);
-
- test(_do.value.size() == 1);
- test(_do.value.get(999999992L).length == 2);
- test(_do.value.get(999999992L)[0] == 999999110L);
- test(_do.value.get(999999992L)[1] == 999999120L);
- test(ro.size() == 3);
- test(ro.get(999999990L).length == 3);
- test(ro.get(999999990L)[0] == 999999110L);
- test(ro.get(999999990L)[1] == 999999111L);
- test(ro.get(999999990L)[2] == 999999110L);
- test(ro.get(999999991L).length == 2);
- test(ro.get(999999991L)[0] == 999999120L);
- test(ro.get(999999991L)[1] == 999999130L);
- test(ro.get(999999992L).length == 2);
- test(ro.get(999999992L)[0] == 999999110L);
- test(ro.get(999999992L)[1] == 999999120L);
+ MyClass.OpLongLongSDResult r = p.opLongLongSD(sdi1, sdi2);
+
+ test(r.p3.size() == 1);
+ test(r.p3.get(999999992L).length == 2);
+ test(r.p3.get(999999992L)[0] == 999999110L);
+ test(r.p3.get(999999992L)[1] == 999999120L);
+ test(r.returnValue.size() == 3);
+ test(r.returnValue.get(999999990L).length == 3);
+ test(r.returnValue.get(999999990L)[0] == 999999110L);
+ test(r.returnValue.get(999999990L)[1] == 999999111L);
+ test(r.returnValue.get(999999990L)[2] == 999999110L);
+ test(r.returnValue.get(999999991L).length == 2);
+ test(r.returnValue.get(999999991L)[0] == 999999120L);
+ test(r.returnValue.get(999999991L)[1] == 999999130L);
+ test(r.returnValue.get(999999992L).length == 2);
+ test(r.returnValue.get(999999992L)[0] == 999999110L);
+ test(r.returnValue.get(999999992L)[1] == 999999120L);
}
{
@@ -1326,24 +1236,23 @@ class Twoways
sdi1.put("ABC", si2);
sdi2.put("aBc", si3);
- StringFloatSDHolder _do = new StringFloatSDHolder();
- java.util.Map<String, float[]> ro = p.opStringFloatSD(sdi1, sdi2, _do);
-
- test(_do.value.size() == 1);
- test(_do.value.get("aBc").length == 2);
- test(_do.value.get("aBc")[0] == -3.14f);
- test(_do.value.get("aBc")[1] == 3.14f);
- test(ro.size() == 3);
- test(ro.get("abc").length == 3);
- test(ro.get("abc")[0] == -1.1f);
- test(ro.get("abc")[1] == 123123.2f);
- test(ro.get("abc")[2] == 100.0f);
- test(ro.get("ABC").length == 2);
- test(ro.get("ABC")[0] == 42.24f);
- test(ro.get("ABC")[1] == -1.61f);
- test(ro.get("aBc").length == 2);
- test(ro.get("aBc")[0] == -3.14f);
- test(ro.get("aBc")[1] == 3.14f);
+ MyClass.OpStringFloatSDResult r = p.opStringFloatSD(sdi1, sdi2);
+
+ test(r.p3.size() == 1);
+ test(r.p3.get("aBc").length == 2);
+ test(r.p3.get("aBc")[0] == -3.14f);
+ test(r.p3.get("aBc")[1] == 3.14f);
+ test(r.returnValue.size() == 3);
+ test(r.returnValue.get("abc").length == 3);
+ test(r.returnValue.get("abc")[0] == -1.1f);
+ test(r.returnValue.get("abc")[1] == 123123.2f);
+ test(r.returnValue.get("abc")[2] == 100.0f);
+ test(r.returnValue.get("ABC").length == 2);
+ test(r.returnValue.get("ABC")[0] == 42.24f);
+ test(r.returnValue.get("ABC")[1] == -1.61f);
+ test(r.returnValue.get("aBc").length == 2);
+ test(r.returnValue.get("aBc")[0] == -3.14f);
+ test(r.returnValue.get("aBc")[1] == 3.14f);
}
{
@@ -1358,24 +1267,23 @@ class Twoways
sdi1.put("Goodbye", si2);
sdi2.put("", si3);
- StringDoubleSDHolder _do = new StringDoubleSDHolder();
- java.util.Map<String, double[]> ro = p.opStringDoubleSD(sdi1, sdi2, _do);
-
- test(_do.value.size() == 1);
- test(_do.value.get("").length == 2);
- test(_do.value.get("")[0] == 1.6E10);
- test(_do.value.get("")[1] == 1.7E10);
- test(ro.size()== 3);
- test(ro.get("Hello!!").length == 3);
- test(ro.get("Hello!!")[0] == 1.1E10);
- test(ro.get("Hello!!")[1] == 1.2E10);
- test(ro.get("Hello!!")[2] == 1.3E10);
- test(ro.get("Goodbye").length == 2);
- test(ro.get("Goodbye")[0] == 1.4E10);
- test(ro.get("Goodbye")[1] == 1.5E10);
- test(ro.get("").length== 2);
- test(ro.get("")[0] == 1.6E10);
- test(ro.get("")[1] == 1.7E10);
+ MyClass.OpStringDoubleSDResult r = p.opStringDoubleSD(sdi1, sdi2);
+
+ test(r.p3.size() == 1);
+ test(r.p3.get("").length == 2);
+ test(r.p3.get("")[0] == 1.6E10);
+ test(r.p3.get("")[1] == 1.7E10);
+ test(r.returnValue.size()== 3);
+ test(r.returnValue.get("Hello!!").length == 3);
+ test(r.returnValue.get("Hello!!")[0] == 1.1E10);
+ test(r.returnValue.get("Hello!!")[1] == 1.2E10);
+ test(r.returnValue.get("Hello!!")[2] == 1.3E10);
+ test(r.returnValue.get("Goodbye").length == 2);
+ test(r.returnValue.get("Goodbye")[0] == 1.4E10);
+ test(r.returnValue.get("Goodbye")[1] == 1.5E10);
+ test(r.returnValue.get("").length== 2);
+ test(r.returnValue.get("")[0] == 1.6E10);
+ test(r.returnValue.get("")[1] == 1.7E10);
}
{
@@ -1390,25 +1298,23 @@ class Twoways
sdi1.put("def", si2);
sdi2.put("ghi", si3);
- StringStringSDHolder _do = new StringStringSDHolder();
- java.util.Map<String, String[]> ro = p.opStringStringSD(sdi1, sdi2, _do);
-
-
- test(_do.value.size() == 1);
- test(_do.value.get("ghi").length== 2);
- test(_do.value.get("ghi")[0].equals("and"));
- test(_do.value.get("ghi")[1].equals("xor"));
- test(ro.size()== 3);
- test(ro.get("abc").length == 3);
- test(ro.get("abc")[0].equals("abc"));
- test(ro.get("abc")[1].equals("de"));
- test(ro.get("abc")[2].equals("fghi"));
- test(ro.get("def").length == 2);
- test(ro.get("def")[0].equals("xyz"));
- test(ro.get("def")[1].equals("or"));
- test(ro.get("ghi").length == 2);
- test(ro.get("ghi")[0].equals("and"));
- test(ro.get("ghi")[1].equals("xor"));
+ MyClass.OpStringStringSDResult r = p.opStringStringSD(sdi1, sdi2);
+
+ test(r.p3.size() == 1);
+ test(r.p3.get("ghi").length== 2);
+ test(r.p3.get("ghi")[0].equals("and"));
+ test(r.p3.get("ghi")[1].equals("xor"));
+ test(r.returnValue.size()== 3);
+ test(r.returnValue.get("abc").length == 3);
+ test(r.returnValue.get("abc")[0].equals("abc"));
+ test(r.returnValue.get("abc")[1].equals("de"));
+ test(r.returnValue.get("abc")[2].equals("fghi"));
+ test(r.returnValue.get("def").length == 2);
+ test(r.returnValue.get("def")[0].equals("xyz"));
+ test(r.returnValue.get("def")[1].equals("or"));
+ test(r.returnValue.get("ghi").length == 2);
+ test(r.returnValue.get("ghi")[0].equals("and"));
+ test(r.returnValue.get("ghi")[1].equals("xor"));
}
{
@@ -1423,24 +1329,23 @@ class Twoways
sdi1.put(MyEnum.enum2, si2);
sdi2.put(MyEnum.enum1, si3);
- MyEnumMyEnumSDHolder _do = new MyEnumMyEnumSDHolder();
- java.util.Map<MyEnum, MyEnum[]> ro = p.opMyEnumMyEnumSD(sdi1, sdi2, _do);
-
- test(_do.value.size() == 1);
- test(_do.value.get(MyEnum.enum1).length == 2);
- test(_do.value.get(MyEnum.enum1)[0] == MyEnum.enum3);
- test(_do.value.get(MyEnum.enum1)[1] == MyEnum.enum3);
- test(ro.size()== 3);
- test(ro.get(MyEnum.enum3).length == 3);
- test(ro.get(MyEnum.enum3)[0] == MyEnum.enum1);
- test(ro.get(MyEnum.enum3)[1] == MyEnum.enum1);
- test(ro.get(MyEnum.enum3)[2] == MyEnum.enum2);
- test(ro.get(MyEnum.enum2).length == 2);
- test(ro.get(MyEnum.enum2)[0] == MyEnum.enum1);
- test(ro.get(MyEnum.enum2)[1] == MyEnum.enum2);
- test(ro.get(MyEnum.enum1).length == 2);
- test(ro.get(MyEnum.enum1)[0] == MyEnum.enum3);
- test(ro.get(MyEnum.enum1)[1] == MyEnum.enum3);
+ MyClass.OpMyEnumMyEnumSDResult r = p.opMyEnumMyEnumSD(sdi1, sdi2);
+
+ test(r.p3.size() == 1);
+ test(r.p3.get(MyEnum.enum1).length == 2);
+ test(r.p3.get(MyEnum.enum1)[0] == MyEnum.enum3);
+ test(r.p3.get(MyEnum.enum1)[1] == MyEnum.enum3);
+ test(r.returnValue.size()== 3);
+ test(r.returnValue.get(MyEnum.enum3).length == 3);
+ test(r.returnValue.get(MyEnum.enum3)[0] == MyEnum.enum1);
+ test(r.returnValue.get(MyEnum.enum3)[1] == MyEnum.enum1);
+ test(r.returnValue.get(MyEnum.enum3)[2] == MyEnum.enum2);
+ test(r.returnValue.get(MyEnum.enum2).length == 2);
+ test(r.returnValue.get(MyEnum.enum2)[0] == MyEnum.enum1);
+ test(r.returnValue.get(MyEnum.enum2)[1] == MyEnum.enum2);
+ test(r.returnValue.get(MyEnum.enum1).length == 2);
+ test(r.returnValue.get(MyEnum.enum1)[0] == MyEnum.enum3);
+ test(r.returnValue.get(MyEnum.enum1)[1] == MyEnum.enum3);
}
{
@@ -1478,7 +1383,7 @@ class Twoways
test(r.equals(ctx));
}
{
- MyClassPrx p2 = MyClassPrxHelper.checkedCast(p.ice_context(ctx));
+ MyClassPrx p2 = MyClassPrx.checkedCast(p.ice_context(ctx));
test(p2.ice_getContext().equals(ctx));
Map<String, String> r = p2.opContext();
test(r.equals(ctx));
@@ -1507,7 +1412,7 @@ class Twoways
ctx.put("two", "TWO");
ctx.put("three", "THREE");
- MyClassPrx p3 = MyClassPrxHelper.uncheckedCast(ic.stringToProxy("test:default -p 12010"));
+ MyClassPrx p3 = MyClassPrx.uncheckedCast(ic.stringToProxy("test:default -p 12010"));
ic.getImplicitContext().setContext(ctx);
test(ic.getImplicitContext().getContext().equals(ctx));
@@ -1530,7 +1435,7 @@ class Twoways
combined.putAll(prxContext);
test(combined.get("one").equals("UN"));
- p3 = MyClassPrxHelper.uncheckedCast(p3.ice_context(prxContext));
+ p3 = p3.ice_context(prxContext);
ic.getImplicitContext().setContext(null);
test(p3.opContext().equals(prxContext));
@@ -1542,8 +1447,7 @@ class Twoways
if(impls[i].equals("PerThread"))
{
- Thread thread = new PerThreadContextInvokeThread(
- MyClassPrxHelper.uncheckedCast(p3.ice_context(null)));
+ Thread thread = new PerThreadContextInvokeThread(p3.ice_context(null));
thread.start();
try
{
@@ -1584,7 +1488,7 @@ class Twoways
test(p.opStringS2(null).length == 0);
test(p.opByteBoolD2(null).size() == 0);
- MyDerivedClassPrx d = MyDerivedClassPrxHelper.uncheckedCast(p);
+ MyDerivedClassPrx d = MyDerivedClassPrx.uncheckedCast(p);
MyStruct1 s = new MyStruct1();
s.tesT = "Test.MyStruct1.s";
s.myClass = null;
@@ -1605,9 +1509,8 @@ class Twoways
{
Structure p1 = p.opMStruct1();
p1.e = MyEnum.enum3;
- StructureHolder p2 = new StructureHolder();
- Structure p3 = p.opMStruct2(p1, p2);
- test(p2.value.e == p1.e && p3.e == p1.e);
+ MyClass.OpMStruct2Result r = p.opMStruct2(p1);
+ test(r.p2.e == p1.e && r.returnValue.e == p1.e);
}
{
@@ -1615,19 +1518,17 @@ class Twoways
String[] p1 = new String[1];
p1[0] = "test";
- StringSHolder p2 = new StringSHolder();
- String[] p3 = p.opMSeq2(p1, p2);
- test(java.util.Arrays.equals(p2.value, p1) && java.util.Arrays.equals(p3, p1));
+ MyClass.OpMSeq2Result r = p.opMSeq2(p1);
+ test(java.util.Arrays.equals(r.p2, p1) && java.util.Arrays.equals(r.returnValue, p1));
}
{
p.opMDict1();
- java.util.Map<String, String> p1 = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> p1 = new java.util.HashMap<>();
p1.put("test", "test");
- StringStringDHolder p2 = new StringStringDHolder();
- java.util.Map<String, String> p3 = p.opMDict2(p1, p2);
- test(p2.value.equals(p1) && p3.equals(p1));
+ MyClass.OpMDict2Result r = p.opMDict2(p1);
+ test(r.p2.equals(p1) && r.returnValue.equals(p1));
}
}
}
diff --git a/java/test/src/main/java/test/Ice/operations/TwowaysAMI.java b/java/test/src/main/java/test/Ice/operations/TwowaysAMI.java
index bd9701c27c5..4d81286b720 100644
--- a/java/test/src/main/java/test/Ice/operations/TwowaysAMI.java
+++ b/java/test/src/main/java/test/Ice/operations/TwowaysAMI.java
@@ -9,81 +9,26 @@
package test.Ice.operations;
-import Ice.LocalException;
-import test.Ice.operations.AMD.Test.*;
-import test.Ice.operations.Test.*;
-import test.Ice.operations.Test.AnotherStruct;
-import test.Ice.operations.Test.ByteBoolDSHolder;
-import test.Ice.operations.Test.Callback_MyClass_opBool;
-import test.Ice.operations.Test.Callback_MyClass_opBoolBoolSD;
-import test.Ice.operations.Test.Callback_MyClass_opBoolS;
-import test.Ice.operations.Test.Callback_MyClass_opBoolSS;
-import test.Ice.operations.Test.Callback_MyClass_opByte;
-import test.Ice.operations.Test.Callback_MyClass_opByteBoolD;
-import test.Ice.operations.Test.Callback_MyClass_opByteBoolDS;
-import test.Ice.operations.Test.Callback_MyClass_opByteByteSD;
-import test.Ice.operations.Test.Callback_MyClass_opByteS;
-import test.Ice.operations.Test.Callback_MyClass_opByteSS;
-import test.Ice.operations.Test.Callback_MyClass_opDoubleMarshaling;
-import test.Ice.operations.Test.Callback_MyClass_opFloatDouble;
-import test.Ice.operations.Test.Callback_MyClass_opFloatDoubleS;
-import test.Ice.operations.Test.Callback_MyClass_opFloatDoubleSS;
-import test.Ice.operations.Test.Callback_MyClass_opIdempotent;
-import test.Ice.operations.Test.Callback_MyClass_opIntIntSD;
-import test.Ice.operations.Test.Callback_MyClass_opIntS;
-import test.Ice.operations.Test.Callback_MyClass_opLongFloatD;
-import test.Ice.operations.Test.Callback_MyClass_opLongFloatDS;
-import test.Ice.operations.Test.Callback_MyClass_opLongLongSD;
-import test.Ice.operations.Test.Callback_MyClass_opMyClass;
-import test.Ice.operations.Test.Callback_MyClass_opMyEnum;
-import test.Ice.operations.Test.Callback_MyClass_opMyEnumMyEnumSD;
-import test.Ice.operations.Test.Callback_MyClass_opMyEnumStringD;
-import test.Ice.operations.Test.Callback_MyClass_opMyEnumStringDS;
-import test.Ice.operations.Test.Callback_MyClass_opMyStructMyEnumD;
-import test.Ice.operations.Test.Callback_MyClass_opMyStructMyEnumDS;
-import test.Ice.operations.Test.Callback_MyClass_opNonmutating;
-import test.Ice.operations.Test.Callback_MyClass_opShortIntD;
-import test.Ice.operations.Test.Callback_MyClass_opShortIntDS;
-import test.Ice.operations.Test.Callback_MyClass_opShortIntLong;
-import test.Ice.operations.Test.Callback_MyClass_opShortIntLongS;
-import test.Ice.operations.Test.Callback_MyClass_opShortIntLongSS;
-import test.Ice.operations.Test.Callback_MyClass_opShortShortSD;
-import test.Ice.operations.Test.Callback_MyClass_opString;
-import test.Ice.operations.Test.Callback_MyClass_opStringDoubleSD;
-import test.Ice.operations.Test.Callback_MyClass_opStringFloatSD;
-import test.Ice.operations.Test.Callback_MyClass_opStringMyEnumD;
-import test.Ice.operations.Test.Callback_MyClass_opStringMyEnumDS;
-import test.Ice.operations.Test.Callback_MyClass_opStringS;
-import test.Ice.operations.Test.Callback_MyClass_opStringSS;
-import test.Ice.operations.Test.Callback_MyClass_opStringSSS;
-import test.Ice.operations.Test.Callback_MyClass_opStringStringD;
-import test.Ice.operations.Test.Callback_MyClass_opStringStringDS;
-import test.Ice.operations.Test.Callback_MyClass_opStringStringSD;
-import test.Ice.operations.Test.Callback_MyClass_opStruct;
-import test.Ice.operations.Test.Callback_MyClass_opVoid;
-import test.Ice.operations.Test.Callback_MyDerivedClass_opDerived;
-import test.Ice.operations.Test.MyClass;
-import test.Ice.operations.Test.MyClassPrx;
-import test.Ice.operations.Test.MyClassPrxHelper;
-import test.Ice.operations.Test.MyDerivedClass;
-import test.Ice.operations.Test.MyDerivedClassPrx;
-import test.Ice.operations.Test.MyDerivedClassPrxHelper;
-import test.Ice.operations.Test.MyEnum;
-import test.Ice.operations.Test.MyStruct;
-import test.Ice.operations.Test.Structure;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+
+import com.zeroc.Ice.LocalException;
+
+import test.Ice.operations.Test.*;
class TwowaysAMI
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
+ new Throwable().printStackTrace();
+ //
+ // Exceptions raised by callbacks are swallowed by CompletableFuture.
+ //
throw new RuntimeException();
}
}
@@ -120,1881 +65,167 @@ class TwowaysAMI
private boolean _called;
}
-
- private static class GenericCallback<T> extends Callback
- {
- public GenericCallback(T value)
- {
- _value = value;
- }
-
- public void response(T value)
- {
- _value = value;
- _succeeded = true;
- called();
- }
-
- public void exception(Ice.LocalException ex)
- {
- _succeeded = false;
- called();
- }
-
- public boolean succeeded()
- {
- check();
- return _succeeded;
- }
-
- public T value()
- {
- return _value;
- }
-
- private T _value;
- private boolean _succeeded = false;
- }
-
- private static class pingI extends Ice.Callback_Object_ice_ping
- {
- @Override
- public void response()
- {
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class isAI extends Ice.Callback_Object_ice_isA
- {
- @Override
- public void response(boolean r)
- {
- test(r);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class idI extends Ice.Callback_Object_ice_id
- {
- @Override
- public void response(String id)
- {
- test(id.equals(MyDerivedClass.ice_staticId()));
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class idsI extends Ice.Callback_Object_ice_ids
- {
- @Override
- public void response(String[] ids)
- {
- test(ids.length == 3);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opVoidI extends Callback_MyClass_opVoid
- {
- @Override
- public void response()
- {
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opByteI extends Callback_MyClass_opByte
- {
- @Override
- public void response(byte r, byte b)
- {
- test(b == (byte)0xf0);
- test(r == (byte)0xff);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opBoolI extends Callback_MyClass_opBool
- {
- @Override
- public void response(boolean r, boolean b)
- {
- test(b);
- test(!r);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opShortIntLongI extends Callback_MyClass_opShortIntLong
- {
- @Override
- public void response(long r, short s, int i, long l)
- {
- test(s == 10);
- test(i == 11);
- test(l == 12);
- test(r == 12);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
- private static class opFloatDoubleI extends Callback_MyClass_opFloatDouble
+ static void twowaysAMI(test.Util.Application app, MyClassPrx p)
{
- @Override
- public void response(double r, float f, double d)
- {
- test(f == 3.14f);
- test(d == 1.1E10);
- test(r == 1.1E10);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opStringI extends Callback_MyClass_opString
- {
- @Override
- public void response(String r, String s)
- {
- test(s.equals("world hello"));
- test(r.equals("hello world"));
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opMyEnumI extends Callback_MyClass_opMyEnum
- {
- @Override
- public void response(MyEnum r, MyEnum e)
- {
- test(e == MyEnum.enum2);
- test(r == MyEnum.enum3);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opMyClassI extends Callback_MyClass_opMyClass
- {
- opMyClassI(Ice.Communicator communicator)
- {
- _communicator = communicator;
- }
+ com.zeroc.Ice.Communicator communicator = app.communicator();
- @Override
- public void response(MyClassPrx r, MyClassPrx c1, MyClassPrx c2)
{
- test(c1.ice_getIdentity().equals(Ice.Util.stringToIdentity("test")));
- test(c2.ice_getIdentity().equals(Ice.Util.stringToIdentity("noSuchIdentity")));
- test(r.ice_getIdentity().equals(Ice.Util.stringToIdentity("test")));
- // We can't do the callbacks below in connection serialization mode.
- if(_communicator.getProperties().getPropertyAsInt("Ice.ThreadPool.Client.Serialize") == 0)
- {
- r.opVoid();
- c1.opVoid();
- try
- {
- c2.opVoid();
- test(false);
- }
- catch(Ice.ObjectNotExistException ex)
+ Callback cb = new Callback();
+ p.ice_pingAsync().whenComplete((result, ex) ->
{
- }
- }
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- private Ice.Communicator _communicator;
- }
-
- private static class opStructI extends Callback_MyClass_opStruct
- {
- opStructI(Ice.Communicator communicator)
- {
- _communicator = communicator;
- }
-
- @Override
- public void response(Structure rso, Structure so)
- {
- test(rso.p == null);
- test(rso.e == MyEnum.enum2);
- test(rso.s.s.equals("def"));
- test(so.e == MyEnum.enum3);
- test(so.s.s.equals("a new string"));
- // We can't do the callbacks below in connection serialization mode.
- if(_communicator.getProperties().getPropertyAsInt("Ice.ThreadPool.Client.Serialize") == 0)
- {
- so.p.opVoid();
- }
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- private Ice.Communicator _communicator;
- }
-
- private static class opByteSI extends Callback_MyClass_opByteS
- {
- @Override
- public void response(byte[] rso, byte[] bso)
- {
- test(bso.length == 4);
- test(bso[0] == (byte)0x22);
- test(bso[1] == (byte)0x12);
- test(bso[2] == (byte)0x11);
- test(bso[3] == (byte)0x01);
- test(rso.length == 8);
- test(rso[0] == (byte)0x01);
- test(rso[1] == (byte)0x11);
- test(rso[2] == (byte)0x12);
- test(rso[3] == (byte)0x22);
- test(rso[4] == (byte)0xf1);
- test(rso[5] == (byte)0xf2);
- test(rso[6] == (byte)0xf3);
- test(rso[7] == (byte)0xf4);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opBoolSI extends Callback_MyClass_opBoolS
- {
- @Override
- public void response(boolean[] rso, boolean[] bso)
- {
- test(bso.length == 4);
- test(bso[0]);
- test(bso[1]);
- test(!bso[2]);
- test(!bso[3]);
- test(rso.length == 3);
- test(!rso[0]);
- test(rso[1]);
- test(rso[2]);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opShortIntLongSI extends Callback_MyClass_opShortIntLongS
- {
- @Override
- public void response(long[] rso, short[] sso, int[] iso, long[] lso)
- {
- test(sso.length == 3);
- test(sso[0] == 1);
- test(sso[1] == 2);
- test(sso[2] == 3);
- test(iso.length == 4);
- test(iso[0] == 8);
- test(iso[1] == 7);
- test(iso[2] == 6);
- test(iso[3] == 5);
- test(lso.length == 6);
- test(lso[0] == 10);
- test(lso[1] == 30);
- test(lso[2] == 20);
- test(lso[3] == 10);
- test(lso[4] == 30);
- test(lso[5] == 20);
- test(rso.length == 3);
- test(rso[0] == 10);
- test(rso[1] == 30);
- test(rso[2] == 20);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opFloatDoubleSI extends Callback_MyClass_opFloatDoubleS
- {
- @Override
- public void response(double[] rso, float[] fso, double[] dso)
- {
- test(fso.length == 2);
- test(fso[0] == 3.14f);
- test(fso[1] == 1.11f);
- test(dso.length == 3);
- test(dso[0] == 1.3E10);
- test(dso[1] == 1.2E10);
- test(dso[2] == 1.1E10);
- test(rso.length == 5);
- test(rso[0] == 1.1E10);
- test(rso[1] == 1.2E10);
- test(rso[2] == 1.3E10);
- test((float)rso[3] == 3.14f);
- test((float)rso[4] == 1.11f);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opStringSI extends Callback_MyClass_opStringS
- {
- @Override
- public void response(String[] rso, String[] sso)
- {
- test(sso.length == 4);
- test(sso[0].equals("abc"));
- test(sso[1].equals("de"));
- test(sso[2].equals("fghi"));
- test(sso[3].equals("xyz"));
- test(rso.length == 3);
- test(rso[0].equals("fghi"));
- test(rso[1].equals("de"));
- test(rso[2].equals("abc"));
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opByteSSI extends Callback_MyClass_opByteSS
- {
- @Override
- public void response(byte[][] rso, byte[][] bso)
- {
- test(bso.length == 2);
- test(bso[0].length == 1);
- test(bso[0][0] == (byte)0xff);
- test(bso[1].length == 3);
- test(bso[1][0] == (byte)0x01);
- test(bso[1][1] == (byte)0x11);
- test(bso[1][2] == (byte)0x12);
- test(rso.length == 4);
- test(rso[0].length == 3);
- test(rso[0][0] == (byte)0x01);
- test(rso[0][1] == (byte)0x11);
- test(rso[0][2] == (byte)0x12);
- test(rso[1].length == 1);
- test(rso[1][0] == (byte)0xff);
- test(rso[2].length == 1);
- test(rso[2][0] == (byte)0x0e);
- test(rso[3].length == 2);
- test(rso[3][0] == (byte)0xf2);
- test(rso[3][1] == (byte)0xf1);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opBoolSSI extends Callback_MyClass_opBoolSS
- {
- @Override
- public void
- response(boolean[][] rso, boolean[][] bso)
- {
- test(bso.length == 4);
- test(bso[0].length == 1);
- test(bso[0][0]);
- test(bso[1].length == 1);
- test(!bso[1][0]);
- test(bso[2].length == 2);
- test(bso[2][0]);
- test(bso[2][1]);
- test(bso[3].length == 3);
- test(!bso[3][0]);
- test(!bso[3][1]);
- test(bso[3][2]);
- test(rso.length == 3);
- test(rso[0].length == 2);
- test(rso[0][0]);
- test(rso[0][1]);
- test(rso[1].length == 1);
- test(!rso[1][0]);
- test(rso[2].length == 1);
- test(rso[2][0]);
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opShortIntLongSSI extends Callback_MyClass_opShortIntLongSS
- {
- @Override
- public void
- response(long[][] rso, short[][] sso, int[][] iso, long[][] lso)
- {
- test(rso.length == 1);
- test(rso[0].length == 2);
- test(rso[0][0] == 496);
- test(rso[0][1] == 1729);
- test(sso.length == 3);
- test(sso[0].length == 3);
- test(sso[0][0] == 1);
- test(sso[0][1] == 2);
- test(sso[0][2] == 5);
- test(sso[1].length == 1);
- test(sso[1][0] == 13);
- test(sso[2].length == 0);
- test(iso.length == 2);
- test(iso[0].length == 1);
- test(iso[0][0] == 42);
- test(iso[1].length == 2);
- test(iso[1][0] == 24);
- test(iso[1][1] == 98);
- test(lso.length == 2);
- test(lso[0].length == 2);
- test(lso[0][0] == 496);
- test(lso[0][1] == 1729);
- test(lso[1].length == 2);
- test(lso[1][0] == 496);
- test(lso[1][1] == 1729);
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opFloatDoubleSSI extends Callback_MyClass_opFloatDoubleSS
- {
- @Override
- public void response(double[][] rso, float[][] fso, double[][] dso)
- {
- test(fso.length == 3);
- test(fso[0].length == 1);
- test(fso[0][0] == 3.14f);
- test(fso[1].length == 1);
- test(fso[1][0] == 1.11f);
- test(fso[2].length == 0);
- test(dso.length == 1);
- test(dso[0].length == 3);
- test(dso[0][0] == 1.1E10);
- test(dso[0][1] == 1.2E10);
- test(dso[0][2] == 1.3E10);
- test(rso.length == 2);
- test(rso[0].length == 3);
- test(rso[0][0] == 1.1E10);
- test(rso[0][1] == 1.2E10);
- test(rso[0][2] == 1.3E10);
- test(rso[1].length == 3);
- test(rso[1][0] == 1.1E10);
- test(rso[1][1] == 1.2E10);
- test(rso[1][2] == 1.3E10);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opStringSSI extends Callback_MyClass_opStringSS
- {
- @Override
- public void response(String[][] rso, String[][] sso)
- {
- test(sso.length == 5);
- test(sso[0].length == 1);
- test(sso[0][0].equals("abc"));
- test(sso[1].length == 2);
- test(sso[1][0].equals("de"));
- test(sso[1][1].equals("fghi"));
- test(sso[2].length == 0);
- test(sso[3].length == 0);
- test(sso[4].length == 1);
- test(sso[4][0].equals("xyz"));
- test(rso.length == 3);
- test(rso[0].length == 1);
- test(rso[0][0].equals("xyz"));
- test(rso[1].length == 0);
- test(rso[2].length == 0);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opStringSSSI extends Callback_MyClass_opStringSSS
- {
- @Override
- public void response(String[][][] rsso, String[][][] ssso)
- {
- test(ssso.length == 5);
- test(ssso[0].length == 2);
- test(ssso[0][0].length == 2);
- test(ssso[0][1].length == 1);
- test(ssso[1].length == 1);
- test(ssso[1][0].length == 1);
- test(ssso[2].length == 2);
- test(ssso[2][0].length == 2);
- test(ssso[2][1].length == 1);
- test(ssso[3].length == 1);
- test(ssso[3][0].length == 1);
- test(ssso[4].length == 0);
- test(ssso[0][0][0].equals("abc"));
- test(ssso[0][0][1].equals("de"));
- test(ssso[0][1][0].equals("xyz"));
- test(ssso[1][0][0].equals("hello"));
- test(ssso[2][0][0].equals(""));
- test(ssso[2][0][1].equals(""));
- test(ssso[2][1][0].equals("abcd"));
- test(ssso[3][0][0].equals(""));
-
- test(rsso.length == 3);
- test(rsso[0].length == 0);
- test(rsso[1].length == 1);
- test(rsso[1][0].length == 1);
- test(rsso[2].length == 2);
- test(rsso[2][0].length == 2);
- test(rsso[2][1].length == 1);
- test(rsso[1][0][0].equals(""));
- test(rsso[2][0][0].equals(""));
- test(rsso[2][0][1].equals(""));
- test(rsso[2][1][0].equals("abcd"));
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opByteBoolDI extends Callback_MyClass_opByteBoolD
- {
- @Override
- public void response(java.util.Map<Byte, Boolean> ro, java.util.Map<Byte, Boolean> _do)
- {
- java.util.Map<Byte, Boolean> di1 = new java.util.HashMap<>();
- di1.put((byte)10, Boolean.TRUE);
- di1.put((byte)100, Boolean.FALSE);
- test(_do.equals(di1));
- test(ro.size() == 4);
- test(ro.get((byte) 10));
- test(!ro.get((byte) 11));
- test(!ro.get((byte) 100));
- test(ro.get((byte) 101));
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opShortIntDI extends Callback_MyClass_opShortIntD
- {
- @Override
- public void response(java.util.Map<Short, Integer> ro, java.util.Map<Short, Integer> _do)
- {
- java.util.Map<Short, Integer> di1 = new java.util.HashMap<>();
- di1.put((short)110, -1);
- di1.put((short)1100, 123123);
- test(_do.equals(di1));
- test(ro.size() == 4);
- test(ro.get((short) 110) == -1);
- test(ro.get((short) 111) == -100);
- test(ro.get((short) 1100) == 123123);
- test(ro.get((short) 1101) == 0);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opLongFloatDI extends Callback_MyClass_opLongFloatD
- {
- @Override
- public void response(java.util.Map<Long, Float> ro, java.util.Map<Long, Float> _do)
- {
- java.util.Map<Long, Float> di1 = new java.util.HashMap<>();
- di1.put(999999110L, -1.1f);
- di1.put(999999111L, 123123.2f);
- test(_do.equals(di1));
- test(ro.size() == 4);
- test(ro.get(999999110L) == -1.1f);
- test(ro.get(999999120L) == -100.4f);
- test(ro.get(999999111L) == 123123.2f);
- test(ro.get(999999130L) == 0.5f);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opStringStringDI extends Callback_MyClass_opStringStringD
- {
- @Override
- public void response(java.util.Map<String, String> ro, java.util.Map<String, String> _do)
- {
- java.util.Map<String, String> di1 = new java.util.HashMap<>();
- di1.put("foo", "abc -1.1");
- di1.put("bar", "abc 123123.2");
- test(_do.equals(di1));
- test(ro.size() == 4);
- test(ro.get("foo").equals("abc -1.1"));
- test(ro.get("FOO").equals("abc -100.4"));
- test(ro.get("bar").equals("abc 123123.2"));
- test(ro.get("BAR").equals("abc 0.5"));
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opStringMyEnumDI extends Callback_MyClass_opStringMyEnumD
- {
- @Override
- public void response(java.util.Map<String, MyEnum> ro, java.util.Map<String, MyEnum> _do)
- {
- java.util.Map<String, MyEnum> di1 = new java.util.HashMap<>();
- di1.put("abc", MyEnum.enum1);
- di1.put("", MyEnum.enum2);
- test(_do.equals(di1));
- test(ro.size() == 4);
- test(ro.get("abc") == MyEnum.enum1);
- test(ro.get("qwerty") == MyEnum.enum3);
- test(ro.get("") == MyEnum.enum2);
- test(ro.get("Hello!!") == MyEnum.enum2);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opMyEnumStringDI extends Callback_MyClass_opMyEnumStringD
- {
- @Override
- public void response(java.util.Map<MyEnum, String> ro, java.util.Map<MyEnum, String> _do)
- {
- java.util.Map<MyEnum, String> di1 = new java.util.HashMap<>();
- di1.put(MyEnum.enum1, "abc");
- test(_do.equals(di1));
- test(ro.size() == 3);
- test(ro.get(MyEnum.enum1).equals("abc"));
- test(ro.get(MyEnum.enum2).equals("Hello!!"));
- test(ro.get(MyEnum.enum3).equals("qwerty"));
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opMyStructMyEnumDI extends Callback_MyClass_opMyStructMyEnumD
- {
- @Override
- public void response(java.util.Map<MyStruct, MyEnum> ro, java.util.Map<MyStruct, MyEnum> _do)
- {
- MyStruct s11 = new MyStruct(1, 1);
- MyStruct s12 = new MyStruct(1, 2);
- java.util.Map<MyStruct, MyEnum> di1 = new java.util.HashMap<>();
- di1.put(s11, MyEnum.enum1);
- di1.put(s12, MyEnum.enum2);
- test(_do.equals(di1));
- MyStruct s22 = new MyStruct(2, 2);
- MyStruct s23 = new MyStruct(2, 3);
- test(ro.size() == 4);
- test(ro.get(s11) == MyEnum.enum1);
- test(ro.get(s12) == MyEnum.enum2);
- test(ro.get(s22) == MyEnum.enum3);
- test(ro.get(s23) == MyEnum.enum2);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opByteBoolDS extends Callback_MyClass_opByteBoolDS
- {
-
- @Override
- public void response(List<Map<Byte, Boolean>> ro, List<Map<Byte, Boolean>> _do)
- {
- test(ro.size() == 2);
- test(ro.get(0).size() == 3);
- test(ro.get(0).get((byte) 10));
- test(!ro.get(0).get((byte) 11));
- test(ro.get(0).get((byte) 101));
- test(ro.get(1).size() == 2);
- test(ro.get(1).get((byte) 10));
- test(!ro.get(1).get((byte) 100));
-
- test(_do.size() == 3);
- test(_do.get(0).size() == 2);
- test(!_do.get(0).get((byte) 100));
- test(!_do.get(0).get((byte) 101));
- test(_do.get(1).size() == 2);
- test(_do.get(1).get((byte) 10));
- test(!_do.get(1).get((byte) 100));
- test(_do.get(2).size() == 3);
- test(_do.get(2).get((byte) 10));
- test(!_do.get(2).get((byte) 11));
- test(_do.get(2).get((byte) 101));
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opShortIntDS extends Callback_MyClass_opShortIntDS
- {
-
- @Override
- public void response(List<Map<Short, Integer>> ro, List<Map<Short, Integer>> _do)
- {
- test(ro.size() == 2);
- test(ro.get(0).size() == 3);
- test(ro.get(0).get((short) 110) == -1);
- test(ro.get(0).get((short) 111) == -100);
- test(ro.get(0).get((short) 1101) == 0);
- test(ro.get(1).size() == 2);
- test(ro.get(1).get((short) 110) == -1);
- test(ro.get(1).get((short) 1100) == 123123);
-
- test(_do.size() == 3);
- test(_do.get(0).size() == 1);
- test(_do.get(0).get((short) 100) == -1001);
- test(_do.get(1).size() == 2);
- test(_do.get(1).get((short) 110) == -1);
- test(_do.get(1).get((short) 1100) == 123123);
- test(_do.get(2).size() == 3);
- test(_do.get(2).get((short) 110) == -1);
- test(_do.get(2).get((short) 111) == -100);
- test(_do.get(2).get((short) 1101) == 0);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opLongFloatDS extends Callback_MyClass_opLongFloatDS
- {
-
- @Override
- public void response(List<Map<Long, Float>> ro, List<Map<Long, Float>> _do)
- {
- test(ro.size() == 2);
- test(ro.get(0).size() == 3);
- test(ro.get(0).get(999999110L) == -1.1f);
- test(ro.get(0).get(999999120L) == -100.4f);
- test(ro.get(0).get(999999130L) == 0.5f);
- test(ro.get(1).size() == 2);
- test(ro.get(1).get(999999110L) == -1.1f);
- test(ro.get(1).get(999999111L) == 123123.2f);
-
- test(_do.size() == 3);
- test(_do.get(0).size() == 1);
- test(_do.get(0).get(999999140L) == 3.14f);
- test(_do.get(1).size() == 2);
- test(_do.get(1).get(999999110L) == -1.1f);
- test(_do.get(1).get(999999111L) == 123123.2f);
- test(_do.get(2).size() == 3);
- test(_do.get(2).get(999999110L) == -1.1f);
- test(_do.get(2).get(999999120L) == -100.4f);
- test(_do.get(2).get(999999130L) == 0.5f);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opStringStringDS extends Callback_MyClass_opStringStringDS
- {
-
- @Override
- public void response(List<Map<String, String>> ro, List<Map<String, String>> _do)
- {
- test(ro.size() == 2);
- test(ro.get(0).size() == 3);
- test(ro.get(0).get("foo").equals("abc -1.1"));
- test(ro.get(0).get("FOO").equals("abc -100.4"));
- test(ro.get(0).get("BAR").equals("abc 0.5"));
- test(ro.get(1).size() == 2);
- test(ro.get(1).get("foo").equals("abc -1.1"));
- test(ro.get(1).get("bar").equals("abc 123123.2"));
-
- test(_do.size() == 3);
- test(_do.get(0).size() == 1);
- test(_do.get(0).get("f00").equals("ABC -3.14"));
- test(_do.get(1).size() == 2);
- test(_do.get(1).get("foo").equals("abc -1.1"));
- test(_do.get(1).get("bar").equals("abc 123123.2"));
- test(_do.get(2).size() == 3);
- test(_do.get(2).get("foo").equals("abc -1.1"));
- test(_do.get(2).get("FOO").equals("abc -100.4"));
- test(_do.get(2).get("BAR").equals("abc 0.5"));
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opStringMyEnumDS extends Callback_MyClass_opStringMyEnumDS
- {
-
- @Override
- public void response(List<Map<String, MyEnum>> ro, List<Map<String, MyEnum>> _do)
- {
- test(ro.size() == 2);
- test(ro.get(0).size() == 3);
- test(ro.get(0).get("abc") == MyEnum.enum1);
- test(ro.get(0).get("qwerty") == MyEnum.enum3);
- test(ro.get(0).get("Hello!!") == MyEnum.enum2);
- test(ro.get(1).size() == 2);
- test(ro.get(1).get("abc") == MyEnum.enum1);
- test(ro.get(1).get("") == MyEnum.enum2);
-
- test(_do.size() == 3);
- test(_do.get(0).size() == 1);
- test(_do.get(0).get("Goodbye") == MyEnum.enum1);
- test(_do.get(1).size() == 2);
- test(_do.get(1).get("abc") == MyEnum.enum1);
- test(_do.get(1).get("") == MyEnum.enum2);
- test(_do.get(2).size() == 3);
- test(_do.get(2).get("abc") == MyEnum.enum1);
- test(_do.get(2).get("qwerty") == MyEnum.enum3);
- test(_do.get(2).get("Hello!!") == MyEnum.enum2);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opMyEnumStringDS extends Callback_MyClass_opMyEnumStringDS
- {
-
- @Override
- public void response(List<Map<MyEnum, String>> ro, List<Map<MyEnum, String>> _do)
- {
- test(ro.size() == 2);
- test(ro.get(0).size() == 2);
- test(ro.get(0).get(MyEnum.enum2).equals("Hello!!"));
- test(ro.get(0).get(MyEnum.enum3).equals("qwerty"));
- test(ro.get(1).size() == 1);
- test(ro.get(1).get(MyEnum.enum1).equals("abc"));
-
- test(_do.size() == 3);
- test(_do.get(0).size() == 1);
- test(_do.get(0).get(MyEnum.enum1).equals("Goodbye"));
- test(_do.get(1).size() == 1);
- test(_do.get(1).get(MyEnum.enum1).equals("abc"));
- test(_do.get(2).size() == 2);
- test(_do.get(2).get(MyEnum.enum2).equals("Hello!!"));
- test(_do.get(2).get(MyEnum.enum3).equals("qwerty"));
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opMyStructMyEnumDS extends Callback_MyClass_opMyStructMyEnumDS
- {
-
- @Override
- public void response(List<Map<MyStruct, MyEnum>> ro, List<Map<MyStruct, MyEnum>> _do)
- {
- MyStruct s11 = new MyStruct(1, 1);
- MyStruct s12 = new MyStruct(1, 2);
- MyStruct s22 = new MyStruct(2, 2);
- MyStruct s23 = new MyStruct(2, 3);
-
- test(ro.size() == 2);
- test(ro.get(0).size() == 3);
- test(ro.get(0).get(s11) == MyEnum.enum1);
- test(ro.get(0).get(s22) == MyEnum.enum3);
- test(ro.get(0).get(s23) == MyEnum.enum2);
- test(ro.get(1).size() == 2);
- test(ro.get(1).get(s11) == MyEnum.enum1);
- test(ro.get(1).get(s12) == MyEnum.enum2);
-
- test(_do.size() == 3);
- test(_do.get(0).size() == 1);
- test(_do.get(0).get(s23) == MyEnum.enum3);
- test(_do.get(1).size() == 2);
- test(_do.get(1).get(s11) == MyEnum.enum1);
- test(_do.get(1).get(s12) == MyEnum.enum2);
- test(_do.get(2).size() == 3);
- test(_do.get(2).get(s11) == MyEnum.enum1);
- test(_do.get(2).get(s22) == MyEnum.enum3);
- test(_do.get(2).get(s23) == MyEnum.enum2);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opByteByteSD extends Callback_MyClass_opByteByteSD
- {
-
- @Override
- public void response(Map<Byte, byte[]> ro, Map<Byte, byte[]> _do)
- {
- test(_do.size() == 1);
- test(_do.get((byte) 0xf1).length == 2);
- test(_do.get((byte) 0xf1)[0] == (byte) 0xf2);
- test(_do.get((byte) 0xf1)[1] == (byte) 0xf3);
- test(ro.size() == 3);
- test(ro.get((byte) 0x01).length == 2);
- test(ro.get((byte) 0x01)[0] == (byte) 0x01);
- test(ro.get((byte) 0x01)[1] == (byte) 0x11);
- test(ro.get((byte) 0x22).length == 1);
- test(ro.get((byte) 0x22)[0] == (byte) 0x12);
- test(ro.get((byte) 0xf1).length == 2);
- test(ro.get((byte) 0xf1)[0] == (byte) 0xf2);
- test(ro.get((byte) 0xf1)[1] == (byte) 0xf3);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
- private static class opBoolBoolSD extends Callback_MyClass_opBoolBoolSD
- {
-
- @Override
- public void response(Map<Boolean, boolean[]> ro, Map<Boolean, boolean[]> _do)
- {
- test(_do.size() == 1);
- test(_do.get(false).length == 2);
- test(_do.get(false)[0]);
- test(!_do.get(false)[1]);
- test(ro.size() == 2);
- test(ro.get(false).length == 2);
- test(ro.get(false)[0]);
- test(!ro.get(false)[1]);
- test(ro.get(true).length == 3);
- test(!ro.get(true)[0]);
- test(ro.get(true)[1]);
- test(ro.get(true)[2]);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
- private static class opShortShortSD extends Callback_MyClass_opShortShortSD
- {
-
- @Override
- public void response(Map<Short, short[]> ro, Map<Short, short[]> _do)
- {
- test(_do.size() == 1);
- test(_do.get((short) 4).length == 2);
- test(_do.get((short) 4)[0] == 6);
- test(_do.get((short) 4)[1] == 7);
- test(ro.size() == 3);
- test(ro.get((short) 1).length == 3);
- test(ro.get((short) 1)[0] == 1);
- test(ro.get((short) 1)[1] == 2);
- test(ro.get((short) 1)[2] == 3);
- test(ro.get((short) 2).length == 2);
- test(ro.get((short) 2)[0] == 4);
- test(ro.get((short) 2)[1] == 5);
- test(ro.get((short) 4).length == 2);
- test(ro.get((short) 4)[0] == 6);
- test(ro.get((short) 4)[1] == 7);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
- private static class opIntIntSD extends Callback_MyClass_opIntIntSD
- {
-
- @Override
- public void response(Map<Integer, int[]> ro, Map<Integer, int[]> _do)
- {
- test(_do.size() == 1);
- test(_do.get(400).length == 2);
- test(_do.get(400)[0] == 600);
- test(_do.get(400)[1] == 700);
- test(ro.size() == 3);
- test(ro.get(100).length == 3);
- test(ro.get(100)[0] == 100);
- test(ro.get(100)[1] == 200);
- test(ro.get(100)[2] == 300);
- test(ro.get(200).length == 2);
- test(ro.get(200)[0] == 400);
- test(ro.get(200)[1] == 500);
- test(ro.get(400).length == 2);
- test(ro.get(400)[0] == 600);
- test(ro.get(400)[1] == 700);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
- private static class opLongLongSD extends Callback_MyClass_opLongLongSD
- {
-
- @Override
- public void response(Map<Long, long[]> ro, Map<Long, long[]> _do)
- {
- test(_do.size() == 1);
- test(_do.get(999999992L).length == 2);
- test(_do.get(999999992L)[0] == 999999110L);
- test(_do.get(999999992L)[1] == 999999120);
- test(ro.size() == 3);
- test(ro.get(999999990L).length == 3);
- test(ro.get(999999990L)[0] == 999999110);
- test(ro.get(999999990L)[1] == 999999111);
- test(ro.get(999999990L)[2] == 999999110);
- test(ro.get(999999991L).length == 2);
- test(ro.get(999999991L)[0] == 999999120);
- test(ro.get(999999991L)[1] == 999999130);
- test(ro.get(999999992L).length == 2);
- test(ro.get(999999992L)[0] == 999999110);
- test(ro.get(999999992L)[1] == 999999120);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
- private static class opStringFloatSD extends Callback_MyClass_opStringFloatSD
- {
-
- @Override
- public void response(Map<String, float[]> ro, Map<String, float[]> _do)
- {
- test(_do.size() == 1);
- test(_do.get("aBc").length == 2);
- test(_do.get("aBc")[0] == -3.14f);
- test(_do.get("aBc")[1] == 3.14f);
- test(ro.size() == 3);
- test(ro.get("abc").length == 3);
- test(ro.get("abc")[0] == -1.1f);
- test(ro.get("abc")[1] == 123123.2f);
- test(ro.get("abc")[2] == 100.0f);
- test(ro.get("ABC").length == 2);
- test(ro.get("ABC")[0] == 42.24f);
- test(ro.get("ABC")[1] == -1.61f);
- test(ro.get("aBc").length == 2);
- test(ro.get("aBc")[0] == -3.14f);
- test(ro.get("aBc")[1] == 3.14f);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
- private static class opStringDoubleSD extends Callback_MyClass_opStringDoubleSD
- {
-
- @Override
- public void response(Map<String, double[]> ro, Map<String, double[]> _do)
- {
- test(_do.size() == 1);
- test(_do.get("").length == 2);
- test(_do.get("")[0] == 1.6E10);
- test(_do.get("")[1] == 1.7E10);
- test(ro.size()== 3);
- test(ro.get("Hello!!").length == 3);
- test(ro.get("Hello!!")[0] == 1.1E10);
- test(ro.get("Hello!!")[1] == 1.2E10);
- test(ro.get("Hello!!")[2] == 1.3E10);
- test(ro.get("Goodbye").length == 2);
- test(ro.get("Goodbye")[0] == 1.4E10);
- test(ro.get("Goodbye")[1] == 1.5E10);
- test(ro.get("").length== 2);
- test(ro.get("")[0] == 1.6E10);
- test(ro.get("")[1] == 1.7E10);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
- private static class opStringStringSD extends Callback_MyClass_opStringStringSD
- {
-
- @Override
- public void response(Map<String, String[]> ro, Map<String, String[]> _do)
- {
- test(_do.size() == 1);
- test(_do.get("ghi").length== 2);
- test(_do.get("ghi")[0].equals("and"));
- test(_do.get("ghi")[1].equals("xor"));
- test(ro.size()== 3);
- test(ro.get("abc").length == 3);
- test(ro.get("abc")[0].equals("abc"));
- test(ro.get("abc")[1].equals("de"));
- test(ro.get("abc")[2].equals("fghi"));
- test(ro.get("def").length == 2);
- test(ro.get("def")[0].equals("xyz"));
- test(ro.get("def")[1].equals("or"));
- test(ro.get("ghi").length == 2);
- test(ro.get("ghi")[0].equals("and"));
- test(ro.get("ghi")[1].equals("xor"));
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
- private static class opMyEnumMyEnumSD extends Callback_MyClass_opMyEnumMyEnumSD
- {
-
- @Override
- public void response(Map<MyEnum, MyEnum[]> ro, Map<MyEnum, MyEnum[]> _do)
- {
- test(_do.size() == 1);
- test(_do.get(MyEnum.enum1).length == 2);
- test(_do.get(MyEnum.enum1)[0] == MyEnum.enum3);
- test(_do.get(MyEnum.enum1)[1] == MyEnum.enum3);
- test(ro.size()== 3);
- test(ro.get(MyEnum.enum3).length == 3);
- test(ro.get(MyEnum.enum3)[0] == MyEnum.enum1);
- test(ro.get(MyEnum.enum3)[1] == MyEnum.enum1);
- test(ro.get(MyEnum.enum3)[2] == MyEnum.enum2);
- test(ro.get(MyEnum.enum2).length == 2);
- test(ro.get(MyEnum.enum2)[0] == MyEnum.enum1);
- test(ro.get(MyEnum.enum2)[1] == MyEnum.enum2);
- test(ro.get(MyEnum.enum1).length == 2);
- test(ro.get(MyEnum.enum1)[0] == MyEnum.enum3);
- test(ro.get(MyEnum.enum1)[1] == MyEnum.enum3);
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opIntSI extends Callback_MyClass_opIntS
- {
- opIntSI(int l)
- {
- _l = l;
- }
-
- @Override
- public void response(int[] r)
- {
- test(r.length == _l);
- for(int j = 0; j < r.length; ++j)
- {
- test(r[j] == -j);
- }
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private int _l;
- private Callback callback = new Callback();
- }
-
- private static class opDerivedI extends Callback_MyDerivedClass_opDerived
- {
- @Override
- public void response()
- {
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opDoubleMarshalingI extends Callback_MyClass_opDoubleMarshaling
- {
- @Override
- public void response()
- {
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opIdempotentI extends Callback_MyClass_opIdempotent
- {
- @Override
- public void response()
- {
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class opNonmutatingI extends Callback_MyClass_opNonmutating
- {
- @Override
- public void response()
- {
- callback.called();
- }
-
- @Override
- public void exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- static void
- twowaysAMI(test.Util.Application app, MyClassPrx p)
- {
- Ice.Communicator communicator = app.communicator();
-
- {
- pingI cb = new pingI();
- p.begin_ice_ping(cb);
+ test(ex == null);
+ cb.called();
+ });
cb.check();
}
{
- isAI cb = new isAI();
- p.begin_ice_isA(MyClass.ice_staticId(), cb);
+ Callback cb = new Callback();
+ p.ice_isAAsync(MyClass.ice_staticId()).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result);
+ cb.called();
+ });
cb.check();
}
{
- idI cb = new idI();
- p.begin_ice_id(cb);
+ Callback cb = new Callback();
+ p.ice_idAsync().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.equals(MyDerivedClass.ice_staticId()));
+ cb.called();
+ });
cb.check();
}
{
- idsI cb = new idsI();
- p.begin_ice_ids(cb);
+ Callback cb = new Callback();
+ p.ice_idsAsync().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.length == 3);
+ cb.called();
+ });
cb.check();
}
{
- Ice.AsyncResult r = p.begin_opVoid();
- p.end_opVoid(r);
+ p.opVoidAsync().join();
}
{
- opVoidI cb = new opVoidI();
- p.begin_opVoid(cb);
+ Callback cb = new Callback();
+ p.opVoidAsync().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ cb.called();
+ });
cb.check();
}
{
- Ice.AsyncResult r = p.begin_opByte((byte)0xff, (byte)0x0f);
- Ice.ByteHolder p3 = new Ice.ByteHolder();
- byte ret = p.end_opByte(p3, r);
- test(p3.value == (byte)0xf0);
- test(ret == (byte)0xff);
- }
-
- {
- opByteI cb = new opByteI();
- p.begin_opByte((byte)0xff, (byte)0x0f, cb);
+ Callback cb = new Callback();
+ p.opByteAsync((byte)0xff, (byte)0x0f).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3 == (byte)0xf0);
+ test(result.returnValue == (byte)0xff);
+ cb.called();
+ });
cb.check();
}
{
- opBoolI cb = new opBoolI();
- p.begin_opBool(true, false, cb);
+ Callback cb = new Callback();
+ p.opBoolAsync(true, false).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3);
+ test(!result.returnValue);
+ cb.called();
+ });
cb.check();
}
{
- opShortIntLongI cb = new opShortIntLongI();
- p.begin_opShortIntLong((short)10, 11, 12L, cb);
+ Callback cb = new Callback();
+ p.opShortIntLongAsync((short)10, 11, 12L).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p4 == 10);
+ test(result.p5 == 11);
+ test(result.p6 == 12);
+ test(result.returnValue == 12);
+ cb.called();
+ });
cb.check();
}
{
- opFloatDoubleI cb = new opFloatDoubleI();
- p.begin_opFloatDouble(3.14f, 1.1E10, cb);
+ Callback cb = new Callback();
+ p.opFloatDoubleAsync(3.14f, 1.1E10).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3 == 3.14f);
+ test(result.p4 == 1.1E10);
+ test(result.returnValue == 1.1E10);
+ cb.called();
+ });
cb.check();
}
{
- opStringI cb = new opStringI();
- p.begin_opString("hello", "world", cb);
+ Callback cb = new Callback();
+ p.opStringAsync("hello", "world").whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.equals("world hello"));
+ test(result.returnValue.equals("hello world"));
+ cb.called();
+ });
cb.check();
}
{
- opMyEnumI cb = new opMyEnumI();
- p.begin_opMyEnum(MyEnum.enum2, cb);
+ Callback cb = new Callback();
+ p.opMyEnumAsync(MyEnum.enum2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p2 == MyEnum.enum2);
+ test(result.returnValue == MyEnum.enum3);
+ cb.called();
+ });
cb.check();
}
{
- opMyClassI cb = new opMyClassI(communicator);
- p.begin_opMyClass(p, cb);
+ Callback cb = new Callback();
+ p.opMyClassAsync(p).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p2.ice_getIdentity().equals(com.zeroc.Ice.Util.stringToIdentity("test")));
+ test(result.p3.ice_getIdentity().equals(com.zeroc.Ice.Util.stringToIdentity("noSuchIdentity")));
+ test(result.returnValue.ice_getIdentity().equals(com.zeroc.Ice.Util.stringToIdentity("test")));
+ // We can't do the callbacks below in connection serialization mode.
+ if(communicator.getProperties().getPropertyAsInt("Ice.ThreadPool.Client.Serialize") == 0)
+ {
+ result.returnValue.opVoid();
+ result.p2.opVoid();
+ try
+ {
+ result.p3.opVoid();
+ test(false);
+ }
+ catch(com.zeroc.Ice.ObjectNotExistException e)
+ {
+ }
+ }
+ cb.called();
+ });
cb.check();
}
@@ -2010,8 +241,22 @@ class TwowaysAMI
si2.s = new AnotherStruct();
si2.s.s = "def";
- opStructI cb = new opStructI(communicator);
- p.begin_opStruct(si1, si2, cb);
+ Callback cb = new Callback();
+ p.opStructAsync(si1, si2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.returnValue.p == null);
+ test(result.returnValue.e == MyEnum.enum2);
+ test(result.returnValue.s.s.equals("def"));
+ test(result.p3.e == MyEnum.enum3);
+ test(result.p3.s.s.equals("a new string"));
+ // We can't do the callbacks below in connection serialization mode.
+ if(communicator.getProperties().getPropertyAsInt("Ice.ThreadPool.Client.Serialize") == 0)
+ {
+ result.p3.p.opVoid();
+ }
+ cb.called();
+ });
cb.check();
}
@@ -2031,8 +276,26 @@ class TwowaysAMI
(byte)0xf4
};
- opByteSI cb = new opByteSI();
- p.begin_opByteS(bsi1, bsi2, cb);
+ Callback cb = new Callback();
+ p.opByteSAsync(bsi1, bsi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.length == 4);
+ test(result.p3[0] == (byte)0x22);
+ test(result.p3[1] == (byte)0x12);
+ test(result.p3[2] == (byte)0x11);
+ test(result.p3[3] == (byte)0x01);
+ test(result.returnValue.length == 8);
+ test(result.returnValue[0] == (byte)0x01);
+ test(result.returnValue[1] == (byte)0x11);
+ test(result.returnValue[2] == (byte)0x12);
+ test(result.returnValue[3] == (byte)0x22);
+ test(result.returnValue[4] == (byte)0xf1);
+ test(result.returnValue[5] == (byte)0xf2);
+ test(result.returnValue[6] == (byte)0xf3);
+ test(result.returnValue[7] == (byte)0xf4);
+ cb.called();
+ });
cb.check();
}
@@ -2040,8 +303,21 @@ class TwowaysAMI
final boolean[] bsi1 = { true, true, false };
final boolean[] bsi2 = { false };
- opBoolSI cb = new opBoolSI();
- p.begin_opBoolS(bsi1, bsi2, cb);
+ Callback cb = new Callback();
+ p.opBoolSAsync(bsi1, bsi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.length == 4);
+ test(result.p3[0]);
+ test(result.p3[1]);
+ test(!result.p3[2]);
+ test(!result.p3[3]);
+ test(result.returnValue.length == 3);
+ test(!result.returnValue[0]);
+ test(result.returnValue[1]);
+ test(result.returnValue[2]);
+ cb.called();
+ });
cb.check();
}
@@ -2050,8 +326,32 @@ class TwowaysAMI
final int[] isi = { 5, 6, 7, 8 };
final long[] lsi = { 10, 30, 20 };
- opShortIntLongSI cb = new opShortIntLongSI();
- p.begin_opShortIntLongS(ssi, isi, lsi, cb);
+ Callback cb = new Callback();
+ p.opShortIntLongSAsync(ssi, isi, lsi).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p4.length == 3);
+ test(result.p4[0] == 1);
+ test(result.p4[1] == 2);
+ test(result.p4[2] == 3);
+ test(result.p5.length == 4);
+ test(result.p5[0] == 8);
+ test(result.p5[1] == 7);
+ test(result.p5[2] == 6);
+ test(result.p5[3] == 5);
+ test(result.p6.length == 6);
+ test(result.p6[0] == 10);
+ test(result.p6[1] == 30);
+ test(result.p6[2] == 20);
+ test(result.p6[3] == 10);
+ test(result.p6[4] == 30);
+ test(result.p6[5] == 20);
+ test(result.returnValue.length == 3);
+ test(result.returnValue[0] == 10);
+ test(result.returnValue[1] == 30);
+ test(result.returnValue[2] == 20);
+ cb.called();
+ });
cb.check();
}
@@ -2059,8 +359,25 @@ class TwowaysAMI
final float[] fsi = { 3.14f, 1.11f };
final double[] dsi = { 1.1E10, 1.2E10, 1.3E10 };
- opFloatDoubleSI cb = new opFloatDoubleSI();
- p.begin_opFloatDoubleS(fsi, dsi, cb);
+ Callback cb = new Callback();
+ p.opFloatDoubleSAsync(fsi, dsi).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.length == 2);
+ test(result.p3[0] == 3.14f);
+ test(result.p3[1] == 1.11f);
+ test(result.p4.length == 3);
+ test(result.p4[0] == 1.3E10);
+ test(result.p4[1] == 1.2E10);
+ test(result.p4[2] == 1.1E10);
+ test(result.returnValue.length == 5);
+ test(result.returnValue[0] == 1.1E10);
+ test(result.returnValue[1] == 1.2E10);
+ test(result.returnValue[2] == 1.3E10);
+ test((float)result.returnValue[3] == 3.14f);
+ test((float)result.returnValue[4] == 1.11f);
+ cb.called();
+ });
cb.check();
}
@@ -2068,8 +385,21 @@ class TwowaysAMI
final String[] ssi1 = { "abc", "de", "fghi" };
final String[] ssi2 = { "xyz" };
- opStringSI cb = new opStringSI();
- p.begin_opStringS(ssi1, ssi2, cb);
+ Callback cb = new Callback();
+ p.opStringSAsync(ssi1, ssi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.length == 4);
+ test(result.p3[0].equals("abc"));
+ test(result.p3[1].equals("de"));
+ test(result.p3[2].equals("fghi"));
+ test(result.p3[3].equals("xyz"));
+ test(result.returnValue.length == 3);
+ test(result.returnValue[0].equals("fghi"));
+ test(result.returnValue[1].equals("de"));
+ test(result.returnValue[2].equals("abc"));
+ cb.called();
+ });
cb.check();
}
@@ -2085,8 +415,31 @@ class TwowaysAMI
{ (byte)0xf2, (byte)0xf1 }
};
- opByteSSI cb = new opByteSSI();
- p.begin_opByteSS(bsi1, bsi2, cb);
+ Callback cb = new Callback();
+ p.opByteSSAsync(bsi1, bsi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.length == 2);
+ test(result.p3[0].length == 1);
+ test(result.p3[0][0] == (byte)0xff);
+ test(result.p3[1].length == 3);
+ test(result.p3[1][0] == (byte)0x01);
+ test(result.p3[1][1] == (byte)0x11);
+ test(result.p3[1][2] == (byte)0x12);
+ test(result.returnValue.length == 4);
+ test(result.returnValue[0].length == 3);
+ test(result.returnValue[0][0] == (byte)0x01);
+ test(result.returnValue[0][1] == (byte)0x11);
+ test(result.returnValue[0][2] == (byte)0x12);
+ test(result.returnValue[1].length == 1);
+ test(result.returnValue[1][0] == (byte)0xff);
+ test(result.returnValue[2].length == 1);
+ test(result.returnValue[2][0] == (byte)0x0e);
+ test(result.returnValue[3].length == 2);
+ test(result.returnValue[3][0] == (byte)0xf2);
+ test(result.returnValue[3][1] == (byte)0xf1);
+ cb.called();
+ });
cb.check();
}
@@ -2103,8 +456,32 @@ class TwowaysAMI
{ false, false, true }
};
- opBoolSSI cb = new opBoolSSI();
- p.begin_opBoolSS(bsi1, bsi2, cb);
+ Callback cb = new Callback();
+ p.opBoolSSAsync(bsi1, bsi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.length == 4);
+ test(result.p3[0].length == 1);
+ test(result.p3[0][0]);
+ test(result.p3[1].length == 1);
+ test(!result.p3[1][0]);
+ test(result.p3[2].length == 2);
+ test(result.p3[2][0]);
+ test(result.p3[2][1]);
+ test(result.p3[3].length == 3);
+ test(!result.p3[3][0]);
+ test(!result.p3[3][1]);
+ test(result.p3[3][2]);
+ test(result.returnValue.length == 3);
+ test(result.returnValue[0].length == 2);
+ test(result.returnValue[0][0]);
+ test(result.returnValue[0][1]);
+ test(result.returnValue[1].length == 1);
+ test(!result.returnValue[1][0]);
+ test(result.returnValue[2].length == 1);
+ test(result.returnValue[2][0]);
+ cb.called();
+ });
cb.check();
}
@@ -2125,8 +502,37 @@ class TwowaysAMI
{496, 1729},
};
- opShortIntLongSSI cb = new opShortIntLongSSI();
- p.begin_opShortIntLongSS(ssi, isi, lsi, cb);
+ Callback cb = new Callback();
+ p.opShortIntLongSSAsync(ssi, isi, lsi).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.returnValue.length == 1);
+ test(result.returnValue[0].length == 2);
+ test(result.returnValue[0][0] == 496);
+ test(result.returnValue[0][1] == 1729);
+ test(result.p4.length == 3);
+ test(result.p4[0].length == 3);
+ test(result.p4[0][0] == 1);
+ test(result.p4[0][1] == 2);
+ test(result.p4[0][2] == 5);
+ test(result.p4[1].length == 1);
+ test(result.p4[1][0] == 13);
+ test(result.p4[2].length == 0);
+ test(result.p5.length == 2);
+ test(result.p5[0].length == 1);
+ test(result.p5[0][0] == 42);
+ test(result.p5[1].length == 2);
+ test(result.p5[1][0] == 24);
+ test(result.p5[1][1] == 98);
+ test(result.p6.length == 2);
+ test(result.p6[0].length == 2);
+ test(result.p6[0][0] == 496);
+ test(result.p6[0][1] == 1729);
+ test(result.p6[1].length == 2);
+ test(result.p6[1][0] == 496);
+ test(result.p6[1][1] == 1729);
+ cb.called();
+ });
cb.check();
}
@@ -2142,8 +548,32 @@ class TwowaysAMI
{ 1.1E10, 1.2E10, 1.3E10 }
};
- opFloatDoubleSSI cb = new opFloatDoubleSSI();
- p.begin_opFloatDoubleSS(fsi, dsi, cb);
+ Callback cb = new Callback();
+ p.opFloatDoubleSSAsync(fsi, dsi).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.length == 3);
+ test(result.p3[0].length == 1);
+ test(result.p3[0][0] == 3.14f);
+ test(result.p3[1].length == 1);
+ test(result.p3[1][0] == 1.11f);
+ test(result.p3[2].length == 0);
+ test(result.p4.length == 1);
+ test(result.p4[0].length == 3);
+ test(result.p4[0][0] == 1.1E10);
+ test(result.p4[0][1] == 1.2E10);
+ test(result.p4[0][2] == 1.3E10);
+ test(result.returnValue.length == 2);
+ test(result.returnValue[0].length == 3);
+ test(result.returnValue[0][0] == 1.1E10);
+ test(result.returnValue[0][1] == 1.2E10);
+ test(result.returnValue[0][2] == 1.3E10);
+ test(result.returnValue[1].length == 3);
+ test(result.returnValue[1][0] == 1.1E10);
+ test(result.returnValue[1][1] == 1.2E10);
+ test(result.returnValue[1][2] == 1.3E10);
+ cb.called();
+ });
cb.check();
}
@@ -2160,8 +590,27 @@ class TwowaysAMI
{ "xyz" }
};
- opStringSSI cb = new opStringSSI();
- p.begin_opStringSS(ssi1, ssi2, cb);
+ Callback cb = new Callback();
+ p.opStringSSAsync(ssi1, ssi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.length == 5);
+ test(result.p3[0].length == 1);
+ test(result.p3[0][0].equals("abc"));
+ test(result.p3[1].length == 2);
+ test(result.p3[1][0].equals("de"));
+ test(result.p3[1][1].equals("fghi"));
+ test(result.p3[2].length == 0);
+ test(result.p3[3].length == 0);
+ test(result.p3[4].length == 1);
+ test(result.p3[4][0].equals("xyz"));
+ test(result.returnValue.length == 3);
+ test(result.returnValue[0].length == 1);
+ test(result.returnValue[0][0].equals("xyz"));
+ test(result.returnValue[1].length == 0);
+ test(result.returnValue[2].length == 0);
+ cb.called();
+ });
cb.check();
}
@@ -2202,8 +651,44 @@ class TwowaysAMI
}
};
- opStringSSSI cb = new opStringSSSI();
- p.begin_opStringSSS(sssi1, sssi2, cb);
+ Callback cb = new Callback();
+ p.opStringSSSAsync(sssi1, sssi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.length == 5);
+ test(result.p3[0].length == 2);
+ test(result.p3[0][0].length == 2);
+ test(result.p3[0][1].length == 1);
+ test(result.p3[1].length == 1);
+ test(result.p3[1][0].length == 1);
+ test(result.p3[2].length == 2);
+ test(result.p3[2][0].length == 2);
+ test(result.p3[2][1].length == 1);
+ test(result.p3[3].length == 1);
+ test(result.p3[3][0].length == 1);
+ test(result.p3[4].length == 0);
+ test(result.p3[0][0][0].equals("abc"));
+ test(result.p3[0][0][1].equals("de"));
+ test(result.p3[0][1][0].equals("xyz"));
+ test(result.p3[1][0][0].equals("hello"));
+ test(result.p3[2][0][0].equals(""));
+ test(result.p3[2][0][1].equals(""));
+ test(result.p3[2][1][0].equals("abcd"));
+ test(result.p3[3][0][0].equals(""));
+
+ test(result.returnValue.length == 3);
+ test(result.returnValue[0].length == 0);
+ test(result.returnValue[1].length == 1);
+ test(result.returnValue[1][0].length == 1);
+ test(result.returnValue[2].length == 2);
+ test(result.returnValue[2][0].length == 2);
+ test(result.returnValue[2][1].length == 1);
+ test(result.returnValue[1][0][0].equals(""));
+ test(result.returnValue[2][0][0].equals(""));
+ test(result.returnValue[2][0][1].equals(""));
+ test(result.returnValue[2][1][0].equals("abcd"));
+ cb.called();
+ });
cb.check();
}
@@ -2216,8 +701,18 @@ class TwowaysAMI
di2.put((byte)11, Boolean.FALSE);
di2.put((byte)101, Boolean.TRUE);
- opByteBoolDI cb = new opByteBoolDI();
- p.begin_opByteBoolD(di1, di2, cb);
+ Callback cb = new Callback();
+ p.opByteBoolDAsync(di1, di2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.equals(di1));
+ test(result.returnValue.size() == 4);
+ test(result.returnValue.get((byte) 10));
+ test(!result.returnValue.get((byte) 11));
+ test(!result.returnValue.get((byte) 100));
+ test(result.returnValue.get((byte) 101));
+ cb.called();
+ });
cb.check();
}
@@ -2230,8 +725,18 @@ class TwowaysAMI
di2.put((short)111, -100);
di2.put((short)1101, 0);
- opShortIntDI cb = new opShortIntDI();
- p.begin_opShortIntD(di1, di2, cb);
+ Callback cb = new Callback();
+ p.opShortIntDAsync(di1, di2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.equals(di1));
+ test(result.returnValue.size() == 4);
+ test(result.returnValue.get((short) 110) == -1);
+ test(result.returnValue.get((short) 111) == -100);
+ test(result.returnValue.get((short) 1100) == 123123);
+ test(result.returnValue.get((short) 1101) == 0);
+ cb.called();
+ });
cb.check();
}
@@ -2244,8 +749,18 @@ class TwowaysAMI
di2.put(999999120L, -100.4f);
di2.put(999999130L, 0.5f);
- opLongFloatDI cb = new opLongFloatDI();
- p.begin_opLongFloatD(di1, di2, cb);
+ Callback cb = new Callback();
+ p.opLongFloatDAsync(di1, di2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.equals(di1));
+ test(result.returnValue.size() == 4);
+ test(result.returnValue.get(999999110L) == -1.1f);
+ test(result.returnValue.get(999999120L) == -100.4f);
+ test(result.returnValue.get(999999111L) == 123123.2f);
+ test(result.returnValue.get(999999130L) == 0.5f);
+ cb.called();
+ });
cb.check();
}
@@ -2258,8 +773,18 @@ class TwowaysAMI
di2.put("FOO", "abc -100.4");
di2.put("BAR", "abc 0.5");
- opStringStringDI cb = new opStringStringDI();
- p.begin_opStringStringD(di1, di2, cb);
+ Callback cb = new Callback();
+ p.opStringStringDAsync(di1, di2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.equals(di1));
+ test(result.returnValue.size() == 4);
+ test(result.returnValue.get("foo").equals("abc -1.1"));
+ test(result.returnValue.get("FOO").equals("abc -100.4"));
+ test(result.returnValue.get("bar").equals("abc 123123.2"));
+ test(result.returnValue.get("BAR").equals("abc 0.5"));
+ cb.called();
+ });
cb.check();
}
@@ -2272,8 +797,18 @@ class TwowaysAMI
di2.put("qwerty", MyEnum.enum3);
di2.put("Hello!!", MyEnum.enum2);
- opStringMyEnumDI cb = new opStringMyEnumDI();
- p.begin_opStringMyEnumD(di1, di2, cb);
+ Callback cb = new Callback();
+ p.opStringMyEnumDAsync(di1, di2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.equals(di1));
+ test(result.returnValue.size() == 4);
+ test(result.returnValue.get("abc") == MyEnum.enum1);
+ test(result.returnValue.get("qwerty") == MyEnum.enum3);
+ test(result.returnValue.get("") == MyEnum.enum2);
+ test(result.returnValue.get("Hello!!") == MyEnum.enum2);
+ cb.called();
+ });
cb.check();
}
@@ -2284,8 +819,17 @@ class TwowaysAMI
di2.put(MyEnum.enum2, "Hello!!");
di2.put(MyEnum.enum3, "qwerty");
- opMyEnumStringDI cb = new opMyEnumStringDI();
- p.begin_opMyEnumStringD(di1, di2, cb);
+ Callback cb = new Callback();
+ p.opMyEnumStringDAsync(di1, di2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.equals(di1));
+ test(result.returnValue.size() == 3);
+ test(result.returnValue.get(MyEnum.enum1).equals("abc"));
+ test(result.returnValue.get(MyEnum.enum2).equals("Hello!!"));
+ test(result.returnValue.get(MyEnum.enum3).equals("qwerty"));
+ cb.called();
+ });
cb.check();
}
@@ -2302,8 +846,18 @@ class TwowaysAMI
di2.put(s22, MyEnum.enum3);
di2.put(s23, MyEnum.enum2);
- opMyStructMyEnumDI cb = new opMyStructMyEnumDI();
- p.begin_opMyStructMyEnumD(di1, di2, cb);
+ Callback cb = new Callback();
+ p.opMyStructMyEnumDAsync(di1, di2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.equals(di1));
+ test(result.returnValue.size() == 4);
+ test(result.returnValue.get(s11) == MyEnum.enum1);
+ test(result.returnValue.get(s12) == MyEnum.enum2);
+ test(result.returnValue.get(s22) == MyEnum.enum3);
+ test(result.returnValue.get(s23) == MyEnum.enum2);
+ cb.called();
+ });
cb.check();
}
@@ -2326,8 +880,32 @@ class TwowaysAMI
dsi1.add(di2);
dsi2.add(di3);
- opByteBoolDS cb = new opByteBoolDS();
- p.begin_opByteBoolDS(dsi1, dsi2, cb);
+ Callback cb = new Callback();
+ p.opByteBoolDSAsync(dsi1, dsi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.returnValue.size() == 2);
+ test(result.returnValue.get(0).size() == 3);
+ test(result.returnValue.get(0).get((byte) 10));
+ test(!result.returnValue.get(0).get((byte) 11));
+ test(result.returnValue.get(0).get((byte) 101));
+ test(result.returnValue.get(1).size() == 2);
+ test(result.returnValue.get(1).get((byte) 10));
+ test(!result.returnValue.get(1).get((byte) 100));
+
+ test(result.p3.size() == 3);
+ test(result.p3.get(0).size() == 2);
+ test(!result.p3.get(0).get((byte) 100));
+ test(!result.p3.get(0).get((byte) 101));
+ test(result.p3.get(1).size() == 2);
+ test(result.p3.get(1).get((byte) 10));
+ test(!result.p3.get(1).get((byte) 100));
+ test(result.p3.get(2).size() == 3);
+ test(result.p3.get(2).get((byte) 10));
+ test(!result.p3.get(2).get((byte) 11));
+ test(result.p3.get(2).get((byte) 101));
+ cb.called();
+ });
cb.check();
}
@@ -2349,8 +927,31 @@ class TwowaysAMI
dsi1.add(di2);
dsi2.add(di3);
- opShortIntDS cb = new opShortIntDS();
- p.begin_opShortIntDS(dsi1, dsi2, cb);
+ Callback cb = new Callback();
+ p.opShortIntDSAsync(dsi1, dsi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.returnValue.size() == 2);
+ test(result.returnValue.get(0).size() == 3);
+ test(result.returnValue.get(0).get((short) 110) == -1);
+ test(result.returnValue.get(0).get((short) 111) == -100);
+ test(result.returnValue.get(0).get((short) 1101) == 0);
+ test(result.returnValue.get(1).size() == 2);
+ test(result.returnValue.get(1).get((short) 110) == -1);
+ test(result.returnValue.get(1).get((short) 1100) == 123123);
+
+ test(result.p3.size() == 3);
+ test(result.p3.get(0).size() == 1);
+ test(result.p3.get(0).get((short) 100) == -1001);
+ test(result.p3.get(1).size() == 2);
+ test(result.p3.get(1).get((short) 110) == -1);
+ test(result.p3.get(1).get((short) 1100) == 123123);
+ test(result.p3.get(2).size() == 3);
+ test(result.p3.get(2).get((short) 110) == -1);
+ test(result.p3.get(2).get((short) 111) == -100);
+ test(result.p3.get(2).get((short) 1101) == 0);
+ cb.called();
+ });
cb.check();
}
@@ -2372,8 +973,31 @@ class TwowaysAMI
dsi1.add(di2);
dsi2.add(di3);
- opLongFloatDS cb = new opLongFloatDS();
- p.begin_opLongFloatDS(dsi1, dsi2, cb);
+ Callback cb = new Callback();
+ p.opLongFloatDSAsync(dsi1, dsi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.returnValue.size() == 2);
+ test(result.returnValue.get(0).size() == 3);
+ test(result.returnValue.get(0).get(999999110L) == -1.1f);
+ test(result.returnValue.get(0).get(999999120L) == -100.4f);
+ test(result.returnValue.get(0).get(999999130L) == 0.5f);
+ test(result.returnValue.get(1).size() == 2);
+ test(result.returnValue.get(1).get(999999110L) == -1.1f);
+ test(result.returnValue.get(1).get(999999111L) == 123123.2f);
+
+ test(result.p3.size() == 3);
+ test(result.p3.get(0).size() == 1);
+ test(result.p3.get(0).get(999999140L) == 3.14f);
+ test(result.p3.get(1).size() == 2);
+ test(result.p3.get(1).get(999999110L) == -1.1f);
+ test(result.p3.get(1).get(999999111L) == 123123.2f);
+ test(result.p3.get(2).size() == 3);
+ test(result.p3.get(2).get(999999110L) == -1.1f);
+ test(result.p3.get(2).get(999999120L) == -100.4f);
+ test(result.p3.get(2).get(999999130L) == 0.5f);
+ cb.called();
+ });
cb.check();
}
@@ -2395,8 +1019,31 @@ class TwowaysAMI
dsi1.add(di2);
dsi2.add(di3);
- opStringStringDS cb = new opStringStringDS();
- p.begin_opStringStringDS(dsi1, dsi2, cb);
+ Callback cb = new Callback();
+ p.opStringStringDSAsync(dsi1, dsi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.returnValue.size() == 2);
+ test(result.returnValue.get(0).size() == 3);
+ test(result.returnValue.get(0).get("foo").equals("abc -1.1"));
+ test(result.returnValue.get(0).get("FOO").equals("abc -100.4"));
+ test(result.returnValue.get(0).get("BAR").equals("abc 0.5"));
+ test(result.returnValue.get(1).size() == 2);
+ test(result.returnValue.get(1).get("foo").equals("abc -1.1"));
+ test(result.returnValue.get(1).get("bar").equals("abc 123123.2"));
+
+ test(result.p3.size() == 3);
+ test(result.p3.get(0).size() == 1);
+ test(result.p3.get(0).get("f00").equals("ABC -3.14"));
+ test(result.p3.get(1).size() == 2);
+ test(result.p3.get(1).get("foo").equals("abc -1.1"));
+ test(result.p3.get(1).get("bar").equals("abc 123123.2"));
+ test(result.p3.get(2).size() == 3);
+ test(result.p3.get(2).get("foo").equals("abc -1.1"));
+ test(result.p3.get(2).get("FOO").equals("abc -100.4"));
+ test(result.p3.get(2).get("BAR").equals("abc 0.5"));
+ cb.called();
+ });
cb.check();
}
@@ -2418,8 +1065,31 @@ class TwowaysAMI
dsi1.add(di2);
dsi2.add(di3);
- opStringMyEnumDS cb = new opStringMyEnumDS();
- p.begin_opStringMyEnumDS(dsi1, dsi2, cb);
+ Callback cb = new Callback();
+ p.opStringMyEnumDSAsync(dsi1, dsi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.returnValue.size() == 2);
+ test(result.returnValue.get(0).size() == 3);
+ test(result.returnValue.get(0).get("abc") == MyEnum.enum1);
+ test(result.returnValue.get(0).get("qwerty") == MyEnum.enum3);
+ test(result.returnValue.get(0).get("Hello!!") == MyEnum.enum2);
+ test(result.returnValue.get(1).size() == 2);
+ test(result.returnValue.get(1).get("abc") == MyEnum.enum1);
+ test(result.returnValue.get(1).get("") == MyEnum.enum2);
+
+ test(result.p3.size() == 3);
+ test(result.p3.get(0).size() == 1);
+ test(result.p3.get(0).get("Goodbye") == MyEnum.enum1);
+ test(result.p3.get(1).size() == 2);
+ test(result.p3.get(1).get("abc") == MyEnum.enum1);
+ test(result.p3.get(1).get("") == MyEnum.enum2);
+ test(result.p3.get(2).size() == 3);
+ test(result.p3.get(2).get("abc") == MyEnum.enum1);
+ test(result.p3.get(2).get("qwerty") == MyEnum.enum3);
+ test(result.p3.get(2).get("Hello!!") == MyEnum.enum2);
+ cb.called();
+ });
cb.check();
}
@@ -2439,8 +1109,27 @@ class TwowaysAMI
dsi1.add(di2);
dsi2.add(di3);
- opMyEnumStringDS cb = new opMyEnumStringDS();
- p.begin_opMyEnumStringDS(dsi1, dsi2, cb);
+ Callback cb = new Callback();
+ p.opMyEnumStringDSAsync(dsi1, dsi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.returnValue.size() == 2);
+ test(result.returnValue.get(0).size() == 2);
+ test(result.returnValue.get(0).get(MyEnum.enum2).equals("Hello!!"));
+ test(result.returnValue.get(0).get(MyEnum.enum3).equals("qwerty"));
+ test(result.returnValue.get(1).size() == 1);
+ test(result.returnValue.get(1).get(MyEnum.enum1).equals("abc"));
+
+ test(result.p3.size() == 3);
+ test(result.p3.get(0).size() == 1);
+ test(result.p3.get(0).get(MyEnum.enum1).equals("Goodbye"));
+ test(result.p3.get(1).size() == 1);
+ test(result.p3.get(1).get(MyEnum.enum1).equals("abc"));
+ test(result.p3.get(2).size() == 2);
+ test(result.p3.get(2).get(MyEnum.enum2).equals("Hello!!"));
+ test(result.p3.get(2).get(MyEnum.enum3).equals("qwerty"));
+ cb.called();
+ });
cb.check();
}
@@ -2468,8 +1157,31 @@ class TwowaysAMI
dsi1.add(di2);
dsi2.add(di3);
- opMyStructMyEnumDS cb = new opMyStructMyEnumDS();
- p.begin_opMyStructMyEnumDS(dsi1, dsi2, cb);
+ Callback cb = new Callback();
+ p.opMyStructMyEnumDSAsync(dsi1, dsi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.returnValue.size() == 2);
+ test(result.returnValue.get(0).size() == 3);
+ test(result.returnValue.get(0).get(s11) == MyEnum.enum1);
+ test(result.returnValue.get(0).get(s22) == MyEnum.enum3);
+ test(result.returnValue.get(0).get(s23) == MyEnum.enum2);
+ test(result.returnValue.get(1).size() == 2);
+ test(result.returnValue.get(1).get(s11) == MyEnum.enum1);
+ test(result.returnValue.get(1).get(s12) == MyEnum.enum2);
+
+ test(result.p3.size() == 3);
+ test(result.p3.get(0).size() == 1);
+ test(result.p3.get(0).get(s23) == MyEnum.enum3);
+ test(result.p3.get(1).size() == 2);
+ test(result.p3.get(1).get(s11) == MyEnum.enum1);
+ test(result.p3.get(1).get(s12) == MyEnum.enum2);
+ test(result.p3.get(2).size() == 3);
+ test(result.p3.get(2).get(s11) == MyEnum.enum1);
+ test(result.p3.get(2).get(s22) == MyEnum.enum3);
+ test(result.p3.get(2).get(s23) == MyEnum.enum2);
+ cb.called();
+ });
cb.check();
}
@@ -2485,8 +1197,25 @@ class TwowaysAMI
sdi1.put((byte) 0x22, si2);
sdi2.put((byte) 0xf1, si3);
- opByteByteSD cb = new opByteByteSD();
- p.begin_opByteByteSD(sdi1, sdi2, cb);
+ Callback cb = new Callback();
+ p.opByteByteSDAsync(sdi1, sdi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.size() == 1);
+ test(result.p3.get((byte) 0xf1).length == 2);
+ test(result.p3.get((byte) 0xf1)[0] == (byte) 0xf2);
+ test(result.p3.get((byte) 0xf1)[1] == (byte) 0xf3);
+ test(result.returnValue.size() == 3);
+ test(result.returnValue.get((byte) 0x01).length == 2);
+ test(result.returnValue.get((byte) 0x01)[0] == (byte) 0x01);
+ test(result.returnValue.get((byte) 0x01)[1] == (byte) 0x11);
+ test(result.returnValue.get((byte) 0x22).length == 1);
+ test(result.returnValue.get((byte) 0x22)[0] == (byte) 0x12);
+ test(result.returnValue.get((byte) 0xf1).length == 2);
+ test(result.returnValue.get((byte) 0xf1)[0] == (byte) 0xf2);
+ test(result.returnValue.get((byte) 0xf1)[1] == (byte) 0xf3);
+ cb.called();
+ });
cb.check();
}
@@ -2501,8 +1230,24 @@ class TwowaysAMI
sdi1.put(true, si2);
sdi2.put(false, si1);
- opBoolBoolSD cb = new opBoolBoolSD();
- p.begin_opBoolBoolSD(sdi1, sdi2, cb);
+ Callback cb = new Callback();
+ p.opBoolBoolSDAsync(sdi1, sdi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.size() == 1);
+ test(result.p3.get(false).length == 2);
+ test(result.p3.get(false)[0]);
+ test(!result.p3.get(false)[1]);
+ test(result.returnValue.size() == 2);
+ test(result.returnValue.get(false).length == 2);
+ test(result.returnValue.get(false)[0]);
+ test(!result.returnValue.get(false)[1]);
+ test(result.returnValue.get(true).length == 3);
+ test(!result.returnValue.get(true)[0]);
+ test(result.returnValue.get(true)[1]);
+ test(result.returnValue.get(true)[2]);
+ cb.called();
+ });
cb.check();
}
@@ -2518,8 +1263,27 @@ class TwowaysAMI
sdi1.put((short) 2, si2);
sdi2.put((short) 4, si3);
- opShortShortSD cb = new opShortShortSD();
- p.begin_opShortShortSD(sdi1, sdi2, cb);
+ Callback cb = new Callback();
+ p.opShortShortSDAsync(sdi1, sdi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.size() == 1);
+ test(result.p3.get((short) 4).length == 2);
+ test(result.p3.get((short) 4)[0] == 6);
+ test(result.p3.get((short) 4)[1] == 7);
+ test(result.returnValue.size() == 3);
+ test(result.returnValue.get((short) 1).length == 3);
+ test(result.returnValue.get((short) 1)[0] == 1);
+ test(result.returnValue.get((short) 1)[1] == 2);
+ test(result.returnValue.get((short) 1)[2] == 3);
+ test(result.returnValue.get((short) 2).length == 2);
+ test(result.returnValue.get((short) 2)[0] == 4);
+ test(result.returnValue.get((short) 2)[1] == 5);
+ test(result.returnValue.get((short) 4).length == 2);
+ test(result.returnValue.get((short) 4)[0] == 6);
+ test(result.returnValue.get((short) 4)[1] == 7);
+ cb.called();
+ });
cb.check();
}
@@ -2535,8 +1299,27 @@ class TwowaysAMI
sdi1.put(200, si2);
sdi2.put(400, si3);
- opIntIntSD cb = new opIntIntSD();
- p.begin_opIntIntSD(sdi1, sdi2, cb);
+ Callback cb = new Callback();
+ p.opIntIntSDAsync(sdi1, sdi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.size() == 1);
+ test(result.p3.get(400).length == 2);
+ test(result.p3.get(400)[0] == 600);
+ test(result.p3.get(400)[1] == 700);
+ test(result.returnValue.size() == 3);
+ test(result.returnValue.get(100).length == 3);
+ test(result.returnValue.get(100)[0] == 100);
+ test(result.returnValue.get(100)[1] == 200);
+ test(result.returnValue.get(100)[2] == 300);
+ test(result.returnValue.get(200).length == 2);
+ test(result.returnValue.get(200)[0] == 400);
+ test(result.returnValue.get(200)[1] == 500);
+ test(result.returnValue.get(400).length == 2);
+ test(result.returnValue.get(400)[0] == 600);
+ test(result.returnValue.get(400)[1] == 700);
+ cb.called();
+ });
cb.check();
}
@@ -2552,8 +1335,27 @@ class TwowaysAMI
sdi1.put(999999991L, si2);
sdi2.put(999999992L, si3);
- opLongLongSD cb = new opLongLongSD();
- p.begin_opLongLongSD(sdi1, sdi2, cb);
+ Callback cb = new Callback();
+ p.opLongLongSDAsync(sdi1, sdi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.size() == 1);
+ test(result.p3.get(999999992L).length == 2);
+ test(result.p3.get(999999992L)[0] == 999999110L);
+ test(result.p3.get(999999992L)[1] == 999999120);
+ test(result.returnValue.size() == 3);
+ test(result.returnValue.get(999999990L).length == 3);
+ test(result.returnValue.get(999999990L)[0] == 999999110);
+ test(result.returnValue.get(999999990L)[1] == 999999111);
+ test(result.returnValue.get(999999990L)[2] == 999999110);
+ test(result.returnValue.get(999999991L).length == 2);
+ test(result.returnValue.get(999999991L)[0] == 999999120);
+ test(result.returnValue.get(999999991L)[1] == 999999130);
+ test(result.returnValue.get(999999992L).length == 2);
+ test(result.returnValue.get(999999992L)[0] == 999999110);
+ test(result.returnValue.get(999999992L)[1] == 999999120);
+ cb.called();
+ });
cb.check();
}
@@ -2569,8 +1371,27 @@ class TwowaysAMI
sdi1.put("ABC", si2);
sdi2.put("aBc", si3);
- opStringFloatSD cb = new opStringFloatSD();
- p.begin_opStringFloatSD(sdi1, sdi2, cb);
+ Callback cb = new Callback();
+ p.opStringFloatSDAsync(sdi1, sdi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.size() == 1);
+ test(result.p3.get("aBc").length == 2);
+ test(result.p3.get("aBc")[0] == -3.14f);
+ test(result.p3.get("aBc")[1] == 3.14f);
+ test(result.returnValue.size() == 3);
+ test(result.returnValue.get("abc").length == 3);
+ test(result.returnValue.get("abc")[0] == -1.1f);
+ test(result.returnValue.get("abc")[1] == 123123.2f);
+ test(result.returnValue.get("abc")[2] == 100.0f);
+ test(result.returnValue.get("ABC").length == 2);
+ test(result.returnValue.get("ABC")[0] == 42.24f);
+ test(result.returnValue.get("ABC")[1] == -1.61f);
+ test(result.returnValue.get("aBc").length == 2);
+ test(result.returnValue.get("aBc")[0] == -3.14f);
+ test(result.returnValue.get("aBc")[1] == 3.14f);
+ cb.called();
+ });
cb.check();
}
@@ -2586,8 +1407,27 @@ class TwowaysAMI
sdi1.put("Goodbye", si2);
sdi2.put("", si3);
- opStringDoubleSD cb = new opStringDoubleSD();
- p.begin_opStringDoubleSD(sdi1, sdi2, cb);
+ Callback cb = new Callback();
+ p.opStringDoubleSDAsync(sdi1, sdi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.size() == 1);
+ test(result.p3.get("").length == 2);
+ test(result.p3.get("")[0] == 1.6E10);
+ test(result.p3.get("")[1] == 1.7E10);
+ test(result.returnValue.size()== 3);
+ test(result.returnValue.get("Hello!!").length == 3);
+ test(result.returnValue.get("Hello!!")[0] == 1.1E10);
+ test(result.returnValue.get("Hello!!")[1] == 1.2E10);
+ test(result.returnValue.get("Hello!!")[2] == 1.3E10);
+ test(result.returnValue.get("Goodbye").length == 2);
+ test(result.returnValue.get("Goodbye")[0] == 1.4E10);
+ test(result.returnValue.get("Goodbye")[1] == 1.5E10);
+ test(result.returnValue.get("").length== 2);
+ test(result.returnValue.get("")[0] == 1.6E10);
+ test(result.returnValue.get("")[1] == 1.7E10);
+ cb.called();
+ });
cb.check();
}
@@ -2603,8 +1443,27 @@ class TwowaysAMI
sdi1.put("def", si2);
sdi2.put("ghi", si3);
- opStringStringSD cb = new opStringStringSD();
- p.begin_opStringStringSD(sdi1, sdi2, cb);
+ Callback cb = new Callback();
+ p.opStringStringSDAsync(sdi1, sdi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.size() == 1);
+ test(result.p3.get("ghi").length== 2);
+ test(result.p3.get("ghi")[0].equals("and"));
+ test(result.p3.get("ghi")[1].equals("xor"));
+ test(result.returnValue.size()== 3);
+ test(result.returnValue.get("abc").length == 3);
+ test(result.returnValue.get("abc")[0].equals("abc"));
+ test(result.returnValue.get("abc")[1].equals("de"));
+ test(result.returnValue.get("abc")[2].equals("fghi"));
+ test(result.returnValue.get("def").length == 2);
+ test(result.returnValue.get("def")[0].equals("xyz"));
+ test(result.returnValue.get("def")[1].equals("or"));
+ test(result.returnValue.get("ghi").length == 2);
+ test(result.returnValue.get("ghi")[0].equals("and"));
+ test(result.returnValue.get("ghi")[1].equals("xor"));
+ cb.called();
+ });
cb.check();
}
@@ -2620,8 +1479,27 @@ class TwowaysAMI
sdi1.put(MyEnum.enum2, si2);
sdi2.put(MyEnum.enum1, si3);
- opMyEnumMyEnumSD cb = new opMyEnumMyEnumSD();
- p.begin_opMyEnumMyEnumSD(sdi1, sdi2, cb);
+ Callback cb = new Callback();
+ p.opMyEnumMyEnumSDAsync(sdi1, sdi2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p3.size() == 1);
+ test(result.p3.get(MyEnum.enum1).length == 2);
+ test(result.p3.get(MyEnum.enum1)[0] == MyEnum.enum3);
+ test(result.p3.get(MyEnum.enum1)[1] == MyEnum.enum3);
+ test(result.returnValue.size()== 3);
+ test(result.returnValue.get(MyEnum.enum3).length == 3);
+ test(result.returnValue.get(MyEnum.enum3)[0] == MyEnum.enum1);
+ test(result.returnValue.get(MyEnum.enum3)[1] == MyEnum.enum1);
+ test(result.returnValue.get(MyEnum.enum3)[2] == MyEnum.enum2);
+ test(result.returnValue.get(MyEnum.enum2).length == 2);
+ test(result.returnValue.get(MyEnum.enum2)[0] == MyEnum.enum1);
+ test(result.returnValue.get(MyEnum.enum2)[1] == MyEnum.enum2);
+ test(result.returnValue.get(MyEnum.enum1).length == 2);
+ test(result.returnValue.get(MyEnum.enum1)[0] == MyEnum.enum3);
+ test(result.returnValue.get(MyEnum.enum1)[1] == MyEnum.enum3);
+ cb.called();
+ });
cb.check();
}
@@ -2635,8 +1513,17 @@ class TwowaysAMI
{
s[i] = i;
}
- opIntSI cb = new opIntSI(l);
- p.begin_opIntS(s, cb);
+ Callback cb = new Callback();
+ p.opIntSAsync(s).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.length == l);
+ for(int j = 0; j < result.length; ++j)
+ {
+ test(result[j] == -j);
+ }
+ cb.called();
+ });
cb.check();
}
}
@@ -2648,26 +1535,22 @@ class TwowaysAMI
ctx.put("three", "THREE");
{
test(p.ice_getContext().isEmpty());
- Ice.AsyncResult r = p.begin_opContext();
- java.util.Map<String, String> c = p.end_opContext(r);
+ java.util.Map<String, String> c = p.opContextAsync().join();
test(!c.equals(ctx));
}
{
test(p.ice_getContext().isEmpty());
- Ice.AsyncResult r = p.begin_opContext(ctx);
- java.util.Map<String, String> c = p.end_opContext(r);
+ java.util.Map<String, String> c = p.opContextAsync(ctx).join();
test(c.equals(ctx));
}
- MyClassPrx p2 = MyClassPrxHelper.checkedCast(p.ice_context(ctx));
+ MyClassPrx p2 = MyClassPrx.checkedCast(p.ice_context(ctx));
test(p2.ice_getContext().equals(ctx));
{
- Ice.AsyncResult r = p2.begin_opContext();
- java.util.Map<String, String> c = p2.end_opContext(r);
+ java.util.Map<String, String> c = p2.opContextAsync().join();
test(c.equals(ctx));
}
{
- Ice.AsyncResult r = p2.begin_opContext(ctx);
- java.util.Map<String, String> c = p2.end_opContext(r);
+ java.util.Map<String, String> c = p2.opContextAsync(ctx).join();
test(c.equals(ctx));
}
}
@@ -2681,24 +1564,23 @@ class TwowaysAMI
String[] impls = {"Shared", "PerThread"};
for(int i = 0; i < 2; i++)
{
- Ice.InitializationData initData = app.createInitializationData();
+ com.zeroc.Ice.InitializationData initData = app.createInitializationData();
initData.properties = communicator.getProperties()._clone();
initData.properties.setProperty("Ice.ImplicitContext", impls[i]);
- Ice.Communicator ic = app.initialize(initData);
+ com.zeroc.Ice.Communicator ic = app.initialize(initData);
java.util.Map<String, String> ctx = new java.util.HashMap<>();
ctx.put("one", "ONE");
ctx.put("two", "TWO");
ctx.put("three", "THREE");
- MyClassPrx p3 = MyClassPrxHelper.uncheckedCast(ic.stringToProxy("test:default -p 12010"));
+ MyClassPrx p3 = MyClassPrx.uncheckedCast(ic.stringToProxy("test:default -p 12010"));
ic.getImplicitContext().setContext(ctx);
test(ic.getImplicitContext().getContext().equals(ctx));
{
- Ice.AsyncResult r = p3.begin_opContext();
- java.util.Map<String, String> c = p3.end_opContext(r);
+ java.util.Map<String, String> c = p3.opContextAsync().join();
test(c.equals(ctx));
}
@@ -2706,8 +1588,7 @@ class TwowaysAMI
ctx = ic.getImplicitContext().getContext();
{
- Ice.AsyncResult r = p3.begin_opContext();
- java.util.Map<String, String> c = p3.end_opContext(r);
+ java.util.Map<String, String> c = p3.opContextAsync().join();
test(c.equals(ctx));
}
@@ -2719,19 +1600,17 @@ class TwowaysAMI
combined.putAll(prxContext);
test(combined.get("one").equals("UN"));
- p3 = MyClassPrxHelper.uncheckedCast(p3.ice_context(prxContext));
+ p3 = p3.ice_context(prxContext);
ic.getImplicitContext().setContext(null);
{
- Ice.AsyncResult r = p3.begin_opContext();
- java.util.Map<String, String> c = p3.end_opContext(r);
+ java.util.Map<String, String> c = p3.opContextAsync().join();
test(c.equals(prxContext));
}
ic.getImplicitContext().setContext(ctx);
{
- Ice.AsyncResult r = p3.begin_opContext();
- java.util.Map<String, String> c = p3.end_opContext(r);
+ java.util.Map<String, String> c = p3.opContextAsync().join();
test(c.equals(combined));
}
@@ -2746,191 +1625,144 @@ class TwowaysAMI
{
ds[i] = d;
}
- opDoubleMarshalingI cb = new opDoubleMarshalingI();
- p.begin_opDoubleMarshaling(d, ds, cb);
+ Callback cb = new Callback();
+ p.opDoubleMarshalingAsync(d, ds).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ cb.called();
+ });
cb.check();
}
{
- opIdempotentI cb = new opIdempotentI();
- p.begin_opIdempotent(cb);
+ Callback cb = new Callback();
+ p.opIdempotentAsync().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ cb.called();
+ });
cb.check();
}
{
- opNonmutatingI cb = new opNonmutatingI();
- p.begin_opNonmutating(cb);
+ Callback cb = new Callback();
+ p.opNonmutatingAsync().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ cb.called();
+ });
cb.check();
}
{
- MyDerivedClassPrx derived = MyDerivedClassPrxHelper.checkedCast(p);
+ MyDerivedClassPrx derived = MyDerivedClassPrx.checkedCast(p);
test(derived != null);
- opDerivedI cb = new opDerivedI();
- derived.begin_opDerived(cb);
+ Callback cb = new Callback();
+ derived.opDerivedAsync().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ cb.called();
+ });
cb.check();
}
-
+
{
- final GenericCallback<Byte> cb = new GenericCallback<Byte>((byte)0);
- p.begin_opByte1((byte)0xFF,
- new test.Ice.operations.Test.Callback_MyClass_opByte1()
- {
- public void response(byte value)
- {
- cb.response(value);
- }
-
- public void exception(Ice.LocalException ex)
- {
- cb.exception(ex);
- }
- });
- test(cb.succeeded() && cb.value() == (byte)0xFF);
+ Callback cb = new Callback();
+ p.opByte1Async((byte)0xFF).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result == (byte)0xFF);
+ cb.called();
+ });
+ cb.check();
}
-
+
{
- final GenericCallback<Short> cb = new GenericCallback<Short>((short)0);
- p.begin_opShort1((short)0x7FFF,
- new test.Ice.operations.Test.Callback_MyClass_opShort1()
- {
- public void response(short value)
- {
- cb.response(value);
- }
-
- public void exception(Ice.LocalException ex)
- {
- cb.exception(ex);
- }
- });
- test(cb.succeeded() && cb.value() == 0x7FFF);
+ Callback cb = new Callback();
+ p.opShort1Async((short)0x7FFF).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result == 0x7FFF);
+ cb.called();
+ });
+ cb.check();
}
-
+
{
- final GenericCallback<Integer> cb = new GenericCallback<Integer>(0);
- p.begin_opInt1(0x7FFFFFFF,
- new test.Ice.operations.Test.Callback_MyClass_opInt1()
- {
- public void response(int value)
- {
- cb.response(value);
- }
-
- public void exception(Ice.LocalException ex)
- {
- cb.exception(ex);
- }
- });
- test(cb.succeeded() && cb.value() == 0x7FFFFFFF);
+ Callback cb = new Callback();
+ p.opInt1Async(0x7FFFFFFF).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result == 0x7FFFFFFF);
+ cb.called();
+ });
+ cb.check();
}
-
+
{
- final GenericCallback<Long> cb = new GenericCallback<Long>((long)0);
- p.begin_opLong1(0x7FFFFFFF,
- new test.Ice.operations.Test.Callback_MyClass_opLong1()
- {
- public void response(long value)
- {
- cb.response(value);
- }
-
- public void exception(Ice.LocalException ex)
- {
- cb.exception(ex);
- }
- });
- test(cb.succeeded() && cb.value() == 0x7FFFFFFF);
+ Callback cb = new Callback();
+ p.opLong1Async(0x7FFFFFFF).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result == 0x7FFFFFFF);
+ cb.called();
+ });
+ cb.check();
}
-
+
{
- final GenericCallback<Float> cb = new GenericCallback<Float>(0.0f);
- p.begin_opFloat1(1.0f,
- new test.Ice.operations.Test.Callback_MyClass_opFloat1()
- {
- public void response(float value)
- {
- cb.response(value);
- }
-
- public void exception(Ice.LocalException ex)
- {
- cb.exception(ex);
- }
- });
- test(cb.succeeded() && cb.value() == 1.0f);
+ Callback cb = new Callback();
+ p.opFloat1Async(1.0f).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result == 1.0f);
+ cb.called();
+ });
+ cb.check();
}
-
+
{
- final GenericCallback<Double> cb = new GenericCallback<Double>(0.0);
- p.begin_opDouble1(1.0,
- new test.Ice.operations.Test.Callback_MyClass_opDouble1()
- {
- public void response(double value)
- {
- cb.response(value);
- }
-
- public void exception(Ice.LocalException ex)
- {
- cb.exception(ex);
- }
- });
- test(cb.succeeded() && cb.value() == 1.0);
+ Callback cb = new Callback();
+ p.opDouble1Async(1.0).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result == 1.0);
+ cb.called();
+ });
+ cb.check();
}
-
+
{
- final GenericCallback<String> cb = new GenericCallback<String>("");
- p.begin_opString1("opString1",
- new test.Ice.operations.Test.Callback_MyClass_opString1()
- {
- public void response(String value)
- {
- cb.response(value);
- }
-
- public void exception(Ice.LocalException ex)
- {
- cb.exception(ex);
- }
- });
- test(cb.succeeded() && cb.value().equals("opString1"));
+ Callback cb = new Callback();
+ p.opString1Async("opString1").whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.equals("opString1"));
+ cb.called();
+ });
+ cb.check();
}
-
+
{
- final GenericCallback<String[]> cb = new GenericCallback<String[]>(null);
- p.begin_opStringS1(null,
- new test.Ice.operations.Test.Callback_MyClass_opStringS1()
- {
- public void response(String[] value)
- {
- cb.response(value);
- }
-
- public void exception(Ice.LocalException ex)
- {
- cb.exception(ex);
- }
- });
- test(cb.succeeded() && cb.value().length == 0);
+ Callback cb = new Callback();
+ p.opStringS1Async(null).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.length == 0);
+ cb.called();
+ });
+ cb.check();
}
-
+
{
- final GenericCallback<Map<Byte, Boolean>> cb = new GenericCallback<Map<Byte, Boolean>>(null);
- p.begin_opByteBoolD1(null,
- new test.Ice.operations.Test.Callback_MyClass_opByteBoolD1()
- {
- public void response(Map<Byte, Boolean> value)
- {
- cb.response(value);
- }
-
- public void exception(Ice.LocalException ex)
- {
- cb.exception(ex);
- }
- });
- test(cb.succeeded() && cb.value().size() == 0);
+ Callback cb = new Callback();
+ p.opByteBoolD1Async(null).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.size() == 0);
+ cb.called();
+ });
+ cb.check();
}
}
}
diff --git a/java/test/src/main/java/test/Ice/operations/run.py b/java/test/src/main/java/test/Ice/operations/run.py
index 83401d7a990..3b3b470f074 100755
--- a/java/test/src/main/java/test/Ice/operations/run.py
+++ b/java/test/src/main/java/test/Ice/operations/run.py
@@ -27,13 +27,5 @@ TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "
additionalClientOptions = "--Ice.Warn.AMICallback=0",
server="test.Ice.operations.AMDServer")
-TestUtil.queueClientServerTest(configName = "tie", localOnly = True, message = "Running test with TIE server.",
- additionalClientOptions = "--Ice.Warn.AMICallback=0",
- server="test.Ice.operations.TieServer")
-
-TestUtil.queueClientServerTest(configName = "amdTie", localOnly = True, message = "Running test with AMD TIE server.",
- additionalClientOptions = "--Ice.Warn.AMICallback=0",
- server="test.Ice.operations.AMDTieServer")
-
TestUtil.queueCollocatedTest()
TestUtil.runQueuedTests()
diff --git a/java/test/src/main/java/test/Ice/optional/AMDInitialI.java b/java/test/src/main/java/test/Ice/optional/AMDInitialI.java
index 6dcab9e4b5f..9853386ba85 100644
--- a/java/test/src/main/java/test/Ice/optional/AMDInitialI.java
+++ b/java/test/src/main/java/test/Ice/optional/AMDInitialI.java
@@ -9,67 +9,74 @@
package test.Ice.optional;
+import java.util.concurrent.CompletionStage;
+import java.util.concurrent.CompletableFuture;
+import java.util.Optional;
+import java.util.OptionalDouble;
+import java.util.OptionalInt;
+import java.util.OptionalLong;
+
+import com.zeroc.Ice.Current;
+
import test.Ice.optional.AMD.Test.*;
-public final class AMDInitialI extends Initial
+public final class AMDInitialI implements _InitialDisp
{
@Override
- public void
- shutdown_async(AMD_Initial_shutdown cb, Ice.Current current)
+ public CompletionStage<Void> shutdownAsync(Current current)
{
current.adapter.getCommunicator().shutdown();
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- pingPong_async(AMD_Initial_pingPong cb, Ice.Object obj, Ice.Current current)
+ public CompletionStage<com.zeroc.Ice.Value> pingPongAsync(com.zeroc.Ice.Value v, Current current)
{
- cb.ice_response(obj);
+ return CompletableFuture.completedFuture(v);
}
@Override
- public void
- opOptionalException_async(AMD_Initial_opOptionalException cb, Ice.IntOptional a, Ice.Optional<String> b,
- Ice.Optional<OneOptional> o, Ice.Current current)
+ public CompletionStage<Void> opOptionalExceptionAsync(OptionalInt a, Optional<String> b, Optional<OneOptional> o,
+ Current current)
throws OptionalException
{
OptionalException ex = new OptionalException();
- if(a.isSet())
+ if(a.isPresent())
{
- ex.setA(a.get());
+ ex.setA(a.getAsInt());
}
else
{
ex.clearA(); // The member "a" has a default value.
}
- if(b.isSet())
+ if(b.isPresent())
{
ex.setB(b.get());
}
- if(o.isSet())
+ if(o.isPresent())
{
ex.setO(o.get());
}
- cb.ice_exception(ex);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(ex);
+ return f;
}
@Override
- public void
- opDerivedException_async(AMD_Initial_opDerivedException cb, Ice.IntOptional a, Ice.Optional<String> b,
- Ice.Optional<OneOptional> o, Ice.Current current)
+ public CompletionStage<Void> opDerivedExceptionAsync(OptionalInt a, Optional<String> b, Optional<OneOptional> o,
+ Current current)
throws OptionalException
{
DerivedException ex = new DerivedException();
- if(a.isSet())
+ if(a.isPresent())
{
- ex.setA(a.get());
+ ex.setA(a.getAsInt());
}
else
{
ex.clearA(); // The member "a" has a default value.
}
- if(b.isSet())
+ if(b.isPresent())
{
ex.setB(b.get());
ex.setSs(b.get());
@@ -78,597 +85,555 @@ public final class AMDInitialI extends Initial
{
ex.clearSs(); // The member "ss" has a default value.
}
- if(o.isSet())
+ if(o.isPresent())
{
ex.setO(o.get());
ex.setO2(o.get());
}
- cb.ice_exception(ex);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(ex);
+ return f;
}
@Override
- public void
- opRequiredException_async(AMD_Initial_opRequiredException cb, Ice.IntOptional a, Ice.Optional<String> b,
- Ice.Optional<OneOptional> o, Ice.Current current)
+ public CompletionStage<Void> opRequiredExceptionAsync(OptionalInt a, Optional<String> b, Optional<OneOptional> o,
+ Current current)
throws OptionalException
{
RequiredException ex = new RequiredException();
- if(a.isSet())
+ if(a.isPresent())
{
- ex.setA(a.get());
+ ex.setA(a.getAsInt());
}
else
{
ex.clearA(); // The member "a" has a default value.
}
- if(b.isSet())
+ if(b.isPresent())
{
ex.setB(b.get());
ex.ss = b.get();
}
- if(o.isSet())
+ if(o.isPresent())
{
ex.setO(o.get());
ex.o2 = o.get();
}
- cb.ice_exception(ex);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(ex);
+ return f;
}
@Override
- public void
- opByte_async(AMD_Initial_opByte cb, Ice.ByteOptional p1, Ice.Current current)
+ public CompletionStage<Initial.OpByteResult> opByteAsync(Optional<Byte> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpByteResult(p1, p1));
}
@Override
- public void
- opByteReq_async(AMD_Initial_opByteReq cb, Ice.ByteOptional p1, Ice.Current current)
+ public CompletionStage<Initial.OpByteReqResult> opByteReqAsync(Optional<Byte> p1, Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpByteReqResult(p1, p1));
}
@Override
- public void
- opBool_async(AMD_Initial_opBool cb, Ice.BooleanOptional p1, Ice.Current current)
+ public CompletionStage<Initial.OpBoolResult> opBoolAsync(Optional<Boolean> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpBoolResult(p1, p1));
}
@Override
- public void
- opBoolReq_async(AMD_Initial_opBoolReq cb, Ice.BooleanOptional p1, Ice.Current current)
+ public CompletionStage<Initial.OpBoolReqResult> opBoolReqAsync(Optional<Boolean> p1, Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpBoolReqResult(p1, p1));
}
@Override
- public void
- opShort_async(AMD_Initial_opShort cb, Ice.ShortOptional p1, Ice.Current current)
+ public CompletionStage<Initial.OpShortResult> opShortAsync(Optional<Short> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpShortResult(p1, p1));
}
@Override
- public void
- opShortReq_async(AMD_Initial_opShortReq cb, Ice.ShortOptional p1, Ice.Current current)
+ public CompletionStage<Initial.OpShortReqResult> opShortReqAsync(Optional<Short> p1, Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpShortReqResult(p1, p1));
}
@Override
- public void
- opInt_async(AMD_Initial_opInt cb, Ice.IntOptional p1, Ice.Current current)
+ public CompletionStage<Initial.OpIntResult> opIntAsync(OptionalInt p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpIntResult(p1, p1));
}
@Override
- public void
- opIntReq_async(AMD_Initial_opIntReq cb, Ice.IntOptional p1, Ice.Current current)
+ public CompletionStage<Initial.OpIntReqResult> opIntReqAsync(OptionalInt p1, Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpIntReqResult(p1, p1));
}
@Override
- public void
- opLong_async(AMD_Initial_opLong cb, Ice.LongOptional p1, Ice.Current current)
+ public CompletionStage<Initial.OpLongResult> opLongAsync(OptionalLong p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpLongResult(p1, p1));
}
@Override
- public void
- opLongReq_async(AMD_Initial_opLongReq cb, Ice.LongOptional p1, Ice.Current current)
+ public CompletionStage<Initial.OpLongReqResult> opLongReqAsync(OptionalLong p1, Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpLongReqResult(p1, p1));
}
@Override
- public void
- opFloat_async(AMD_Initial_opFloat cb, Ice.FloatOptional p1, Ice.Current current)
+ public CompletionStage<Initial.OpFloatResult> opFloatAsync(Optional<Float> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpFloatResult(p1, p1));
}
@Override
- public void
- opFloatReq_async(AMD_Initial_opFloatReq cb, Ice.FloatOptional p1, Ice.Current current)
+ public CompletionStage<Initial.OpFloatReqResult> opFloatReqAsync(Optional<Float> p1, Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpFloatReqResult(p1, p1));
}
@Override
- public void
- opDouble_async(AMD_Initial_opDouble cb, Ice.DoubleOptional p1, Ice.Current current)
+ public CompletionStage<Initial.OpDoubleResult> opDoubleAsync(OptionalDouble p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpDoubleResult(p1, p1));
}
@Override
- public void
- opDoubleReq_async(AMD_Initial_opDoubleReq cb, Ice.DoubleOptional p1, Ice.Current current)
+ public CompletionStage<Initial.OpDoubleReqResult> opDoubleReqAsync(OptionalDouble p1, Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpDoubleReqResult(p1, p1));
}
@Override
- public void
- opString_async(AMD_Initial_opString cb, Ice.Optional<String> p1, Ice.Current current)
+ public CompletionStage<Initial.OpStringResult> opStringAsync(Optional<String> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpStringResult(p1, p1));
}
@Override
- public void
- opStringReq_async(AMD_Initial_opStringReq cb, Ice.Optional<String> p1, Ice.Current current)
+ public CompletionStage<Initial.OpStringReqResult> opStringReqAsync(Optional<String> p1, Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpStringReqResult(p1, p1));
}
@Override
- public void
- opMyEnum_async(AMD_Initial_opMyEnum cb, Ice.Optional<MyEnum> p1, Ice.Current current)
+ public CompletionStage<Initial.OpMyEnumResult> opMyEnumAsync(Optional<MyEnum> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpMyEnumResult(p1, p1));
}
@Override
- public void
- opMyEnumReq_async(AMD_Initial_opMyEnumReq cb, Ice.Optional<MyEnum> p1, Ice.Current current)
+ public CompletionStage<Initial.OpMyEnumReqResult> opMyEnumReqAsync(Optional<MyEnum> p1, Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpMyEnumReqResult(p1, p1));
}
@Override
- public void
- opSmallStruct_async(AMD_Initial_opSmallStruct cb, Ice.Optional<SmallStruct> p1, Ice.Current current)
+ public CompletionStage<Initial.OpSmallStructResult> opSmallStructAsync(Optional<SmallStruct> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpSmallStructResult(p1, p1));
}
@Override
- public void
- opSmallStructReq_async(AMD_Initial_opSmallStructReq cb, Ice.Optional<SmallStruct> p1, Ice.Current current)
+ public CompletionStage<Initial.OpSmallStructReqResult> opSmallStructReqAsync(Optional<SmallStruct> p1,
+ Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpSmallStructReqResult(p1, p1));
}
@Override
- public void
- opFixedStruct_async(AMD_Initial_opFixedStruct cb, Ice.Optional<FixedStruct> p1, Ice.Current current)
+ public CompletionStage<Initial.OpFixedStructResult> opFixedStructAsync(Optional<FixedStruct> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpFixedStructResult(p1, p1));
}
@Override
- public void
- opFixedStructReq_async(AMD_Initial_opFixedStructReq cb, Ice.Optional<FixedStruct> p1, Ice.Current current)
+ public CompletionStage<Initial.OpFixedStructReqResult> opFixedStructReqAsync(Optional<FixedStruct> p1,
+ Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpFixedStructReqResult(p1, p1));
}
@Override
- public void
- opVarStruct_async(AMD_Initial_opVarStruct cb, Ice.Optional<VarStruct> p1, Ice.Current current)
+ public CompletionStage<Initial.OpVarStructResult> opVarStructAsync(Optional<VarStruct> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpVarStructResult(p1, p1));
}
@Override
- public void
- opVarStructReq_async(AMD_Initial_opVarStructReq cb, Ice.Optional<VarStruct> p1, Ice.Current current)
+ public CompletionStage<Initial.OpVarStructReqResult> opVarStructReqAsync(Optional<VarStruct> p1, Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpVarStructReqResult(p1, p1));
}
@Override
- public void
- opOneOptional_async(AMD_Initial_opOneOptional cb, Ice.Optional<OneOptional> p1, Ice.Current current)
+ public CompletionStage<Initial.OpOneOptionalResult> opOneOptionalAsync(Optional<OneOptional> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpOneOptionalResult(p1, p1));
}
@Override
- public void
- opOneOptionalReq_async(AMD_Initial_opOneOptionalReq cb, Ice.Optional<OneOptional> p1, Ice.Current current)
+ public CompletionStage<Initial.OpOneOptionalReqResult> opOneOptionalReqAsync(Optional<OneOptional> p1,
+ Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpOneOptionalReqResult(p1, p1));
}
@Override
- public void
- opOneOptionalProxy_async(AMD_Initial_opOneOptionalProxy cb, Ice.Optional<OneOptionalPrx> p1, Ice.Current current)
+ public CompletionStage<Initial.OpOneOptionalProxyResult> opOneOptionalProxyAsync(
+ Optional<com.zeroc.Ice.ObjectPrx> p1,
+ Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpOneOptionalProxyResult(p1, p1));
}
@Override
- public void
- opOneOptionalProxyReq_async(AMD_Initial_opOneOptionalProxyReq cb, Ice.Optional<OneOptionalPrx> p1,
- Ice.Current current)
+ public CompletionStage<Initial.OpOneOptionalProxyReqResult> opOneOptionalProxyReqAsync(
+ Optional<com.zeroc.Ice.ObjectPrx> p1,
+ Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpOneOptionalProxyReqResult(p1, p1));
}
@Override
- public void
- opByteSeq_async(AMD_Initial_opByteSeq cb, Ice.Optional<byte[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpByteSeqResult> opByteSeqAsync(Optional<byte[]> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpByteSeqResult(p1, p1));
}
@Override
- public void
- opByteSeqReq_async(AMD_Initial_opByteSeqReq cb, Ice.Optional<byte[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpByteSeqReqResult> opByteSeqReqAsync(Optional<byte[]> p1, Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpByteSeqReqResult(p1, p1));
}
@Override
- public void
- opBoolSeq_async(AMD_Initial_opBoolSeq cb, Ice.Optional<boolean[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpBoolSeqResult> opBoolSeqAsync(Optional<boolean[]> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpBoolSeqResult(p1, p1));
}
@Override
- public void
- opBoolSeqReq_async(AMD_Initial_opBoolSeqReq cb, Ice.Optional<boolean[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpBoolSeqReqResult> opBoolSeqReqAsync(Optional<boolean[]> p1, Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpBoolSeqReqResult(p1, p1));
}
@Override
- public void
- opShortSeq_async(AMD_Initial_opShortSeq cb, Ice.Optional<short[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpShortSeqResult> opShortSeqAsync(Optional<short[]> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpShortSeqResult(p1, p1));
}
@Override
- public void
- opShortSeqReq_async(AMD_Initial_opShortSeqReq cb, Ice.Optional<short[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpShortSeqReqResult> opShortSeqReqAsync(Optional<short[]> p1, Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpShortSeqReqResult(p1, p1));
}
@Override
- public void
- opIntSeq_async(AMD_Initial_opIntSeq cb, Ice.Optional<int[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpIntSeqResult> opIntSeqAsync(Optional<int[]> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpIntSeqResult(p1, p1));
}
@Override
- public void
- opIntSeqReq_async(AMD_Initial_opIntSeqReq cb, Ice.Optional<int[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpIntSeqReqResult> opIntSeqReqAsync(Optional<int[]> p1, Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpIntSeqReqResult(p1, p1));
}
@Override
- public void
- opLongSeq_async(AMD_Initial_opLongSeq cb, Ice.Optional<long[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpLongSeqResult> opLongSeqAsync(Optional<long[]> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpLongSeqResult(p1, p1));
}
@Override
- public void
- opLongSeqReq_async(AMD_Initial_opLongSeqReq cb, Ice.Optional<long[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpLongSeqReqResult> opLongSeqReqAsync(Optional<long[]> p1, Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpLongSeqReqResult(p1, p1));
}
@Override
- public void
- opFloatSeq_async(AMD_Initial_opFloatSeq cb, Ice.Optional<float[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpFloatSeqResult> opFloatSeqAsync(Optional<float[]> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpFloatSeqResult(p1, p1));
}
@Override
- public void
- opFloatSeqReq_async(AMD_Initial_opFloatSeqReq cb, Ice.Optional<float[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpFloatSeqReqResult> opFloatSeqReqAsync(Optional<float[]> p1, Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpFloatSeqReqResult(p1, p1));
}
@Override
- public void
- opDoubleSeq_async(AMD_Initial_opDoubleSeq cb, Ice.Optional<double[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpDoubleSeqResult> opDoubleSeqAsync(Optional<double[]> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpDoubleSeqResult(p1, p1));
}
@Override
- public void
- opDoubleSeqReq_async(AMD_Initial_opDoubleSeqReq cb, Ice.Optional<double[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpDoubleSeqReqResult> opDoubleSeqReqAsync(Optional<double[]> p1, Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpDoubleSeqReqResult(p1, p1));
}
@Override
- public void
- opStringSeq_async(AMD_Initial_opStringSeq cb, Ice.Optional<String[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpStringSeqResult> opStringSeqAsync(Optional<String[]> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpStringSeqResult(p1, p1));
}
@Override
- public void
- opStringSeqReq_async(AMD_Initial_opStringSeqReq cb, Ice.Optional<String[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpStringSeqReqResult> opStringSeqReqAsync(Optional<String[]> p1, Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpStringSeqReqResult(p1, p1));
}
@Override
- public void
- opSmallStructSeq_async(AMD_Initial_opSmallStructSeq cb, Ice.Optional<SmallStruct[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpSmallStructSeqResult> opSmallStructSeqAsync(Optional<SmallStruct[]> p1,
+ Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpSmallStructSeqResult(p1, p1));
}
@Override
- public void
- opSmallStructSeqReq_async(AMD_Initial_opSmallStructSeqReq cb, Ice.Optional<SmallStruct[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpSmallStructSeqReqResult> opSmallStructSeqReqAsync(Optional<SmallStruct[]> p1,
+ Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpSmallStructSeqReqResult(p1, p1));
}
@Override
- public void
- opSmallStructList_async(AMD_Initial_opSmallStructList cb, Ice.Optional<java.util.List<SmallStruct>> p1,
- Ice.Current current)
+ public CompletionStage<Initial.OpSmallStructListResult> opSmallStructListAsync(
+ Optional<java.util.List<SmallStruct>> p1,
+ Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpSmallStructListResult(p1, p1));
}
@Override
- public void
- opSmallStructListReq_async(AMD_Initial_opSmallStructListReq cb, Ice.Optional<java.util.List<SmallStruct>> p1,
- Ice.Current current)
+ public CompletionStage<Initial.OpSmallStructListReqResult> opSmallStructListReqAsync(
+ Optional<java.util.List<SmallStruct>> p1,
+ Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpSmallStructListReqResult(p1, p1));
}
@Override
- public void
- opFixedStructSeq_async(AMD_Initial_opFixedStructSeq cb, Ice.Optional<FixedStruct[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpFixedStructSeqResult> opFixedStructSeqAsync(
+ Optional<FixedStruct[]> p1,
+ Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpFixedStructSeqResult(p1, p1));
}
@Override
- public void
- opFixedStructSeqReq_async(AMD_Initial_opFixedStructSeqReq cb, Ice.Optional<FixedStruct[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpFixedStructSeqReqResult> opFixedStructSeqReqAsync(
+ Optional<FixedStruct[]> p1,
+ Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpFixedStructSeqReqResult(p1, p1));
}
@Override
- public void
- opFixedStructList_async(AMD_Initial_opFixedStructList cb, Ice.Optional<java.util.List<FixedStruct>> p1,
- Ice.Current current)
+ public CompletionStage<Initial.OpFixedStructListResult> opFixedStructListAsync(
+ Optional<java.util.List<FixedStruct>> p1,
+ Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpFixedStructListResult(p1, p1));
}
@Override
- public void
- opFixedStructListReq_async(AMD_Initial_opFixedStructListReq cb, Ice.Optional<java.util.List<FixedStruct>> p1,
- Ice.Current current)
+ public CompletionStage<Initial.OpFixedStructListReqResult> opFixedStructListReqAsync(
+ Optional<java.util.List<FixedStruct>> p1,
+ Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpFixedStructListReqResult(p1, p1));
}
@Override
- public void
- opVarStructSeq_async(AMD_Initial_opVarStructSeq cb, Ice.Optional<VarStruct[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpVarStructSeqResult> opVarStructSeqAsync(Optional<VarStruct[]> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpVarStructSeqResult(p1, p1));
}
@Override
- public void
- opVarStructSeqReq_async(AMD_Initial_opVarStructSeqReq cb, Ice.Optional<VarStruct[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpVarStructSeqReqResult> opVarStructSeqReqAsync(Optional<VarStruct[]> p1,
+ Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpVarStructSeqReqResult(p1, p1));
}
@Override
- public void
- opSerializable_async(AMD_Initial_opSerializable cb, Ice.Optional<SerializableClass> p1, Ice.Current current)
+ public CompletionStage<Initial.OpSerializableResult> opSerializableAsync(Optional<SerializableClass> p1,
+ Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpSerializableResult(p1, p1));
}
@Override
- public void
- opSerializableReq_async(AMD_Initial_opSerializableReq cb, Ice.Optional<SerializableClass> p1, Ice.Current current)
+ public CompletionStage<Initial.OpSerializableReqResult> opSerializableReqAsync(Optional<SerializableClass> p1,
+ Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpSerializableReqResult(p1, p1));
}
@Override
- public void
- opIntIntDict_async(AMD_Initial_opIntIntDict cb, Ice.Optional<java.util.Map<Integer, Integer>> p1,
- Ice.Current current)
+ public CompletionStage<Initial.OpIntIntDictResult> opIntIntDictAsync(Optional<java.util.Map<Integer, Integer>> p1,
+ Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpIntIntDictResult(p1, p1));
}
@Override
- public void
- opIntIntDictReq_async(AMD_Initial_opIntIntDictReq cb, Ice.Optional<java.util.Map<Integer, Integer>> p1,
- Ice.Current current)
+ public CompletionStage<Initial.OpIntIntDictReqResult> opIntIntDictReqAsync(
+ Optional<java.util.Map<Integer, Integer>> p1,
+ Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpIntIntDictReqResult(p1, p1));
}
@Override
- public void
- opStringIntDict_async(AMD_Initial_opStringIntDict cb, Ice.Optional<java.util.Map<String, Integer>> p1,
- Ice.Current current)
+ public CompletionStage<Initial.OpStringIntDictResult> opStringIntDictAsync(
+ Optional<java.util.Map<String, Integer>> p1,
+ Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpStringIntDictResult(p1, p1));
}
@Override
- public void
- opStringIntDictReq_async(AMD_Initial_opStringIntDictReq cb, Ice.Optional<java.util.Map<String, Integer>> p1,
- Ice.Current current)
+ public CompletionStage<Initial.OpStringIntDictReqResult> opStringIntDictReqAsync(
+ Optional<java.util.Map<String, Integer>> p1,
+ Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpStringIntDictReqResult(p1, p1));
}
@Override
- public void
- opIntOneOptionalDict_async(AMD_Initial_opIntOneOptionalDict cb,
- Ice.Optional<java.util.Map<Integer, OneOptional>> p1, Ice.Current current)
+ public CompletionStage<Initial.OpIntOneOptionalDictResult> opIntOneOptionalDictAsync(
+ Optional<java.util.Map<Integer, OneOptional>> p1,
+ Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpIntOneOptionalDictResult(p1, p1));
}
@Override
- public void
- opIntOneOptionalDictReq_async(AMD_Initial_opIntOneOptionalDictReq cb,
- Ice.Optional<java.util.Map<Integer, OneOptional>> p1, Ice.Current current)
+ public CompletionStage<Initial.OpIntOneOptionalDictReqResult> opIntOneOptionalDictReqAsync(
+ Optional<java.util.Map<Integer, OneOptional>> p1,
+ Current current)
{
- cb.ice_response(p1.get(), p1.get());
+ return CompletableFuture.completedFuture(new Initial.OpIntOneOptionalDictReqResult(p1, p1));
}
@Override
- public void
- opClassAndUnknownOptional_async(AMD_Initial_opClassAndUnknownOptional cb, A p, Ice.Current current)
+ public CompletionStage<Void> opClassAndUnknownOptionalAsync(A p, Current current)
{
- cb.ice_response();
+ return CompletableFuture.completedFuture(null);
}
@Override
- public void
- sendOptionalClass_async(AMD_Initial_sendOptionalClass cb, boolean req, Ice.Optional<OneOptional> o,
- Ice.Current current)
+ public CompletionStage<Void> sendOptionalClassAsync(boolean req, Optional<OneOptional> o, Current current)
{
- cb.ice_response();
+ return CompletableFuture.completedFuture(null);
}
@Override
- public void
- returnOptionalClass_async(AMD_Initial_returnOptionalClass cb, boolean req, Ice.Current current)
+ public CompletionStage<Optional<OneOptional>> returnOptionalClassAsync(boolean req, Current current)
{
- cb.ice_response(new Ice.Optional<OneOptional>(new OneOptional(53)));
+ return CompletableFuture.completedFuture(Optional.of(new OneOptional(53)));
}
@Override
- public void
- opG_async(AMD_Initial_opG cb, G g, Ice.Current current)
+ public CompletionStage<G> opGAsync(G g, Current current)
{
- cb.ice_response(g);
+ return CompletableFuture.completedFuture(g);
}
@Override
- public void
- opVoid_async(AMD_Initial_opVoid cb, Ice.Current current)
+ public CompletionStage<Void> opVoidAsync(Current current)
{
- cb.ice_response();
+ return CompletableFuture.completedFuture(null);
}
@Override
- public void opMStruct1_async(AMD_Initial_opMStruct1 cb, Ice.Current current)
+ public CompletionStage<Initial.OpMStruct1MarshaledResult> opMStruct1Async(Current current)
{
- cb.ice_response(new Ice.Optional<SmallStruct>(new SmallStruct()));
+ return CompletableFuture.completedFuture(
+ new Initial.OpMStruct1MarshaledResult(Optional.of(new SmallStruct()), current));
}
@Override
- public void opMStruct2_async(AMD_Initial_opMStruct2 cb, Ice.Optional<SmallStruct> p1, Ice.Current current)
+ public CompletionStage<Initial.OpMStruct2MarshaledResult> opMStruct2Async(Optional<SmallStruct> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpMStruct2MarshaledResult(p1, p1, current));
}
@Override
- public void opMSeq1_async(AMD_Initial_opMSeq1 cb, Ice.Current current)
+ public CompletionStage<Initial.OpMSeq1MarshaledResult> opMSeq1Async(Current current)
{
- cb.ice_response(new Ice.Optional<String[]>(new String[0]));
+ return CompletableFuture.completedFuture(
+ new Initial.OpMSeq1MarshaledResult(Optional.of(new String[0]), current));
}
@Override
- public void opMSeq2_async(AMD_Initial_opMSeq2 cb, Ice.Optional<String[]> p1, Ice.Current current)
+ public CompletionStage<Initial.OpMSeq2MarshaledResult> opMSeq2Async(Optional<String[]> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpMSeq2MarshaledResult(p1, p1, current));
}
@Override
- public void opMDict1_async(AMD_Initial_opMDict1 cb, Ice.Current current)
+ public CompletionStage<Initial.OpMDict1MarshaledResult> opMDict1Async(Current current)
{
- cb.ice_response(new Ice.Optional<java.util.Map<String, Integer>>(new java.util.HashMap<String, Integer>()));
+ return CompletableFuture.completedFuture(
+ new Initial.OpMDict1MarshaledResult(Optional.of(new java.util.HashMap<>()), current));
}
@Override
- public void
- opMDict2_async(AMD_Initial_opMDict2 cb, Ice.Optional<java.util.Map<String, Integer>> p1, Ice.Current current)
+ public CompletionStage<Initial.OpMDict2MarshaledResult> opMDict2Async(Optional<java.util.Map<String, Integer>> p1,
+ Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpMDict2MarshaledResult(p1, p1, current));
}
@Override
- public void opMG1_async(AMD_Initial_opMG1 cb, Ice.Current current)
+ public CompletionStage<Initial.OpMG1MarshaledResult> opMG1Async(Current current)
{
- cb.ice_response(new Ice.Optional<G>(new G()));
+ return CompletableFuture.completedFuture(new Initial.OpMG1MarshaledResult(Optional.of(new G()), current));
}
@Override
- public void opMG2_async(AMD_Initial_opMG2 cb, Ice.Optional<G> p1, Ice.Current current)
+ public CompletionStage<Initial.OpMG2MarshaledResult> opMG2Async(Optional<G> p1, Current current)
{
- cb.ice_response(p1, p1);
+ return CompletableFuture.completedFuture(new Initial.OpMG2MarshaledResult(p1, p1, current));
}
@Override
- public void
- supportsRequiredParams_async(AMD_Initial_supportsRequiredParams cb, Ice.Current current)
+ public CompletionStage<Boolean> supportsRequiredParamsAsync(Current current)
{
- cb.ice_response(true);
+ return CompletableFuture.completedFuture(true);
}
@Override
- public void
- supportsJavaSerializable_async(AMD_Initial_supportsJavaSerializable cb, Ice.Current current)
+ public CompletionStage<Boolean> supportsJavaSerializableAsync(Current current)
{
- cb.ice_response(true);
+ return CompletableFuture.completedFuture(true);
}
@Override
- public void
- supportsCsharpSerializable_async(AMD_Initial_supportsCsharpSerializable cb, Ice.Current current)
+ public CompletionStage<Boolean> supportsCsharpSerializableAsync(Current current)
{
- cb.ice_response(false);
+ return CompletableFuture.completedFuture(false);
}
@Override
- public void
- supportsCppStringView_async(AMD_Initial_supportsCppStringView cb, Ice.Current current)
+ public CompletionStage<Boolean> supportsCppStringViewAsync(Current current)
{
- cb.ice_response(false);
+ return CompletableFuture.completedFuture(false);
}
}
diff --git a/java/test/src/main/java/test/Ice/optional/AMDServer.java b/java/test/src/main/java/test/Ice/optional/AMDServer.java
index 99cab219be1..98f9e74760c 100644
--- a/java/test/src/main/java/test/Ice/optional/AMDServer.java
+++ b/java/test/src/main/java/test/Ice/optional/AMDServer.java
@@ -15,19 +15,18 @@ public class AMDServer extends test.Util.Application
public int run(String[] args)
{
communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- adapter.add(new AMDInitialI(), Ice.Util.stringToIdentity("initial"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.add(new AMDInitialI(), com.zeroc.Ice.Util.stringToIdentity("initial"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.optional.AMD");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.optional.AMD");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/optional/AllTests.java b/java/test/src/main/java/test/Ice/optional/AllTests.java
index bd6d64fd582..a74519bb674 100644
--- a/java/test/src/main/java/test/Ice/optional/AllTests.java
+++ b/java/test/src/main/java/test/Ice/optional/AllTests.java
@@ -8,14 +8,23 @@
// **********************************************************************
package test.Ice.optional;
+
import java.io.PrintWriter;
+import java.util.Optional;
+import java.util.OptionalDouble;
+import java.util.OptionalInt;
+import java.util.OptionalLong;
+
+import com.zeroc.Ice.InputStream;
+import com.zeroc.Ice.OperationMode;
+import com.zeroc.Ice.OptionalFormat;
+import com.zeroc.Ice.OutputStream;
import test.Ice.optional.Test.*;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -23,10 +32,14 @@ public class AllTests
}
}
- public static InitialPrx
- allTests(test.Util.Application app, boolean collocated, PrintWriter out)
+ static class Wrapper<T>
{
- Ice.Communicator communicator = app.communicator();
+ T value;
+ }
+
+ public static InitialPrx allTests(test.Util.Application app, boolean collocated, PrintWriter out)
+ {
+ com.zeroc.Ice.Communicator communicator = app.communicator();
FactoryI factory = new FactoryI();
communicator.getValueFactoryManager().add(factory, "");
@@ -34,13 +47,13 @@ public class AllTests
out.print("testing stringToProxy... ");
out.flush();
String ref = "initial:default -p 12010";
- Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref);
test(base != null);
out.println("ok");
out.print("testing checked cast... ");
out.flush();
- InitialPrx initial = InitialPrxHelper.checkedCast(base);
+ InitialPrx initial = InitialPrx.checkedCast(base);
test(initial != null);
test(initial.equals(base));
out.println("ok");
@@ -66,13 +79,13 @@ public class AllTests
mo1.setG(1.0);
mo1.setH("test");
mo1.setI(MyEnum.MyEnumMember);
- mo1.setJ(MultiOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test")));
+ mo1.setJ(communicator.stringToProxy("test"));
mo1.setK(mo1);
mo1.setBs(new byte[] { (byte)5 });
mo1.setSs(new String[] { "test", "test2" });
- mo1.setIid(new java.util.HashMap<Integer, Integer>());
+ mo1.setIid(new java.util.HashMap<>());
mo1.getIid().put(4, 3);
- mo1.setSid(new java.util.HashMap<String, Integer>());
+ mo1.setSid(new java.util.HashMap<>());
mo1.getSid().put("test", 10);
FixedStruct fs = new FixedStruct();
fs.m = 78;
@@ -86,18 +99,18 @@ public class AllTests
mo1.setFss(new FixedStruct[] { fs });
mo1.setVss(new VarStruct[] { vs });
mo1.setOos(new OneOptional[] { oo1 });
- mo1.setOops(new OneOptionalPrx[] { OneOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test")) });
+ mo1.setOops(new com.zeroc.Ice.ObjectPrx[] { communicator.stringToProxy("test") });
- mo1.setIed(new java.util.HashMap<Integer, MyEnum>());
+ mo1.setIed(new java.util.HashMap<>());
mo1.getIed().put(4, MyEnum.MyEnumMember);
- mo1.setIfsd(new java.util.HashMap<Integer, FixedStruct>());
+ mo1.setIfsd(new java.util.HashMap<>());
mo1.getIfsd().put(4, fs);
- mo1.setIvsd(new java.util.HashMap<Integer, VarStruct>());
+ mo1.setIvsd(new java.util.HashMap<>());
mo1.getIvsd().put(5, vs);
- mo1.setIood(new java.util.HashMap<Integer, OneOptional>());
+ mo1.setIood(new java.util.HashMap<>());
mo1.getIood().put(5, new OneOptional(15));
- mo1.setIoopd(new java.util.HashMap<Integer, OneOptionalPrx>());
- mo1.getIoopd().put(5, OneOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test")));
+ mo1.setIoopd(new java.util.HashMap<>());
+ mo1.getIoopd().put(5, communicator.stringToProxy("test"));
mo1.setBos(new boolean[] { false, true, false });
@@ -113,7 +126,7 @@ public class AllTests
test(mo1.getG() == 1.0);
test(mo1.getH().equals("test"));
test(mo1.getI() == MyEnum.MyEnumMember);
- test(mo1.getJ().equals(MultiOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test"))));
+ test(mo1.getJ().equals(communicator.stringToProxy("test")));
test(mo1.getK() == mo1);
test(java.util.Arrays.equals(mo1.getBs(), new byte[] { (byte)5 }));
test(java.util.Arrays.equals(mo1.getSs(), new String[] { "test", "test2" }));
@@ -127,13 +140,13 @@ public class AllTests
test(mo1.getFss()[0].equals(new FixedStruct(78)));
test(mo1.getVss()[0].equals(new VarStruct("hello")));
test(mo1.getOos()[0] == oo1);
- test(mo1.getOops()[0].equals(OneOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test"))));
+ test(mo1.getOops()[0].equals(communicator.stringToProxy("test")));
test(mo1.getIed().get(4) == MyEnum.MyEnumMember);
test(mo1.getIfsd().get(4).equals(new FixedStruct(78)));
test(mo1.getIvsd().get(5).equals(new VarStruct("hello")));
test(mo1.getIood().get(5).getA() == 15);
- test(mo1.getIoopd().get(5).equals(OneOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test"))));
+ test(mo1.getIoopd().get(5).equals(communicator.stringToProxy("test")));
test(java.util.Arrays.equals(mo1.getBos(), new boolean[] { false, true, false }));
@@ -215,13 +228,13 @@ public class AllTests
test(mo5.getFss()[0].equals(new FixedStruct(78)));
test(mo5.getVss()[0].equals(new VarStruct("hello")));
test(mo5.getOos()[0].getA() == 15);
- test(mo5.getOops()[0].equals(OneOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test"))));
+ test(mo5.getOops()[0].equals(communicator.stringToProxy("test")));
test(mo5.getIed().get(4) == MyEnum.MyEnumMember);
test(mo5.getIfsd().get(4).equals(new FixedStruct(78)));
test(mo5.getIvsd().get(5).equals(new VarStruct("hello")));
test(mo5.getIood().get(5).getA() == 15);
- test(mo5.getIoopd().get(5).equals(OneOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test"))));
+ test(mo5.getIoopd().get(5).equals(communicator.stringToProxy("test")));
test(java.util.Arrays.equals(mo5.getBos(), new boolean[] { false, true, false }));
@@ -325,19 +338,19 @@ public class AllTests
test(!mo9.hasFss());
test(mo9.getVss()[0].equals(new VarStruct("hello")));
test(!mo9.hasOos());
- test(mo9.getOops()[0].equals(OneOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test"))));
+ test(mo9.getOops()[0].equals(communicator.stringToProxy("test")));
test(mo9.getIed().get(4) == MyEnum.MyEnumMember);
test(!mo9.hasIfsd());
test(mo9.getIvsd().get(5).equals(new VarStruct("hello")));
test(!mo9.hasIood());
- test(mo9.getIoopd().get(5).equals(OneOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test"))));
+ test(mo9.getIoopd().get(5).equals(communicator.stringToProxy("test")));
test(!mo9.hasBos());
{
OptionalWithCustom owc1 = new OptionalWithCustom();
- java.util.ArrayList<SmallStruct> l = new java.util.ArrayList<SmallStruct>();
+ java.util.ArrayList<SmallStruct> l = new java.util.ArrayList<>();
l.add(new SmallStruct((byte)5));
l.add(new SmallStruct((byte)6));
l.add(new SmallStruct((byte)7));
@@ -356,27 +369,28 @@ public class AllTests
// are skipped even if the receiver knows nothing about them.
//
factory.setEnabled(true);
- Ice.OutputStream os = new Ice.OutputStream(communicator);
+ OutputStream os = new OutputStream(communicator);
os.startEncapsulation();
os.writeValue(oo1);
os.endEncapsulation();
byte[] inEncaps = os.finished();
- Ice.ByteSeqHolder outEncaps = new Ice.ByteSeqHolder();
- test(initial.ice_invoke("pingPong", Ice.OperationMode.Normal, inEncaps, outEncaps));
- Ice.InputStream in = new Ice.InputStream(communicator, outEncaps.value);
+ com.zeroc.Ice.Object.Ice_invokeResult inv = initial.ice_invoke("pingPong", OperationMode.Normal, inEncaps);
+ test(inv.returnValue);
+ InputStream in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
ReadValueCallbackI cb = new ReadValueCallbackI();
in.readValue(cb);
in.endEncapsulation();
test(cb.obj != null && cb.obj instanceof TestObjectReader);
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
os.writeValue(mo1);
os.endEncapsulation();
inEncaps = os.finished();
- test(initial.ice_invoke("pingPong", Ice.OperationMode.Normal, inEncaps, outEncaps));
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("pingPong", OperationMode.Normal, inEncaps);
+ test(inv.returnValue);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.readValue(cb);
in.endEncapsulation();
@@ -386,15 +400,15 @@ public class AllTests
//
// Use the 1.0 encoding with operations whose only class parameters are optional.
//
- Ice.Optional<OneOptional> oo = new Ice.Optional<OneOptional>(new OneOptional(53));
+ Optional<OneOptional> oo = Optional.of(new OneOptional(53));
initial.sendOptionalClass(true, oo);
- InitialPrx initial2 = (InitialPrx)initial.ice_encodingVersion(Ice.Util.Encoding_1_0);
+ InitialPrx initial2 = initial.ice_encodingVersion(com.zeroc.Ice.Util.Encoding_1_0);
initial2.sendOptionalClass(true, oo);
- initial.returnOptionalClass(true, oo);
- test(oo.isSet());
- initial2.returnOptionalClass(true, oo);
- test(!oo.isSet());
+ oo = initial.returnOptionalClass(true);
+ test(oo.isPresent());
+ oo = initial2.returnOptionalClass(true);
+ test(!oo.isPresent());
Recursive[] recursive1 = new Recursive[1];
recursive1[0] = new Recursive();
@@ -418,15 +432,16 @@ public class AllTests
initial.opVoid();
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(1, Ice.OptionalFormat.F4);
+ os.writeOptional(1, OptionalFormat.F4);
os.writeInt(15);
- os.writeOptional(1, Ice.OptionalFormat.VSize);
+ os.writeOptional(1, OptionalFormat.VSize);
os.writeString("test");
os.endEncapsulation();
inEncaps = os.finished();
- test(initial.ice_invoke("opVoid", Ice.OperationMode.Normal, inEncaps, outEncaps));
+ inv = initial.ice_invoke("opVoid", OperationMode.Normal, inEncaps);
+ test(inv.returnValue);
out.println("ok");
@@ -443,7 +458,7 @@ public class AllTests
mc.getFss()[i] = new FixedStruct();
}
- mc.setIfsd(new java.util.HashMap<Integer, FixedStruct>());
+ mc.setIfsd(new java.util.HashMap<>());
for(int i = 0; i < 300; ++i)
{
mc.getIfsd().put(i, new FixedStruct());
@@ -456,14 +471,14 @@ public class AllTests
test(mc.getIfsd().size() == 300);
factory.setEnabled(true);
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
os.writeValue(mc);
os.endEncapsulation();
inEncaps = os.finished();
- outEncaps = new Ice.ByteSeqHolder();
- test(initial.ice_invoke("pingPong", Ice.OperationMode.Normal, inEncaps, outEncaps));
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("pingPong", OperationMode.Normal, inEncaps);
+ test(inv.returnValue);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.readValue(cb);
in.endEncapsulation();
@@ -493,14 +508,14 @@ public class AllTests
test(b2.getMd() == 13);
factory.setEnabled(true);
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
os.writeValue(b);
os.endEncapsulation();
inEncaps = os.finished();
- outEncaps = new Ice.ByteSeqHolder();
- test(initial.ice_invoke("pingPong", Ice.OperationMode.Normal, inEncaps, outEncaps));
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("pingPong", OperationMode.Normal, inEncaps);
+ test(inv.returnValue);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.readValue(cb);
in.endEncapsulation();
@@ -521,26 +536,18 @@ public class AllTests
test(rf.ae == rf.getAf());
factory.setEnabled(true);
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
os.writeValue(f);
os.endEncapsulation();
inEncaps = os.finished();
- in = new Ice.InputStream(communicator, inEncaps);
+ in = new InputStream(communicator, inEncaps);
in.startEncapsulation();
- final FHolder fholder = new FHolder();
- in.readValue(new Ice.ReadValueCallback()
- {
- @Override
- public void valueReady(Ice.Object obj)
- {
- fholder.value = ((FObjectReader)obj).getF();
- }
- });
+ final Wrapper<F> w = new Wrapper<>();
+ in.readValue(v -> w.value = ((FObjectReader)v).getF());
in.endEncapsulation();
factory.setEnabled(false);
- rf = fholder.value;
- test(rf.ae != null && !rf.hasAf());
+ test(w.value.ae != null && !w.value.hasAf());
}
out.println("ok");
@@ -566,14 +573,15 @@ public class AllTests
C c = new C();
c.ss = "test";
c.setMs("testms");
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
os.writeValue(c);
os.endEncapsulation();
inEncaps = os.finished();
factory.setEnabled(true);
- test(initial.ice_invoke("pingPong", Ice.OperationMode.Normal, inEncaps, outEncaps));
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("pingPong", OperationMode.Normal, inEncaps);
+ test(inv.returnValue);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.readValue(cb);
in.endEncapsulation();
@@ -581,14 +589,15 @@ public class AllTests
factory.setEnabled(false);
factory.setEnabled(true);
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- Ice.Object d = new DObjectWriter();
+ com.zeroc.Ice.Value d = new DObjectWriter();
os.writeValue(d);
os.endEncapsulation();
inEncaps = os.finished();
- test(initial.ice_invoke("pingPong", Ice.OperationMode.Normal, inEncaps, outEncaps));
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("pingPong", OperationMode.Normal, inEncaps);
+ test(inv.returnValue);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.readValue(cb);
in.endEncapsulation();
@@ -603,16 +612,17 @@ public class AllTests
{
A a = new A();
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
os.writeValue(a);
- os.writeOptional(1, Ice.OptionalFormat.Class);
+ os.writeOptional(1, OptionalFormat.Class);
os.writeValue(new DObjectWriter());
os.endEncapsulation();
inEncaps = os.finished();
- test(initial.ice_invoke("opClassAndUnknownOptional", Ice.OperationMode.Normal, inEncaps, outEncaps));
+ inv = initial.ice_invoke("opClassAndUnknownOptional", OperationMode.Normal, inEncaps);
+ test(inv.returnValue);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
@@ -624,645 +634,571 @@ public class AllTests
final boolean reqParams = initial.supportsRequiredParams();
{
+ Optional<Byte> p1 = Optional.empty();
+ Initial.OpByteResult r = initial.opByte(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
- Ice.ByteOptional p1 = new Ice.ByteOptional();
- Ice.ByteOptional p3 = new Ice.ByteOptional();
- Ice.ByteOptional p2 = initial.opByte(p1, p3);
- test(!p2.isSet() && !p3.isSet());
-
- p1.set((byte)56);
- p2 = initial.opByte(p1, p3);
- test(p2.get() == (byte)56 && p3.get() == (byte)56);
- Ice.AsyncResult r = initial.begin_opByte(p1);
- p2 = initial.end_opByte(p3, r);
- test(p2.get() == (byte)56 && p3.get() == (byte)56);
- p2 = initial.opByte(new Ice.ByteOptional(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ p1 = Optional.of((byte)56);
+ r = initial.opByte(p1);
+ test(r.returnValue.get() == (byte)56 && r.p3.get() == (byte)56);
+ r = initial.opByteAsync(p1).join();
+ test(r.returnValue.get() == (byte)56 && r.p3.get() == (byte)56);
if(reqParams)
{
- p2 = initial.opByteReq(p1.get(), p3);
- test(p2.get() == (byte)56 && p3.get() == (byte)56);
- r = initial.begin_opByteReq(p1.get());
- p2 = initial.end_opByteReq(p3, r);
- test(p2.get() == (byte)56 && p3.get() == (byte)56);
+ Initial.OpByteReqResult rr = initial.opByteReq(p1.get());
+ test(rr.returnValue.get() == (byte)56 && rr.p3.get() == (byte)56);
+ rr = initial.opByteReqAsync(p1.get()).join();
+ test(rr.returnValue.get() == (byte)56 && rr.p3.get() == (byte)56);
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.F1);
+ os.writeOptional(2, OptionalFormat.F1);
os.writeByte(p1.get());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opByteReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opByteReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.F1));
+ test(in.readOptional(1, OptionalFormat.F1));
test(in.readByte() == (byte)56);
- test(in.readOptional(3, Ice.OptionalFormat.F1));
+ test(in.readOptional(3, OptionalFormat.F1));
test(in.readByte() == (byte)56);
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.BooleanOptional p1 = new Ice.BooleanOptional();
- Ice.BooleanOptional p3 = new Ice.BooleanOptional();
- Ice.BooleanOptional p2 = initial.opBool(p1, p3);
- test(!p2.isSet() && !p3.isSet());
-
- p1.set(true);
- p2 = initial.opBool(p1, p3);
- test(p2.get() == true && p3.get() == true);
- Ice.AsyncResult r = initial.begin_opBool(p1);
- p2 = initial.end_opBool(p3, r);
- test(p2.get() == true && p3.get() == true);
- p2 = initial.opBool(new Ice.BooleanOptional(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ Optional<Boolean> p1 = Optional.empty();
+ Initial.OpBoolResult r = initial.opBool(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
+
+ p1 = Optional.of(true);
+ r = initial.opBool(p1);
+ test(r.returnValue.get() == true && r.p3.get() == true);
+ r = initial.opBoolAsync(p1).join();
+ test(r.returnValue.get() == true && r.p3.get() == true);
if(reqParams)
{
- p2 = initial.opBoolReq(true, p3);
- test(p2.get() == true && p3.get() == true);
- r = initial.begin_opBoolReq(true);
- p2 = initial.end_opBoolReq(p3, r);
- test(p2.get() == true && p3.get() == true);
+ Initial.OpBoolReqResult rr = initial.opBoolReq(true);
+ test(rr.returnValue.get() == true && rr.p3.get() == true);
+ rr = initial.opBoolReqAsync(true).join();
+ test(rr.returnValue.get() == true && rr.p3.get() == true);
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.F1);
+ os.writeOptional(2, OptionalFormat.F1);
os.writeBool(p1.get());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opBoolReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opBoolReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.F1));
+ test(in.readOptional(1, OptionalFormat.F1));
test(in.readBool() == true);
- test(in.readOptional(3, Ice.OptionalFormat.F1));
+ test(in.readOptional(3, OptionalFormat.F1));
test(in.readBool() == true);
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.ShortOptional p1 = new Ice.ShortOptional();
- Ice.ShortOptional p3 = new Ice.ShortOptional();
- Ice.ShortOptional p2 = initial.opShort(p1, p3);
- test(!p2.isSet() && !p3.isSet());
-
- p1.set((short)56);
- p2 = initial.opShort(p1, p3);
- test(p2.get() == 56 && p3.get() == 56);
- Ice.AsyncResult r = initial.begin_opShort(p1);
- p2 = initial.end_opShort(p3, r);
- test(p2.get() == 56 && p3.get() == 56);
- p2 = initial.opShort(new Ice.ShortOptional(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ Optional<Short> p1 = Optional.empty();
+ Initial.OpShortResult r = initial.opShort(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
+
+ p1 = Optional.of((short)56);
+ r = initial.opShort(p1);
+ test(r.returnValue.get() == 56 && r.p3.get() == 56);
+ r = initial.opShortAsync(p1).join();
+ test(r.returnValue.get() == 56 && r.p3.get() == 56);
if(reqParams)
{
- p2 = initial.opShortReq(p1.get(), p3);
- test(p2.get() == 56 && p3.get() == 56);
- r = initial.begin_opShortReq(p1.get());
- p2 = initial.end_opShortReq(p3, r);
- test(p2.get() == 56 && p3.get() == 56);
+ Initial.OpShortReqResult rr = initial.opShortReq(p1.get());
+ test(rr.returnValue.get() == 56 && rr.p3.get() == 56);
+ rr = initial.opShortReqAsync(p1.get()).join();
+ test(rr.returnValue.get() == 56 && rr.p3.get() == 56);
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.F2);
+ os.writeOptional(2, OptionalFormat.F2);
os.writeShort(p1.get());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opShortReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opShortReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.F2));
+ test(in.readOptional(1, OptionalFormat.F2));
test(in.readShort() == 56);
- test(in.readOptional(3, Ice.OptionalFormat.F2));
+ test(in.readOptional(3, OptionalFormat.F2));
test(in.readShort() == 56);
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.IntOptional p1 = new Ice.IntOptional();
- Ice.IntOptional p3 = new Ice.IntOptional();
- Ice.IntOptional p2 = initial.opInt(p1, p3);
- test(!p2.isSet() && !p3.isSet());
-
- p1.set(56);
- p2 = initial.opInt(p1, p3);
- test(p2.get() == 56 && p3.get() == 56);
- Ice.AsyncResult r = initial.begin_opInt(p1);
- p2 = initial.end_opInt(p3, r);
- test(p2.get() == 56 && p3.get() == 56);
- p2 = initial.opInt(new Ice.IntOptional(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ OptionalInt p1 = OptionalInt.empty();
+ Initial.OpIntResult r = initial.opInt(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
+
+ p1 = OptionalInt.of(56);
+ r = initial.opInt(p1);
+ test(r.returnValue.getAsInt() == 56 && r.p3.getAsInt() == 56);
+ r = initial.opIntAsync(p1).join();
+ test(r.returnValue.getAsInt() == 56 && r.p3.getAsInt() == 56);
if(reqParams)
{
- p2 = initial.opIntReq(p1.get(), p3);
- test(p2.get() == 56 && p3.get() == 56);
- r = initial.begin_opIntReq(p1.get());
- p2 = initial.end_opIntReq(p3, r);
- test(p2.get() == 56 && p3.get() == 56);
+ Initial.OpIntReqResult rr = initial.opIntReq(p1.getAsInt());
+ test(rr.returnValue.getAsInt() == 56 && rr.p3.getAsInt() == 56);
+ rr = initial.opIntReqAsync(p1.getAsInt()).join();
+ test(rr.returnValue.getAsInt() == 56 && rr.p3.getAsInt() == 56);
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.F4);
- os.writeInt(p1.get());
+ os.writeOptional(2, OptionalFormat.F4);
+ os.writeInt(p1.getAsInt());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opIntReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opIntReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.F4));
+ test(in.readOptional(1, OptionalFormat.F4));
test(in.readInt() == 56);
- test(in.readOptional(3, Ice.OptionalFormat.F4));
+ test(in.readOptional(3, OptionalFormat.F4));
test(in.readInt() == 56);
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.LongOptional p1 = new Ice.LongOptional();
- Ice.LongOptional p3 = new Ice.LongOptional();
- Ice.LongOptional p2 = initial.opLong(p1, p3);
- test(!p2.isSet() && !p3.isSet());
-
- p1.set(56);
- p2 = initial.opLong(p1, p3);
- test(p2.get() == 56 && p3.get() == 56);
- Ice.AsyncResult r = initial.begin_opLong(p1);
- p2 = initial.end_opLong(p3, r);
- test(p2.get() == 56 && p3.get() == 56);
- p2 = initial.opLong(new Ice.LongOptional(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ OptionalLong p1 = OptionalLong.empty();
+ Initial.OpLongResult r = initial.opLong(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
+
+ p1 = OptionalLong.of(56);
+ r = initial.opLong(p1);
+ test(r.returnValue.getAsLong() == 56 && r.p3.getAsLong() == 56);
+ r = initial.opLongAsync(p1).join();
+ test(r.returnValue.getAsLong() == 56 && r.p3.getAsLong() == 56);
if(reqParams)
{
- p2 = initial.opLongReq(p1.get(), p3);
- test(p2.get() == 56 && p3.get() == 56);
- r = initial.begin_opLongReq(p1.get());
- p2 = initial.end_opLongReq(p3, r);
- test(p2.get() == 56 && p3.get() == 56);
+ Initial.OpLongReqResult rr = initial.opLongReq(p1.getAsLong());
+ test(rr.returnValue.getAsLong() == 56 && rr.p3.getAsLong() == 56);
+ rr = initial.opLongReqAsync(p1.getAsLong()).join();
+ test(rr.returnValue.getAsLong() == 56 && rr.p3.getAsLong() == 56);
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(1, Ice.OptionalFormat.F8);
- os.writeLong(p1.get());
+ os.writeOptional(1, OptionalFormat.F8);
+ os.writeLong(p1.getAsLong());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opLongReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opLongReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(2, Ice.OptionalFormat.F8));
+ test(in.readOptional(2, OptionalFormat.F8));
test(in.readLong() == 56);
- test(in.readOptional(3, Ice.OptionalFormat.F8));
+ test(in.readOptional(3, OptionalFormat.F8));
test(in.readLong() == 56);
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.FloatOptional p1 = new Ice.FloatOptional();
- Ice.FloatOptional p3 = new Ice.FloatOptional();
- Ice.FloatOptional p2 = initial.opFloat(p1, p3);
- test(!p2.isSet() && !p3.isSet());
-
- p1.set((float)1.0);
- p2 = initial.opFloat(p1, p3);
- test(p2.get() == 1.0 && p3.get() == 1.0);
- Ice.AsyncResult r = initial.begin_opFloat(p1);
- p2 = initial.end_opFloat(p3, r);
- test(p2.get() == 1.0 && p3.get() == 1.0);
- p2 = initial.opFloat(new Ice.FloatOptional(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ Optional<Float> p1 = Optional.empty();
+ Initial.OpFloatResult r = initial.opFloat(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
+
+ p1 = Optional.of((float)1.0);
+ r = initial.opFloat(p1);
+ test(r.returnValue.get() == 1.0 && r.p3.get() == 1.0);
+ r = initial.opFloatAsync(p1).join();
+ test(r.returnValue.get() == 1.0 && r.p3.get() == 1.0);
if(reqParams)
{
- p2 = initial.opFloatReq(p1.get(), p3);
- test(p2.get() == 1.0 && p3.get() == 1.0);
- r = initial.begin_opFloatReq(p1.get());
- p2 = initial.end_opFloatReq(p3, r);
- test(p2.get() == 1.0 && p3.get() == 1.0);
+ Initial.OpFloatReqResult rr = initial.opFloatReq(p1.get());
+ test(rr.returnValue.get() == 1.0 && rr.p3.get() == 1.0);
+ rr = initial.opFloatReqAsync(p1.get()).join();
+ test(rr.returnValue.get() == 1.0 && rr.p3.get() == 1.0);
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.F4);
+ os.writeOptional(2, OptionalFormat.F4);
os.writeFloat(p1.get());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opFloatReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opFloatReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.F4));
+ test(in.readOptional(1, OptionalFormat.F4));
test(in.readFloat() == 1.0);
- test(in.readOptional(3, Ice.OptionalFormat.F4));
+ test(in.readOptional(3, OptionalFormat.F4));
test(in.readFloat() == 1.0);
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.DoubleOptional p1 = new Ice.DoubleOptional();
- Ice.DoubleOptional p3 = new Ice.DoubleOptional();
- Ice.DoubleOptional p2 = initial.opDouble(p1, p3);
- test(!p2.isSet() && !p3.isSet());
-
- p1.set(1.0);
- p2 = initial.opDouble(p1, p3);
- test(p2.get() == 1.0 && p3.get() == 1.0);
- Ice.AsyncResult r = initial.begin_opDouble(p1);
- p2 = initial.end_opDouble(p3, r);
- test(p2.get() == 1.0 && p3.get() == 1.0);
- p2 = initial.opDouble(new Ice.DoubleOptional(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ OptionalDouble p1 = OptionalDouble.empty();
+ Initial.OpDoubleResult r = initial.opDouble(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
+
+ p1 = OptionalDouble.of(1.0);
+ r = initial.opDouble(p1);
+ test(r.returnValue.getAsDouble() == 1.0 && r.p3.getAsDouble() == 1.0);
+ r = initial.opDoubleAsync(p1).join();
+ test(r.returnValue.getAsDouble() == 1.0 && r.p3.getAsDouble() == 1.0);
if(reqParams)
{
- p2 = initial.opDoubleReq(p1.get(), p3);
- test(p2.get() == 1.0 && p3.get() == 1.0);
- r = initial.begin_opDoubleReq(p1.get());
- p2 = initial.end_opDoubleReq(p3, r);
- test(p2.get() == 1.0 && p3.get() == 1.0);
+ Initial.OpDoubleReqResult rr = initial.opDoubleReq(p1.getAsDouble());
+ test(rr.returnValue.getAsDouble() == 1.0 && rr.p3.getAsDouble() == 1.0);
+ rr = initial.opDoubleReqAsync(p1.getAsDouble()).join();
+ test(rr.returnValue.getAsDouble() == 1.0 && rr.p3.getAsDouble() == 1.0);
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.F8);
- os.writeDouble(p1.get());
+ os.writeOptional(2, OptionalFormat.F8);
+ os.writeDouble(p1.getAsDouble());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opDoubleReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opDoubleReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.F8));
+ test(in.readOptional(1, OptionalFormat.F8));
test(in.readDouble() == 1.0);
- test(in.readOptional(3, Ice.OptionalFormat.F8));
+ test(in.readOptional(3, OptionalFormat.F8));
test(in.readDouble() == 1.0);
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.Optional<String> p1 = new Ice.Optional<String>();
- Ice.Optional<String> p3 = new Ice.Optional<String>();
- Ice.Optional<String> p2 = initial.opString(p1, p3);
- test(!p2.isSet() && !p3.isSet());
-
- p1.set("test");
- p2 = initial.opString(p1, p3);
- test(p2.get().equals("test") && p3.get().equals("test"));
- Ice.AsyncResult r = initial.begin_opString(p1);
- p2 = initial.end_opString(p3, r);
- test(p2.get().equals("test") && p3.get().equals("test"));
- p2 = initial.opString(new Ice.Optional<String>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ Optional<String> p1 = Optional.empty();
+ Initial.OpStringResult r = initial.opString(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
+
+ p1 = Optional.of("test");
+ r = initial.opString(p1);
+ test(r.returnValue.get().equals("test") && r.p3.get().equals("test"));
+ r = initial.opStringAsync(p1).join();
+ test(r.returnValue.get().equals("test") && r.p3.get().equals("test"));
if(reqParams)
{
- p2 = initial.opStringReq(p1.get(), p3);
- test(p2.get().equals("test") && p3.get().equals("test"));
- r = initial.begin_opStringReq(p1.get());
- p2 = initial.end_opStringReq(p3, r);
- test(p2.get().equals("test") && p3.get().equals("test"));
+ Initial.OpStringReqResult rr = initial.opStringReq(p1.get());
+ test(rr.returnValue.get().equals("test") && rr.p3.get().equals("test"));
+ rr = initial.opStringReqAsync(p1.get()).join();
+ test(rr.returnValue.get().equals("test") && rr.p3.get().equals("test"));
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeOptional(2, OptionalFormat.VSize);
os.writeString(p1.get());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opStringReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opStringReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ test(in.readOptional(1, OptionalFormat.VSize));
test(in.readString().equals("test"));
- test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ test(in.readOptional(3, OptionalFormat.VSize));
test(in.readString().equals("test"));
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.Optional<MyEnum> p1 = new Ice.Optional<MyEnum>();
- Ice.Optional<MyEnum> p3 = new Ice.Optional<MyEnum>();
- Ice.Optional<MyEnum> p2 = initial.opMyEnum(p1, p3);
- test(!p2.isSet() && !p3.isSet());
-
- p1.set(MyEnum.MyEnumMember);
- p2 = initial.opMyEnum(p1, p3);
- test(p2.get() == MyEnum.MyEnumMember && p3.get() == MyEnum.MyEnumMember);
- p1.set(MyEnum.MyEnumMember);
- p2 = initial.opMyEnum(new Ice.Optional<MyEnum>((MyEnum)null), p3); // Test null enum
- test(p2.get() == MyEnum.MyEnumMember && p3.get() == MyEnum.MyEnumMember);
- Ice.AsyncResult r = initial.begin_opMyEnum(p1);
- p2 = initial.end_opMyEnum(p3, r);
- test(p2.get() == MyEnum.MyEnumMember && p3.get() == MyEnum.MyEnumMember);
- p2 = initial.opMyEnum(new Ice.Optional<MyEnum>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ Optional<MyEnum> p1 = Optional.empty();
+ Initial.OpMyEnumResult r = initial.opMyEnum(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
+
+ p1 = Optional.of(MyEnum.MyEnumMember);
+ r = initial.opMyEnum(p1);
+ test(r.returnValue.get() == MyEnum.MyEnumMember && r.p3.get() == MyEnum.MyEnumMember);
+ r = initial.opMyEnumAsync(p1).join();
+ test(r.returnValue.get() == MyEnum.MyEnumMember && r.p3.get() == MyEnum.MyEnumMember);
if(reqParams)
{
- p2 = initial.opMyEnumReq(p1.get(), p3);
- test(p2.get() == MyEnum.MyEnumMember && p3.get() == MyEnum.MyEnumMember);
- r = initial.begin_opMyEnumReq(p1.get());
- p2 = initial.end_opMyEnumReq(p3, r);
- test(p2.get() == MyEnum.MyEnumMember && p3.get() == MyEnum.MyEnumMember);
+ Initial.OpMyEnumReqResult rr = initial.opMyEnumReq(p1.get());
+ test(rr.returnValue.get() == MyEnum.MyEnumMember && rr.p3.get() == MyEnum.MyEnumMember);
+ rr = initial.opMyEnumReqAsync(p1.get()).join();
+ test(rr.returnValue.get() == MyEnum.MyEnumMember && rr.p3.get() == MyEnum.MyEnumMember);
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.Size);
+ os.writeOptional(2, OptionalFormat.Size);
MyEnum.write(os, p1.get());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opMyEnumReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opMyEnumReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.Size));
+ test(in.readOptional(1, OptionalFormat.Size));
test(MyEnum.read(in) == MyEnum.MyEnumMember);
- test(in.readOptional(3, Ice.OptionalFormat.Size));
+ test(in.readOptional(3, OptionalFormat.Size));
test(MyEnum.read(in) == MyEnum.MyEnumMember);
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.Optional<SmallStruct> p1 = new Ice.Optional<SmallStruct>();
- Ice.Optional<SmallStruct> p3 = new Ice.Optional<SmallStruct>();
- Ice.Optional<SmallStruct> p2 = initial.opSmallStruct(p1, p3);
- test(!p2.isSet() && !p3.isSet());
-
- p1.set(new SmallStruct((byte)56));
- p2 = initial.opSmallStruct(p1, p3);
- test(p2.get().m == (byte)56 && p3.get().m == (byte)56);
- p2 = initial.opSmallStruct(new Ice.Optional<SmallStruct>((SmallStruct)null), p3); // Test null struct
- test(p2.get().m == (byte)0 && p3.get().m == (byte)0);
- Ice.AsyncResult r = initial.begin_opSmallStruct(p1);
- p2 = initial.end_opSmallStruct(p3, r);
- test(p2.get().m == (byte)56 && p3.get().m == (byte)56);
- p2 = initial.opSmallStruct(new Ice.Optional<SmallStruct>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ Optional<SmallStruct> p1 = Optional.empty();
+ Initial.OpSmallStructResult r = initial.opSmallStruct(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
+
+ p1 = Optional.of(new SmallStruct((byte)56));
+ r = initial.opSmallStruct(p1);
+ test(r.returnValue.get().m == (byte)56 && r.p3.get().m == (byte)56);
+ r = initial.opSmallStruct(Optional.of(new SmallStruct()));
+ test(r.returnValue.get().m == (byte)0 && r.p3.get().m == (byte)0);
+ r = initial.opSmallStructAsync(p1).join();
+ test(r.returnValue.get().m == (byte)56 && r.p3.get().m == (byte)56);
if(reqParams)
{
- p2 = initial.opSmallStructReq(p1.get(), p3);
- test(p2.get().m == (byte)56 && p3.get().m == (byte)56);
- r = initial.begin_opSmallStructReq(p1.get());
- p2 = initial.end_opSmallStructReq(p3, r);
- test(p2.get().m == (byte)56 && p3.get().m == (byte)56);
+ Initial.OpSmallStructReqResult rr = initial.opSmallStructReq(p1.get());
+ test(rr.returnValue.get().m == (byte)56 && rr.p3.get().m == (byte)56);
+ rr = initial.opSmallStructReqAsync(p1.get()).join();
+ test(rr.returnValue.get().m == (byte)56 && rr.p3.get().m == (byte)56);
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeOptional(2, OptionalFormat.VSize);
os.writeSize(1);
SmallStruct.write(os, p1.get());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opSmallStructReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opSmallStructReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ test(in.readOptional(1, OptionalFormat.VSize));
in.skipSize();
SmallStruct f = SmallStruct.read(in, null);
test(f.m == (byte)56);
- test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ test(in.readOptional(3, OptionalFormat.VSize));
in.skipSize();
SmallStruct.read(in, f);
test(f.m == (byte)56);
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.Optional<FixedStruct> p1 = new Ice.Optional<FixedStruct>();
- Ice.Optional<FixedStruct> p3 = new Ice.Optional<FixedStruct>();
- Ice.Optional<FixedStruct> p2 = initial.opFixedStruct(p1, p3);
- test(!p2.isSet() && !p3.isSet());
-
- p1.set(new FixedStruct(56));
- p2 = initial.opFixedStruct(p1, p3);
- test(p2.get().m == 56 && p3.get().m == 56);
- Ice.AsyncResult r = initial.begin_opFixedStruct(p1);
- p2 = initial.end_opFixedStruct(p3, r);
- test(p2.get().m == 56 && p3.get().m == 56);
- p2 = initial.opFixedStruct(new Ice.Optional<FixedStruct>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ Optional<FixedStruct> p1 = Optional.empty();
+ Initial.OpFixedStructResult r = initial.opFixedStruct(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
+
+ p1 = Optional.of(new FixedStruct(56));
+ r = initial.opFixedStruct(p1);
+ test(r.returnValue.get().m == 56 && r.p3.get().m == 56);
+ r = initial.opFixedStructAsync(p1).join();
+ test(r.returnValue.get().m == 56 && r.p3.get().m == 56);
if(reqParams)
{
- p2 = initial.opFixedStructReq(p1.get(), p3);
- test(p2.get().m == 56 && p3.get().m == 56);
- r = initial.begin_opFixedStructReq(p1.get());
- p2 = initial.end_opFixedStructReq(p3, r);
- test(p2.get().m == 56 && p3.get().m == 56);
+ Initial.OpFixedStructReqResult rr = initial.opFixedStructReq(p1.get());
+ test(rr.returnValue.get().m == 56 && rr.p3.get().m == 56);
+ rr = initial.opFixedStructReqAsync(p1.get()).join();
+ test(rr.returnValue.get().m == 56 && rr.p3.get().m == 56);
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeOptional(2, OptionalFormat.VSize);
os.writeSize(4);
FixedStruct.write(os, p1.get());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opFixedStructReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opFixedStructReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ test(in.readOptional(1, OptionalFormat.VSize));
in.skipSize();
FixedStruct f = FixedStruct.read(in, null);
test(f.m == 56);
- test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ test(in.readOptional(3, OptionalFormat.VSize));
in.skipSize();
FixedStruct.read(in, f);
test(f.m == 56);
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.Optional<VarStruct> p1 = new Ice.Optional<VarStruct>();
- Ice.Optional<VarStruct> p3 = new Ice.Optional<VarStruct>();
- Ice.Optional<VarStruct> p2 = initial.opVarStruct(p1, p3);
- test(!p2.isSet() && !p3.isSet());
-
- p1.set(new VarStruct("test"));
- p2 = initial.opVarStruct(p1, p3);
- test(p2.get().m.equals("test") && p3.get().m.equals("test"));
- Ice.AsyncResult r = initial.begin_opVarStruct(p1);
- p2 = initial.end_opVarStruct(p3, r);
- test(p2.get().m.equals("test") && p3.get().m.equals("test"));
- p2 = initial.opVarStruct(new Ice.Optional<VarStruct>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ Optional<VarStruct> p1 = Optional.empty();
+ Initial.OpVarStructResult r = initial.opVarStruct(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
+
+ p1 = Optional.of(new VarStruct("test"));
+ r = initial.opVarStruct(p1);
+ test(r.returnValue.get().m.equals("test") && r.p3.get().m.equals("test"));
+ r = initial.opVarStructAsync(p1).join();
+ test(r.returnValue.get().m.equals("test") && r.p3.get().m.equals("test"));
if(reqParams)
{
- p2 = initial.opVarStructReq(p1.get(), p3);
- test(p2.get().m.equals("test") && p3.get().m.equals("test"));
- r = initial.begin_opVarStructReq(p1.get());
- p2 = initial.end_opVarStructReq(p3, r);
- test(p2.get().m.equals("test") && p3.get().m.equals("test"));
+ Initial.OpVarStructReqResult rr = initial.opVarStructReq(p1.get());
+ test(rr.returnValue.get().m.equals("test") && rr.p3.get().m.equals("test"));
+ rr = initial.opVarStructReqAsync(p1.get()).join();
+ test(rr.returnValue.get().m.equals("test") && rr.p3.get().m.equals("test"));
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.FSize);
+ os.writeOptional(2, OptionalFormat.FSize);
int pos = os.startSize();
VarStruct.write(os, p1.get());
os.endSize(pos);
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opVarStructReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opVarStructReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.FSize));
+ test(in.readOptional(1, OptionalFormat.FSize));
in.skip(4);
VarStruct v = VarStruct.read(in, null);
test(v.m.equals("test"));
- test(in.readOptional(3, Ice.OptionalFormat.FSize));
+ test(in.readOptional(3, OptionalFormat.FSize));
in.skip(4);
VarStruct.read(in, v);
test(v.m.equals("test"));
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.Optional<OneOptional> p1 = new Ice.Optional<OneOptional>();
- Ice.Optional<OneOptional> p3 = new Ice.Optional<OneOptional>();
- Ice.Optional<OneOptional> p2 = initial.opOneOptional(p1, p3);
- test(!p2.isSet() && !p3.isSet());
-
- p1.set(new OneOptional(58));
- p2 = initial.opOneOptional(p1, p3);
- test(p2.get().getA() == 58 && p3.get().getA() == 58);
- Ice.AsyncResult r = initial.begin_opOneOptional(p1);
- p2 = initial.end_opOneOptional(p3, r);
- test(p2.get().getA() == 58 && p3.get().getA() == 58);
- p2 = initial.opOneOptional(new Ice.Optional<OneOptional>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ Optional<OneOptional> p1 = Optional.empty();
+ Initial.OpOneOptionalResult r = initial.opOneOptional(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
+
+ p1 = Optional.of(new OneOptional(58));
+ r = initial.opOneOptional(p1);
+ test(r.returnValue.get().getA() == 58 && r.p3.get().getA() == 58);
+ r = initial.opOneOptionalAsync(p1).join();
+ test(r.returnValue.get().getA() == 58 && r.p3.get().getA() == 58);
if(reqParams)
{
- p2 = initial.opOneOptionalReq(p1.get(), p3);
- test(p2.get().getA() == 58 && p3.get().getA() == 58);
- r = initial.begin_opOneOptionalReq(p1.get());
- p2 = initial.end_opOneOptionalReq(p3, r);
- test(p2.get().getA() == 58 && p3.get().getA() == 58);
+ Initial.OpOneOptionalReqResult rr = initial.opOneOptionalReq(p1.get());
+ test(rr.returnValue.get().getA() == 58 && rr.p3.get().getA() == 58);
+ rr = initial.opOneOptionalReqAsync(p1.get()).join();
+ test(rr.returnValue.get().getA() == 58 && rr.p3.get().getA() == 58);
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.Class);
+ os.writeOptional(2, OptionalFormat.Class);
os.writeValue(p1.get());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opOneOptionalReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opOneOptionalReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.Class));
+ test(in.readOptional(1, OptionalFormat.Class));
ReadValueCallbackI p2cb = new ReadValueCallbackI();
in.readValue(p2cb);
- test(in.readOptional(3, Ice.OptionalFormat.Class));
+ test(in.readOptional(3, OptionalFormat.Class));
ReadValueCallbackI p3cb = new ReadValueCallbackI();
in.readValue(p3cb);
in.endEncapsulation();
test(((OneOptional)p2cb.obj).getA() == 58 && ((OneOptional)p3cb.obj).getA() == 58);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.Optional<OneOptionalPrx> p1 = new Ice.Optional<OneOptionalPrx>();
- Ice.Optional<OneOptionalPrx> p3 = new Ice.Optional<OneOptionalPrx>();
- Ice.Optional<OneOptionalPrx> p2 = initial.opOneOptionalProxy(p1, p3);
- test(!p2.isSet() && !p3.isSet());
-
- p1.set(OneOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test")));
- p2 = initial.opOneOptionalProxy(p1, p3);
- test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
- Ice.AsyncResult r = initial.begin_opOneOptionalProxy(p1);
- p2 = initial.end_opOneOptionalProxy(p3, r);
- test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
- p2 = initial.opOneOptionalProxy(new Ice.Optional<OneOptionalPrx>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ Optional<com.zeroc.Ice.ObjectPrx> p1 = Optional.empty();
+ Initial.OpOneOptionalProxyResult r = initial.opOneOptionalProxy(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
+
+ p1 = Optional.of(communicator.stringToProxy("test"));
+ r = initial.opOneOptionalProxy(p1);
+ test(r.returnValue.get().equals(p1.get()) && r.p3.get().equals(p1.get()));
+ r = initial.opOneOptionalProxyAsync(p1).join();
+ test(r.returnValue.get().equals(p1.get()) && r.p3.get().equals(p1.get()));
if(reqParams)
{
- p2 = initial.opOneOptionalProxyReq(p1.get(), p3);
- test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
- r = initial.begin_opOneOptionalProxyReq(p1.get());
- p2 = initial.end_opOneOptionalProxyReq(p3, r);
- test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
+ Initial.OpOneOptionalProxyReqResult rr = initial.opOneOptionalProxyReq(p1.get());
+ test(rr.returnValue.get().equals(p1.get()) && rr.p3.get().equals(p1.get()));
+ rr = initial.opOneOptionalProxyReqAsync(p1.get()).join();
+ test(rr.returnValue.get().equals(p1.get()) && rr.p3.get().equals(p1.get()));
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.FSize);
+ os.writeOptional(2, OptionalFormat.FSize);
int pos = os.startSize();
os.writeProxy(p1.get());
os.endSize(pos);
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opOneOptionalProxyReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opOneOptionalProxyReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.FSize));
+ test(in.readOptional(1, OptionalFormat.FSize));
in.skip(4);
test(in.readProxy().equals(p1.get()));
- test(in.readOptional(3, Ice.OptionalFormat.FSize));
+ test(in.readOptional(3, OptionalFormat.FSize));
in.skip(4);
test(in.readProxy().equals(p1.get()));
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
@@ -1272,440 +1208,427 @@ public class AllTests
out.print("testing optional parameters and sequences... ");
out.flush();
{
- Ice.Optional<byte[]> p1 = new Ice.Optional<byte[]>();
- Ice.Optional<byte[]> p3 = new Ice.Optional<byte[]>();
- Ice.Optional<byte[]> p2 = initial.opByteSeq(p1, p3);
- test(!p2.isSet() && !p3.isSet());
+ Optional<byte[]> p1 = Optional.empty();
+ Initial.OpByteSeqResult r = initial.opByteSeq(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
- p1.set(new byte[100]);
+ p1 = Optional.of(new byte[100]);
java.util.Arrays.fill(p1.get(), (byte)56);
- p2 = initial.opByteSeq(p1, p3);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- Ice.AsyncResult r = initial.begin_opByteSeq(p1);
- p2 = initial.end_opByteSeq(p3, r);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- p2 = initial.opByteSeq(new Ice.Optional<byte[]>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ r = initial.opByteSeq(p1);
+ test(java.util.Arrays.equals(r.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(r.p3.get(), p1.get()));
+ r = initial.opByteSeqAsync(p1).join();
+ test(java.util.Arrays.equals(r.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(r.p3.get(), p1.get()));
if(reqParams)
{
- p2 = initial.opByteSeqReq(p1.get(), p3);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- r = initial.begin_opByteSeqReq(p1.get());
- p2 = initial.end_opByteSeqReq(p3, r);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ Initial.OpByteSeqReqResult rr = initial.opByteSeqReq(p1.get());
+ test(java.util.Arrays.equals(rr.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(rr.p3.get(), p1.get()));
+ rr = initial.opByteSeqReqAsync(p1.get()).join();
+ test(java.util.Arrays.equals(rr.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(rr.p3.get(), p1.get()));
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeOptional(2, OptionalFormat.VSize);
os.writeByteSeq(p1.get());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opByteSeqReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opByteSeqReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ test(in.readOptional(1, OptionalFormat.VSize));
test(java.util.Arrays.equals(in.readByteSeq(), p1.get()));
- test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ test(in.readOptional(3, OptionalFormat.VSize));
test(java.util.Arrays.equals(in.readByteSeq(), p1.get()));
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.Optional<boolean[]> p1 = new Ice.Optional<boolean[]>();
- Ice.Optional<boolean[]> p3 = new Ice.Optional<boolean[]>();
- Ice.Optional<boolean[]> p2 = initial.opBoolSeq(p1, p3);
- test(!p2.isSet() && !p3.isSet());
-
- p1.set(new boolean[100]);
- p2 = initial.opBoolSeq(p1, p3);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- Ice.AsyncResult r = initial.begin_opBoolSeq(p1);
- p2 = initial.end_opBoolSeq(p3, r);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- p2 = initial.opBoolSeq(new Ice.Optional<boolean[]>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ Optional<boolean[]> p1 = Optional.empty();
+ Initial.OpBoolSeqResult r = initial.opBoolSeq(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
+
+ p1 = Optional.of(new boolean[100]);
+ r = initial.opBoolSeq(p1);
+ test(java.util.Arrays.equals(r.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(r.p3.get(), p1.get()));
+ r = initial.opBoolSeqAsync(p1).join();
+ test(java.util.Arrays.equals(r.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(r.p3.get(), p1.get()));
if(reqParams)
{
- p2 = initial.opBoolSeqReq(p1.get(), p3);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- r = initial.begin_opBoolSeqReq(p1.get());
- p2 = initial.end_opBoolSeqReq(p3, r);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ Initial.OpBoolSeqReqResult rr = initial.opBoolSeqReq(p1.get());
+ test(java.util.Arrays.equals(rr.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(rr.p3.get(), p1.get()));
+ rr = initial.opBoolSeqReqAsync(p1.get()).join();
+ test(java.util.Arrays.equals(rr.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(rr.p3.get(), p1.get()));
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeOptional(2, OptionalFormat.VSize);
os.writeBoolSeq(p1.get());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opBoolSeqReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opBoolSeqReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ test(in.readOptional(1, OptionalFormat.VSize));
test(java.util.Arrays.equals(in.readBoolSeq(), p1.get()));
- test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ test(in.readOptional(3, OptionalFormat.VSize));
test(java.util.Arrays.equals(in.readBoolSeq(), p1.get()));
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.Optional<short[]> p1 = new Ice.Optional<short[]>();
- Ice.Optional<short[]> p3 = new Ice.Optional<short[]>();
- Ice.Optional<short[]> p2 = initial.opShortSeq(p1, p3);
- test(!p2.isSet() && !p3.isSet());
+ Optional<short[]> p1 = Optional.empty();
+ Initial.OpShortSeqResult r = initial.opShortSeq(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
- p1.set(new short[100]);
+ p1 = Optional.of(new short[100]);
java.util.Arrays.fill(p1.get(), (short)56);
- p2 = initial.opShortSeq(p1, p3);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- Ice.AsyncResult r = initial.begin_opShortSeq(p1);
- p2 = initial.end_opShortSeq(p3, r);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- p2 = initial.opShortSeq(new Ice.Optional<short[]>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ r = initial.opShortSeq(p1);
+ test(java.util.Arrays.equals(r.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(r.p3.get(), p1.get()));
+ r = initial.opShortSeqAsync(p1).join();
+ test(java.util.Arrays.equals(r.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(r.p3.get(), p1.get()));
if(reqParams)
{
- p2 = initial.opShortSeqReq(p1.get(), p3);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- r = initial.begin_opShortSeqReq(p1.get());
- p2 = initial.end_opShortSeqReq(p3, r);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ Initial.OpShortSeqReqResult rr = initial.opShortSeqReq(p1.get());
+ test(java.util.Arrays.equals(rr.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(rr.p3.get(), p1.get()));
+ rr = initial.opShortSeqReqAsync(p1.get()).join();
+ test(java.util.Arrays.equals(rr.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(rr.p3.get(), p1.get()));
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeOptional(2, OptionalFormat.VSize);
os.writeSize(p1.get().length * 2 + (p1.get().length > 254 ? 5 : 1));
os.writeShortSeq(p1.get());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opShortSeqReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opShortSeqReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ test(in.readOptional(1, OptionalFormat.VSize));
in.skipSize();
test(java.util.Arrays.equals(in.readShortSeq(), p1.get()));
- test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ test(in.readOptional(3, OptionalFormat.VSize));
in.skipSize();
test(java.util.Arrays.equals(in.readShortSeq(), p1.get()));
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.Optional<int[]> p1 = new Ice.Optional<int[]>();
- Ice.Optional<int[]> p3 = new Ice.Optional<int[]>();
- Ice.Optional<int[]> p2 = initial.opIntSeq(p1, p3);
- test(!p2.isSet() && !p3.isSet());
+ Optional<int[]> p1 = Optional.empty();
+ Initial.OpIntSeqResult r = initial.opIntSeq(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
- p1.set(new int[100]);
+ p1 = Optional.of(new int[100]);
java.util.Arrays.fill(p1.get(), 56);
- p2 = initial.opIntSeq(p1, p3);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- Ice.AsyncResult r = initial.begin_opIntSeq(p1);
- p2 = initial.end_opIntSeq(p3, r);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- p2 = initial.opIntSeq(new Ice.Optional<int[]>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ r = initial.opIntSeq(p1);
+ test(java.util.Arrays.equals(r.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(r.p3.get(), p1.get()));
+ r = initial.opIntSeqAsync(p1).join();
+ test(java.util.Arrays.equals(r.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(r.p3.get(), p1.get()));
if(reqParams)
{
- p2 = initial.opIntSeqReq(p1.get(), p3);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- r = initial.begin_opIntSeqReq(p1.get());
- p2 = initial.end_opIntSeqReq(p3, r);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ Initial.OpIntSeqReqResult rr = initial.opIntSeqReq(p1.get());
+ test(java.util.Arrays.equals(rr.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(rr.p3.get(), p1.get()));
+ rr = initial.opIntSeqReqAsync(p1.get()).join();
+ test(java.util.Arrays.equals(rr.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(rr.p3.get(), p1.get()));
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeOptional(2, OptionalFormat.VSize);
os.writeSize(p1.get().length * 4 + (p1.get().length > 254 ? 5 : 1));
os.writeIntSeq(p1.get());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opIntSeqReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opIntSeqReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ test(in.readOptional(1, OptionalFormat.VSize));
in.skipSize();
test(java.util.Arrays.equals(in.readIntSeq(), p1.get()));
- test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ test(in.readOptional(3, OptionalFormat.VSize));
in.skipSize();
test(java.util.Arrays.equals(in.readIntSeq(), p1.get()));
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.Optional<long[]> p1 = new Ice.Optional<long[]>();
- Ice.Optional<long[]> p3 = new Ice.Optional<long[]>();
- Ice.Optional<long[]> p2 = initial.opLongSeq(p1, p3);
- test(!p2.isSet() && !p3.isSet());
+ Optional<long[]> p1 = Optional.empty();
+ Initial.OpLongSeqResult r = initial.opLongSeq(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
- p1.set(new long[100]);
+ p1 = Optional.of(new long[100]);
java.util.Arrays.fill(p1.get(), 56);
- p2 = initial.opLongSeq(p1, p3);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- Ice.AsyncResult r = initial.begin_opLongSeq(p1);
- p2 = initial.end_opLongSeq(p3, r);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- p2 = initial.opLongSeq(new Ice.Optional<long[]>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ r = initial.opLongSeq(p1);
+ test(java.util.Arrays.equals(r.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(r.p3.get(), p1.get()));
+ r = initial.opLongSeqAsync(p1).join();
+ test(java.util.Arrays.equals(r.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(r.p3.get(), p1.get()));
if(reqParams)
{
- p2 = initial.opLongSeqReq(p1.get(), p3);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- r = initial.begin_opLongSeqReq(p1.get());
- p2 = initial.end_opLongSeqReq(p3, r);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ Initial.OpLongSeqReqResult rr = initial.opLongSeqReq(p1.get());
+ test(java.util.Arrays.equals(rr.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(rr.p3.get(), p1.get()));
+ rr = initial.opLongSeqReqAsync(p1.get()).join();
+ test(java.util.Arrays.equals(rr.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(rr.p3.get(), p1.get()));
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeOptional(2, OptionalFormat.VSize);
os.writeSize(p1.get().length * 8 + (p1.get().length > 254 ? 5 : 1));
os.writeLongSeq(p1.get());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opLongSeqReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opLongSeqReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ test(in.readOptional(1, OptionalFormat.VSize));
in.skipSize();
test(java.util.Arrays.equals(in.readLongSeq(), p1.get()));
- test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ test(in.readOptional(3, OptionalFormat.VSize));
in.skipSize();
test(java.util.Arrays.equals(in.readLongSeq(), p1.get()));
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.Optional<float[]> p1 = new Ice.Optional<float[]>();
- Ice.Optional<float[]> p3 = new Ice.Optional<float[]>();
- Ice.Optional<float[]> p2 = initial.opFloatSeq(p1, p3);
- test(!p2.isSet() && !p3.isSet());
+ Optional<float[]> p1 = Optional.empty();
+ Initial.OpFloatSeqResult r = initial.opFloatSeq(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
- p1.set(new float[100]);
+ p1 = Optional.of(new float[100]);
java.util.Arrays.fill(p1.get(), (float)1.0);
- p2 = initial.opFloatSeq(p1, p3);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- Ice.AsyncResult r = initial.begin_opFloatSeq(p1);
- p2 = initial.end_opFloatSeq(p3, r);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- p2 = initial.opFloatSeq(new Ice.Optional<float[]>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ r = initial.opFloatSeq(p1);
+ test(java.util.Arrays.equals(r.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(r.p3.get(), p1.get()));
+ r = initial.opFloatSeqAsync(p1).join();
+ test(java.util.Arrays.equals(r.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(r.p3.get(), p1.get()));
if(reqParams)
{
- p2 = initial.opFloatSeqReq(p1.get(), p3);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- r = initial.begin_opFloatSeqReq(p1.get());
- p2 = initial.end_opFloatSeqReq(p3, r);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ Initial.OpFloatSeqReqResult rr = initial.opFloatSeqReq(p1.get());
+ test(java.util.Arrays.equals(rr.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(rr.p3.get(), p1.get()));
+ rr = initial.opFloatSeqReqAsync(p1.get()).join();
+ test(java.util.Arrays.equals(rr.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(rr.p3.get(), p1.get()));
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeOptional(2, OptionalFormat.VSize);
os.writeSize(p1.get().length * 4 + (p1.get().length > 254 ? 5 : 1));
os.writeFloatSeq(p1.get());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opFloatSeqReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opFloatSeqReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ test(in.readOptional(1, OptionalFormat.VSize));
in.skipSize();
test(java.util.Arrays.equals(in.readFloatSeq(), p1.get()));
- test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ test(in.readOptional(3, OptionalFormat.VSize));
in.skipSize();
test(java.util.Arrays.equals(in.readFloatSeq(), p1.get()));
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.Optional<double[]> p1 = new Ice.Optional<double[]>();
- Ice.Optional<double[]> p3 = new Ice.Optional<double[]>();
- Ice.Optional<double[]> p2 = initial.opDoubleSeq(p1, p3);
- test(!p2.isSet() && !p3.isSet());
+ Optional<double[]> p1 = Optional.empty();
+ Initial.OpDoubleSeqResult r = initial.opDoubleSeq(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
- p1.set(new double[100]);
+ p1 = Optional.of(new double[100]);
java.util.Arrays.fill(p1.get(), 1.0);
- p2 = initial.opDoubleSeq(p1, p3);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- Ice.AsyncResult r = initial.begin_opDoubleSeq(p1);
- p2 = initial.end_opDoubleSeq(p3, r);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- p2 = initial.opDoubleSeq(new Ice.Optional<double[]>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ r = initial.opDoubleSeq(p1);
+ test(java.util.Arrays.equals(r.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(r.p3.get(), p1.get()));
+ r = initial.opDoubleSeqAsync(p1).join();
+ test(java.util.Arrays.equals(r.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(r.p3.get(), p1.get()));
if(reqParams)
{
- p2 = initial.opDoubleSeqReq(p1.get(), p3);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- r = initial.begin_opDoubleSeqReq(p1.get());
- p2 = initial.end_opDoubleSeqReq(p3, r);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ Initial.OpDoubleSeqReqResult rr = initial.opDoubleSeqReq(p1.get());
+ test(java.util.Arrays.equals(rr.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(rr.p3.get(), p1.get()));
+ rr = initial.opDoubleSeqReqAsync(p1.get()).join();
+ test(java.util.Arrays.equals(rr.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(rr.p3.get(), p1.get()));
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeOptional(2, OptionalFormat.VSize);
os.writeSize(p1.get().length * 8 + (p1.get().length > 254 ? 5 : 1));
os.writeDoubleSeq(p1.get());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opDoubleSeqReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opDoubleSeqReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ test(in.readOptional(1, OptionalFormat.VSize));
in.skipSize();
test(java.util.Arrays.equals(in.readDoubleSeq(), p1.get()));
- test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ test(in.readOptional(3, OptionalFormat.VSize));
in.skipSize();
test(java.util.Arrays.equals(in.readDoubleSeq(), p1.get()));
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.Optional<String[]> p1 = new Ice.Optional<String[]>();
- Ice.Optional<String[]> p3 = new Ice.Optional<String[]>();
- Ice.Optional<String[]> p2 = initial.opStringSeq(p1, p3);
- test(!p2.isSet() && !p3.isSet());
+ Optional<String[]> p1 = Optional.empty();
+ Initial.OpStringSeqResult r = initial.opStringSeq(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
- p1.set(new String[10]);
+ p1 = Optional.of(new String[10]);
java.util.Arrays.fill(p1.get(), "test1");
- p2 = initial.opStringSeq(p1, p3);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- Ice.AsyncResult r = initial.begin_opStringSeq(p1);
- p2 = initial.end_opStringSeq(p3, r);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- p2 = initial.opStringSeq(new Ice.Optional<String[]>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ r = initial.opStringSeq(p1);
+ test(java.util.Arrays.equals(r.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(r.p3.get(), p1.get()));
+ r = initial.opStringSeqAsync(p1).join();
+ test(java.util.Arrays.equals(r.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(r.p3.get(), p1.get()));
if(reqParams)
{
- p2 = initial.opStringSeqReq(p1.get(), p3);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- r = initial.begin_opStringSeqReq(p1.get());
- p2 = initial.end_opStringSeqReq(p3, r);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
+ Initial.OpStringSeqReqResult rr = initial.opStringSeqReq(p1.get());
+ test(java.util.Arrays.equals(rr.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(rr.p3.get(), p1.get()));
+ rr = initial.opStringSeqReqAsync(p1.get()).join();
+ test(java.util.Arrays.equals(rr.returnValue.get(), p1.get()) &&
+ java.util.Arrays.equals(rr.p3.get(), p1.get()));
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.FSize);
+ os.writeOptional(2, OptionalFormat.FSize);
int pos = os.startSize();
os.writeStringSeq(p1.get());
os.endSize(pos);
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opStringSeqReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opStringSeqReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.FSize));
+ test(in.readOptional(1, OptionalFormat.FSize));
in.skip(4);
test(java.util.Arrays.equals(in.readStringSeq(), p1.get()));
- test(in.readOptional(3, Ice.OptionalFormat.FSize));
+ test(in.readOptional(3, OptionalFormat.FSize));
in.skip(4);
test(java.util.Arrays.equals(in.readStringSeq(), p1.get()));
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.Optional<SmallStruct[]> p1 = new Ice.Optional<SmallStruct[]>();
- Ice.Optional<SmallStruct[]> p3 = new Ice.Optional<SmallStruct[]>();
- Ice.Optional<SmallStruct[]> p2 = initial.opSmallStructSeq(p1, p3);
- test(!p2.isSet() && !p3.isSet());
+ Optional<SmallStruct[]> p1 = Optional.empty();
+ Initial.OpSmallStructSeqResult r = initial.opSmallStructSeq(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
- p1.set(new SmallStruct[10]);
+ p1 = Optional.of(new SmallStruct[10]);
for(int i = 0; i < p1.get().length; ++i)
{
p1.get()[i] = new SmallStruct();
}
- p2 = initial.opSmallStructSeq(p1, p3);
+ r = initial.opSmallStructSeq(p1);
for(int i = 0; i < p1.get().length; ++i)
{
- test(p2.get()[i].equals(p1.get()[i]));
+ test(r.p3.get()[i].equals(p1.get()[i]));
}
- Ice.AsyncResult r = initial.begin_opSmallStructSeq(p1);
- p2 = initial.end_opSmallStructSeq(p3, r);
+ r = initial.opSmallStructSeqAsync(p1).join();
for(int i = 0; i < p1.get().length; ++i)
{
- test(p2.get()[i].equals(p1.get()[i]));
+ test(r.returnValue.get()[i].equals(p1.get()[i]));
}
- p2 = initial.opSmallStructSeq(new Ice.Optional<SmallStruct[]>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
if(reqParams)
{
- p2 = initial.opSmallStructSeqReq(p1.get(), p3);
+ Initial.OpSmallStructSeqReqResult rr = initial.opSmallStructSeqReq(p1.get());
for(int i = 0; i < p1.get().length; ++i)
{
- test(p2.get()[i].equals(p1.get()[i]));
+ test(rr.returnValue.get()[i].equals(p1.get()[i]));
}
- r = initial.begin_opSmallStructSeqReq(p1.get());
- p2 = initial.end_opSmallStructSeqReq(p3, r);
+ rr = initial.opSmallStructSeqReqAsync(p1.get()).join();
for(int i = 0; i < p1.get().length; ++i)
{
- test(p2.get()[i].equals(p1.get()[i]));
+ test(rr.returnValue.get()[i].equals(p1.get()[i]));
}
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeOptional(2, OptionalFormat.VSize);
os.writeSize(p1.get().length + (p1.get().length > 254 ? 5 : 1));
SmallStructSeqHelper.write(os, p1.get());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opSmallStructSeqReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opSmallStructSeqReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ test(in.readOptional(1, OptionalFormat.VSize));
in.skipSize();
SmallStruct[] arr = SmallStructSeqHelper.read(in);
for(int i = 0; i < p1.get().length; ++i)
{
test(arr[i].equals(p1.get()[i]));
}
- test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ test(in.readOptional(3, OptionalFormat.VSize));
in.skipSize();
arr = SmallStructSeqHelper.read(in);
for(int i = 0; i < p1.get().length; ++i)
@@ -1714,122 +1637,112 @@ public class AllTests
}
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.Optional<java.util.List<SmallStruct>> p1 = new Ice.Optional<java.util.List<SmallStruct>>();
- Ice.Optional<java.util.List<SmallStruct>> p3 = new Ice.Optional<java.util.List<SmallStruct>>();
- Ice.Optional<java.util.List<SmallStruct>> p2 = initial.opSmallStructList(p1, p3);
- test(!p2.isSet() && !p3.isSet());
+ Optional<java.util.List<SmallStruct>> p1 = Optional.empty();
+ Initial.OpSmallStructListResult r = initial.opSmallStructList(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
- p1.set(new java.util.ArrayList<SmallStruct>());
+ p1 = Optional.of(new java.util.ArrayList<>());
for(int i = 0; i < 10; ++i)
{
p1.get().add(new SmallStruct());
}
- p2 = initial.opSmallStructList(p1, p3);
- test(p2.get().equals(p1.get()));
- Ice.AsyncResult r = initial.begin_opSmallStructList(p1);
- p2 = initial.end_opSmallStructList(p3, r);
- test(p2.get().equals(p1.get()));
- p2 = initial.opSmallStructList(new Ice.Optional<java.util.List<SmallStruct>>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ r = initial.opSmallStructList(p1);
+ test(r.returnValue.get().equals(p1.get()));
+ r = initial.opSmallStructListAsync(p1).join();
+ test(r.returnValue.get().equals(p1.get()));
if(reqParams)
{
- p2 = initial.opSmallStructListReq(p1.get(), p3);
- test(p2.get().equals(p1.get()));
- r = initial.begin_opSmallStructListReq(p1.get());
- p2 = initial.end_opSmallStructListReq(p3, r);
- test(p2.get().equals(p1.get()));
+ Initial.OpSmallStructListReqResult rr = initial.opSmallStructListReq(p1.get());
+ test(rr.returnValue.get().equals(p1.get()));
+ rr = initial.opSmallStructListReqAsync(p1.get()).join();
+ test(rr.returnValue.get().equals(p1.get()));
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeOptional(2, OptionalFormat.VSize);
os.writeSize(p1.get().size() + (p1.get().size() > 254 ? 5 : 1));
SmallStructListHelper.write(os, p1.get());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opSmallStructListReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opSmallStructListReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ test(in.readOptional(1, OptionalFormat.VSize));
in.skipSize();
java.util.List<SmallStruct> arr = SmallStructListHelper.read(in);
test(arr.equals(p1.get()));
- test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ test(in.readOptional(3, OptionalFormat.VSize));
in.skipSize();
arr = SmallStructListHelper.read(in);
test(arr.equals(p1.get()));
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.Optional<FixedStruct[]> p1 = new Ice.Optional<FixedStruct[]>();
- Ice.Optional<FixedStruct[]> p3 = new Ice.Optional<FixedStruct[]>();
- Ice.Optional<FixedStruct[]> p2 = initial.opFixedStructSeq(p1, p3);
- test(!p2.isSet() && !p3.isSet());
+ Optional<FixedStruct[]> p1 = Optional.empty();
+ Initial.OpFixedStructSeqResult r = initial.opFixedStructSeq(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
- p1.set(new FixedStruct[10]);
+ p1 = Optional.of(new FixedStruct[10]);
for(int i = 0; i < p1.get().length; ++i)
{
p1.get()[i] = new FixedStruct();
}
- p2 = initial.opFixedStructSeq(p1, p3);
+ r = initial.opFixedStructSeq(p1);
for(int i = 0; i < p1.get().length; ++i)
{
- test(p2.get()[i].equals(p1.get()[i]));
+ test(r.returnValue.get()[i].equals(p1.get()[i]));
}
- Ice.AsyncResult r = initial.begin_opFixedStructSeq(p1);
- p2 = initial.end_opFixedStructSeq(p3, r);
+ r = initial.opFixedStructSeqAsync(p1).join();
for(int i = 0; i < p1.get().length; ++i)
{
- test(p2.get()[i].equals(p1.get()[i]));
+ test(r.returnValue.get()[i].equals(p1.get()[i]));
}
- p2 = initial.opFixedStructSeq(new Ice.Optional<FixedStruct[]>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
if(reqParams)
{
- p2 = initial.opFixedStructSeqReq(p1.get(), p3);
+ Initial.OpFixedStructSeqReqResult rr = initial.opFixedStructSeqReq(p1.get());
for(int i = 0; i < p1.get().length; ++i)
{
- test(p2.get()[i].equals(p1.get()[i]));
+ test(rr.returnValue.get()[i].equals(p1.get()[i]));
}
- r = initial.begin_opFixedStructSeqReq(p1.get());
- p2 = initial.end_opFixedStructSeqReq(p3, r);
+ rr = initial.opFixedStructSeqReqAsync(p1.get()).join();
for(int i = 0; i < p1.get().length; ++i)
{
- test(p2.get()[i].equals(p1.get()[i]));
+ test(rr.returnValue.get()[i].equals(p1.get()[i]));
}
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeOptional(2, OptionalFormat.VSize);
os.writeSize(p1.get().length * 4 + (p1.get().length > 254 ? 5 : 1));
FixedStructSeqHelper.write(os, p1.get());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opFixedStructSeqReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opFixedStructSeqReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ test(in.readOptional(1, OptionalFormat.VSize));
in.skipSize();
FixedStruct[] arr = FixedStructSeqHelper.read(in);
for(int i = 0; i < p1.get().length; ++i)
{
test(arr[i].equals(p1.get()[i]));
}
- test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ test(in.readOptional(3, OptionalFormat.VSize));
in.skipSize();
arr = FixedStructSeqHelper.read(in);
for(int i = 0; i < p1.get().length; ++i)
@@ -1838,123 +1751,113 @@ public class AllTests
}
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.Optional<java.util.List<FixedStruct>> p1 = new Ice.Optional<java.util.List<FixedStruct>>();
- Ice.Optional<java.util.List<FixedStruct>> p3 = new Ice.Optional<java.util.List<FixedStruct>>();
- Ice.Optional<java.util.List<FixedStruct>> p2 = initial.opFixedStructList(p1, p3);
- test(!p2.isSet() && !p3.isSet());
+ Optional<java.util.List<FixedStruct>> p1 = Optional.empty();
+ Initial.OpFixedStructListResult r = initial.opFixedStructList(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
- p1.set(new java.util.ArrayList<FixedStruct>());
+ p1 = Optional.of(new java.util.ArrayList<>());
for(int i = 0; i < 10; ++i)
{
p1.get().add(new FixedStruct());
}
- p2 = initial.opFixedStructList(p1, p3);
- test(p2.get().equals(p1.get()));
- Ice.AsyncResult r = initial.begin_opFixedStructList(p1);
- p2 = initial.end_opFixedStructList(p3, r);
- test(p2.get().equals(p1.get()));
- p2 = initial.opFixedStructList(new Ice.Optional<java.util.List<FixedStruct>>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ r = initial.opFixedStructList(p1);
+ test(r.returnValue.get().equals(p1.get()));
+ r = initial.opFixedStructListAsync(p1).join();
+ test(r.returnValue.get().equals(p1.get()));
if(reqParams)
{
- p2 = initial.opFixedStructListReq(p1.get(), p3);
- test(p2.get().equals(p1.get()));
- r = initial.begin_opFixedStructListReq(p1.get());
- p2 = initial.end_opFixedStructListReq(p3, r);
- test(p2.get().equals(p1.get()));
+ Initial.OpFixedStructListReqResult rr = initial.opFixedStructListReq(p1.get());
+ test(rr.returnValue.get().equals(p1.get()));
+ rr = initial.opFixedStructListReqAsync(p1.get()).join();
+ test(rr.returnValue.get().equals(p1.get()));
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeOptional(2, OptionalFormat.VSize);
os.writeSize(p1.get().size() * 4 + (p1.get().size() > 254 ? 5 : 1));
FixedStructListHelper.write(os, p1.get());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opFixedStructListReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opFixedStructListReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ test(in.readOptional(1, OptionalFormat.VSize));
in.skipSize();
java.util.List<FixedStruct> arr = FixedStructListHelper.read(in);
test(arr.equals(p1.get()));
- test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ test(in.readOptional(3, OptionalFormat.VSize));
in.skipSize();
arr = FixedStructListHelper.read(in);
test(arr.equals(p1.get()));
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.Optional<VarStruct[]> p1 = new Ice.Optional<VarStruct[]>();
- Ice.Optional<VarStruct[]> p3 = new Ice.Optional<VarStruct[]>();
- Ice.Optional<VarStruct[]> p2 = initial.opVarStructSeq(p1, p3);
- test(!p2.isSet() && !p3.isSet());
+ Optional<VarStruct[]> p1 = Optional.empty();
+ Initial.OpVarStructSeqResult r = initial.opVarStructSeq(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
- p1.set(new VarStruct[10]);
+ p1 = Optional.of(new VarStruct[10]);
for(int i = 0; i < p1.get().length; ++i)
{
p1.get()[i] = new VarStruct("");
}
- p2 = initial.opVarStructSeq(p1, p3);
+ r = initial.opVarStructSeq(p1);
for(int i = 0; i < p1.get().length; ++i)
{
- test(p2.get()[i].equals(p1.get()[i]));
+ test(r.returnValue.get()[i].equals(p1.get()[i]));
}
- Ice.AsyncResult r = initial.begin_opVarStructSeq(p1);
- p2 = initial.end_opVarStructSeq(p3, r);
+ r = initial.opVarStructSeqAsync(p1).join();
for(int i = 0; i < p1.get().length; ++i)
{
- test(p2.get()[i].equals(p1.get()[i]));
+ test(r.returnValue.get()[i].equals(p1.get()[i]));
}
- p2 = initial.opVarStructSeq(new Ice.Optional<VarStruct[]>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
if(reqParams)
{
- p2 = initial.opVarStructSeqReq(p1.get(), p3);
+ Initial.OpVarStructSeqReqResult rr = initial.opVarStructSeqReq(p1.get());
for(int i = 0; i < p1.get().length; ++i)
{
- test(p2.get()[i].equals(p1.get()[i]));
+ test(rr.returnValue.get()[i].equals(p1.get()[i]));
}
- r = initial.begin_opVarStructSeqReq(p1.get());
- p2 = initial.end_opVarStructSeqReq(p3, r);
+ rr = initial.opVarStructSeqReqAsync(p1.get()).join();
for(int i = 0; i < p1.get().length; ++i)
{
- test(p2.get()[i].equals(p1.get()[i]));
+ test(rr.returnValue.get()[i].equals(p1.get()[i]));
}
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.FSize);
+ os.writeOptional(2, OptionalFormat.FSize);
int pos = os.startSize();
VarStructSeqHelper.write(os, p1.get());
os.endSize(pos);
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opVarStructSeqReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opVarStructSeqReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.FSize));
+ test(in.readOptional(1, OptionalFormat.FSize));
in.skip(4);
VarStruct[] arr = VarStructSeqHelper.read(in);
for(int i = 0; i < p1.get().length; ++i)
{
test(arr[i].equals(p1.get()[i]));
}
- test(in.readOptional(3, Ice.OptionalFormat.FSize));
+ test(in.readOptional(3, OptionalFormat.FSize));
in.skip(4);
arr = VarStructSeqHelper.read(in);
for(int i = 0; i < p1.get().length; ++i)
@@ -1963,7 +1866,7 @@ public class AllTests
}
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
@@ -1971,46 +1874,41 @@ public class AllTests
if(supportsJavaSerializable)
{
- Ice.Optional<SerializableClass> p1 = new Ice.Optional<SerializableClass>();
- Ice.Optional<SerializableClass> p3 = new Ice.Optional<SerializableClass>();
- Ice.Optional<SerializableClass> p2 = initial.opSerializable(p1, p3);
- test(!p2.isSet() && !p3.isSet());
-
- p1.set(new SerializableClass(58));
- p2 = initial.opSerializable(p1, p3);
- test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
- Ice.AsyncResult r = initial.begin_opSerializable(p1);
- p2 = initial.end_opSerializable(p3, r);
- test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
- p2 = initial.opSerializable(new Ice.Optional<SerializableClass>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ Optional<SerializableClass> p1 = Optional.empty();
+ Initial.OpSerializableResult r = initial.opSerializable(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
+
+ p1 = Optional.of(new SerializableClass(58));
+ r = initial.opSerializable(p1);
+ test(r.returnValue.get().equals(p1.get()) && r.p3.get().equals(p1.get()));
+ r = initial.opSerializableAsync(p1).join();
+ test(r.returnValue.get().equals(p1.get()) && r.p3.get().equals(p1.get()));
if(reqParams)
{
- p2 = initial.opSerializableReq(p1.get(), p3);
- test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
- r = initial.begin_opSerializableReq(p1.get());
- p2 = initial.end_opSerializableReq(p3, r);
- test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
+ Initial.OpSerializableReqResult rr = initial.opSerializableReq(p1.get());
+ test(rr.returnValue.get().equals(p1.get()) && rr.p3.get().equals(p1.get()));
+ rr = initial.opSerializableReqAsync(p1.get()).join();
+ test(rr.returnValue.get().equals(p1.get()) && rr.p3.get().equals(p1.get()));
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeOptional(2, OptionalFormat.VSize);
os.writeSerializable(p1.get());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opSerializableReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opSerializableReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ test(in.readOptional(1, OptionalFormat.VSize));
SerializableClass sc = SerializableHelper.read(in);
test(sc.equals(p1.get()));
- test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ test(in.readOptional(3, OptionalFormat.VSize));
sc = SerializableHelper.read(in);
test(sc.equals(p1.get()));
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
@@ -2020,159 +1918,145 @@ public class AllTests
out.print("testing optional parameters and dictionaries... ");
out.flush();
{
- Ice.Optional<java.util.Map<Integer, Integer>> p1 = new Ice.Optional<java.util.Map<Integer, Integer>>();
- Ice.Optional<java.util.Map<Integer, Integer>> p3 = new Ice.Optional<java.util.Map<Integer, Integer>>();
- Ice.Optional<java.util.Map<Integer, Integer>> p2 = initial.opIntIntDict(p1, p3);
- test(!p2.isSet() && !p3.isSet());
+ Optional<java.util.Map<Integer, Integer>> p1 = Optional.empty();
+ Initial.OpIntIntDictResult r = initial.opIntIntDict(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
- p1.set(new java.util.HashMap<Integer, Integer>());
+ p1 = Optional.of(new java.util.HashMap<>());
p1.get().put(1, 2);
p1.get().put(2, 3);
- p2 = initial.opIntIntDict(p1, p3);
- test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
- Ice.AsyncResult r = initial.begin_opIntIntDict(p1);
- p2 = initial.end_opIntIntDict(p3, r);
- test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
- p2 = initial.opIntIntDict(new Ice.Optional<java.util.Map<Integer, Integer>>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ r = initial.opIntIntDict(p1);
+ test(r.returnValue.get().equals(p1.get()) && r.p3.get().equals(p1.get()));
+ r = initial.opIntIntDictAsync(p1).join();
+ test(r.returnValue.get().equals(p1.get()) && r.p3.get().equals(p1.get()));
if(reqParams)
{
- p2 = initial.opIntIntDictReq(p1.get(), p3);
- test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
- r = initial.begin_opIntIntDictReq(p1.get());
- p2 = initial.end_opIntIntDictReq(p3, r);
- test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
+ Initial.OpIntIntDictReqResult rr = initial.opIntIntDictReq(p1.get());
+ test(rr.returnValue.get().equals(p1.get()) && rr.p3.get().equals(p1.get()));
+ rr = initial.opIntIntDictReqAsync(p1.get()).join();
+ test(rr.returnValue.get().equals(p1.get()) && rr.p3.get().equals(p1.get()));
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.VSize);
+ os.writeOptional(2, OptionalFormat.VSize);
os.writeSize(p1.get().size() * 8 + (p1.get().size() > 254 ? 5 : 1));
IntIntDictHelper.write(os, p1.get());
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opIntIntDictReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opIntIntDictReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.VSize));
+ test(in.readOptional(1, OptionalFormat.VSize));
in.skipSize();
java.util.Map<Integer, Integer> m = IntIntDictHelper.read(in);
test(m.equals(p1.get()));
- test(in.readOptional(3, Ice.OptionalFormat.VSize));
+ test(in.readOptional(3, OptionalFormat.VSize));
in.skipSize();
m = IntIntDictHelper.read(in);
test(m.equals(p1.get()));
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.Optional<java.util.Map<String, Integer>> p1 = new Ice.Optional<java.util.Map<String, Integer>>();
- Ice.Optional<java.util.Map<String, Integer>> p3 = new Ice.Optional<java.util.Map<String, Integer>>();
- Ice.Optional<java.util.Map<String, Integer>> p2 = initial.opStringIntDict(p1, p3);
- test(!p2.isSet() && !p3.isSet());
+ Optional<java.util.Map<String, Integer>> p1 = Optional.empty();
+ Initial.OpStringIntDictResult r = initial.opStringIntDict(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
- p1.set(new java.util.HashMap<String, Integer>());
+ p1 = Optional.of(new java.util.HashMap<>());
p1.get().put("1", 1);
p1.get().put("2", 2);
- p2 = initial.opStringIntDict(p1, p3);
- test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
- Ice.AsyncResult r = initial.begin_opStringIntDict(p1);
- p2 = initial.end_opStringIntDict(p3, r);
- test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
- p2 = initial.opStringIntDict(new Ice.Optional<java.util.Map<String, Integer>>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ r = initial.opStringIntDict(p1);
+ test(r.returnValue.get().equals(p1.get()) && r.p3.get().equals(p1.get()));
+ r = initial.opStringIntDictAsync(p1).join();
+ test(r.returnValue.get().equals(p1.get()) && r.p3.get().equals(p1.get()));
if(reqParams)
{
- p2 = initial.opStringIntDictReq(p1.get(), p3);
- test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
- r = initial.begin_opStringIntDictReq(p1.get());
- p2 = initial.end_opStringIntDictReq(p3, r);
- test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
+ Initial.OpStringIntDictReqResult rr = initial.opStringIntDictReq(p1.get());
+ test(rr.returnValue.get().equals(p1.get()) && rr.p3.get().equals(p1.get()));
+ rr = initial.opStringIntDictReqAsync(p1.get()).join();
+ test(rr.returnValue.get().equals(p1.get()) && rr.p3.get().equals(p1.get()));
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.FSize);
+ os.writeOptional(2, OptionalFormat.FSize);
int pos = os.startSize();
StringIntDictHelper.write(os, p1.get());
os.endSize(pos);
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opStringIntDictReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opStringIntDictReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.FSize));
+ test(in.readOptional(1, OptionalFormat.FSize));
in.skip(4);
java.util.Map<String, Integer> m = StringIntDictHelper.read(in);
test(m.equals(p1.get()));
- test(in.readOptional(3, Ice.OptionalFormat.FSize));
+ test(in.readOptional(3, OptionalFormat.FSize));
in.skip(4);
m = StringIntDictHelper.read(in);
test(m.equals(p1.get()));
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
}
{
- Ice.Optional<java.util.Map<Integer, OneOptional>> p1 = new Ice.Optional<java.util.Map<Integer, OneOptional>>();
- Ice.Optional<java.util.Map<Integer, OneOptional>> p3 = new Ice.Optional<java.util.Map<Integer, OneOptional>>();
- Ice.Optional<java.util.Map<Integer, OneOptional>> p2 = initial.opIntOneOptionalDict(p1, p3);
- test(!p2.isSet() && !p3.isSet());
+ Optional<java.util.Map<Integer, OneOptional>> p1 = Optional.empty();
+ Optional<java.util.Map<Integer, OneOptional>> p3 = Optional.empty();
+ Initial.OpIntOneOptionalDictResult r = initial.opIntOneOptionalDict(p1);
+ test(!r.returnValue.isPresent() && !r.p3.isPresent());
- p1.set(new java.util.HashMap<Integer, OneOptional>());
+ p1 = Optional.of(new java.util.HashMap<>());
p1.get().put(1, new OneOptional(15));
p1.get().put(2, new OneOptional(12));
- p2 = initial.opIntOneOptionalDict(p1, p3);
- test(p2.get().get(1).getA() == 15 && p3.get().get(1).getA() == 15);
- test(p2.get().get(2).getA() == 12 && p3.get().get(2).getA() == 12);
- Ice.AsyncResult r = initial.begin_opIntOneOptionalDict(p1);
- p2 = initial.end_opIntOneOptionalDict(p3, r);
- test(p2.get().get(1).getA() == 15 && p3.get().get(1).getA() == 15);
- test(p2.get().get(2).getA() == 12 && p3.get().get(2).getA() == 12);
- p2 = initial.opIntOneOptionalDict(new Ice.Optional<java.util.Map<Integer, OneOptional>>(), p3);
- test(!p2.isSet() && !p3.isSet()); // Ensure out parameter is cleared.
+ r = initial.opIntOneOptionalDict(p1);
+ test(r.returnValue.get().get(1).getA() == 15 && r.p3.get().get(1).getA() == 15);
+ test(r.returnValue.get().get(2).getA() == 12 && r.p3.get().get(2).getA() == 12);
+ r = initial.opIntOneOptionalDictAsync(p1).join();
+ test(r.returnValue.get().get(1).getA() == 15 && r.p3.get().get(1).getA() == 15);
+ test(r.returnValue.get().get(2).getA() == 12 && r.p3.get().get(2).getA() == 12);
if(reqParams)
{
- p2 = initial.opIntOneOptionalDictReq(p1.get(), p3);
- test(p2.get().get(1).getA() == 15 && p3.get().get(1).getA() == 15);
- test(p2.get().get(2).getA() == 12 && p3.get().get(2).getA() == 12);
- r = initial.begin_opIntOneOptionalDictReq(p1.get());
- p2 = initial.end_opIntOneOptionalDictReq(p3, r);
- test(p2.get().get(1).getA() == 15 && p3.get().get(1).getA() == 15);
- test(p2.get().get(2).getA() == 12 && p3.get().get(2).getA() == 12);
+ Initial.OpIntOneOptionalDictReqResult rr = initial.opIntOneOptionalDictReq(p1.get());
+ test(rr.returnValue.get().get(1).getA() == 15 && rr.p3.get().get(1).getA() == 15);
+ test(rr.returnValue.get().get(2).getA() == 12 && rr.p3.get().get(2).getA() == 12);
+ rr = initial.opIntOneOptionalDictReqAsync(p1.get()).join();
+ test(rr.returnValue.get().get(1).getA() == 15 && rr.p3.get().get(1).getA() == 15);
+ test(rr.returnValue.get().get(2).getA() == 12 && rr.p3.get().get(2).getA() == 12);
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(2, Ice.OptionalFormat.FSize);
+ os.writeOptional(2, OptionalFormat.FSize);
int pos = os.startSize();
IntOneOptionalDictHelper.write(os, p1.get());
os.endSize(pos);
os.endEncapsulation();
inEncaps = os.finished();
- initial.ice_invoke("opIntOneOptionalDictReq", Ice.OperationMode.Normal, inEncaps, outEncaps);
- in = new Ice.InputStream(communicator, outEncaps.value);
+ inv = initial.ice_invoke("opIntOneOptionalDictReq", OperationMode.Normal, inEncaps);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
- test(in.readOptional(1, Ice.OptionalFormat.FSize));
+ test(in.readOptional(1, OptionalFormat.FSize));
in.skip(4);
java.util.Map<Integer, OneOptional> m = IntOneOptionalDictHelper.read(in);
test(m.get(1).getA() == 15 && m.get(2).getA() == 12);
- test(in.readOptional(3, Ice.OptionalFormat.FSize));
+ test(in.readOptional(3, OptionalFormat.FSize));
in.skip(4);
m = IntOneOptionalDictHelper.read(in);
test(m.get(1).getA() == 15 && m.get(2).getA() == 12);
in.endEncapsulation();
- in = new Ice.InputStream(communicator, outEncaps.value);
+ in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();
}
@@ -2184,29 +2068,22 @@ public class AllTests
f.getAf().requiredA = 56;
f.ae = f.getAf();
- os = new Ice.OutputStream(communicator);
+ os = new OutputStream(communicator);
os.startEncapsulation();
- os.writeOptional(1, Ice.OptionalFormat.Class);
+ os.writeOptional(1, OptionalFormat.Class);
os.writeValue(f);
- os.writeOptional(2, Ice.OptionalFormat.Class);
+ os.writeOptional(2, OptionalFormat.Class);
os.writeValue(f.ae);
os.endEncapsulation();
inEncaps = os.finished();
- in = new Ice.InputStream(communicator, inEncaps);
+ in = new InputStream(communicator, inEncaps);
in.startEncapsulation();
- test(in.readOptional(2, Ice.OptionalFormat.Class));
- final AHolder a = new AHolder();
- in.readValue(new Ice.ReadValueCallback()
- {
- @Override
- public void valueReady(Ice.Object obj)
- {
- a.value = (A)obj;
- }
- });
+ test(in.readOptional(2, OptionalFormat.Class));
+ final Wrapper<A> w = new Wrapper<>();
+ in.readValue(v -> w.value = (A)v);
in.endEncapsulation();
- test(a.value != null && a.value.requiredA == 56);
+ test(w.value != null && w.value.requiredA == 56);
}
out.println("ok");
@@ -2215,9 +2092,9 @@ public class AllTests
{
try
{
- Ice.IntOptional a = new Ice.IntOptional();
- Ice.Optional<String> b = new Ice.Optional<String>();
- Ice.Optional<OneOptional> o = new Ice.Optional<OneOptional>();
+ OptionalInt a = OptionalInt.empty();
+ Optional<String> b = Optional.empty();
+ Optional<OneOptional> o = Optional.empty();
initial.opOptionalException(a, b, o);
}
catch(OptionalException ex)
@@ -2229,9 +2106,9 @@ public class AllTests
try
{
- Ice.IntOptional a = new Ice.IntOptional(30);
- Ice.Optional<String> b = new Ice.Optional<String>("test");
- Ice.Optional<OneOptional> o = new Ice.Optional<OneOptional>(new OneOptional(53));
+ OptionalInt a = OptionalInt.of(30);
+ Optional<String> b = Optional.of("test");
+ Optional<OneOptional> o = Optional.of(new OneOptional(53));
initial.opOptionalException(a, b, o);
}
catch(OptionalException ex)
@@ -2246,9 +2123,9 @@ public class AllTests
//
// Use the 1.0 encoding with an exception whose only class members are optional.
//
- Ice.IntOptional a = new Ice.IntOptional(30);
- Ice.Optional<String> b = new Ice.Optional<String>("test");
- Ice.Optional<OneOptional> o = new Ice.Optional<OneOptional>(new OneOptional(53));
+ OptionalInt a = OptionalInt.of(30);
+ Optional<String> b = Optional.of("test");
+ Optional<OneOptional> o = Optional.of(new OneOptional(53));
initial2.opOptionalException(a, b, o);
}
catch(OptionalException ex)
@@ -2260,9 +2137,9 @@ public class AllTests
try
{
- Ice.IntOptional a = new Ice.IntOptional();
- Ice.Optional<String> b = new Ice.Optional<String>();
- Ice.Optional<OneOptional> o = new Ice.Optional<OneOptional>();
+ OptionalInt a = OptionalInt.empty();
+ Optional<String> b = Optional.empty();
+ Optional<OneOptional> o = Optional.empty();
initial.opDerivedException(a, b, o);
}
catch(DerivedException ex)
@@ -2280,9 +2157,9 @@ public class AllTests
try
{
- Ice.IntOptional a = new Ice.IntOptional(30);
- Ice.Optional<String> b = new Ice.Optional<String>("test2");
- Ice.Optional<OneOptional> o = new Ice.Optional<OneOptional>(new OneOptional(53));
+ OptionalInt a = OptionalInt.of(30);
+ Optional<String> b = Optional.of("test2");
+ Optional<OneOptional> o = Optional.of(new OneOptional(53));
initial.opDerivedException(a, b, o);
}
catch(DerivedException ex)
@@ -2300,9 +2177,9 @@ public class AllTests
try
{
- Ice.IntOptional a = new Ice.IntOptional();
- Ice.Optional<String> b = new Ice.Optional<String>();
- Ice.Optional<OneOptional> o = new Ice.Optional<OneOptional>();
+ OptionalInt a = OptionalInt.empty();
+ Optional<String> b = Optional.empty();
+ Optional<OneOptional> o = Optional.empty();
initial.opRequiredException(a, b, o);
}
catch(RequiredException ex)
@@ -2320,9 +2197,9 @@ public class AllTests
try
{
- Ice.IntOptional a = new Ice.IntOptional(30);
- Ice.Optional<String> b = new Ice.Optional<String>("test2");
- Ice.Optional<OneOptional> o = new Ice.Optional<OneOptional>(new OneOptional(53));
+ OptionalInt a = OptionalInt.of(30);
+ Optional<String> b = Optional.of("test2");
+ Optional<OneOptional> o = Optional.of(new OneOptional(53));
initial.opRequiredException(a, b, o);
}
catch(RequiredException ex)
@@ -2340,92 +2217,13 @@ public class AllTests
}
out.println("ok");
- //
- // Use reflection to load TwowaysLambdaAMI as that is only supported with Java >= 1.8
- //
- try
- {
- Class<?> cls = IceInternal.Util.findClass("test.Ice.optional.lambda.AllTests", null);
- if(cls != null)
- {
- java.lang.reflect.Method allTests = cls.getDeclaredMethod("allTests",
- new Class<?>[]{test.Util.Application.class, java.io.PrintWriter.class});
- allTests.invoke(null, app, out);
- }
- }
- catch(java.lang.NoSuchMethodException ex)
- {
- throw new RuntimeException(ex);
- }
- catch(java.lang.IllegalAccessException ex)
- {
- throw new RuntimeException(ex);
- }
- catch(java.lang.reflect.InvocationTargetException ex)
- {
- throw new RuntimeException(ex);
- }
-
- out.print("testing optionals with marshaled results... ");
- out.flush();
- {
- test(initial.opMStruct1().isSet());
- test(initial.opMDict1().isSet());
- test(initial.opMSeq1().isSet());
- test(initial.opMG1().isSet());
-
- {
- Ice.Optional<SmallStruct> p1 = new Ice.Optional<SmallStruct>();
- Ice.Optional<SmallStruct> p2 = new Ice.Optional<SmallStruct>();
- Ice.Optional<SmallStruct> p3 = initial.opMStruct2(p1, p2);
- test(!p2.isSet() && !p3.isSet());
-
- p1.set(new SmallStruct());
- p3 = initial.opMStruct2(p1, p2);
- test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
- }
- {
- Ice.Optional<String[]> p1 = new Ice.Optional<String[]>();
- Ice.Optional<String[]> p2 = new Ice.Optional<String[]>();
- Ice.Optional<String[]> p3 = initial.opMSeq2(p1, p2);
- test(!p2.isSet() && !p3.isSet());
-
- p1.set(new String[1]);
- p1.get()[0] = "hello";
- p3 = initial.opMSeq2(p1, p2);
- test(java.util.Arrays.equals(p2.get(), p1.get()) && java.util.Arrays.equals(p3.get(), p1.get()));
- }
- {
- Ice.Optional<java.util.Map<String, Integer>> p1 = new Ice.Optional<java.util.Map<String, Integer>>();
- Ice.Optional<java.util.Map<String, Integer>> p2 = new Ice.Optional<java.util.Map<String, Integer>>();
- Ice.Optional<java.util.Map<String, Integer>> p3 = initial.opMDict2(p1, p2);
- test(!p2.isSet() && !p3.isSet());
-
- p1.set(new java.util.HashMap<String, Integer>());
- p1.get().put("test", 54);
- p3 = initial.opMDict2(p1, p2);
- test(p2.get().equals(p1.get()) && p3.get().equals(p1.get()));
- }
- {
- Ice.Optional<G> p1 = new Ice.Optional<G>();
- Ice.Optional<G> p2 = new Ice.Optional<G>();
- Ice.Optional<G> p3 = initial.opMG2(p1, p2);
- test(!p2.isSet() && !p3.isSet());
-
- p1.set(new G());
- p3 = initial.opMG2(p1, p2);
- test(p2.isSet() && p3.isSet() && p3.get() == p2.get());
- }
- }
- out.println("ok");
-
return initial;
}
- private static class TestObjectReader extends Ice.ObjectReader
+ private static class TestObjectReader extends com.zeroc.Ice.ValueReader
{
@Override
- public void read(Ice.InputStream in)
+ public void read(InputStream in)
{
in.startValue();
in.startSlice();
@@ -2434,10 +2232,10 @@ public class AllTests
}
}
- private static class BObjectReader extends Ice.ObjectReader
+ private static class BObjectReader extends com.zeroc.Ice.ValueReader
{
@Override
- public void read(Ice.InputStream in)
+ public void read(InputStream in)
{
in.startValue();
// ::Test::B
@@ -2452,10 +2250,10 @@ public class AllTests
}
}
- private static class CObjectReader extends Ice.ObjectReader
+ private static class CObjectReader extends com.zeroc.Ice.ValueReader
{
@Override
- public void read(Ice.InputStream in)
+ public void read(InputStream in)
{
in.startValue();
// ::Test::C
@@ -2473,23 +2271,23 @@ public class AllTests
}
}
- private static class DObjectWriter extends Ice.ObjectWriter
+ private static class DObjectWriter extends com.zeroc.Ice.ValueWriter
{
@Override
- public void write(Ice.OutputStream out)
+ public void write(OutputStream out)
{
out.startValue(null);
// ::Test::D
out.startSlice("::Test::D", -1, false);
out.writeString("test");
- out.writeOptional(1, Ice.OptionalFormat.FSize);
+ out.writeOptional(1, OptionalFormat.FSize);
String[] o = { "test1", "test2", "test3", "test4" };
int pos = out.startSize();
out.writeStringSeq(o);
out.endSize(pos);
A a = new A();
a.setMc(18);
- out.writeOptional(1000, Ice.OptionalFormat.Class);
+ out.writeOptional(1000, OptionalFormat.Class);
out.writeValue(a);
out.endSlice();
// ::Test::B
@@ -2505,22 +2303,22 @@ public class AllTests
}
}
- private static class DObjectReader extends Ice.ObjectReader
+ private static class DObjectReader extends com.zeroc.Ice.ValueReader
{
@Override
- public void read(Ice.InputStream in)
+ public void read(InputStream in)
{
in.startValue();
// ::Test::D
in.startSlice();
String s = in.readString();
test(s.equals("test"));
- test(in.readOptional(1, Ice.OptionalFormat.FSize));
+ test(in.readOptional(1, OptionalFormat.FSize));
in.skip(4);
String[] o = in.readStringSeq();
test(o.length == 4 &&
o[0].equals("test1") && o[1].equals("test2") && o[2].equals("test3") && o[3].equals("test4"));
- test(in.readOptional(1000, Ice.OptionalFormat.Class));
+ test(in.readOptional(1000, OptionalFormat.Class));
in.readValue(a);
in.endSlice();
// ::Test::B
@@ -2542,10 +2340,10 @@ public class AllTests
private ReadValueCallbackI a = new ReadValueCallbackI();
}
- private static class FObjectReader extends Ice.ObjectReader
+ private static class FObjectReader extends com.zeroc.Ice.ValueReader
{
@Override
- public void read(Ice.InputStream in)
+ public void read(InputStream in)
{
_f = new F();
in.startValue();
@@ -2554,14 +2352,7 @@ public class AllTests
//in.read(1, _f.af);
in.endSlice();
in.startSlice();
- in.readValue(new Ice.ReadValueCallback()
- {
- @Override
- public void valueReady(Ice.Object obj)
- {
- _f.ae = (A)obj;
- }
- });
+ in.readValue(v -> _f.ae = (A)v);
in.endSlice();
in.endValue(false);
}
@@ -2574,10 +2365,10 @@ public class AllTests
private F _f;
}
- private static class FactoryI implements Ice.ValueFactory
+ private static class FactoryI implements com.zeroc.Ice.ValueFactory
{
@Override
- public Ice.Object create(String typeId)
+ public com.zeroc.Ice.Value create(String typeId)
{
if(!_enabled)
{
@@ -2620,14 +2411,14 @@ public class AllTests
private boolean _enabled;
}
- private static class ReadValueCallbackI implements Ice.ReadValueCallback
+ private static class ReadValueCallbackI implements com.zeroc.Ice.ReadValueCallback
{
@Override
- public void valueReady(Ice.Object obj)
+ public void valueReady(com.zeroc.Ice.Value obj)
{
this.obj = obj;
}
- Ice.Object obj;
+ com.zeroc.Ice.Value obj;
}
}
diff --git a/java/test/src/main/java/test/Ice/optional/Client.java b/java/test/src/main/java/test/Ice/optional/Client.java
index 8714a642be3..41e0b2c0f66 100644
--- a/java/test/src/main/java/test/Ice/optional/Client.java
+++ b/java/test/src/main/java/test/Ice/optional/Client.java
@@ -23,12 +23,11 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.optional");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.optional");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/optional/InitialI.java b/java/test/src/main/java/test/Ice/optional/InitialI.java
index 347a217b938..a0b60ab70d6 100644
--- a/java/test/src/main/java/test/Ice/optional/InitialI.java
+++ b/java/test/src/main/java/test/Ice/optional/InitialI.java
@@ -9,43 +9,47 @@
package test.Ice.optional;
+import java.util.Optional;
+import java.util.OptionalDouble;
+import java.util.OptionalInt;
+import java.util.OptionalLong;
+
+import com.zeroc.Ice.Current;
+
import test.Ice.optional.Test.*;
-public final class InitialI extends Initial
+public final class InitialI implements _InitialDisp
{
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(Current current)
{
current.adapter.getCommunicator().shutdown();
}
@Override
- public Ice.Object
- pingPong(Ice.Object obj, Ice.Current current)
+ public com.zeroc.Ice.Value pingPong(com.zeroc.Ice.Value obj, Current current)
{
return obj;
}
@Override
- public void
- opOptionalException(Ice.IntOptional a, Ice.Optional<String> b, Ice.Optional<OneOptional> o, Ice.Current current)
+ public void opOptionalException(OptionalInt a, Optional<String> b, Optional<OneOptional> o, Current current)
throws OptionalException
{
OptionalException ex = new OptionalException();
- if(a.isSet())
+ if(a.isPresent())
{
- ex.setA(a.get());
+ ex.setA(a.getAsInt());
}
else
{
ex.clearA(); // The member "a" has a default value.
}
- if(b.isSet())
+ if(b.isPresent())
{
ex.setB(b.get());
}
- if(o.isSet())
+ if(o.isPresent())
{
ex.setO(o.get());
}
@@ -53,20 +57,19 @@ public final class InitialI extends Initial
}
@Override
- public void
- opDerivedException(Ice.IntOptional a, Ice.Optional<String> b, Ice.Optional<OneOptional> o, Ice.Current current)
+ public void opDerivedException(OptionalInt a, Optional<String> b, Optional<OneOptional> o, Current current)
throws OptionalException
{
DerivedException ex = new DerivedException();
- if(a.isSet())
+ if(a.isPresent())
{
- ex.setA(a.get());
+ ex.setA(a.getAsInt());
}
else
{
ex.clearA(); // The member "a" has a default value.
}
- if(b.isSet())
+ if(b.isPresent())
{
ex.setB(b.get());
ex.setSs(b.get());
@@ -75,7 +78,7 @@ public final class InitialI extends Initial
{
ex.clearSs(); // The member "ss" has a default value.
}
- if(o.isSet())
+ if(o.isPresent())
{
ex.setO(o.get());
ex.setO2(o.get());
@@ -84,25 +87,24 @@ public final class InitialI extends Initial
}
@Override
- public void
- opRequiredException(Ice.IntOptional a, Ice.Optional<String> b, Ice.Optional<OneOptional> o, Ice.Current current)
+ public void opRequiredException(OptionalInt a, Optional<String> b, Optional<OneOptional> o, Current current)
throws OptionalException
{
RequiredException ex = new RequiredException();
- if(a.isSet())
+ if(a.isPresent())
{
- ex.setA(a.get());
+ ex.setA(a.getAsInt());
}
else
{
ex.clearA(); // The member "a" has a default value.
}
- if(b.isSet())
+ if(b.isPresent())
{
ex.setB(b.get());
ex.ss = b.get();
}
- if(o.isSet())
+ if(o.isPresent())
{
ex.setO(o.get());
ex.o2 = o.get();
@@ -111,630 +113,479 @@ public final class InitialI extends Initial
}
@Override
- public Ice.ByteOptional
- opByte(Ice.ByteOptional p1, Ice.ByteOptional p3, Ice.Current current)
+ public Initial.OpByteResult opByte(Optional<Byte> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpByteResult(p1, p1);
}
@Override
- public byte
- opByteReq(Ice.ByteOptional p1, Ice.ByteHolder p3, Ice.Current current)
+ public Initial.OpByteReqResult opByteReq(Optional<Byte> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpByteReqResult(p1, p1);
}
@Override
- public Ice.BooleanOptional
- opBool(Ice.BooleanOptional p1, Ice.BooleanOptional p3, Ice.Current current)
+ public Initial.OpBoolResult opBool(Optional<Boolean> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpBoolResult(p1, p1);
}
@Override
- public boolean
- opBoolReq(Ice.BooleanOptional p1, Ice.BooleanHolder p3, Ice.Current current)
+ public Initial.OpBoolReqResult opBoolReq(Optional<Boolean> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpBoolReqResult(p1, p1);
}
@Override
- public Ice.ShortOptional
- opShort(Ice.ShortOptional p1, Ice.ShortOptional p3, Ice.Current current)
+ public Initial.OpShortResult opShort(Optional<Short> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpShortResult(p1, p1);
}
@Override
- public short
- opShortReq(Ice.ShortOptional p1, Ice.ShortHolder p3, Ice.Current current)
+ public Initial.OpShortReqResult opShortReq(Optional<Short> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpShortReqResult(p1, p1);
}
@Override
- public Ice.IntOptional
- opInt(Ice.IntOptional p1, Ice.IntOptional p3, Ice.Current current)
+ public Initial.OpIntResult opInt(OptionalInt p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpIntResult(p1, p1);
}
@Override
- public int
- opIntReq(Ice.IntOptional p1, Ice.IntHolder p3, Ice.Current current)
+ public Initial.OpIntReqResult opIntReq(OptionalInt p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpIntReqResult(p1, p1);
}
@Override
- public Ice.LongOptional
- opLong(Ice.LongOptional p1, Ice.LongOptional p3, Ice.Current current)
+ public Initial.OpLongResult opLong(OptionalLong p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpLongResult(p1, p1);
}
@Override
- public long
- opLongReq(Ice.LongOptional p1, Ice.LongHolder p3, Ice.Current current)
+ public Initial.OpLongReqResult opLongReq(OptionalLong p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpLongReqResult(p1, p1);
}
@Override
- public Ice.FloatOptional
- opFloat(Ice.FloatOptional p1, Ice.FloatOptional p3, Ice.Current current)
+ public Initial.OpFloatResult opFloat(Optional<Float> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpFloatResult(p1, p1);
}
@Override
- public float
- opFloatReq(Ice.FloatOptional p1, Ice.FloatHolder p3, Ice.Current current)
+ public Initial.OpFloatReqResult opFloatReq(Optional<Float> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpFloatReqResult(p1, p1);
}
@Override
- public Ice.DoubleOptional
- opDouble(Ice.DoubleOptional p1, Ice.DoubleOptional p3, Ice.Current current)
+ public Initial.OpDoubleResult opDouble(OptionalDouble p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpDoubleResult(p1, p1);
}
@Override
- public double
- opDoubleReq(Ice.DoubleOptional p1, Ice.DoubleHolder p3, Ice.Current current)
+ public Initial.OpDoubleReqResult opDoubleReq(OptionalDouble p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpDoubleReqResult(p1, p1);
}
@Override
- public Ice.Optional<String>
- opString(Ice.Optional<String> p1, Ice.Optional<String> p3, Ice.Current current)
+ public Initial.OpStringResult opString(Optional<String> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpStringResult(p1, p1);
}
@Override
- public String
- opStringReq(Ice.Optional<String> p1, Ice.StringHolder p3, Ice.Current current)
+ public Initial.OpStringReqResult opStringReq(Optional<String> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpStringReqResult(p1, p1);
}
@Override
- public Ice.Optional<MyEnum>
- opMyEnum(Ice.Optional<MyEnum> p1, Ice.Optional<MyEnum> p3, Ice.Current current)
+ public Initial.OpMyEnumResult opMyEnum(Optional<MyEnum> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpMyEnumResult(p1, p1);
}
@Override
- public MyEnum
- opMyEnumReq(Ice.Optional<MyEnum> p1, MyEnumHolder p3, Ice.Current current)
+ public Initial.OpMyEnumReqResult opMyEnumReq(Optional<MyEnum> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpMyEnumReqResult(p1, p1);
}
@Override
- public Ice.Optional<SmallStruct>
- opSmallStruct(Ice.Optional<SmallStruct> p1, Ice.Optional<SmallStruct> p3, Ice.Current current)
+ public Initial.OpSmallStructResult opSmallStruct(Optional<SmallStruct> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpSmallStructResult(p1, p1);
}
@Override
- public SmallStruct
- opSmallStructReq(Ice.Optional<SmallStruct> p1, SmallStructHolder p3, Ice.Current current)
+ public Initial.OpSmallStructReqResult opSmallStructReq(Optional<SmallStruct> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpSmallStructReqResult(p1, p1);
}
@Override
- public Ice.Optional<FixedStruct>
- opFixedStruct(Ice.Optional<FixedStruct> p1, Ice.Optional<FixedStruct> p3, Ice.Current current)
+ public Initial.OpFixedStructResult opFixedStruct(Optional<FixedStruct> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpFixedStructResult(p1, p1);
}
@Override
- public FixedStruct
- opFixedStructReq(Ice.Optional<FixedStruct> p1, FixedStructHolder p3, Ice.Current current)
+ public Initial.OpFixedStructReqResult opFixedStructReq(Optional<FixedStruct> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpFixedStructReqResult(p1, p1);
}
@Override
- public Ice.Optional<VarStruct>
- opVarStruct(Ice.Optional<VarStruct> p1, Ice.Optional<VarStruct> p3, Ice.Current current)
+ public Initial.OpVarStructResult opVarStruct(Optional<VarStruct> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpVarStructResult(p1, p1);
}
@Override
- public VarStruct
- opVarStructReq(Ice.Optional<VarStruct> p1, VarStructHolder p3, Ice.Current current)
+ public Initial.OpVarStructReqResult opVarStructReq(Optional<VarStruct> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpVarStructReqResult(p1, p1);
}
@Override
- public Ice.Optional<OneOptional>
- opOneOptional(Ice.Optional<OneOptional> p1, Ice.Optional<OneOptional> p3, Ice.Current current)
+ public Initial.OpOneOptionalResult opOneOptional(Optional<OneOptional> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpOneOptionalResult(p1, p1);
}
@Override
- public OneOptional
- opOneOptionalReq(Ice.Optional<OneOptional> p1, OneOptionalHolder p3, Ice.Current current)
+ public Initial.OpOneOptionalReqResult opOneOptionalReq(Optional<OneOptional> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpOneOptionalReqResult(p1, p1);
}
@Override
- public Ice.Optional<OneOptionalPrx>
- opOneOptionalProxy(Ice.Optional<OneOptionalPrx> p1, Ice.Optional<OneOptionalPrx> p3, Ice.Current current)
+ public Initial.OpOneOptionalProxyResult opOneOptionalProxy(Optional<com.zeroc.Ice.ObjectPrx> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpOneOptionalProxyResult(p1, p1);
}
@Override
- public OneOptionalPrx
- opOneOptionalProxyReq(Ice.Optional<OneOptionalPrx> p1, OneOptionalPrxHolder p3, Ice.Current current)
+ public Initial.OpOneOptionalProxyReqResult opOneOptionalProxyReq(Optional<com.zeroc.Ice.ObjectPrx> p1,
+ Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpOneOptionalProxyReqResult(p1, p1);
}
@Override
- public Ice.Optional<byte[]>
- opByteSeq(Ice.Optional<byte[]> p1, Ice.Optional<byte[]> p3, Ice.Current current)
+ public Initial.OpByteSeqResult opByteSeq(Optional<byte[]> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpByteSeqResult(p1, p1);
}
@Override
- public byte[]
- opByteSeqReq(Ice.Optional<byte[]> p1, ByteSeqHolder p3, Ice.Current current)
+ public Initial.OpByteSeqReqResult opByteSeqReq(Optional<byte[]> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpByteSeqReqResult(p1, p1);
}
@Override
- public Ice.Optional<boolean[]>
- opBoolSeq(Ice.Optional<boolean[]> p1, Ice.Optional<boolean[]> p3, Ice.Current current)
+ public Initial.OpBoolSeqResult opBoolSeq(Optional<boolean[]> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpBoolSeqResult(p1, p1);
}
@Override
- public boolean[]
- opBoolSeqReq(Ice.Optional<boolean[]> p1, BoolSeqHolder p3, Ice.Current current)
+ public Initial.OpBoolSeqReqResult opBoolSeqReq(Optional<boolean[]> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpBoolSeqReqResult(p1, p1);
}
@Override
- public Ice.Optional<short[]>
- opShortSeq(Ice.Optional<short[]> p1, Ice.Optional<short[]> p3, Ice.Current current)
+ public Initial.OpShortSeqResult opShortSeq(Optional<short[]> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpShortSeqResult(p1, p1);
}
@Override
- public short[]
- opShortSeqReq(Ice.Optional<short[]> p1, ShortSeqHolder p3, Ice.Current current)
+ public Initial.OpShortSeqReqResult opShortSeqReq(Optional<short[]> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpShortSeqReqResult(p1, p1);
}
@Override
- public Ice.Optional<int[]>
- opIntSeq(Ice.Optional<int[]> p1, Ice.Optional<int[]> p3, Ice.Current current)
+ public Initial.OpIntSeqResult opIntSeq(Optional<int[]> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpIntSeqResult(p1, p1);
}
@Override
- public int[]
- opIntSeqReq(Ice.Optional<int[]> p1, IntSeqHolder p3, Ice.Current current)
+ public Initial.OpIntSeqReqResult opIntSeqReq(Optional<int[]> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpIntSeqReqResult(p1, p1);
}
@Override
- public Ice.Optional<long[]>
- opLongSeq(Ice.Optional<long[]> p1, Ice.Optional<long[]> p3, Ice.Current current)
+ public Initial.OpLongSeqResult opLongSeq(Optional<long[]> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpLongSeqResult(p1, p1);
}
@Override
- public long[]
- opLongSeqReq(Ice.Optional<long[]> p1, LongSeqHolder p3, Ice.Current current)
+ public Initial.OpLongSeqReqResult opLongSeqReq(Optional<long[]> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpLongSeqReqResult(p1, p1);
}
@Override
- public Ice.Optional<float[]>
- opFloatSeq(Ice.Optional<float[]> p1, Ice.Optional<float[]> p3, Ice.Current current)
+ public Initial.OpFloatSeqResult opFloatSeq(Optional<float[]> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpFloatSeqResult(p1, p1);
}
@Override
- public float[]
- opFloatSeqReq(Ice.Optional<float[]> p1, FloatSeqHolder p3, Ice.Current current)
+ public Initial.OpFloatSeqReqResult opFloatSeqReq(Optional<float[]> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpFloatSeqReqResult(p1, p1);
}
@Override
- public Ice.Optional<double[]>
- opDoubleSeq(Ice.Optional<double[]> p1, Ice.Optional<double[]> p3, Ice.Current current)
+ public Initial.OpDoubleSeqResult opDoubleSeq(Optional<double[]> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpDoubleSeqResult(p1, p1);
}
@Override
- public double[]
- opDoubleSeqReq(Ice.Optional<double[]> p1, DoubleSeqHolder p3, Ice.Current current)
+ public Initial.OpDoubleSeqReqResult opDoubleSeqReq(Optional<double[]> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpDoubleSeqReqResult(p1, p1);
}
@Override
- public Ice.Optional<String[]>
- opStringSeq(Ice.Optional<String[]> p1, Ice.Optional<String[]> p3, Ice.Current current)
+ public Initial.OpStringSeqResult opStringSeq(Optional<String[]> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpStringSeqResult(p1, p1);
}
@Override
- public String[]
- opStringSeqReq(Ice.Optional<String[]> p1, StringSeqHolder p3, Ice.Current current)
+ public Initial.OpStringSeqReqResult opStringSeqReq(Optional<String[]> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpStringSeqReqResult(p1, p1);
}
@Override
- public Ice.Optional<SmallStruct[]>
- opSmallStructSeq(Ice.Optional<SmallStruct[]> p1, Ice.Optional<SmallStruct[]> p3, Ice.Current current)
+ public Initial.OpSmallStructSeqResult opSmallStructSeq(Optional<SmallStruct[]> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpSmallStructSeqResult(p1, p1);
}
@Override
- public SmallStruct[]
- opSmallStructSeqReq(Ice.Optional<SmallStruct[]> p1, SmallStructSeqHolder p3, Ice.Current current)
+ public Initial.OpSmallStructSeqReqResult opSmallStructSeqReq(Optional<SmallStruct[]> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpSmallStructSeqReqResult(p1, p1);
}
@Override
- public Ice.Optional<java.util.List<SmallStruct>>
- opSmallStructList(Ice.Optional<java.util.List<SmallStruct>> p1,
- Ice.Optional<java.util.List<SmallStruct>> p3, Ice.Current current)
+ public Initial.OpSmallStructListResult opSmallStructList(Optional<java.util.List<SmallStruct>> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpSmallStructListResult(p1, p1);
}
@Override
- public java.util.List<SmallStruct>
- opSmallStructListReq(Ice.Optional<java.util.List<SmallStruct>> p1, SmallStructListHolder p3, Ice.Current current)
+ public Initial.OpSmallStructListReqResult opSmallStructListReq(Optional<java.util.List<SmallStruct>> p1,
+ Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpSmallStructListReqResult(p1, p1);
}
@Override
- public Ice.Optional<FixedStruct[]>
- opFixedStructSeq(Ice.Optional<FixedStruct[]> p1, Ice.Optional<FixedStruct[]> p3, Ice.Current current)
+ public Initial.OpFixedStructSeqResult opFixedStructSeq(Optional<FixedStruct[]> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpFixedStructSeqResult(p1, p1);
}
@Override
- public FixedStruct[]
- opFixedStructSeqReq(Ice.Optional<FixedStruct[]> p1, FixedStructSeqHolder p3, Ice.Current current)
+ public Initial.OpFixedStructSeqReqResult opFixedStructSeqReq(Optional<FixedStruct[]> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpFixedStructSeqReqResult(p1, p1);
}
@Override
- public Ice.Optional<java.util.List<FixedStruct>>
- opFixedStructList(Ice.Optional<java.util.List<FixedStruct>> p1,
- Ice.Optional<java.util.List<FixedStruct>> p3, Ice.Current current)
+ public Initial.OpFixedStructListResult opFixedStructList(Optional<java.util.List<FixedStruct>> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpFixedStructListResult(p1, p1);
}
@Override
- public java.util.List<FixedStruct>
- opFixedStructListReq(Ice.Optional<java.util.List<FixedStruct>> p1, FixedStructListHolder p3, Ice.Current current)
+ public Initial.OpFixedStructListReqResult opFixedStructListReq(Optional<java.util.List<FixedStruct>> p1,
+ Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpFixedStructListReqResult(p1, p1);
}
@Override
- public Ice.Optional<VarStruct[]>
- opVarStructSeq(Ice.Optional<VarStruct[]> p1, Ice.Optional<VarStruct[]> p3, Ice.Current current)
+ public Initial.OpVarStructSeqResult opVarStructSeq(Optional<VarStruct[]> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpVarStructSeqResult(p1, p1);
}
@Override
- public VarStruct[]
- opVarStructSeqReq(Ice.Optional<VarStruct[]> p1, VarStructSeqHolder p3, Ice.Current current)
+ public Initial.OpVarStructSeqReqResult opVarStructSeqReq(Optional<VarStruct[]> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpVarStructSeqReqResult(p1, p1);
}
@Override
- public Ice.Optional<SerializableClass>
- opSerializable(Ice.Optional<SerializableClass> p1, Ice.Optional<SerializableClass> p3, Ice.Current current)
+ public Initial.OpSerializableResult opSerializable(Optional<SerializableClass> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpSerializableResult(p1, p1);
}
@Override
- public SerializableClass
- opSerializableReq(Ice.Optional<SerializableClass> p1, Ice.Holder<SerializableClass> p3, Ice.Current current)
+ public Initial.OpSerializableReqResult opSerializableReq(Optional<SerializableClass> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpSerializableReqResult(p1, p1);
}
@Override
- public Ice.Optional<java.util.Map<Integer, Integer>>
- opIntIntDict(Ice.Optional<java.util.Map<Integer, Integer>> p1, Ice.Optional<java.util.Map<Integer, Integer>> p3,
- Ice.Current current)
+ public Initial.OpIntIntDictResult opIntIntDict(Optional<java.util.Map<Integer, Integer>> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpIntIntDictResult(p1, p1);
}
@Override
- public java.util.Map<Integer, Integer>
- opIntIntDictReq(Ice.Optional<java.util.Map<Integer, Integer>> p1, IntIntDictHolder p3, Ice.Current current)
+ public Initial.OpIntIntDictReqResult opIntIntDictReq(Optional<java.util.Map<Integer, Integer>> p1, Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpIntIntDictReqResult(p1, p1);
}
@Override
- public Ice.Optional<java.util.Map<String, Integer>>
- opStringIntDict(Ice.Optional<java.util.Map<String, Integer>> p1, Ice.Optional<java.util.Map<String, Integer>> p3,
- Ice.Current current)
+ public Initial.OpStringIntDictResult opStringIntDict(Optional<java.util.Map<String, Integer>> p1, Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpStringIntDictResult(p1, p1);
}
@Override
- public java.util.Map<String, Integer>
- opStringIntDictReq(Ice.Optional<java.util.Map<String, Integer>> p1, StringIntDictHolder p3, Ice.Current current)
+ public Initial.OpStringIntDictReqResult opStringIntDictReq(Optional<java.util.Map<String, Integer>> p1,
+ Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpStringIntDictReqResult(p1, p1);
}
@Override
- public Ice.Optional<java.util.Map<Integer, OneOptional>>
- opIntOneOptionalDict(Ice.Optional<java.util.Map<Integer, OneOptional>> p1,
- Ice.Optional<java.util.Map<Integer, OneOptional>> p3, Ice.Current current)
+ public Initial.OpIntOneOptionalDictResult opIntOneOptionalDict(Optional<java.util.Map<Integer, OneOptional>> p1,
+ Current current)
{
- p3.set(p1);
- return p1;
+ return new Initial.OpIntOneOptionalDictResult(p1, p1);
}
@Override
- public java.util.Map<Integer, OneOptional>
- opIntOneOptionalDictReq(Ice.Optional<java.util.Map<Integer, OneOptional>> p1, IntOneOptionalDictHolder p3,
- Ice.Current current)
+ public Initial.OpIntOneOptionalDictReqResult opIntOneOptionalDictReq(
+ Optional<java.util.Map<Integer, OneOptional>> p1,
+ Current current)
{
- p3.value = p1.get();
- return p1.get();
+ return new Initial.OpIntOneOptionalDictReqResult(p1, p1);
}
@Override
- public void
- opClassAndUnknownOptional(A p, Ice.Current current)
+ public void opClassAndUnknownOptional(A p, Current current)
{
}
@Override
- public void
- sendOptionalClass(boolean req, Ice.Optional<OneOptional> o, Ice.Current current)
+ public void sendOptionalClass(boolean req, Optional<OneOptional> o, Current current)
{
}
@Override
- public void
- returnOptionalClass(boolean req, Ice.Optional<OneOptional> o, Ice.Current current)
+ public Optional<OneOptional> returnOptionalClass(boolean req, Current current)
{
- o.set(new OneOptional(53));
+ return Optional.of(new OneOptional(53));
}
@Override
- public G
- opG(G g, Ice.Current current)
+ public G opG(G g, Current current)
{
return g;
}
@Override
- public void
- opVoid(Ice.Current current)
+ public void opVoid(Current current)
{
}
@Override
- public Ice.Optional<SmallStruct> opMStruct1(Ice.Current current)
+ public Initial.OpMStruct1MarshaledResult opMStruct1(Current current)
{
- return new Ice.Optional<SmallStruct>(new SmallStruct());
+ return new Initial.OpMStruct1MarshaledResult(Optional.of(new SmallStruct()), current);
}
@Override
- public Ice.Optional<SmallStruct>
- opMStruct2(Ice.Optional<SmallStruct> p1, Ice.Optional<SmallStruct> p2, Ice.Current current)
+ public Initial.OpMStruct2MarshaledResult opMStruct2(Optional<SmallStruct> p1, Current current)
{
- if(p1.isSet())
- {
- p2.set(p1.get());
- }
- return p1;
+ return new Initial.OpMStruct2MarshaledResult(p1, p1, current);
}
@Override
- public Ice.Optional<String[]> opMSeq1(Ice.Current current)
+ public Initial.OpMSeq1MarshaledResult opMSeq1(Current current)
{
- return new Ice.Optional<String[]>(new String[0]);
+ return new Initial.OpMSeq1MarshaledResult(Optional.of(new String[0]), current);
}
@Override
- public Ice.Optional<String[]> opMSeq2(Ice.Optional<String[]> p1, Ice.Optional<String[]> p2, Ice.Current current)
+ public Initial.OpMSeq2MarshaledResult opMSeq2(Optional<String[]> p1, Current current)
{
- if(p1.isSet())
- {
- p2.set(p1.get());
- }
- return p1;
+ return new Initial.OpMSeq2MarshaledResult(p1, p1, current);
}
@Override
- public Ice.Optional<java.util.Map<String, Integer>> opMDict1(Ice.Current current)
+ public Initial.OpMDict1MarshaledResult opMDict1(Current current)
{
- return new Ice.Optional<java.util.Map<String, Integer>>(new java.util.HashMap<String, Integer>());
+ return new Initial.OpMDict1MarshaledResult(Optional.of(new java.util.HashMap<>()), current);
}
@Override
- public Ice.Optional<java.util.Map<String, Integer>>
- opMDict2(Ice.Optional<java.util.Map<String, Integer>> p1, Ice.Optional<java.util.Map<String, Integer>> p2,
- Ice.Current current)
+ public Initial.OpMDict2MarshaledResult opMDict2(Optional<java.util.Map<String, Integer>> p1, Current current)
{
- if(p1.isSet())
- {
- p2.set(p1.get());
- }
- return p1;
+ return new Initial.OpMDict2MarshaledResult(p1, p1, current);
}
@Override
- public Ice.Optional<G> opMG1(Ice.Current current)
+ public Initial.OpMG1MarshaledResult opMG1(Current current)
{
- return new Ice.Optional<G>(new G());
+ return new Initial.OpMG1MarshaledResult(Optional.of(new G()), current);
}
@Override
- public Ice.Optional<G> opMG2(Ice.Optional<G> p1, Ice.Optional<G> p2, Ice.Current current)
+ public Initial.OpMG2MarshaledResult opMG2(Optional<G> p1, Current current)
{
- if(p1.isSet())
- {
- p2.set(p1.get());
- }
- return p1;
+ return new Initial.OpMG2MarshaledResult(p1, p1, current);
}
@Override
- public boolean
- supportsRequiredParams(Ice.Current current)
+ public boolean supportsRequiredParams(Current current)
{
return true;
}
@Override
- public boolean
- supportsJavaSerializable(Ice.Current current)
+ public boolean supportsJavaSerializable(Current current)
{
return true;
}
@Override
- public boolean
- supportsCsharpSerializable(Ice.Current current)
+ public boolean supportsCsharpSerializable(Current current)
{
return false;
}
@Override
- public boolean
- supportsCppStringView(Ice.Current current)
+ public boolean supportsCppStringView(Current current)
{
return false;
}
diff --git a/java/test/src/main/java/test/Ice/optional/Server.java b/java/test/src/main/java/test/Ice/optional/Server.java
index d4429d5a94d..f036c674d5e 100644
--- a/java/test/src/main/java/test/Ice/optional/Server.java
+++ b/java/test/src/main/java/test/Ice/optional/Server.java
@@ -15,19 +15,18 @@ public class Server extends test.Util.Application
public int run(String[] args)
{
communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- adapter.add(new InitialI(), Ice.Util.stringToIdentity("initial"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.add(new InitialI(), com.zeroc.Ice.Util.stringToIdentity("initial"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.optional");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.optional");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/optional/Test.ice b/java/test/src/main/java/test/Ice/optional/Test.ice
index 2d2d9005a85..ba3a7ba5f51 100644
--- a/java/test/src/main/java/test/Ice/optional/Test.ice
+++ b/java/test/src/main/java/test/Ice/optional/Test.ice
@@ -312,9 +312,11 @@ class Initial
out optional(3) StringIntDict p3);
optional(1) StringIntDict opStringIntDictReq(optional(2) StringIntDict p1, out optional(3) StringIntDict p3);
- ["java:optional"] optional(1) IntOneOptionalDict opIntOneOptionalDict(optional(2) IntOneOptionalDict p1, out optional(3) IntOneOptionalDict p3);
+ ["java:optional"] optional(1) IntOneOptionalDict opIntOneOptionalDict(optional(2) IntOneOptionalDict p1,
+ out optional(3) IntOneOptionalDict p3);
- optional(1) IntOneOptionalDict opIntOneOptionalDictReq(optional(2) IntOneOptionalDict p1, out optional(3) IntOneOptionalDict p3);
+ optional(1) IntOneOptionalDict opIntOneOptionalDictReq(optional(2) IntOneOptionalDict p1,
+ out optional(3) IntOneOptionalDict p3);
void opClassAndUnknownOptional(A p);
@@ -327,20 +329,20 @@ class Initial
void opVoid();
- ["marshaled-result", "java:optional"] optional(1) SmallStruct opMStruct1();
- ["marshaled-result", "java:optional"] optional(1) SmallStruct opMStruct2(optional(2) SmallStruct p1,
- out optional(3)SmallStruct p2);
+ ["marshaled-result"] optional(1) SmallStruct opMStruct1();
+ ["marshaled-result"] optional(1) SmallStruct opMStruct2(optional(2) SmallStruct p1,
+ out optional(3)SmallStruct p2);
- ["marshaled-result", "java:optional"] optional(1) StringSeq opMSeq1();
- ["marshaled-result", "java:optional"] optional(1) StringSeq opMSeq2(optional(2) StringSeq p1,
- out optional(3) StringSeq p2);
+ ["marshaled-result"] optional(1) StringSeq opMSeq1();
+ ["marshaled-result"] optional(1) StringSeq opMSeq2(optional(2) StringSeq p1,
+ out optional(3) StringSeq p2);
- ["marshaled-result", "java:optional"] optional(1) StringIntDict opMDict1();
- ["marshaled-result", "java:optional"] optional(1) StringIntDict opMDict2(optional(2) StringIntDict p1,
- out optional(3) StringIntDict p2);
+ ["marshaled-result"] optional(1) StringIntDict opMDict1();
+ ["marshaled-result"] optional(1) StringIntDict opMDict2(optional(2) StringIntDict p1,
+ out optional(3) StringIntDict p2);
- ["marshaled-result", "java:optional"] optional(1) G opMG1();
- ["marshaled-result", "java:optional"] optional(1) G opMG2(optional(2) G p1, out optional(3) G p2);
+ ["marshaled-result"] optional(1) G opMG1();
+ ["marshaled-result"] optional(1) G opMG2(optional(2) G p1, out optional(3) G p2);
bool supportsRequiredParams();
diff --git a/java/test/src/main/java/test/Ice/packagemd/AllTests.java b/java/test/src/main/java/test/Ice/packagemd/AllTests.java
index d2a9afed7b0..026eb8970f9 100644
--- a/java/test/src/main/java/test/Ice/packagemd/AllTests.java
+++ b/java/test/src/main/java/test/Ice/packagemd/AllTests.java
@@ -12,7 +12,6 @@ package test.Ice.packagemd;
import java.io.PrintWriter;
import test.Ice.packagemd.Test.InitialPrx;
-import test.Ice.packagemd.Test.InitialPrxHelper;
import test.Ice.packagemd.Test1.C1;
import test.Ice.packagemd.Test1.C2;
import test.Ice.packagemd.Test1.E1;
@@ -21,8 +20,7 @@ import test.Ice.packagemd.Test1._notify;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -30,19 +28,18 @@ public class AllTests
}
}
- public static InitialPrx
- allTests(Ice.Communicator communicator, PrintWriter out)
+ public static InitialPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out)
{
- out.print("testing stringToProxy... ");
+ out.print("testing stringToProxy... ");
out.flush();
String ref = "initial:default -p 12010";
- Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref);
test(base != null);
out.println("ok");
out.print("testing checked cast... ");
out.flush();
- InitialPrx initial = InitialPrxHelper.checkedCast(base);
+ InitialPrx initial = InitialPrx.checkedCast(base);
test(initial != null);
test(initial.equals(base));
out.println("ok");
@@ -95,11 +92,11 @@ public class AllTests
initial.throwTest2E2AsE1();
test(false);
}
- catch(Ice.UnknownUserException ex)
+ catch(com.zeroc.Ice.UnknownUserException ex)
{
// Expected
}
- catch(Ice.MarshalException ex)
+ catch(com.zeroc.Ice.MarshalException ex)
{
// Expected
}
@@ -112,11 +109,11 @@ public class AllTests
initial.throwTest2E2AsE2();
test(false);
}
- catch(Ice.UnknownUserException ex)
+ catch(com.zeroc.Ice.UnknownUserException ex)
{
// Expected
}
- catch(Ice.MarshalException ex)
+ catch(com.zeroc.Ice.MarshalException ex)
{
// Expected
}
diff --git a/java/test/src/main/java/test/Ice/packagemd/Client.java b/java/test/src/main/java/test/Ice/packagemd/Client.java
index bf5c86e5fb7..cd11c053f38 100644
--- a/java/test/src/main/java/test/Ice/packagemd/Client.java
+++ b/java/test/src/main/java/test/Ice/packagemd/Client.java
@@ -22,14 +22,13 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.packagemd");
- initData.properties.setProperty("Ice.Package.Test1", "test.Ice.packagemd");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.packagemd");
+ r.initData.properties.setProperty("Ice.Package.Test1", "test.Ice.packagemd");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/packagemd/InitialI.java b/java/test/src/main/java/test/Ice/packagemd/InitialI.java
index 4c006512435..76453dfa6f3 100644
--- a/java/test/src/main/java/test/Ice/packagemd/InitialI.java
+++ b/java/test/src/main/java/test/Ice/packagemd/InitialI.java
@@ -9,134 +9,117 @@
package test.Ice.packagemd;
-import test.Ice.packagemd.Test._InitialDisp;
+import test.Ice.packagemd.Test.Initial;
import test.Ice.packagemd.Test1.C1;
import test.Ice.packagemd.Test1.C2;
import test.Ice.packagemd.Test1.E1;
import test.Ice.packagemd.Test1.E2;
import test.Ice.packagemd.Test1._notify;
-public final class InitialI extends _InitialDisp
+public final class InitialI implements Initial
{
- public Ice.Object
- getTest1C2AsObject(Ice.Current __current)
+ public com.zeroc.Ice.Value getTest1C2AsObject(com.zeroc.Ice.Current __current)
{
return new C2();
}
@Override
- public C1
- getTest1C2AsC1(Ice.Current __current)
+ public C1 getTest1C2AsC1(com.zeroc.Ice.Current __current)
{
return new C2();
}
@Override
- public C2
- getTest1C2AsC2(Ice.Current __current)
+ public C2 getTest1C2AsC2(com.zeroc.Ice.Current __current)
{
return new C2();
}
@Override
- public void
- throwTest1E2AsE1(Ice.Current __current)
+ public void throwTest1E2AsE1(com.zeroc.Ice.Current __current)
throws E1
{
throw new E2();
}
@Override
- public void
- throwTest1E2AsE2(Ice.Current __current)
+ public void throwTest1E2AsE2(com.zeroc.Ice.Current __current)
throws E2
{
throw new E2();
}
@Override
- public void
- throwTest1Notify(Ice.Current __current)
+ public void throwTest1Notify(com.zeroc.Ice.Current __current)
throws _notify
{
throw new _notify();
}
- public Ice.Object
- getTest2C2AsObject(Ice.Current __current)
+ public com.zeroc.Ice.Value getTest2C2AsObject(com.zeroc.Ice.Current __current)
{
return new test.Ice.packagemd.testpkg.Test2.C2();
}
@Override
- public test.Ice.packagemd.testpkg.Test2.C1
- getTest2C2AsC1(Ice.Current __current)
+ public test.Ice.packagemd.testpkg.Test2.C1 getTest2C2AsC1(com.zeroc.Ice.Current __current)
{
return new test.Ice.packagemd.testpkg.Test2.C2();
}
@Override
- public test.Ice.packagemd.testpkg.Test2.C2
- getTest2C2AsC2(Ice.Current __current)
+ public test.Ice.packagemd.testpkg.Test2.C2 getTest2C2AsC2(com.zeroc.Ice.Current __current)
{
return new test.Ice.packagemd.testpkg.Test2.C2();
}
@Override
- public void
- throwTest2E2AsE1(Ice.Current __current)
+ public void throwTest2E2AsE1(com.zeroc.Ice.Current __current)
throws test.Ice.packagemd.testpkg.Test2.E1
{
throw new test.Ice.packagemd.testpkg.Test2.E2();
}
@Override
- public void
- throwTest2E2AsE2(Ice.Current __current)
+ public void throwTest2E2AsE2(com.zeroc.Ice.Current __current)
throws test.Ice.packagemd.testpkg.Test2.E2
{
throw new test.Ice.packagemd.testpkg.Test2.E2();
}
- public Ice.Object
- getTest3C2AsObject(Ice.Current __current)
+ public com.zeroc.Ice.Value getTest3C2AsObject(com.zeroc.Ice.Current __current)
{
return new test.Ice.packagemd.testpkg.Test3.C2();
}
@Override
- public test.Ice.packagemd.testpkg.Test3.C1
- getTest3C2AsC1(Ice.Current __current)
+ public test.Ice.packagemd.testpkg.Test3.C1 getTest3C2AsC1(com.zeroc.Ice.Current __current)
{
return new test.Ice.packagemd.testpkg.Test3.C2();
}
@Override
- public test.Ice.packagemd.testpkg.Test3.C2
- getTest3C2AsC2(Ice.Current __current)
+ public test.Ice.packagemd.testpkg.Test3.C2 getTest3C2AsC2(com.zeroc.Ice.Current __current)
{
return new test.Ice.packagemd.testpkg.Test3.C2();
}
@Override
- public void
- throwTest3E2AsE1(Ice.Current __current)
+ public void throwTest3E2AsE1(com.zeroc.Ice.Current __current)
throws test.Ice.packagemd.testpkg.Test3.E1
{
throw new test.Ice.packagemd.testpkg.Test3.E2();
}
@Override
- public void
- throwTest3E2AsE2(Ice.Current __current)
+ public void throwTest3E2AsE2(com.zeroc.Ice.Current __current)
throws test.Ice.packagemd.testpkg.Test3.E2
{
throw new test.Ice.packagemd.testpkg.Test3.E2();
}
@Override
- public void
- shutdown(Ice.Current __current)
+ public void shutdown(com.zeroc.Ice.Current __current)
{
__current.adapter.getCommunicator().shutdown();
}
diff --git a/java/test/src/main/java/test/Ice/packagemd/Server.java b/java/test/src/main/java/test/Ice/packagemd/Server.java
index 2f7abf04cf4..8b3a2326d24 100644
--- a/java/test/src/main/java/test/Ice/packagemd/Server.java
+++ b/java/test/src/main/java/test/Ice/packagemd/Server.java
@@ -14,23 +14,22 @@ public class Server extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Object object = new InitialI();
- adapter.add(object, Ice.Util.stringToIdentity("initial"));
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.Object object = new InitialI();
+ adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("initial"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.packagemd");
- initData.properties.setProperty("Ice.Package.Test1", "test.Ice.packagemd");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.packagemd");
+ r.initData.properties.setProperty("Ice.Package.Test1", "test.Ice.packagemd");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/plugin/Client.java b/java/test/src/main/java/test/Ice/plugin/Client.java
index 1cb30d326a1..43458377a65 100644
--- a/java/test/src/main/java/test/Ice/plugin/Client.java
+++ b/java/test/src/main/java/test/Ice/plugin/Client.java
@@ -28,20 +28,22 @@ public class Client extends test.Util.Application
jarFile = "../../../../../../../lib/IceTestPlugins.jar";
}
- Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.Util.InitializeResult ir = null;
+ com.zeroc.Ice.Communicator communicator = communicator();
PrintWriter printWriter = getWriter();
printWriter.print("testing a simple plug-in... ");
printWriter.flush();
try
{
- Ice.InitializationData initData = createInitData();
+ com.zeroc.Ice.InitializationData initData = createInitData();
initData.properties.setProperty("Ice.Plugin.Test",
jarFile + ":test.Ice.plugin.plugins.PluginFactory " +
"'C:\\Program Files\\' --DatabasePath 'C:\\Program Files\\Application\\db'");
- communicator = Ice.Util.initialize(args, initData);
+ ir = com.zeroc.Ice.Util.initialize(args, initData);
+ communicator = ir.communicator;
communicator.destroy();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
@@ -53,13 +55,14 @@ public class Client extends test.Util.Application
communicator = null;
try
{
- Ice.InitializationData initData = createInitData();
+ com.zeroc.Ice.InitializationData initData = createInitData();
initData.properties.setProperty("Ice.Plugin.Test",
jarFile + ":test.Ice.plugin.plugins.PluginInitializeFailFactory");
- communicator = Ice.Util.initialize(args, initData);
+ ir = com.zeroc.Ice.Util.initialize(args, initData);
+ communicator = ir.communicator;
test(false);
}
- catch(Ice.PluginInitializationException ex)
+ catch(com.zeroc.Ice.PluginInitializationException ex)
{
test(ex.getCause().getMessage().equals("PluginInitializeFailException"));
}
@@ -70,7 +73,7 @@ public class Client extends test.Util.Application
printWriter.flush();
try
{
- Ice.InitializationData initData = createInitData();
+ com.zeroc.Ice.InitializationData initData = createInitData();
initData.properties.setProperty("Ice.Plugin.PluginOne",
jarFile + ":test.Ice.plugin.plugins.PluginOneFactory");
initData.properties.setProperty("Ice.Plugin.PluginTwo",
@@ -78,10 +81,11 @@ public class Client extends test.Util.Application
initData.properties.setProperty("Ice.Plugin.PluginThree",
jarFile + ":test.Ice.plugin.plugins.PluginThreeFactory");
initData.properties.setProperty("Ice.PluginLoadOrder", "PluginOne, PluginTwo"); // Exclude PluginThree
- communicator = Ice.Util.initialize(args, initData);
+ ir = com.zeroc.Ice.Util.initialize(args, initData);
+ communicator = ir.communicator;
communicator.destroy();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
@@ -92,7 +96,7 @@ public class Client extends test.Util.Application
printWriter.flush();
try
{
- Ice.InitializationData initData = createInitData();
+ com.zeroc.Ice.InitializationData initData = createInitData();
initData.properties.setProperty("Ice.Plugin.PluginOne",
jarFile + ":test.Ice.plugin.plugins.PluginOneFactory");
initData.properties.setProperty("Ice.Plugin.PluginTwo",
@@ -101,9 +105,10 @@ public class Client extends test.Util.Application
jarFile + ":test.Ice.plugin.plugins.PluginThreeFactory");
initData.properties.setProperty("Ice.PluginLoadOrder", "PluginOne, PluginTwo");
initData.properties.setProperty("Ice.InitPlugins", "0");
- communicator = Ice.Util.initialize(args, initData);
+ ir = com.zeroc.Ice.Util.initialize(args, initData);
+ communicator = ir.communicator;
- Ice.PluginManager pm = communicator.getPluginManager();
+ com.zeroc.Ice.PluginManager pm = communicator.getPluginManager();
test(pm.getPlugin("PluginOne") != null);
test(pm.getPlugin("PluginTwo") != null);
test(pm.getPlugin("PluginThree") != null);
@@ -120,7 +125,7 @@ public class Client extends test.Util.Application
test(p4.isDestroyed());
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
@@ -132,7 +137,7 @@ public class Client extends test.Util.Application
communicator = null;
try
{
- Ice.InitializationData initData = createInitData();
+ com.zeroc.Ice.InitializationData initData = createInitData();
initData.properties.setProperty("Ice.Plugin.PluginOneFail",
jarFile + ":test.Ice.plugin.plugins.PluginOneFailFactory");
initData.properties.setProperty("Ice.Plugin.PluginTwoFail",
@@ -140,9 +145,11 @@ public class Client extends test.Util.Application
initData.properties.setProperty("Ice.Plugin.PluginThreeFail",
jarFile + ":test.Ice.plugin.plugins.PluginThreeFailFactory");
initData.properties.setProperty("Ice.PluginLoadOrder", "PluginOneFail, PluginTwoFail, PluginThreeFail");
- communicator = Ice.Util.initialize(args, initData);
+ ir = com.zeroc.Ice.Util.initialize(args, initData);
+ communicator = ir.communicator;
+ test(false);
}
- catch(Ice.PluginInitializationException ex)
+ catch(com.zeroc.Ice.PluginInitializationException ex)
{
test(ex.getCause().getMessage().equals("PluginInitializeFailException"));
}
@@ -154,22 +161,14 @@ public class Client extends test.Util.Application
return 0;
}
- @Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
- {
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- return initData;
- }
-
- private Ice.InitializationData createInitData()
+ private com.zeroc.Ice.InitializationData createInitData()
{
- Ice.InitializationData initData = createInitializationData() ;
+ com.zeroc.Ice.InitializationData initData = createInitializationData() ;
if(classLoader() != null)
{
initData.classLoader = classLoader();
}
- initData.properties = Ice.Util.createProperties();
+ initData.properties = com.zeroc.Ice.Util.createProperties();
return initData;
}
@@ -189,7 +188,7 @@ public class Client extends test.Util.Application
System.exit(result);
}
- static class MyPlugin implements Ice.Plugin
+ static class MyPlugin implements com.zeroc.Ice.Plugin
{
public boolean isInitialized()
{
diff --git a/java/test/src/main/java/test/Ice/properties/Client.java b/java/test/src/main/java/test/Ice/properties/Client.java
index 522ec06d7a5..8540c23b16f 100644
--- a/java/test/src/main/java/test/Ice/properties/Client.java
+++ b/java/test/src/main/java/test/Ice/properties/Client.java
@@ -9,10 +9,12 @@
package test.Ice.properties;
+import com.zeroc.Ice.Properties;
+import com.zeroc.Ice.Util;
+
public class Client extends test.Util.Application
{
- public static void
- test(boolean b)
+ public static void test(boolean b)
{
if(!b)
{
@@ -20,28 +22,27 @@ public class Client extends test.Util.Application
}
}
- class PropertiesClient extends Ice.Application
+ class PropertiesClient extends com.zeroc.Ice.Application
{
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
- Ice.Properties properties = communicator().getProperties();
+ Properties properties = communicator().getProperties();
test(properties.getProperty("Ice.Trace.Network").equals("1"));
test(properties.getProperty("Ice.Trace.Protocol").equals("1"));
test(properties.getProperty("Config.Path").equals(configPath));
test(properties.getProperty("Ice.ProgramName").equals("PropertiesClient"));
test(appName().equals(properties.getProperty("Ice.ProgramName")));
return 0;
- };
- };
+ }
+ }
@Override
public int run(String[] args)
{
{
System.out.print("testing load properties from UTF-8 path... ");
- Ice.Properties properties = Ice.Util.createProperties();
+ Properties properties = Util.createProperties();
properties.load(configPath);
test(properties.getProperty("Ice.Trace.Network").equals("1"));
test(properties.getProperty("Ice.Trace.Protocol").equals("1"));
@@ -59,17 +60,17 @@ public class Client extends test.Util.Application
//
System.out.print("testing using Ice.Config with multiple config files... ");
String[] args1 = new String[]{"--Ice.Config=config/config.1, config/config.2, config/config.3"};
- Ice.Properties properties = Ice.Util.createProperties(args1);
- test(properties.getProperty("Config1").equals("Config1"));
- test(properties.getProperty("Config2").equals("Config2"));
- test(properties.getProperty("Config3").equals("Config3"));
+ Util.CreatePropertiesResult cpr = Util.createProperties(args1);
+ test(cpr.properties.getProperty("Config1").equals("Config1"));
+ test(cpr.properties.getProperty("Config2").equals("Config2"));
+ test(cpr.properties.getProperty("Config3").equals("Config3"));
System.out.println("ok");
}
{
System.out.print("testing configuration file escapes... ");
String[] args1 = new String[]{"--Ice.Config=config/escapes.cfg"};
- Ice.Properties properties = Ice.Util.createProperties(args1);
+ Util.CreatePropertiesResult cpr = Util.createProperties(args1);
String[] props = new String[]{"Foo\tBar", "3",
"Foo\\tBar", "4",
@@ -96,7 +97,7 @@ public class Client extends test.Util.Application
for(int i = 0; !props[i].isEmpty(); i += 2)
{
- test(properties.getProperty(props[i]).equals(props[i + 1]));
+ test(cpr.properties.getProperty(props[i]).equals(props[i + 1]));
}
System.out.println("ok");
}
diff --git a/java/test/src/main/java/test/Ice/proxy/AMDMyDerivedClassI.java b/java/test/src/main/java/test/Ice/proxy/AMDMyDerivedClassI.java
index 68886fa161c..d54a52e8ace 100644
--- a/java/test/src/main/java/test/Ice/proxy/AMDMyDerivedClassI.java
+++ b/java/test/src/main/java/test/Ice/proxy/AMDMyDerivedClassI.java
@@ -8,49 +8,43 @@
// **********************************************************************
package test.Ice.proxy;
-import test.Ice.proxy.AMD.Test.AMD_MyClass_getContext;
-import test.Ice.proxy.AMD.Test.AMD_MyClass_shutdown;
-import test.Ice.proxy.AMD.Test.AMD_MyDerivedClass_echo;
-import test.Ice.proxy.AMD.Test.MyDerivedClass;
-public final class AMDMyDerivedClassI extends MyDerivedClass
+import java.util.concurrent.CompletionStage;
+import java.util.concurrent.CompletableFuture;
+
+import test.Ice.proxy.AMD.Test._MyDerivedClassDisp;
+
+public final class AMDMyDerivedClassI implements _MyDerivedClassDisp
{
- public
- AMDMyDerivedClassI()
+ public AMDMyDerivedClassI()
{
}
@Override
- public void
- echo_async(AMD_MyDerivedClass_echo cb,
- Ice.ObjectPrx obj,
- Ice.Current c)
+ public CompletionStage<com.zeroc.Ice.ObjectPrx> echoAsync(com.zeroc.Ice.ObjectPrx obj,
+ com.zeroc.Ice.Current current)
{
- cb.ice_response(obj);
+ return CompletableFuture.completedFuture(obj);
}
@Override
- public void
- shutdown_async(AMD_MyClass_shutdown cb,
- Ice.Current c)
+ public CompletionStage<Void> shutdownAsync(com.zeroc.Ice.Current c)
{
c.adapter.getCommunicator().shutdown();
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- getContext_async(AMD_MyClass_getContext cb, Ice.Current current)
+ public CompletionStage<java.util.Map<String, String>> getContextAsync(com.zeroc.Ice.Current current)
{
- cb.ice_response(_ctx);
+ return CompletableFuture.completedFuture(_ctx);
}
@Override
- public boolean
- ice_isA(String s, Ice.Current current)
+ public boolean ice_isA(String s, com.zeroc.Ice.Current current)
{
_ctx = current.ctx;
- return super.ice_isA(s, current);
+ return _MyDerivedClassDisp.super.ice_isA(s, current);
}
private java.util.Map<String, String> _ctx;
diff --git a/java/test/src/main/java/test/Ice/proxy/AMDServer.java b/java/test/src/main/java/test/Ice/proxy/AMDServer.java
index 82defd2909a..7b656360223 100644
--- a/java/test/src/main/java/test/Ice/proxy/AMDServer.java
+++ b/java/test/src/main/java/test/Ice/proxy/AMDServer.java
@@ -14,23 +14,22 @@ public class AMDServer extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- adapter.add(new AMDMyDerivedClassI(), Ice.Util.stringToIdentity("test"));
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new AMDMyDerivedClassI(), com.zeroc.Ice.Util.stringToIdentity("test"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy.AMD");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy.AMD");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/proxy/AllTests.java b/java/test/src/main/java/test/Ice/proxy/AllTests.java
index d5471d4510a..633f48bc256 100644
--- a/java/test/src/main/java/test/Ice/proxy/AllTests.java
+++ b/java/test/src/main/java/test/Ice/proxy/AllTests.java
@@ -8,17 +8,20 @@
// **********************************************************************
package test.Ice.proxy;
+
import java.io.PrintWriter;
+import com.zeroc.Ice.EncodingVersion;
+import com.zeroc.Ice.EndpointSelectionType;
+import com.zeroc.Ice.ObjectPrx;
+import com.zeroc.Ice.Util;
+
import test.Ice.proxy.Test.MyClassPrx;
-import test.Ice.proxy.Test.MyClassPrxHelper;
import test.Ice.proxy.Test.MyDerivedClassPrx;
-import test.Ice.proxy.Test.MyDerivedClassPrxHelper;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -26,16 +29,15 @@ public class AllTests
}
}
- public static MyClassPrx
- allTests(Ice.Communicator communicator, PrintWriter out)
+ public static MyClassPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out)
{
out.print("testing stringToProxy... ");
out.flush();
String ref = "test:default -p 12010";
- Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ ObjectPrx base = communicator.stringToProxy(ref);
test(base != null);
- Ice.ObjectPrx b1 = communicator.stringToProxy("test");
+ ObjectPrx b1 = communicator.stringToProxy("test");
test(b1.ice_getIdentity().name.equals("test") && b1.ice_getIdentity().category.length() == 0 &&
b1.ice_getAdapterId().length() == 0 && b1.ice_getFacet().length() == 0);
b1 = communicator.stringToProxy("test ");
@@ -55,7 +57,7 @@ public class AllTests
b1 = communicator.stringToProxy("\"test -f facet'");
test(false);
}
- catch(Ice.ProxyParseException ex)
+ catch(com.zeroc.Ice.ProxyParseException ex)
{
}
b1 = communicator.stringToProxy("\"test -f facet\"");
@@ -65,14 +67,15 @@ public class AllTests
test(b1.ice_getIdentity().name.equals("test -f facet@test") && b1.ice_getIdentity().category.length() == 0 &&
b1.ice_getFacet().length() == 0);
b1 = communicator.stringToProxy("\"test -f facet@test @test\"");
- test(b1.ice_getIdentity().name.equals("test -f facet@test @test") && b1.ice_getIdentity().category.length() == 0 &&
+ test(b1.ice_getIdentity().name.equals("test -f facet@test @test") &&
+ b1.ice_getIdentity().category.length() == 0 &&
b1.ice_getFacet().length() == 0);
try
{
b1 = communicator.stringToProxy("test test");
test(false);
}
- catch(Ice.ProxyParseException ex)
+ catch(com.zeroc.Ice.ProxyParseException ex)
{
}
b1 = communicator.stringToProxy("test\\040test");
@@ -82,7 +85,7 @@ public class AllTests
b1 = communicator.stringToProxy("test\\777");
test(false);
}
- catch(Ice.IdentityParseException ex)
+ catch(com.zeroc.Ice.IdentityParseException ex)
{
}
b1 = communicator.stringToProxy("test\\40test");
@@ -115,7 +118,7 @@ public class AllTests
b1 = communicator.stringToProxy("\"\" test"); // Invalid trailing characters.
test(false);
}
- catch(Ice.ProxyParseException ex)
+ catch(com.zeroc.Ice.ProxyParseException ex)
{
}
try
@@ -123,7 +126,7 @@ public class AllTests
b1 = communicator.stringToProxy("test:"); // Missing endpoint.
test(false);
}
- catch(Ice.EndpointParseException ex)
+ catch(com.zeroc.Ice.EndpointParseException ex)
{
}
@@ -135,7 +138,7 @@ public class AllTests
b1 = communicator.stringToProxy("id@adapter test");
test(false);
}
- catch(Ice.ProxyParseException ex)
+ catch(com.zeroc.Ice.ProxyParseException ex)
{
}
b1 = communicator.stringToProxy("category/test@adapter");
@@ -174,7 +177,7 @@ public class AllTests
b1 = communicator.stringToProxy("id -f \"facet x");
test(false);
}
- catch(Ice.ProxyParseException ex)
+ catch(com.zeroc.Ice.ProxyParseException ex)
{
}
try
@@ -182,7 +185,7 @@ public class AllTests
b1 = communicator.stringToProxy("id -f \'facet x");
test(false);
}
- catch(Ice.ProxyParseException ex)
+ catch(com.zeroc.Ice.ProxyParseException ex)
{
}
b1 = communicator.stringToProxy("test -f facet:tcp");
@@ -205,7 +208,7 @@ public class AllTests
b1 = communicator.stringToProxy("test -f facet@test @test");
test(false);
}
- catch(Ice.ProxyParseException ex)
+ catch(com.zeroc.Ice.ProxyParseException ex)
{
}
b1 = communicator.stringToProxy("test");
@@ -225,7 +228,7 @@ public class AllTests
b1 = communicator.stringToProxy("test -s");
test(b1.ice_isSecure());
- test(b1.ice_getEncodingVersion().equals(Ice.Util.currentEncoding()));
+ test(b1.ice_getEncodingVersion().equals(Util.currentEncoding()));
b1 = communicator.stringToProxy("test -e 1.0");
test(b1.ice_getEncodingVersion().major == 1 && b1.ice_getEncodingVersion().minor == 0);
@@ -244,7 +247,7 @@ public class AllTests
b1 = communicator.stringToProxy("test:tcp@adapterId");
test(false);
}
- catch(Ice.EndpointParseException ex)
+ catch(com.zeroc.Ice.EndpointParseException ex)
{
}
// This is an unknown endpoint warning, not a parse exception.
@@ -254,7 +257,7 @@ public class AllTests
// b1 = communicator.stringToProxy("test -f the:facet:tcp");
// test(false);
//}
- //catch(Ice.EndpointParseException ex)
+ //catch(com.zeroc.Ice.EndpointParseException ex)
//{
//}
try
@@ -262,26 +265,26 @@ public class AllTests
b1 = communicator.stringToProxy("test::tcp");
test(false);
}
- catch(Ice.EndpointParseException ex)
+ catch(com.zeroc.Ice.EndpointParseException ex)
{
}
//
// Test for bug ICE-5543: escaped escapes in stringToIdentity
//
- Ice.Identity id = new Ice.Identity("test", ",X2QNUAzSBcJ_e$AV;E\\");
- Ice.Identity id2 = Ice.Util.stringToIdentity(Ice.Util.identityToString(id));
+ com.zeroc.Ice.Identity id = new com.zeroc.Ice.Identity("test", ",X2QNUAzSBcJ_e$AV;E\\");
+ com.zeroc.Ice.Identity id2 = com.zeroc.Ice.Util.stringToIdentity(com.zeroc.Ice.Util.identityToString(id));
test(id.equals(id2));
- id = new Ice.Identity("test", ",X2QNUAz\\SB\\/cJ_e$AV;E\\\\");
- id2 = Ice.Util.stringToIdentity(Ice.Util.identityToString(id));
+ id = new com.zeroc.Ice.Identity("test", ",X2QNUAz\\SB\\/cJ_e$AV;E\\\\");
+ id2 = com.zeroc.Ice.Util.stringToIdentity(com.zeroc.Ice.Util.identityToString(id));
test(id.equals(id2));
out.println("ok");
out.print("testing propertyToProxy... ");
out.flush();
- Ice.Properties prop = communicator.getProperties();
+ com.zeroc.Ice.Properties prop = communicator.getProperties();
String propertyPrefix = "Foo.Proxy";
prop.setProperty(propertyPrefix, "test:default -p 12010");
b1 = communicator.propertyToProxy(propertyPrefix);
@@ -358,13 +361,13 @@ public class AllTests
prop.setProperty(property, "");
property = propertyPrefix + ".EndpointSelection";
- test(b1.ice_getEndpointSelection() == Ice.EndpointSelectionType.Random);
+ test(b1.ice_getEndpointSelection() == EndpointSelectionType.Random);
prop.setProperty(property, "Random");
b1 = communicator.propertyToProxy(propertyPrefix);
- test(b1.ice_getEndpointSelection() == Ice.EndpointSelectionType.Random);
+ test(b1.ice_getEndpointSelection() == EndpointSelectionType.Random);
prop.setProperty(property, "Ordered");
b1 = communicator.propertyToProxy(propertyPrefix);
- test(b1.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered);
+ test(b1.ice_getEndpointSelection() == EndpointSelectionType.Ordered);
prop.setProperty(property, "");
property = propertyPrefix + ".CollocationOptimized";
@@ -398,29 +401,29 @@ public class AllTests
b1 = b1.ice_collocationOptimized(true);
b1 = b1.ice_connectionCached(true);
b1 = b1.ice_preferSecure(false);
- b1 = b1.ice_endpointSelection(Ice.EndpointSelectionType.Ordered);
+ b1 = b1.ice_endpointSelection(EndpointSelectionType.Ordered);
b1 = b1.ice_locatorCacheTimeout(100);
b1 = b1.ice_invocationTimeout(1234);
- b1 = b1.ice_encodingVersion(new Ice.EncodingVersion((byte)1, (byte)0));
+ b1 = b1.ice_encodingVersion(new EncodingVersion((byte)1, (byte)0));
- Ice.ObjectPrx router = communicator.stringToProxy("router");
+ ObjectPrx router = communicator.stringToProxy("router");
router = router.ice_collocationOptimized(false);
router = router.ice_connectionCached(true);
router = router.ice_preferSecure(true);
- router = router.ice_endpointSelection(Ice.EndpointSelectionType.Random);
+ router = router.ice_endpointSelection(EndpointSelectionType.Random);
router = router.ice_locatorCacheTimeout(200);
router = router.ice_invocationTimeout(1500);
- Ice.ObjectPrx locator = communicator.stringToProxy("locator");
+ ObjectPrx locator = communicator.stringToProxy("locator");
locator = locator.ice_collocationOptimized(true);
locator = locator.ice_connectionCached(false);
locator = locator.ice_preferSecure(true);
- locator = locator.ice_endpointSelection(Ice.EndpointSelectionType.Random);
+ locator = locator.ice_endpointSelection(EndpointSelectionType.Random);
locator = locator.ice_locatorCacheTimeout(300);
locator = locator.ice_invocationTimeout(1500);
- locator = locator.ice_router(Ice.RouterPrxHelper.uncheckedCast(router));
- b1 = b1.ice_locator(Ice.LocatorPrxHelper.uncheckedCast(locator));
+ locator = locator.ice_router(com.zeroc.Ice.RouterPrx.uncheckedCast(router));
+ b1 = b1.ice_locator(com.zeroc.Ice.LocatorPrx.uncheckedCast(locator));
java.util.Map<String, String> proxyProps = communicator.proxyToProperty(b1, "Test");
test(proxyProps.size() == 21);
@@ -434,7 +437,7 @@ public class AllTests
test(proxyProps.get("Test.InvocationTimeout").equals("1234"));
test(proxyProps.get("Test.Locator").equals(
- "locator -t -e " + Ice.Util.encodingVersionToString(Ice.Util.currentEncoding())));
+ "locator -t -e " + Util.encodingVersionToString(Util.currentEncoding())));
// Locator collocation optimization is always disabled.
//test(proxyProps.get("Test.Locator.CollocationOptimized").equals("1"));
test(proxyProps.get("Test.Locator.ConnectionCached").equals("0"));
@@ -444,7 +447,7 @@ public class AllTests
test(proxyProps.get("Test.Locator.InvocationTimeout").equals("1500"));
test(proxyProps.get("Test.Locator.Router").equals(
- "router -t -e " + Ice.Util.encodingVersionToString(Ice.Util.currentEncoding())));
+ "router -t -e " + Util.encodingVersionToString(Util.currentEncoding())));
test(proxyProps.get("Test.Locator.Router.CollocationOptimized").equals("0"));
test(proxyProps.get("Test.Locator.Router.ConnectionCached").equals("1"));
test(proxyProps.get("Test.Locator.Router.PreferSecure").equals("1"));
@@ -461,10 +464,10 @@ public class AllTests
out.print("testing proxy methods... ");
out.flush();
- test(communicator.identityToString(
- base.ice_identity(communicator.stringToIdentity("other")).ice_getIdentity()).equals("other"));
- test(Ice.Util.identityToString(
- base.ice_identity(Ice.Util.stringToIdentity("other")).ice_getIdentity()).equals("other"));
+ test(com.zeroc.Ice.Util.identityToString(
+ base.ice_identity(com.zeroc.Ice.Util.stringToIdentity("other")).ice_getIdentity()).equals("other"));
+ test(com.zeroc.Ice.Util.identityToString(
+ base.ice_identity(com.zeroc.Ice.Util.stringToIdentity("other")).ice_getIdentity()).equals("other"));
test(base.ice_facet("facet").ice_getFacet().equals("facet"));
test(base.ice_adapterId("id").ice_getAdapterId().equals("id"));
test(base.ice_twoway().ice_isTwoway());
@@ -478,9 +481,9 @@ public class AllTests
test(!base.ice_collocationOptimized(false).ice_isCollocationOptimized());
test(base.ice_preferSecure(true).ice_isPreferSecure());
test(!base.ice_preferSecure(false).ice_isPreferSecure());
- test(base.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0));
- test(base.ice_encodingVersion(Ice.Util.Encoding_1_1).ice_getEncodingVersion().equals(Ice.Util.Encoding_1_1));
- test(!base.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_getEncodingVersion().equals(Ice.Util.Encoding_1_1));
+ test(base.ice_encodingVersion(Util.Encoding_1_0).ice_getEncodingVersion().equals(Util.Encoding_1_0));
+ test(base.ice_encodingVersion(Util.Encoding_1_1).ice_getEncodingVersion().equals(Util.Encoding_1_1));
+ test(!base.ice_encodingVersion(Util.Encoding_1_0).ice_getEncodingVersion().equals(Util.Encoding_1_1));
try
{
@@ -572,7 +575,7 @@ public class AllTests
test(communicator.stringToProxy("foo").equals(communicator.stringToProxy("foo")));
test(!communicator.stringToProxy("foo").equals(communicator.stringToProxy("foo2")));
- Ice.ObjectPrx compObj = communicator.stringToProxy("foo");
+ ObjectPrx compObj = communicator.stringToProxy("foo");
test(compObj.ice_facet("facet").equals(compObj.ice_facet("facet")));
test(!compObj.ice_facet("facet").equals(compObj.ice_facet("facet1")));
@@ -589,10 +592,10 @@ public class AllTests
test(compObj.ice_connectionCached(true).equals(compObj.ice_connectionCached(true)));
test(!compObj.ice_connectionCached(false).equals(compObj.ice_connectionCached(true)));
- test(compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random).equals(
- compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random)));
- test(!compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random).equals(
- compObj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered)));
+ test(compObj.ice_endpointSelection(EndpointSelectionType.Random).equals(
+ compObj.ice_endpointSelection(EndpointSelectionType.Random)));
+ test(!compObj.ice_endpointSelection(EndpointSelectionType.Random).equals(
+ compObj.ice_endpointSelection(EndpointSelectionType.Ordered)));
test(compObj.ice_connectionId("id2").equals(compObj.ice_connectionId("id2")));
test(!compObj.ice_connectionId("id1").equals(compObj.ice_connectionId("id2")));
@@ -606,25 +609,29 @@ public class AllTests
test(compObj.ice_timeout(20).equals(compObj.ice_timeout(20)));
test(!compObj.ice_timeout(10).equals(compObj.ice_timeout(20)));
- Ice.LocatorPrx loc1 = Ice.LocatorPrxHelper.uncheckedCast(communicator.stringToProxy("loc1:default -p 10000"));
- Ice.LocatorPrx loc2 = Ice.LocatorPrxHelper.uncheckedCast(communicator.stringToProxy("loc2:default -p 10000"));
+ com.zeroc.Ice.LocatorPrx loc1 =
+ com.zeroc.Ice.LocatorPrx.uncheckedCast(communicator.stringToProxy("loc1:default -p 10000"));
+ com.zeroc.Ice.LocatorPrx loc2 =
+ com.zeroc.Ice.LocatorPrx.uncheckedCast(communicator.stringToProxy("loc2:default -p 10000"));
test(compObj.ice_locator(null).equals(compObj.ice_locator(null)));
test(compObj.ice_locator(loc1).equals(compObj.ice_locator(loc1)));
test(!compObj.ice_locator(loc1).equals(compObj.ice_locator(null)));
test(!compObj.ice_locator(null).equals(compObj.ice_locator(loc2)));
test(!compObj.ice_locator(loc1).equals(compObj.ice_locator(loc2)));
- Ice.RouterPrx rtr1 = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("rtr1:default -p 10000"));
- Ice.RouterPrx rtr2 = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("rtr2:default -p 10000"));
+ com.zeroc.Ice.RouterPrx rtr1 =
+ com.zeroc.Ice.RouterPrx.uncheckedCast(communicator.stringToProxy("rtr1:default -p 10000"));
+ com.zeroc.Ice.RouterPrx rtr2 =
+ com.zeroc.Ice.RouterPrx.uncheckedCast(communicator.stringToProxy("rtr2:default -p 10000"));
test(compObj.ice_router(null).equals(compObj.ice_router(null)));
test(compObj.ice_router(rtr1).equals(compObj.ice_router(rtr1)));
test(!compObj.ice_router(rtr1).equals(compObj.ice_router(null)));
test(!compObj.ice_router(null).equals(compObj.ice_router(rtr2)));
test(!compObj.ice_router(rtr1).equals(compObj.ice_router(rtr2)));
- java.util.Map<String, String> ctx1 = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> ctx1 = new java.util.HashMap<>();
ctx1.put("ctx1", "v1");
- java.util.Map<String, String> ctx2 = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> ctx2 = new java.util.HashMap<>();
ctx2.put("ctx2", "v2");
test(compObj.ice_context(null).equals(compObj.ice_context(null)));
test(compObj.ice_context(ctx1).equals(compObj.ice_context(ctx1)));
@@ -635,8 +642,8 @@ public class AllTests
test(compObj.ice_preferSecure(true).equals(compObj.ice_preferSecure(true)));
test(!compObj.ice_preferSecure(true).equals(compObj.ice_preferSecure(false)));
- Ice.ObjectPrx compObj1 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10000");
- Ice.ObjectPrx compObj2 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10001");
+ ObjectPrx compObj1 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10000");
+ ObjectPrx compObj2 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10001");
test(!compObj1.equals(compObj2));
compObj1 = communicator.stringToProxy("foo@MyAdapter1");
@@ -653,15 +660,15 @@ public class AllTests
compObj2 = communicator.stringToProxy("foo@MyAdapter1");
test(!compObj1.equals(compObj2));
- Ice.Endpoint[] endpts1 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10000").ice_getEndpoints();
- Ice.Endpoint[] endpts2 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10001").ice_getEndpoints();
+ com.zeroc.Ice.Endpoint[] endpts1 =
+ communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10000").ice_getEndpoints();
+ com.zeroc.Ice.Endpoint[] endpts2 =
+ communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10001").ice_getEndpoints();
test(!endpts1[0].equals(endpts2[0]));
test(endpts1[0].equals(communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10000").ice_getEndpoints()[0]));
- test(compObj1.ice_encodingVersion(Ice.Util.Encoding_1_0).equals(
- compObj1.ice_encodingVersion(Ice.Util.Encoding_1_0)));
- test(!compObj1.ice_encodingVersion(Ice.Util.Encoding_1_0).equals(
- compObj1.ice_encodingVersion(Ice.Util.Encoding_1_1)));
+ test(compObj1.ice_encodingVersion(Util.Encoding_1_0).equals(compObj1.ice_encodingVersion(Util.Encoding_1_0)));
+ test(!compObj1.ice_encodingVersion(Util.Encoding_1_0).equals(compObj1.ice_encodingVersion(Util.Encoding_1_1)));
//
// TODO: Ideally we should also test comparison of fixed proxies.
@@ -670,9 +677,9 @@ public class AllTests
out.print("testing checked cast... ");
out.flush();
- MyClassPrx cl = MyClassPrxHelper.checkedCast(base);
+ MyClassPrx cl = MyClassPrx.checkedCast(base);
test(cl != null);
- MyDerivedClassPrx derived = MyDerivedClassPrxHelper.checkedCast(cl);
+ MyDerivedClassPrx derived = MyDerivedClassPrx.checkedCast(cl);
test(derived != null);
test(cl.equals(base));
test(derived.equals(base));
@@ -685,10 +692,10 @@ public class AllTests
java.util.Map<String, String> c = cl.getContext();
test(c == null || c.size() == 0);
- c = new java.util.HashMap<String, String>();
+ c = new java.util.HashMap<>();
c.put("one", "hello");
c.put("two", "world");
- cl = MyClassPrxHelper.checkedCast(base, c);
+ cl = MyClassPrx.checkedCast(base, c);
java.util.Map<String, String> c2 = cl.getContext();
test(c.equals(c2));
out.println("ok");
@@ -696,45 +703,44 @@ public class AllTests
out.print("testing encoding versioning... ");
out.flush();
String ref20 = "test -e 2.0:default -p 12010";
- MyClassPrx cl20 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref20));
+ MyClassPrx cl20 = MyClassPrx.uncheckedCast(communicator.stringToProxy(ref20));
try
{
cl20.ice_ping();
test(false);
}
- catch(Ice.UnsupportedEncodingException ex)
+ catch(com.zeroc.Ice.UnsupportedEncodingException ex)
{
// Server 2.0 endpoint doesn't support 1.1 version.
}
String ref10 = "test -e 1.0:default -p 12010";
- MyClassPrx cl10 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref10));
+ MyClassPrx cl10 = MyClassPrx.uncheckedCast(communicator.stringToProxy(ref10));
cl10.ice_ping();
- cl10.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping();
- cl.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping();
+ cl10.ice_encodingVersion(Util.Encoding_1_0).ice_ping();
+ cl.ice_encodingVersion(Util.Encoding_1_0).ice_ping();
// 1.3 isn't supported but since a 1.3 proxy supports 1.1, the
// call will use the 1.1 encoding
String ref13 = "test -e 1.3:default -p 12010";
- MyClassPrx cl13 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref13));
+ MyClassPrx cl13 = MyClassPrx.uncheckedCast(communicator.stringToProxy(ref13));
cl13.ice_ping();
- cl13.end_ice_ping(cl13.begin_ice_ping());
+ cl13.ice_pingAsync().join();
try
{
// Send request with bogus 1.2 encoding.
- Ice.EncodingVersion version = new Ice.EncodingVersion((byte)1, (byte)2);
- Ice.OutputStream os = new Ice.OutputStream(communicator);
+ EncodingVersion version = new EncodingVersion((byte)1, (byte)2);
+ com.zeroc.Ice.OutputStream os = new com.zeroc.Ice.OutputStream(communicator);
os.startEncapsulation();
os.endEncapsulation();
byte[] inEncaps = os.finished();
inEncaps[4] = version.major;
inEncaps[5] = version.minor;
- Ice.ByteSeqHolder outEncaps = new Ice.ByteSeqHolder();
- cl.ice_invoke("ice_ping", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ cl.ice_invoke("ice_ping", com.zeroc.Ice.OperationMode.Normal, inEncaps);
test(false);
}
- catch(Ice.UnknownLocalException ex)
+ catch(com.zeroc.Ice.UnknownLocalException ex)
{
// The server thrown an UnsupportedEncodingException
test(ex.unknown.indexOf("UnsupportedEncodingException") > 0);
@@ -743,18 +749,17 @@ public class AllTests
try
{
// Send request with bogus 2.0 encoding.
- Ice.EncodingVersion version = new Ice.EncodingVersion((byte)2, (byte)0);
- Ice.OutputStream os = new Ice.OutputStream(communicator);
+ EncodingVersion version = new EncodingVersion((byte)2, (byte)0);
+ com.zeroc.Ice.OutputStream os = new com.zeroc.Ice.OutputStream(communicator);
os.startEncapsulation();
os.endEncapsulation();
byte[] inEncaps = os.finished();
inEncaps[4] = version.major;
inEncaps[5] = version.minor;
- Ice.ByteSeqHolder outEncaps = new Ice.ByteSeqHolder();
- cl.ice_invoke("ice_ping", Ice.OperationMode.Normal, inEncaps, outEncaps);
+ cl.ice_invoke("ice_ping", com.zeroc.Ice.OperationMode.Normal, inEncaps);
test(false);
}
- catch(Ice.UnknownLocalException ex)
+ catch(com.zeroc.Ice.UnknownLocalException ex)
{
// The server thrown an UnsupportedEncodingException
test(ex.unknown.indexOf("UnsupportedEncodingException") > 0);
@@ -765,27 +770,27 @@ public class AllTests
out.print("testing protocol versioning... ");
out.flush();
ref20 = "test -p 2.0:default -p 12010";
- cl20 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref20));
+ cl20 = MyClassPrx.uncheckedCast(communicator.stringToProxy(ref20));
try
{
cl20.ice_ping();
test(false);
}
- catch(Ice.UnsupportedProtocolException ex)
+ catch(com.zeroc.Ice.UnsupportedProtocolException ex)
{
// Server 2.0 proxy doesn't support 1.0 version.
}
ref10 = "test -p 1.0:default -p 12010";
- cl10 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref10));
+ cl10 = MyClassPrx.uncheckedCast(communicator.stringToProxy(ref10));
cl10.ice_ping();
// 1.3 isn't supported but since a 1.3 proxy supports 1.1, the
// call will use the 1.1 protocol
ref13 = "test -p 1.3:default -p 12010";
- cl13 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref13));
+ cl13 = MyClassPrx.uncheckedCast(communicator.stringToProxy(ref13));
cl13.ice_ping();
- cl13.end_ice_ping(cl13.begin_ice_ping());
+ cl13.ice_pingAsync().join();
out.println("ok");
out.print("testing opaque endpoints... ");
@@ -797,7 +802,7 @@ public class AllTests
communicator.stringToProxy("id:opaque -t 99 -v abc -x abc");
test(false);
}
- catch(Ice.EndpointParseException ex)
+ catch(com.zeroc.Ice.EndpointParseException ex)
{
}
@@ -807,7 +812,7 @@ public class AllTests
communicator.stringToProxy("id:opaque");
test(false);
}
- catch(Ice.EndpointParseException ex)
+ catch(com.zeroc.Ice.EndpointParseException ex)
{
}
@@ -817,7 +822,7 @@ public class AllTests
communicator.stringToProxy("id:opaque -t 1 -t 1 -v abc");
test(false);
}
- catch(Ice.EndpointParseException ex)
+ catch(com.zeroc.Ice.EndpointParseException ex)
{
}
@@ -827,7 +832,7 @@ public class AllTests
communicator.stringToProxy("id:opaque -t 1 -v abc -v abc");
test(false);
}
- catch(Ice.EndpointParseException ex)
+ catch(com.zeroc.Ice.EndpointParseException ex)
{
}
@@ -837,7 +842,7 @@ public class AllTests
communicator.stringToProxy("id:opaque -v abc");
test(false);
}
- catch(Ice.EndpointParseException ex)
+ catch(com.zeroc.Ice.EndpointParseException ex)
{
}
@@ -847,7 +852,7 @@ public class AllTests
communicator.stringToProxy("id:opaque -t 1");
test(false);
}
- catch(Ice.EndpointParseException ex)
+ catch(com.zeroc.Ice.EndpointParseException ex)
{
}
@@ -857,7 +862,7 @@ public class AllTests
communicator.stringToProxy("id:opaque -t -v abc");
test(false);
}
- catch(Ice.EndpointParseException ex)
+ catch(com.zeroc.Ice.EndpointParseException ex)
{
}
@@ -867,7 +872,7 @@ public class AllTests
communicator.stringToProxy("id:opaque -t 1 -v");
test(false);
}
- catch(Ice.EndpointParseException ex)
+ catch(com.zeroc.Ice.EndpointParseException ex)
{
}
@@ -877,7 +882,7 @@ public class AllTests
communicator.stringToProxy("id:opaque -t x -v abc");
test(false);
}
- catch(Ice.EndpointParseException ex)
+ catch(com.zeroc.Ice.EndpointParseException ex)
{
}
@@ -887,7 +892,7 @@ public class AllTests
communicator.stringToProxy("id:opaque -t -1 -v abc");
test(false);
}
- catch(Ice.EndpointParseException ex)
+ catch(com.zeroc.Ice.EndpointParseException ex)
{
}
@@ -897,17 +902,17 @@ public class AllTests
communicator.stringToProxy("id:opaque -t 99 -v x?c");
test(false);
}
- catch(Ice.EndpointParseException ex)
+ catch(com.zeroc.Ice.EndpointParseException ex)
{
}
// Legal TCP endpoint expressed as opaque endpoint
- Ice.ObjectPrx p1 = communicator.stringToProxy("test -e 1.1:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==");
+ ObjectPrx p1 = communicator.stringToProxy("test -e 1.1:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==");
String pstr = communicator.proxyToString(p1);
test(pstr.equals("test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000"));
// Opaque endpoint encoded with 1.1 encoding.
- Ice.ObjectPrx p2 = communicator.stringToProxy("test:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==");
+ ObjectPrx p2 = communicator.stringToProxy("test:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==");
test(communicator.proxyToString(p2).equals("test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000"));
if(communicator.getProperties().getPropertyAsInt("Ice.IPv6") == 0)
@@ -917,7 +922,7 @@ public class AllTests
boolean tcp = communicator.getProperties().getProperty("Ice.Default.Protocol").equals("tcp");
if(tcp)
{
- p1.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping();
+ p1.ice_encodingVersion(Util.Encoding_1_0).ice_ping();
}
// Two legal TCP endpoints expressed as opaque endpoints
@@ -949,10 +954,10 @@ public class AllTests
{
try
{
- p1.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping();
+ p1.ice_encodingVersion(Util.Encoding_1_0).ice_ping();
test(false);
}
- catch(Ice.ConnectFailedException ex)
+ catch(com.zeroc.Ice.ConnectFailedException ex)
{
}
}
diff --git a/java/test/src/main/java/test/Ice/proxy/Client.java b/java/test/src/main/java/test/Ice/proxy/Client.java
index a3c40117591..916231a58fe 100644
--- a/java/test/src/main/java/test/Ice/proxy/Client.java
+++ b/java/test/src/main/java/test/Ice/proxy/Client.java
@@ -16,19 +16,17 @@ public class Client extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- MyClassPrx myClass = AllTests.allTests(communicator, getWriter());
+ MyClassPrx myClass = AllTests.allTests(communicator(), getWriter());
myClass.shutdown();
return 0;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/proxy/Collocated.java b/java/test/src/main/java/test/Ice/proxy/Collocated.java
index 5823e8d25c5..8d1ce1cfb95 100644
--- a/java/test/src/main/java/test/Ice/proxy/Collocated.java
+++ b/java/test/src/main/java/test/Ice/proxy/Collocated.java
@@ -14,10 +14,10 @@ public class Collocated extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.Communicator communicator = communicator();
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new MyDerivedClassI(), com.zeroc.Ice.Util.stringToIdentity("test"));
//adapter.activate(); // Don't activate OA to ensure collocation is used.
AllTests.allTests(communicator, getWriter());
@@ -26,13 +26,12 @@ public class Collocated extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy");
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy");
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/proxy/MyDerivedClassI.java b/java/test/src/main/java/test/Ice/proxy/MyDerivedClassI.java
index ed8036499b0..687ec11fffa 100644
--- a/java/test/src/main/java/test/Ice/proxy/MyDerivedClassI.java
+++ b/java/test/src/main/java/test/Ice/proxy/MyDerivedClassI.java
@@ -8,42 +8,38 @@
// **********************************************************************
package test.Ice.proxy;
-import test.Ice.proxy.Test.MyDerivedClass;
-public final class MyDerivedClassI extends MyDerivedClass
+import test.Ice.proxy.Test._MyDerivedClassDisp;
+
+public final class MyDerivedClassI implements _MyDerivedClassDisp
{
- public
- MyDerivedClassI()
+ public MyDerivedClassI()
{
}
@Override
- public Ice.ObjectPrx
- echo(Ice.ObjectPrx obj, Ice.Current c)
+ public com.zeroc.Ice.ObjectPrx echo(com.zeroc.Ice.ObjectPrx obj, com.zeroc.Ice.Current c)
{
return obj;
}
@Override
- public void
- shutdown(Ice.Current c)
+ public void shutdown(com.zeroc.Ice.Current c)
{
c.adapter.getCommunicator().shutdown();
}
@Override
- public java.util.Map<String, String>
- getContext(Ice.Current current)
+ public java.util.Map<String, String> getContext(com.zeroc.Ice.Current current)
{
return _ctx;
}
@Override
- public boolean
- ice_isA(String s, Ice.Current current)
+ public boolean ice_isA(String s, com.zeroc.Ice.Current current)
{
_ctx = current.ctx;
- return super.ice_isA(s, current);
+ return _MyDerivedClassDisp.super.ice_isA(s, current);
}
private java.util.Map<String, String> _ctx;
diff --git a/java/test/src/main/java/test/Ice/proxy/Server.java b/java/test/src/main/java/test/Ice/proxy/Server.java
index fd6252a37d1..3c936989a70 100644
--- a/java/test/src/main/java/test/Ice/proxy/Server.java
+++ b/java/test/src/main/java/test/Ice/proxy/Server.java
@@ -14,22 +14,21 @@ public class Server extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test"));
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new MyDerivedClassI(), com.zeroc.Ice.Util.stringToIdentity("test"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/retry/AllTests.java b/java/test/src/main/java/test/Ice/retry/AllTests.java
index 1324853a0fb..1c878aacf9a 100644
--- a/java/test/src/main/java/test/Ice/retry/AllTests.java
+++ b/java/test/src/main/java/test/Ice/retry/AllTests.java
@@ -11,14 +11,11 @@ package test.Ice.retry;
import java.io.PrintWriter;
-import test.Ice.retry.Test.Callback_Retry_op;
import test.Ice.retry.Test.RetryPrx;
-import test.Ice.retry.Test.RetryPrxHelper;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -33,8 +30,7 @@ public class AllTests
_called = false;
}
- public synchronized void
- check()
+ public synchronized void check()
{
while(!_called)
{
@@ -50,8 +46,7 @@ public class AllTests
_called = false;
}
- public synchronized void
- called()
+ public synchronized void called()
{
assert(!_called);
_called = true;
@@ -61,75 +56,23 @@ public class AllTests
private boolean _called;
}
- private static class AMIRegular extends Callback_Retry_op
- {
- @Override
- public void
- response()
- {
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class AMIException extends Callback_Retry_op
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(ex instanceof Ice.ConnectionLostException || ex instanceof Ice.UnknownLocalException);
- callback.called();
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- public static RetryPrx
- allTests(Ice.Communicator communicator, Ice.Communicator communicator2, PrintWriter out,
- Instrumentation instrumentation, String ref)
+ public static RetryPrx allTests(com.zeroc.Ice.Communicator communicator, com.zeroc.Ice.Communicator communicator2,
+ PrintWriter out, Instrumentation instrumentation, String ref)
{
out.print("testing stringToProxy... ");
out.flush();
- Ice.ObjectPrx base1 = communicator.stringToProxy(ref);
+ com.zeroc.Ice.ObjectPrx base1 = communicator.stringToProxy(ref);
test(base1 != null);
- Ice.ObjectPrx base2 = communicator.stringToProxy(ref);
+ com.zeroc.Ice.ObjectPrx base2 = communicator.stringToProxy(ref);
test(base2 != null);
out.println("ok");
out.print("testing checked cast... ");
out.flush();
- RetryPrx retry1 = RetryPrxHelper.checkedCast(base1);
+ RetryPrx retry1 = RetryPrx.checkedCast(base1);
test(retry1 != null);
test(retry1.equals(base1));
- RetryPrx retry2 = RetryPrxHelper.checkedCast(base2);
+ RetryPrx retry2 = RetryPrx.checkedCast(base2);
test(retry2 != null);
test(retry2.equals(base2));
out.println("ok");
@@ -148,11 +91,11 @@ public class AllTests
retry2.op(true);
test(false);
}
- catch(Ice.UnknownLocalException ex)
+ catch(com.zeroc.Ice.UnknownLocalException ex)
{
// Expected with collocation
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
}
instrumentation.testInvocationCount(1);
@@ -168,11 +111,15 @@ public class AllTests
instrumentation.testRetryCount(0);
out.println("ok");
- AMIRegular cb1 = new AMIRegular();
- AMIException cb2 = new AMIException();
+ Callback cb1 = new Callback();
+ Callback cb2 = new Callback();
out.print("calling regular AMI operation with first proxy... ");
- retry1.begin_op(false, cb1);
+ retry1.opAsync(false).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ cb1.called();
+ });
cb1.check();
instrumentation.testInvocationCount(1);
instrumentation.testFailureCount(0);
@@ -180,7 +127,12 @@ public class AllTests
out.println("ok");
out.print("calling AMI operation to kill connection with second proxy... ");
- retry2.begin_op(true, cb2);
+ retry2.opAsync(true).whenComplete((result, ex) ->
+ {
+ test(ex != null && (ex instanceof com.zeroc.Ice.ConnectionLostException ||
+ ex instanceof com.zeroc.Ice.UnknownLocalException));
+ cb2.called();
+ });
cb2.check();
instrumentation.testInvocationCount(1);
instrumentation.testFailureCount(1);
@@ -188,7 +140,11 @@ public class AllTests
out.println("ok");
out.print("calling regular AMI operation with first proxy again... ");
- retry1.begin_op(false, cb1);
+ retry1.opAsync(false).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ cb1.called();
+ });
cb1.check();
instrumentation.testInvocationCount(1);
instrumentation.testFailureCount(0);
@@ -200,7 +156,7 @@ public class AllTests
instrumentation.testInvocationCount(1);
instrumentation.testFailureCount(0);
instrumentation.testRetryCount(4);
- test(retry1.end_opIdempotent(retry1.begin_opIdempotent(4)) == 4);
+ test(retry1.opIdempotentAsync(4).join() == 4);
instrumentation.testInvocationCount(1);
instrumentation.testFailureCount(0);
instrumentation.testRetryCount(4);
@@ -212,7 +168,7 @@ public class AllTests
retry1.opNotIdempotent();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
instrumentation.testInvocationCount(1);
@@ -220,11 +176,12 @@ public class AllTests
instrumentation.testRetryCount(0);
try
{
- retry1.end_opNotIdempotent(retry1.begin_opNotIdempotent());
+ retry1.opNotIdempotentAsync().join();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(java.util.concurrent.CompletionException ex)
{
+ test(ex.getCause() instanceof com.zeroc.Ice.LocalException);
}
instrumentation.testInvocationCount(1);
instrumentation.testFailureCount(1);
@@ -249,11 +206,12 @@ public class AllTests
instrumentation.testRetryCount(0);
try
{
- retry1.end_opSystemException(retry1.begin_opSystemException());
+ retry1.opSystemExceptionAsync().join();
test(false);
}
- catch(SystemFailure ex)
+ catch(java.util.concurrent.CompletionException ex)
{
+ test(ex.getCause() instanceof SystemFailure);
}
instrumentation.testInvocationCount(1);
instrumentation.testFailureCount(1);
@@ -264,14 +222,14 @@ public class AllTests
out.print("testing invocation timeout and retries... ");
out.flush();
- retry2 = RetryPrxHelper.checkedCast(communicator2.stringToProxy(retry1.toString()));
+ retry2 = RetryPrx.checkedCast(communicator2.stringToProxy(retry1.toString()));
try
{
// No more than 2 retries before timeout kicks-in
- ((RetryPrx)retry2.ice_invocationTimeout(500)).opIdempotent(4);
+ retry2.ice_invocationTimeout(500).opIdempotent(4);
test(false);
}
- catch(Ice.InvocationTimeoutException ex)
+ catch(com.zeroc.Ice.InvocationTimeoutException ex)
{
instrumentation.testRetryCount(2);
retry2.opIdempotent(-1); // Reset the counter
@@ -280,12 +238,13 @@ public class AllTests
try
{
// No more than 2 retries before timeout kicks-in
- RetryPrx prx = (RetryPrx)retry2.ice_invocationTimeout(500);
- prx.end_opIdempotent(prx.begin_opIdempotent(4));
+ RetryPrx prx = retry2.ice_invocationTimeout(500);
+ prx.opIdempotentAsync(4).join();
test(false);
}
- catch(Ice.InvocationTimeoutException ex)
+ catch(java.util.concurrent.CompletionException ex)
{
+ test(ex.getCause() instanceof com.zeroc.Ice.InvocationTimeoutException);
instrumentation.testRetryCount(2);
retry2.opIdempotent(-1); // Reset the counter
instrumentation.testRetryCount(-1);
diff --git a/java/test/src/main/java/test/Ice/retry/Client.java b/java/test/src/main/java/test/Ice/retry/Client.java
index 37048d507c3..93d3b604483 100644
--- a/java/test/src/main/java/test/Ice/retry/Client.java
+++ b/java/test/src/main/java/test/Ice/retry/Client.java
@@ -18,18 +18,18 @@ public class Client extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.Communicator communicator = communicator();
//
// Configure a second communicator for the invocation timeout
// + retry test, we need to configure a large retry interval
// to avoid time-sensitive failures.
//
- Ice.InitializationData initData2 = createInitializationData();
+ com.zeroc.Ice.InitializationData initData2 = createInitializationData();
initData2.properties = communicator.getProperties()._clone();
initData2.properties.setProperty("Ice.RetryIntervals", "0 1 10000");
initData2.observer = instrumentation.getObserver();
- Ice.Communicator communicator2 = initialize(initData2);
+ com.zeroc.Ice.Communicator communicator2 = initialize(initData2);
try
{
@@ -45,22 +45,21 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.observer = instrumentation.getObserver();
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.observer = instrumentation.getObserver();
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry");
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry");
- initData.properties.setProperty("Ice.RetryIntervals", "0 1 400 1");
+ r.initData.properties.setProperty("Ice.RetryIntervals", "0 1 400 1");
//
// We don't want connection warnings because of the timeout
//
- initData.properties.setProperty("Ice.Warn.Connections", "0");
+ r.initData.properties.setProperty("Ice.Warn.Connections", "0");
- return initData;
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/retry/Collocated.java b/java/test/src/main/java/test/Ice/retry/Collocated.java
index 1faf02f0889..cf0c420a96e 100644
--- a/java/test/src/main/java/test/Ice/retry/Collocated.java
+++ b/java/test/src/main/java/test/Ice/retry/Collocated.java
@@ -15,29 +15,28 @@ public class Collocated extends test.Util.Application
{
private Instrumentation instrumentation = new Instrumentation();
- private void
- setupObjectAdapter(Ice.Communicator communicator)
+ private void setupObjectAdapter(com.zeroc.Ice.Communicator communicator)
{
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("");
- adapter.add(new RetryI(), Ice.Util.stringToIdentity("retry"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("");
+ adapter.add(new RetryI(), com.zeroc.Ice.Util.stringToIdentity("retry"));
//adapter.activate(); // Don't activate OA to ensure collocation is used.
}
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.Communicator communicator = communicator();
//
// Configure a second communicator for the invocation timeout
// + retry test, we need to configure a large retry interval
// to avoid time-sensitive failures.
//
- Ice.InitializationData initData2 = createInitializationData();
+ com.zeroc.Ice.InitializationData initData2 = createInitializationData();
initData2.properties = communicator.getProperties()._clone();
initData2.properties.setProperty("Ice.RetryIntervals", "0 1 10000");
initData2.observer = instrumentation.getObserver();
- Ice.Communicator communicator2 = initialize(initData2);
+ com.zeroc.Ice.Communicator communicator2 = initialize(initData2);
setupObjectAdapter(communicator);
setupObjectAdapter(communicator2);
@@ -55,23 +54,22 @@ public class Collocated extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.observer = instrumentation.getObserver();
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.observer = instrumentation.getObserver();
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry");
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry");
- initData.properties.setProperty("Ice.RetryIntervals", "0 1 10 1");
+ r.initData.properties.setProperty("Ice.RetryIntervals", "0 1 10 1");
//
// We don't want connection warnings because of the timeout
//
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ r.initData.properties.setProperty("Ice.Warn.Connections", "0");
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- return initData;
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/retry/Instrumentation.java b/java/test/src/main/java/test/Ice/retry/Instrumentation.java
index 8b5ecf06a79..73570c58bde 100644
--- a/java/test/src/main/java/test/Ice/retry/Instrumentation.java
+++ b/java/test/src/main/java/test/Ice/retry/Instrumentation.java
@@ -11,8 +11,7 @@ package test.Ice.retry;
public class Instrumentation
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -20,17 +19,15 @@ public class Instrumentation
}
}
- class InvocationObserverI implements Ice.Instrumentation.InvocationObserver
+ class InvocationObserverI implements com.zeroc.Ice.Instrumentation.InvocationObserver
{
@Override
- public void
- attach()
+ public void attach()
{
}
-
+
@Override
- public void
- detach()
+ public void detach()
{
synchronized(Instrumentation.class)
{
@@ -39,8 +36,7 @@ public class Instrumentation
}
@Override
- public void
- failed(String msg)
+ public void failed(String msg)
{
synchronized(Instrumentation.class)
{
@@ -49,8 +45,7 @@ public class Instrumentation
}
@Override
- public void
- retried()
+ public void retried()
{
synchronized(Instrumentation.class)
{
@@ -59,95 +54,91 @@ public class Instrumentation
}
@Override
- public void
- userException()
+ public void userException()
{
}
-
+
@Override
- public Ice.Instrumentation.RemoteObserver
- getRemoteObserver(Ice.ConnectionInfo ci, Ice.Endpoint ei, int i, int j)
+ public com.zeroc.Ice.Instrumentation.RemoteObserver getRemoteObserver(com.zeroc.Ice.ConnectionInfo ci,
+ com.zeroc.Ice.Endpoint ei, int i, int j)
{
return null;
}
@Override
- public Ice.Instrumentation.CollocatedObserver
- getCollocatedObserver(Ice.ObjectAdapter adapter, int i , int j)
+ public com.zeroc.Ice.Instrumentation.CollocatedObserver getCollocatedObserver(
+ com.zeroc.Ice.ObjectAdapter adapter,
+ int i,
+ int j)
{
return null;
}
- };
- private Ice.Instrumentation.InvocationObserver invocationObserver = new InvocationObserverI();
+ }
+ private com.zeroc.Ice.Instrumentation.InvocationObserver invocationObserver = new InvocationObserverI();
- class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorObserver
+ class CommunicatorObserverI implements com.zeroc.Ice.Instrumentation.CommunicatorObserver
{
@Override
- public Ice.Instrumentation.Observer
- getConnectionEstablishmentObserver(Ice.Endpoint e, String s)
+ public com.zeroc.Ice.Instrumentation.Observer getConnectionEstablishmentObserver(com.zeroc.Ice.Endpoint e,
+ String s)
{
return null;
}
@Override
- public Ice.Instrumentation.Observer
- getEndpointLookupObserver(Ice.Endpoint e)
+ public com.zeroc.Ice.Instrumentation.Observer getEndpointLookupObserver(com.zeroc.Ice.Endpoint e)
{
return null;
}
@Override
- public Ice.Instrumentation.ConnectionObserver
- getConnectionObserver(Ice.ConnectionInfo ci,
- Ice.Endpoint ei,
- Ice.Instrumentation.ConnectionState s,
- Ice.Instrumentation.ConnectionObserver o)
+ public com.zeroc.Ice.Instrumentation.ConnectionObserver getConnectionObserver(
+ com.zeroc.Ice.ConnectionInfo ci,
+ com.zeroc.Ice.Endpoint ei,
+ com.zeroc.Ice.Instrumentation.ConnectionState s,
+ com.zeroc.Ice.Instrumentation.ConnectionObserver o)
{
return null;
}
-
+
@Override
- public Ice.Instrumentation.ThreadObserver
- getThreadObserver(String p,
- String n,
- Ice.Instrumentation.ThreadState s,
- Ice.Instrumentation.ThreadObserver o)
+ public com.zeroc.Ice.Instrumentation.ThreadObserver getThreadObserver(
+ String p,
+ String n,
+ com.zeroc.Ice.Instrumentation.ThreadState s,
+ com.zeroc.Ice.Instrumentation.ThreadObserver o)
{
return null;
}
@Override
- public Ice.Instrumentation.InvocationObserver
- getInvocationObserver(Ice.ObjectPrx p, String o, java.util.Map<String, String> c)
+ public com.zeroc.Ice.Instrumentation.InvocationObserver getInvocationObserver(com.zeroc.Ice.ObjectPrx p,
+ String o,
+ java.util.Map<String, String> c)
{
return invocationObserver;
}
-
+
@Override
- public Ice.Instrumentation.DispatchObserver
- getDispatchObserver(Ice.Current c, int i)
+ public com.zeroc.Ice.Instrumentation.DispatchObserver getDispatchObserver(com.zeroc.Ice.Current c, int i)
{
return null;
}
-
+
@Override
- public void
- setObserverUpdater(Ice.Instrumentation.ObserverUpdater u)
+ public void setObserverUpdater(com.zeroc.Ice.Instrumentation.ObserverUpdater u)
{
}
- };
-
- private Ice.Instrumentation.CommunicatorObserver communicatorObserver = new CommunicatorObserverI();
+ }
+ private com.zeroc.Ice.Instrumentation.CommunicatorObserver communicatorObserver = new CommunicatorObserverI();
- public Ice.Instrumentation.CommunicatorObserver
- getObserver()
+ public com.zeroc.Ice.Instrumentation.CommunicatorObserver getObserver()
{
return communicatorObserver;
}
- static private void
- testEqual(Ice.IntHolder value, int expected)
+ static private void testEqual(IntValue value, int expected)
{
if(expected < 0)
{
@@ -180,26 +171,33 @@ public class Instrumentation
}
value.value = 0;
}
-
- public void
- testRetryCount(int expected)
+
+ public void testRetryCount(int expected)
{
testEqual(nRetry, expected);
}
- public void
- testFailureCount(int expected)
+ public void testFailureCount(int expected)
{
testEqual(nFailure, expected);
}
- public void
- testInvocationCount(int expected)
+ public void testInvocationCount(int expected)
{
testEqual(nInvocation, expected);
}
- private Ice.IntHolder nRetry = new Ice.IntHolder(0);
- private Ice.IntHolder nFailure = new Ice.IntHolder(0);
- private Ice.IntHolder nInvocation = new Ice.IntHolder(0);
-};
+ static class IntValue
+ {
+ IntValue(int v)
+ {
+ value = v;
+ }
+
+ int value;
+ }
+
+ private IntValue nRetry = new IntValue(0);
+ private IntValue nFailure = new IntValue(0);
+ private IntValue nInvocation = new IntValue(0);
+}
diff --git a/java/test/src/main/java/test/Ice/retry/RetryI.java b/java/test/src/main/java/test/Ice/retry/RetryI.java
index 453b1ddd2c7..827365878ee 100644
--- a/java/test/src/main/java/test/Ice/retry/RetryI.java
+++ b/java/test/src/main/java/test/Ice/retry/RetryI.java
@@ -8,18 +8,17 @@
// **********************************************************************
package test.Ice.retry;
-import test.Ice.retry.Test._RetryDisp;
-public final class RetryI extends _RetryDisp
+import test.Ice.retry.Test.Retry;
+
+public final class RetryI implements Retry
{
- public
- RetryI()
+ public RetryI()
{
}
@Override
- public void
- op(boolean kill, Ice.Current current)
+ public void op(boolean kill, com.zeroc.Ice.Current current)
{
if(kill)
{
@@ -29,14 +28,13 @@ public final class RetryI extends _RetryDisp
}
else
{
- throw new Ice.ConnectionLostException();
+ throw new com.zeroc.Ice.ConnectionLostException();
}
}
}
@Override
- public int
- opIdempotent(int nRetry, Ice.Current current)
+ public int opIdempotent(int nRetry, com.zeroc.Ice.Current current)
{
if(nRetry < 0)
{
@@ -47,31 +45,28 @@ public final class RetryI extends _RetryDisp
if(nRetry > _counter)
{
++_counter;
- throw new Ice.ConnectionLostException();
+ throw new com.zeroc.Ice.ConnectionLostException();
}
int counter = _counter;
_counter = 0;
return counter;
}
-
+
@Override
- public void
- opNotIdempotent(Ice.Current current)
+ public void opNotIdempotent(com.zeroc.Ice.Current current)
{
- throw new Ice.ConnectionLostException();
+ throw new com.zeroc.Ice.ConnectionLostException();
}
-
+
@Override
- public void
- opSystemException(Ice.Current c)
+ public void opSystemException(com.zeroc.Ice.Current c)
{
throw new SystemFailure();
}
-
+
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
diff --git a/java/test/src/main/java/test/Ice/retry/Server.java b/java/test/src/main/java/test/Ice/retry/Server.java
index 8d4a4f6209e..5321ac7e0e2 100644
--- a/java/test/src/main/java/test/Ice/retry/Server.java
+++ b/java/test/src/main/java/test/Ice/retry/Server.java
@@ -14,22 +14,21 @@ public class Server extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- adapter.add(new RetryI(), Ice.Util.stringToIdentity("retry"));
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new RetryI(), com.zeroc.Ice.Util.stringToIdentity("retry"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/retry/SystemFailure.java b/java/test/src/main/java/test/Ice/retry/SystemFailure.java
index 6355a7ea240..73982e28053 100644
--- a/java/test/src/main/java/test/Ice/retry/SystemFailure.java
+++ b/java/test/src/main/java/test/Ice/retry/SystemFailure.java
@@ -9,12 +9,11 @@
package test.Ice.retry;
-class SystemFailure extends Ice.SystemException
+class SystemFailure extends com.zeroc.Ice.SystemException
{
@Override
- public String
- ice_id()
+ public String ice_id()
{
return "::SystemFailure";
}
-};
+}
diff --git a/java/test/src/main/java/test/Ice/seqMapping/AMDMyClassI.java b/java/test/src/main/java/test/Ice/seqMapping/AMDMyClassI.java
index 7f5ea811728..9f20d5444bc 100644
--- a/java/test/src/main/java/test/Ice/seqMapping/AMDMyClassI.java
+++ b/java/test/src/main/java/test/Ice/seqMapping/AMDMyClassI.java
@@ -9,36 +9,39 @@
package test.Ice.seqMapping;
+import java.util.concurrent.CompletionStage;
+import java.util.concurrent.CompletableFuture;
+
import test.Ice.seqMapping.AMD.Test.*;
import test.Ice.seqMapping.Serialize.*;
-public final class AMDMyClassI extends MyClass
+public final class AMDMyClassI implements MyClass
{
@Override
- public void
- shutdown_async(AMD_MyClass_shutdown cb, Ice.Current current)
+ public CompletionStage<Void> shutdownAsync(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- opSerialSmallJava_async(AMD_MyClass_opSerialSmallJava cb, Small i, Ice.Current current)
+ public CompletionStage<MyClass.OpSerialSmallJavaResult> opSerialSmallJavaAsync(Small i,
+ com.zeroc.Ice.Current current)
{
- cb.ice_response(i, i);
+ return CompletableFuture.completedFuture(new MyClass.OpSerialSmallJavaResult(i, i));
}
@Override
- public void
- opSerialLargeJava_async(AMD_MyClass_opSerialLargeJava cb, Large i, Ice.Current current)
+ public CompletionStage<MyClass.OpSerialLargeJavaResult> opSerialLargeJavaAsync(Large i,
+ com.zeroc.Ice.Current current)
{
- cb.ice_response(i, i);
+ return CompletableFuture.completedFuture(new MyClass.OpSerialLargeJavaResult(i, i));
}
@Override
- public void opSerialStructJava_async(AMD_MyClass_opSerialStructJava cb, Struct i, Ice.Current current)
+ public CompletionStage<MyClass.OpSerialStructJavaResult> opSerialStructJavaAsync(Struct i,
+ com.zeroc.Ice.Current current)
{
- cb.ice_response(i, i);
+ return CompletableFuture.completedFuture(new MyClass.OpSerialStructJavaResult(i, i));
}
}
diff --git a/java/test/src/main/java/test/Ice/seqMapping/AMDServer.java b/java/test/src/main/java/test/Ice/seqMapping/AMDServer.java
index e19857ff333..bea35e684a6 100644
--- a/java/test/src/main/java/test/Ice/seqMapping/AMDServer.java
+++ b/java/test/src/main/java/test/Ice/seqMapping/AMDServer.java
@@ -12,24 +12,22 @@ package test.Ice.seqMapping;
public class AMDServer extends test.Util.Application
{
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- adapter.add(new AMDMyClassI(), Ice.Util.stringToIdentity("test"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.add(new AMDMyClassI(), com.zeroc.Ice.Util.stringToIdentity("test"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping.AMD");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping.AMD");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/seqMapping/AllTests.java b/java/test/src/main/java/test/Ice/seqMapping/AllTests.java
index dd47cd787d0..d6e9b7cb391 100644
--- a/java/test/src/main/java/test/Ice/seqMapping/AllTests.java
+++ b/java/test/src/main/java/test/Ice/seqMapping/AllTests.java
@@ -15,12 +15,11 @@ import test.Ice.seqMapping.Test.*;
public class AllTests
{
- public static MyClassPrx
- allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out)
+ public static MyClassPrx allTests(com.zeroc.Ice.Communicator communicator, boolean collocated, PrintWriter out)
{
String ref = "test:default -p 12010";
- Ice.ObjectPrx baseProxy = communicator.stringToProxy(ref);
- MyClassPrx cl = MyClassPrxHelper.checkedCast(baseProxy);
+ com.zeroc.Ice.ObjectPrx baseProxy = communicator.stringToProxy(ref);
+ MyClassPrx cl = MyClassPrx.checkedCast(baseProxy);
out.print("testing twoway operations... ");
out.flush();
diff --git a/java/test/src/main/java/test/Ice/seqMapping/Client.java b/java/test/src/main/java/test/Ice/seqMapping/Client.java
index 293f3ea0b9d..f4b9dfe02ac 100644
--- a/java/test/src/main/java/test/Ice/seqMapping/Client.java
+++ b/java/test/src/main/java/test/Ice/seqMapping/Client.java
@@ -14,8 +14,7 @@ import test.Ice.seqMapping.Test.*;
public class Client extends test.Util.Application
{
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
java.io.PrintWriter out = getWriter();
@@ -30,12 +29,11 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/seqMapping/Collocated.java b/java/test/src/main/java/test/Ice/seqMapping/Collocated.java
index 755e0248197..45f82daf413 100644
--- a/java/test/src/main/java/test/Ice/seqMapping/Collocated.java
+++ b/java/test/src/main/java/test/Ice/seqMapping/Collocated.java
@@ -12,12 +12,11 @@ package test.Ice.seqMapping;
public class Collocated extends test.Util.Application
{
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
java.io.PrintWriter out = getWriter();
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- adapter.add(new MyClassI(), Ice.Util.stringToIdentity("test"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.add(new MyClassI(), com.zeroc.Ice.Util.stringToIdentity("test"));
//adapter.activate(); // Don't activate OA to ensure collocation is used.
AllTests.allTests(communicator(), true, out);
@@ -26,13 +25,12 @@ public class Collocated extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/seqMapping/MyClassI.java b/java/test/src/main/java/test/Ice/seqMapping/MyClassI.java
index ced4817bdb5..38e0694ea3b 100644
--- a/java/test/src/main/java/test/Ice/seqMapping/MyClassI.java
+++ b/java/test/src/main/java/test/Ice/seqMapping/MyClassI.java
@@ -12,33 +12,29 @@ package test.Ice.seqMapping;
import test.Ice.seqMapping.Test.*;
import test.Ice.seqMapping.Serialize.*;
-public final class MyClassI extends MyClass
+public final class MyClassI implements MyClass
{
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
@Override
- public Small opSerialSmallJava(Small i, Ice.Holder<Small> o, Ice.Current current)
+ public MyClass.OpSerialSmallJavaResult opSerialSmallJava(Small i, com.zeroc.Ice.Current current)
{
- o.value = i;
- return i;
+ return new MyClass.OpSerialSmallJavaResult(i, i);
}
@Override
- public Large opSerialLargeJava(Large i, Ice.Holder<Large> o, Ice.Current current)
+ public MyClass.OpSerialLargeJavaResult opSerialLargeJava(Large i, com.zeroc.Ice.Current current)
{
- o.value = i;
- return i;
+ return new MyClass.OpSerialLargeJavaResult(i, i);
}
@Override
- public Struct opSerialStructJava(Struct i, Ice.Holder<Struct> o, Ice.Current current)
+ public MyClass.OpSerialStructJavaResult opSerialStructJava(Struct i, com.zeroc.Ice.Current current)
{
- o.value = i;
- return i;
+ return new MyClass.OpSerialStructJavaResult(i, i);
}
}
diff --git a/java/test/src/main/java/test/Ice/seqMapping/Server.java b/java/test/src/main/java/test/Ice/seqMapping/Server.java
index 21eff24ab1c..a0030daa477 100644
--- a/java/test/src/main/java/test/Ice/seqMapping/Server.java
+++ b/java/test/src/main/java/test/Ice/seqMapping/Server.java
@@ -12,24 +12,22 @@ package test.Ice.seqMapping;
public class Server extends test.Util.Application
{
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- adapter.add(new MyClassI(), Ice.Util.stringToIdentity("test"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.add(new MyClassI(), com.zeroc.Ice.Util.stringToIdentity("test"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/seqMapping/Test.ice b/java/test/src/main/java/test/Ice/seqMapping/Test.ice
index df46b2e5d47..2946052e37a 100644
--- a/java/test/src/main/java/test/Ice/seqMapping/Test.ice
+++ b/java/test/src/main/java/test/Ice/seqMapping/Test.ice
@@ -17,7 +17,7 @@ module Test
["java:serializable:test.Ice.seqMapping.Serialize.Large"] sequence<byte> SerialLarge;
["java:serializable:test.Ice.seqMapping.Serialize.Struct"] sequence<byte> SerialStruct;
-class MyClass
+interface MyClass
{
void shutdown();
diff --git a/java/test/src/main/java/test/Ice/seqMapping/TestAMD.ice b/java/test/src/main/java/test/Ice/seqMapping/TestAMD.ice
index f01c1f80e18..3c94895b5c9 100644
--- a/java/test/src/main/java/test/Ice/seqMapping/TestAMD.ice
+++ b/java/test/src/main/java/test/Ice/seqMapping/TestAMD.ice
@@ -17,7 +17,7 @@ module Test
["java:serializable:test.Ice.seqMapping.Serialize.Large"] sequence<byte> SerialLarge;
["java:serializable:test.Ice.seqMapping.Serialize.Struct"] sequence<byte> SerialStruct;
-["amd"] class MyClass
+["amd"] interface MyClass
{
void shutdown();
diff --git a/java/test/src/main/java/test/Ice/seqMapping/Twoways.java b/java/test/src/main/java/test/Ice/seqMapping/Twoways.java
index 36e0480c73b..26ec90b1651 100644
--- a/java/test/src/main/java/test/Ice/seqMapping/Twoways.java
+++ b/java/test/src/main/java/test/Ice/seqMapping/Twoways.java
@@ -14,8 +14,7 @@ import test.Ice.seqMapping.Serialize.*;
class Twoways
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -23,34 +22,29 @@ class Twoways
}
}
- static void
- twoways(MyClassPrx p)
+ static void twoways(MyClassPrx p)
{
{
Small i = null;
- Ice.Holder<Small> o = new Ice.Holder<Small>();
- Small r;
- r = p.opSerialSmallJava(i, o);
+ MyClass.OpSerialSmallJavaResult r = p.opSerialSmallJava(i);
- test(o.value == null);
- test(r == null);
+ test(r.o == null);
+ test(r.returnValue == null);
}
{
Small i = new Small();
i.i = 99;
- Ice.Holder<Small> o = new Ice.Holder<Small>();
- Small r;
try
{
- r = p.opSerialSmallJava(i, o);
+ MyClass.OpSerialSmallJavaResult r = p.opSerialSmallJava(i);
- test(o.value.i == 99);
- test(r.i == 99);
+ test(r.o.i == 99);
+ test(r.returnValue.i == 99);
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
// OK, talking to non-Java server.
}
@@ -68,35 +62,33 @@ class Twoways
i.d8 = 8.0;
i.d9 = 9.0;
i.d10 = 10.0;
- Ice.Holder<Large> o = new Ice.Holder<Large>();
- Large r;
try
{
- r = p.opSerialLargeJava(i, o);
+ MyClass.OpSerialLargeJavaResult r = p.opSerialLargeJava(i);
- test(o.value.d1 == 1.0);
- test(o.value.d2 == 2.0);
- test(o.value.d3 == 3.0);
- test(o.value.d4 == 4.0);
- test(o.value.d5 == 5.0);
- test(o.value.d6 == 6.0);
- test(o.value.d7 == 7.0);
- test(o.value.d8 == 8.0);
- test(o.value.d9 == 9.0);
- test(o.value.d10 == 10.0);
- test(r.d1 == 1.0);
- test(r.d2 == 2.0);
- test(r.d3 == 3.0);
- test(r.d4 == 4.0);
- test(r.d5 == 5.0);
- test(r.d6 == 6.0);
- test(r.d7 == 7.0);
- test(r.d8 == 8.0);
- test(r.d9 == 9.0);
- test(r.d10 == 10.0);
+ test(r.o.d1 == 1.0);
+ test(r.o.d2 == 2.0);
+ test(r.o.d3 == 3.0);
+ test(r.o.d4 == 4.0);
+ test(r.o.d5 == 5.0);
+ test(r.o.d6 == 6.0);
+ test(r.o.d7 == 7.0);
+ test(r.o.d8 == 8.0);
+ test(r.o.d9 == 9.0);
+ test(r.o.d10 == 10.0);
+ test(r.returnValue.d1 == 1.0);
+ test(r.returnValue.d2 == 2.0);
+ test(r.returnValue.d3 == 3.0);
+ test(r.returnValue.d4 == 4.0);
+ test(r.returnValue.d5 == 5.0);
+ test(r.returnValue.d6 == 6.0);
+ test(r.returnValue.d7 == 7.0);
+ test(r.returnValue.d8 == 8.0);
+ test(r.returnValue.d9 == 9.0);
+ test(r.returnValue.d10 == 10.0);
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
// OK, talking to non-Java server.
}
@@ -108,27 +100,25 @@ class Twoways
i.o2 = i;
i.s = null;
i.s2 = "Hello";
- Ice.Holder<Struct> o = new Ice.Holder<Struct>();
- Struct r;
try
{
- r = p.opSerialStructJava(i, o);
+ MyClass.OpSerialStructJavaResult r = p.opSerialStructJava(i);
- test(o.value.o == null);
- test(o.value.o2 != null);
- test(((Struct)(o.value.o2)).o == null);
- test(((Struct)(o.value.o2)).o2 == o.value.o2);
- test(o.value.s == null);
- test(o.value.s2.equals("Hello"));
- test(r.o == null);
- test(r.o2 != null);
- test(((Struct)(r.o2)).o == null);
- test(((Struct)(r.o2)).o2 == r.o2);
- test(r.s == null);
- test(r.s2.equals("Hello"));
+ test(r.o.o == null);
+ test(r.o.o2 != null);
+ test(((Struct)(r.o.o2)).o == null);
+ test(((Struct)(r.o.o2)).o2 == r.o.o2);
+ test(r.o.s == null);
+ test(r.o.s2.equals("Hello"));
+ test(r.returnValue.o == null);
+ test(r.returnValue.o2 != null);
+ test(((Struct)(r.returnValue.o2)).o == null);
+ test(((Struct)(r.returnValue.o2)).o2 == r.returnValue.o2);
+ test(r.returnValue.s == null);
+ test(r.returnValue.s2.equals("Hello"));
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
// OK, talking to non-Java server.
}
diff --git a/java/test/src/main/java/test/Ice/seqMapping/TwowaysAMI.java b/java/test/src/main/java/test/Ice/seqMapping/TwowaysAMI.java
index d76481ea4e6..67437799284 100644
--- a/java/test/src/main/java/test/Ice/seqMapping/TwowaysAMI.java
+++ b/java/test/src/main/java/test/Ice/seqMapping/TwowaysAMI.java
@@ -14,8 +14,7 @@ import test.Ice.seqMapping.Serialize.*;
class TwowaysAMI
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -30,8 +29,7 @@ class TwowaysAMI
_called = false;
}
- public synchronized boolean
- check()
+ public synchronized boolean check()
{
while(!_called)
{
@@ -48,8 +46,7 @@ class TwowaysAMI
return true;
}
- public synchronized void
- called()
+ public synchronized void called()
{
assert(!_called);
_called = true;
@@ -59,150 +56,25 @@ class TwowaysAMI
private boolean _called;
}
- private static class Callback_MyClass_opSerialSmallJavaNull extends Callback_MyClass_opSerialSmallJava
- {
- @Override
- public void
- response(Small r, Small o)
- {
- test(o == null);
- test(r == null);
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(ex instanceof Ice.OperationNotExistException); // OK, talking to non-Java server.
- }
-
- public boolean
- check()
- {
- return callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_MyClass_opSerialSmallJavaI extends Callback_MyClass_opSerialSmallJava
- {
- @Override
- public void
- response(Small r, Small o)
- {
- test(o.i == 99);
- test(r.i == 99);
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(ex instanceof Ice.OperationNotExistException); // OK, talking to non-Java server.
- }
-
- public boolean
- check()
- {
- return callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_MyClass_opSerialLargeJavaI extends Callback_MyClass_opSerialLargeJava
- {
- @Override
- public void
- response(Large r, Large o)
- {
- test(o.d1 == 1.0);
- test(o.d2 == 2.0);
- test(o.d3 == 3.0);
- test(o.d4 == 4.0);
- test(o.d5 == 5.0);
- test(o.d6 == 6.0);
- test(o.d7 == 7.0);
- test(o.d8 == 8.0);
- test(o.d9 == 9.0);
- test(o.d10 == 10.0);
- test(r.d1 == 1.0);
- test(r.d2 == 2.0);
- test(r.d3 == 3.0);
- test(r.d4 == 4.0);
- test(r.d5 == 5.0);
- test(r.d6 == 6.0);
- test(r.d7 == 7.0);
- test(r.d8 == 8.0);
- test(r.d9 == 9.0);
- test(r.d10 == 10.0);
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(ex instanceof Ice.OperationNotExistException); // OK, talking to non-Java server.
- }
-
- public boolean
- check()
- {
- return callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_MyClass_opSerialStructJavaI extends Callback_MyClass_opSerialStructJava
- {
- @Override
- public void
- response(Struct r, Struct o)
- {
- test(o.o == null);
- test(o.o2 != null);
- test(((Struct)(o.o2)).o == null);
- test(((Struct)(o.o2)).o2 == o.o2);
- test(o.s == null);
- test(o.s2.equals("Hello"));
- test(r.o == null);
- test(r.o2 != null);
- test(((Struct)(r.o2)).o == null);
- test(((Struct)(r.o2)).o2 == r.o2);
- test(r.s == null);
- test(r.s2.equals("Hello"));
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException ex)
- {
- test(ex instanceof Ice.OperationNotExistException); // OK, talking to non-Java server.
- }
-
- public boolean
- check()
- {
- return callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- static void
- twowaysAMI(MyClassPrx p)
+ static void twowaysAMI(MyClassPrx p)
{
{
Small i = null;
- Callback_MyClass_opSerialSmallJavaNull cb = new Callback_MyClass_opSerialSmallJavaNull();
- p.begin_opSerialSmallJava(i, cb);
+ Callback cb = new Callback();
+ p.opSerialSmallJavaAsync(i).whenComplete((result, ex) ->
+ {
+ if(ex != null)
+ {
+ test(ex instanceof com.zeroc.Ice.OperationNotExistException); // OK, talking to non-Java server.
+ }
+ else
+ {
+ test(result.o == null);
+ test(result.returnValue == null);
+ cb.called();
+ }
+ });
test(cb.check());
}
@@ -210,8 +82,20 @@ class TwowaysAMI
Small i = new Small();
i.i = 99;
- Callback_MyClass_opSerialSmallJavaI cb = new Callback_MyClass_opSerialSmallJavaI();
- p.begin_opSerialSmallJava(i, cb);
+ Callback cb = new Callback();
+ p.opSerialSmallJavaAsync(i).whenComplete((result, ex) ->
+ {
+ if(ex != null)
+ {
+ test(ex instanceof com.zeroc.Ice.OperationNotExistException); // OK, talking to non-Java server.
+ }
+ else
+ {
+ test(result.o.i == 99);
+ test(result.returnValue.i == 99);
+ cb.called();
+ }
+ });
test(cb.check());
}
@@ -228,8 +112,38 @@ class TwowaysAMI
i.d9 = 9.0;
i.d10 = 10.0;
- Callback_MyClass_opSerialLargeJavaI cb = new Callback_MyClass_opSerialLargeJavaI();
- p.begin_opSerialLargeJava(i, cb);
+ Callback cb = new Callback();
+ p.opSerialLargeJavaAsync(i).whenComplete((result, ex) ->
+ {
+ if(ex != null)
+ {
+ test(ex instanceof com.zeroc.Ice.OperationNotExistException); // OK, talking to non-Java server.
+ }
+ else
+ {
+ test(result.o.d1 == 1.0);
+ test(result.o.d2 == 2.0);
+ test(result.o.d3 == 3.0);
+ test(result.o.d4 == 4.0);
+ test(result.o.d5 == 5.0);
+ test(result.o.d6 == 6.0);
+ test(result.o.d7 == 7.0);
+ test(result.o.d8 == 8.0);
+ test(result.o.d9 == 9.0);
+ test(result.o.d10 == 10.0);
+ test(result.returnValue.d1 == 1.0);
+ test(result.returnValue.d2 == 2.0);
+ test(result.returnValue.d3 == 3.0);
+ test(result.returnValue.d4 == 4.0);
+ test(result.returnValue.d5 == 5.0);
+ test(result.returnValue.d6 == 6.0);
+ test(result.returnValue.d7 == 7.0);
+ test(result.returnValue.d8 == 8.0);
+ test(result.returnValue.d9 == 9.0);
+ test(result.returnValue.d10 == 10.0);
+ cb.called();
+ }
+ });
test(cb.check());
}
@@ -240,8 +154,23 @@ class TwowaysAMI
i.s = null;
i.s2 = "Hello";
- Callback_MyClass_opSerialStructJavaI cb = new Callback_MyClass_opSerialStructJavaI();
- p.begin_opSerialStructJava(i, cb);
+ Callback cb = new Callback();
+ p.opSerialStructJavaAsync(i).whenComplete((result, ex) ->
+ {
+ test(result.o.o == null);
+ test(result.o.o2 != null);
+ test(((Struct)(result.o.o2)).o == null);
+ test(((Struct)(result.o.o2)).o2 == result.o.o2);
+ test(result.o.s == null);
+ test(result.o.s2.equals("Hello"));
+ test(result.returnValue.o == null);
+ test(result.returnValue.o2 != null);
+ test(((Struct)(result.returnValue.o2)).o == null);
+ test(((Struct)(result.returnValue.o2)).o2 == result.returnValue.o2);
+ test(result.returnValue.s == null);
+ test(result.returnValue.s2.equals("Hello"));
+ cb.called();
+ });
test(cb.check());
}
}
diff --git a/java/test/src/main/java/test/Ice/serialize/AllTests.java b/java/test/src/main/java/test/Ice/serialize/AllTests.java
index 202de5696da..b38ff97e156 100644
--- a/java/test/src/main/java/test/Ice/serialize/AllTests.java
+++ b/java/test/src/main/java/test/Ice/serialize/AllTests.java
@@ -8,13 +8,14 @@
// **********************************************************************
package test.Ice.serialize;
-import test.Ice.serialize.Test.*;
+
import java.io.*;
+import test.Ice.serialize.Test.*;
+
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -22,12 +23,11 @@ public class AllTests
}
}
- public static InitialPrx
- allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out)
+ public static InitialPrx allTests(com.zeroc.Ice.Communicator communicator, boolean collocated, PrintWriter out)
{
String ref = "initial:default -p 12010";
- Ice.ObjectPrx base = communicator.stringToProxy(ref);
- InitialPrx initial = InitialPrxHelper.checkedCast(base);
+ com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ InitialPrx initial = InitialPrx.checkedCast(base);
out.print("testing serialization... ");
out.flush();
@@ -40,7 +40,7 @@ public class AllTests
//
// We expect this test to raise an exception: we are attempting to deserialize
// an instance of Struct1 using java.io.ObjectInputStream. However, we must
- // use Ice.ObjectInputStream instead because Struct1 contains a proxy.
+ // use com.zeroc.Ice.ObjectInputStream instead because Struct1 contains a proxy.
//
byte[] bytes = initial.getStruct1();
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
@@ -64,7 +64,7 @@ public class AllTests
{
byte[] bytes = initial.getStruct1();
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
- Ice.ObjectInputStream ois = new Ice.ObjectInputStream(communicator, bais);
+ com.zeroc.Ice.ObjectInputStream ois = new com.zeroc.Ice.ObjectInputStream(communicator, bais);
try
{
Struct1 s = (Struct1)ois.readObject();
@@ -87,7 +87,7 @@ public class AllTests
{
byte[] bytes = initial.getBase();
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
- Ice.ObjectInputStream ois = new Ice.ObjectInputStream(communicator, bais);
+ com.zeroc.Ice.ObjectInputStream ois = new com.zeroc.Ice.ObjectInputStream(communicator, bais);
try
{
Base b = (Base) ois.readObject();
@@ -110,7 +110,7 @@ public class AllTests
{
byte[] bytes = initial.getEx();
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
- Ice.ObjectInputStream ois = new Ice.ObjectInputStream(communicator, bais);
+ com.zeroc.Ice.ObjectInputStream ois = new com.zeroc.Ice.ObjectInputStream(communicator, bais);
try
{
Ex ex = (Ex)ois.readObject();
@@ -132,8 +132,7 @@ public class AllTests
return initial;
}
- private static void
- checkStruct1(Struct1 s)
+ private static void checkStruct1(Struct1 s)
{
test(s.bo);
test(s.by == (byte)1);
@@ -148,8 +147,7 @@ public class AllTests
s.p.ice_ping(); // Make sure the deserialized proxy is usable.
}
- private static void
- checkBase(Base b)
+ private static void checkBase(Base b)
{
test(b.b == b);
test(b.o == b);
diff --git a/java/test/src/main/java/test/Ice/serialize/Client.java b/java/test/src/main/java/test/Ice/serialize/Client.java
index ca504c66b15..369362e0def 100644
--- a/java/test/src/main/java/test/Ice/serialize/Client.java
+++ b/java/test/src/main/java/test/Ice/serialize/Client.java
@@ -8,13 +8,13 @@
// **********************************************************************
package test.Ice.serialize;
+
import test.Ice.serialize.Test.*;
public class Client extends test.Util.Application
{
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
java.io.PrintWriter out = getWriter();
InitialPrx initial = AllTests.allTests(communicator(), false, out);
@@ -23,12 +23,11 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.serialize");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.serialize");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/serialize/InitialI.java b/java/test/src/main/java/test/Ice/serialize/InitialI.java
index 60d860c93aa..4cb8dc80a28 100644
--- a/java/test/src/main/java/test/Ice/serialize/InitialI.java
+++ b/java/test/src/main/java/test/Ice/serialize/InitialI.java
@@ -8,12 +8,14 @@
// **********************************************************************
package test.Ice.serialize;
-import test.Ice.serialize.Test.*;
+
import java.io.*;
-public final class InitialI extends _InitialDisp
+import test.Ice.serialize.Test.*;
+
+public final class InitialI implements Initial
{
- InitialI(Ice.ObjectAdapter adapter, Ice.Identity ident)
+ InitialI(com.zeroc.Ice.ObjectAdapter adapter, com.zeroc.Ice.Identity ident)
{
_s = new Struct1();
_s.bo = true;
@@ -25,7 +27,7 @@ public final class InitialI extends _InitialDisp
_s.d = 6.0;
_s.str = "7";
_s.e = MyEnum.enum2;
- _s.p = InitialPrxHelper.uncheckedCast(adapter.createProxy(ident));
+ _s.p = InitialPrx.uncheckedCast(adapter.createProxy(ident));
_d = new Derived();
_d.b = _d;
@@ -35,20 +37,19 @@ public final class InitialI extends _InitialDisp
_d.seq2 = new int[] { 5, 6, 7, 8, 9 };
_d.seq3 = new MyEnum[] { MyEnum.enum3, MyEnum.enum2, MyEnum.enum1 };
_d.seq4 = new Base[] { _d };
- _d.d1 = new java.util.HashMap<Byte, Boolean>();
+ _d.d1 = new java.util.HashMap<>();
_d.d1.put((byte)1, true);
- _d.d2 = new java.util.HashMap<Short, Integer>();
+ _d.d2 = new java.util.HashMap<>();
_d.d2.put((short)2, 3);
- _d.d3 = new java.util.HashMap<String, MyEnum>();
+ _d.d3 = new java.util.HashMap<>();
_d.d3.put("enum3", MyEnum.enum3);
- _d.d4 = new java.util.HashMap<String, Base>();
+ _d.d4 = new java.util.HashMap<>();
_d.d4.put("b", _d);
_d.p = _s.p;
}
@Override
- public byte[]
- getStruct1(Ice.Current current)
+ public byte[] getStruct1(com.zeroc.Ice.Current current)
{
try
{
@@ -59,15 +60,14 @@ public final class InitialI extends _InitialDisp
}
catch(IOException ex)
{
- Ice.UnknownException e = new Ice.UnknownException();
+ com.zeroc.Ice.UnknownException e = new com.zeroc.Ice.UnknownException();
e.initCause(ex);
throw e;
}
}
@Override
- public byte[]
- getBase(Ice.Current current)
+ public byte[] getBase(com.zeroc.Ice.Current current)
{
try
{
@@ -78,15 +78,14 @@ public final class InitialI extends _InitialDisp
}
catch(IOException ex)
{
- Ice.UnknownException e = new Ice.UnknownException();
+ com.zeroc.Ice.UnknownException e = new com.zeroc.Ice.UnknownException();
e.initCause(ex);
throw e;
}
}
@Override
- public byte[]
- getEx(Ice.Current current)
+ public byte[] getEx(com.zeroc.Ice.Current current)
{
try
{
@@ -101,15 +100,14 @@ public final class InitialI extends _InitialDisp
}
catch(IOException ex)
{
- Ice.UnknownException e = new Ice.UnknownException();
+ com.zeroc.Ice.UnknownException e = new com.zeroc.Ice.UnknownException();
e.initCause(ex);
throw e;
}
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
diff --git a/java/test/src/main/java/test/Ice/serialize/Server.java b/java/test/src/main/java/test/Ice/serialize/Server.java
index a0658f19668..e4c36995150 100644
--- a/java/test/src/main/java/test/Ice/serialize/Server.java
+++ b/java/test/src/main/java/test/Ice/serialize/Server.java
@@ -12,12 +12,11 @@ package test.Ice.serialize;
public class Server extends test.Util.Application
{
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- Ice.Identity ident = Ice.Util.stringToIdentity("initial");
- Ice.Object object = new InitialI(adapter, ident);
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.Identity ident = com.zeroc.Ice.Util.stringToIdentity("initial");
+ com.zeroc.Ice.Object object = new InitialI(adapter, ident);
adapter.add(object, ident);
adapter.activate();
@@ -25,13 +24,12 @@ public class Server extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.serialize");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.serialize");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/servantLocator/AMDCookieI.java b/java/test/src/main/java/test/Ice/servantLocator/AMDCookieI.java
index 639244ab65d..b2f21b0c190 100644
--- a/java/test/src/main/java/test/Ice/servantLocator/AMDCookieI.java
+++ b/java/test/src/main/java/test/Ice/servantLocator/AMDCookieI.java
@@ -14,8 +14,7 @@ import test.Ice.servantLocator.AMD.Test.Cookie;
public final class AMDCookieI extends Cookie
{
@Override
- public String
- message()
+ public String message()
{
return "blahblah";
}
diff --git a/java/test/src/main/java/test/Ice/servantLocator/AMDServantLocatorI.java b/java/test/src/main/java/test/Ice/servantLocator/AMDServantLocatorI.java
index 348e9a94c6c..a7697752758 100644
--- a/java/test/src/main/java/test/Ice/servantLocator/AMDServantLocatorI.java
+++ b/java/test/src/main/java/test/Ice/servantLocator/AMDServantLocatorI.java
@@ -9,19 +9,21 @@
package test.Ice.servantLocator;
+import com.zeroc.Ice.ObjectNotExistException;
+import com.zeroc.Ice.ServantLocator;
+import com.zeroc.Ice.SocketException;
+import com.zeroc.Ice.UnknownException;
+import com.zeroc.Ice.UnknownLocalException;
+import com.zeroc.Ice.UnknownUserException;
+import com.zeroc.Ice.UserException;
+
import test.Ice.servantLocator.AMD.Test.Cookie;
import test.Ice.servantLocator.AMD.Test.TestImpossibleException;
import test.Ice.servantLocator.AMD.Test.TestIntfUserException;
-import Ice.ObjectNotExistException;
-import Ice.SocketException;
-import Ice.UnknownException;
-import Ice.UnknownLocalException;
-import Ice.UnknownUserException;
-public final class AMDServantLocatorI implements Ice.ServantLocator
+public final class AMDServantLocatorI implements ServantLocator
{
- public
- AMDServantLocatorI(String category)
+ public AMDServantLocatorI(String category)
{
_category = category;
_deactivated = false;
@@ -29,15 +31,13 @@ public final class AMDServantLocatorI implements Ice.ServantLocator
}
@Override
- protected synchronized void
- finalize()
+ protected synchronized void finalize()
throws Throwable
{
test(_deactivated);
}
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -46,8 +46,8 @@ public final class AMDServantLocatorI implements Ice.ServantLocator
}
@Override
- public Ice.Object
- locate(Ice.Current current, Ice.LocalObjectHolder cookie) throws Ice.UserException
+ public ServantLocator.LocateResult locate(com.zeroc.Ice.Current current)
+ throws UserException
{
synchronized(this)
{
@@ -55,10 +55,10 @@ public final class AMDServantLocatorI implements Ice.ServantLocator
}
test(current.id.category.equals(_category) || _category.length() == 0);
-
+
if(current.id.name.equals("unknown"))
{
- return null;
+ return new ServantLocator.LocateResult();
}
test(current.id.name.equals("locate") || current.id.name.equals("finished"));
@@ -73,14 +73,12 @@ public final class AMDServantLocatorI implements Ice.ServantLocator
test(_requestId == -1);
_requestId = current.requestId;
- cookie.value = new AMDCookieI();
-
- return new AMDTestI();
+ return new ServantLocator.LocateResult(new AMDTestI(), new AMDCookieI());
}
@Override
- public void
- finished(Ice.Current current, Ice.Object servant, java.lang.Object cookie) throws Ice.UserException
+ public void finished(com.zeroc.Ice.Current current, com.zeroc.Ice.Object servant, java.lang.Object cookie)
+ throws UserException
{
synchronized(this)
{
@@ -95,19 +93,18 @@ public final class AMDServantLocatorI implements Ice.ServantLocator
test(current.id.category.equals(_category) || _category.length() == 0);
test(current.id.name.equals("locate") || current.id.name.equals("finished"));
-
+
if(current.id.name.equals("finished"))
{
exception(current);
}
-
+
Cookie co = (Cookie)cookie;
test(co.message().equals("blahblah"));
}
@Override
- public synchronized void
- deactivate(String category)
+ public synchronized void deactivate(String category)
{
synchronized(this)
{
@@ -117,8 +114,8 @@ public final class AMDServantLocatorI implements Ice.ServantLocator
}
}
- private void
- exception(Ice.Current current) throws Ice.UserException
+ private void exception(com.zeroc.Ice.Current current)
+ throws UserException
{
if(current.operation.equals("ice_ids"))
{
@@ -143,7 +140,7 @@ public final class AMDServantLocatorI implements Ice.ServantLocator
//
// User exceptions are checked exceptions in Java, so it's not
// possible to throw it from the servant locator.
- //
+ //
// else if(current.operation.equals("userException"))
// {
// throw new TestIntfUserException();
diff --git a/java/test/src/main/java/test/Ice/servantLocator/AMDServer.java b/java/test/src/main/java/test/Ice/servantLocator/AMDServer.java
index 77f66d39142..50bdf4d905c 100644
--- a/java/test/src/main/java/test/Ice/servantLocator/AMDServer.java
+++ b/java/test/src/main/java/test/Ice/servantLocator/AMDServer.java
@@ -15,25 +15,24 @@ public class AMDServer extends test.Util.Application
public int run(String[] args)
{
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.addServantLocator(new AMDServantLocatorI("category"), "category");
adapter.addServantLocator(new AMDServantLocatorI(""), "");
- adapter.add(new AMDTestI(), Ice.Util.stringToIdentity("asm"));
- adapter.add(new AMDTestActivationI(), Ice.Util.stringToIdentity("test/activation"));
+ adapter.add(new AMDTestI(), com.zeroc.Ice.Util.stringToIdentity("asm"));
+ adapter.add(new AMDTestActivationI(), com.zeroc.Ice.Util.stringToIdentity("test/activation"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator.AMD");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator.AMD");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- return initData;
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/servantLocator/AMDTestActivationI.java b/java/test/src/main/java/test/Ice/servantLocator/AMDTestActivationI.java
index a90d2abb347..015dafd7d88 100644
--- a/java/test/src/main/java/test/Ice/servantLocator/AMDTestActivationI.java
+++ b/java/test/src/main/java/test/Ice/servantLocator/AMDTestActivationI.java
@@ -9,12 +9,12 @@
package test.Ice.servantLocator;
-import test.Ice.servantLocator.Test._TestActivationDisp;
+import test.Ice.servantLocator.Test.TestActivation;
-public final class AMDTestActivationI extends _TestActivationDisp
+public final class AMDTestActivationI implements TestActivation
{
@Override
- public void activateServantLocator(boolean activate, Ice.Current current)
+ public void activateServantLocator(boolean activate, com.zeroc.Ice.Current current)
{
if(activate)
{
@@ -23,7 +23,7 @@ public final class AMDTestActivationI extends _TestActivationDisp
}
else
{
- Ice.ServantLocator locator = current.adapter.removeServantLocator("");
+ com.zeroc.Ice.ServantLocator locator = current.adapter.removeServantLocator("");
locator.deactivate("");
locator = current.adapter.removeServantLocator("category");
locator.deactivate("category");
diff --git a/java/test/src/main/java/test/Ice/servantLocator/AMDTestI.java b/java/test/src/main/java/test/Ice/servantLocator/AMDTestI.java
index 9a750ad6577..539ecec23a4 100644
--- a/java/test/src/main/java/test/Ice/servantLocator/AMDTestI.java
+++ b/java/test/src/main/java/test/Ice/servantLocator/AMDTestI.java
@@ -9,87 +9,72 @@
package test.Ice.servantLocator;
-import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_asyncException;
-import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_asyncResponse;
-import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_impossibleException;
-import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_intfUserException;
-import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_javaException;
-import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_localException;
-import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_requestFailedException;
-import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_shutdown;
-import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_unknownException;
-import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_unknownLocalException;
-import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_unknownUserException;
-import test.Ice.servantLocator.AMD.Test.AMD_TestIntf_unknownExceptionWithServantException;
+import java.util.concurrent.CompletionStage;
+import java.util.concurrent.CompletableFuture;
+
import test.Ice.servantLocator.AMD.Test.TestImpossibleException;
import test.Ice.servantLocator.AMD.Test.TestIntfUserException;
-import test.Ice.servantLocator.AMD.Test._TestIntfDisp;
+import test.Ice.servantLocator.AMD.Test.TestIntf;
-public final class AMDTestI extends _TestIntfDisp
+public final class AMDTestI implements TestIntf
{
@Override
- public void
- requestFailedException_async(AMD_TestIntf_requestFailedException cb, Ice.Current current)
+ public CompletionStage<Void> requestFailedExceptionAsync(com.zeroc.Ice.Current current)
{
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- unknownUserException_async(AMD_TestIntf_unknownUserException cb, Ice.Current current)
+ public CompletionStage<Void> unknownUserExceptionAsync(com.zeroc.Ice.Current current)
{
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- unknownLocalException_async(AMD_TestIntf_unknownLocalException cb, Ice.Current current)
+ public CompletionStage<Void> unknownLocalExceptionAsync(com.zeroc.Ice.Current current)
{
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- unknownException_async(AMD_TestIntf_unknownException cb, Ice.Current current)
+ public CompletionStage<Void> unknownExceptionAsync(com.zeroc.Ice.Current current)
{
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- localException_async(AMD_TestIntf_localException cb, Ice.Current current)
+ public CompletionStage<Void> localExceptionAsync(com.zeroc.Ice.Current current)
{
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
-// public void
-// userException_async(AMD_TestIntf_userException cb, Ice.Current current)
+// public CompletionStage<Void> userExceptionAsync(com.zeroc.Ice.Current current)
// {
-// cb.ice_response();
+// return CompletableFuture.completedFuture((Void)null);
// }
@Override
- public void
- javaException_async(AMD_TestIntf_javaException cb, Ice.Current current)
+ public CompletionStage<Void> javaExceptionAsync(com.zeroc.Ice.Current current)
{
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- unknownExceptionWithServantException_async(AMD_TestIntf_unknownExceptionWithServantException cb,
- Ice.Current current)
+ public CompletionStage<Void> unknownExceptionWithServantExceptionAsync(com.zeroc.Ice.Current current)
{
- cb.ice_exception(new Ice.ObjectNotExistException());
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(new com.zeroc.Ice.ObjectNotExistException());
+ return f;
}
@Override
- public void
- impossibleException_async(AMD_TestIntf_impossibleException cb, boolean _throw, Ice.Current current)
+ public CompletionStage<String> impossibleExceptionAsync(boolean _throw, com.zeroc.Ice.Current current)
{
if(_throw)
{
- cb.ice_exception(new TestImpossibleException());
+ CompletableFuture<String> f = new CompletableFuture<>();
+ f.completeExceptionally(new TestImpossibleException());
+ return f;
}
else
{
@@ -97,17 +82,18 @@ public final class AMDTestI extends _TestIntfDisp
// Return a value so we can be sure that the stream position
// is reset correctly if finished() throws.
//
- cb.ice_response("Hello");
+ return CompletableFuture.completedFuture("Hello");
}
}
@Override
- public void
- intfUserException_async(AMD_TestIntf_intfUserException cb, boolean _throw, Ice.Current current)
+ public CompletionStage<String> intfUserExceptionAsync(boolean _throw, com.zeroc.Ice.Current current)
{
if(_throw)
{
- cb.ice_exception(new TestIntfUserException());
+ CompletableFuture<String> f = new CompletableFuture<>();
+ f.completeExceptionally(new TestIntfUserException());
+ return f;
}
else
{
@@ -115,31 +101,36 @@ public final class AMDTestI extends _TestIntfDisp
// Return a value so we can be sure that the stream position
// is reset correctly if finished() throws.
//
- cb.ice_response("Hello");
+ return CompletableFuture.completedFuture("Hello");
}
}
@Override
- public void
- asyncResponse_async(AMD_TestIntf_asyncResponse cb, Ice.Current current)
+ public CompletionStage<Void> asyncResponseAsync(com.zeroc.Ice.Current current)
{
- cb.ice_response();
- throw new Ice.ObjectNotExistException();
+ //
+ // The Java 8 mapping does not support this test.
+ //
+ //return CompletableFuture.completedFuture((Void)null);
+ throw new com.zeroc.Ice.ObjectNotExistException();
}
@Override
- public void
- asyncException_async(AMD_TestIntf_asyncException cb, Ice.Current current)
+ public CompletionStage<Void> asyncExceptionAsync(com.zeroc.Ice.Current current)
{
- cb.ice_exception(new TestIntfUserException());
- throw new Ice.ObjectNotExistException();
+ //
+ // The Java 8 mapping does not support this test.
+ //
+ //CompletableFuture<Void> f = new CompletableFuture<>();
+ //f.completeExceptionally(new TestIntfUserException());
+ //return f;
+ throw new com.zeroc.Ice.ObjectNotExistException();
}
@Override
- public void
- shutdown_async(AMD_TestIntf_shutdown cb, Ice.Current current)
+ public CompletionStage<Void> shutdownAsync(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
}
diff --git a/java/test/src/main/java/test/Ice/servantLocator/AllTests.java b/java/test/src/main/java/test/Ice/servantLocator/AllTests.java
index de9b90ee2d9..b0fe10d68ce 100644
--- a/java/test/src/main/java/test/Ice/servantLocator/AllTests.java
+++ b/java/test/src/main/java/test/Ice/servantLocator/AllTests.java
@@ -14,20 +14,17 @@ import java.io.PrintWriter;
import test.Ice.servantLocator.Test.TestImpossibleException;
import test.Ice.servantLocator.Test.TestIntfUserException;
import test.Ice.servantLocator.Test.TestIntfPrx;
-import test.Ice.servantLocator.Test.TestIntfPrxHelper;
import test.Ice.servantLocator.Test.TestActivationPrx;
-import test.Ice.servantLocator.Test.TestActivationPrxHelper;
-import Ice.ObjectNotExistException;
-import Ice.ObjectPrx;
-import Ice.UnknownException;
-import Ice.UnknownLocalException;
-import Ice.UnknownUserException;
+import com.zeroc.Ice.ObjectNotExistException;
+import com.zeroc.Ice.ObjectPrx;
+import com.zeroc.Ice.UnknownException;
+import com.zeroc.Ice.UnknownLocalException;
+import com.zeroc.Ice.UnknownUserException;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -35,8 +32,7 @@ public class AllTests
}
}
- public static void
- testExceptions(TestIntfPrx obj)
+ public static void testExceptions(TestIntfPrx obj)
{
try
{
@@ -123,7 +119,7 @@ public class AllTests
{
test(ex.unknown.indexOf("java.lang.RuntimeException: message") >= 0);
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
catch(Throwable ex)
@@ -207,19 +203,18 @@ public class AllTests
}
}
- public static TestIntfPrx
- allTests(Ice.Communicator communicator, PrintWriter out)
+ public static TestIntfPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out)
{
out.print("testing stringToProxy... ");
out.flush();
String ref = "asm:default -p 12010";
- Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref);
test(base != null);
out.println("ok");
out.print("testing checked cast... ");
out.flush();
- TestIntfPrx obj = TestIntfPrxHelper.checkedCast(base);
+ TestIntfPrx obj = TestIntfPrx.checkedCast(base);
test(obj != null);
test(obj.equals(base));
out.println("ok");
@@ -260,10 +255,10 @@ public class AllTests
out.print("testing servant locator... ");
out.flush();
base = communicator.stringToProxy("category/locate:default -p 12010");
- obj = TestIntfPrxHelper.checkedCast(base);
+ obj = TestIntfPrx.checkedCast(base);
try
{
- TestIntfPrxHelper.checkedCast(communicator.stringToProxy("category/unknown:default -p 12010"));
+ TestIntfPrx.checkedCast(communicator.stringToProxy("category/unknown:default -p 12010"));
}
catch(ObjectNotExistException ex)
{
@@ -273,19 +268,19 @@ public class AllTests
out.print("testing default servant locator... ");
out.flush();
base = communicator.stringToProxy("anothercat/locate:default -p 12010");
- obj = TestIntfPrxHelper.checkedCast(base);
+ obj = TestIntfPrx.checkedCast(base);
base = communicator.stringToProxy("locate:default -p 12010");
- obj = TestIntfPrxHelper.checkedCast(base);
+ obj = TestIntfPrx.checkedCast(base);
try
{
- TestIntfPrxHelper.checkedCast(communicator.stringToProxy("anothercat/unknown:default -p 12010"));
+ TestIntfPrx.checkedCast(communicator.stringToProxy("anothercat/unknown:default -p 12010"));
}
catch(ObjectNotExistException ex)
{
}
try
{
- TestIntfPrxHelper.checkedCast(communicator.stringToProxy("unknown:default -p 12010"));
+ TestIntfPrx.checkedCast(communicator.stringToProxy("unknown:default -p 12010"));
}
catch(ObjectNotExistException ex)
{
@@ -295,14 +290,14 @@ public class AllTests
out.print("testing locate exceptions... ");
out.flush();
base = communicator.stringToProxy("category/locate:default -p 12010");
- obj = TestIntfPrxHelper.checkedCast(base);
+ obj = TestIntfPrx.checkedCast(base);
testExceptions(obj);
out.println("ok");
out.print("testing finished exceptions... ");
out.flush();
base = communicator.stringToProxy("category/finished:default -p 12010");
- obj = TestIntfPrxHelper.checkedCast(base);
+ obj = TestIntfPrx.checkedCast(base);
testExceptions(obj);
//
@@ -346,7 +341,7 @@ public class AllTests
out.print("testing servant locator removal... ");
out.flush();
base = communicator.stringToProxy("test/activation:default -p 12010");
- TestActivationPrx activation = TestActivationPrxHelper.checkedCast(base);
+ TestActivationPrx activation = TestActivationPrx.checkedCast(base);
activation.activateServantLocator(false);
try
{
diff --git a/java/test/src/main/java/test/Ice/servantLocator/Client.java b/java/test/src/main/java/test/Ice/servantLocator/Client.java
index fa676eb383c..99622d68ed3 100644
--- a/java/test/src/main/java/test/Ice/servantLocator/Client.java
+++ b/java/test/src/main/java/test/Ice/servantLocator/Client.java
@@ -22,12 +22,11 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/servantLocator/Collocated.java b/java/test/src/main/java/test/Ice/servantLocator/Collocated.java
index 6e4fbf4e820..d9455de1cf2 100644
--- a/java/test/src/main/java/test/Ice/servantLocator/Collocated.java
+++ b/java/test/src/main/java/test/Ice/servantLocator/Collocated.java
@@ -14,26 +14,25 @@ public class Collocated extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.addServantLocator(new ServantLocatorI("category"), "category");
adapter.addServantLocator(new ServantLocatorI(""), "");
- adapter.add(new TestI(), Ice.Util.stringToIdentity("asm"));
- adapter.add(new TestActivationI(), Ice.Util.stringToIdentity("test/activation"));
+ adapter.add(new TestI(), com.zeroc.Ice.Util.stringToIdentity("asm"));
+ adapter.add(new TestActivationI(), com.zeroc.Ice.Util.stringToIdentity("test/activation"));
AllTests.allTests(communicator(), getWriter());
return 0;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- return initData;
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/servantLocator/CookieI.java b/java/test/src/main/java/test/Ice/servantLocator/CookieI.java
index 38934db95a1..cc560e847ec 100644
--- a/java/test/src/main/java/test/Ice/servantLocator/CookieI.java
+++ b/java/test/src/main/java/test/Ice/servantLocator/CookieI.java
@@ -14,8 +14,7 @@ import test.Ice.servantLocator.Test.Cookie;
public final class CookieI extends Cookie
{
@Override
- public String
- message()
+ public String message()
{
return "blahblah";
}
diff --git a/java/test/src/main/java/test/Ice/servantLocator/ServantLocatorI.java b/java/test/src/main/java/test/Ice/servantLocator/ServantLocatorI.java
index 09f12a13efb..34d0cbfb59b 100644
--- a/java/test/src/main/java/test/Ice/servantLocator/ServantLocatorI.java
+++ b/java/test/src/main/java/test/Ice/servantLocator/ServantLocatorI.java
@@ -9,19 +9,21 @@
package test.Ice.servantLocator;
+import com.zeroc.Ice.ObjectNotExistException;
+import com.zeroc.Ice.ServantLocator;
+import com.zeroc.Ice.SocketException;
+import com.zeroc.Ice.UnknownException;
+import com.zeroc.Ice.UnknownLocalException;
+import com.zeroc.Ice.UnknownUserException;
+import com.zeroc.Ice.UserException;
+
import test.Ice.servantLocator.Test.Cookie;
import test.Ice.servantLocator.Test.TestImpossibleException;
import test.Ice.servantLocator.Test.TestIntfUserException;
-import Ice.ObjectNotExistException;
-import Ice.SocketException;
-import Ice.UnknownException;
-import Ice.UnknownLocalException;
-import Ice.UnknownUserException;
-public final class ServantLocatorI implements Ice.ServantLocator
+public final class ServantLocatorI implements ServantLocator
{
- public
- ServantLocatorI(String category)
+ public ServantLocatorI(String category)
{
_category = category;
_deactivated = false;
@@ -29,15 +31,13 @@ public final class ServantLocatorI implements Ice.ServantLocator
}
@Override
- protected synchronized void
- finalize()
+ protected synchronized void finalize()
throws Throwable
{
test(_deactivated);
}
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -46,8 +46,8 @@ public final class ServantLocatorI implements Ice.ServantLocator
}
@Override
- public Ice.Object
- locate(Ice.Current current, Ice.LocalObjectHolder cookie) throws Ice.UserException
+ public ServantLocator.LocateResult locate(com.zeroc.Ice.Current current)
+ throws UserException
{
synchronized(this)
{
@@ -55,10 +55,10 @@ public final class ServantLocatorI implements Ice.ServantLocator
}
test(current.id.category.equals(_category) || _category.length() == 0);
-
+
if(current.id.name.equals("unknown"))
{
- return null;
+ return new ServantLocator.LocateResult();
}
test(current.id.name.equals("locate") || current.id.name.equals("finished"));
@@ -73,14 +73,12 @@ public final class ServantLocatorI implements Ice.ServantLocator
test(_requestId == -1);
_requestId = current.requestId;
- cookie.value = new CookieI();
-
- return new TestI();
+ return new ServantLocator.LocateResult(new TestI(), new CookieI());
}
@Override
- public void
- finished(Ice.Current current, Ice.Object servant, java.lang.Object cookie) throws Ice.UserException
+ public void finished(com.zeroc.Ice.Current current, com.zeroc.Ice.Object servant, java.lang.Object cookie)
+ throws UserException
{
synchronized(this)
{
@@ -95,19 +93,18 @@ public final class ServantLocatorI implements Ice.ServantLocator
test(current.id.category.equals(_category) || _category.length() == 0);
test(current.id.name.equals("locate") || current.id.name.equals("finished"));
-
+
if(current.id.name.equals("finished"))
{
exception(current);
}
-
+
Cookie co = (Cookie)cookie;
test(co.message().equals("blahblah"));
}
@Override
- public synchronized void
- deactivate(String category)
+ public synchronized void deactivate(String category)
{
synchronized(this)
{
@@ -117,8 +114,8 @@ public final class ServantLocatorI implements Ice.ServantLocator
}
}
- private void
- exception(Ice.Current current) throws Ice.UserException
+ private void exception(com.zeroc.Ice.Current current)
+ throws UserException
{
if(current.operation.equals("ice_ids"))
{
@@ -143,7 +140,7 @@ public final class ServantLocatorI implements Ice.ServantLocator
//
// User exceptions are checked exceptions in Java, so it's not
// possible to throw it from the servant locator.
- //
+ //
// else if(current.operation.equals("userException"))
// {
// throw new TestIntfUserException();
diff --git a/java/test/src/main/java/test/Ice/servantLocator/Server.java b/java/test/src/main/java/test/Ice/servantLocator/Server.java
index 9559c24a7a4..6aa0b684d8d 100644
--- a/java/test/src/main/java/test/Ice/servantLocator/Server.java
+++ b/java/test/src/main/java/test/Ice/servantLocator/Server.java
@@ -14,25 +14,24 @@ public class Server extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.addServantLocator(new ServantLocatorI("category"), "category");
adapter.addServantLocator(new ServantLocatorI(""), "");
- adapter.add(new TestI(), Ice.Util.stringToIdentity("asm"));
- adapter.add(new TestActivationI(), Ice.Util.stringToIdentity("test/activation"));
+ adapter.add(new TestI(), com.zeroc.Ice.Util.stringToIdentity("asm"));
+ adapter.add(new TestActivationI(), com.zeroc.Ice.Util.stringToIdentity("test/activation"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- return initData;
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/servantLocator/TestActivationI.java b/java/test/src/main/java/test/Ice/servantLocator/TestActivationI.java
index 094992022df..664b1b612b0 100644
--- a/java/test/src/main/java/test/Ice/servantLocator/TestActivationI.java
+++ b/java/test/src/main/java/test/Ice/servantLocator/TestActivationI.java
@@ -9,12 +9,12 @@
package test.Ice.servantLocator;
-import test.Ice.servantLocator.Test._TestActivationDisp;
+import test.Ice.servantLocator.Test.TestActivation;
-public final class TestActivationI extends _TestActivationDisp
+public final class TestActivationI implements TestActivation
{
@Override
- public void activateServantLocator(boolean activate, Ice.Current current)
+ public void activateServantLocator(boolean activate, com.zeroc.Ice.Current current)
{
if(activate)
{
@@ -23,7 +23,7 @@ public final class TestActivationI extends _TestActivationDisp
}
else
{
- Ice.ServantLocator locator = current.adapter.removeServantLocator("");
+ com.zeroc.Ice.ServantLocator locator = current.adapter.removeServantLocator("");
locator.deactivate("");
locator = current.adapter.removeServantLocator("category");
locator.deactivate("category");
diff --git a/java/test/src/main/java/test/Ice/servantLocator/TestI.java b/java/test/src/main/java/test/Ice/servantLocator/TestI.java
index f479681d910..8baeafa1763 100644
--- a/java/test/src/main/java/test/Ice/servantLocator/TestI.java
+++ b/java/test/src/main/java/test/Ice/servantLocator/TestI.java
@@ -11,61 +11,53 @@ package test.Ice.servantLocator;
import test.Ice.servantLocator.Test.TestImpossibleException;
import test.Ice.servantLocator.Test.TestIntfUserException;
-import test.Ice.servantLocator.Test._TestIntfDisp;
+import test.Ice.servantLocator.Test.TestIntf;
-public final class TestI extends _TestIntfDisp
+public final class TestI implements TestIntf
{
@Override
- public void
- requestFailedException(Ice.Current current)
+ public void requestFailedException(com.zeroc.Ice.Current current)
{
}
@Override
- public void
- unknownUserException(Ice.Current current)
+ public void unknownUserException(com.zeroc.Ice.Current current)
{
}
@Override
- public void
- unknownLocalException(Ice.Current current)
+ public void unknownLocalException(com.zeroc.Ice.Current current)
{
}
@Override
- public void
- unknownException(Ice.Current current)
+ public void unknownException(com.zeroc.Ice.Current current)
{
}
@Override
- public void
- localException(Ice.Current current)
+ public void localException(com.zeroc.Ice.Current current)
{
}
-// public void
-// userException(Ice.Current current)
+// public void userException(com.zeroc.Ice.Current current)
// {
// }
@Override
- public void
- javaException(Ice.Current current)
+ public void javaException(com.zeroc.Ice.Current current)
{
}
@Override
- public void
- unknownExceptionWithServantException(Ice.Current current)
+ public void unknownExceptionWithServantException(com.zeroc.Ice.Current current)
{
- throw new Ice.ObjectNotExistException();
+ throw new com.zeroc.Ice.ObjectNotExistException();
}
@Override
- public String
- impossibleException(boolean _throw, Ice.Current current) throws TestImpossibleException
+ public String impossibleException(boolean _throw, com.zeroc.Ice.Current current)
+ throws TestImpossibleException
{
if(_throw)
{
@@ -80,8 +72,8 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public String
- intfUserException(boolean _throw, Ice.Current current) throws TestIntfUserException, TestImpossibleException
+ public String intfUserException(boolean _throw, com.zeroc.Ice.Current current)
+ throws TestIntfUserException, TestImpossibleException
{
if(_throw)
{
@@ -96,8 +88,8 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- asyncResponse(Ice.Current current) throws TestIntfUserException, TestImpossibleException
+ public void asyncResponse(com.zeroc.Ice.Current current)
+ throws TestIntfUserException, TestImpossibleException
{
//
// Only relevant for AMD.
@@ -105,8 +97,8 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- asyncException(Ice.Current current) throws TestIntfUserException, TestImpossibleException
+ public void asyncException(com.zeroc.Ice.Current current)
+ throws TestIntfUserException, TestImpossibleException
{
//
// Only relevant for AMD.
@@ -114,8 +106,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
diff --git a/java/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java b/java/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java
index 220b71f7e03..e1aef24a5d0 100644
--- a/java/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java
+++ b/java/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java
@@ -14,22 +14,21 @@ public class AMDServer extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- Ice.Object object = new AMDTestI();
- adapter.add(object, Ice.Util.stringToIdentity("Test"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.Object object = new AMDTestI();
+ adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("Test"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.exceptions.serverAMD");
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.exceptions.serverAMD");
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/slicing/exceptions/AMDTestI.java b/java/test/src/main/java/test/Ice/slicing/exceptions/AMDTestI.java
index a500d1b6da5..ad0c19f582e 100644
--- a/java/test/src/main/java/test/Ice/slicing/exceptions/AMDTestI.java
+++ b/java/test/src/main/java/test/Ice/slicing/exceptions/AMDTestI.java
@@ -9,12 +9,14 @@
package test.Ice.slicing.exceptions;
+import java.util.concurrent.CompletionStage;
+import java.util.concurrent.CompletableFuture;
+
import test.Ice.slicing.exceptions.serverAMD.Test.*;
-public final class AMDTestI extends _TestIntfDisp
+public final class AMDTestI implements TestIntf
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -23,240 +25,258 @@ public final class AMDTestI extends _TestIntfDisp
}
@Override
- public void
- shutdown_async(AMD_TestIntf_shutdown cb, Ice.Current current)
+ public CompletionStage<Void> shutdownAsync(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- baseAsBase_async(AMD_TestIntf_baseAsBase cb, Ice.Current current)
+ public CompletionStage<Void> baseAsBaseAsync(com.zeroc.Ice.Current current)
throws Base
{
Base b = new Base();
b.b = "Base.b";
- cb.ice_exception(b);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(b);
+ return f;
}
@Override
- public void
- unknownDerivedAsBase_async(AMD_TestIntf_unknownDerivedAsBase cb, Ice.Current current)
+ public CompletionStage<Void> unknownDerivedAsBaseAsync(com.zeroc.Ice.Current current)
throws Base
{
UnknownDerived d = new UnknownDerived();
d.b = "UnknownDerived.b";
d.ud = "UnknownDerived.ud";
- cb.ice_exception(d);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(d);
+ return f;
}
@Override
- public void
- knownDerivedAsBase_async(AMD_TestIntf_knownDerivedAsBase cb, Ice.Current current)
+ public CompletionStage<Void> knownDerivedAsBaseAsync(com.zeroc.Ice.Current current)
throws Base
{
KnownDerived d = new KnownDerived();
d.b = "KnownDerived.b";
d.kd = "KnownDerived.kd";
- cb.ice_exception(d);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(d);
+ return f;
}
@Override
- public void
- knownDerivedAsKnownDerived_async(AMD_TestIntf_knownDerivedAsKnownDerived cb, Ice.Current current)
+ public CompletionStage<Void> knownDerivedAsKnownDerivedAsync(com.zeroc.Ice.Current current)
throws KnownDerived
{
KnownDerived d = new KnownDerived();
d.b = "KnownDerived.b";
d.kd = "KnownDerived.kd";
- cb.ice_exception(d);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(d);
+ return f;
}
@Override
- public void
- unknownIntermediateAsBase_async(AMD_TestIntf_unknownIntermediateAsBase cb, Ice.Current current)
+ public CompletionStage<Void> unknownIntermediateAsBaseAsync(com.zeroc.Ice.Current current)
throws Base
{
UnknownIntermediate ui = new UnknownIntermediate();
ui.b = "UnknownIntermediate.b";
ui.ui = "UnknownIntermediate.ui";
- cb.ice_exception(ui);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(ui);
+ return f;
}
@Override
- public void
- knownIntermediateAsBase_async(AMD_TestIntf_knownIntermediateAsBase cb, Ice.Current current)
+ public CompletionStage<Void> knownIntermediateAsBaseAsync(com.zeroc.Ice.Current current)
throws Base
{
KnownIntermediate ki = new KnownIntermediate();
ki.b = "KnownIntermediate.b";
ki.ki = "KnownIntermediate.ki";
- cb.ice_exception(ki);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(ki);
+ return f;
}
@Override
- public void
- knownMostDerivedAsBase_async(AMD_TestIntf_knownMostDerivedAsBase cb, Ice.Current current)
+ public CompletionStage<Void> knownMostDerivedAsBaseAsync(com.zeroc.Ice.Current current)
throws Base
{
KnownMostDerived kmd = new KnownMostDerived();
kmd.b = "KnownMostDerived.b";
kmd.ki = "KnownMostDerived.ki";
kmd.kmd = "KnownMostDerived.kmd";
- cb.ice_exception(kmd);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(kmd);
+ return f;
}
@Override
- public void
- knownIntermediateAsKnownIntermediate_async(AMD_TestIntf_knownIntermediateAsKnownIntermediate cb,
- Ice.Current current)
+ public CompletionStage<Void> knownIntermediateAsKnownIntermediateAsync(com.zeroc.Ice.Current current)
throws KnownIntermediate
{
KnownIntermediate ki = new KnownIntermediate();
ki.b = "KnownIntermediate.b";
ki.ki = "KnownIntermediate.ki";
- cb.ice_exception(ki);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(ki);
+ return f;
}
@Override
- public void
- knownMostDerivedAsKnownIntermediate_async(AMD_TestIntf_knownMostDerivedAsKnownIntermediate cb,
- Ice.Current current)
+ public CompletionStage<Void> knownMostDerivedAsKnownIntermediateAsync(com.zeroc.Ice.Current current)
throws KnownIntermediate
{
KnownMostDerived kmd = new KnownMostDerived();
kmd.b = "KnownMostDerived.b";
kmd.ki = "KnownMostDerived.ki";
kmd.kmd = "KnownMostDerived.kmd";
- cb.ice_exception(kmd);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(kmd);
+ return f;
}
@Override
- public void
- knownMostDerivedAsKnownMostDerived_async(AMD_TestIntf_knownMostDerivedAsKnownMostDerived cb,
- Ice.Current current)
+ public CompletionStage<Void>
+ knownMostDerivedAsKnownMostDerivedAsync(com.zeroc.Ice.Current current)
throws KnownMostDerived
{
KnownMostDerived kmd = new KnownMostDerived();
kmd.b = "KnownMostDerived.b";
kmd.ki = "KnownMostDerived.ki";
kmd.kmd = "KnownMostDerived.kmd";
- cb.ice_exception(kmd);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(kmd);
+ return f;
}
@Override
- public void
- unknownMostDerived1AsBase_async(AMD_TestIntf_unknownMostDerived1AsBase cb, Ice.Current current)
+ public CompletionStage<Void> unknownMostDerived1AsBaseAsync(com.zeroc.Ice.Current current)
throws Base
{
UnknownMostDerived1 umd1 = new UnknownMostDerived1();
umd1.b = "UnknownMostDerived1.b";
umd1.ki = "UnknownMostDerived1.ki";
umd1.umd1 = "UnknownMostDerived1.umd1";
- cb.ice_exception(umd1);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(umd1);
+ return f;
}
@Override
- public void
- unknownMostDerived1AsKnownIntermediate_async(AMD_TestIntf_unknownMostDerived1AsKnownIntermediate cb,
- Ice.Current current)
+ public CompletionStage<Void> unknownMostDerived1AsKnownIntermediateAsync(com.zeroc.Ice.Current current)
throws KnownIntermediate
{
UnknownMostDerived1 umd1 = new UnknownMostDerived1();
umd1.b = "UnknownMostDerived1.b";
umd1.ki = "UnknownMostDerived1.ki";
umd1.umd1 = "UnknownMostDerived1.umd1";
- cb.ice_exception(umd1);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(umd1);
+ return f;
}
@Override
- public void
- unknownMostDerived2AsBase_async(AMD_TestIntf_unknownMostDerived2AsBase cb, Ice.Current current)
+ public CompletionStage<Void> unknownMostDerived2AsBaseAsync(com.zeroc.Ice.Current current)
throws Base
{
UnknownMostDerived2 umd2 = new UnknownMostDerived2();
umd2.b = "UnknownMostDerived2.b";
umd2.ui = "UnknownMostDerived2.ui";
umd2.umd2 = "UnknownMostDerived2.umd2";
- cb.ice_exception(umd2);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(umd2);
+ return f;
}
@Override
- public void
- unknownMostDerived2AsBaseCompact_async(AMD_TestIntf_unknownMostDerived2AsBaseCompact cb, Ice.Current current)
+ public CompletionStage<Void> unknownMostDerived2AsBaseCompactAsync(com.zeroc.Ice.Current current)
{
UnknownMostDerived2 umd2 = new UnknownMostDerived2();
umd2.b = "UnknownMostDerived2.b";
umd2.ui = "UnknownMostDerived2.ui";
umd2.umd2 = "UnknownMostDerived2.umd2";
- cb.ice_exception(umd2);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(umd2);
+ return f;
}
@Override
- public void
- knownPreservedAsBase_async(AMD_TestIntf_knownPreservedAsBase cb, Ice.Current current)
+ public CompletionStage<Void> knownPreservedAsBaseAsync(com.zeroc.Ice.Current current)
{
KnownPreservedDerived ex = new KnownPreservedDerived();
ex.b = "base";
ex.kp = "preserved";
ex.kpd = "derived";
- cb.ice_exception(ex);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(ex);
+ return f;
}
@Override
- public void
- knownPreservedAsKnownPreserved_async(AMD_TestIntf_knownPreservedAsKnownPreserved cb, Ice.Current current)
+ public CompletionStage<Void> knownPreservedAsKnownPreservedAsync(com.zeroc.Ice.Current current)
{
KnownPreservedDerived ex = new KnownPreservedDerived();
ex.b = "base";
ex.kp = "preserved";
ex.kpd = "derived";
- cb.ice_exception(ex);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(ex);
+ return f;
}
@Override
- public void
- relayKnownPreservedAsBase_async(AMD_TestIntf_relayKnownPreservedAsBase cb, RelayPrx r, Ice.Current current)
+ public CompletionStage<Void> relayKnownPreservedAsBaseAsync(RelayPrx r, com.zeroc.Ice.Current current)
{
try
{
r.knownPreservedAsBase();
test(false);
+ return null;
}
- catch(Ice.UserException ex)
+ catch(com.zeroc.Ice.UserException ex)
{
- cb.ice_exception(ex);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(ex);
+ return f;
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
- cb.ice_exception(ex);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(ex);
+ return f;
}
}
@Override
- public void
- relayKnownPreservedAsKnownPreserved_async(AMD_TestIntf_relayKnownPreservedAsKnownPreserved cb,
- RelayPrx r, Ice.Current current)
+ public CompletionStage<Void> relayKnownPreservedAsKnownPreservedAsync(RelayPrx r, com.zeroc.Ice.Current current)
{
try
{
r.knownPreservedAsKnownPreserved();
test(false);
+ return null;
}
- catch(Ice.UserException ex)
+ catch(com.zeroc.Ice.UserException ex)
{
- cb.ice_exception(ex);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(ex);
+ return f;
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
- cb.ice_exception(ex);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(ex);
+ return f;
}
}
@Override
- public void
- unknownPreservedAsBase_async(AMD_TestIntf_unknownPreservedAsBase cb, Ice.Current current)
+ public CompletionStage<Void> unknownPreservedAsBaseAsync(com.zeroc.Ice.Current current)
{
SPreserved2 ex = new SPreserved2();
ex.b = "base";
@@ -264,12 +284,13 @@ public final class AMDTestI extends _TestIntfDisp
ex.kpd = "derived";
ex.p1 = new SPreservedClass("bc", "spc");
ex.p2 = ex.p1;
- cb.ice_exception(ex);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(ex);
+ return f;
}
@Override
- public void
- unknownPreservedAsKnownPreserved_async(AMD_TestIntf_unknownPreservedAsKnownPreserved cb, Ice.Current current)
+ public CompletionStage<Void> unknownPreservedAsKnownPreservedAsync(com.zeroc.Ice.Current current)
{
SPreserved2 ex = new SPreserved2();
ex.b = "base";
@@ -277,45 +298,54 @@ public final class AMDTestI extends _TestIntfDisp
ex.kpd = "derived";
ex.p1 = new SPreservedClass("bc", "spc");
ex.p2 = ex.p1;
- cb.ice_exception(ex);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(ex);
+ return f;
}
@Override
- public void
- relayUnknownPreservedAsBase_async(AMD_TestIntf_relayUnknownPreservedAsBase cb, RelayPrx r, Ice.Current current)
+ public CompletionStage<Void> relayUnknownPreservedAsBaseAsync(RelayPrx r, com.zeroc.Ice.Current current)
{
try
{
r.unknownPreservedAsBase();
test(false);
+ return null;
}
- catch(Ice.UserException ex)
+ catch(com.zeroc.Ice.UserException ex)
{
- cb.ice_exception(ex);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(ex);
+ return f;
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
- cb.ice_exception(ex);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(ex);
+ return f;
}
}
@Override
- public void
- relayUnknownPreservedAsKnownPreserved_async(AMD_TestIntf_relayUnknownPreservedAsKnownPreserved cb, RelayPrx r,
- Ice.Current current)
+ public CompletionStage<Void> relayUnknownPreservedAsKnownPreservedAsync(RelayPrx r, com.zeroc.Ice.Current current)
{
try
{
r.unknownPreservedAsKnownPreserved();
test(false);
+ return null;
}
- catch(Ice.UserException ex)
+ catch(com.zeroc.Ice.UserException ex)
{
- cb.ice_exception(ex);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(ex);
+ return f;
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
- cb.ice_exception(ex);
+ CompletableFuture<Void> f = new CompletableFuture<>();
+ f.completeExceptionally(ex);
+ return f;
}
}
}
diff --git a/java/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java b/java/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java
index c9426103f5e..f7c1807962d 100644
--- a/java/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java
+++ b/java/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java
@@ -13,8 +13,7 @@ import test.Ice.slicing.exceptions.client.Test.*;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -29,8 +28,7 @@ public class AllTests
_called = false;
}
- public synchronized void
- check()
+ public synchronized void check()
{
while(!_called)
{
@@ -45,9 +43,8 @@ public class AllTests
_called = false;
}
-
- public synchronized void
- called()
+
+ public synchronized void called()
{
assert(!_called);
_called = true;
@@ -57,615 +54,10 @@ public class AllTests
private boolean _called;
}
- private static class Callback_TestIntf_baseAsBaseI extends Callback_TestIntf_baseAsBase
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.UserException exc)
- {
- try
- {
- throw exc;
- }
- catch(Base b)
- {
- test(b.b.equals("Base.b"));
- test(b.ice_id().equals("::Test::Base"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- callback.called();
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_unknownDerivedAsBaseI extends Callback_TestIntf_unknownDerivedAsBase
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.UserException exc)
- {
- try
- {
- throw exc;
- }
- catch(Base b)
- {
- test(b.b.equals("UnknownDerived.b"));
- test(b.ice_id().equals("::Test::Base"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- callback.called();
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_knownDerivedAsBaseI extends Callback_TestIntf_knownDerivedAsBase
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.UserException exc)
- {
- try
- {
- throw exc;
- }
- catch(KnownDerived k)
- {
- test(k.b.equals("KnownDerived.b"));
- test(k.kd.equals("KnownDerived.kd"));
- test(k.ice_id().equals("::Test::KnownDerived"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- callback.called();
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_knownDerivedAsKnownDerivedI
- extends Callback_TestIntf_knownDerivedAsKnownDerived
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.UserException exc)
- {
- try
- {
- throw exc;
- }
- catch(KnownDerived k)
- {
- test(k.b.equals("KnownDerived.b"));
- test(k.kd.equals("KnownDerived.kd"));
- test(k.ice_id().equals("::Test::KnownDerived"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- callback.called();
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_unknownIntermediateAsBaseI
- extends Callback_TestIntf_unknownIntermediateAsBase
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.UserException exc)
- {
- try
- {
- throw exc;
- }
- catch(Base b)
- {
- test(b.b.equals("UnknownIntermediate.b"));
- test(b.ice_id().equals("::Test::Base"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- callback.called();
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_knownIntermediateAsBaseI extends Callback_TestIntf_knownIntermediateAsBase
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.UserException exc)
- {
- try
- {
- throw exc;
- }
- catch(KnownIntermediate ki)
- {
- test(ki.b.equals("KnownIntermediate.b"));
- test(ki.ki.equals("KnownIntermediate.ki"));
- test(ki.ice_id().equals("::Test::KnownIntermediate"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- callback.called();
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_knownMostDerivedAsBaseI extends Callback_TestIntf_knownMostDerivedAsBase
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.UserException exc)
- {
- try
- {
- throw exc;
- }
- catch(KnownMostDerived kmd)
- {
- test(kmd.b.equals("KnownMostDerived.b"));
- test(kmd.ki.equals("KnownMostDerived.ki"));
- test(kmd.kmd.equals("KnownMostDerived.kmd"));
- test(kmd.ice_id().equals("::Test::KnownMostDerived"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- callback.called();
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_knownIntermediateAsKnownIntermediateI
- extends Callback_TestIntf_knownIntermediateAsKnownIntermediate
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.UserException exc)
- {
- try
- {
- throw exc;
- }
- catch(KnownIntermediate ki)
- {
- test(ki.b.equals("KnownIntermediate.b"));
- test(ki.ki.equals("KnownIntermediate.ki"));
- test(ki.ice_id().equals("::Test::KnownIntermediate"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- callback.called();
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_knownMostDerivedAsKnownIntermediateI
- extends Callback_TestIntf_knownMostDerivedAsKnownIntermediate
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.UserException exc)
- {
- try
- {
- throw exc;
- }
- catch(KnownMostDerived kmd)
- {
- test(kmd.b.equals("KnownMostDerived.b"));
- test(kmd.ki.equals("KnownMostDerived.ki"));
- test(kmd.kmd.equals("KnownMostDerived.kmd"));
- test(kmd.ice_id().equals("::Test::KnownMostDerived"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- callback.called();
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_knownMostDerivedAsKnownMostDerivedI
- extends Callback_TestIntf_knownMostDerivedAsKnownMostDerived
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.UserException exc)
- {
- try
- {
- throw exc;
- }
- catch(KnownMostDerived kmd)
- {
- test(kmd.b.equals("KnownMostDerived.b"));
- test(kmd.ki.equals("KnownMostDerived.ki"));
- test(kmd.kmd.equals("KnownMostDerived.kmd"));
- test(kmd.ice_id().equals("::Test::KnownMostDerived"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- callback.called();
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_unknownMostDerived1AsBaseI
- extends Callback_TestIntf_unknownMostDerived1AsBase
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.UserException exc)
- {
- try
- {
- throw exc;
- }
- catch(KnownIntermediate ki)
- {
- test(ki.b.equals("UnknownMostDerived1.b"));
- test(ki.ki.equals("UnknownMostDerived1.ki"));
- test(ki.ice_id().equals("::Test::KnownIntermediate"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- callback.called();
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_unknownMostDerived1AsKnownIntermediateI
- extends Callback_TestIntf_unknownMostDerived1AsKnownIntermediate
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.UserException exc)
- {
- try
- {
- throw exc;
- }
- catch(KnownIntermediate ki)
- {
- test(ki.b.equals("UnknownMostDerived1.b"));
- test(ki.ki.equals("UnknownMostDerived1.ki"));
- test(ki.ice_id().equals("::Test::KnownIntermediate"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- callback.called();
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_unknownMostDerived2AsBaseI
- extends Callback_TestIntf_unknownMostDerived2AsBase
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.UserException exc)
- {
- try
- {
- throw exc;
- }
- catch(Base b)
- {
- test(b.b.equals("UnknownMostDerived2.b"));
- test(b.ice_id().equals("::Test::Base"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- callback.called();
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class RelayI extends _RelayDisp
+ private static class RelayI implements Relay
{
@Override
- public void knownPreservedAsBase(Ice.Current current)
+ public void knownPreservedAsBase(com.zeroc.Ice.Current current)
throws Base
{
KnownPreservedDerived ex = new KnownPreservedDerived();
@@ -676,7 +68,7 @@ public class AllTests
}
@Override
- public void knownPreservedAsKnownPreserved(Ice.Current current)
+ public void knownPreservedAsKnownPreserved(com.zeroc.Ice.Current current)
throws KnownPreserved
{
KnownPreservedDerived ex = new KnownPreservedDerived();
@@ -687,7 +79,7 @@ public class AllTests
}
@Override
- public void unknownPreservedAsBase(Ice.Current current)
+ public void unknownPreservedAsBase(com.zeroc.Ice.Current current)
throws Base
{
Preserved2 ex = new Preserved2();
@@ -700,7 +92,7 @@ public class AllTests
}
@Override
- public void unknownPreservedAsKnownPreserved(Ice.Current current)
+ public void unknownPreservedAsKnownPreserved(com.zeroc.Ice.Current current)
throws KnownPreserved
{
Preserved2 ex = new Preserved2();
@@ -713,19 +105,19 @@ public class AllTests
}
}
- public static TestIntfPrx
- allTests(Ice.Communicator communicator, boolean collocated, java.io.PrintWriter out)
+ public static TestIntfPrx allTests(com.zeroc.Ice.Communicator communicator, boolean collocated,
+ java.io.PrintWriter out)
{
- out.print("testing stringToProxy... ");
+ out.print("testing stringToProxy... ");
out.flush();
String ref = "Test:default -p 12010 -t 10000";
- Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref);
test(base != null);
out.println("ok");
out.print("testing checked cast... ");
out.flush();
- TestIntfPrx test = TestIntfPrxHelper.checkedCast(base);
+ TestIntfPrx test = TestIntfPrx.checkedCast(base);
test(test != null);
test(test.equals(base));
out.println("ok");
@@ -753,8 +145,15 @@ public class AllTests
out.print("base (AMI)... ");
out.flush();
{
- Callback_TestIntf_baseAsBaseI cb = new Callback_TestIntf_baseAsBaseI();
- test.begin_baseAsBase(cb);
+ Callback cb = new Callback();
+ test.baseAsBaseAsync().whenComplete((result, ex) ->
+ {
+ test(ex != null && ex instanceof Base);
+ Base b = (Base)ex;
+ test(b.b.equals("Base.b"));
+ test(b.ice_id().equals("::Test::Base"));
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -782,8 +181,15 @@ public class AllTests
out.print("slicing of unknown derived (AMI)... ");
out.flush();
{
- Callback_TestIntf_unknownDerivedAsBaseI cb = new Callback_TestIntf_unknownDerivedAsBaseI();
- test.begin_unknownDerivedAsBase(cb);
+ Callback cb = new Callback();
+ test.unknownDerivedAsBaseAsync().whenComplete((result, ex) ->
+ {
+ test(ex != null && ex instanceof Base);
+ Base b = (Base)ex;
+ test(b.b.equals("UnknownDerived.b"));
+ test(b.ice_id().equals("::Test::Base"));
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -812,8 +218,16 @@ public class AllTests
out.print("non-slicing of known derived as base (AMI)... ");
out.flush();
{
- Callback_TestIntf_knownDerivedAsBaseI cb = new Callback_TestIntf_knownDerivedAsBaseI();
- test.begin_knownDerivedAsBase(cb);
+ Callback cb = new Callback();
+ test.knownDerivedAsBaseAsync().whenComplete((result, ex) ->
+ {
+ test(ex != null && ex instanceof KnownDerived);
+ KnownDerived k = (KnownDerived)ex;
+ test(k.b.equals("KnownDerived.b"));
+ test(k.kd.equals("KnownDerived.kd"));
+ test(k.ice_id().equals("::Test::KnownDerived"));
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -842,8 +256,16 @@ public class AllTests
out.print("non-slicing of known derived as derived (AMI)... ");
out.flush();
{
- Callback_TestIntf_knownDerivedAsKnownDerivedI cb = new Callback_TestIntf_knownDerivedAsKnownDerivedI();
- test.begin_knownDerivedAsKnownDerived(cb);
+ Callback cb = new Callback();
+ test.knownDerivedAsKnownDerivedAsync().whenComplete((result, ex) ->
+ {
+ test(ex != null && ex instanceof KnownDerived);
+ KnownDerived k = (KnownDerived)ex;
+ test(k.b.equals("KnownDerived.b"));
+ test(k.kd.equals("KnownDerived.kd"));
+ test(k.ice_id().equals("::Test::KnownDerived"));
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -871,8 +293,15 @@ public class AllTests
out.print("slicing of unknown intermediate as base (AMI)... ");
out.flush();
{
- Callback_TestIntf_unknownIntermediateAsBaseI cb = new Callback_TestIntf_unknownIntermediateAsBaseI();
- test.begin_unknownIntermediateAsBase(cb);
+ Callback cb = new Callback();
+ test.unknownIntermediateAsBaseAsync().whenComplete((result, ex) ->
+ {
+ test(ex != null && ex instanceof Base);
+ Base b = (Base)ex;
+ test(b.b.equals("UnknownIntermediate.b"));
+ test(b.ice_id().equals("::Test::Base"));
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -901,8 +330,16 @@ public class AllTests
out.print("slicing of known intermediate as base (AMI)... ");
out.flush();
{
- Callback_TestIntf_knownIntermediateAsBaseI cb = new Callback_TestIntf_knownIntermediateAsBaseI();
- test.begin_knownIntermediateAsBase(cb);
+ Callback cb = new Callback();
+ test.knownIntermediateAsBaseAsync().whenComplete((result, ex) ->
+ {
+ test(ex != null && ex instanceof KnownIntermediate);
+ KnownIntermediate ki = (KnownIntermediate)ex;
+ test(ki.b.equals("KnownIntermediate.b"));
+ test(ki.ki.equals("KnownIntermediate.ki"));
+ test(ki.ice_id().equals("::Test::KnownIntermediate"));
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -932,8 +369,17 @@ public class AllTests
out.print("slicing of known most derived as base (AMI)... ");
out.flush();
{
- Callback_TestIntf_knownMostDerivedAsBaseI cb = new Callback_TestIntf_knownMostDerivedAsBaseI();
- test.begin_knownMostDerivedAsBase(cb);
+ Callback cb = new Callback();
+ test.knownMostDerivedAsBaseAsync().whenComplete((result, ex) ->
+ {
+ test(ex != null && ex instanceof KnownMostDerived);
+ KnownMostDerived kmd = (KnownMostDerived)ex;
+ test(kmd.b.equals("KnownMostDerived.b"));
+ test(kmd.ki.equals("KnownMostDerived.ki"));
+ test(kmd.kmd.equals("KnownMostDerived.kmd"));
+ test(kmd.ice_id().equals("::Test::KnownMostDerived"));
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -962,9 +408,16 @@ public class AllTests
out.print("non-slicing of known intermediate as intermediate (AMI)... ");
out.flush();
{
- Callback_TestIntf_knownIntermediateAsKnownIntermediateI cb =
- new Callback_TestIntf_knownIntermediateAsKnownIntermediateI();
- test.begin_knownIntermediateAsKnownIntermediate(cb);
+ Callback cb = new Callback();
+ test.knownIntermediateAsKnownIntermediateAsync().whenComplete((result, ex) ->
+ {
+ test(ex != null && ex instanceof KnownIntermediate);
+ KnownIntermediate ki = (KnownIntermediate)ex;
+ test(ki.b.equals("KnownIntermediate.b"));
+ test(ki.ki.equals("KnownIntermediate.ki"));
+ test(ki.ice_id().equals("::Test::KnownIntermediate"));
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -994,9 +447,17 @@ public class AllTests
out.print("non-slicing of known most derived as intermediate (AMI)... ");
out.flush();
{
- Callback_TestIntf_knownMostDerivedAsKnownIntermediateI cb =
- new Callback_TestIntf_knownMostDerivedAsKnownIntermediateI();
- test.begin_knownMostDerivedAsKnownIntermediate(cb);
+ Callback cb = new Callback();
+ test.knownMostDerivedAsKnownIntermediateAsync().whenComplete((result, ex) ->
+ {
+ test(ex != null && ex instanceof KnownMostDerived);
+ KnownMostDerived kmd = (KnownMostDerived)ex;
+ test(kmd.b.equals("KnownMostDerived.b"));
+ test(kmd.ki.equals("KnownMostDerived.ki"));
+ test(kmd.kmd.equals("KnownMostDerived.kmd"));
+ test(kmd.ice_id().equals("::Test::KnownMostDerived"));
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -1026,9 +487,17 @@ public class AllTests
out.print("non-slicing of known most derived as most derived (AMI)... ");
out.flush();
{
- Callback_TestIntf_knownMostDerivedAsKnownMostDerivedI cb =
- new Callback_TestIntf_knownMostDerivedAsKnownMostDerivedI();
- test.begin_knownMostDerivedAsKnownMostDerived(cb);
+ Callback cb = new Callback();
+ test.knownMostDerivedAsKnownMostDerivedAsync().whenComplete((result, ex) ->
+ {
+ test(ex != null && ex instanceof KnownMostDerived);
+ KnownMostDerived kmd = (KnownMostDerived)ex;
+ test(kmd.b.equals("KnownMostDerived.b"));
+ test(kmd.ki.equals("KnownMostDerived.ki"));
+ test(kmd.kmd.equals("KnownMostDerived.kmd"));
+ test(kmd.ice_id().equals("::Test::KnownMostDerived"));
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -1057,8 +526,16 @@ public class AllTests
out.print("slicing of unknown most derived, known intermediate as base (AMI)... ");
out.flush();
{
- Callback_TestIntf_unknownMostDerived1AsBaseI cb = new Callback_TestIntf_unknownMostDerived1AsBaseI();
- test.begin_unknownMostDerived1AsBase(cb);
+ Callback cb = new Callback();
+ test.unknownMostDerived1AsBaseAsync().whenComplete((result, ex) ->
+ {
+ test(ex != null && ex instanceof KnownIntermediate);
+ KnownIntermediate ki = (KnownIntermediate)ex;
+ test(ki.b.equals("UnknownMostDerived1.b"));
+ test(ki.ki.equals("UnknownMostDerived1.ki"));
+ test(ki.ice_id().equals("::Test::KnownIntermediate"));
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -1087,9 +564,16 @@ public class AllTests
out.print("slicing of unknown most derived, known intermediate as intermediate (AMI)... ");
out.flush();
{
- Callback_TestIntf_unknownMostDerived1AsKnownIntermediateI cb =
- new Callback_TestIntf_unknownMostDerived1AsKnownIntermediateI();
- test.begin_unknownMostDerived1AsKnownIntermediate(cb);
+ Callback cb = new Callback();
+ test.unknownMostDerived1AsKnownIntermediateAsync().whenComplete((result, ex) ->
+ {
+ test(ex != null && ex instanceof KnownIntermediate);
+ KnownIntermediate ki = (KnownIntermediate)ex;
+ test(ki.b.equals("UnknownMostDerived1.b"));
+ test(ki.ki.equals("UnknownMostDerived1.ki"));
+ test(ki.ice_id().equals("::Test::KnownIntermediate"));
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -1117,8 +601,15 @@ public class AllTests
out.print("slicing of unknown most derived, unknown intermediate thrown as base (AMI)... ");
out.flush();
{
- Callback_TestIntf_unknownMostDerived2AsBaseI cb = new Callback_TestIntf_unknownMostDerived2AsBaseI();
- test.begin_unknownMostDerived2AsBase(cb);
+ Callback cb = new Callback();
+ test.unknownMostDerived2AsBaseAsync().whenComplete((result, ex) ->
+ {
+ test(ex != null && ex instanceof Base);
+ Base b = (Base)ex;
+ test(b.b.equals("UnknownMostDerived2.b"));
+ test(b.ice_id().equals("::Test::Base"));
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -1136,17 +627,17 @@ public class AllTests
//
// For the 1.0 encoding, the unknown exception is sliced to Base.
//
- test(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0));
+ test(test.ice_getEncodingVersion().equals(com.zeroc.Ice.Util.Encoding_1_0));
}
- catch(Ice.UnknownUserException ex)
+ catch(com.zeroc.Ice.UnknownUserException ex)
{
//
// An UnknownUserException is raised for the compact format because the
// most-derived type is unknown and the exception cannot be sliced.
//
- test(!test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0));
+ test(!test.ice_getEncodingVersion().equals(com.zeroc.Ice.Util.Encoding_1_0));
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
catch(Exception ex)
@@ -1159,8 +650,8 @@ public class AllTests
out.print("preserved exceptions... ");
out.flush();
{
- Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("Relay", "default");
- RelayPrx relay = RelayPrxHelper.uncheckedCast(adapter.addWithUUID(new RelayI()));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("Relay", "default");
+ RelayPrx relay = RelayPrx.uncheckedCast(adapter.addWithUUID(new RelayI()));
adapter.activate();
try
@@ -1174,7 +665,7 @@ public class AllTests
test(ex.kp.equals("preserved"));
test(ex.kpd.equals("derived"));
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
catch(Exception ex)
@@ -1193,7 +684,7 @@ public class AllTests
test(ex.kp.equals("preserved"));
test(ex.kpd.equals("derived"));
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
catch(Exception ex)
@@ -1222,12 +713,12 @@ public class AllTests
//
// For the 1.0 encoding, the unknown exception is sliced to KnownPreserved.
//
- test(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0));
+ test(test.ice_getEncodingVersion().equals(com.zeroc.Ice.Util.Encoding_1_0));
test(ex.b.equals("base"));
test(ex.kp.equals("preserved"));
test(ex.kpd.equals("derived"));
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
catch(Exception ex)
@@ -1256,12 +747,12 @@ public class AllTests
//
// For the 1.0 encoding, the unknown exception is sliced to KnownPreserved.
//
- test(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0));
+ test(test.ice_getEncodingVersion().equals(com.zeroc.Ice.Util.Encoding_1_0));
test(ex.b.equals("base"));
test(ex.kp.equals("preserved"));
test(ex.kpd.equals("derived"));
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
catch(Exception ex)
diff --git a/java/test/src/main/java/test/Ice/slicing/exceptions/Client.java b/java/test/src/main/java/test/Ice/slicing/exceptions/Client.java
index bf5aa54559a..9c0aebde55f 100644
--- a/java/test/src/main/java/test/Ice/slicing/exceptions/Client.java
+++ b/java/test/src/main/java/test/Ice/slicing/exceptions/Client.java
@@ -14,15 +14,6 @@ import test.Ice.slicing.exceptions.client.Test.TestIntfPrx;
public class Client extends test.Util.Application
{
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
- {
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.exceptions.client");
- return initData;
- }
-
- @Override
public int run(String[] args)
{
TestIntfPrx test = AllTests.allTests(communicator(), false, getWriter());
@@ -30,6 +21,14 @@ public class Client extends test.Util.Application
return 0;
}
+ @Override
+ protected GetInitDataResult getInitData(String[] args)
+ {
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.exceptions.client");
+ return r;
+ }
+
public static void main(String[] args)
{
Client c = new Client();
diff --git a/java/test/src/main/java/test/Ice/slicing/exceptions/Server.java b/java/test/src/main/java/test/Ice/slicing/exceptions/Server.java
index 183f1dd91d8..2ff1ebd1c0c 100644
--- a/java/test/src/main/java/test/Ice/slicing/exceptions/Server.java
+++ b/java/test/src/main/java/test/Ice/slicing/exceptions/Server.java
@@ -14,22 +14,21 @@ public class Server extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- Ice.Object object = new TestI();
- adapter.add(object, Ice.Util.stringToIdentity("Test"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.Object object = new TestI();
+ adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("Test"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.exceptions.server");
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.exceptions.server");
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/slicing/exceptions/TestI.java b/java/test/src/main/java/test/Ice/slicing/exceptions/TestI.java
index 128c8c4bb8c..8845bdeee4f 100644
--- a/java/test/src/main/java/test/Ice/slicing/exceptions/TestI.java
+++ b/java/test/src/main/java/test/Ice/slicing/exceptions/TestI.java
@@ -11,10 +11,9 @@ package test.Ice.slicing.exceptions;
import test.Ice.slicing.exceptions.server.Test.*;
-public final class TestI extends _TestIntfDisp
+public final class TestI implements TestIntf
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -23,15 +22,13 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
@Override
- public void
- baseAsBase(Ice.Current current)
+ public void baseAsBase(com.zeroc.Ice.Current current)
throws Base
{
Base b = new Base();
@@ -40,8 +37,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- unknownDerivedAsBase(Ice.Current current)
+ public void unknownDerivedAsBase(com.zeroc.Ice.Current current)
throws Base
{
UnknownDerived d = new UnknownDerived();
@@ -51,8 +47,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- knownDerivedAsBase(Ice.Current current)
+ public void knownDerivedAsBase(com.zeroc.Ice.Current current)
throws Base
{
KnownDerived d = new KnownDerived();
@@ -62,8 +57,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- knownDerivedAsKnownDerived(Ice.Current current)
+ public void knownDerivedAsKnownDerived(com.zeroc.Ice.Current current)
throws KnownDerived
{
KnownDerived d = new KnownDerived();
@@ -73,8 +67,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- unknownIntermediateAsBase(Ice.Current current)
+ public void unknownIntermediateAsBase(com.zeroc.Ice.Current current)
throws Base
{
UnknownIntermediate ui = new UnknownIntermediate();
@@ -84,8 +77,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- knownIntermediateAsBase(Ice.Current current)
+ public void knownIntermediateAsBase(com.zeroc.Ice.Current current)
throws Base
{
KnownIntermediate ki = new KnownIntermediate();
@@ -95,8 +87,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- knownMostDerivedAsBase(Ice.Current current)
+ public void knownMostDerivedAsBase(com.zeroc.Ice.Current current)
throws Base
{
KnownMostDerived kmd = new KnownMostDerived();
@@ -107,8 +98,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- knownIntermediateAsKnownIntermediate(Ice.Current current)
+ public void knownIntermediateAsKnownIntermediate(com.zeroc.Ice.Current current)
throws KnownIntermediate
{
KnownIntermediate ki = new KnownIntermediate();
@@ -118,8 +108,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- knownMostDerivedAsKnownIntermediate(Ice.Current current)
+ public void knownMostDerivedAsKnownIntermediate(com.zeroc.Ice.Current current)
throws KnownIntermediate
{
KnownMostDerived kmd = new KnownMostDerived();
@@ -130,8 +119,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- knownMostDerivedAsKnownMostDerived(Ice.Current current)
+ public void knownMostDerivedAsKnownMostDerived(com.zeroc.Ice.Current current)
throws KnownMostDerived
{
KnownMostDerived kmd = new KnownMostDerived();
@@ -143,7 +131,7 @@ public final class TestI extends _TestIntfDisp
@Override
public void
- unknownMostDerived1AsBase(Ice.Current current)
+ unknownMostDerived1AsBase(com.zeroc.Ice.Current current)
throws Base
{
UnknownMostDerived1 umd1 = new UnknownMostDerived1();
@@ -154,8 +142,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- unknownMostDerived1AsKnownIntermediate(Ice.Current current)
+ public void unknownMostDerived1AsKnownIntermediate(com.zeroc.Ice.Current current)
throws KnownIntermediate
{
UnknownMostDerived1 umd1 = new UnknownMostDerived1();
@@ -166,8 +153,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- unknownMostDerived2AsBase(Ice.Current current)
+ public void unknownMostDerived2AsBase(com.zeroc.Ice.Current current)
throws Base
{
UnknownMostDerived2 umd2 = new UnknownMostDerived2();
@@ -178,8 +164,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- unknownMostDerived2AsBaseCompact(Ice.Current current)
+ public void unknownMostDerived2AsBaseCompact(com.zeroc.Ice.Current current)
throws Base
{
UnknownMostDerived2 umd2 = new UnknownMostDerived2();
@@ -190,8 +175,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- knownPreservedAsBase(Ice.Current current)
+ public void knownPreservedAsBase(com.zeroc.Ice.Current current)
throws Base
{
KnownPreservedDerived ex = new KnownPreservedDerived();
@@ -202,8 +186,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- knownPreservedAsKnownPreserved(Ice.Current current)
+ public void knownPreservedAsKnownPreserved(com.zeroc.Ice.Current current)
throws KnownPreserved
{
KnownPreservedDerived ex = new KnownPreservedDerived();
@@ -214,8 +197,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- relayKnownPreservedAsBase(RelayPrx r, Ice.Current current)
+ public void relayKnownPreservedAsBase(RelayPrx r, com.zeroc.Ice.Current current)
throws Base
{
r.knownPreservedAsBase();
@@ -223,8 +205,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- relayKnownPreservedAsKnownPreserved(RelayPrx r, Ice.Current current)
+ public void relayKnownPreservedAsKnownPreserved(RelayPrx r, com.zeroc.Ice.Current current)
throws KnownPreserved
{
r.knownPreservedAsKnownPreserved();
@@ -232,8 +213,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- unknownPreservedAsBase(Ice.Current current)
+ public void unknownPreservedAsBase(com.zeroc.Ice.Current current)
throws Base
{
SPreserved2 ex = new SPreserved2();
@@ -246,8 +226,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- unknownPreservedAsKnownPreserved(Ice.Current current)
+ public void unknownPreservedAsKnownPreserved(com.zeroc.Ice.Current current)
throws KnownPreserved
{
SPreserved2 ex = new SPreserved2();
@@ -260,8 +239,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- relayUnknownPreservedAsBase(RelayPrx r, Ice.Current current)
+ public void relayUnknownPreservedAsBase(RelayPrx r, com.zeroc.Ice.Current current)
throws Base
{
r.unknownPreservedAsBase();
@@ -269,8 +247,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- relayUnknownPreservedAsKnownPreserved(RelayPrx r, Ice.Current current)
+ public void relayUnknownPreservedAsKnownPreserved(RelayPrx r, com.zeroc.Ice.Current current)
throws KnownPreserved
{
r.unknownPreservedAsKnownPreserved();
diff --git a/java/test/src/main/java/test/Ice/slicing/objects/AMDServer.java b/java/test/src/main/java/test/Ice/slicing/objects/AMDServer.java
index 529194081fe..13ec1d7438a 100644
--- a/java/test/src/main/java/test/Ice/slicing/objects/AMDServer.java
+++ b/java/test/src/main/java/test/Ice/slicing/objects/AMDServer.java
@@ -14,23 +14,22 @@ public class AMDServer extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Object object = new AMDTestI();
- adapter.add(object, Ice.Util.stringToIdentity("Test"));
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.Object object = new AMDTestI();
+ adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("Test"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.objects.serverAMD");
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.objects.serverAMD");
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/slicing/objects/AMDTestI.java b/java/test/src/main/java/test/Ice/slicing/objects/AMDTestI.java
index 0c9e6662935..b69876307f9 100644
--- a/java/test/src/main/java/test/Ice/slicing/objects/AMDTestI.java
+++ b/java/test/src/main/java/test/Ice/slicing/objects/AMDTestI.java
@@ -9,12 +9,14 @@
package test.Ice.slicing.objects;
+import java.util.concurrent.CompletionStage;
+import java.util.concurrent.CompletableFuture;
+
import test.Ice.slicing.objects.serverAMD.Test.*;
-public final class AMDTestI extends _TestIntfDisp
+public final class AMDTestI implements TestIntf
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -23,85 +25,76 @@ public final class AMDTestI extends _TestIntfDisp
}
@Override
- public void
- shutdown_async(AMD_TestIntf_shutdown cb, Ice.Current current)
+ public CompletionStage<Void> shutdownAsync(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- SBaseAsObject_async(AMD_TestIntf_SBaseAsObject cb, Ice.Current current)
+ public CompletionStage<com.zeroc.Ice.Value> SBaseAsObjectAsync(com.zeroc.Ice.Current current)
{
SBase sb = new SBase();
sb.sb = "SBase.sb";
- cb.ice_response(sb);
+ return CompletableFuture.completedFuture(sb);
}
@Override
- public void
- SBaseAsSBase_async(AMD_TestIntf_SBaseAsSBase cb, Ice.Current current)
+ public CompletionStage<SBase> SBaseAsSBaseAsync(com.zeroc.Ice.Current current)
{
SBase sb = new SBase();
sb.sb = "SBase.sb";
- cb.ice_response(sb);
+ return CompletableFuture.completedFuture(sb);
}
@Override
- public void
- SBSKnownDerivedAsSBase_async(AMD_TestIntf_SBSKnownDerivedAsSBase cb, Ice.Current current)
+ public CompletionStage<SBase> SBSKnownDerivedAsSBaseAsync(com.zeroc.Ice.Current current)
{
SBSKnownDerived sbskd = new SBSKnownDerived();
sbskd.sb = "SBSKnownDerived.sb";
sbskd.sbskd = "SBSKnownDerived.sbskd";
- cb.ice_response(sbskd);
+ return CompletableFuture.completedFuture(sbskd);
}
@Override
- public void
- SBSKnownDerivedAsSBSKnownDerived_async(AMD_TestIntf_SBSKnownDerivedAsSBSKnownDerived cb, Ice.Current current)
+ public CompletionStage<SBSKnownDerived> SBSKnownDerivedAsSBSKnownDerivedAsync(com.zeroc.Ice.Current current)
{
SBSKnownDerived sbskd = new SBSKnownDerived();
sbskd.sb = "SBSKnownDerived.sb";
sbskd.sbskd = "SBSKnownDerived.sbskd";
- cb.ice_response(sbskd);
+ return CompletableFuture.completedFuture(sbskd);
}
@Override
- public void
- SBSUnknownDerivedAsSBase_async(AMD_TestIntf_SBSUnknownDerivedAsSBase cb, Ice.Current current)
+ public CompletionStage<SBase> SBSUnknownDerivedAsSBaseAsync(com.zeroc.Ice.Current current)
{
SBSUnknownDerived sbsud = new SBSUnknownDerived();
sbsud.sb = "SBSUnknownDerived.sb";
sbsud.sbsud = "SBSUnknownDerived.sbsud";
- cb.ice_response(sbsud);
+ return CompletableFuture.completedFuture(sbsud);
}
@Override
- public void
- SBSUnknownDerivedAsSBaseCompact_async(AMD_TestIntf_SBSUnknownDerivedAsSBaseCompact cb, Ice.Current current)
+ public CompletionStage<SBase> SBSUnknownDerivedAsSBaseCompactAsync(com.zeroc.Ice.Current current)
{
SBSUnknownDerived sbsud = new SBSUnknownDerived();
sbsud.sb = "SBSUnknownDerived.sb";
sbsud.sbsud = "SBSUnknownDerived.sbsud";
- cb.ice_response(sbsud);
+ return CompletableFuture.completedFuture(sbsud);
}
@Override
- public void
- SUnknownAsObject_async(AMD_TestIntf_SUnknownAsObject cb, Ice.Current current)
+ public CompletionStage<com.zeroc.Ice.Value> SUnknownAsObjectAsync(com.zeroc.Ice.Current current)
{
SUnknown su = new SUnknown();
su.su = "SUnknown.su";
- cb.ice_response(su);
+ return CompletableFuture.completedFuture(su);
}
@Override
- public void
- checkSUnknown_async(AMD_TestIntf_checkSUnknown cb, Ice.Object obj, Ice.Current current)
+ public CompletionStage<Void> checkSUnknownAsync(com.zeroc.Ice.Value obj, com.zeroc.Ice.Current current)
{
- if(current.encoding.equals(Ice.Util.Encoding_1_0))
+ if(current.encoding.equals(com.zeroc.Ice.Util.Encoding_1_0))
{
test(!(obj instanceof SUnknown));
}
@@ -110,22 +103,20 @@ public final class AMDTestI extends _TestIntfDisp
SUnknown su = (SUnknown)obj;
test(su.su.equals("SUnknown.su"));
}
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- oneElementCycle_async(AMD_TestIntf_oneElementCycle cb, Ice.Current current)
+ public CompletionStage<B> oneElementCycleAsync(com.zeroc.Ice.Current current)
{
B b = new B();
b.sb = "B1.sb";
b.pb = b;
- cb.ice_response(b);
+ return CompletableFuture.completedFuture(b);
}
@Override
- public void
- twoElementCycle_async(AMD_TestIntf_twoElementCycle cb, Ice.Current current)
+ public CompletionStage<B> twoElementCycleAsync(com.zeroc.Ice.Current current)
{
B b1 = new B();
b1.sb = "B1.sb";
@@ -133,12 +124,11 @@ public final class AMDTestI extends _TestIntfDisp
b2.sb = "B2.sb";
b2.pb = b1;
b1.pb = b2;
- cb.ice_response(b1);
+ return CompletableFuture.completedFuture(b1);
}
@Override
- public void
- D1AsB_async(AMD_TestIntf_D1AsB cb, Ice.Current current)
+ public CompletionStage<B> D1AsBAsync(com.zeroc.Ice.Current current)
{
D1 d1 = new D1();
d1.sb = "D1.sb";
@@ -150,12 +140,11 @@ public final class AMDTestI extends _TestIntfDisp
d2.pd2 = d1;
d1.pb = d2;
d1.pd1 = d2;
- cb.ice_response(d1);
+ return CompletableFuture.completedFuture(d1);
}
@Override
- public void
- D1AsD1_async(AMD_TestIntf_D1AsD1 cb, Ice.Current current)
+ public CompletionStage<D1> D1AsD1Async(com.zeroc.Ice.Current current)
{
D1 d1 = new D1();
d1.sb = "D1.sb";
@@ -167,12 +156,11 @@ public final class AMDTestI extends _TestIntfDisp
d2.pd2 = d1;
d1.pb = d2;
d1.pd1 = d2;
- cb.ice_response(d1);
+ return CompletableFuture.completedFuture(d1);
}
@Override
- public void
- D2AsB_async(AMD_TestIntf_D2AsB cb, Ice.Current current)
+ public CompletionStage<B> D2AsBAsync(com.zeroc.Ice.Current current)
{
D2 d2 = new D2();
d2.sb = "D2.sb";
@@ -184,12 +172,11 @@ public final class AMDTestI extends _TestIntfDisp
d1.pd1 = d2;
d2.pb = d1;
d2.pd2 = d1;
- cb.ice_response(d2);
+ return CompletableFuture.completedFuture(d2);
}
@Override
- public void
- paramTest1_async(AMD_TestIntf_paramTest1 cb, Ice.Current current)
+ public CompletionStage<TestIntf.ParamTest1Result> paramTest1Async(com.zeroc.Ice.Current current)
{
D1 d1 = new D1();
d1.sb = "D1.sb";
@@ -201,12 +188,11 @@ public final class AMDTestI extends _TestIntfDisp
d2.pd2 = d1;
d1.pb = d2;
d1.pd1 = d2;
- cb.ice_response(d1, d2);
+ return CompletableFuture.completedFuture(new TestIntf.ParamTest1Result(d1, d2));
}
@Override
- public void
- paramTest2_async(AMD_TestIntf_paramTest2 cb, Ice.Current current)
+ public CompletionStage<TestIntf.ParamTest2Result> paramTest2Async(com.zeroc.Ice.Current current)
{
D1 d1 = new D1();
d1.sb = "D1.sb";
@@ -218,12 +204,11 @@ public final class AMDTestI extends _TestIntfDisp
d2.pd2 = d1;
d1.pb = d2;
d1.pd1 = d2;
- cb.ice_response(d2, d1);
+ return CompletableFuture.completedFuture(new TestIntf.ParamTest2Result(d2, d1));
}
@Override
- public void
- paramTest3_async(AMD_TestIntf_paramTest3 cb, Ice.Current current)
+ public CompletionStage<TestIntf.ParamTest3Result> paramTest3Async(com.zeroc.Ice.Current current)
{
D2 d2 = new D2();
d2.sb = "D2.sb (p1 1)";
@@ -248,12 +233,11 @@ public final class AMDTestI extends _TestIntfDisp
d3.sd1 = "D1.sd2 (p2 2)";
d3.pd1 = null;
d4.pd2 = d3;
- cb.ice_response(d3, d2, d4);
+ return CompletableFuture.completedFuture(new TestIntf.ParamTest3Result(d3, d2, d4));
}
@Override
- public void
- paramTest4_async(AMD_TestIntf_paramTest4 cb, Ice.Current current)
+ public CompletionStage<TestIntf.ParamTest4Result> paramTest4Async(com.zeroc.Ice.Current current)
{
D4 d4 = new D4();
d4.sb = "D4.sb (1)";
@@ -262,12 +246,11 @@ public final class AMDTestI extends _TestIntfDisp
d4.p1.sb = "B.sb (1)";
d4.p2 = new B();
d4.p2.sb = "B.sb (2)";
- cb.ice_response(d4.p2, d4);
+ return CompletableFuture.completedFuture(new TestIntf.ParamTest4Result(d4.p2, d4));
}
@Override
- public void
- returnTest1_async(AMD_TestIntf_returnTest1 cb, Ice.Current current)
+ public CompletionStage<TestIntf.ReturnTest1Result> returnTest1Async(com.zeroc.Ice.Current current)
{
D1 d1 = new D1();
d1.sb = "D1.sb";
@@ -279,12 +262,11 @@ public final class AMDTestI extends _TestIntfDisp
d2.pd2 = d1;
d1.pb = d2;
d1.pd1 = d2;
- cb.ice_response(d2, d2, d1);
+ return CompletableFuture.completedFuture(new TestIntf.ReturnTest1Result(d2, d2, d1));
}
@Override
- public void
- returnTest2_async(AMD_TestIntf_returnTest2 cb, Ice.Current current)
+ public CompletionStage<TestIntf.ReturnTest2Result> returnTest2Async(com.zeroc.Ice.Current current)
{
D1 d1 = new D1();
d1.sb = "D1.sb";
@@ -296,31 +278,30 @@ public final class AMDTestI extends _TestIntfDisp
d2.pd2 = d1;
d1.pb = d2;
d1.pd1 = d2;
- cb.ice_response(d1, d1, d2);
+ return CompletableFuture.completedFuture(new TestIntf.ReturnTest2Result(d1, d1, d2));
}
@Override
- public void
- returnTest3_async(AMD_TestIntf_returnTest3 cb, B p1, B p2, Ice.Current current)
+ public CompletionStage<B> returnTest3Async(B p1, B p2, com.zeroc.Ice.Current current)
{
- cb.ice_response(p1);
+ return CompletableFuture.completedFuture(p1);
}
@Override
- public void
- sequenceTest_async(AMD_TestIntf_sequenceTest cb, SS1 p1, SS2 p2, Ice.Current current)
+ public CompletionStage<SS3> sequenceTestAsync(SS1 p1, SS2 p2, com.zeroc.Ice.Current current)
{
SS3 ss = new SS3();
ss.c1 = p1;
ss.c2 = p2;
- cb.ice_response(ss);
+ return CompletableFuture.completedFuture(ss);
}
@Override
- public void
- dictionaryTest_async(AMD_TestIntf_dictionaryTest cb, java.util.Map<Integer, B> bin, Ice.Current current)
+ public CompletionStage<TestIntf.DictionaryTestResult> dictionaryTestAsync(java.util.Map<Integer, B> bin,
+ com.zeroc.Ice.Current current)
{
- java.util.Map<Integer, B> bout = new java.util.HashMap<Integer, B>();
+ TestIntf.DictionaryTestResult r = new TestIntf.DictionaryTestResult();
+ r.bout = new java.util.HashMap<>();
int i;
for(i = 0; i < 10; ++i)
{
@@ -330,39 +311,37 @@ public final class AMDTestI extends _TestIntfDisp
d2.pb = b.pb;
d2.sd2 = "D2";
d2.pd2 = d2;
- bout.put(i * 10, d2);
+ r.bout.put(i * 10, d2);
}
- java.util.Map<Integer, B> r = new java.util.HashMap<Integer, B>();
+ r.returnValue = new java.util.HashMap<>();
for(i = 0; i < 10; ++i)
{
String s = "D1." + new Integer(i * 20).toString();
D1 d1 = new D1();
d1.sb = s;
- d1.pb = (i == 0 ? null : r.get((i - 1) * 20));
+ d1.pb = (i == 0 ? null : r.returnValue.get((i - 1) * 20));
d1.sd1 = s;
d1.pd1 = d1;
- r.put(i * 20, d1);
+ r.returnValue.put(i * 20, d1);
}
- cb.ice_response(r, bout);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- exchangePBase_async(AMD_TestIntf_exchangePBase cb, PBase pb, Ice.Current current)
+ public CompletionStage<PBase> exchangePBaseAsync(PBase pb, com.zeroc.Ice.Current current)
{
- cb.ice_response(pb);
+ return CompletableFuture.completedFuture(pb);
}
@Override
- public void
- PBSUnknownAsPreserved_async(AMD_TestIntf_PBSUnknownAsPreserved cb, Ice.Current current)
+ public CompletionStage<Preserved> PBSUnknownAsPreservedAsync(com.zeroc.Ice.Current current)
{
PSUnknown r = new PSUnknown();
r.pi = 5;
r.ps = "preserved";
r.psu = "unknown";
r.graph = null;
- if(!current.encoding.equals(Ice.Util.Encoding_1_0))
+ if(!current.encoding.equals(com.zeroc.Ice.Util.Encoding_1_0))
{
//
// 1.0 encoding doesn't support unmarshaling unknown classes even if referenced
@@ -370,14 +349,13 @@ public final class AMDTestI extends _TestIntfDisp
//
r.cl = new MyClass(15);
}
- cb.ice_response(r);
+ return CompletableFuture.completedFuture(r);
}
@Override
- public void
- checkPBSUnknown_async(AMD_TestIntf_checkPBSUnknown cb, Preserved p, Ice.Current current)
+ public CompletionStage<Void> checkPBSUnknownAsync(Preserved p, com.zeroc.Ice.Current current)
{
- if(current.encoding.equals(Ice.Util.Encoding_1_0))
+ if(current.encoding.equals(com.zeroc.Ice.Util.Encoding_1_0))
{
test(!(p instanceof PSUnknown));
test(p.pi == 5);
@@ -392,12 +370,11 @@ public final class AMDTestI extends _TestIntfDisp
test(pu.graph == null);
test(pu.cl != null && pu.cl.i == 15);
}
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- PBSUnknownAsPreservedWithGraph_async(AMD_TestIntf_PBSUnknownAsPreservedWithGraph cb, Ice.Current current)
+ public CompletionStage<Preserved> PBSUnknownAsPreservedWithGraphAsync(com.zeroc.Ice.Current current)
{
PSUnknown r = new PSUnknown();
r.pi = 5;
@@ -407,15 +384,17 @@ public final class AMDTestI extends _TestIntfDisp
r.graph.next = new PNode();
r.graph.next.next = new PNode();
r.graph.next.next.next = r.graph;
- cb.ice_response(r);
- r.graph.next.next.next = null; // Break the cycle.
+ return CompletableFuture.completedFuture(r);
+ //
+ // Can't do this with the Java 8 mapping:
+ //
+ //r.graph.next.next.next = null; // Break the cycle.
}
@Override
- public void
- checkPBSUnknownWithGraph_async(AMD_TestIntf_checkPBSUnknownWithGraph cb, Preserved p, Ice.Current current)
+ public CompletionStage<Void> checkPBSUnknownWithGraphAsync(Preserved p, com.zeroc.Ice.Current current)
{
- if(current.encoding.equals(Ice.Util.Encoding_1_0))
+ if(current.encoding.equals(com.zeroc.Ice.Util.Encoding_1_0))
{
test(!(p instanceof PSUnknown));
test(p.pi == 5);
@@ -432,26 +411,27 @@ public final class AMDTestI extends _TestIntfDisp
test(pu.graph.next.next.next == pu.graph);
pu.graph.next.next.next = null; // Break the cycle.
}
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- PBSUnknown2AsPreservedWithGraph_async(AMD_TestIntf_PBSUnknown2AsPreservedWithGraph cb, Ice.Current current)
+ public CompletionStage<Preserved> PBSUnknown2AsPreservedWithGraphAsync(com.zeroc.Ice.Current current)
{
PSUnknown2 r = new PSUnknown2();
r.pi = 5;
r.ps = "preserved";
r.pb = r;
- cb.ice_response(r);
- r.pb = null; // Break the cycle.
+ return CompletableFuture.completedFuture(r);
+ //
+ // Can't do this with the Java 8 mapping:
+ //
+ //r.pb = null; // Break the cycle.
}
@Override
- public void
- checkPBSUnknown2WithGraph_async(AMD_TestIntf_checkPBSUnknown2WithGraph cb, Preserved p, Ice.Current current)
+ public CompletionStage<Void> checkPBSUnknown2WithGraphAsync(Preserved p, com.zeroc.Ice.Current current)
{
- if(current.encoding.equals(Ice.Util.Encoding_1_0))
+ if(current.encoding.equals(com.zeroc.Ice.Util.Encoding_1_0))
{
test(!(p instanceof PSUnknown2));
test(p.pi == 5);
@@ -465,19 +445,17 @@ public final class AMDTestI extends _TestIntfDisp
test(pu.pb == pu);
pu.pb = null; // Break the cycle.
}
- cb.ice_response();
+ return CompletableFuture.completedFuture((Void)null);
}
@Override
- public void
- exchangePNode_async(AMD_TestIntf_exchangePNode cb, PNode pn, Ice.Current current)
+ public CompletionStage<PNode> exchangePNodeAsync(PNode pn, com.zeroc.Ice.Current current)
{
- cb.ice_response(pn);
+ return CompletableFuture.completedFuture(pn);
}
@Override
- public void
- throwBaseAsBase_async(AMD_TestIntf_throwBaseAsBase cb, Ice.Current current)
+ public CompletionStage<Void> throwBaseAsBaseAsync(com.zeroc.Ice.Current current)
throws BaseException
{
BaseException be = new BaseException();
@@ -485,12 +463,13 @@ public final class AMDTestI extends _TestIntfDisp
be.pb = new B();
be.pb.sb = "sb";
be.pb.pb = be.pb;
- cb.ice_exception(be);
+ CompletableFuture<Void> r = new CompletableFuture<>();
+ r.completeExceptionally(be);
+ return r;
}
@Override
- public void
- throwDerivedAsBase_async(AMD_TestIntf_throwDerivedAsBase cb, Ice.Current current)
+ public CompletionStage<Void> throwDerivedAsBaseAsync(com.zeroc.Ice.Current current)
throws BaseException
{
DerivedException de = new DerivedException();
@@ -504,12 +483,13 @@ public final class AMDTestI extends _TestIntfDisp
de.pd1.pb = de.pd1;
de.pd1.sd1 = "sd2";
de.pd1.pd1 = de.pd1;
- cb.ice_exception(de);
+ CompletableFuture<Void> r = new CompletableFuture<>();
+ r.completeExceptionally(de);
+ return r;
}
@Override
- public void
- throwDerivedAsDerived_async(AMD_TestIntf_throwDerivedAsDerived cb, Ice.Current current)
+ public CompletionStage<Void> throwDerivedAsDerivedAsync(com.zeroc.Ice.Current current)
throws DerivedException
{
DerivedException de = new DerivedException();
@@ -523,12 +503,13 @@ public final class AMDTestI extends _TestIntfDisp
de.pd1.pb = de.pd1;
de.pd1.sd1 = "sd2";
de.pd1.pd1 = de.pd1;
- cb.ice_exception(de);
+ CompletableFuture<Void> r = new CompletableFuture<>();
+ r.completeExceptionally(de);
+ return r;
}
@Override
- public void
- throwUnknownDerivedAsBase_async(AMD_TestIntf_throwUnknownDerivedAsBase cb, Ice.Current current)
+ public CompletionStage<Void> throwUnknownDerivedAsBaseAsync(com.zeroc.Ice.Current current)
throws BaseException
{
D2 d2 = new D2();
@@ -542,30 +523,35 @@ public final class AMDTestI extends _TestIntfDisp
ude.pb = d2;
ude.sude = "sude";
ude.pd2 = d2;
- cb.ice_exception(ude);
+ CompletableFuture<Void> r = new CompletableFuture<>();
+ r.completeExceptionally(ude);
+ return r;
}
@Override
- public void
- throwPreservedException_async(AMD_TestIntf_throwPreservedException cb, Ice.Current current)
+ public CompletionStage<Void> throwPreservedExceptionAsync(com.zeroc.Ice.Current current)
{
PSUnknownException ue = new PSUnknownException();
ue.p = new PSUnknown2();
ue.p.pi = 5;
ue.p.ps = "preserved";
ue.p.pb = ue.p;
- cb.ice_exception(ue);
- ue.p.pb = null; // Break the cycle.
+ CompletableFuture<Void> r = new CompletableFuture<>();
+ r.completeExceptionally(ue);
+ return r;
+ //
+ // Can't do this with the Java 8 mapping:
+ //
+ //ue.p.pb = null; // Break the cycle.
}
@Override
- public void
- useForward_async(AMD_TestIntf_useForward cb, Ice.Current current)
+ public CompletionStage<Forward> useForwardAsync(com.zeroc.Ice.Current current)
{
Forward f = new Forward();
f = new Forward();
f.h = new Hidden();
f.h.f = f;
- cb.ice_response(f);
+ return CompletableFuture.completedFuture(f);
}
}
diff --git a/java/test/src/main/java/test/Ice/slicing/objects/AllTests.java b/java/test/src/main/java/test/Ice/slicing/objects/AllTests.java
index d8080a02248..83813c2ecd2 100644
--- a/java/test/src/main/java/test/Ice/slicing/objects/AllTests.java
+++ b/java/test/src/main/java/test/Ice/slicing/objects/AllTests.java
@@ -11,12 +11,13 @@ package test.Ice.slicing.objects;
import java.io.PrintWriter;
+import com.zeroc.Ice.Util;
+
import test.Ice.slicing.objects.client.Test.*;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -31,8 +32,7 @@ public class AllTests
_called = false;
}
- public synchronized void
- check()
+ public synchronized void check()
{
while(!_called)
{
@@ -48,8 +48,7 @@ public class AllTests
_called = false;
}
- public synchronized void
- called()
+ public synchronized void called()
{
assert(!_called);
_called = true;
@@ -59,1219 +58,6 @@ public class AllTests
private boolean _called;
}
- private static class Callback_TestIntf_SBaseAsObjectI extends Callback_TestIntf_SBaseAsObject
- {
- @Override
- public void
- response(Ice.Object o)
- {
- test(o != null);
- test(o.ice_id().equals("::Test::SBase"));
- SBase sb = (SBase)o;
- test(sb != null);
- test(sb.sb.equals("SBase.sb"));
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_SBaseAsSBaseI extends Callback_TestIntf_SBaseAsSBase
- {
- @Override
- public void
- response(SBase sb)
- {
- test(sb.sb.equals("SBase.sb"));
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_SBSKnownDerivedAsSBaseI extends Callback_TestIntf_SBSKnownDerivedAsSBase
- {
- @Override
- public void
- response(SBase sb)
- {
- test(sb.sb.equals("SBSKnownDerived.sb"));
- SBSKnownDerived sbskd = (SBSKnownDerived)sb;
- test(sbskd != null);
- test(sbskd.sbskd.equals("SBSKnownDerived.sbskd"));
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_SBSKnownDerivedAsSBSKnownDerivedI
- extends Callback_TestIntf_SBSKnownDerivedAsSBSKnownDerived
- {
- @Override
- public void
- response(SBSKnownDerived sbskd)
- {
- test(sbskd.sbskd.equals("SBSKnownDerived.sbskd"));
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_SBSUnknownDerivedAsSBaseI extends Callback_TestIntf_SBSUnknownDerivedAsSBase
- {
- @Override
- public void
- response(SBase sb)
- {
- test(sb.sb.equals("SBSUnknownDerived.sb"));
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_SBSUnknownDerivedAsSBaseCompactI
- extends Callback_TestIntf_SBSUnknownDerivedAsSBaseCompact
- {
- @Override
- public void
- response(SBase sb)
- {
- test(sb.sb.equals("SBSUnknownDerived.sb"));
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- if(exc instanceof Ice.OperationNotExistException)
- {
- callback.called();
- return;
- }
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_SBSUnknownDerivedAsSBaseCompactFailI
- extends Callback_TestIntf_SBSUnknownDerivedAsSBaseCompact
- {
- @Override
- public void
- response(SBase sb)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- if(exc instanceof Ice.OperationNotExistException)
- {
- callback.called();
- return;
- }
- test(exc instanceof Ice.NoValueFactoryException);
- callback.called();
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_SUnknownAsObjectI1 extends Callback_TestIntf_SUnknownAsObject
- {
- @Override
- public void
- response(Ice.Object o)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(exc.ice_id().equals("::Ice::NoValueFactoryException"));
- callback.called();
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_SUnknownAsObjectI2 extends Callback_TestIntf_SUnknownAsObject
- {
- @Override
- public void
- response(Ice.Object o)
- {
- test(o instanceof Ice.UnknownSlicedValue);
- test(((Ice.UnknownSlicedValue)o).getUnknownTypeId().equals("::Test::SUnknown"));
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_oneElementCycleI extends Callback_TestIntf_oneElementCycle
- {
- @Override
- public void
- response(B b)
- {
- test(b != null);
- test(b.ice_id().equals("::Test::B"));
- test(b.sb.equals("B1.sb"));
- test(b.pb == b);
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_twoElementCycleI extends Callback_TestIntf_twoElementCycle
- {
- @Override
- public void
- response(B b1)
- {
- test(b1 != null);
- test(b1.ice_id().equals("::Test::B"));
- test(b1.sb.equals("B1.sb"));
-
- B b2 = b1.pb;
- test(b2 != null);
- test(b2.ice_id().equals("::Test::B"));
- test(b2.sb.equals("B2.sb"));
- test(b2.pb == b1);
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_D1AsBI extends Callback_TestIntf_D1AsB
- {
- @Override
- public void
- response(B b1)
- {
- test(b1 != null);
- test(b1.ice_id().equals("::Test::D1"));
- test(b1.sb.equals("D1.sb"));
- test(b1.pb != null);
- test(b1.pb != b1);
- D1 d1 = (D1)b1;
- test(d1 != null);
- test(d1.sd1.equals("D1.sd1"));
- test(d1.pd1 != null);
- test(d1.pd1 != b1);
- test(b1.pb == d1.pd1);
-
- B b2 = b1.pb;
- test(b2 != null);
- test(b2.pb == b1);
- test(b2.sb.equals("D2.sb"));
- test(b2.ice_id().equals("::Test::B"));
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_D1AsD1I extends Callback_TestIntf_D1AsD1
- {
- @Override
- public void
- response(D1 d1)
- {
- test(d1 != null);
- test(d1.ice_id().equals("::Test::D1"));
- test(d1.sb.equals("D1.sb"));
- test(d1.pb != null);
- test(d1.pb != d1);
-
- B b2 = d1.pb;
- test(b2 != null);
- test(b2.ice_id().equals("::Test::B"));
- test(b2.sb.equals("D2.sb"));
- test(b2.pb == d1);
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_D2AsBI extends Callback_TestIntf_D2AsB
- {
- @Override
- public void
- response(B b2)
- {
- test(b2 != null);
- test(b2.ice_id().equals("::Test::B"));
- test(b2.sb.equals("D2.sb"));
- test(b2.pb != null);
- test(b2.pb != b2);
-
- B b1 = b2.pb;
- test(b1 != null);
- test(b1.ice_id().equals("::Test::D1"));
- test(b1.sb.equals("D1.sb"));
- test(b1.pb == b2);
- D1 d1 = (D1)b1;
- test(d1 != null);
- test(d1.sd1.equals("D1.sd1"));
- test(d1.pd1 == b2);
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_paramTest1I extends Callback_TestIntf_paramTest1
- {
- @Override
- public void
- response(B b1, B b2)
- {
- test(b1 != null);
- test(b1.ice_id().equals("::Test::D1"));
- test(b1.sb.equals("D1.sb"));
- test(b1.pb == b2);
- D1 d1 = (D1)b1;
- test(d1 != null);
- test(d1.sd1.equals("D1.sd1"));
- test(d1.pd1 == b2);
-
- test(b2 != null);
- test(b2.ice_id().equals("::Test::B")); // No factory, must be sliced
- test(b2.sb.equals("D2.sb"));
- test(b2.pb == b1);
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_paramTest2I extends Callback_TestIntf_paramTest2
- {
- @Override
- public void
- response(B b2, B b1)
- {
- test(b1 != null);
- test(b1.ice_id().equals("::Test::D1"));
- test(b1.sb.equals("D1.sb"));
- test(b1.pb == b2);
- D1 d1 = (D1)b1;
- test(d1 != null);
- test(d1.sd1.equals("D1.sd1"));
- test(d1.pd1 == b2);
-
- test(b2 != null);
- test(b2.ice_id().equals("::Test::B")); // No factory, must be sliced
- test(b2.sb.equals("D2.sb"));
- test(b2.pb == b1);
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_returnTest1I extends Callback_TestIntf_returnTest1
- {
- @Override
- public void
- response(B r, B p1, B p2)
- {
- test(r == p1);
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_returnTest2I extends Callback_TestIntf_returnTest2
- {
- @Override
- public void
- response(B r, B p1, B p2)
- {
- test(r == p1);
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_returnTest3I extends Callback_TestIntf_returnTest3
- {
- @Override
- public void
- response(B b)
- {
- r = b;
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
-
- public B r;
- }
-
- private static class Callback_TestIntf_paramTest3I extends Callback_TestIntf_paramTest3
- {
- @Override
- public void
- response(B ret, B p1, B p2)
- {
- test(p1 != null);
- test(p1.sb.equals("D2.sb (p1 1)"));
- test(p1.pb == null);
- test(p1.ice_id().equals("::Test::B"));
-
- test(p2 != null);
- test(p2.sb.equals("D2.sb (p2 1)"));
- test(p2.pb == null);
- test(p2.ice_id().equals("::Test::B"));
-
- test(ret != null);
- test(ret.sb.equals("D1.sb (p2 2)"));
- test(ret.pb == null);
- test(ret.ice_id().equals("::Test::D1"));
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_paramTest4I extends Callback_TestIntf_paramTest4
- {
- @Override
- public void
- response(B ret, B b)
- {
- test(b != null);
- test(b.sb.equals("D4.sb (1)"));
- test(b.pb == null);
- test(b.ice_id().equals("::Test::B"));
-
- test(ret != null);
- test(ret.sb.equals("B.sb (2)"));
- test(ret.pb == null);
- test(ret.ice_id().equals("::Test::B"));
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_sequenceTestI extends Callback_TestIntf_sequenceTest
- {
- @Override
- public void
- response(SS3 ss)
- {
- r = ss;
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
-
- public SS3 r;
- }
-
- private static class Callback_TestIntf_dictionaryTestI extends Callback_TestIntf_dictionaryTest
- {
- @Override
- public void
- response(java.util.Map<Integer, B> r, java.util.Map<Integer, B> bout)
- {
- this.r = r;
- this.bout = bout;
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
-
- public java.util.Map<Integer, B> r;
- public java.util.Map<Integer, B> bout;
- }
-
- private static class Callback_TestIntf_throwBaseAsBaseI extends Callback_TestIntf_throwBaseAsBase
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.UserException exc)
- {
- try
- {
- BaseException e = (BaseException)exc;
- test(e.ice_id().equals("::Test::BaseException"));
- test(e.sbe.equals("sbe"));
- test(e.pb != null);
- test(e.pb.sb.equals("sb"));
- test(e.pb.pb == e.pb);
- }
- catch(Exception e)
- {
- test(false);
- }
- callback.called();
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_throwDerivedAsBaseI extends Callback_TestIntf_throwDerivedAsBase
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.UserException exc)
- {
- try
- {
- DerivedException e = (DerivedException)exc;
- test(e.ice_id().equals("::Test::DerivedException"));
- test(e.sbe.equals("sbe"));
- test(e.pb != null);
- test(e.pb.sb.equals("sb1"));
- test(e.pb.pb == e.pb);
- test(e.sde.equals("sde1"));
- test(e.pd1 != null);
- test(e.pd1.sb.equals("sb2"));
- test(e.pd1.pb == e.pd1);
- test(e.pd1.sd1.equals("sd2"));
- test(e.pd1.pd1 == e.pd1);
- }
- catch(Exception e)
- {
- test(false);
- }
- callback.called();
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_throwDerivedAsDerivedI extends Callback_TestIntf_throwDerivedAsDerived
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.UserException exc)
- {
- try
- {
- DerivedException e = (DerivedException)exc;
- test(e.ice_id().equals("::Test::DerivedException"));
- test(e.sbe.equals("sbe"));
- test(e.pb != null);
- test(e.pb.sb.equals("sb1"));
- test(e.pb.pb == e.pb);
- test(e.sde.equals("sde1"));
- test(e.pd1 != null);
- test(e.pd1.sb.equals("sb2"));
- test(e.pd1.pb == e.pd1);
- test(e.pd1.sd1.equals("sd2"));
- test(e.pd1.pd1 == e.pd1);
- }
- catch(Exception e)
- {
- test(false);
- }
- callback.called();
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_throwUnknownDerivedAsBaseI
- extends Callback_TestIntf_throwUnknownDerivedAsBase
- {
- @Override
- public void
- response()
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- @Override
- public void
- exception(Ice.UserException exc)
- {
- try
- {
- BaseException e = (BaseException)exc;
- test(e.ice_id().equals("::Test::BaseException"));
- test(e.sbe.equals("sbe"));
- test(e.pb != null);
- test(e.pb.sb.equals("sb d2"));
- test(e.pb.pb == e.pb);
- }
- catch(Exception e)
- {
- test(false);
- }
- callback.called();
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_useForwardI extends Callback_TestIntf_useForward
- {
- @Override
- public void
- response(Forward f)
- {
- test(f != null);
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_exchangePBaseI1 extends Callback_TestIntf_exchangePBase
- {
- @Override
- public void
- response(PBase r)
- {
- PDerived p2 = (PDerived)r;
- test(p2.pi == 3);
- test(p2.ps.equals("preserved"));
- test(p2.pb == p2);
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- if(exc instanceof Ice.OperationNotExistException)
- {
- callback.called();
- return;
- }
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_exchangePBaseI2 extends Callback_TestIntf_exchangePBase
- {
- @Override
- public void
- response(PBase r)
- {
- test(!(r instanceof PCUnknown));
- test(r.pi == 3);
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- if(exc instanceof Ice.OperationNotExistException)
- {
- callback.called();
- return;
- }
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_exchangePBaseI3 extends Callback_TestIntf_exchangePBase
- {
- @Override
- public void
- response(PBase r)
- {
- test(!(r instanceof PCDerived));
- test(r.pi == 3);
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- if(exc instanceof Ice.OperationNotExistException)
- {
- callback.called();
- return;
- }
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_exchangePBaseI4 extends Callback_TestIntf_exchangePBase
- {
- @Override
- public void
- response(PBase r)
- {
- PCDerived p2 = (PCDerived)r;
- test(p2.pi == 3);
- test(p2.pbs[0] == p2);
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- if(exc instanceof Ice.OperationNotExistException)
- {
- callback.called();
- return;
- }
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_exchangePBaseICompact1 extends Callback_TestIntf_exchangePBase
- {
- @Override
- public void
- response(PBase r)
- {
- test(!(r instanceof CompactPCDerived));
- test(r.pi == 3);
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- if(exc instanceof Ice.OperationNotExistException)
- {
- callback.called();
- return;
- }
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_exchangePBaseICompact2 extends Callback_TestIntf_exchangePBase
- {
- @Override
- public void
- response(PBase r)
- {
- CompactPCDerived p2 = (CompactPCDerived)r;
- test(p2.pi == 3);
- test(p2.pbs[0] == p2);
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- if(exc instanceof Ice.OperationNotExistException)
- {
- callback.called();
- return;
- }
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_exchangePBaseI5 extends Callback_TestIntf_exchangePBase
- {
- @Override
- public void
- response(PBase r)
- {
- test(!(r instanceof PCDerived3));
- test(r instanceof Preserved);
- test(r.pi == 3);
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- if(exc instanceof Ice.OperationNotExistException)
- {
- callback.called();
- return;
- }
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class Callback_TestIntf_exchangePBaseI6 extends Callback_TestIntf_exchangePBase
- {
- @Override
- public void
- response(PBase r)
- {
- PCDerived3 p3 = (PCDerived3)r;
- test(p3.pi == 3);
- for(int i = 0; i < 300; ++i)
- {
- PCDerived2 p2 = (PCDerived2)p3.pbs[i];
- test(p2.pi == i);
- test(p2.pbs.length == 1);
- test(p2.pbs[0] == null);
- test(p2.pcd2 == i);
- }
- test(p3.pcd2 == p3.pi);
- test(p3.pcd3 == p3.pbs[10]);
- callback.called();
- }
-
- @Override
- public void
- exception(Ice.LocalException exc)
- {
- if(exc instanceof Ice.OperationNotExistException)
- {
- callback.called();
- return;
- }
- test(false);
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
private static class PNodeI extends PNode
{
public PNodeI()
@@ -1282,10 +68,10 @@ public class AllTests
static int counter = 0;
}
- private static class NodeFactoryI implements Ice.ValueFactory
+ private static class NodeFactoryI implements com.zeroc.Ice.ValueFactory
{
@Override
- public Ice.Object create(String id)
+ public com.zeroc.Ice.Value create(String id)
{
if(id.equals(PNode.ice_staticId()))
{
@@ -1305,10 +91,10 @@ public class AllTests
static int counter = 0;
}
- private static class PreservedFactoryI implements Ice.ValueFactory
+ private static class PreservedFactoryI implements com.zeroc.Ice.ValueFactory
{
@Override
- public Ice.Object create(String id)
+ public com.zeroc.Ice.Value create(String id)
{
if(id.equals(Preserved.ice_staticId()))
{
@@ -1318,19 +104,23 @@ public class AllTests
}
}
- public static TestIntfPrx
- allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out)
+ private static class Wrapper<T>
+ {
+ public T v;
+ }
+
+ public static TestIntfPrx allTests(com.zeroc.Ice.Communicator communicator, boolean collocated, PrintWriter out)
{
out.print("testing stringToProxy... ");
out.flush();
String ref = "Test:default -p 12010 -t 10000";
- Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref);
test(base != null);
out.println("ok");
out.print("testing checked cast... ");
out.flush();
- TestIntfPrx test = TestIntfPrxHelper.checkedCast(base);
+ TestIntfPrx test = TestIntfPrx.checkedCast(base);
test(test != null);
test(test.equals(base));
out.println("ok");
@@ -1338,7 +128,7 @@ public class AllTests
out.print("base as Object... ");
out.flush();
{
- Ice.Object o;
+ com.zeroc.Ice.Value o;
SBase sb = null;
try
{
@@ -1349,6 +139,7 @@ public class AllTests
}
catch(Exception ex)
{
+ ex.printStackTrace();
test(false);
}
test(sb != null);
@@ -1359,8 +150,17 @@ public class AllTests
out.print("base as Object (AMI)... ");
out.flush();
{
- Callback_TestIntf_SBaseAsObjectI cb = new Callback_TestIntf_SBaseAsObjectI();
- test.begin_SBaseAsObject(cb);
+ Callback cb = new Callback();
+ test.SBaseAsObjectAsync().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result != null);
+ test(result.ice_id().equals("::Test::SBase"));
+ SBase sb = (SBase)result;
+ test(sb != null);
+ test(sb.sb.equals("SBase.sb"));
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -1384,8 +184,13 @@ public class AllTests
out.print("base as base (AMI)... ");
out.flush();
{
- Callback_TestIntf_SBaseAsSBaseI cb = new Callback_TestIntf_SBaseAsSBaseI();
- test.begin_SBaseAsSBase(cb);
+ Callback cb = new Callback();
+ test.SBaseAsSBaseAsync().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.sb.equals("SBase.sb"));
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -1413,8 +218,16 @@ public class AllTests
out.print("base with known derived as base (AMI)... ");
out.flush();
{
- Callback_TestIntf_SBSKnownDerivedAsSBaseI cb = new Callback_TestIntf_SBSKnownDerivedAsSBaseI();
- test.begin_SBSKnownDerivedAsSBase(cb);
+ Callback cb = new Callback();
+ test.SBSKnownDerivedAsSBaseAsync().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.sb.equals("SBSKnownDerived.sb"));
+ SBSKnownDerived sbskd = (SBSKnownDerived)result;
+ test(sbskd != null);
+ test(sbskd.sbskd.equals("SBSKnownDerived.sbskd"));
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -1438,9 +251,13 @@ public class AllTests
out.print("base with known derived as known derived (AMI)... ");
out.flush();
{
- Callback_TestIntf_SBSKnownDerivedAsSBSKnownDerivedI cb =
- new Callback_TestIntf_SBSKnownDerivedAsSBSKnownDerivedI();
- test.begin_SBSKnownDerivedAsSBSKnownDerived(cb);
+ Callback cb = new Callback();
+ test.SBSKnownDerivedAsSBSKnownDerivedAsync().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.sbskd.equals("SBSKnownDerived.sbskd"));
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -1458,14 +275,14 @@ public class AllTests
test(false);
}
}
- if(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0))
+ if(test.ice_getEncodingVersion().equals(Util.Encoding_1_0))
{
try
{
SBase sb = test.SBSUnknownDerivedAsSBaseCompact();
test(sb.sb.equals("SBSUnknownDerived.sb"));
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
catch(Exception ex)
@@ -1484,11 +301,11 @@ public class AllTests
test.SBSUnknownDerivedAsSBaseCompact();
test(false);
}
- catch(Ice.NoValueFactoryException ex)
+ catch(com.zeroc.Ice.NoValueFactoryException ex)
{
// Expected.
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
catch(Exception ex)
@@ -1501,18 +318,33 @@ public class AllTests
out.print("base with unknown derived as base (AMI)... ");
out.flush();
{
- Callback_TestIntf_SBSUnknownDerivedAsSBaseI cb = new Callback_TestIntf_SBSUnknownDerivedAsSBaseI();
- test.begin_SBSUnknownDerivedAsSBase(cb);
+ Callback cb = new Callback();
+ test.SBSUnknownDerivedAsSBaseAsync().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.sb.equals("SBSUnknownDerived.sb"));
+ cb.called();
+ });
cb.check();
}
- if(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0))
+ if(test.ice_getEncodingVersion().equals(Util.Encoding_1_0))
{
//
// This test succeeds for the 1.0 encoding.
//
- Callback_TestIntf_SBSUnknownDerivedAsSBaseCompactI cb =
- new Callback_TestIntf_SBSUnknownDerivedAsSBaseCompactI();
- test.begin_SBSUnknownDerivedAsSBaseCompact(cb);
+ Callback cb = new Callback();
+ test.SBSUnknownDerivedAsSBaseCompactAsync().whenComplete((result, ex) ->
+ {
+ if(ex != null)
+ {
+ test(ex instanceof com.zeroc.Ice.OperationNotExistException);
+ }
+ else
+ {
+ test(result.sb.equals("SBSUnknownDerived.sb"));
+ }
+ cb.called();
+ });
cb.check();
}
else
@@ -1521,9 +353,14 @@ public class AllTests
// This test fails when using the compact format because the instance cannot
// be sliced to a known type.
//
- Callback_TestIntf_SBSUnknownDerivedAsSBaseCompactFailI cb =
- new Callback_TestIntf_SBSUnknownDerivedAsSBaseCompactFailI();
- test.begin_SBSUnknownDerivedAsSBaseCompact(cb);
+ Callback cb = new Callback();
+ test.SBSUnknownDerivedAsSBaseCompactAsync().whenComplete((result, ex) ->
+ {
+ test(ex != null);
+ test(ex instanceof com.zeroc.Ice.OperationNotExistException ||
+ ex instanceof com.zeroc.Ice.NoValueFactoryException);
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -1531,18 +368,18 @@ public class AllTests
out.print("unknown with Object as Object... ");
out.flush();
{
- Ice.Object o;
+ com.zeroc.Ice.Value o;
try
{
o = test.SUnknownAsObject();
- test(!test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0));
- test(o instanceof Ice.UnknownSlicedValue);
- test(((Ice.UnknownSlicedValue)o).getUnknownTypeId().equals("::Test::SUnknown"));
+ test(!test.ice_getEncodingVersion().equals(Util.Encoding_1_0));
+ test(o instanceof com.zeroc.Ice.UnknownSlicedValue);
+ test(((com.zeroc.Ice.UnknownSlicedValue)o).getUnknownTypeId().equals("::Test::SUnknown"));
test.checkSUnknown(o);
}
- catch(Ice.NoValueFactoryException ex)
+ catch(com.zeroc.Ice.NoValueFactoryException ex)
{
- test(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0));
+ test(test.ice_getEncodingVersion().equals(Util.Encoding_1_0));
}
catch(Exception ex)
{
@@ -1554,16 +391,27 @@ public class AllTests
out.print("unknown with Object as Object (AMI)... ");
out.flush();
{
- if(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0))
+ if(test.ice_getEncodingVersion().equals(Util.Encoding_1_0))
{
- Callback_TestIntf_SUnknownAsObjectI1 cb = new Callback_TestIntf_SUnknownAsObjectI1();
- test.begin_SUnknownAsObject(cb);
+ Callback cb = new Callback();
+ test.SUnknownAsObjectAsync().whenComplete((result, ex) ->
+ {
+ test(ex != null);
+ test(((com.zeroc.Ice.LocalException)ex).ice_id().equals("::Ice::NoValueFactoryException"));
+ cb.called();
+ });
cb.check();
}
else
{
- Callback_TestIntf_SUnknownAsObjectI2 cb = new Callback_TestIntf_SUnknownAsObjectI2();
- test.begin_SUnknownAsObject(cb);
+ Callback cb = new Callback();
+ test.SUnknownAsObjectAsync().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result instanceof com.zeroc.Ice.UnknownSlicedValue);
+ test(((com.zeroc.Ice.UnknownSlicedValue)result).getUnknownTypeId().equals("::Test::SUnknown"));
+ cb.called();
+ });
cb.check();
}
}
@@ -1590,8 +438,16 @@ public class AllTests
out.print("one-element cycle (AMI)... ");
out.flush();
{
- Callback_TestIntf_oneElementCycleI cb = new Callback_TestIntf_oneElementCycleI();
- test.begin_oneElementCycle(cb);
+ Callback cb = new Callback();
+ test.oneElementCycleAsync().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result != null);
+ test(result.ice_id().equals("::Test::B"));
+ test(result.sb.equals("B1.sb"));
+ test(result.pb == result);
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -1622,8 +478,21 @@ public class AllTests
out.print("two-element cycle (AMI)... ");
out.flush();
{
- Callback_TestIntf_twoElementCycleI cb = new Callback_TestIntf_twoElementCycleI();
- test.begin_twoElementCycle(cb);
+ Callback cb = new Callback();
+ test.twoElementCycleAsync().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result != null);
+ test(result.ice_id().equals("::Test::B"));
+ test(result.sb.equals("B1.sb"));
+
+ B b2 = result.pb;
+ test(b2 != null);
+ test(b2.ice_id().equals("::Test::B"));
+ test(b2.sb.equals("B2.sb"));
+ test(b2.pb == result);
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -1663,8 +532,29 @@ public class AllTests
out.print("known derived pointer slicing as base (AMI)... ");
out.flush();
{
- Callback_TestIntf_D1AsBI cb = new Callback_TestIntf_D1AsBI();
- test.begin_D1AsB(cb);
+ Callback cb = new Callback();
+ test.D1AsBAsync().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result != null);
+ test(result.ice_id().equals("::Test::D1"));
+ test(result.sb.equals("D1.sb"));
+ test(result.pb != null);
+ test(result.pb != result);
+ D1 d1 = (D1)result;
+ test(d1 != null);
+ test(d1.sd1.equals("D1.sd1"));
+ test(d1.pd1 != null);
+ test(d1.pd1 != result);
+ test(result.pb == d1.pd1);
+
+ B b2 = result.pb;
+ test(b2 != null);
+ test(b2.pb == result);
+ test(b2.sb.equals("D2.sb"));
+ test(b2.ice_id().equals("::Test::B"));
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -1698,8 +588,23 @@ public class AllTests
out.print("known derived pointer slicing as derived (AMI)... ");
out.flush();
{
- Callback_TestIntf_D1AsD1I cb = new Callback_TestIntf_D1AsD1I();
- test.begin_D1AsD1(cb);
+ Callback cb = new Callback();
+ test.D1AsD1Async().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result != null);
+ test(result.ice_id().equals("::Test::D1"));
+ test(result.sb.equals("D1.sb"));
+ test(result.pb != null);
+ test(result.pb != result);
+
+ B b2 = result.pb;
+ test(b2 != null);
+ test(b2.ice_id().equals("::Test::B"));
+ test(b2.sb.equals("D2.sb"));
+ test(b2.pb == result);
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -1737,8 +642,27 @@ public class AllTests
out.print("unknown derived pointer slicing as base (AMI)... ");
out.flush();
{
- Callback_TestIntf_D2AsBI cb = new Callback_TestIntf_D2AsBI();
- test.begin_D2AsB(cb);
+ Callback cb = new Callback();
+ test.D2AsBAsync().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result != null);
+ test(result.ice_id().equals("::Test::B"));
+ test(result.sb.equals("D2.sb"));
+ test(result.pb != null);
+ test(result.pb != result);
+
+ B b1 = result.pb;
+ test(b1 != null);
+ test(b1.ice_id().equals("::Test::D1"));
+ test(b1.sb.equals("D1.sb"));
+ test(b1.pb == result);
+ D1 d1 = (D1)b1;
+ test(d1 != null);
+ test(d1.sd1.equals("D1.sd1"));
+ test(d1.pd1 == result);
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -1748,23 +672,21 @@ public class AllTests
{
try
{
- BHolder b1 = new BHolder();
- BHolder b2 = new BHolder();
- test.paramTest1(b1, b2);
+ TestIntf.ParamTest1Result r = test.paramTest1();
- test(b1.value != null);
- test(b1.value.ice_id().equals("::Test::D1"));
- test(b1.value.sb.equals("D1.sb"));
- test(b1.value.pb == b2.value);
- D1 d1 = (D1)b1.value;
+ test(r.p1 != null);
+ test(r.p1.ice_id().equals("::Test::D1"));
+ test(r.p1.sb.equals("D1.sb"));
+ test(r.p1.pb == r.p2);
+ D1 d1 = (D1)r.p1;
test(d1 != null);
test(d1.sd1.equals("D1.sd1"));
- test(d1.pd1 == b2.value);
+ test(d1.pd1 == r.p2);
- test(b2.value != null);
- test(b2.value.ice_id().equals("::Test::B")); // No factory, must be sliced
- test(b2.value.sb.equals("D2.sb"));
- test(b2.value.pb == b1.value);
+ test(r.p2 != null);
+ test(r.p2.ice_id().equals("::Test::B")); // No factory, must be sliced
+ test(r.p2.sb.equals("D2.sb"));
+ test(r.p2.pb == r.p1);
}
catch(Exception ex)
{
@@ -1776,8 +698,25 @@ public class AllTests
out.print("param ptr slicing with known first (AMI)... ");
out.flush();
{
- Callback_TestIntf_paramTest1I cb = new Callback_TestIntf_paramTest1I();
- test.begin_paramTest1(cb);
+ Callback cb = new Callback();
+ test.paramTest1Async().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p1 != null);
+ test(result.p1.ice_id().equals("::Test::D1"));
+ test(result.p1.sb.equals("D1.sb"));
+ test(result.p1.pb == result.p2);
+ D1 d1 = (D1)result.p1;
+ test(d1 != null);
+ test(d1.sd1.equals("D1.sd1"));
+ test(d1.pd1 == result.p2);
+
+ test(result.p2 != null);
+ test(result.p2.ice_id().equals("::Test::B")); // No factory, must be sliced
+ test(result.p2.sb.equals("D2.sb"));
+ test(result.p2.pb == result.p1);
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -1787,23 +726,21 @@ public class AllTests
{
try
{
- BHolder b2 = new BHolder();
- BHolder b1 = new BHolder();
- test.paramTest2(b2, b1);
+ TestIntf.ParamTest2Result r = test.paramTest2();
- test(b1.value != null);
- test(b1.value.ice_id().equals("::Test::D1"));
- test(b1.value.sb.equals("D1.sb"));
- test(b1.value.pb == b2.value);
- D1 d1 = (D1)b1.value;
+ test(r.p1 != null);
+ test(r.p1.ice_id().equals("::Test::D1"));
+ test(r.p1.sb.equals("D1.sb"));
+ test(r.p1.pb == r.p2);
+ D1 d1 = (D1)r.p1;
test(d1 != null);
test(d1.sd1.equals("D1.sd1"));
- test(d1.pd1 == b2.value);
+ test(d1.pd1 == r.p2);
- test(b2.value != null);
- test(b2.value.ice_id().equals("::Test::B")); // No factory, must be sliced
- test(b2.value.sb.equals("D2.sb"));
- test(b2.value.pb == b1.value);
+ test(r.p2 != null);
+ test(r.p2.ice_id().equals("::Test::B")); // No factory, must be sliced
+ test(r.p2.sb.equals("D2.sb"));
+ test(r.p2.pb == r.p1);
}
catch(Exception ex)
{
@@ -1815,8 +752,25 @@ public class AllTests
out.print("param ptr slicing with unknown first (AMI)... ");
out.flush();
{
- Callback_TestIntf_paramTest2I cb = new Callback_TestIntf_paramTest2I();
- test.begin_paramTest2(cb);
+ Callback cb = new Callback();
+ test.paramTest2Async().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p1 != null);
+ test(result.p1.ice_id().equals("::Test::D1"));
+ test(result.p1.sb.equals("D1.sb"));
+ test(result.p1.pb == result.p2);
+ D1 d1 = (D1)result.p1;
+ test(d1 != null);
+ test(d1.sd1.equals("D1.sd1"));
+ test(d1.pd1 == result.p2);
+
+ test(result.p2 != null);
+ test(result.p2.ice_id().equals("::Test::B")); // No factory, must be sliced
+ test(result.p2.sb.equals("D2.sb"));
+ test(result.p2.pb == result.p1);
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -1826,10 +780,8 @@ public class AllTests
{
try
{
- BHolder p1 = new BHolder();
- BHolder p2 = new BHolder();
- B r = test.returnTest1(p1, p2);
- test(r == p1.value);
+ TestIntf.ReturnTest1Result r = test.returnTest1();
+ test(r.returnValue == r.p1);
}
catch(Exception ex)
{
@@ -1841,8 +793,13 @@ public class AllTests
out.print("return value identity with known first (AMI)... ");
out.flush();
{
- Callback_TestIntf_returnTest1I cb = new Callback_TestIntf_returnTest1I();
- test.begin_returnTest1(cb);
+ Callback cb = new Callback();
+ test.returnTest1Async().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.returnValue == result.p1);
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -1852,10 +809,8 @@ public class AllTests
{
try
{
- BHolder p1 = new BHolder();
- BHolder p2 = new BHolder();
- B r = test.returnTest2(p1, p2);
- test(r == p1.value);
+ TestIntf.ReturnTest2Result r = test.returnTest2();
+ test(r.returnValue == r.p2);
}
catch(Exception ex)
{
@@ -1867,8 +822,13 @@ public class AllTests
out.print("return value identity with unknown first (AMI)... ");
out.flush();
{
- Callback_TestIntf_returnTest2I cb = new Callback_TestIntf_returnTest2I();
- test.begin_returnTest2(cb);
+ Callback cb = new Callback();
+ test.returnTest2Async().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.returnValue == result.p2);
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -1940,11 +900,17 @@ public class AllTests
d1.pb = d3;
d1.pd1 = d3;
- Callback_TestIntf_returnTest3I cb = new Callback_TestIntf_returnTest3I();
- test.begin_returnTest3(d1, d3, cb);
+ final Wrapper<B> w = new Wrapper<>();
+ Callback cb = new Callback();
+ test.returnTest3Async(d1, d3).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ w.v = result;
+ cb.called();
+ });
cb.check();
- B b1 = cb.r;
+ B b1 = w.v;
test(b1 != null);
test(b1.sb.equals("D1.sb"));
test(b1.ice_id().equals("::Test::D1"));
@@ -2043,11 +1009,17 @@ public class AllTests
d1.pb = d3;
d1.pd1 = d3;
- Callback_TestIntf_returnTest3I cb = new Callback_TestIntf_returnTest3I();
- test.begin_returnTest3(d3, d1, cb);
+ final Wrapper<B> w = new Wrapper<>();
+ Callback cb = new Callback();
+ test.returnTest3Async(d3, d1).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ w.v = result;
+ cb.called();
+ });
cb.check();
- B b1 = cb.r;
+ B b1 = w.v;
test(b1 != null);
test(b1.sb.equals("D3.sb"));
test(b1.ice_id().equals("::Test::B")); // Sliced by server
@@ -2084,24 +1056,22 @@ public class AllTests
{
try
{
- BHolder p1 = new BHolder();
- BHolder p2 = new BHolder();
- B ret = test.paramTest3(p1, p2);
+ TestIntf.ParamTest3Result r = test.paramTest3();
- test(p1.value != null);
- test(p1.value.sb.equals("D2.sb (p1 1)"));
- test(p1.value.pb == null);
- test(p1.value.ice_id().equals("::Test::B"));
+ test(r.p1 != null);
+ test(r.p1.sb.equals("D2.sb (p1 1)"));
+ test(r.p1.pb == null);
+ test(r.p1.ice_id().equals("::Test::B"));
- test(p2.value != null);
- test(p2.value.sb.equals("D2.sb (p2 1)"));
- test(p2.value.pb == null);
- test(p2.value.ice_id().equals("::Test::B"));
+ test(r.p2 != null);
+ test(r.p2.sb.equals("D2.sb (p2 1)"));
+ test(r.p2.pb == null);
+ test(r.p2.ice_id().equals("::Test::B"));
- test(ret != null);
- test(ret.sb.equals("D1.sb (p2 2)"));
- test(ret.pb == null);
- test(ret.ice_id().equals("::Test::D1"));
+ test(r.returnValue != null);
+ test(r.returnValue.sb.equals("D1.sb (p2 2)"));
+ test(r.returnValue.pb == null);
+ test(r.returnValue.ice_id().equals("::Test::D1"));
}
catch(Exception ex)
{
@@ -2113,8 +1083,26 @@ public class AllTests
out.print("remainder unmarshaling (3 instances) (AMI)... ");
out.flush();
{
- Callback_TestIntf_paramTest3I cb = new Callback_TestIntf_paramTest3I();
- test.begin_paramTest3(cb);
+ Callback cb = new Callback();
+ test.paramTest3Async().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p1 != null);
+ test(result.p1.sb.equals("D2.sb (p1 1)"));
+ test(result.p1.pb == null);
+ test(result.p1.ice_id().equals("::Test::B"));
+
+ test(result.p2 != null);
+ test(result.p2.sb.equals("D2.sb (p2 1)"));
+ test(result.p2.pb == null);
+ test(result.p2.ice_id().equals("::Test::B"));
+
+ test(result.returnValue != null);
+ test(result.returnValue.sb.equals("D1.sb (p2 2)"));
+ test(result.returnValue.pb == null);
+ test(result.returnValue.ice_id().equals("::Test::D1"));
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -2124,18 +1112,17 @@ public class AllTests
{
try
{
- BHolder b = new BHolder();
- B ret = test.paramTest4(b);
+ TestIntf.ParamTest4Result r = test.paramTest4();
- test(b.value != null);
- test(b.value.sb.equals("D4.sb (1)"));
- test(b.value.pb == null);
- test(b.value.ice_id().equals("::Test::B"));
+ test(r.p != null);
+ test(r.p.sb.equals("D4.sb (1)"));
+ test(r.p.pb == null);
+ test(r.p.ice_id().equals("::Test::B"));
- test(ret != null);
- test(ret.sb.equals("B.sb (2)"));
- test(ret.pb == null);
- test(ret.ice_id().equals("::Test::B"));
+ test(r.returnValue != null);
+ test(r.returnValue.sb.equals("B.sb (2)"));
+ test(r.returnValue.pb == null);
+ test(r.returnValue.ice_id().equals("::Test::B"));
}
catch(Exception ex)
{
@@ -2147,8 +1134,21 @@ public class AllTests
out.print("remainder unmarshaling (4 instances) (AMI)... ");
out.flush();
{
- Callback_TestIntf_paramTest4I cb = new Callback_TestIntf_paramTest4I();
- test.begin_paramTest4(cb);
+ Callback cb = new Callback();
+ test.paramTest4Async().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result.p != null);
+ test(result.p.sb.equals("D4.sb (1)"));
+ test(result.p.pb == null);
+ test(result.p.ice_id().equals("::Test::B"));
+
+ test(result.returnValue != null);
+ test(result.returnValue.sb.equals("B.sb (2)"));
+ test(result.returnValue.pb == null);
+ test(result.returnValue.ice_id().equals("::Test::B"));
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -2203,11 +1203,17 @@ public class AllTests
b2.sb = "B.sb(2)";
b2.pb = b1;
- Callback_TestIntf_returnTest3I cb = new Callback_TestIntf_returnTest3I();
- test.begin_returnTest3(d3, b2, cb);
+ final Wrapper<B> w = new Wrapper<>();
+ Callback cb = new Callback();
+ test.returnTest3Async(d3, b2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ w.v = result;
+ cb.called();
+ });
cb.check();
- B r = cb.r;
+ B r = w.v;
test(r != null);
test(r.ice_id().equals("::Test::B"));
test(r.sb.equals("D3.sb"));
@@ -2270,11 +1276,17 @@ public class AllTests
d12.sd1 = "D1.sd1(2)";
d12.pd1 = d11;
- Callback_TestIntf_returnTest3I cb = new Callback_TestIntf_returnTest3I();
- test.begin_returnTest3(d3, d12, cb);
+ final Wrapper<B> w = new Wrapper<>();
+ Callback cb = new Callback();
+ test.returnTest3Async(d3, d12).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ w.v = result;
+ cb.called();
+ });
cb.check();
- B r = cb.r;
+ B r = w.v;
test(r != null);
test(r.ice_id().equals("::Test::B"));
test(r.sb.equals("D3.sb"));
@@ -2375,7 +1387,7 @@ public class AllTests
out.print("sequence slicing (AMI)... ");
out.flush();
{
- SS3 ss;
+ final Wrapper<SS3> w = new Wrapper<>();
{
B ss1b = new B();
ss1b.sb = "B.sb";
@@ -2423,11 +1435,16 @@ public class AllTests
ss2.s[1] = ss2d1;
ss2.s[2] = ss2d3;
- Callback_TestIntf_sequenceTestI cb = new Callback_TestIntf_sequenceTestI();
- test.begin_sequenceTest(ss1, ss2, cb);
+ Callback cb = new Callback();
+ test.sequenceTestAsync(ss1, ss2).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ w.v = result;
+ cb.called();
+ });
cb.check();
- ss = cb.r;
}
+ SS3 ss = w.v;
test(ss.c1 != null);
B ss1b = ss.c1.s[0];
B ss1d1 = ss.c1.s[1];
@@ -2462,9 +1479,7 @@ public class AllTests
{
try
{
- java.util.IdentityHashMap<Integer, B> bin = new java.util.IdentityHashMap<Integer, B>();
- BDictHolder boutH = new BDictHolder();
- java.util.Map<Integer, B> r;
+ java.util.IdentityHashMap<Integer, B> bin = new java.util.IdentityHashMap<>();
int i;
for(i = 0; i < 10; ++i)
{
@@ -2476,12 +1491,12 @@ public class AllTests
bin.put(i, d1);
}
- r = test.dictionaryTest(bin, boutH);
+ TestIntf.DictionaryTestResult r = test.dictionaryTest(bin);
- test(boutH.value.size() == 10);
+ test(r.bout.size() == 10);
for(i = 0; i < 10; ++i)
{
- B b = boutH.value.get(i * 10);
+ B b = r.bout.get(i * 10);
test(b != null);
String s = "D1." + new Integer(i).toString();
test(b.sb.equals(s));
@@ -2491,14 +1506,14 @@ public class AllTests
test(b.pb.pb == b.pb);
}
- test(r.size() == 10);
+ test(r.returnValue.size() == 10);
for(i = 0; i < 10; ++i)
{
- B b = r.get(i * 20);
+ B b = r.returnValue.get(i * 20);
test(b != null);
String s = "D1." + new Integer(i * 20).toString();
test(b.sb.equals(s));
- test(b.pb == (i == 0 ? null : r.get((i - 1) * 20)));
+ test(b.pb == (i == 0 ? null : r.returnValue.get((i - 1) * 20)));
D1 d1 = (D1)b;
test(d1 != null);
test(d1.sd1.equals(s));
@@ -2515,9 +1530,7 @@ public class AllTests
out.print("dictionary slicing (AMI)... ");
out.flush();
{
- java.util.Map<Integer, B> bin = new java.util.HashMap<Integer, B>();
- java.util.Map<Integer, B> bout;
- java.util.Map<Integer, B> r;
+ java.util.Map<Integer, B> bin = new java.util.HashMap<>();
int i;
for(i = 0; i < 10; ++i)
{
@@ -2529,12 +1542,20 @@ public class AllTests
bin.put(i, d1);
}
- Callback_TestIntf_dictionaryTestI cb = new Callback_TestIntf_dictionaryTestI();
- test.begin_dictionaryTest(bin, cb);
+ final Wrapper<java.util.Map<Integer, B>> wbout = new Wrapper<>();
+ final Wrapper<java.util.Map<Integer, B>> wr = new Wrapper<>();
+ Callback cb = new Callback();
+ test.dictionaryTestAsync(bin).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ wbout.v = result.bout;
+ wr.v = result.returnValue;
+ cb.called();
+ });
cb.check();
- bout = cb.bout;
- r = cb.r;
+ java.util.Map<Integer, B> bout = wbout.v;
+ java.util.Map<Integer, B> r = wr.v;
test(bout.size() == 10);
for(i = 0; i < 10; ++i)
{
@@ -2590,8 +1611,25 @@ public class AllTests
out.print("base exception thrown as base exception (AMI)... ");
out.flush();
{
- Callback_TestIntf_throwBaseAsBaseI cb = new Callback_TestIntf_throwBaseAsBaseI();
- test.begin_throwBaseAsBase(cb);
+ Callback cb = new Callback();
+ test.throwBaseAsBaseAsync().whenComplete((result, ex) ->
+ {
+ test(ex != null);
+ try
+ {
+ BaseException e = (BaseException)ex;
+ test(e.ice_id().equals("::Test::BaseException"));
+ test(e.sbe.equals("sbe"));
+ test(e.pb != null);
+ test(e.pb.sb.equals("sb"));
+ test(e.pb.pb == e.pb);
+ }
+ catch(Exception e)
+ {
+ test(false);
+ }
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -2628,8 +1666,31 @@ public class AllTests
out.print("derived exception thrown as base exception (AMI)... ");
out.flush();
{
- Callback_TestIntf_throwDerivedAsBaseI cb = new Callback_TestIntf_throwDerivedAsBaseI();
- test.begin_throwDerivedAsBase(cb);
+ Callback cb = new Callback();
+ test.throwDerivedAsBaseAsync().whenComplete((result, ex) ->
+ {
+ test(ex != null);
+ try
+ {
+ DerivedException e = (DerivedException)ex;
+ test(e.ice_id().equals("::Test::DerivedException"));
+ test(e.sbe.equals("sbe"));
+ test(e.pb != null);
+ test(e.pb.sb.equals("sb1"));
+ test(e.pb.pb == e.pb);
+ test(e.sde.equals("sde1"));
+ test(e.pd1 != null);
+ test(e.pd1.sb.equals("sb2"));
+ test(e.pd1.pb == e.pd1);
+ test(e.pd1.sd1.equals("sd2"));
+ test(e.pd1.pd1 == e.pd1);
+ }
+ catch(Exception e)
+ {
+ test(false);
+ }
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -2666,8 +1727,31 @@ public class AllTests
out.print("derived exception thrown as derived exception (AMI)... ");
out.flush();
{
- Callback_TestIntf_throwDerivedAsDerivedI cb = new Callback_TestIntf_throwDerivedAsDerivedI();
- test.begin_throwDerivedAsDerived(cb);
+ Callback cb = new Callback();
+ test.throwDerivedAsDerivedAsync().whenComplete((result, ex) ->
+ {
+ test(ex != null);
+ try
+ {
+ DerivedException e = (DerivedException)ex;
+ test(e.ice_id().equals("::Test::DerivedException"));
+ test(e.sbe.equals("sbe"));
+ test(e.pb != null);
+ test(e.pb.sb.equals("sb1"));
+ test(e.pb.pb == e.pb);
+ test(e.sde.equals("sde1"));
+ test(e.pd1 != null);
+ test(e.pd1.sb.equals("sb2"));
+ test(e.pd1.pb == e.pd1);
+ test(e.pd1.sd1.equals("sd2"));
+ test(e.pd1.pd1 == e.pd1);
+ }
+ catch(Exception e)
+ {
+ test(false);
+ }
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -2698,8 +1782,25 @@ public class AllTests
out.print("unknown derived exception thrown as base exception (AMI)... ");
out.flush();
{
- Callback_TestIntf_throwUnknownDerivedAsBaseI cb = new Callback_TestIntf_throwUnknownDerivedAsBaseI();
- test.begin_throwUnknownDerivedAsBase(cb);
+ Callback cb = new Callback();
+ test.throwUnknownDerivedAsBaseAsync().whenComplete((result, ex) ->
+ {
+ test(ex != null);
+ try
+ {
+ BaseException e = (BaseException)ex;
+ test(e.ice_id().equals("::Test::BaseException"));
+ test(e.sbe.equals("sbe"));
+ test(e.pb != null);
+ test(e.pb.sb.equals("sb d2"));
+ test(e.pb.pb == e.pb);
+ }
+ catch(Exception e)
+ {
+ test(false);
+ }
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -2709,9 +1810,8 @@ public class AllTests
{
try
{
- ForwardHolder f = new ForwardHolder();
- test.useForward(f);
- test(f.value != null);
+ Forward f = test.useForward();
+ test(f != null);
}
catch(Exception ex)
{
@@ -2723,8 +1823,13 @@ public class AllTests
out.print("forward-declared class (AMI)... ");
out.flush();
{
- Callback_TestIntf_useForwardI cb = new Callback_TestIntf_useForwardI();
- test.begin_useForward(cb);
+ Callback cb = new Callback();
+ test.useForwardAsync().whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ test(result != null);
+ cb.called();
+ });
cb.check();
}
out.println("ok");
@@ -2758,7 +1863,7 @@ public class AllTests
test(p2.ps.equals("preserved"));
test(p2.pb == p2);
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
@@ -2775,7 +1880,7 @@ public class AllTests
test(!(r instanceof PCUnknown));
test(r.pi == 3);
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
@@ -2790,7 +1895,7 @@ public class AllTests
pcd.pbs = new PBase[] { pcd };
PBase r = test.exchangePBase(pcd);
- if(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0))
+ if(test.ice_getEncodingVersion().equals(Util.Encoding_1_0))
{
test(!(r instanceof PCDerived));
test(r.pi == 3);
@@ -2802,7 +1907,7 @@ public class AllTests
test(p2.pbs[0] == p2);
}
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
@@ -2817,7 +1922,7 @@ public class AllTests
pcd.pbs = new PBase[] { pcd };
PBase r = test.exchangePBase(pcd);
- if(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0))
+ if(test.ice_getEncodingVersion().equals(Util.Encoding_1_0))
{
test(!(r instanceof CompactPCDerived));
test(r.pi == 3);
@@ -2829,7 +1934,7 @@ public class AllTests
test(p2.pbs[0] == p2);
}
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
@@ -2858,7 +1963,7 @@ public class AllTests
pcd.pcd3 = pcd.pbs[10];
PBase r = test.exchangePBase(pcd);
- if(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0))
+ if(test.ice_getEncodingVersion().equals(Util.Encoding_1_0))
{
test(!(r instanceof PCDerived3));
test(r instanceof Preserved);
@@ -2880,7 +1985,7 @@ public class AllTests
test(p3.pcd3 == p3.pbs[10]);
}
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
@@ -2893,12 +1998,12 @@ public class AllTests
//
Preserved p = test.PBSUnknownAsPreserved();
test.checkPBSUnknown(p);
- if(!test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0))
+ if(!test.ice_getEncodingVersion().equals(Util.Encoding_1_0))
{
- ((TestIntfPrx)test.ice_encodingVersion(Ice.Util.Encoding_1_0)).checkPBSUnknown(p);
+ test.ice_encodingVersion(Util.Encoding_1_0).checkPBSUnknown(p);
}
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
out.println("ok");
@@ -2915,11 +2020,25 @@ public class AllTests
pd.ps = "preserved";
pd.pb = pd;
- Callback_TestIntf_exchangePBaseI1 cb = new Callback_TestIntf_exchangePBaseI1();
- test.begin_exchangePBase(pd, cb);
+ Callback cb = new Callback();
+ test.exchangePBaseAsync(pd).whenComplete((result, ex) ->
+ {
+ if(ex != null)
+ {
+ test(ex instanceof com.zeroc.Ice.OperationNotExistException);
+ }
+ else
+ {
+ PDerived p2 = (PDerived)result;
+ test(p2.pi == 3);
+ test(p2.ps.equals("preserved"));
+ test(p2.pb == p2);
+ }
+ cb.called();
+ });
cb.check();
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
@@ -2932,11 +2051,23 @@ public class AllTests
pu.pi = 3;
pu.pu = "preserved";
- Callback_TestIntf_exchangePBaseI2 cb = new Callback_TestIntf_exchangePBaseI2();
- test.begin_exchangePBase(pu, cb);
+ Callback cb = new Callback();
+ test.exchangePBaseAsync(pu).whenComplete((result, ex) ->
+ {
+ if(ex != null)
+ {
+ test(ex instanceof com.zeroc.Ice.OperationNotExistException);
+ }
+ else
+ {
+ test(!(result instanceof PCUnknown));
+ test(result.pi == 3);
+ }
+ cb.called();
+ });
cb.check();
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
@@ -2950,20 +2081,45 @@ public class AllTests
pcd.pi = 3;
pcd.pbs = new PBase[] { pcd };
- if(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0))
- {
- Callback_TestIntf_exchangePBaseI3 cb = new Callback_TestIntf_exchangePBaseI3();
- test.begin_exchangePBase(pcd, cb);
+ if(test.ice_getEncodingVersion().equals(Util.Encoding_1_0))
+ {
+ Callback cb = new Callback();
+ test.exchangePBaseAsync(pcd).whenComplete((result, ex) ->
+ {
+ if(ex != null)
+ {
+ test(ex instanceof com.zeroc.Ice.OperationNotExistException);
+ }
+ else
+ {
+ test(!(result instanceof PCDerived));
+ test(result.pi == 3);
+ }
+ cb.called();
+ });
cb.check();
}
else
{
- Callback_TestIntf_exchangePBaseI4 cb = new Callback_TestIntf_exchangePBaseI4();
- test.begin_exchangePBase(pcd, cb);
+ Callback cb = new Callback();
+ test.exchangePBaseAsync(pcd).whenComplete((result, ex) ->
+ {
+ if(ex != null)
+ {
+ test(ex instanceof com.zeroc.Ice.OperationNotExistException);
+ }
+ else
+ {
+ PCDerived p2 = (PCDerived)result;
+ test(p2.pi == 3);
+ test(p2.pbs[0] == p2);
+ }
+ cb.called();
+ });
cb.check();
}
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
@@ -2977,20 +2133,45 @@ public class AllTests
pcd.pi = 3;
pcd.pbs = new PBase[] { pcd };
- if(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0))
- {
- Callback_TestIntf_exchangePBaseICompact1 cb = new Callback_TestIntf_exchangePBaseICompact1();
- test.begin_exchangePBase(pcd, cb);
+ if(test.ice_getEncodingVersion().equals(Util.Encoding_1_0))
+ {
+ Callback cb = new Callback();
+ test.exchangePBaseAsync(pcd).whenComplete((result, ex) ->
+ {
+ if(ex != null)
+ {
+ test(ex instanceof com.zeroc.Ice.OperationNotExistException);
+ }
+ else
+ {
+ test(!(result instanceof CompactPCDerived));
+ test(result.pi == 3);
+ }
+ cb.called();
+ });
cb.check();
}
else
{
- Callback_TestIntf_exchangePBaseICompact2 cb = new Callback_TestIntf_exchangePBaseICompact2();
- test.begin_exchangePBase(pcd, cb);
+ Callback cb = new Callback();
+ test.exchangePBaseAsync(pcd).whenComplete((result, ex) ->
+ {
+ if(ex != null)
+ {
+ test(ex instanceof com.zeroc.Ice.OperationNotExistException);
+ }
+ else
+ {
+ CompactPCDerived p2 = (CompactPCDerived)result;
+ test(p2.pi == 3);
+ test(p2.pbs[0] == p2);
+ }
+ cb.called();
+ });
cb.check();
}
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
@@ -3018,20 +2199,55 @@ public class AllTests
pcd.pcd2 = pcd.pi;
pcd.pcd3 = pcd.pbs[10];
- if(test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0))
- {
- Callback_TestIntf_exchangePBaseI5 cb = new Callback_TestIntf_exchangePBaseI5();
- test.begin_exchangePBase(pcd, cb);
+ if(test.ice_getEncodingVersion().equals(Util.Encoding_1_0))
+ {
+ Callback cb = new Callback();
+ test.exchangePBaseAsync(pcd).whenComplete((result, ex) ->
+ {
+ if(ex != null)
+ {
+ test(ex instanceof com.zeroc.Ice.OperationNotExistException);
+ }
+ else
+ {
+ test(!(result instanceof PCDerived3));
+ test(result instanceof Preserved);
+ test(result.pi == 3);
+ }
+ cb.called();
+ });
cb.check();
}
else
{
- Callback_TestIntf_exchangePBaseI6 cb = new Callback_TestIntf_exchangePBaseI6();
- test.begin_exchangePBase(pcd, cb);
+ Callback cb = new Callback();
+ test.exchangePBaseAsync(pcd).whenComplete((result, ex) ->
+ {
+ if(ex != null)
+ {
+ test(ex instanceof com.zeroc.Ice.OperationNotExistException);
+ }
+ else
+ {
+ PCDerived3 p3 = (PCDerived3)result;
+ test(p3.pi == 3);
+ for(int j = 0; j < 300; ++j)
+ {
+ PCDerived2 p2 = (PCDerived2)p3.pbs[j];
+ test(p2.pi == j);
+ test(p2.pbs.length == 1);
+ test(p2.pbs[0] == null);
+ test(p2.pcd2 == j);
+ }
+ test(p3.pcd2 == p3.pi);
+ test(p3.pcd3 == p3.pbs[10]);
+ }
+ cb.called();
+ });
cb.check();
}
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
@@ -3044,12 +2260,12 @@ public class AllTests
//
Preserved p = test.PBSUnknownAsPreserved();
test.checkPBSUnknown(p);
- if(!test.ice_getEncodingVersion().equals(Ice.Util.Encoding_1_0))
+ if(!test.ice_getEncodingVersion().equals(Util.Encoding_1_0))
{
- ((TestIntfPrx)test.ice_encodingVersion(Ice.Util.Encoding_1_0)).checkPBSUnknown(p);
+ test.ice_encodingVersion(Util.Encoding_1_0).checkPBSUnknown(p);
}
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
@@ -3140,7 +2356,7 @@ public class AllTests
test(false);
}
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
diff --git a/java/test/src/main/java/test/Ice/slicing/objects/Client.java b/java/test/src/main/java/test/Ice/slicing/objects/Client.java
index f6eb48a34f0..bad24e2946e 100644
--- a/java/test/src/main/java/test/Ice/slicing/objects/Client.java
+++ b/java/test/src/main/java/test/Ice/slicing/objects/Client.java
@@ -16,19 +16,18 @@ public class Client extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.Communicator communicator = communicator();
TestIntfPrx test = AllTests.allTests(communicator, false, getWriter());
test.shutdown();
return 0;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.objects.client");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.objects.client");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/slicing/objects/Server.java b/java/test/src/main/java/test/Ice/slicing/objects/Server.java
index 629716506f6..b25d118840c 100644
--- a/java/test/src/main/java/test/Ice/slicing/objects/Server.java
+++ b/java/test/src/main/java/test/Ice/slicing/objects/Server.java
@@ -14,23 +14,22 @@ public class Server extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Object object = new TestI();
- adapter.add(object, Ice.Util.stringToIdentity("Test"));
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.Object object = new TestI();
+ adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("Test"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.objects.server");
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.objects.server");
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/slicing/objects/TestI.java b/java/test/src/main/java/test/Ice/slicing/objects/TestI.java
index bdd69fa7dad..8ff095af743 100644
--- a/java/test/src/main/java/test/Ice/slicing/objects/TestI.java
+++ b/java/test/src/main/java/test/Ice/slicing/objects/TestI.java
@@ -9,12 +9,14 @@
package test.Ice.slicing.objects;
+import java.util.concurrent.CompletionStage;
+import java.util.concurrent.CompletableFuture;
+
import test.Ice.slicing.objects.server.Test.*;
-public final class TestI extends _TestIntfDisp
+public final class TestI implements TestIntf
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -23,15 +25,13 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
@Override
- public Ice.Object
- SBaseAsObject(Ice.Current current)
+ public com.zeroc.Ice.Value SBaseAsObject(com.zeroc.Ice.Current current)
{
SBase sb = new SBase();
sb.sb = "SBase.sb";
@@ -39,8 +39,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public SBase
- SBaseAsSBase(Ice.Current current)
+ public SBase SBaseAsSBase(com.zeroc.Ice.Current current)
{
SBase sb = new SBase();
sb.sb = "SBase.sb";
@@ -48,8 +47,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public SBase
- SBSKnownDerivedAsSBase(Ice.Current current)
+ public SBase SBSKnownDerivedAsSBase(com.zeroc.Ice.Current current)
{
SBSKnownDerived sbskd = new SBSKnownDerived();
sbskd.sb = "SBSKnownDerived.sb";
@@ -58,8 +56,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public SBSKnownDerived
- SBSKnownDerivedAsSBSKnownDerived(Ice.Current current)
+ public SBSKnownDerived SBSKnownDerivedAsSBSKnownDerived(com.zeroc.Ice.Current current)
{
SBSKnownDerived sbskd = new SBSKnownDerived();
sbskd.sb = "SBSKnownDerived.sb";
@@ -68,8 +65,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public SBase
- SBSUnknownDerivedAsSBase(Ice.Current current)
+ public SBase SBSUnknownDerivedAsSBase(com.zeroc.Ice.Current current)
{
SBSUnknownDerived sbsud = new SBSUnknownDerived();
sbsud.sb = "SBSUnknownDerived.sb";
@@ -78,8 +74,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public SBase
- SBSUnknownDerivedAsSBaseCompact(Ice.Current current)
+ public SBase SBSUnknownDerivedAsSBaseCompact(com.zeroc.Ice.Current current)
{
SBSUnknownDerived sbsud = new SBSUnknownDerived();
sbsud.sb = "SBSUnknownDerived.sb";
@@ -88,8 +83,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public Ice.Object
- SUnknownAsObject(Ice.Current current)
+ public com.zeroc.Ice.Value SUnknownAsObject(com.zeroc.Ice.Current current)
{
SUnknown su = new SUnknown();
su.su = "SUnknown.su";
@@ -97,10 +91,9 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- checkSUnknown(Ice.Object obj, Ice.Current current)
+ public void checkSUnknown(com.zeroc.Ice.Value obj, com.zeroc.Ice.Current current)
{
- if(current.encoding.equals(Ice.Util.Encoding_1_0))
+ if(current.encoding.equals(com.zeroc.Ice.Util.Encoding_1_0))
{
test(!(obj instanceof SUnknown));
}
@@ -112,8 +105,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public B
- oneElementCycle(Ice.Current current)
+ public B oneElementCycle(com.zeroc.Ice.Current current)
{
B b = new B();
b.sb = "B1.sb";
@@ -122,8 +114,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public B
- twoElementCycle(Ice.Current current)
+ public B twoElementCycle(com.zeroc.Ice.Current current)
{
B b1 = new B();
b1.sb = "B1.sb";
@@ -135,8 +126,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public B
- D1AsB(Ice.Current current)
+ public B D1AsB(com.zeroc.Ice.Current current)
{
D1 d1 = new D1();
d1.sb = "D1.sb";
@@ -152,8 +142,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public D1
- D1AsD1(Ice.Current current)
+ public D1 D1AsD1(com.zeroc.Ice.Current current)
{
D1 d1 = new D1();
d1.sb = "D1.sb";
@@ -169,8 +158,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public B
- D2AsB(Ice.Current current)
+ public B D2AsB(com.zeroc.Ice.Current current)
{
D2 d2 = new D2();
d2.sb = "D2.sb";
@@ -186,8 +174,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- paramTest1(BHolder p1, BHolder p2, Ice.Current current)
+ public TestIntf.ParamTest1Result paramTest1(com.zeroc.Ice.Current current)
{
D1 d1 = new D1();
d1.sb = "D1.sb";
@@ -199,26 +186,26 @@ public final class TestI extends _TestIntfDisp
d2.pd2 = d1;
d1.pb = d2;
d1.pd1 = d2;
- p1.value = d1;
- p2.value = d2;
+ return new TestIntf.ParamTest1Result(d1, d2);
}
@Override
- public void
- paramTest2(BHolder p1, BHolder p2, Ice.Current current)
+ public TestIntf.ParamTest2Result paramTest2(com.zeroc.Ice.Current current)
{
- paramTest1(p2, p1, current);
+ TestIntf.ParamTest1Result r1 = paramTest1(current);
+ return new TestIntf.ParamTest2Result(r1.p2, r1.p1);
}
@Override
- public B
- paramTest3(BHolder p1, BHolder p2, Ice.Current current)
+ public TestIntf.ParamTest3Result paramTest3(com.zeroc.Ice.Current current)
{
+ TestIntf.ParamTest3Result r = new TestIntf.ParamTest3Result();
+
D2 d2 = new D2();
d2.sb = "D2.sb (p1 1)";
d2.pb = null;
d2.sd2 = "D2.sd2 (p1 1)";
- p1.value = d2;
+ r.p1 = d2;
D1 d1 = new D1();
d1.sb = "D1.sb (p1 2)";
@@ -231,7 +218,7 @@ public final class TestI extends _TestIntfDisp
d4.sb = "D2.sb (p2 1)";
d4.pb = null;
d4.sd2 = "D2.sd2 (p2 1)";
- p2.value = d4;
+ r.p2 = d4;
D1 d3 = new D1();
d3.sb = "D1.sb (p2 2)";
@@ -239,13 +226,13 @@ public final class TestI extends _TestIntfDisp
d3.sd1 = "D1.sd2 (p2 2)";
d3.pd1 = null;
d4.pd2 = d3;
+ r.returnValue = d3;
- return d3;
+ return r;
}
@Override
- public B
- paramTest4(BHolder p1, Ice.Current current)
+ public TestIntf.ParamTest4Result paramTest4(com.zeroc.Ice.Current current)
{
D4 d4 = new D4();
d4.sb = "D4.sb (1)";
@@ -254,38 +241,32 @@ public final class TestI extends _TestIntfDisp
d4.p1.sb = "B.sb (1)";
d4.p2 = new B();
d4.p2.sb = "B.sb (2)";
- p1.value = d4;
- return d4.p2;
+
+ return new TestIntf.ParamTest4Result(d4.p2, d4);
}
@Override
- public B
- returnTest1(BHolder p1, BHolder p2, Ice.Current current)
+ public TestIntf.ReturnTest1Result returnTest1(com.zeroc.Ice.Current current)
{
- Ice.Current c;
- paramTest1(p1, p2, current);
- return p1.value;
+ TestIntf.ParamTest1Result r1 = paramTest1(current);
+ return new TestIntf.ReturnTest1Result(r1.p1, r1.p1, r1.p2);
}
@Override
- public B
- returnTest2(BHolder p1, BHolder p2, Ice.Current current)
+ public TestIntf.ReturnTest2Result returnTest2(com.zeroc.Ice.Current current)
{
- Ice.Current c;
- paramTest1(p2, p1, current);
- return p1.value;
+ TestIntf.ParamTest1Result r1 = paramTest1(current);
+ return new TestIntf.ReturnTest2Result(r1.p1, r1.p1, r1.p2);
}
@Override
- public B
- returnTest3(B p1, B p2, Ice.Current current)
+ public B returnTest3(B p1, B p2, com.zeroc.Ice.Current current)
{
return p1;
}
@Override
- public SS3
- sequenceTest(SS1 p1, SS2 p2, Ice.Current current)
+ public SS3 sequenceTest(SS1 p1, SS2 p2, com.zeroc.Ice.Current current)
{
SS3 ss = new SS3();
ss.c1 = p1;
@@ -294,10 +275,10 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public java.util.Map<Integer, B>
- dictionaryTest(java.util.Map<Integer, B> bin, BDictHolder bout, Ice.Current current)
+ public TestIntf.DictionaryTestResult dictionaryTest(java.util.Map<Integer, B> bin, com.zeroc.Ice.Current current)
{
- bout.value = new java.util.HashMap<Integer, B>();
+ TestIntf.DictionaryTestResult r = new TestIntf.DictionaryTestResult();
+ r.bout = new java.util.HashMap<>();
int i;
for(i = 0; i < 10; ++i)
{
@@ -307,39 +288,37 @@ public final class TestI extends _TestIntfDisp
d2.pb = b.pb;
d2.sd2 = "D2";
d2.pd2 = d2;
- bout.value.put(i * 10, d2);
+ r.bout.put(i * 10, d2);
}
- java.util.Map<Integer, B> r = new java.util.HashMap<Integer, B>();
+ r.returnValue = new java.util.HashMap<>();
for(i = 0; i < 10; ++i)
{
String s = "D1." + new Integer(i * 20).toString();
D1 d1 = new D1();
d1.sb = s;
- d1.pb = (i == 0 ? null : r.get((i - 1) * 20));
+ d1.pb = (i == 0 ? null : r.returnValue.get((i - 1) * 20));
d1.sd1 = s;
d1.pd1 = d1;
- r.put(i * 20, d1);
+ r.returnValue.put(i * 20, d1);
}
return r;
}
@Override
- public PBase
- exchangePBase(PBase pb, Ice.Current current)
+ public PBase exchangePBase(PBase pb, com.zeroc.Ice.Current current)
{
return pb;
}
@Override
- public Preserved
- PBSUnknownAsPreserved(Ice.Current current)
+ public Preserved PBSUnknownAsPreserved(com.zeroc.Ice.Current current)
{
PSUnknown r = new PSUnknown();
r.pi = 5;
r.ps = "preserved";
r.psu = "unknown";
r.graph = null;
- if(!current.encoding.equals(Ice.Util.Encoding_1_0))
+ if(!current.encoding.equals(com.zeroc.Ice.Util.Encoding_1_0))
{
//
// 1.0 encoding doesn't support unmarshaling unknown classes even if referenced
@@ -351,10 +330,9 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- checkPBSUnknown(Preserved p, Ice.Current current)
+ public void checkPBSUnknown(Preserved p, com.zeroc.Ice.Current current)
{
- if(current.encoding.equals(Ice.Util.Encoding_1_0))
+ if(current.encoding.equals(com.zeroc.Ice.Util.Encoding_1_0))
{
test(!(p instanceof PSUnknown));
test(p.pi == 5);
@@ -372,8 +350,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- PBSUnknownAsPreservedWithGraph_async(AMD_TestIntf_PBSUnknownAsPreservedWithGraph cb, Ice.Current current)
+ public CompletionStage<Preserved> PBSUnknownAsPreservedWithGraphAsync(com.zeroc.Ice.Current current)
{
PSUnknown r = new PSUnknown();
r.pi = 5;
@@ -383,15 +360,17 @@ public final class TestI extends _TestIntfDisp
r.graph.next = new PNode();
r.graph.next.next = new PNode();
r.graph.next.next.next = r.graph;
- cb.ice_response(r);
- r.graph.next.next.next = null; // Break the cycle.
+ return CompletableFuture.completedFuture(r);
+ //
+ // Can't do this with the Java 8 mapping:
+ //
+ //r.graph.next.next.next = null; // Break the cycle.
}
@Override
- public void
- checkPBSUnknownWithGraph(Preserved p, Ice.Current current)
+ public void checkPBSUnknownWithGraph(Preserved p, com.zeroc.Ice.Current current)
{
- if(current.encoding.equals(Ice.Util.Encoding_1_0))
+ if(current.encoding.equals(com.zeroc.Ice.Util.Encoding_1_0))
{
test(!(p instanceof PSUnknown));
test(p.pi == 5);
@@ -411,22 +390,23 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- PBSUnknown2AsPreservedWithGraph_async(AMD_TestIntf_PBSUnknown2AsPreservedWithGraph cb, Ice.Current current)
+ public CompletionStage<Preserved> PBSUnknown2AsPreservedWithGraphAsync(com.zeroc.Ice.Current current)
{
PSUnknown2 r = new PSUnknown2();
r.pi = 5;
r.ps = "preserved";
r.pb = r;
- cb.ice_response(r);
- r.pb = null; // Break the cycle.
+ return CompletableFuture.completedFuture(r);
+ //
+ // Can't do this with the Java 8 mapping:
+ //
+ //r.pb = null; // Break the cycle.
}
@Override
- public void
- checkPBSUnknown2WithGraph(Preserved p, Ice.Current current)
+ public void checkPBSUnknown2WithGraph(Preserved p, com.zeroc.Ice.Current current)
{
- if(current.encoding.equals(Ice.Util.Encoding_1_0))
+ if(current.encoding.equals(com.zeroc.Ice.Util.Encoding_1_0))
{
test(!(p instanceof PSUnknown2));
test(p.pi == 5);
@@ -443,15 +423,13 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public PNode
- exchangePNode(PNode pn, Ice.Current current)
+ public PNode exchangePNode(PNode pn, com.zeroc.Ice.Current current)
{
return pn;
}
@Override
- public void
- throwBaseAsBase(Ice.Current current)
+ public void throwBaseAsBase(com.zeroc.Ice.Current current)
throws BaseException
{
BaseException be = new BaseException();
@@ -463,8 +441,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- throwDerivedAsBase(Ice.Current current)
+ public void throwDerivedAsBase(com.zeroc.Ice.Current current)
throws BaseException
{
DerivedException de = new DerivedException();
@@ -482,8 +459,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- throwDerivedAsDerived(Ice.Current current)
+ public void throwDerivedAsDerived(com.zeroc.Ice.Current current)
throws DerivedException
{
DerivedException de = new DerivedException();
@@ -501,8 +477,7 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- throwUnknownDerivedAsBase(Ice.Current current)
+ public void throwUnknownDerivedAsBase(com.zeroc.Ice.Current current)
throws BaseException
{
D2 d2 = new D2();
@@ -520,24 +495,28 @@ public final class TestI extends _TestIntfDisp
}
@Override
- public void
- throwPreservedException_async(AMD_TestIntf_throwPreservedException cb, Ice.Current current)
+ public CompletionStage<Void> throwPreservedExceptionAsync(com.zeroc.Ice.Current current)
{
PSUnknownException ue = new PSUnknownException();
ue.p = new PSUnknown2();
ue.p.pi = 5;
ue.p.ps = "preserved";
ue.p.pb = ue.p;
- cb.ice_exception(ue);
- ue.p.pb = null; // Break the cycle.
+ CompletableFuture<Void> r = new CompletableFuture<>();
+ r.completeExceptionally(ue);
+ return r;
+ //
+ // Can't do this with the Java 8 mapping:
+ //
+ //ue.p.pb = null; // Break the cycle.
}
@Override
- public void
- useForward(ForwardHolder f, Ice.Current current)
+ public Forward useForward(com.zeroc.Ice.Current current)
{
- f.value = new Forward();
- f.value.h = new Hidden();
- f.value.h.f = f.value;
+ Forward f = new Forward();
+ f.h = new Hidden();
+ f.h.f = f;
+ return f;
}
}
diff --git a/java/test/src/main/java/test/Ice/stream/Client.java b/java/test/src/main/java/test/Ice/stream/Client.java
index b00dd482951..86ff5d34565 100644
--- a/java/test/src/main/java/test/Ice/stream/Client.java
+++ b/java/test/src/main/java/test/Ice/stream/Client.java
@@ -11,20 +11,21 @@ package test.Ice.stream;
import java.io.PrintWriter;
-import Ice.BoolSeqHelper;
-import Ice.ByteSeqHelper;
-import Ice.DoubleSeqHelper;
-import Ice.FloatSeqHelper;
-import Ice.ShortSeqHelper;
-import Ice.IntSeqHelper;
-import Ice.LongSeqHelper;
-import Ice.StringSeqHelper;
+import com.zeroc.Ice.BoolSeqHelper;
+import com.zeroc.Ice.ByteSeqHelper;
+import com.zeroc.Ice.DoubleSeqHelper;
+import com.zeroc.Ice.FloatSeqHelper;
+import com.zeroc.Ice.ShortSeqHelper;
+import com.zeroc.Ice.IntSeqHelper;
+import com.zeroc.Ice.LongSeqHelper;
+import com.zeroc.Ice.StringSeqHelper;
+import com.zeroc.Ice.InputStream;
+import com.zeroc.Ice.OutputStream;
import test.Ice.stream.Test.*;
public class Client extends test.Util.Application
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -32,7 +33,7 @@ public class Client extends test.Util.Application
}
}
- private static class TestObjectWriter extends Ice.ObjectWriter
+ private static class TestObjectWriter extends com.zeroc.Ice.ValueWriter
{
TestObjectWriter(MyClass obj)
{
@@ -40,8 +41,7 @@ public class Client extends test.Util.Application
}
@Override
- public void
- write(Ice.OutputStream out)
+ public void write(OutputStream out)
{
obj.__write(out);
called = true;
@@ -51,11 +51,10 @@ public class Client extends test.Util.Application
boolean called = false;
}
- private static class TestObjectReader extends Ice.ObjectReader
+ private static class TestObjectReader extends com.zeroc.Ice.ValueReader
{
@Override
- public void
- read(Ice.InputStream in)
+ public void read(InputStream in)
{
obj = new MyClass();
obj.__read(in);
@@ -66,63 +65,45 @@ public class Client extends test.Util.Application
boolean called = false;
}
- private static class TestValueFactory implements Ice.ValueFactory
+ private static class TestValueFactory implements com.zeroc.Ice.ValueFactory
{
@Override
- public Ice.Object
- create(String type)
+ public com.zeroc.Ice.Value create(String type)
{
assert(type.equals(MyClass.ice_staticId()));
return new TestObjectReader();
}
}
- private static class MyInterfaceI extends _MyInterfaceDisp
- {
- }
-
- private static class MyInterfaceFactory implements Ice.ValueFactory
+ private static class TestReadValueCallback implements com.zeroc.Ice.ReadValueCallback
{
@Override
- public Ice.Object
- create(String type)
- {
- assert(type.equals(_MyInterfaceDisp.ice_staticId()));
- return new MyInterfaceI();
- }
- }
-
- private static class TestReadValueCallback implements Ice.ReadValueCallback
- {
- @Override
- public void valueReady(Ice.Object obj)
+ public void valueReady(com.zeroc.Ice.Value obj)
{
this.obj = obj;
}
- Ice.Object obj;
+ com.zeroc.Ice.Value obj;
}
- private static class MyClassFactoryWrapper implements Ice.ValueFactory
+ private static class MyClassFactoryWrapper implements com.zeroc.Ice.ValueFactory
{
MyClassFactoryWrapper()
{
- _factory = MyClass.ice_factory();
+ setFactory(null);
}
@Override
- public Ice.Object
- create(String type)
+ public com.zeroc.Ice.Value create(String type)
{
return _factory.create(type);
}
- void
- setFactory(Ice.ValueFactory factory)
+ void setFactory(com.zeroc.Ice.ValueFactory factory)
{
if(factory == null)
{
- _factory = MyClass.ice_factory();
+ _factory = id -> { return new MyClass(); };
}
else
{
@@ -130,20 +111,18 @@ public class Client extends test.Util.Application
}
}
- private Ice.ValueFactory _factory;
+ private com.zeroc.Ice.ValueFactory _factory;
}
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
- Ice.Communicator comm = communicator();
+ com.zeroc.Ice.Communicator comm = communicator();
MyClassFactoryWrapper factoryWrapper = new MyClassFactoryWrapper();
comm.getValueFactoryManager().add(factoryWrapper, MyClass.ice_staticId());
- comm.getValueFactoryManager().add(new MyInterfaceFactory(), _MyInterfaceDisp.ice_staticId());
- Ice.InputStream in;
- Ice.OutputStream out;
+ InputStream in;
+ OutputStream out;
PrintWriter printWriter = getWriter();
printWriter.print("testing primitive types... ");
@@ -151,17 +130,17 @@ public class Client extends test.Util.Application
{
byte[] data = new byte[0];
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
}
{
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
out.startEncapsulation();
out.writeBool(true);
out.endEncapsulation();
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
in.startEncapsulation();
test(in.readBool());
in.endEncapsulation();
@@ -169,78 +148,78 @@ public class Client extends test.Util.Application
{
byte[] data = new byte[0];
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
try
{
in.readBool();
test(false);
}
- catch(Ice.UnmarshalOutOfBoundsException ex)
+ catch(com.zeroc.Ice.UnmarshalOutOfBoundsException ex)
{
}
}
{
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
out.writeBool(true);
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
test(in.readBool());
}
{
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
out.writeByte((byte)1);
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
test(in.readByte() == (byte)1);
}
{
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
out.writeShort((short)2);
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
test(in.readShort() == (short)2);
}
{
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
out.writeInt(3);
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
test(in.readInt() == 3);
}
{
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
out.writeLong(4);
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
test(in.readLong() == 4);
}
{
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
out.writeFloat((float)5.0);
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
test(in.readFloat() == (float)5.0);
}
{
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
out.writeDouble(6.0);
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
test(in.readDouble() == 6.0);
}
{
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
out.writeString("hello world");
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
test(in.readString().equals("hello world"));
}
@@ -250,15 +229,15 @@ public class Client extends test.Util.Application
printWriter.flush();
{
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
MyEnum.write(out, MyEnum.enum3);
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
test(MyEnum.read(in) == MyEnum.enum3);
}
{
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
SmallStruct s = new SmallStruct();
s.bo = true;
s.by = (byte)1;
@@ -269,16 +248,16 @@ public class Client extends test.Util.Application
s.d = 6.0;
s.str = "7";
s.e = MyEnum.enum2;
- s.p = MyClassPrxHelper.uncheckedCast(comm.stringToProxy("test:default"));
+ s.p = comm.stringToProxy("test:default");
SmallStruct.write(out, s);
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
SmallStruct s2 = SmallStruct.read(in, null);
test(s2.equals(s));
}
{
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
OptionalClass o = new OptionalClass();
o.bo = true;
o.by = (byte)5;
@@ -287,7 +266,7 @@ public class Client extends test.Util.Application
out.writeValue(o);
out.writePendingValues();
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
TestReadValueCallback cb = new TestReadValueCallback();
in.readValue(cb);
in.readPendingValues();
@@ -307,7 +286,7 @@ public class Client extends test.Util.Application
}
{
- out = new Ice.OutputStream(comm, Ice.Util.Encoding_1_0);
+ out = new OutputStream(comm, com.zeroc.Ice.Util.Encoding_1_0);
OptionalClass o = new OptionalClass();
o.bo = true;
o.by = (byte)5;
@@ -316,7 +295,7 @@ public class Client extends test.Util.Application
out.writeValue(o);
out.writePendingValues();
byte[] data = out.finished();
- in = new Ice.InputStream(comm, Ice.Util.Encoding_1_0, data);
+ in = new InputStream(comm, com.zeroc.Ice.Util.Encoding_1_0, data);
TestReadValueCallback cb = new TestReadValueCallback();
in.readValue(cb);
in.readPendingValues();
@@ -335,10 +314,10 @@ public class Client extends test.Util.Application
true,
false
};
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
BoolSeqHelper.write(out, arr);
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
boolean[] arr2 = BoolSeqHelper.read(in);
test(java.util.Arrays.equals(arr2, arr));
@@ -348,10 +327,10 @@ public class Client extends test.Util.Application
new boolean[0],
arr
};
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
BoolSSHelper.write(out, arrS);
data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
boolean[][] arr2S = BoolSSHelper.read(in);
test(java.util.Arrays.deepEquals(arr2S, arrS));
}
@@ -364,10 +343,10 @@ public class Client extends test.Util.Application
(byte)0x12,
(byte)0x22
};
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
ByteSeqHelper.write(out, arr);
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
byte[] arr2 = ByteSeqHelper.read(in);
test(java.util.Arrays.equals(arr2, arr));
@@ -377,10 +356,10 @@ public class Client extends test.Util.Application
new byte[0],
arr
};
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
ByteSSHelper.write(out, arrS);
data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
byte[][] arr2S = ByteSSHelper.read(in);
test(java.util.Arrays.deepEquals(arr2S, arrS));
}
@@ -388,10 +367,10 @@ public class Client extends test.Util.Application
{
test.Ice.stream.Serialize.Small small = new test.Ice.stream.Serialize.Small();
small.i = 99;
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
out.writeSerializable(small);
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
test.Ice.stream.Serialize.Small small2 = (test.Ice.stream.Serialize.Small)in.readSerializable();
test(small2.i == 99);
}
@@ -404,10 +383,10 @@ public class Client extends test.Util.Application
(short)0x12,
(short)0x22
};
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
ShortSeqHelper.write(out, arr);
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
short[] arr2 = ShortSeqHelper.read(in);
test(java.util.Arrays.equals(arr2, arr));
@@ -417,10 +396,10 @@ public class Client extends test.Util.Application
new short[0],
arr
};
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
ShortSSHelper.write(out, arrS);
data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
short[][] arr2S = ShortSSHelper.read(in);
test(java.util.Arrays.deepEquals(arr2S, arrS));
}
@@ -433,10 +412,10 @@ public class Client extends test.Util.Application
0x12,
0x22
};
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
IntSeqHelper.write(out, arr);
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
int[] arr2 = IntSeqHelper.read(in);
test(java.util.Arrays.equals(arr2, arr));
@@ -446,10 +425,10 @@ public class Client extends test.Util.Application
new int[0],
arr
};
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
IntSSHelper.write(out, arrS);
data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
int[][] arr2S = IntSSHelper.read(in);
test(java.util.Arrays.deepEquals(arr2S, arrS));
}
@@ -462,10 +441,10 @@ public class Client extends test.Util.Application
0x12,
0x22
};
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
LongSeqHelper.write(out, arr);
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
long[] arr2 = LongSeqHelper.read(in);
test(java.util.Arrays.equals(arr2, arr));
@@ -475,10 +454,10 @@ public class Client extends test.Util.Application
new long[0],
arr
};
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
LongSSHelper.write(out, arrS);
data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
long[][] arr2S = LongSSHelper.read(in);
test(java.util.Arrays.deepEquals(arr2S, arrS));
}
@@ -491,10 +470,10 @@ public class Client extends test.Util.Application
3,
4
};
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
FloatSeqHelper.write(out, arr);
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
float[] arr2 = FloatSeqHelper.read(in);
test(java.util.Arrays.equals(arr2, arr));
@@ -504,10 +483,10 @@ public class Client extends test.Util.Application
new float[0],
arr
};
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
FloatSSHelper.write(out, arrS);
data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
float[][] arr2S = FloatSSHelper.read(in);
test(java.util.Arrays.deepEquals(arr2S, arrS));
}
@@ -520,10 +499,10 @@ public class Client extends test.Util.Application
3,
4
};
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
DoubleSeqHelper.write(out, arr);
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
double[] arr2 = DoubleSeqHelper.read(in);
test(java.util.Arrays.equals(arr2, arr));
@@ -533,10 +512,10 @@ public class Client extends test.Util.Application
new double[0],
arr
};
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
DoubleSSHelper.write(out, arrS);
data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
double[][] arr2S = DoubleSSHelper.read(in);
test(java.util.Arrays.deepEquals(arr2S, arrS));
}
@@ -549,10 +528,10 @@ public class Client extends test.Util.Application
"string3",
"string4"
};
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
StringSeqHelper.write(out, arr);
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
String[] arr2 = StringSeqHelper.read(in);
test(java.util.Arrays.equals(arr2, arr));
@@ -562,10 +541,10 @@ public class Client extends test.Util.Application
new String[0],
arr
};
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
StringSSHelper.write(out, arrS);
data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
String[][] arr2S = StringSSHelper.read(in);
test(java.util.Arrays.deepEquals(arr2S, arrS));
}
@@ -578,10 +557,10 @@ public class Client extends test.Util.Application
MyEnum.enum1,
MyEnum.enum2
};
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
MyEnumSHelper.write(out, arr);
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
MyEnum[] arr2 = MyEnumSHelper.read(in);
test(java.util.Arrays.equals(arr2, arr));
@@ -591,10 +570,10 @@ public class Client extends test.Util.Application
new MyEnum[0],
arr
};
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
MyEnumSSHelper.write(out, arrS);
data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
MyEnum[][] arr2S = MyEnumSSHelper.read(in);
test(java.util.Arrays.deepEquals(arr2S, arrS));
}
@@ -618,14 +597,14 @@ public class Client extends test.Util.Application
arr[i].seq8 = new String[] { "string1", "string2", "string3", "string4" };
arr[i].seq9 = new MyEnum[] { MyEnum.enum3, MyEnum.enum2, MyEnum.enum1 };
arr[i].seq10 = new MyClass[4]; // null elements.
- arr[i].d = new java.util.HashMap<String, MyClass>();
+ arr[i].d = new java.util.HashMap<>();
arr[i].d.put("hi", arr[i]);
}
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
MyClassSHelper.write(out, arr);
out.writePendingValues();
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
MyClass[] arr2 = MyClassSHelper.read(in);
in.readPendingValues();
test(arr2.length == arr.length);
@@ -653,10 +632,10 @@ public class Client extends test.Util.Application
new MyClass[0],
arr
};
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
MyClassSSHelper.write(out, arrS);
data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
MyClass[][] arr2S = MyClassSSHelper.read(in);
test(arr2S.length == arrS.length);
test(arr2S[0].length == arrS[0].length);
@@ -665,20 +644,7 @@ public class Client extends test.Util.Application
}
{
- MyInterface i = new MyInterfaceI();
- out = new Ice.OutputStream(comm);
- out.writeValue(i);
- out.writePendingValues();
- byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
- MyInterfaceHolder j = new MyInterfaceHolder();
- in.readValue(j);
- in.readPendingValues();
- test(j.value != null);
- }
-
- {
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
MyClass obj = new MyClass();
obj.s = new SmallStruct();
obj.s.e = MyEnum.enum2;
@@ -690,7 +656,7 @@ public class Client extends test.Util.Application
}
{
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
MyClass obj = new MyClass();
obj.s = new SmallStruct();
obj.s.e = MyEnum.enum2;
@@ -700,7 +666,7 @@ public class Client extends test.Util.Application
byte[] data = out.finished();
test(writer.called);
factoryWrapper.setFactory(new TestValueFactory());
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
TestReadValueCallback cb = new TestReadValueCallback();
in.readValue(cb);
in.readPendingValues();
@@ -714,7 +680,7 @@ public class Client extends test.Util.Application
}
{
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
MyException ex = new MyException();
MyClass c = new MyClass();
@@ -732,7 +698,7 @@ public class Client extends test.Util.Application
c.seq8 = new String[] { "string1", "string2", "string3", "string4" };
c.seq9 = new MyEnum[] { MyEnum.enum3, MyEnum.enum2, MyEnum.enum1 };
c.seq10 = new MyClass[4]; // null elements.
- c.d = new java.util.HashMap<String, MyClass>();
+ c.d = new java.util.HashMap<>();
c.d.put("hi", c);
ex.c = c;
@@ -740,7 +706,7 @@ public class Client extends test.Util.Application
out.writeException(ex);
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
try
{
in.throwException();
@@ -759,63 +725,63 @@ public class Client extends test.Util.Application
test(java.util.Arrays.equals(ex1.c.seq8, c.seq8));
test(java.util.Arrays.equals(ex1.c.seq9, c.seq9));
}
- catch(Ice.UserException ex1)
+ catch(com.zeroc.Ice.UserException ex1)
{
test(false);
}
}
{
- java.util.Map<Byte, Boolean> dict = new java.util.HashMap<Byte, Boolean>();
+ java.util.Map<Byte, Boolean> dict = new java.util.HashMap<>();
dict.put((byte)4, true);
dict.put((byte)1, false);
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
ByteBoolDHelper.write(out, dict);
byte data[] = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
java.util.Map<Byte, Boolean> dict2 = ByteBoolDHelper.read(in);
test(dict2.equals(dict));
}
{
- java.util.Map<Short, Integer> dict = new java.util.HashMap<Short, Integer>();
+ java.util.Map<Short, Integer> dict = new java.util.HashMap<>();
dict.put((short)1, 9);
dict.put((short)4, 8);
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
ShortIntDHelper.write(out, dict);
byte data[] = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
java.util.Map<Short, Integer> dict2 = ShortIntDHelper.read(in);
test(dict2.equals(dict));
}
{
- java.util.Map<Long, Float> dict = new java.util.HashMap<Long, Float>();
+ java.util.Map<Long, Float> dict = new java.util.HashMap<>();
dict.put((long)123809828, 0.51f);
dict.put((long)123809829, 0.56f);
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
LongFloatDHelper.write(out, dict);
byte data[] = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
java.util.Map<Long, Float> dict2 = LongFloatDHelper.read(in);
test(dict2.equals(dict));
}
{
- java.util.Map<String, String> dict = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> dict = new java.util.HashMap<>();
dict.put("key1", "value1");
dict.put("key2", "value2");
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
StringStringDHelper.write(out, dict);
byte data[] = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
java.util.Map<String, String> dict2 = StringStringDHelper.read(in);
test(dict2.equals(dict));
}
{
- java.util.Map<String, MyClass> dict = new java.util.HashMap<String, MyClass>();
+ java.util.Map<String, MyClass> dict = new java.util.HashMap<>();
MyClass c;
c = new MyClass();
c.s = new SmallStruct();
@@ -825,11 +791,11 @@ public class Client extends test.Util.Application
c.s = new SmallStruct();
c.s.e = MyEnum.enum3;
dict.put("key2", c);
- out = new Ice.OutputStream(comm);
+ out = new OutputStream(comm);
StringMyClassDHelper.write(out, dict);
out.writePendingValues();
byte[] data = out.finished();
- in = new Ice.InputStream(comm, data);
+ in = new InputStream(comm, data);
java.util.Map<String, MyClass> dict2 = StringMyClassDHelper.read(in);
in.readPendingValues();
test(dict2.size() == dict.size());
@@ -843,12 +809,11 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.stream");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.stream");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/stream/Test.ice b/java/test/src/main/java/test/Ice/stream/Test.ice
index 8302a9e342c..eccd2bb193f 100644
--- a/java/test/src/main/java/test/Ice/stream/Test.ice
+++ b/java/test/src/main/java/test/Ice/stream/Test.ice
@@ -111,10 +111,6 @@ class MyClass
StringMyClassD d;
};
-interface MyInterface
-{
-};
-
exception MyException
{
MyClass c;
diff --git a/java/test/src/main/java/test/Ice/threadPoolPriority/Client.java b/java/test/src/main/java/test/Ice/threadPoolPriority/Client.java
index d9b17b4e55c..4befa3d5967 100644
--- a/java/test/src/main/java/test/Ice/threadPoolPriority/Client.java
+++ b/java/test/src/main/java/test/Ice/threadPoolPriority/Client.java
@@ -10,12 +10,10 @@
package test.Ice.threadPoolPriority;
import test.Ice.threadPoolPriority.Test.PriorityPrx;
-import test.Ice.threadPoolPriority.Test.PriorityPrxHelper;
public class Client extends test.Util.Application
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -27,8 +25,8 @@ public class Client extends test.Util.Application
public int run(String[] args)
{
java.io.PrintWriter out = getWriter();
- Ice.ObjectPrx object = communicator().stringToProxy("test:default -p 12010 -t 10000");
- PriorityPrx priority = PriorityPrxHelper.checkedCast(object);
+ com.zeroc.Ice.ObjectPrx object = communicator().stringToProxy("test:default -p 12010 -t 10000");
+ PriorityPrx priority = PriorityPrx.checkedCast(object);
out.print("testing thread priority... ");
out.flush();
int prio = priority.getPriority();
diff --git a/java/test/src/main/java/test/Ice/threadPoolPriority/PriorityI.java b/java/test/src/main/java/test/Ice/threadPoolPriority/PriorityI.java
index 18579e7713a..d4cb6e0a231 100644
--- a/java/test/src/main/java/test/Ice/threadPoolPriority/PriorityI.java
+++ b/java/test/src/main/java/test/Ice/threadPoolPriority/PriorityI.java
@@ -1,19 +1,26 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
package test.Ice.threadPoolPriority;
-import test.Ice.threadPoolPriority.Test._PriorityDisp;
+import test.Ice.threadPoolPriority.Test.Priority;
-public class PriorityI extends _PriorityDisp
+public class PriorityI implements Priority
{
-
@Override
- public void shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
@Override
- public int getPriority(Ice.Current current)
+ public int getPriority(com.zeroc.Ice.Current current)
{
return Thread.currentThread().getPriority();
}
diff --git a/java/test/src/main/java/test/Ice/threadPoolPriority/Server.java b/java/test/src/main/java/test/Ice/threadPoolPriority/Server.java
index 68ae4707319..7fc77d818a6 100644
--- a/java/test/src/main/java/test/Ice/threadPoolPriority/Server.java
+++ b/java/test/src/main/java/test/Ice/threadPoolPriority/Server.java
@@ -15,20 +15,19 @@ public class Server extends test.Util.Application
public int run(String[] args)
{
communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000:udp");
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- adapter.add(new PriorityI(), Ice.Util.stringToIdentity("test"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.add(new PriorityI(), com.zeroc.Ice.Util.stringToIdentity("test"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.ThreadPool.Server.ThreadPriority", "10");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.ThreadPool.Server.ThreadPriority", "10");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/throughput/Client.java b/java/test/src/main/java/test/Ice/throughput/Client.java
index 22bfc5ce894..b7234143425 100644
--- a/java/test/src/main/java/test/Ice/throughput/Client.java
+++ b/java/test/src/main/java/test/Ice/throughput/Client.java
@@ -18,29 +18,26 @@ import test.Ice.throughput.Demo.StringDouble;
import test.Ice.throughput.Demo.StringDoubleSeqSize;
import test.Ice.throughput.Demo.StringSeqSize;
import test.Ice.throughput.Demo.ThroughputPrx;
-import test.Ice.throughput.Demo.ThroughputPrxHelper;
public class Client extends test.Util.Application
{
class ShutdownHook extends Thread
{
@Override
- public void
- run()
+ public void run()
{
try
{
communicator().destroy();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
}
}
}
- private static void
- menu()
+ private static void menu()
{
System.out.println(
"usage:\n" +
@@ -64,8 +61,7 @@ public class Client extends test.Util.Application
}
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
PrintWriter out = getWriter();
PrintWriter err = out;
@@ -80,13 +76,13 @@ public class Client extends test.Util.Application
// Application installed interrupt callback and install our
// own shutdown hook.
//
- ThroughputPrx throughput = ThroughputPrxHelper.checkedCast(communicator().propertyToProxy("Throughput.Proxy"));
+ ThroughputPrx throughput = ThroughputPrx.checkedCast(communicator().propertyToProxy("Throughput.Proxy"));
if(throughput == null)
{
err.println("invalid proxy");
return 1;
}
- ThroughputPrx throughputOneway = ThroughputPrxHelper.uncheckedCast(throughput.ice_oneway());
+ ThroughputPrx throughputOneway = throughput.ice_oneway();
byte[] byteSeq = new byte[ByteSeqSize.value];
@@ -144,14 +140,14 @@ public class Client extends test.Util.Application
throughput.recvStringSeq();
throughput.recvStructSeq();
throughput.recvFixedSeq();
-
+
throughput.echoByteSeq(emptyBytes);
throughput.echoStringSeq(emptyStrings);
throughput.echoStructSeq(emptyStructs);
throughput.echoFixedSeq(emptyFixed);
}
throughput.endWarmup();
-
+
out.println(" ok");
}
*/
@@ -163,7 +159,7 @@ public class Client extends test.Util.Application
// Initial ping to setup the connection.
throughput.ice_ping();
-
+
String[] input = { "t", "o", "r", "e", "s", "x", null };
int inputIndex = 0;
String line = null;
@@ -223,20 +219,20 @@ public class Client extends test.Util.Application
out.print("sending");
break;
}
-
+
case 'r':
{
out.print("receiving");
break;
}
-
+
case 'e':
{
out.print("sending and receiving");
break;
}
}
-
+
out.print(" " + repetitions);
switch(currentType)
{
@@ -264,17 +260,17 @@ public class Client extends test.Util.Application
break;
}
}
-
+
out.print(" sequences of size " + seqSize);
-
+
if(c == 'o')
{
out.print(" as oneway");
}
-
+
out.println("...");
out.flush();
-
+
for(int i = 0; i < repetitions; ++i)
{
switch(currentType)
@@ -288,19 +284,19 @@ public class Client extends test.Util.Application
throughput.sendByteSeq(byteSeq);
break;
}
-
+
case 'o':
{
throughputOneway.sendByteSeq(byteSeq);
break;
}
-
+
case 'r':
{
throughput.recvByteSeq();
break;
}
-
+
case 'e':
{
throughput.echoByteSeq(byteSeq);
@@ -319,19 +315,19 @@ public class Client extends test.Util.Application
throughput.sendStringSeq(stringSeq);
break;
}
-
+
case 'o':
{
throughputOneway.sendStringSeq(stringSeq);
break;
}
-
+
case 'r':
{
throughput.recvStringSeq();
break;
}
-
+
case 'e':
{
throughput.echoStringSeq(stringSeq);
@@ -350,19 +346,19 @@ public class Client extends test.Util.Application
throughput.sendStructSeq(structSeq);
break;
}
-
+
case 'o':
{
throughputOneway.sendStructSeq(structSeq);
break;
}
-
+
case 'r':
{
throughput.recvStructSeq();
break;
}
-
+
case 'e':
{
throughput.echoStructSeq(structSeq);
@@ -381,19 +377,19 @@ public class Client extends test.Util.Application
throughput.sendFixedSeq(fixedSeq);
break;
}
-
+
case 'o':
{
throughputOneway.sendFixedSeq(fixedSeq);
break;
}
-
+
case 'r':
{
throughput.recvFixedSeq();
break;
}
-
+
case 'e':
{
throughput.echoFixedSeq(fixedSeq);
@@ -463,7 +459,7 @@ public class Client extends test.Util.Application
menu();
}
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
}
@@ -472,15 +468,14 @@ public class Client extends test.Util.Application
return 0;
}
-
+
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Demo", "test.Ice.throughput");
- initData.properties.setProperty("Throughput.Proxy", "throughput:default -p 10000 -h 127.0.0.1");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Demo", "test.Ice.throughput");
+ r.initData.properties.setProperty("Throughput.Proxy", "throughput:default -p 10000 -h 127.0.0.1");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/throughput/Server.java b/java/test/src/main/java/test/Ice/throughput/Server.java
index fb81f2fc963..446c841a1ee 100644
--- a/java/test/src/main/java/test/Ice/throughput/Server.java
+++ b/java/test/src/main/java/test/Ice/throughput/Server.java
@@ -12,23 +12,21 @@ package test.Ice.throughput;
public class Server extends test.Util.Application
{
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Throughput");
- adapter.add(new ThroughputI(), Ice.Util.stringToIdentity("throughput"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Throughput");
+ adapter.add(new ThroughputI(), com.zeroc.Ice.Util.stringToIdentity("throughput"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Demo", "test.Ice.throughput");
- initData.properties.setProperty("Throughput.Endpoints", "default -p 10000 -h 127.0.0.1");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Demo", "test.Ice.throughput");
+ r.initData.properties.setProperty("Throughput.Endpoints", "default -p 10000 -h 127.0.0.1");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/throughput/ThroughputI.java b/java/test/src/main/java/test/Ice/throughput/ThroughputI.java
index dec3f3aef9d..df30da2f275 100644
--- a/java/test/src/main/java/test/Ice/throughput/ThroughputI.java
+++ b/java/test/src/main/java/test/Ice/throughput/ThroughputI.java
@@ -15,12 +15,11 @@ import test.Ice.throughput.Demo.FixedSeqSize;
import test.Ice.throughput.Demo.StringDouble;
import test.Ice.throughput.Demo.StringDoubleSeqSize;
import test.Ice.throughput.Demo.StringSeqSize;
-import test.Ice.throughput.Demo._ThroughputDisp;
+import test.Ice.throughput.Demo.Throughput;
-public final class ThroughputI extends _ThroughputDisp
+public final class ThroughputI implements Throughput
{
- public
- ThroughputI()
+ public ThroughputI()
{
_byteSeq = new byte[ByteSeqSize.value];
@@ -49,37 +48,32 @@ public final class ThroughputI extends _ThroughputDisp
}
@Override
- public boolean
- needsWarmup(Ice.Current current)
+ public boolean needsWarmup(com.zeroc.Ice.Current current)
{
_warmup = false;
return _needsWarmup;
}
@Override
- public void
- startWarmup(Ice.Current current)
+ public void startWarmup(com.zeroc.Ice.Current current)
{
_warmup = true;
}
@Override
- public void
- endWarmup(Ice.Current current)
+ public void endWarmup(com.zeroc.Ice.Current current)
{
_warmup = false;
_needsWarmup = false;
}
@Override
- public void
- sendByteSeq(byte[] seq, Ice.Current current)
+ public void sendByteSeq(byte[] seq, com.zeroc.Ice.Current current)
{
}
@Override
- public byte[]
- recvByteSeq(Ice.Current current)
+ public byte[] recvByteSeq(com.zeroc.Ice.Current current)
{
if(_warmup)
{
@@ -92,21 +86,18 @@ public final class ThroughputI extends _ThroughputDisp
}
@Override
- public byte[]
- echoByteSeq(byte[] seq, Ice.Current current)
+ public byte[] echoByteSeq(byte[] seq, com.zeroc.Ice.Current current)
{
return seq;
}
@Override
- public void
- sendStringSeq(String[] seq, Ice.Current current)
+ public void sendStringSeq(String[] seq, com.zeroc.Ice.Current current)
{
}
@Override
- public String[]
- recvStringSeq(Ice.Current current)
+ public String[] recvStringSeq(com.zeroc.Ice.Current current)
{
if(_warmup)
{
@@ -119,21 +110,18 @@ public final class ThroughputI extends _ThroughputDisp
}
@Override
- public String[]
- echoStringSeq(String[] seq, Ice.Current current)
+ public String[] echoStringSeq(String[] seq, com.zeroc.Ice.Current current)
{
return seq;
}
@Override
- public void
- sendStructSeq(StringDouble[] seq, Ice.Current current)
+ public void sendStructSeq(StringDouble[] seq, com.zeroc.Ice.Current current)
{
}
@Override
- public StringDouble[]
- recvStructSeq(Ice.Current current)
+ public StringDouble[] recvStructSeq(com.zeroc.Ice.Current current)
{
if(_warmup)
{
@@ -146,21 +134,18 @@ public final class ThroughputI extends _ThroughputDisp
}
@Override
- public StringDouble[]
- echoStructSeq(StringDouble[] seq, Ice.Current current)
+ public StringDouble[] echoStructSeq(StringDouble[] seq, com.zeroc.Ice.Current current)
{
return seq;
}
@Override
- public void
- sendFixedSeq(Fixed[] seq, Ice.Current current)
+ public void sendFixedSeq(Fixed[] seq, com.zeroc.Ice.Current current)
{
}
@Override
- public Fixed[]
- recvFixedSeq(Ice.Current current)
+ public Fixed[] recvFixedSeq(com.zeroc.Ice.Current current)
{
if(_warmup)
{
@@ -173,15 +158,13 @@ public final class ThroughputI extends _ThroughputDisp
}
@Override
- public Fixed[]
- echoFixedSeq(Fixed[] seq, Ice.Current current)
+ public Fixed[] echoFixedSeq(Fixed[] seq, com.zeroc.Ice.Current current)
{
return seq;
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
diff --git a/java/test/src/main/java/test/Ice/timeout/AllTests.java b/java/test/src/main/java/test/Ice/timeout/AllTests.java
index facbe176e24..72a0151fd53 100644
--- a/java/test/src/main/java/test/Ice/timeout/AllTests.java
+++ b/java/test/src/main/java/test/Ice/timeout/AllTests.java
@@ -10,14 +10,13 @@
package test.Ice.timeout;
import java.io.PrintWriter;
+import java.util.concurrent.CompletionException;
import test.Ice.timeout.Test.TimeoutPrx;
-import test.Ice.timeout.Test.TimeoutPrxHelper;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -32,8 +31,7 @@ public class AllTests
_called = false;
}
- public synchronized void
- check()
+ public synchronized void check()
{
while(!_called)
{
@@ -49,8 +47,7 @@ public class AllTests
_called = false;
}
- public synchronized void
- called()
+ public synchronized void called()
{
assert(!_called);
_called = true;
@@ -60,86 +57,13 @@ public class AllTests
private boolean _called;
}
- private static class CallbackSuccess extends Ice.Callback
+ public static TimeoutPrx allTests(test.Util.Application app)
{
- @Override
- public void
- completed(Ice.AsyncResult result)
- {
- try
- {
- TimeoutPrx p = TimeoutPrxHelper.uncheckedCast(result.getProxy());
- if(result.getOperation().equals("sendData"))
- {
- p.end_sendData(result);
- }
- else if(result.getOperation().equals("sleep"))
- {
- p.end_sleep(result);
- }
- }
- catch(Ice.LocalException ex)
- {
- test(false);
- }
- callback.called();
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- private static class CallbackFail extends Ice.Callback
- {
- @Override
- public void
- completed(Ice.AsyncResult result)
- {
- try
- {
- TimeoutPrx p = TimeoutPrxHelper.uncheckedCast(result.getProxy());
- if(result.getOperation().equals("sendData"))
- {
- p.end_sendData(result);
- }
- else if(result.getOperation().equals("sleep"))
- {
- p.end_sleep(result);
- }
- test(false);
- }
- catch(Ice.TimeoutException ex)
- {
- callback.called();
- }
- catch(Ice.LocalException ex)
- {
- test(false);
- }
- }
-
- public void
- check()
- {
- callback.check();
- }
-
- private Callback callback = new Callback();
- }
-
- public static TimeoutPrx
- allTests(test.Util.Application app)
- {
- Ice.Communicator communicator = app.communicator();
+ com.zeroc.Ice.Communicator communicator = app.communicator();
PrintWriter out = app.getWriter();
String sref = "timeout:default -p 12010";
- Ice.ObjectPrx obj = communicator.stringToProxy(sref);
+ com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(sref);
test(obj != null);
int mult = 1;
@@ -148,7 +72,7 @@ public class AllTests
mult = 4;
}
- TimeoutPrx timeout = TimeoutPrxHelper.checkedCast(obj);
+ TimeoutPrx timeout = TimeoutPrx.checkedCast(obj);
test(timeout != null);
out.print("testing connect timeout... ");
@@ -157,14 +81,14 @@ public class AllTests
//
// Expect ConnectTimeoutException.
//
- TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(100 * mult));
+ TimeoutPrx to = timeout.ice_timeout(100 * mult);
timeout.holdAdapter(500 * mult);
try
{
to.op();
test(false);
}
- catch(Ice.ConnectTimeoutException ex)
+ catch(com.zeroc.Ice.ConnectTimeoutException ex)
{
// Expected.
}
@@ -174,13 +98,13 @@ public class AllTests
// Expect success.
//
timeout.op(); // Ensure adapter is active.
- TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000 * mult));
+ TimeoutPrx to = timeout.ice_timeout(1000 * mult);
timeout.holdAdapter(500 * mult);
try
{
to.op();
}
- catch(Ice.ConnectTimeoutException ex)
+ catch(com.zeroc.Ice.ConnectTimeoutException ex)
{
test(false);
}
@@ -197,14 +121,14 @@ public class AllTests
//
// Expect TimeoutException.
//
- TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(100));
+ TimeoutPrx to = timeout.ice_timeout(100);
timeout.holdAdapter(500 * mult);
try
{
to.sendData(seq);
test(false);
}
- catch(Ice.TimeoutException ex)
+ catch(com.zeroc.Ice.TimeoutException ex)
{
// Expected.
}
@@ -214,13 +138,13 @@ public class AllTests
// Expect success.
//
timeout.op(); // Ensure adapter is active.
- TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000 * mult));
+ TimeoutPrx to = timeout.ice_timeout(1000 * mult);
timeout.holdAdapter(500 * mult);
try
{
to.sendData(new byte[1000000]);
}
- catch(Ice.TimeoutException ex)
+ catch(com.zeroc.Ice.TimeoutException ex)
{
test(false);
}
@@ -230,25 +154,25 @@ public class AllTests
out.print("testing invocation timeout... ");
out.flush();
{
- Ice.Connection connection = obj.ice_getConnection();
- TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_invocationTimeout(100));
+ com.zeroc.Ice.Connection connection = obj.ice_getConnection();
+ TimeoutPrx to = timeout.ice_invocationTimeout(100);
test(connection == to.ice_getConnection());
try
{
to.sleep(750 * mult);
test(false);
}
- catch(Ice.InvocationTimeoutException ex)
+ catch(com.zeroc.Ice.InvocationTimeoutException ex)
{
}
obj.ice_ping();
- to = TimeoutPrxHelper.checkedCast(obj.ice_invocationTimeout(500 * mult));
+ to = TimeoutPrx.checkedCast(obj.ice_invocationTimeout(500 * mult));
test(connection == to.ice_getConnection());
try
{
to.sleep(250 * mult);
}
- catch(Ice.InvocationTimeoutException ex)
+ catch(com.zeroc.Ice.InvocationTimeoutException ex)
{
test(false);
}
@@ -258,9 +182,13 @@ public class AllTests
//
// Expect InvocationTimeoutException.
//
- TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_invocationTimeout(100));
- CallbackFail cb = new CallbackFail();
- to.begin_sleep(750 * mult, cb);
+ TimeoutPrx to = timeout.ice_invocationTimeout(100);
+ Callback cb = new Callback();
+ to.sleepAsync(750 * mult).whenComplete((result, ex) ->
+ {
+ test(ex != null && ex instanceof com.zeroc.Ice.TimeoutException);
+ cb.called();
+ });
cb.check();
obj.ice_ping();
}
@@ -268,24 +196,28 @@ public class AllTests
//
// Expect success.
//
- TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_invocationTimeout(500 * mult));
- CallbackSuccess cb = new CallbackSuccess();
- to.begin_sleep(250 * mult, cb);
+ TimeoutPrx to = timeout.ice_invocationTimeout(500 * mult);
+ Callback cb = new Callback();
+ to.sleepAsync(250 * mult).whenComplete((result, ex) ->
+ {
+ test(ex == null);
+ cb.called();
+ });
cb.check();
}
{
//
// Backward compatible connection timeouts
//
- TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_invocationTimeout(-2).ice_timeout(100));
- Ice.Connection con = null;
+ TimeoutPrx to = timeout.ice_invocationTimeout(-2).ice_timeout(100);
+ com.zeroc.Ice.Connection con = null;
try
{
con = to.ice_getConnection();
to.sleep(750);
test(false);
}
- catch(Ice.TimeoutException ex)
+ catch(com.zeroc.Ice.TimeoutException ex)
{
assert(con != null);
try
@@ -293,7 +225,7 @@ public class AllTests
con.getInfo();
test(false);
}
- catch(Ice.TimeoutException exc)
+ catch(com.zeroc.Ice.TimeoutException exc)
{
// Connection got closed as well.
}
@@ -303,18 +235,19 @@ public class AllTests
try
{
con = to.ice_getConnection();
- to.end_sleep(to.begin_sleep(750));
+ to.sleepAsync(750).join();
test(false);
}
- catch(Ice.TimeoutException ex)
+ catch(CompletionException ex)
{
+ assert(ex.getCause() instanceof com.zeroc.Ice.TimeoutException);
assert(con != null);
try
{
con.getInfo();
test(false);
}
- catch(Ice.TimeoutException exc)
+ catch(com.zeroc.Ice.TimeoutException exc)
{
// Connection got closed as well.
}
@@ -326,15 +259,15 @@ public class AllTests
out.print("testing close timeout... ");
out.flush();
{
- TimeoutPrx to = TimeoutPrxHelper.checkedCast(obj.ice_timeout(100 * mult));
- Ice.Connection connection = to.ice_getConnection();
+ TimeoutPrx to = TimeoutPrx.checkedCast(obj.ice_timeout(100 * mult));
+ com.zeroc.Ice.Connection connection = to.ice_getConnection();
timeout.holdAdapter(500);
connection.close(false);
try
{
connection.getInfo(); // getInfo() doesn't throw in the closing state.
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -350,7 +283,7 @@ public class AllTests
connection.getInfo();
test(false);
}
- catch(Ice.CloseConnectionException ex)
+ catch(com.zeroc.Ice.CloseConnectionException ex)
{
// Expected.
}
@@ -365,18 +298,18 @@ public class AllTests
// Test Ice.Override.Timeout. This property overrides all
// endpoint timeouts.
//
- Ice.InitializationData initData = app.createInitializationData();
+ com.zeroc.Ice.InitializationData initData = app.createInitializationData();
initData.properties = communicator.getProperties()._clone();
initData.properties.setProperty("Ice.Override.Timeout", "250");
- Ice.Communicator comm = app.initialize(initData);
- TimeoutPrx to = TimeoutPrxHelper.checkedCast(comm.stringToProxy(sref));
+ com.zeroc.Ice.Communicator comm = app.initialize(initData);
+ TimeoutPrx to = TimeoutPrx.checkedCast(comm.stringToProxy(sref));
timeout.holdAdapter(700 * mult);
try
{
to.sendData(seq);
test(false);
}
- catch(Ice.TimeoutException ex)
+ catch(com.zeroc.Ice.TimeoutException ex)
{
// Expected.
}
@@ -384,14 +317,14 @@ public class AllTests
// Calling ice_timeout() should have no effect.
//
timeout.op(); // Ensure adapter is active.
- to = TimeoutPrxHelper.checkedCast(to.ice_timeout(1000 * mult));
+ to = TimeoutPrx.checkedCast(to.ice_timeout(1000 * mult));
timeout.holdAdapter(500 * mult);
try
{
to.sendData(seq);
test(false);
}
- catch(Ice.TimeoutException ex)
+ catch(com.zeroc.Ice.TimeoutException ex)
{
// Expected.
}
@@ -401,7 +334,7 @@ public class AllTests
//
// Test Ice.Override.ConnectTimeout.
//
- Ice.InitializationData initData = app.createInitializationData();
+ com.zeroc.Ice.InitializationData initData = app.createInitializationData();
initData.properties = communicator.getProperties()._clone();
if(mult == 1)
{
@@ -412,15 +345,15 @@ public class AllTests
initData.properties.setProperty("Ice.Override.ConnectTimeout", "2500");
}
- Ice.Communicator comm = app.initialize(initData);
- TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(comm.stringToProxy(sref));
+ com.zeroc.Ice.Communicator comm = app.initialize(initData);
+ TimeoutPrx to = TimeoutPrx.uncheckedCast(comm.stringToProxy(sref));
timeout.holdAdapter(750 * mult);
try
{
to.op();
test(false);
}
- catch(Ice.ConnectTimeoutException ex)
+ catch(com.zeroc.Ice.ConnectTimeoutException ex)
{
// Expected.
}
@@ -429,13 +362,13 @@ public class AllTests
//
timeout.op(); // Ensure adapter is active.
timeout.holdAdapter(750 * mult);
- to = TimeoutPrxHelper.uncheckedCast(to.ice_timeout(1000 * mult));
+ to = to.ice_timeout(1000 * mult);
try
{
to.op();
test(false);
}
- catch(Ice.ConnectTimeoutException ex)
+ catch(com.zeroc.Ice.ConnectTimeoutException ex)
{
// Expected.
}
@@ -443,7 +376,7 @@ public class AllTests
// Verify that timeout set via ice_timeout() is still used for requests.
//
timeout.op(); // Ensure adapter is active.
- to = TimeoutPrxHelper.uncheckedCast(to.ice_timeout(250));
+ to = to.ice_timeout(250);
to.ice_getConnection(); // Establish connection
timeout.holdAdapter(750 * mult);
try
@@ -451,7 +384,7 @@ public class AllTests
to.sendData(seq);
test(false);
}
- catch(Ice.TimeoutException ex)
+ catch(com.zeroc.Ice.TimeoutException ex)
{
// Expected.
}
@@ -461,10 +394,10 @@ public class AllTests
//
// Test Ice.Override.CloseTimeout.
//
- Ice.InitializationData initData = app.createInitializationData();
+ com.zeroc.Ice.InitializationData initData = app.createInitializationData();
initData.properties = communicator.getProperties()._clone();
initData.properties.setProperty("Ice.Override.CloseTimeout", "100");
- Ice.Communicator comm = app.initialize(initData);
+ com.zeroc.Ice.Communicator comm = app.initialize(initData);
comm.stringToProxy(sref).ice_getConnection();
timeout.holdAdapter(500);
long now = System.nanoTime();
@@ -478,43 +411,44 @@ public class AllTests
{
communicator.getProperties().setProperty("TimeoutCollocated.AdapterId", "timeoutAdapter");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TimeoutCollocated");
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TimeoutCollocated");
adapter.activate();
- TimeoutPrx proxy = TimeoutPrxHelper.uncheckedCast(adapter.addWithUUID(new TimeoutI()));
- proxy = (TimeoutPrx)proxy.ice_invocationTimeout(100);
+ TimeoutPrx proxy = TimeoutPrx.uncheckedCast(adapter.addWithUUID(new TimeoutI()));
+ proxy = proxy.ice_invocationTimeout(100);
try
{
proxy.sleep(300);
test(false);
}
- catch(Ice.InvocationTimeoutException ex)
+ catch(com.zeroc.Ice.InvocationTimeoutException ex)
{
}
try
{
- proxy.end_sleep(proxy.begin_sleep(300));
+ proxy.sleepAsync(300).join();
test(false);
}
- catch(Ice.InvocationTimeoutException ex)
+ catch(CompletionException ex)
{
+ test(ex.getCause() instanceof com.zeroc.Ice.InvocationTimeoutException);
}
- ((TimeoutPrx)proxy.ice_invocationTimeout(-1)).ice_ping();
+ proxy.ice_invocationTimeout(-1).ice_ping();
- TimeoutPrx batchTimeout = (TimeoutPrx)proxy.ice_batchOneway();
+ TimeoutPrx batchTimeout = proxy.ice_batchOneway();
batchTimeout.ice_ping();
batchTimeout.ice_ping();
batchTimeout.ice_ping();
- ((TimeoutPrx)proxy.ice_invocationTimeout(-1)).begin_sleep(300); // Keep the server thread pool busy.
+ proxy.ice_invocationTimeout(-1).sleepAsync(300); // Keep the server thread pool busy.
try
{
batchTimeout.ice_flushBatchRequests();
test(false);
}
- catch(Ice.InvocationTimeoutException ex)
+ catch(com.zeroc.Ice.InvocationTimeoutException ex)
{
}
@@ -522,14 +456,15 @@ public class AllTests
batchTimeout.ice_ping();
batchTimeout.ice_ping();
- ((TimeoutPrx)proxy.ice_invocationTimeout(-1)).begin_sleep(300); // Keep the server thread pool busy.
+ proxy.ice_invocationTimeout(-1).sleepAsync(300); // Keep the server thread pool busy.
try
{
- batchTimeout.end_ice_flushBatchRequests(batchTimeout.begin_ice_flushBatchRequests());
+ batchTimeout.ice_flushBatchRequestsAsync().join();
test(false);
}
- catch(Ice.InvocationTimeoutException ex)
+ catch(CompletionException ex)
{
+ test(ex.getCause() instanceof com.zeroc.Ice.InvocationTimeoutException);
}
adapter.destroy();
diff --git a/java/test/src/main/java/test/Ice/timeout/Client.java b/java/test/src/main/java/test/Ice/timeout/Client.java
index 1de8964d87b..b031f28737e 100644
--- a/java/test/src/main/java/test/Ice/timeout/Client.java
+++ b/java/test/src/main/java/test/Ice/timeout/Client.java
@@ -22,35 +22,34 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.timeout");
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.timeout");
//
// We need to send messages large enough to cause the transport
// buffers to fill up.
//
- initData.properties.setProperty("Ice.MessageSizeMax", "20000");
+ r.initData.properties.setProperty("Ice.MessageSizeMax", "20000");
//
// For this test, we want to disable retries.
//
- initData.properties.setProperty("Ice.RetryIntervals", "-1");
+ r.initData.properties.setProperty("Ice.RetryIntervals", "-1");
//
// This test kills connections, so we don't want warnings.
//
- initData.properties.setProperty("Ice.Warn.Connections", "0");
+ r.initData.properties.setProperty("Ice.Warn.Connections", "0");
//
// Limit the send buffer size, this test relies on the socket
// send() blocking after sending a given amount of data.
//
- initData.properties.setProperty("Ice.TCP.SndSize", "50000");
+ r.initData.properties.setProperty("Ice.TCP.SndSize", "50000");
- return initData;
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/timeout/Server.java b/java/test/src/main/java/test/Ice/timeout/Server.java
index 3d4982f6305..b2df019230f 100644
--- a/java/test/src/main/java/test/Ice/timeout/Server.java
+++ b/java/test/src/main/java/test/Ice/timeout/Server.java
@@ -14,31 +14,30 @@ public class Server extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- adapter.add(new TimeoutI(), Ice.Util.stringToIdentity("timeout"));
+ com.zeroc.Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new TimeoutI(), com.zeroc.Ice.Util.stringToIdentity("timeout"));
adapter.activate();
return WAIT;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.timeout");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.timeout");
+ r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
//
// Limit the recv buffer size, this test relies on the socket
// send() blocking after sending a given amount of data.
//
- initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
+ r.initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
//
// This test kills connections, so we don't want warnings.
//
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- return initData;
+ r.initData.properties.setProperty("Ice.Warn.Connections", "0");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/timeout/TimeoutI.java b/java/test/src/main/java/test/Ice/timeout/TimeoutI.java
index fcfff4d36ec..bcb6c0ce8a4 100644
--- a/java/test/src/main/java/test/Ice/timeout/TimeoutI.java
+++ b/java/test/src/main/java/test/Ice/timeout/TimeoutI.java
@@ -8,22 +8,21 @@
// **********************************************************************
package test.Ice.timeout;
-import test.Ice.timeout.Test._TimeoutDisp;
+import test.Ice.timeout.Test.Timeout;
-class TimeoutI extends _TimeoutDisp
+class TimeoutI implements Timeout
{
static class ActivateAdapterThread extends Thread
{
- ActivateAdapterThread(Ice.ObjectAdapter adapter, int timeout)
+ ActivateAdapterThread(com.zeroc.Ice.ObjectAdapter adapter, int timeout)
{
_adapter = adapter;
_timeout = timeout;
}
@Override
- public void
- run()
+ public void run()
{
_adapter.waitForHold();
try
@@ -36,25 +35,22 @@ class TimeoutI extends _TimeoutDisp
_adapter.activate();
}
- Ice.ObjectAdapter _adapter;
+ com.zeroc.Ice.ObjectAdapter _adapter;
int _timeout;
}
@Override
- public void
- op(Ice.Current current)
+ public void op(com.zeroc.Ice.Current current)
{
}
@Override
- public void
- sendData(byte[] seq, Ice.Current current)
+ public void sendData(byte[] seq, com.zeroc.Ice.Current current)
{
}
@Override
- public void
- sleep(int to, Ice.Current current)
+ public void sleep(int to, com.zeroc.Ice.Current current)
{
try
{
@@ -67,8 +63,7 @@ class TimeoutI extends _TimeoutDisp
}
@Override
- public void
- holdAdapter(int to, Ice.Current current)
+ public void holdAdapter(int to, com.zeroc.Ice.Current current)
{
current.adapter.hold();
Thread thread = new ActivateAdapterThread(current.adapter, to);
@@ -76,8 +71,7 @@ class TimeoutI extends _TimeoutDisp
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
diff --git a/java/test/src/main/java/test/Ice/udp/AllTests.java b/java/test/src/main/java/test/Ice/udp/AllTests.java
index 1e43756d12e..012adc25c99 100644
--- a/java/test/src/main/java/test/Ice/udp/AllTests.java
+++ b/java/test/src/main/java/test/Ice/udp/AllTests.java
@@ -15,8 +15,7 @@ import java.io.PrintWriter;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -24,24 +23,21 @@ public class AllTests
}
}
- public static class PingReplyI extends _PingReplyDisp
+ public static class PingReplyI implements PingReply
{
@Override
- public synchronized void
- reply(Ice.Current current)
+ public synchronized void reply(com.zeroc.Ice.Current current)
{
++_replies;
notify();
}
- public synchronized void
- reset()
+ public synchronized void reset()
{
_replies = 0;
}
- public synchronized boolean
- waitReply(int expectedReplies, long timeout)
+ public synchronized boolean waitReply(int expectedReplies, long timeout)
{
long end = System.currentTimeMillis() + timeout;
while(_replies < expectedReplies)
@@ -68,24 +64,22 @@ public class AllTests
private int _replies;
}
- public static void
- allTests(test.Util.Application app)
+ public static void allTests(test.Util.Application app)
{
- Ice.Communicator communicator = app.communicator();
+ com.zeroc.Ice.Communicator communicator = app.communicator();
PrintWriter out = app.getWriter();
communicator.getProperties().setProperty("ReplyAdapter.Endpoints", "udp -p 12030");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ReplyAdapter");
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ReplyAdapter");
PingReplyI replyI = new PingReplyI();
- PingReplyPrx reply =
- (PingReplyPrx)PingReplyPrxHelper.uncheckedCast(adapter.addWithUUID(replyI)).ice_datagram();
+ PingReplyPrx reply = PingReplyPrx.uncheckedCast(adapter.addWithUUID(replyI)).ice_datagram();
adapter.activate();
out.print("testing udp... ");
out.flush();
- Ice.ObjectPrx base = communicator.stringToProxy("test -d:udp -p 12010");
- TestIntfPrx obj = TestIntfPrxHelper.uncheckedCast(base);
+ com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy("test -d:udp -p 12010");
+ TestIntfPrx obj = TestIntfPrx.uncheckedCast(base);
int nRetry = 5;
boolean ret = false;
@@ -104,7 +98,7 @@ public class AllTests
// If the 3 datagrams were not received within the 2 seconds, we try again to
// receive 3 new datagrams using a new object. We give up after 5 retries.
replyI = new PingReplyI();
- reply = (PingReplyPrx)PingReplyPrxHelper.uncheckedCast(adapter.addWithUUID(replyI)).ice_datagram();
+ reply = PingReplyPrx.uncheckedCast(adapter.addWithUUID(replyI)).ice_datagram();
}
test(ret == true);
@@ -126,7 +120,7 @@ public class AllTests
replyI.waitReply(1, 10000);
}
}
- catch(Ice.DatagramLimitException ex)
+ catch(com.zeroc.Ice.DatagramLimitException ex)
{
test(seq.length > 16384);
}
@@ -139,7 +133,7 @@ public class AllTests
obj.sendByteSeq(seq, reply);
test(!replyI.waitReply(1, 500));
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
System.err.println(ex);
test(false);
@@ -169,7 +163,7 @@ public class AllTests
endpoint = "udp -h 239.255.1.1 -p 12020";
}
base = communicator.stringToProxy("test -d:" + endpoint);
- TestIntfPrx objMcast = TestIntfPrxHelper.uncheckedCast(base);
+ TestIntfPrx objMcast = TestIntfPrx.uncheckedCast(base);
nRetry = 5;
while(nRetry-- > 0)
@@ -182,7 +176,7 @@ public class AllTests
break; // Success
}
replyI = new PingReplyI();
- reply = (PingReplyPrx) PingReplyPrxHelper.uncheckedCast(adapter.addWithUUID(replyI)).ice_datagram();
+ reply = PingReplyPrx.uncheckedCast(adapter.addWithUUID(replyI)).ice_datagram();
}
if(!ret)
{
@@ -210,7 +204,7 @@ public class AllTests
break; // Success
}
replyI = new PingReplyI();
- reply = (PingReplyPrx) PingReplyPrxHelper.uncheckedCast(adapter.addWithUUID(replyI)).ice_datagram();
+ reply = PingReplyPrx.uncheckedCast(adapter.addWithUUID(replyI)).ice_datagram();
}
test(ret);
out.println("ok");
@@ -234,7 +228,7 @@ public class AllTests
// break; // Success
// }
// replyI = new PingReplyI();
-// reply = (PingReplyPrx)PingReplyPrxHelper.uncheckedCast(adapter.addWithUUID(replyI)).ice_datagram();
+// reply = PingReplyPrx.uncheckedCast(adapter.addWithUUID(replyI)).ice_datagram();
// }
// if(!ret)
diff --git a/java/test/src/main/java/test/Ice/udp/Client.java b/java/test/src/main/java/test/Ice/udp/Client.java
index 585531f0253..eb2e364b0eb 100644
--- a/java/test/src/main/java/test/Ice/udp/Client.java
+++ b/java/test/src/main/java/test/Ice/udp/Client.java
@@ -29,21 +29,20 @@ public class Client extends test.Util.Application
}
for(int i = 0; i < num; ++i)
{
- TestIntfPrxHelper.uncheckedCast(communicator().stringToProxy("control:tcp -p " + (12010 + i))).shutdown();
+ TestIntfPrx.uncheckedCast(communicator().stringToProxy("control:tcp -p " + (12010 + i))).shutdown();
}
return 0;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.udp");
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("Ice.UDP.RcvSize", "16384");
- initData.properties.setProperty("Ice.UDP.SndSize", "16384");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.udp");
+ r.initData.properties.setProperty("Ice.Warn.Connections", "0");
+ r.initData.properties.setProperty("Ice.UDP.RcvSize", "16384");
+ r.initData.properties.setProperty("Ice.UDP.SndSize", "16384");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/udp/Server.java b/java/test/src/main/java/test/Ice/udp/Server.java
index 02b6fca4ab1..e2d01cb84fd 100644
--- a/java/test/src/main/java/test/Ice/udp/Server.java
+++ b/java/test/src/main/java/test/Ice/udp/Server.java
@@ -14,7 +14,7 @@ public class Server extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Properties properties = communicator().getProperties();
+ com.zeroc.Ice.Properties properties = communicator().getProperties();
int port = 12010;
try
@@ -25,22 +25,22 @@ public class Server extends test.Util.Application
{
}
properties.setProperty("ControlAdapter.Endpoints", "tcp -p " + port);
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("ControlAdapter");
- adapter.add(new TestIntfI(), Ice.Util.stringToIdentity("control"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("ControlAdapter");
+ adapter.add(new TestIntfI(), com.zeroc.Ice.Util.stringToIdentity("control"));
adapter.activate();
if(port == 12010)
{
properties.setProperty("TestAdapter.Endpoints", "udp -p 12010");
- Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("TestAdapter");
- adapter2.add(new TestIntfI(), Ice.Util.stringToIdentity("test"));
+ com.zeroc.Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("TestAdapter");
+ adapter2.add(new TestIntfI(), com.zeroc.Ice.Util.stringToIdentity("test"));
adapter2.activate();
}
if(!isAndroid())
{
- Ice.ObjectAdapter mcastAdapter = communicator().createObjectAdapter("McastTestAdapter");
- mcastAdapter.add(new TestIntfI(), Ice.Util.stringToIdentity("test"));
+ com.zeroc.Ice.ObjectAdapter mcastAdapter = communicator().createObjectAdapter("McastTestAdapter");
+ mcastAdapter.add(new TestIntfI(), com.zeroc.Ice.Util.stringToIdentity("test"));
mcastAdapter.activate();
}
@@ -48,19 +48,18 @@ public class Server extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.udp");
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("Ice.UDP.RcvSize", "16384");
- initData.properties.setProperty("Ice.UDP.SndSize", "16384");
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.udp");
+ r.initData.properties.setProperty("Ice.Warn.Connections", "0");
+ r.initData.properties.setProperty("Ice.UDP.RcvSize", "16384");
+ r.initData.properties.setProperty("Ice.UDP.SndSize", "16384");
if(!isAndroid())
{
String endpoint;
- if(initData.properties.getProperty("Ice.IPv6").equals("1"))
+ if(r.initData.properties.getProperty("Ice.IPv6").equals("1"))
{
if(System.getProperty("os.name").contains("OS X"))
{
@@ -75,9 +74,9 @@ public class Server extends test.Util.Application
{
endpoint = "udp -h 239.255.1.1 -p 12020";
}
- initData.properties.setProperty("McastTestAdapter.Endpoints", endpoint);
+ r.initData.properties.setProperty("McastTestAdapter.Endpoints", endpoint);
}
- return initData;
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/Ice/udp/TestIntfI.java b/java/test/src/main/java/test/Ice/udp/TestIntfI.java
index e113e0b67f0..07d14aab0e9 100644
--- a/java/test/src/main/java/test/Ice/udp/TestIntfI.java
+++ b/java/test/src/main/java/test/Ice/udp/TestIntfI.java
@@ -11,36 +11,36 @@ package test.Ice.udp;
import test.Ice.udp.Test.*;
-public final class TestIntfI extends _TestIntfDisp
+public final class TestIntfI implements TestIntf
{
@Override
- public void ping(PingReplyPrx reply, Ice.Current current)
+ public void ping(PingReplyPrx reply, com.zeroc.Ice.Current current)
{
try
{
reply.reply();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
assert(false);
}
}
@Override
- public void sendByteSeq(byte[] seq, PingReplyPrx reply, Ice.Current current)
+ public void sendByteSeq(byte[] seq, PingReplyPrx reply, com.zeroc.Ice.Current current)
{
try
{
reply.reply();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
assert(false);
}
}
@Override
- public void pingBiDir(Ice.Identity id, Ice.Current current)
+ public void pingBiDir(com.zeroc.Ice.Identity id, com.zeroc.Ice.Current current)
{
try
{
@@ -51,23 +51,23 @@ public final class TestIntfI extends _TestIntfDisp
try
{
byte[] seq = new byte[32 * 1024];
- TestIntfPrxHelper.uncheckedCast(current.con.createProxy(id)).sendByteSeq(seq, null);
+ TestIntfPrx.uncheckedCast(current.con.createProxy(id)).sendByteSeq(seq, null);
}
- catch(Ice.DatagramLimitException ex)
+ catch(com.zeroc.Ice.DatagramLimitException ex)
{
// Expected.
}
- PingReplyPrxHelper.uncheckedCast(current.con.createProxy(id)).reply();
+ PingReplyPrx.uncheckedCast(current.con.createProxy(id)).reply();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
assert(false);
}
}
@Override
- public void shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
diff --git a/java/test/src/main/java/test/IceBox/admin/AllTests.java b/java/test/src/main/java/test/IceBox/admin/AllTests.java
index 1d7cce6c451..5d018dee240 100644
--- a/java/test/src/main/java/test/IceBox/admin/AllTests.java
+++ b/java/test/src/main/java/test/IceBox/admin/AllTests.java
@@ -13,8 +13,7 @@ import test.IceBox.admin.Test.*;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -22,11 +21,10 @@ public class AllTests
}
}
- public static void
- allTests(Ice.Communicator communicator)
+ public static void allTests(com.zeroc.Ice.Communicator communicator)
{
String ref = "DemoIceBox/admin:default -p 9996 -t 10000";
- Ice.ObjectPrx admin = communicator.stringToProxy(ref);
+ com.zeroc.Ice.ObjectPrx admin = communicator.stringToProxy(ref);
TestFacetPrx facet = null;
@@ -36,7 +34,7 @@ public class AllTests
//
// Test: Verify that the custom facet is present.
//
- facet = TestFacetPrxHelper.checkedCast(admin, "TestFacet");
+ facet = TestFacetPrx.checkedCast(admin, "TestFacet");
facet.ice_ping();
}
System.out.println("ok");
@@ -44,8 +42,8 @@ public class AllTests
System.out.print("testing properties facet... ");
System.out.flush();
{
- Ice.PropertiesAdminPrx pa =
- Ice.PropertiesAdminPrxHelper.checkedCast(admin, "IceBox.Service.TestService.Properties");
+ com.zeroc.Ice.PropertiesAdminPrx pa =
+ com.zeroc.Ice.PropertiesAdminPrx.checkedCast(admin, "IceBox.Service.TestService.Properties");
//
// Test: PropertiesAdmin::getProperty()
@@ -70,7 +68,7 @@ public class AllTests
//
// Test: PropertiesAdmin::setProperties()
//
- java.util.Map<String, String> setProps = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> setProps = new java.util.HashMap<>();
setProps.put("Prop1", "10"); // Changed
setProps.put("Prop2", "20"); // Changed
setProps.put("Prop3", ""); // Removed
@@ -98,30 +96,28 @@ public class AllTests
System.out.print("testing metrics admin facet... ");
System.out.flush();
{
- IceMX.MetricsAdminPrx ma =
- IceMX.MetricsAdminPrxHelper.checkedCast(admin, "IceBox.Service.TestService.Metrics");
+ com.zeroc.IceMX.MetricsAdminPrx ma =
+ com.zeroc.IceMX.MetricsAdminPrx.checkedCast(admin, "IceBox.Service.TestService.Metrics");
- Ice.PropertiesAdminPrx pa =
- Ice.PropertiesAdminPrxHelper.checkedCast(admin, "IceBox.Service.TestService.Properties");
+ com.zeroc.Ice.PropertiesAdminPrx pa =
+ com.zeroc.Ice.PropertiesAdminPrx.checkedCast(admin, "IceBox.Service.TestService.Properties");
- String[] views;
- Ice.StringSeqHolder disabledViews = new Ice.StringSeqHolder();
- views = ma.getMetricsViewNames(disabledViews);
- test(views.length == 0);
+ com.zeroc.IceMX.MetricsAdmin.GetMetricsViewNamesResult r = ma.getMetricsViewNames();
+ test(r.returnValue.length == 0);
- java.util.Map<String, String> setProps = new java.util.HashMap<String, String>();
+ java.util.Map<String, String> setProps = new java.util.HashMap<>();
setProps.put("IceMX.Metrics.Debug.GroupBy", "id");
setProps.put("IceMX.Metrics.All.GroupBy", "none");
setProps.put("IceMX.Metrics.Parent.GroupBy", "parent");
pa.setProperties(setProps);
- pa.setProperties(new java.util.HashMap<String, String>());
+ pa.setProperties(new java.util.HashMap<>());
- views = ma.getMetricsViewNames(disabledViews);
- test(views.length == 3);
+ r = ma.getMetricsViewNames();
+ test(r.returnValue.length == 3);
// Make sure that the IceBox communicator metrics admin is a separate instance.
- test(IceMX.MetricsAdminPrxHelper.checkedCast(admin,
- "Metrics").getMetricsViewNames(disabledViews).length == 0);
+ test(com.zeroc.IceMX.MetricsAdminPrx.checkedCast(admin, "Metrics").
+ getMetricsViewNames().returnValue.length == 0);
}
System.out.println("ok");
}
diff --git a/java/test/src/main/java/test/IceBox/admin/Client.java b/java/test/src/main/java/test/IceBox/admin/Client.java
index 474c874e3e9..a3bed564dce 100644
--- a/java/test/src/main/java/test/IceBox/admin/Client.java
+++ b/java/test/src/main/java/test/IceBox/admin/Client.java
@@ -14,24 +14,23 @@ public class Client extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.Communicator communicator = communicator();
AllTests.allTests(communicator);
//
// Shutdown the IceBox server.
//
- Ice.ProcessPrxHelper.uncheckedCast(
+ com.zeroc.Ice.ProcessPrx.uncheckedCast(
communicator.stringToProxy("DemoIceBox/admin -f Process:default -p 9996")).shutdown();
return 0;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/IceBox/admin/TestFacetI.java b/java/test/src/main/java/test/IceBox/admin/TestFacetI.java
index de8aed302ed..2b04ad57182 100644
--- a/java/test/src/main/java/test/IceBox/admin/TestFacetI.java
+++ b/java/test/src/main/java/test/IceBox/admin/TestFacetI.java
@@ -11,14 +11,14 @@ package test.IceBox.admin;
import test.IceBox.admin.Test.*;
-public class TestFacetI extends _TestFacetDisp implements Ice.PropertiesAdminUpdateCallback
+public class TestFacetI implements TestFacet, com.zeroc.Ice.PropertiesAdminUpdateCallback
{
public TestFacetI()
{
}
@Override
- public synchronized java.util.Map<String, String> getChanges(Ice.Current current)
+ public synchronized java.util.Map<String, String> getChanges(com.zeroc.Ice.Current current)
{
return _changes;
}
diff --git a/java/test/src/main/java/test/IceBox/admin/TestServiceI.java b/java/test/src/main/java/test/IceBox/admin/TestServiceI.java
index 16371331026..8019ca2f988 100644
--- a/java/test/src/main/java/test/IceBox/admin/TestServiceI.java
+++ b/java/test/src/main/java/test/IceBox/admin/TestServiceI.java
@@ -9,9 +9,9 @@
package test.IceBox.admin;
-public class TestServiceI implements IceBox.Service
+public class TestServiceI implements com.zeroc.IceBox.Service
{
- public TestServiceI(Ice.Communicator serviceManagerCommunicator)
+ public TestServiceI(com.zeroc.Ice.Communicator serviceManagerCommunicator)
{
TestFacetI facet = new TestFacetI();
@@ -24,23 +24,22 @@ public class TestServiceI implements IceBox.Service
// The TestFacetI servant also implements PropertiesAdminUpdateCallback.
// Set the callback on the admin facet.
//
- Ice.Object propFacet = serviceManagerCommunicator.findAdminFacet("IceBox.Service.TestService.Properties");
+ com.zeroc.Ice.Object propFacet =
+ serviceManagerCommunicator.findAdminFacet("IceBox.Service.TestService.Properties");
if(propFacet != null)
{
- Ice.NativePropertiesAdmin admin = (Ice.NativePropertiesAdmin)propFacet;
+ com.zeroc.Ice.NativePropertiesAdmin admin = (com.zeroc.Ice.NativePropertiesAdmin)propFacet;
admin.addUpdateCallback(facet);
}
}
@Override
- public void
- start(String name, Ice.Communicator communicator, String[] args)
+ public void start(String name, com.zeroc.Ice.Communicator communicator, String[] args)
{
}
@Override
- public void
- stop()
+ public void stop()
{
}
}
diff --git a/java/test/src/main/java/test/IceBox/configuration/AllTests.java b/java/test/src/main/java/test/IceBox/configuration/AllTests.java
index 8035fb508d1..7d59f13d022 100644
--- a/java/test/src/main/java/test/IceBox/configuration/AllTests.java
+++ b/java/test/src/main/java/test/IceBox/configuration/AllTests.java
@@ -12,12 +12,10 @@ package test.IceBox.configuration;
import java.io.PrintWriter;
import test.IceBox.configuration.Test.TestIntfPrx;
-import test.IceBox.configuration.Test.TestIntfPrxHelper;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if (!b)
{
@@ -25,13 +23,12 @@ public class AllTests
}
}
- public static void
- allTests(Ice.Communicator communicator, PrintWriter out)
+ public static void allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out)
{
- TestIntfPrx service1 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:tcp -p 12010"));
- TestIntfPrx service2 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:tcp -p 12011"));
- TestIntfPrx service3 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:tcp -p 12012"));
- TestIntfPrx service4 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:tcp -p 12013"));
+ TestIntfPrx service1 = TestIntfPrx.uncheckedCast(communicator.stringToProxy("test:tcp -p 12010"));
+ TestIntfPrx service2 = TestIntfPrx.uncheckedCast(communicator.stringToProxy("test:tcp -p 12011"));
+ TestIntfPrx service3 = TestIntfPrx.uncheckedCast(communicator.stringToProxy("test:tcp -p 12012"));
+ TestIntfPrx service4 = TestIntfPrx.uncheckedCast(communicator.stringToProxy("test:tcp -p 12013"));
if(service1.getProperty("IceBox.InheritProperties").equals(""))
{
diff --git a/java/test/src/main/java/test/IceBox/configuration/Client.java b/java/test/src/main/java/test/IceBox/configuration/Client.java
index 1417b0b37f8..66fa9582cab 100644
--- a/java/test/src/main/java/test/IceBox/configuration/Client.java
+++ b/java/test/src/main/java/test/IceBox/configuration/Client.java
@@ -14,25 +14,24 @@ public class Client extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.Communicator communicator = communicator();
AllTests.allTests(communicator, getWriter());
//
// Shutdown the IceBox server.
//
- Ice.ProcessPrxHelper.uncheckedCast(communicator.stringToProxy("DemoIceBox/admin -f Process:default -p 9996"))
- .shutdown();
+ com.zeroc.Ice.ProcessPrx.uncheckedCast(
+ communicator.stringToProxy("DemoIceBox/admin -f Process:default -p 9996")).shutdown();
return 0;
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.IceBox.configuration");
- initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.IceBox.configuration");
+ r.initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/IceBox/configuration/TestI.java b/java/test/src/main/java/test/IceBox/configuration/TestI.java
index 24cc986a83a..7588b75acbb 100644
--- a/java/test/src/main/java/test/IceBox/configuration/TestI.java
+++ b/java/test/src/main/java/test/IceBox/configuration/TestI.java
@@ -9,27 +9,23 @@
package test.IceBox.configuration;
-import test.IceBox.configuration.Test._TestIntfDisp;
+import test.IceBox.configuration.Test.TestIntf;
-
-public class TestI extends _TestIntfDisp
+public class TestI implements TestIntf
{
- public
- TestI(String[] args)
+ public TestI(String[] args)
{
_args = args;
}
@Override
- public String
- getProperty(String name, Ice.Current current)
+ public String getProperty(String name, com.zeroc.Ice.Current current)
{
return current.adapter.getCommunicator().getProperties().getProperty(name);
}
@Override
- public String[]
- getArgs(Ice.Current current)
+ public String[] getArgs(com.zeroc.Ice.Current current)
{
return _args;
}
diff --git a/java/test/src/main/java/test/IceBox/configuration/TestServiceI.java b/java/test/src/main/java/test/IceBox/configuration/TestServiceI.java
index d12a648b819..9786bdbf33d 100644
--- a/java/test/src/main/java/test/IceBox/configuration/TestServiceI.java
+++ b/java/test/src/main/java/test/IceBox/configuration/TestServiceI.java
@@ -9,22 +9,20 @@
package test.IceBox.configuration;
-public class TestServiceI implements IceBox.Service
+public class TestServiceI implements com.zeroc.IceBox.Service
{
@Override
- public void
- start(String name, Ice.Communicator communicator, String[] args)
+ public void start(String name, com.zeroc.Ice.Communicator communicator, String[] args)
{
communicator.getProperties().setProperty("Ice.Package.Test", "test.IceBox.configuration");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter(name + "OA");
- adapter.add(new TestI(args), Ice.Util.stringToIdentity("test"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter(name + "OA");
+ adapter.add(new TestI(args), com.zeroc.Ice.Util.stringToIdentity("test"));
adapter.activate();
}
@Override
- public void
- stop()
+ public void stop()
{
}
}
diff --git a/java/test/src/main/java/test/IceDiscovery/simple/AllTests.java b/java/test/src/main/java/test/IceDiscovery/simple/AllTests.java
index e9b3f3e87c7..5a653060fb3 100644
--- a/java/test/src/main/java/test/IceDiscovery/simple/AllTests.java
+++ b/java/test/src/main/java/test/IceDiscovery/simple/AllTests.java
@@ -19,8 +19,7 @@ import java.util.HashSet;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -28,16 +27,15 @@ public class AllTests
}
}
- public static void
- allTests(Ice.Communicator communicator, int num)
+ public static void allTests(com.zeroc.Ice.Communicator communicator, int num)
{
- List<ControllerPrx> proxies = new ArrayList<ControllerPrx>();
- List<ControllerPrx> indirectProxies = new ArrayList<ControllerPrx>();
+ List<ControllerPrx> proxies = new ArrayList<>();
+ List<ControllerPrx> indirectProxies = new ArrayList<>();
for(int i = 0; i < num; ++i)
{
String id = "controller" + i;
- proxies.add(ControllerPrxHelper.uncheckedCast(communicator.stringToProxy(id)));
- indirectProxies.add(ControllerPrxHelper.uncheckedCast(communicator.stringToProxy(id + "@control" + i)));
+ proxies.add(ControllerPrx.uncheckedCast(communicator.stringToProxy(id)));
+ indirectProxies.add(ControllerPrx.uncheckedCast(communicator.stringToProxy(id + "@control" + i)));
}
System.out.print("testing indirect proxies... ");
@@ -67,7 +65,7 @@ public class AllTests
{
communicator.stringToProxy("object @ oa1").ice_ping();
}
- catch(Ice.NoEndpointException ex)
+ catch(com.zeroc.Ice.NoEndpointException ex)
{
}
@@ -77,7 +75,7 @@ public class AllTests
{
communicator.stringToProxy("object @ oa1").ice_ping();
}
- catch(Ice.ObjectNotExistException ex)
+ catch(com.zeroc.Ice.ObjectNotExistException ex)
{
}
@@ -87,7 +85,7 @@ public class AllTests
{
communicator.stringToProxy("object @ oa1").ice_ping();
}
- catch(Ice.NoEndpointException ex)
+ catch(com.zeroc.Ice.NoEndpointException ex)
{
}
}
@@ -130,14 +128,14 @@ public class AllTests
{
communicator.stringToProxy("object @ oa1").ice_ping();
}
- catch(Ice.ObjectNotExistException ex)
+ catch(com.zeroc.Ice.ObjectNotExistException ex)
{
}
try
{
communicator.stringToProxy("object @ oa2").ice_ping();
}
- catch(Ice.ObjectNotExistException ex)
+ catch(com.zeroc.Ice.ObjectNotExistException ex)
{
}
@@ -163,12 +161,12 @@ public class AllTests
communicator.stringToProxy("object @ rg").ice_ping();
- Set<String> adapterIds = new HashSet<String>();
+ Set<String> adapterIds = new HashSet<>();
adapterIds.add("oa1");
adapterIds.add("oa2");
adapterIds.add("oa3");
- TestIntfPrx intf = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("object"));
- intf = (TestIntfPrx)intf.ice_connectionCached(false).ice_locatorCacheTimeout(0);
+ TestIntfPrx intf = TestIntfPrx.uncheckedCast(communicator.stringToProxy("object"));
+ intf = intf.ice_connectionCached(false).ice_locatorCacheTimeout(0);
while(!adapterIds.isEmpty())
{
adapterIds.remove(intf.getAdapterId());
@@ -179,8 +177,7 @@ public class AllTests
adapterIds.add("oa1");
adapterIds.add("oa2");
adapterIds.add("oa3");
- intf = TestIntfPrxHelper.uncheckedCast(
- communicator.stringToProxy("object @ rg").ice_connectionCached(false));
+ intf = TestIntfPrx.uncheckedCast(communicator.stringToProxy("object @ rg").ice_connectionCached(false));
int nRetry = 100;
while(!adapterIds.isEmpty() && --nRetry > 0)
{
@@ -197,14 +194,12 @@ public class AllTests
proxies.get(0).deactivateObjectAdapter("oa");
proxies.get(1).deactivateObjectAdapter("oa");
- test(TestIntfPrxHelper.uncheckedCast(
- communicator.stringToProxy("object @ rg")).getAdapterId().equals("oa3"));
+ test(TestIntfPrx.uncheckedCast(communicator.stringToProxy("object @ rg")).getAdapterId().equals("oa3"));
proxies.get(2).deactivateObjectAdapter("oa");
proxies.get(0).activateObjectAdapter("oa", "oa1", "rg");
proxies.get(0).addObject("oa", "object");
- test(TestIntfPrxHelper.uncheckedCast(
- communicator.stringToProxy("object @ rg")).getAdapterId().equals("oa1"));
+ test(TestIntfPrx.uncheckedCast(communicator.stringToProxy("object @ rg")).getAdapterId().equals("oa1"));
proxies.get(0).deactivateObjectAdapter("oa");
}
System.out.println("ok");
diff --git a/java/test/src/main/java/test/IceDiscovery/simple/ControllerI.java b/java/test/src/main/java/test/IceDiscovery/simple/ControllerI.java
index aea6b38b3a3..bb4d88e67d2 100644
--- a/java/test/src/main/java/test/IceDiscovery/simple/ControllerI.java
+++ b/java/test/src/main/java/test/IceDiscovery/simple/ControllerI.java
@@ -11,56 +11,53 @@ package test.IceDiscovery.simple;
import test.IceDiscovery.simple.Test.*;
-public final class ControllerI extends _ControllerDisp
+public final class ControllerI implements Controller
{
@Override
- public void
- activateObjectAdapter(String name, String adapterId, String replicaGroupId, Ice.Current current)
+ public void activateObjectAdapter(String name, String adapterId, String replicaGroupId,
+ com.zeroc.Ice.Current current)
{
- Ice.Communicator communicator = current.adapter.getCommunicator();
- Ice.Properties properties = communicator.getProperties();
+ com.zeroc.Ice.Communicator communicator = current.adapter.getCommunicator();
+ com.zeroc.Ice.Properties properties = communicator.getProperties();
properties.setProperty(name + ".AdapterId", adapterId);
properties.setProperty(name + ".ReplicaGroupId", replicaGroupId);
properties.setProperty(name + ".Endpoints", "default");
- Ice.ObjectAdapter oa = communicator.createObjectAdapter(name);
+ com.zeroc.Ice.ObjectAdapter oa = communicator.createObjectAdapter(name);
_adapters.put(name, oa);
oa.activate();
}
@Override
- public void
- deactivateObjectAdapter(String name, Ice.Current current)
+ public void deactivateObjectAdapter(String name, com.zeroc.Ice.Current current)
{
_adapters.get(name).destroy();
_adapters.remove(name);
}
@Override
- public void
- addObject(String oaName, String id, Ice.Current current)
+ public void addObject(String oaName, String id, com.zeroc.Ice.Current current)
{
assert(_adapters.containsKey(oaName));
- Ice.Identity identity = new Ice.Identity();
+ com.zeroc.Ice.Identity identity = new com.zeroc.Ice.Identity();
identity.name = id;
_adapters.get(oaName).add(new TestIntfI(), identity);
}
@Override
- public void
- removeObject(String oaName, String id, Ice.Current current)
+ public void removeObject(String oaName, String id, com.zeroc.Ice.Current current)
{
assert(_adapters.containsKey(oaName));
- Ice.Identity identity = new Ice.Identity();
+ com.zeroc.Ice.Identity identity = new com.zeroc.Ice.Identity();
identity.name = id;
_adapters.get(oaName).remove(identity);
}
@Override
- public void shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
- final private java.util.Map<String, Ice.ObjectAdapter> _adapters =
- new java.util.HashMap<String, Ice.ObjectAdapter>();
+ final private java.util.Map<String, com.zeroc.Ice.ObjectAdapter> _adapters =
+ new java.util.HashMap<String, com.zeroc.Ice.ObjectAdapter>();
}
diff --git a/java/test/src/main/java/test/IceDiscovery/simple/Server.java b/java/test/src/main/java/test/IceDiscovery/simple/Server.java
index 28db45ec264..21f5a2da128 100644
--- a/java/test/src/main/java/test/IceDiscovery/simple/Server.java
+++ b/java/test/src/main/java/test/IceDiscovery/simple/Server.java
@@ -14,7 +14,7 @@ public class Server extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Properties properties = communicator().getProperties();
+ com.zeroc.Ice.Properties properties = communicator().getProperties();
int num = 0;
try
@@ -29,8 +29,8 @@ public class Server extends test.Util.Application
properties.setProperty("ControlAdapter.AdapterId", "control" + num);
properties.setProperty("ControlAdapter.ThreadPool.Size", "1");
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("ControlAdapter");
- adapter.add(new ControllerI(), Ice.Util.stringToIdentity("controller" + num));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("ControlAdapter");
+ adapter.add(new ControllerI(), com.zeroc.Ice.Util.stringToIdentity("controller" + num));
adapter.activate();
return WAIT;
diff --git a/java/test/src/main/java/test/IceDiscovery/simple/TestIntfI.java b/java/test/src/main/java/test/IceDiscovery/simple/TestIntfI.java
index 43b9cc5bc62..57574f83205 100644
--- a/java/test/src/main/java/test/IceDiscovery/simple/TestIntfI.java
+++ b/java/test/src/main/java/test/IceDiscovery/simple/TestIntfI.java
@@ -11,11 +11,10 @@ package test.IceDiscovery.simple;
import test.IceDiscovery.simple.Test.*;
-public final class TestIntfI extends _TestIntfDisp
+public final class TestIntfI implements TestIntf
{
@Override
- public String
- getAdapterId(Ice.Current current)
+ public String getAdapterId(com.zeroc.Ice.Current current)
{
return current.adapter.getCommunicator().getProperties().getProperty(current.adapter.getName() + ".AdapterId");
}
diff --git a/java/test/src/main/java/test/IceDiscovery/simple/run.py b/java/test/src/main/java/test/IceDiscovery/simple/run.py
index 86f25ed9c16..d9b4f000e9d 100755
--- a/java/test/src/main/java/test/IceDiscovery/simple/run.py
+++ b/java/test/src/main/java/test/IceDiscovery/simple/run.py
@@ -26,7 +26,7 @@ client = "test.IceDiscovery.simple.Client"
num = 3
-args = " --Ice.Plugin.IceDiscovery=IceDiscovery:IceDiscovery.PluginFactory"
+args = " --Ice.Plugin.IceDiscovery=IceDiscovery:com.zeroc.IceDiscovery.PluginFactory"
args += " --IceDiscovery.Timeout=50"
args += " --IceDiscovery.RetryCount=5"
if not TestUtil.ipv6:
diff --git a/java/test/src/main/java/test/IceGrid/simple/AllTests.java b/java/test/src/main/java/test/IceGrid/simple/AllTests.java
index c18faeeefdf..c4897098935 100644
--- a/java/test/src/main/java/test/IceGrid/simple/AllTests.java
+++ b/java/test/src/main/java/test/IceGrid/simple/AllTests.java
@@ -11,12 +11,10 @@ package test.IceGrid.simple;
import java.io.PrintWriter;
import test.IceGrid.simple.Test.TestIntfPrx;
-import test.IceGrid.simple.Test.TestIntfPrxHelper;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -24,27 +22,26 @@ public class AllTests
}
}
- public static void
- allTests(test.Util.Application app)
+ public static void allTests(test.Util.Application app)
{
- Ice.Communicator communicator = app.communicator();
+ com.zeroc.Ice.Communicator communicator = app.communicator();
PrintWriter out = app.getWriter();
out.print("testing stringToProxy... ");
out.flush();
String ref = "test @ TestAdapter";
- Ice.ObjectPrx base = communicator.stringToProxy(ref);
+ com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref);
test(base != null);
out.println("ok");
out.print("testing IceGrid.Locator is present... ");
- IceGrid.LocatorPrx locator = IceGrid.LocatorPrxHelper.uncheckedCast(base);
+ com.zeroc.IceGrid.LocatorPrx locator = com.zeroc.IceGrid.LocatorPrx.uncheckedCast(base);
test(locator != null);
out.println("ok");
out.print("testing checked cast... ");
out.flush();
- TestIntfPrx obj = TestIntfPrxHelper.checkedCast(base);
+ TestIntfPrx obj = TestIntfPrx.checkedCast(base);
test(obj != null);
test(obj.equals(base));
out.println("ok");
@@ -55,10 +52,10 @@ public class AllTests
out.println("ok");
out.print("testing locator finder... ");
- Ice.Identity finderId = new Ice.Identity();
+ com.zeroc.Ice.Identity finderId = new com.zeroc.Ice.Identity();
finderId.category = "Ice";
finderId.name = "LocatorFinder";
- Ice.LocatorFinderPrx finder = Ice.LocatorFinderPrxHelper.checkedCast(
+ com.zeroc.Ice.LocatorFinderPrx finder = com.zeroc.Ice.LocatorFinderPrx.checkedCast(
communicator.getDefaultLocator().ice_identity(finderId));
test(finder.getLocator() != null);
out.println("ok");
@@ -67,17 +64,17 @@ public class AllTests
out.flush();
{
// Add test well-known object
- IceGrid.RegistryPrx registry = IceGrid.RegistryPrxHelper.checkedCast(
+ com.zeroc.IceGrid.RegistryPrx registry = com.zeroc.IceGrid.RegistryPrx.checkedCast(
communicator.stringToProxy(communicator.getDefaultLocator().ice_getIdentity().category + "/Registry"));
test(registry != null);
try
{
- IceGrid.AdminSessionPrx session = registry.createAdminSession("foo", "bar");
+ com.zeroc.IceGrid.AdminSessionPrx session = registry.createAdminSession("foo", "bar");
session.getAdmin().addObjectWithType(base, "::Test");
session.destroy();
}
- catch(Ice.UserException ex)
+ catch(com.zeroc.Ice.UserException ex)
{
test(false);
}
@@ -86,11 +83,11 @@ public class AllTests
// Ensure the IceGrid discovery locator can discover the
// registries and make sure locator requests are forwarded.
//
- Ice.InitializationData initData = app.createInitializationData();
+ com.zeroc.Ice.InitializationData initData = app.createInitializationData();
initData.properties = communicator.getProperties()._clone();
initData.properties.setProperty("Ice.Default.Locator", "");
initData.properties.setProperty("Ice.Plugin.IceLocatorDiscovery",
- "IceLocatorDiscovery:IceLocatorDiscovery.PluginFactory");
+ "IceLocatorDiscovery:com.zeroc.IceLocatorDiscovery.PluginFactory");
if(System.getProperty("os.name").contains("OS X") &&
initData.properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0)
{
@@ -99,19 +96,19 @@ public class AllTests
initData.properties.setProperty("AdapterForDiscoveryTest.AdapterId", "discoveryAdapter");
initData.properties.setProperty("AdapterForDiscoveryTest.Endpoints", "default");
- Ice.Communicator com = Ice.Util.initialize(initData);
- test(com.getDefaultLocator() != null);
- com.stringToProxy("test @ TestAdapter").ice_ping();
- com.stringToProxy("test").ice_ping();
+ com.zeroc.Ice.Communicator comm = com.zeroc.Ice.Util.initialize(initData);
+ test(comm.getDefaultLocator() != null);
+ comm.stringToProxy("test @ TestAdapter").ice_ping();
+ comm.stringToProxy("test").ice_ping();
- test(com.getDefaultLocator().getRegistry() != null);
- test(IceGrid.LocatorPrxHelper.uncheckedCast(com.getDefaultLocator()).getLocalRegistry() != null);
- test(IceGrid.LocatorPrxHelper.uncheckedCast(com.getDefaultLocator()).getLocalQuery() != null);
+ test(comm.getDefaultLocator().getRegistry() != null);
+ test(com.zeroc.IceGrid.LocatorPrx.uncheckedCast(comm.getDefaultLocator()).getLocalRegistry() != null);
+ test(com.zeroc.IceGrid.LocatorPrx.uncheckedCast(comm.getDefaultLocator()).getLocalQuery() != null);
- Ice.ObjectAdapter adapter = com.createObjectAdapter("AdapterForDiscoveryTest");
+ com.zeroc.Ice.ObjectAdapter adapter = comm.createObjectAdapter("AdapterForDiscoveryTest");
adapter.activate();
adapter.deactivate();
- com.destroy();
+ comm.destroy();
//
// Now, ensure that the IceGrid discovery locator correctly
@@ -120,37 +117,37 @@ public class AllTests
initData.properties.setProperty("IceLocatorDiscovery.InstanceName", "unknown");
initData.properties.setProperty("IceLocatorDiscovery.RetryCount", "1");
initData.properties.setProperty("IceLocatorDiscovery.Timeout", "100");
- com = Ice.Util.initialize(initData);
- test(com.getDefaultLocator() != null);
+ comm = com.zeroc.Ice.Util.initialize(initData);
+ test(comm.getDefaultLocator() != null);
try
{
- com.stringToProxy("test @ TestAdapter").ice_ping();
+ comm.stringToProxy("test @ TestAdapter").ice_ping();
}
- catch(Ice.NoEndpointException ex)
+ catch(com.zeroc.Ice.NoEndpointException ex)
{
}
try
{
- com.stringToProxy("test").ice_ping();
+ comm.stringToProxy("test").ice_ping();
}
- catch(Ice.NoEndpointException ex)
+ catch(com.zeroc.Ice.NoEndpointException ex)
{
}
- test(com.getDefaultLocator().getRegistry() == null);
- test(IceGrid.LocatorPrxHelper.checkedCast(com.getDefaultLocator()) == null);
+ test(comm.getDefaultLocator().getRegistry() == null);
+ test(com.zeroc.IceGrid.LocatorPrx.checkedCast(comm.getDefaultLocator()) == null);
try
{
- IceGrid.LocatorPrxHelper.uncheckedCast(com.getDefaultLocator()).getLocalQuery();
+ com.zeroc.IceGrid.LocatorPrx.uncheckedCast(comm.getDefaultLocator()).getLocalQuery();
}
- catch(Ice.OperationNotExistException ex)
+ catch(com.zeroc.Ice.OperationNotExistException ex)
{
}
- adapter = com.createObjectAdapter("AdapterForDiscoveryTest");
+ adapter = comm.createObjectAdapter("AdapterForDiscoveryTest");
adapter.activate();
adapter.deactivate();
- com.destroy();
+ comm.destroy();
}
out.println("ok");
@@ -160,23 +157,22 @@ public class AllTests
out.println("ok");
}
- public static void
- allTestsWithDeploy(Ice.Communicator communicator, PrintWriter out)
+ public static void allTestsWithDeploy(com.zeroc.Ice.Communicator communicator, PrintWriter out)
{
out.print("testing stringToProxy... ");
out.flush();
- Ice.ObjectPrx base = communicator.stringToProxy("test @ TestAdapter");
+ com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy("test @ TestAdapter");
test(base != null);
- Ice.ObjectPrx base2 = communicator.stringToProxy("test");
+ com.zeroc.Ice.ObjectPrx base2 = communicator.stringToProxy("test");
test(base2 != null);
out.println("ok");
out.print("testing checked cast... ");
out.flush();
- TestIntfPrx obj = TestIntfPrxHelper.checkedCast(base);
+ TestIntfPrx obj = TestIntfPrx.checkedCast(base);
test(obj != null);
test(obj.equals(base));
- TestIntfPrx obj2 = TestIntfPrxHelper.checkedCast(base2);
+ TestIntfPrx obj2 = TestIntfPrx.checkedCast(base2);
test(obj2 != null);
test(obj2.equals(base2));
out.println("ok");
@@ -189,16 +185,16 @@ public class AllTests
out.print("testing encoding versioning... ");
out.flush();
- Ice.ObjectPrx base10 = communicator.stringToProxy("test10 @ TestAdapter10");
+ com.zeroc.Ice.ObjectPrx base10 = communicator.stringToProxy("test10 @ TestAdapter10");
test(base10 != null);
- Ice.ObjectPrx base102 = communicator.stringToProxy("test10");
+ com.zeroc.Ice.ObjectPrx base102 = communicator.stringToProxy("test10");
test(base102 != null);
try
{
base10.ice_ping();
test(false);
}
- catch(Ice.NoEndpointException ex)
+ catch(com.zeroc.Ice.NoEndpointException ex)
{
}
try
@@ -206,11 +202,11 @@ public class AllTests
base102.ice_ping();
test(false);
}
- catch(Ice.NoEndpointException ex)
+ catch(com.zeroc.Ice.NoEndpointException ex)
{
}
- base10 = base10.ice_encodingVersion(Ice.Util.Encoding_1_0);
- base102 = base102.ice_encodingVersion(Ice.Util.Encoding_1_0);
+ base10 = base10.ice_encodingVersion(com.zeroc.Ice.Util.Encoding_1_0);
+ base102 = base102.ice_encodingVersion(com.zeroc.Ice.Util.Encoding_1_0);
base10.ice_ping();
base102.ice_ping();
out.println("ok");
@@ -222,7 +218,7 @@ public class AllTests
communicator.stringToProxy("unknown/unknown").ice_ping();
test(false);
}
- catch(Ice.NotRegisteredException ex)
+ catch(com.zeroc.Ice.NotRegisteredException ex)
{
test(ex.kindOfObject.equals("object"));
test(ex.id.equals("unknown/unknown"));
@@ -236,30 +232,30 @@ public class AllTests
communicator.stringToProxy("test @ TestAdapterUnknown").ice_ping();
test(false);
}
- catch(Ice.NotRegisteredException ex)
+ catch(com.zeroc.Ice.NotRegisteredException ex)
{
test(ex.kindOfObject.equals("object adapter"));
test(ex.id.equals("TestAdapterUnknown"));
}
out.println("ok");
- IceGrid.RegistryPrx registry = IceGrid.RegistryPrxHelper.checkedCast(
+ com.zeroc.IceGrid.RegistryPrx registry = com.zeroc.IceGrid.RegistryPrx.checkedCast(
communicator.stringToProxy(communicator.getDefaultLocator().ice_getIdentity().category + "/Registry"));
test(registry != null);
- IceGrid.AdminSessionPrx session = null;
+ com.zeroc.IceGrid.AdminSessionPrx session = null;
try
{
session = registry.createAdminSession("foo", "bar");
}
- catch(IceGrid.PermissionDeniedException e)
+ catch(com.zeroc.IceGrid.PermissionDeniedException e)
{
test(false);
}
- session.ice_getConnection().setACM(new Ice.IntOptional(registry.getACMTimeout()), null,
- new Ice.Optional<Ice.ACMHeartbeat>(Ice.ACMHeartbeat.HeartbeatAlways));
+ session.ice_getConnection().setACM(java.util.OptionalInt.of(registry.getACMTimeout()), null,
+ java.util.Optional.of(com.zeroc.Ice.ACMHeartbeat.HeartbeatAlways));
- IceGrid.AdminPrx admin = session.getAdmin();
+ com.zeroc.IceGrid.AdminPrx admin = session.getAdmin();
test(admin != null);
try
@@ -267,19 +263,19 @@ public class AllTests
admin.enableServer("server", false);
admin.stopServer("server");
}
- catch(IceGrid.ServerNotExistException ex)
+ catch(com.zeroc.IceGrid.ServerNotExistException ex)
{
test(false);
}
- catch(IceGrid.ServerStopException ex)
+ catch(com.zeroc.IceGrid.ServerStopException ex)
{
test(false);
}
- catch(IceGrid.NodeUnreachableException ex)
+ catch(com.zeroc.IceGrid.NodeUnreachableException ex)
{
test(false);
}
- catch(IceGrid.DeploymentException ex)
+ catch(com.zeroc.IceGrid.DeploymentException ex)
{
test(false);
}
@@ -288,18 +284,18 @@ public class AllTests
out.flush();
try
{
- obj = TestIntfPrxHelper.checkedCast(base);
+ obj = TestIntfPrx.checkedCast(base);
test(false);
}
- catch(Ice.NoEndpointException ex)
+ catch(com.zeroc.Ice.NoEndpointException ex)
{
}
try
{
- obj2 = TestIntfPrxHelper.checkedCast(base2);
+ obj2 = TestIntfPrx.checkedCast(base2);
test(false);
}
- catch(Ice.NoEndpointException ex)
+ catch(com.zeroc.Ice.NoEndpointException ex)
{
}
@@ -307,32 +303,32 @@ public class AllTests
{
admin.enableServer("server", true);
}
- catch(IceGrid.ServerNotExistException ex)
+ catch(com.zeroc.IceGrid.ServerNotExistException ex)
{
test(false);
}
- catch(IceGrid.NodeUnreachableException ex)
+ catch(com.zeroc.IceGrid.NodeUnreachableException ex)
{
test(false);
}
- catch(IceGrid.DeploymentException ex)
+ catch(com.zeroc.IceGrid.DeploymentException ex)
{
test(false);
}
try
{
- obj = TestIntfPrxHelper.checkedCast(base);
+ obj = TestIntfPrx.checkedCast(base);
}
- catch(Ice.NoEndpointException ex)
+ catch(com.zeroc.Ice.NoEndpointException ex)
{
test(false);
}
try
{
- obj2 = TestIntfPrxHelper.checkedCast(base2);
+ obj2 = TestIntfPrx.checkedCast(base2);
}
- catch(Ice.NoEndpointException ex)
+ catch(com.zeroc.Ice.NoEndpointException ex)
{
test(false);
}
@@ -342,19 +338,19 @@ public class AllTests
{
admin.stopServer("server");
}
- catch(IceGrid.ServerNotExistException ex)
+ catch(com.zeroc.IceGrid.ServerNotExistException ex)
{
test(false);
}
- catch(IceGrid.ServerStopException ex)
+ catch(com.zeroc.IceGrid.ServerStopException ex)
{
test(false);
}
- catch(IceGrid.NodeUnreachableException ex)
+ catch(com.zeroc.IceGrid.NodeUnreachableException ex)
{
test(false);
}
- catch(IceGrid.DeploymentException ex)
+ catch(com.zeroc.IceGrid.DeploymentException ex)
{
test(false);
}
diff --git a/java/test/src/main/java/test/IceGrid/simple/Client.java b/java/test/src/main/java/test/IceGrid/simple/Client.java
index c843e477fc5..d8f829f46d6 100644
--- a/java/test/src/main/java/test/IceGrid/simple/Client.java
+++ b/java/test/src/main/java/test/IceGrid/simple/Client.java
@@ -14,7 +14,7 @@ public class Client extends test.Util.Application
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.Communicator communicator = communicator();
boolean withDeploy = false;
for(String arg : args)
{
@@ -38,12 +38,11 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.IceGrid.simple");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.IceGrid.simple");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/IceGrid/simple/Server.java b/java/test/src/main/java/test/IceGrid/simple/Server.java
index e1ea3916029..ec2a17672b2 100644
--- a/java/test/src/main/java/test/IceGrid/simple/Server.java
+++ b/java/test/src/main/java/test/IceGrid/simple/Server.java
@@ -12,22 +12,20 @@ package test.IceGrid.simple;
public class Server extends test.Util.Application
{
@Override
- public int
- run(String[] args)
+ public int run(String[] args)
{
- Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
- argsH.value = communicator().getProperties().parseCommandLineOptions("TestAdapter", argsH.value);
+ communicator().getProperties().parseCommandLineOptions("TestAdapter", args);
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- Ice.Object object = new TestI();
+ com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.Object object = new TestI();
String id = communicator().getProperties().getPropertyWithDefault("Identity", "test");
- adapter.add(object, Ice.Util.stringToIdentity(id));
+ adapter.add(object, com.zeroc.Ice.Util.stringToIdentity(id));
//shutdownOnInterrupt();
try
{
adapter.activate();
}
- catch(Ice.ObjectAdapterDeactivatedException ex)
+ catch(com.zeroc.Ice.ObjectAdapterDeactivatedException ex)
{
}
communicator().waitForShutdown();
@@ -36,22 +34,20 @@ public class Server extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
+ GetInitDataResult r = super.getInitData(args);
//
- // Its possible to have batch oneway requests dispatched
+ // It's possible to have batch oneway requests dispatched
// after the adapter is deactivated due to thread
- // scheduling so we supress this warning.
+ // scheduling so we suppress this warning.
//
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- initData.properties.setProperty("Ice.Package.Test", "test.IceGrid.simple");
- return initData;
+ r.initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ r.initData.properties.setProperty("Ice.Package.Test", "test.IceGrid.simple");
+ return r;
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
Server c = new Server();
int status = c.main("test.IceGrid.simple.Server", args);
diff --git a/java/test/src/main/java/test/IceGrid/simple/TestI.java b/java/test/src/main/java/test/IceGrid/simple/TestI.java
index 03ef5d74b4a..1ac709ab57d 100644
--- a/java/test/src/main/java/test/IceGrid/simple/TestI.java
+++ b/java/test/src/main/java/test/IceGrid/simple/TestI.java
@@ -9,18 +9,16 @@
package test.IceGrid.simple;
-import test.IceGrid.simple.Test._TestIntfDisp;
+import test.IceGrid.simple.Test.TestIntf;
-public class TestI extends _TestIntfDisp
+public class TestI implements TestIntf
{
- public
- TestI()
+ public TestI()
{
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
current.adapter.getCommunicator().shutdown();
}
diff --git a/java/test/src/main/java/test/IceSSL/configuration/AllTests.java b/java/test/src/main/java/test/IceSSL/configuration/AllTests.java
index d4d89c9f61e..e8f09e2d47a 100644
--- a/java/test/src/main/java/test/IceSSL/configuration/AllTests.java
+++ b/java/test/src/main/java/test/IceSSL/configuration/AllTests.java
@@ -8,10 +8,13 @@
// **********************************************************************
package test.IceSSL.configuration;
+
import java.io.PrintWriter;
+import com.zeroc.Ice.InitializationData;
+import com.zeroc.Ice.Util;
+
import test.IceSSL.configuration.Test.ServerFactoryPrx;
-import test.IceSSL.configuration.Test.ServerFactoryPrxHelper;
import test.IceSSL.configuration.Test.ServerPrx;
//
@@ -20,8 +23,7 @@ import test.IceSSL.configuration.Test.ServerPrx;
public class AllTests
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -29,8 +31,7 @@ public class AllTests
}
}
- private static java.security.cert.X509Certificate
- loadCertificate(String path, String alias)
+ private static java.security.cert.X509Certificate loadCertificate(String path, String alias)
{
try
{
@@ -45,12 +46,12 @@ public class AllTests
}
}
- private static Ice.InitializationData
- createClientProps(Ice.Properties defaultProperties, String defaultDir, String defaultHost)
+ private static InitializationData createClientProps(com.zeroc.Ice.Properties defaultProperties,
+ String defaultDir, String defaultHost)
{
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties();
- initData.properties.setProperty("Ice.Plugin.IceSSL", "IceSSL.PluginFactory");
+ InitializationData initData = new com.zeroc.Ice.InitializationData();
+ initData.properties = Util.createProperties();
+ initData.properties.setProperty("Ice.Plugin.IceSSL", "com.zeroc.IceSSL.PluginFactory");
if(defaultProperties.getProperty("Ice.IPv6").length() > 0)
{
initData.properties.setProperty("Ice.IPv6", defaultProperties.getProperty("Ice.IPv6"));
@@ -65,10 +66,11 @@ public class AllTests
return initData;
}
- private static Ice.InitializationData
- createClientProps(Ice.Properties defaultProperties, String defaultDir, String defaultHost, String ks, String ts)
+ private static InitializationData createClientProps(com.zeroc.Ice.Properties defaultProperties,
+ String defaultDir, String defaultHost, String ks,
+ String ts)
{
- Ice.InitializationData initData = createClientProps(defaultProperties, defaultDir, defaultHost);
+ InitializationData initData = createClientProps(defaultProperties, defaultDir, defaultHost);
if(!ks.isEmpty())
{
initData.properties.setProperty("IceSSL.Keystore", ks + ".jks");
@@ -81,11 +83,11 @@ public class AllTests
return initData;
}
- private static java.util.Map<String, String>
- createServerProps(Ice.Properties defaultProperties, String defaultDir, String defaultHost)
+ private static java.util.Map<String, String> createServerProps(com.zeroc.Ice.Properties defaultProperties,
+ String defaultDir, String defaultHost)
{
- java.util.Map<String, String> result = new java.util.HashMap<String, String>();
- result.put("Ice.Plugin.IceSSL", "IceSSL.PluginFactory");
+ java.util.Map<String, String> result = new java.util.HashMap<>();
+ result.put("Ice.Plugin.IceSSL", "com.zeroc.IceSSL.PluginFactory");
if(defaultProperties.getProperty("Ice.IPv6").length() > 0)
{
result.put("Ice.IPv6", defaultProperties.getProperty("Ice.IPv6"));
@@ -99,8 +101,9 @@ public class AllTests
return result;
}
- private static java.util.Map<String, String>
- createServerProps(Ice.Properties defaultProperties, String defaultDir, String defaultHost, String ks, String ts)
+ private static java.util.Map<String, String> createServerProps(com.zeroc.Ice.Properties defaultProperties,
+ String defaultDir, String defaultHost, String ks,
+ String ts)
{
java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost);
if(!ks.isEmpty())
@@ -115,53 +118,52 @@ public class AllTests
return d;
}
- public static ServerFactoryPrx
- allTests(test.Util.Application app, String testDir, PrintWriter out)
+ public static ServerFactoryPrx allTests(test.Util.Application app, String testDir, PrintWriter out)
{
- Ice.Communicator communicator = app.communicator();
+ com.zeroc.Ice.Communicator communicator = app.communicator();
final String factoryRef = "factory:tcp -p 12010";
- Ice.ObjectPrx b = communicator.stringToProxy(factoryRef);
+ com.zeroc.Ice.ObjectPrx b = communicator.stringToProxy(factoryRef);
test(b != null);
- ServerFactoryPrx factory = ServerFactoryPrxHelper.checkedCast(b);
+ ServerFactoryPrx factory = ServerFactoryPrx.checkedCast(b);
final String defaultHost = communicator.getProperties().getProperty("Ice.Default.Host");
final String defaultDir = testDir + "/../certs";
- final Ice.Properties defaultProperties = communicator.getProperties();
+ final com.zeroc.Ice.Properties defaultProperties = communicator.getProperties();
final String[] args = new String[0];
out.print("testing manual initialization... ");
out.flush();
{
- Ice.InitializationData initData = createClientProps(defaultProperties, defaultDir, defaultHost);
+ InitializationData initData = createClientProps(defaultProperties, defaultDir, defaultHost);
initData.properties.setProperty("Ice.InitPlugins", "0");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
- Ice.ObjectPrx p = comm.stringToProxy("dummy:ssl -p 9999");
+ Util.InitializeResult ir = Util.initialize(args, initData);
+ com.zeroc.Ice.ObjectPrx p = ir.communicator.stringToProxy("dummy:ssl -p 9999");
try
{
p.ice_ping();
test(false);
}
- catch(Ice.PluginInitializationException ex)
+ catch(com.zeroc.Ice.PluginInitializationException ex)
{
// Expected.
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
- comm.destroy();
+ ir.communicator.destroy();
}
{
- Ice.InitializationData initData = createClientProps(defaultProperties, defaultDir, defaultHost);
+ InitializationData initData = createClientProps(defaultProperties, defaultDir, defaultHost);
initData.properties.setProperty("Ice.InitPlugins", "0");
initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DH_anon.*AES.*)");
initData.properties.setProperty("IceSSL.VerifyPeer", "0");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
- Ice.PluginManager pm = comm.getPluginManager();
+ Util.InitializeResult ir = Util.initialize(args, initData);
+ com.zeroc.Ice.PluginManager pm = ir.communicator.getPluginManager();
pm.initializePlugins();
- Ice.ObjectPrx obj = comm.stringToProxy(factoryRef);
+ com.zeroc.Ice.ObjectPrx obj = ir.communicator.stringToProxy(factoryRef);
test(obj != null);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(obj);
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(obj);
java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost);
d.put("IceSSL.Ciphers", "NONE (.*DH_anon.*AES.*)");
d.put("IceSSL.VerifyPeer", "0");
@@ -170,12 +172,12 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
out.println("ok");
@@ -183,7 +185,7 @@ public class AllTests
out.flush();
{
java.util.Map<String, String> d;
- Ice.InitializationData initData;
+ InitializationData initData;
//
// Test IceSSL.VerifyPeer=0. Client does not have a certificate,
@@ -191,8 +193,8 @@ public class AllTests
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "", "");
initData.properties.setProperty("IceSSL.VerifyPeer", "0");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ Util.InitializeResult ir = Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "");
d.put("IceSSL.VerifyPeer", "0");
@@ -200,23 +202,23 @@ public class AllTests
try
{
server.noCert();
- test(!((IceSSL.ConnectionInfo)server.ice_getConnection().getInfo()).verified);
+ test(!((com.zeroc.IceSSL.ConnectionInfo)server.ice_getConnection().getInfo()).verified);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
//
// Test IceSSL.VerifyPeer=0. Client does not have a certificate,
// but it still verifies the server's.
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "", "cacert1");
- comm = Ice.Util.initialize(args, initData);
- fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ir = Util.initialize(args, initData);
+ fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "");
d.put("IceSSL.VerifyPeer", "0");
@@ -224,20 +226,21 @@ public class AllTests
try
{
server.noCert();
- test(((IceSSL.ConnectionInfo)server.ice_getConnection().getInfo()).verified);
+ test(((com.zeroc.IceSSL.ConnectionInfo)server.ice_getConnection().getInfo()).verified);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
+ ir.communicator.destroy();
//
// Test IceSSL.VerifyPeer=1. Client does not have a certificate.
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "", "cacert1");
- comm = Ice.Util.initialize(args, initData);
- fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ir = Util.initialize(args, initData);
+ fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "");
d.put("IceSSL.VerifyPeer", "1");
@@ -246,7 +249,7 @@ public class AllTests
{
server.noCert();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -264,21 +267,21 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.SecurityException ex)
+ catch(com.zeroc.Ice.SecurityException ex)
{
// Expected.
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
// Expected.
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
//
// Test IceSSL.VerifyPeer=1. Client has a certificate.
@@ -288,8 +291,8 @@ public class AllTests
// able to provide the certificate chain).
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
- comm = Ice.Util.initialize(args, initData);
- fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ir = Util.initialize(args, initData);
+ fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
d.put("IceSSL.VerifyPeer", "1");
@@ -302,7 +305,8 @@ public class AllTests
java.security.cert.X509Certificate serverCert = loadCertificate(defaultDir + "/s_rsa_ca1.jks", "cert");
java.security.cert.X509Certificate caCert = loadCertificate(defaultDir + "/cacert1.jks", "ca");
- IceSSL.NativeConnectionInfo info = (IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
+ com.zeroc.IceSSL.NativeConnectionInfo info =
+ (com.zeroc.IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
test(info.nativeCerts.length == 2);
test(info.verified);
@@ -334,7 +338,7 @@ public class AllTests
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
//
// Test IceSSL.VerifyPeer=1. This should fail because the
@@ -342,8 +346,8 @@ public class AllTests
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "", "");
initData.properties.setProperty("IceSSL.VerifyPeer", "1");
- comm = Ice.Util.initialize(args, initData);
- fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ir = Util.initialize(args, initData);
+ fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
d.put("IceSSL.VerifyPeer", "0");
@@ -353,17 +357,17 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.SecurityException ex)
+ catch(com.zeroc.Ice.SecurityException ex)
{
// Expected.
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
//
// Test IceSSL.VerifyPeer=1. This should fail because the
@@ -371,8 +375,8 @@ public class AllTests
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca2", "");
initData.properties.setProperty("IceSSL.VerifyPeer", "0");
- comm = Ice.Util.initialize(args, initData);
- fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ir = Util.initialize(args, initData);
+ fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "");
d.put("IceSSL.VerifyPeer", "1");
@@ -382,20 +386,20 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.SecurityException ex)
+ catch(com.zeroc.Ice.SecurityException ex)
{
// Expected.
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
// Expected.
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
//
// Test IceSSL.VerifyPeer=1. This should fail because the server
@@ -404,8 +408,8 @@ public class AllTests
initData = createClientProps(defaultProperties, defaultDir, defaultHost);
initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DH_anon.*AES.*)");
initData.properties.setProperty("IceSSL.VerifyPeer", "1");
- comm = Ice.Util.initialize(args, initData);
- fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ir = Util.initialize(args, initData);
+ fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost);
d.put("IceSSL.Ciphers", "NONE (.*DH_anon.*AES.*)");
@@ -416,16 +420,16 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.SecurityException ex)
+ catch(com.zeroc.Ice.SecurityException ex)
{
// Expected.
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
//
// This should succeed because the self signed certificate used by the server is
@@ -433,8 +437,8 @@ public class AllTests
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "", "cacert2");
initData.properties.setProperty("IceSSL.VerifyPeer", "1");
- comm = Ice.Util.initialize(args, initData);
- fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ir = Util.initialize(args, initData);
+ fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_cacert2", "");
d.put("IceSSL.VerifyPeer", "0");
@@ -443,13 +447,13 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
//
// This should fail because the self signed certificate used by the server is not
@@ -457,8 +461,8 @@ public class AllTests
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost);
initData.properties.setProperty("IceSSL.VerifyPeer", "1");
- comm = Ice.Util.initialize(args, initData);
- fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ir = Util.initialize(args, initData);
+ fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_cacert2", "");
d.put("IceSSL.VerifyPeer", "0");
@@ -468,24 +472,24 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.SecurityException ex)
+ catch(com.zeroc.Ice.SecurityException ex)
{
// Expected.
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
//
// Verify that IceSSL.CheckCertName has no effect in a server.
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
- comm = Ice.Util.initialize(args, initData);
+ ir = Util.initialize(args, initData);
- fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
d.put("IceSSL.CheckCertName", "1");
@@ -494,12 +498,12 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
//
// Test IceSSL.CheckCertName. The test certificates for the server contain "127.0.0.1"
@@ -514,9 +518,9 @@ public class AllTests
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.CheckCertName", "1");
- comm = Ice.Util.initialize(args, initData);
+ ir = Util.initialize(args, initData);
- fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
server = fact.createServer(d);
@@ -524,12 +528,12 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
//
// Test common name.
@@ -537,9 +541,9 @@ public class AllTests
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.CheckCertName", "1");
- comm = Ice.Util.initialize(args, initData);
+ ir = Util.initialize(args, initData);
- fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1_cn1", "cacert1");
server = fact.createServer(d);
@@ -547,12 +551,12 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
//
// Test common name again. The certificate used in this test has "127.0.0.11" as its
@@ -561,9 +565,9 @@ public class AllTests
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.CheckCertName", "1");
- comm = Ice.Util.initialize(args, initData);
+ ir = Util.initialize(args, initData);
- fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1_cn2", "cacert1");
server = fact.createServer(d);
@@ -572,30 +576,30 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
// Expected.
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
}
}
out.println("ok");
- Ice.InitializationData initData;
+ InitializationData initData;
java.util.Map<String, String> d;
out.print("testing certificate chains... ");
out.flush();
{
- IceSSL.NativeConnectionInfo info;
+ com.zeroc.IceSSL.NativeConnectionInfo info;
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "", "");
initData.properties.setProperty("IceSSL.VerifyPeer", "0");
- Ice.Communicator comm = Ice.Util.initialize(initData);
+ com.zeroc.Ice.Communicator comm = Util.initialize(initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(comm.stringToProxy(factoryRef));
test(fact != null);
//
@@ -608,11 +612,11 @@ public class AllTests
ServerPrx server = fact.createServer(d);
try
{
- info = (IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
+ info = (com.zeroc.IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
test(info.nativeCerts.length == 1);
test(!info.verified);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -627,11 +631,11 @@ public class AllTests
server = fact.createServer(d);
try
{
- info = (IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
+ info = (com.zeroc.IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
test(info.nativeCerts.length == 1);
test(!info.verified);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -647,10 +651,10 @@ public class AllTests
server = fact.createServer(d);
try
{
- info = (IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
+ info = (com.zeroc.IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
test(info.nativeCerts.length == 2);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -662,9 +666,9 @@ public class AllTests
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "", "cacert1");
initData.properties.setProperty("IceSSL.VerifyPeer", "1");
- comm = Ice.Util.initialize(initData);
+ comm = Util.initialize(initData);
- fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ fact = ServerFactoryPrx.checkedCast(comm.stringToProxy(factoryRef));
test(fact != null);
{
@@ -673,11 +677,11 @@ public class AllTests
server = fact.createServer(d);
try
{
- info = (IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
+ info = (com.zeroc.IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
test(info.nativeCerts.length == 2);
test(info.verified);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -692,9 +696,9 @@ public class AllTests
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "", "cacert1");
initData.properties.setProperty("IceSSL.VerifyPeer", "1");
initData.properties.setProperty("IceSSL.VerifyDepthMax", "2");
- comm = Ice.Util.initialize(initData);
+ comm = Util.initialize(initData);
- fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ fact = ServerFactoryPrx.checkedCast(comm.stringToProxy(factoryRef));
test(fact != null);
{
@@ -706,11 +710,11 @@ public class AllTests
server.ice_getConnection().getInfo();
test(false);
}
- catch(Ice.SecurityException ex)
+ catch(com.zeroc.Ice.SecurityException ex)
{
// Chain length too long
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -724,9 +728,9 @@ public class AllTests
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "", "cacert1");
initData.properties.setProperty("IceSSL.VerifyPeer", "1");
//initData.properties.setProperty("IceSSL.VerifyDepthMax", "3");
- comm = Ice.Util.initialize(initData);
+ comm = Util.initialize(initData);
- fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ fact = ServerFactoryPrx.checkedCast(comm.stringToProxy(factoryRef));
test(fact != null);
{
@@ -735,11 +739,11 @@ public class AllTests
server = fact.createServer(d);
try
{
- info = (IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
+ info = (com.zeroc.IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
test(info.nativeCerts.length == 3);
test(info.verified);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -755,7 +759,7 @@ public class AllTests
server.ice_getConnection().getInfo();
test(false);
}
- catch(Ice.SecurityException ex)
+ catch(com.zeroc.Ice.SecurityException ex)
{
// Chain length too long
}
@@ -769,9 +773,9 @@ public class AllTests
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "", "cacert1");
initData.properties.setProperty("IceSSL.VerifyPeer", "1");
initData.properties.setProperty("IceSSL.VerifyDepthMax", "4");
- comm = Ice.Util.initialize(initData);
+ comm = Util.initialize(initData);
- fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ fact = ServerFactoryPrx.checkedCast(comm.stringToProxy(factoryRef));
test(fact != null);
{
@@ -780,11 +784,11 @@ public class AllTests
server = fact.createServer(d);
try
{
- info = (IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
+ info = (com.zeroc.IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
test(info.nativeCerts.length == 4);
test(info.verified);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -799,9 +803,9 @@ public class AllTests
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_cai2", "cacert1");
initData.properties.setProperty("IceSSL.VerifyPeer", "1");
initData.properties.setProperty("IceSSL.VerifyDepthMax", "4");
- comm = Ice.Util.initialize(initData);
+ comm = Util.initialize(initData);
- fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ fact = ServerFactoryPrx.checkedCast(comm.stringToProxy(factoryRef));
test(fact != null);
{
@@ -813,15 +817,15 @@ public class AllTests
server.ice_getConnection();
test(false);
}
- catch(Ice.ProtocolException ex)
+ catch(com.zeroc.Ice.ProtocolException ex)
{
// Expected
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
// Expected
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -837,7 +841,7 @@ public class AllTests
{
server.ice_getConnection();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -857,13 +861,14 @@ public class AllTests
initData = createClientProps(defaultProperties, defaultDir, defaultHost);
initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DH_anon.*AES.*)");
initData.properties.setProperty("IceSSL.VerifyPeer", "0");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
- IceSSL.Plugin plugin = (IceSSL.Plugin)comm.getPluginManager().getPlugin("IceSSL");
+ Util.InitializeResult ir = Util.initialize(args, initData);
+ com.zeroc.IceSSL.Plugin plugin =
+ (com.zeroc.IceSSL.Plugin)ir.communicator.getPluginManager().getPlugin("IceSSL");
test(plugin != null);
CertificateVerifierI verifier = new CertificateVerifierI();
plugin.setCertificateVerifier(verifier);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost);
d.put("IceSSL.Ciphers", "NONE (.*DH_anon.*AES.*)");
@@ -873,10 +878,11 @@ public class AllTests
{
String cipherSub = "DH_anon";
server.checkCipher(cipherSub);
- IceSSL.NativeConnectionInfo info = (IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
+ com.zeroc.IceSSL.NativeConnectionInfo info =
+ (com.zeroc.IceSSL.NativeConnectionInfo)server.ice_getConnection().getInfo();
test(info.cipher.indexOf(cipherSub) >= 0);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -895,11 +901,11 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.SecurityException ex)
+ catch(com.zeroc.Ice.SecurityException ex)
{
// Expected.
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -907,7 +913,7 @@ public class AllTests
test(!verifier.hadCert());
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
@@ -915,13 +921,14 @@ public class AllTests
// Verify that a server certificate is present.
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
- IceSSL.Plugin plugin = (IceSSL.Plugin)comm.getPluginManager().getPlugin("IceSSL");
+ Util.InitializeResult ir = Util.initialize(args, initData);
+ com.zeroc.IceSSL.Plugin plugin =
+ (com.zeroc.IceSSL.Plugin)ir.communicator.getPluginManager().getPlugin("IceSSL");
test(plugin != null);
CertificateVerifierI verifier = new CertificateVerifierI();
plugin.setCertificateVerifier(verifier);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
d.put("IceSSL.VerifyPeer", "2");
@@ -930,14 +937,14 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
test(verifier.invoked());
test(verifier.hadCert());
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
//
@@ -945,11 +952,12 @@ public class AllTests
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.CertVerifier", "test.IceSSL.configuration.CertificateVerifierI");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
- IceSSL.Plugin plugin = (IceSSL.Plugin)comm.getPluginManager().getPlugin("IceSSL");
+ Util.InitializeResult ir = Util.initialize(args, initData);
+ com.zeroc.IceSSL.Plugin plugin =
+ (com.zeroc.IceSSL.Plugin)ir.communicator.getPluginManager().getPlugin("IceSSL");
test(plugin != null);
test(plugin.getCertificateVerifier() != null);
- comm.destroy();
+ ir.communicator.destroy();
}
out.println("ok");
@@ -962,8 +970,8 @@ public class AllTests
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.Protocols", "ssl3");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ Util.InitializeResult ir = Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
d.put("IceSSL.VerifyPeer", "2");
@@ -974,20 +982,20 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.SecurityException ex)
+ catch(com.zeroc.Ice.SecurityException ex)
{
// Expected.
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
// Expected for thread pool.
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
//
// SSLv3 has been disabled by default in latests JDK updates.
@@ -1000,8 +1008,8 @@ public class AllTests
// //
// // This should succeed.
// //
-// comm = Ice.Util.initialize(args, initData);
-// fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+// ir = Util.initialize(args, initData);
+// fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
// test(fact != null);
// d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
// d.put("IceSSL.VerifyPeer", "2");
@@ -1011,13 +1019,13 @@ public class AllTests
// {
// server.ice_ping();
// }
-// catch(Ice.LocalException ex)
+// catch(com.zeroc.Ice.LocalException ex)
// {
// ex.printStackTrace();
// test(false);
// }
// fact.destroyServer(server);
-// comm.destroy();
+// ir.communicator.destroy();
// }
}
@@ -1028,8 +1036,8 @@ public class AllTests
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.Protocols", "ssl3");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ Util.InitializeResult ir = Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
d.put("IceSSL.VerifyPeer", "2");
@@ -1039,20 +1047,20 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.SecurityException ex)
+ catch(com.zeroc.Ice.SecurityException ex)
{
// Expected.
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
// Expected for thread pool.
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
@@ -1061,8 +1069,8 @@ public class AllTests
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.Protocols", "ssl3");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ Util.InitializeResult ir = Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
d.put("IceSSL.VerifyPeer", "2");
@@ -1072,20 +1080,20 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.SecurityException ex)
+ catch(com.zeroc.Ice.SecurityException ex)
{
// Expected.
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
// Expected for thread pool.
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
out.println("ok");
@@ -1097,8 +1105,8 @@ public class AllTests
// This should fail because the server's certificate is expired.
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ Util.InitializeResult ir = Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1_exp", "cacert1");
d.put("IceSSL.VerifyPeer", "2");
@@ -1108,24 +1116,24 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.SecurityException ex)
+ catch(com.zeroc.Ice.SecurityException ex)
{
// Expected.
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
//
// This should fail because the client's certificate is expired.
//
initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1_exp.jks");
initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks");
- comm = Ice.Util.initialize(args, initData);
- fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ir = Util.initialize(args, initData);
+ fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
d.put("IceSSL.VerifyPeer", "2");
@@ -1135,20 +1143,20 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
// Expected.
}
- catch(Ice.SecurityException ex)
+ catch(com.zeroc.Ice.SecurityException ex)
{
// Expected.
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
out.println("ok");
@@ -1156,8 +1164,8 @@ public class AllTests
out.flush();
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacerts");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ Util.InitializeResult ir = Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca2", "cacerts");
d.put("IceSSL.VerifyPeer", "2");
@@ -1166,12 +1174,12 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
out.println("ok");
@@ -1186,14 +1194,14 @@ public class AllTests
// Don't specify the password.
try
{
- Ice.Util.initialize(args, initData);
+ Util.initialize(args, initData);
test(false);
}
- catch(Ice.PluginInitializationException ex)
+ catch(com.zeroc.Ice.PluginInitializationException ex)
{
// Expected.
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -1205,9 +1213,9 @@ public class AllTests
initData = createClientProps(defaultProperties, defaultDir, defaultHost);
initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks");
initData.properties.setProperty("Ice.InitPlugins", "0");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
- Ice.PluginManager pm = comm.getPluginManager();
- IceSSL.Plugin plugin = (IceSSL.Plugin)pm.getPlugin("IceSSL");
+ Util.InitializeResult ir = Util.initialize(args, initData);
+ com.zeroc.Ice.PluginManager pm = ir.communicator.getPluginManager();
+ com.zeroc.IceSSL.Plugin plugin = (com.zeroc.IceSSL.Plugin)pm.getPlugin("IceSSL");
test(plugin != null);
PasswordCallbackI cb = new PasswordCallbackI("bogus");
plugin.setPasswordCallback(cb);
@@ -1216,15 +1224,15 @@ public class AllTests
pm.initializePlugins();
test(false);
}
- catch(Ice.PluginInitializationException ex)
+ catch(com.zeroc.Ice.PluginInitializationException ex)
{
// Expected.
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
- comm.destroy();
+ ir.communicator.destroy();
}
{
//
@@ -1233,9 +1241,9 @@ public class AllTests
initData = createClientProps(defaultProperties, defaultDir, defaultHost);
initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks");
initData.properties.setProperty("Ice.InitPlugins", "0");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
- Ice.PluginManager pm = comm.getPluginManager();
- IceSSL.Plugin plugin = (IceSSL.Plugin)pm.getPlugin("IceSSL");
+ Util.InitializeResult ir = Util.initialize(args, initData);
+ com.zeroc.Ice.PluginManager pm = ir.communicator.getPluginManager();
+ com.zeroc.IceSSL.Plugin plugin = (com.zeroc.IceSSL.Plugin)pm.getPlugin("IceSSL");
test(plugin != null);
PasswordCallbackI cb = new PasswordCallbackI();
plugin.setPasswordCallback(cb);
@@ -1244,11 +1252,11 @@ public class AllTests
{
pm.initializePlugins();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
- comm.destroy();
+ ir.communicator.destroy();
}
{
//
@@ -1257,12 +1265,12 @@ public class AllTests
initData = createClientProps(defaultProperties, defaultDir, defaultHost);
initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks");
initData.properties.setProperty("IceSSL.PasswordCallback", "test.IceSSL.configuration.PasswordCallbackI");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
- Ice.PluginManager pm = comm.getPluginManager();
- IceSSL.Plugin plugin = (IceSSL.Plugin)pm.getPlugin("IceSSL");
+ Util.InitializeResult ir = Util.initialize(args, initData);
+ com.zeroc.Ice.PluginManager pm = ir.communicator.getPluginManager();
+ com.zeroc.IceSSL.Plugin plugin = (com.zeroc.IceSSL.Plugin)pm.getPlugin("IceSSL");
test(plugin != null);
test(plugin.getPasswordCallback() != null);
- comm.destroy();
+ ir.communicator.destroy();
}
out.println("ok");
@@ -1276,8 +1284,8 @@ public class AllTests
initData = createClientProps(defaultProperties, defaultDir, defaultHost);
initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DH_anon.*AES.*)");
initData.properties.setProperty("IceSSL.VerifyPeer", "0");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ Util.InitializeResult ir = Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
d.put("IceSSL.Ciphers", "ALL");
@@ -1287,12 +1295,12 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
//
@@ -1301,8 +1309,8 @@ public class AllTests
// First try a client with a DSA certificate.
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_dsa_ca1", "cacert1");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ Util.InitializeResult ir = Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
d.put("IceSSL.VerifyPeer", "1");
@@ -1311,19 +1319,19 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
//
// Next try a client with an RSA certificate.
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
- comm = Ice.Util.initialize(args, initData);
- fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ir = Util.initialize(args, initData);
+ fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
d.put("IceSSL.VerifyPeer", "1");
@@ -1332,20 +1340,20 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
//
// Next try a client with ADH. This should fail.
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost);
initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DH_anon.*AES.*)");
- comm = Ice.Util.initialize(args, initData);
- fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ir = Util.initialize(args, initData);
+ fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
d.put("IceSSL.VerifyPeer", "1");
@@ -1355,20 +1363,20 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.SecurityException ex)
+ catch(com.zeroc.Ice.SecurityException ex)
{
// Expected.
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
// Expected for thread pool.
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
//
@@ -1376,8 +1384,8 @@ public class AllTests
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_dsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DSS.*)");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ Util.InitializeResult ir = Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_ca1", "cacert1");
d.put("IceSSL.VerifyPeer", "2");
@@ -1387,20 +1395,20 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.SecurityException ex)
+ catch(com.zeroc.Ice.SecurityException ex)
{
// Expected.
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
// Expected for thread pool.
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
//
@@ -1409,8 +1417,8 @@ public class AllTests
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_dsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DSS.*)");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ Util.InitializeResult ir = Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
d.put("IceSSL.Alias", "rsacert");
@@ -1421,20 +1429,20 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.SecurityException ex)
+ catch(com.zeroc.Ice.SecurityException ex)
{
// Expected.
}
- catch(Ice.ConnectionLostException ex)
+ catch(com.zeroc.Ice.ConnectionLostException ex)
{
// Expected for thread pool.
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
//
@@ -1442,8 +1450,8 @@ public class AllTests
// Alias property to select the DSA certificate. This should succeed.
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "cacert1", "");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ Util.InitializeResult ir = Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
d.put("IceSSL.Alias", "dsacert");
@@ -1456,15 +1464,16 @@ public class AllTests
// RSA is used by default, so we examine the negotiated cipher to determine whether
// DSA was actually used.
//
- IceSSL.ConnectionInfo info = (IceSSL.ConnectionInfo)server.ice_getConnection().getInfo();
+ com.zeroc.IceSSL.ConnectionInfo info =
+ (com.zeroc.IceSSL.ConnectionInfo)server.ice_getConnection().getInfo();
test(info.cipher.toLowerCase().contains("dss"));
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
out.println("ok");
@@ -1474,9 +1483,9 @@ public class AllTests
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.TrustOnly",
"C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Server");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
ServerPrx server = fact.createServer(d);
@@ -1484,20 +1493,20 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.TrustOnly",
"!C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Server");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
ServerPrx server = fact.createServer(d);
@@ -1506,19 +1515,19 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.TrustOnly",
"C=US, ST=Florida, O=\"ZeroC, Inc.\", OU=Ice, emailAddress=info@zeroc.com, CN=Server");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
ServerPrx server = fact.createServer(d);
@@ -1526,18 +1535,18 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
d.put("IceSSL.TrustOnly",
@@ -1547,18 +1556,18 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
d.put("IceSSL.TrustOnly",
@@ -1569,18 +1578,18 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.TrustOnly", "CN=Server");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
ServerPrx server = fact.createServer(d);
@@ -1588,19 +1597,19 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.TrustOnly", "!CN=Server");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
ServerPrx server = fact.createServer(d);
@@ -1609,17 +1618,17 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
d.put("IceSSL.TrustOnly", "CN=Client");
@@ -1628,18 +1637,18 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
d.put("IceSSL.TrustOnly", "!CN=Client");
@@ -1649,18 +1658,18 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.TrustOnly", "CN=Client");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
ServerPrx server = fact.createServer(d);
@@ -1669,17 +1678,17 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
d.put("IceSSL.TrustOnly", "CN=Server");
@@ -1689,18 +1698,18 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.TrustOnly", "C=Canada,CN=Server");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
ServerPrx server = fact.createServer(d);
@@ -1709,18 +1718,18 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.TrustOnly", "!C=Canada,CN=Server");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
ServerPrx server = fact.createServer(d);
@@ -1728,19 +1737,19 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.TrustOnly", "C=Canada;CN=Server");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
ServerPrx server = fact.createServer(d);
@@ -1748,19 +1757,19 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.TrustOnly", "!C=Canada;!CN=Server");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
ServerPrx server = fact.createServer(d);
@@ -1769,18 +1778,18 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.TrustOnly", "!CN=Server1"); // Should not match "Server"
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
ServerPrx server = fact.createServer(d);
@@ -1788,18 +1797,18 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
d.put("IceSSL.TrustOnly", "!CN=Client1"); // Should not match "Client"
@@ -1808,12 +1817,12 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
//
@@ -1822,9 +1831,9 @@ public class AllTests
initData = createClientProps(defaultProperties, defaultDir, defaultHost);
initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DH_anon.*AES.*)");
initData.properties.setProperty("IceSSL.VerifyPeer", "0");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost);
d.put("IceSSL.TrustOnly",
@@ -1837,11 +1846,11 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
//
@@ -1850,9 +1859,9 @@ public class AllTests
initData = createClientProps(defaultProperties, defaultDir, defaultHost);
initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DH_anon.*AES.*)");
initData.properties.setProperty("IceSSL.VerifyPeer", "0");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost);
d.put("IceSSL.TrustOnly",
@@ -1865,11 +1874,11 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
//
@@ -1877,9 +1886,9 @@ public class AllTests
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.TrustOnly", "ST=Florida;!CN=Server;C=US");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
ServerPrx server = fact.createServer(d);
@@ -1888,20 +1897,20 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
//
// Rejection takes precedence (server).
//
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
d.put("IceSSL.TrustOnly", "ST=Florida;!CN=Client;C=US");
@@ -1911,11 +1920,11 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
out.println("ok");
@@ -1925,9 +1934,9 @@ public class AllTests
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.TrustOnly.Client",
"C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Server");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
// Should have no effect.
@@ -1938,20 +1947,20 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.TrustOnly.Client",
"!C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Server");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
ServerPrx server = fact.createServer(d);
@@ -1960,17 +1969,17 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
// Should have no effect.
@@ -1980,19 +1989,19 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.TrustOnly.Client", "CN=Client");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
ServerPrx server = fact.createServer(d);
@@ -2001,18 +2010,18 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
initData.properties.setProperty("IceSSL.TrustOnly.Client", "!CN=Client");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
ServerPrx server = fact.createServer(d);
@@ -2020,12 +2029,12 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
out.println("ok");
@@ -2036,9 +2045,9 @@ public class AllTests
// Should have no effect.
initData.properties.setProperty("IceSSL.TrustOnly.Server",
"C=US, ST=Florida, O=ZeroC\\, Inc., OU=Ice, emailAddress=info@zeroc.com, CN=Client");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
d.put("IceSSL.TrustOnly.Server",
@@ -2048,18 +2057,18 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
d.put("IceSSL.TrustOnly.Server",
@@ -2070,19 +2079,19 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
// Should have no effect.
initData.properties.setProperty("IceSSL.TrustOnly.Server", "!CN=Server");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
ServerPrx server = fact.createServer(d);
@@ -2090,18 +2099,18 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
d.put("IceSSL.TrustOnly.Server", "CN=Server");
@@ -2111,17 +2120,17 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
d.put("IceSSL.TrustOnly.Server", "!CN=Client");
@@ -2131,11 +2140,11 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
out.println("ok");
@@ -2143,9 +2152,9 @@ public class AllTests
out.flush();
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
d.put("IceSSL.TrustOnly.Server", "CN=bogus");
@@ -2156,18 +2165,18 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
d.put("IceSSL.TrustOnly.Server.ServerAdapter",
@@ -2178,17 +2187,17 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
+ Util.InitializeResult ir = Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
d.put("IceSSL.TrustOnly.Server.ServerAdapter", "CN=bogus");
@@ -2198,16 +2207,16 @@ public class AllTests
server.ice_ping();
test(false);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
{
initData = createClientProps(defaultProperties, defaultDir, defaultHost, "c_rsa_ca1", "cacert1");
- Ice.Communicator comm = Ice.Util.initialize(args, initData);
- ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef));
+ Util.InitializeResult ir = Util.initialize(args, initData);
+ ServerFactoryPrx fact = ServerFactoryPrx.checkedCast(ir.communicator.stringToProxy(factoryRef));
test(fact != null);
d = createServerProps(defaultProperties, defaultDir, defaultHost, "s_rsa_dsa_ca1", "cacert1");
d.put("IceSSL.TrustOnly.Server.ServerAdapter", "!CN=bogus");
@@ -2216,12 +2225,12 @@ public class AllTests
{
server.ice_ping();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
fact.destroyServer(server);
- comm.destroy();
+ ir.communicator.destroy();
}
out.println("ok");
@@ -2231,18 +2240,18 @@ public class AllTests
initData = createClientProps(defaultProperties, defaultDir, defaultHost);
initData.properties.setProperty("IceSSL.VerifyDepthMax", "4");
initData.properties.setProperty("Ice.Override.Timeout", "5000"); // 5s timeout
- Ice.Communicator comm = Ice.Util.initialize(initData);
- Ice.ObjectPrx p = comm.stringToProxy("dummy:wss -h demo.zeroc.com -p 5064");
+ com.zeroc.Ice.Communicator comm = Util.initialize(initData);
+ com.zeroc.Ice.ObjectPrx p = comm.stringToProxy("dummy:wss -h demo.zeroc.com -p 5064");
try
{
p.ice_ping();
test(false);
}
- catch(Ice.SecurityException ex)
+ catch(com.zeroc.Ice.SecurityException ex)
{
// Expected, by default we don't check for system CAs.
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -2251,16 +2260,17 @@ public class AllTests
initData.properties.setProperty("IceSSL.VerifyDepthMax", "4");
initData.properties.setProperty("Ice.Override.Timeout", "5000"); // 5s timeout
initData.properties.setProperty("IceSSL.UsePlatformCAs", "1");
- comm = Ice.Util.initialize(initData);
+ comm = Util.initialize(initData);
p = comm.stringToProxy("dummy:wss -h demo.zeroc.com -p 5064");
try
{
- Ice.WSConnectionInfo info = (Ice.WSConnectionInfo)p.ice_getConnection().getInfo();
- IceSSL.ConnectionInfo sslinfo = (IceSSL.ConnectionInfo)info.underlying;
+ com.zeroc.Ice.WSConnectionInfo info = (com.zeroc.Ice.WSConnectionInfo)p.ice_getConnection().getInfo();
+ com.zeroc.IceSSL.ConnectionInfo sslinfo = (com.zeroc.IceSSL.ConnectionInfo)info.underlying;
test(sslinfo.verified);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
+ ex.printStackTrace();
test(false);
}
comm.destroy();
diff --git a/java/test/src/main/java/test/IceSSL/configuration/CertificateVerifierI.java b/java/test/src/main/java/test/IceSSL/configuration/CertificateVerifierI.java
index 7f3d4099f5d..6a25bcf23ad 100644
--- a/java/test/src/main/java/test/IceSSL/configuration/CertificateVerifierI.java
+++ b/java/test/src/main/java/test/IceSSL/configuration/CertificateVerifierI.java
@@ -9,17 +9,15 @@
package test.IceSSL.configuration;
-public class CertificateVerifierI implements IceSSL.CertificateVerifier
+public class CertificateVerifierI implements com.zeroc.IceSSL.CertificateVerifier
{
- public
- CertificateVerifierI()
+ public CertificateVerifierI()
{
reset();
}
@Override
- public boolean
- verify(IceSSL.NativeConnectionInfo info)
+ public boolean verify(com.zeroc.IceSSL.NativeConnectionInfo info)
{
if(info.nativeCerts != null)
{
@@ -28,8 +26,8 @@ public class CertificateVerifierI implements IceSSL.CertificateVerifier
java.util.Collection<java.util.List<?> > subjectAltNames =
((java.security.cert.X509Certificate)info.nativeCerts[0]).getSubjectAlternativeNames();
test(subjectAltNames != null);
- java.util.List<String> ipAddresses = new java.util.ArrayList<String>();
- java.util.List<String> dnsNames = new java.util.ArrayList<String>();
+ java.util.List<String> ipAddresses = new java.util.ArrayList<>();
+ java.util.List<String> dnsNames = new java.util.ArrayList<>();
for(java.util.List<?> l : subjectAltNames)
{
test(!l.isEmpty());
@@ -58,34 +56,29 @@ public class CertificateVerifierI implements IceSSL.CertificateVerifier
return _returnValue;
}
- void
- reset()
+ void reset()
{
_returnValue = true;
_invoked = false;
_hadCert = false;
}
- void
- returnValue(boolean b)
+ void returnValue(boolean b)
{
_returnValue = b;
}
- boolean
- invoked()
+ boolean invoked()
{
return _invoked;
}
- boolean
- hadCert()
+ boolean hadCert()
{
return _hadCert;
}
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
diff --git a/java/test/src/main/java/test/IceSSL/configuration/Client.java b/java/test/src/main/java/test/IceSSL/configuration/Client.java
index fb92b152d10..52a8c20befb 100644
--- a/java/test/src/main/java/test/IceSSL/configuration/Client.java
+++ b/java/test/src/main/java/test/IceSSL/configuration/Client.java
@@ -32,12 +32,11 @@ public class Client extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.IceSSL.configuration");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.IceSSL.configuration");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/IceSSL/configuration/PasswordCallbackI.java b/java/test/src/main/java/test/IceSSL/configuration/PasswordCallbackI.java
index c4a3011911d..f4491e7769f 100644
--- a/java/test/src/main/java/test/IceSSL/configuration/PasswordCallbackI.java
+++ b/java/test/src/main/java/test/IceSSL/configuration/PasswordCallbackI.java
@@ -9,37 +9,32 @@
package test.IceSSL.configuration;
-public class PasswordCallbackI implements IceSSL.PasswordCallback
+public class PasswordCallbackI implements com.zeroc.IceSSL.PasswordCallback
{
- public
- PasswordCallbackI()
+ public PasswordCallbackI()
{
_password = "password";
}
- public
- PasswordCallbackI(String password)
+ public PasswordCallbackI(String password)
{
_password = password;
}
@Override
- public char[]
- getPassword(String alias)
+ public char[] getPassword(String alias)
{
return _password.toCharArray();
}
@Override
- public char[]
- getTruststorePassword()
+ public char[] getTruststorePassword()
{
return null;
}
@Override
- public char[]
- getKeystorePassword()
+ public char[] getKeystorePassword()
{
return null;
}
diff --git a/java/test/src/main/java/test/IceSSL/configuration/Server.java b/java/test/src/main/java/test/IceSSL/configuration/Server.java
index 54aeb9a9f0f..86d5ae85f3a 100644
--- a/java/test/src/main/java/test/IceSSL/configuration/Server.java
+++ b/java/test/src/main/java/test/IceSSL/configuration/Server.java
@@ -9,16 +9,15 @@
package test.IceSSL.configuration;
-
public class Server extends test.Util.Application
{
@Override
public int run(String[] args)
{
- Ice.Communicator communicator = communicator();
+ com.zeroc.Ice.Communicator communicator = communicator();
communicator.getProperties().setProperty("TestAdapter.Endpoints", "tcp -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Identity id = Ice.Util.stringToIdentity("factory");
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ com.zeroc.Ice.Identity id = com.zeroc.Ice.Util.stringToIdentity("factory");
adapter.add(new ServerFactoryI(), id);
adapter.activate();
@@ -27,12 +26,11 @@ public class Server extends test.Util.Application
}
@Override
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- Ice.InitializationData initData = createInitializationData() ;
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Package.Test", "test.IceSSL.configuration");
- return initData;
+ GetInitDataResult r = super.getInitData(args);
+ r.initData.properties.setProperty("Ice.Package.Test", "test.IceSSL.configuration");
+ return r;
}
public static void main(String[] args)
diff --git a/java/test/src/main/java/test/IceSSL/configuration/ServerFactoryI.java b/java/test/src/main/java/test/IceSSL/configuration/ServerFactoryI.java
index 6acd389c8fd..c73417e70ae 100644
--- a/java/test/src/main/java/test/IceSSL/configuration/ServerFactoryI.java
+++ b/java/test/src/main/java/test/IceSSL/configuration/ServerFactoryI.java
@@ -9,13 +9,11 @@
package test.IceSSL.configuration;
import test.IceSSL.configuration.Test.ServerPrx;
-import test.IceSSL.configuration.Test.ServerPrxHelper;
-import test.IceSSL.configuration.Test._ServerFactoryDisp;
+import test.IceSSL.configuration.Test.ServerFactory;
-class ServerFactoryI extends _ServerFactoryDisp
+class ServerFactoryI implements ServerFactory
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -24,32 +22,30 @@ class ServerFactoryI extends _ServerFactoryDisp
}
@Override
- public ServerPrx
- createServer(java.util.Map<String, String> props, Ice.Current current)
+ public ServerPrx createServer(java.util.Map<String, String> props, com.zeroc.Ice.Current current)
{
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties();
+ com.zeroc.Ice.InitializationData initData = new com.zeroc.Ice.InitializationData();
+ initData.properties = com.zeroc.Ice.Util.createProperties();
for(java.util.Map.Entry<String, String> i : props.entrySet())
{
initData.properties.setProperty(i.getKey(), i.getValue());
}
String[] args = new String[0];
- Ice.Communicator communicator = Ice.Util.initialize(args, initData);
- Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("ServerAdapter", "ssl");
- ServerI server = new ServerI(communicator);
- Ice.ObjectPrx obj = adapter.addWithUUID(server);
+ com.zeroc.Ice.Util.InitializeResult ir = com.zeroc.Ice.Util.initialize(args, initData);
+ com.zeroc.Ice.ObjectAdapter adapter = ir.communicator.createObjectAdapterWithEndpoints("ServerAdapter", "ssl");
+ ServerI server = new ServerI(ir.communicator);
+ com.zeroc.Ice.ObjectPrx obj = adapter.addWithUUID(server);
_servers.put(obj.ice_getIdentity(), server);
adapter.activate();
- return ServerPrxHelper.uncheckedCast(obj);
+ return ServerPrx.uncheckedCast(obj);
}
@Override
- public void
- destroyServer(ServerPrx srv, Ice.Current current)
+ public void destroyServer(ServerPrx srv, com.zeroc.Ice.Current current)
{
- Ice.Identity key = srv.ice_getIdentity();
+ com.zeroc.Ice.Identity key = srv.ice_getIdentity();
if(_servers.containsKey(key))
{
ServerI server = _servers.get(key);
@@ -59,12 +55,12 @@ class ServerFactoryI extends _ServerFactoryDisp
}
@Override
- public void
- shutdown(Ice.Current current)
+ public void shutdown(com.zeroc.Ice.Current current)
{
test(_servers.size() == 0);
current.adapter.getCommunicator().shutdown();
}
- private java.util.Map<Ice.Identity, ServerI> _servers = new java.util.HashMap<Ice.Identity, ServerI>();
+ private java.util.Map<com.zeroc.Ice.Identity, ServerI> _servers =
+ new java.util.HashMap<com.zeroc.Ice.Identity, ServerI>();
}
diff --git a/java/test/src/main/java/test/IceSSL/configuration/ServerI.java b/java/test/src/main/java/test/IceSSL/configuration/ServerI.java
index b81f9212d1b..2059924c37b 100644
--- a/java/test/src/main/java/test/IceSSL/configuration/ServerI.java
+++ b/java/test/src/main/java/test/IceSSL/configuration/ServerI.java
@@ -8,25 +8,25 @@
// **********************************************************************
package test.IceSSL.configuration;
-import test.IceSSL.configuration.Test._ServerDisp;
-class ServerI extends _ServerDisp
+import test.IceSSL.configuration.Test.Server;
+
+class ServerI implements Server
{
- ServerI(Ice.Communicator communicator)
+ ServerI(com.zeroc.Ice.Communicator communicator)
{
_communicator = communicator;
}
@Override
- public void
- noCert(Ice.Current current)
+ public void noCert(com.zeroc.Ice.Current current)
{
try
{
- IceSSL.NativeConnectionInfo info = (IceSSL.NativeConnectionInfo)current.con.getInfo();
+ com.zeroc.IceSSL.NativeConnectionInfo info = (com.zeroc.IceSSL.NativeConnectionInfo)current.con.getInfo();
test(info.certs == null);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
@@ -34,46 +34,43 @@ class ServerI extends _ServerDisp
@Override
public void
- checkCert(String subjectDN, String issuerDN, Ice.Current current)
+ checkCert(String subjectDN, String issuerDN, com.zeroc.Ice.Current current)
{
try
{
- IceSSL.NativeConnectionInfo info = (IceSSL.NativeConnectionInfo)current.con.getInfo();
+ com.zeroc.IceSSL.NativeConnectionInfo info = (com.zeroc.IceSSL.NativeConnectionInfo)current.con.getInfo();
java.security.cert.X509Certificate cert = (java.security.cert.X509Certificate)info.nativeCerts[0];
test(info.verified);
test(info.nativeCerts.length == 2 &&
cert.getSubjectDN().toString().equals(subjectDN) &&
cert.getIssuerDN().toString().equals(issuerDN));
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
}
@Override
- public void
- checkCipher(String cipher, Ice.Current current)
+ public void checkCipher(String cipher, com.zeroc.Ice.Current current)
{
try
{
- IceSSL.NativeConnectionInfo info = (IceSSL.NativeConnectionInfo)current.con.getInfo();
+ com.zeroc.IceSSL.NativeConnectionInfo info = (com.zeroc.IceSSL.NativeConnectionInfo)current.con.getInfo();
test(info.cipher.indexOf(cipher) >= 0);
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
test(false);
}
}
- public void
- destroy()
+ public void destroy()
{
_communicator.destroy();
}
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -81,5 +78,5 @@ class ServerI extends _ServerDisp
}
}
- private Ice.Communicator _communicator;
+ private com.zeroc.Ice.Communicator _communicator;
}
diff --git a/java/test/src/main/java/test/IceUtil/inputUtil/Client.java b/java/test/src/main/java/test/IceUtil/inputUtil/Client.java
index e5414ed48dc..86d621f9dcf 100644
--- a/java/test/src/main/java/test/IceUtil/inputUtil/Client.java
+++ b/java/test/src/main/java/test/IceUtil/inputUtil/Client.java
@@ -9,10 +9,12 @@
package test.IceUtil.inputUtil;
+import com.zeroc.IceUtilInternal.Options;
+import com.zeroc.IceUtilInternal.StringUtil;
+
public class Client
{
- private static void
- test(boolean b)
+ private static void test(boolean b)
{
if(!b)
{
@@ -20,8 +22,7 @@ public class Client
}
}
- public static void
- main(String[] argvs)
+ public static void main(String[] argvs)
{
System.out.print("testing string to command line arguments... ");
System.out.flush();
@@ -29,59 +30,59 @@ public class Client
try
{
- test(IceUtilInternal.Options.split("").length == 0);
-
- args = IceUtilInternal.Options.split("\"\"");
+ test(Options.split("").length == 0);
+
+ args = Options.split("\"\"");
test(args.length == 1 && args[0].equals(""));
- args = IceUtilInternal.Options.split("''");
+ args = Options.split("''");
test(args.length == 1 && args[0].equals(""));
- args = IceUtilInternal.Options.split("$''");
+ args = Options.split("$''");
test(args.length == 1 && args[0].equals(""));
- args = IceUtilInternal.Options.split("-a -b -c");
+ args = Options.split("-a -b -c");
test(args.length == 3 && args[0].equals("-a") && args[1].equals("-b") && args[2].equals("-c"));
- args = IceUtilInternal.Options.split("\"-a\" '-b' $'-c'");
+ args = Options.split("\"-a\" '-b' $'-c'");
test(args.length == 3 && args[0].equals("-a") && args[1].equals("-b") && args[2].equals("-c"));
- args = IceUtilInternal.Options.split(" '-b' \"-a\" $'-c' ");
+ args = Options.split(" '-b' \"-a\" $'-c' ");
test(args.length == 3 && args[0].equals("-b") && args[1].equals("-a") && args[2].equals("-c"));
- args = IceUtilInternal.Options.split(" $'-c' '-b' \"-a\" ");
+ args = Options.split(" $'-c' '-b' \"-a\" ");
test(args.length == 3 && args[0].equals("-c") && args[1].equals("-b") && args[2].equals("-a"));
// Testing single quote
- args = IceUtilInternal.Options.split("-Dir='C:\\\\test\\\\file'"); // -Dir='C:\\test\\file'
+ args = Options.split("-Dir='C:\\\\test\\\\file'"); // -Dir='C:\\test\\file'
test(args.length == 1 && args[0].equals("-Dir=C:\\\\test\\\\file")); // -Dir=C:\\test\\file
- args = IceUtilInternal.Options.split("-Dir='C:\\test\\file'"); // -Dir='C:\test\file'
+ args = Options.split("-Dir='C:\\test\\file'"); // -Dir='C:\test\file'
test(args.length == 1 && args[0].equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file
- args = IceUtilInternal.Options.split("-Dir='C:\\test\\filewith\"quote'"); // -Dir='C:\test\filewith"quote'
+ args = Options.split("-Dir='C:\\test\\filewith\"quote'"); // -Dir='C:\test\filewith"quote'
test(args.length == 1 && args[0].equals("-Dir=C:\\test\\filewith\"quote")); // -Dir=C:\test\filewith"quote
// Testing double quote
- args = IceUtilInternal.Options.split("-Dir=\"C:\\\\test\\\\file\""); // -Dir="C:\\test\\file"
+ args = Options.split("-Dir=\"C:\\\\test\\\\file\""); // -Dir="C:\\test\\file"
test(args.length == 1 && args[0].equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file
- args = IceUtilInternal.Options.split("-Dir=\"C:\\test\\file\""); // -Dir="C:\test\file"
+ args = Options.split("-Dir=\"C:\\test\\file\""); // -Dir="C:\test\file"
test(args.length == 1 && args[0].equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file
- args = IceUtilInternal.Options.split("-Dir=\"C:\\test\\filewith\\\"quote\""); // -Dir="C:\test\filewith\"quote"
+ args = Options.split("-Dir=\"C:\\test\\filewith\\\"quote\""); // -Dir="C:\test\filewith\"quote"
test(args.length == 1 && args[0].equals("-Dir=C:\\test\\filewith\"quote")); // -Dir=C:\test\filewith"quote
// Testing ANSI quote
- args = IceUtilInternal.Options.split("-Dir=$'C:\\\\test\\\\file'"); // -Dir=$'C:\\test\\file'
+ args = Options.split("-Dir=$'C:\\\\test\\\\file'"); // -Dir=$'C:\\test\\file'
test(args.length == 1 && args[0].equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file
- args = IceUtilInternal.Options.split("-Dir=$'C:\\oest\\oile'"); // -Dir='C:\oest\oile'
+ args = Options.split("-Dir=$'C:\\oest\\oile'"); // -Dir='C:\oest\oile'
test(args.length == 1 && args[0].equals("-Dir=C:\\oest\\oile")); // -Dir=C:\oest\oile
- args = IceUtilInternal.Options.split("-Dir=$'C:\\oest\\oilewith\"quote'"); // -Dir=$'C:\oest\oilewith"quote'
+ args = Options.split("-Dir=$'C:\\oest\\oilewith\"quote'"); // -Dir=$'C:\oest\oilewith"quote'
test(args.length == 1 && args[0].equals("-Dir=C:\\oest\\oilewith\"quote")); // -Dir=C:\oest\oilewith"quote
- args = IceUtilInternal.Options.split("-Dir=$'\\103\\072\\134\\164\\145\\163\\164\\134\\146\\151\\154\\145'");
+ args = Options.split("-Dir=$'\\103\\072\\134\\164\\145\\163\\164\\134\\146\\151\\154\\145'");
test(args.length == 1 && args[0].equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file
- args = IceUtilInternal.Options.split("-Dir=$'\\x43\\x3A\\x5C\\x74\\x65\\x73\\x74\\x5C\\x66\\x69\\x6C\\x65'");
+ args = Options.split("-Dir=$'\\x43\\x3A\\x5C\\x74\\x65\\x73\\x74\\x5C\\x66\\x69\\x6C\\x65'");
test(args.length == 1 && args[0].equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file
- args = IceUtilInternal.Options.split("-Dir=$'\\cM\\c_'"); // Control characters
+ args = Options.split("-Dir=$'\\cM\\c_'"); // Control characters
test(args.length == 1 && args[0].equals("-Dir=\015\037"));
- args = IceUtilInternal.Options.split("-Dir=$'C:\\\\\\146\\x66\\cMi'"); // -Dir=$'C:\\\146\x66i\cMi'
+ args = Options.split("-Dir=$'C:\\\\\\146\\x66\\cMi'"); // -Dir=$'C:\\\146\x66i\cMi'
test(args.length == 1 && args[0].equals("-Dir=C:\\ff\015i"));
- args = IceUtilInternal.Options.split("-Dir=$'C:\\\\\\cM\\x66\\146i'"); // -Dir=$'C:\\\cM\x66\146i'
+ args = Options.split("-Dir=$'C:\\\\\\cM\\x66\\146i'"); // -Dir=$'C:\\\cM\x66\146i'
test(args.length == 1 && args[0].equals("-Dir=C:\\\015ffi"));
}
- catch(IceUtilInternal.Options.BadQuote ex)
+ catch(Options.BadQuote ex)
{
test(false);
}
@@ -97,10 +98,10 @@ public class Client
{
try
{
- IceUtilInternal.Options.split(badQuoteCommands[i]);
+ Options.split(badQuoteCommands[i]);
test(false);
}
- catch(IceUtilInternal.Options.BadQuote ex)
+ catch(Options.BadQuote ex)
{
}
}
@@ -112,57 +113,57 @@ public class Client
{
String[] arr;
- arr = IceUtilInternal.StringUtil.splitString("", "");
+ arr = StringUtil.splitString("", "");
test(arr.length == 0);
- arr = IceUtilInternal.StringUtil.splitString("", ":");
+ arr = StringUtil.splitString("", ":");
test(arr.length == 0);
- arr = IceUtilInternal.StringUtil.splitString("a", "");
+ arr = StringUtil.splitString("a", "");
test(arr.length == 1 && arr[0].equals("a"));
- arr = IceUtilInternal.StringUtil.splitString("a", ":");
+ arr = StringUtil.splitString("a", ":");
test(arr.length == 1 && arr[0].equals("a"));
- arr = IceUtilInternal.StringUtil.splitString("ab", "");
+ arr = StringUtil.splitString("ab", "");
test(arr.length == 1 && arr[0].equals("ab"));
- arr = IceUtilInternal.StringUtil.splitString("ab:", ":");
+ arr = StringUtil.splitString("ab:", ":");
test(arr.length == 1 && arr[0].equals("ab"));
- arr = IceUtilInternal.StringUtil.splitString(":ab", ":");
+ arr = StringUtil.splitString(":ab", ":");
test(arr.length == 1 && arr[0].equals("ab"));
- arr = IceUtilInternal.StringUtil.splitString("a:b", ":");
+ arr = StringUtil.splitString("a:b", ":");
test(arr.length == 2 && arr[0].equals("a") && arr[1].equals("b"));
- arr = IceUtilInternal.StringUtil.splitString(":a:b:", ":");
+ arr = StringUtil.splitString(":a:b:", ":");
test(arr.length == 2 && arr[0].equals("a") && arr[1].equals("b"));
-
- arr = IceUtilInternal.StringUtil.splitString("\"a\"", ":");
+
+ arr = StringUtil.splitString("\"a\"", ":");
test(arr.length == 1 && arr[0].equals("a"));
- arr = IceUtilInternal.StringUtil.splitString("\"a\":b", ":");
+ arr = StringUtil.splitString("\"a\":b", ":");
test(arr.length == 2 && arr[0].equals("a") && arr[1].equals("b"));
- arr = IceUtilInternal.StringUtil.splitString("\"a\":\"b\"", ":");
+ arr = StringUtil.splitString("\"a\":\"b\"", ":");
test(arr.length == 2 && arr[0].equals("a") && arr[1].equals("b"));
- arr = IceUtilInternal.StringUtil.splitString("\"a:b\"", ":");
+ arr = StringUtil.splitString("\"a:b\"", ":");
test(arr.length == 1 && arr[0].equals("a:b"));
- arr = IceUtilInternal.StringUtil.splitString("a=\"a:b\"", ":");
+ arr = StringUtil.splitString("a=\"a:b\"", ":");
test(arr.length == 1 && arr[0].equals("a=a:b"));
- arr = IceUtilInternal.StringUtil.splitString("'a'", ":");
+ arr = StringUtil.splitString("'a'", ":");
test(arr.length == 1 && arr[0].equals("a"));
- arr = IceUtilInternal.StringUtil.splitString("'\"a'", ":");
+ arr = StringUtil.splitString("'\"a'", ":");
test(arr.length == 1 && arr[0].equals("\"a"));
- arr = IceUtilInternal.StringUtil.splitString("\"'a\"", ":");
+ arr = StringUtil.splitString("\"'a\"", ":");
test(arr.length == 1 && arr[0].equals("'a"));
-
- arr = IceUtilInternal.StringUtil.splitString("a\\'b", ":");
+
+ arr = StringUtil.splitString("a\\'b", ":");
test(arr.length == 1 && arr[0].equals("a'b"));
- arr = IceUtilInternal.StringUtil.splitString("'a:b\\'c'", ":");
+ arr = StringUtil.splitString("'a:b\\'c'", ":");
test(arr.length == 1 && arr[0].equals("a:b'c"));
- arr = IceUtilInternal.StringUtil.splitString("a\\\"b", ":");
+ arr = StringUtil.splitString("a\\\"b", ":");
test(arr.length == 1 && arr[0].equals("a\"b"));
- arr = IceUtilInternal.StringUtil.splitString("\"a:b\\\"c\"", ":");
+ arr = StringUtil.splitString("\"a:b\\\"c\"", ":");
test(arr.length == 1 && arr[0].equals("a:b\"c"));
- arr = IceUtilInternal.StringUtil.splitString("'a:b\"c'", ":");
+ arr = StringUtil.splitString("'a:b\"c'", ":");
test(arr.length == 1 && arr[0].equals("a:b\"c"));
- arr = IceUtilInternal.StringUtil.splitString("\"a:b'c\"", ":");
+ arr = StringUtil.splitString("\"a:b'c\"", ":");
test(arr.length == 1 && arr[0].equals("a:b'c"));
- test(IceUtilInternal.StringUtil.splitString("a\"b", ":") == null);
+ test(StringUtil.splitString("a\"b", ":") == null);
}
System.out.println("ok");
}
diff --git a/java/test/src/main/java/test/Slice/generation/list-generated.out b/java/test/src/main/java/test/Slice/generation/list-generated.out
index cbacf36a41c..adc47f8b79b 100644
--- a/java/test/src/main/java/test/Slice/generation/list-generated.out
+++ b/java/test/src/main/java/test/Slice/generation/list-generated.out
@@ -1,29 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<generated>
<source name="File1.ice">
- <file name="classes/test/Slice/generation/Test/_Interface1Operations.java"/>
- <file name="classes/test/Slice/generation/Test/_Interface1OperationsNC.java"/>
<file name="classes/test/Slice/generation/Test/_Marker.java"/>
<file name="classes/test/Slice/generation/Test/Interface1.java"/>
- <file name="classes/test/Slice/generation/Test/Interface1Holder.java"/>
- <file name="classes/test/Slice/generation/Test/Interface1PrxHolder.java"/>
- <file name="classes/test/Slice/generation/Test/Interface1PrxHelper.java"/>
<file name="classes/test/Slice/generation/Test/Interface1Prx.java"/>
- <file name="classes/test/Slice/generation/Test/_Interface1Disp.java"/>
- <file name="classes/test/Slice/generation/Test/Callback_Interface1_method.java"/>
+ <file name="classes/test/Slice/generation/Test/_Interface1PrxI.java"/>
<output></output>
</source>
<source name="File2.ice">
- <file name="classes/test/Slice/generation/Test/_Interface2Operations.java"/>
- <file name="classes/test/Slice/generation/Test/_Interface2OperationsNC.java"/>
<file name="classes/test/Slice/generation/Test/_Marker.java"/>
<file name="classes/test/Slice/generation/Test/Interface2.java"/>
- <file name="classes/test/Slice/generation/Test/Interface2Holder.java"/>
- <file name="classes/test/Slice/generation/Test/Interface2PrxHolder.java"/>
- <file name="classes/test/Slice/generation/Test/Interface2PrxHelper.java"/>
<file name="classes/test/Slice/generation/Test/Interface2Prx.java"/>
- <file name="classes/test/Slice/generation/Test/_Interface2Disp.java"/>
- <file name="classes/test/Slice/generation/Test/Callback_Interface2_method.java"/>
+ <file name="classes/test/Slice/generation/Test/_Interface2PrxI.java"/>
<output></output>
</source>
</generated>
diff --git a/java/test/src/main/java/test/Slice/keyword/Client.java b/java/test/src/main/java/test/Slice/keyword/Client.java
index c972b6320f1..938c4602398 100644
--- a/java/test/src/main/java/test/Slice/keyword/Client.java
+++ b/java/test/src/main/java/test/Slice/keyword/Client.java
@@ -8,86 +8,78 @@
// **********************************************************************
package test.Slice.keyword;
-import test.Slice.keyword._abstract.AMD_catch_checkedCast;
import test.Slice.keyword._abstract._assert;
import test.Slice.keyword._abstract._break;
import test.Slice.keyword._abstract._catch;
-import test.Slice.keyword._abstract._catchDisp;
import test.Slice.keyword._abstract._default;
-import test.Slice.keyword._abstract._defaultDisp;
import test.Slice.keyword._abstract._else;
+import test.Slice.keyword._abstract._elseDisp;
import test.Slice.keyword._abstract._finalize;
+import test.Slice.keyword._abstract._finalizeDisp;
import test.Slice.keyword._abstract._hashCode;
import test.Slice.keyword._abstract._import;
import test.Slice.keyword._abstract._new;
import test.Slice.keyword._abstract._switch;
import test.Slice.keyword._abstract.catchPrx;
import test.Slice.keyword._abstract.defaultPrx;
-import test.Slice.keyword._abstract.defaultPrxHelper;
import test.Slice.keyword._abstract.elsePrx;
import test.Slice.keyword._abstract.finalizePrx;
-import test.Slice.keyword._abstract.forHolder;
-import test.Slice.keyword._abstract.gotoHolder;
public class Client
{
- static public class catchI extends _catchDisp
+ static public class catchI implements _catch
{
- public
- catchI()
+ public catchI()
{
}
@Override
- public void
- checkedCast_async(AMD_catch_checkedCast __cb, int _clone, Ice.Current __current)
+ public java.util.concurrent.CompletionStage<Integer> checkedCastAsync(int _clone, com.zeroc.Ice.Current current)
{
int _continue = 0;
- __cb.ice_response(_continue);
+ return java.util.concurrent.CompletableFuture.completedFuture(_continue);
}
}
- static public class defaultI extends _defaultDisp
+ static public class defaultI implements _default
{
- public
- defaultI()
+ public defaultI()
{
}
@Override
- public void
- _do(Ice.Current __current)
+ public void _do(com.zeroc.Ice.Current current)
{
- assert __current.operation.equals("do");
+ assert current.operation.equals("do");
}
}
static public class elseI extends _else
{
- public
- elseI()
+ public elseI()
{
}
+ }
+ static public class elseServantI implements _elseDisp
+ {
@Override
- public void
- foo(defaultPrx _equals, Ice.IntHolder _final, Ice.Current __current)
+ public int foo(defaultPrx _equals, com.zeroc.Ice.Current current)
{
+ return 0;
}
}
static public class newI implements _new
{
- public
- newI()
+ public newI()
{
}
@Override
- public _assert
- _notify(_break _notifyAll, _else _null, _finalize _package,
- elsePrx _private, finalizePrx _protected,
- catchPrx _public, defaultPrx _return, int _static, int _strictfp, int _super)
+ public _assert _notify(_break _notifyAll, _else _null, _finalize _package,
+ elsePrx _private, finalizePrx _protected,
+ catchPrx _public, defaultPrx _return, int _static, int _strictfp, int _super)
throws _hashCode, _import
{
return null;
@@ -96,29 +88,29 @@ public class Client
static public class finalizeI extends _finalize
{
- public
- finalizeI()
+ public finalizeI()
{
}
+ }
+ static public class finalizeServantI implements _finalizeDisp
+ {
@Override
- public void
- checkedCast_async(AMD_catch_checkedCast __cb, int _clone, Ice.Current __current)
+ public java.util.concurrent.CompletionStage<Integer> checkedCastAsync(int _clone, com.zeroc.Ice.Current current)
{
int _continue = 0;
- __cb.ice_response(_continue);
+ return java.util.concurrent.CompletableFuture.completedFuture(_continue);
}
@Override
- public void
- _do(Ice.Current __current)
+ public void _do(com.zeroc.Ice.Current current)
{
}
@Override
- public void
- foo(defaultPrx _equals, Ice.IntHolder _final, Ice.Current __current)
+ public int foo(defaultPrx _equals, com.zeroc.Ice.Current current)
{
+ return 0;
}
}
@@ -127,14 +119,13 @@ public class Client
// are named correctly. It is not expected to run.
//
@SuppressWarnings({ "unused", "null" })
- private static void
- testtypes()
+ private static void testtypes()
{
_assert v = _assert._boolean;
_break b = new _break();
b._case = 0;
catchPrx c = null;
- c._checkedCast(0, new Ice.IntHolder());
+ c._checkedCast(0);
_catch c1 = new catchI();
defaultPrx d = null;
d._do();
@@ -142,11 +133,9 @@ public class Client
elsePrx e;
_else e1 = new elseI();
finalizePrx f = null;
- f._checkedCast(0, new Ice.IntHolder());
+ f._checkedCast(0);
f._do();
_finalize f1 = new finalizeI();
- forHolder g;
- gotoHolder h;
_hashCode i = new _hashCode();
i._if = 0;
_import j = new _import();
@@ -157,28 +146,25 @@ public class Client
assert _switch.value == 0;
}
- private static int
- run(String[] args, Ice.Communicator communicator)
+ private static int run(String[] args, com.zeroc.Ice.Communicator communicator)
{
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- adapter.add(new defaultI(), Ice.Util.stringToIdentity("test"));
+ com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new defaultI(), com.zeroc.Ice.Util.stringToIdentity("test"));
adapter.activate();
System.out.print("Testing operation name... ");
System.out.flush();
- defaultPrx p = defaultPrxHelper.uncheckedCast(
- adapter.createProxy(Ice.Util.stringToIdentity("test")));
+ defaultPrx p = defaultPrx.uncheckedCast(adapter.createProxy(com.zeroc.Ice.Util.stringToIdentity("test")));
p._do();
System.out.println("ok");
return 0;
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
int status = 0;
- Ice.Communicator communicator = null;
+ com.zeroc.Ice.Communicator communicator = null;
try
{
@@ -186,9 +172,9 @@ public class Client
// In this test, we need at least two threads in the
// client side thread pool for nested AMI.
//
- Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
+ com.zeroc.Ice.Util.CreatePropertiesResult cpr = com.zeroc.Ice.Util.createProperties(args);
+ com.zeroc.Ice.InitializationData initData = new com.zeroc.Ice.InitializationData();
+ initData.properties = cpr.properties;
initData.properties.setProperty("Ice.Package._abstract", "test.Slice.keyword");
initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2");
initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0");
@@ -201,8 +187,9 @@ public class Client
//
initData.properties.setProperty("Ice.MessageSizeMax", "100");
- communicator = Ice.Util.initialize(argsH, initData);
- status = run(argsH.value, communicator);
+ com.zeroc.Ice.Util.InitializeResult ir = com.zeroc.Ice.Util.initialize(cpr.args, initData);
+ communicator = ir.communicator;
+ status = run(ir.args, communicator);
}
catch(Exception ex)
{
@@ -216,7 +203,7 @@ public class Client
{
communicator.destroy();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
status = 1;
diff --git a/java/test/src/main/java/test/Slice/keyword/Key.ice b/java/test/src/main/java/test/Slice/keyword/Key.ice
index 2f0e36ae3f0..f7e5dfc54e9 100644
--- a/java/test/src/main/java/test/Slice/keyword/Key.ice
+++ b/java/test/src/main/java/test/Slice/keyword/Key.ice
@@ -58,7 +58,7 @@ exception import extends hashCode
local interface new
{
- assert notify( break notifyAll, else null, finalize package, else* private, finalize * protected, catch* public,
+ assert notify(break notifyAll, else null, finalize package, else* private, finalize* protected, catch* public,
default* return, int static, int strictfp, int super)
throws hashCode, import;
};
diff --git a/java/test/src/main/java/test/Slice/macros/Client.java b/java/test/src/main/java/test/Slice/macros/Client.java
index 8a9cf97d3d9..3168ace3065 100644
--- a/java/test/src/main/java/test/Slice/macros/Client.java
+++ b/java/test/src/main/java/test/Slice/macros/Client.java
@@ -23,8 +23,7 @@ public class Client
}
}
- public static void
- main(String[] args)
+ public static void main(String[] args)
{
int status = 0;
try
@@ -40,7 +39,7 @@ public class Client
JavaOnly c = new JavaOnly();
test(c.lang.equals("java"));
- test(c.version == Ice.Util.intVersion());
+ test(c.version == com.zeroc.Ice.Util.intVersion());
System.out.println("ok");
}
catch(Exception ex)
diff --git a/java/test/src/main/java/test/Slice/structure/Client.java b/java/test/src/main/java/test/Slice/structure/Client.java
index ede1f92c0c8..c3fae044cf8 100644
--- a/java/test/src/main/java/test/Slice/structure/Client.java
+++ b/java/test/src/main/java/test/Slice/structure/Client.java
@@ -26,7 +26,7 @@ public class Client
}
}
- private static void allTests(Ice.Communicator communicator)
+ private static void allTests(com.zeroc.Ice.Communicator communicator)
{
System.out.print("testing equals() for Slice structures... ");
System.out.flush();
@@ -37,13 +37,13 @@ public class Client
C def_cls = new C(5);
S1 def_s = new S1("name");
String[] def_ss = new String[]{ "one", "two", "three" };
- ArrayList<Integer> def_il = new ArrayList<Integer>();
+ ArrayList<Integer> def_il = new ArrayList<>();
def_il.add(1);
def_il.add(2);
def_il.add(3);
- Map<String, String> def_sd = new HashMap<String, String>();
+ Map<String, String> def_sd = new HashMap<>();
def_sd.put("abc", "def");
- Ice.ObjectPrx def_prx = communicator.stringToProxy("test");
+ com.zeroc.Ice.ObjectPrx def_prx = communicator.stringToProxy("test");
S2 def_s2 = new S2(true, (byte)98, (short)99, 100, 101, (float)1.0, 2.0, "string", def_ss, def_il, def_sd,
def_s, def_cls, def_prx);
@@ -151,11 +151,11 @@ public class Client
S2 v1, v2;
v1 = def_s2.clone();
- v1.il = new ArrayList<Integer>(def_s2.il);
+ v1.il = new ArrayList<>(def_s2.il);
test(v1.equals(def_s2));
v1 = def_s2.clone();
- v1.il = new ArrayList<Integer>();
+ v1.il = new ArrayList<>();
test(!v1.equals(def_s2));
v1 = def_s2.clone();
@@ -176,11 +176,11 @@ public class Client
S2 v1, v2;
v1 = def_s2.clone();
- v1.sd = new HashMap<String, String>(def_s2.sd);
+ v1.sd = new HashMap<>(def_s2.sd);
test(v1.equals(def_s2));
v1 = def_s2.clone();
- v1.sd = new HashMap<String, String>();
+ v1.sd = new HashMap<>();
test(!v1.equals(def_s2));
v1 = def_s2.clone();
@@ -272,7 +272,7 @@ public class Client
System.out.println("ok");
}
- private static int run(String[] args, Ice.Communicator communicator)
+ private static int run(String[] args, com.zeroc.Ice.Communicator communicator)
{
allTests(communicator);
@@ -282,13 +282,13 @@ public class Client
public static void main(String[] args)
{
int status = 0;
- Ice.Communicator communicator = null;
+ com.zeroc.Ice.Communicator communicator = null;
try
{
- Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
- communicator = Ice.Util.initialize(argsH);
- status = run(argsH.value, communicator);
+ com.zeroc.Ice.Util.InitializeResult ir = com.zeroc.Ice.Util.initialize(args);
+ communicator = ir.communicator;
+ status = run(ir.args, communicator);
}
catch(Exception ex)
{
@@ -302,7 +302,7 @@ public class Client
{
communicator.destroy();
}
- catch(Ice.LocalException ex)
+ catch(com.zeroc.Ice.LocalException ex)
{
ex.printStackTrace();
status = 1;
diff --git a/java/test/src/main/java/test/Util/Application.java b/java/test/src/main/java/test/Util/Application.java
index 5c072418482..3ccff95fb55 100644
--- a/java/test/src/main/java/test/Util/Application.java
+++ b/java/test/src/main/java/test/Util/Application.java
@@ -9,14 +9,12 @@
package test.Util;
-import Ice.*;
+import com.zeroc.Ice.*;
public abstract class Application
{
public final int WAIT = 2;
-
-
public interface ServerReadyListener
{
void serverReady();
@@ -27,11 +25,16 @@ public abstract class Application
void communicatorInitialized(Communicator c);
}
- public
- Application()
+ public Application()
{
}
+ static public class GetInitDataResult
+ {
+ public InitializationData initData;
+ public String[] args;
+ }
+
//
// This main() must be called by the global main(). main()
// initializes the Communicator, calls run(), and destroys
@@ -40,17 +43,14 @@ public abstract class Application
// if exceptions propagate to main(), and the Communicator is
// always destroyed, regardless of exceptions.
//
- public final int
- main(String appName, String[] args)
+ public final int main(String appName, String[] args)
{
- Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
- Ice.InitializationData initData = getInitData(argsH);
- initData.classLoader = _classLoader;
- return main(appName, argsH.value, initData);
+ GetInitDataResult r = getInitData(args);
+ r.initData.classLoader = _classLoader;
+ return main(appName, r.args, r.initData);
}
- public final int
- main(String appName, String[] args, InitializationData initializationData)
+ public final int main(String appName, String[] args, InitializationData initializationData)
{
java.io.PrintWriter writer = getWriter();
if(_communicator != null)
@@ -64,10 +64,11 @@ public abstract class Application
//
// We parse the properties here to extract Ice.ProgramName.
//
- StringSeqHolder argHolder = new StringSeqHolder(args);
if(initializationData == null)
{
- initializationData = getInitData(argHolder);
+ GetInitDataResult r = getInitData(args);
+ initializationData = r.initData;
+ args = r.args;
}
InitializationData initData;
@@ -79,7 +80,8 @@ public abstract class Application
{
initData = new InitializationData();
}
- initData.properties = Util.createProperties(argHolder, initData.properties);
+ Util.CreatePropertiesResult cpr = Util.createProperties(args, initData.properties);
+ initData.properties = cpr.properties;
//
// If the process logger is the default logger, we replace it with a
@@ -94,12 +96,13 @@ public abstract class Application
try
{
- _communicator = Util.initialize(argHolder, initData);
+ Util.InitializeResult ir = Util.initialize(cpr.args, initData);
+ _communicator = ir.communicator;
if(_communicatorListener != null)
{
_communicatorListener.communicatorInitialized(_communicator);
}
- status = run(argHolder.value);
+ status = run(ir.args);
if(status == WAIT)
{
if(_cb != null)
@@ -169,9 +172,9 @@ public abstract class Application
//
// Initialize a new communicator.
//
- public Ice.Communicator initialize(InitializationData initData)
+ public Communicator initialize(InitializationData initData)
{
- Ice.Communicator communicator = Util.initialize(initData);
+ Communicator communicator = Util.initialize(initData);
if(_communicatorListener != null)
{
_communicatorListener.communicatorInitialized(communicator);
@@ -179,9 +182,9 @@ public abstract class Application
return communicator;
}
- public Ice.Communicator initialize()
+ public Communicator initialize()
{
- Ice.Communicator communicator = Util.initialize();
+ Communicator communicator = Util.initialize();
if(_communicatorListener != null)
{
_communicatorListener.communicatorInitialized(communicator);
@@ -196,9 +199,14 @@ public abstract class Application
// necessary because some properties must be set prior to
// communicator initialization.
//
- protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH)
+ protected GetInitDataResult getInitData(String[] args)
{
- return createInitializationData();
+ GetInitDataResult r = new GetInitDataResult();
+ r.initData = createInitializationData();
+ com.zeroc.Ice.Util.CreatePropertiesResult cpr = com.zeroc.Ice.Util.createProperties(args);
+ r.initData.properties = cpr.properties;
+ r.args = cpr.args;
+ return r;
}
public java.io.PrintWriter getWriter()
@@ -211,7 +219,7 @@ public abstract class Application
_printWriter = new java.io.PrintWriter(writer);
}
- public void setLogger(Ice.Logger logger)
+ public void setLogger(com.zeroc.Ice.Logger logger)
{
_logger = logger;
}
@@ -236,7 +244,7 @@ public abstract class Application
static public boolean isAndroid()
{
- return IceInternal.Util.isAndroid();
+ return com.zeroc.IceInternal.Util.isAndroid();
}
//
// Return the application name, i.e., argv[0].
@@ -263,7 +271,7 @@ public abstract class Application
public InitializationData createInitializationData()
{
- Ice.InitializationData initData = new Ice.InitializationData();
+ InitializationData initData = new InitializationData();
initData.classLoader = _classLoader;
initData.logger = _logger;
return initData;
@@ -277,7 +285,7 @@ public abstract class Application
private ClassLoader _classLoader;
private String _testName;
private Communicator _communicator;
- private Ice.Logger _logger = null;
+ private Logger _logger = null;
private java.io.PrintWriter _printWriter = new java.io.PrintWriter(new java.io.OutputStreamWriter(System.out));
private ServerReadyListener _cb = null;
private CommunicatorListener _communicatorListener = null;
diff --git a/scripts/IceGridAdmin.py b/scripts/IceGridAdmin.py
index 854dc3b25e0..f020d088865 100644
--- a/scripts/IceGridAdmin.py
+++ b/scripts/IceGridAdmin.py
@@ -229,7 +229,7 @@ def iceGridTest(application, additionalOptions = "", applicationOptions = ""):
return
client = TestUtil.getDefaultClientFile()
- if TestUtil.getDefaultMapping() != "java":
+ if TestUtil.getDefaultMapping() != "java" and TestUtil.getDefaultMapping() != "java-compat":
client = os.path.join(testdir, client)
clientOptions = ' ' + getDefaultLocatorProperty() + ' ' + additionalOptions
@@ -283,7 +283,7 @@ def iceGridClientServerTest(additionalClientOptions, additionalServerOptions):
testdir = os.getcwd()
server = TestUtil.getDefaultServerFile()
client = TestUtil.getDefaultClientFile()
- if TestUtil.getDefaultMapping() != "java":
+ if TestUtil.getDefaultMapping() != "java" and TestUtil.getDefaultMapping() != "java-compat":
server = os.path.join(testdir, server)
client = os.path.join(testdir, client)
diff --git a/scripts/TestUtil.py b/scripts/TestUtil.py
index 28e17e7279e..f6c34e4a185 100755
--- a/scripts/TestUtil.py
+++ b/scripts/TestUtil.py
@@ -290,7 +290,7 @@ def dumpenv(env, lang):
vars.extend(["CLASSPATH", "MONO_PATH", "DEVPATH", "PYTHONPATH", "RUBYLIB"])
elif lang == "cpp":
pass
- elif lang == "java":
+ elif lang == "java" or lang == "java-compat":
vars.append("CLASSPATH")
elif lang == "csharp":
vars.extend(["MONO_PATH", "DEVPATH"])
@@ -547,7 +547,7 @@ def run(tests, root = False):
filters.append((testFilter, False))
elif o == "--cross":
global cross
- crossLang = ["cpp", "csharp", "java", "js", "php", "python", "ruby", "objective-c"]
+ crossLang = ["cpp", "csharp", "java", "java-compat" "js", "php", "python", "ruby", "objective-c"]
if a not in crossLang:
print("cross must be one of %s" % ', '.join(crossLang))
sys.exit(1)
@@ -636,7 +636,7 @@ def run(tests, root = False):
if allCross:
if len(cross) == 0:
- cross = ["cpp", "java", "js", "php", "python", "ruby"]
+ cross = ["cpp", "java", "java-compat", "js", "php", "python", "ruby"]
if isWin32():
cross.append("csharp")
@@ -650,7 +650,7 @@ def run(tests, root = False):
if isDarwin():
cross.append("objective-c")
if root:
- allLang = ["cpp", "java", "js", "python"]
+ allLang = ["cpp", "java", "java-compat", "js", "python"]
if isWin32():
allLang.append("csharp")
if isDarwin():
@@ -859,6 +859,8 @@ def getIceBox():
iceBox += "++11"
iceBox = os.path.join(getCppBinDir(lang), iceBox)
elif lang == "java":
+ iceBox = "com.zeroc.IceBox.Server"
+ elif lang == "java-compat":
iceBox = "IceBox.Server"
elif lang == "csharp":
iceBox = os.path.join(getIceDir("csharp"), "bin", "iceboxnet")
@@ -867,6 +869,8 @@ def getIceBox():
def getIceBoxAdmin():
if getDefaultMapping() == "java":
+ return "com.zeroc.IceBox.Admin"
+ elif getDefaultMapping() == "java-compat":
return "IceBox.Admin"
else:
return getIceExe("iceboxadmin")
@@ -938,6 +942,13 @@ sslConfigTree = {
"colloc" : " --IceSSL.CertFile=client.p12"
},
"java" : {
+ "plugin" : " --Ice.Plugin.IceSSL=com.zeroc.IceSSL.PluginFactory " +
+ "--IceSSL.DefaultDir=%(certsdir)s --IceSSL.Password=password --IceSSL.VerifyPeer=%(verifyPeer)s",
+ "client" : " --IceSSL.Keystore=client.jks",
+ "server" : " --IceSSL.Keystore=server.jks",
+ "colloc" : " --IceSSL.Keystore=client.jks"
+ },
+ "java-compat" : {
"plugin" : " --Ice.Plugin.IceSSL=IceSSL.PluginFactory " +
"--IceSSL.DefaultDir=%(certsdir)s --IceSSL.Password=password --IceSSL.VerifyPeer=%(verifyPeer)s",
"client" : " --IceSSL.Keystore=client.jks",
@@ -962,8 +973,9 @@ if isWin32():
#
# This cipher suites doesn't work well between Java and SChannel TLS1.2 implementations.
#
- sslConfigTree["java"]["client"] += " --IceSSL.Ciphers=!TLS_DHE_RSA_WITH_AES_128_GCM_SHA256"
- sslConfigTree["java"]["server"] += " --IceSSL.Ciphers=!TLS_DHE_RSA_WITH_AES_128_GCM_SHA256"
+ for lang in ["java", "java-compat"]:
+ sslConfigTree[lang]["client"] += " --IceSSL.Ciphers=!TLS_DHE_RSA_WITH_AES_128_GCM_SHA256"
+ sslConfigTree[lang]["server"] += " --IceSSL.Ciphers=!TLS_DHE_RSA_WITH_AES_128_GCM_SHA256"
sslConfigTree["python"] = sslConfigTree["cpp"]
sslConfigTree["ruby"] = sslConfigTree["cpp"]
@@ -972,10 +984,11 @@ sslConfigTree["objective-c"] = sslConfigTree["cpp"]
def getDefaultMapping():
"""Try to guess the language mapping from the current path"""
- here = os.getcwd().split(os.sep)
- here.reverse()
+ # here = os.getcwd().split(os.sep)
+ # here.reverse()
+ here = os.path.relpath(os.getcwd(), start=toplevel).split(os.sep)
for i in range(0, len(here)):
- if here[i] in ["cpp", "csharp", "java", "js", "php", "python", "ruby", "objective-c", "icetouch", "tmp"]:
+ if here[i] in ["cpp", "csharp", "java", "java-compat", "js", "php", "python", "ruby", "objective-c", "tmp"]:
return here[i]
raise RuntimeError("cannot determine mapping")
@@ -1208,7 +1221,7 @@ def getCommandLine(exe, config, options = "", interpreterOptions = "", cfgName =
if interpreterOptions:
output.write(" " + interpreterOptions)
output.write(' "%s" ' % exe)
- elif config.lang == "java":
+ elif config.lang == "java" or config.lang == "java-compat":
output.write("%s -ea " % javaCmd)
if isSolaris() and config.x64:
output.write("-d64 ")
@@ -1262,6 +1275,7 @@ def directoryToPackage():
after = []
before = base
lang = getDefaultMapping()
+ lang = 'java' if lang == 'java-compat' else lang
while len(before) > 0:
current = os.path.basename(before)
before = os.path.dirname(before)
@@ -1280,7 +1294,7 @@ def getDefaultServerFile(baseDir = os.getcwd()):
return "server"
if lang == "python":
return "Server.py"
- if lang == "java":
+ if lang == "java" or lang == "java-compat":
pkg = directoryToPackage()
if len(pkg) > 0:
pkg = pkg + "."
@@ -1300,7 +1314,7 @@ def getDefaultClientFile(lang = None, baseDir = ""):
return "client"
if lang == "python":
return "Client.py"
- if lang == "java":
+ if lang == "java" or lang == "java-compat":
pkg = directoryToPackage()
if len(pkg) > 0:
pkg = pkg + "."
@@ -1321,7 +1335,7 @@ def getDefaultCollocatedFile():
return "collocated"
if lang == "python":
return "Collocated.py"
- if lang == "java":
+ if lang == "java" or lang == "java-compat":
return directoryToPackage() + ".Collocated"
import Expect
@@ -1453,7 +1467,7 @@ def getMirrorDir(base, mapping):
before = os.path.dirname(before)
if current == lang:
# Deal with Java's different directory structure
- if lang == "java":
+ if lang == "java" or lang == "java-compat":
while len(before) > 0:
current = os.path.basename(before)
before = os.path.dirname(before)
@@ -1465,7 +1479,7 @@ def getMirrorDir(base, mapping):
raise RuntimeError("cannot find language dir")
dir = os.path.join(before, mapping)
# Deal with Java's different directory structure
- if mapping == "java":
+ if mapping == "java" or mapping == "java-compat":
dir = os.path.join(dir, "test", "src", "main", "java")
return os.path.join(dir, *after)
@@ -1527,7 +1541,7 @@ def clientServerTest(cfgName = None, additionalServerOptions = "", additionalCli
serverDesc = os.path.basename(server)
clientDesc = os.path.basename(client)
- if lang != "java":
+ if lang != "java" and lang != "java-compat":
server = os.path.join(serverdir, server)
if serverenv is None:
@@ -1574,7 +1588,7 @@ def clientServerTest(cfgName = None, additionalServerOptions = "", additionalCli
print("** no matching test for %s" % clientLang)
return
- if clientLang != "java":
+ if clientLang != "java" and clientLang != "java-compat":
client = os.path.join(clientdir, client)
if clientenv is None:
@@ -1592,6 +1606,7 @@ def clientServerTest(cfgName = None, additionalServerOptions = "", additionalCli
serverCfg = DriverConfig("server")
if lang in ["ruby", "php", "js"]:
serverCfg.lang = "cpp"
+
server = getCommandLine(server, serverCfg, additionalServerOptions, interpreterOptions)
serverProc = spawnServer(server, env = serverenv, lang=serverCfg.lang, mx=serverCfg.mx)
print("ok")
@@ -1634,7 +1649,7 @@ def collocatedTest(additionalOptions = ""):
testdir = os.getcwd()
collocated = getDefaultCollocatedFile()
- if lang != "java":
+ if lang != "java" and lang != "java-compat":
collocated = os.path.join(testdir, collocated)
exe = collocated
@@ -1676,7 +1691,7 @@ def clientEchoTest(additionalServerOptions = "", additionalClientOptions = "",
serverDesc = server
clientDesc = client
- if lang != "java":
+ if lang != "java" and lang != "java-compat":
server = os.path.join(serverdir, server)
if serverenv is None:
@@ -1715,7 +1730,7 @@ def clientEchoTest(additionalServerOptions = "", additionalClientOptions = "",
print("** no matching test for %s" % clientLang)
return
- if clientLang != "java":
+ if clientLang != "java" and clientLang != "java-compat":
client = os.path.join(clientdir, client)
if clientenv is None:
@@ -1775,7 +1790,6 @@ def startClient(exe, args = "", config=None, env=None, echo = True, startReader
config = DriverConfig("client")
if env is None:
env = getTestEnv(getDefaultMapping(), os.getcwd())
-
interpreterOptions = ""
if config.lang == "php":
interpreterOptions = phpProfileSetup(clientConfig, iceOptions, iceProfile)
@@ -1902,7 +1916,7 @@ def getTestEnv(lang, testdir):
#
iceJARs = ["ice", "glacier2", "freeze", "icebox", "icestorm", "icegrid", "icepatch2", "icediscovery",
"icelocatordiscovery"]
- jarSuffix = "-" + getIceJsonVersion() + ".jar"
+ jarSuffix = "-" + ("compat-") if lang == "java-compat" else "" + getIceJsonVersion() + ".jar"
# First sanitize the environment.
env["CLASSPATH"] = sanitize(os.getenv("CLASSPATH", ""))
@@ -1924,8 +1938,8 @@ def getTestEnv(lang, testdir):
# Add test directory to env
if lang == "cpp":
addLdPath(os.path.join(testdir), env)
- elif lang == "java":
- addClasspath(os.path.join(testToplevel, "java", "lib", "test.jar"), env)
+ elif lang == "java" or lang == "java-compat":
+ addClasspath(os.path.join(testToplevel, lang, "lib", "test.jar"), env)
elif lang == "js":
if es5 and testdir.find("/es5/") == -1:
testdir = testdir.replace("test/Ice/", "test/Ice/es5/")
@@ -2144,7 +2158,7 @@ def processCmdLine():
elif o == "--cross":
global cross
cross.append(a)
- crossLang = ["cpp", "csharp", "java", "js", "php", "python", "ruby", "objective-c"]
+ crossLang = ["cpp", "csharp", "java", "java-comapt", "js", "php", "python", "ruby", "objective-c"]
if not a in crossLang:
print("cross must be one of %s" % ', '.join(crossLang))
sys.exit(1)
@@ -2283,6 +2297,8 @@ def runTests(start, expanded, num = 0, script = False):
# Deal with Java's different directory structure
if i.find(os.path.join("java","test")) != -1:
dir = os.path.join(testToplevel, "java", "test", "src", "main", i)
+ elif i.find(os.path.join("java-compat","test")) != -1:
+ dir = os.path.join(testToplevel, "java-compat", "test", "src", "main", i.replace('-compat',''))
else:
dir = os.path.join(testToplevel, i)
dir = os.path.normpath(dir)
diff --git a/slice/Glacier2/Metrics.ice b/slice/Glacier2/Metrics.ice
index 71d162d6d71..9e008003c97 100644
--- a/slice/Glacier2/Metrics.ice
+++ b/slice/Glacier2/Metrics.ice
@@ -13,6 +13,11 @@
[["cpp:include:Glacier2/Config.h"]]
#include <Ice/Metrics.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:ICEMX"]
module IceMX
diff --git a/slice/Glacier2/PermissionsVerifier.ice b/slice/Glacier2/PermissionsVerifier.ice
index b77287a2b2b..fbe813f4ba0 100644
--- a/slice/Glacier2/PermissionsVerifier.ice
+++ b/slice/Glacier2/PermissionsVerifier.ice
@@ -13,6 +13,11 @@
[["cpp:include:Glacier2/Config.h"]]
#include <Glacier2/SSLInfo.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:GLACIER2"]
module Glacier2
@@ -103,4 +108,3 @@ interface SSLPermissionsVerifier
};
};
-
diff --git a/slice/Glacier2/PermissionsVerifierF.ice b/slice/Glacier2/PermissionsVerifierF.ice
index a503d41ba5a..5939e08cebd 100644
--- a/slice/Glacier2/PermissionsVerifierF.ice
+++ b/slice/Glacier2/PermissionsVerifierF.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:GLACIER2"]
module Glacier2
{
@@ -19,4 +25,3 @@ interface PermissionsVerifier;
interface SSLPermissionsVerifier;
};
-
diff --git a/slice/Glacier2/Router.ice b/slice/Glacier2/Router.ice
index 6984da1aaeb..4feaf022d38 100644
--- a/slice/Glacier2/Router.ice
+++ b/slice/Glacier2/Router.ice
@@ -13,9 +13,14 @@
[["cpp:include:Glacier2/Config.h"]]
#include <Ice/Router.ice>
+#include <Ice/JavaCompat.ice>
#include <Glacier2/Session.ice>
#include <Glacier2/PermissionsVerifier.ice>
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
/**
*
* Glacier2 is a firewall solution for Ice. Glacier2 authenticates
@@ -176,4 +181,3 @@ interface Router extends Ice::Router
};
};
-
diff --git a/slice/Glacier2/RouterF.ice b/slice/Glacier2/RouterF.ice
index a6056fa1fa6..3eab1dd7b81 100644
--- a/slice/Glacier2/RouterF.ice
+++ b/slice/Glacier2/RouterF.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:GLACIER2"]
module Glacier2
{
@@ -18,4 +24,3 @@ module Glacier2
interface Router;
};
-
diff --git a/slice/Glacier2/SSLInfo.ice b/slice/Glacier2/SSLInfo.ice
index 16984f00631..99a940098e1 100644
--- a/slice/Glacier2/SSLInfo.ice
+++ b/slice/Glacier2/SSLInfo.ice
@@ -13,6 +13,11 @@
[["cpp:include:Glacier2/Config.h"]]
#include <Ice/BuiltinSequences.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:GLACIER2"]
module Glacier2
@@ -48,4 +53,3 @@ struct SSLInfo
};
};
-
diff --git a/slice/Glacier2/Session.ice b/slice/Glacier2/Session.ice
index 44e9874ea8d..1bdfffa1200 100644
--- a/slice/Glacier2/Session.ice
+++ b/slice/Glacier2/Session.ice
@@ -14,8 +14,13 @@
#include <Ice/BuiltinSequences.ice>
#include <Ice/Identity.ice>
+#include <Ice/JavaCompat.ice>
#include <Glacier2/SSLInfo.ice>
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:GLACIER2"]
module Glacier2
{
@@ -271,4 +276,3 @@ interface SSLSessionManager
};
};
-
diff --git a/slice/Ice/BuiltinSequences.ice b/slice/Ice/BuiltinSequences.ice
index fdfc5d3eced..fe3eb87f3cf 100644
--- a/slice/Ice/BuiltinSequences.ice
+++ b/slice/Ice/BuiltinSequences.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
@@ -46,4 +52,3 @@ sequence<Object> ObjectSeq;
sequence<Object*> ObjectProxySeq;
};
-
diff --git a/slice/Ice/Communicator.ice b/slice/Ice/Communicator.ice
index 3bf5d39531e..cd76f5f3641 100644
--- a/slice/Ice/Communicator.ice
+++ b/slice/Ice/Communicator.ice
@@ -16,13 +16,14 @@
#include <Ice/ObjectAdapterF.ice>
#include <Ice/ObjectFactory.ice>
#include <Ice/ValueFactory.ice>
-#include <Ice/RouterF.ice>
-#include <Ice/LocatorF.ice>
+#include <Ice/Router.ice>
+#include <Ice/Locator.ice>
#include <Ice/PluginF.ice>
#include <Ice/ImplicitContextF.ice>
#include <Ice/Current.ice>
#include <Ice/Properties.ice>
#include <Ice/FacetMap.ice>
+#include <Ice/JavaCompat.ice>
/**
*
@@ -33,6 +34,10 @@
* additional functionality that supports high scalability.
*
**/
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
diff --git a/slice/Ice/CommunicatorF.ice b/slice/Ice/CommunicatorF.ice
index c24f2bfee17..f20964d5422 100644
--- a/slice/Ice/CommunicatorF.ice
+++ b/slice/Ice/CommunicatorF.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
@@ -18,4 +24,3 @@ module Ice
local interface Communicator;
};
-
diff --git a/slice/Ice/Connection.ice b/slice/Ice/Connection.ice
index 666ce118462..58e0c5341b1 100644
--- a/slice/Ice/Connection.ice
+++ b/slice/Ice/Connection.ice
@@ -14,6 +14,11 @@
#include <Ice/ObjectAdapterF.ice>
#include <Ice/Identity.ice>
#include <Ice/Endpoint.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:ICE"]
module Ice
diff --git a/slice/Ice/ConnectionF.ice b/slice/Ice/ConnectionF.ice
index 1089bbd5f0f..4b6b2d85c79 100644
--- a/slice/Ice/ConnectionF.ice
+++ b/slice/Ice/ConnectionF.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
@@ -20,4 +26,3 @@ local class WSConnectionInfo;
local interface Connection;
};
-
diff --git a/slice/Ice/Current.ice b/slice/Ice/Current.ice
index a308070c883..1faece86063 100644
--- a/slice/Ice/Current.ice
+++ b/slice/Ice/Current.ice
@@ -15,6 +15,11 @@
#include <Ice/ConnectionF.ice>
#include <Ice/Identity.ice>
#include <Ice/Version.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:ICE"]
module Ice
@@ -158,4 +163,3 @@ local struct Current
};
};
-
diff --git a/slice/Ice/Endpoint.ice b/slice/Ice/Endpoint.ice
index 4775e152a27..06ae661d9ce 100644
--- a/slice/Ice/Endpoint.ice
+++ b/slice/Ice/Endpoint.ice
@@ -9,11 +9,16 @@
#pragma once
+[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
+
#include <Ice/Version.ice>
#include <Ice/BuiltinSequences.ice>
#include <Ice/EndpointF.ice>
+#include <Ice/JavaCompat.ice>
-[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:ICE"]
module Ice
@@ -269,4 +274,3 @@ local class OpaqueEndpointInfo extends EndpointInfo
};
};
-
diff --git a/slice/Ice/EndpointF.ice b/slice/Ice/EndpointF.ice
index 047b968106a..6e32bab4f17 100644
--- a/slice/Ice/EndpointF.ice
+++ b/slice/Ice/EndpointF.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
@@ -30,4 +36,3 @@ local interface Endpoint;
local sequence<Endpoint> EndpointSeq;
};
-
diff --git a/slice/Ice/EndpointTypes.ice b/slice/Ice/EndpointTypes.ice
index f5f20a88e56..50ec5b4d3d0 100644
--- a/slice/Ice/EndpointTypes.ice
+++ b/slice/Ice/EndpointTypes.ice
@@ -9,9 +9,14 @@
#pragma once
-
[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
@@ -37,4 +42,3 @@ local enum EndpointSelectionType
};
};
-
diff --git a/slice/Ice/FacetMap.ice b/slice/Ice/FacetMap.ice
index 738bab8085d..1ab58aea287 100644
--- a/slice/Ice/FacetMap.ice
+++ b/slice/Ice/FacetMap.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
@@ -23,4 +29,3 @@ module Ice
local dictionary<string, Object> FacetMap;
};
-
diff --git a/slice/Ice/Identity.ice b/slice/Ice/Identity.ice
index a03cf48e2e5..fa9edcbec83 100644
--- a/slice/Ice/Identity.ice
+++ b/slice/Ice/Identity.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
@@ -57,4 +63,3 @@ local dictionary<Identity, Object> ObjectDict;
sequence<Identity> IdentitySeq;
};
-
diff --git a/slice/Ice/ImplicitContext.ice b/slice/Ice/ImplicitContext.ice
index a7146cfa8cf..5bc29f564a9 100644
--- a/slice/Ice/ImplicitContext.ice
+++ b/slice/Ice/ImplicitContext.ice
@@ -13,6 +13,11 @@
#include <Ice/LocalException.ice>
#include <Ice/Current.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:ICE"]
module Ice
@@ -107,4 +112,3 @@ local interface ImplicitContext
string remove(string key);
};
};
-
diff --git a/slice/Ice/ImplicitContextF.ice b/slice/Ice/ImplicitContextF.ice
index 65352b8794e..6b7fa84c2dc 100644
--- a/slice/Ice/ImplicitContextF.ice
+++ b/slice/Ice/ImplicitContextF.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
@@ -18,4 +24,3 @@ module Ice
local interface ImplicitContext;
};
-
diff --git a/slice/Ice/Instrumentation.ice b/slice/Ice/Instrumentation.ice
index 2c898a7e9ab..b6d40b9a7a1 100644
--- a/slice/Ice/Instrumentation.ice
+++ b/slice/Ice/Instrumentation.ice
@@ -14,6 +14,11 @@
#include <Ice/EndpointF.ice>
#include <Ice/ConnectionF.ice>
#include <Ice/Current.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:ICE"]
module Ice
@@ -500,4 +505,3 @@ local interface CommunicatorObserver
};
};
-
diff --git a/slice/Ice/InstrumentationF.ice b/slice/Ice/InstrumentationF.ice
index 3bd9d0546f4..c7c3aba0d26 100644
--- a/slice/Ice/InstrumentationF.ice
+++ b/slice/Ice/InstrumentationF.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
@@ -25,4 +31,3 @@ local interface CommunicatorObserver;
};
};
-
diff --git a/slice/Ice/JavaCompat.ice b/slice/Ice/JavaCompat.ice
new file mode 100644
index 00000000000..9e56b26ee2f
--- /dev/null
+++ b/slice/Ice/JavaCompat.ice
@@ -0,0 +1,24 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+#if defined(__SLICE2JAVA__) && defined(__SLICE2JAVA_COMPAT__)
+# define JAVA_COMPAT 1
+#endif
+
+//
+// The following is needed only if this Slice file may be compiled with
+// a slice2java compiler version < 3.7
+//
+// __SLICE2JAVA__ and __ICE_VERSION__ were both introduced in Ice 3.5.1
+
+#if (defined(__SLICE2JAVA__) && (__ICE_VERSION__ < 30700)) || !defined(__ICE_VERSION__)
+# define JAVA_COMPAT 1
+#endif
diff --git a/slice/Ice/LocalException.ice b/slice/Ice/LocalException.ice
index 39e194a0550..9e532d5a0c0 100644
--- a/slice/Ice/LocalException.ice
+++ b/slice/Ice/LocalException.ice
@@ -14,6 +14,11 @@
#include <Ice/Identity.ice>
#include <Ice/Version.ice>
#include <Ice/BuiltinSequences.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:ICE"]
module Ice
@@ -1030,4 +1035,3 @@ local exception ResponseSentException
};
-
diff --git a/slice/Ice/Locator.ice b/slice/Ice/Locator.ice
index 91d5547cd18..44c779d76be 100644
--- a/slice/Ice/Locator.ice
+++ b/slice/Ice/Locator.ice
@@ -11,9 +11,13 @@
[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
-
#include <Ice/Identity.ice>
#include <Ice/Process.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:ICE"]
module Ice
@@ -225,5 +229,3 @@ interface LocatorFinder
};
};
-
-
diff --git a/slice/Ice/LocatorF.ice b/slice/Ice/LocatorF.ice
index 77ec7fdd7ae..dd1b6c1e754 100644
--- a/slice/Ice/LocatorF.ice
+++ b/slice/Ice/LocatorF.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
@@ -19,4 +25,3 @@ interface Locator;
interface LocatorRegistry;
};
-
diff --git a/slice/Ice/Logger.ice b/slice/Ice/Logger.ice
index a59d5875db6..48224686910 100644
--- a/slice/Ice/Logger.ice
+++ b/slice/Ice/Logger.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
@@ -84,4 +90,3 @@ local interface Logger
};
};
-
diff --git a/slice/Ice/LoggerF.ice b/slice/Ice/LoggerF.ice
index b90a3307cbe..f8a2b4b9b5a 100644
--- a/slice/Ice/LoggerF.ice
+++ b/slice/Ice/LoggerF.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
@@ -18,4 +24,3 @@ module Ice
local interface Logger;
};
-
diff --git a/slice/Ice/Metrics.ice b/slice/Ice/Metrics.ice
index a849e246c32..f4a9705e46e 100644
--- a/slice/Ice/Metrics.ice
+++ b/slice/Ice/Metrics.ice
@@ -12,6 +12,7 @@
[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
#include <Ice/BuiltinSequences.ice>
+#include <Ice/JavaCompat.ice>
/**
*
@@ -20,6 +21,10 @@
* metrics from Ice applications.
*
**/
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICEMX"]
module IceMX
{
diff --git a/slice/Ice/ObjectAdapter.ice b/slice/Ice/ObjectAdapter.ice
index 6b28238d693..36c42c3f027 100644
--- a/slice/Ice/ObjectAdapter.ice
+++ b/slice/Ice/ObjectAdapter.ice
@@ -13,10 +13,15 @@
#include <Ice/CommunicatorF.ice>
#include <Ice/ServantLocatorF.ice>
-#include <Ice/LocatorF.ice>
+#include <Ice/Locator.ice>
#include <Ice/Identity.ice>
#include <Ice/FacetMap.ice>
#include <Ice/Endpoint.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:ICE"]
module Ice
diff --git a/slice/Ice/ObjectAdapterF.ice b/slice/Ice/ObjectAdapterF.ice
index 8536bcb091a..8a8278ecb82 100644
--- a/slice/Ice/ObjectAdapterF.ice
+++ b/slice/Ice/ObjectAdapterF.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
@@ -18,4 +24,3 @@ module Ice
local interface ObjectAdapter;
};
-
diff --git a/slice/Ice/ObjectFactory.ice b/slice/Ice/ObjectFactory.ice
index 8721419fd05..a624857f69f 100644
--- a/slice/Ice/ObjectFactory.ice
+++ b/slice/Ice/ObjectFactory.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
@@ -56,4 +62,3 @@ local interface ObjectFactory
};
};
-
diff --git a/slice/Ice/Plugin.ice b/slice/Ice/Plugin.ice
index 02e0e355110..4023449a3cf 100644
--- a/slice/Ice/Plugin.ice
+++ b/slice/Ice/Plugin.ice
@@ -14,6 +14,11 @@
#include <Ice/LoggerF.ice>
#include <Ice/BuiltinSequences.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:ICE"]
module Ice
@@ -115,4 +120,3 @@ local interface PluginManager
};
};
-
diff --git a/slice/Ice/PluginF.ice b/slice/Ice/PluginF.ice
index ea450b557f0..aad7c056ed4 100644
--- a/slice/Ice/PluginF.ice
+++ b/slice/Ice/PluginF.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
@@ -19,4 +25,3 @@ local interface Plugin;
local interface PluginManager;
};
-
diff --git a/slice/Ice/Process.ice b/slice/Ice/Process.ice
index a35918ac5f7..177ae1f906a 100644
--- a/slice/Ice/Process.ice
+++ b/slice/Ice/Process.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
@@ -52,4 +58,3 @@ interface Process
};
};
-
diff --git a/slice/Ice/ProcessF.ice b/slice/Ice/ProcessF.ice
index 6b2395256bb..a378e229104 100644
--- a/slice/Ice/ProcessF.ice
+++ b/slice/Ice/ProcessF.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
@@ -18,4 +24,3 @@ module Ice
interface Process;
};
-
diff --git a/slice/Ice/Properties.ice b/slice/Ice/Properties.ice
index 727a20b2f2b..2d4428858b1 100644
--- a/slice/Ice/Properties.ice
+++ b/slice/Ice/Properties.ice
@@ -12,6 +12,11 @@
[["cpp:header-ext:h", "objc:header-dir:objc"]]
#include <Ice/PropertiesAdmin.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:ICE"]
module Ice
@@ -226,4 +231,3 @@ local interface Properties
};
};
-
diff --git a/slice/Ice/PropertiesAdmin.ice b/slice/Ice/PropertiesAdmin.ice
index 40869c15e79..8004598c436 100644
--- a/slice/Ice/PropertiesAdmin.ice
+++ b/slice/Ice/PropertiesAdmin.ice
@@ -12,6 +12,11 @@
[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
#include <Ice/BuiltinSequences.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:ICE"]
module Ice
diff --git a/slice/Ice/PropertiesF.ice b/slice/Ice/PropertiesF.ice
index 1d9e38a94bc..52dca3549a5 100644
--- a/slice/Ice/PropertiesF.ice
+++ b/slice/Ice/PropertiesF.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
@@ -19,4 +25,3 @@ local interface Properties;
interface PropertiesAdmin;
};
-
diff --git a/slice/Ice/RemoteLogger.ice b/slice/Ice/RemoteLogger.ice
index 894e3392798..0f0463cb394 100644
--- a/slice/Ice/RemoteLogger.ice
+++ b/slice/Ice/RemoteLogger.ice
@@ -10,10 +10,15 @@
#pragma once
#include <Ice/BuiltinSequences.ice>
+#include <Ice/JavaCompat.ice>
[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
[["cpp:include:list"]]
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
@@ -230,4 +235,3 @@ interface LoggerAdmin
};
};
-
diff --git a/slice/Ice/Router.ice b/slice/Ice/Router.ice
index 4e24ad914cd..d836c4c6022 100644
--- a/slice/Ice/Router.ice
+++ b/slice/Ice/Router.ice
@@ -12,6 +12,11 @@
[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
#include <Ice/BuiltinSequences.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:ICE"]
module Ice
@@ -81,4 +86,3 @@ interface RouterFinder
};
};
-
diff --git a/slice/Ice/RouterF.ice b/slice/Ice/RouterF.ice
index 12f6019dab4..015703a80be 100644
--- a/slice/Ice/RouterF.ice
+++ b/slice/Ice/RouterF.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
@@ -18,4 +24,3 @@ module Ice
interface Router;
};
-
diff --git a/slice/Ice/ServantLocator.ice b/slice/Ice/ServantLocator.ice
index 1246662b318..b08d674bd54 100644
--- a/slice/Ice/ServantLocator.ice
+++ b/slice/Ice/ServantLocator.ice
@@ -13,6 +13,11 @@
#include <Ice/ObjectAdapterF.ice>
#include <Ice/Current.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:ICE"]
module Ice
@@ -115,4 +120,3 @@ local interface ServantLocator
};
};
-
diff --git a/slice/Ice/ServantLocatorF.ice b/slice/Ice/ServantLocatorF.ice
index 9a02ac20eba..132b3f9af99 100644
--- a/slice/Ice/ServantLocatorF.ice
+++ b/slice/Ice/ServantLocatorF.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
@@ -18,4 +24,3 @@ module Ice
local interface ServantLocator;
};
-
diff --git a/slice/Ice/SliceChecksumDict.ice b/slice/Ice/SliceChecksumDict.ice
index cd95f217487..7ee744aaff5 100644
--- a/slice/Ice/SliceChecksumDict.ice
+++ b/slice/Ice/SliceChecksumDict.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
@@ -23,4 +29,3 @@ module Ice
dictionary<string, string> SliceChecksumDict;
};
-
diff --git a/slice/Ice/ValueFactory.ice b/slice/Ice/ValueFactory.ice
index aa1542e4702..78b2b790fe7 100644
--- a/slice/Ice/ValueFactory.ice
+++ b/slice/Ice/ValueFactory.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
diff --git a/slice/Ice/Version.ice b/slice/Ice/Version.ice
index 7a18925fc30..b06bddc7f58 100644
--- a/slice/Ice/Version.ice
+++ b/slice/Ice/Version.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICE"]
module Ice
{
diff --git a/slice/IceBT/ConnectionInfo.ice b/slice/IceBT/ConnectionInfo.ice
index db128dfa868..a105a93a4ff 100644
--- a/slice/IceBT/ConnectionInfo.ice
+++ b/slice/IceBT/ConnectionInfo.ice
@@ -12,6 +12,11 @@
[["cpp:header-ext:h", "objc:header-dir:objc"]]
#include <Ice/Connection.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:ICEBT"]
module IceBT
diff --git a/slice/IceBT/EndpointInfo.ice b/slice/IceBT/EndpointInfo.ice
index c7018aacec6..5d0950c80de 100644
--- a/slice/IceBT/EndpointInfo.ice
+++ b/slice/IceBT/EndpointInfo.ice
@@ -12,6 +12,11 @@
[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
#include <Ice/Endpoint.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
/**
*
diff --git a/slice/IceBT/Types.ice b/slice/IceBT/Types.ice
index 1dffa01b450..436da337061 100644
--- a/slice/IceBT/Types.ice
+++ b/slice/IceBT/Types.ice
@@ -11,6 +11,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
/**
*
* IceBT provides a Bluetooth transport for Ice.
diff --git a/slice/IceBox/IceBox.ice b/slice/IceBox/IceBox.ice
index b5e54b1383d..167c2fcfde8 100644
--- a/slice/IceBox/IceBox.ice
+++ b/slice/IceBox/IceBox.ice
@@ -16,6 +16,11 @@
#include <Ice/CommunicatorF.ice>
#include <Ice/PropertiesF.ice>
#include <Ice/SliceChecksumDict.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
/**
*
@@ -191,4 +196,3 @@ interface ServiceManager
};
};
-
diff --git a/slice/IceDiscovery/IceDiscovery.ice b/slice/IceDiscovery/IceDiscovery.ice
index 58990b1f6d5..92b54ed4d26 100644
--- a/slice/IceDiscovery/IceDiscovery.ice
+++ b/slice/IceDiscovery/IceDiscovery.ice
@@ -11,6 +11,11 @@
[["cpp:header-ext:h", "objc:header-dir:objc"]]
#include <Ice/Identity.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
module IceDiscovery
{
diff --git a/slice/IceGrid/Admin.ice b/slice/IceGrid/Admin.ice
index 669169ee0f9..e7da760d9d3 100644
--- a/slice/IceGrid/Admin.ice
+++ b/slice/IceGrid/Admin.ice
@@ -16,10 +16,15 @@
#include <Ice/BuiltinSequences.ice>
#include <Ice/Properties.ice>
#include <Ice/SliceChecksumDict.ice>
+#include <Ice/JavaCompat.ice>
#include <Glacier2/Session.ice>
#include <IceGrid/Exception.ice>
#include <IceGrid/Descriptor.ice>
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICEGRID"]
module IceGrid
{
@@ -1940,4 +1945,3 @@ interface AdminSession extends Glacier2::Session
};
};
-
diff --git a/slice/IceGrid/Descriptor.ice b/slice/IceGrid/Descriptor.ice
index d2ef0d76f21..9ad040cf8ff 100644
--- a/slice/IceGrid/Descriptor.ice
+++ b/slice/IceGrid/Descriptor.ice
@@ -14,6 +14,11 @@
#include <Ice/Identity.ice>
#include <Ice/BuiltinSequences.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:ICEGRID"]
module IceGrid
@@ -1077,4 +1082,3 @@ struct ApplicationUpdateDescriptor
};
};
-
diff --git a/slice/IceGrid/Exception.ice b/slice/IceGrid/Exception.ice
index 1404bab46c7..b0844b87413 100644
--- a/slice/IceGrid/Exception.ice
+++ b/slice/IceGrid/Exception.ice
@@ -14,6 +14,11 @@
#include <Ice/Identity.ice>
#include <Ice/BuiltinSequences.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:ICEGRID"]
module IceGrid
@@ -381,4 +386,3 @@ exception FileNotAvailableException
};
-
diff --git a/slice/IceGrid/FileParser.ice b/slice/IceGrid/FileParser.ice
index 8e47cfd163d..2484b8e92dc 100644
--- a/slice/IceGrid/FileParser.ice
+++ b/slice/IceGrid/FileParser.ice
@@ -12,8 +12,13 @@
[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
[["cpp:include:IceGrid/Config.h"]]
+#include <Ice/JavaCompat.ice>
#include <IceGrid/Admin.ice>
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICEGRID"]
module IceGrid
{
@@ -59,4 +64,3 @@ interface FileParser
};
};
-
diff --git a/slice/IceGrid/PluginFacade.ice b/slice/IceGrid/PluginFacade.ice
index fc35b42d705..d83a02f4651 100644
--- a/slice/IceGrid/PluginFacade.ice
+++ b/slice/IceGrid/PluginFacade.ice
@@ -14,9 +14,14 @@
#include <Ice/BuiltinSequences.ice>
#include <Ice/Current.ice>
+#include <Ice/JavaCompat.ice>
#include <IceGrid/Admin.ice>
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICEGRID"]
module IceGrid
{
diff --git a/slice/IceGrid/Registry.ice b/slice/IceGrid/Registry.ice
index 52817a4ff7b..446e41e502d 100644
--- a/slice/IceGrid/Registry.ice
+++ b/slice/IceGrid/Registry.ice
@@ -16,6 +16,11 @@
#include <IceGrid/Session.ice>
#include <IceGrid/Admin.ice>
#include <Ice/Locator.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:ICEGRID"]
module IceGrid
@@ -268,4 +273,3 @@ interface Locator extends Ice::Locator
};
};
-
diff --git a/slice/IceGrid/Session.ice b/slice/IceGrid/Session.ice
index 50fb280bc75..ed78dbf59cf 100644
--- a/slice/IceGrid/Session.ice
+++ b/slice/IceGrid/Session.ice
@@ -14,6 +14,11 @@
#include <Glacier2/Session.ice>
#include <IceGrid/Exception.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:ICEGRID"]
module IceGrid
@@ -122,4 +127,3 @@ interface Session extends Glacier2::Session
};
};
-
diff --git a/slice/IceGrid/UserAccountMapper.ice b/slice/IceGrid/UserAccountMapper.ice
index ed59f59cf98..1569a255125 100644
--- a/slice/IceGrid/UserAccountMapper.ice
+++ b/slice/IceGrid/UserAccountMapper.ice
@@ -12,6 +12,12 @@
[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
[["cpp:include:IceGrid/Config.h"]]
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICEGRID"]
module IceGrid
{
@@ -56,4 +62,3 @@ interface UserAccountMapper
};
};
-
diff --git a/slice/IceLocatorDiscovery/IceLocatorDiscovery.ice b/slice/IceLocatorDiscovery/IceLocatorDiscovery.ice
index 4a1bd514207..fa626f49bcc 100644
--- a/slice/IceLocatorDiscovery/IceLocatorDiscovery.ice
+++ b/slice/IceLocatorDiscovery/IceLocatorDiscovery.ice
@@ -11,6 +11,11 @@
[["cpp:header-ext:h", "objc:header-dir:objc"]]
#include <Ice/Locator.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
/**
* IceLocatorDiscovery is an Ice plug-in that enables the discovery of IceGrid and custom locators via
diff --git a/slice/IcePatch2/FileInfo.ice b/slice/IcePatch2/FileInfo.ice
index 847b00f44cd..72ddf6460af 100644
--- a/slice/IcePatch2/FileInfo.ice
+++ b/slice/IcePatch2/FileInfo.ice
@@ -13,6 +13,11 @@
[["cpp:include:IcePatch2/Config.h"]]
#include <Ice/BuiltinSequences.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:ICEPATCH2"]
module IcePatch2
@@ -74,5 +79,3 @@ struct LargeFileInfo
sequence<LargeFileInfo> LargeFileInfoSeq;
};
-
-
diff --git a/slice/IcePatch2/FileServer.ice b/slice/IcePatch2/FileServer.ice
index b5f8af414ad..e086548aa68 100644
--- a/slice/IcePatch2/FileServer.ice
+++ b/slice/IcePatch2/FileServer.ice
@@ -13,6 +13,11 @@
[["cpp:include:IcePatch2/Config.h"]]
#include <IcePatch2/FileInfo.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
/**
*
diff --git a/slice/IceSSL/ConnectionInfo.ice b/slice/IceSSL/ConnectionInfo.ice
index b9e09e2ff32..d1ae27ed4d4 100644
--- a/slice/IceSSL/ConnectionInfo.ice
+++ b/slice/IceSSL/ConnectionInfo.ice
@@ -12,6 +12,11 @@
[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
#include <Ice/Connection.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:ICESSL"]
module IceSSL
@@ -35,4 +40,3 @@ local class ConnectionInfo extends Ice::ConnectionInfo
};
};
-
diff --git a/slice/IceSSL/EndpointInfo.ice b/slice/IceSSL/EndpointInfo.ice
index a93bc334d8b..7b726d1a597 100644
--- a/slice/IceSSL/EndpointInfo.ice
+++ b/slice/IceSSL/EndpointInfo.ice
@@ -12,12 +12,17 @@
[["cpp:header-ext:h", "objc:header-dir:objc", "js:ice-build"]]
#include <Ice/Endpoint.ice>
+#include <Ice/JavaCompat.ice>
/**
*
* IceSSL provides a secure transport for Ice.
*
**/
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
["objc:prefix:ICESSL"]
module IceSSL
{
@@ -32,4 +37,3 @@ local class EndpointInfo extends Ice::EndpointInfo
};
};
-
diff --git a/slice/IceStorm/IceStorm.ice b/slice/IceStorm/IceStorm.ice
index 39d05c4922f..0aec66781c6 100644
--- a/slice/IceStorm/IceStorm.ice
+++ b/slice/IceStorm/IceStorm.ice
@@ -14,9 +14,14 @@
#include <Ice/Identity.ice>
#include <Ice/SliceChecksumDict.ice>
+#include <Ice/JavaCompat.ice>
#include <IceStorm/Metrics.ice>
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
+
/**
*
* A messaging service with support for federation. In contrast to
@@ -403,4 +408,3 @@ interface Finder
};
};
-
diff --git a/slice/IceStorm/Metrics.ice b/slice/IceStorm/Metrics.ice
index 57be7be1e23..3ec43924164 100644
--- a/slice/IceStorm/Metrics.ice
+++ b/slice/IceStorm/Metrics.ice
@@ -13,6 +13,11 @@
[["cpp:include:IceStorm/Config.h"]]
#include <Ice/Metrics.ice>
+#include <Ice/JavaCompat.ice>
+
+#ifndef JAVA_COMPAT
+[["java:package:com.zeroc"]]
+#endif
["objc:prefix:ICEMX"]
module IceMX