diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2006-12-18 17:06:44 +0000 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2006-12-18 17:06:44 +0000 |
commit | d07fdae285690f699a70f97f36232e516dcad2bc (patch) | |
tree | c239def689c5e6cc53ac76dbe3e60ec11c306964 /cpp/src | |
parent | Fixed tryLock() comment (diff) | |
download | ice-d07fdae285690f699a70f97f36232e516dcad2bc.tar.bz2 ice-d07fdae285690f699a70f97f36232e516dcad2bc.tar.xz ice-d07fdae285690f699a70f97f36232e516dcad2bc.zip |
Object adapter properties now prefixed by "Ice.OA."
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Glacier2/Glacier2Router.cpp | 23 | ||||
-rw-r--r-- | cpp/src/Ice/CommunicatorI.cpp | 2 | ||||
-rw-r--r-- | cpp/src/Ice/ObjectAdapterFactory.cpp | 2 | ||||
-rw-r--r-- | cpp/src/Ice/ObjectAdapterI.cpp | 124 | ||||
-rw-r--r-- | cpp/src/Ice/ObjectAdapterI.h | 4 | ||||
-rw-r--r-- | cpp/src/Ice/PropertyNames.cpp | 27 | ||||
-rw-r--r-- | cpp/src/Ice/PropertyNames.h | 2 | ||||
-rw-r--r-- | cpp/src/IceBox/Admin.cpp | 18 | ||||
-rw-r--r-- | cpp/src/IceGrid/DescriptorBuilder.cpp | 17 | ||||
-rw-r--r-- | cpp/src/IceGrid/DescriptorHelper.cpp | 25 | ||||
-rw-r--r-- | cpp/src/IceGrid/IceGridNode.cpp | 39 | ||||
-rw-r--r-- | cpp/src/IceGrid/PlatformInfo.cpp | 36 | ||||
-rw-r--r-- | cpp/src/IceGrid/RegistryI.cpp | 63 | ||||
-rw-r--r-- | cpp/src/IceGrid/ServerI.cpp | 6 | ||||
-rwxr-xr-x | cpp/src/IcePatch2/ClientUtil.cpp | 7 | ||||
-rw-r--r-- | cpp/src/IcePatch2/Server.cpp | 20 | ||||
-rw-r--r-- | cpp/src/IceUtil/StringUtil.cpp | 67 |
17 files changed, 360 insertions, 122 deletions
diff --git a/cpp/src/Glacier2/Glacier2Router.cpp b/cpp/src/Glacier2/Glacier2Router.cpp index 2e52ea9a6e6..aeac0ac4d27 100644 --- a/cpp/src/Glacier2/Glacier2Router.cpp +++ b/cpp/src/Glacier2/Glacier2Router.cpp @@ -131,8 +131,11 @@ Glacier2::RouterService::start(int argc, char* argv[]) // // Initialize the client object adapter. // - const string clientEndpointsProperty = "Glacier2.Client.Endpoints"; - if(properties->getProperty(clientEndpointsProperty).empty()) + // DEPRECATED PROPERTY: Remove extra code in future release + // + const string clientEndpointsProperty = "Ice.OA.Glacier2.Client.Endpoints"; + if(properties->getProperty(clientEndpointsProperty).empty() && + properties->getProperty("Glacier2.Client.Endpoints").empty()) { error("property `" + clientEndpointsProperty + "' is not set"); return false; @@ -143,9 +146,12 @@ Glacier2::RouterService::start(int argc, char* argv[]) // Initialize the server object adapter only if server endpoints // are defined. // - const string serverEndpointsProperty = "Glacier2.Server.Endpoints"; + // DEPRECATED PROPERTY: Remove extra code in future release + // + const string serverEndpointsProperty = "Ice.OA.Glacier2.Server.Endpoints"; ObjectAdapterPtr serverAdapter; - if(!properties->getProperty(serverEndpointsProperty).empty()) + if(!properties->getProperty(serverEndpointsProperty).empty() || + !properties->getProperty("Glacier2.Server.Endpoints").empty()) { serverAdapter = communicator()->createObjectAdapter("Glacier2.Server"); } @@ -154,9 +160,12 @@ Glacier2::RouterService::start(int argc, char* argv[]) // Initialize the admin object adapter only if admin endpoints // are defined. // - const string adminEndpointsProperty = "Glacier2.Admin.Endpoints"; + // DEPRECATED PROPERTY: Remove extra code in future release + // + const string adminEndpointsProperty = "Ice.OA.Glacier2.Admin.Endpoints"; ObjectAdapterPtr adminAdapter; - if(!properties->getProperty(adminEndpointsProperty).empty()) + if(!properties->getProperty(adminEndpointsProperty).empty() || + !properties->getProperty("Glacier2.Admin.Endpoints").empty()) { adminAdapter = communicator()->createObjectAdapter("Glacier2.Admin"); } @@ -167,7 +176,7 @@ Glacier2::RouterService::start(int argc, char* argv[]) // We need a separate object adapter for any collocated // permissions verifiers. We can't use the client adapter. // - properties->setProperty("Glacier2Internal.Verifiers.AdapterId", IceUtil::generateUUID()); + properties->setProperty("Ice.OA.Glacier2Internal.Verifiers.AdapterId", IceUtil::generateUUID()); ObjectAdapterPtr verifierAdapter = communicator()->createObjectAdapter("Glacier2Internal.Verifiers"); // diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp index 913df832639..d56d618eaa8 100644 --- a/cpp/src/Ice/CommunicatorI.cpp +++ b/cpp/src/Ice/CommunicatorI.cpp @@ -152,7 +152,7 @@ Ice::CommunicatorI::identityToString(const Identity& ident) const ObjectAdapterPtr Ice::CommunicatorI::createObjectAdapter(const string& name) { - return createObjectAdapterWithEndpoints(name, getProperties()->getProperty(name + ".Endpoints")); + return _instance->objectAdapterFactory()->createObjectAdapter(name, "", 0); } ObjectAdapterPtr diff --git a/cpp/src/Ice/ObjectAdapterFactory.cpp b/cpp/src/Ice/ObjectAdapterFactory.cpp index 36b88ee695e..03ca3d518c5 100644 --- a/cpp/src/Ice/ObjectAdapterFactory.cpp +++ b/cpp/src/Ice/ObjectAdapterFactory.cpp @@ -117,7 +117,7 @@ IceInternal::ObjectAdapterFactory::createObjectAdapter(const string& name, const throw AlreadyRegisteredException(__FILE__, __LINE__, "object adapter", name); } - if(name.empty() && (!name.empty() || router != 0)) + if(name.empty() && (!endpoints.empty() || router != 0)) { InitializationException ex(__FILE__, __LINE__); ex.reason = "Cannot configure endpoints or router with nameless object adapter"; diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp index ac6d5262c2a..954e3976ad5 100644 --- a/cpp/src/Ice/ObjectAdapterI.cpp +++ b/cpp/src/Ice/ObjectAdapterI.cpp @@ -45,6 +45,8 @@ using namespace std; using namespace Ice; using namespace IceInternal; +string Ice::ObjectAdapterI::_propertyPrefix = "Ice.OA."; + string Ice::ObjectAdapterI::getName() const { @@ -99,10 +101,13 @@ Ice::ObjectAdapterI::activate() locatorInfo = _locatorInfo; if(!_noConfig) { - printAdapterReady = - _instance->initializationData().properties->getPropertyAsInt("Ice.PrintAdapterReady") > 0; - registerProcess = - _instance->initializationData().properties->getPropertyAsInt(_name + ".RegisterProcess") > 0; + PropertiesPtr properties = _instance->initializationData().properties; + printAdapterReady = properties->getPropertyAsInt("Ice.PrintAdapterReady") > 0; + // + // DEPREACTED PROPERTY: Remove extra code in future release + // + registerProcess = properties->getPropertyAsIntWithDefault(_propertyPrefix + _name + ".RegisterProcess", + properties->getPropertyAsInt(_name + ".RegisterProcess")) > 0; } } @@ -695,12 +700,18 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const Communica } // + // DEPRECATED PROPERTIES: Remove extra code in future release + // + + // // Make sure named adapter has some configuration // + PropertiesPtr properties = instance->initializationData().properties; + StringSeq oldProps = filterProperties(_name + "."); if(endpointInfo.empty() && router == 0) { - PropertyDict oaProps = instance->initializationData().properties->getPropertiesForPrefix(_name + "."); - if(oaProps.size() == 0) + StringSeq props = filterProperties(_propertyPrefix + _name + "."); + if(oldProps.size() == 0 && props.size() == 0) { InitializationException ex(__FILE__, __LINE__); ex.reason = "Object adapter \"" + _name + "\" requires configuration."; @@ -708,17 +719,34 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const Communica } } - const_cast<string&>(_id) = instance->initializationData().properties->getProperty(name + ".AdapterId"); - const_cast<string&>(_replicaGroupId) = - instance->initializationData().properties->getProperty(name + ".ReplicaGroupId"); + if(oldProps.size() != 0) + { + Warning out(_instance->initializationData().logger); + out << "The following properties have been deprecated, please prepend \"Ice.OA.\":"; + for(unsigned int i = 0; i < oldProps.size(); ++i) + { + out << "\n " << oldProps[i]; + } + } + + const_cast<string&>(_id) = properties->getPropertyWithDefault(_propertyPrefix + _name + ".AdapterId", + properties->getProperty(_name + ".AdapterId")); + const_cast<string&>(_replicaGroupId) = + properties->getPropertyWithDefault(_propertyPrefix + _name + ".ReplicaGroupId", + properties->getProperty(_name + ".ReplicaGroupId")); __setNoDelete(true); try { if(!router) { - const_cast<RouterPrx&>(router) = - RouterPrx::uncheckedCast(_instance->proxyFactory()->propertyToProxy(_name + ".Router")); + const_cast<RouterPrx&>(router) = RouterPrx::uncheckedCast( + _instance->proxyFactory()->propertyToProxy(_propertyPrefix + _name + ".Router")); + if(!router) + { + const_cast<RouterPrx&>(router) = RouterPrx::uncheckedCast( + _instance->proxyFactory()->propertyToProxy(_name + ".Router")); + } } if(router) { @@ -767,7 +795,16 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const Communica // The connection factory might change it, for example, to // fill in the real port number. // - vector<EndpointIPtr> endpoints = parseEndpoints(endpointInfo); + vector<EndpointIPtr> endpoints; + if(endpointInfo.empty()) + { + endpoints = parseEndpoints(properties->getPropertyWithDefault(_propertyPrefix + _name + ".Endpoints", + properties->getProperty(_name + ".Endpoints"))); + } + else + { + endpoints = parseEndpoints(endpointInfo); + } for(vector<EndpointIPtr>::iterator p = endpoints.begin(); p != endpoints.end(); ++p) { _incomingConnectionFactories.push_back(new IncomingConnectionFactory(instance, *p, this, _name)); @@ -786,7 +823,8 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const Communica // Parse published endpoints. If set, these are used in proxies // instead of the connection factory endpoints. // - string endpts = _instance->initializationData().properties->getProperty(name + ".PublishedEndpoints"); + string endpts = properties->getPropertyWithDefault(_propertyPrefix + _name + ".PublishedEndpoints", + properties->getProperty(_name + ".PublishedEndpoints")); _publishedEndpoints = parseEndpoints(endpts); if(_publishedEndpoints.empty()) { @@ -801,11 +839,15 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const Communica not1(Ice::constMemFun(&EndpointI::publish))), _publishedEndpoints.end()); } - string locatorProperty = _name + ".Locator"; - if(!_instance->initializationData().properties->getProperty(locatorProperty).empty()) + string locatorProperty = _propertyPrefix + _name + ".Locator"; + if(!properties->getProperty(locatorProperty).empty()) { setLocator(LocatorPrx::uncheckedCast(_instance->proxyFactory()->propertyToProxy(locatorProperty))); } + else if(!properties->getProperty(_name + ".Locator").empty()) + { + setLocator(LocatorPrx::uncheckedCast(_instance->proxyFactory()->propertyToProxy(_name + ".Locator"))); + } else { setLocator(_instance->referenceFactory()->getDefaultLocator()); @@ -813,11 +855,24 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const Communica if(!_instance->threadPerConnection()) { - int size = _instance->initializationData().properties->getPropertyAsInt(_name + ".ThreadPool.Size"); - int sizeMax = _instance->initializationData().properties->getPropertyAsInt(_name + ".ThreadPool.SizeMax"); - if(size > 0 || sizeMax > 0) + if(!properties->getProperty(_propertyPrefix + _name + ".ThreadPool.Size").empty() || + !properties->getProperty(_propertyPrefix + _name + ".ThreadPool.SizeMax").empty()) + { + int size = properties->getPropertyAsInt(_propertyPrefix + _name + ".ThreadPool.Size"); + int sizeMax = properties->getPropertyAsInt(_propertyPrefix + _name + ".ThreadPool.SizeMax"); + if(size > 0 || sizeMax > 0) + { + _threadPool = new ThreadPool(_instance, _propertyPrefix + _name + ".ThreadPool", 0); + } + } + else { - _threadPool = new ThreadPool(_instance, _name + ".ThreadPool", 0); + int size = properties->getPropertyAsInt(_name + ".ThreadPool.Size"); + int sizeMax = properties->getPropertyAsInt(_name + ".ThreadPool.SizeMax"); + if(size > 0 || sizeMax > 0) + { + _threadPool = new ThreadPool(_instance, _name + ".ThreadPool", 0); + } } } } @@ -1082,6 +1137,37 @@ ObjectAdapterI::updateLocatorRegistry(const IceInternal::LocatorInfoPtr& locator } } +StringSeq +Ice::ObjectAdapterI::filterProperties(const string& prefix) +{ + static const string suffixes[] = + { + "AdapterId", + "Endpoints", + "Locator", + "PublishedEndpoints", + "RegisterProcess", + "ReplicaGroupId", + "Router", + "ThreadPool.Size", + "ThreadPool.SizeMax", + "ThreadPool.SizeWarn", + "ThreadPool.StackSize" + }; + + StringSeq propertySet; + PropertyDict props = _instance->initializationData().properties->getPropertiesForPrefix(prefix); + for(unsigned int i = 0; i < sizeof(suffixes)/sizeof(*suffixes); ++i) + { + if(props.find(prefix + suffixes[i]) != props.end()) + { + propertySet.push_back(prefix + suffixes[i]); + } + } + + return propertySet; +} + Ice::ObjectAdapterI::ProcessI::ProcessI(const CommunicatorPtr& communicator) : _communicator(communicator) { diff --git a/cpp/src/Ice/ObjectAdapterI.h b/cpp/src/Ice/ObjectAdapterI.h index e90416cadc0..c3f198d91b8 100644 --- a/cpp/src/Ice/ObjectAdapterI.h +++ b/cpp/src/Ice/ObjectAdapterI.h @@ -27,6 +27,7 @@ #include <Ice/ThreadPoolF.h> #include <Ice/Exception.h> #include <Ice/Process.h> +#include <Ice/BuiltinSequences.h> #include <list> namespace Ice @@ -96,6 +97,7 @@ private: static void checkIdentity(const Identity&); std::vector<IceInternal::EndpointIPtr> parseEndpoints(const std::string&) const; void updateLocatorRegistry(const IceInternal::LocatorInfoPtr&, const Ice::ObjectPrx&, bool); + Ice::StringSeq filterProperties(const std::string&); bool _deactivated; IceInternal::InstancePtr _instance; @@ -117,6 +119,8 @@ private: bool _waitForDeactivate; bool _noConfig; + static std::string _propertyPrefix; + class ProcessI : public Process { public: diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp index 2449070ce72..6e84d41e3a4 100644 --- a/cpp/src/Ice/PropertyNames.cpp +++ b/cpp/src/Ice/PropertyNames.cpp @@ -7,7 +7,7 @@ // // ********************************************************************** -// Generated by makeprops.py from file `./config/PropertyNames.def', Mon Dec 11 11:13:50 2006 +// Generated by makeprops.py from file `../config/PropertyNames.def', Mon Dec 18 13:40:21 2006 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -50,6 +50,17 @@ const char* IceInternal::PropertyNames::IceProps[] = "Ice.MonitorConnections", "Ice.Nohup", "Ice.NullHandleAbort", + "Ice.OA.*.AdapterId", + "Ice.OA.*.Endpoints", + "Ice.OA.*.Locator", + "Ice.OA.*.PublishedEndpoints", + "Ice.OA.*.RegisterProcess", + "Ice.OA.*.ReplicaGroupId", + "Ice.OA.*.Router", + "Ice.OA.*.ThreadPool.Size", + "Ice.OA.*.ThreadPool.SizeMax", + "Ice.OA.*.ThreadPool.SizeWarn", + "Ice.OA.*.ThreadPool.StackSize", "Ice.Override.Compress", "Ice.Override.ConnectTimeout", "Ice.Override.Timeout", @@ -253,8 +264,8 @@ const char* IceInternal::PropertyNames::IceSSLProps[] = "IceSSL.DefaultDir", "IceSSL.DH.*", "IceSSL.EntropyDaemon", - "IceSSL.FindCert.*.*", - "IceSSL.ImportCert.*.*", + "IceSSL.FindCert.*", + "IceSSL.ImportCert.*", "IceSSL.KeyFile", "IceSSL.Keystore", "IceSSL.KeystorePassword", @@ -396,11 +407,11 @@ const char* IceInternal::PropertyNames::FreezeProps[] = "Freeze.DbEnv.*.DbRecoverFatal", "Freeze.DbEnv.*.OldLogsAutoDelete", "Freeze.DbEnv.*.PeriodicCheckpointMinSize", - "Freeze.Evictor.*.*.MaxTxSize", - "Freeze.Evictor.*.*.SavePeriod", - "Freeze.Evictor.*.*.SaveSizeTrigger", - "Freeze.Evictor.*.*.StreamTimeout", - "Freeze.Evictor.*.*.PopulateEmptyIndices", + "Freeze.Evictor.*.MaxTxSize", + "Freeze.Evictor.*.SavePeriod", + "Freeze.Evictor.*.SaveSizeTrigger", + "Freeze.Evictor.*.StreamTimeout", + "Freeze.Evictor.*.PopulateEmptyIndices", "Freeze.Evictor.UseNonmutating", "Freeze.Trace.DbEnv", "Freeze.Trace.Evictor", diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h index 5df9ba17997..c1bdfae9cbc 100644 --- a/cpp/src/Ice/PropertyNames.h +++ b/cpp/src/Ice/PropertyNames.h @@ -7,7 +7,7 @@ // // ********************************************************************** -// Generated by makeprops.py from file `./config/PropertyNames.def', Mon Dec 11 11:13:50 2006 +// Generated by makeprops.py from file `../config/PropertyNames.def', Mon Dec 18 13:40:21 2006 // IMPORTANT: Do not edit this file -- any edits made here will be lost! diff --git a/cpp/src/IceBox/Admin.cpp b/cpp/src/IceBox/Admin.cpp index ce9855b64d3..4ca832c154d 100644 --- a/cpp/src/IceBox/Admin.cpp +++ b/cpp/src/IceBox/Admin.cpp @@ -92,10 +92,15 @@ Client::run(int argc, char* argv[]) string managerProxy; if(properties->getProperty("Ice.Default.Locator").empty()) { - string managerEndpoints = properties->getProperty("IceBox.ServiceManager.Endpoints"); + // + // DEPRECATED PROPERTY: Remove extra code in future release. + // + string managerEndpoints = + properties->getPropertyWithDefault("Ice.OA.IceBox.ServiceManager.Endpoints", + properties->getProperty("IceBox.ServiceManager.Endpoints")); if(managerEndpoints.empty()) { - cerr << appName() << ": property `IceBox.ServiceManager.Endpoints' is not set" << endl; + cerr << appName() << ": property `Ice.OA.IceBox.ServiceManager.Endpoints' is not set" << endl; return EXIT_FAILURE; } @@ -103,10 +108,15 @@ Client::run(int argc, char* argv[]) } else { - string managerAdapterId = properties->getProperty("IceBox.ServiceManager.AdapterId"); + // + // DEPRECATED PROPERTY: Remove extra code in future release. + // + string managerAdapterId = + properties->getPropertyWithDefault("Ice.OA.IceBox.ServiceManager.AdapterId", + properties->getProperty("IceBox.ServiceManager.AdapterId")); if(managerAdapterId.empty()) { - cerr << appName() << ": property `IceBox.ServiceManager.AdapterId' is not set" << endl; + cerr << appName() << ": property `Ice.OA.IceBox.ServiceManager.AdapterId' is not set" << endl; return EXIT_FAILURE; } diff --git a/cpp/src/IceGrid/DescriptorBuilder.cpp b/cpp/src/IceGrid/DescriptorBuilder.cpp index 611966a6672..f99092e1062 100644 --- a/cpp/src/IceGrid/DescriptorBuilder.cpp +++ b/cpp/src/IceGrid/DescriptorBuilder.cpp @@ -681,6 +681,10 @@ CommunicatorDescriptorBuilder::addAdapter(const XmlAttributesHelper& attrs) desc.serverLifetime = attrs.asBool("server-lifetime", true); _descriptor->adapters.push_back(desc); + // + // DEPRECATED PROPERTY: Remove extra code in future release. + // + addProperty(_hiddenProperties, "Ice.OA." + desc.name + ".Endpoints", attrs("endpoints", "default")); addProperty(_hiddenProperties, desc.name + ".Endpoints", attrs("endpoints", "default")); } @@ -904,8 +908,13 @@ IceBoxDescriptorBuilder::init(const IceBoxDescriptorPtr& desc, const XmlAttribut ServerDescriptorBuilder::init(desc, attrs); _descriptor = desc; + // + // DEPRECATED PROPERTY: Remove extra code in future release. + // addProperty(_hiddenProperties, "IceBox.InstanceName", "${server}"); + addProperty(_hiddenProperties, "Ice.OA.IceBox.ServiceManager.Endpoints", "tcp -h 127.0.0.1"); addProperty(_hiddenProperties, "IceBox.ServiceManager.Endpoints", "tcp -h 127.0.0.1"); + addProperty(_hiddenProperties, "Ice.OA.IceBox.ServiceManager.RegisterProcess", "1"); addProperty(_hiddenProperties, "IceBox.ServiceManager.RegisterProcess", "1"); } @@ -932,7 +941,13 @@ IceBoxDescriptorBuilder::addAdapter(const XmlAttributesHelper& attrs) PropertyDescriptorSeq::iterator p = _hiddenProperties.begin(); while(p != _hiddenProperties.end()) { - if(p->name == "IceBox.ServiceManager.Endpoints" || p->name == "IceBox.ServiceManager.RegisterProcess") + // + // DEPRECATED PROPERTY: Remove extra code in future release + // + if(p->name == "Ice.OA.IceBox.ServiceManager.Endpoints" || + p->name == "IceBox.ServiceManager.Endpoints" || + p->name == "Ice.OA.IceBox.ServiceManager.RegisterProcess" || + p->name == "IceBox.ServiceManager.RegisterProcess") { p = _hiddenProperties.erase(p); } diff --git a/cpp/src/IceGrid/DescriptorHelper.cpp b/cpp/src/IceGrid/DescriptorHelper.cpp index 68138d8a469..dcc2c00ce76 100644 --- a/cpp/src/IceGrid/DescriptorHelper.cpp +++ b/cpp/src/IceGrid/DescriptorHelper.cpp @@ -962,8 +962,10 @@ CommunicatorHelper::instantiateImpl(const CommunicatorDescriptorPtr& instance, c // // Make sure the endpoints are defined. // - string endpoints = IceGrid::getProperty(instance->propertySet.properties, adapter.name + ".Endpoints"); - if(endpoints.empty()) + // DEPRECATED PROPERY: Remove extra code in future release. + // + if(IceGrid::getProperty(instance->propertySet.properties, "Ice.OA." + adapter.name + ".Endpoints").empty() && + IceGrid::getProperty(instance->propertySet.properties, adapter.name + ".Endpoints").empty()) { resolve.exception("invalid endpoints for adapter `" + adapter.name + "': empty string"); } @@ -1065,7 +1067,14 @@ CommunicatorHelper::printObjectAdapter(Output& out, const AdapterDescriptor& ada { out << nl << "priority = `" << adapter.priority << "'"; } - string endpoints = getProperty(adapter.name + ".Endpoints"); + // + // DEPRECATED PROPERTY: Remove extra code in future release. + // + string endpoints = getProperty("Ice.OA." + adapter.name + ".Endpoints"); + if(endpoints.empty()) + { + endpoints = getProperty(adapter.name + ".Endpoints"); + } if(!endpoints.empty()) { out << nl << "endpoints = `" << endpoints << "'"; @@ -1485,7 +1494,15 @@ IceBoxHelper::print(Output& out, const ServerInfo& info) const { out << "icebox `" + _desc->id + "'"; out << sb; - out << nl << "service manager endpoints = `" << getProperty("IceBox.ServiceManager.Endpoints") << "'"; + // + // DEPRECATED PROPERTY: Remove extra code in future release. + // + string endpoints = getProperty("Ice.OA.IceBox.ServiceManager.Endpoints"); + if(endpoints.empty()) + { + endpoints = getProperty("IceBox.ServiceManager.Endpoints"); + } + out << nl << "service manager endpoints = `" << endpoints << "'"; printImpl(out, info); for(vector<ServiceInstanceHelper>::const_iterator p = _services.begin(); p != _services.end(); ++p) { diff --git a/cpp/src/IceGrid/IceGridNode.cpp b/cpp/src/IceGrid/IceGridNode.cpp index c23e68edc10..b90bdf0c210 100644 --- a/cpp/src/IceGrid/IceGridNode.cpp +++ b/cpp/src/IceGrid/IceGridNode.cpp @@ -227,13 +227,22 @@ NodeService::start(int argc, char* argv[]) out << "you should set individual adapter thread pools instead."; } - int size = properties->getPropertyAsIntWithDefault("IceGrid.Node.ThreadPool.Size", 0); + // + // DEPRECATED PROPERTY: Remove extra code in future release + // + int size = properties->getPropertyAsIntWithDefault("Ice.OA.IceGrid.Node.ThreadPool.Size", + properties->getPropertyAsIntWithDefault("IceGrid.Node.ThreadPool.Size", 0)); if(size <= 0) { - properties->setProperty("IceGrid.Node.ThreadPool.Size", "1"); + properties->setProperty("Ice.OA.IceGrid.Node.ThreadPool.Size", "1"); size = 1; } - int sizeMax = properties->getPropertyAsIntWithDefault("IceGrid.Node.ThreadPool.SizeMax", 0); + + // + // DEPRECATED PROPERTY: Remove extra code in future release + // + int sizeMax = properties->getPropertyAsIntWithDefault("Ice.OA.IceGrid.Node.ThreadPool.SizeMax", + properties->getPropertyAsIntWithDefault("IceGrid.Node.ThreadPool.SizeMax", 0)); if(sizeMax <= 0) { if(size >= sizeMax) @@ -243,7 +252,7 @@ NodeService::start(int argc, char* argv[]) ostringstream os; os << sizeMax; - properties->setProperty("IceGrid.Node.ThreadPool.SizeMax", os.str()); + properties->setProperty("Ice.OA.IceGrid.Node.ThreadPool.SizeMax", os.str()); } size = properties->getPropertyAsIntWithDefault("Ice.ThreadPool.Client.Size", 0); @@ -296,8 +305,13 @@ NodeService::start(int argc, char* argv[]) Identity locatorId; locatorId.category = properties->getPropertyWithDefault("IceGrid.InstanceName", "IceGrid"); locatorId.name = "Locator"; - string locatorPrx = "\"" + communicator()->identityToString(locatorId) + "\" :" + - properties->getProperty("IceGrid.Registry.Client.Endpoints"); + // + // DEPRECATED PROPERTY: Remove extra code in future release + // + string endpoints = + properties->getPropertyWithDefault("Ice.OA.IceGrid.Registry.Client.Endpoints", + properties->getProperty("IceGrid.Registry.Client.Endpoints")); + string locatorPrx = "\"" + communicator()->identityToString(locatorId) + "\" :" + endpoints; communicator()->setDefaultLocator(LocatorPrx::uncheckedCast(communicator()->stringToProxy(locatorPrx))); properties->setProperty("Ice.Default.Locator", locatorPrx); } @@ -362,9 +376,12 @@ NodeService::start(int argc, char* argv[]) // // Check that required properties are set and valid. // - if(properties->getProperty("IceGrid.Node.Endpoints").empty()) + // DEPRECATED PROPERTY: Remove extra code in future release + // + if(properties->getProperty("Ice.OA.IceGrid.Node.Endpoints").empty() && + properties->getProperty("IceGrid.Node.Endpoints").empty()) { - error("property `IceGrid.Node.Endpoints' is not set"); + error("property `Ice.OA.IceGrid.Node.Endpoints' is not set"); return false; } @@ -384,7 +401,11 @@ NodeService::start(int argc, char* argv[]) // // Create the node object adapter. // - properties->setProperty("IceGrid.Node.RegisterProcess", "0"); + // DEPRECATED PROPERTIES: Remove extra code in future release. + // + properties->setProperty("Ice.OA.IceGrid.Node.RegisterProcess", "0"); + properties->setProperty("IceGrid.Node.RegisterProcess", ""); + properties->setProperty("Ice.OA.IceGrid.Node.AdapterId", ""); properties->setProperty("IceGrid.Node.AdapterId", ""); _adapter = communicator()->createObjectAdapter("IceGrid.Node"); diff --git a/cpp/src/IceGrid/PlatformInfo.cpp b/cpp/src/IceGrid/PlatformInfo.cpp index c5fc269efc6..188d5d68910 100644 --- a/cpp/src/IceGrid/PlatformInfo.cpp +++ b/cpp/src/IceGrid/PlatformInfo.cpp @@ -175,20 +175,46 @@ PlatformInfo::PlatformInfo(const string& prefix, _machine = utsinfo.machine; #endif + // + // DEPRECATED PROPERTIES: Remove extra code in future release. + // Ice::PropertiesPtr properties = communicator->getProperties(); + string endpointsPrefix; + string oldEndpointsPrefix; if(prefix == "IceGrid.Registry") { _name = properties->getPropertyWithDefault("IceGrid.Registry.ReplicaName", "Master"); - const string endpointsPrefix = prefix + ".Client"; - _endpoints = properties->getPropertyWithDefault( - endpointsPrefix + ".PublishedEndpoints", properties->getProperty(endpointsPrefix + ".Endpoints")); + endpointsPrefix = "Ice.OA." + prefix + ".Client"; + oldEndpointsPrefix = prefix + ".Client"; } else { _name = properties->getProperty(prefix + ".Name"); - _endpoints = properties->getPropertyWithDefault( - prefix + ".PublishedEndpoints", properties->getProperty(prefix + ".Endpoints")); + endpointsPrefix = prefix; + oldEndpointsPrefix = prefix; + } + + Ice::PropertyDict props = properties->getPropertiesForPrefix(endpointsPrefix); + Ice::PropertyDict::const_iterator p = props.find(endpointsPrefix + ".PublishedEndpoints"); + if(p != props.end()) + { + _endpoints = p->second; } + else + { + Ice::PropertyDict oldProps = properties->getPropertiesForPrefix(oldEndpointsPrefix); + p = props.find(oldEndpointsPrefix + ".PublishedEndpoints"); + if(p != props.end()) + { + _endpoints = p->second; + } + else + { + _endpoints = properties->getPropertyWithDefault( + endpointsPrefix + ".Endpoints", properties->getProperty(oldEndpointsPrefix + ".Endpoints")); + } + } + _dataDir = properties->getProperty(prefix + ".Data"); if(!IcePatch2::isAbsolute(_dataDir)) { diff --git a/cpp/src/IceGrid/RegistryI.cpp b/cpp/src/IceGrid/RegistryI.cpp index dc4b09ce6e8..cc07c398ee2 100644 --- a/cpp/src/IceGrid/RegistryI.cpp +++ b/cpp/src/IceGrid/RegistryI.cpp @@ -160,48 +160,63 @@ RegistryI::start(bool nowarn) // // Check that required properties are set and valid. // - if(properties->getProperty("IceGrid.Registry.Client.Endpoints").empty()) + // DEPRECATED PROPERTY: Remove extra code in future release + // + if(properties->getProperty("Ice.OA.IceGrid.Registry.Client.Endpoints").empty() && + properties->getProperty("IceGrid.Registry.Client.Endpoints").empty()) { Error out(_communicator->getLogger()); - out << "property `IceGrid.Registry.Client.Endpoints' is not set"; + out << "property `Ice.OA.IceGrid.Registry.Client.Endpoints' is not set"; return false; } - if(properties->getProperty("IceGrid.Registry.Server.Endpoints").empty()) + // + // DEPRECATED PROPERTY: Remove extra code in future release + // + if(properties->getProperty("Ice.OA.IceGrid.Registry.Server.Endpoints").empty() && + properties->getProperty("IceGrid.Registry.Server.Endpoints").empty()) { Error out(_communicator->getLogger()); - out << "property `IceGrid.Registry.Server.Endpoints' is not set"; + out << "property `Ice.OA.IceGrid.Registry.Server.Endpoints' is not set"; return false; } - if(properties->getProperty("IceGrid.Registry.Internal.Endpoints").empty()) + // + // DEPRECATED PROPERTY: Remove extra code in future release + // + if(properties->getProperty("Ice.OA.IceGrid.Registry.Internal.Endpoints").empty() && + properties->getProperty("IceGrid.Registry.Internal.Endpoints").empty()) { Error out(_communicator->getLogger()); - out << "property `IceGrid.Registry.Internal.Endpoints' is not set"; + out << "property `Ice.OA.IceGrid.Registry.Internal.Endpoints' is not set"; return false; } - if(!properties->getProperty("IceGrid.Registry.SessionManager.Endpoints").empty()) + // + // DEPRECATED PROPERTY: Remove extra code in future release + // + if(!properties->getProperty("Ice.OA.IceGrid.Registry.SessionManager.Endpoints").empty() || + !properties->getProperty("IceGrid.Registry.SessionManager.Endpoints").empty()) { if(!nowarn) { Warning out(_communicator->getLogger()); - out << "session manager endpoints `IceGrid.Registry.SessionManager.Endpoints' enabled"; + out << "session manager endpoints `Ice.OA.IceGrid.Registry.SessionManager.Endpoints' enabled"; } } properties->setProperty("Ice.PrintProcessId", "0"); properties->setProperty("Ice.ServerIdleTime", "0"); - properties->setProperty("IceGrid.Registry.Client.AdapterId", ""); - properties->setProperty("IceGrid.Registry.Server.AdapterId", ""); - properties->setProperty("IceGrid.Registry.SessionManager.AdapterId", ""); - properties->setProperty("IceGrid.Registry.Internal.AdapterId", ""); + properties->setProperty("Ice.OA.IceGrid.Registry.Client.AdapterId", ""); + properties->setProperty("Ice.OA.IceGrid.Registry.Server.AdapterId", ""); + properties->setProperty("Ice.OA.IceGrid.Registry.SessionManager.AdapterId", ""); + properties->setProperty("Ice.OA.IceGrid.Registry.Internal.AdapterId", ""); setupThreadPool(properties, "Ice.ThreadPool.Client", 1, 100); - setupThreadPool(properties, "IceGrid.Registry.Client.ThreadPool", 1, 10); - setupThreadPool(properties, "IceGrid.Registry.Server.ThreadPool", 1, 10); - setupThreadPool(properties, "IceGrid.Registry.SessionManager.ThreadPool", 1, 10); - setupThreadPool(properties, "IceGrid.Registry.Internal.ThreadPool", 1, 100); + setupThreadPool(properties, "Ice.OA.IceGrid.Registry.Client.ThreadPool", 1, 10); + setupThreadPool(properties, "Ice.OA.IceGrid.Registry.Server.ThreadPool", 1, 10); + setupThreadPool(properties, "Ice.OA.IceGrid.Registry.SessionManager.ThreadPool", 1, 10); + setupThreadPool(properties, "Ice.OA.IceGrid.Registry.Internal.ThreadPool", 1, 100); _replicaName = properties->getPropertyWithDefault("IceGrid.Registry.ReplicaName", "Master"); _master = _replicaName == "Master"; @@ -244,12 +259,18 @@ RegistryI::start(bool nowarn) // try { - string strPrx = _instanceName + "/Locator:" + properties->getProperty("IceGrid.Registry.Client.Endpoints"); + // + // DEPRECATED PROPERTY: Remove extra code in future release + // + string endpoints = + properties->getPropertyWithDefault("Ice.OA.IceGrid.Registry.Client.Endpoints", + properties->getProperty("IceGrid.Registry.Client.Endpoints")); + string strPrx = _instanceName + "/Locator:" + endpoints; _communicator->stringToProxy(strPrx)->ice_timeout(5000)->ice_ping(); Error out(_communicator->getLogger()); out << "an IceGrid registry is already running and listening on\n"; - out << "the client endpoints `" << properties->getProperty("IceGrid.Registry.Client.Endpoints") << "'"; + out << "the client endpoints `" << endpoints << "'"; return false; } catch(const Ice::LocalException&) @@ -333,7 +354,11 @@ RegistryI::start(bool nowarn) ObjectAdapterPtr serverAdapter = _communicator->createObjectAdapter("IceGrid.Registry.Server"); _clientAdapter = _communicator->createObjectAdapter("IceGrid.Registry.Client"); ObjectAdapterPtr sessionManagerAdapter; - if(!properties->getProperty("IceGrid.Registry.SessionManager.Endpoints").empty()) + // + // DEPRECATED PROPERTY: Remove extra code in future release + // + if(!properties->getProperty("Ice.OA.IceGrid.Registry.SessionManager.Endpoints").empty() || + !properties->getProperty("IceGrid.Registry.SessionManager.Endpoints").empty()) { sessionManagerAdapter = _communicator->createObjectAdapter("IceGrid.Registry.SessionManager"); } diff --git a/cpp/src/IceGrid/ServerI.cpp b/cpp/src/IceGrid/ServerI.cpp index 51ecb0013b1..2ed1d397e65 100644 --- a/cpp/src/IceGrid/ServerI.cpp +++ b/cpp/src/IceGrid/ServerI.cpp @@ -2534,17 +2534,23 @@ ServerI::updateConfigFile(const string& serverDir, const CommunicatorDescriptorP { if(!q->id.empty() || q->registerProcess) { + // + // DEPREACTED PROPERTIES: Removed extra code in future release + // props.push_back(createProperty("# Object adapter " + q->name)); if(!q->id.empty()) { + props.push_back(createProperty("Ice.OA." + q->name + ".AdapterId", q->id)); props.push_back(createProperty(q->name + ".AdapterId", q->id)); if(!q->replicaGroupId.empty()) { + props.push_back(createProperty("Ice.OA." + q->name + ".ReplicaGroupId", q->replicaGroupId)); props.push_back(createProperty(q->name + ".ReplicaGroupId", q->replicaGroupId)); } } if(q->registerProcess) { + props.push_back(createProperty("Ice.OA." + q->name + ".RegisterProcess", "1")); props.push_back(createProperty(q->name + ".RegisterProcess", "1")); } } diff --git a/cpp/src/IcePatch2/ClientUtil.cpp b/cpp/src/IcePatch2/ClientUtil.cpp index 6c2d9f60673..ba6bb4c1e6a 100755 --- a/cpp/src/IcePatch2/ClientUtil.cpp +++ b/cpp/src/IcePatch2/ClientUtil.cpp @@ -156,11 +156,12 @@ IcePatch2::Patcher::Patcher(const CommunicatorPtr& communicator, const PatcherFe { PropertiesPtr properties = communicator->getProperties(); - const char* endpointsProperty = "IcePatch2.Endpoints"; - const string endpoints = properties->getProperty(endpointsProperty); + const char* endpointsProperty = "Ice.OA.IcePatch2.Endpoints"; + string endpoints = properties->getPropertyWithDefault(endpointsProperty, + properties->getProperty("IcePatch2.Endpoints")); if(endpoints.empty()) { - throw string("property `") + endpointsProperty + "' is not set"; + throw string("property `") + endpointsProperty + "' is not set"; } Identity id; diff --git a/cpp/src/IcePatch2/Server.cpp b/cpp/src/IcePatch2/Server.cpp index ed1e102c400..e285545c049 100644 --- a/cpp/src/IcePatch2/Server.cpp +++ b/cpp/src/IcePatch2/Server.cpp @@ -141,17 +141,25 @@ IcePatch2::PatcherService::start(int argc, char* argv[]) return false; } - const string endpointsProperty = "IcePatch2.Endpoints"; - if(properties->getProperty(endpointsProperty).empty()) + // + // DEPRECATED PROPERTY: Remove extra code in future release + // + const string endpointsProperty = "Ice.OA.IcePatch2.Endpoints"; + string endpoints = properties->getPropertyWithDefault(endpointsProperty, + properties->getProperty("IcePatch2.Endpoints")); + if(endpoints.empty()) { - error("property `" + endpointsProperty + "' is not set"); - return false; + error("property `" + endpointsProperty + "' is not set"); + return false; } ObjectAdapterPtr adapter = communicator()->createObjectAdapter("IcePatch2"); - const string adminEndpointsProperty = "IcePatch2.Admin.Endpoints"; + // + // DEPRECATED PROPERTY: Remove extra code in future release + // ObjectAdapterPtr adminAdapter; - if(!properties->getProperty(adminEndpointsProperty).empty()) + if(!properties->getProperty("Ice.OA.IcePatch2.Admin.Endpoints").empty() || + !properties->getProperty("IcePatch2.Admin.Endpoints").empty()) { adminAdapter = communicator()->createObjectAdapter("IcePatch2.Admin"); } diff --git a/cpp/src/IceUtil/StringUtil.cpp b/cpp/src/IceUtil/StringUtil.cpp index 2f1fa474dda..1b90f0ad3e8 100644 --- a/cpp/src/IceUtil/StringUtil.cpp +++ b/cpp/src/IceUtil/StringUtil.cpp @@ -337,51 +337,50 @@ IceUtil::checkQuote(const string& s, string::size_type start) // // Match `s' against the pattern `pat'. A * in the pattern acts -// as a wildcard: it matches any non-empty sequence of characters -// other than a period (`.'). We match by hand here because -// it's portable across platforms (whereas regex() isn't). +// as a wildcard: it matches any non-empty sequence of characters. +// We match by hand here because it's portable across platforms +// (whereas regex() isn't). Only one * per pattern is supported. // bool -IceUtil::match(const string& s, const string& pat, bool matchPeriod) +IceUtil::match(const string& s, const string& pat, bool emptyMatch) { assert(!s.empty()); assert(!pat.empty()); - if(pat.find('*') == string::npos) + // + // If pattern does not contain a wildcard just compare strings. + // + string::size_type beginIndex = pat.find('*'); + if(beginIndex == string::npos) { return s == pat; } - string::size_type sIndex = 0; - string::size_type patIndex = 0; - do + // + // Make sure start of the strings match + // + if(s.substr(0, beginIndex) != pat.substr(0, beginIndex)) { - if(pat[patIndex] == '*') - { - // - // Don't allow matching x..y against x.*.y if requested -- star matches non-empty sequence only. - // - if(!matchPeriod && s[sIndex] == '.') - { - return false; - } - while(sIndex < s.size() && (matchPeriod || s[sIndex] != '.')) - { - ++sIndex; - } - patIndex++; - } - else - { - if(pat[patIndex] != s[sIndex]) - { - return false; - } - ++sIndex; - ++patIndex; - } + return false; + } + + // + // Make sure there is something present in the middle to match the + // wildcard. If emptyMatch is true, allow a match of "". + // + string::size_type endIndex = s.length() - (pat.length() - beginIndex - 1); + if(endIndex < beginIndex || (!emptyMatch && endIndex == beginIndex)) + { + return false; + } + + // + // Make sure end of the strings match + // + if(s.substr(endIndex, s.length()) != pat.substr(beginIndex + 1, pat.length())) + { + return false; } - while(sIndex < s.size() && patIndex < pat.size()); - return sIndex == s.size() && patIndex == pat.size(); + return true; } |