/**
* @brief Adds a trigger context to a job.
+ * @remarks This function consumes the given @c trigger.
+ * Using the @c trigger after calling this function leads to undefined behavior.
* @param[in] job Job handle
* @param[in] trigger Trigger context
* @return @c 0 on success, otherwise a negative error value
/**
* @brief Adds a requirement context to a job.
+ * @remarks This function consumes the given @c requirement.
+ * Using the @c requirement after calling this function leads to undefined behavior.
* @param[in] job Job handle
* @param[in] requirement Requirement context
* @return @c 0 on success, otherwise a negative error value
* @param[in] name Name of attribute
* @return @c 0 on success, otherwise a negative error value
*/
-int ctx_sched_job_context_prepare_attribute_int(ctx_sched_job_context_h job_context, const char name);
+int ctx_sched_job_context_prepare_attribute_int(ctx_sched_job_context_h job_context, const char* name);
/**
* @brief Prepares an attribute of a context.
* @param[in] name Name of attribute
* @return @c 0 on success, otherwise a negative error value
*/
-int ctx_sched_job_context_prepare_attribute_str(ctx_sched_job_context_h job_context, const char name);
+int ctx_sched_job_context_prepare_attribute_str(ctx_sched_job_context_h job_context, const char* name);
/**
* @brief Adds an equal-to condition of a context attribute.
* @return @c 0 on success, otherwise a negative error value
* @pre ctx_sched_job_context_prepare_attribute()
*/
-int ctx_sched_job_context_attribute_add_eq_int(ctx_sched_job_context_h job_context, const char name, int value);
+int ctx_sched_job_context_attribute_add_eq_int(ctx_sched_job_context_h job_context, const char* name, int value);
/**
* @brief Adds an equal-to condition of a context attribute.
* @return @c 0 on success, otherwise a negative error value
* @pre ctx_sched_job_context_prepare_attribute()
*/
-int ctx_sched_job_context_attribute_add_eq_str(ctx_sched_job_context_h job_context, const char name, const char* value);
+int ctx_sched_job_context_attribute_add_eq_str(ctx_sched_job_context_h job_context, const char* name, const char* value);
/**
* @brief Adds a not-equal-to condition of a context attribute.
* @return @c 0 on success, otherwise a negative error value
* @pre ctx_sched_job_context_prepare_attribute()
*/
-int ctx_sched_job_context_attribute_add_ne_int(ctx_sched_job_context_h job_context, const char name, int value);
+int ctx_sched_job_context_attribute_add_ne_int(ctx_sched_job_context_h job_context, const char* name, int value);
/**
* @brief Adds a not-equal-to condition of a context attribute.
* @return @c 0 on success, otherwise a negative error value
* @pre ctx_sched_job_context_prepare_attribute()
*/
-int ctx_sched_job_context_attribute_add_ne_str(ctx_sched_job_context_h job_context, const char name, const char* value);
+int ctx_sched_job_context_attribute_add_ne_str(ctx_sched_job_context_h job_context, const char* name, const char* value);
/**
* @brief Adds a greater-than condition of a context attribute.
* @return @c 0 on success, otherwise a negative error value
* @pre ctx_sched_job_context_prepare_attribute()
*/
-int ctx_sched_job_context_attribute_set_gt_int(ctx_sched_job_context_h job_context, const char name, int value);
+int ctx_sched_job_context_attribute_set_gt_int(ctx_sched_job_context_h job_context, const char* name, int value);
/**
* @brief Adds a greater-than-or-equal-to condition of a context attribute.
* @return @c 0 on success, otherwise a negative error value
* @pre ctx_sched_job_context_prepare_attribute()
*/
-int ctx_sched_job_context_attribute_set_ge_int(ctx_sched_job_context_h job_context, const char name, int value);
+int ctx_sched_job_context_attribute_set_ge_int(ctx_sched_job_context_h job_context, const char* name, int value);
/**
* @brief Adds a less-than condition of a context attribute.
* @return @c 0 on success, otherwise a negative error value
* @pre ctx_sched_job_context_prepare_attribute()
*/
-int ctx_sched_job_context_attribute_set_lt_int(ctx_sched_job_context_h job_context, const char name, int value);
+int ctx_sched_job_context_attribute_set_lt_int(ctx_sched_job_context_h job_context, const char* name, int value);
/**
* @brief Adds a less-than-or-equal-to condition of a context attribute.
* @return @c 0 on success, otherwise a negative error value
* @pre ctx_sched_job_context_prepare_attribute()
*/
-int ctx_sched_job_context_attribute_set_le_int(ctx_sched_job_context_h job_context, const char name, int value);
+int ctx_sched_job_context_attribute_set_le_int(ctx_sched_job_context_h job_context, const char* name, int value);
/**
* @brief Releases the resources allocated for a job context.
IMethodCallHandler* createMethodCallHandler();
- GDBusConnection* getConnection();
-
private:
IServiceRunner* __serviceRunner;
};
return E_SUPPORT;
}
-EXPORT_API int ctx_sched_job_context_prepare_name_int(ctx_sched_job_context_h job_context, const char* name)
+EXPORT_API int ctx_sched_job_context_prepare_attribute_int(ctx_sched_job_context_h job_context, const char* name)
{
return E_SUPPORT;
}
-EXPORT_API int ctx_sched_job_context_prepare_name_str(ctx_sched_job_context_h job_context, const char* name)
+EXPORT_API int ctx_sched_job_context_prepare_attribute_str(ctx_sched_job_context_h job_context, const char* name)
{
return E_SUPPORT;
}
-EXPORT_API int ctx_sched_job_context_name_add_eq_int(ctx_sched_job_context_h job_context, const char* name, int value)
+EXPORT_API int ctx_sched_job_context_attribute_add_eq_int(ctx_sched_job_context_h job_context, const char* name, int value)
{
return E_SUPPORT;
}
-EXPORT_API int ctx_sched_job_context_name_add_eq_str(ctx_sched_job_context_h job_context, const char* name, const char* value)
+EXPORT_API int ctx_sched_job_context_attribute_add_eq_str(ctx_sched_job_context_h job_context, const char* name, const char* value)
{
return E_SUPPORT;
}
-EXPORT_API int ctx_sched_job_context_name_add_ne_int(ctx_sched_job_context_h job_context, const char* name, int value)
+EXPORT_API int ctx_sched_job_context_attribute_add_ne_int(ctx_sched_job_context_h job_context, const char* name, int value)
{
return E_SUPPORT;
}
-EXPORT_API int ctx_sched_job_context_name_add_ne_str(ctx_sched_job_context_h job_context, const char* name, const char* value)
+EXPORT_API int ctx_sched_job_context_attribute_add_ne_str(ctx_sched_job_context_h job_context, const char* name, const char* value)
{
return E_SUPPORT;
}
-EXPORT_API int ctx_sched_job_context_name_set_gt_int(ctx_sched_job_context_h job_context, const char* name, int value)
+EXPORT_API int ctx_sched_job_context_attribute_set_gt_int(ctx_sched_job_context_h job_context, const char* name, int value)
{
return E_SUPPORT;
}
-EXPORT_API int ctx_sched_job_context_name_set_ge_int(ctx_sched_job_context_h job_context, const char* name, int value)
+EXPORT_API int ctx_sched_job_context_attribute_set_ge_int(ctx_sched_job_context_h job_context, const char* name, int value)
{
return E_SUPPORT;
}
-EXPORT_API int ctx_sched_job_context_name_set_lt_int(ctx_sched_job_context_h job_context, const char* name, int value)
+EXPORT_API int ctx_sched_job_context_attribute_set_lt_int(ctx_sched_job_context_h job_context, const char* name, int value)
{
return E_SUPPORT;
}
-EXPORT_API int ctx_sched_job_context_name_set_le_int(ctx_sched_job_context_h job_context, const char* name, int value)
+EXPORT_API int ctx_sched_job_context_attribute_set_le_int(ctx_sched_job_context_h job_context, const char* name, int value)
{
return E_SUPPORT;
}
static_cast<OnDemandJobInfo*>(job->jobInfo)->addTrigger(static_cast<JobTrigger*>(trigger->jobContext));
+ trigger->jobContext = NULL;
+ delete trigger;
+
return E_NONE;
}
job->jobInfo->addRequirement(static_cast<JobRequirement*>(requirement->jobContext));
+ requirement->jobContext = NULL;
+ delete requirement;
+
return E_NONE;
}
return E_NONE;
}
-EXPORT_API int ctx_sched_job_context_prepare_name_int(ctx_sched_job_context_h job_context, const char* name)
+EXPORT_API int ctx_sched_job_context_prepare_attribute_int(ctx_sched_job_context_h job_context, const char* name)
{
IF_FAIL_RETURN(job_context && name, E_PARAM);
return ret ? E_NONE : E_PARAM;
}
-EXPORT_API int ctx_sched_job_context_prepare_name_str(ctx_sched_job_context_h job_context, const char* name)
+EXPORT_API int ctx_sched_job_context_prepare_attribute_str(ctx_sched_job_context_h job_context, const char* name)
{
IF_FAIL_RETURN(job_context && name, E_PARAM);
return ret ? E_NONE : E_PARAM;
}
-EXPORT_API int ctx_sched_job_context_name_add_eq_int(ctx_sched_job_context_h job_context, const char* name, int value)
+EXPORT_API int ctx_sched_job_context_attribute_add_eq_int(ctx_sched_job_context_h job_context, const char* name, int value)
{
IF_FAIL_RETURN(job_context && name, E_PARAM);
return E_NONE;
}
-EXPORT_API int ctx_sched_job_context_name_add_eq_str(ctx_sched_job_context_h job_context, const char* name, const char* value)
+EXPORT_API int ctx_sched_job_context_attribute_add_eq_str(ctx_sched_job_context_h job_context, const char* name, const char* value)
{
IF_FAIL_RETURN(job_context && name, E_PARAM);
return E_NONE;
}
-EXPORT_API int ctx_sched_job_context_name_add_ne_int(ctx_sched_job_context_h job_context, const char* name, int value)
+EXPORT_API int ctx_sched_job_context_attribute_add_ne_int(ctx_sched_job_context_h job_context, const char* name, int value)
{
IF_FAIL_RETURN(job_context && name, E_PARAM);
return E_NONE;
}
-EXPORT_API int ctx_sched_job_context_name_add_ne_str(ctx_sched_job_context_h job_context, const char* name, const char* value)
+EXPORT_API int ctx_sched_job_context_attribute_add_ne_str(ctx_sched_job_context_h job_context, const char* name, const char* value)
{
IF_FAIL_RETURN(job_context && name, E_PARAM);
return E_NONE;
}
-EXPORT_API int ctx_sched_job_context_name_set_gt_int(ctx_sched_job_context_h job_context, const char* name, int value)
+EXPORT_API int ctx_sched_job_context_attribute_set_gt_int(ctx_sched_job_context_h job_context, const char* name, int value)
{
IF_FAIL_RETURN(job_context && name, E_PARAM);
return E_NONE;
}
-EXPORT_API int ctx_sched_job_context_name_set_ge_int(ctx_sched_job_context_h job_context, const char* name, int value)
+EXPORT_API int ctx_sched_job_context_attribute_set_ge_int(ctx_sched_job_context_h job_context, const char* name, int value)
{
IF_FAIL_RETURN(job_context && name, E_PARAM);
return E_NONE;
}
-EXPORT_API int ctx_sched_job_context_name_set_lt_int(ctx_sched_job_context_h job_context, const char* name, int value)
+EXPORT_API int ctx_sched_job_context_attribute_set_lt_int(ctx_sched_job_context_h job_context, const char* name, int value)
{
IF_FAIL_RETURN(job_context && name, E_PARAM);
return E_NONE;
}
-EXPORT_API int ctx_sched_job_context_name_set_le_int(ctx_sched_job_context_h job_context, const char* name, int value)
+EXPORT_API int ctx_sched_job_context_attribute_set_le_int(ctx_sched_job_context_h job_context, const char* name, int value)
{
IF_FAIL_RETURN(job_context && name, E_PARAM);
const char* JobSchedulerService::getServiceName()
{
- return NULL;
+ return CTX_JOB_SCHEDULER;
}
const char* JobSchedulerService::getMethodSpecs()
{
- return NULL;
+ return CTX_JOB_SCHEDULER_SPEC;
}
bool JobSchedulerService::prepare()