X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=service%2Fsoft-sensor-manager%2FSDK%2Fjava%2Forg%2Fiotivity%2Fservice%2Fssm%2FQueryEngine.java;h=348e51d7107224ea1648dc8241691a05ba86c123;hb=8c01dff2c5bc5496f7dc1632c498943ec6ecb015;hp=a14e6408b5cd4960579d504355aa09dc7190d4b3;hpb=00b3660e45c56cb3db35dc2596a054f801b5591a;p=platform%2Fupstream%2Fiotivity.git diff --git a/service/soft-sensor-manager/SDK/java/org/iotivity/service/ssm/QueryEngine.java b/service/soft-sensor-manager/SDK/java/org/iotivity/service/ssm/QueryEngine.java index a14e640..348e51d 100644 --- a/service/soft-sensor-manager/SDK/java/org/iotivity/service/ssm/QueryEngine.java +++ b/service/soft-sensor-manager/SDK/java/org/iotivity/service/ssm/QueryEngine.java @@ -1,31 +1,103 @@ +/****************************************************************** + * + * Copyright 2015 Samsung Electronics All Rights Reserved. + * + * + * + * 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. + * + ******************************************************************/ +/** + * @file QueryEngine.java + * + * @brief This file provides a class that represents main interface of Query Engine + * + */ + package org.iotivity.service.ssm; +/** +* @class QueryEngine +* @brief This class represents main interface of Query Engine to interact with +* SSMCore with in turn interacts with the application. +* QueryEninge class forms the database from the base to respond to +* queries from SSMCore. +* +*/ public class QueryEngine { - private int pQueryEngineInstance; - - public QueryEngine(int queryEngineInstance) - { - pQueryEngineInstance = queryEngineInstance; - } - - public int GetQueryEngineInstance() - { - return pQueryEngineInstance; - } - - public int ExecuteContextQuery(String contextQuery) - { - return CoreController.getInstance().ExecuteContextQuery(pQueryEngineInstance, contextQuery); - } - - public void RegisterQueryEvent(IQueryEngineEvent queryEngineEvent) - { - CoreController.getInstance().RegisterQueryEvent(pQueryEngineInstance, queryEngineEvent); - } - - public void KillContextQuery(int cqid) - { - CoreController.getInstance().KillContextQuery(pQueryEngineInstance, cqid); - } + private int pQueryEngineInstance; + + public QueryEngine(int queryEngineInstance) + { + pQueryEngineInstance = queryEngineInstance; + } + + /** + * Obtain the instance value of the called query engine object, + * this value is set on creation of the QueryEngine object + * + * @return int - Instance of the query engine object, set on object's creation + * + */ + public int getQueryEngineInstance() + { + return pQueryEngineInstance; + } + + /** + * Execute the query with the QueryEngine and return ContextQuery ID + * for the query + * + * @param contextQuery + * - query string to be executed + * + * @return int - ID of context query executed + * + */ + public int executeContextQuery(String contextQuery) throws Exception + { + return CoreController.getInstance().executeContextQuery( + pQueryEngineInstance, contextQuery); + } + + /** + * Register QueryEngineEvent to QueryEngine + * + * @param queryEngineEvent + * - the event class to receive QueryEngine events + * + * @return void + * + */ + public void registerQueryEvent(IQueryEngineEvent queryEngineEvent) + { + CoreController.getInstance().registerQueryEvent(pQueryEngineInstance, + queryEngineEvent); + } + + /** + * Kill the registered ContextQuery corresponding to the to cqid + * + * @param cqid + * - ContextQuery ID of the query to be terminated + * + * @return void + * + */ + public void killContextQuery(int cqid) throws Exception + { + CoreController.getInstance().killContextQuery(pQueryEngineInstance, + cqid); + } } \ No newline at end of file