X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=service%2Fsimulator%2Fjava%2Fsdk%2Fsrc%2Forg%2Foic%2Fsimulator%2FSimulatorManagerNativeInterface.java;h=42da05cd9f52597483a25e5e7290675cbbd5b496;hb=b196fb356a2ca6776efcc7a77eebd3e5067fb472;hp=d8970f932fe95547af7542127e5ab64a9af5f18b;hpb=beaafa6a4457340991f808619cd24e65bb4bbd8f;p=platform%2Fupstream%2Fiotivity.git diff --git a/service/simulator/java/sdk/src/org/oic/simulator/SimulatorManagerNativeInterface.java b/service/simulator/java/sdk/src/org/oic/simulator/SimulatorManagerNativeInterface.java index d8970f9..42da05c 100644 --- a/service/simulator/java/sdk/src/org/oic/simulator/SimulatorManagerNativeInterface.java +++ b/service/simulator/java/sdk/src/org/oic/simulator/SimulatorManagerNativeInterface.java @@ -14,25 +14,15 @@ * limitations under the License. */ -/** - * This file contains a class which provides a set of native methods - * for creation and deletion of resources. - */ package org.oic.simulator; -import java.util.List; -import java.util.ArrayList; -import java.util.Vector; - import org.oic.simulator.clientcontroller.IFindResourceListener; -import org.oic.simulator.clientcontroller.SimulatorRemoteResource; -import org.oic.simulator.ILogger; import org.oic.simulator.serviceprovider.IResourceModelChangedListener; import org.oic.simulator.serviceprovider.SimulatorResourceServer; /** - * This class provides a set of native functions for creation and deletion of - * resources. + * This class provides a set of native functions for creation, discovery and + * deletion of resources. */ class SimulatorManagerNativeInterface { @@ -47,109 +37,125 @@ class SimulatorManagerNativeInterface { * * @return {@link SimulatorResourceServer} object on success, otherwise * null. + * + * @throws InvalidArgsException + * Thrown if the input parameters are empty. + * @throws SimulatorException + * Thrown for other errors. */ public static native SimulatorResourceServer createResource( - String configPath, IResourceModelChangedListener listener); + String configPath, IResourceModelChangedListener listener) + throws InvalidArgsException, SimulatorException; /** * Native function for creating several resources. * * @param configPath * Path to RAML configuration file. + * @param count + * Number of instances. * @param listener * Listener for receiving notifications whenever there is a * change in the resource model. * * @return An array of {@link SimulatorResourceServer} objects on success, * otherwise null. - */ - public static native SimulatorResourceServer[] createResources( - String configPath, int count, IResourceModelChangedListener listener); - - /** - * Native function to get the list of locally created resources. * - * @return A list of {@link SimulatorResourceServer} objects on success, - * otherwise null. + * @throws InvalidArgsException + * Thrown if the input parameters are empty. + * @throws SimulatorException + * Thrown for other errors. */ - public static native Vector getResources(); + public static native SimulatorResourceServer[] createResources( + String configPath, int count, IResourceModelChangedListener listener) + throws InvalidArgsException, SimulatorException; /** - * Native function to delete a specific resource + * Native function to delete a specific resource. * * @param resource * {@link SimulatorResourceServer} object of the resource to be * deleted. + * + * @throws InvalidArgsException + * Thrown if the input parameter is empty. + * @throws SimulatorException + * Thrown for other errors. */ - public static native void deleteResource(SimulatorResourceServer resource); + public static native void deleteResource(SimulatorResourceServer resource) + throws InvalidArgsException, SimulatorException; /** * Native function to delete all resources or resources of a specific type. * * @param resourceType * Type of the resource. + * + * @throws InvalidArgsException + * Thrown if the input parameter is empty. + * @throws SimulatorException + * Thrown for other errors. */ - public static native void deleteResources(String resourceType); - - /** - * Native function to set the logger listener for receiving the log messages - * from native layer. - */ - public static native void setLogger(ILogger logger); + public static native void deleteResources(String resourceType) + throws InvalidArgsException, SimulatorException; /** * Native function for discovering resources. * * @param resourceType - * - required resource type - * - * @return OCSimulatorResult - return value of this API. It returns - * OC_STACK_OK if success. - * + * required resource type + * @param listener + * Interface to receive the discovered remote resources. + * + * @throws InvalidArgsException + * Thrown if the input parameter is empty. + * @throws SimulatorException + * Thrown for other errors. */ - public static native int findResource(String resourceType, - IFindResourceListener listener); + public static native void findResources(String resourceType, + IFindResourceListener listener) throws InvalidArgsException, + SimulatorException; /** - * Native function for getting the list of previously discovered resources - * in the network. - * - * @param resourceType - * - required resource type - * - * @return ArrayList - returns list of - * SimulatorRemoteResource - * + * Native function to set the logger listener for receiving the log messages + * from native layer. + * + * @param logger + * Interface to receive log. */ - public static native ArrayList getFoundResources( - String resourceType); + public static native void setLogger(ILogger logger); /** - * Method to get the URI for this resource - * - * @return resource URI + * Native function to set the device information. + * + * @param deviceInfo + * Device information. */ - public static native String getUri(); + public static native void setDeviceInfo(String deviceInfo); /** - * Method to get the list of resource types - * - * @return List of resource types + * Native function to get the device information asynchronously via the + * listener. + * + * @param listener + * Interface for receiving the device information. */ - public static native List getResourceTypes(); + public static native void getDeviceInfo(IDeviceInfo listener); /** - * Method to get the list of resource interfaces - * - * @return List of resource interface + * Native function to set the platform information. + * + * @param platformInfo + * Platform information. */ - public static native List getResourceInterfaces(); + public static native void setPlatformInfo(PlatformInfo platformInfo); /** - * Method to get a string representation of the resource's server ID. This - * is unique per-server independent on how it was discovered. - * - * @return server ID + * Native function to get the platform information asynchronously via the + * listener. + * + * @param listener + * Interface for receiving the platform information. */ - public static native String getServerId(); + public static native void getPlatformInfo(IPlatformInfo listener); } \ No newline at end of file