summaryrefslogtreecommitdiff
path: root/cpp/demo/Glacier2/chat/Server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/demo/Glacier2/chat/Server.cpp')
-rw-r--r--cpp/demo/Glacier2/chat/Server.cpp73
1 files changed, 0 insertions, 73 deletions
diff --git a/cpp/demo/Glacier2/chat/Server.cpp b/cpp/demo/Glacier2/chat/Server.cpp
deleted file mode 100644
index defada30969..00000000000
--- a/cpp/demo/Glacier2/chat/Server.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2015 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 <IceUtil/IceUtil.h> // For generateUUID.
-#include <Glacier2/Glacier2.h>
-#include <ChatSessionI.h>
-
-using namespace std;
-using namespace Demo;
-
-class DummyPermissionsVerifierI : public Glacier2::PermissionsVerifier
-{
-public:
-
- virtual bool
- checkPermissions(const string& userId, const string& password, string&, const Ice::Current&) const
- {
- cout << "verified user `" << userId << "' with password `" << password << "'" << endl;
- return true;
- }
-};
-
-class ChatSessionManagerI : public Glacier2::SessionManager
-{
-public:
-
- virtual Glacier2::SessionPrx
- create(const string& userId, const Glacier2::SessionControlPrx&, const Ice::Current& current)
- {
- Ice::Identity ident = { IceUtil::generateUUID(), "session" };
- return Glacier2::SessionPrx::uncheckedCast(current.adapter->add(new ChatSessionI(userId), ident));
- }
-};
-
-class ChatServer : public Ice::Application
-{
-public:
-
- virtual int
- run(int argc, char*[])
- {
- if(argc > 1)
- {
- cerr << appName() << ": too many arguments" << endl;
- return EXIT_FAILURE;
- }
-
- Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("ChatServer");
-
- Glacier2::PermissionsVerifierPtr dpv = new DummyPermissionsVerifierI;
- adapter->add(dpv, communicator()->stringToIdentity("ChatSessionVerifier"));
- Glacier2::SessionManagerPtr csm = new ChatSessionManagerI;
- adapter->add(csm, communicator()->stringToIdentity("ChatSessionManager"));
- adapter->activate();
- communicator()->waitForShutdown();
-
- return EXIT_SUCCESS;
- }
-};
-
-int
-main(int argc, char* argv[])
-{
- ChatServer app;
- return app.main(argc, argv, "config.server");
-}