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 provides a set of native methods
19 * for creation and deletion of resources.
21 package org.oic.simulator;
23 import java.util.List;
24 import java.util.ArrayList;
25 import java.util.Vector;
27 import org.oic.simulator.clientcontroller.IFindResourceListener;
28 import org.oic.simulator.clientcontroller.SimulatorRemoteResource;
29 import org.oic.simulator.ILogger;
30 import org.oic.simulator.serviceprovider.IResourceModelChangedListener;
31 import org.oic.simulator.serviceprovider.SimulatorResourceServer;
34 * This class provides a set of native functions for creation and deletion of
37 class SimulatorManagerNativeInterface {
40 * Native function for creating a resource.
43 * Path to RAML configuration file.
45 * Listener for receiving notifications whenever there is a
46 * change in the resource model.
48 * @return {@link SimulatorResourceServer} object on success, otherwise
51 public static native SimulatorResourceServer createResource(
52 String configPath, IResourceModelChangedListener listener);
55 * Native function for creating several resources.
58 * Path to RAML configuration file.
60 * Listener for receiving notifications whenever there is a
61 * change in the resource model.
63 * @return An array of {@link SimulatorResourceServer} objects on success,
66 public static native SimulatorResourceServer[] createResources(
67 String configPath, int count, IResourceModelChangedListener listener);
70 * Native function to get the list of locally created resources.
72 * @return A list of {@link SimulatorResourceServer} objects on success,
75 public static native Vector<SimulatorResourceServer> getResources();
78 * Native function to delete a specific resource
81 * {@link SimulatorResourceServer} object of the resource to be
84 public static native void deleteResource(SimulatorResourceServer resource);
87 * Native function to delete all resources or resources of a specific type.
90 * Type of the resource.
92 public static native void deleteResources(String resourceType);
95 * Native function to set the logger listener for receiving the log messages
98 public static native void setLogger(ILogger logger);
101 * Native function for discovering resources.
103 * @param resourceType
104 * - required resource type
106 * @return OCSimulatorResult - return value of this API. It returns
107 * OC_STACK_OK if success.
110 public static native int findResource(String resourceType,
111 IFindResourceListener listener);
114 * Native function for getting the list of previously discovered resources
117 * @param resourceType
118 * - required resource type
120 * @return ArrayList<SimulatorRemoteResource> - returns list of
121 * SimulatorRemoteResource
124 public static native ArrayList<SimulatorRemoteResource> getFoundResources(
125 String resourceType);
128 * Method to get the URI for this resource
130 * @return resource URI
132 public static native String getUri();
135 * Method to get the list of resource types
137 * @return List of resource types
139 public static native List<String> getResourceTypes();
142 * Method to get the list of resource interfaces
144 * @return List of resource interface
146 public static native List<String> getResourceInterfaces();
149 * Method to get a string representation of the resource's server ID. This
150 * is unique per-server independent on how it was discovered.
154 public static native String getServerId();