return;
}
+ if (!jValue)
+ {
+ throwInvalidArgsException(env, SIMULATOR_INVALID_PARAM, "Attribute value cannot be null!");
+ return;
+ }
+
SimulatorResourceServerSP resource = JniSimulatorResource::getJniSimulatorResourceSP(env,
jobject);
if (!resource)
JNIEXPORT jint JNICALL
Java_org_oic_simulator_serviceprovider_SimulatorResourceServer_startResourceAutomation
-(JNIEnv *env, jobject object, jint automationType, jobject listener)
+(JNIEnv *env, jobject object, jint automationType, jint updateInterval, jobject listener)
{
SimulatorResourceServerSP resource = JniSimulatorResource::getJniSimulatorResourceSP(env, object);
if (!resource)
try
{
- automationId = resource->startUpdateAutomation(type, callback);
+ automationId = resource->startUpdateAutomation(type, updateInterval, callback);
}
catch (InvalidArgsException &e)
{
JNIEXPORT jint JNICALL
Java_org_oic_simulator_serviceprovider_SimulatorResourceServer_startAttributeAutomation
-(JNIEnv *env, jobject object, jstring attrName, jint automationType, jobject listener)
+(JNIEnv *env, jobject object, jstring attrName, jint automationType, jint updateInterval, jobject listener)
{
SimulatorResourceServerSP resource = JniSimulatorResource::getJniSimulatorResourceSP(env, object);
if (!resource)
int automationId = -1;
try
{
- automationId = resource->startUpdateAutomation(attrNamePtr, type, callback);
+ automationId = resource->startUpdateAutomation(attrNamePtr, type, updateInterval, callback);
}
catch (InvalidArgsException &e)
{
}
std::string str = env->GetStringUTFChars(jKey, NULL);
- resource->removeAttribute(str);
+ try
+ {
+ resource->removeAttribute(str);
+ }
+ catch (InvalidArgsException &e)
+ {
+ throwInvalidArgsException(env, e.code(), e.what());
+ return;
+ }
+ catch (SimulatorException &e)
+ {
+ throwSimulatorException(env, e.code(), e.what());
+ return;
+ }
+ catch (...)
+ {
+ throwSimulatorException(env, SIMULATOR_ERROR, "Unknown Exception");
+ return;
+ }
}
JNIEXPORT jobjectArray JNICALL