-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta3
-
sparc
-
solaris_8
-
Verified
Name: krC82822 Date: 08/14/2001
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
The following standard CORBA dynamic any helper classes are
not included in the J2SE distribution:
org.omg.DynamicAny.DynStructHelper
org.omg.DynamicAny.DynSequenceHelper
org.omg.DynamicAny.DynArrayHelper
org.omg.DynamicAny.DynUnionHelper
org.omg.DynamicAny.DynEnumHelper
org.omg.DynamicAny.DynAnyFactoryHelper
----------------
further commentary from user:
These Helpers are mandated by the CORBA 2.3 spec. If you read 99-10-07 chapter 9
covers the implementation of dynamic anys. From the first paragraph at the top of
page 213 (in section 9.2.2):
"The create_dyn_any_from_type_code operation creates a DynAny from a
TypeCode. Depending on the TypeCode, the created object may be of type
DynAny, or one of its derived types, such as DynStruct. The returned reference can
be narrowed to the derived type."
And the last two paragraphs:
"Dynamic interpretation of an any usually involves creating a DynAny object using
DynAnyFactory::create_dyn_any as the first step. Depending on the type of the
any, the resulting DynAny object reference can be narrowed to a DynFixed,
DynStruct, DynSequence, DynArray, DynUnion, DynEnum, or DynValue
object reference.
Dynamic creation of an any involves creating a DynAny object using
DynAnyFactory::create_dyn_any_from_type_code, passing the TypeCode
associated with the value to be created. The returned reference is narrowed to one of
the complex types, such as DynStruct, if appropriate. Then, the value can be
initialized by means of invoking operations on the resulting object. Finally, the to_any
operation can be invoked to create an any value from the constructed DynAny."
The important thing here is the description of how the narrow operation is used. In
the Java bainding narrow operations are supported on the Helper class i.e. the various
dynamic helper classes are mandated by the spec.
To create say a DynStruct from an appropriate TypeCode you would do somethink like
the following:
// Get initial dynamic any factory
org.omg.CORBA.Object obj = orb.resolve_initial_references ("DynAnyFactory");
org.omg.DynamicAny.DynAnyFactory factory = org.omg.DynamicAny.DynAnyFactoryHelper.narrow (obj);
// Create basic dynamic any from type code
TypeCode tc;
org.omg.DynamicAny.DynAny dAny = factory.create_dyn_any_from_type_code (tc);
// Narrow to dynamic struct
org.omg.DynamicAny.DynStruct dStruct = org.omg.DynamicAny.DynStructHelper.narrow (dAny);
This is the standard way to create all of the various dynamic support classes (DynStruct,
DynArray, DynUnion, DynSequence, DynEnum, etc). Without the Helper classes this cannot
be done.
(Review ID: 126508)
======================================================================
**************************************************************************
###@###.### 2001-12-03
Fix Verified OK:
- With build: j2sdk-1_4_0-rc-bin-b88-solsparc-28_nov_2001
- With tests:
/java/idl/ws/rip/RIP_TEST_MASTER/tests/api/dynany/bug4491742
**************************************************************************