summaryrefslogtreecommitdiff
path: root/service/main.cpp
blob: c84b11b126b6d7f8524eeacd72abbb39d07ee50f (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/Initialize.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(std::make_shared<SearchImpl>(dbpool), Ice::stringToIdentity("Search"));
			}
	};

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