2 * Copyright 2015 Samsung Electronics All Rights Reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * This file contains a class which has a set of native methods for accessing
21 package org.oic.simulator.serviceprovider;
23 import org.oic.simulator.SimulatorResourceAttribute;
27 * This class represents the resource model of a resource and it provides a set
28 * of native methods for accessing the resource model.
30 public class SimulatorResourceModel {
33 * Handle to the native object of the simulator resource model.
35 private long nativeHandle;
38 * Constructor for SimulatorResourceModel.
41 * Handle to the native SimulatorResourceModel object.
43 private SimulatorResourceModel(long nativeHandle) {
44 this.nativeHandle = nativeHandle;
48 protected void finalize() throws Throwable {
53 * Native function for getting the total count of attributes in the resource
56 * @return Total number of attributes.
58 public native int size();
61 * Native function for getting all attributes of a resource.
63 * @return Map of attributes with attribute name as the key and its
64 * corresponding {@link SimulatorResourceAttribute} object as the
67 public native Map<String, SimulatorResourceAttribute> getAttributes();
70 * Native function to get a specific attribute of a resource. It takes the
71 * attribute name and returns an object of
72 * {@link SimulatorResourceAttribute}.
75 * Name of the attribute
77 * @return An object of SimulatorResourceAttribute.
79 public native SimulatorResourceAttribute getAttribute(String attrName);
82 * Native function to get all the allowed values of a particular attribute.
85 * Name of the attribute
87 * @return An array of all possible values as strings.
89 public native String[] getAllowedValues(String key);
92 * Native function to release the memory allocated to the native object for
93 * SimulatorResourceModel.
95 public native void dispose();