merge
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Wed, 28 Mar 2007 11:52:28 +0000 (11:52 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Wed, 28 Mar 2007 11:52:28 +0000 (11:52 +0000)
org.glite.jp.ws-interface/Makefile
org.glite.jp.ws-interface/project/version.properties
org.glite.jp.ws-interface/src/JobProvenanceIS.xml
org.glite.jp.ws-interface/src/JobProvenancePS.xml
org.glite.jp.ws-interface/src/puke-ug.xsl
org.glite.jp.ws-interface/src/ws_fault.c [new file with mode: 0644]

index bbd4c5b..905d02e 100644 (file)
@@ -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 $@
index c811e69..0a62af8 100644 (file)
@@ -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">
 
        <version>CVS revision: <![CDATA[ $Header$ ]]></version>
 
 
        <doc>
                <para>
-                       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.
                </para>
+
                <para>
-                       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.
                </para>
        </doc>
 
index 611e939..8a59640 100644 (file)
@@ -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">
 
        <version>CVS revision: <![CDATA[ $Header$ ]]></version>
 
 
        <doc>
                <para>
-               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.
                </para>
 
                <para>
-               The JP Primary storage, as described in section 8.4 of
-               the 
-               <ulink url="https://edms.cern.ch/document/594698/">
-               Architecture deliverable DJRA1.1 
-               </ulink>
-               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 
+               <ulink url="https://edms.cern.ch/document/594698/">Architecture deliverable DJRA1.1 </ulink>
+               provides public interfaces for data storing, retrieval based on basic metadata, 
+               and registration of Index servers for incremental feed.
                </para>
 
                <para>
index 8ce605b..d3dbdd4 100644 (file)
@@ -5,7 +5,7 @@
 <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
-<xsl:output indent="yes" doctype-public="-//OASIS//DTD DocBook XML V4.4//EN"
+<xsl:output indent="yes" doctype-public="-//OASIS//DTD DocBook XML V4.2//EN"
       doctype-system="http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"/>
 
 <xsl:template match="book">
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 (file)
index 0000000..2623ae9
--- /dev/null
@@ -0,0 +1,125 @@
+#ident "$Header: "
+
+#include <syslog.h>
+#include <glite/jp/types.h>
+#include <glite/security/glite_gscompat.h>
+
+#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;
+}