summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/IceBox/Admin.cpp23
-rw-r--r--cpp/src/IceBox/ServiceManagerI.cpp23
2 files changed, 35 insertions, 11 deletions
diff --git a/cpp/src/IceBox/Admin.cpp b/cpp/src/IceBox/Admin.cpp
index 9e254ec204b..ba7420c9511 100644
--- a/cpp/src/IceBox/Admin.cpp
+++ b/cpp/src/IceBox/Admin.cpp
@@ -88,19 +88,28 @@ Client::run(int argc, char* argv[])
return EXIT_SUCCESS;
}
- const char* managerEndpointsProperty = "IceBox.ServiceManager.Endpoints";
- string managerEndpoints = properties->getProperty(managerEndpointsProperty);
- if(managerEndpoints.empty())
+ const char* managerProperty = "IceBox.ServiceManager";
+ string managerProxy = properties->getProperty(managerProperty);
+ if(managerProxy.empty())
{
- cerr << appName() << ": property `" << managerEndpointsProperty << "' is not set" << endl;
- return EXIT_FAILURE;
+ const char* nameProperty = "IceBox.Name";
+ string name = properties->getProperty(nameProperty);
+ if(!properties->getProperty("Ice.Default.Locator").empty() && !name.empty())
+ {
+ managerProxy = name + ".ServiceManager@" + name + ".ServiceManagerAdapter";
+ }
+ else
+ {
+ cerr << appName() << ": property `" << managerProperty << "' is not set" << endl;
+ return EXIT_FAILURE;
+ }
}
- ObjectPrx base = communicator()->stringToProxy("ServiceManager:" + managerEndpoints);
+ ObjectPrx base = communicator()->stringToProxy(managerProxy);
IceBox::ServiceManagerPrx manager = IceBox::ServiceManagerPrx::checkedCast(base);
if(!manager)
{
- cerr << appName() << ": `" << managerEndpoints << "' is not running" << endl;
+ cerr << appName() << ": `" << managerProxy << "' is not running" << endl;
return EXIT_FAILURE;
}
diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp
index 97c67085191..c8ef663aba8 100644
--- a/cpp/src/IceBox/ServiceManagerI.cpp
+++ b/cpp/src/IceBox/ServiceManagerI.cpp
@@ -56,14 +56,29 @@ IceBox::ServiceManagerI::run()
{
ServiceManagerPtr obj = this;
+ //
+ // 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("ServiceManagerAdapter",
- "IceBox.ServiceManager.Endpoints");
- adapter->add(obj, stringToIdentity("ServiceManager"));
+ ObjectAdapterPtr adapter =
+ _server->communicator()->createObjectAdapterFromProperty(namePrefix + "ServiceManagerAdapter",
+ "IceBox.ServiceManager.Endpoints");
+
+ string identity = properties->getPropertyWithDefault("IceBox.ServiceManager.Identity",
+ namePrefix + "ServiceManager");
+ adapter->add(obj, stringToIdentity(identity));
//
// Load and initialize the services defined in the property set
@@ -73,7 +88,7 @@ IceBox::ServiceManagerI::run()
// IceBox.Service.Foo=entry_point [args]
//
const string prefix = "IceBox.Service.";
- PropertiesPtr properties = _server->communicator()->getProperties();
+
PropertyDict services = properties->getPropertiesForPrefix(prefix);
PropertyDict::const_iterator p;
for(p = services.begin(); p != services.end(); ++p)