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.
17 package org.oic.simulator;
19 import org.oic.simulator.clientcontroller.IFindResourceListener;
20 import org.oic.simulator.serviceprovider.IResourceModelChangedListener;
21 import org.oic.simulator.serviceprovider.SimulatorResourceServer;
24 * This class provides a set of native functions for creation, discovery and
25 * deletion of resources.
27 class SimulatorManagerNativeInterface {
30 * Native function for creating a resource.
33 * Path to RAML configuration file.
35 * Listener for receiving notifications whenever there is a
36 * change in the resource model.
38 * @return {@link SimulatorResourceServer} object on success, otherwise
41 * @throws InvalidArgsException
42 * Thrown if the input parameters are empty.
43 * @throws SimulatorException
44 * Thrown for other errors.
46 public static native SimulatorResourceServer createResource(
47 String configPath, IResourceModelChangedListener listener)
48 throws InvalidArgsException, SimulatorException;
51 * Native function for creating several resources.
54 * Path to RAML configuration file.
56 * Number of instances.
58 * Listener for receiving notifications whenever there is a
59 * change in the resource model.
61 * @return An array of {@link SimulatorResourceServer} objects on success,
64 * @throws InvalidArgsException
65 * Thrown if the input parameters are empty.
66 * @throws SimulatorException
67 * Thrown for other errors.
69 public static native SimulatorResourceServer[] createResources(
70 String configPath, int count, IResourceModelChangedListener listener)
71 throws InvalidArgsException, SimulatorException;
74 * Native function to delete a specific resource.
77 * {@link SimulatorResourceServer} object of the resource to be
80 * @throws InvalidArgsException
81 * Thrown if the input parameter is empty.
82 * @throws SimulatorException
83 * Thrown for other errors.
85 public static native void deleteResource(SimulatorResourceServer resource)
86 throws InvalidArgsException, SimulatorException;
89 * Native function to delete all resources or resources of a specific type.
92 * Type of the resource.
94 * @throws InvalidArgsException
95 * Thrown if the input parameter is empty.
96 * @throws SimulatorException
97 * Thrown for other errors.
99 public static native void deleteResources(String resourceType)
100 throws SimulatorException;
103 * Native function for discovering resources.
105 * @param resourceType
106 * required resource type
108 * Interface to receive the discovered remote resources.
110 * @throws InvalidArgsException
111 * Thrown if the input parameter is empty.
112 * @throws SimulatorException
113 * Thrown for other errors.
115 public static native void findResource(String resourceType,
116 IFindResourceListener listener) throws InvalidArgsException,
120 * Native function to set the logger listener for receiving the log messages
124 * Interface to receive log.
126 public static native void setLogger(ILogger logger);
129 * Native function to set the device information.
132 * Device information.
134 public static native void setDeviceInfo(String deviceInfo);
137 * Native function to get the device information asynchronously via the
141 * Interface for receiving the device information.
143 public static native void getDeviceInfo(IDeviceInfo listener);
146 * Native function to set the platform information.
148 * @param platformInfo
149 * Platform information.
151 public static native void setPlatformInfo(PlatformInfo platformInfo);
154 * Native function to get the platform information asynchronously via the
158 * Interface for receiving the platform information.
160 public static native void getPlatformInfo(IPlatformInfo listener);