Update of /cvsroot/monetdb/pathfinder/runtime
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv8099/runtime

Modified Files:
        pathfinder.mx pf_support.mx serialize.mx serialize_dflt.mx 
        serialize_null.mx serialize_sax.mx shredder.mx xrpc_client.mx 
        xrpc_server.mx 
Log Message:
propagated changes of Wednesday Feb 07 2007 - Friday Feb 09 2007
from the XQuery_0-16 branch to the development trunk



Index: serialize_sax.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/serialize_sax.mx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- serialize_sax.mx    3 Jan 2007 12:33:13 -0000       1.12
+++ serialize_sax.mx    9 Feb 2007 23:41:15 -0000       1.13
@@ -165,10 +165,13 @@
  * Default driver initialization function
  */
 static bool
-sax_init (XqueryCtx* ctx, char* args, char *restag, char *resprefix)
+sax_init (XqueryCtx* ctx, char* args, char *restag, char *resprefix, char 
*module, char *method)
 {
     (void) args;
     (void) resprefix;
+    (void) module;
+    (void) method;
+
     ctx->driverWs = (void *) restag; /* store result tag */
     sax_init_isspecial();
 

Index: pathfinder.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/pathfinder.mx,v
retrieving revision 1.293
retrieving revision 1.294
diff -u -d -r1.293 -r1.294
--- pathfinder.mx       4 Feb 2007 22:54:20 -0000       1.293
+++ pathfinder.mx       9 Feb 2007 23:41:12 -0000       1.294
@@ -2622,9 +2622,9 @@
 # pf:collection(), get 'collection root' as a single startpoint to query an 
entire collection
 PROC ws_collection_root(BAT[void,BAT] ws, BAT[void,str] colnames) : 
BAT[oid,oid]
 {
-    pflock_meta(ws_id(ws)); # stop all concurrent shred_doc/del_doc activities
     lock_set(pf_short);
-    var colname_coll, err := CATCH(colname_coll := 
reverse(colnames).mirror().leftjoin(reverse(collection_name)));
+    var colname_coll, err := CATCH({ colname_coll := 
reverse(colnames).mirror().leftjoin(reverse(collection_name));
+                                     
colname_pins.insert(colname_coll.kunique().project(ws_id(ws))); });
     lock_unset(pf_short);
     var notfound := colname_coll.kdiff(reverse(colnames));
     if (count(notfound) > 0) ERROR("pf:collection() %s not found (%d such 
errors).\n", notfound.fetch(0), count(notfound));
@@ -2642,7 +2642,6 @@
     var err, idx_coll, idx_doc, idx_colname, idx_names;
     nms := nms.fetch(nms.tmark([EMAIL 
PROTECTED]).[startsWith]("::").ord_uselect(false));
 
-    pflock_meta(ws_id(ws)); # stop all concurrent shred_doc/del_doc activities
     lock_set(pf_short);
     err := CATCH({ var doc := 
nms.leftjoin(reverse(collection_name)).leftjoin(reverse(doc_collection)).tsort();
                    idx_names := doc.leftjoin(doc_name);
@@ -2661,7 +2660,7 @@
 {
     pflock_meta(ws_id(ws)); # stop all concurrent shred_doc/del_doc activities
     lock_set(pf_short);
-    var res, err := CATCH(res := 
reverse(reverse(collection_name).project([EMAIL PROTECTED])));
+    var res, err := CATCH(res := 
reverse(collection_name.[startsWith]("::").uselect(false).project([EMAIL 
PROTECTED])).leftjoin(collection_name));
     lock_unset(pf_short);
     if (not(isnil(err))) ERROR(err);
     return res;
@@ -2678,12 +2677,12 @@
     return res;
 }
 
-# fn:documents(), get all document *names* in a collection
+# fn:documents(), get all document *names* 
 PROC ws_documents(BAT[void,BAT] ws) : BAT[void,str]
 {
     pflock_meta(ws_id(ws)); # stop all concurrent shred_doc/del_doc activities
     lock_set(pf_short);
-    var res, err := CATCH(res := doc_name.tmark([EMAIL PROTECTED]));
+    var res, err := CATCH(res := 
reverse(doc_name.[startsWith]("::").uselect(false).project([EMAIL 
PROTECTED])).leftjoin(doc_name));
     lock_unset(pf_short);
     if (not(isnil(err))) ERROR(err);
     return res;
@@ -3264,6 +3263,13 @@
 @:ws(c_decl)@
 @:ws_decl(c)@
 
+#define SOAP_NS  "http://www.w3.org/2003/05/soap-envelope";
+#define XDT_NS   "http://www.w3.org/2005/xpath-datatypes";
+#define XS_NS    "http://www.w3.org/2001/XMLSchema";
+#define XSI_NS   "http://www.w3.org/2001/XMLSchema-instance";
+#define XRPC_NS  "http://monetdb.cwi.nl/XQuery";
+#define XRPC_LOC "http://monetdb.cwi.nl/XQuery/XRPC.xsd";
+
 #define XTRACT_KIND(X)     (X & 63)
 #define XTRACT_CONT(X)     (X >> 6)
 #define SET_CONT_KIND(X,Y) (X << 6 | Y)
@@ -3284,7 +3290,7 @@
 pathfinder_export char *
 xquery_method(stream *out, 
               int timing,
-              char* module, 
+              char* moduleNS, 
               char* uri, 
               char *method, 
               lng argc, 
@@ -3475,6 +3481,8 @@
     lng *time_shred; 
     lng *time_exec; 
     lng *time_print; 
+    char **moduleNS;
+    char **method;
     char **genType;
 
     /* counts used to remove query (non-module) procs and stacks after 
execution */
@@ -3961,7 +3969,7 @@
 
             if (shredBAT) {
                 /* add shredded RPC request message to the working set */
-                src = (char*) PFdocbatMIL();
+                src = " ws_opencoll(ws, bat(shredBAT), \"\", TEMP_DOC);\n";
                 while(*src && cur < end) *cur++ = *src++;
             }
 
@@ -4340,6 +4348,8 @@
 
     @:find_var(shredBAT,int,ival)@
     @:find_var(genType,str,sval)@
+    @:find_var(moduleNS,str,sval)@
+    @:find_var(method,str,sval)@
     @:find_var(time_compile,lng,lval)@
     @:find_var(time_exec,lng,lval)@
     @:find_var(time_print,lng,lval)@
@@ -4824,8 +4834,7 @@
         } else {
             /* e.g. import module namespace xmark = "/cygwin/tmp/" at 
"/cygwin/tmp/mod1.xq" */
             p = xquery_parse_space(p+6);
-            if ( (strncmp(p, "module", 6) == 0 && ISSPACE(p[6])) ||
-                 (strncmp(p, "rpc-module", 10) == 0 && ISSPACE(p[10])) ){
+            if ( (strncmp(p, "module", 6) == 0 && ISSPACE(p[6])) ){
                 len = p[0] == 'm' ? 6 : 10;
                 p = xquery_parse_space(p+len);
                 if (strncmp(p, "namespace", 9) == 0 && ISSPACE(p[9])) {
@@ -5263,7 +5272,7 @@
               int timing,
               char* module,
               char* uri,
-              char *method,
+              char* method,
               lng argc,
               lng itercnt,
               lng** argcnt,
@@ -5274,7 +5283,7 @@
     lng usec = GDKusec();
     MT_Id XQthread_id = THRgettid(), old_tid;
     Thread XQthread = THRget(XQthread_id), old_thread;
-    char *err, *ns = "fn", *mode = "xml-noheader-xrpc";
+    char *err, *buf, *ns = "fn", *mode = "xml-noheader-xrpc";
     stream *s = NULL;
     mapi_client *mc = MAPIclient(GDKin, out, "xquery" );
     xquery_client *ctx;
@@ -5287,6 +5296,11 @@
     ctx->fderr = GDKerr;
     ctx->mode = 0;
 
+    buf = GDKstrdup(module);
+    (*ctx->moduleNS) = buf;
+    buf = GDKstrdup(method);
+    (*ctx->method) = buf;
+
     if (timing){
         mode = "timing-xml-noheader-xrpc";
     }

Index: serialize.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/serialize.mx,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -d -r1.87 -r1.88
--- serialize.mx        25 Jan 2007 00:50:25 -0000      1.87
+++ serialize.mx        9 Feb 2007 23:41:13 -0000       1.88
@@ -162,7 +162,8 @@
 typedef struct serializeFunStruct {
     const char* name;
     /* the initialization handler */
-    bool (*init)(XqueryCtx* ctx, char* args, char* restag, char* resprefix);
+    bool (*init)(XqueryCtx* ctx, char* args, char* restag,
+                 char* resprefix, char* module, char* method);
     /* the clean up handler */
     bool (*cleanup)(XqueryCtx* ctx);
 
@@ -226,6 +227,8 @@
 pf_support_export int
 xquery_print_result_loop (
     str  mode,
+    str  moduleNS,
+    str  method,
     BAT* ws,
     BAT* loop, 
     BAT* iter, 
@@ -259,6 +262,8 @@
 pf_support_export int
 xquery_print_result_DRIVER (
     str                 mode,
+    str                 moduleNS,
+    str                 method,
     serializeFunStruct *driverFun, /* unused */
     char               *driverArg, /* unused */
     BAT                *ws,
@@ -276,6 +281,8 @@
 xquery_print_result_driver (
     Stream              fp,
     str                 mode,
+    str                 module,
+    str                 method,
     serializeFunStruct *driverFun, /* unused */
     char               *driverArg, /* unused */
     BAT                *ws,
@@ -1273,6 +1280,8 @@
 createWsContext (XqueryCtx*        ctx,
                  BAT*              ws,
                  str               mode,
+                 str               module,
+                 str               method,
                  serializeFunStruct*    driverFun,
                  char*             driverArg,
                  Stream            fp)
@@ -1326,6 +1335,18 @@
         /* we may wrap each item in an element
            specifying its type */
         if (match(mode, "xrpc")) {
+            if (!module) {
+                fatal_err (ctx,
+                        "the namespace of called module is "
+                        "required in \"xrpc\" mode");
+                return PROBLEM;
+            }
+            if (!method) {
+                fatal_err (ctx,
+                        "the name of called function is "
+                        "required in \"xrpc\" mode");
+                return PROBLEM;
+            }
             resprefix = "xrpc";
             ctx->modes = ctx->modes | MODE_XRPC;
             /* in "XRPC" mode, the line "<?xml ...?>" is printed by
@@ -1403,7 +1424,7 @@
     else
         return PROBLEM;
     
-    if ( !ctx->driverFun->init(ctx, driverArg, restag, resprefix) )
+    if ( !ctx->driverFun->init(ctx, driverArg, restag, resprefix, module, 
method) )
         return PROBLEM;
 
     return SUCCESS;
@@ -1485,7 +1506,7 @@
         GDKerror("serialize.mx: unable to find document \"%s\" in working 
set!\n", docName);
     } else { 
         XqueryCtx  ctx_struct, *ctx = &ctx_struct;
-        if (createWsContext(ctx,ws,mode,driverFun,driverArg,GDKout)) {
+        if (createWsContext(ctx,ws,mode,NULL,NULL,driverFun,driverArg,GDKout)) 
{
             if (ctx->driverFun->handle_startDocument(ctx)) {
                 ptr p;
                 getWsValue(p, ctx, docIndex, PRE_SIZE, 0 /* start */);
@@ -1564,6 +1585,8 @@
 xquery_print_result_driver (
     Stream              fp,
     str                 mode,
+    str                 module,
+    str                 method,
     serializeFunStruct *driverFun, /* unused */
     char               *driverArg, /* unused */
     BAT                *ws,
@@ -1583,7 +1606,7 @@
     static BUN (*fun_k) (BAT *, oid);
 
     /* prepare serialization */ 
-    if ( !createWsContext (ctx, ws, mode, driverFun, driverArg, fp) )
+    if ( !createWsContext (ctx, ws, mode, module, method, driverFun, 
driverArg, fp) )
         return GDK_FAIL;
 
     curcnt = 0;
@@ -1841,6 +1864,8 @@
 int 
 xquery_print_result_DRIVER (
     str                 mode,
+    str                 moduleNS,
+    str                 method,
     serializeFunStruct *driverFun,
     char               *driverArg,
     BAT                *ws,
@@ -1858,6 +1883,8 @@
     return xquery_print_result_driver (
                GDKout,
                mode,
+               moduleNS,
+               method,
                driverFun, /* set of printing callback function */
                driverArg, /* optional arguments for the callback functions */
                ws,
@@ -1874,6 +1901,8 @@
 int
 xquery_print_result_loop (
     str  mode,
+    str  moduleNS,
+    str  method,
     BAT* ws,
     BAT* loop, 
     BAT* iter, 
@@ -1886,6 +1915,8 @@
     size_t niters = BATcount (loop);
     return xquery_print_result_DRIVER (
                mode,
+               moduleNS,
+               method,
                NULL, /* set of printing callback function */
                NULL, /* optional arguments for the callback functions */
                ws,
@@ -1914,6 +1945,8 @@
     
     return xquery_print_result_DRIVER (
                mode,
+               NULL, /* module */
+               NULL, /* method */
                NULL, /* set of printing callback function */
                NULL, /* optional arguments for the callback functions */
                ws,
@@ -1962,6 +1995,8 @@
                         ret = xquery_print_result_driver (
                              s,
                              mode,
+                             NULL, /* module */
+                             NULL, /* method */
                              NULL, /* set of printing callback function */
                              NULL, /* optional arguments for the callback 
functions */
                              ws,

Index: pf_support.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/pf_support.mx,v
retrieving revision 1.193
retrieving revision 1.194
diff -u -d -r1.193 -r1.194
--- pf_support.mx       4 Feb 2007 22:54:20 -0000       1.193
+++ pf_support.mx       9 Feb 2007 23:41:13 -0000       1.194
@@ -59,24 +59,26 @@
 .COMMAND print_doc(str,BAT[void,bat], str) : void = xquery_print_doc_main;
  "C interface to Workset print routine"
 
-.COMMAND print_result(str mode, BAT[oid,bat] ws,
+.COMMAND print_result(str mode, str moduleNS, str method,
+                      BAT[oid,bat] ws,
                       BAT[oid,any] loop, BAT[void,oid] iter,
                       BAT[void,oid] item, BAT[void,int] kind, 
                       BAT[oid,lng] int_values, BAT[oid,dbl] dbl_values, 
-                      BAT[oid,str] str_values) : void = 
xquery_print_result_loop;
+                      BAT[oid,str] str_values) :
+                            void = xquery_print_result_loop;
  "C interface to Workset result print routine, that can print multiple iters"
 
 .COMMAND print_result(str mode, BAT[void,bat] ws,
                       BAT[void,oid] item, BAT[void,int] kind,
                       BAT[void,lng] int_values, BAT[void,dbl] dbl_values,
-                      BAT[void,dbl] dec_values, BAT[void,str] str_values) : 
+                      BAT[void,dbl] dec_values, BAT[void,str] str_values) :
                             void = xquery_print_result_main;
  "C interface to Workset result print routine"
 
 .COMMAND print_result(str file, str mode, BAT[void,bat] ws,
                       oid item, int kind,
                       BAT[void,lng] int_values, BAT[void,dbl] dbl_values,
-                      BAT[void,dbl] dec_values, BAT[void,str] str_values) : 
+                      BAT[void,dbl] dec_values, BAT[void,str] str_values) :
                             void = xquery_print_result_file;
  "C interface to Workset result print routine, but print to a file"
 
@@ -692,7 +694,7 @@
                    const int_values, 
                    const dbl_values, 
                    const dec_values, 
-                   const str_values);    
+                   const str_values);
 }
 
 

Index: xrpc_client.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc_client.mx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- xrpc_client.mx      1 Feb 2007 23:02:22 -0000       1.9
+++ xrpc_client.mx      9 Feb 2007 23:41:16 -0000       1.10
@@ -478,13 +478,6 @@
 #define MAX_POST_HEADER_SIZE    1024
 #define NR_RETRIES              3
 
-#define SOAP_NS  "http://www.w3.org/2003/05/soap-envelope";
-#define XDT_NS   "http://www.w3.org/2005/xpath-datatypes";
-#define XS_NS    "http://www.w3.org/2001/XMLSchema";
-#define XSI_NS   "http://www.w3.org/2001/XMLSchema-instance";
-#define XRPC_LOC "http://monetdb.cwi.nl/XQuery/XRPC.xsd";
-#define XRPC_NS  "http://monetdb.cwi.nl/XQuery";
-
 #endif /* XRPC_CLIENT_H */
 
 @c
@@ -1023,7 +1016,8 @@
                             return GDK_FAIL;
                         }
                         xquery_print_result_driver(bs,
-                                "xml-noheader-noroot", NULL, NULL, ws, 1,
+                                "xml-noheader-noroot", NULL, NULL, NULL, NULL,
+                                ws, 1,
                                 node_item, node_item, node_item, node_kind,
                                 int_values, dbl_values, str_values);
 

Index: serialize_dflt.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/serialize_dflt.mx,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- serialize_dflt.mx   25 Jan 2007 23:40:26 -0000      1.24
+++ serialize_dflt.mx   9 Feb 2007 23:41:14 -0000       1.25
@@ -76,6 +76,10 @@
 struct dflt_ws_t {
     char  *restag; /* result tag name */
     char  *resprefix; /* used in 'typed' and 'xrpc' modes to set the prefix */
+    /* Need these two variables to store the values of the attributes
+     * 'module' and 'method' for the 'xrpc' mode. */
+    char  *module;
+    char  *method;
     char  *newline, *esc_quote; /* newline and escaped quote string */
     size_t nl_sz, esq_sz; /* length of newline and escaped quote string */
     
@@ -207,7 +211,7 @@
  * dflt driver initialization function
  */
 static bool
-dflt_init (XqueryCtx* ctx, char* args, char *restag, char *resprefix)
+dflt_init (XqueryCtx* ctx, char* args, char *restag, char *resprefix, char 
*module, char *method)
 {
     (void) args;
 
@@ -223,11 +227,12 @@
     dflt_ws->esc_quote = "\"";
     dflt_ws->esq_sz    = strlen (dflt_ws->esc_quote);
 
-    /* store result tag */
+    /* store result prefix and tag */
+    dflt_ws->resprefix = resprefix;
     dflt_ws->restag    = restag;
 
-    /* store result prefix */
-    dflt_ws->resprefix    = resprefix;
+    dflt_ws->module = module;
+    dflt_ws->method = method;
 
     return SUCCESS;
 }
@@ -238,7 +243,7 @@
  *  is the '=' character that is printed after each newline.)
  */
 static bool
-mapi_init (XqueryCtx* ctx, char* args, char *restag, char *resprefix)
+mapi_init (XqueryCtx* ctx, char* args, char *restag, char *resprefix, char 
*module, char *method)
 {
     (void) args;
 
@@ -254,11 +259,12 @@
     dflt_ws->esc_quote = "\"";
     dflt_ws->esq_sz    = strlen (dflt_ws->esc_quote);
 
-    /* store result tag */
+    /* store result prefix and tag */
+    dflt_ws->resprefix = resprefix;
     dflt_ws->restag    = restag;
 
-    /* store result prefix */
-    dflt_ws->resprefix    = resprefix;
+    dflt_ws->module = module;
+    dflt_ws->method = method;
 
     return SUCCESS;
 }
@@ -267,11 +273,13 @@
  * seq driver initialization function
  */
 static bool
-esc_init (XqueryCtx* ctx, char* args, char *restag, char *resprefix)
+esc_init (XqueryCtx* ctx, char* args, char *restag, char *resprefix, char 
*module, char *method)
 {
     (void) args;
     (void) restag;
     (void) resprefix;
+    (void) module;
+    (void) method;
 
     /* create workspace container */
     ctx->driverWs = (void *) new_dflt_ws ();
@@ -884,126 +892,12 @@
     return SUCCESS;
 }
 
-#define XRPC_NS  "http://monetdb.cwi.nl/XQuery";
-static char *
-get_attrVal(char *attrname,
-            char *attrns,
-            BAT  *qn_loc,
-            BAT  *qn_uri,
-            BAT  *attr_qn,
-            BAT  *attr_prop,
-            BAT  *prop_val)
-{
-    BAT *tmpBAT = NULL;
-    BAT *qn1 = NULL, *qn2 = NULL;
-    BAT *attr = NULL, *prop = NULL;
-    char *ret;
-
-    qn1 = BATselect(qn_loc, attrname, attrname); /* [qn,loc] */
-    qn2 = BATselect(qn_uri, attrns,   attrns);   /* [qn,uri] */
-    tmpBAT = VIEWcombine(qn1);                   /* [qn,qn] */
-
-    BBPunfix(BBPcacheid(qn1));
-
-    /* [qn,qn] join [qn,uri] => [qn,uri] */
-    qn1 = BATjoin(tmpBAT, qn2, 1);
-    if (BATcount(qn1) != 1) return NULL;
-
-    /* [attr,qn] join [qn,uri] => [attr,uri] */
-    attr = BATjoin(attr_qn, qn1, 1);
-    /* [prop,attr] join [attr,uri] => [prop,uri] */
-    prop = BATjoin(BATmirror(attr_prop), attr, 1);
-
-    BBPunfix(BBPcacheid(tmpBAT));
-    /* [uri,prop] join [prop,val] => [uri,val] */
-    tmpBAT = BATjoin(BATmirror(prop), prop_val, 1);
-    if (BATcount(tmpBAT) != 1) return NULL;
-
-    ret = GDKstrdup(BUNtail(tmpBAT, BUNptr(tmpBAT, 0)));
-    
-    BBPreclaim(tmpBAT);
-    BBPreclaim(qn1);
-    BBPreclaim(qn2);
-    BBPreclaim(attr);
-    BBPreclaim(prop);
-
-    return ret;
-}
-
-static BAT *
-getWsContexBAT(BAT *ws, int contID, int batID)
-{
-    BUN bun;
-    oid BATid = (oid)batID;
-    oid CONTid  = (oid)contID;
-
-    if ( contID < 0 )
-        return NULL;
-    if ( !(bun = BUNfnd(ws,&BATid)) )
-        return NULL;
-
-    BAT* batbat;
-    if ( !( batbat = BATdescriptor(*(bat*)bun)) )
-        return NULL;
-
-    BUN bbun = BUNfnd(batbat,&CONTid);
-    BAT *res = NULL;
-    if ( !bbun ) {
-        BBPunfix( BBPcacheid( batbat ) );
-        return NULL;
-    } else {
-        if ( !(res = BATdescriptor(*(bat*)bbun)) ) {
-            BBPunfix( BBPcacheid( batbat ) );
-            return NULL;
-        }
-    }
-    BBPunfix( BBPcacheid( batbat ) );
-    return res;
-}
-
 /**
  *  Start serialization of XRPC response message
  */
 static bool
 xrpc_startSerialize(XqueryCtx *ctx)
 {
-    int   i = 0;
-    char *module = NULL, *method = NULL;
-
-    BAT *qn_loc   = NULL, *qn_uri = NULL;
-    BAT *attr_qn  = NULL, *attr_prop = NULL;
-    BAT *prop_val = NULL;
-   
-    /* Since the 'xrpc' mode should only be used by the XRPC server, we
-     * expect the attributes "module" and "method" in WS.  If this is
-     * not the case, it is a failure. */
-    i = BATcount(BBP_cache( *(bat*)BUNtail(ctx->ws, BUNptr(ctx->ws,0)) ));
-    if (i <= 1)
-        return PROBLEM;
-
-    qn_loc    = getWsContexBAT(ctx->ws, 1, QN_LOC);
-    qn_uri    = getWsContexBAT(ctx->ws, 1, QN_URI);
-    attr_qn   = getWsContexBAT(ctx->ws, 1, ATTR_QN);
-    attr_prop = getWsContexBAT(ctx->ws, 1, ATTR_PROP);
-    prop_val  = getWsContexBAT(ctx->ws, 1, PROP_VAL);
-    if (!qn_loc || !qn_uri || !attr_qn || !attr_prop || !prop_val) {
-        return PROBLEM;
-    }
-
-    module = get_attrVal("module", XRPC_NS, qn_loc, qn_uri, attr_qn,
-            attr_prop, prop_val); 
-    method = get_attrVal("method", XRPC_NS, qn_loc, qn_uri, attr_qn,
-            attr_prop, prop_val); 
-    if (!module || !method) {
-        return PROBLEM;
-    }
-
-    BBPunfix( BBPcacheid(qn_loc) );
-    BBPunfix( BBPcacheid(qn_uri) );
-    BBPunfix( BBPcacheid(attr_qn) );
-    BBPunfix( BBPcacheid(attr_prop) );
-    BBPunfix( BBPcacheid(prop_val) );
-
     /* We need to prepend "=" to each line, so make sure
        that we print one after each newline (encoded in
        newline string 'newline')->
@@ -1012,29 +906,24 @@
         stream_write (ctx->out, &e_, 1, 1);
     }
 
-    stream_printf(ctx->out, "<?xml version=\"1.0\" encoding=\"utf-8\"?>%s",
-            dflt_ws->newline);
-
     stream_printf(ctx->out, 
+            "<?xml version=\"1.0\" encoding=\"utf-8\"?>%s"
             "<env:Envelope "
-            "xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\"; "
-            "xmlns:xrpc=\"http://monetdb.cwi.nl/XQuery\"; "
-            "xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"; "
-            "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"; "
-            "xsi:schemaLocation=\"http://monetdb.cwi.nl/XQuery "
-            "http://monetdb.cwi.nl/XQuery/XRPC.xsd\";>"
-            "<env:Body><xrpc:response");
-
-    if (module)
-        stream_printf(ctx->out,
-                " xrpc:module=\"%s\"", module);
-    if (method)
-        stream_printf(ctx->out,
-                " xrpc:method=\"%s\"", method);
-    stream_write(ctx->out, ">", 1, 1);
+            "xmlns:env=\"%s\" "
+            "xmlns:xrpc=\"%s\" "
+            "xmlns:xs=\"%s\" "
+            "xmlns:xsi=\"%s\" "
+            "xsi:schemaLocation=\"%s %s\">"
+            "<env:Body>"
+            "<xrpc:response xrpc:module=\"%s\" xrpc:method=\"%s\">",
+            dflt_ws->newline,
+            SOAP_NS,
+            XRPC_NS,
+            XS_NS,
+            XSI_NS,
+            XRPC_NS, XRPC_LOC,
+            dflt_ws->module, dflt_ws->method);
 
-    GDKfree(module);
-    GDKfree(method);
     return SUCCESS;
 }
 

Index: shredder.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/shredder.mx,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -d -r1.115 -r1.116
--- shredder.mx 1 Feb 2007 23:02:22 -0000       1.115
+++ shredder.mx 9 Feb 2007 23:41:16 -0000       1.116
@@ -841,7 +841,7 @@
 #ifdef DEBUG
         stream_printf(GDKout, "CALL %s:start_document()\n", 
shredCtx->serFun->name);
 #endif
-            shredCtx->serFun->init(shredCtx->serCtx, "", NULL, NULL);
+            shredCtx->serFun->init(shredCtx->serCtx, "", NULL, NULL, NULL, 
NULL);
             shredCtx->serFun->handle_startDocument(shredCtx->serCtx);
     }
 }

Index: xrpc_server.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc_server.mx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- xrpc_server.mx      1 Feb 2007 23:02:22 -0000       1.10
+++ xrpc_server.mx      9 Feb 2007 23:41:16 -0000       1.11
@@ -391,7 +391,7 @@
 handle_rpc_request(struct shttpd_callback_arg *arg)
 {
     char errstr[1024], *module = NULL, *location = NULL, *method = NULL;
-    int sock = -1, k = 0;
+    int sock = -1, k = 0, simple_param = 1;
     stream *out = NULL;
     lng i = 0, j = 0, time_servDeSeria = 0;
 
@@ -650,6 +650,7 @@
                     }
 
                     snprintf(argval[nr_args], 32, OIDFMT, val_node_pre);
+                    simple_param = 0;
                 } else {
                     /* 32-bytes is enough to hold the string
                      * representation of the largest 64bits OID value */
@@ -703,6 +704,7 @@
 
                     snprintf(argval[nr_args], 32, OIDFMT, val_node_pre);
                     frag_root = BUNappend(frag_root, (ptr)&val_node_pre, TRUE);
+                    simple_param = 0;
 
                     /* reassign level values for the ELEM nodes */
                     level_diff = pre_levelT[val_node_pre];
@@ -736,9 +738,11 @@
             "Content-Type: application/soap+xml; "
             "charset=\"utf-8\"\r\n\r\n");
     char *err = xquery_method(out, timing, module, location, method,
-            argc, iterc, argcnt, argtpe, argval, shredBAT);
-    time_servApp = GDKusec() - time_servApp; /* Stop timing Server
-                                                Application */
+            argc, iterc, argcnt, argtpe, argval,
+            simple_param?NULL:shredBAT);
+
+    /* Stop timing Server Application */
+    time_servApp = GDKusec() - time_servApp;
 
     if (err) {
         send_err(out, 0, "", "env:Sender", err);

Index: serialize_null.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/serialize_null.mx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- serialize_null.mx   3 Jan 2007 12:33:13 -0000       1.7
+++ serialize_null.mx   9 Feb 2007 23:41:14 -0000       1.8
@@ -34,7 +34,7 @@
 
 #include "serialize.h"
 
-bool null_init (XqueryCtx *ctx, char *args, char *restag, char *resprefix);
+bool null_init (XqueryCtx *ctx, char *args, char *restag, char *resprefix, 
char *module, char *method);
 bool null_cleanup (XqueryCtx *ctx);
 bool null_startSerialize (XqueryCtx *ctx);
 bool null_endSerialize (XqueryCtx *ctx);
@@ -76,12 +76,15 @@
  * NULL driver initialization function
  */
 bool
-null_init (XqueryCtx *ctx, char *args, char *restag, char *resprefix)
+null_init (XqueryCtx *ctx, char *args, char *restag, char *resprefix, char 
*module, char *method)
 {
     (void) ctx;
     (void) args;
     (void) restag;
     (void) resprefix;
+    (void) module;
+    (void) method;
+
     ctx->driverWs = NULL; /* driverWs not used */
     return SUCCESS;
 }


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to