#include "feed.h"
#include "file_plugin.h"
#include "builtin_plugins.h"
-
+#include "is_client.h"
/*
* seconds before feed expires: should be
int pi;
void *bh = NULL;
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];
+ 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;
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 };
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)) {
+ /* XXX: ignore error */
+ for (j=0; oneval[j].attr; j++);
+ vals = realloc(vals,(nvals+j+1) * sizeof *vals);
+ memcpy(vals+nvals,oneval,(j+1) * sizeof *vals);
+ nvals += j;
+ }
pd[pi]->ops.close(pd[pi]->fpctx,ph);
}
}
+ for (f = ctx->feeds; f; f=f->next) {
+ 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);
+
+ glite_jp_single_feed(ctx,f->destination,job,fattr);
+ }
+
if (bh) glite_jppsbe_close_file(ctx,bh);
free(pd);