X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Fpazpar2_config.c;h=0a67bee195c03fa9d977858203a96816eef71e77;hb=a308a61764c5a8da2d386827d8574c45618d63de;hp=2e5f984a32c6457e1897dcce66bc515d9bbb5776;hpb=7aa45df8e1aeb4cd15434b945b66e56af3928fe0;p=pazpar2-moved-to-github.git diff --git a/src/pazpar2_config.c b/src/pazpar2_config.c index 2e5f984..0a67bee 100644 --- a/src/pazpar2_config.c +++ b/src/pazpar2_config.c @@ -112,13 +112,14 @@ static void conf_sortkey_assign(NMEM nmem, sortkey->type = type; } -static struct conf_service *service_init(struct conf_server *server, +struct conf_service *service_init(struct conf_server *server, int num_metadata, int num_sortkeys, const char *service_id) { struct conf_service * service = 0; NMEM nmem = nmem_create(); + service = nmem_malloc(nmem, sizeof(struct conf_service)); service->mutex = 0; service->ref_count = 1; @@ -134,7 +135,19 @@ static struct conf_service *service_init(struct conf_server *server, service->charsets = 0; service->id = service_id ? nmem_strdup(nmem, service_id) : 0; + // Setup a dictionary from server. + service->dictionary = 0; + + service->settings = nmem_malloc(nmem, sizeof(*service->settings)); + service->settings->num_settings = PZ_MAX_EOF; + service->settings->settings = nmem_malloc(nmem, sizeof(struct setting*) * service->settings->num_settings); + memset(service->settings->settings, 0, sizeof(struct setting*) * service->settings->num_settings); + // inherit_server_settings_values(service); + + service->next = 0; + service->num_metadata = num_metadata; + service->metadata = 0; if (service->num_metadata) service->metadata @@ -146,7 +159,8 @@ static struct conf_service *service_init(struct conf_server *server, service->sortkeys = nmem_malloc(nmem, sizeof(struct conf_sortkey) * service->num_sortkeys); - service->dictionary = 0; + + return service; } @@ -310,12 +324,12 @@ static int parse_metadata(struct conf_service *service, xmlNode *n, else if (!xmlStrcmp(attr->name, BAD_CAST "mergekey") && attr->children && attr->children->type == XML_TEXT_NODE) xml_mergekey = attr->children->content; - else if (!xmlStrcmp(attr->name, BAD_CAST "limitmap") && - attr->children && attr->children->type == XML_TEXT_NODE) - xml_limitmap = attr->children->content; else if (!xmlStrcmp(attr->name, BAD_CAST "facetrule") && attr->children && attr->children->type == XML_TEXT_NODE) xml_icu_chain = attr->children->content; + else if (!xmlStrcmp(attr->name, BAD_CAST "limitmap") && + attr->children && attr->children->type == XML_TEXT_NODE) + xml_limitmap = attr->children->content; else { yaz_log(YLOG_FATAL, "Unknown metadata attribute '%s'", attr->name); @@ -565,6 +579,15 @@ static struct conf_service *service_create_static(struct conf_server *server, if (service_xslt_config(service, n)) return 0; } + else if (!strcmp((const char *) n->name, (const char *) "set")) + { + xmlChar *name= xmlGetProp(n, (xmlChar *) "name"); + xmlChar *value = xmlGetProp(n, (xmlChar *) "value"); + if (service->dictionary && name && value) { + yaz_log(YLOG_DEBUG, "service set: %s=%s (Not implemented)", (char *) name, (char *) value); + //service_aply_setting(service, name, value); + } + } else { yaz_log(YLOG_FATAL, "Bad element: %s", n->name); @@ -618,8 +641,7 @@ static void inherit_server_settings(struct conf_service *s) } else { - yaz_log(YLOG_WARN, "service '%s' has no settings", - s->id ? s->id : "unnamed"); + yaz_log(YLOG_WARN, "server '%s' has no settings", s->id ? s->id : "unnamed"); init_settings(s); } } @@ -643,8 +665,7 @@ static void inherit_server_settings(struct conf_service *s) struct conf_service *service_create(struct conf_server *server, xmlNode *node) { - struct conf_service *service = service_create_static(server, - node, 0); + struct conf_service *service = service_create_static(server, node, 0); if (service) { inherit_server_settings(service);