summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/NodeI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/IceGrid/NodeI.cpp')
-rw-r--r--cpp/src/IceGrid/NodeI.cpp68
1 files changed, 62 insertions, 6 deletions
diff --git a/cpp/src/IceGrid/NodeI.cpp b/cpp/src/IceGrid/NodeI.cpp
index 8c08d9b38bb..d787583ed3e 100644
--- a/cpp/src/IceGrid/NodeI.cpp
+++ b/cpp/src/IceGrid/NodeI.cpp
@@ -190,18 +190,22 @@ NodeI::NodeI(const Ice::ObjectAdapterPtr& adapter,
_traceLevels(traceLevels),
_name(name),
_proxy(proxy),
+ _redirectErrToOut(false),
_waitTime(0),
_userAccountMapper(mapper),
- _serial(1),
- _platform("IceGrid.Node", _communicator, _traceLevels)
+ _platform("IceGrid.Node", _communicator, _traceLevels),
+ _fileCache(new FileCache()),
+ _serial(1)
{
- _dataDir = _platform.getDataDir();
- _serversDir = _dataDir + "/servers";
- _tmpDir = _dataDir + "/tmp";
-
Ice::PropertiesPtr properties = _communicator->getProperties();
+
+ const_cast<string&>(_dataDir) = _platform.getDataDir();
+ const_cast<string&>(_serversDir) = _dataDir + "/servers";
+ const_cast<string&>(_tmpDir) = _dataDir + "/tmp";
const_cast<string&>(_instanceName) = _communicator->getDefaultLocator()->ice_getIdentity().category;
const_cast<Ice::Int&>(_waitTime) = properties->getPropertyAsIntWithDefault("IceGrid.Node.WaitTime", 60);
+ const_cast<string&>(_outputDir) = properties->getProperty("IceGrid.Node.Output");
+ const_cast<bool&>(_redirectErrToOut) = properties->getPropertyAsInt("IceGrid.Node.RedirectErrToOut") > 0;
}
NodeI::~NodeI()
@@ -510,6 +514,34 @@ NodeI::shutdown(const Ice::Current&) const
_activator->shutdown();
}
+Ice::StringSeq
+NodeI::readLines(const string& filename, Ice::Long pos, int count, Ice::Long& newPos, const Ice::Current&) const
+{
+ string file;
+ if(filename == "stderr")
+ {
+ file = _communicator->getProperties()->getProperty("Ice.StdErr");
+ if(file.empty())
+ {
+ throw FileNotAvailableException("Ice.StdErr configuration property is not set");
+ }
+ }
+ else if(filename == "stdout")
+ {
+ file = _communicator->getProperties()->getProperty("Ice.StdOut");
+ if(file.empty())
+ {
+ throw FileNotAvailableException("Ice.StdOut configuration property is not set");
+ }
+ }
+ else
+ {
+ throw FileNotAvailableException("unknown file");
+ }
+
+ return _fileCache->read(file, pos, count, newPos);
+}
+
void
NodeI::destroy()
{
@@ -553,6 +585,30 @@ NodeI::getUserAccountMapper() const
return _userAccountMapper;
}
+PlatformInfo&
+NodeI::getPlatformInfo() const
+{
+ return _platform;
+}
+
+FileCachePtr
+NodeI::getFileCache() const
+{
+ return _fileCache;
+}
+
+string
+NodeI::getOutputDir() const
+{
+ return _outputDir;
+}
+
+bool
+NodeI::getRedirectErrToOut() const
+{
+ return _redirectErrToOut;
+}
+
NodeSessionPrx
NodeI::registerWithRegistry(const InternalRegistryPrx& registry)
{