+Added retrieval handling support in Generic Frontend Server to support
+conversion between MARC/XML as well as XSLTtransforms. See
+etc/yazgfs.xml for an example.
+
Added Authentication support to Generic Frontend Server in SRU
mode. Authentication using HTTP Basic is supported, as is the use
of 'x-username' and 'x-password' parameters in the request itself.
-<!-- $Id: yazgfs.xml,v 1.2 2006-03-15 13:32:05 adam Exp $ -->
+<!-- $Id: yazgfs.xml,v 1.3 2006-05-07 14:48:24 adam Exp $ -->
<!-- sample YAZ GFS config file .. see
http://indexdata.dk/yaz/doc/server.vhosts.tkl -->
<yazgfs>
<cql2rpn>pqf.properties</cql2rpn>
<docpath>xsl</docpath>
<stylesheet>xsl/default.xsl</stylesheet>
+ <retrievalinfo>
+ <retrieval syntax="usmarc" schema="F"/>
+ <retrieval syntax="usmarc" schema="B"/>
+ <retrieval syntax="xml" schema="marcxml"
+ identifier="info:srw/schema/1/marcxml-v1.1"
+ backendsyntax="usmarc" backendschema="F">
+ <convert>
+ <marc inputformat="marc" outputformat="marcxml"
+ inputcharset="marc-8"/>
+ </convert>
+ </retrieval>
+ <retrieval syntax="xml" schema="danmarc"
+ backendsyntax="usmarc" backendschema="F">
+ <convert>
+ <marc inputformat="marc" outputformat="marcxchange"
+ inputcharset="marc-8"/>
+ </convert>
+ </retrieval>
+ <retrieval syntax="xml" schema="dc"
+ identifier="info:srw/schema/1/dc-v1.1"
+ backendsyntax="usmarc" backendschema="F">
+ <convert>
+ <marc inputformat="marc" outputformat="marcxml"
+ inputcharset="marc-8"/>
+ <xslt stylesheet="../etc/MARC21slim2DC.xsl"/>
+ </convert>
+ </retrieval>
+ </retrievalinfo>
<explain xmlns="http://explain.z3950.org/dtd/2.0/">
<serverInfo>
<host>myserver.org</host>
- <port>9900</port>
+ <port>9000</port>
<database>Default</database>
</serverInfo>
</explain>
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*
- * $Id: record_conv.h,v 1.3 2006-05-04 20:00:45 adam Exp $
+ * $Id: record_conv.h,v 1.4 2006-05-07 14:48:24 adam Exp $
*/
/**
* \file record_conv.h
/** performs record conversion
\param p record conversion handle
- \param input_record record to be converted (0-terminated)
+ \param input_record_buf input record buffer
+ \param input_record_len length of input record buffer
\param output_record resultint record (WRBUF string)
\retval 0 success
\retval -1 failure
On failure, use yaz_record_conv_get_error to get error string.
*/
YAZ_EXPORT
-int yaz_record_conv_record(yaz_record_conv_t p, const char *input_record,
+int yaz_record_conv_record(yaz_record_conv_t p, const char *input_record_buf,
+ size_t input_record_len,
WRBUF output_record);
/** returns error string (for last error)
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*
- * $Id: retrieval.h,v 1.2 2006-05-05 18:37:08 adam Exp $
+ * $Id: retrieval.h,v 1.3 2006-05-07 14:48:24 adam Exp $
*/
/**
* \file retrieval.h
/** performs retrieval request based on schema and format
\param p retrieval handle
- \param schema record schema / element set name (Z39.50)
+ \param schema record schema (SRU) / element set name (Z39.50)
\param syntax record syntax (format)
- \param rc record conversion reference (holds conversion upon success)
- \retval 0 success
- \retval -1 falure
+ \param match_schema matched schema (if conversion was successful)
+ \param match_syntax matced syntax OID if conversion was successful)
+ \param rc record conversion reference (if conversion was successful)
+ \param backend_schema backend scchema (if conversion was successful)
+ \param backend_syntax backend syntax (if conversion was successful)
+ \retval 0 success, schema and syntax matches
+ \retval -1 failure, use yaz_retrieval_get_error() for reason
+ \retval 1 schema does not match
+ \retval 2 syntax does not match
+ \retval 3 neither schema, nor syntax matches
+ \retval 4 both match but not together
*/
YAZ_EXPORT
-int yaz_retrieval_request(yaz_retrieval_t p, const char *schema,
- const char *syntax, yaz_record_conv_t *rc);
+int yaz_retrieval_request(yaz_retrieval_t p,
+ const char *schema, int *syntax,
+ const char **match_schema, int **match_syntax,
+ yaz_record_conv_t *rc,
+ const char **backend_schema,
+ int **backend_syntax);
/** returns error string (for last error)
\param p record conversion handle
* Copyright (C) 2005-2006, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: record_conv.c,v 1.4 2006-05-04 20:00:45 adam Exp $
+ * $Id: record_conv.c,v 1.5 2006-05-07 14:48:25 adam Exp $
*/
/**
* \file record_conv.c
return 0;
}
-int yaz_record_conv_record(yaz_record_conv_t p, const char *input_record,
+int yaz_record_conv_record(yaz_record_conv_t p,
+ const char *input_record_buf,
+ size_t input_record_len,
WRBUF output_record)
{
int ret = 0;
struct yaz_record_conv_rule *r = p->rules;
wrbuf_rewind(p->wr_error);
- wrbuf_puts(record, input_record);
+ wrbuf_write(record, input_record_buf, input_record_len);
for (; ret == 0 && r; r = r->next)
{
if (r->which == YAZ_RECORD_CONV_RULE_XSLT)
* Copyright (C) 2005-2006, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: retrieval.c,v 1.2 2006-05-05 18:37:08 adam Exp $
+ * $Id: retrieval.c,v 1.3 2006-05-07 14:48:25 adam Exp $
*/
/**
* \file retrieval.c
#include <yaz/xmalloc.h>
#include <yaz/nmem.h>
#include <yaz/tpath.h>
+#include <yaz/proto.h>
#if HAVE_XSLT
#include <libxml/parser.h>
/** \brief The internal structure for yaz_retrieval_t */
struct yaz_retrieval_struct {
- /** \brief memory for configuration */
+ /** \brief ODR memory for configuration */
+ ODR odr;
+
+ /** \brief odr's NMEM memory (odr->mem) */
NMEM nmem;
/** \brief string buffer for error messages */
/** \brief schema short-hand (such sa "dc") */
const char *schema;
/** \brief record syntax */
- const char *syntax;
+ int *syntax;
/** \brief backend schema */
const char *backend_schema;
/** \brief backend syntax */
- const char *backend_syntax;
+ int *backend_syntax;
/** \brief record conversion */
yaz_record_conv_t record_conv;
- /** \breif next element in list */
+ /** \brief next element in list */
struct yaz_retrieval_elem *next;
};
yaz_retrieval_t yaz_retrieval_create()
{
yaz_retrieval_t p = xmalloc(sizeof(*p));
- p->nmem = nmem_create();
+ p->odr = odr_createmem(ODR_ENCODE);
+ p->nmem = p->odr->mem;
p->wr_error = wrbuf_alloc();
p->list = 0;
p->path = 0;
if (p)
{
yaz_retrieval_reset(p);
- nmem_destroy(p->nmem);
+ odr_destroy(p->odr);
wrbuf_free(p->wr_error, 1);
xfree(p->path);
xfree(p);
yaz_record_conv_destroy(el->record_conv);
wrbuf_rewind(p->wr_error);
- nmem_reset(p->nmem);
+ odr_reset(p->odr);
p->list = 0;
p->list_p = &p->list;
{
if (!xmlStrcmp(attr->name, BAD_CAST "syntax") &&
attr->children && attr->children->type == XML_TEXT_NODE)
- el->syntax =
- nmem_strdup(p->nmem, (const char *) attr->children->content);
+ {
+ el->syntax = yaz_str_to_z3950oid(
+ p->odr, CLASS_RECSYN,
+ (const char *) attr->children->content);
+ if (!el->syntax)
+ {
+ wrbuf_printf(p->wr_error, "Bad syntax '%s'",
+ (const char *) attr->children->content);
+ return -1;
+ }
+ }
else if (!xmlStrcmp(attr->name, BAD_CAST "identifier") &&
attr->children && attr->children->type == XML_TEXT_NODE)
el->identifier =
nmem_strdup(p->nmem, (const char *) attr->children->content);
else if (!xmlStrcmp(attr->name, BAD_CAST "backendsyntax") &&
attr->children && attr->children->type == XML_TEXT_NODE)
- el->backend_syntax =
- nmem_strdup(p->nmem, (const char *) attr->children->content);
+ {
+ el->backend_syntax = yaz_str_to_z3950oid(
+ p->odr, CLASS_RECSYN,
+ (const char *) attr->children->content);
+ if (!el->backend_syntax)
+ {
+ wrbuf_printf(p->wr_error, "Bad backendsyntax '%s'",
+ (const char *) attr->children->content);
+ return -1;
+ }
+ }
else
{
wrbuf_printf(p->wr_error, "Bad attribute '%s'.", attr->name);
return -1;
}
}
- el->record_conv = yaz_record_conv_create();
-
- yaz_record_conv_set_path(el->record_conv, p->path);
-
- if (yaz_record_conv_configure(el->record_conv, ptr->children))
+ if (!el->syntax)
{
- wrbuf_printf(p->wr_error, "%s",
- yaz_record_conv_get_error(el->record_conv));
- yaz_record_conv_destroy(el->record_conv);
+ wrbuf_printf(p->wr_error, "Missing 'syntax' attribute.", attr->name);
return -1;
}
+
+ el->record_conv = 0; /* OK to have no 'convert' sub content */
+ for (ptr = ptr->children; ptr; ptr = ptr->next)
+ {
+ if (ptr->type == XML_ELEMENT_NODE)
+ {
+ el->record_conv = yaz_record_conv_create();
+
+ yaz_record_conv_set_path(el->record_conv, p->path);
+
+ if (yaz_record_conv_configure(el->record_conv, ptr))
+ {
+ wrbuf_printf(p->wr_error, "%s",
+ yaz_record_conv_get_error(el->record_conv));
+ yaz_record_conv_destroy(el->record_conv);
+ return -1;
+ }
+ }
+ }
*p->list_p = el;
p->list_p = &el->next;
return 0;
}
-int yaz_retrieval_request(yaz_retrieval_t p, const char *schema,
- const char *syntax, yaz_record_conv_t *rc)
+int yaz_retrieval_request(yaz_retrieval_t p,
+ const char *schema, int *syntax,
+ const char **match_schema, int **match_syntax,
+ yaz_record_conv_t *rc,
+ const char **backend_schema,
+ int **backend_syntax)
{
- wrbuf_rewind(p->wr_error);
- wrbuf_printf(p->wr_error, "yaz_retrieval_request: not implemented");
- return -1;
+ struct yaz_retrieval_elem *el = p->list;
+
+ int syntax_matches = 0;
+ int schema_matches = 0;
+ for(; el; el = el->next)
+ {
+ int schema_ok = 0;
+ int syntax_ok = 0;
+
+ if (schema && el->schema && !strcmp(schema, el->schema))
+ schema_ok = 1;
+ if (schema && el->identifier && !strcmp(schema, el->identifier))
+ schema_ok = 1;
+ if (!schema)
+ schema_ok = 1;
+
+ if (syntax && el->syntax && !oid_oidcmp(syntax, el->syntax))
+ syntax_ok = 1;
+ if (!syntax)
+ syntax_ok = 1;
+
+ if (syntax_ok)
+ syntax_matches++;
+ if (schema_ok)
+ schema_matches++;
+ if (syntax_ok && schema_ok)
+ {
+ *match_syntax = el->syntax;
+ *match_schema = el->schema;
+ if (backend_schema)
+ *backend_schema = el->backend_schema;
+ if (backend_syntax)
+ *backend_syntax = el->backend_syntax;
+ if (rc)
+ *rc = el->record_conv;
+ return 0;
+ }
+ }
+ if (syntax_matches && !schema_matches)
+ return 1;
+ if (!syntax_matches && schema_matches)
+ return 2;
+ if (!syntax_matches && !schema_matches)
+ return 3;
+ return 4;
}
const char *yaz_retrieval_get_error(yaz_retrieval_t p)
* Copyright (C) 1995-2005, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: seshigh.c,v 1.76 2006-05-05 20:02:22 quinn Exp $
+ * $Id: seshigh.c,v 1.77 2006-05-07 14:48:25 adam Exp $
*/
/**
* \file seshigh.c
request_initq(&anew->incoming);
request_initq(&anew->outgoing);
anew->proto = cs_getproto(link);
- anew->cql_transform = 0;
- anew->server_node_ptr = 0;
+ anew->server = 0;
return anew;
}
return 1;
}
+static const char *get_esn(Z_RecordComposition *comp)
+{
+ if (comp && comp->which == Z_RecordComp_complex)
+ {
+ if (comp->u.complex->generic
+ && comp->u.complex->generic->elementSpec
+ && (comp->u.complex->generic->elementSpec->which ==
+ Z_ElementSpec_elementSetName))
+ return comp->u.complex->generic->elementSpec->u.elementSetName;
+ }
+ else if (comp && comp->which == Z_RecordComp_simple &&
+ comp->u.simple->which == Z_ElementSetNames_generic)
+ return comp->u.simple->u.generic;
+ return 0;
+}
+
+static void set_esn(Z_RecordComposition **comp_p, const char *esn, NMEM nmem)
+{
+ Z_RecordComposition *comp = nmem_malloc(nmem, sizeof(*comp));
+
+ comp->which = Z_RecordComp_simple;
+ comp->u.simple = nmem_malloc(nmem, sizeof(*comp->u.simple));
+ comp->u.simple->which = Z_ElementSetNames_generic;
+ comp->u.simple->u.generic = nmem_strdup(nmem, esn);
+ *comp_p = comp;
+}
+
+static int retrieve_fetch(association *assoc, bend_fetch_rr *rr)
+{
+#if HAVE_XSLT
+ yaz_record_conv_t rc = 0;
+ const char *match_schema = 0;
+ int *match_syntax = 0;
+
+ if (assoc->server)
+ {
+ int r;
+ const char *input_schema = get_esn(rr->comp);
+ Odr_oid *input_syntax_raw = rr->request_format_raw;
+
+ const char *backend_schema = 0;
+ Odr_oid *backend_syntax = 0;
+
+ r = yaz_retrieval_request(assoc->server->retrieval,
+ input_schema,
+ input_syntax_raw,
+ &match_schema,
+ &match_syntax,
+ &rc,
+ &backend_schema,
+ &backend_syntax);
+ if (r == -1) /* error ? */
+ {
+ const char *details = yaz_retrieval_get_error(
+ assoc->server->retrieval);
+
+ rr->errcode = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
+ if (details)
+ rr->errstring = odr_strdup(rr->stream, details);
+ return -1;
+ }
+ else if (r == 1)
+ {
+ const char *details = input_schema;
+ rr->errcode = YAZ_BIB1_ELEMENT_SET_NAMES_UNSUPP;
+ if (details)
+ rr->errstring = odr_strdup(rr->stream, details);
+ return -1;
+ }
+ else if (r == 2)
+ {
+ rr->errcode = YAZ_BIB1_RECORD_SYNTAX_UNSUPP;
+ return -1;
+ }
+ else if (r == 3)
+ {
+ const char *details = input_schema;
+ rr->errcode = YAZ_BIB1_ELEMENT_SET_NAMES_UNSUPP;
+ if (details)
+ rr->errstring = odr_strdup(rr->stream, details);
+ return -1;
+ }
+ else if (r == 4)
+ {
+ rr->errcode = YAZ_BIB1_RECORD_NOT_AVAILABLE_IN_REQUESTED_SYNTAX;
+ return -1;
+ }
+ if (backend_schema)
+ {
+ set_esn(&rr->comp, backend_schema, rr->stream->mem);
+ }
+ if (backend_syntax)
+ {
+ oident *oident_syntax = oid_getentbyoid(backend_syntax);
+
+ rr->request_format_raw = backend_syntax;
+
+ if (oident_syntax)
+ rr->request_format = oident_syntax->value;
+ else
+ rr->request_format = VAL_NONE;
+ }
+ }
+ (*assoc->init->bend_fetch)(assoc->backend, rr);
+ if (rc && rr->record && rr->errcode == 0 && rr->len > 0)
+ { /* post conversion must take place .. */
+ WRBUF output_record = wrbuf_alloc();
+ int r = yaz_record_conv_record(rc, rr->record, rr->len, output_record);
+ if (r)
+ {
+ const char *details = yaz_record_conv_get_error(rc);
+ rr->errcode = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
+ if (details)
+ rr->errstring = odr_strdup(rr->stream, details);
+ }
+ else
+ {
+ rr->len = wrbuf_len(output_record);
+ rr->record = odr_malloc(rr->stream, rr->len);
+ memcpy(rr->record, wrbuf_buf(output_record), rr->len);
+ }
+ wrbuf_free(output_record, 1);
+ }
+ if (match_syntax)
+ {
+ struct oident *oi = oid_getentbyoid(match_syntax);
+ rr->output_format = oi ? oi->value : VAL_NONE;
+ rr->output_format_raw = match_syntax;
+ }
+ if (match_schema)
+ rr->schema = odr_strdup(rr->stream, match_schema);
+ return 0;
+#else
+ (*assoc->init->bend_fetch)(assoc->backend, rr);
+#endif
+}
+
static int srw_bend_fetch(association *assoc, int pos,
Z_SRW_searchRetrieveRequest *srw_req,
Z_SRW_record *record)
if (!assoc->init->bend_fetch)
return 1;
- (*assoc->init->bend_fetch)(assoc->backend, &rr);
+ retrieve_fetch(assoc, &rr);
if (rr.errcode && rr.surrogate_flag)
{
if (srw_req->query_type == Z_SRW_query_type_cql)
{
- if (assoc->cql_transform)
+ if (assoc->server && assoc->server->cql_transform)
{
int srw_errcode = cql2pqf(assoc->encode, srw_req->query.cql,
- assoc->cql_transform, rr.query);
+ assoc->server->cql_transform,
+ rr.query);
if (srw_errcode)
{
yaz_add_srw_diagnostic(assoc->encode,
rr.print = assoc->print;
rr.explain_buf = 0;
rr.database = srw_req->database;
- rr.server_node_ptr = assoc->server_node_ptr;
+ if (assoc->server)
+ rr.server_node_ptr = assoc->server->server_node_ptr;
+ else
+ rr.server_node_ptr = 0;
rr.schema = "http://explain.z3950.org/dtd/2.0/";
if (assoc->init->bend_explain)
(*assoc->init->bend_explain)(assoc->backend, &rr);
(*assoc->init->bend_scan))(assoc->backend, bsrr);
}
else if (srw_req->query_type == Z_SRW_query_type_cql
- && assoc->init->bend_scan && assoc->cql_transform)
+ && assoc->init->bend_scan && assoc->server
+ && assoc->server->cql_transform)
{
int srw_error;
bsrr->scanClause = 0;
bsrr->term = odr_malloc(assoc->decode, sizeof(*bsrr->term));
srw_error = cql2pqf_scan(assoc->encode,
srw_req->scanClause.cql,
- assoc->cql_transform,
+ assoc->server->cql_transform,
bsrr->term);
if (srw_error)
yaz_add_srw_diagnostic(assoc->encode, &srw_res->diagnostics,
p = z_get_HTTP_Response(o, 404);
r = 1;
}
- if (r == 2 && assoc->docpath && hreq->path[0] == '/'
+ if (r == 2 && assoc->server && assoc->server->docpath
+ && hreq->path[0] == '/'
&&
/* check if path is a proper prefix of documentroot */
- strncmp(hreq->path+1, assoc->docpath, strlen(assoc->docpath))
+ strncmp(hreq->path+1, assoc->server->docpath,
+ strlen(assoc->server->docpath))
== 0)
{
if (!check_path(hreq->path))
p = z_get_HTTP_Response(o, 200);
hres = p->u.HTTP_Response;
- if (!stylesheet)
- stylesheet = assoc->stylesheet;
+ if (!stylesheet && assoc->server)
+ stylesheet = assoc->server->stylesheet;
/* empty stylesheet means NO stylesheet */
if (stylesheet && *stylesheet == '\0')
assoc->init->implementation_name,
odr_prepend(assoc->encode, "GFS", resp->implementationName));
- version = odr_strdup(assoc->encode, "$Revision: 1.76 $");
+ version = odr_strdup(assoc->encode, "$Revision: 1.77 $");
if (strlen(version) > 10) /* check for unexpanded CVS strings */
version[strlen(version)-2] = '\0';
resp->implementationVersion = odr_prepend(assoc->encode,
freq.print = a->print;
freq.referenceId = referenceId;
freq.schema = 0;
- (*a->init->bend_fetch)(a->backend, &freq);
+
+ retrieve_fetch(a, &freq);
*next = freq.last_in_set ? 0 : recno + 1;
bsrr->errstring = NULL;
bsrr->search_info = NULL;
- if (assoc->cql_transform &&
- req->query->which == Z_Query_type_104 &&
- req->query->u.type_104->which == Z_External_CQL)
+ if (assoc->server && assoc->server->cql_transform
+ && req->query->which == Z_Query_type_104
+ && req->query->u.type_104->which == Z_External_CQL)
{
/* have a CQL query and a CQL to PQF transform .. */
int srw_errcode =
cql2pqf(bsrr->stream, req->query->u.type_104->u.cql,
- assoc->cql_transform, bsrr->query);
+ assoc->server->cql_transform, bsrr->query);
if (srw_errcode)
bsrr->errcode = yaz_diag_srw_to_bib1(srw_errcode);
}
/*
- * Copyright (C) 1995-2005, Index Data ApS
+ * Copyright (C) 1995-2006, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: session.h,v 1.10 2006-03-15 13:32:05 adam Exp $
+ * $Id: session.h,v 1.11 2006-05-07 14:48:25 adam Exp $
*/
/**
* \file session.h
#include <yaz/oid.h>
#include <yaz/proto.h>
#include <yaz/backend.h>
+#include <yaz/retrieval.h>
#include "eventl.h"
struct gfs_server {
char *directory;
char *docpath;
char *stylesheet;
+ yaz_retrieval_t retrieval;
struct gfs_server *next;
};
struct bend_initrequest *init;
statserv_options_block *last_control;
- cql_transform_t cql_transform;
- void *server_node_ptr;
- const char *docpath;
- const char *stylesheet;
+
+ struct gfs_server *server;
} association;
association *create_association(IOCHAN channel, COMSTACK link,
/*
- * Copyright (C) 1995-2005, Index Data ApS
+ * Copyright (C) 1995-2006, Index Data ApS
* See the file LICENSE for details.
*
* NT threaded server code by
* Chas Woodfield, Fretwell Downing Informatics.
*
- * $Id: statserv.c,v 1.36 2006-03-22 17:58:32 mike Exp $
+ * $Id: statserv.c,v 1.37 2006-05-07 14:48:25 adam Exp $
*/
/**
n->directory = 0;
n->docpath = 0;
n->stylesheet = 0;
+#if HAVE_XSLT
+ n->retrieval = yaz_retrieval_create();
+#endif
return n;
}
*cp = '\0';
host = vhost;
}
- assoc->cql_transform = 0;
- assoc->server_node_ptr = 0;
- assoc->docpath = 0;
- assoc->stylesheet = 0;
+ assoc->server = 0;
if (control_block.xml_config[0])
{
struct gfs_server *gfs;
xfree(assoc->init);
assoc->init = 0;
}
- assoc->docpath = gfs->docpath;
- assoc->stylesheet = gfs->stylesheet;
- assoc->cql_transform = gfs->cql_transform;
- assoc->server_node_ptr = gfs->server_node_ptr;
+ assoc->server = gfs;
assoc->last_control = &gfs->cb;
statserv_setcontrol(&gfs->cb);
gfs_server_chdir(gfs);
{
; /* being processed separately */
}
+ else if (!strcmp((const char *) ptr->name, "retrievalinfo"))
+ {
+ if (yaz_retrieval_configure((*gfsp)->retrieval, ptr))
+ {
+ yaz_log(YLOG_FATAL, "%s in config %s",
+ yaz_retrieval_get_error((*gfsp)->retrieval),
+ control_block.xml_config);
+ exit(1);
+ }
+ }
else
{
yaz_log(YLOG_FATAL, "Unknown element '%s' in config %s",
* Copyright (C) 2005-2006, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: tst_record_conv.c,v 1.5 2006-05-05 18:37:08 adam Exp $
+ * $Id: tst_record_conv.c,v 1.6 2006-05-07 14:48:25 adam Exp $
*
*/
#include <yaz/record_conv.h>
else
{
WRBUF output_record = wrbuf_alloc();
- int r = yaz_record_conv_record(p, input_record, output_record);
+ int r = yaz_record_conv_record(p, input_record, strlen(input_record),
+ output_record);
if (r)
{
if (output_expect_record)
* Copyright (C) 2005-2006, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: tst_retrieval.c,v 1.2 2006-05-05 18:37:08 adam Exp $
+ * $Id: tst_retrieval.c,v 1.3 2006-05-07 14:48:25 adam Exp $
*
*/
#include <yaz/retrieval.h>
"Bad element 'bad'."
" Expected 'retrieval'", 0));
+ YAZ_CHECK(conv_configure_test("<retrievalinfo><retrieval/>"
+ "</retrievalinfo>", 0, 0));
+
YAZ_CHECK(conv_configure_test("<retrievalinfo>"
- "<retrieval>"
+ "<retrieval>\n"
+ " "
"<convert>"
"<xslt stylesheet=\"tst_record_conv.xsl\"/>"
"<marc"
"</retrieval>"
"</retrievalinfo>",
0, 0));
+
+
+ YAZ_CHECK(conv_configure_test("<retrievalinfo>"
+ "<retrieval"
+ " syntax=\"usmarc\""
+ " schema=\"marcxml\""
+ " identifier=\"info:srw/schema/1/marcxml-v1.1\""
+ ">"
+ "<convert/>"
+ "</retrieval>"
+ "</retrievalinfo>",
+ 0, 0));
+
+ YAZ_CHECK(conv_configure_test("<retrievalinfo>"
+ "<retrieval"
+ " syntax=\"unknown_synt\""
+ ">"
+ "<convert/>"
+ "</retrieval>"
+ "</retrievalinfo>",
+ "Bad syntax 'unknown_synt'", 0));
+
+ YAZ_CHECK(conv_configure_test("<retrievalinfo>"
+ "<retrieval"
+ " backendsyntax=\"unknown_synt\""
+ ">"
+ "<convert/>"
+ "</retrieval>"
+ "</retrievalinfo>",
+ "Bad backendsyntax 'unknown_synt'", 0));
+
}
#endif