summaryrefslogtreecommitdiff
path: root/service/main.cpp
blob: 00563f4630c24ea030812e18a34c82ffc25dfe8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <Ice/Communicator.h>
#include <Ice/ObjectAdapter.h>
#include <icetrayService.h>
#include "apiImpl.h"
#include <curl/curl.h>
#include <libxml/parser.h>

namespace MirrorSearch {
	class Api : public IceTray::Service {
		public:
			Api()
			{
				xmlInitParser();
				curl_global_init(0);
			}
			~Api()
			{
				xmlCleanupParser();
				curl_global_cleanup();
			}
			void addObjects(const std::string &, const Ice::CommunicatorPtr & ic, const Ice::StringSeq &, const Ice::ObjectAdapterPtr & adp) override
			{
				auto dbpool = getConnectionPool(ic, "postgresql", "MirrorSearch");
				adp->add(new SearchImpl(dbpool), ic->stringToIdentity("Search"));
			}
	};

	NAMEDFACTORY("default", MirrorSearch::Api, IceTray::ServiceFactory);
}