diff options
author | Benoit Foucher <benoit@zeroc.com> | 2003-04-12 00:45:49 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2003-04-12 00:45:49 +0000 |
commit | 663438ef42029c60cb3e601fe45170a29f9b10ad (patch) | |
tree | f14949a35fd8c82df1b3796b838387204a63c491 /cpp/src | |
parent | fixing topic destruction bugs (diff) | |
download | ice-663438ef42029c60cb3e601fe45170a29f9b10ad.tar.bz2 ice-663438ef42029c60cb3e601fe45170a29f9b10ad.tar.xz ice-663438ef42029c60cb3e601fe45170a29f9b10ad.zip |
Added support for setting environment variables
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/IcePack/ActivatorI.cpp | 18 | ||||
-rw-r--r-- | cpp/src/IcePack/AdminI.cpp | 6 | ||||
-rw-r--r-- | cpp/src/IcePack/AdminI.h | 4 | ||||
-rw-r--r-- | cpp/src/IcePack/ApplicationBuilder.cpp | 4 | ||||
-rw-r--r-- | cpp/src/IcePack/Internal.ice | 2 | ||||
-rw-r--r-- | cpp/src/IcePack/Parser.cpp | 7 | ||||
-rw-r--r-- | cpp/src/IcePack/ServerBuilder.cpp | 10 | ||||
-rw-r--r-- | cpp/src/IcePack/ServerBuilder.h | 1 | ||||
-rw-r--r-- | cpp/src/IcePack/ServerDeployerI.cpp | 2 | ||||
-rw-r--r-- | cpp/src/IcePack/ServerDeployerI.h | 2 |
10 files changed, 42 insertions, 14 deletions
diff --git a/cpp/src/IcePack/ActivatorI.cpp b/cpp/src/IcePack/ActivatorI.cpp index a7ed12912b4..e6a07121167 100644 --- a/cpp/src/IcePack/ActivatorI.cpp +++ b/cpp/src/IcePack/ActivatorI.cpp @@ -184,8 +184,8 @@ IcePack::ActivatorI::activate(const ServerPtr& server) string locatorArg = "--Ice.Default.Locator=" + _properties->getProperty("Ice.Default.Locator"); argv[argc - 2] = strdup(locatorArg.c_str()); - argv[argc - 1] = 0; - + argv[argc - 1] = 0; + if(_traceLevels->activator > 1) { Ice::Trace out(_traceLevels->logger, _traceLevels->activatorCat); @@ -239,6 +239,20 @@ IcePack::ActivatorI::activate(const ServerPtr& server) } } + for(q = server->description.envs.begin(); q != server->description.envs.end(); ++q) + { + if(putenv(strdup(q->c_str())) != 0) + { + SyscallException ex(__FILE__, __LINE__); + ex.error = getSystemErrno(); + ostringstream s; + s << "can't set environment variable: " << *q << "':\n" << ex; + write(fds[1], s.str().c_str(), s.str().length()); + close(fds[1]); + exit(EXIT_FAILURE); + } + } + // // Redirect the standard error output to the write side of the // pipe. diff --git a/cpp/src/IcePack/AdminI.cpp b/cpp/src/IcePack/AdminI.cpp index ad8f9a51786..fe666fccd87 100644 --- a/cpp/src/IcePack/AdminI.cpp +++ b/cpp/src/IcePack/AdminI.cpp @@ -36,7 +36,7 @@ IcePack::AdminI::~AdminI() } void -IcePack::AdminI::addApplication(const string& descriptor, const ServerTargets& targets, const Current&) +IcePack::AdminI::addApplication(const string& descriptor, const StringSeq& targets, const Current&) { ApplicationBuilder builder(_communicator, _nodeRegistry, targets); builder.parse(descriptor); @@ -46,14 +46,14 @@ IcePack::AdminI::addApplication(const string& descriptor, const ServerTargets& t void IcePack::AdminI::removeApplication(const string& descriptor, const Current&) { - ApplicationBuilder builder(_communicator, _nodeRegistry, ServerTargets()); + ApplicationBuilder builder(_communicator, _nodeRegistry, StringSeq()); builder.parse(descriptor); builder.undo(); } void IcePack::AdminI::addServer(const string& node, const string& name, const string& path, const string& ldpath, - const string& descriptor, const ServerTargets& targets, const Current&) + const string& descriptor, const StringSeq& targets, const Current&) { ApplicationBuilder builder(_communicator, _nodeRegistry, targets); builder.addServer(name, node, descriptor, path, ldpath, ""); diff --git a/cpp/src/IcePack/AdminI.h b/cpp/src/IcePack/AdminI.h index 856b2705170..d3e92727015 100644 --- a/cpp/src/IcePack/AdminI.h +++ b/cpp/src/IcePack/AdminI.h @@ -28,11 +28,11 @@ public: const ObjectRegistryPtr&); virtual ~AdminI(); - virtual void addApplication(const std::string&, const ServerTargets&, const Ice::Current& = Ice::Current()); + virtual void addApplication(const std::string&, const Ice::StringSeq&, const Ice::Current& = Ice::Current()); virtual void removeApplication(const std::string&, const Ice::Current& = Ice::Current()); virtual void addServer(const std::string&, const std::string&, const std::string&, const std::string&, - const std::string&, const ServerTargets&, const Ice::Current& = Ice::Current()); + const std::string&, const Ice::StringSeq&, const Ice::Current& = Ice::Current()); virtual void removeServer(const ::std::string&, const Ice::Current&); virtual ServerDescription getServerDescription(const ::std::string&, const Ice::Current&) const; diff --git a/cpp/src/IcePack/ApplicationBuilder.cpp b/cpp/src/IcePack/ApplicationBuilder.cpp index cd217716cec..b7a4296a0f8 100644 --- a/cpp/src/IcePack/ApplicationBuilder.cpp +++ b/cpp/src/IcePack/ApplicationBuilder.cpp @@ -26,7 +26,7 @@ class AddServer : public Task public: AddServer(const ServerDeployerPrx& deployer, const string& node, const string& name, const string& descriptor, - const string& binpath, const string& libpath, const ServerTargets& targets) : + const string& binpath, const string& libpath, const Ice::StringSeq& targets) : _deployer(deployer), _node(node), _name(name), @@ -96,7 +96,7 @@ private: string _descriptor; string _binpath; string _libpath; - ServerTargets _targets; + Ice::StringSeq _targets; }; class ApplicationHandler : public ComponentHandler diff --git a/cpp/src/IcePack/Internal.ice b/cpp/src/IcePack/Internal.ice index 60c9cb65a33..2d4438f9f20 100644 --- a/cpp/src/IcePack/Internal.ice +++ b/cpp/src/IcePack/Internal.ice @@ -420,7 +420,7 @@ interface ServerDeployer * deployment. * **/ - void add(string name, string xmlfile, string binPath, string libPath, ServerTargets targets) + void add(string name, string xmlfile, string binPath, string libPath, Ice::StringSeq targets) throws DeploymentException; /** diff --git a/cpp/src/IcePack/Parser.cpp b/cpp/src/IcePack/Parser.cpp index 541c3e5923d..41653d40433 100644 --- a/cpp/src/IcePack/Parser.cpp +++ b/cpp/src/IcePack/Parser.cpp @@ -102,7 +102,7 @@ IcePack::Parser::addApplication(const list<string>& args) string descriptor = *p++; - ServerTargets targets; + StringSeq targets; for(; p != args.end(); ++p) { targets.push_back(*p); @@ -243,7 +243,7 @@ IcePack::Parser::addServer(const list<string>& args) string descriptor = *p++; string path; string ldpath; - ServerTargets targets; + StringSeq targets; if(p != args.end()) { @@ -369,6 +369,9 @@ IcePack::Parser::describeServer(const list<string>& args) cout << "args = "; copy(desc.args.begin(), desc.args.end(), ostream_iterator<string>(cout," ")); cout << endl; + cout << "envs = "; + copy(desc.envs.begin(), desc.envs.end(), ostream_iterator<string>(cout," ")); + cout << endl; } catch(const Exception& ex) { diff --git a/cpp/src/IcePack/ServerBuilder.cpp b/cpp/src/IcePack/ServerBuilder.cpp index 909c1993f17..f1715c41c72 100644 --- a/cpp/src/IcePack/ServerBuilder.cpp +++ b/cpp/src/IcePack/ServerBuilder.cpp @@ -320,6 +320,10 @@ IcePack::ServerHandler::endElement(const XMLCh *const name) { _builder.addJavaOption(elementValue()); } + else if(str == "env") + { + _builder.addEnvVar(elementValue()); + } } ComponentHandler::endElement(name); @@ -622,6 +626,12 @@ IcePack::ServerBuilder::addJavaOption(const string& option) } void +IcePack::ServerBuilder::addEnvVar(const string& env) +{ + _description.envs.push_back(env); +} + +void IcePack::ServerBuilder::setKind(ServerBuilder::ServerKind kind) { switch(kind) diff --git a/cpp/src/IcePack/ServerBuilder.h b/cpp/src/IcePack/ServerBuilder.h index f596d75d95b..bdac153334b 100644 --- a/cpp/src/IcePack/ServerBuilder.h +++ b/cpp/src/IcePack/ServerBuilder.h @@ -50,6 +50,7 @@ public: void addService(const std::string&, const std::string&, const std::string&); void addOption(const std::string&); void addJavaOption(const std::string&); + void addEnvVar(const std::string&); void setKind(ServerKind); ServerPrx getServer() const; diff --git a/cpp/src/IcePack/ServerDeployerI.cpp b/cpp/src/IcePack/ServerDeployerI.cpp index bcfe93dbb5c..d43335c47b8 100644 --- a/cpp/src/IcePack/ServerDeployerI.cpp +++ b/cpp/src/IcePack/ServerDeployerI.cpp @@ -32,7 +32,7 @@ IcePack::ServerDeployerI::~ServerDeployerI() void IcePack::ServerDeployerI::add(const string& name, const string& descriptor, const string& binPath, - const string& libPath, const ServerTargets& targets, const Ice::Current&) + const string& libPath, const Ice::StringSeq& targets, const Ice::Current&) { // // Setup required variables. diff --git a/cpp/src/IcePack/ServerDeployerI.h b/cpp/src/IcePack/ServerDeployerI.h index e5e013c48d8..6d1c5cc09df 100644 --- a/cpp/src/IcePack/ServerDeployerI.h +++ b/cpp/src/IcePack/ServerDeployerI.h @@ -30,7 +30,7 @@ public: virtual ~ServerDeployerI(); virtual void add(const ::std::string&, const ::std::string&, const ::std::string&, const ::std::string&, - const ::IcePack::ServerTargets&, const ::Ice::Current& = ::Ice::Current()); + const ::Ice::StringSeq&, const ::Ice::Current& = ::Ice::Current()); virtual void remove(const ::std::string&, const ::Ice::Current& = ::Ice::Current()); |