import org.oic.simulator.OperationInProgressException;
import org.oic.simulator.SimulatorException;
import org.oic.simulator.SimulatorResourceModel;
+import org.oic.simulator.SimulatorResult;
/**
* SimulatorRemoteResource represents a Resource running in the remote Simulator
public void get(Map<String, String> queryParamsMap,
IGetListener onGetListener) throws InvalidArgsException,
NoSupportException, SimulatorException {
- this.get(null, queryParamsMap, onGetListener);
+ if (null == onGetListener)
+ throw new InvalidArgsException(
+ SimulatorResult.SIMULATOR_INVALID_PARAM.ordinal(),
+ "Parameter passed in invalid");
+ this.nativeGet(null, queryParamsMap, onGetListener);
}
/**
* @throws SimulatorException
* This exception will be thrown for other errors.
*/
- public native void get(String resourceInterface,
+ public void get(String resourceInterface,
+ Map<String, String> queryParamsMap, IGetListener onGetListener)
+ throws InvalidArgsException, NoSupportException, SimulatorException {
+ if (null == resourceInterface || resourceInterface.isEmpty() || null == onGetListener)
+ throw new InvalidArgsException(
+ SimulatorResult.SIMULATOR_INVALID_PARAM.ordinal(),
+ "Parameter passed in invalid");
+ this.nativeGet(resourceInterface, queryParamsMap, onGetListener);
+ }
+
+ private native void nativeGet(String resourceInterface,
Map<String, String> queryParamsMap, IGetListener onGetListener)
throws InvalidArgsException, NoSupportException, SimulatorException;
public void put(SimulatorResourceModel representation,
Map<String, String> queryParamsMap, IPutListener onPutListener)
throws InvalidArgsException, NoSupportException, SimulatorException {
- this.put(null, representation, queryParamsMap, onPutListener);
+ if (null == representation || null == onPutListener)
+ throw new InvalidArgsException(
+ SimulatorResult.SIMULATOR_INVALID_PARAM.ordinal(),
+ "Parameter passed in invalid");
+ this.nativePut(null, representation, queryParamsMap, onPutListener);
}
/**
* @throws SimulatorException
* This exception will be thrown for other errors.
*/
- private native void put(String resourceInterface,
+ public void put(String resourceInterface,
+ SimulatorResourceModel representation,
+ Map<String, String> queryParamsMap, IPutListener onPutListener)
+ throws InvalidArgsException, NoSupportException, SimulatorException {
+ if (null == resourceInterface || resourceInterface.isEmpty() ||
+ null == representation || null == onPutListener)
+ throw new InvalidArgsException(
+ SimulatorResult.SIMULATOR_INVALID_PARAM.ordinal(),
+ "Parameter passed in invalid");
+ this.nativePut(resourceInterface, representation, queryParamsMap, onPutListener);
+ }
+
+ private native void nativePut(String resourceInterface,
SimulatorResourceModel representation,
Map<String, String> queryParamsMap, IPutListener onPutListener)
throws InvalidArgsException, NoSupportException, SimulatorException;
public void post(SimulatorResourceModel representation,
Map<String, String> queryParamsMap, IPostListener onPostListener)
throws InvalidArgsException, NoSupportException, SimulatorException {
- this.post(null, representation, queryParamsMap, onPostListener);
+ if (null == representation || null == onPostListener)
+ throw new InvalidArgsException(
+ SimulatorResult.SIMULATOR_INVALID_PARAM.ordinal(),
+ "Parameter passed in invalid");
+ this.nativePost(null, representation, queryParamsMap, onPostListener);
}
/**
* @throws SimulatorException
* This exception will be thrown for other errors.
*/
- public native void post(String resourceInterface,
+ public void post(String resourceInterface,
+ SimulatorResourceModel representation,
+ Map<String, String> queryParamsMap, IPostListener onPostListener)
+ throws InvalidArgsException, NoSupportException, SimulatorException {
+ if (null == resourceInterface || resourceInterface.isEmpty() ||
+ null == representation || null == onPostListener)
+ throw new InvalidArgsException(
+ SimulatorResult.SIMULATOR_INVALID_PARAM.ordinal(),
+ "Parameter passed in invalid");
+ this.nativePost(resourceInterface, representation, queryParamsMap, onPostListener);
+ }
+
+ private native void nativePost(String resourceInterface,
SimulatorResourceModel representation,
Map<String, String> queryParamsMap, IPostListener onPostListener)
throws InvalidArgsException, NoSupportException, SimulatorException;
@Override
protected void finalize() throws Throwable {
- super.finalize();
-
- dispose();
+ try {
+ dispose();
+ } catch(Throwable t){
+ throw t;
+ } finally{
+ super.finalize();
+ }
}
private native void dispose();