From 45be6a3e20dbf3d948857fea34ca647479d09839 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Fri, 15 Jul 2005 11:56:39 +0000 Subject: [PATCH] - fixed build wrt. gsoap 2.6.2 - cleanup of match_file() --- org.glite.jp.primary/src/authz.c | 1 + org.glite.jp.primary/src/feed.c | 62 +++++++++++------------------- org.glite.jp.primary/src/is_client.c | 2 +- org.glite.jp.primary/src/jptype_map.h | 16 ++++++++ org.glite.jp.primary/src/new_ftp_backend.c | 2 + org.glite.jp.primary/src/soap_ops.c | 11 ------ 6 files changed, 43 insertions(+), 51 deletions(-) diff --git a/org.glite.jp.primary/src/authz.c b/org.glite.jp.primary/src/authz.c index 3e6d6e4..8ff2b58 100644 --- a/org.glite.jp.primary/src/authz.c +++ b/org.glite.jp.primary/src/authz.c @@ -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) { diff --git a/org.glite.jp.primary/src/feed.c b/org.glite.jp.primary/src/feed.c index ba9e2e1..c4a4578 100644 --- a/org.glite.jp.primary/src/feed.c +++ b/org.glite.jp.primary/src/feed.c @@ -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; inext) { + 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; iattrs[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); diff --git a/org.glite.jp.primary/src/is_client.c b/org.glite.jp.primary/src/is_client.c index 237fb4c..bb2ae45 100644 --- a/org.glite.jp.primary/src/is_client.c +++ b/org.glite.jp.primary/src/is_client.c @@ -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) */ diff --git a/org.glite.jp.primary/src/jptype_map.h b/org.glite.jp.primary/src/jptype_map.h index 56d611f..c620c83 100644 --- a/org.glite.jp.primary/src/jptype_map.h +++ b/org.glite.jp.primary/src/jptype_map.h @@ -14,5 +14,21 @@ #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 diff --git a/org.glite.jp.primary/src/new_ftp_backend.c b/org.glite.jp.primary/src/new_ftp_backend.c index 930030e..fab285b 100644 --- a/org.glite.jp.primary/src/new_ftp_backend.c +++ b/org.glite.jp.primary/src/new_ftp_backend.c @@ -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 { diff --git a/org.glite.jp.primary/src/soap_ops.c b/org.glite.jp.primary/src/soap_ops.c index 9411403..9fe77bf 100644 --- a/org.glite.jp.primary/src/soap_ops.c +++ b/org.glite.jp.primary/src/soap_ops.c @@ -16,17 +16,6 @@ #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) { -- 1.8.2.3