Update of /cvsroot/monetdb/pathfinder/runtime/xrpc/admin
In directory sc8-pr-cvs16:/tmp/cvs-serv3105

Modified Files:
        admin.js xrpcwebclient.js 
Log Message:
- Adapted to the new SOAP XRPC message format, which now requires an
  "arity" attribute in "request" node.

- Adapted the implementation of "view" (a shredded XML document) to
  Peter's yesterday's change:

    "HTTP-xrpc document access should now use the prefix doc/
    (e.g. http://host:50001/xrpc/doc/foo.xml == xrpc://host/doc/foo.xml)"

  prefix the document name in the "open" call with "/xrpc/doc" to
  retrieve the document from MXQ.
    


Index: admin.js
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc/admin/admin.js,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- admin.js    3 May 2007 21:28:33 -0000       1.7
+++ admin.js    4 May 2007 13:16:13 -0000       1.8
@@ -12,7 +12,9 @@
 var modurl  = href + "/admin/admin.xq";
 var posturl = href + "/xrpc/admin";
 
-function myXRPC(method,call,callback) { 
XRPC(posturl,mod,modurl,method,call,callback); }
+function myXRPC(method,arity,call,callback) {
+    XRPC(posturl,mod,modurl,method,arity,call,callback);
+}
 
 /**********************************************************************
           Callback functions of the admin functions in admin.xq
@@ -92,7 +94,7 @@
         dTableBody += '<td>'+url+'</td>\n';
         dTableBody +=
             '<td>'+
-            '<input type="button" name="viewDoc" value="view" 
onclick="open(\'/'+docName+'\',\'_blank\',\'scrollbars=yes,resizable=yes,directories=no,location=no,titlebar=no,toolbar=no\')"/>'+
+            '<input type="button" name="viewDoc" value="view" 
onclick="open(\'/xrpc/doc'+docName+'\',\'_blank\',\'scrollbars=yes,resizable=yes,directories=no,location=no,titlebar=no,toolbar=no\')"/>'+
             '</td>\n';
         dTableBody +=
             '<td>'+
@@ -230,7 +232,7 @@
 }
 
 function doCollections()  { 
-    XRPC(posturl, mod, modurl, 'collections',  XRPC_CALL(), 
doCollectionsCallback); 
+    XRPC(posturl, mod, modurl, 'collections',  0, XRPC_CALL(), 
doCollectionsCallback); 
 }
 
 /* methods expected to take 'long' (use popup window) */
@@ -258,11 +260,11 @@
 ***********************************************************************/
 
 function doDocuments(colName) 
-                          { myXRPC('documents', 
XRPC_CALL(XRPC_SEQ(XRPC_ATOM('string', colName))), doDocumentsCallback); }
-function doAllDocuments() { myXRPC('documents', XRPC_CALL(), 
doAllDocumentsCallback); }
-function doDbStats()      { myXRPC('db-stats',     XRPC_CALL(), 
doDbStatsCallback); }
-function doDbEnv()        { myXRPC('db-env',       XRPC_CALL(), 
doDbEnvCallback); }
-function doDbRestart()    { myXRPC('db-restart',   XRPC_CALL(), 
reportCallback);  }
+                          { myXRPC('documents',  1, 
XRPC_CALL(XRPC_SEQ(XRPC_ATOM('string', colName))), doDocumentsCallback); }
+function doAllDocuments() { myXRPC('documents',  0, XRPC_CALL(), 
doAllDocumentsCallback); }
+function doDbStats()      { myXRPC('db-stats',   0, XRPC_CALL(), 
doDbStatsCallback); }
+function doDbEnv()        { myXRPC('db-env',     0, XRPC_CALL(), 
doDbEnvCallback); }
+function doDbRestart()    { myXRPC('db-restart', 0, XRPC_CALL(), 
reportCallback);  }
 
 function doBackupCol()    { alert("Sorry, function doBackupCol() not 
implemented yet"); }
 function doRestoreCol()   { alert("Sorry, function doRestoreCol() not 
implemented yet"); }
@@ -272,27 +274,27 @@
     var name =  top.content.document.getElementById("newName").value;
     var col =   top.content.document.getElementById("newCol").value;
     var perct = top.content.document.getElementById("newFree").value;
-    myXRPC('add-doc', XRPC_CALL(XRPC_SEQ(XRPC_ATOM('string', url)) +
-                                XRPC_SEQ(XRPC_ATOM('string', name)) +
-                                XRPC_SEQ(XRPC_ATOM('string', col)) +
-                                XRPC_SEQ(XRPC_ATOM('integer', perct))), 
doAddDocCallback);
+    myXRPC('add-doc', 4, XRPC_CALL(XRPC_SEQ(XRPC_ATOM('string', url)) +
+                                   XRPC_SEQ(XRPC_ATOM('string', name)) +
+                                   XRPC_SEQ(XRPC_ATOM('string', col)) +
+                                   XRPC_SEQ(XRPC_ATOM('integer', perct))), 
doAddDocCallback);
     var dTable = top.content.document.getElementById("div1");
     dTable.innerHTML = dTable.innerHTML + '<b>Started shredding '+ url + 
'...</b>';
 }
 
 function doDelDoc(docName) {
     if (!window.confirm('Are you sure you want to delete the document "' + 
docName + '"?')) return;
-    myXRPC('del-doc', XRPC_CALL(XRPC_SEQ(XRPC_ATOM('string', docName))), 
doDelDocCallback);
+    myXRPC('del-doc', 1, XRPC_CALL(XRPC_SEQ(XRPC_ATOM('string', docName))), 
doDelDocCallback);
 }
 
 function doDelCol(colName) {
     if (!window.confirm('Are you sure you want to delete the collection "' + 
colName + '" and all documents in it?')) return;
-    myXRPC('del-col', XRPC_CALL(XRPC_SEQ(XRPC_ATOM('string', colName))), 
doDelColCallback);
+    myXRPC('del-col', 1, XRPC_CALL(XRPC_SEQ(XRPC_ATOM('string', colName))), 
doDelColCallback);
 }
 
 function doBackup(){
     var id = top.content.document.getElementById("ID").value;
-    myXRPC('backup', XRPC_CALL(XRPC_SEQ(XRPC_ATOM('string', id))), 
doBackupCallback);
+    myXRPC('backup', 1, XRPC_CALL(XRPC_SEQ(XRPC_ATOM('string', id))), 
doBackupCallback);
     top.content.document.getElementById("div1").innerHTML = "Backup in 
progress..";
 }
 
@@ -300,7 +302,7 @@
     var id =    top.content.document.getElementById("ID").value;
     var perct = top.content.document.getElementById("dfltFree").value;
 
-    myXRPC('restore', XRPC_CALL(XRPC_SEQ(XRPC_ATOM('string', id)) + 
+    myXRPC('restore', 2, XRPC_CALL(XRPC_SEQ(XRPC_ATOM('string', id)) + 
                                 XRPC_SEQ(XRPC_ATOM('integer', perct))), 
doRestoreCallback);
     top.content.document.getElementById("div1").innerHTML = "Restore in 
progress..";
 }

Index: xrpcwebclient.js
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc/admin/xrpcwebclient.js,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- xrpcwebclient.js    16 Mar 2007 01:38:10 -0000      1.5
+++ xrpcwebclient.js    4 May 2007 13:16:13 -0000       1.6
@@ -3,17 +3,18 @@
               module,     /* module namespace (logical) URL. Must match XQuery 
module definition! */
               moduleurl,  /* module (physical) at-hint URL. Module file must 
be here! */
               method,     /* method name (matches function name in module) */
+              arity,      /* arity of the method */
               call,       /* one or more XRPC_CALL() parameter specs 
(concatenated strings) */ 
               callback)   /* callback function to call with the XML response */
 {
-    clnt.sendReceive(posturl, method, 
XRPC_REQUEST(module,moduleurl,method,call), callback);
+    clnt.sendReceive(posturl, method, 
XRPC_REQUEST(module,moduleurl,method,arity,call), callback);
 }
 
 /**********************************************************************
           functions to construct valid XRPC soap requests
  ***********************************************************************/
 
-function XRPC_REQUEST(module, moduleurl, method, body) {
+function XRPC_REQUEST(module, moduleurl, method, arity, body) {
     var r = '<?xml version="1.0" encoding="utf-8"?>\n' +
            '<env:Envelope ' +
            'xmlns:env="http://www.w3.org/2003/05/soap-envelope"; ' +
@@ -23,8 +24,9 @@
            'xmlns:xs="http://www.w3.org/2001/XMLSchema";>' +
            '<env:Body>' +
                '<xrpc:request xrpc:module="' + module + '" ' +
-                'xrpc:location="' + moduleurl + '" '+
-                'xrpc:method="' + method + '">' + 
+                'xrpc:location="' + moduleurl + '" ' +
+                'xrpc:method="' + method + '" ' +
+                'xrpc:arity="' + arity + '">' + 
            body 
            + '</xrpc:request></env:Body></env:Envelope>';
     return r;


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to