summaryrefslogtreecommitdiff
path: root/cpp/src/IcePack/NodeI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/IcePack/NodeI.cpp')
-rw-r--r--cpp/src/IcePack/NodeI.cpp57
1 files changed, 48 insertions, 9 deletions
diff --git a/cpp/src/IcePack/NodeI.cpp b/cpp/src/IcePack/NodeI.cpp
index 4243b7ec0d1..bf710d885f4 100644
--- a/cpp/src/IcePack/NodeI.cpp
+++ b/cpp/src/IcePack/NodeI.cpp
@@ -7,33 +7,72 @@
//
// **********************************************************************
+#include <IceUtil/UUID.h>
#include <Ice/Ice.h>
#include <IcePack/NodeI.h>
+#include <IcePack/Activator.h>
+#include <IcePack/ServerFactory.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#ifdef _WIN32
+# include <direct.h>
+#endif
using namespace std;
using namespace IcePack;
-IcePack::NodeI::NodeI(const ActivatorPtr& activator, const string& name, const ServerDeployerPrx& deployer) :
+NodeI::NodeI(const ActivatorPtr& activator,
+ const string& name,
+ const ServerFactoryPtr& factory,
+ const Ice::PropertiesPtr& properties) :
_activator(activator),
_name(name),
- _deployer(deployer)
+ _factory(factory)
{
+ _tmpDir = properties->getProperty("IcePack.Node.Data");
+ _tmpDir = _tmpDir + (_tmpDir[_tmpDir.length() - 1] == '/' ? "" : "/") + "tmp/";
}
-std::string
-IcePack::NodeI::getName(const Ice::Current&) const
+ServerPrx
+NodeI::createServer(const string& name, const ServerDescriptorPtr& desc, const ::Ice::Current&) const
{
- return _name;
+ return _factory->createServer(name, desc);
+}
+
+ServerAdapterPrx
+NodeI::createServerAdapter(const ServerPrx& server, const string& id, const ::Ice::Current&) const
+{
+ return _factory->createServerAdapter(id, server);
+}
+
+string
+NodeI::createTmpDir(const Ice::Current&) const
+{
+ string dir = _tmpDir + IceUtil::generateUUID();
+#ifdef _WIN32
+ _mkdir(dir.c_str());
+#else
+ mkdir(dir.c_str(), 0755);
+#endif
+ return dir;
+}
+
+void
+NodeI::destroyTmpDir(const string& path, const Ice::Current&) const
+{
+ rmdir(path.c_str());
}
-ServerDeployerPrx
-IcePack::NodeI::getServerDeployer(const Ice::Current&) const
+std::string
+NodeI::getName(const Ice::Current&) const
{
- return _deployer;
+ return _name;
}
void
-IcePack::NodeI::shutdown(const Ice::Current&) const
+NodeI::shutdown(const Ice::Current&) const
{
_activator->shutdown();
}