diff options
author | Benoit Foucher <benoit@zeroc.com> | 2002-09-11 20:33:06 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2002-09-11 20:33:06 +0000 |
commit | af019e080ac9319035abe899838bc6ff7bf7e435 (patch) | |
tree | 754643a46a0f0ef381b0a7596fc08a17dcda5cdf /cpp | |
parent | Fix bug in changeTimeout (the newEndpoints were not passed to the (diff) | |
download | ice-af019e080ac9319035abe899838bc6ff7bf7e435.tar.bz2 ice-af019e080ac9319035abe899838bc6ff7bf7e435.tar.xz ice-af019e080ac9319035abe899838bc6ff7bf7e435.zip |
Object adapter creation method changes, IceBox changes.
Diffstat (limited to 'cpp')
102 files changed, 644 insertions, 725 deletions
diff --git a/cpp/demo/Freeze/library/Collocated.cpp b/cpp/demo/Freeze/library/Collocated.cpp index 7dd09e7b716..cd7d6bb4738 100644 --- a/cpp/demo/Freeze/library/Collocated.cpp +++ b/cpp/demo/Freeze/library/Collocated.cpp @@ -65,7 +65,7 @@ LibraryCollocated::runFreeze(int argc, char* argv[], const DBEnvironmentPtr& dbE // // Create an Object Adapter, use the Evictor as Servant Locator. // - ObjectAdapterPtr adapter = communicator()->createObjectAdapter("LibraryAdapter"); + ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Library"); adapter->addServantLocator(evictor, "book"); // diff --git a/cpp/demo/Freeze/library/RunParser.cpp b/cpp/demo/Freeze/library/RunParser.cpp index 4dfe8af52c7..9252cb877af 100644 --- a/cpp/demo/Freeze/library/RunParser.cpp +++ b/cpp/demo/Freeze/library/RunParser.cpp @@ -92,19 +92,19 @@ runParser(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) } Ice::PropertiesPtr properties = communicator->getProperties(); - const char* refProperty = "Library.Library"; - string ref = properties->getProperty(refProperty); - if(ref.empty()) + const char* proxyProperty = "Library.Proxy"; + string proxy = properties->getProperty(proxyProperty); + if(proxy.empty()) { - cerr << argv[0] << ": property `" << refProperty << "' not set" << endl; + cerr << argv[0] << ": property `" << proxyProperty << "' not set" << endl; return EXIT_FAILURE; } - Ice::ObjectPrx base = communicator->stringToProxy(ref); + Ice::ObjectPrx base = communicator->stringToProxy(proxy); LibraryPrx phoneBook = LibraryPrx::checkedCast(base); if(!phoneBook) { - cerr << argv[0] << ": invalid object reference" << endl; + cerr << argv[0] << ": invalid proxy" << endl; return EXIT_FAILURE; } diff --git a/cpp/demo/Freeze/library/Server.cpp b/cpp/demo/Freeze/library/Server.cpp index 21672b53e9b..6e2521c6407 100644 --- a/cpp/demo/Freeze/library/Server.cpp +++ b/cpp/demo/Freeze/library/Server.cpp @@ -63,7 +63,7 @@ LibraryServer::runFreeze(int argc, char* argv[], const DBEnvironmentPtr& dbEnv) // // Create an Object Adapter, use the Evictor as Servant Locator. // - ObjectAdapterPtr adapter = communicator()->createObjectAdapter("LibraryAdapter"); + ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Library"); adapter->addServantLocator(evictor, "book"); // diff --git a/cpp/demo/Freeze/library/config b/cpp/demo/Freeze/library/config index 25b727ebe17..6d3702c3492 100644 --- a/cpp/demo/Freeze/library/config +++ b/cpp/demo/Freeze/library/config @@ -1,9 +1,11 @@ -Ice.Adapter.LibraryAdapter.Endpoints=default -p 10000 Ice.ConnectionWarnings=1 #Ice.Trace.Network=3 #Ice.Trace.Protocol=1 -Library.Library=library:default -p 10000 -Library.EvictorSize=3 -#Library.SaveAfterMutatingOperation=1 + Freeze.Trace.DB=1 Freeze.Trace.Evictor=2 + +Library.Endpoints=default -p 10000 +Library.EvictorSize=3 +Library.Proxy=library:default -p 10000 +#Library.SaveAfterMutatingOperation=1 diff --git a/cpp/demo/Freeze/phonebook/Collocated.cpp b/cpp/demo/Freeze/phonebook/Collocated.cpp index 28d01bebdd4..0583761f534 100644 --- a/cpp/demo/Freeze/phonebook/Collocated.cpp +++ b/cpp/demo/Freeze/phonebook/Collocated.cpp @@ -65,7 +65,7 @@ PhoneBookCollocated::runFreeze(int argc, char* argv[], const DBEnvironmentPtr& d // // Create an Object Adapter, use the Evictor as Servant Locator. // - ObjectAdapterPtr adapter = communicator()->createObjectAdapter("PhoneBookAdapter"); + ObjectAdapterPtr adapter = communicator()->createObjectAdapter("PhoneBook"); adapter->addServantLocator(evictor, "contact"); // diff --git a/cpp/demo/Freeze/phonebook/RunParser.cpp b/cpp/demo/Freeze/phonebook/RunParser.cpp index 3ea31e8de6d..2684033e848 100644 --- a/cpp/demo/Freeze/phonebook/RunParser.cpp +++ b/cpp/demo/Freeze/phonebook/RunParser.cpp @@ -93,19 +93,19 @@ runParser(int argc, char* argv[], const CommunicatorPtr& communicator) } PropertiesPtr properties = communicator->getProperties(); - const char* refProperty = "PhoneBook.PhoneBook"; - string ref = properties->getProperty(refProperty); - if(ref.empty()) + const char* proxyProperty = "PhoneBook.Proxy"; + string proxy = properties->getProperty(proxyProperty); + if(proxy.empty()) { - cerr << argv[0] << ": property `" << refProperty << "' not set" << endl; + cerr << argv[0] << ": property `" << proxyProperty << "' not set" << endl; return EXIT_FAILURE; } - ObjectPrx base = communicator->stringToProxy(ref); + ObjectPrx base = communicator->stringToProxy(proxy); PhoneBookPrx phoneBook = PhoneBookPrx::checkedCast(base); if(!phoneBook) { - cerr << argv[0] << ": invalid object reference" << endl; + cerr << argv[0] << ": invalid proxy" << endl; return EXIT_FAILURE; } diff --git a/cpp/demo/Freeze/phonebook/Server.cpp b/cpp/demo/Freeze/phonebook/Server.cpp index cb7a004f040..efd43e7bd42 100644 --- a/cpp/demo/Freeze/phonebook/Server.cpp +++ b/cpp/demo/Freeze/phonebook/Server.cpp @@ -63,7 +63,7 @@ PhoneBookServer::runFreeze(int argc, char* argv[], const DBEnvironmentPtr& dbEnv // // Create an Object Adapter, use the Evictor as Servant Locator. // - ObjectAdapterPtr adapter = communicator()->createObjectAdapter("PhoneBookAdapter"); + ObjectAdapterPtr adapter = communicator()->createObjectAdapter("PhoneBook"); adapter->addServantLocator(evictor, "contact"); // diff --git a/cpp/demo/Freeze/phonebook/config b/cpp/demo/Freeze/phonebook/config index 12ac6bcbaa5..d419a005119 100644 --- a/cpp/demo/Freeze/phonebook/config +++ b/cpp/demo/Freeze/phonebook/config @@ -1,9 +1,11 @@ -Ice.Adapter.PhoneBookAdapter.Endpoints=default -p 10000 Ice.ConnectionWarnings=1 #Ice.Trace.Network=3 #Ice.Trace.Protocol=1 -PhoneBook.PhoneBook=phonebook:default -p 10000 -PhoneBook.EvictorSize=3 -#PhoneBook.SaveAfterMutatingOperation=1 + Freeze.Trace.DB=1 Freeze.Trace.Evictor=2 + +PhoneBook.Endpoints=default -p 10000 +PhoneBook.Proxy=phonebook:default -p 10000 +PhoneBook.EvictorSize=3 +#PhoneBook.SaveAfterMutatingOperation=1 diff --git a/cpp/demo/Glacier/session/Server.cpp b/cpp/demo/Glacier/session/Server.cpp index 7302437029e..7bb7174d6a8 100644 --- a/cpp/demo/Glacier/session/Server.cpp +++ b/cpp/demo/Glacier/session/Server.cpp @@ -37,7 +37,7 @@ private: int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("HelloSessionManagerAdapter"); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("HelloSessionManager"); // // Create the SessionManager. diff --git a/cpp/demo/Glacier/session/config b/cpp/demo/Glacier/session/config index 2f4a14c22d4..d3fc3420026 100644 --- a/cpp/demo/Glacier/session/config +++ b/cpp/demo/Glacier/session/config @@ -1,4 +1,4 @@ -Ice.Adapter.HelloSessionManagerAdapter.Endpoints=tcp -p 10000:udp -p 10000:ssl -p 10001 +HelloSessionManager.Endpoints=tcp -p 10000:udp -p 10000:ssl -p 10001 Ice.ConnectionWarnings=1 Ice.Trace.Network=1 diff --git a/cpp/demo/Ice/callback/Client.cpp b/cpp/demo/Ice/callback/Client.cpp index ebb815ca47e..029bba73400 100644 --- a/cpp/demo/Ice/callback/Client.cpp +++ b/cpp/demo/Ice/callback/Client.cpp @@ -50,19 +50,19 @@ int CallbackClient::run(int argc, char* argv[]) { PropertiesPtr properties = communicator()->getProperties(); - const char* refProperty = "Callback.Callback"; - std::string ref = properties->getProperty(refProperty); - if(ref.empty()) + const char* proxyProperty = "Callback.Client.Callback"; + std::string proxy = properties->getProperty(proxyProperty); + if(proxy.empty()) { - cerr << appName() << ": property `" << refProperty << "' not set" << endl; + cerr << appName() << ": property `" << proxyProperty << "' not set" << endl; return EXIT_FAILURE; } - ObjectPrx base = communicator()->stringToProxy(ref); + ObjectPrx base = communicator()->stringToProxy(proxy); CallbackPrx twoway = CallbackPrx::checkedCast(base->ice_twoway()->ice_timeout(-1)->ice_secure(false)); if(!twoway) { - cerr << appName() << ": invalid object reference" << endl; + cerr << appName() << ": invalid proxy" << endl; return EXIT_FAILURE; } CallbackPrx oneway = CallbackPrx::uncheckedCast(twoway->ice_oneway()); @@ -70,7 +70,7 @@ CallbackClient::run(int argc, char* argv[]) CallbackPrx datagram = CallbackPrx::uncheckedCast(twoway->ice_datagram()); CallbackPrx batchDatagram = CallbackPrx::uncheckedCast(twoway->ice_batchDatagram()); - ObjectAdapterPtr adapter = communicator()->createObjectAdapter("CallbackReceiverAdapter"); + ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Callback.Client"); adapter->add(new CallbackReceiverI, stringToIdentity("callbackReceiver")); adapter->activate(); diff --git a/cpp/demo/Ice/callback/Server.cpp b/cpp/demo/Ice/callback/Server.cpp index 4ce327b5452..1db4a0d76d8 100644 --- a/cpp/demo/Ice/callback/Server.cpp +++ b/cpp/demo/Ice/callback/Server.cpp @@ -31,7 +31,7 @@ main(int argc, char* argv[]) int CallbackServer::run(int argc, char* argv[]) { - ObjectAdapterPtr adapter = communicator()->createObjectAdapter("CallbackAdapter"); + ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Callback.Server"); CallbackPrx self = CallbackPrx::uncheckedCast(adapter->createProxy(Ice::stringToIdentity("callback"))); adapter->add(new CallbackI(communicator()), Ice::stringToIdentity("callback")); adapter->activate(); diff --git a/cpp/demo/Ice/callback/config b/cpp/demo/Ice/callback/config index af5e066343e..6383a74a85d 100644 --- a/cpp/demo/Ice/callback/config +++ b/cpp/demo/Ice/callback/config @@ -1,5 +1,10 @@ -Callback.Callback=callback:tcp -p 10000:udp -p 10000:ssl -p 10001 -Ice.Adapter.CallbackReceiverAdapter.Endpoints=tcp:udp:ssl +Callback.Client.Callback=callback:tcp -p 10000:udp -p 10000:ssl -p 10001 +Callback.Client.Endpoints=tcp:udp:ssl + +# Uncomment the following lines if you want to run this demo with Glacier +Ice.Default.Router=Glacier/router:default -p 10005 +Callback.Client.Router=Glacier/router:default -p 10005 +Callback.Client.Endpoints= #Ice.Trace.Network=1 #Ice.Trace.Protocol=1 @@ -22,8 +27,3 @@ Glacier.Router.Server.ForwardContext=1 Glacier.Router.Client.ForwardContext=1 Glacier.Router.Server.BatchSleepTime=2000 Glacier.Router.Client.BatchSleepTime=2000 - -# Uncomment the following lines if you want to run this demo with Glacier -Ice.Default.Router=Glacier/router:default -p 10005 -Ice.Adapter.CallbackReceiverAdapter.Router=Glacier/router:default -p 10005 -Ice.Adapter.CallbackReceiverAdapter.Endpoints= diff --git a/cpp/demo/Ice/callback/config.server b/cpp/demo/Ice/callback/config.server index d33b8c73dad..d7b901f7a68 100644 --- a/cpp/demo/Ice/callback/config.server +++ b/cpp/demo/Ice/callback/config.server @@ -1,4 +1,4 @@ -Ice.Adapter.CallbackAdapter.Endpoints=tcp -p 10000:udp -p 10000:ssl -p 10001 +Callback.Server.Endpoints=tcp -p 10000:udp -p 10000:ssl -p 10001 #Ice.Trace.Network=1 #Ice.Trace.Protocol=1 diff --git a/cpp/demo/Ice/hello/Client.cpp b/cpp/demo/Ice/hello/Client.cpp index 66eb660fbc3..24046e25d96 100644 --- a/cpp/demo/Ice/hello/Client.cpp +++ b/cpp/demo/Ice/hello/Client.cpp @@ -35,19 +35,19 @@ int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { Ice::PropertiesPtr properties = communicator->getProperties(); - const char* refProperty = "Hello.Hello"; - std::string ref = properties->getProperty(refProperty); - if(ref.empty()) + const char* proxyProperty = "Hello.Proxy"; + std::string proxy = properties->getProperty(proxyProperty); + if(proxy.empty()) { - cerr << argv[0] << ": property `" << refProperty << "' not set" << endl; + cerr << argv[0] << ": property `" << proxyProperty << "' not set" << endl; return EXIT_FAILURE; } - Ice::ObjectPrx base = communicator->stringToProxy(ref); + Ice::ObjectPrx base = communicator->stringToProxy(proxy); HelloPrx twoway = HelloPrx::checkedCast(base->ice_twoway()->ice_timeout(-1)->ice_secure(false)); if(!twoway) { - cerr << argv[0] << ": invalid object reference" << endl; + cerr << argv[0] << ": invalid proxy" << endl; return EXIT_FAILURE; } HelloPrx oneway = HelloPrx::uncheckedCast(twoway->ice_oneway()); diff --git a/cpp/demo/Ice/hello/Server.cpp b/cpp/demo/Ice/hello/Server.cpp index a77c52e2032..f4c3ece91c5 100644 --- a/cpp/demo/Ice/hello/Server.cpp +++ b/cpp/demo/Ice/hello/Server.cpp @@ -16,7 +16,7 @@ using namespace std; int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("HelloAdapter"); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Hello"); Ice::ObjectPtr object = new HelloI(communicator); adapter->add(object, Ice::stringToIdentity("hello")); adapter->activate(); diff --git a/cpp/demo/Ice/hello/config b/cpp/demo/Ice/hello/config index f7b6e327fc0..aae6a5276f9 100644 --- a/cpp/demo/Ice/hello/config +++ b/cpp/demo/Ice/hello/config @@ -2,14 +2,14 @@ # The client reads this property to create the reference to the # "hello" object in the server. # -Hello.Hello=hello:tcp -p 10000:udp -p 10000:ssl -p 10001 +Hello.Proxy=hello:tcp -p 10000:udp -p 10000:ssl -p 10001 # # The server creates one single object adapter with the name # "HelloAdapter". The following line sets the endpoints for this # adapter. # -Ice.Adapter.HelloAdapter.Endpoints=tcp -p 10000:udp -p 10000:ssl -p 10001 +Hello.Endpoints=tcp -p 10000:udp -p 10000:ssl -p 10001 # # Warn about connection exceptions diff --git a/cpp/demo/Ice/latency/Client.cpp b/cpp/demo/Ice/latency/Client.cpp index 3c9920a43ac..f81d1733606 100644 --- a/cpp/demo/Ice/latency/Client.cpp +++ b/cpp/demo/Ice/latency/Client.cpp @@ -17,19 +17,19 @@ int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { Ice::PropertiesPtr properties = communicator->getProperties(); - const char* refProperty = "Latency.Ping"; - std::string ref = properties->getProperty(refProperty); - if(ref.empty()) + const char* proxyProperty = "Latency.Ping"; + std::string proxy = properties->getProperty(proxyProperty); + if(proxy.empty()) { - cerr << argv[0] << ": property `" << refProperty << "' not set" << endl; + cerr << argv[0] << ": property `" << proxyProperty << "' not set" << endl; return EXIT_FAILURE; } - Ice::ObjectPrx base = communicator->stringToProxy(ref); + Ice::ObjectPrx base = communicator->stringToProxy(proxy); PingPrx ping = PingPrx::checkedCast(base); if(!ping) { - cerr << argv[0] << ": invalid object reference" << endl; + cerr << argv[0] << ": invalid proxy" << endl; return EXIT_FAILURE; } diff --git a/cpp/demo/Ice/latency/Server.cpp b/cpp/demo/Ice/latency/Server.cpp index d0ff8237506..a9b6ebdbc2e 100644 --- a/cpp/demo/Ice/latency/Server.cpp +++ b/cpp/demo/Ice/latency/Server.cpp @@ -16,7 +16,7 @@ using namespace std; int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("LatencyAdapter"); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Latency"); Ice::ObjectPtr object = new Ping; adapter->add(object, Ice::stringToIdentity("ping")); adapter->activate(); diff --git a/cpp/demo/Ice/latency/config b/cpp/demo/Ice/latency/config index 1031518505f..0e05f54a78e 100644 --- a/cpp/demo/Ice/latency/config +++ b/cpp/demo/Ice/latency/config @@ -1,5 +1,5 @@ Latency.Ping=ping:default -p 10000 -Ice.Adapter.LatencyAdapter.Endpoints=default -p 10000 +Latency.Endpoints=default -p 10000 #Ice.Plugin.IceSSL=IceSSL:create IceSSL.Client.CertPath=../../../certs diff --git a/cpp/demo/Ice/nested/Client.cpp b/cpp/demo/Ice/nested/Client.cpp index 334870d11dc..f5b6e72f6cb 100644 --- a/cpp/demo/Ice/nested/Client.cpp +++ b/cpp/demo/Ice/nested/Client.cpp @@ -32,23 +32,23 @@ int NestedClient::run(int argc, char* argv[]) { PropertiesPtr properties = communicator()->getProperties(); - const char* refProperty = "Nested.NestedServer"; - std::string ref = properties->getProperty(refProperty); - if(ref.empty()) + const char* proxyProperty = "Nested.Client.NestedServer"; + std::string proxy = properties->getProperty(proxyProperty); + if(proxy.empty()) { - cerr << appName() << ": property `" << refProperty << "' not set" << endl; + cerr << appName() << ": property `" << proxyProperty << "' not set" << endl; return EXIT_FAILURE; } - ObjectPrx base = communicator()->stringToProxy(ref); + ObjectPrx base = communicator()->stringToProxy(proxy); NestedPrx nested = NestedPrx::checkedCast(base); if(!nested) { - cerr << appName() << ": invalid object reference" << endl; + cerr << appName() << ": invalid proxy" << endl; return EXIT_FAILURE; } - ObjectAdapterPtr adapter = communicator()->createObjectAdapter("NestedClientAdapter"); + ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Nested.Client"); NestedPrx self = NestedPrx::uncheckedCast(adapter->createProxy(Ice::stringToIdentity("nestedClient"))); adapter->add(new NestedI(self), Ice::stringToIdentity("nestedClient")); adapter->activate(); diff --git a/cpp/demo/Ice/nested/Server.cpp b/cpp/demo/Ice/nested/Server.cpp index 19023fabdce..c9284a75dab 100644 --- a/cpp/demo/Ice/nested/Server.cpp +++ b/cpp/demo/Ice/nested/Server.cpp @@ -31,7 +31,7 @@ main(int argc, char* argv[]) int NestedServer::run(int argc, char* argv[]) { - ObjectAdapterPtr adapter = communicator()->createObjectAdapter("NestedServerAdapter"); + ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Nested.Server"); NestedPrx self = NestedPrx::uncheckedCast(adapter->createProxy(Ice::stringToIdentity("nestedServer"))); adapter->add(new NestedI(self), Ice::stringToIdentity("nestedServer")); adapter->activate(); diff --git a/cpp/demo/Ice/nested/config b/cpp/demo/Ice/nested/config index 8f863717fef..9de9263fe25 100644 --- a/cpp/demo/Ice/nested/config +++ b/cpp/demo/Ice/nested/config @@ -1,5 +1,5 @@ -Nested.NestedServer=nestedServer:default -p 10000 -t 10000 -Ice.Adapter.NestedClientAdapter.Endpoints=default -t 10000 +Nested.Client.NestedServer=nestedServer:default -p 10000 -t 10000 +Nested.Client.Endpoints=default -t 10000 Ice.ThreadPool.Size=50 #Ice.Trace.Network=1 diff --git a/cpp/demo/Ice/nested/config.server b/cpp/demo/Ice/nested/config.server index 6499354438d..0c60e507615 100644 --- a/cpp/demo/Ice/nested/config.server +++ b/cpp/demo/Ice/nested/config.server @@ -1,4 +1,4 @@ -Ice.Adapter.NestedServerAdapter.Endpoints=default -p 10000 -t 10000 +Nested.Server.Endpoints=default -p 10000 -t 10000 Ice.ThreadPool.Size=50 #Ice.Trace.Network=1 diff --git a/cpp/demo/Ice/value/Server.cpp b/cpp/demo/Ice/value/Server.cpp index 42d88b9b617..2f4e73af40b 100644 --- a/cpp/demo/Ice/value/Server.cpp +++ b/cpp/demo/Ice/value/Server.cpp @@ -16,7 +16,7 @@ using namespace std; int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("ValueAdapter"); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Value"); Ice::ObjectPtr object = new InitialI(adapter); adapter->add(object, Ice::stringToIdentity("initial")); adapter->activate(); diff --git a/cpp/demo/Ice/value/config b/cpp/demo/Ice/value/config index d06219e3768..02f0649ae73 100644 --- a/cpp/demo/Ice/value/config +++ b/cpp/demo/Ice/value/config @@ -1,5 +1,5 @@ Value.Initial=initial:default -p 10000 -Ice.Adapter.ValueAdapter.Endpoints=default -p 10000 +Value.Endpoints=default -p 10000 Ice.Plugin.IceSSL=IceSSL:create IceSSL.Client.CertPath=../../../certs diff --git a/cpp/demo/IceBox/hello/Client.cpp b/cpp/demo/IceBox/hello/Client.cpp index 6394105e52d..d3d5839a45c 100644 --- a/cpp/demo/IceBox/hello/Client.cpp +++ b/cpp/demo/IceBox/hello/Client.cpp @@ -34,19 +34,19 @@ int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { Ice::PropertiesPtr properties = communicator->getProperties(); - const char* refProperty = "Hello.Hello"; - std::string ref = properties->getProperty(refProperty); - if(ref.empty()) + const char* proxyProperty = "Hello.Proxy"; + std::string proxy = properties->getProperty(proxyProperty); + if(proxy.empty()) { - cerr << argv[0] << ": property `" << refProperty << "' not set" << endl; + cerr << argv[0] << ": property `" << proxyProperty << "' not set" << endl; return EXIT_FAILURE; } - Ice::ObjectPrx base = communicator->stringToProxy(ref); + Ice::ObjectPrx base = communicator->stringToProxy(proxy); HelloPrx twoway = HelloPrx::checkedCast(base->ice_twoway()->ice_timeout(-1)->ice_secure(false)); if(!twoway) { - cerr << argv[0] << ": invalid object reference" << endl; + cerr << argv[0] << ": invalid proxy" << endl; return EXIT_FAILURE; } HelloPrx oneway = HelloPrx::uncheckedCast(twoway->ice_oneway()); diff --git a/cpp/demo/IceBox/hello/HelloServiceI.cpp b/cpp/demo/IceBox/hello/HelloServiceI.cpp index 5f70e8bf3aa..ffcd7b95d27 100644 --- a/cpp/demo/IceBox/hello/HelloServiceI.cpp +++ b/cpp/demo/IceBox/hello/HelloServiceI.cpp @@ -29,10 +29,9 @@ HelloServiceI::~HelloServiceI() void HelloServiceI::start(const string& name, const ::Ice::CommunicatorPtr& communicator, - const ::Ice::PropertiesPtr& properties, const ::Ice::StringSeq& args) { - _adapter = communicator->createObjectAdapter(name + "Adapter"); + _adapter = communicator->createObjectAdapter(name); ::Ice::ObjectPtr object = new HelloI(communicator); _adapter->add(object, ::Ice::stringToIdentity("hello")); _adapter->activate(); diff --git a/cpp/demo/IceBox/hello/HelloServiceI.h b/cpp/demo/IceBox/hello/HelloServiceI.h index 9c39a006a83..bbaf1323aa7 100644 --- a/cpp/demo/IceBox/hello/HelloServiceI.h +++ b/cpp/demo/IceBox/hello/HelloServiceI.h @@ -28,7 +28,6 @@ public: virtual void start(const ::std::string&, const ::Ice::CommunicatorPtr&, - const ::Ice::PropertiesPtr&, const ::Ice::StringSeq&); virtual void stop(); diff --git a/cpp/demo/IceBox/hello/config b/cpp/demo/IceBox/hello/config index c614fac6847..1054087c8e7 100644 --- a/cpp/demo/IceBox/hello/config +++ b/cpp/demo/IceBox/hello/config @@ -12,14 +12,14 @@ IceBox.Service.Hello=HelloService:create # The client reads this property to create the reference to the # "hello" object in the server. # -Hello.Hello=hello:tcp -p 10000:udp -p 10000:ssl -p 10001 +Hello.Proxy=hello:tcp -p 10000:udp -p 10000:ssl -p 10001 # # The server creates one single object adapter with the name # "helloadapater". The following line sets the endpoints for this # adapter # -Ice.Adapter.HelloAdapter.Endpoints=tcp -p 10000:udp -p 10000:ssl -p 10001 +Hello.Endpoints=tcp -p 10000:udp -p 10000:ssl -p 10001 # # Warn about connection exceptions diff --git a/cpp/demo/IceStorm/clock/Publisher.cpp b/cpp/demo/IceStorm/clock/Publisher.cpp index dd09515c34d..751c730d0a9 100644 --- a/cpp/demo/IceStorm/clock/Publisher.cpp +++ b/cpp/demo/IceStorm/clock/Publisher.cpp @@ -34,19 +34,19 @@ Publisher::run(int argc, char* argv[]) { Ice::PropertiesPtr properties = communicator()->getProperties(); - static const string referenceProperty = "IceStorm.TopicManager"; - string reference = properties->getProperty(referenceProperty); - if(reference.empty()) + static const string proxyProperty = "IceStorm.TopicManager.Proxy"; + string proxy = properties->getProperty(proxyProperty); + if(proxy.empty()) { - cerr << appName() << ": property `" << referenceProperty << "' not set" << endl; + cerr << appName() << ": property `" << proxyProperty << "' not set" << endl; return EXIT_FAILURE; } - Ice::ObjectPrx base = communicator()->stringToProxy(reference); + Ice::ObjectPrx base = communicator()->stringToProxy(proxy); IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(base); if(!manager) { - cerr << appName() << ": invalid object reference" << endl; + cerr << appName() << ": invalid proxy" << endl; return EXIT_FAILURE; } diff --git a/cpp/demo/IceStorm/clock/Subscriber.cpp b/cpp/demo/IceStorm/clock/Subscriber.cpp index 6e266e6d3b8..766df81d859 100644 --- a/cpp/demo/IceStorm/clock/Subscriber.cpp +++ b/cpp/demo/IceStorm/clock/Subscriber.cpp @@ -37,19 +37,19 @@ Subscriber::run(int argc, char* argv[]) { Ice::PropertiesPtr properties = communicator()->getProperties(); - static const string referenceProperty = "IceStorm.TopicManager"; - string reference = properties->getProperty(referenceProperty); - if(reference.empty()) + static const string proxyProperty = "IceStorm.TopicManager.Proxy"; + string proxy = properties->getProperty(proxyProperty); + if(proxy.empty()) { - cerr << appName() << ": property `" << referenceProperty << "' not set" << endl; + cerr << appName() << ": property `" << proxyProperty << "' not set" << endl; return EXIT_FAILURE; } - Ice::ObjectPrx base = communicator()->stringToProxy(reference); + Ice::ObjectPrx base = communicator()->stringToProxy(proxy); IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(base); if(!manager) { - cerr << appName() << ": invalid object reference" << endl; + cerr << appName() << ": invalid proxy" << endl; return EXIT_FAILURE; } @@ -81,7 +81,7 @@ Subscriber::run(int argc, char* argv[]) // // Create the servant to receive the events. // - Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapterWithEndpoints("ClockAdapter", "tcp"); + Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Clock.Subscriber"); Ice::ObjectPtr clock = new ClockI(); // diff --git a/cpp/demo/IceStorm/clock/config b/cpp/demo/IceStorm/clock/config index a7e2c7be493..04fd18f9794 100644 --- a/cpp/demo/IceStorm/clock/config +++ b/cpp/demo/IceStorm/clock/config @@ -1,13 +1,19 @@ # -# This property defines the endpoints on which the IceStorm -# TopicManager listens. +# This property is used to configure the endpoints of the clock +# subscriber adapter. # -IceStorm.TopicManager.Endpoints=default -p 10000 +Clock.Subscriber.Endpoints=tcp # # This property is used by the clients to connect to IceStorm. # -IceStorm.TopicManager=IceStorm.TopicManager: default -p 10000 +IceStorm.TopicManager.Proxy=IceStorm/TopicManager:default -p 10000 + +# +# This property defines the endpoints on which the IceStorm +# TopicManager listens. +# +IceStorm.TopicManager.Endpoints=default -p 10000 # # TopicManager Tracing diff --git a/cpp/doc/Properties.sgml b/cpp/doc/Properties.sgml index 86654638b80..b9a509115ab 100644 --- a/cpp/doc/Properties.sgml +++ b/cpp/doc/Properties.sgml @@ -121,10 +121,10 @@ The request retry tracing level: <section><title>&Ice; Object Adapter Properties</title> <!-- ********************************************************************** --> -<section><title>Ice.Adapter.<replaceable>name</replaceable>.Endpoints</title> +<section><title><replaceable>name</replaceable>.Endpoints</title> <section><title>Synopsis</title> <synopsis> -Ice.Adapter.<replaceable>name</replaceable>.Endpoints=<replaceable>endpoints</replaceable> +<replaceable>name</replaceable>.Endpoints=<replaceable>endpoints</replaceable> </synopsis> </section> <section> @@ -132,17 +132,15 @@ Ice.Adapter.<replaceable>name</replaceable>.Endpoints=<replaceable>endpoints</re <para> Sets the endpoints for the object adapter <replaceable>name</replaceable> to -<replaceable>endpoints</replaceable>, provided that such object adapter -has been created with -<literal>Ice::Communicator::createObjectAdapter</literal>. +<replaceable>endpoints</replaceable>. </para> </section> </section> -<section><title>Ice.Adapter.<replaceable>name</replaceable>.Router</title> +<section><title><replaceable>name</replaceable>.Router</title> <section><title>Synopsis</title> <synopsis> -Ice.Adapter.<replaceable>name</replaceable>.Router=<replaceable>router</replaceable> +<replaceable>name</replaceable>.Router=<replaceable>router</replaceable> </synopsis> </section> <section> @@ -162,10 +160,10 @@ router. </para></note> </section> </section> -<section><title>Ice.Adapter.<replaceable>name</replaceable>.Locator</title> +<section><title><replaceable>name</replaceable>.Locator</title> <section><title>Synopsis</title> <synopsis> -Ice.Adapter.<replaceable>name</replaceable>.Locator=<replaceable>locator</replaceable> +<replaceable>name</replaceable>.Locator=<replaceable>locator</replaceable> </synopsis> </section> <section> @@ -173,11 +171,26 @@ Ice.Adapter.<replaceable>name</replaceable>.Locator=<replaceable>locator</replac <para> Specifies a locator (as stringified proxy to the &Ice; locator interface) for the object adapter with the name -<replaceable>name</replaceable>. By doing so, the object adapter will -register itself and its endpoints with the locator registry from this -locator. To prevent the object adapter to register its endpoints with -the locator registry you can set <replaceable>locator</replaceable> to -0. +<replaceable>name</replaceable>. +</para> +</section> +</section> + +<section><title><replaceable>name</replaceable>.AdapterId</title> +<section><title>Synopsis</title> +<synopsis> +<replaceable>name</replaceable>.AdapterId=<replaceable>id</replaceable> +</synopsis> +</section> +<section> +<title>Description</title> +<para> +Specifies an identity for the object adapter with the name +<replaceable>name</replaceable>. This identity needs to be +unique among object adapters using a same locator instance. If the +default locator or the object adapter locator is set, the object +adapter will set its endpoints with the locator registry when it's +activated. </para> </section> </section> @@ -790,55 +803,107 @@ There are no default values for these properties. <section><title>&IceBox; Properties</title> <!-- ********************************************************************** --> -<section><title>IceBox.Name</title> +<section><title>IceBox.ServiceManager.Endpoints</title> <section><title>Synopsis</title> <synopsis> -IceBox.Name=<replaceable>name</replaceable> +IceBox.ServiceManager.Endpoints=<replaceable>endpoints</replaceable> </synopsis> </section> <section> <title>Description</title> <para> -Defines the name of the &IceBox; server. This property needs to be set -if the &IceBox; server is used with the locator to uniquely identify -the service manager object adapter. It's also used to create a unique -service manager object identity if the property -<literal>IceBox.ServiceManager.Identity</literal> is not specified. +Defines the endpoints of the &IceBox; service manager interface. The +service manager endpoints must be accessible to the &IceBox; +administration tool to shutdown the &IceBox; server. </para> </section> </section> -<section><title>IceBox.ServiceManager.Endpoints</title> +<section><title>IceBox.ServiceManager.Identity</title> <section><title>Synopsis</title> <synopsis> -IceBox.ServiceManager.Endpoints=<replaceable>endpoints</replaceable> +IceBox.ServiceManager.Identity=<replaceable>identity</replaceable> </synopsis> </section> <section> <title>Description</title> <para> -Defines the endpoints of the &IceBox; service manager interface. The -service manager endpoints must be accessible to the &IceBox; -administration tool to shutdown the &IceBox; server. +The identity of the service manager interface. If not specified the +default value <literal>ServiceManager</literal> is used. </para> </section> </section> -<section><title>IceBox.ServiceManager.Identity</title> +<section><title>IceBox.PrintServicesReady</title> <section><title>Synopsis</title> <synopsis> -IceBox.ServiceManager.Identity=<replaceable>identity</replaceable> +IceBox.PrintServicesReady=<replaceable>token</replaceable> +</synopsis> +</section> +<section> +<title>Description</title> +<para> +The service manager will print "<replaceable>token</replaceable> +ready" on standard output after initialization of all the service is +done. This is useful for scripts that wish to wait until all services +are ready to be used. +</para> +</section> +</section> + +<section><title>IceBox.Service.<replaceable>name</replaceable></title> +<section><title>Synopsis</title> +<synopsis> +IceBox.Service.<replaceable>name</replaceable>=<replaceable>entry_point [args]</replaceable> +</synopsis> +</section> +<section> +<title>Description</title> +<para> +Defines a service to be loaded during the &IceBox; initialization. +</para> +<para> +In C++, <replaceable>entry_point</replaceable> has the form +<literal>library:symbol</literal>. The <literal>library</literal> +component is the name of a shared library or DLL. The +<literal>symbol</literal> component is the name of a factory +function used to create the service. +</para> +<para> +In Java, <replaceable>entry_point</replaceable> is the name of the +service implementation class. +</para> +</section> +</section> + +<section><title>IceBox.DBEnvName.<replaceable>name</replaceable></title> +<section><title>Synopsis</title> +<synopsis> +IceBox.DBEnvName.<replaceable>name</replaceable>=<replaceable>db</replaceable> +</synopsis> +</section> +<section> +<title>Description</title> +<para> +Defines the database environment directory for the &Freeze; service +with the name <replaceable>name</replaceable>. +</para> +</section> +</section> + +<section><title>IceBox.UseSharedCommunicator.<replaceable>name</replaceable></title> +<section><title>Synopsis</title> +<synopsis> +IceBox.UseSharedCommunicator.<replaceable>name</replaceable>=<replaceable>num</replaceable> </synopsis> </section> <section> <title>Description</title> <para> -The identity of the service manager interface. If not specified and if -<literal>IceBox.Name</literal> is specified, the identity will be -<literal>ServiceManager</literal> prefixed with the value of the -<literal>IceBox.Name</literal> property. If -<literal>IceBox.Name</literal> is not specified the default value -<literal>ServiceManager</literal> is used. +If <replaceable>num</replaceable> is set to a value larger than zero, +the service manager will supply the service with the name +<replaceable>name</replaceable> a communicator wich might be shared by +other services. </para> </section> </section> diff --git a/cpp/slice/Ice/Communicator.ice b/cpp/slice/Ice/Communicator.ice index dd604ced938..e2f13151fb6 100644 --- a/cpp/slice/Ice/Communicator.ice +++ b/cpp/slice/Ice/Communicator.ice @@ -132,66 +132,20 @@ local interface Communicator * * Create a new object adapter. The endpoints for the object * adapter are taken from the property - * <literal>Ice.Adapter.<replaceable>name</replaceable>.Endpoints</literal>, - * with <replaceable>name</replaceable> being the name of the - * object adapter. + * <literal><replaceable>name</replaceable>.Endpoints</literal>. * - * @param name The name to use for the object adapter. This name - * must be unique for the communicator. + * @param name The object adapter name. * * @return The new object adapter. * * @see ObjectAdapter * @see Properties - * @see createObjectAdapterFromProperty - * @see createObjectAdapterWithEndpoints * **/ ObjectAdapter createObjectAdapter(string name); /** * - * Create a new object adapter from a property. The endpoints for - * the object adapter are taken from the property - * <replaceable>property</replaceable>. - * - * @param name The name to use for the object adapter. This name - * must be unique for the communicator. - * - * @param property The property from which the endpoints are taken. - * - * @return The new object adapter. - * - * @see Properties - * @see ObjectAdapter - * @see createObjectAdapterWithEndpoints - * - **/ - ObjectAdapter createObjectAdapterFromProperty(string name, string property); - - /** - * - * Create a new object adapter with a list of endpoints. In - * contrast to [createObjectAdapter] and - * [createObjectAdapterFromProperty], the endpoints to use are - * passed explicitly as a parameter. - * - * @param name The name to use for the object adapter. This name - * must be unique for the communicator. - * - * @param endpts The list of endpoints for the object adapter. - * - * @return The new object adapter. - * - * @see ObjectAdapter - * @see createObjectAdapter - * @see createObjectAdapterFromProperty - * - **/ - ObjectAdapter createObjectAdapterWithEndpoints(string name, string endpts); - - /** - * * Add a Servant factory to this communicator. If a factory has * already been installed for the given id, the current factory * for this id is replaced by the new one. diff --git a/cpp/slice/Ice/ObjectAdapter.ice b/cpp/slice/Ice/ObjectAdapter.ice index 106d52006fa..efd3030c533 100644 --- a/cpp/slice/Ice/ObjectAdapter.ice +++ b/cpp/slice/Ice/ObjectAdapter.ice @@ -34,18 +34,6 @@ local interface ObjectAdapter { /** * - * Get the name of this object adapter. The name is mainly used - * for configuration purposes with Properties. - * - * @return The name of this object adapter. - * - * @see Properties - * - **/ - string getName(); - - /** - * * Get the communicator this object adapter belongs to. * * @return This object adapter's communicator. diff --git a/cpp/slice/IceBox/IceBox.ice b/cpp/slice/IceBox/IceBox.ice index 5440d0c6f6b..df23ebec60e 100644 --- a/cpp/slice/IceBox/IceBox.ice +++ b/cpp/slice/IceBox/IceBox.ice @@ -26,8 +26,7 @@ module IceBox * unable to load a service executable. * **/ -// ML: Shouldn't this be local? -exception FailureException +local exception FailureException { /** * @@ -107,10 +106,8 @@ local interface Service extends ServiceBase /** * * Initialize the service. The given Communicator is created by - * the [ServiceManager]. The service may use this instance, or may - * create its own as needed. The advantage of using this - * Communicator instance is that invocations between collocated - * services are optimized. + * the [ServiceManager]. It may be shared by other services + * depending on the service configuration. * * <note><para>The [ServiceManager] owns this Communicator, and is * responsible for destroying it.</para></note> @@ -121,10 +118,6 @@ local interface Service extends ServiceBase * @param communicator The [ServiceManager]'s Communicator * instance. * - * @param properties The property set representing the service's - * command-line arguments of the form - * [--<replaceable>name</replaceable>.key=value]. - * * @param args The service arguments which were not converted into * properties. * @@ -133,7 +126,7 @@ local interface Service extends ServiceBase * @see start * **/ - void start(string name, Ice::Communicator communicator, Ice::Properties properties, Ice::StringSeq args) + void start(string name, Ice::Communicator communicator, Ice::StringSeq args) throws FailureException; }; @@ -152,10 +145,8 @@ local interface FreezeService extends ServiceBase /** * * Initialize the service. The given Communicator is created by - * the [ServiceManager]. The service may use this instance, or may - * create its own as needed. The advantage of using this - * Communicator instance is that invocations between collocated - * services are optimized. + * the [ServiceManager]. It may be shared by other services + * depending on the service configuration. * * <note><para>The [ServiceManager] owns this Communicator, and is * responsible for destroying it.</para></note> @@ -166,10 +157,6 @@ local interface FreezeService extends ServiceBase * @param communicator The [ServiceManager]'s Communicator * instance. * - * @param properties The property set representing the service's - * command-line arguments of the form - * [--<replaceable>name</replaceable>.key=value]. - * * @param args The service arguments which were not converted into * properties. * @@ -180,8 +167,7 @@ local interface FreezeService extends ServiceBase * @see ServiceBase * **/ - void start(string name, Ice::Communicator communicator, Ice::Properties properties, Ice::StringSeq args, - Freeze::DBEnvironment dbEnv) + void start(string name, Ice::Communicator communicator, Ice::StringSeq args, Freeze::DBEnvironment dbEnv) throws FailureException; }; diff --git a/cpp/src/Glacier/GlacierRouter.cpp b/cpp/src/Glacier/GlacierRouter.cpp index 2035ef2d13c..83fb5e59270 100644 --- a/cpp/src/Glacier/GlacierRouter.cpp +++ b/cpp/src/Glacier/GlacierRouter.cpp @@ -167,26 +167,20 @@ Glacier::RouterApp::run(int argc, char* argv[]) // Initialize the client object adapter. // const char* clientEndpointsProperty = "Glacier.Router.Client.Endpoints"; - string clientEndpoints = properties->getProperty(clientEndpointsProperty); - if(clientEndpoints.empty()) + if(properties->getProperty(clientEndpointsProperty).empty()) { cerr << appName() << ": property `" << clientEndpointsProperty << "' is not set" << endl; return EXIT_FAILURE; } - ObjectAdapterPtr clientAdapter = communicator()->createObjectAdapterFromProperty("Client", - clientEndpointsProperty); - clientAdapter->setLocator(0); + ObjectAdapterPtr clientAdapter = communicator()->createObjectAdapter("Glacier.Router.Client"); // // Initialize the server object adapter. // - const char* serverEndpointsProperty = "Glacier.Router.Server.Endpoints"; - string serverEndpoints = properties->getProperty(serverEndpointsProperty); ObjectAdapterPtr serverAdapter; - if(!serverEndpoints.empty()) + if(!properties->getProperty("Glacier.Router.Server.Endpoints").empty()) { - serverAdapter = communicator()->createObjectAdapterFromProperty("Server", serverEndpointsProperty); - serverAdapter->setLocator(0); + serverAdapter = communicator()->createObjectAdapter("Glacier.Router.Server"); } // @@ -209,8 +203,7 @@ Glacier::RouterApp::run(int argc, char* argv[]) // Initialize the router object adapter and the router object. // const char* routerEndpointsProperty = "Glacier.Router.Endpoints"; - string routerEndpoints = properties->getProperty(routerEndpointsProperty); - if(routerEndpoints.empty()) + if(properties->getProperty(routerEndpointsProperty).empty()) { cerr << appName() << ": property `" << routerEndpointsProperty << "' is not set" << endl; return EXIT_FAILURE; @@ -231,9 +224,7 @@ Glacier::RouterApp::run(int argc, char* argv[]) const char* userIdProperty = "Glacier.Router.UserId"; string userId = properties->getProperty(userIdProperty); - ObjectAdapterPtr routerAdapter = - communicator()->createObjectAdapterFromProperty("Router", routerEndpointsProperty); - routerAdapter->setLocator(0); + ObjectAdapterPtr routerAdapter = communicator()->createObjectAdapter("Glacier.Router"); RouterPtr router = new RouterI(clientAdapter, serverAdapter, routingTable, sessionManagerPrx, userId); routerAdapter->add(router, stringToIdentity(routerIdentity)); @@ -307,7 +298,7 @@ main(int argc, char* argv[]) defaultProperties = getDefaultProperties(argc, argv); StringSeq args = argsToStringSeq(argc, argv); args = defaultProperties->parseCommandLineOptions("Ice", args); - args = defaultProperties->parseCommandLineOptions("Glacier", args); + args = defaultProperties->parseCommandLineOptions("Glacier.Router", args); stringSeqToArgs(args, argc, argv); } catch(const Exception& ex) diff --git a/cpp/src/Glacier/GlacierStarter.cpp b/cpp/src/Glacier/GlacierStarter.cpp index e337d7bd0ab..c3601c998b0 100644 --- a/cpp/src/Glacier/GlacierStarter.cpp +++ b/cpp/src/Glacier/GlacierStarter.cpp @@ -75,14 +75,12 @@ Glacier::RouterApp::run(int argc, char* argv[]) // adapter doesn't register itself with the locator). // const char* endpointsProperty = "Glacier.Starter.Endpoints"; - string endpoints = properties->getProperty(endpointsProperty); - if(endpoints.empty()) + if(properties->getProperty(endpointsProperty).empty()) { cerr << appName() << ": property `" << endpointsProperty << "' is not set" << endl; return EXIT_FAILURE; } - ObjectAdapterPtr adapter = communicator()->createObjectAdapterFromProperty("Starter", endpointsProperty); - adapter->setLocator(0); + ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Glacier.Starter"); // // Get the password verifier, or create one if no verifier is diff --git a/cpp/src/Glacier/StarterI.cpp b/cpp/src/Glacier/StarterI.cpp index 6d034d72a35..44de87d35a8 100644 --- a/cpp/src/Glacier/StarterI.cpp +++ b/cpp/src/Glacier/StarterI.cpp @@ -59,6 +59,19 @@ Glacier::StarterI::StarterI(const CommunicatorPtr& communicator, const PasswordV _certContext.setSecondsValid(issuedAdjust); } +static bool +prefixOK(const string& property) +{ + if(property.find("--Ice.") == 0) + return false; + if(property.find("--IceSSL.") == 0) + return false; + if(property.find("--Glacier.Router") == 0) + return false; + + return true; +} + void Glacier::StarterI::destroy() { @@ -173,6 +186,13 @@ Glacier::StarterI::startRouter(const string& userId, const string& password, Byt // Setup arguments to start the router with. // StringSeq args = _properties->getCommandLineOptions(); + + // + // Filter all arguments that don't start with "--Ice.", + // "--IceSSL.", or "--Glacier.Router.". + // + args.erase(remove_if(args.begin(), args.end(), prefixOK), args.end()); + args.push_back("--Glacier.Router.Identity=" + uuid); // diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp index 79e72685229..a53cd53cc73 100644 --- a/cpp/src/Ice/CommunicatorI.cpp +++ b/cpp/src/Ice/CommunicatorI.cpp @@ -97,52 +97,36 @@ Ice::CommunicatorI::createObjectAdapter(const string& name) throw CommunicatorDestroyedException(__FILE__, __LINE__); } - ObjectAdapterPtr adapter = createObjectAdapterFromProperty(name, "Ice.Adapter." + name + ".Endpoints"); - - string router = _instance->properties()->getProperty("Ice.Adapter." + name + ".Router"); - if(!router.empty()) - { - adapter->addRouter(RouterPrx::uncheckedCast(_instance->proxyFactory()->stringToProxy(router))); - } + ObjectAdapterPtr adapter; - string locator = _instance->properties()->getProperty("Ice.Adapter." + name + ".Locator"); - if(!locator.empty()) + if(name.empty()) { - adapter->setLocator(LocatorPrx::uncheckedCast(_instance->proxyFactory()->stringToProxy(locator))); + adapter = _instance->objectAdapterFactory()->createObjectAdapter("", "", ""); } - - return adapter; -} - -ObjectAdapterPtr -Ice::CommunicatorI::createObjectAdapterFromProperty(const string& name, const string& property) -{ - RecMutex::Lock sync(*this); - if(_destroyed) + else { - throw CommunicatorDestroyedException(__FILE__, __LINE__); - } - - string endpts = _instance->properties()->getProperty(property); - - return createObjectAdapterWithEndpoints(name, endpts); -} - -ObjectAdapterPtr -Ice::CommunicatorI::createObjectAdapterWithEndpoints(const string& name, const string& endpts) -{ - RecMutex::Lock sync(*this); - if(_destroyed) - { - throw CommunicatorDestroyedException(__FILE__, __LINE__); + string id = _instance->properties()->getProperty(name + ".AdapterId"); + + string endpts = _instance->properties()->getProperty(name + ".Endpoints"); + + adapter = _instance->objectAdapterFactory()->createObjectAdapter(name, endpts, id); + + string router = _instance->properties()->getProperty(name + ".Router"); + if(!router.empty()) + { + adapter->addRouter(RouterPrx::uncheckedCast(_instance->proxyFactory()->stringToProxy(router))); + } + + string locator = _instance->properties()->getProperty(name + ".Locator"); + if(!locator.empty()) + { + adapter->setLocator(LocatorPrx::uncheckedCast(_instance->proxyFactory()->stringToProxy(locator))); + } + else + { + adapter->setLocator(_instance->referenceFactory()->getDefaultLocator()); + } } - - ObjectAdapterPtr adapter = _instance->objectAdapterFactory()->createObjectAdapter(name, endpts); - - // - // Set the adapter locator to this communicator default locator. - // - adapter->setLocator(_instance->referenceFactory()->getDefaultLocator()); if(!_serverThreadPool) // Lazy initialization of _serverThreadPool. { diff --git a/cpp/src/Ice/CommunicatorI.h b/cpp/src/Ice/CommunicatorI.h index 7f73035a2a8..cc1616698c1 100644 --- a/cpp/src/Ice/CommunicatorI.h +++ b/cpp/src/Ice/CommunicatorI.h @@ -32,8 +32,6 @@ public: virtual std::string proxyToString(const ObjectPrx&); virtual ObjectAdapterPtr createObjectAdapter(const std::string&); - virtual ObjectAdapterPtr createObjectAdapterFromProperty(const std::string&, const std::string&); - virtual ObjectAdapterPtr createObjectAdapterWithEndpoints(const std::string&, const std::string&); virtual void addObjectFactory(const ObjectFactoryPtr&, const std::string&); virtual void removeObjectFactory(const std::string&); diff --git a/cpp/src/Ice/ObjectAdapterFactory.cpp b/cpp/src/Ice/ObjectAdapterFactory.cpp index 2d19064514e..ec29ed96bf7 100644 --- a/cpp/src/Ice/ObjectAdapterFactory.cpp +++ b/cpp/src/Ice/ObjectAdapterFactory.cpp @@ -31,7 +31,7 @@ IceInternal::ObjectAdapterFactory::shutdown() } ObjectAdapterPtr -IceInternal::ObjectAdapterFactory::createObjectAdapter(const string& name, const string& endpts) +IceInternal::ObjectAdapterFactory::createObjectAdapter(const string& name, const string& endpts, const string& id) { IceUtil::Mutex::Lock sync(*this); @@ -41,7 +41,7 @@ IceInternal::ObjectAdapterFactory::createObjectAdapter(const string& name, const return p->second; } - ObjectAdapterIPtr adapter = new ObjectAdapterI(_instance, _communicator, name, endpts); + ObjectAdapterIPtr adapter = new ObjectAdapterI(_instance, _communicator, name, endpts, id); _adapters.insert(make_pair(name, adapter)); return adapter; } diff --git a/cpp/src/Ice/ObjectAdapterFactory.h b/cpp/src/Ice/ObjectAdapterFactory.h index 7657b955fa5..ed6477ba69c 100644 --- a/cpp/src/Ice/ObjectAdapterFactory.h +++ b/cpp/src/Ice/ObjectAdapterFactory.h @@ -22,7 +22,7 @@ class ObjectAdapterFactory : public ::IceUtil::Shared, public ::IceUtil::Mutex public: void shutdown(); - ::Ice::ObjectAdapterPtr createObjectAdapter(const std::string&, const std::string&); + ::Ice::ObjectAdapterPtr createObjectAdapter(const std::string&, const std::string&, const std::string&); ::Ice::ObjectAdapterPtr findObjectAdapter(const ::Ice::ObjectPrx&); private: diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp index 55269d7bba5..23102d5690c 100644 --- a/cpp/src/Ice/ObjectAdapterI.cpp +++ b/cpp/src/Ice/ObjectAdapterI.cpp @@ -36,12 +36,6 @@ using namespace std; using namespace Ice; using namespace IceInternal; -string -Ice::ObjectAdapterI::getName() -{ - return _name; // _name is immutable -} - CommunicatorPtr Ice::ObjectAdapterI::getCommunicator() { @@ -67,7 +61,7 @@ Ice::ObjectAdapterI::activate() if(!_printAdapterReadyDone) { - if(_locatorInfo) + if(_locatorInfo && !_id.empty()) { Identity ident; ident.name = "dummy"; @@ -80,7 +74,7 @@ Ice::ObjectAdapterI::activate() // try { - _locatorInfo->getLocatorRegistry()->setAdapterDirectProxy(_name, newDirectProxy(ident)); + _locatorInfo->getLocatorRegistry()->setAdapterDirectProxy(_id, newDirectProxy(ident)); } catch(const Ice::AdapterNotRegistered&) { @@ -429,12 +423,6 @@ Ice::ObjectAdapterI::addRouter(const RouterPrx& router) // callbacks. // _instance->outgoingConnectionFactory()->setRouter(routerInfo->getRouter()); - - // - // Creates proxies with endpoints instead of the adapter name - // when there is a router. - // - _useEndpointsInProxy = true; } } @@ -449,21 +437,6 @@ Ice::ObjectAdapterI::setLocator(const LocatorPrx& locator) } _locatorInfo = _instance->locatorManager()->get(locator); - if(_locatorInfo) - { - // - // If a locator is set, we create proxies with adapter names in - // the reference instead of endpoints. If it's not set, we create - // proxies with endpoints if there's at least one incoming - // connection factory or router endpoints. - // - _useEndpointsInProxy = false; - } - else - { - IceUtil::Mutex::Lock routerEndpointsSync(_routerEndpointsMutex); - _useEndpointsInProxy = !_incomingConnectionFactories.empty() || !_routerEndpoints.empty(); - } } list<ConnectionPtr> @@ -484,11 +457,12 @@ Ice::ObjectAdapterI::getIncomingConnections() const } Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const CommunicatorPtr& communicator, - const string& name, const string& endpts) : + const string& name, const string& endpts, const string& id) : _instance(instance), _communicator(communicator), _printAdapterReadyDone(false), _name(name), + _id(id), _activeServantMapHint(_activeServantMap.end()), _locatorMapHint(_locatorMap.end()) { @@ -541,15 +515,7 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const Communica __setNoDelete(false); throw; } - __setNoDelete(false); - - // - // Create proxies with the adapter endpoints only if there's - // incoming connection factories. If there's no incoming - // connection factories we will create proxies with the adapter - // name in the reference (to allow collocation to work). - // - _useEndpointsInProxy = !_incomingConnectionFactories.empty(); + __setNoDelete(false); // // Object Adapters without incoming connection factories are @@ -576,7 +542,7 @@ Ice::ObjectAdapterI::~ObjectAdapterI() ObjectPrx Ice::ObjectAdapterI::newProxy(const Identity& ident) const { - if(_useEndpointsInProxy) + if(_id.empty()) { return newDirectProxy(ident); } @@ -587,7 +553,7 @@ Ice::ObjectAdapterI::newProxy(const Identity& ident) const // vector<EndpointPtr> endpoints; ReferencePtr ref = _instance->referenceFactory()->create(ident, vector<string>(), Reference::ModeTwoway, - false, false, _name, endpoints, 0, 0, 0); + false, false, _id, endpoints, 0, 0, 0); // // Return a proxy for the reference. @@ -637,9 +603,9 @@ Ice::ObjectAdapterI::isLocal(const ObjectPrx& proxy) const { // // Proxy is local if the reference adapter id matches this - // adapter name. + // adapter id. // - return ref->adapterId == _name; + return ref->adapterId == _id; } // diff --git a/cpp/src/Ice/ObjectAdapterI.h b/cpp/src/Ice/ObjectAdapterI.h index 88009692b78..f7a6dc565b6 100644 --- a/cpp/src/Ice/ObjectAdapterI.h +++ b/cpp/src/Ice/ObjectAdapterI.h @@ -35,7 +35,6 @@ class ObjectAdapterI : public ObjectAdapter, public ::IceUtil::Mutex { public: - virtual std::string getName(); virtual CommunicatorPtr getCommunicator(); virtual void activate(); @@ -66,7 +65,8 @@ public: private: - ObjectAdapterI(const ::IceInternal::InstancePtr&, const CommunicatorPtr&, const std::string&, const std::string&); + ObjectAdapterI(const ::IceInternal::InstancePtr&, const CommunicatorPtr&, const std::string&, const std::string&, + const std::string&); virtual ~ObjectAdapterI(); friend class ::IceInternal::ObjectAdapterFactory; @@ -78,7 +78,7 @@ private: CommunicatorPtr _communicator; bool _printAdapterReadyDone; std::string _name; - bool _useEndpointsInProxy; + std::string _id; ObjectDict _activeServantMap; ObjectDict::iterator _activeServantMapHint; std::map<std::string, ServantLocatorPtr> _locatorMap; diff --git a/cpp/src/IceBox/Admin.cpp b/cpp/src/IceBox/Admin.cpp index 07d05a0899c..6246fcff773 100644 --- a/cpp/src/IceBox/Admin.cpp +++ b/cpp/src/IceBox/Admin.cpp @@ -88,39 +88,31 @@ Client::run(int argc, char* argv[]) return EXIT_SUCCESS; } - - // - // TODO: Simplify configuration, this is way too complicated. We - // should most likely have only two configuration variables, one - // for the identity and the other one for the endpoints. - // - - string namePrefix = properties->getProperty("IceBox.Name"); - if(!namePrefix.empty()) - { - namePrefix += "."; - } - string managerProxy; - string managerEndpoints = properties->getProperty("IceBox.ServiceManager.Endpoints"); - if(managerEndpoints.empty()) + string managerIdentity = properties->getPropertyWithDefault("IceBox.ServiceManager.Identity", "ServiceManager"); + + if(properties->getProperty("Ice.Default.Locator").empty()) { - if(!properties->getProperty("Ice.Default.Locator").empty() && !namePrefix.empty()) - { - managerProxy = namePrefix + "ServiceManager@" + namePrefix + "ServiceManagerAdapter"; - } - else + string managerEndpoints = properties->getProperty("IceBox.ServiceManager.Endpoints"); + if(managerEndpoints.empty()) { cerr << appName() << ": property `IceBox.ServiceManager.Endpoints' is not set" << endl; return EXIT_FAILURE; } + + managerProxy = managerIdentity + ":" + managerEndpoints; } else { - string managerIdentity = properties->getPropertyWithDefault("IceBox.ServiceManager.Identity", - "ServiceManager"); - managerProxy = namePrefix + managerIdentity + ":" + managerEndpoints; + string managerAdapterId = properties->getProperty("IceBox.ServiceManager.AdapterId"); + if(managerAdapterId.empty()) + { + cerr << appName() << ": property `IceBox.ServiceManager.AdapterId' is not set" << endl; + return EXIT_FAILURE; + } + + managerProxy = managerIdentity + "@" + managerAdapterId; } ObjectPrx base = communicator()->stringToProxy(managerProxy); diff --git a/cpp/src/IceBox/Exception.cpp b/cpp/src/IceBox/Exception.cpp new file mode 100644 index 00000000000..6374851379e --- /dev/null +++ b/cpp/src/IceBox/Exception.cpp @@ -0,0 +1,21 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// Mutable Realms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <IceBox/IceBox.h> + +using namespace std; + +void +IceBox::FailureException::ice_print(ostream& out) const +{ + Exception::ice_print(out); + out << ":\nservice failure exception: " << reason; +} + diff --git a/cpp/src/IceBox/Makefile b/cpp/src/IceBox/Makefile index 5eb8d8f1d3f..b7538acd9b9 100644 --- a/cpp/src/IceBox/Makefile +++ b/cpp/src/IceBox/Makefile @@ -21,7 +21,8 @@ ADMIN = $(top_srcdir)/bin/iceboxadmin TARGETS = $(NAME) $(VERSIONED_NAME) $(SERVER) $(ADMIN) -OBJS = IceBox.o +OBJS = IceBox.o \ + Exception.o SOBJS = ServiceManagerI.o \ Server.o diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp index ab79dfe2c8c..eef3af10afd 100644 --- a/cpp/src/IceBox/ServiceManagerI.cpp +++ b/cpp/src/IceBox/ServiceManagerI.cpp @@ -34,9 +34,6 @@ IceBox::ServiceManagerI::ServiceManagerI(Application* server, int& argc, char* a { _argv.push_back(argv[i]); } - - PropertiesPtr properties = _server->communicator()->getProperties(); - _options = properties->getCommandLineOptions(); } IceBox::ServiceManagerI::~ServiceManagerI() @@ -56,34 +53,16 @@ IceBox::ServiceManagerI::run() { ServiceManagerPtr obj = this; - // - // TODO: Simplify configuration, this is way too complicated. We - // should most likely have only two configuration properties, one - // for the identity and the other one for the endpoints. - // - - // - // Prefix the adapter name and object identity with the value - // of the IceBox.Name property. - // - PropertiesPtr properties = _server->communicator()->getProperties(); - string namePrefix = properties->getProperty("IceBox.Name"); - if(!namePrefix.empty()) - { - namePrefix += "."; - } - // // Create an object adapter. Services probably should NOT share // this object adapter, as the endpoint(s) for this object adapter // will most likely need to be firewalled for security reasons. // - ObjectAdapterPtr adapter = - _server->communicator()->createObjectAdapterFromProperty(namePrefix + "ServiceManagerAdapter", - "IceBox.ServiceManager.Endpoints"); + ObjectAdapterPtr adapter = _server->communicator()->createObjectAdapter("IceBox.ServiceManager"); - string identity = properties->getPropertyWithDefault("IceBox.ServiceManager.Identity", - namePrefix + "ServiceManager"); + PropertiesPtr properties = _server->communicator()->getProperties(); + + string identity = properties->getPropertyWithDefault("IceBox.ServiceManager.Identity", "ServiceManager"); adapter->add(obj, stringToIdentity(identity)); // @@ -189,26 +168,14 @@ void IceBox::ServiceManagerI::start(const string& service, const string& entryPoint, const StringSeq& args) { // - // We need to create a property set to pass to start(). - // The property set is populated from a number of sources. - // The precedence order (from lowest to highest) is: - // - // 1. Properties defined in the server property set (e.g., - // that were defined in the server's configuration file) - // 2. Service arguments - // 3. Server arguments - // - // We'll compose an array of arguments in the above order. + // Create the service property set from the service arguments and + // the server arguments. The service property set will be use to + // create a new communicator or we be added to the shared + // communicator depending on the value of the + // IceBox.UseSharedCommunicator property. // StringSeq serviceArgs; StringSeq::size_type j; - for(j = 0; j < _options.size(); j++) - { - if(_options[j].find("--" + service + ".") == 0) - { - serviceArgs.push_back(_options[j]); - } - } for(j = 0; j < args.size(); j++) { serviceArgs.push_back(args[j]); @@ -222,13 +189,6 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint, } // - // Create the service property set. - // - PropertiesPtr serviceProperties = createProperties(serviceArgs); - serviceArgs = serviceProperties->parseCommandLineOptions("Ice", serviceArgs); - serviceArgs = serviceProperties->parseCommandLineOptions(service, serviceArgs); - - // // Load the entry point. // DynamicLibraryPtr library = new DynamicLibrary(); @@ -236,7 +196,7 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint, if(sym == 0) { string msg = library->getErrorMessage(); - FailureException ex; + FailureException ex(__FILE__, __LINE__); ex.reason = "ServiceManager: unable to load entry point `" + entryPoint + "'"; if(!msg.empty()) { @@ -256,13 +216,13 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint, } catch(const Exception& ex) { - FailureException e; + FailureException e(__FILE__, __LINE__); e.reason = "ServiceManager: exception in entry point `" + entryPoint + "': " + ex.ice_name(); throw e; } catch (...) { - FailureException e; + FailureException e(__FILE__, __LINE__); e.reason = "ServiceManager: unknown exception in entry point `" + entryPoint + "'"; throw e; } @@ -272,13 +232,48 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint, // try { + // + // If Ice.UseSharedCommunicator.<name> is defined create a + // communicator for the service. The communicator inherits + // from the shared communicator properties. If it's not + // defined, add the service properties to the shared + // commnunicator property set. + // + PropertiesPtr properties = _server->communicator()->getProperties(); + if(properties->getPropertyAsInt("IceBox.UseSharedCommunicator." + service) > 0) + { + Ice::PropertiesPtr fileProperties = Ice::createProperties(serviceArgs); + properties->parseCommandLineOptions("", fileProperties->getCommandLineOptions()); + + serviceArgs = properties->parseCommandLineOptions("Ice", serviceArgs); + serviceArgs = properties->parseCommandLineOptions(service, serviceArgs); + } + else + { + int argc = 0; + char **argv = 0; + + Ice::PropertiesPtr serviceProperties = properties->clone(); + + Ice::PropertiesPtr fileProperties = Ice::createProperties(serviceArgs); + serviceProperties->parseCommandLineOptions("", fileProperties->getCommandLineOptions()); + + serviceArgs = serviceProperties->parseCommandLineOptions("Ice", serviceArgs); + serviceArgs = serviceProperties->parseCommandLineOptions(service, serviceArgs); + + info.communicator = initializeWithProperties(argc, argv, serviceProperties); + } + + Ice::CommunicatorPtr communicator = info.communicator ? info.communicator : _server->communicator(); + ::IceBox::ServicePtr s = ::IceBox::ServicePtr::dynamicCast(info.service); + if(s) { // // IceBox::Service // - s->start(service, _server->communicator(), serviceProperties, serviceArgs); + s->start(service, communicator, serviceArgs); } else { @@ -290,32 +285,16 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint, // ::IceBox::FreezeServicePtr fs = ::IceBox::FreezeServicePtr::dynamicCast(info.service); - PropertiesPtr properties = _server->communicator()->getProperties(); - string propName = "IceBox.DBEnvName." + service; - info.dbEnvName = properties->getProperty(propName); + info.dbEnv = ::Freeze::initialize(communicator, properties->getProperty("IceBox.DBEnvName." + service)); - DBEnvironmentInfo dbInfo; - map<string,DBEnvironmentInfo>::iterator r = _dbEnvs.find(info.dbEnvName); - if(r == _dbEnvs.end()) - { - dbInfo.dbEnv = ::Freeze::initialize(_server->communicator(), info.dbEnvName); - dbInfo.openCount = 1; - } - else - { - dbInfo = r->second; - ++dbInfo.openCount; - } - _dbEnvs[info.dbEnvName] = dbInfo; - - fs->start(service, _server->communicator(), serviceProperties, serviceArgs, dbInfo.dbEnv); + fs->start(service, communicator, serviceArgs, info.dbEnv); } info.library = library; _services[service] = info; } catch(const Freeze::DBException& ex) { - FailureException e; + FailureException e(__FILE__, __LINE__); e.reason = "ServiceManager: database exception while starting service " + service + ": " + ex.ice_name() + "\n" + ex.message; throw e; @@ -326,7 +305,7 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint, } catch(const Exception& ex) { - FailureException e; + FailureException e(__FILE__, __LINE__); e.reason = "ServiceManager: exception while starting service " + service + ": " + ex.ice_name(); throw e; } @@ -345,56 +324,83 @@ IceBox::ServiceManagerI::stop(const string& service) info.service->stop(); // - // Close the database environment if service is a Freeze service and the - // database open count is one. + // Close the database environment if the service database + // environment is set. // - ::IceBox::FreezeServicePtr fs = IceBox::FreezeServicePtr::dynamicCast(info.service); - if(fs) + if(info.dbEnv) { - map<string,DBEnvironmentInfo>::iterator r = _dbEnvs.find(info.dbEnvName); - assert(r != _dbEnvs.end()); - DBEnvironmentInfo dbInfo = r->second; - if(--dbInfo.openCount == 0) - { - dbInfo.dbEnv->close(); - _dbEnvs.erase(info.dbEnvName); - } - else - { - _dbEnvs[info.dbEnvName] = dbInfo; - } + info.dbEnv->close(); + info.dbEnv = 0; } } catch(const ::Freeze::DBException& ex) { - // - // Release the service before the library - // info.service = 0; + + if(info.communicator) + { + try + { + info.communicator->destroy(); + } + catch(const Ice::Exception&) + { + } + info.communicator = 0; + } + info.library = 0; - FailureException e; + FailureException e(__FILE__, __LINE__); e.reason = "ServiceManager: database exception in stop for service " + service + ": " + ex.ice_name() + "\n" + ex.message; throw e; } catch(const Exception& ex) { - // - // Release the service before the library - // info.service = 0; + + if(info.communicator) + { + try + { + info.communicator->destroy(); + } + catch(const Ice::Exception&) + { + } + info.communicator = 0; + } + info.library = 0; - FailureException e; + FailureException e(__FILE__, __LINE__); e.reason = "ServiceManager: exception in stop for service " + service + ": " + ex.ice_name(); throw e; } // - // Release the service before the library + // Release the service, the service communicator and then the + // library. The order is important, the service must be release + // before destroying the communicator so that the communicator + // leak detector doesn't report potential leaks, and the + // communicator must be destroyed before the library is released + // since the library will destroy its global state. // info.service = 0; + + if(info.communicator) + { + try + { + info.communicator->destroy(); + } + catch(const Ice::Exception&) + { + } + info.communicator = 0; + } + info.library = 0; } diff --git a/cpp/src/IceBox/ServiceManagerI.h b/cpp/src/IceBox/ServiceManagerI.h index ac6cc047519..fb7f52721da 100644 --- a/cpp/src/IceBox/ServiceManagerI.h +++ b/cpp/src/IceBox/ServiceManagerI.h @@ -36,8 +36,9 @@ public: struct ServiceInfo { ServiceBasePtr service; - std::string dbEnvName; ::IceInternal::DynamicLibraryPtr library; + ::Ice::CommunicatorPtr communicator; + ::Freeze::DBEnvironmentPtr dbEnv; }; private: @@ -46,19 +47,11 @@ private: void stop(const std::string&); void stopAll(); - struct DBEnvironmentInfo - { - ::Freeze::DBEnvironmentPtr dbEnv; - unsigned int openCount; - }; - ::Ice::Application* _server; ::Ice::LoggerPtr _logger; std::string _progName; // argv[0] ::Ice::StringSeq _argv; // Filtered server argument vector, not including program name - ::Ice::StringSeq _options; // Server property set converted to command-line options std::map<std::string, ServiceInfo> _services; - std::map<std::string, DBEnvironmentInfo> _dbEnvs; }; } diff --git a/cpp/src/IcePack/Client.cpp b/cpp/src/IcePack/Client.cpp index 5484c0b2c86..a8b21dee02d 100644 --- a/cpp/src/IcePack/Client.cpp +++ b/cpp/src/IcePack/Client.cpp @@ -143,7 +143,7 @@ Client::run(int argc, char* argv[]) return EXIT_FAILURE; } - AdminPrx admin = AdminPrx::checkedCast(communicator()->stringToProxy("IcePack/Admin@IcePackAdminAdapter")); + AdminPrx admin = AdminPrx::checkedCast(communicator()->stringToProxy("IcePack/Admin@IcePack.Registry.Admin")); if(!admin) { cerr << appName() << ": no valid administrative endpoints" << endl; diff --git a/cpp/src/IcePack/IcePackNode.cpp b/cpp/src/IcePack/IcePackNode.cpp index ff00477bb42..4dad7b90bba 100644 --- a/cpp/src/IcePack/IcePackNode.cpp +++ b/cpp/src/IcePack/IcePackNode.cpp @@ -144,8 +144,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator, const Free // // Check that required properties are set and valid. // - string endpoints = properties->getProperty("IcePack.Node.Endpoints"); - if(endpoints.empty()) + if(properties->getProperty("IcePack.Node.Endpoints").empty()) { Ice::Error out(communicator->getLogger()); out << "property `IcePack.Node.Endpoints' is not set"; @@ -170,8 +169,13 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator, const Free } } - Ice::ObjectAdapterPtr adapter = - communicator->createObjectAdapterWithEndpoints("IcePackNodeAdapter." + name, endpoints); + // + // Set the adapter id for this node and create the node object + // adapter. + // + properties->setProperty("IcePack.Node.AdapterId", "IcePack.Node-" + name); + + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("IcePack.Node"); TraceLevelsPtr traceLevels = new TraceLevels(properties, communicator->getLogger()); @@ -213,7 +217,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator, const Free try { NodeRegistryPrx nodeRegistry = NodeRegistryPrx::checkedCast( - communicator->stringToProxy("IcePack/NodeRegistry@IcePackRegistryAdapter")); + communicator->stringToProxy("IcePack/NodeRegistry@IcePack.Registry.Internal")); nodeRegistry->add(name, nodeProxy); } catch(const NodeActiveException&) @@ -248,7 +252,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator, const Free AdminPrx admin; try { - admin = AdminPrx::checkedCast(communicator->stringToProxy("IcePack/Admin@IcePackAdminAdapter")); + admin = AdminPrx::checkedCast(communicator->stringToProxy("IcePack/Admin@IcePack.Registry.Admin")); } catch(const Ice::LocalException& ex) { diff --git a/cpp/src/IcePack/NodeInfo.cpp b/cpp/src/IcePack/NodeInfo.cpp index 1cf50a1a248..2f6cd5098b3 100644 --- a/cpp/src/IcePack/NodeInfo.cpp +++ b/cpp/src/IcePack/NodeInfo.cpp @@ -57,7 +57,7 @@ IcePack::NodeInfo::getAdapterRegistry() const try { return AdapterRegistryPrx::checkedCast( - _communicator->stringToProxy("IcePack/AdapterRegistry@IcePackRegistryAdapter")); + _communicator->stringToProxy("IcePack/AdapterRegistry@IcePack.Registry.Internal")); } catch(const Ice::LocalException& ex) { @@ -71,7 +71,7 @@ IcePack::NodeInfo::getServerRegistry() const try { return ServerRegistryPrx::checkedCast( - _communicator->stringToProxy("IcePack/ServerRegistry@IcePackRegistryAdapter")); + _communicator->stringToProxy("IcePack/ServerRegistry@IcePack.Registry.Internal")); } catch(const Ice::LocalException& ex) { @@ -87,7 +87,7 @@ IcePack::NodeInfo::getYellowQuery() const // try { - return Yellow::QueryPrx::checkedCast(_communicator->stringToProxy("Yellow/Query@YellowQueryAdapter")); + return Yellow::QueryPrx::checkedCast(_communicator->stringToProxy("Yellow/Query@Yellow.Query")); } catch(const Ice::LocalException& ex) { @@ -103,7 +103,7 @@ IcePack::NodeInfo::getYellowAdmin() const // try { - return Yellow::AdminPrx::checkedCast(_communicator->stringToProxy("Yellow/Admin@YellowAdminAdapter")); + return Yellow::AdminPrx::checkedCast(_communicator->stringToProxy("Yellow/Admin@Yellow.Admin")); } catch(const Ice::LocalException& ex) { diff --git a/cpp/src/IcePack/NodeRegistryI.cpp b/cpp/src/IcePack/NodeRegistryI.cpp index 3393aad1d67..eae4cbb2108 100644 --- a/cpp/src/IcePack/NodeRegistryI.cpp +++ b/cpp/src/IcePack/NodeRegistryI.cpp @@ -81,7 +81,7 @@ IcePack::NodeRegistryI::add(const string& name, const NodePrx& node, const Ice:: try { - _adapterRegistry->findByName("IcePackNodeAdapter." + name); + _adapterRegistry->findByName("IcePack.Node-" + name); // // TODO: ensure this adapter has been created by the adapter @@ -100,7 +100,7 @@ IcePack::NodeRegistryI::add(const string& name, const NodePrx& node, const Ice:: AdapterPrx adapter = _adapterFactory->createStandaloneAdapter("IcePackNodeAdapter." + name); try { - _adapterRegistry->add("IcePackNodeAdapter." + name, adapter); + _adapterRegistry->add("IcePack.Node-" + name, adapter); } catch(const AdapterExistsException&) { @@ -133,9 +133,9 @@ IcePack::NodeRegistryI::remove(const string& name, const Ice::Current&) // try { - AdapterPrx adapter = _adapterRegistry->findByName("IcePackNodeAdapter." + name); + AdapterPrx adapter = _adapterRegistry->findByName("IcePack.Node-" + name); adapter->destroy(); - _adapterRegistry->remove("IcePackNodeAdapter." + name); + _adapterRegistry->remove("IcePack.Node-" + name); } catch(const AdapterNotExistException&) { diff --git a/cpp/src/IcePack/Registry.cpp b/cpp/src/IcePack/Registry.cpp index 9d5d0d368a7..9c7f7e7cf76 100644 --- a/cpp/src/IcePack/Registry.cpp +++ b/cpp/src/IcePack/Registry.cpp @@ -94,32 +94,28 @@ IcePack::Registry::start(bool nowarn) // // Check that required properties are set and valid. // - string registryEndpoints = properties->getProperty("IcePack.Registry.Internal.Endpoints"); - if(registryEndpoints.empty()) + if(properties->getProperty("IcePack.Registry.Internal.Endpoints").empty()) { Ice::Error out(_communicator->getLogger()); out << "property `IcePack.Registry.Internal.Endpoints' is not set"; return false; } - string locatorEndpoints = properties->getProperty("IcePack.Registry.Locator.Endpoints"); - if(locatorEndpoints.empty()) + if(properties->getProperty("IcePack.Registry.Locator.Endpoints").empty()) { Ice::Error out(_communicator->getLogger()); out << "property `IcePack.Registry.Locator.Endpoints' is not set"; return false; } - string locatorRegistryEndpoints = properties->getProperty("IcePack.Registry.LocatorRegistry.Endpoints"); - if(locatorRegistryEndpoints.empty()) + if(properties->getProperty("IcePack.Registry.LocatorRegistry.Endpoints").empty()) { Ice::Error out(_communicator->getLogger()); out << "property `IcePack.Registry.LocatorRegistry.Endpoints' is not set"; return false; } - string adminEndpoints = properties->getProperty("IcePack.Registry.Admin.Endpoints"); - if(!adminEndpoints.empty()) + if(!properties->getProperty("IcePack.Registry.Admin.Endpoints").empty()) { if(!nowarn) { @@ -140,8 +136,8 @@ IcePack::Registry::start(bool nowarn) // // Create the internal registries (node, server, adapter). // - Ice::ObjectAdapterPtr registryAdapter = - _communicator->createObjectAdapterWithEndpoints("IcePackRegistryAdapter", registryEndpoints); + properties->setProperty("IcePack.Registry.Internal.AdapterId", "IcePack.Registry.Internal"); + Ice::ObjectAdapterPtr registryAdapter = _communicator->createObjectAdapter("IcePack.Registry.Internal"); AdapterFactoryPtr adapterFactory = new AdapterFactory(registryAdapter, traceLevels, _dbEnv); @@ -162,8 +158,8 @@ IcePack::Registry::start(bool nowarn) // NOTE: the locator registry uses the registry object adapter // to activate standalone object adapters. // - Ice::ObjectAdapterPtr locatorRegistryAdapter = - _communicator->createObjectAdapterWithEndpoints("IcePackLocatorRegistryAdapter",locatorRegistryEndpoints); + Ice::ObjectAdapterPtr locatorRegistryAdapter = + _communicator->createObjectAdapter("IcePack.Registry.LocatorRegistry"); Ice::Identity locatorRegistryId; locatorRegistryId.category = "IcePack"; @@ -176,8 +172,7 @@ IcePack::Registry::start(bool nowarn) // Create the locator registry adapter and the locator // registry servant. // - Ice::ObjectAdapterPtr locatorAdapter = - _communicator->createObjectAdapterWithEndpoints("IcePackLocatorAdapter", locatorEndpoints); + Ice::ObjectAdapterPtr locatorAdapter = _communicator->createObjectAdapter("IcePack.Registry.Locator"); Ice::Identity locatorId; locatorId.category = "IcePack"; @@ -189,37 +184,37 @@ IcePack::Registry::start(bool nowarn) // // Create the admin adapter and admin servant. // - Ice::ObjectAdapterPtr adminAdapter = - _communicator->createObjectAdapterWithEndpoints("IcePackAdminAdapter", adminEndpoints); + properties->setProperty("IcePack.Registry.Admin.AdapterId", "IcePack.Registry.Admin"); + Ice::ObjectAdapterPtr adminAdapter = _communicator->createObjectAdapter("IcePack.Registry.Admin"); AdminPtr admin = new AdminI(_communicator, nodeRegistry, serverRegistry, adapterRegistry); adminAdapter->add(admin, Ice::stringToIdentity("IcePack/Admin")); // - // Register the IcePackRegistryAdapter adapter and - // IcePackAdminAdapter with the adapter registry so that they can + // Register the IcePack.Registry.Internal adapter and + // IcePack.Registry.Admin with the adapter registry so that they can // be located by clients. // try { - adapterRegistry->remove("IcePackRegistryAdapter"); + adapterRegistry->remove("IcePack.Registry.Internal"); } catch(const AdapterNotExistException&) { } try { - adapterRegistry->remove("IcePackAdminAdapter"); + adapterRegistry->remove("IcePack.Registry.Admin"); } catch(const AdapterNotExistException&) { } - adapterRegistry->add("IcePackRegistryAdapter", AdapterPrx::uncheckedCast( + adapterRegistry->add("IcePack.Registry.Internal", AdapterPrx::uncheckedCast( locatorRegistryAdapter->addWithUUID(new StandaloneAdapterI()))); - adapterRegistry->add("IcePackAdminAdapter", AdapterPrx::uncheckedCast( + adapterRegistry->add("IcePack.Registry.Admin", AdapterPrx::uncheckedCast( locatorRegistryAdapter->addWithUUID(new StandaloneAdapterI()))); - + // // Set the locator on the registry and admin adapter. This should // cause the adapters to register their endpoints with the locator diff --git a/cpp/src/IcePack/ServerBuilder.cpp b/cpp/src/IcePack/ServerBuilder.cpp index 029c356954b..72cc8061d52 100644 --- a/cpp/src/IcePack/ServerBuilder.cpp +++ b/cpp/src/IcePack/ServerBuilder.cpp @@ -8,6 +8,7 @@ // // ********************************************************************** +#include <IceUtil/UUID.h> #include <Ice/Ice.h> #include <IcePack/ServerBuilder.h> #include <IcePack/ServiceBuilder.h> @@ -248,14 +249,28 @@ IcePack::ServerHandler::startElement(const XMLCh *const name, AttributeList &att else if(kind == "cpp-icebox") { _builder.setKind(ServerBuilder::ServerKindCppIceBox); - _builder.addProperty("IceBox.ServiceManager.Endpoints", getAttributeValue(attrs, "endpoints")); _builder.createConfigFile("/config/config_icebox"); + _builder.createDirectory("/dbs"); + + // + // TODO: is the server name a good category? + // + _builder.addProperty("IceBox.ServiceManager.Identity", _builder.substitute("${name}/ServiceManager")); + + _builder.registerAdapter("IceBox.ServiceManager", getAttributeValue(attrs, "endpoints"), ""); } else if(kind == "java-icebox") { _builder.setKind(ServerBuilder::ServerKindJavaIceBox); - _builder.addProperty("IceBox.ServiceManager.Endpoints", getAttributeValue(attrs, "endpoints")); _builder.createConfigFile("/config/config_icebox"); + _builder.createDirectory("/dbs"); + + // + // TODO: is the server name a good category? + // + _builder.addProperty("IceBox.ServiceManager.Identity", _builder.substitute("${name}/ServiceManager")); + + _builder.registerAdapter("IceBox.ServiceManager", getAttributeValue(attrs, "endpoints"), ""); } } else if(str == "service") @@ -267,7 +282,8 @@ IcePack::ServerHandler::startElement(const XMLCh *const name, AttributeList &att else if(str == "adapter") { _builder.registerAdapter(getAttributeValue(attrs, "name"), - getAttributeValueWithDefault(attrs, "endpoints", "")); + getAttributeValue(attrs, "endpoints"), + getAttributeValueWithDefault(attrs, "id", "")); } else if(str == "activation") { @@ -521,7 +537,7 @@ IcePack::ServerBuilder::registerServer() } void -IcePack::ServerBuilder::registerAdapter(const string& name, const string& endpoints) +IcePack::ServerBuilder::registerAdapter(const string& name, const string& endpoints, const string& adapterId) { AdapterRegistryPrx adapterRegistry = _nodeInfo->getAdapterRegistry(); if(!adapterRegistry) @@ -531,26 +547,33 @@ IcePack::ServerBuilder::registerAdapter(const string& name, const string& endpoi if(name.empty()) { - throw DeploySAXParseException("no adapter name", _locator); + throw DeploySAXParseException("empty adapter name", _locator); + } + if(endpoints.empty()) + { + throw DeploySAXParseException("empty adapter endpoints", _locator); } + + // + // If the adapter id is not specified, generate one from the + // server and adapter name. + // + string id = adapterId.empty() ? name + "-" + _variables["name"] : adapterId; // - // A server adapter object will be created with the server - // when the server is created (see ServerBuilder::execute() + // A server adapter object will be created with the server when + // the server is created (see ServerBuilder::execute() // method). The RegisterServerAdapter task will get the server - // adapter proxy through the builder method - // getServerAdapter(). - // - _serverAdapterNames.push_back(name); - _tasks.push_back(new RegisterServerAdapterTask(adapterRegistry, name, *this)); - - addProperty("Ice.Adapter." + name + ".Locator", - _nodeInfo->getCommunicator()->getProperties()->getProperty("Ice.Default.Locator")); + // adapter proxy through the builder method getServerAdapter(). + // + _serverAdapterNames.push_back(id); + _tasks.push_back(new RegisterServerAdapterTask(adapterRegistry, id, *this)); - if(!endpoints.empty()) - { - addProperty("Ice.Adapter." + name + ".Endpoints", endpoints); - } + // + // Generate adapter configuration properties. + // + addProperty(name + ".Endpoints", endpoints); + addProperty(name + ".AdapterId", id); } void @@ -633,12 +656,10 @@ IcePack::ServerBuilder::setKind(ServerBuilder::ServerKind kind) _description.serviceManager = IceBox::ServiceManagerPrx::uncheckedCast( _nodeInfo->getCommunicator()->stringToProxy( - _variables["name"] + ".ServiceManager@" + _variables["name"] + ".ServiceManagerAdapter")); + "IceBox/" + _variables["name"] + "@" + _variables["name"] + "ServiceManagerAdapter")); _className = "IceBox.Server"; - createDirectory("/dbs"); - addProperty("IceBox.Name", _variables["name"]); - registerAdapter(_variables["name"] + ".ServiceManagerAdapter",""); + break; } case ServerKindCppIceBox: @@ -650,11 +671,8 @@ IcePack::ServerBuilder::setKind(ServerBuilder::ServerKind kind) _description.serviceManager = IceBox::ServiceManagerPrx::uncheckedCast( _nodeInfo->getCommunicator()->stringToProxy( - _variables["name"] + ".ServiceManager@" + _variables["name"] + ".ServiceManagerAdapter")); + "IceBox/" + _variables["name"] + "@" + _variables["name"] + "ServiceManagerAdapter")); - createDirectory("/dbs"); - addProperty("IceBox.Name", _variables["name"]); - registerAdapter(_variables["name"] + ".ServiceManagerAdapter",""); break; } } diff --git a/cpp/src/IcePack/ServerBuilder.h b/cpp/src/IcePack/ServerBuilder.h index 729c48f5306..e96ac3c5143 100644 --- a/cpp/src/IcePack/ServerBuilder.h +++ b/cpp/src/IcePack/ServerBuilder.h @@ -41,7 +41,7 @@ public: void setClassName(const std::string&); void setWorkingDirectory(const std::string&); void registerServer(); - void registerAdapter(const std::string&, const std::string&); + void registerAdapter(const std::string&, const std::string&, const std::string&); void addService(const std::string&, const std::string&); void addOption(const std::string&); void addJavaOption(const std::string&); diff --git a/cpp/src/IcePack/ServiceBuilder.cpp b/cpp/src/IcePack/ServiceBuilder.cpp index 3c7ba67497e..37adeaed70a 100644 --- a/cpp/src/IcePack/ServiceBuilder.cpp +++ b/cpp/src/IcePack/ServiceBuilder.cpp @@ -70,13 +70,24 @@ IcePack::ServiceHandler::startElement(const XMLCh *const name, AttributeList &at _builder.setDBEnv(getAttributeValueWithDefault(attrs, "dbenv", "")); } - _builder.createConfigFile("/config/config_" + _builder.substitute("${name}")); + _builder.createConfigFile(_builder.substitute("/config/config_${name}")); _builder.setEntryPoint(getAttributeValue(attrs, "entry")); } else if(str == "adapter") { - _builder.getServerBuilder().registerAdapter(getAttributeValue(attrs, "name"), - getAttributeValueWithDefault(attrs, "endpoints", "")); + string name = getAttributeValue(attrs, "name"); + string id = getAttributeValueWithDefault(attrs, "id", ""); + + // + // If the adapter id is not specified or empty, generate one + // from the server, service and adapter name: <adapter + // name>-<server name>-<service name> + // + if(id.empty()) + { + id = name + "-" + _builder.getServerBuilder().substitute("${name}") + _builder.substitute("${name}"); + } + _builder.getServerBuilder().registerAdapter(name, getAttributeValue(attrs, "endpoints"), id); } } diff --git a/cpp/src/IcePatch/Server.cpp b/cpp/src/IcePatch/Server.cpp index bb7029dfec7..222fc7a80d6 100644 --- a/cpp/src/IcePatch/Server.cpp +++ b/cpp/src/IcePatch/Server.cpp @@ -95,8 +95,7 @@ IcePatch::Server::run(int argc, char* argv[]) // Get the IcePatch endpoints. // const char* endpointsProperty = "IcePatch.Endpoints"; - string endpoints = properties->getProperty(endpointsProperty); - if(endpoints.empty()) + if(properties->getProperty(endpointsProperty).empty()) { cerr << appName() << ": property `" << endpointsProperty << "' is not set" << endl; return EXIT_FAILURE; @@ -123,7 +122,7 @@ IcePatch::Server::run(int argc, char* argv[]) // // Create and initialize the object adapter and the file locator. // - ObjectAdapterPtr adapter = communicator()->createObjectAdapterFromProperty("IcePatch", endpointsProperty); + ObjectAdapterPtr adapter = communicator()->createObjectAdapter("IcePatch"); ServantLocatorPtr fileLocator = new FileLocator(adapter); adapter->addServantLocator(fileLocator, "IcePatch"); diff --git a/cpp/src/IceStorm/Admin.cpp b/cpp/src/IceStorm/Admin.cpp index a0bcd06acff..c385586e550 100644 --- a/cpp/src/IceStorm/Admin.cpp +++ b/cpp/src/IceStorm/Admin.cpp @@ -157,19 +157,19 @@ Client::run(int argc, char* argv[]) return EXIT_FAILURE; } - const char* managerReferenceProperty = "IceStorm.TopicManager"; - string managerReference = properties->getProperty(managerReferenceProperty); - if(managerReference.empty()) + const char* managerProxyProperty = "IceStorm.TopicManager.Proxy"; + string managerProxy = properties->getProperty(managerProxyProperty); + if(managerProxy.empty()) { - cerr << appName() << ": property `" << managerReferenceProperty << "' is not set" << endl; + cerr << appName() << ": property `" << managerProxyProperty << "' is not set" << endl; return EXIT_FAILURE; } - ObjectPrx base = communicator()->stringToProxy(managerReference); + ObjectPrx base = communicator()->stringToProxy(managerProxy); IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(base); if(!manager) { - cerr << appName() << ": `" << managerReference << "' is not running" << endl; + cerr << appName() << ": `" << managerProxy << "' is not running" << endl; return EXIT_FAILURE; } diff --git a/cpp/src/IceStorm/Service.cpp b/cpp/src/IceStorm/Service.cpp index 21f10259fa5..47612d9b8bd 100644 --- a/cpp/src/IceStorm/Service.cpp +++ b/cpp/src/IceStorm/Service.cpp @@ -35,7 +35,6 @@ public: virtual void start(const string&, const CommunicatorPtr&, - const PropertiesPtr&, const StringSeq&, const DBEnvironmentPtr&); @@ -73,18 +72,17 @@ IceStorm::ServiceI::~ServiceI() void IceStorm::ServiceI::start(const string& name, - const CommunicatorPtr& communicator, - const PropertiesPtr& properties, - const StringSeq& args, - const DBEnvironmentPtr& dbEnv) + const CommunicatorPtr& communicator, + const StringSeq& args, + const DBEnvironmentPtr& dbEnv) { DBPtr dbTopicManager = dbEnv->openDB("topicmanager", true); - TraceLevelsPtr traceLevels = new TraceLevels(name, properties, communicator->getLogger()); - string endpoints = properties->getProperty(name + ".TopicManager.Endpoints"); - _adapter = communicator->createObjectAdapterWithEndpoints(name + ".TopicManagerAdapter", endpoints); + TraceLevelsPtr traceLevels = new TraceLevels(name, communicator->getProperties(), communicator->getLogger()); + _adapter = communicator->createObjectAdapter(name + ".TopicManager"); + _manager = new TopicManagerI(communicator, _adapter, traceLevels, dbEnv, dbTopicManager); - _adapter->add(_manager, stringToIdentity(name + ".TopicManager")); + _adapter->add(_manager, stringToIdentity(name + "/TopicManager")); _adapter->activate(); } diff --git a/cpp/src/Yellow/Service.cpp b/cpp/src/Yellow/Service.cpp index 93e5391c39c..007873e09b9 100644 --- a/cpp/src/Yellow/Service.cpp +++ b/cpp/src/Yellow/Service.cpp @@ -36,7 +36,6 @@ public: virtual void start(const string&, const CommunicatorPtr&, - const PropertiesPtr&, const StringSeq&, const ::Freeze::DBEnvironmentPtr&); @@ -75,7 +74,6 @@ Yellow::ServiceI::~ServiceI() void Yellow::ServiceI::start(const string& name, const CommunicatorPtr& communicator, - const PropertiesPtr& properties, const StringSeq& args, const DBEnvironmentPtr& dbEnv) { @@ -95,13 +93,12 @@ Yellow::ServiceI::start(const string& name, // // TODO: At present #2 isn't supported. // - string queryEndpoints = properties->getProperty(name + ".Query.Endpoints"); - _queryAdapter = communicator->createObjectAdapterWithEndpoints(name + "QueryAdapter", queryEndpoints); + _queryAdapter = communicator->createObjectAdapter(name + ".Query"); - string adminEndpoints = properties->getProperty(name + ".Admin.Endpoints"); + string adminEndpoints = communicator->getProperties()->getProperty(name + ".Admin.Endpoints"); if(!adminEndpoints.empty()) { - _adminAdapter = communicator->createObjectAdapterWithEndpoints(name + "AdminAdapter", adminEndpoints); + _adminAdapter = communicator->createObjectAdapter(name + ".Admin"); ObjectPtr admin = new AdminI(dbYellow); _adminAdapter->add(admin, stringToIdentity(name + "/Admin")); } diff --git a/cpp/test/Glacier/starter/Client.cpp b/cpp/test/Glacier/starter/Client.cpp index 55b77842ff7..7fec465695d 100644 --- a/cpp/test/Glacier/starter/Client.cpp +++ b/cpp/test/Glacier/starter/Client.cpp @@ -37,7 +37,8 @@ CallbackClient::run(int argc, char* argv[]) { string ref; - ObjectAdapterPtr adapter = communicator()->createObjectAdapterWithEndpoints("CallbackReceiverAdapter", "default"); + communicator()->getProperties()->setProperty("CallbackReceiverAdapter.Endpoints", "default"); + ObjectAdapterPtr adapter = communicator()->createObjectAdapter("CallbackReceiverAdapter"); adapter->activate(); // Put the print statement after activate(), so that if // Ice.PrintAdapterReady is set, the "ready" is the first output diff --git a/cpp/test/Glacier/starter/Server.cpp b/cpp/test/Glacier/starter/Server.cpp index 7bac3485fe5..135d1dc5b97 100644 --- a/cpp/test/Glacier/starter/Server.cpp +++ b/cpp/test/Glacier/starter/Server.cpp @@ -31,8 +31,8 @@ main(int argc, char* argv[]) int CallbackServer::run(int argc, char* argv[]) { - string endpts = "tcp -p 12345 -t 2000"; - ObjectAdapterPtr adapter = communicator()->createObjectAdapterWithEndpoints("CallbackAdapter", endpts); + communicator()->getProperties()->setProperty("CallbackAdapter.Endpoints", "tcp -p 12345 -t 2000"); + Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("CallbackAdapter"); CallbackPrx self = CallbackPrx::uncheckedCast(adapter->createProxy(Ice::stringToIdentity("callback"))); adapter->add(new CallbackI(communicator()), Ice::stringToIdentity("callback")); adapter->activate(); diff --git a/cpp/test/Ice/exceptions/Collocated.cpp b/cpp/test/Ice/exceptions/Collocated.cpp index 13fe7ce6158..e13bd348d71 100644 --- a/cpp/test/Ice/exceptions/Collocated.cpp +++ b/cpp/test/Ice/exceptions/Collocated.cpp @@ -16,8 +16,8 @@ using namespace std; int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { - string endpts = "default -p 12345 -t 2000"; - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TestAdapter", endpts); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000"); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::ObjectPtr object = new ThrowerI(adapter); adapter->add(object, Ice::stringToIdentity("thrower")); diff --git a/cpp/test/Ice/exceptions/Server.cpp b/cpp/test/Ice/exceptions/Server.cpp index ff25f39b2ef..25129f353f5 100644 --- a/cpp/test/Ice/exceptions/Server.cpp +++ b/cpp/test/Ice/exceptions/Server.cpp @@ -18,8 +18,8 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { Ice::PropertiesPtr properties = communicator->getProperties(); properties->setProperty("Ice.ConnectionWarnings", "0"); - string endpts = "default -p 12345 -t 2000"; - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TestAdapter", endpts); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000"); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::ObjectPtr object = new ThrowerI(adapter); adapter->add(object, Ice::stringToIdentity("thrower")); adapter->activate(); diff --git a/cpp/test/Ice/facets/Collocated.cpp b/cpp/test/Ice/facets/Collocated.cpp index 6257639d6b5..963405b6305 100644 --- a/cpp/test/Ice/facets/Collocated.cpp +++ b/cpp/test/Ice/facets/Collocated.cpp @@ -16,8 +16,8 @@ using namespace std; int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { - string endpts = "default -p 12345 -t 2000"; - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TestAdapter", endpts); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000"); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::ObjectPtr d = new DI; adapter->add(d, Ice::stringToIdentity("d")); d->ice_addFacet(d, "facetABCD"); diff --git a/cpp/test/Ice/facets/Server.cpp b/cpp/test/Ice/facets/Server.cpp index 7c25e743151..57d1de4c6de 100644 --- a/cpp/test/Ice/facets/Server.cpp +++ b/cpp/test/Ice/facets/Server.cpp @@ -16,8 +16,8 @@ using namespace std; int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { - string endpts = "default -p 12345 -t 2000"; - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TestAdapter", endpts); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000"); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::ObjectPtr d = new DI; adapter->add(d, Ice::stringToIdentity("d")); d->ice_addFacet(d, "facetABCD"); diff --git a/cpp/test/Ice/faultTolerance/Server.cpp b/cpp/test/Ice/faultTolerance/Server.cpp index 90c9e33f04e..5f67babd71e 100644 --- a/cpp/test/Ice/faultTolerance/Server.cpp +++ b/cpp/test/Ice/faultTolerance/Server.cpp @@ -51,7 +51,8 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) ostringstream endpts; endpts << "default -p " << port; - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TestAdapter", endpts.str()); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", endpts.str()); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::ObjectPtr object = new TestI(adapter); adapter->add(object, Ice::stringToIdentity("test")); adapter->activate(); diff --git a/cpp/test/Ice/inheritance/Collocated.cpp b/cpp/test/Ice/inheritance/Collocated.cpp index 641674e6942..c49924d7a44 100644 --- a/cpp/test/Ice/inheritance/Collocated.cpp +++ b/cpp/test/Ice/inheritance/Collocated.cpp @@ -16,8 +16,8 @@ using namespace std; int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { - string endpts = "default -p 12345 -t 2000"; - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TestAdapter", endpts); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000"); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::ObjectPtr object = new InitialI(adapter); adapter->add(object, Ice::stringToIdentity("initial")); diff --git a/cpp/test/Ice/inheritance/Server.cpp b/cpp/test/Ice/inheritance/Server.cpp index 9d429a7eeb1..515d04fd1a1 100644 --- a/cpp/test/Ice/inheritance/Server.cpp +++ b/cpp/test/Ice/inheritance/Server.cpp @@ -16,8 +16,8 @@ using namespace std; int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { - string endpts = "default -p 12345 -t 2000"; - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TestAdapter", endpts); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000"); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::ObjectPtr object = new InitialI(adapter); adapter->add(object, Ice::stringToIdentity("initial")); adapter->activate(); diff --git a/cpp/test/Ice/location/AllTests.cpp b/cpp/test/Ice/location/AllTests.cpp index 67327d1da42..62cba6a87eb 100644 --- a/cpp/test/Ice/location/AllTests.cpp +++ b/cpp/test/Ice/location/AllTests.cpp @@ -15,10 +15,9 @@ using namespace std; void -allTests(const Ice::CommunicatorPtr& communicator) +allTests(const Ice::CommunicatorPtr& communicator, const string& ref) { - ServerManagerPrx manager = ServerManagerPrx::checkedCast( - communicator->stringToProxy("servermanager :default -t 10000 -p 12345")); + ServerManagerPrx manager = ServerManagerPrx::checkedCast(communicator->stringToProxy(ref)); test(manager); // diff --git a/cpp/test/Ice/location/Client.cpp b/cpp/test/Ice/location/Client.cpp index 12108ead77b..dd4954c2058 100644 --- a/cpp/test/Ice/location/Client.cpp +++ b/cpp/test/Ice/location/Client.cpp @@ -17,8 +17,8 @@ using namespace std; int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { - void allTests(const Ice::CommunicatorPtr&); - allTests(communicator); + void allTests(const Ice::CommunicatorPtr&, const string&); + allTests(communicator, "ServerManager:default -p 12345 -t 10000"); return EXIT_SUCCESS; } diff --git a/cpp/test/Ice/location/Collocated.cpp b/cpp/test/Ice/location/Collocated.cpp index 367a6ac2982..581673703ca 100644 --- a/cpp/test/Ice/location/Collocated.cpp +++ b/cpp/test/Ice/location/Collocated.cpp @@ -16,13 +16,13 @@ using namespace std; int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { - string endpts = "default -p 12345 -t 2000"; - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("ServerManagerAdapter", endpts); + communicator->getProperties()->setProperty("ServerManager.AdapterId", "ServerManager"); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("ServerManager"); Ice::ObjectPtr object = new ServerManagerI(adapter); - adapter->add(object, Ice::stringToIdentity("servermanager")); + adapter->add(object, Ice::stringToIdentity("ServerManager")); - void allTests(const Ice::CommunicatorPtr&); - allTests(communicator); + void allTests(const Ice::CommunicatorPtr&, const string&); + allTests(communicator, "ServerManager@ServerManager"); return EXIT_SUCCESS; } diff --git a/cpp/test/Ice/location/Server.cpp b/cpp/test/Ice/location/Server.cpp index 2214493b0aa..b0c56c57849 100644 --- a/cpp/test/Ice/location/Server.cpp +++ b/cpp/test/Ice/location/Server.cpp @@ -23,12 +23,12 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) // communicator and object adapter). // Ice::PropertiesPtr properties = communicator->getProperties(); - properties->setProperty("Ice.Adapter.ServerManagerAdapter.Endpoints", "default -p 12345"); + properties->setProperty("ServerManager.Endpoints", "default -p 12345"); - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("ServerManagerAdapter"); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("ServerManager"); Ice::ObjectPtr object = new ServerManagerI(adapter); - adapter->add(object, Ice::stringToIdentity("servermanager")); + adapter->add(object, Ice::stringToIdentity("ServerManager")); // // We also register a sample server locator which implements the diff --git a/cpp/test/Ice/location/TestI.cpp b/cpp/test/Ice/location/TestI.cpp index aa800a3a4d6..048aeaf671c 100644 --- a/cpp/test/Ice/location/TestI.cpp +++ b/cpp/test/Ice/location/TestI.cpp @@ -31,7 +31,9 @@ ServerManagerI::startServer(const Ice::Current&) // the adapter id instead of the endpoints. // _serverCommunicator = Ice::initialize(argc, argv); - Ice::ObjectAdapterPtr adapter = _serverCommunicator->createObjectAdapterWithEndpoints("TestAdapter", "default"); + _serverCommunicator->getProperties()->setProperty("TestAdapter.Endpoints", "default"); + _serverCommunicator->getProperties()->setProperty("TestAdapter.AdapterId", "TestAdapter"); + Ice::ObjectAdapterPtr adapter = _serverCommunicator->createObjectAdapter("TestAdapter"); Ice::ObjectPrx locator = _serverCommunicator->stringToProxy("locator:default -p 12345"); adapter->setLocator(Ice::LocatorPrx::uncheckedCast(locator)); diff --git a/cpp/test/Ice/locationForward/Server.cpp b/cpp/test/Ice/locationForward/Server.cpp index fdeb807d092..2765e71003a 100644 --- a/cpp/test/Ice/locationForward/Server.cpp +++ b/cpp/test/Ice/locationForward/Server.cpp @@ -62,8 +62,9 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) } ostringstream endpts; - endpts << "default -p " << port; - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TestAdapter", endpts.str()); + endpts << "default -p " << port; + communicator->getProperties()->setProperty("TestAdapter.Endpoints", endpts.str()); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::ObjectPtr object = new TestI(adapter, fwd); adapter->add(object, Ice::stringToIdentity("test")); adapter->activate(); diff --git a/cpp/test/Ice/objects/Collocated.cpp b/cpp/test/Ice/objects/Collocated.cpp index 18074993a2d..cdd5f0d25d1 100644 --- a/cpp/test/Ice/objects/Collocated.cpp +++ b/cpp/test/Ice/objects/Collocated.cpp @@ -16,8 +16,8 @@ using namespace std; int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { - string endpts = "default -p 12345 -t 2000"; - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TestAdapter", endpts); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000"); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); InitialPtr initial = new InitialI(adapter); adapter->add(initial, Ice::stringToIdentity("initial")); InitialPrx allTests(const Ice::CommunicatorPtr&, bool); diff --git a/cpp/test/Ice/objects/Server.cpp b/cpp/test/Ice/objects/Server.cpp index 45beed7cf20..d078385f27c 100644 --- a/cpp/test/Ice/objects/Server.cpp +++ b/cpp/test/Ice/objects/Server.cpp @@ -16,8 +16,8 @@ using namespace std; int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { - string endpts = "default -p 12345 -t 2000"; - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TestAdapter", endpts); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000"); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); InitialPtr initial = new InitialI(adapter); adapter->add(initial, Ice::stringToIdentity("initial")); adapter->activate(); diff --git a/cpp/test/Ice/operations/Collocated.cpp b/cpp/test/Ice/operations/Collocated.cpp index 747d22c2d78..c385c174784 100644 --- a/cpp/test/Ice/operations/Collocated.cpp +++ b/cpp/test/Ice/operations/Collocated.cpp @@ -16,8 +16,8 @@ using namespace std; int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { - string endpts = "default -p 12345 -t 2000"; - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TestAdapter", endpts); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000"); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::ObjectPtr object = new MyDerivedClassI(adapter, Ice::stringToIdentity("test")); adapter->add(object, Ice::stringToIdentity("test")); diff --git a/cpp/test/Ice/operations/Server.cpp b/cpp/test/Ice/operations/Server.cpp index 7dd323418ef..7b28350bcbe 100644 --- a/cpp/test/Ice/operations/Server.cpp +++ b/cpp/test/Ice/operations/Server.cpp @@ -16,8 +16,8 @@ using namespace std; int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { - string endpts = "default -p 12345 -t 2000"; - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TestAdapter", endpts); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12345 -t 2000"); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::ObjectPtr object = new MyDerivedClassI(adapter, Ice::stringToIdentity("test")); adapter->add(object, Ice::stringToIdentity("test")); adapter->activate(); diff --git a/cpp/test/IcePack/deployer/AllTests.cpp b/cpp/test/IcePack/deployer/AllTests.cpp index d169f912ed4..3960afe5fd9 100644 --- a/cpp/test/IcePack/deployer/AllTests.cpp +++ b/cpp/test/IcePack/deployer/AllTests.cpp @@ -34,7 +34,7 @@ void allCommonTests(const Ice::CommunicatorPtr& communicator) { IcePack::AdminPrx admin = IcePack::AdminPrx::checkedCast( - communicator->stringToProxy("IcePack/Admin@IcePackAdminAdapter")); + communicator->stringToProxy("IcePack/Admin@IcePack.Registry.Admin")); test(admin); cout << "test server registration..." << flush; @@ -56,7 +56,7 @@ allCommonTests(const Ice::CommunicatorPtr& communicator) cout << "ok" << endl; Yellow::QueryPrx yellow = Yellow::QueryPrx::checkedCast( - communicator->stringToProxy("Yellow/Query@YellowQueryAdapter")); + communicator->stringToProxy("Yellow/Query@Yellow.Query")); test(yellow); cout << "testing offer registration... " << flush; @@ -127,7 +127,7 @@ allTestsWithTarget(const Ice::CommunicatorPtr& communicator) allCommonTests(communicator); IcePack::AdminPrx admin = IcePack::AdminPrx::checkedCast( - communicator->stringToProxy("IcePack/Admin@IcePackAdminAdapter")); + communicator->stringToProxy("IcePack/Admin@IcePack.Registry.Admin")); test(admin); cout << "pinging server objects... " << flush; diff --git a/cpp/test/IcePack/deployer/Server.cpp b/cpp/test/IcePack/deployer/Server.cpp index c68f83839b4..8613974b79a 100644 --- a/cpp/test/IcePack/deployer/Server.cpp +++ b/cpp/test/IcePack/deployer/Server.cpp @@ -28,7 +28,7 @@ int Ice::PropertiesPtr properties = communicator()->getProperties(); string name = properties->getProperty("Ice.ProgramName"); - Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter(name + "Adapter"); + Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter(name); Ice::ObjectPtr object = new TestI(adapter, properties); adapter->add(object, Ice::stringToIdentity(name)); adapter->activate(); diff --git a/cpp/test/IcePack/deployer/Service.cpp b/cpp/test/IcePack/deployer/Service.cpp index b1a54c8bc23..fd0d7b0fce6 100644 --- a/cpp/test/IcePack/deployer/Service.cpp +++ b/cpp/test/IcePack/deployer/Service.cpp @@ -31,7 +31,6 @@ public: virtual void start(const string&, const CommunicatorPtr&, - const PropertiesPtr&, const StringSeq&); virtual void stop(); @@ -46,7 +45,6 @@ public: virtual void start(const string&, const CommunicatorPtr&, - const PropertiesPtr&, const StringSeq&, const Freeze::DBEnvironmentPtr&); @@ -84,11 +82,10 @@ ServiceI::~ServiceI() void ServiceI::start(const string& name, const CommunicatorPtr& communicator, - const PropertiesPtr& properties, const StringSeq& args) { - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter(name + "Adapter"); - Ice::ObjectPtr object = new TestI(adapter, properties); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter(name); + Ice::ObjectPtr object = new TestI(adapter, communicator->getProperties()); adapter->add(object, Ice::stringToIdentity(name)); adapter->activate(); } @@ -109,7 +106,6 @@ FreezeServiceI::~FreezeServiceI() void FreezeServiceI::start(const string& name, const CommunicatorPtr& communicator, - const PropertiesPtr& properties, const StringSeq& args, const Freeze::DBEnvironmentPtr& dbEnv) { @@ -118,8 +114,8 @@ FreezeServiceI::start(const string& name, // Freeze::DBPtr db = dbEnv->openDB("testdb", true); - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter(name + "Adapter"); - Ice::ObjectPtr object = new TestI(adapter, properties); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter(name); + Ice::ObjectPtr object = new TestI(adapter, communicator->getProperties()); adapter->add(object, Ice::stringToIdentity(name)); adapter->activate(); } diff --git a/cpp/test/IcePack/deployer/freezeservice.xml b/cpp/test/IcePack/deployer/freezeservice.xml index 5dd9940494e..e39427c1caa 100644 --- a/cpp/test/IcePack/deployer/freezeservice.xml +++ b/cpp/test/IcePack/deployer/freezeservice.xml @@ -1,7 +1,7 @@ <service kind="freeze" entry="TestService:createFreezeService"> <adapters> - <adapter name="${name}Adapter" endpoints="default"> + <adapter name="${name}" endpoints="default" id="${name}Adapter"> <offer interface="::Test" identity="${name}"/> </adapter> </adapters> diff --git a/cpp/test/IcePack/deployer/server.xml b/cpp/test/IcePack/deployer/server.xml index ac21a8cbd0f..47528322380 100644 --- a/cpp/test/IcePack/deployer/server.xml +++ b/cpp/test/IcePack/deployer/server.xml @@ -6,7 +6,7 @@ </target> <adapters> - <adapter name="${name}Adapter" endpoints="default"> + <adapter name="${name}" endpoints="default" id="${name}Adapter"> <offer interface="::Test" identity="${name}"/> </adapter> </adapters> diff --git a/cpp/test/IcePack/deployer/service.xml b/cpp/test/IcePack/deployer/service.xml index d62c74789b5..11ec815ae3a 100644 --- a/cpp/test/IcePack/deployer/service.xml +++ b/cpp/test/IcePack/deployer/service.xml @@ -1,7 +1,7 @@ <service kind="standard" entry="TestService:create"> <adapters> - <adapter name="${name}Adapter" endpoints="default"> + <adapter name="${name}" endpoints="default" id="${name}Adapter"> <offer interface="::Test" identity="${name}"/> </adapter> </adapters> diff --git a/cpp/test/IcePack/deployer/yellow_service.xml b/cpp/test/IcePack/deployer/yellow_service.xml index 780fb53f086..dd78c1667ab 100644 --- a/cpp/test/IcePack/deployer/yellow_service.xml +++ b/cpp/test/IcePack/deployer/yellow_service.xml @@ -1,13 +1,8 @@ <service kind="freeze" entry="YellowService:create" endpoints="default"> -<adapters> - <adapter name="${name}QueryAdapter"/> - <adapter name="${name}AdminAdapter"/> -</adapters> - -<properties> - <property name="${name}.Query.Endpoints" value="default"/> - <property name="${name}.Admin.Endpoints" value="default"/> -</properties> + <adapters> + <adapter name="${name}.Query" endpoints="default" id="Yellow.Query"/> + <adapter name="${name}.Admin" endpoints="default" id="Yellow.Admin"/> + </adapters> </service> diff --git a/cpp/test/IcePack/simple/Collocated.cpp b/cpp/test/IcePack/simple/Collocated.cpp deleted file mode 100644 index b2130d41c46..00000000000 --- a/cpp/test/IcePack/simple/Collocated.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2001 -// Mutable Realms, Inc. -// Huntsville, AL, USA -// -// All Rights Reserved -// -// ********************************************************************** - -#include <Ice/Ice.h> -#include <TestI.h> - -using namespace std; - -int -run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) -{ - string endpts = "default -t 2000"; - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TestAdapter", endpts); - Ice::ObjectPtr object = new TestI(adapter); - adapter->add(object, Ice::stringToIdentity("test")); - - TestPrx allTests(const Ice::CommunicatorPtr&); - allTests(communicator); - return EXIT_SUCCESS; -} - -int -main(int argc, char* argv[]) -{ - int status; - Ice::CommunicatorPtr communicator; - - try - { - communicator = Ice::initialize(argc, argv); - status = run(argc, argv, communicator); - } - catch(const Ice::Exception& ex) - { - cerr << ex << endl; - status = EXIT_FAILURE; - } - - if(communicator) - { - try - { - communicator->destroy(); - } - catch(const Ice::Exception& ex) - { - cerr << ex << endl; - status = EXIT_FAILURE; - } - } - - return status; -} diff --git a/cpp/test/IcePack/simple/Makefile b/cpp/test/IcePack/simple/Makefile index 5c13407afd4..8b7b1660ba7 100644 --- a/cpp/test/IcePack/simple/Makefile +++ b/cpp/test/IcePack/simple/Makefile @@ -12,9 +12,8 @@ top_srcdir = ../../.. CLIENT = client SERVER = server -COLLOCATED = collocated -TARGETS = $(CLIENT) $(SERVER) $(COLLOCATED) +TARGETS = $(CLIENT) $(SERVER) OBJS = Test.o \ @@ -24,14 +23,9 @@ COBJS = Client.o \ SOBJS = TestI.o \ Server.o -COLOBJS = TestI.o \ - Collocated.o \ - AllTests.o - SRCS = $(OBJS:.o=.cpp) \ $(COBJS:.o=.cpp) \ $(SOBJS:.o=.cpp) \ - $(COLOBJS:.o=.cpp) SLICE_SRCS = Test.ice @@ -47,10 +41,6 @@ $(SERVER): $(OBJS) $(SOBJS) rm -f $@ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) $(LIBS) -$(COLLOCATED): $(OBJS) $(COLOBJS) - rm -f $@ - $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(COLOBJS) $(LIBS) - Test.h Test.cpp: Test.ice $(SLICE2CPP) rm -f Test.h Test.cpp $(SLICE2CPP) Test.ice diff --git a/cpp/test/IcePack/simple/Server.cpp b/cpp/test/IcePack/simple/Server.cpp index 39f5b6350c7..7ec28990fc6 100644 --- a/cpp/test/IcePack/simple/Server.cpp +++ b/cpp/test/IcePack/simple/Server.cpp @@ -17,8 +17,8 @@ int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { Ice::PropertiesPtr properties = communicator->getProperties(); - properties->setProperty("Ice.Adapter.TestAdapter.Endpoints", "default -t 2000"); - properties->setProperty("Ice.Adapter.TestAdapter.Locator", properties->getProperty("Ice.Default.Locator")); + properties->setProperty("TestAdapter.Endpoints", "default -t 2000"); + properties->setProperty("TestAdapter.AdapterId", "TestAdapter"); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::ObjectPtr object = new TestI(adapter); diff --git a/cpp/test/IcePack/simple/run.py b/cpp/test/IcePack/simple/run.py index f0937596df0..24ed905f18f 100755 --- a/cpp/test/IcePack/simple/run.py +++ b/cpp/test/IcePack/simple/run.py @@ -40,10 +40,9 @@ if os.path.exists(os.path.join(testdir, "db/registry")): icePackRegistryPipe = IcePackAdmin.startIcePackRegistry(toplevel, "12346", testdir) # -# Test client/server, collocated without on demand activation. +# Test client/server without on demand activation. # TestUtil.mixedClientServerTestWithOptions(toplevel, name, additionalOptions, additionalOptions) -TestUtil.collocatedTestWithOptions(toplevel, name, additionalOptions) # # Shutdown the registry. diff --git a/cpp/test/IcePack/simple/simple_server.xml b/cpp/test/IcePack/simple/simple_server.xml index 535ded622b5..5557a732b4e 100644 --- a/cpp/test/IcePack/simple/simple_server.xml +++ b/cpp/test/IcePack/simple/simple_server.xml @@ -1,7 +1,7 @@ <server kind="cpp"> <adapters> - <adapter name="TestAdapter"/> + <adapter name="TestAdapter" endpoints="default" id="TestAdapter"/> </adapters> <target name="debug"> diff --git a/cpp/test/IceSSL/certificateVerification/Server.cpp b/cpp/test/IceSSL/certificateVerification/Server.cpp index 69e80bb4532..58c899ac889 100644 --- a/cpp/test/IceSSL/certificateVerification/Server.cpp +++ b/cpp/test/IceSSL/certificateVerification/Server.cpp @@ -159,13 +159,13 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) sslPlugin->setCertificateVerifier(IceSSL::Server, certVerifier); } - string kmEndpts = "tcp -p 12344 -t 2000"; - Ice::ObjectAdapterPtr kmAdapter = communicator->createObjectAdapterWithEndpoints("KeyManagerAdapter", kmEndpts); + properties->setProperty("KeyManagerAdapter.Endpoints", "tcp -p 12344 -t 2000"); + Ice::ObjectAdapterPtr kmAdapter = communicator->createObjectAdapter("KeyManagerAdapter"); kmAdapter->add(object, Ice::stringToIdentity("keyManager")); kmAdapter->activate(); - string endpts = "ssl -p 12345 -t 2000"; - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("PingerAdapter", endpts); + properties->setProperty("PingerAdapter.Endpoints", "ssl -p 12345 -t 2000"); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("PingerAdapter"); adapter->add(new PingerI(), Ice::stringToIdentity("pinger")); adapter->activate(); communicator->waitForShutdown(); diff --git a/cpp/test/IceStorm/federation/Publisher.cpp b/cpp/test/IceStorm/federation/Publisher.cpp index 3578146b12d..e35b3ea4f2c 100644 --- a/cpp/test/IceStorm/federation/Publisher.cpp +++ b/cpp/test/IceStorm/federation/Publisher.cpp @@ -25,19 +25,19 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator) args = properties->parseCommandLineOptions("IceStorm", args); stringSeqToArgs(args, argc, argv); - const char* managerReferenceProperty = "IceStorm.TopicManager"; - string managerReference = properties->getProperty(managerReferenceProperty); - if(managerReference.empty()) + const char* managerProxyProperty = "IceStorm.TopicManager.Proxy"; + string managerProxy = properties->getProperty(managerProxyProperty); + if(managerProxy.empty()) { - cerr << argv[0] << ": property `" << managerReferenceProperty << "' is not set" << endl; + cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl; return EXIT_FAILURE; } - ObjectPrx base = communicator->stringToProxy(managerReference); + ObjectPrx base = communicator->stringToProxy(managerProxy); IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(base); if(!manager) { - cerr << argv[0] << ": `" << managerReference << "' is not running" << endl; + cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl; return EXIT_FAILURE; } diff --git a/cpp/test/IceStorm/federation/Subscriber.cpp b/cpp/test/IceStorm/federation/Subscriber.cpp index 8f1e51e0da6..f1abdd0ef00 100644 --- a/cpp/test/IceStorm/federation/Subscriber.cpp +++ b/cpp/test/IceStorm/federation/Subscriber.cpp @@ -86,23 +86,24 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator) } createLock(lockfile); - const char* managerReferenceProperty = "IceStorm.TopicManager"; - string managerReference = properties->getProperty(managerReferenceProperty); - if(managerReference.empty()) + const char* managerProxyProperty = "IceStorm.TopicManager.Proxy"; + string managerProxy = properties->getProperty(managerProxyProperty); + if(managerProxy.empty()) { - cerr << argv[0] << ": property `" << managerReferenceProperty << "' is not set" << endl; + cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl; return EXIT_FAILURE; } - ObjectPrx base = communicator->stringToProxy(managerReference); + ObjectPrx base = communicator->stringToProxy(managerProxy); IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(base); if(!manager) { - cerr << argv[0] << ": `" << managerReference << "' is not running" << endl; + cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl; return EXIT_FAILURE; } - ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("SubscriberAdapter", "default"); + properties->setProperty("SubscriberAdapter.Endpoints", "default"); + ObjectAdapterPtr adapter = communicator->createObjectAdapter("SubscriberAdapter"); EventIPtr eventFed1 = new EventI(communicator); EventIPtr eventFed2 = new EventI(communicator); EventIPtr eventFed3 = new EventI(communicator); diff --git a/cpp/test/IceStorm/federation/run.py b/cpp/test/IceStorm/federation/run.py index cb821a2f779..83386b06347 100755 --- a/cpp/test/IceStorm/federation/run.py +++ b/cpp/test/IceStorm/federation/run.py @@ -37,7 +37,7 @@ iceBoxEndpoints=' --IceBox.ServiceManager.Endpoints="default -p 12345"' iceStormService=" --IceBox.Service.IceStorm=IceStormService:create" + \ ' --IceStorm.TopicManager.Endpoints="default -p 12346"' + \ " --IceBox.PrintServicesReady=IceStorm" -iceStormReference=' --IceStorm.TopicManager="IceStorm.TopicManager: default -p 12346"' +iceStormReference=' --IceStorm.TopicManager.Proxy="IceStorm/TopicManager: default -p 12346"' dbEnvName = os.path.join(testdir, "db") TestUtil.cleanDbDir(dbEnvName) diff --git a/cpp/test/IceStorm/federation2/run.py b/cpp/test/IceStorm/federation2/run.py index d4c2bd8d3af..088b29d494b 100755 --- a/cpp/test/IceStorm/federation2/run.py +++ b/cpp/test/IceStorm/federation2/run.py @@ -37,7 +37,7 @@ iceBoxEndpoints=' --IceBox.ServiceManager.Endpoints="default -p 12345"' iceStormService=" --IceBox.Service.IceStorm=IceStormService:create" + \ ' --IceStorm.TopicManager.Endpoints="default -p 12346"' + \ " --IceBox.PrintServicesReady=IceStorm" -iceStormReference=' --IceStorm.TopicManager="IceStorm.TopicManager: default -p 12346"' +iceStormReference=' --IceStorm.TopicManager.Proxy="IceStorm/TopicManager: default -p 12346"' dbEnvName = os.path.join(testdir, "db") TestUtil.cleanDbDir(dbEnvName) diff --git a/cpp/test/IceStorm/single/Publisher.cpp b/cpp/test/IceStorm/single/Publisher.cpp index 4647483eae2..24e10019b2d 100644 --- a/cpp/test/IceStorm/single/Publisher.cpp +++ b/cpp/test/IceStorm/single/Publisher.cpp @@ -25,19 +25,19 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator) args = properties->parseCommandLineOptions("IceStorm", args); stringSeqToArgs(args, argc, argv); - const char* managerReferenceProperty = "IceStorm.TopicManager"; - string managerReference = properties->getProperty(managerReferenceProperty); - if(managerReference.empty()) + const char* managerProxyProperty = "IceStorm.TopicManager.Proxy"; + string managerProxy = properties->getProperty(managerProxyProperty); + if(managerProxy.empty()) { - cerr << argv[0] << ": property `" << managerReferenceProperty << "' is not set" << endl; + cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl; return EXIT_FAILURE; } - ObjectPrx base = communicator->stringToProxy(managerReference); + ObjectPrx base = communicator->stringToProxy(managerProxy); IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(base); if(!manager) { - cerr << argv[0] << ": `" << managerReference << "' is not running" << endl; + cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl; return EXIT_FAILURE; } diff --git a/cpp/test/IceStorm/single/Subscriber.cpp b/cpp/test/IceStorm/single/Subscriber.cpp index 40fec79d20a..23f3ca1db29 100644 --- a/cpp/test/IceStorm/single/Subscriber.cpp +++ b/cpp/test/IceStorm/single/Subscriber.cpp @@ -79,23 +79,24 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator) } createLock(lockfile); - const char* managerReferenceProperty = "IceStorm.TopicManager"; - string managerReference = properties->getProperty(managerReferenceProperty); - if(managerReference.empty()) + const char* managerProxyProperty = "IceStorm.TopicManager.Proxy"; + string managerProxy = properties->getProperty(managerProxyProperty); + if(managerProxy.empty()) { - cerr << argv[0] << ": property `" << managerReferenceProperty << "' is not set" << endl; + cerr << argv[0] << ": property `" << managerProxyProperty << "' is not set" << endl; return EXIT_FAILURE; } - ObjectPrx base = communicator->stringToProxy(managerReference); + ObjectPrx base = communicator->stringToProxy(managerProxy); IceStorm::TopicManagerPrx manager = IceStorm::TopicManagerPrx::checkedCast(base); if(!manager) { - cerr << argv[0] << ": `" << managerReference << "' is not running" << endl; + cerr << argv[0] << ": `" << managerProxy << "' is not running" << endl; return EXIT_FAILURE; } - ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("SingleAdapter", "default"); + properties->setProperty("SingleAdapter", "default"); + ObjectAdapterPtr adapter = communicator->createObjectAdapter("SingleAdapter"); ObjectPtr single = new SingleI(communicator); ObjectPrx object = adapter->add(single, stringToIdentity("single/events")); diff --git a/cpp/test/IceStorm/single/run.py b/cpp/test/IceStorm/single/run.py index 762ff06609d..69a23e149d0 100755 --- a/cpp/test/IceStorm/single/run.py +++ b/cpp/test/IceStorm/single/run.py @@ -35,9 +35,9 @@ updatedClientServerOptions = TestUtil.clientServerOptions.replace("TOPLEVELDIR", iceBoxEndpoints=' --IceBox.ServiceManager.Endpoints="default -p 12345"' iceStormService=" --IceBox.Service.IceStorm=IceStormService:create" + \ - ' --IceStorm.TopicManager.Endpoints="default -p 12346"' + \ + ' --IceStorm.TopicManager.Endpoints="default -p 12346"' + \ " --IceBox.PrintServicesReady=IceStorm" -iceStormReference=' --IceStorm.TopicManager="IceStorm.TopicManager: default -p 12346"' +iceStormReference=' --IceStorm.TopicManager.Proxy="IceStorm/TopicManager:default -p 12346"' dbEnvName = os.path.join(testdir, "db") TestUtil.cleanDbDir(dbEnvName) |