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.
linked_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 
21 /*
22  * linked_service.h
23  *
24  * Created on: 6 Sep 2016
25  * Author: tyrrells
26  */
27 
28 #ifndef SERVER_SRC_SERVICES_LIB_INCLUDE_LINKED_SERVICE_H_
29 #define SERVER_SRC_SERVICES_LIB_INCLUDE_LINKED_SERVICE_H_
30 
32 
33 #include "jansson.h"
34 
35 #include "linked_list.h"
36 #include "mapped_parameter.h"
37 #include "grassroots_server.h"
38 
39 /* forward declarations */
40 struct ServiceJob;
41 
42 
50 typedef struct LinkedService
51 {
58 
66 
67 
75  const char *ls_generate_fn_s;
76 
77 
79 
80  const json_t *ls_config_p;
81 
83 
85 
86 
94 typedef struct LinkedServiceNode
95 {
98 
102 
103 
104 #ifdef __cplusplus
105 extern "C"
106 {
107 #endif
108 
109 
121 GRASSROOTS_SERVICE_API LinkedService *AllocateLinkedService (const char *linked_service_s, const char *input_key_s, const json_t *mapped_params_json_p, const char * const function_s, const json_t *config_p, GrassrootsServer *grassroots_p);
122 
123 
131 GRASSROOTS_SERVICE_API LinkedService *CreateLinkedServiceFromJSON (struct Service *service_p, const json_t *linked_service_json_p, GrassrootsServer *grassroots_p);
132 
133 
134 
142 
143 
152 
153 
161 
162 
178 GRASSROOTS_SERVICE_API bool CreateAndAddMappedParameterToLinkedService (LinkedService *linked_service_p, const char *input_s, const char *output_s, bool required_flag, bool multi_flag);
179 
180 
189 GRASSROOTS_SERVICE_API bool AddMappedParameterToLinkedService (LinkedService *linked_service_p, struct MappedParameter *mapped_param_p);
190 
191 
192 
200 GRASSROOTS_SERVICE_API struct MappedParameter *GetMappedParameterByInputParamName (const LinkedService *linked_service_p, const char * const name_s);
201 
202 
211 
212 
222 GRASSROOTS_SERVICE_API bool ProcessLinkedService (LinkedService *linked_service_p, struct ServiceJob *job_p);
223 
224 
235 GRASSROOTS_SERVICE_API bool AddLinkedServiceToRequestJSON (json_t *request_p, LinkedService *linked_service_p, ParameterSet *output_params_p);
236 
237 
238 
239 
240 GRASSROOTS_SERVICE_API bool RunCustomLinkedServiceGenerator (struct LinkedService *linked_service_p, json_t *data_p, struct ServiceJob *job_p);
241 
242 
243 #ifdef __cplusplus
244 }
245 #endif
246 
247 
248 #endif /* SERVER_SRC_SERVICES_LIB_INCLUDE_LINKED_SERVICE_H_ */
ServiceJob
A datatype to represent a running task.
Definition: service_job.h:72
GetMappedParameterByInputParamName
struct MappedParameter * GetMappedParameterByInputParamName(const LinkedService *linked_service_p, const char *const name_s)
Get the MappedParameter with a given name from a LinkedService.
grassroots_service_library.h
LinkedService::AllocateLinkedService
LinkedService * AllocateLinkedService(const char *linked_service_s, const char *input_key_s, const json_t *mapped_params_json_p, const char *const function_s, const json_t *config_p, GrassrootsServer *grassroots_p)
Allocate a LinkedService.
LinkedService::AllocateLinkedServiceNode
LinkedServiceNode * AllocateLinkedServiceNode(LinkedService *linked_service_p)
Allocate a LinkedServiceNode to store a LinkedService on a LinkedList.
GRASSROOTS_SERVICE_API
#define GRASSROOTS_SERVICE_API
Definition: grassroots_service_library.h:49
LinkedService::ls_output_service_s
char * ls_output_service_s
The name of the Service whose input will be generated from the output of the Service that owns this L...
Definition: linked_service.h:57
LinkedService::FreeLinkedService
void FreeLinkedService(LinkedService *linked_service_p)
Free a LinkedService.
grassroots_server.h
RunCustomLinkedServiceGenerator
bool RunCustomLinkedServiceGenerator(struct LinkedService *linked_service_p, json_t *data_p, struct ServiceJob *job_p)
Service
A datatype which defines an available service, its capabilities and its parameters.
Definition: service.h:153
LinkedService::CreateLinkedServiceFromJSON
LinkedService * CreateLinkedServiceFromJSON(struct Service *service_p, const json_t *linked_service_json_p, GrassrootsServer *grassroots_p)
Create a new LinkedService from a JSON fragment.
LinkedService::ls_config_p
const json_t * ls_config_p
Definition: linked_service.h:80
LinkedService::ls_input_key_s
char * ls_input_key_s
Definition: linked_service.h:78
LinkedService::ProcessLinkedService
bool ProcessLinkedService(LinkedService *linked_service_p, struct ServiceJob *job_p)
Run a LinkedService.
LinkedService::GetLinkedServiceAsJSON
json_t * GetLinkedServiceAsJSON(LinkedService *linked_service_p)
Get the JSON representation of a LinkedService.
LinkedService::ls_generate_fn_s
const char * ls_generate_fn_s
The name of the function that will get dynamically loaded from the Service's Plugin.
Definition: linked_service.h:75
LinkedList
A doubly-linked list that can be traversed in either direction.
Definition: linked_list.h:56
LinkedService
This datatype stores the data needed to get the required information from the output of one Service t...
Definition: linked_service.h:50
mapped_parameter.h
LinkedServiceNode::lsn_node
ListItem lsn_node
The base ListItem.
Definition: linked_service.h:97
LinkedService::AddMappedParameterToLinkedService
bool AddMappedParameterToLinkedService(LinkedService *linked_service_p, struct MappedParameter *mapped_param_p)
Add a MappedParameter to a LinkedService.
GrassrootsServer
Definition: grassroots_server.h:45
LinkedServiceNode
The datatype to allow the storage of LinkedServices on LinkedLists.
Definition: linked_service.h:94
LinkedService::FreeLinkedServiceNode
void FreeLinkedServiceNode(ListItem *node_p)
Free a LinkedServiceNode and its associated LinkedService.
linked_list.h
A doubly-linked list.
MappedParameter
This structure is used to store a relationship between a value from the output of running one service...
Definition: mapped_parameter.h:52
LinkedService::CreateAndAddMappedParameterToLinkedService
bool CreateAndAddMappedParameterToLinkedService(LinkedService *linked_service_p, const char *input_s, const char *output_s, bool required_flag, bool multi_flag)
Create and add a MappedParameter to a LinkedService.
LinkedService::AddLinkedServiceToRequestJSON
bool AddLinkedServiceToRequestJSON(json_t *request_p, LinkedService *linked_service_p, ParameterSet *output_params_p)
Add the details for how to run a LinkedService with a partially-filled in set of Parameters to a JSON...
LinkedServiceNode::lsn_linked_service_p
LinkedService * lsn_linked_service_p
A pointer to the LinkedService.
Definition: linked_service.h:100
ParameterSet
A set of Parameters along with an optional name and description.
Definition: parameter_set.h:46
LinkedService::ls_grassroots_p
GrassrootsServer * ls_grassroots_p
Definition: linked_service.h:82
LinkedService::ls_mapped_params_p
LinkedList * ls_mapped_params_p
The list of MappedParameterNodes storing the information required to map values from the input Servic...
Definition: linked_service.h:65
ListItem
A doubly-linked node that points to its predecessor and successor.
Definition: linked_list.h:43