2018-08-08 16:15:29 +00:00
|
|
|
#pragma once
|
|
|
|
#include <Interpreters/Context.h>
|
|
|
|
#include <Poco/Logger.h>
|
|
|
|
#include <Poco/Net/HTTPRequestHandler.h>
|
|
|
|
#include <Poco/Net/HTTPRequestHandlerFactory.h>
|
2018-08-19 17:09:54 +00:00
|
|
|
#include "MainHandler.h"
|
|
|
|
#include "ColumnInfoHandler.h"
|
2018-09-27 15:23:42 +00:00
|
|
|
#include "IdentifierQuoteHandler.h"
|
2018-08-08 16:15:29 +00:00
|
|
|
|
|
|
|
#pragma GCC diagnostic push
|
|
|
|
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
|
|
|
#include <Poco/Data/SessionPool.h>
|
|
|
|
#pragma GCC diagnostic pop
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2018-09-27 15:23:42 +00:00
|
|
|
/** Factory for '/ping', '/', '/columns_info', '/identifier_quote' handlers.
|
2018-08-10 14:46:12 +00:00
|
|
|
* Also stores Session pools for ODBC connections
|
|
|
|
*/
|
2018-08-08 16:15:29 +00:00
|
|
|
class HandlerFactory : public Poco::Net::HTTPRequestHandlerFactory
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
HandlerFactory(const std::string & name_, size_t keep_alive_timeout_, std::shared_ptr<Context> context_)
|
|
|
|
: log(&Poco::Logger::get(name_)), name(name_), keep_alive_timeout(keep_alive_timeout_), context(context_)
|
|
|
|
{
|
2018-08-09 12:57:34 +00:00
|
|
|
pool_map = std::make_shared<ODBCHandler::PoolMap>();
|
2018-08-08 16:15:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Poco::Net::HTTPRequestHandler * createRequestHandler(const Poco::Net::HTTPServerRequest & request) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
Poco::Logger * log;
|
|
|
|
std::string name;
|
|
|
|
size_t keep_alive_timeout;
|
|
|
|
std::shared_ptr<Context> context;
|
2018-08-09 12:57:34 +00:00
|
|
|
std::shared_ptr<ODBCHandler::PoolMap> pool_map;
|
2018-08-08 16:15:29 +00:00
|
|
|
};
|
|
|
|
}
|