diff options
author | Benoit Foucher <benoit@zeroc.com> | 2007-12-06 12:17:44 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2007-12-06 12:17:44 +0100 |
commit | 86a110227d6113cebae014240cd51913de11d9ef (patch) | |
tree | ef707d21f3c63fdd441b7bf07e758df45e47ab93 /cpp/src | |
parent | Fixed build, application.xml, bug in IceGrid GUI (diff) | |
download | ice-86a110227d6113cebae014240cd51913de11d9ef.tar.bz2 ice-86a110227d6113cebae014240cd51913de11d9ef.tar.xz ice-86a110227d6113cebae014240cd51913de11d9ef.zip |
Fixed bug 2583
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/IceGrid/DescriptorHelper.cpp | 63 | ||||
-rw-r--r-- | cpp/src/IceGrid/DescriptorHelper.h | 4 | ||||
-rw-r--r-- | cpp/src/IceGrid/NodeCache.cpp | 31 |
3 files changed, 65 insertions, 33 deletions
diff --git a/cpp/src/IceGrid/DescriptorHelper.cpp b/cpp/src/IceGrid/DescriptorHelper.cpp index 06fda723c11..a86c708440b 100644 --- a/cpp/src/IceGrid/DescriptorHelper.cpp +++ b/cpp/src/IceGrid/DescriptorHelper.cpp @@ -260,7 +260,8 @@ Resolver::Resolver(const ApplicationDescriptor& app, const Ice::CommunicatorPtr& _enableWarning(enableWarning), _context("application `" + app.name + "'"), _variables(app.variables), - _reserved(getReserved()) + _reserved(getReserved()), + _version(0) { // // Make sure the variables don't override reserved variables. @@ -347,7 +348,8 @@ Resolver::Resolver(const Resolver& resolve, _parameters(!params ? resolve._parameters : values), _propertySets(resolve._propertySets), _reserved(resolve._reserved), - _ignore(resolve._ignore) + _ignore(resolve._ignore), + _version(resolve._version) { if(params) { @@ -374,7 +376,8 @@ Resolver::Resolver(const InternalNodeInfoPtr& info, const Ice::CommunicatorPtr& _escape(true), _enableWarning(false), _context("node `" + info->name + "'"), - _reserved(getReserved()) + _reserved(getReserved()), + _version(0) { setReserved("node", info->name); setReserved("node.os", info->os); @@ -397,11 +400,11 @@ Resolver::operator()(const string& value, const string& name, bool allowEmpty) c } catch(const string& reason) { - throw "invalid variable `" + value + "': " + reason; + throw "invalid variable `" + value + "':\n " + reason; } catch(const char* reason) { - throw "invalid variable `" + value + "': " + reason; + throw "invalid variable `" + value + "':\n " + reason; } if(!allowEmpty) @@ -672,6 +675,32 @@ Resolver::addIgnored(const string& name) } void +Resolver::setVersion(const string& version) +{ + string v = operator()(version, "ice version"); + if(!v.empty()) + { + _version = getMMVersion(v); + if(_version < 0) + { + exception("invalid ice version: " + v); + } + else if(_version > ICE_INT_VERSION && warningEnabled()) + { + Ice::Warning out(_communicator->getLogger()); + out << "invalid ice version: " << _version << " is superior to the IceGrid "; + out << "registry version (" << ICE_STRING_VERSION << ")"; + } + } +} + +int +Resolver::getVersion() const +{ + return _version; +} + +void Resolver::exception(const string& reason) const { throw DeploymentException(_context + ":\n" + reason); @@ -1464,28 +1493,7 @@ ServerHelper::instantiateImpl(const ServerDescriptorPtr& instance, instance->id = resolve.asId(_desc->id, "id", false); instance->exe = resolve(_desc->exe, "executable", false); - instance->iceVersion = resolve(_desc->iceVersion, "ice version"); - if(!instance->iceVersion.empty()) - { - int version = getMMVersion(instance->iceVersion); - if(version < 0) - { - resolve.exception("invalid ice version: " + instance->iceVersion); - } - else if(version > ICE_INT_VERSION) - { - //resolve.exception("invalid ice version: " + instance->iceVersion + " is superior to the IceGrid \n" - //"registry version (" + ICE_STRING_VERSION + ")"); - if(resolve.warningEnabled()) - { - Ice::Warning out(resolve.getCommunicator()->getLogger()); - out << "invalid ice version: " << instance->iceVersion << " is superior to the IceGrid "; - out << "registry version (" << ICE_STRING_VERSION << ")"; - } - } - } - instance->pwd = resolve(_desc->pwd, "working directory path"); instance->activation = resolve(_desc->activation, "activation"); instance->applicationDistrib = _desc->applicationDistrib; @@ -1841,8 +1849,9 @@ ServerInstanceHelper::init(const ServerDescriptorPtr& definition, const Resolver // Setup the resolver. // Resolver svrResolve(resolve, parameterValues, true); - svrResolve.setReserved("server", svrResolve(def->id, "server id", false)); + svrResolve.setReserved("server", svrResolve.asId(def->id, "server id", false)); svrResolve.setContext("server `${server}'"); + svrResolve.setVersion(def->iceVersion); _id = svrResolve("${server}"); // diff --git a/cpp/src/IceGrid/DescriptorHelper.h b/cpp/src/IceGrid/DescriptorHelper.h index f16d50afb71..8b52a71b922 100644 --- a/cpp/src/IceGrid/DescriptorHelper.h +++ b/cpp/src/IceGrid/DescriptorHelper.h @@ -48,6 +48,9 @@ public: PropertyDescriptorSeq getProperties(const Ice::StringSeq&) const; void addIgnored(const std::string&); + void setVersion(const std::string&); + int getVersion() const; + void exception(const std::string&) const; TemplateDescriptor getServerTemplate(const std::string&) const; @@ -76,6 +79,7 @@ private: PropertySetDescriptorDict _propertySets; std::map<std::string, std::string> _reserved; std::set<std::string> _ignore; + int _version; }; class CommunicatorHelper diff --git a/cpp/src/IceGrid/NodeCache.cpp b/cpp/src/IceGrid/NodeCache.cpp index 2f5762dccfc..766a313e450 100644 --- a/cpp/src/IceGrid/NodeCache.cpp +++ b/cpp/src/IceGrid/NodeCache.cpp @@ -28,9 +28,11 @@ namespace IceGrid struct ToInternalServerDescriptor : std::unary_function<CommunicatorDescriptorPtr&, void> { - ToInternalServerDescriptor(const InternalServerDescriptorPtr& descriptor, const InternalNodeInfoPtr& node) : + ToInternalServerDescriptor(const InternalServerDescriptorPtr& descriptor, const InternalNodeInfoPtr& node, + int iceVersion) : _desc(descriptor), - _node(node) + _node(node), + _iceVersion(iceVersion) { } @@ -48,16 +50,33 @@ struct ToInternalServerDescriptor : std::unary_function<CommunicatorDescriptorPt { filename += "_" + svc->name; } - PropertyDescriptorSeq& props = _desc->properties[filename]; + PropertyDescriptorSeq& props = _desc->properties[filename]; PropertyDescriptorSeq communicatorProps = desc->propertySet.properties; // + // If this is a service communicator and the IceBox server has admin + // endpoints configured, we ignore the server-lifetime attributes of + // the service object adapters and assume it's set to false. + // + bool ignoreServerLifetime = false; + if(svc) + { + if(_iceVersion == 0 || _iceVersion >= 30300) + { + if(getProperty(_desc->properties["config"], "Ice.Admin.Endpoints") != "") + { + ignoreServerLifetime = true; + } + } + } + // // Add the adapters and their configuration. // for(AdapterDescriptorSeq::const_iterator q = desc->adapters.begin(); q != desc->adapters.end(); ++q) { - _desc->adapters.push_back(new InternalAdapterDescriptor(q->id, q->serverLifetime)); + _desc->adapters.push_back(new InternalAdapterDescriptor(q->id, + ignoreServerLifetime ? false : q->serverLifetime)); props.push_back(createProperty("# Object adapter " + q->name)); PropertyDescriptor prop = removeProperty(communicatorProps, q->name + ".Endpoints"); @@ -134,6 +153,7 @@ struct ToInternalServerDescriptor : std::unary_function<CommunicatorDescriptorPt InternalServerDescriptorPtr _desc; InternalNodeInfoPtr _node; + int _iceVersion; }; class LoadCB : public AMI_Node_loadServer @@ -899,7 +919,6 @@ NodeEntry::getInternalServerDescriptor(const ServerInfo& info) const } props.push_back(createProperty("IceBox.LoadOrder", servicesStr)); - if(iceVersion != 0 && iceVersion < 30300) { if(isSet(iceBox->propertySet.properties, "IceBox.ServiceManager.RegisterProcess")) @@ -926,7 +945,7 @@ NodeEntry::getInternalServerDescriptor(const ServerInfo& info) const // logs, adapters, db envs and properties to the internal server // descriptor. // - forEachCommunicator(ToInternalServerDescriptor(server, _session->getInfo()))(info.descriptor); + forEachCommunicator(ToInternalServerDescriptor(server, _session->getInfo(), iceVersion))(info.descriptor); return server; } |