summaryrefslogtreecommitdiff
path: root/cpp/src/IceStorm/Server.cpp
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2001-11-26 15:53:00 +0000
committerMatthew Newhook <matthew@zeroc.com>2001-11-26 15:53:00 +0000
commit021c6615fd0b299d7742c82f7d6b76f4a813f397 (patch)
treeaf38dfba0fc3204ce8a0572777b92883e6e657f8 /cpp/src/IceStorm/Server.cpp
parentBlobject (diff)
downloadice-021c6615fd0b299d7742c82f7d6b76f4a813f397.tar.bz2
ice-021c6615fd0b299d7742c82f7d6b76f4a813f397.tar.xz
ice-021c6615fd0b299d7742c82f7d6b76f4a813f397.zip
Initial version of IceStorm.
Diffstat (limited to 'cpp/src/IceStorm/Server.cpp')
-rw-r--r--cpp/src/IceStorm/Server.cpp93
1 files changed, 93 insertions, 0 deletions
diff --git a/cpp/src/IceStorm/Server.cpp b/cpp/src/IceStorm/Server.cpp
new file mode 100644
index 00000000000..e43b48ced91
--- /dev/null
+++ b/cpp/src/IceStorm/Server.cpp
@@ -0,0 +1,93 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <IceStorm/TopicManagerI.h>
+#include <IceStorm/TraceLevels.h>
+
+using namespace std;
+
+void
+usage(const char* n)
+{
+ cerr << "Usage: " << n << " [options]\n";
+ cerr <<
+ "Options:\n"
+ "-h, --help Show this message.\n"
+ "-v, --version Display the Ice version.\n"
+ ;
+}
+
+int
+run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
+{
+ for (int i = 1; i < argc; ++i)
+ {
+ if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
+ {
+ usage(argv[0]);
+ return EXIT_SUCCESS;
+ }
+ else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
+ {
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
+ }
+ else
+ {
+ cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ }
+
+ //PropertiesPtr properties = communicator->getProperties();
+
+ IceStorm::TraceLevelsPtr traceLevels = new IceStorm::TraceLevels(communicator->getProperties());
+ Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TopicManager");
+ Ice::ObjectPtr object = new IceStorm::TopicManagerI(communicator, adapter, traceLevels);
+ adapter->add(object, "TopicManager");
+ adapter->activate();
+ communicator->waitForShutdown();
+ return EXIT_SUCCESS;
+}
+
+int
+main(int argc, char* argv[])
+{
+ int status;
+ Ice::CommunicatorPtr communicator;
+
+ try
+ {
+ communicator = Ice::initialize(argc, argv);
+ status = run(argc, argv, communicator);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
+
+ if (communicator)
+ {
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
+ }
+
+ return status;
+}