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 DataReader.java
23 * @brief This file provides a class that represents context model data package's reader
27 package org.iotivity.service.ssm;
29 import java.util.List;
33 * @brief This class represents context model data package's reader and contains
34 * API's to be used by IQueryEngineEvent listeners to handle the model data.
37 public class DataReader
40 private int pDataReaderInstance;
42 public DataReader(int dataReaderInstance)
44 pDataReaderInstance = dataReaderInstance;
48 * Get affected context models. The CQL(context query language) can specify
49 * multiple ContextModels for retrieving data so a list of string of affected
50 * context models is returned
52 * @return List<String> - affected ContextModel list
55 public List<String> getAffectedModels()
57 return CoreController.getInstance().getAffectedModels(
62 * Get affected model data count. There can be multiple data models existing
63 * from the given condition, return the count.
66 * - affected ContextModel name
68 * @return int - affected dataId count
71 public int getModelDataCount(String modelName) throws Exception
73 return CoreController.getInstance().getModelDataCount(
74 pDataReaderInstance, modelName);
78 * Get actual Context Model data
81 * - affected ContextModel name
84 * - affected dataId index
86 * @return ModelData - affected ContextModel data reader
89 public ModelData getModelData(String modelName, int dataIndex)
92 return CoreController.getInstance().getModelData(pDataReaderInstance,
93 modelName, dataIndex);