summaryrefslogtreecommitdiff
path: root/cpp/src/Yellow/Service.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Yellow/Service.cpp')
-rw-r--r--cpp/src/Yellow/Service.cpp128
1 files changed, 0 insertions, 128 deletions
diff --git a/cpp/src/Yellow/Service.cpp b/cpp/src/Yellow/Service.cpp
deleted file mode 100644
index b56026face5..00000000000
--- a/cpp/src/Yellow/Service.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2002
-// ZeroC, Inc.
-// Billerica, MA, USA
-//
-// All Rights Reserved.
-//
-// Ice is free software; you can redistribute it and/or modify it under
-// the terms of the GNU General Public License version 2 as published by
-// the Free Software Foundation.
-//
-// **********************************************************************
-
-#include <Yellow/AdminI.h>
-#include <Yellow/QueryI.h>
-
-#include <IceBox/IceBox.h>
-
-#if defined(_WIN32)
-# define YELLOW_SERVICE_API __declspec(dllexport)
-#else
-# define YELLOW_SERVICE_API /**/
-#endif
-
-using namespace std;
-using namespace Ice;
-using namespace Yellow;
-using namespace Freeze;
-
-namespace Yellow
-{
-
-class YELLOW_SERVICE_API ServiceI : public ::IceBox::FreezeService
-{
-public:
-
- ServiceI();
- virtual ~ServiceI();
-
- virtual void start(const string&,
- const CommunicatorPtr&,
- const StringSeq&,
- const ::Freeze::DBEnvironmentPtr&);
-
- virtual void stop();
-
-private:
-
- ObjectAdapterPtr _queryAdapter;
- ObjectAdapterPtr _adminAdapter;
-};
-
-} // End namespace Yellow
-
-extern "C"
-{
-
-//
-// Factory function
-//
-YELLOW_SERVICE_API ::IceBox::FreezeService*
-create(Ice::CommunicatorPtr communicator)
-{
- return new Yellow::ServiceI;
-}
-
-}
-
-Yellow::ServiceI::ServiceI()
-{
-}
-
-Yellow::ServiceI::~ServiceI()
-{
-}
-
-void
-Yellow::ServiceI::start(const string& name,
- const CommunicatorPtr& communicator,
- const StringSeq& args,
- const DBEnvironmentPtr& dbEnv)
-{
- //
- // The Admin & Query interface implementations each have their own
- // map. This is safe because a) no iterators are used on the
- // database, and b) internally the database is synchronized.
- //
- DBPtr dbYellow = dbEnv->openDB("yellow", true);
-
- //
- // With respect to the adapters I want to support three use-cases:
- //
- // 1) admin is not permitted.
- // 2) both admin & query is permitted on the same endpoint
- // 3) query & admin are permitted, but on seperate endpoitns
- //
- // TODO: At present #2 isn't supported.
- //
- _queryAdapter = communicator->createObjectAdapter(name + ".Query");
-
- string adminEndpoints = communicator->getProperties()->getProperty(name + ".Admin.Endpoints");
- if(!adminEndpoints.empty())
- {
- _adminAdapter = communicator->createObjectAdapter(name + ".Admin");
- ObjectPtr admin = new AdminI(dbYellow);
- _adminAdapter->add(admin, stringToIdentity(name + "/Admin"));
- }
-
- ObjectPtr query = new QueryI(dbYellow);
- _queryAdapter->add(query, stringToIdentity(name + "/Query"));
-
- if(_adminAdapter)
- {
- _adminAdapter->activate();
- }
- _queryAdapter->activate();
-}
-
-void
-Yellow::ServiceI::stop()
-{
- if(_adminAdapter)
- {
- _adminAdapter->deactivate();
- }
- _queryAdapter->deactivate();
-}