Results 1 to 9 of 9

Thread: How to create private objects when using locators?

  1. #1
    JohnB is offline Registered User
    Name: John Basrai
    Organization: Northrop Grumman
    Project: Airborne Payload Command Control Interface
    Join Date
    Feb 2005
    Posts
    49

    How to create private objects when using locators?

    Hello,

    I need to use the global namespace with indirect proxy for most of objects but I also want to create some private objects that use direct proxy. I don't think that's possible because createDirectProxy takes an identity and in order to get an Identity I have have to first `add' the object to an adapter.

    ObjectPrx = adapter->add(object, Ice::stringToIdentity("name"));
    DirectPrx = adapter->createDirectProxy(ObjectPrx->ice_identity());

    I think step one (assuming adapter has a locator) will create an
    indrect proxy and register it in the global namespace. Correct?

    I'm about to write my own namespace, which doesn't seem to hard, but wanted to make sure there's really a need for it.

    Thanks,
    John Basrai
    Software Engineer
    Northrop Grumman Mission Systems/ISD

  2. #2
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    John,

    Adding an object to an adapter does not automatically register that object with the locator. Rather, the application must explicitly register the object.

    Take care,
    - Mark

  3. #3
    JohnB is offline Registered User
    Name: John Basrai
    Organization: Northrop Grumman
    Project: Airborne Payload Command Control Interface
    Join Date
    Feb 2005
    Posts
    49
    Ok so I've been scouring the manual and the forums and I can't find out how you do that. Is it something so obvoius that I missed it?

    This thread
    talks about but doesn't say exactly how to do .
    John Basrai
    Software Engineer
    Northrop Grumman Mission Systems/ISD

  4. #4
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    There are several ways to register an object with the locator:
    • By statically configuring the object in an IcePack deployment descriptor.
    • Using the icepackadmin command "object add ...".
    • Programmatically by calling addObject on the IcePack::Admin object. You can find an example of this in demo/IcePack/hello/HelloI.cpp.
    Take care,
    - Mark

  5. #5
    JohnB is offline Registered User
    Name: John Basrai
    Organization: Northrop Grumman
    Project: Airborne Payload Command Control Interface
    Join Date
    Feb 2005
    Posts
    49
    [Ok looks like you posted before I could, I look at hello demo]

    Is this The correct way to do it?

    AdminPrx admin = AdminPrxHelper.checkedCast(communicator().stringTo Proxy("IcePack/Admin"));
    ....
    admin.addObject(agent);
    John Basrai
    Software Engineer
    Northrop Grumman Mission Systems/ISD

  6. #6
    JohnB is offline Registered User
    Name: John Basrai
    Organization: Northrop Grumman
    Project: Airborne Payload Command Control Interface
    Join Date
    Feb 2005
    Posts
    49
    So it's the <Adapter>.Proxy property that causes it
    to be registered in name space? Here's the config file.

    Hello.Proxy=hello@HelloAdapter
    Hello.Endpoints=tcp:udp:ssl
    Hello.AdapterId=HelloAdapter
    Ice.Default.Locator=IcePack/Locator:default -p 10006

    So this will register under name "hello@HelloAdapter"? Maybe I'm confused. I'm expecting a <name>,<object ref> tuple but maybe the Proxy is self contained?

    So in this case the client just does a stringToProxy on this property and run time notices that it's indirect and does the rest. Client (code) doesn't really do a lookup. The client run time does that.

    I found this code in Clinet.cpp of Hello demo.

    Code:
        const char* proxyProperty = "Hello.Proxy";
        string proxy = properties->getProperty(proxyProperty);
        ...
        Ice::ObjectPrx base = communicator->stringToProxy(proxy);
    John Basrai
    Software Engineer
    Northrop Grumman Mission Systems/ISD

  7. #7
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Quote Originally Posted by JohnB
    So it's the <Adapter>.Proxy property that causes it to be registered in name space?
    No, the Hello.Proxy property is only used by the client to retrieve the object's proxy from the configuration file. The name of this property has no special significance.

    There is no way to automatically register objects in IcePack's object registry. It has to be done explicitly in one of the ways I mentioned above.

    - Mark

  8. #8
    JohnB is offline Registered User
    Name: John Basrai
    Organization: Northrop Grumman
    Project: Airborne Payload Command Control Interface
    Join Date
    Feb 2005
    Posts
    49
    I was looking at the wrong sample! I was looking at demo/Ice/hello intead of demo/IcePack/hello.

    I'll have to study the IcePack/hello demo.

    Thanks for you help.
    John Basrai
    Software Engineer
    Northrop Grumman Mission Systems/ISD

  9. #9
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Quote Originally Posted by JohnB
    So in this case the client just does a stringToProxy on this property and run time notices that it's indirect and does the rest. Client (code) doesn't really do a lookup. The client run time does that.
    That's correct, the Ice run time handles indirect proxies internally, but the client must be configured with a locator proxy. This means the client code you quoted works equally well for direct and indirect proxies.

    Also, don't be confused by the fact that the client, server and IcePack all use the same configuration file in the demo. Only certain properties in the file are used by each of the components. The public object with the identity "hello" is registered when the descriptors are deployed.

    - Mark

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 10-30-2007, 01:05 AM
  2. Replies: 1
    Last Post: 04-13-2007, 09:49 PM
  3. IceStorm behind a private net
    By fgarcia in forum Help Center
    Replies: 64
    Last Post: 09-25-2006, 10:35 AM
  4. Private Thread assignment
    By joe in forum Bug Reports
    Replies: 1
    Last Post: 05-20-2006, 08:46 AM
  5. question: servant locators
    By raj in forum Help Center
    Replies: 1
    Last Post: 12-28-2003, 12:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •