Add ContextPublisher::isObservable() 10/141210/1
authorMu-Woong Lee <muwoong.lee@samsung.com>
Fri, 28 Jul 2017 13:45:05 +0000 (22:45 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Fri, 28 Jul 2017 13:45:05 +0000 (22:45 +0900)
Change-Id: I032fca150218b09f8d8f01992fa196598fcab004
Signed-off-by: Mu-Woong Lee <muwoong.lee@samsung.com>
src/server/ContextPublisher.cpp
src/server/ContextPublisher.h
src/server/JobManager.cpp

index f25fff0acb6b993d8829a74c7d8b4786d0b03a9e..355dfb9e5415dfe4a741aa8d12dde476927fb77e 100644 (file)
@@ -90,6 +90,12 @@ const char* ContextPublisher::getPrivilege() const
        return NULL;
 }
 
+bool ContextPublisher::isObservable() const
+{
+       // Most context items are observable, that is, can be used as triggers.
+       return true;
+}
+
 bool ContextPublisher::isReadable() const
 {
        // Most context items are directly readable without subscribing them.
index 8401a8ec946209ad4a90d298f62b654fe497ef7e..7b85bdbb8f3c547bee9363d9209e568c68c43494 100644 (file)
@@ -46,9 +46,14 @@ namespace ctx {
                virtual const char* getUri() const = 0;
                virtual const char* getPrivilege() const;
 
-               // If not readable, it cannot be used as a requirement
+
+               // If not observable, it cannot be used as a trigger.
+               virtual bool isObservable() const;
+               // If not readable, it cannot be used as a requirement.
                virtual bool isReadable() const;
+               // If writable, clients are able to publish their data via this.
                virtual bool isWritable() const;
+               // If it is a user context, its instance will be created for each user.
                virtual bool isUserContext() const;
 
                virtual bool isReady();
index 1952a43fa1bf51fd81028399c8db098d16e1e92b..f2974b300a7a84920959f5155fff91dd6d21607a 100644 (file)
@@ -102,6 +102,9 @@ bool JobManager::isSupported(JobContext::Type type, const std::string& uri, ICli
        ContextPublisher* pubs = ContextManager::getPublisher(uri, client->getUid());
        IF_FAIL_RETURN(pubs, false);
 
+       if (type == JobContext::Type::TRIGGER && !pubs->isObservable())
+               return false;
+
        if (type == JobContext::Type::REQUIREMENT && !pubs->isReadable())
                return false;