Archived

This forum has been archived. Please start a new discussion on GitHub.

Local or server private methods

I have this needing! I'm implementing a Security application with:

Principal
|
User
|
Group


Now on server every Servant contain a reference to a DB Versant Object
And I need to get this reference with a virtual method:

something like

VersantPrincipal getDBReference()

a method that only on server side i have to see.

How can I do this?

Comments

  • I take it that you do not need to call this method from the client? If so, simply add the method to your servant implementation. You can add whatever methods you like to support your implementation.
    If you do need to see the method on the client side, you need to create a Slice operation for it, of course.

    Cheers,

    Michi.
  • The client absolutely have to NOT see the method becouse it returns VERSANT reference type!!!
    And I can't add a method by myself becouse this way it's not polimorphic!
    I need something like 'ice local interface' but with method.

    Maybe i'm not able to explain my problem in English but YOU can imagine that my ICE Interfaces need some property or method that have to been accesed in polymorphic way ONLY on the server side.
  • Well, if you want something on the server side that can be accessed only from there, simply add a method to the servant. For example:
    // Slice
    interface Foo {
        void op();
    };
    
    In the implementation, you will write something like:
    class FooI : public virtual Foo {
    public:
        void op(const Ice::Current&); // Slice operation
        whateverType myExtraMethod(); // Extra method
    };
    

    Then make myExtraMethod() do whatever you want to do.

    Cheers,

    Michi.
  • OK! And so I've done but SubFooI and Sub2FooI (subinterfaces of SubFoo) don't inherits from SubFooI and in this way I loose polimorphism and in my routines i can't call that method in a polymorphic way

    something like:

    FooI foo = (FooI) current.adapter.proxyToServant(myProxy)
    foo.myProvateMethode(.....)

    this becouse there isn't reletionship between Servant
  • YES!!! At the end it was the same problem!
    Thanks a lot!

    P.S. But you never sleep? Me too :)))