1 /******************************************************************
3 * Copyright 2015 Samsung Electronics All Rights Reserved.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 ******************************************************************/
21 * @file QueryEngine.java
23 * @brief This file provides a class that represents main interface of Query Engine
27 package org.iotivity.service.ssm;
31 * @brief This class represents main interface of Query Engine to interact with
32 * SSMCore with in turn interacts with the application.
33 * QueryEninge class forms the database from the base to respond to
34 * queries from SSMCore.
37 public class QueryEngine
39 private long pQueryEngineInstance;
41 private QueryEngine(long queryEngineInstance)
43 pQueryEngineInstance = queryEngineInstance;
47 * Obtain the instance value of the called query engine object,
48 * this value is set on creation of the QueryEngine object
50 * @return int - Instance of the query engine object, set on object's creation
53 public long getQueryEngineInstance()
55 return pQueryEngineInstance;
59 * Execute the query with the QueryEngine and return ContextQuery ID
63 * - query string to be executed
65 * @return int - ID of context query executed
68 public int executeContextQuery(String contextQuery) throws Exception
70 return CoreController.getInstance().executeContextQuery(
71 pQueryEngineInstance, contextQuery);
75 * Register QueryEngineEvent to QueryEngine
77 * @param queryEngineEvent
78 * - the event class to receive QueryEngine events
83 public void registerQueryEvent(IQueryEngineEvent queryEngineEvent)
85 CoreController.getInstance().registerQueryEvent(pQueryEngineInstance,
90 * Kill the registered ContextQuery corresponding to the to cqid
93 * - ContextQuery ID of the query to be terminated
98 public void killContextQuery(int cqid) throws Exception
100 CoreController.getInstance().killContextQuery(pQueryEngineInstance,