diff options
author | Benoit Foucher <benoit@zeroc.com> | 2005-06-02 15:34:46 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2005-06-02 15:34:46 +0000 |
commit | 2fa5eeac950a312d83b1d3bb7510d4e17f6777ff (patch) | |
tree | 58588af8967f527433f4c7a7ba5c1112c33b3fcd /cpp/src | |
parent | minor fix (diff) | |
download | ice-2fa5eeac950a312d83b1d3bb7510d4e17f6777ff.tar.bz2 ice-2fa5eeac950a312d83b1d3bb7510d4e17f6777ff.tar.xz ice-2fa5eeac950a312d83b1d3bb7510d4e17f6777ff.zip |
Added support for targets attribute of the application, server and service
descriptors Ported IcePack fixes (configurable identities).
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/PropertyNames.cpp | 9 | ||||
-rw-r--r-- | cpp/src/Ice/PropertyNames.h | 2 | ||||
-rw-r--r-- | cpp/src/IceGrid/AdminI.cpp | 111 | ||||
-rw-r--r-- | cpp/src/IceGrid/AdminI.h | 4 | ||||
-rw-r--r-- | cpp/src/IceGrid/DescriptorHelper.cpp | 30 | ||||
-rw-r--r-- | cpp/src/IceGrid/DescriptorHelper.h | 2 | ||||
-rw-r--r-- | cpp/src/IceGrid/Grammar.y | 12 | ||||
-rw-r--r-- | cpp/src/IceGrid/IceGridNode.cpp | 4 | ||||
-rw-r--r-- | cpp/src/IceGrid/Parser.cpp | 134 | ||||
-rw-r--r-- | cpp/src/IceGrid/Parser.h | 3 | ||||
-rw-r--r-- | cpp/src/IceGrid/RegistryI.cpp | 20 |
11 files changed, 56 insertions, 275 deletions
diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp index 981b9b90aec..3067ceab9ed 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', Thu Jun 2 12:34:35 2005 +// Generated by makeprops.py from file `../config/PropertyNames.def', Thu Jun 2 17:48:18 2005 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -111,7 +111,6 @@ const char* IceInternal::PropertyNames::IcePackProps[] = "IcePack.Node.Trace.Server", "IcePack.Node.WaitTime", "IcePack.Node.BackgroundRegistration", - "IcePack.Registry.AdminIdentity", "IcePack.Registry.Admin.AdapterId", "IcePack.Registry.Admin.Endpoints", "IcePack.Registry.Admin.PublishedEndpoints", @@ -119,6 +118,7 @@ const char* IceInternal::PropertyNames::IcePackProps[] = "IcePack.Registry.Admin.ThreadPool.SizeMax", "IcePack.Registry.Admin.ThreadPool.SizeWarn", "IcePack.Registry.Admin.ThreadPool.StackSize", + "IcePack.Registry.AdminIdentity", "IcePack.Registry.Client.AdapterId", "IcePack.Registry.Client.Endpoints", "IcePack.Registry.Client.PublishedEndpoints", @@ -136,6 +136,7 @@ const char* IceInternal::PropertyNames::IcePackProps[] = "IcePack.Registry.Internal.ThreadPool.SizeWarn", "IcePack.Registry.Internal.ThreadPool.StackSize", "IcePack.Registry.LocatorIdentity", + "IcePack.Registry.QueryIdentity", "IcePack.Registry.Server.AdapterId", "IcePack.Registry.Server.Endpoints", "IcePack.Registry.Server.PublishedEndpoints", @@ -147,7 +148,6 @@ const char* IceInternal::PropertyNames::IcePackProps[] = "IcePack.Registry.Trace.NodeRegistry", "IcePack.Registry.Trace.ObjectRegistry", "IcePack.Registry.Trace.ServerRegistry", - "IcePack.Registry.QueryIdentity", 0 }; @@ -179,6 +179,7 @@ const char* IceInternal::PropertyNames::IceGridProps[] = "IceGrid.Registry.Admin.ThreadPool.SizeMax", "IceGrid.Registry.Admin.ThreadPool.SizeWarn", "IceGrid.Registry.Admin.ThreadPool.StackSize", + "IceGrid.Registry.AdminIdentity", "IceGrid.Registry.Client.AdapterId", "IceGrid.Registry.Client.Endpoints", "IceGrid.Registry.Client.PublishedEndpoints", @@ -195,6 +196,8 @@ const char* IceInternal::PropertyNames::IceGridProps[] = "IceGrid.Registry.Internal.ThreadPool.SizeMax", "IceGrid.Registry.Internal.ThreadPool.SizeWarn", "IceGrid.Registry.Internal.ThreadPool.StackSize", + "IceGrid.Registry.LocatorIdentity", + "IceGrid.Registry.QueryIdentity", "IceGrid.Registry.Server.AdapterId", "IceGrid.Registry.Server.Endpoints", "IceGrid.Registry.Server.PublishedEndpoints", diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h index 21a8142ed5c..a62522681eb 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', Thu Jun 2 12:34:35 2005 +// Generated by makeprops.py from file `../config/PropertyNames.def', Thu Jun 2 17:48:18 2005 // IMPORTANT: Do not edit this file -- any edits made here will be lost! diff --git a/cpp/src/IceGrid/AdminI.cpp b/cpp/src/IceGrid/AdminI.cpp index 63acd4643f2..6901087a023 100644 --- a/cpp/src/IceGrid/AdminI.cpp +++ b/cpp/src/IceGrid/AdminI.cpp @@ -146,117 +146,6 @@ AdminI::getAllApplicationNames(const Current&) const return _database->getAllApplications(); } -void -AdminI::addServer(const ApplicationDescriptorPtr& server, const Current&) -{ -// if(server->application.empty()) -// { -// ApplicationDescriptorPtr application = new ApplicationDescriptor(); -// application->name = '_' + server->name; -// ApplicationDescriptorHelper helper(_communicator, application); -// helper.addServerTemplate("_" + server->name, server); -// helper.addServer("_" + server->name, variables); - -// application->servers.push_back(server); -// try -// { -// _database->addApplicationDescriptor(application); -// } -// catch(const ApplicationExistsException&) -// { -// ServerExistsException ex; -// ex.name = server->name; -// throw ex; -// } -// } -// else -// { -// try -// { -// ApplicationDescriptorPtr application = _database->getApplicationDescriptor(server->application); -// application->servers.push_back(server); -// _database->updateApplicationDescriptor(application); -// } -// catch(const ApplicationNotExistException&) -// { -// DeploymentException ex; -// ex.reason = "application `" + server->application + "' doesn't exist"; -// throw ex; -// } -// } -} - -void -AdminI::updateServer(const ApplicationDescriptorPtr& desc, const Current&) -{ - // - // TODO - // -// ServerDescriptorPtr server = _database->getServerDescriptor(newServer->name); -// try -// { -// if(server->application.empty()) -// { -// ApplicationDescriptorPtr application = new ApplicationDescriptor(); -// application->name = '_' + newServer->name; -// application->servers.push_back(newServer); -// _database->updateApplicationDescriptor(application); -// } -// else -// { -// ApplicationDescriptorPtr application = _database->getApplicationDescriptor(server->application); -// for(ServerDescriptorSeq::iterator p = application->servers.begin(); p != application->servers.end(); ++p) -// { -// application->servers.erase(p); -// application->servers.push_back(newServer); -// } -// _database->updateApplicationDescriptor(application); -// } -// } -// catch(const ApplicationNotExistException&) -// { -// ServerNotExistException ex; -// ex.name = newServer->name; -// throw ex; -// } - -} - -void -AdminI::removeServer(const string& name, const Current&) -{ - // - // TODO - // -// ServerDescriptorPtr server = _database->getServerDescriptor(name); -// try -// { -// if(server->application.empty()) -// { -// _database->removeApplicationDescriptor('_' + name); -// } -// else -// { -// ApplicationDescriptorPtr application = _database->getApplicationDescriptor(server->application); -// for(ServerDescriptorSeq::iterator p = application->servers.begin(); p != application->servers.end(); ++p) -// { -// if((*p)->name == name) -// { -// application->servers.erase(p); -// break; -// } -// } -// _database->updateApplicationDescriptor(application); -// } -// } -// catch(const ApplicationNotExistException&) -// { -// ServerNotExistException ex; -// ex.name = name; -// throw ex; -// } -} - InstanceDescriptor AdminI::getServerDescriptor(const string& name, const Current&) const { diff --git a/cpp/src/IceGrid/AdminI.h b/cpp/src/IceGrid/AdminI.h index b2320cfbb74..76da377a909 100644 --- a/cpp/src/IceGrid/AdminI.h +++ b/cpp/src/IceGrid/AdminI.h @@ -34,11 +34,7 @@ public: const Ice::Current&); virtual Ice::StringSeq getAllApplicationNames(const Ice::Current&) const; - virtual void addServer(const ApplicationDescriptorPtr&, const Ice::Current&); - virtual void updateServer(const ApplicationDescriptorPtr&, const Ice::Current&); - virtual void removeServer(const ::std::string&, const Ice::Current&); virtual InstanceDescriptor getServerDescriptor(const ::std::string&, const Ice::Current&) const; - virtual ServerState getServerState(const ::std::string&, const Ice::Current&) const; virtual Ice::Int getServerPid(const ::std::string&, const Ice::Current&) const; virtual bool startServer(const ::std::string&, const Ice::Current&); diff --git a/cpp/src/IceGrid/DescriptorHelper.cpp b/cpp/src/IceGrid/DescriptorHelper.cpp index f77a244b057..f25f811e1a4 100644 --- a/cpp/src/IceGrid/DescriptorHelper.cpp +++ b/cpp/src/IceGrid/DescriptorHelper.cpp @@ -201,10 +201,24 @@ DescriptorVariables::addParameter(const string& name) _scopes.back().parameters.insert(name); } -const vector<string>& -DescriptorVariables::getDeploymentTargets() const +vector<string> +DescriptorVariables::getDeploymentTargets(const string& prefix) const { - return _deploymentTargets; + if(prefix.empty()) + { + return _deploymentTargets; + } + + vector<string> targets; + for(vector<string>::const_iterator p = _deploymentTargets.begin(); p != _deploymentTargets.end(); ++p) + { + string::size_type pos = p->find(prefix); + if(pos != string::npos) + { + targets.push_back(p->substr(prefix.size())); + } + } + return targets; } void @@ -544,6 +558,7 @@ ApplicationDescriptorHelper::ApplicationDescriptorHelper(const Ice::Communicator { XmlAttributesHelper attributes(_variables, attrs); _descriptor->name = attributes("name"); + _descriptor->targets = _variables->getDeploymentTargets(""); _variables->addVariable("application", _descriptor->name); } @@ -595,7 +610,6 @@ ApplicationDescriptorHelper::addServer(const string& tmpl, const IceXML::Attribu instance._cpp_template = tmpl; instance.parameterValues = attrs; instance.parameterValues.erase("template"); - instance.targets = _variables->getDeploymentTargets(); instance.descriptor = _templates->instantiateServer(*this, tmpl, instance.parameterValues); _descriptor->servers.push_back(instance); } @@ -605,7 +619,7 @@ ApplicationDescriptorHelper::addServer(const ServerDescriptorPtr& descriptor) { InstanceDescriptor instance; instance.descriptor = descriptor; - instance.targets = _variables->getDeploymentTargets(); + instance.targets = _variables->getDeploymentTargets(descriptor->name + "."); _descriptor->servers.push_back(instance); } @@ -1081,7 +1095,6 @@ ServerDescriptorHelper::addService(const string& tmpl, const IceXML::Attributes& instance._cpp_template = tmpl; instance.parameterValues = attrs; instance.parameterValues.erase("template"); - instance.targets = _variables->getDeploymentTargets(); iceBox->services.push_back(instance); } @@ -1096,7 +1109,10 @@ ServerDescriptorHelper::addService(const ServiceDescriptorPtr& descriptor) InstanceDescriptor instance; instance.descriptor = descriptor; - instance.targets = _variables->getDeploymentTargets(); + if(_templateId.empty()) + { + instance.targets = _variables->getDeploymentTargets(_descriptor->name + "." + descriptor->name + "."); + } iceBox->services.push_back(instance); } diff --git a/cpp/src/IceGrid/DescriptorHelper.h b/cpp/src/IceGrid/DescriptorHelper.h index 262923a8287..b9b33dc5417 100644 --- a/cpp/src/IceGrid/DescriptorHelper.h +++ b/cpp/src/IceGrid/DescriptorHelper.h @@ -39,7 +39,7 @@ public: std::vector<std::string> getCurrentScopeParameters() const; void addParameter(const std::string&); - const std::vector<std::string>& getDeploymentTargets() const; + std::vector<std::string> getDeploymentTargets(const std::string&) const; void substitution(bool); bool substitution() const; diff --git a/cpp/src/IceGrid/Grammar.y b/cpp/src/IceGrid/Grammar.y index 897c05af293..b5fe6d7a2d4 100644 --- a/cpp/src/IceGrid/Grammar.y +++ b/cpp/src/IceGrid/Grammar.y @@ -154,14 +154,6 @@ command { parser->listAllNodes(); } -| ICE_GRID_SERVER ICE_GRID_ADD strings ';' -{ - parser->addServer($3); -} -| ICE_GRID_SERVER ICE_GRID_UPDATE strings ';' -{ - parser->updateServer($3); -} | ICE_GRID_SERVER ICE_GRID_DESCRIBE strings ';' { parser->describeServer($3); @@ -198,10 +190,6 @@ command { parser->activationServer($3); } -| ICE_GRID_SERVER ICE_GRID_REMOVE strings ';' -{ - parser->removeServer($3); -} | ICE_GRID_SERVER ICE_GRID_LIST ';' { parser->listAllServers(); diff --git a/cpp/src/IceGrid/IceGridNode.cpp b/cpp/src/IceGrid/IceGridNode.cpp index e67f5840605..b07cade381f 100644 --- a/cpp/src/IceGrid/IceGridNode.cpp +++ b/cpp/src/IceGrid/IceGridNode.cpp @@ -298,7 +298,9 @@ NodeService::start(int argc, char* argv[]) // collocated locator (this property is passed by the // activator to each activated server). // - string locatorPrx = "IceGrid/Locator:" + properties->getProperty("IceGrid.Registry.Client.Endpoints"); + const string locatorIdProperty = "IceGrid.Registry.LocatorIdentity"; + string locatorId = properties->getPropertyWithDefault(locatorIdProperty, "IceGrid/Locator"); + string locatorPrx = locatorId + ":" + properties->getProperty("IceGrid.Registry.Client.Endpoints"); properties->setProperty("Ice.Default.Locator", locatorPrx); } else if(properties->getProperty("Ice.Default.Locator").empty()) diff --git a/cpp/src/IceGrid/Parser.cpp b/cpp/src/IceGrid/Parser.cpp index 114569ebd2b..bf474aaa221 100644 --- a/cpp/src/IceGrid/Parser.cpp +++ b/cpp/src/IceGrid/Parser.cpp @@ -239,7 +239,7 @@ describe(Output& out, const Ice::CommunicatorPtr& communicator, const string& id out << nl << "parameters = '" << toString(templ.parameters) << "'"; } - out << nl << "name = '" << templ.descriptor->name << "'"; + out << nl << "name = '" << templ.descriptor->name << "'"; if(server) { describeServer(out, communicator, server); @@ -309,6 +309,10 @@ describe(Output& out, const Ice::CommunicatorPtr& communicator, const InstanceDe out << eb; } } + if(!inst.targets.empty()) + { + out << nl << "targets = '" << toString(inst.targets) << "'"; + } if(server) { describeServer(out, communicator, server); @@ -518,6 +522,10 @@ Parser::describeApplication(const list<string>& args) Output out(cout); out << "application '" << application->name << "'"; out << sb; + if(!application->targets.empty()) + { + out << nl << "targets = '" << toString(application->targets) << "'"; + } if(!application->comment.empty()) { out << nl << "comment = " << application->comment; @@ -1105,103 +1113,6 @@ Parser::listAllNodes() } void -Parser::addServer(const list<string>& args) -{ - if(args.size() < 2) - { - error("`server add' requires at least two arguments\n(`help' for more info)"); - return; - } - - try - { - StringSeq targets; - map<string, string> vars; - - list<string>::const_iterator p = args.begin(); - string descriptor = *p++; - vars["node"] = *p++; - - for(; p != args.end(); ++p) - { - string::size_type pos = p->find('='); - if(pos != string::npos) - { - vars[p->substr(0, pos)] = p->substr(pos + 1); - } - else - { - targets.push_back(*p); - } - } - - // - // TODO - // - //_admin->addServer(DescriptorParser::parseDescriptor(descriptor, targets, vars, _communicator)); - } - catch(const DeploymentException& ex) - { - ostringstream s; - s << ex << ":\n" << ex.reason; - error(s.str()); - } - catch(const Ice::Exception& ex) - { - ostringstream s; - s << ex; - error(s.str()); - } -} - -void -Parser::updateServer(const list<string>& args) -{ - if(args.size() < 2) - { - error("`server update' requires at least two arguments\n(`help' for more info)"); - return; - } - - try - { - StringSeq targets; - map<string, string> vars; - - list<string>::const_iterator p = args.begin(); - string descriptor = *p++; - vars["node"] = *p++; - - for(; p != args.end(); ++p) - { - string::size_type pos = p->find('='); - if(pos != string::npos) - { - vars[p->substr(0, pos)] = p->substr(pos + 1); - } - else - { - targets.push_back(*p); - } - } - - _admin->updateServer(DescriptorParser::parseDescriptor(descriptor, targets, vars, _communicator)); - } - catch(const DeploymentException& ex) - { - ostringstream s; - s << ex << ":\n" << ex.reason; - error(s.str()); - } - catch(const Ice::Exception& ex) - { - ostringstream s; - s << ex; - error(s.str()); - } -} - -void Parser::startServer(const list<string>& args) { if(args.size() != 1) @@ -1317,33 +1228,6 @@ Parser::describeServer(const list<string>& args) } void -Parser::removeServer(const list<string>& args) -{ - if(args.size() != 1) - { - error("`server remove' requires exactly one argument\n(`help' for more info)"); - return; - } - - try - { - _admin->removeServer(args.front()); - } - catch(const DeploymentException& ex) - { - ostringstream s; - s << ex << ":\n" << ex.reason; - error(s.str()); - } - catch(const Ice::Exception& ex) - { - ostringstream s; - s << ex; - error(s.str()); - } -} - -void Parser::stateServer(const list<string>& args) { if(args.size() != 1) diff --git a/cpp/src/IceGrid/Parser.h b/cpp/src/IceGrid/Parser.h index f36ec9de160..49b87f87ee7 100644 --- a/cpp/src/IceGrid/Parser.h +++ b/cpp/src/IceGrid/Parser.h @@ -83,8 +83,6 @@ public: void removeNode(const std::list<std::string>&); void listAllNodes(); - void addServer(const std::list<std::string>&); - void updateServer(const std::list<std::string>&); void startServer(const std::list<std::string>&); void stopServer(const std::list<std::string>&); void signalServer(const std::list<std::string>&); @@ -93,7 +91,6 @@ public: void stateServer(const std::list<std::string>&); void activationServer(const std::list<std::string>&); void pidServer(const std::list<std::string>&); - void removeServer(const std::list<std::string>&); void listAllServers(); void endpointsAdapter(const std::list<std::string>&); diff --git a/cpp/src/IceGrid/RegistryI.cpp b/cpp/src/IceGrid/RegistryI.cpp index 106ed8cba44..b2e85107e62 100644 --- a/cpp/src/IceGrid/RegistryI.cpp +++ b/cpp/src/IceGrid/RegistryI.cpp @@ -226,14 +226,18 @@ RegistryI::start(bool nowarn) ObjectPrx obj = serverAdapter->add(locatorRegistry, stringToIdentity("IceGrid/" + IceUtil::generateUUID())); LocatorRegistryPrx locatorRegistryPrx = LocatorRegistryPrx::uncheckedCast(obj->ice_collocationOptimization(false)); ObjectPtr locator = new LocatorI(_database, locatorRegistryPrx); - clientAdapter->add(locator, stringToIdentity("IceGrid/Locator")); + const string locatorIdProperty = "IceGrid.Registry.LocatorIdentity"; + Identity locatorId = stringToIdentity(properties->getPropertyWithDefault(locatorIdProperty, "IceGrid/Locator")); + clientAdapter->add(locator, locatorId); // // Create the query interface and register it with the object registry. // QueryPtr query = new QueryI(_communicator, _database); - clientAdapter->add(query, stringToIdentity("IceGrid/Query")); - ObjectPrx queryPrx = clientAdapter->createDirectProxy(stringToIdentity("IceGrid/Query")); + const string queryIdProperty = "IceGrid.Registry.QueryIdentity"; + Identity queryId = stringToIdentity(properties->getPropertyWithDefault(queryIdProperty, "IceGrid/Query")); + clientAdapter->add(query, queryId); + ObjectPrx queryPrx = clientAdapter->createDirectProxy(queryId); try { _database->removeObjectDescriptor(queryPrx->ice_getIdentity()); @@ -250,8 +254,10 @@ RegistryI::start(bool nowarn) // Create the admin interface and register it with the object registry. // ObjectPtr admin = new AdminI(_communicator, _database, this); - adminAdapter->add(admin, stringToIdentity("IceGrid/Admin")); - ObjectPrx adminPrx = adminAdapter->createDirectProxy(stringToIdentity("IceGrid/Admin")); + const string adminIdProperty = "IceGrid.Registry.AdminIdentity"; + Identity adminId = stringToIdentity(properties->getPropertyWithDefault(adminIdProperty, "IceGrid/Admin")); + adminAdapter->add(admin, adminId); + ObjectPrx adminPrx = adminAdapter->createDirectProxy(adminId); try { _database->removeObjectDescriptor(adminPrx->ice_getIdentity()); @@ -276,8 +282,8 @@ RegistryI::start(bool nowarn) // registered with the registry object adapter which is using an independant threadpool. // locator = new LocatorI(_database, locatorRegistryPrx); - registryAdapter->add(locator, stringToIdentity("IceGrid/Locator")); - obj = registryAdapter->createDirectProxy(stringToIdentity("IceGrid/Locator")); + registryAdapter->add(locator, locatorId); + obj = registryAdapter->createDirectProxy(locatorId); _communicator->setDefaultLocator(LocatorPrx::uncheckedCast(obj->ice_collocationOptimization(false))); // |