|
|
|
|||||
|
AdapterIds and Indirect proxies, and IcePack's Locator service
Hey Ice guys,
I wonder if you could clarify a couple of things I am struggling with? When I create an adapter that will manage indirect proxies with either: Code:
communicator->createObjectAdapterWithEndpoints("name",endpoint); // this
communicator->createObjectAdapter("name"); // or this
Are those proxies, always fully specified as an ObjectID@AdapterID proxy type? Assuming this is the case, is it correct that a client call (on this proxy) calls the Locator service and first attempts to find an endpoint with the Object identity in its registry then if this fails attempts to find the endpoint with the Object Adapter identity? Also, am I reading it correctly that to do this programmatically (and thus avoid having the AdapterId in the config file) that I can call myAdapter->setLocator(communicator->getLocator()) before activating the myAdapter? If this is not the case is there another way to programmatically make an ObjectAdapter add itself to the Locator service? Regards, Ryan |
|
|||||
|
Quote:
Quote:
Thanks a bunch, Ryan |
|
|||||
|
I had the same question about setting up an adapter to register itself with IcePack, without needing an entry in the properties file. The solution mentioned below grabs the PropertiesPtr from the communicator, adds the adapter info (id and endpoints) to the properties object, then asks the communicator to create the adapter. Sounds good so far.
Except that in section 27.8.2 of the manual, it says that you can't be guaranteed that any properties set after the communicator has been initialized will be noticed by the communicator. It then suggests that I get the properties before the communicator is initialied (using getDefaultProperties) and then initializing the communicator with them. That's quite a bit clunkier than the solution suggested in this thread, and I'd rather do it the way suggested. actually, what I'd rather do is call a non-existent function: communicator->createObjectAdapterWithEverything(name, id, endpoints)
__________________
Clay Kunz MIT/WHOI Joint Program (Using ICE for IPC on autonomous underwater vehicles) |
|
||||||
|
Hi Clay,
It is perfectly acceptable to set the AdapterId property just prior to calling createObjectAdapter (or createObjectAdapterWithEndpoints). The text you mentioned in section 27.8.2 is really referring to properties that the communicator checks once during initialization (such as tracing, plugins, etc.) and never checks again. Take care, - Mark |
|
|||||
|
Re: Can you set the adapter id via setProperty after the communicator is initialized?
Hi Mark,
I have a similar problem to Clay's. I'd like to programatically set the location of IcePack before registering an adapter. I read Section 27.8.2 of the manual, but I can't do what is suggested there (the getDefaultProperties trick) because I'm trying to write an IceBox service and therefore can't write any code that will be executed before the communicator is initialized. I understood from your post that I could just set the properties I need despite what it says in Section 27.8.2 of the manual, but it doesn't seem to work. My code looks like this: // set property Ice::PropertiesPtr properties = communicator->getProperties(); properties->setProperty( "Ice.Default.Locator", "<location>" ) // [ ... ] // create the adapter adapter = communicator->createObjectAdapter(adapterName); But the property doesn't seem to get read, and the adapter doesn't register with IcePack. Any ideas what's happening? Thanks in advance.
__________________
Alex Brooks Australian Centre for Field Robotics University of Sydney www.cas.edu.au project: orca-robotics.sf.net |
|
||||||
|
The Ice.Default.Locator property is a communicator property. The communicator reads it when it's initialized to set its default locator proxy. You can get this proxy using the Ice::Communicator::getDefaultLocator() method. And you can also set it explicitly with the Ice::Communicator::setDefaultLocator() method.
If you want your object adapter to use another locator than the communicator default locator proxy, you have the following option:
Benoit. |
|
|||||
|
Benoit,
Thanks, this did the trick! I implemented the first option (setting the <name>.Locator property). For some reason this wouldn't work until I also set Ice.Default.Locator to the same value. Not sure why.
__________________
Alex Brooks Australian Centre for Field Robotics University of Sydney www.cas.edu.au project: orca-robotics.sf.net |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| indirect reference to use Plugin | Greenhippo | Help Center | 8 | 12-11-2006 10:16 PM |
| indirect proxy and ObjectNotExistException | rc_hz | Comments | 6 | 12-06-2006 08:14 AM |
| how to get endpoints from an indirect proxy? | n2503v | Help Center | 2 | 01-24-2006 02:56 AM |
| Forcing reevalutation of an indirect proxy | Nis Baggesen | Help Center | 1 | 12-29-2005 01:33 PM |
| Indirect Binding | Jennie | Help Center | 2 | 11-05-2004 03:19 PM |