summaryrefslogtreecommitdiff
path: root/service/main.cpp
blob: b008e089f57574fc7c7e52a30f4e6a02c1460a7c (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
31
#include "apiImpl.h"
#include <Ice/Initialize.h>
#include <Ice/ObjectAdapter.h>
#include <curl/curl.h>
#include <icetrayService.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);
}