Java SDK and Eclipse plugin for simulator.
[platform/upstream/iotivity.git] / service / simulator / java / sdk / src / org / oic / simulator / SimulatorManagerNativeInterface.java
1 /*
2  * Copyright 2015 Samsung Electronics All Rights Reserved.
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.oic.simulator;
18
19 import org.oic.simulator.clientcontroller.IFindResourceListener;
20 import org.oic.simulator.serviceprovider.IResourceModelChangedListener;
21 import org.oic.simulator.serviceprovider.SimulatorResourceServer;
22
23 /**
24  * This class provides a set of native functions for creation, discovery and
25  * deletion of resources.
26  */
27 class SimulatorManagerNativeInterface {
28
29     /**
30      * Native function for creating a resource.
31      *
32      * @param configPath
33      *            Path to RAML configuration file.
34      * @param listener
35      *            Listener for receiving notifications whenever there is a
36      *            change in the resource model.
37      *
38      * @return {@link SimulatorResourceServer} object on success, otherwise
39      *         null.
40      * 
41      * @throws InvalidArgsException
42      *             Thrown if the input parameters are empty.
43      * @throws SimulatorException
44      *             Thrown for other errors.
45      */
46     public static native SimulatorResourceServer createResource(
47             String configPath, IResourceModelChangedListener listener)
48             throws InvalidArgsException, SimulatorException;
49
50     /**
51      * Native function for creating several resources.
52      *
53      * @param configPath
54      *            Path to RAML configuration file.
55      * @param count
56      *            Number of instances.
57      * @param listener
58      *            Listener for receiving notifications whenever there is a
59      *            change in the resource model.
60      *
61      * @return An array of {@link SimulatorResourceServer} objects on success,
62      *         otherwise null.
63      *
64      * @throws InvalidArgsException
65      *             Thrown if the input parameters are empty.
66      * @throws SimulatorException
67      *             Thrown for other errors.
68      */
69     public static native SimulatorResourceServer[] createResources(
70             String configPath, int count, IResourceModelChangedListener listener)
71             throws InvalidArgsException, SimulatorException;
72
73     /**
74      * Native function to delete a specific resource.
75      *
76      * @param resource
77      *            {@link SimulatorResourceServer} object of the resource to be
78      *            deleted.
79      * 
80      * @throws InvalidArgsException
81      *             Thrown if the input parameter is empty.
82      * @throws SimulatorException
83      *             Thrown for other errors.
84      */
85     public static native void deleteResource(SimulatorResourceServer resource)
86             throws InvalidArgsException, SimulatorException;
87
88     /**
89      * Native function to delete all resources or resources of a specific type.
90      *
91      * @param resourceType
92      *            Type of the resource.
93      * 
94      * @throws InvalidArgsException
95      *             Thrown if the input parameter is empty.
96      * @throws SimulatorException
97      *             Thrown for other errors.
98      */
99     public static native void deleteResources(String resourceType)
100             throws InvalidArgsException, SimulatorException;
101
102     /**
103      * Native function for discovering all types of resources.
104      *
105      * @param listener
106      *            Interface to receive the discovered remote resources.
107      * 
108      * @throws InvalidArgsException
109      *             Thrown if the input parameter is empty.
110      * @throws SimulatorException
111      *             Thrown for other errors.
112      */
113     public static native void findResource(IFindResourceListener listener)
114             throws InvalidArgsException, SimulatorException;
115
116     /**
117      * Native function for discovering specific type of resources.
118      *
119      * @param resourceType
120      *            required resource type
121      * @param listener
122      *            Interface to receive the discovered remote resources.
123      * 
124      * @throws InvalidArgsException
125      *             Thrown if the input parameter is empty.
126      * @throws SimulatorException
127      *             Thrown for other errors.
128      */
129     public static native void findResources(String resourceType,
130             IFindResourceListener listener) throws InvalidArgsException,
131             SimulatorException;
132
133     /**
134      * Native function to set the logger listener for receiving the log messages
135      * from native layer.
136      * 
137      * @param logger
138      *            Interface to receive log.
139      */
140     public static native void setLogger(ILogger logger);
141
142     /**
143      * Native function to set the device information.
144      * 
145      * @param deviceInfo
146      *            Device information.
147      */
148     public static native void setDeviceInfo(String deviceInfo);
149
150     /**
151      * Native function to get the device information asynchronously via the
152      * listener.
153      * 
154      * @param listener
155      *            Interface for receiving the device information.
156      */
157     public static native void getDeviceInfo(IDeviceInfo listener);
158
159     /**
160      * Native function to set the platform information.
161      * 
162      * @param platformInfo
163      *            Platform information.
164      */
165     public static native void setPlatformInfo(PlatformInfo platformInfo);
166
167     /**
168      * Native function to get the platform information asynchronously via the
169      * listener.
170      * 
171      * @param listener
172      *            Interface for receiving the platform information.
173      */
174     public static native void getPlatformInfo(IPlatformInfo listener);
175 }