[omniORB] Finding methods in objects / part 2

Stephen Crawley crawley@dstc.edu.au
Thu, 02 Dec 1999 15:23:05 +1000


> On Monday 29 November, Casillas_Juan_M/madrid_tecnologia@sinvest.es wrote:
> >       How A can instantiate new objects from the implementations,
> >       A knows the IOR, but ... program A can't cast dinamically new
> >       objects from a string ... or It can ?
> 
> I don't think you mean "instantiate new objects...". I think you mean
> you want A to use an _object reference_ to an object which has a type
> that A does not know. In this case, there is no problem with creating
> the reference, and invoking operations on it with DII. You obviously
> can't use static invocation since you don't have compile-time
> knowledge of it.
> 
> That said, I think you need to carefully re-think what it is you are
> trying to do. As someone pointed out earlier, knowing that a server
> supports an interface with an operation named hello() doesn't do you
> any good at all, since the name of an operation doesn't tell you
> anything about what it does. Not only that, but there is no guarantee
> that the arguments to different hello() operations are the
> same.

True.

If you are considering implementing an application that uses dynamic
discovery of interface types, it would be worthwhile taking a look
at the OMG MOF specification.  You could use MOF in (at least) 2
ways to solve this sort of problem:

  1) Define your own "type system" that expresses the semantics of
     your interface types in an appropriate manner.  Render this
     type system as a MOF meta-model, generate IDL and server and
     implement a compiler to populate your server with interface
     types.  Then do type discovery using the repository.

  2) Make the MOF's meta-meta-model your type system and define
     your application's information model as a MOF meta-model.  
     Then use an "off the shelf" MOF meta-model repository and
     an "off-the-shelf" meta-model compiler to populate it.

While 2) is not what the MOF was originally designed for, if the
MOF Model is a rich enough information meta-model for you, this
will save you a lot of time.

-- Steve