2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file src/service/logic/Logic.h
18 * @author Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
20 * @brief This file defines main class of logic layer in cynara service
23 #ifndef SRC_SERVICE_LOGIC_LOGIC_H_
24 #define SRC_SERVICE_LOGIC_LOGIC_H_
26 #include <types/PolicyKey.h>
27 #include <types/PolicyResult.h>
29 #include <main/pointers.h>
30 #include <plugin/PluginManager.h>
31 #include <request/CheckRequestManager.h>
32 #include <request/pointers.h>
33 #include <request/RequestTaker.h>
37 class Logic : public RequestTaker {
42 void bindAgentManager(const AgentManagerPtr &agentManager) {
43 m_agentManager = agentManager;
46 void bindPluginManager(PluginManagerPtr pluginManager) {
47 m_pluginManager = pluginManager;
50 void bindStorage(StoragePtr storage) {
54 void bindSocketManager(SocketManagerPtr socketManager) {
55 m_socketManager = socketManager;
58 void unbindAll(void) {
59 m_agentManager.reset();
60 m_pluginManager.reset();
62 m_socketManager.reset();
65 virtual void execute(RequestContextPtr context, AdminCheckRequestPtr request);
66 virtual void execute(RequestContextPtr context, AgentRegisterRequestPtr request);
67 virtual void execute(RequestContextPtr context, CancelRequestPtr request);
68 virtual void execute(RequestContextPtr context, CheckRequestPtr request);
69 virtual void execute(RequestContextPtr context, InsertOrUpdateBucketRequestPtr request);
70 virtual void execute(RequestContextPtr context, RemoveBucketRequestPtr request);
71 virtual void execute(RequestContextPtr context, SetPoliciesRequestPtr request);
72 virtual void execute(RequestContextPtr context, SignalRequestPtr request);
74 virtual void contextClosed(RequestContextPtr context);
77 AgentManagerPtr m_agentManager;
78 CheckRequestManager m_checkRequestManager;
79 PluginManagerPtr m_pluginManager;
81 SocketManagerPtr m_socketManager;
83 bool check(RequestContextPtr context, const PolicyKey &key, PolicyResult& result);
85 void onPoliciesChanged(void);
90 #endif /* SRC_SERVICE_LOGIC_LOGIC_H_ */