开发者

Middleware (e.g. CORBA) - Inheritence of Object Members. Is it possible?

Consider the very simple IDL code that specifies a base and derived interface in CORBA:

module test{    
    interface Quote{
        attribute string symbol;
    };

    interface SpecialQuote:Quote{
        attribute string specialSymbol;
    };

    interface QuoteSender{
        void sendQuote(in Quote stock_quote);
    }
};

(This assumes CORBA but should be similar for other middleware). I am interested in being able to:

  1. create a derived class "Special开发者_JS百科Quote", fill in specialSymbol
  2. upcast to the base class "Quote", fill in symbol
  3. send over CORBA interface using "sendQuote"
  4. on the receiving end, downcast to SpecialQuote to retrieve specialSymbol

I'm having a hard time performing this because the attributes essentially just translate to empty setters/getters in Java rather than their Primitive Data Types. Thus it requires both the client and server ends to re-implement the setters/getters.

So in short, is inheritance of interface members possible across middleware? If so in CORBA, any recommendations? If in another middleware, which one?


You can do everything you ask for in CORBA without any modification. CORBA was designed to achieve this kind of polymorphism. However, take into account that in CORBA you have a separated client and server parts, so you have to implement the get and set methods in the server. As for the client, it only uses the get and set methods that cause a remote call to the implementation object.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜