Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Advanced CORBA Programming wit C++ - M. Henning, S. Vinoski.pdf
Скачиваний:
65
Добавлен:
24.05.2014
Размер:
5 Mб
Скачать

IT-SC book: Advanced CORBA® Programming with C++

//Look for controller in the Naming Service. CosNaming::Name n;

n.length(2);

n[0].id = CORBA::string_dup("CCS"); n[1].id = CORBA::string_dup("Controller"); CCS::Controller_var ctrl;

try {ctrl = resolve_name<CCS::Controller>(inc, n);

} catch (const CosNaming::NamingContext::NotF ound &) { cerr < "No controller in Naming Service" < endl; throw 0;

}

//...

}catch (const CORBA::Exception & e) {

cerr < "Uncaught CORBA exception: " < e <

endl;

return 1; } catch (...) {

return 1;

}

return 0;

}

18.15 Summary

The Naming Service provides a simple mechanism for servers to advertise objects by name and for clients to locate the objects by supplying the correct name. The Naming Service eliminates the need to pass stringified object references by out-of-band mechanisms, and that improves the reliability and maintainability of a system because the Naming Service provides a single logical repository for object references. Naming graphs can be federated over a number of servers to scale to a very large number of bindings. Choosing the correct federation structure is important for both scalability and maintainability. Often, a federation structure that reflects the administrative structure of an organization provides a good compromise.

712