summaryrefslogtreecommitdiff
path: root/cpp/test/IceGrid/deployer/Service.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/test/IceGrid/deployer/Service.cpp')
-rw-r--r--cpp/test/IceGrid/deployer/Service.cpp77
1 files changed, 77 insertions, 0 deletions
diff --git a/cpp/test/IceGrid/deployer/Service.cpp b/cpp/test/IceGrid/deployer/Service.cpp
new file mode 100644
index 00000000000..9d074a8ea85
--- /dev/null
+++ b/cpp/test/IceGrid/deployer/Service.cpp
@@ -0,0 +1,77 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <IceBox/IceBox.h>
+#include <Freeze/Freeze.h>
+#include <TestI.h>
+
+using namespace std;
+using namespace Ice;
+
+class ServiceI : public ::IceBox::Service
+{
+public:
+
+ ServiceI();
+ virtual ~ServiceI();
+
+ virtual void start(const string&,
+ const CommunicatorPtr&,
+ const StringSeq&);
+
+ virtual void stop();
+};
+
+extern "C"
+{
+
+//
+// Factory function
+//
+ICE_DECLSPEC_EXPORT ::IceBox::Service*
+create(CommunicatorPtr communicator)
+{
+ return new ServiceI;
+}
+
+}
+
+ServiceI::ServiceI()
+{
+}
+
+ServiceI::~ServiceI()
+{
+}
+
+void
+ServiceI::start(const string& name,
+ const CommunicatorPtr& communicator,
+ const StringSeq& args)
+{
+ Ice::PropertiesPtr properties = communicator->getProperties();
+ Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter(name);
+ if(properties->getPropertyAsInt(name + ".Freeze") > 0)
+ {
+ //
+ // We do this to ensure the dbenv directory exists.
+ //
+ Freeze::createConnection(communicator, name);
+ }
+ Ice::ObjectPtr object = new TestI(properties);
+ adapter->add(object, communicator->stringToIdentity(properties->getProperty(name + ".Identity")));
+ adapter->activate();
+}
+
+void
+ServiceI::stop()
+{
+}
+