summaryrefslogtreecommitdiff
path: root/cpp/demo/book/lifecycle/Server.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2007-08-24 11:28:20 -0400
committerDwayne Boone <dwayne@zeroc.com>2007-08-24 11:28:20 -0400
commit9a07052d6711858507faa27ff736d4520b3163e9 (patch)
tree7fa0a0406be0386a8314b2e8c742f29bf127b70d /cpp/demo/book/lifecycle/Server.cpp
parentMerge branch 'master' of ssh://cvs.zeroc.com/home/git/ice (diff)
parentSquashed commit of the following: (diff)
downloadice-9a07052d6711858507faa27ff736d4520b3163e9.tar.bz2
ice-9a07052d6711858507faa27ff736d4520b3163e9.tar.xz
ice-9a07052d6711858507faa27ff736d4520b3163e9.zip
Merge branch 'master' of ssh://cvs.zeroc.com/home/git/ice
Diffstat (limited to 'cpp/demo/book/lifecycle/Server.cpp')
-rw-r--r--cpp/demo/book/lifecycle/Server.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/cpp/demo/book/lifecycle/Server.cpp b/cpp/demo/book/lifecycle/Server.cpp
new file mode 100644
index 00000000000..1a6aa475723
--- /dev/null
+++ b/cpp/demo/book/lifecycle/Server.cpp
@@ -0,0 +1,55 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2007 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 <FilesystemI.h>
+
+using namespace std;
+using namespace Filesystem;
+using namespace FilesystemI;
+
+class FilesystemApp : virtual public Ice::Application {
+public:
+ virtual int run(int, char* []) {
+ // Terminate cleanly on receipt of a signal
+ //
+ shutdownOnInterrupt();
+
+ // Create an object adapter.
+ //
+ Ice::ObjectAdapterPtr adapter =
+ communicator()->createObjectAdapterWithEndpoints(
+ "SimpleFilesystem", "default -p 10000");
+
+ // Create the root directory.
+ //
+ new DirectoryI(adapter);
+
+ // All objects are created, allow client requests now.
+ //
+ adapter->activate();
+
+ // Wait until we are done.
+ //
+ communicator()->waitForShutdown();
+ if(interrupted())
+ {
+ cerr << appName() << ": received signal, shutting down" << endl;
+ }
+
+ return 0;
+ };
+};
+
+int
+main(int argc, char* argv[])
+{
+ FilesystemApp app;
+ return app.main(argc, argv);
+}