ZOO-Project
|
#include "service_json.h"
#include "json.h"
#include <errno.h>
#include "json_tokener.h"
#include "stdlib.h"
#include "mimetypes.h"
#include "server_internal.h"
#include "service_internal.h"
#include <dirent.h>
Functions | |
json_object * | mapToJson (map *myMap) |
Convert a map to a json object. More... | |
json_object * | mapsToJson (maps *myMap) |
Convert a maps to a json object. More... | |
json_object * | elementsToJson (elements *myElements) |
Convert an elements to a json object. More... | |
json_object * | serviceToJson (service *myService) |
Convert an service to a json object. More... | |
void | printAllowedRangesJ (maps *m, iotype *iot, json_object *prop) |
Add Allowed Range properties to a json_object. More... | |
void | printLiteralDataJ (maps *m, elements *in, json_object *input) |
Add literalDataDomains property to a json_object. More... | |
void | printFormatJ (maps *m, iotype *iot, json_object *res, bool isDefault, map *maxSize) |
Add Format properties to a json_object. More... | |
void | printJAdditionalParameters (maps *conf, map *meta, json_object *doc) |
Add additionalParameters property to a json_object. More... | |
void | printJMetadata (maps *conf, map *meta, json_object *doc) |
Add metadata property to a json_object. More... | |
void | printIOTypeJ (maps *m, const char *io, elements *in, json_object *inputs, service *serv) |
Add metadata properties to a json_object. More... | |
void | printGetCapabilitiesForProcessJ (registry *reg, maps *m, void *doc0, void *nc0, service *serv) |
Add all the capabilities properties to a json_object. More... | |
void | printExceptionReportResponseJ (maps *m, map *s) |
Print an OWS ExceptionReport Document and HTTP headers (when required) depending on the code. More... | |
void | parseJLiteral (maps *conf, json_object *req, elements *element, maps *output) |
Parse LiteralData value. More... | |
void | parseJComplex (maps *conf, json_object *req, elements *element, maps *output, const char *name) |
Parse ComplexData value. More... | |
void | parseJBoundingBox (maps *conf, json_object *req, elements *element, maps *output) |
Parse BoundingBox value. More... | |
void | _parseJIOSingle (maps *conf, elements *cio, maps **ioMaps, const char *ioType, const char *key, json_object *val, maps *cMaps) |
Parse a single input / output entity. More... | |
void | parseJIOSingle (maps *conf, elements *ioElements, maps **ioMaps, const char *ioType, const char *key, json_object *val) |
Parse a single input / output entity that can be an array. More... | |
void | parseJIO (maps *conf, json_object *req, elements *ioElements, maps **ioMaps, const char *ioType) |
Parse all the inputs / outputs entities. More... | |
void | parseJRequest (maps *conf, service *s, json_object *req, map *request_inputs, maps **inputs, maps **outputs) |
Parse Json Request. More... | |
json_object * | printJobStatus (maps *pmsConf, char *pcJobId) |
Print the jobs status info cf. More... | |
json_object * | printJobList (maps *conf) |
Print the jobs list. More... | |
json_object * | printJResult (maps *conf, service *s, maps *result, int res) |
Print the result of an execution. More... | |
int | createStatusLinks (maps *conf, int result, json_object *obj) |
Create the status links. More... | |
char * | json_getStatusFilePath (maps *conf) |
Get the status file path. More... | |
char * | getResultPath (maps *conf, char *jobId) |
json_object * | parseJson (maps *conf, char *myString) |
json_object * | json_readFile (maps *conf, char *filePath) |
json_object * | createStatus (maps *conf, int status) |
int | createStatusFile (maps *conf, int status) |
Create the status file. More... | |
int | json_getStatusFile (maps *conf) |
Create the status file. More... | |
void | produceApiInfo (maps *conf, json_object *res, json_object *res5) |
Produce the JSON object for api info object. More... | |
void | addResponse (const map *useContent, json_object *res, const map *pmSchema, const map *pmType, const char *code, const char *msg) |
void | addParameter (maps *conf, const char *oName, const char *fName, const char *in, json_object *res) |
void | produceApiParameters (maps *conf, json_object *res) |
Produce the JSON object for api parameter. More... | |
void | produceApiComponents (maps *conf, json_object *res) |
void | produceApi (maps *conf, json_object *res) |
Produce the JSON object for /api. More... | |
Variables | |
const char * | rangeCorrespondances [4][2] |
Equivalent range keywords for WPS version 1 and 2. More... | |
void _parseJIOSingle | ( | maps * | conf, |
elements * | cio, | ||
maps ** | ioMaps, | ||
const char * | ioType, | ||
const char * | key, | ||
json_object * | val, | ||
maps * | cMaps | ||
) |
Parse a single input / output entity.
conf | the maps containing the settings of the main.cfg file |
ioElements | the elements extracted from the zcfg |
ioMaps | the produced maps containing inputs (or outputs) |
ioType | the char* set to inputs or outputs |
key | char* the input/output name |
val | json_object pointing to the input/output |
cMaps | the outputed maps containing input (or output) metedata |
void addParameter | ( | maps * | conf, |
const char * | oName, | ||
const char * | fName, | ||
const char * | in, | ||
json_object * | res | ||
) |
void addResponse | ( | const map * | useContent, |
json_object * | res, | ||
const map * | pmSchema, | ||
const map * | pmType, | ||
const char * | code, | ||
const char * | msg | ||
) |
json_object* createStatus | ( | maps * | conf, |
int | status | ||
) |
int createStatusFile | ( | maps * | conf, |
int | status | ||
) |
Create the status file.
conf | the maps containing the settings of the main.cfg file |
status | an integer (SERVICE_ACCEPTED,SERVICE_STARTED...) |
int createStatusLinks | ( | maps * | conf, |
int | result, | ||
json_object * | obj | ||
) |
Create the status links.
conf | the maps containing the settings of the main.cfg file |
result | an integer (>0 for adding the /result link) |
obj | the JSON object pointer to add the links to |
json_object* elementsToJson | ( | elements * | myElements | ) |
Convert an elements to a json object.
myElements | the elements pointer to be converted into a json object |
char* getResultPath | ( | maps * | conf, |
char * | jobId | ||
) |
int json_getStatusFile | ( | maps * | conf | ) |
Create the status file.
conf | the maps containing the settings of the main.cfg file |
char* json_getStatusFilePath | ( | maps * | conf | ) |
Get the status file path.
conf | the maps containing the settings of the main.cfg file |
json_object* json_readFile | ( | maps * | conf, |
char * | filePath | ||
) |
json_object* mapsToJson | ( | maps * | myMap | ) |
Convert a maps to a json object.
myMap | the maps to be converted into json object |
json_object* mapToJson | ( | map * | myMap | ) |
Convert a map to a json object.
myMap | the map to be converted into json object |
Parse BoundingBox value.
conf | the maps containing the settings of the main.cfg file |
req | json_object pointing to the input/output |
element | |
output | the maps to set current json structure |
void parseJComplex | ( | maps * | conf, |
json_object * | req, | ||
elements * | element, | ||
maps * | output, | ||
const char * | name | ||
) |
Parse ComplexData value.
conf | the maps containing the settings of the main.cfg file |
req | json_object pointing to the input/output |
element | |
output | the maps to set current json structure |
name | the name of the request from http_requests |
void parseJIO | ( | maps * | conf, |
json_object * | req, | ||
elements * | ioElements, | ||
maps ** | ioMaps, | ||
const char * | ioType | ||
) |
Parse all the inputs / outputs entities.
conf | the maps containing the settings of the main.cfg file |
req | json_object pointing to the input/output |
ioElements | the elements extracted from the zcfg |
ioMaps | the produced maps containing inputs (or outputs) |
ioType | the char* set to inputs or outputs |
void parseJIOSingle | ( | maps * | conf, |
elements * | ioElements, | ||
maps ** | ioMaps, | ||
const char * | ioType, | ||
const char * | key, | ||
json_object * | val | ||
) |
Parse a single input / output entity that can be an array.
conf | the maps containing the settings of the main.cfg file |
ioElements | the elements extracted from the zcfg |
ioMaps | the produced maps containing inputs (or outputs) |
ioType | the char* set to inputs or outputs |
key | char* the input/output name |
val | json_object pointing to the input/output |
Parse LiteralData value.
conf | the maps containing the settings of the main.cfg file |
req | json_object pointing to the input/output |
element | |
output | the maps to set current json structure |
void parseJRequest | ( | maps * | conf, |
service * | s, | ||
json_object * | req, | ||
map * | request_inputs, | ||
maps ** | inputs, | ||
maps ** | outputs | ||
) |
Parse Json Request.
conf | the maps containing the settings of the main.cfg file |
s | the current service metadata |
req | the JSON object of the request body |
inputs | the produced maps |
outputs | the produced maps |
json_object* parseJson | ( | maps * | conf, |
char * | myString | ||
) |
Add Allowed Range properties to a json_object.
m | the main configuration maps pointer |
iot | the iotype pointer |
prop | the json_object pointer to add the allowed range properties |
Print an OWS ExceptionReport Document and HTTP headers (when required) depending on the code.
Set hasPrinted value to true in the [lenv] section.
m | the maps containing the settings of the main.cfg file |
s | the map containing the text,code,locator keys (or a map array of the same keys) |
Add Format properties to a json_object.
m | the main configuration maps pointer |
iot | the current iotype pointer |
res | the json_object pointer to add the properties to |
isDefault | boolean specifying if the currrent iotype is default |
maxSize | a map pointer to the maximumMegabytes param defined in the zcfg file for this input/output |
void printGetCapabilitiesForProcessJ | ( | registry * | reg, |
maps * | m, | ||
void * | doc0, | ||
void * | nc0, | ||
service * | serv | ||
) |
Add all the capabilities properties to a json_object.
ref | the registry pointer |
m | the main configuration maps pointer |
doc0 | the void (json_object) pointer to add the property to |
nc0 | the void (json_object) pointer to add the property to |
serv | the service pointer to extract the metadata from |
void printIOTypeJ | ( | maps * | m, |
const char * | io, | ||
elements * | in, | ||
json_object * | inputs, | ||
service * | serv | ||
) |
Add metadata properties to a json_object.
m | the main configuration maps pointer |
io | a string |
in | an elements pointer to the current input/output |
inputs | the json_object pointer to add the property to |
serv | the service pointer to extract the metadata from |
Add additionalParameters property to a json_object.
conf | the main configuration maps pointer |
meta | a map pointer to the current metadata informations |
doc | the json_object pointer to add the property to |
Add metadata property to a json_object.
conf | the main configuration maps pointer |
meta | a map pointer to the current metadata informations |
doc | the json_object pointer to add the property to |
json_object* printJobList | ( | maps * | conf | ) |
Print the jobs list.
conf | the maps containing the settings of the main.cfg file |
json_object* printJobStatus | ( | maps * | pmsConf, |
char * | pcJobId | ||
) |
Print the jobs status info cf.
conf | the maps containing the settings of the main.cfg file |
Print the result of an execution.
conf | the maps containing the settings of the main.cfg file |
s | service pointer to metadata |
result | outputs of the service |
res | the status of execution SERVICE_FAILED/SERVICE_SUCCEEDED |
Add literalDataDomains property to a json_object.
m | the main configuration maps pointer |
in | the elements pointer |
input | the json_object pointer to add the literalDataDomains property |
void produceApi | ( | maps * | conf, |
json_object * | res | ||
) |
Produce the JSON object for /api.
conf | the maps containing the settings of the main.cfg file |
res | the JSON object to populate |
void produceApiComponents | ( | maps * | conf, |
json_object * | res | ||
) |
void produceApiInfo | ( | maps * | conf, |
json_object * | res, | ||
json_object * | res5 | ||
) |
Produce the JSON object for api info object.
conf | the maps containing the settings of the main.cfg file |
res | the JSON object for the api info |
void produceApiParameters | ( | maps * | conf, |
json_object * | res | ||
) |
Produce the JSON object for api parameter.
conf | the maps containing the settings of the main.cfg file |
res | the JSON object to populate with the parameters |
json_object* serviceToJson | ( | service * | myService | ) |
Convert an service to a json object.
myService | the service pointer to be converted into a json object |
const char* rangeCorrespondances[4][2] |
Equivalent range keywords for WPS version 1 and 2.