diff options
Diffstat (limited to 'cpp/test/IcePack/deployer/Service.cpp')
-rw-r--r-- | cpp/test/IcePack/deployer/Service.cpp | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/cpp/test/IcePack/deployer/Service.cpp b/cpp/test/IcePack/deployer/Service.cpp new file mode 100644 index 00000000000..b1a54c8bc23 --- /dev/null +++ b/cpp/test/IcePack/deployer/Service.cpp @@ -0,0 +1,130 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <IceBox/IceBox.h> +#include <Freeze/Freeze.h> +#include <TestI.h> + +#if defined(_WIN32) +# define TEST_SERVICE_API __declspec(dllexport) +#else +# define TEST_SERVICE_API /**/ +#endif + +using namespace std; +using namespace Ice; + +class TEST_SERVICE_API ServiceI : public ::IceBox::Service +{ +public: + + ServiceI(); + virtual ~ServiceI(); + + virtual void start(const string&, + const CommunicatorPtr&, + const PropertiesPtr&, + const StringSeq&); + + virtual void stop(); +}; + +class TEST_SERVICE_API FreezeServiceI : public ::IceBox::FreezeService +{ +public: + + FreezeServiceI(); + virtual ~FreezeServiceI(); + + virtual void start(const string&, + const CommunicatorPtr&, + const PropertiesPtr&, + const StringSeq&, + const Freeze::DBEnvironmentPtr&); + + virtual void stop(); +}; + +extern "C" +{ + +// +// Factory function +// +TEST_SERVICE_API ::IceBox::Service* +create(CommunicatorPtr communicator) +{ + return new ServiceI; +} + +TEST_SERVICE_API ::IceBox::FreezeService* +createFreezeService(CommunicatorPtr communicator) +{ + return new FreezeServiceI; +} + +} + +ServiceI::ServiceI() +{ +} + +ServiceI::~ServiceI() +{ +} + +void +ServiceI::start(const string& name, + const CommunicatorPtr& communicator, + const PropertiesPtr& properties, + const StringSeq& args) +{ + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter(name + "Adapter"); + Ice::ObjectPtr object = new TestI(adapter, properties); + adapter->add(object, Ice::stringToIdentity(name)); + adapter->activate(); +} + +void +ServiceI::stop() +{ +} + +FreezeServiceI::FreezeServiceI() +{ +} + +FreezeServiceI::~FreezeServiceI() +{ +} + +void +FreezeServiceI::start(const string& name, + const CommunicatorPtr& communicator, + const PropertiesPtr& properties, + const StringSeq& args, + const Freeze::DBEnvironmentPtr& dbEnv) +{ + // + // Ensure that we can create an environment. + // + Freeze::DBPtr db = dbEnv->openDB("testdb", true); + + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter(name + "Adapter"); + Ice::ObjectPtr object = new TestI(adapter, properties); + adapter->add(object, Ice::stringToIdentity(name)); + adapter->activate(); +} + +void +FreezeServiceI::stop() +{ +} |