1 //
2 // Copyright (c) ZeroC, Inc. All rights reserved.
3 //
4 
5 #include <Ice/Ice.h>
6 #include <IceBox/IceBox.h>
7 #include <TestI.h>
8 
9 using namespace std;
10 using namespace Ice;
11 
12 class ServiceI : public ::IceBox::Service
13 {
14 public:
15 
16     ServiceI();
17     virtual ~ServiceI();
18 
19     virtual void start(const string&,
20                        const CommunicatorPtr&,
21                        const StringSeq&);
22 
23     virtual void stop();
24 };
25 
26 extern "C"
27 {
28 
29 //
30 // Factory function
31 //
32 ICE_DECLSPEC_EXPORT ::IceBox::Service*
create(CommunicatorPtr)33 create(CommunicatorPtr)
34 {
35     return new ServiceI;
36 }
37 
38 }
39 
ServiceI()40 ServiceI::ServiceI()
41 {
42 }
43 
~ServiceI()44 ServiceI::~ServiceI()
45 {
46 }
47 
48 void
start(const string & name,const CommunicatorPtr & communicator,const StringSeq &)49 ServiceI::start(const string& name,
50                 const CommunicatorPtr& communicator,
51                 const StringSeq&)
52 {
53     Ice::PropertiesPtr properties = communicator->getProperties();
54     Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter(name);
55     Ice::ObjectPtr object = new TestI(adapter, properties);
56     adapter->add(object, stringToIdentity(properties->getProperty(name + ".Identity")));
57     adapter->activate();
58 }
59 
60 void
stop()61 ServiceI::stop()
62 {
63 }
64