Archived

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

IceAdmin and Base Class Proxies

Dear Ice,

I am using the interface to IceAdmin via the iceGrid. I get a proxy to the registry, create and admin session, and then call getAdapterInfo().

This returns a list of adatper infos with dictionaries of id, proxy,...

I want to use that Proxy to call a method on each of the adapters I find. Since all of my interfaces derive from a base interface, i was trying to cast as the base interface. For example:
module capstone {
    module interfaces {
            interface IServer {}
    }
}

module capstone {
    module interfaces {
        module instr {
            interface Instruments extends capstone::interfaces::IServer {
        }
    }
}

info = getAdapterInfo()
capstone.interfaces.IServerPrx.checkedCast(info.proxy)

Ice.ObjectNotExistException: exception ::Ice::ObjectNotExistException
{
    id = 
    {
        name = dummy
        category = 
    }
    facet = 
    operation = ice_isA
}


Should this be possible?

I want to call a base class method on the proxy from info.,proxy. I need to cast it. uncheckedCast() doesn't error, but I cant connect to proxy with resulting object. Says iceConnectionRefused.

Thanks,
Tom

Comments

  • bernard
    bernard Jupiter, FL
    Hi Tom,

    You can't checked-cast unchecked-cast the proxy in an AdapterInfo and get something usable. As described in the documentation for AdapterInfo, this is a "dummy" proxy, used only to carry the direct endpoints of this adapter.

    An object adapter only hosts your own objects; it does not provide its own objects. If you want to call an object in each of your object adapters, you need to create these objects - give them an ID and typically incarnate them with servants.

    Best regards,
    Bernard
  • Thank you.