Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
service.h
Go to the documentation of this file.
1 /*
2 ** Copyright 2014-2016 The Earlham Institute
3 **
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
7 **
8 ** http://www.apache.org/licenses/LICENSE-2.0
9 **
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.
15 */
16 
17 
22 #ifndef GRASSROOTS_SERVICE_H
23 #define GRASSROOTS_SERVICE_H
24 
26 
27 #include "byte_buffer.h"
28 #include "linked_list.h"
29 #include "parameter_set.h"
30 #include "typedefs.h"
31 #include "handler.h"
32 #include "user_details.h"
33 #include "operation.h"
34 #include "paired_service.h"
35 #include "linked_service.h"
36 #include "uuid_defs.h"
37 #include "service_metadata.h"
38 #include "sync_data.h"
39 
40 #include "jansson.h"
41 
42 #include "providers_state_table.h"
43 
44 struct ExternalServer;
45 
46 /*
47  * The following preprocessor macros allow us to declare
48  * and define the variables in the same place. By default,
49  * they will expand to
50  *
51  * extern const char *SERVICE_NAME_S;
52  *
53  * however if ALLOCATE_JSON_TAGS is defined then it will
54  * become
55  *
56  * const char *SERVICE_NAME_S = "path";
57  *
58  * ALLOCATE_PATH_TAGS must be defined only once prior to
59  * including this header file. Currently this happens in
60  * service.c.
61  */
62 #ifndef DOXYGEN_SHOULD_SKIP_THIS
63 
64 #ifdef ALLOCATE_PATH_TAGS
65  #define PATH_PREFIX GRASSROOTS_SERVICE_API
66  #define PATH_VAL(x) = x
67 #else
68  #define PATH_PREFIX extern GRASSROOTS_SERVICE_API
69  #define PATH_VAL(x)
70 #endif
71 
72 #endif
73 
78 //PATH_PREFIX const char *SERVICES_PATH_S PATH_VAL("services");
79 
80 
81 #define SERVICE_GROUP_ALIAS_SEPARATOR "-"
82 
89 /* forward declarations */
90 struct Plugin;
91 struct Service;
92 struct ServiceJob;
93 struct ServiceJobSet;
94 
95 
101 typedef enum
102 {
105 
111 
117 } Synchronicity;
118 
119 
126 typedef struct ServiceData
127 {
130 
135  json_t *sd_config_p;
136 
142 } ServiceData;
143 
144 
145 
146 
153 typedef struct Service
154 {
160 
169 
180  struct ServiceJobSet *(*se_run_fn) (struct Service *service_p, ParameterSet *param_set_p, User *user_p, ProvidersStateTable *providers_p);
181 
193  ParameterSet *(*se_match_fn) (struct Service *service_p, DataResource *resource_p, Handler *handler_p);
194 
206  bool (*se_has_permissions_fn) (struct Service *service_p, ParameterSet *params_p, const User * const user_p);
207 
208 
212  const char *(*se_get_service_name_fn) (const struct Service *service_p);
213 
217  const char *(*se_get_service_description_fn) (const struct Service *service_p);
218 
219 
223  const char *(*se_get_service_alias_fn) (const struct Service *service_p);
224 
228  const char *(*se_get_service_info_uri_fn) (const struct Service *service_p);
229 
230 
234  ParameterSet *(*se_get_params_fn) (struct Service *service_p, DataResource *resource_p, User *user_p);
235 
236 
247  void (*se_customise_service_job_fn) (struct Service *service_p, struct ServiceJob *job_p);
248 
249 
253  void (*se_release_params_fn) (struct Service *service_p, ParameterSet *params_p);
254 
262  bool (*se_close_fn) (struct Service *service_p);
263 
264 
274  struct ServiceJob *(*se_deserialise_job_json_fn) (struct Service *service_p, const json_t *service_job_json_p);
275 
276 
285  json_t *(*se_serialise_job_json_fn) (struct Service *service_p, struct ServiceJob *service_job_p, bool omit_results_flag);
286 
298  bool (*se_process_linked_services_fn) (struct Service *service_p, struct ServiceJob *job_p, LinkedService *linked_service_p);
299 
300 
310  bool (*se_get_parameter_type_fn) (const struct Service *service_p, const char *param_name_s, ParameterType *pt_p);
311 
312 
317 
320 
323 
326 
332 
337 
344 
349 
350 
358  ServiceMetadata *(*se_get_metadata_fn) (struct Service *service_p);
359 
365 
371  void (*se_release_service_fn) (struct Service *service_p);
372 
373 
380  json_t *(*se_get_indexing_data_fn) (struct Service *service_p);
381 
382 
388  Parameter *(*se_custom_parameter_decoder_fn) (struct Service *service_p, json_t *param_json_p, const bool concise_flag);
389 
394 
395 
396 
397 } Service;
398 
399 
407 typedef struct
408 {
411 
414 } ServiceNode;
415 
416 
422 typedef struct ServicesArray
423 {
426 
429 } ServicesArray;
430 
431 
432 
433 
434 
435 #ifdef __cplusplus
436 extern "C"
437 {
438 #endif
439 
448 GRASSROOTS_SERVICE_API ServicesArray *GetReferrableServicesFromPlugin (Plugin * const plugin_p, User *user_p, const json_t *service_config_p);
449 
458 
459 
488 GRASSROOTS_SERVICE_API bool InitialiseService (Service * const service_p,
489  const char *(*get_service_name_fn) (const Service *service_p),
490  const char *(*get_service_description_fn) (const Service *service_p),
491  const char *(*get_service_alias_fn) (const Service *service_p),
492  const char *(*get_service_info_uri_fn) (const Service *service_p),
493  struct ServiceJobSet *(*run_fn) (Service *service_p, ParameterSet *param_set_p, User *user_p, ProvidersStateTable *providers_p),
494  ParameterSet *(*match_fn) (Service *service_p, DataResource *resource_p, Handler *handler_p),
495  ParameterSet *(*get_parameters_fn) (Service *service_p, DataResource *resource_p, User *user_p),
496  bool (*get_parameter_type_fn) (const Service *service_p, const char *param_name_s, ParameterType *pt_p),
497  void (*release_parameters_fn) (Service *service_p, ParameterSet *params_p),
498  bool (*close_fn) (Service *service_p),
499  void (*customise_service_job_fn) (Service *service_p, struct ServiceJob *job_p),
500  bool specific_flag,
501  Synchronicity synchronous,
502  ServiceData *data_p,
503  ServiceMetadata *(*get_metadata_fn) (Service *service_p),
504  json_t *(*get_indexing_data_fn) (Service *service_p),
505  GrassrootsServer *grassroots_p
506 );
507 
508 
523 GRASSROOTS_SERVICE_API struct ServiceJobSet *RunService (Service *service_p, ParameterSet *param_set_p, User *user_p, ProvidersStateTable *providers_p);
524 
525 
535 
536 
546 GRASSROOTS_SERVICE_API struct ServiceJob *CreateSerialisedServiceJobFromService (struct Service *service_p, const json_t *service_job_json_p);
547 
548 
560 GRASSROOTS_SERVICE_API json_t *CreateSerialisedJSONForServiceJobFromService (struct Service *service_p, struct ServiceJob *service_job_p, bool omit_results_flag);
561 
562 
563 
576 GRASSROOTS_SERVICE_API ParameterSet *IsServiceMatch (Service *service_p, DataResource *resource_p, Handler *handler_p);
577 
578 
586 GRASSROOTS_SERVICE_API const char *GetServiceName (const Service *service_p);
587 
588 
596 GRASSROOTS_SERVICE_API const char *GetServiceDescription (const Service *service_p);
597 
598 
606 GRASSROOTS_SERVICE_API const char *GetServiceAlias (const Service *service_p);
607 
608 
618 
619 
627 GRASSROOTS_SERVICE_API const char *GetServiceInformationURI (const Service *service_p);
628 
641 
642 
643 
654 GRASSROOTS_SERVICE_API bool GetParameterTypeForNamedParameter (const struct Service *service_p, const char *param_name_s, ParameterType *pt_p);
655 
656 
665 
666 
673 GRASSROOTS_SERVICE_API void FreeService (Service *service_p);
674 
675 
684 
685 
686 
696 GRASSROOTS_SERVICE_API void SetServiceReleaseFunction (Service *service_p, void (*release_fn) (Service *service_p));
697 
698 
708 GRASSROOTS_SERVICE_LOCAL void ReleaseServiceData (ServiceData *data_p);
709 
718 
719 
727 
728 
737 
738 
739 
740 
754 GRASSROOTS_SERVICE_API json_t *GetServiceAsJSON (Service * const service_p, DataResource *resource_p, User *user_p, const bool add_id_flag);
755 
756 
764 GRASSROOTS_SERVICE_API const char *GetServiceIcon (const Service *service_p);
765 
766 
767 
775 GRASSROOTS_SERVICE_API const char *GetServiceInformationPage (const Service *service_p);
776 
777 
786 
787 
805 GRASSROOTS_SERVICE_API json_t *GetServicesListAsJSON (LinkedList *services_list_p, DataResource *resource_p, User *user_p, const bool add_service_ids_flag, ProvidersStateTable *providers_p);
806 
807 
817 
818 
826 
827 
836 GRASSROOTS_SERVICE_API ServicesArray *AllocateServicesArray (const uint32 num_services);
837 
838 
846 GRASSROOTS_SERVICE_LOCAL void AssignPluginForServicesArray (ServicesArray *services_p, Plugin *plugin_p);
847 
848 
857 GRASSROOTS_SERVICE_API bool AddServiceResponseHeader (Service *service_p, json_t *result_json_p);
858 
859 
870 GRASSROOTS_SERVICE_API ServicesArray *GetReferenceServicesFromJSON (json_t *config_p, const char *plugin_name_s, Service *(*get_service_fn) (json_t *config_p, size_t i, GrassrootsServer *grassroots_p), GrassrootsServer *grassroots_p);
871 
872 
882 
883 
891 GRASSROOTS_SERVICE_LOCAL OperationStatus DefaultGetServiceStatus (Service *service_p, const uuid_t service_id);
892 
893 
908 GRASSROOTS_SERVICE_API bool CreateAndAddPairedService (Service *service_p, struct ExternalServer *external_server_p, const char *remote_service_name_s, const json_t *op_p, const json_t *provider_p);
909 
910 
919 GRASSROOTS_SERVICE_API bool AddPairedService (Service *service_p, PairedService *paired_service_p);
920 
921 
931 GRASSROOTS_SERVICE_API bool CreateAndAddLinkedService (Service *service_p, const json_t *service_config_p, GrassrootsServer *grassroots_p);
932 
933 
942 GRASSROOTS_SERVICE_API bool AddLinkedService (Service *service_p, LinkedService *paired_service_p);
943 
944 
945 
961 GRASSROOTS_SERVICE_API json_t *GetServiceRunRequest (const char * const service_name_s, const ParameterSet *params_p, const SchemaVersion *sv_p, const bool run_flag, const ParameterLevel level);
962 
963 
978 GRASSROOTS_SERVICE_API json_t *GetServiceRefreshRequest (const char * const service_name_s, const ParameterSet *params_p, const SchemaVersion *sv_p, const bool run_flag, const ParameterLevel level);
979 
980 
996 GRASSROOTS_SERVICE_API json_t *GetServiceRefreshRequest (const char * const service_name_s, const ParameterSet *params_p, const SchemaVersion *sv_p, const bool run_flag, const ParameterLevel level);
997 
998 
999 
1020 GRASSROOTS_SERVICE_API json_t *GetInterestedServiceJSON (Service *service_p, const char *keyword_s, const ParameterSet * const params_p, const bool full_definition_flag);
1021 
1022 
1035 
1036 
1045 
1046 
1054 GRASSROOTS_SERVICE_API void SetServiceRunning (Service *service_p, bool b);
1055 
1056 
1066 GRASSROOTS_SERVICE_API void SetMetadataForService (Service *service_p, SchemaTerm *category_p, SchemaTerm *subcategory_p);
1067 
1068 
1069 
1070 
1071 
1072 
1073 
1075 
1076 
1077 GRASSROOTS_SERVICE_API json_t *GetBaseServiceDataAsJSON (Service * const service_p, User *user_p);
1078 
1079 
1088 
1089 
1090 GRASSROOTS_SERVICE_API json_t *GetServiceRefreshRequestFromJSON (const char * const service_name_s, json_t *param_set_json_p, const SchemaVersion *sv_p, const bool run_flag, const ParameterLevel level);
1091 
1092 
1093 GRASSROOTS_SERVICE_API json_t *GetServiceRunRequestFromJSON (const char * const service_name_s, json_t *param_set_json_p, const SchemaVersion *sv_p, const bool run_flag, const ParameterLevel level);
1094 
1095 
1096 GRASSROOTS_SERVICE_API bool DefaultGetParameterTypeForNamedParameter (const char *param_name_s, ParameterType *pt_p, const NamedParameterType *params_p);
1097 
1098 
1108 
1109 
1119 
1120 
1121 #ifdef __cplusplus
1122 }
1123 #endif
1124 
1125 
1126 #endif /* #ifndef GRASSROOTS_SERVICE_H */
Parameter
The datatype that stores all of the information about a Parameter.
Definition: parameter.h:121
Service::se_jobs_p
struct ServiceJobSet * se_jobs_p
The ServiceJobSet for this Service.
Definition: service.h:322
Service::se_grassroots_p
GrassrootsServer * se_grassroots_p
The server that this service is running on.
Definition: service.h:393
ServicesArray::sa_num_services
uint32 sa_num_services
The number of Services in the array.
Definition: service.h:428
Synchronicity
Synchronicity
A datatype to define how a Service runs.
Definition: service.h:101
ServiceNode::sn_service_p
Service * sn_service_p
The Service.
Definition: service.h:413
Service::GetServiceIndexingData
json_t * GetServiceIndexingData(Service *service_p)
Get a JSON document containing the data that can be parsed by an indexing app such as Lucene.
SchemaVersion
This is a datatype to store the versioning details for the Grassroots JSON schema that is being used.
Definition: schema_version.h:44
Service::GetServiceParameters
ParameterSet * GetServiceParameters(Service *service_p, DataResource *resource_p, User *user_p)
Get a newly-created ParameterSet describing the parameters for a given Service.
Service::GetGrassrootsServerFromService
GrassrootsServer * GetGrassrootsServerFromService(const Service *const service_p)
Get the GrassrootsServer that the Service is running on.
ServiceNode
A datatype for storing Services on a LinkedList.
Definition: service.h:407
GetServiceRefreshRequestFromJSON
json_t * GetServiceRefreshRequestFromJSON(const char *const service_name_s, json_t *param_set_json_p, const SchemaVersion *sv_p, const bool run_flag, const ParameterLevel level)
ServiceNode::AllocateServiceNode
ServiceNode * AllocateServiceNode(Service *service_p)
Allocate a ServiceNode pointing to the given Service.
ServicesArray::sa_services_pp
Service ** sa_services_pp
An array of pointers to Services.
Definition: service.h:425
ExternalServer
A datatype to allow access to an external Grassroots Server.
Definition: servers_manager.h:48
linked_service.h
Service::SetMetadataForService
void SetMetadataForService(Service *service_p, SchemaTerm *category_p, SchemaTerm *subcategory_p)
Set the values of a Service's ServiceMetadata object.
NamedParameterType
This is a datatype that stores a read-only c-style string along with a ParameterType.
Definition: parameter.h:85
ParameterType
ParameterType
The different types that a Parameter can take.
Definition: parameter_type.h:35
ServiceJob
A datatype to represent a running task.
Definition: service_job.h:72
ServicesArray::AllocateServicesArray
ServicesArray * AllocateServicesArray(const uint32 num_services)
Allocate an empty ServicesArray.
AddServiceJobToService
bool AddServiceJobToService(Service *service_p, ServiceJob *job_p)
Add a ServiceJob to a Service.
grassroots_service_library.h
Service::se_paired_services
LinkedList se_paired_services
Any remote Services that are paired with this Service.
Definition: service.h:325
parameter_set.h
Service::SetServiceReleaseFunction
void SetServiceReleaseFunction(Service *service_p, void(*release_fn)(Service *service_p))
For an asynchronous Service, set the function that will be called if ReleaseService() is called.
GRASSROOTS_SERVICE_API
#define GRASSROOTS_SERVICE_API
Definition: grassroots_service_library.h:49
ServicesArray::GetReferenceServicesFromJSON
ServicesArray * GetReferenceServicesFromJSON(json_t *config_p, const char *plugin_name_s, Service *(*get_service_fn)(json_t *config_p, size_t i, GrassrootsServer *grassroots_p), GrassrootsServer *grassroots_p)
Get the ServicesArray generated from a Services reference file.
operation.h
Service::GetServiceRefreshRequest
json_t * GetServiceRefreshRequest(const char *const service_name_s, const ParameterSet *params_p, const SchemaVersion *sv_p, const bool run_flag, const ParameterLevel level)
Get the JSON fragment for sending to a Grassroots Server detailing how to update the parameters for a...
DataResource
A datatype representing a URI.
Definition: data_resource.h:40
handler.h
providers_state_table.h
Service::se_get_parameter_type_fn
bool(* se_get_parameter_type_fn)(const struct Service *service_p, const char *param_name_s, ParameterType *pt_p)
Callback function used to get the ParameterType of a named Parameter used by the given Service.
Definition: service.h:310
paired_service.h
Service::CreateSerialisedServiceJobFromService
struct ServiceJob * CreateSerialisedServiceJobFromService(struct Service *service_p, const json_t *service_job_json_p)
Function to parse a JSON fragment from a previously serialised ServiceJob.
Service::CreateAndAddLinkedService
bool CreateAndAddLinkedService(Service *service_p, const json_t *service_config_p, GrassrootsServer *grassroots_p)
Create and add a LinkedService to a Service.
Service::GetServiceRunRequest
json_t * GetServiceRunRequest(const char *const service_name_s, const ParameterSet *params_p, const SchemaVersion *sv_p, const bool run_flag, const ParameterLevel level)
Get the JSON fragment for sending to a Grassroots Server detailing whether and how a user wants a Ser...
Service::ReleaseService
void ReleaseService(Service *service_p)
For an asynchronous Service, tell it that it is no longer needed by the Grassroots system.
Service::se_is_specific_service_flag
bool se_is_specific_service_flag
Is the service self-contained.
Definition: service.h:168
sync_data.h
Service::se_id
uuid_t se_id
Unique Id for this service.
Definition: service.h:319
GRASSROOTS_SERVICE_LOCAL
#define GRASSROOTS_SERVICE_LOCAL
Definition: grassroots_service_library.h:50
Service::se_plugin_p
struct Plugin * se_plugin_p
The platform-specific plugin that the code for the Service is stored in.
Definition: service.h:159
GetReferrableServicesFromPlugin
ServicesArray * GetReferrableServicesFromPlugin(Plugin *const plugin_p, User *user_p, const json_t *service_config_p)
Get the ServicesArray from a given Plugin.
Service::GetParameterTypeForNamedParameter
bool GetParameterTypeForNamedParameter(const struct Service *service_p, const char *param_name_s, ParameterType *pt_p)
Get the ParameterType of a named Parameter used by the given Service.
ServicesArray::FreeServicesArray
void FreeServicesArray(ServicesArray *services_p)
Free a ServicesArray and each of its Services.
ServiceMetadata
A datatype for describing the type of application that a Service provides.
Definition: service_metadata.h:39
Service::RunService
struct ServiceJobSet * RunService(Service *service_p, ParameterSet *param_set_p, User *user_p, ProvidersStateTable *providers_p)
Run a Service.
uuid_defs.h
service_metadata.h
Service::CreateAndAddPairedService
bool CreateAndAddPairedService(Service *service_p, struct ExternalServer *external_server_p, const char *remote_service_name_s, const json_t *op_p, const json_t *provider_p)
Create a new PairedService and add it to a Service.
Service::ReleaseServiceParameters
void ReleaseServiceParameters(Service *service_p, ParameterSet *params_p)
Free a ParameterSet that was got from a call to GetServiceParameters.
ServiceNode::FreeServiceNode
void FreeServiceNode(ListItem *node_p)
Free a ServiceNode.
Service::se_process_linked_services_fn
bool(* se_process_linked_services_fn)(struct Service *service_p, struct ServiceJob *job_p, LinkedService *linked_service_p)
Callback function used when processing the results from running ServiceJobs for this Service as input...
Definition: service.h:298
Service
A datatype which defines an available service, its capabilities and its parameters.
Definition: service.h:153
Service::CreateSerialisedJSONForServiceJobFromService
json_t * CreateSerialisedJSONForServiceJobFromService(struct Service *service_p, struct ServiceJob *service_job_p, bool omit_results_flag)
Function to create a JSON fragment representing a serialised ServiceJob.
Service::DeallocatePluginService
bool DeallocatePluginService(Plugin *const plugin_p)
Close a Services-based Plugin and free all of the Services.
ServiceData::sd_config_flag
bool sd_config_flag
If this is true, then this ServiceData will decrease the reference count on sd_config_p when this Ser...
Definition: service.h:141
ServicesArray
A datatype for having a set of Services.
Definition: service.h:422
Service::se_sync_data_p
SyncData * se_sync_data_p
If the Service's synchronicity is set to SY_ASYNCHRONOUS_ATTACHED, this is used as mutex to control a...
Definition: service.h:364
typedefs.h
Service::se_synchronous
Synchronicity se_synchronous
The synchronicity for how this Service runs.
Definition: service.h:316
SortServicesListByName
bool SortServicesListByName(LinkedList *services_list_p)
ServiceNode::sn_node
ListItem sn_node
The List Node.
Definition: service.h:410
Service::GetServiceUUIDAsString
char * GetServiceUUIDAsString(Service *service_p)
Get the unique id of a service object.
ParameterLevel
ParameterLevel
The ParameterLevel defines the level that a user should be to adjust the Parameter.
Definition: parameter.h:52
RemoveServiceJobFromService
bool RemoveServiceJobFromService(Service *service_p, ServiceJob *job_p)
Remove a ServiceJob from a Service.
LinkedList
A doubly-linked list that can be traversed in either direction.
Definition: linked_list.h:56
GetServiceRunRequestFromJSON
json_t * GetServiceRunRequestFromJSON(const char *const service_name_s, json_t *param_set_json_p, const SchemaVersion *sv_p, const bool run_flag, const ParameterLevel level)
Service::GetInterestedServiceJSON
json_t * GetInterestedServiceJSON(Service *service_p, const char *keyword_s, const ParameterSet *const params_p, const bool full_definition_flag)
Get the JSON fragment for a job result list registering that a Service could be run against the user'...
LinkedService
This datatype stores the data needed to get the required information from the output of one Service t...
Definition: linked_service.h:50
ProvidersStateTable
This is a datatype that is used to keep track of which servers and services have already been process...
Definition: providers_state_table.h:49
Service::se_has_permissions_fn
bool(* se_has_permissions_fn)(struct Service *service_p, ParameterSet *params_p, const User *const user_p)
Check whether the user have permissions to run the Service.
Definition: service.h:206
Service::se_release_params_fn
void(* se_release_params_fn)(struct Service *service_p, ParameterSet *params_p)
Function to release the ParameterSet for this Service.
Definition: service.h:253
GetBaseServiceDataAsJSON
json_t * GetBaseServiceDataAsJSON(Service *const service_p, User *user_p)
OperationStatus
OperationStatus
The current status of an Operation.
Definition: operation.h:96
Service::IsServiceRunning
bool IsServiceRunning(Service *service_p)
Check if a Service is currently running any ServiceJobs.
ServiceData::sd_config_p
json_t * sd_config_p
If this service has an entry in global server config it will be stored here.
Definition: service.h:135
byte_buffer.h
SyncData
A datatype that allows data to be shared between tasks (e.g.
Definition: linux_sync_data.h:30
Plugin
A Plugin is a dynamically-loaded component to provide a piece of functionality.
Definition: plugin.h:150
Service::se_customise_service_job_fn
void(* se_customise_service_job_fn)(struct Service *service_p, struct ServiceJob *job_p)
This function is used to customise any ServiceJob objects that this Service creates.
Definition: service.h:247
Service::se_running_flag
bool se_running_flag
A flag to specify whether this Service is currently running.
Definition: service.h:343
Service::GetServiceInformationURI
const char * GetServiceInformationURI(const Service *service_p)
Get the address of a web page about the service.
Service::CloseService
bool CloseService(Service *service_p)
Close a Service.
Service::GetServiceName
const char * GetServiceName(const Service *service_p)
Get the user-friendly name of the service.
Service::AddPairedService
bool AddPairedService(Service *service_p, PairedService *paired_service_p)
Add a PairedService to a Service.
Service::GetServiceAlias
const char * GetServiceAlias(const Service *service_p)
Get the alias of the service.
PairedService
A datatype for describing a remote Service that can be used in conjunction with a local Service.
Definition: paired_service.h:59
Service::IsServiceMatch
ParameterSet * IsServiceMatch(Service *service_p, DataResource *resource_p, Handler *handler_p)
Is the Service able to work upon the given Resource.
GrassrootsServer
Definition: grassroots_server.h:45
ServiceJobSet
A datatype to represent a collection of ServiceJobs.
Definition: service_job.h:185
SY_SYNCHRONOUS
A task that runs synchronously.
Definition: service.h:104
User
A datatype to store user credentials.
Definition: user_details.h:40
SY_ASYNCHRONOUS_ATTACHED
A task runs asynchronously within the Grassroots system such as e.g threaded jobs.
Definition: service.h:116
user_details.h
Service::SetServiceRunning
void SetServiceRunning(Service *service_p, bool b)
Set if a Service is currently running any ServiceJobs or not.
DefaultGetParameterTypeForNamedParameter
bool DefaultGetParameterTypeForNamedParameter(const char *param_name_s, ParameterType *pt_p, const NamedParameterType *params_p)
linked_list.h
A doubly-linked list.
GetServicesFromPlugin
ServicesArray * GetServicesFromPlugin(Plugin *const plugin_p, User *user_p)
Get the ServicesArray from a given Plugin.
Service::se_close_fn
bool(* se_close_fn)(struct Service *service_p)
Function to close this Service.
Definition: service.h:262
Service::GetCurrentServiceStatus
OperationStatus GetCurrentServiceStatus(Service *service_p, const uuid_t service_id)
Get the OperationStatus for an operation in a Service.
ServiceData
A datatype for holding the configuration data for a Service.
Definition: service.h:126
Service::DoesServiceHaveCustomServiceJobSerialisation
bool DoesServiceHaveCustomServiceJobSerialisation(struct Service *service_p)
Does the Service use the default ServiceJob serialisation/deserialisation when storing ServiceJobs in...
Service::AddLinkedService
bool AddLinkedService(Service *service_p, LinkedService *paired_service_p)
Add a LinkedService to a Service.
Service::se_release_service_fn
void(* se_release_service_fn)(struct Service *service_p)
A custom callback function to use to close the service if needed.
Definition: service.h:371
Service::se_data_p
ServiceData * se_data_p
Any custom data that the service needs to store.
Definition: service.h:336
Handler
A Handler is a datatype for accessing data.
Definition: handler.h:72
Service::InitialiseService
bool InitialiseService(Service *const service_p, const char *(*get_service_name_fn)(const Service *service_p), const char *(*get_service_description_fn)(const Service *service_p), const char *(*get_service_alias_fn)(const Service *service_p), const char *(*get_service_info_uri_fn)(const Service *service_p), struct ServiceJobSet *(*run_fn)(Service *service_p, ParameterSet *param_set_p, User *user_p, ProvidersStateTable *providers_p), ParameterSet *(*match_fn)(Service *service_p, DataResource *resource_p, Handler *handler_p), ParameterSet *(*get_parameters_fn)(Service *service_p, DataResource *resource_p, User *user_p), bool(*get_parameter_type_fn)(const Service *service_p, const char *param_name_s, ParameterType *pt_p), void(*release_parameters_fn)(Service *service_p, ParameterSet *params_p), bool(*close_fn)(Service *service_p), void(*customise_service_job_fn)(Service *service_p, struct ServiceJob *job_p), bool specific_flag, Synchronicity synchronous, ServiceData *data_p, ServiceMetadata *(*get_metadata_fn)(Service *service_p), json_t *(*get_indexing_data_fn)(Service *service_p), GrassrootsServer *grassroots_p)
Initialise the basic structure of a Service.
Service::AddServiceResponseHeader
bool AddServiceResponseHeader(Service *service_p, json_t *result_json_p)
Add a JSON fragment to the response for a given Service that has been run.
Service::GetServiceDescription
const char * GetServiceDescription(const Service *service_p)
Get the user-friendly description of the service.
Service::se_metadata_p
ServiceMetadata * se_metadata_p
The ServiceMetadata for this Service.
Definition: service.h:348
ParameterSet
A set of Parameters along with an optional name and description.
Definition: parameter_set.h:46
ServiceData::sd_service_p
struct Service * sd_service_p
The service that owns this data.
Definition: service.h:129
SchemaTerm
A datatype for specifying ontological terms as a way to describe the data that each of the Services c...
Definition: schema_term.h:38
Service::se_linked_services
LinkedList se_linked_services
Any LinkedServices that will use the output from running this Service as input for itself.
Definition: service.h:331
SY_ASYNCHRONOUS_DETACHED
A task that runs asynchronously outside of the Grassroots system such as e.g drmaa jobs.
Definition: service.h:110
Service::GetServiceIcon
const char * GetServiceIcon(const Service *service_p)
Get the URL of an icon image to use for a given Service.
Service::FreeService
void FreeService(Service *service_p)
Free a Service and its associated Parameters and ServiceData.
Service::GetServiceInformationPage
const char * GetServiceInformationPage(const Service *service_p)
Get the URL of a web page describing a given Service.
Service::GetServiceAsJSON
json_t * GetServiceAsJSON(Service *const service_p, DataResource *resource_p, User *user_p, const bool add_id_flag)
Generate a json-based description of a Service.
Service::SetServiceJobCustomFunctions
void SetServiceJobCustomFunctions(Service *service_p, struct ServiceJob *job_p)
This function is used to customise any ServiceJob objects that a given Service creates.
Service::GetServicesListAsJSON
json_t * GetServicesListAsJSON(LinkedList *services_list_p, DataResource *resource_p, User *user_p, const bool add_service_ids_flag, ProvidersStateTable *providers_p)
Get the JSON fragment for exposing a list of Services to any interested Clients or ExternalServcers.
ListItem
A doubly-linked node that points to its predecessor and successor.
Definition: linked_list.h:43
uuid_t
Definition: windows_uuid.h:43