From 514227c1ea1fee19ad220a34d58013f495a39ad9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Wed, 28 Mar 2007 11:52:28 +0000 Subject: [PATCH] merge --- org.glite.jp.ws-interface/Makefile | 14 ++- .../project/version.properties | 4 +- org.glite.jp.ws-interface/src/JobProvenanceIS.xml | 21 ++-- org.glite.jp.ws-interface/src/JobProvenancePS.xml | 23 ++-- org.glite.jp.ws-interface/src/puke-ug.xsl | 2 +- org.glite.jp.ws-interface/src/ws_fault.c | 125 +++++++++++++++++++++ 6 files changed, 156 insertions(+), 33 deletions(-) create mode 100644 org.glite.jp.ws-interface/src/ws_fault.c diff --git a/org.glite.jp.ws-interface/Makefile b/org.glite.jp.ws-interface/Makefile index bbd4c5b..905d02e 100644 --- a/org.glite.jp.ws-interface/Makefile +++ b/org.glite.jp.ws-interface/Makefile @@ -5,6 +5,7 @@ top_builddir=${top_srcdir}/${builddir} stagedir=. distdir=. globalprefix=glite +jpprefix=jp package=glite-jp-ws-interface version=0.0.0 PREFIX=/opt/glite @@ -16,6 +17,7 @@ STAGETO=interface XSLTPROC=xsltproc --nonet XMLLINT:=xmllint --nonet +TIDY:=tidy -i -q --show-warnings no --tidy-mark no --wrap 0 docbookxls:=http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl WSDL=JobProvenancePS.wsdl JobProvenanceIS.wsdl JobProvenanceTypes.wsdl @@ -45,21 +47,27 @@ distbin: install: -mkdir -p ${PREFIX}/${STAGETO} -mkdir -p ${PREFIX}/share/doc/${package}-${version} + -mkdir -p ${PREFIX}/include/${globalprefix}/${jpprefix} install -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version} - install -m 644 JobProvenance.html ${PREFIX}/share/doc/${package}-${version} + -install -m 644 JobProvenance.html ${PREFIX}/share/doc/${package}-${version} # cd ${top_srcdir}/interface && install -m 644 ${WSDL} ${PREFIX}/${STAGETO} install -m 644 ${WSDL} ${XSD} ${PREFIX}/${STAGETO} + install -m 644 ${top_srcdir}/src/ws_fault.c ${PREFIX}/include/${globalprefix}/${jpprefix} clean: rm -f *.h %.wsdl: %.xml puke-wsdl.xsl ${XSLTPROC} ../src/puke-wsdl.xsl $< >$@ + -${TIDY} -xml -m $@ %.xsd: %.xml puke-schema.xsl ${XSLTPROC} ../src/puke-schema.xsl $< >$@ + -${TIDY} -xml -m $@ JobProvenance.html: doc.xml JobProvenancePS.xml JobProvenanceIS.xml JobProvenanceTypes.xml puke-ug.xsl - ${XSLTPROC} --novalid ../src/puke-ug.xsl $< >doc-html.xml - ${XMLLINT} --valid --noout doc-html.xml + -${XSLTPROC} --novalid ../src/puke-ug.xsl $< >doc-html.xml && \ ${XSLTPROC} --stringparam chapter.autolabel 0 ${docbookxls} doc-html.xml >$@ + -${TIDY} -xml -m doc-html.xml + -${XMLLINT} --valid --noout doc-html.xml + -${TIDY} -asxhtml -m $@ diff --git a/org.glite.jp.ws-interface/project/version.properties b/org.glite.jp.ws-interface/project/version.properties index ff80206..80cbe6b 100755 --- a/org.glite.jp.ws-interface/project/version.properties +++ b/org.glite.jp.ws-interface/project/version.properties @@ -1,2 +1,2 @@ -module.version=1.2.0 -module.age=0 +module.version=1.2.2 +module.age=1 diff --git a/org.glite.jp.ws-interface/src/JobProvenanceIS.xml b/org.glite.jp.ws-interface/src/JobProvenanceIS.xml index c811e69..0a62af8 100644 --- a/org.glite.jp.ws-interface/src/JobProvenanceIS.xml +++ b/org.glite.jp.ws-interface/src/JobProvenanceIS.xml @@ -4,8 +4,7 @@ typeNs="http://glite.org/wsdl/types/jp" typePrefix="jpt" elemNs="http://glite.org/wsdl/elements/jp" - elemPrefix="jpe" - xmlns:jpt="http://glite.org/wsdl/types/jp"> + elemPrefix="jpe"> CVS revision: @@ -13,18 +12,16 @@ - The Job Provenance (JP) Index Server is a volatile counterpart to the - permanent JP Primary Storage. - Index servers are populated with subsets of data from Primary storage(s) - and indexed according to particular user needs. + The Job Provenance (JP) Index Server is a volatile counterpart to the + permanent JP Primary Storage. Index servers are populated with subsets + of data from Primary storage(s) and indexed according to particular user needs. + - The interface to Index server contains three logical parts: administraive - (control), system and user. - The administrative part is used by run-time index server configuration - tool, - the system one allows Primary storage(s) to feed data into the Index server, - and the user one is available to users for queries. + The interface to Index server contains three logical parts: administraive + (control), system and user. The administrative part is used by run-time index + server configuration tool, the system one allows Primary storage(s) to feed + data into the Index server, and the user one is available to users for queries. diff --git a/org.glite.jp.ws-interface/src/JobProvenancePS.xml b/org.glite.jp.ws-interface/src/JobProvenancePS.xml index 611e939..8a59640 100644 --- a/org.glite.jp.ws-interface/src/JobProvenancePS.xml +++ b/org.glite.jp.ws-interface/src/JobProvenancePS.xml @@ -4,8 +4,7 @@ typeNs="http://glite.org/wsdl/types/jp" typePrefix="jpt" elemNs="http://glite.org/wsdl/elements/jp" - elemPrefix="jpe" - xmlns:jpt="http://glite.org/wsdl/types/jp"> + elemPrefix="jpe"> CVS revision: @@ -13,22 +12,16 @@ - The Job Provenance (JP) Primary Storage Service is responsible - to keep the JP data - (definition of submitted jobs, execution conditions and environment, - and important points of the job life cycle) in a compact and - economic form. + The Job Provenance (JP) Primary Storage Service is responsible to keep the JP data + (definition of submitted jobs, execution conditions and environment, and important + points of the job life cycle) in a compact and economic form. - The JP Primary storage, as described in section 8.4 of - the - - Architecture deliverable DJRA1.1 - - provides public interfaces for data storing, - retrieval based on basic metadata, and registration of Index servers for - incremental feed. + The JP Primary storage, as described in section 8.4 of the + Architecture deliverable DJRA1.1 + provides public interfaces for data storing, retrieval based on basic metadata, + and registration of Index servers for incremental feed. diff --git a/org.glite.jp.ws-interface/src/puke-ug.xsl b/org.glite.jp.ws-interface/src/puke-ug.xsl index 8ce605b..d3dbdd4 100644 --- a/org.glite.jp.ws-interface/src/puke-ug.xsl +++ b/org.glite.jp.ws-interface/src/puke-ug.xsl @@ -5,7 +5,7 @@ - diff --git a/org.glite.jp.ws-interface/src/ws_fault.c b/org.glite.jp.ws-interface/src/ws_fault.c new file mode 100644 index 0000000..2623ae9 --- /dev/null +++ b/org.glite.jp.ws-interface/src/ws_fault.c @@ -0,0 +1,125 @@ +#ident "$Header: " + +#include +#include +#include + +#define GSOAP_STRING(CHOICE) GLITE_SECURITY_GSOAP_CHOICE_GET(CHOICE, string, stringOrBlob, 1) +#define GSOAP_BLOB(CHOICE) GLITE_SECURITY_GSOAP_CHOICE_GET(CHOICE, blob, stringOrBlob, 1) +#define GSOAP_SETSTRING(CHOICE, VALUE) GLITE_SECURITY_GSOAP_CHOICE_SET(CHOICE, string, jptype, stringOrBlob, 1, VALUE) +#define GSOAP_SETBLOB(CHOICE, VALUE) GLITE_SECURITY_GSOAP_CHOICE_SET(CHOICE, blob, jptype, stringOrBlob, 1, VALUE) +#define GSOAP_ISSTRING(CHOICE) GLITE_SECURITY_GSOAP_CHOICE_ISTYPE(CHOICE, string, jptype, stringOrBlob, 1) +#define GSOAP_ISBLOB(CHOICE) GLITE_SECURITY_GSOAP_CHOICE_ISTYPE(CHOICE, blob, jptype, stringOrBlob, 1) + +#if GSOAP_VERSION >= 20709 + #define GFNUM SOAP_TYPE_jptype__genericFault +#else + #define GFNUM SOAP_TYPE__genericFault +#endif + +#ifndef dprintf +#define dprintf(FMT, ARGS...) printf(FMT, ##ARGS) +#endif + +static int glite_jp_clientCheckFault(struct soap *soap, int err, const char *name, int toSyslog) { + struct SOAP_ENV__Detail *detail; + struct jptype__genericFault *f; + char *reason,indent[200] = " "; + char *prefix; + int retval; + + if (name) asprintf(&prefix, "[%s] ", name); + else prefix = strdup(""); + retval = 0; + + switch(err) { + case SOAP_OK: + dprintf("%sOK\n", prefix); + break; + + case SOAP_FAULT: + case SOAP_SVR_FAULT: + detail = GLITE_SECURITY_GSOAP_DETAIL(soap); + reason = GLITE_SECURITY_GSOAP_REASON(soap); + dprintf("%s%s\n", prefix, reason); + if (toSyslog) syslog(LOG_ERR, "%s", reason); + + if (detail->__type != GFNUM && detail->__any) { + // compatibility with clients gSoaps < 2.7.9b + dprintf("%s%s%s\n", prefix, indent, detail->__any); + if (toSyslog) syslog(LOG_ERR, "%s", detail->__any); + + f = NULL; + } else { + // client is based on gSoap 2.7.9b + assert(detail->__type == GFNUM); +#if GSOAP_VERSION >= 20709 + f = (struct jptype__genericFault *)detail->fault; +#elif GSOAP_VERSION >= 20700 + f = ((struct _genericFault *)detail->fault)->jpelem__genericFault; +#else + f = ((struct _genericFault *)detail->value)->jpelem__genericFault; +#endif + } + + while (f) { + dprintf("%s%s%s: %s (%s)\n", + prefix, indent, + f->source, f->text, f->description); + if (toSyslog) syslog(LOG_ERR, "%s%s: %s (%s)", + reason, f->source, f->text, f->description); + f = f->reason; + strcat(indent," "); + } + retval = -1; + break; + + default: + soap_print_fault(soap,stderr); + retval = -1; + } + + free(prefix); + return retval; +} + + +static struct jptype__genericFault* jp2s_error(struct soap *soap, const glite_jp_error_t *err) +{ + struct jptype__genericFault *ret = NULL; + if (err) { + ret = soap_malloc(soap,sizeof *ret); + memset(ret,0,sizeof *ret); + ret->code = err->code; + ret->source = soap_strdup(soap,err->source); + ret->text = soap_strdup(soap,strerror(err->code)); + ret->description = soap_strdup(soap,err->desc); + ret->reason = jp2s_error(soap,err->reason); + } + return ret; +} + + +static void glite_jp_server_err2fault(const glite_jp_context_t ctx,struct soap *soap) +{ + struct SOAP_ENV__Detail *detail = soap_malloc(soap,sizeof *detail); +#if GSOAP_VERSION >= 20709 + struct jptype__genericFault *f; + f = jp2s_error(soap,ctx->error); +#else + struct _genericFault *f = soap_malloc(soap, sizeof *f); + f->jpelem__genericFault = jp2s_error(soap,ctx->error); +#endif + memset(detail, 0, sizeof(*detail)); +#if GSOAP_VERSION >= 20700 + detail->fault = (void *)f; +#else + detail->value = (void *)f; +#endif + detail->__type = GFNUM; + detail->__any = NULL; + + soap_receiver_fault(soap,"Oh, shit!",NULL); + if (soap->version == 2) soap->fault->SOAP_ENV__Detail = detail; + else soap->fault->detail = detail; +} -- 1.8.2.3