Remove the lazy creation routine for context providers 66/66266/5
authorMu-Woong Lee <muwoong.lee@samsung.com>
Mon, 18 Apr 2016 06:25:28 +0000 (15:25 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Tue, 19 Apr 2016 05:51:45 +0000 (14:51 +0900)
Change-Id: Ie8bc5c7ddb1832a86e2db4c9eec1eb3f1fda6fa1
Signed-off-by: Mu-Woong Lee <muwoong.lee@samsung.com>
15 files changed:
CMakeLists.txt
packaging/context-service.spec
src/ContextManager.cpp [new file with mode: 0644]
src/ContextManager.h [new file with mode: 0644]
src/ContextManagerImpl.cpp [deleted file]
src/ContextManagerImpl.h [deleted file]
src/ProviderHandler.cpp
src/ProviderHandler.h
src/Server.cpp
src/trigger/ContextMonitor.cpp
src/trigger/ContextMonitor.h
src/trigger/TemplateManager.cpp
src/trigger/TemplateManager.h
src/trigger/Trigger.cpp
src/trigger/Trigger.h

index 032be8bd334f662af0b4663674af7b2a3d4e76fb..15137487344c9a3afc91a582fcc0cf70b1744ce3 100644 (file)
@@ -13,7 +13,10 @@ MESSAGE("Sources: ${SRCS}")
 SET(DEPS
        vconf
        capi-system-info
+       capi-system-device
+       capi-system-runtime-info
        capi-appfw-app-manager
+       capi-appfw-package-manager
        appsvc
        notification
        capi-system-system-settings
index e314866387356dde73ffac4778e0711e27135566..a8af3974451d226bb06c06bf00bd83e87e984d40 100644 (file)
@@ -12,7 +12,10 @@ BuildRequires: cmake
 BuildRequires: sed
 BuildRequires: pkgconfig(vconf)
 BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: pkgconfig(capi-system-device)
+BuildRequires: pkgconfig(capi-system-runtime-info)
 BuildRequires: pkgconfig(capi-appfw-app-manager)
+BuildRequires: pkgconfig(capi-appfw-package-manager)
 BuildRequires: pkgconfig(appsvc)
 BuildRequires: pkgconfig(notification)
 BuildRequires: pkgconfig(capi-system-system-settings)
diff --git a/src/ContextManager.cpp b/src/ContextManager.cpp
new file mode 100644 (file)
index 0000000..119fcff
--- /dev/null
@@ -0,0 +1,365 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <glib.h>
+#include <list>
+
+#include <Types.h>
+#include <DBusTypes.h>
+#include <context_trigger_types_internal.h>
+#include <Json.h>
+#include <ContextProvider.h>
+#include "Server.h"
+#include "access_control/Privilege.h"
+#include "Request.h"
+#include "ProviderHandler.h"
+#include "ContextManager.h"
+#include "trigger/TemplateManager.h"
+
+/* Context Providers */
+#include <internal/DeviceContextProvider.h>
+#include <internal/StatisticsContextProvider.h>
+#include <internal/PlaceContextProvider.h>
+#include <internal/CustomContextProvider.h>
+
+using namespace ctx;
+
+struct TriggerItemFormat {
+       std::string subject;
+       int operation;
+       Json attributes;
+       Json options;
+       std::string owner;
+       bool unregister;
+       TriggerItemFormat(std::string subj, int ops, Json attr, Json opt, std::string own) :
+               subject(subj),
+               operation(ops),
+               attributes(attr),
+               options(opt),
+               owner(own)
+       {
+               unregister = false;
+       }
+
+       TriggerItemFormat(std::string subj) :
+               subject(subj)
+       {
+               unregister = true;
+       }
+};
+
+static std::list<TriggerItemFormat> __triggerItemList;
+
+ContextManager::ContextManager() :
+       __initialized(false)
+{
+       ContextProvider::__setContextManager(this);
+}
+
+ContextManager::~ContextManager()
+{
+       release();
+}
+
+bool ContextManager::init()
+{
+       bool ret;
+
+       ret = initDeviceContextProvider();
+       IF_FAIL_RETURN_TAG(ret, false, _E, "Initialization failed: DeviceContextProvider");
+
+       ret = initStatisticsContextProvider();
+       IF_FAIL_RETURN_TAG(ret, false, _E, "Initialization failed: StatisticsContextProvider");
+
+       ret = initPlaceContextProvider();
+       IF_FAIL_RETURN_TAG(ret, false, _E, "Initialization failed: PlaceContextProvider");
+
+//     ret = initCustomContextProvider();
+//     IF_FAIL_RETURN_TAG(ret, false, _E, "Initialization failed: CustomContextProvider");
+
+       __initialized = true;
+       return true;
+}
+
+void ContextManager::release()
+{
+       for (auto& it : __providerHandleMap) {
+               delete it.second;
+       }
+       __providerHandleMap.clear();
+}
+
+bool ContextManager::registerProvider(const char *subject, const char *privilege, ContextProvider *provider)
+{
+       if (__providerHandleMap.find(subject) != __providerHandleMap.end()) {
+               _E("The provider for the subject '%s' is already registered.", subject);
+               return false;
+       }
+
+       _SI("Subj: %s, Priv: %s", subject, privilege);
+
+       ProviderHandler *handle = new(std::nothrow) ProviderHandler(subject, privilege, provider);
+       IF_FAIL_RETURN_TAG(handle, false, _E, "Memory allocation failed");
+
+       __providerHandleMap[subject] = handle;
+       return true;
+}
+
+bool ContextManager::unregisterProvider(const char *subject)
+{
+       auto it = __providerHandleMap.find(subject);
+       if (it == __providerHandleMap.end()) {
+               _E("The provider for the subject '%s' is not found.", subject);
+               return false;
+       }
+
+       delete it->second;
+       __providerHandleMap.erase(it);
+
+       return true;
+}
+
+bool ContextManager::registerTriggerItem(const char *subject, int operation, Json attributes, Json options, const char* owner)
+{
+       IF_FAIL_RETURN_TAG(subject, false, _E, "Invalid parameter");
+
+       if (!__initialized) {
+               __triggerItemList.push_back(TriggerItemFormat(subject, operation, attributes, options, (owner)? owner : ""));
+       } else {
+               trigger::TemplateManager* tmplMgr = trigger::TemplateManager::getInstance();
+               IF_FAIL_RETURN_TAG(tmplMgr, false, _E, "Memory allocation failed");
+               tmplMgr->registerTemplate(subject, operation, attributes, options, owner);
+       }
+
+       return true;
+}
+
+bool ContextManager::unregisterTriggerItem(const char *subject)
+{
+       IF_FAIL_RETURN_TAG(subject, false, _E, "Invalid parameter");
+
+       if (!__initialized) {
+               __triggerItemList.push_back(TriggerItemFormat(subject));
+       } else {
+               trigger::TemplateManager* tmplMgr = trigger::TemplateManager::getInstance();
+               IF_FAIL_RETURN_TAG(tmplMgr, false, _E, "Memory allocation failed");
+               tmplMgr->unregisterTemplate(subject);
+       }
+
+       return true;
+}
+
+bool ContextManager::popTriggerItem(std::string &subject, int &operation, Json &attributes, Json &options, std::string& owner, bool& unregister)
+{
+       IF_FAIL_RETURN(!__triggerItemList.empty(), false);
+
+       TriggerItemFormat format = __triggerItemList.front();
+       __triggerItemList.pop_front();
+
+       subject = format.subject;
+       operation = format.operation;
+       attributes = format.attributes;
+       options = format.options;
+       owner = format.owner;
+       unregister = format.unregister;
+
+       return true;
+}
+
+void ContextManager::assignRequest(RequestInfo* request)
+{
+       if (__handleCustomRequest(request)) {
+               delete request;
+               return;
+       }
+
+       auto it = __providerHandleMap.find(request->getSubject());
+       if (it == __providerHandleMap.end()) {
+               _W("Unsupported subject");
+               request->reply(ERR_NOT_SUPPORTED);
+               delete request;
+               return;
+       }
+
+       if (!it->second->isAllowed(request->getCredentials())) {
+               _W("Permission denied");
+               request->reply(ERR_PERMISSION_DENIED);
+               delete request;
+               return;
+       }
+
+       switch (request->getType()) {
+       case REQ_SUBSCRIBE:
+               it->second->subscribe(request);
+               break;
+       case REQ_UNSUBSCRIBE:
+               it->second->unsubscribe(request);
+               break;
+       case REQ_READ:
+       case REQ_READ_SYNC:
+               it->second->read(request);
+               break;
+       case REQ_WRITE:
+               it->second->write(request);
+               break;
+       case REQ_SUPPORT:
+               request->reply(ERR_NONE);
+               delete request;
+               break;
+       default:
+               _E("Invalid type of request");
+               delete request;
+       }
+}
+
+bool ContextManager::isSupported(const char *subject)
+{
+       auto it = __providerHandleMap.find(subject);
+       return (it != __providerHandleMap.end());
+}
+
+bool ContextManager::isAllowed(const Credentials *creds, const char *subject)
+{
+       IF_FAIL_RETURN(creds, true);    /* In case internal requests */
+       auto it = __providerHandleMap.find(subject);
+       IF_FAIL_RETURN(it != __providerHandleMap.end(), false);
+       return it->second->isAllowed(creds);
+}
+
+void ContextManager::__publish(const char* subject, Json &option, int error, Json &dataUpdated)
+{
+       _I("Publishing '%s'", subject);
+       _J("Option", option);
+
+       auto it = __providerHandleMap.find(subject);
+       IF_FAIL_VOID(it != __providerHandleMap.end());
+
+       it->second->publish(option, error, dataUpdated);
+}
+
+void ContextManager::__replyToRead(const char* subject, Json &option, int error, Json &dataRead)
+{
+       _I("Sending data of '%s'", subject);
+       _J("Option", option);
+       _J("Data", dataRead);
+
+       auto it = __providerHandleMap.find(subject);
+       IF_FAIL_VOID(it != __providerHandleMap.end());
+
+       it->second->replyToRead(option, error, dataRead);
+}
+
+struct PublishedData {
+       int type;
+       ContextManager *mgr;
+       std::string subject;
+       int error;
+       Json option;
+       Json data;
+       PublishedData(int t, ContextManager *m, const char* s, Json& o, int e, Json& d)
+               : type(t), mgr(m), subject(s), error(e)
+       {
+               option = o.str();
+               data = d.str();
+       }
+};
+
+gboolean ContextManager::__threadSwitcher(gpointer data)
+{
+       PublishedData *tuple = static_cast<PublishedData*>(data);
+
+       switch (tuple->type) {
+       case REQ_SUBSCRIBE:
+               tuple->mgr->__publish(tuple->subject.c_str(), tuple->option, tuple->error, tuple->data);
+               break;
+       case REQ_READ:
+               tuple->mgr->__replyToRead(tuple->subject.c_str(), tuple->option, tuple->error, tuple->data);
+               break;
+       default:
+               _W("Invalid type");
+       }
+
+       delete tuple;
+       return FALSE;
+}
+
+bool ContextManager::publish(const char* subject, Json& option, int error, Json& dataUpdated)
+{
+       IF_FAIL_RETURN_TAG(subject, false, _E, "Invalid parameter");
+
+       PublishedData *tuple = new(std::nothrow) PublishedData(REQ_SUBSCRIBE, this, subject, option, error, dataUpdated);
+       IF_FAIL_RETURN_TAG(tuple, false, _E, "Memory allocation failed");
+
+       g_idle_add(__threadSwitcher, tuple);
+
+       return true;
+}
+
+bool ContextManager::replyToRead(const char* subject, Json& option, int error, Json& dataRead)
+{
+       IF_FAIL_RETURN_TAG(subject, false, _E, "Invalid parameter");
+
+       PublishedData *tuple = new(std::nothrow) PublishedData(REQ_READ, this, subject, option, error, dataRead);
+       IF_FAIL_RETURN_TAG(tuple, false, _E, "Memory allocation failed");
+
+       g_idle_add(__threadSwitcher, tuple);
+
+       return true;
+}
+
+bool ContextManager::__handleCustomRequest(RequestInfo* request)
+{
+       std::string subject = request->getSubject();
+       IF_FAIL_RETURN( subject == CONTEXT_TRIGGER_SUBJECT_CUSTOM_ADD ||
+                                       subject == CONTEXT_TRIGGER_SUBJECT_CUSTOM_REMOVE ||
+                                       subject == CONTEXT_TRIGGER_SUBJECT_CUSTOM_PUBLISH, false);
+
+#if 0
+       const char* pkg_id = request->getPackageId();
+       if (pkg_id == NULL) {
+               request->reply(ERR_OPERATION_FAILED);
+               return true;
+       }
+
+       Json desc = request->getDescription();
+       std::string name;
+       desc.get(NULL, CT_CUSTOM_NAME, &name);
+       std::string subj = pkg_id + std::string("::") + name;
+
+       int error = ERR_NONE;
+       if (subject == CONTEXT_TRIGGER_SUBJECT_CUSTOM_ADD) {
+               Json tmpl;
+               desc.get(NULL, CT_CUSTOM_ATTRIBUTES, &tmpl);
+
+               error = custom_context_provider::addItem(subj, name, tmpl, pkg_id);
+       } else if (subject == CONTEXT_TRIGGER_SUBJECT_CUSTOM_REMOVE) {
+               error = custom_context_provider::removeItem(subj);
+               if (error == ERR_NONE) {
+                       Json data;
+                       data.set(NULL, CT_CUSTOM_SUBJECT, subj);
+                       request->reply(error, data);
+               }
+       } else if (subject == CONTEXT_TRIGGER_SUBJECT_CUSTOM_PUBLISH) {
+               Json fact;
+               desc.get(NULL, CT_CUSTOM_FACT, &fact);
+
+               error = custom_context_provider::publishData(subj, fact);
+       }
+
+       request->reply(error);
+#endif
+       return true;
+}
diff --git a/src/ContextManager.h b/src/ContextManager.h
new file mode 100644 (file)
index 0000000..e2518bc
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _CONTEXT_CONTEXT_MANAGER_H_
+#define _CONTEXT_CONTEXT_MANAGER_H_
+
+#include <map>
+#include <IContextManager.h>
+
+namespace ctx {
+
+       /* Forward declaration */
+       class Credentials;
+       class RequestInfo;
+       class ProviderHandler;
+
+       class ContextManager : public IContextManager {
+       public:
+               ~ContextManager();
+
+               bool init();
+               void release();
+
+               void assignRequest(ctx::RequestInfo *request);
+               bool isSupported(const char *subject);
+               bool isAllowed(const Credentials *creds, const char *subject);
+               bool popTriggerItem(std::string &subject, int &operation, ctx::Json &attributes, ctx::Json &options, std::string &owner, bool& unregister);
+
+               /* From the interface class */
+               bool registerProvider(const char *subject, const char *privilege, ContextProvider *provider);
+               bool unregisterProvider(const char *subject);
+               bool registerTriggerItem(const char *subject, int operation, ctx::Json attributes, ctx::Json options, const char *owner = NULL);
+               bool unregisterTriggerItem(const char *subject);
+               bool publish(const char *subject, ctx::Json &option, int error, ctx::Json &dataUpdated);
+               bool replyToRead(const char *subject, ctx::Json &option, int error, ctx::Json &dataRead);
+
+       private:
+               ContextManager();
+
+               static gboolean __threadSwitcher(gpointer data);
+
+               void __publish(const char *subject, ctx::Json &option, int error, ctx::Json &dataUpdated);
+               void __replyToRead(const char *subject, ctx::Json &option, int error, ctx::Json &dataRead);
+
+               /* For custom request */
+               bool __handleCustomRequest(ctx::RequestInfo* request);
+
+               bool __initialized;
+               std::map<std::string, ProviderHandler*> __providerHandleMap;
+
+               friend class Server;
+
+       };      /* class ContextManager */
+
+}      /* namespace ctx */
+
+#endif /* _CONTEXT_CONTEXT_MANAGER_H_ */
diff --git a/src/ContextManagerImpl.cpp b/src/ContextManagerImpl.cpp
deleted file mode 100644 (file)
index 00f27d3..0000000
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <glib.h>
-#include <list>
-
-#include <Types.h>
-#include <DBusTypes.h>
-#include <context_trigger_types_internal.h>
-#include <Json.h>
-#include "Server.h"
-#include "access_control/Privilege.h"
-#include "Request.h"
-#include "ProviderHandler.h"
-#include "ContextManagerImpl.h"
-#include "trigger/TemplateManager.h"
-
-/* Context Providers */
-#include <internal/DeviceContextProvider.h>
-#include <internal/StatisticsContextProvider.h>
-#include <internal/PlaceContextProvider.h>
-#include <internal/CustomContextProvider.h>
-
-struct TriggerItemFormat {
-       std::string subject;
-       int operation;
-       ctx::Json attributes;
-       ctx::Json options;
-       std::string owner;
-       bool unregister;
-       TriggerItemFormat(std::string subj, int ops, ctx::Json attr, ctx::Json opt, std::string own) :
-               subject(subj),
-               operation(ops),
-               attributes(attr),
-               options(opt),
-               owner(own)
-       {
-               unregister = false;
-       }
-
-       TriggerItemFormat(std::string subj) :
-               subject(subj)
-       {
-               unregister = true;
-       }
-};
-
-static std::list<TriggerItemFormat> __triggerItemList;
-bool ctx::ContextManagerImpl::__initialized = false;
-
-ctx::ContextManagerImpl::ContextManagerImpl()
-{
-}
-
-ctx::ContextManagerImpl::~ContextManagerImpl()
-{
-       release();
-}
-
-bool ctx::ContextManagerImpl::init()
-{
-       bool ret;
-
-       ret = initDeviceContextProvider();
-       IF_FAIL_RETURN_TAG(ret, false, _E, "Initialization failed: DeviceContextProvider");
-
-       ret = initStatisticsContextProvider();
-       IF_FAIL_RETURN_TAG(ret, false, _E, "Initialization failed: StatisticsContextProvider");
-
-       ret = initPlaceContextProvider();
-       IF_FAIL_RETURN_TAG(ret, false, _E, "Initialization failed: PlaceContextProvider");
-
-       ret = initCustomContextProvider();
-       IF_FAIL_RETURN_TAG(ret, false, _E, "Initialization failed: CustomContextProvider");
-
-       __initialized = true;
-
-       return true;
-}
-
-void ctx::ContextManagerImpl::release()
-{
-       for (auto it = __providerHandleMap.begin(); it != __providerHandleMap.end(); ++it) {
-               delete it->second;
-       }
-       __providerHandleMap.clear();
-}
-
-bool ctx::ContextManagerImpl::registerProvider(const char *subject, ctx::ContextProviderInfo &providerInfo)
-{
-       if (__providerHandleMap.find(subject) != __providerHandleMap.end()) {
-               _E("The provider for the subject '%s' is already registered.", subject);
-               return false;
-       }
-
-       _SI("Subj: %s, Priv: %s", subject, providerInfo.privilege);
-       __providerHandleMap[subject] = NULL;
-
-       auto it = __providerHandleMap.find(subject);
-       ProviderHandler *handle = new(std::nothrow) ProviderHandler(it->first.c_str(), providerInfo);
-
-       if (!handle) {
-               _E("Memory allocation failed");
-               __providerHandleMap.erase(it);
-               return false;
-       }
-
-       it->second = handle;
-       return true;
-}
-
-bool ctx::ContextManagerImpl::unregisterProvider(const char *subject)
-{
-       auto it = __providerHandleMap.find(subject);
-       if (it == __providerHandleMap.end()) {
-               _E("The provider for the subject '%s' is not found.", subject);
-               return false;
-       }
-
-       delete it->second;
-       __providerHandleMap.erase(it);
-
-       return true;
-}
-
-bool ctx::ContextManagerImpl::registerTriggerItem(const char *subject, int operation, ctx::Json attributes, ctx::Json options, const char* owner)
-{
-       IF_FAIL_RETURN_TAG(subject, false, _E, "Invalid parameter");
-
-       if (!__initialized) {
-               __triggerItemList.push_back(TriggerItemFormat(subject, operation, attributes, options, (owner)? owner : ""));
-       } else {
-               ctx::trigger::TemplateManager* tmplMgr = ctx::trigger::TemplateManager::getInstance();
-               IF_FAIL_RETURN_TAG(tmplMgr, false, _E, "Memory allocation failed");
-               tmplMgr->registerTemplate(subject, operation, attributes, options, owner);
-       }
-
-       return true;
-}
-
-bool ctx::ContextManagerImpl::unregisterTriggerItem(const char *subject)
-{
-       IF_FAIL_RETURN_TAG(subject, false, _E, "Invalid parameter");
-
-       if (!__initialized) {
-               __triggerItemList.push_back(TriggerItemFormat(subject));
-       } else {
-               ctx::trigger::TemplateManager* tmplMgr = ctx::trigger::TemplateManager::getInstance();
-               IF_FAIL_RETURN_TAG(tmplMgr, false, _E, "Memory allocation failed");
-               tmplMgr->unregisterTemplate(subject);
-       }
-
-       return true;
-}
-
-bool ctx::ContextManagerImpl::popTriggerItem(std::string &subject, int &operation, ctx::Json &attributes, ctx::Json &options, std::string& owner, bool& unregister)
-{
-       IF_FAIL_RETURN(!__triggerItemList.empty(), false);
-
-       TriggerItemFormat format = __triggerItemList.front();
-       __triggerItemList.pop_front();
-
-       subject = format.subject;
-       operation = format.operation;
-       attributes = format.attributes;
-       options = format.options;
-       owner = format.owner;
-       unregister = format.unregister;
-
-       return true;
-}
-
-void ctx::ContextManagerImpl::assignRequest(ctx::RequestInfo* request)
-{
-       if (__handleCustomRequest(request)) {
-               delete request;
-               return;
-       }
-
-       auto it = __providerHandleMap.find(request->getSubject());
-       if (it == __providerHandleMap.end()) {
-               _W("Unsupported subject");
-               request->reply(ERR_NOT_SUPPORTED);
-               delete request;
-               return;
-       }
-
-       if (!it->second->isAllowed(request->getCredentials())) {
-               _W("Permission denied");
-               request->reply(ERR_PERMISSION_DENIED);
-               delete request;
-               return;
-       }
-
-       switch (request->getType()) {
-       case REQ_SUBSCRIBE:
-               it->second->subscribe(request);
-               break;
-       case REQ_UNSUBSCRIBE:
-               it->second->unsubscribe(request);
-               break;
-       case REQ_READ:
-       case REQ_READ_SYNC:
-               it->second->read(request);
-               break;
-       case REQ_WRITE:
-               it->second->write(request);
-               break;
-       case REQ_SUPPORT:
-               request->reply(ERR_NONE);
-               delete request;
-               break;
-       default:
-               _E("Invalid type of request");
-               delete request;
-       }
-}
-
-bool ctx::ContextManagerImpl::isSupported(const char *subject)
-{
-       auto it = __providerHandleMap.find(subject);
-       return (it != __providerHandleMap.end());
-}
-
-bool ctx::ContextManagerImpl::isAllowed(const ctx::Credentials *creds, const char *subject)
-{
-       IF_FAIL_RETURN(creds, true);    /* In case internal requests */
-       auto it = __providerHandleMap.find(subject);
-       IF_FAIL_RETURN(it != __providerHandleMap.end(), false);
-       return it->second->isAllowed(creds);
-}
-
-void ctx::ContextManagerImpl::__publish(const char* subject, ctx::Json &option, int error, ctx::Json &dataUpdated)
-{
-       _I("Publishing '%s'", subject);
-       _J("Option", option);
-
-       auto it = __providerHandleMap.find(subject);
-       IF_FAIL_VOID(it != __providerHandleMap.end());
-
-       it->second->publish(option, error, dataUpdated);
-}
-
-void ctx::ContextManagerImpl::__replyToRead(const char* subject, ctx::Json &option, int error, ctx::Json &dataRead)
-{
-       _I("Sending data of '%s'", subject);
-       _J("Option", option);
-       _J("Data", dataRead);
-
-       auto it = __providerHandleMap.find(subject);
-       IF_FAIL_VOID(it != __providerHandleMap.end());
-
-       it->second->replyToRead(option, error, dataRead);
-}
-
-struct PublishedData {
-       int type;
-       ctx::ContextManagerImpl *mgr;
-       std::string subject;
-       int error;
-       ctx::Json option;
-       ctx::Json data;
-       PublishedData(int t, ctx::ContextManagerImpl *m, const char* s, ctx::Json& o, int e, ctx::Json& d)
-               : type(t), mgr(m), subject(s), error(e)
-       {
-               option = o.str();
-               data = d.str();
-       }
-};
-
-gboolean ctx::ContextManagerImpl::__threadSwitcher(gpointer data)
-{
-       PublishedData *tuple = static_cast<PublishedData*>(data);
-
-       switch (tuple->type) {
-       case REQ_SUBSCRIBE:
-               tuple->mgr->__publish(tuple->subject.c_str(), tuple->option, tuple->error, tuple->data);
-               break;
-       case REQ_READ:
-               tuple->mgr->__replyToRead(tuple->subject.c_str(), tuple->option, tuple->error, tuple->data);
-               break;
-       default:
-               _W("Invalid type");
-       }
-
-       delete tuple;
-       return FALSE;
-}
-
-bool ctx::ContextManagerImpl::publish(const char* subject, ctx::Json& option, int error, ctx::Json& dataUpdated)
-{
-       IF_FAIL_RETURN_TAG(subject, false, _E, "Invalid parameter");
-
-       PublishedData *tuple = new(std::nothrow) PublishedData(REQ_SUBSCRIBE, this, subject, option, error, dataUpdated);
-       IF_FAIL_RETURN_TAG(tuple, false, _E, "Memory allocation failed");
-
-       g_idle_add(__threadSwitcher, tuple);
-
-       return true;
-}
-
-bool ctx::ContextManagerImpl::replyToRead(const char* subject, ctx::Json& option, int error, ctx::Json& dataRead)
-{
-       IF_FAIL_RETURN_TAG(subject, false, _E, "Invalid parameter");
-
-       PublishedData *tuple = new(std::nothrow) PublishedData(REQ_READ, this, subject, option, error, dataRead);
-       IF_FAIL_RETURN_TAG(tuple, false, _E, "Memory allocation failed");
-
-       g_idle_add(__threadSwitcher, tuple);
-
-       return true;
-}
-
-bool ctx::ContextManagerImpl::__handleCustomRequest(ctx::RequestInfo* request)
-{
-       std::string subject = request->getSubject();
-       IF_FAIL_RETURN( subject == CONTEXT_TRIGGER_SUBJECT_CUSTOM_ADD ||
-                                       subject == CONTEXT_TRIGGER_SUBJECT_CUSTOM_REMOVE ||
-                                       subject == CONTEXT_TRIGGER_SUBJECT_CUSTOM_PUBLISH, false);
-
-       const char* pkg_id = request->getPackageId();
-       if (pkg_id == NULL) {
-               request->reply(ERR_OPERATION_FAILED);
-               return true;
-       }
-
-       ctx::Json desc = request->getDescription();
-       std::string name;
-       desc.get(NULL, CT_CUSTOM_NAME, &name);
-       std::string subj = pkg_id + std::string("::") + name;
-
-       int error = ERR_NONE;
-       if (subject == CONTEXT_TRIGGER_SUBJECT_CUSTOM_ADD) {
-               ctx::Json tmpl;
-               desc.get(NULL, CT_CUSTOM_ATTRIBUTES, &tmpl);
-
-               error = ctx::custom_context_provider::addItem(subj, name, tmpl, pkg_id);
-       } else if (subject == CONTEXT_TRIGGER_SUBJECT_CUSTOM_REMOVE) {
-               error = ctx::custom_context_provider::removeItem(subj);
-               if (error == ERR_NONE) {
-                       ctx::Json data;
-                       data.set(NULL, CT_CUSTOM_SUBJECT, subj);
-                       request->reply(error, data);
-               }
-       } else if (subject == CONTEXT_TRIGGER_SUBJECT_CUSTOM_PUBLISH) {
-               ctx::Json fact;
-               desc.get(NULL, CT_CUSTOM_FACT, &fact);
-
-               error = ctx::custom_context_provider::publishData(subj, fact);
-       }
-
-       request->reply(error);
-       return true;
-}
diff --git a/src/ContextManagerImpl.h b/src/ContextManagerImpl.h
deleted file mode 100644 (file)
index ab4b377..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _CONTEXT_MANAGER_IMPL_H_
-#define _CONTEXT_MANAGER_IMPL_H_
-
-#include <string>
-#include <map>
-#include <glib.h>
-#include <ContextManager.h>
-#include <IContextManager.h>
-
-namespace ctx {
-
-       /* Forward declaration */
-       class Credentials;
-       class RequestInfo;
-       class ProviderHandler;
-
-       class ContextManagerImpl : public IContextManager {
-       public:
-               ContextManagerImpl();
-               ~ContextManagerImpl();
-
-               bool init();
-               void release();
-
-               void assignRequest(ctx::RequestInfo *request);
-               bool isSupported(const char *subject);
-               bool isAllowed(const Credentials *creds, const char *subject);
-               bool popTriggerItem(std::string &subject, int &operation, ctx::Json &attributes, ctx::Json &options, std::string &owner, bool& unregister);
-
-               /* From the interface class */
-               bool registerProvider(const char *subject, ContextProviderInfo &providerInfo);
-               bool unregisterProvider(const char *subject);
-               bool registerTriggerItem(const char *subject, int operation, ctx::Json attributes, ctx::Json options, const char *owner = NULL);
-               bool unregisterTriggerItem(const char *subject);
-               bool publish(const char *subject, ctx::Json &option, int error, ctx::Json &dataUpdated);
-               bool replyToRead(const char *subject, ctx::Json &option, int error, ctx::Json &dataRead);
-
-       private:
-               std::map<std::string, ProviderHandler*> __providerHandleMap;
-               static bool __initialized;
-
-               static gboolean __threadSwitcher(gpointer data);
-               void __publish(const char *subject, ctx::Json &option, int error, ctx::Json &dataUpdated);
-               void __replyToRead(const char *subject, ctx::Json &option, int error, ctx::Json &dataRead);
-
-               /* For custom request */
-               bool __handleCustomRequest(ctx::RequestInfo* request);
-       };      /* class ContextManagerImpl */
-
-}      /* namespace ctx */
-
-#endif /* End of __CONTEXT_MANAGER_IMPL_H__ */
index fd92e623e9aa67a21a10fdfd7631baadb3296594..8742495bc87dbf97427c0d587bd7dd47412a61db 100644 (file)
 
 #include <glib.h>
 #include <Types.h>
-#include <Json.h>
 #include "access_control/Privilege.h"
-#include "Server.h"
 #include "Request.h"
 #include "ProviderHandler.h"
 
-ctx::ProviderHandler::ProviderHandler(const char *subj, ctx::ContextProviderInfo &prvd) :
-       __subject(subj),
-       __providerInfo(prvd)
+using namespace ctx;
+
+ProviderHandler::ProviderHandler(const char *subject, const char *privilege, ContextProvider *provider) :
+       __subject(subject),
+       __privilege(privilege),
+       __provider(provider)
 {
 }
 
-ctx::ProviderHandler::~ProviderHandler()
+ProviderHandler::~ProviderHandler()
 {
-       for (auto it = __subscribeRequests.begin(); it != __subscribeRequests.end(); ++it) {
-               delete *it;
+       for (RequestInfo*& info : __subscribeRequests) {
+               delete info;
        }
        __subscribeRequests.clear();
 
-       for (auto it = __readRequests.begin(); it != __readRequests.end(); ++it) {
-               delete *it;
+       for (RequestInfo*& info : __readRequests) {
+               delete info;
        }
        __readRequests.clear();
 
-       __providerInfo.destroy(__providerInfo.data);
+       delete __provider;
 }
 
-bool ctx::ProviderHandler::isAllowed(const ctx::Credentials *creds)
+bool ProviderHandler::isAllowed(const Credentials *creds)
 {
        IF_FAIL_RETURN(creds, true);    /* In case of internal requests */
-       return privilege_manager::isAllowed(creds, __providerInfo.privilege);
+       return privilege_manager::isAllowed(creds, __privilege);
 }
 
-ctx::ContextProviderBase* ctx::ProviderHandler::__getProvider(ctx::RequestInfo *request)
+ContextProvider* ProviderHandler::__getProvider(RequestInfo *request)
 {
-       ContextProviderBase *provider = __providerInfo.create(__providerInfo.data);
-       if (!provider) {
-               _E("Memory allocation failed");
-               delete request;
-               return NULL;
-       }
-
-       return provider;
+       /* TODO: When implementing dynamic so loading... */
+       return __provider;
 }
 
-void ctx::ProviderHandler::subscribe(ctx::RequestInfo *request)
+void ProviderHandler::subscribe(RequestInfo *request)
 {
        _I(CYAN("'%s' subscribes '%s' (RID-%d)"), request->getClient(), __subject, request->getId());
 
-       ContextProviderBase *provider = __getProvider(request);
+       ContextProvider *provider = __getProvider(request);
        IF_FAIL_VOID(provider);
 
-       ctx::Json requestResult;
-       int error = provider->subscribe(__subject, request->getDescription().str(), &requestResult);
+       Json requestResult;
+       int error = provider->subscribe(request->getDescription().str(), &requestResult);
 
        if (!request->reply(error, requestResult) || error != ERR_NONE) {
                delete request;
@@ -79,11 +74,11 @@ void ctx::ProviderHandler::subscribe(ctx::RequestInfo *request)
        __subscribeRequests.push_back(request);
 }
 
-void ctx::ProviderHandler::unsubscribe(ctx::RequestInfo *request)
+void ProviderHandler::unsubscribe(RequestInfo *request)
 {
        _I(CYAN("'%s' unsubscribes '%s' (RID-%d)"), request->getClient(), __subject, request->getId());
 
-       // Search the subscribe request to be removed
+       /* Search the subscribe request to be removed */
        auto target = __findRequest(__subscribeRequests, request->getClient(), request->getId());
        if (target == __subscribeRequests.end()) {
                _W("Unknown request");
@@ -91,42 +86,42 @@ void ctx::ProviderHandler::unsubscribe(ctx::RequestInfo *request)
                return;
        }
 
-       // Keep the pointer to the request found
-       RequestInfo *req_found = *target;
+       /* Keep the pointer to the request found */
+       RequestInfo *reqFound = *target;
 
-       // Remove the request from the list
+       /* Remove the request from the list */
        __subscribeRequests.erase(target);
 
-       // Check if there exist the same requests
-       if (__findRequest(__subscribeRequests, req_found->getDescription()) != __subscribeRequests.end()) {
-               // Do not stop detecting the subject
-               _D("A same request from '%s' exists", req_found->getClient());
+       /* Check if there exist the same requests */
+       if (__findRequest(__subscribeRequests, reqFound->getDescription()) != __subscribeRequests.end()) {
+               /* Do not stop detecting the subject */
+               _D("A same request from '%s' exists", reqFound->getClient());
                request->reply(ERR_NONE);
                delete request;
-               delete req_found;
+               delete reqFound;
                return;
        }
 
-       // Get the provider
-       ContextProviderBase *provider = __getProvider(request);
+       /* Get the provider */
+       ContextProvider *provider = __getProvider(request);
        IF_FAIL_VOID(provider);
 
-       // Stop detecting the subject
-       int error = provider->unsubscribe(__subject, req_found->getDescription());
+       /* Stop detecting the subject */
+       int error = provider->unsubscribe(reqFound->getDescription());
        request->reply(error);
        delete request;
-       delete req_found;
+       delete reqFound;
 }
 
-void ctx::ProviderHandler::read(ctx::RequestInfo *request)
+void ProviderHandler::read(RequestInfo *request)
 {
        _I(CYAN("'%s' reads '%s' (RID-%d)"), request->getClient(), __subject, request->getId());
 
-       ContextProviderBase *provider = __getProvider(request);
+       ContextProvider *provider = __getProvider(request);
        IF_FAIL_VOID(provider);
 
-       ctx::Json requestResult;
-       int error = provider->read(__subject, request->getDescription().str(), &requestResult);
+       Json requestResult;
+       int error = provider->read(request->getDescription().str(), &requestResult);
 
        if (!request->reply(error, requestResult) || error != ERR_NONE) {
                delete request;
@@ -136,21 +131,21 @@ void ctx::ProviderHandler::read(ctx::RequestInfo *request)
        __readRequests.push_back(request);
 }
 
-void ctx::ProviderHandler::write(ctx::RequestInfo *request)
+void ProviderHandler::write(RequestInfo *request)
 {
        _I(CYAN("'%s' writes '%s' (RID-%d)"), request->getClient(), __subject, request->getId());
 
-       ContextProviderBase *provider = __getProvider(request);
+       ContextProvider *provider = __getProvider(request);
        IF_FAIL_VOID(provider);
 
-       ctx::Json requestResult;
-       int error = provider->write(__subject, request->getDescription(), &requestResult);
+       Json requestResult;
+       int error = provider->write(request->getDescription(), &requestResult);
 
        request->reply(error, requestResult);
        delete request;
 }
 
-bool ctx::ProviderHandler::publish(ctx::Json &option, int error, ctx::Json &dataUpdated)
+bool ProviderHandler::publish(Json &option, int error, Json &dataUpdated)
 {
        auto end = __subscribeRequests.end();
        auto target = __findRequest(__subscribeRequests.begin(), end, option);
@@ -165,13 +160,13 @@ bool ctx::ProviderHandler::publish(ctx::Json &option, int error, ctx::Json &data
        return true;
 }
 
-bool ctx::ProviderHandler::replyToRead(ctx::Json &option, int error, ctx::Json &dataRead)
+bool ProviderHandler::replyToRead(Json &option, int error, Json &dataRead)
 {
        auto end = __readRequests.end();
        auto target = __findRequest(__readRequests.begin(), end, option);
        auto prev = target;
 
-       ctx::Json dummy;
+       Json dummy;
 
        while (target != end) {
                (*target)->reply(error, dummy, dataRead);
@@ -185,14 +180,14 @@ bool ctx::ProviderHandler::replyToRead(ctx::Json &option, int error, ctx::Json &
        return true;
 }
 
-ctx::ProviderHandler::RequestList::iterator
-ctx::ProviderHandler::__findRequest(RequestList &reqList, Json &option)
+ProviderHandler::RequestList::iterator
+ProviderHandler::__findRequest(RequestList &reqList, Json &option)
 {
        return __findRequest(reqList.begin(), reqList.end(), option);
 }
 
-ctx::ProviderHandler::RequestList::iterator
-ctx::ProviderHandler::__findRequest(RequestList &reqList, std::string client, int reqId)
+ProviderHandler::RequestList::iterator
+ProviderHandler::__findRequest(RequestList &reqList, std::string client, int reqId)
 {
        for (auto it = reqList.begin(); it != reqList.end(); ++it) {
                if (client == (*it)->getClient() && reqId == (*it)->getId()) {
@@ -202,8 +197,8 @@ ctx::ProviderHandler::__findRequest(RequestList &reqList, std::string client, in
        return reqList.end();
 }
 
-ctx::ProviderHandler::RequestList::iterator
-ctx::ProviderHandler::__findRequest(RequestList::iterator begin, RequestList::iterator end, Json &option)
+ProviderHandler::RequestList::iterator
+ProviderHandler::__findRequest(RequestList::iterator begin, RequestList::iterator end, Json &option)
 {
        for (auto it = begin; it != end; ++it) {
                if (option == (*it)->getDescription()) {
index d2524bca00f59bf219f88659758ea80d8f309ba7..d8cea264d3e778863a23f4290207eb6186d596d7 100644 (file)
 
 #include <string>
 #include <list>
-#include <ContextProviderBase.h>
+#include <ContextProvider.h>
 
 namespace ctx {
 
-       class Json;
        class Credentials;
        class RequestInfo;
 
@@ -31,7 +30,7 @@ namespace ctx {
        public:
                typedef std::list<RequestInfo*> RequestList;
 
-               ProviderHandler(const char *subj, ContextProviderInfo &prvd);
+               ProviderHandler(const char *subject, const char *privilege, ContextProvider *provider);
                ~ProviderHandler();
 
                bool isAllowed(const Credentials *creds);
@@ -46,11 +45,12 @@ namespace ctx {
 
        private:
                const char *__subject;
-               ContextProviderInfo __providerInfo;
+               const char *__privilege;
+               ContextProvider *__provider;
                RequestList __subscribeRequests;
                RequestList __readRequests;
 
-               ContextProviderBase* __getProvider(RequestInfo *request);
+               ContextProvider* __getProvider(RequestInfo *request);
                RequestList::iterator __findRequest(RequestList &reqList, Json &option);
                RequestList::iterator __findRequest(RequestList &reqList, std::string client, int reqId);
                RequestList::iterator __findRequest(RequestList::iterator begin, RequestList::iterator end, Json &option);
index 879d2946a2048a3b64f92c68f82e50004d42249c..2617a4f80ad5f648647ba744ee88f450f21e4c05 100644 (file)
 
 #include <Types.h>
 #include "DBusServer.h"
-#include "ContextManagerImpl.h"
+#include "ContextManager.h"
 #include "trigger/Trigger.h"
 #include "Server.h"
 
 static GMainLoop *mainloop = NULL;
 static bool started = false;
 
-static ctx::ContextManagerImpl *__contextMgr = NULL;
+static ctx::ContextManager *__contextMgr = NULL;
 static ctx::DBusServer *__dbusHandle = NULL;
 static ctx::trigger::Trigger *__contextTrigger = NULL;
 
@@ -55,9 +55,8 @@ void ctx::Server::activate()
        bool result = false;
 
        _I("Init Context Manager");
-       __contextMgr = new(std::nothrow) ctx::ContextManagerImpl();
+       __contextMgr = new(std::nothrow) ctx::ContextManager();
        IF_FAIL_CATCH_TAG(__contextMgr, _E, "Memory allocation failed");
-       context_manager::setInstance(__contextMgr);
        result = __contextMgr->init();
        IF_FAIL_CATCH_TAG(result, _E, "Initialization Failed");
 
index 386eaa4713d0c4991dd07f6f039f8febe050bbe4..56f5eede7d116739773897e2db510bc94a86fef6 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <Types.h>
 #include "../access_control/Privilege.h"
-#include "../ContextManagerImpl.h"
+#include "../ContextManager.h"
 #include "ContextMonitor.h"
 #include "IContextListener.h"
 #include "FactRequest.h"
@@ -28,7 +28,7 @@ static int __lastRid;
 static int __lastErr;
 
 ContextMonitor *ContextMonitor::__instance = NULL;
-ContextManagerImpl *ContextMonitor::__contextMgr = NULL;
+ContextManager *ContextMonitor::__contextMgr = NULL;
 
 static int __generateReqId()
 {
@@ -50,7 +50,7 @@ ContextMonitor::~ContextMonitor()
 {
 }
 
-void ContextMonitor::setContextManager(ContextManagerImpl* ctx_mgr)
+void ContextMonitor::setContextManager(ContextManager* ctx_mgr)
 {
        __contextMgr = ctx_mgr;
 }
index a681d693a144aa2152c92b8259902630f27d1986..d3c696681bfdc86ad532cc87c07aef5babb89654 100644 (file)
@@ -24,7 +24,7 @@
 
 namespace ctx {
 
-       class ContextManagerImpl;
+       class ContextManager;
 
 namespace trigger {
 
@@ -34,7 +34,7 @@ namespace trigger {
        class ContextMonitor {
        public:
                static ContextMonitor* getInstance();
-               static void setContextManager(ContextManagerImpl* ctx_mgr);
+               static void setContextManager(ContextManager* ctx_mgr);
                static void destroy();
 
                int subscribe(int ruleId, std::string subject, Json option, IContextListener* listener);
@@ -53,7 +53,7 @@ namespace trigger {
                ~ContextMonitor();
 
                static ContextMonitor *__instance;
-               static ContextManagerImpl *__contextMgr;
+               static ContextManager *__contextMgr;
 
                int __subscribe(const char* subject, Json* option, IContextListener* listener);
                void __unsubscribe(const char *subject, int subscriptionId);
index 176165063f1a6da480c3b07ef4cfe1bf7c708c4c..51dcb6cc69b66aad45703ac7079e0bd364024768 100644 (file)
@@ -17,7 +17,7 @@
 #include <sstream>
 #include <Types.h>
 #include <context_trigger_types_internal.h>
-#include "../ContextManagerImpl.h"
+#include "../ContextManager.h"
 #include "RuleManager.h"
 #include "TemplateManager.h"
 
@@ -25,7 +25,7 @@ using namespace ctx;
 using namespace ctx::trigger;
 
 TemplateManager *TemplateManager::__instance = NULL;
-ContextManagerImpl *TemplateManager::__contextMgr = NULL;
+ContextManager *TemplateManager::__contextMgr = NULL;
 RuleManager *TemplateManager::__ruleMgr = NULL;
 
 static std::string __intToString(int i)
@@ -44,7 +44,7 @@ TemplateManager::~TemplateManager()
 {
 }
 
-void TemplateManager::setManager(ContextManagerImpl* ctxMgr, RuleManager* ruleMgr)
+void TemplateManager::setManager(ContextManager* ctxMgr, RuleManager* ruleMgr)
 {
        __contextMgr = ctxMgr;
        __ruleMgr = ruleMgr;
index 22d1b32b6e80130eafd16549af1c1296557ca6f5..c91ef15ae796035f0b37c38d479224224de2fe2d 100644 (file)
@@ -22,7 +22,7 @@
 
 namespace ctx {
 
-       class ContextManagerImpl;
+       class ContextManager;
 
 namespace trigger {
 
@@ -31,7 +31,7 @@ namespace trigger {
        class TemplateManager {
        public:
                static TemplateManager* getInstance();
-               static void setManager(ContextManagerImpl* ctxMgr, RuleManager* ruleMgr);
+               static void setManager(ContextManager* ctxMgr, RuleManager* ruleMgr);
                static void destroy();
 
                bool init();
@@ -46,7 +46,7 @@ namespace trigger {
                ~TemplateManager();
 
                static TemplateManager *__instance;
-               static ContextManagerImpl *__contextMgr;
+               static ContextManager *__contextMgr;
                static RuleManager *__ruleMgr;
 
                DatabaseManager __dbManager;
index 7cfdbe2614160d5272b9521026b02b16aa96be0e..ac56d3c02c73e2d0af1ca5f3e94b2f021e85f708 100644 (file)
@@ -33,7 +33,7 @@ Trigger::~Trigger()
 {
 }
 
-bool Trigger::init(ContextManagerImpl* ctxMgr)
+bool Trigger::init(ContextManager* ctxMgr)
 {
        // Do the necessary initialization process.
        // This function is called from the main thread during the service launching process.
@@ -99,7 +99,7 @@ void Trigger::__processRequest(RequestInfo* request)
        }
 }
 
-void Trigger::__processInitialize(ContextManagerImpl* mgr)
+void Trigger::__processInitialize(ContextManager* mgr)
 {
        // Context Monitor
        ContextMonitor::setContextManager(mgr);
index 984c9bd3ec0e420f6f9ab1e0bab7928cd5013120..161c99e35bc3eab23b001e62947cdd33eee9a418 100644 (file)
@@ -22,7 +22,7 @@
 namespace ctx {
 
        class client_request;
-       class ContextManagerImpl;
+       class ContextManager;
 
 namespace trigger {
 
@@ -33,14 +33,14 @@ namespace trigger {
                        Trigger();
                        ~Trigger();
 
-                       bool init(ContextManagerImpl* ctxMgr);
+                       bool init(ContextManager* ctxMgr);
                        void release();
 
                        bool assignRequest(RequestInfo* request);
 
                private:
                        void __processRequest(RequestInfo* request);
-                       void __processInitialize(ContextManagerImpl* mgr);
+                       void __processInitialize(ContextManager* mgr);
 
                        void __addRule(RequestInfo* request);
                        void __removeRule(RequestInfo* request);