[omniORB] CorbaScript on omniORB2
David Riddoch
djr@uk.research.att.com
Tue, 20 Jul 1999 15:14:33 +0100 (GMT)
Hi,
> I have started (once again :-() the port of CorbaScript on top of omniORB2.
> I have some comments:
>
> * Have you plan to implement the Interface Repository?
> Currently I use the IFR provided by ORBacus and this works.
No plans. We also use other peoples interface repositories.
> * Why is it not possible to insert a nil object reference into a DynAny?
> See the following patch:
Good question. I have no idea why I did this ... so I'll accept your
patch! Thanks.
> void
> DynAnyImpl::insert_reference(CORBA::Object_ptr value)
> {
> if ( !CORBA::Object::PR_is_valid(value) )
> throw CORBA::BAD_PARAM(0,CORBA::COMPLETED_NO);
>
> // Merle Philippe
> // if( CORBA::is_nil(value) ) throw CORBA::DynAny::InvalidValue();
>
> Lock sync(this);
> CORBA::Object::marshalObjRef(value, doWrite(CORBA::tk_objref));
> }
>
> void
> DynAnyConstrBase::insert_reference(CORBA::Object_ptr value)
> {
> if ( !CORBA::Object::PR_is_valid(value) )
> throw CORBA::BAD_PARAM(0,CORBA::COMPLETED_NO);
>
> // Merle Philippe
> // if( CORBA::is_nil(value) ) throw CORBA::DynAny::InvalidValue();
>
> Lock sync(this);
> CORBA::Object::marshalObjRef(value, writeCurrent(CORBA::tk_objref));
> }
>
> void
> DynUnionImpl::insert_reference(CORBA::Object_ptr value)
> {
> if ( !CORBA::Object::PR_is_valid(value) )
> throw CORBA::BAD_PARAM(0,CORBA::COMPLETED_NO);
>
> // Merle Philippe
> // if( CORBA::is_nil(value) ) throw CORBA::DynAny::InvalidValue();
>
> Lock sync(this);
> CORBA::Object::marshalObjRef(value, writeCurrent(CORBA::tk_objref));
> discriminatorHasChanged();
> }
>
>
> * Why is it not possible to create a DynAny with a IDL void type?
> See the following patch:
Accepted.
> static DynAnyImplBase*
> create_dyn_any(TypeCode_base* tc, CORBA::Boolean is_root)
> {
> if ( !CORBA::TypeCode::PR_is_valid(tc) )
> throw CORBA::BAD_PARAM(0,CORBA::COMPLETED_NO);
>
> if( CORBA::is_nil(tc) )
> throw CORBA::BAD_TYPECODE(0, CORBA::COMPLETED_NO);
>
> DynAnyImplBase* da = 0;
>
> try {
> switch( tc->NP_kind() ) {
> // ADD Merle Philippe
> case CORBA::tk_void:
> // END
> case CORBA::tk_short:
>
> CORBA::DynAny_ptr
> CORBA::ORB::create_basic_dyn_any(TypeCode_ptr tc)
> {
> if (!CORBA::TypeCode::PR_is_valid(tc))
> throw CORBA::BAD_PARAM(0,CORBA::COMPLETED_NO);
>
> TypeCode_base* aetc = TypeCode_base::aliasExpand(ToTcBase_Checked(tc));
>
> switch( aetc->kind() ) {
> // ADD Merle Philippe
> case CORBA::tk_void:
> // END
> case CORBA::tk_short:
>
>
> * Is it normal that a subclass of CORBA::BOA::DynamicImplementation
> must handle "_is_a" CORBA calls into the implementation of the
> invoke() method?
Our current implementation of the DSI is based loosely on CORBA 2.2, but
was written for a CORBA 2.0 ORB. In CORBA 2.0 the DSI is not very clearly
specified. In CORBA 2.2 I think you should handle _is_a() by overriding
ServantBase's version. However as our version is not built on top of
ServantBase (because we don't yet have a POA) we can't do that. Thus I
have given the application the opportunity to handle _is_a. If you
don't want to handle it you are very welcome to throw BAD_OPERATION from
your invoke() routine -- in which case the default version will be used.
I'm not sure that this would be very useful though...
When we have a POA it will use the 'normal' semantics.
> * How can I narrow an object reference to a DynamicImplementation
>subclass instance?
> I would like to write the following:
>
> class MyDSI : public CORBA::BOA::DynamicImplementation {
> public:
> ........
> static MyDSI* _narrow(CORBA::Object_ptr o) { ???? }
> };
You can't do this, and I personally think it would not be a good idea.
Object references are fundamentally opaque.
> Why the DynamicImplementation doesn't directly inherit from omniObject and
> CORBA::Object classes?
> I have seen that you use a delegation pattern with the internal
> DsiObject, isn't it?
My way encapsulates the implementation better. Object implementations
and object references are not the same thing -- so there is no reason why
DynamicImplementation should inherit from CORBA::Object.
> * Here is a report bug:
>
> unix> cssh
> CorbaScript 1.3.1 (Jul 20 1999) for omniORB2 for C++
> Copyright 1996-99 LIFL, France
> >>> TestCS.SeqShort
> < OMG-IDL typedef sequence<short> TestCS::SeqShort; >
> >>> TestCS.SeqShort(1,2,3,4,5,6)
> Caught omniORB2 fatalException. This indicates a bug is caught within omniORB2.
> Please send a bug report.
> The exception was thrown in file: ../typecode.cc
> line: 949
> The error message is: TypeCode_base::NP_aliasExpand() - should not
> have been called
> unix>
>
> I have this report several times in my demonstration.
Could you try and get me a stack trace, or give me a minimal example?
> Even with these problems (and corrections), CorbaScript begins to work
> on top of omniORB2:-)
Excellent. Let us know when it is ready for others to use, and I'll put a
link up on our site.
Cheers,
David