- fixed build wrt. gsoap 2.6.2
authorAleš Křenek <ljocha@ics.muni.cz>
Fri, 15 Jul 2005 11:56:39 +0000 (11:56 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Fri, 15 Jul 2005 11:56:39 +0000 (11:56 +0000)
- cleanup of match_file()

org.glite.jp.primary/src/authz.c
org.glite.jp.primary/src/feed.c
org.glite.jp.primary/src/is_client.c
org.glite.jp.primary/src/jptype_map.h
org.glite.jp.primary/src/new_ftp_backend.c
org.glite.jp.primary/src/soap_ops.c

index 3e6d6e4..8ff2b58 100644 (file)
@@ -7,6 +7,7 @@
 #include "glite/jp/context.h"
 
 #include "jpps_H.h"
+#include "jptype_map.h"
 
 int glite_jpps_authz(glite_jp_context_t ctx,int op,const char *job,const char *owner)
 {
index ba9e2e1..c4a4578 100644 (file)
@@ -192,25 +192,25 @@ int glite_jpps_match_file(
        int     ret;
        struct  jpfeed  *f = ctx->feeds;
 
-       int     nvals = 0,j,i,attrs[GLITE_JP_ATTR__LAST];
-       glite_jp_attrtype_t     attrl[GLITE_JP_ATTR__LAST];
+       int     nvals = 0,j,i;
+       glite_jp_attr_t         *attrs = NULL, *attrs2;
        glite_jp_attrval_t      *vals = NULL,*oneval;
 
        fprintf(stderr,"%s: %s %s %s\n",__FUNCTION__,job,class,name);
 
-       memset(attrs,0,sizeof attrs);
        
-       for (;f;f=f->next) for (i=0; f->attrs[i].type; i++) attrs[i] = 1;
-       j = 0;
-       for (i=1; i<GLITE_JP_ATTR__LAST; i++) if (attrs[i]) attrl[j++] = i;
-       attrl[j] = GLITE_JP_ATTR_UNDEF;
-
        switch (glite_jpps_fplug_lookup(ctx,class,&pd)) {
                case ENOENT: return 0;  /* XXX: shall we complain? */
                case 0: break;
                default: return -1;
        }
 
+       for (;f;f=f->next) {
+               glite_jp_attr_union(attrs,f->attrs,&attrs2);
+               glite_jp_attrset_free(attrs,1);
+               attrs = attrs2;
+       }
+
        for (pi=0; pd[pi]; pi++) {
                int     ci;
                for (ci=0; pd[pi]->uris[ci]; ci++) if (!strcmp(pd[pi]->uris[ci],class)) {
@@ -227,31 +227,10 @@ int glite_jpps_match_file(
                                continue;
                        }
 
-#if 0 /* not needed anymore -- owner is known from registration */
-                       /* XXX: does not belong here but I'd like to avoid opening the file twice */
-                       if (!strcmp(class,GLITE_JP_FILETYPE_LB)) {
-                               glite_jp_attr_t         owner = { GLITE_JP_ATTR_OWNER, NULL };
-                               glite_jp_attrval_t      *val;
-
-                               switch (pd[pi]->ops.attr(pd[pi]->fpctx,ph,owner,&val)) {
-                                       case ENOENT:
-                                       case ENOSYS: abort();
-                                       case 0: printf("LB plugin: owner = %s\n",val[0].value.s);
-                                               /* TODO: store it in backend */
-
-                                               glite_jp_attrval_free(val,1);
-                                               break;
-
-                                       default: /* TODO: complain */; break;
-                               }
-                       }
-#endif
-
-                       /* TODO: extract attributes for the feeds */
-                       for (i=0; attrl[i]; i++) 
-                               if (!pd[pi]->ops.attr(pd[pi]->fpctx,ph,attrl[i],&oneval)) {
+                       for (i=0; attrs[i].type; i++) 
+                               if (!pd[pi]->ops.attr(pd[pi]->fpctx,ph,attrs[i],&oneval)) {
                                /* XXX: ignore error */
-                                       for (j=0; oneval[j].attr; j++);
+                                       for (j=0; oneval[j].attr.type; j++);
                                        vals = realloc(vals,(nvals+j+1) * sizeof *vals);
                                        memcpy(vals+nvals,oneval,(j+1) * sizeof *vals);
                                        nvals += j;
@@ -261,20 +240,25 @@ int glite_jpps_match_file(
                }
        }
 
+       glite_jp_attrset_free(attrs,1);
+
        for (f = ctx->feeds; f; f=f->next) {
+               int     k;
                glite_jp_attrval_t      * fattr = malloc((nvals+1) * sizeof *fattr);
-               int     attri[GLITE_JP_ATTR__LAST];
-
-               memset(attri,0,sizeof attri);
-               for (i=0; f->attrs[i].attr; i++) attri[f->attrs[i].attr] = 1;
 
                j = 0;
-               for (i=0; i<nvals; i++) if (attri[vals[i].attr]) memcpy(fattr+j++,vals+i,sizeof *fattr);
-               memset(fattr+j,0,sizeof *fattr);
+               for (i=0; i<nvals; i++) for (k=0; f->attrs[k].type; k++)
+                       if (!glite_jp_attr_cmp(f->attrs+k,&vals[i].attr))
+                               memcpy(fattr+j++,vals+i,sizeof *fattr);
 
-               glite_jp_single_feed(ctx,f->destination,job,fattr);
+               memset(fattr+j,0,sizeof *fattr);
+               glite_jpps_single_feed(ctx,f->destination,job,fattr);
+               free(fattr);
        }
 
+       for (i=0; vals[i].attr.type; i++) glite_jp_attrval_free(vals+i,0);
+       free(vals);
+
        if (bh) glite_jppsbe_close_file(ctx,bh);
        free(pd);
 
index 237fb4c..bb2ae45 100644 (file)
@@ -18,7 +18,7 @@ int glite_jpps_single_feed(
                glite_jp_context_t ctx,
                const char *destination,
                const char *job,
-               glite_jp_attrval_t const * const attrs[]
+               glite_jp_attrval_t const *attrs
 )
 {
        /* TODO: really call JP Index server (via interlogger) */
index 56d611f..c620c83 100644 (file)
 #define LESS jptype__queryOp__LESS
 #define GREATER jptype__queryOp__GREATER
 #define WITHIN jptype__queryOp__WITHIN
+
+#else
+
+#define __jpsrv__RegisterJob __ns1__RegisterJob
+#define __jpsrv__StartUpload __ns1__StartUpload
+#define __jpsrv__CommitUpload __ns1__CommitUpload
+#define __jpsrv__RecordTag __ns1__RecordTag
+#define __jpsrv__FeedIndex __ns1__FeedIndex
+#define __jpsrv__FeedIndexRefresh __ns1__FeedIndexRefresh
+#define __jpsrv__GetJob __ns1__GetJob
+
+#define SOAP_TYPE___jpsrv__RegisterJob SOAP_TYPE___ns1__RegisterJob
+#define SOAP_TYPE___jpsrv__StartUpload SOAP_TYPE___ns1__StartUpload
+#define SOAP_TYPE___jpsrv__CommitUpload SOAP_TYPE___ns1__CommitUpload
+#define SOAP_TYPE___jpsrv__GetJob SOAP_TYPE___ns1__GetJob
+
 #endif
 
index 930030e..fab285b 100644 (file)
@@ -23,6 +23,8 @@
 
 #include "jpps_H.h"    /* XXX: SOAP_TYPE___jpsrv__GetJob */
 
+#include "jptype_map.h"
+
 #define FTPBE_DEFAULT_DB_CS    "jpps/@localhost:jpps"
 
 struct ftpbe_config {
index 9411403..9fe77bf 100644 (file)
 #include "file_plugin.h"
 #include "builtin_plugins.h"
 
-#include "soap_version.h"
-#if GSOAP_VERSION <= 20602
-#define __jpsrv__RegisterJob __ns1__RegisterJob
-#define __jpsrv__StartUpload __ns1__StartUpload
-#define __jpsrv__CommitUpload __ns1__CommitUpload
-#define __jpsrv__RecordTag __ns1__RecordTag
-#define __jpsrv__FeedIndex __ns1__FeedIndex
-#define __jpsrv__FeedIndexRefresh __ns1__FeedIndexRefresh
-#define __jpsrv__GetJob __ns1__GetJob
-#endif
-
 static struct jptype__genericFault *jp2s_error(struct soap *soap,
                const glite_jp_error_t *err)
 {