From: František Dvořák Date: Sat, 7 Apr 2007 17:46:07 +0000 (+0000) Subject: Merged JPPS and JPIS wsdl for using both WS, cleanup, tests update. X-Git-Tag: glite-yaim-myproxy_R_3_1_1_2~11 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=e79edbb660b67c8c9f095bd9d081a93d75c8c44e;p=jra1mw.git Merged JPPS and JPIS wsdl for using both WS, cleanup, tests update. Added error propaggation from sever to client. Warning cleanup. More slaves as default (feeds no + 2). --- diff --git a/org.glite.jp.index/Makefile b/org.glite.jp.index/Makefile index b43cc0a..82a9857 100644 --- a/org.glite.jp.index/Makefile +++ b/org.glite.jp.index/Makefile @@ -30,9 +30,9 @@ GLOBUS_LIBS:=-L${globus_prefix}/lib \ GLOBUS_CFLAGS:=-I${globus_prefix}/include/${nothrflavour} -DEBUG:=-W -Wall -Wno-unused-parameter -Wno-unused-function -g -O0 +DEBUG:=-W -Wall -g -O0 CPPFLAGS:=-DDEBUG -D_GNU_SOURCE -I. -I${top_srcdir}/interface -I${top_srcdir}/src -I${gsoap_prefix}/include -I${gsoap_prefix} -I${stagedir}/include ${GLOBUS_CFLAGS} -I${mysql_prefix}/include -I${mysql_prefix}/include/mysql -I${gsoap_prefix}/include -CFLAGS:=${DEBUG} +CFLAGS:=${DEBUG} ${CFLAGS} LDFLAGS:=-L${stagedir}/lib dotless_soap_ver:=${shell echo ${gsoap_version} | tr -d . } @@ -55,20 +55,17 @@ MANS1:=glite-jpis-client.1 MANS8:=glite-jp-indexd.8 MANS:=${MANS1} ${MANS8} HTMLS:=glite-jpis-client.html glite-jp-indexd.html -is_prefix:=jpis_ -is_client_prefix:=jpis_client_ -ps_prefix:=jpps_ +ws_prefix:=jp_ +is_prefix:=${ws_prefix} +ps_prefix:=${ws_prefix} -SRCS:= conf.c bones_server.c soap_ops.c soap_ps_calls.c \ - ws_ps_typeref.c ws_is_typeref.c db_ops.c context.c common_server.c \ - ${is_prefix}ServerLib.c \ - ${ps_prefix}ClientLib.c ${ps_prefix}C.c +SRCS:= conf.c bones_server.c soap_ops.c soap_ps_calls.c common.c \ + ${is_prefix}Server.c ${ps_prefix}Client.c ${ws_prefix}C.c \ + ws_ps_typeref.c ws_is_typeref.c db_ops.c context.c common_server.c -EXA_TEST_SRCS:=jpis-test.c ${is_prefix}C.c ${is_prefix}Client.c context.c db_ops.c conf.c ws_is_typeref.c +EXA_TEST_SRCS:=jpis-test.c ${is_prefix}Client.c ${is_prefix}C.c context.c db_ops.c conf.c ws_is_typeref.c EXA_DB_SRCS:=jpis-db-internal.c db_ops.c conf.c context.c ws_is_typeref.c -EXA_CLIENT_SRCS:=jpis-client.c common.c \ - ${is_client_prefix}C.c ${is_client_prefix}Client.c -# ${is_prefix}C.c +EXA_CLIENT_SRCS:=jpis-client.c ${is_prefix}Client.c ${is_prefix}C.c common.c OBJS:=${SRCS:.c=.o} EXA_TEST_OBJS:=${EXA_TEST_SRCS:.c=.o} @@ -86,56 +83,26 @@ default all: compile doc compile: ${daemon} ${examples} ${daemon}: ${OBJS} - ${LINK} -o $@ -export-dynamic ${OBJS} ${BONESLIB} ${TRIOLIB} ${COMMONLIB} ${GSOAPLIB} ${GLOBUS_LIBS} ${SRVCOMMONLIB} + ${LINK} -o $@ -export-dynamic ${OBJS} ${BONESLIB} ${TRIOLIB} ${COMMONLIB} ${GSOAPLIB} ${SRVCOMMONLIB} glite-jpis-test: ${EXA_TEST_OBJS} - ${LINK} -o $@ $+ ${GSOAPLIB} ${GLOBUS_LIBS} ${COMMONLIB} ${TRIOLIB} ${SRVCOMMONLIB} + ${LINK} -o $@ $+ ${GSOAPLIB} ${COMMONLIB} ${TRIOLIB} ${SRVCOMMONLIB} jpis-db-internal: ${EXA_DB_OBJS} - ${LINK} -o $@ $+ ${COMMONLIB} ${SRVCOMMONLIB} ${GLOBUS_LIBS} + ${LINK} -o $@ $+ ${COMMONLIB} ${SRVCOMMONLIB} glite-jpis-client: ${EXA_CLIENT_OBJS} - ${LINK} -o $@ $+ ${GSOAPLIB} + ${LINK} -o $@ $+ ${GSOAPLIB} ${COMMONLIB} ${TRIOLIB} -JobProvenanceIS.xh: JobProvenanceIS.wsdl JobProvenanceTypes.wsdl typemap.dat - cp ${stagedir}/interface/JobProvenanceTypes.wsdl . - ${gsoap_bin_prefix}/wsdl2h -t ${top_srcdir}/src/typemap.dat -c -o $@ $< - rm -f JobProvenanceTypes.wsdl +${ws_prefix}Client.c ${ws_prefix}Server.c \ +${ws_prefix}C.c ${ws_prefix}H.h ${ws_prefix}Stub.h: JobProvenance.xh + ${gsoap_bin_prefix}/soapcpp2 -n -w -c -p ${ws_prefix} $< -JobProvenancePS.xh: %.xh: %.wsdl JobProvenanceTypes.wsdl typemap.dat - cp ${stagedir}/interface/JobProvenanceTypes.wsdl . +JobProvenance.xh: jpdev.wsdl + cp ${stagedir}/interface/JobProvenanceTypes.wsdl . ${gsoap_bin_prefix}/wsdl2h -t ${top_srcdir}/src/typemap.dat -c -o $@ $< rm -f JobProvenanceTypes.wsdl -#JobProvenanceISClient.xh: typemap.dat JobProvenanceISClient.xsd JobProvenanceIS.wsdl -# cp ${stagedir}/interface/JobProvenance{Types.xsd,Types.wsdl,IS.wsdl} . -# ${gsoap_bin_prefix}/wsdl2h -t ${top_srcdir}/src/typemap.dat -c -o $@ JobProvenanceIS.wsdl ${top_srcdir}/src/JobProvenanceISClient.xsd -# rm -f JobProvenance{Types.xsd,Types.wsdl,IS.wsdl} - -${is_prefix}ClientLib.c ${is_prefix}Client.c \ -${is_prefix}Server.c ${is_prefix}ServerLib.c \ -${is_prefix}C.c ${is_prefix}H.h ${is_prefix}Stub.h: JobProvenanceIS.xh - ${gsoap_bin_prefix}/soapcpp2 -n -w -c -p ${is_prefix} $< - -# JobProvenanceISClient.xh should be used, -# for now (gsoap-2.7.0) used direct JobProvenanceIS.xh -${is_client_prefix}ClientLib.c ${is_client_prefix}Client.c \ -${is_client_prefix}Server.c ${is_client_prefix}ServerLib.c \ -${is_client_prefix}C.c ${is_client_prefix}H.h ${is_client_prefix}Stub.h: JobProvenanceIS.xh - ${gsoap_bin_prefix}/soapcpp2 -n -w -c -p ${is_client_prefix} $< - -${ps_prefix}Client.c ${ps_prefix}ClientLib.c \ -${ps_prefix}C.c ${ps_prefix}H.h ${ps_prefix}Stub.h: JobProvenancePS.xh - ${gsoap_bin_prefix}/soapcpp2 -n -w -c -p ${ps_prefix} $< - - -#env_C.c env_Server.c: -# touch env.xh -# cp ${stagedir}/interface/JobProvenanceTypes.wsdl . -# ${gsoap_prefix}/bin/wsdl2h -t ${top_srcdir}/src/typemap.dat -c -o env.xh JobProvenanceTypes.wsdl -# rm -f JobProvenanceTypes.wsdl -# ${gsoap_prefix}/bin/soapcpp2 -w -c -p env_ env.xh - check: # ../test/run-test.sh @@ -194,15 +161,18 @@ db_ops.h: context.h context.h: conf.h db_ops.o: db_ops.c conf.h context.h db_ops.h context.o: context.c conf.h context.h -soap_ps_calls.o: soap_ps_calls.c jpps_H.h jpps_.nsmap soap_version.h conf.h db_ops.h ws_ps_typeref.h context.h -soap_ops.o: soap_ops.c jpis_H.h jpis_.nsmap soap_version.h db_ops.h ws_ps_typeref.h ws_is_typeref.h context.h +soap_ps_calls.o: soap_ps_calls.c ${ps_prefix}H.h ${ps_prefix}.nsmap soap_version.h conf.h db_ops.h ws_ps_typeref.h context.h +soap_ops.o: soap_ops.c jp_H.h ${is_prefix}.nsmap soap_version.h db_ops.h ws_ps_typeref.h ws_is_typeref.h context.h ws_ps_typeref.o: ws_ps_typeref.c ${ps_prefix}H.h ws_typemap.h ws_ps_typeref.h soap_version.h ws_is_typeref.o: ws_is_typeref.c ${is_prefix}H.h ws_typemap.h ws_is_typeref.h soap_version.h comon_server.o: common_server.c common_server.h -jpis-client.o: jpis-client.c ${is_client_prefix}H.h soap_version.h -jpis-test.o: jpis-client.c ${is_client_prefix}H.h soap_version.h +jpis-client.o: jpis-client.c ${is_prefix}H.h soap_version.h +jpis-test.o: jpis-client.c ${is_prefix}H.h soap_version.h conf.o: conf.c ${is_prefix}H.h soap_version.h +${ws_prefix}C.o: ${ws_prefix}C.c + $(CC) -c $(CPPFLAGS) $(CFLAGS) -Wno-unused-parameter $< + %.1: %.sgml docbook2man $< diff --git a/org.glite.jp.index/examples/jpis-client.c b/org.glite.jp.index/examples/jpis-client.c index 6000d0b..a8eb355 100644 --- a/org.glite.jp.index/examples/jpis-client.c +++ b/org.glite.jp.index/examples/jpis-client.c @@ -11,31 +11,16 @@ #include #include -#include "jpis_client_.nsmap" +#include "jp_.nsmap" #include "common.h" #define dprintf(FMT, ARGS...) fprintf(stderr, FMT, ##ARGS); #include -/* 'jpisclient' as future namespace */ -#define _jpisclient__QueryJobs _jpelem__QueryJobs -#define _jpisclient__QueryJobsResponse _jpelem__QueryJobsResponse -#define soap_default__jpisclient__QueryJobs soap_default__jpelem__QueryJobs -#define soap_get__jpisclient__QueryJobs soap_get__jpelem__QueryJobs -#define soap_put__jpisclient__QueryJobs soap_put__jpelem__QueryJobs -#define soap_put__jpisclient__QueryJobsResponse soap_put__jpelem__QueryJobsResponse -#define soap_serialize__jpisclient__QueryJobs soap_serialize__jpelem__QueryJobs -#define soap_serialize__jpisclient__QueryJobsResponse soap_serialize__jpelem__QueryJobsResponse - #define DEFAULT_JPIS "http://localhost:8902" #define USE_GMT 1 -/* namespaces[] not used here but needed to prevent linker to complain... */ -SOAP_NMAC struct Namespace namespaces[] = { - {NULL, NULL, NULL, NULL}, -}; - static struct option opts[] = { {"index-server",required_argument, NULL, 'i'}, {"example-file",required_argument, NULL, 'e'}, @@ -115,7 +100,7 @@ static void value_print(FILE *out, const struct jptype__stringOrBlob *value) { /* * fill the query soap structure with some example data */ -static void query_example_fill(struct soap *soap, struct _jpisclient__QueryJobs *in) { +static void query_example_fill(struct soap *soap, struct _jpelem__QueryJobs *in) { struct jptype__indexQuery *cond; struct jptype__indexQueryRecord *rec; @@ -172,15 +157,15 @@ static void query_example_fill(struct soap *soap, struct _jpisclient__QueryJobs /* * read the XML query */ -static int query_recv(struct soap *soap, int fd, struct _jpisclient__QueryJobs *qj) { +static int query_recv(struct soap *soap, int fd, struct _jpelem__QueryJobs *qj) { int i; memset(qj, 0, sizeof(*qj)); soap->recvfd = fd; soap_begin_recv(soap); - soap_default__jpisclient__QueryJobs(soap, qj); - if (!soap_get__jpisclient__QueryJobs(soap, qj, "QueryJobs", NULL)) { + soap_default__jpelem__QueryJobs(soap, qj); + if (!soap_get__jpelem__QueryJobs(soap, qj, "jpelem:QueryJobs", NULL)) { soap_end_recv(soap); soap_end(soap); return EINVAL; @@ -200,7 +185,7 @@ static int query_recv(struct soap *soap, int fd, struct _jpisclient__QueryJobs * /* * print info from the query soap structure */ -static void query_print(FILE *out, const struct _jpisclient__QueryJobs *in) { +static void query_print(FILE *out, const struct _jpelem__QueryJobs *in) { struct jptype__indexQuery *cond; struct jptype__indexQueryRecord *rec; int i, j, k; @@ -242,13 +227,13 @@ static void query_print(FILE *out, const struct _jpisclient__QueryJobs *in) { /* * dump the XML query */ -static int query_dump(struct soap *soap, int fd, struct _jpisclient__QueryJobs *qj) { +static int query_dump(struct soap *soap, int fd, struct _jpelem__QueryJobs *qj) { int retval; soap->sendfd = fd; soap_begin_send(soap); - soap_serialize__jpisclient__QueryJobs(soap, qj); - retval = soap_put__jpisclient__QueryJobs(soap, qj, "jpisclient:QueryJobs", NULL); + soap_serialize__jpelem__QueryJobs(soap, qj); + retval = soap_put__jpelem__QueryJobs(soap, qj, "jpelem:QueryJobs", NULL); soap_end_send(soap); write(fd, "\n", strlen("\n")); @@ -256,7 +241,7 @@ static int query_dump(struct soap *soap, int fd, struct _jpisclient__QueryJobs * } -static int query_format(struct soap *soap, format_t format, FILE *f, struct _jpisclient__QueryJobs *qj) { +static int query_format(struct soap *soap, format_t format, FILE *f, struct _jpelem__QueryJobs *qj) { switch (format) { case FORMAT_XML: case FORMAT_STRIPPEDXML: @@ -271,7 +256,7 @@ static int query_format(struct soap *soap, format_t format, FILE *f, struct _jpi * dump the XML query with the example data */ static int query_example_dump(struct soap *soap, int fd) { - struct _jpisclient__QueryJobs qj; + struct _jpelem__QueryJobs qj; int retval; memset(&qj, 0, sizeof(qj)); @@ -288,13 +273,13 @@ static int query_example_dump(struct soap *soap, int fd) { /* * dump the data returned from JP IS */ -static int queryresult_dump(struct soap *soap, int fd, const struct _jpisclient__QueryJobsResponse *qjr) { +static int queryresult_dump(struct soap *soap, int fd, const struct _jpelem__QueryJobsResponse *qjr) { int retval; soap->sendfd = fd; soap_begin_send(soap); - soap_serialize__jpisclient__QueryJobsResponse(soap, qjr); - retval = soap_put__jpisclient__QueryJobsResponse(soap, qjr, "jpisclient:QueryJobsResponse", NULL); + soap_serialize__jpelem__QueryJobsResponse(soap, qjr); + retval = soap_put__jpelem__QueryJobsResponse(soap, qjr, "QueryJobsResponse", NULL); soap_end_send(soap); write(fd, "\n", strlen("\n")); @@ -370,12 +355,10 @@ static void usage(const char *prog_name) { int main(int argc, char * const argv[]) { struct soap soap, soap_comm; - struct _jpisclient__QueryJobs qj; + struct _jpelem__QueryJobs qj; char *server, *example_file, *query_file, *test_file; const char *prog_name; int retval, opt, example_fd, query_fd, test_fd; - struct Namespace *namespaces; - int i; format_t format = FORMAT_XML; prog_name = server = NULL; @@ -384,38 +367,14 @@ int main(int argc, char * const argv[]) { retval = 1; soap_init(&soap); - - /* - * Following code is needed, when we can't combine more XSD/WSDL files - * for using both as client. We direct use structures only from - * JobProvenanceIS.wsdl, just retyped to jpisclient namespace. - * - * So manually add jpisclient to the namespaces. - */ - for (i = 0; jpis_client__namespaces[i].id; i++) - if (strcmp(jpis_client__namespaces[i].id, "jpisclient") == 0) break; - if (jpis_client__namespaces[i].id) { - /* - * namespaces hack isn't needed (used two schemas and - * gsoap 2.7.6b) - */ - namespaces = NULL; - soap_set_namespaces(&soap, jpis_client__namespaces); - } else { - /* perform namespaces hack */ - namespaces = calloc(i + 2, sizeof(struct Namespace)); - memcpy(namespaces, jpis_client__namespaces, sizeof(jpis_client__namespaces)); - namespaces[i].id = "jpisclient"; - namespaces[i].ns = "http://glite.org/xsd/types/jpisclient"; - soap_set_namespaces(&soap, namespaces); - } + soap_set_namespaces(&soap, jp__namespaces); /* * Soap with registered plugin can't be used for reading XML. * For communications with JP IS glite_gsplugin needs to be registered yet. */ soap_init(&soap_comm); - soap_set_namespaces(&soap_comm, jpis_client__namespaces); + soap_set_namespaces(&soap_comm, jp__namespaces); soap_register_plugin(&soap_comm, glite_gsplugin); /* program name */ @@ -525,7 +484,7 @@ int main(int argc, char * const argv[]) { * Right way would be copy data from client query structure to IS query * structure. Just ugly retype to client here. */ - if (query_recv(&soap, query_fd, (struct _jpisclient__QueryJobs *)&in) != 0) { + if (query_recv(&soap, query_fd, (struct _jpelem__QueryJobs *)&in) != 0) { fprintf(stderr, "query: Error getting query XML\n"); } else { fprintf(stderr, "query: using JPIS %s\n\n", server); @@ -534,8 +493,12 @@ int main(int argc, char * const argv[]) { soap_begin(&soap_comm); ret = check_fault(&soap_comm, soap_call___jpsrv__QueryJobs(&soap_comm, server, "", &in, &out)); if (ret == 0) { - queryresult_format(&soap, format, stdout, (struct _jpisclient__QueryJobsResponse *)&out); - } else goto cleanup; + queryresult_format(&soap, format, stdout, (struct _jpelem__QueryJobsResponse *)&out); + } else { + soap_end(&soap_comm); + soap_end(&soap); + goto cleanup; + } soap_end(&soap_comm); } soap_end(&soap); @@ -553,7 +516,6 @@ cleanup: free(example_file); free(query_file); free(test_file); - free(namespaces); return retval; } diff --git a/org.glite.jp.index/examples/jpis-test.c b/org.glite.jp.index/examples/jpis-test.c index 7e4651a..f450182 100644 --- a/org.glite.jp.index/examples/jpis-test.c +++ b/org.glite.jp.index/examples/jpis-test.c @@ -6,8 +6,8 @@ #include #include "glite/jp/strmd5.h" -#include "jpis_H.h" -#include "jpis_.nsmap" +#include "jp_H.h" +#include "jp_.nsmap" #include "db_ops.h" #include "conf.h" @@ -34,7 +34,7 @@ int main(int argc,char *argv[]) struct soap *soap = soap_new(); soap_init(soap); - soap_set_namespaces(soap, jpis__namespaces); + soap_set_namespaces(soap, jp__namespaces); soap_register_plugin(soap,glite_gsplugin); /*---------------------------------------------------------------------------*/ @@ -47,7 +47,7 @@ int main(int argc,char *argv[]) glite_jp_init_context(&ctx); - glite_jp_get_conf(argc, argv, NULL, &conf); + glite_jp_get_conf(argc, argv, &conf); if (!conf) { fprintf(stderr, "Can't gather configuration\n"); goto end; @@ -238,7 +238,3 @@ int main(int argc,char *argv[]) return 0; } - - -/* XXX: we don't use it */ -SOAP_NMAC struct Namespace namespaces[] = { {NULL,NULL} }; diff --git a/org.glite.jp.index/examples/query-tests/complex_query.in b/org.glite.jp.index/examples/query-tests/complex_query.in index d80b1d5..3dd8f22 100644 --- a/org.glite.jp.index/examples/query-tests/complex_query.in +++ b/org.glite.jp.index/examples/query-tests/complex_query.in @@ -1,5 +1,5 @@ - + http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus @@ -32,5 +32,5 @@ http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus http://egee.cesnet.cz/en/Schema/LB/Attributes:user - + diff --git a/org.glite.jp.index/examples/query-tests/exists_query.in b/org.glite.jp.index/examples/query-tests/exists_query.in index 0af4672..c56c485 100644 --- a/org.glite.jp.index/examples/query-tests/exists_query.in +++ b/org.glite.jp.index/examples/query-tests/exists_query.in @@ -1,5 +1,5 @@ - + http://egee.cesnet.cz/en/Schema/LB/Attributes:CE @@ -14,4 +14,4 @@ http://egee.cesnet.cz/en/Schema/LB/Attributes:user http://egee.cesnet.cz/en/Schema/LB/Attributes:CE - + diff --git a/org.glite.jp.index/examples/query-tests/jobid_query.in b/org.glite.jp.index/examples/query-tests/jobid_query.in index d8a6b35..1f57246 100644 --- a/org.glite.jp.index/examples/query-tests/jobid_query.in +++ b/org.glite.jp.index/examples/query-tests/jobid_query.in @@ -1,5 +1,5 @@ - + http://egee.cesnet.cz/en/Schema/JP/System:jobId @@ -16,4 +16,4 @@ http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus http://egee.cesnet.cz/en/Schema/LB/Attributes:user - + diff --git a/org.glite.jp.index/examples/query-tests/origin_query.in b/org.glite.jp.index/examples/query-tests/origin_query.in index 47bdec3..3e398ed 100644 --- a/org.glite.jp.index/examples/query-tests/origin_query.in +++ b/org.glite.jp.index/examples/query-tests/origin_query.in @@ -1,5 +1,5 @@ - + http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus @@ -17,4 +17,4 @@ http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus http://egee.cesnet.cz/en/Schema/LB/Attributes:user - + diff --git a/org.glite.jp.index/examples/query-tests/simple_query.in b/org.glite.jp.index/examples/query-tests/simple_query.in index 0b1fe2d..3a32ae3 100644 --- a/org.glite.jp.index/examples/query-tests/simple_query.in +++ b/org.glite.jp.index/examples/query-tests/simple_query.in @@ -1,5 +1,5 @@ - + http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus @@ -16,4 +16,4 @@ http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus http://egee.cesnet.cz/en/Schema/LB/Attributes:user - + diff --git a/org.glite.jp.index/examples/query-tests/within_query.in b/org.glite.jp.index/examples/query-tests/within_query.in index 99d5a51..e40d902 100644 --- a/org.glite.jp.index/examples/query-tests/within_query.in +++ b/org.glite.jp.index/examples/query-tests/within_query.in @@ -1,5 +1,5 @@ - + http://egee.cesnet.cz/en/Schema/LB/Attributes:CE @@ -16,4 +16,4 @@ http://egee.cesnet.cz/en/Schema/LB/Attributes:user http://egee.cesnet.cz/en/Schema/LB/Attributes:CE - + diff --git a/org.glite.jp.index/src/bones_server.c b/org.glite.jp.index/src/bones_server.c index 71cdf6f..fa483c1 100644 --- a/org.glite.jp.index/src/bones_server.c +++ b/org.glite.jp.index/src/bones_server.c @@ -10,9 +10,9 @@ #include #include -#include #include +#include #include #include "conf.h" @@ -22,7 +22,8 @@ #include "common_server.h" #include "soap_version.h" -#include "jpis_H.h" +#include "jp_H.h" +#include "jp_.nsmap" #if GSOAP_VERSION <= 20602 #define soap_call___jpsrv__FeedIndex soap_call___ns1__FeedIndex @@ -37,9 +38,7 @@ #define RECONNECT_TIME 60*20 // when try reconnect to PS in case of error (in sec) -extern SOAP_NMAC struct Namespace jpis__namespaces[],jpps__namespaces[]; -extern SOAP_NMAC struct Namespace namespaces[] = { {NULL,NULL} }; -// namespaces[] not used here, but need to prevent linker to complain... +extern SOAP_NMAC struct Namespace jp__namespaces[],jpps__namespaces[]; int newconn(int,struct timeval *,void *); int request(int,struct timeval *,void *); @@ -47,18 +46,11 @@ static int reject(int); static int disconn(int,struct timeval *,void *); int data_init(void **data); + static struct glite_srvbones_service stab = { "JP Index Server", -1, newconn, request, reject, disconn }; -/* -typedef struct { - glite_jpis_context_t ctx; - glite_jp_is_conf *conf; - struct soap *soap; -} slave_data_t; -*/ - static time_t cert_mtime; static char *server_cert, *server_key, *cadir; static gss_cred_id_t mycred = GSS_C_NO_CREDENTIAL; @@ -68,13 +60,12 @@ static char *port = GLITE_JPIS_DEFAULT_PORT_STR; static int debug = 1; static glite_jp_context_t ctx; -static char *glite_jp_default_namespace; static glite_jp_is_conf *conf; // Let's make configuration visible to all slaves int main(int argc, char *argv[]) { - int one = 1,i; + int one = 1, nfeeds; edg_wll_GssStatus gss_code; struct sockaddr_in a; glite_jpis_context_t isctx; @@ -82,7 +73,7 @@ int main(int argc, char *argv[]) glite_jp_init_context(&ctx); - if (glite_jp_get_conf(argc, argv, NULL, &conf)) { + if (glite_jp_get_conf(argc, argv, &conf)) { glite_jp_free_context(ctx); exit(1); } @@ -124,15 +115,6 @@ int main(int argc, char *argv[]) return 1; } - -#if GSOAP_VERSION <= 20602 - for (i=0; jpis__namespaces[i].id && strcmp(jpis__namespaces[i].id,"ns1"); i++); -#else - for (i=0; jpis__namespaces[i].id && strcmp(jpis__namespaces[i].id,"jpsrv"); i++); -#endif - assert(jpis__namespaces[i].id); - glite_jp_default_namespace = jpis__namespaces[i].ns; - stab.conn = socket(PF_INET, SOCK_STREAM, 0); if (stab.conn < 0) { perror("socket"); @@ -173,15 +155,28 @@ int main(int argc, char *argv[]) fprintf(stderr,"Server idenity: %s\n",mysubj); else fputs("WARNING: Running unauthenticated\n",stderr); - /* XXX: uncomment after testing phase - for (i=0; conf->PS_list[i]; i++); // count PS we need to contact - i += USER_QUERY_SLAVES_NUM; // add some slaves for user queries - if (i > MAX_SLAVES_NUM) - glite_srvbones_set_param(GLITE_SBPARAM_SLAVES_COUNT, MAX_SLAVES_NUM); - else - glite_srvbones_set_param(GLITE_SBPARAM_SLAVES_COUNT, i); - */ - /* for dbg - one slave OK */ glite_srvbones_set_param(GLITE_SBPARAM_SLAVES_COUNT,1); + // XXX: more tests needed + if (conf->feeds) + for (nfeeds=0; conf->feeds[nfeeds]; nfeeds++); + else nfeeds = 0; + if (conf->slaves <= 0) { + // add some slaves for user queries and PS responses + conf->slaves = nfeeds + (USER_QUERY_SLAVES_NUM - 1); + if (conf->slaves > MAX_SLAVES_NUM) conf->slaves = MAX_SLAVES_NUM; + } + // + // SUM(PS, feeds(PS) - slaves(PS)) slaves would be blocked + // when waited for all PS + // + // wild guess for slaves(PS) == 1 on all PS: + // 1 + SUM(PS, feeds(PS) - 1) slaves is required, + // SUM(PS, feeds(PS)) is enough. + // + if (conf->slaves < nfeeds) { + fprintf(stderr, "WARNING: %d slaves can be too low for %d feeds\n", conf->slaves, nfeeds); + } + glite_srvbones_set_param(GLITE_SBPARAM_SLAVES_COUNT, conf->slaves); + glite_srvbones_run(data_init,&stab,1 /* XXX: entries in stab */,debug); glite_jpis_free_db(isctx); @@ -257,7 +252,7 @@ int newconn(int conn,struct timeval *to,void *data) soap_init2(soap,SOAP_IO_KEEPALIVE,SOAP_IO_KEEPALIVE); soap_set_omode(soap, SOAP_IO_BUFFER); // set buffered response // buffer set to SOAP_BUFLEN (default = 8k) - soap_set_namespaces(soap,jpis__namespaces); + soap_set_namespaces(soap,jp__namespaces); soap->user = (void *) private; glite_gsplugin_init_context(&plugin_ctx); @@ -324,7 +319,7 @@ cleanup: return ret; } -int request(int conn,struct timeval *to,void *data) +int request(int conn UNUSED,struct timeval *to,void *data) { slave_data_t *private = (slave_data_t *)data; struct soap *soap = private->soap; @@ -346,7 +341,7 @@ int request(int conn,struct timeval *to,void *data) if (soap_envelope_begin_in(soap) || soap_recv_header(soap) || soap_body_begin_in(soap) - || jpis__serve_request(soap) + || jp__serve_request(soap) #if GSOAP_VERSION >= 20700 || (soap->fserveloop && soap->fserveloop(soap)) #endif @@ -378,7 +373,7 @@ static int reject(int conn) return 0; } -static int disconn(int conn,struct timeval *to,void *data) +static int disconn(int conn UNUSED,struct timeval *to UNUSED,void *data) { slave_data_t *private = (slave_data_t *)data; struct soap *soap = private->soap; diff --git a/org.glite.jp.index/src/common.c b/org.glite.jp.index/src/common.c index 8ffdaeb..cc13951 100644 --- a/org.glite.jp.index/src/common.c +++ b/org.glite.jp.index/src/common.c @@ -1,8 +1,12 @@ #ident "$Header$" +#include #include #include +#include +#include + #include "common.h" #define WHITE_SPACE_SET "\n\r \t" @@ -23,3 +27,19 @@ void glite_jpis_trim_soap(struct soap *soap, char **soap_str) { soap_dealloc(soap, *soap_str); *soap_str = s; } + + +int glite_jpis_stack_error_source(glite_jp_context_t ctx, int code, const char *desc, const char *func, int line) { + glite_jp_error_t err; + char *source; + + asprintf(&source, "%s:%d", func, line); + memset(&err, 0, sizeof err); + err.code = code; + err.desc = desc; + err.source = source; + glite_jp_stack_error(ctx, &err); + free(source); + + return code; +} diff --git a/org.glite.jp.index/src/common.h b/org.glite.jp.index/src/common.h index 04ef8bf..d9d1602 100644 --- a/org.glite.jp.index/src/common.h +++ b/org.glite.jp.index/src/common.h @@ -3,6 +3,13 @@ #ifndef GLITE_JPIS_COMMON_H #define GLITE_JPIS_COMMON_H +#include +#include + void glite_jpis_trim_soap(struct soap *soap, char **soap_str); +int glite_jpis_stack_error_source(glite_jp_context_t ctx, int code, const char *desc, const char *func, int line); + +#define glite_jpis_stack_error(CTX, CODE, DESC) glite_jpis_stack_error_source((CTX), (CODE), (DESC), __FUNCTION__, __LINE__); + #endif diff --git a/org.glite.jp.index/src/conf.c b/org.glite.jp.index/src/conf.c index 566a07f..c378d75 100644 --- a/org.glite.jp.index/src/conf.c +++ b/org.glite.jp.index/src/conf.c @@ -20,13 +20,10 @@ #include -#define SOAP_FMAC3 static -#define WITH_NOGLOBAL -#include "jpis_C.c" -extern SOAP_NMAC struct Namespace jpis__namespaces[]; +extern SOAP_NMAC struct Namespace jp__namespaces[]; -static const char *get_opt_string = "dq:c:k:C:V:nm:p:i:o:x:"; +static const char *get_opt_string = "dq:c:k:C:V:nm:p:i:o:x:s:"; static struct option opts[] = { {"debug", 0, NULL, 'd'}, @@ -41,11 +38,14 @@ static struct option opts[] = { {"pidfile", 1, NULL, 'i'}, {"logfile", 1, NULL, 'o'}, {"config", 1, NULL, 'x'}, + {"slaves", 1, NULL, 's'}, {NULL, 0, NULL, 0} }; static int read_conf(glite_jp_is_conf *conf, char *conf_file); +#if 0 static int dump_conf(void); +#endif static void usage(char *me) { @@ -62,12 +62,13 @@ static void usage(char *me) "\t-i, --pidfile\t file to store master pid\n" "\t-o, --logfile\t file to store logs\n" "\t-x, --config\t file with server configuration\n" + "\t-s, --slaves\t number of slaves for responses\n" "\n" ,me); } -int glite_jp_get_conf(int argc, char **argv, char *config_file, glite_jp_is_conf **configuration) +int glite_jp_get_conf(int argc, char **argv, glite_jp_is_conf **configuration) { char *qt = NULL, *conf_file = NULL; int opt; @@ -76,7 +77,6 @@ int glite_jp_get_conf(int argc, char **argv, char *config_file, glite_jp_is_conf conf = calloc(1, sizeof(*conf)); - while ((opt = getopt_long(argc,argv,get_opt_string,opts,NULL)) != EOF) switch (opt) { case 'd': conf->debug = 1; break; case 'q': qt = optarg; break; @@ -90,6 +90,7 @@ int glite_jp_get_conf(int argc, char **argv, char *config_file, glite_jp_is_conf case 'i': conf->pidfile = optarg; break; case 'o': conf->logfile = optarg; break; case 'x': conf_file = optarg; break; + case 's': conf->slaves = atoi(optarg); if (conf->slaves > 0) break; default : usage(argv[0]); exit(0); break; } @@ -108,7 +109,7 @@ int glite_jp_get_conf(int argc, char **argv, char *config_file, glite_jp_is_conf return 1; } else { - read_conf(conf, conf_file); + if (read_conf(conf, conf_file) != 0) return 1; } *configuration = conf; @@ -170,7 +171,7 @@ static int read_conf(glite_jp_is_conf *conf, char *conf_file) } soap_init(&soap); - soap_set_namespaces(&soap, jpis__namespaces); + soap_set_namespaces(&soap, jp__namespaces); soap_begin(&soap); soap.recvfd = fd; @@ -212,7 +213,7 @@ static int read_conf(glite_jp_is_conf *conf, char *conf_file) conf->feeds[i] = calloc(1, sizeof(*conf->feeds[i])); conf->feeds[i]->PS_URL=strdup(feed->primaryServer); - if (glite_jpis_SoapToPrimaryQueryConds(&soap, feed->__sizecondition, + if (glite_jpis_SoapToPrimaryQueryConds(feed->__sizecondition, feed->condition, &conf->feeds[i]->query)) return EINVAL; conf->feeds[i]->history = feed->history; @@ -228,6 +229,7 @@ static int read_conf(glite_jp_is_conf *conf, char *conf_file) return 0; } +#if 0 /* * Just helper function - used only once for first generation * of XML example configuration (which was then reedited in hand) @@ -240,7 +242,7 @@ static int dump_conf(void) { struct jptype__primaryQuery *cond; soap_init(&soap); - soap_set_namespaces(&soap, jpis__namespaces); + soap_set_namespaces(&soap, jp__namespaces); soap.sendfd = STDOUT_FILENO; soap_begin_send(&soap); @@ -283,4 +285,4 @@ static int dump_conf(void) { return retval; } - +#endif diff --git a/org.glite.jp.index/src/conf.h b/org.glite.jp.index/src/conf.h index a23bc7c..b89ef5d 100644 --- a/org.glite.jp.index/src/conf.h +++ b/org.glite.jp.index/src/conf.h @@ -5,6 +5,12 @@ #include +#ifdef __GNUC__ + #define UNUSED __attribute__((unused)) +#else + #define UNUSED +#endif + #define GLITE_JPIS_DEFAULT_PORT_STR "8902" //#define lprintf @@ -40,12 +46,13 @@ typedef struct _glite_jp_is_conf { *logfile, *server_cert, *server_key; + int slaves; } glite_jp_is_conf; // read commad line options and configuration file -int glite_jp_get_conf(int argc, char **argv, char *config_file, glite_jp_is_conf **configuration); +int glite_jp_get_conf(int argc, char **argv, glite_jp_is_conf **configuration); void glite_jp_free_conf(glite_jp_is_conf *conf); void glite_jp_lprintf(const char *source, const char *fmt, ...); diff --git a/org.glite.jp.index/src/db_ops.c b/org.glite.jp.index/src/db_ops.c index 5a0c9f2..988b7e8 100644 --- a/org.glite.jp.index/src/db_ops.c +++ b/org.glite.jp.index/src/db_ops.c @@ -53,6 +53,10 @@ #define COND_MAGIC 0x444E4F43 + +static int glite_jpis_db_queries_deserialize(glite_jp_query_rec_t ***queries, void *blob, size_t blob_size) UNUSED; + + static int is_indexed(glite_jp_is_conf *conf, const char *attr) { size_t i; diff --git a/org.glite.jp.index/src/simple_server.c b/org.glite.jp.index/src/simple_server.c index ccaa5a7..a125aa6 100644 --- a/org.glite.jp.index/src/simple_server.c +++ b/org.glite.jp.index/src/simple_server.c @@ -1,7 +1,7 @@ #include "glite/jp/types.h" #include "glite/jp/context.h" -#include "jpis_H.h" +#include "jp_H.h" int main() { struct soap soap; diff --git a/org.glite.jp.index/src/soap_ops.c b/org.glite.jp.index/src/soap_ops.c index af6d24b..d3f10de 100644 --- a/org.glite.jp.index/src/soap_ops.c +++ b/org.glite.jp.index/src/soap_ops.c @@ -9,16 +9,14 @@ #include "glite/jp/known_attr.h" #include "glite/lb/trio.h" -#include "jpis_H.h" -#include "jpis_.nsmap" +#include "jp_H.h" #include "soap_version.h" #include "glite/security/glite_gscompat.h" #include "db_ops.h" -// XXX: avoid 2 wsdl collisions - work only because ws_ps_typeref.h -// uses common types from jpis_H.h (awful) #include "ws_ps_typeref.h" #include "ws_is_typeref.h" #include "context.h" +#include "common.h" #define INDEXED_STRIDE 2 // how often realloc indexed attr result // XXX: 2 is only for debugging, replace with e.g. 100 @@ -65,7 +63,7 @@ static int updateJob(glite_jpis_context_t ctx, const char *ps, struct jptype__jo SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__UpdateJobs( struct soap *soap, struct _jpelem__UpdateJobs *jpelem__UpdateJobs, - struct _jpelem__UpdateJobsResponse *jpelem__UpdateJobsResponse) + struct _jpelem__UpdateJobsResponse *jpelem__UpdateJobsResponse UNUSED) { int ret, ijobs; const char *feedid; @@ -225,14 +223,14 @@ static int get_op(const enum jptype__queryOp in, char **out) } -static char *get_sql_stringvalue(glite_jpis_context_t ctx, struct jptype__stringOrBlob *value) { +static char *get_sql_stringvalue(struct jptype__stringOrBlob *value) { if (!value) return NULL; if (!GSOAP_ISSTRING(value)) return NULL; return GSOAP_STRING(value); } -static int get_sql_indexvalue(char **sql, struct soap *soap, glite_jpis_context_t ctx, struct jptype__indexQuery *condition, struct jptype__stringOrBlob *value) { +static int get_sql_indexvalue(char **sql, glite_jpis_context_t ctx, struct jptype__indexQuery *condition, struct jptype__stringOrBlob *value) { glite_jp_attrval_t attr; *sql = NULL; @@ -247,7 +245,7 @@ static int get_sql_indexvalue(char **sql, struct soap *soap, glite_jpis_context_ attr.size = GSOAP_BLOB(value)->__size; attr.binary = 1; } else return 0; - glite_jpis_SoapToAttrOrig(soap, condition->origin, &(attr.origin)); + glite_jpis_SoapToAttrOrig(condition->origin, &(attr.origin)); *sql = glite_jp_attrval_to_db_index(ctx->jpctx, &attr, 255); return 0; @@ -277,7 +275,7 @@ static int get_sql_cond(char **sql, const char *attr_md5, enum jptype__queryOp o } -static char *get_sql_or(struct soap *soap, glite_jpis_context_t ctx, struct jptype__indexQuery *condition, const char *attr_md5) { +static char *get_sql_or(glite_jpis_context_t ctx, struct jptype__indexQuery *condition, const char *attr_md5) { struct jptype__indexQueryRecord *record; char *sql, *cond, *s = NULL, *value, *value2; int j; @@ -289,13 +287,13 @@ static char *get_sql_or(struct soap *soap, glite_jpis_context_t ctx, struct jpty /* no additional conditions needed when existing is enough */ } else { if (strcmp(condition->attr, GLITE_JP_ATTR_JOBID) == 0) { - value = get_sql_stringvalue(ctx, record->value); + value = get_sql_stringvalue(record->value); if (!value) goto err; - value2 = get_sql_stringvalue(ctx, record->value2); + value2 = get_sql_stringvalue(record->value2); if (get_sql_cond(&cond, attr_md5, record->op, value, value2) != 0) goto err; } else { - get_sql_indexvalue(&value, soap, ctx, condition, record->value); - get_sql_indexvalue(&value2, soap, ctx, condition, record->value2); + get_sql_indexvalue(&value, ctx, condition, record->value); + get_sql_indexvalue(&value2, ctx, condition, record->value2); get_sql_cond(&cond, attr_md5, record->op, value, value2); free(value); free(value2); @@ -316,7 +314,7 @@ err: /* get all jobids matching the query conditions */ -static int get_jobids(struct soap *soap, glite_jpis_context_t ctx, struct _jpelem__QueryJobs *in, char ***jobids, char *** ps_list) +static int get_jobids(glite_jpis_context_t ctx, struct _jpelem__QueryJobs *in, char ***jobids, char *** ps_list) { char *qa = NULL, *qb = NULL, *qor, *attr_md5, *qwhere = NULL, *query = NULL, *res[2], @@ -343,7 +341,7 @@ static int get_jobids(struct soap *soap, glite_jpis_context_t ctx, struct _jpele /* origin */ if (condition->origin) { - glite_jpis_SoapToAttrOrig(soap, condition->origin, &orig); + glite_jpis_SoapToAttrOrig(condition->origin, &orig); trio_asprintf(&qb, "attr_%|Ss.origin = %d AND ", attr_md5, orig); } else trio_asprintf(&qb, ""); @@ -356,7 +354,7 @@ static int get_jobids(struct soap *soap, glite_jpis_context_t ctx, struct _jpele } /* inside part of the condition: record list (ORs) */ - if ((qor = get_sql_or(soap, ctx, condition, attr_md5)) == NULL) goto err; + if ((qor = get_sql_or(ctx, condition, attr_md5)) == NULL) goto err; if (qor[0]) { asprintf(&qb, "%s%s(%s)", qa, qa[0] ? " AND " : "", qor); free(qa); @@ -603,18 +601,20 @@ SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__QueryJobs( /* test whether there is any indexed attribudes in the condition */ if ( checkIndexedConditions(ctx, in) ) { - fprintf(stderr, "No indexed attribute in query\n"); + glite_jpis_stack_error(ctx->jpctx, EINVAL, "No indexed attribute in query"); + glite_jp_server_err2fault(ctx->jpctx, soap); return SOAP_ERR; } /* test whether there is known attribudes in the condition */ if ( checkConditions(ctx, in) ) { - fprintf(stderr, "Unknown attribute in query\n"); + glite_jpis_stack_error(ctx->jpctx, EINVAL, "Unknown attribute in query"); + glite_jp_server_err2fault(ctx->jpctx, soap); return SOAP_ERR; } /* get all jobids matching the conditions */ - if ( get_jobids(soap, ctx, in, &jobids, &ps_list) ) { + if ( get_jobids(ctx, in, &jobids, &ps_list) ) { return SOAP_ERR; } @@ -642,9 +642,9 @@ SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__QueryJobs( SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__AddFeed( - struct soap *soap, - struct _jpelem__AddFeed *in, - struct _jpelem__AddFeedResponse *out) + struct soap *soap UNUSED, + struct _jpelem__AddFeed *in UNUSED, + struct _jpelem__AddFeedResponse *out UNUSED) { // XXX: test client in examples/jpis-test // sends to this function some data for testing @@ -654,9 +654,9 @@ SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__AddFeed( SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__GetFeedIDs( - struct soap *soap, - struct _jpelem__GetFeedIDs *in, - struct _jpelem__GetFeedIDsResponse *out) + struct soap *soap UNUSED, + struct _jpelem__GetFeedIDs *in UNUSED, + struct _jpelem__GetFeedIDsResponse *out UNUSED) { // XXX: test client in examples/jpis-test // sends to this function some data for testing @@ -666,9 +666,9 @@ SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__GetFeedIDs( SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__DeleteFeed( - struct soap *soap, - struct _jpelem__DeleteFeed *in, - struct _jpelem__DeleteFeedResponse *out) + struct soap *soap UNUSED, + struct _jpelem__DeleteFeed *in UNUSED, + struct _jpelem__DeleteFeedResponse *out UNUSED) { // XXX: test client in examples/jpis-test // sends to this function some data for testing @@ -678,9 +678,9 @@ SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__DeleteFeed( SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__ServerConfiguration( - struct soap *soap, - struct _jpelem__ServerConfiguration *in, - struct _jpelem__ServerConfigurationResponse *out) + struct soap *soap UNUSED, + struct _jpelem__ServerConfiguration *in UNUSED, + struct _jpelem__ServerConfigurationResponse *out UNUSED) { // empty, just for deserializer generation puts(__FUNCTION__); diff --git a/org.glite.jp.index/src/soap_ps_calls.c b/org.glite.jp.index/src/soap_ps_calls.c index f839245..576dc72 100644 --- a/org.glite.jp.index/src/soap_ps_calls.c +++ b/org.glite.jp.index/src/soap_ps_calls.c @@ -8,8 +8,7 @@ #include "glite/security/glite_gsplugin.h" #include "glite/security/glite_gscompat.h" -#include "jpps_H.h" -#include "jpps_.nsmap" +#include "jp_H.h" #include "conf.h" #include "db_ops.h" @@ -19,11 +18,14 @@ #include "stdsoap2.h" +extern struct Namespace jp__namespaces[]; +int debug = 0; + + /*------------------*/ /* Helper functions */ /*------------------*/ -int debug = 0; #define dprintf(FMT, ARGS...) if (debug) fprintf(stderr, FMT, ##ARGS) #include "glite/jp/ws_fault.c" #define check_fault(SOAP, ERR) glite_jp_clientCheckFault((SOAP), (ERR), NULL, 0) @@ -66,7 +68,7 @@ int MyFeedIndex(glite_jpis_context_t ctx, glite_jp_is_conf *conf, long int uniqu if (ctx->conf->server_cert) plugin_ctx->cert_filename = strdup(ctx->conf->server_cert); soap_init(soap); - soap_set_namespaces(soap,jpps__namespaces); + soap_set_namespaces(soap, jp__namespaces); soap_set_omode(soap, SOAP_IO_BUFFER); // set buffered response // buffer set to SOAP_BUFLEN (default = 8k) soap_register_plugin_arg(soap,glite_gsplugin,plugin_ctx); @@ -132,3 +134,12 @@ err: return err.code; } + +int __jpsrv__RegisterJob(struct soap* soap UNUSED, struct _jpelem__RegisterJob *jpelem__RegisterJob UNUSED, struct _jpelem__RegisterJobResponse *jpelem__RegisterJobResponse UNUSED) { return 0; } +int __jpsrv__StartUpload(struct soap* soap UNUSED, struct _jpelem__StartUpload *jpelem__StartUpload UNUSED, struct _jpelem__StartUploadResponse *jpelem__StartUploadResponse UNUSED) { return 0; } +int __jpsrv__CommitUpload(struct soap* soap UNUSED, struct _jpelem__CommitUpload *jpelem__CommitUpload UNUSED, struct _jpelem__CommitUploadResponse *jpelem__CommitUploadResponse UNUSED) { return 0; } +int __jpsrv__RecordTag(struct soap* soap UNUSED, struct _jpelem__RecordTag *jpelem__RecordTag UNUSED, struct _jpelem__RecordTagResponse *jpelem__RecordTagResponse UNUSED) { return 0; } +int __jpsrv__FeedIndex(struct soap* soap UNUSED, struct _jpelem__FeedIndex *jpelem__FeedIndex UNUSED, struct _jpelem__FeedIndexResponse *jpelem__FeedIndexResponse UNUSED) { return 0; } +int __jpsrv__FeedIndexRefresh(struct soap* soap UNUSED, struct _jpelem__FeedIndexRefresh *jpelem__FeedIndexRefresh UNUSED, struct _jpelem__FeedIndexRefreshResponse *jpelem__FeedIndexRefreshResponse UNUSED) { return 0; } +int __jpsrv__GetJobFiles(struct soap* soap UNUSED, struct _jpelem__GetJobFiles *jpelem__GetJobFiles UNUSED, struct _jpelem__GetJobFilesResponse *jpelem__GetJobFilesResponse UNUSED) { return 0; } +int __jpsrv__GetJobAttributes(struct soap* soap UNUSED, struct _jpelem__GetJobAttributes *jpelem__GetJobAttributes UNUSED, struct _jpelem__GetJobAttributesResponse *jpelem__GetJobAttributesResponse UNUSED) { return 0; } diff --git a/org.glite.jp.index/src/ws_is_typeref.c b/org.glite.jp.index/src/ws_is_typeref.c index 471fde5..42afedb 100644 --- a/org.glite.jp.index/src/ws_is_typeref.c +++ b/org.glite.jp.index/src/ws_is_typeref.c @@ -6,7 +6,7 @@ #include #include "soap_version.h" -#include "jpis_H.h" +#include "jp_H.h" #include "ws_typemap.h" #include #include "ws_is_typeref.h" @@ -28,11 +28,10 @@ void glite_jpis_SoapToQueryOp(const enum jptype__queryOp in, glite_jp_queryop_t } } -void glite_jpis_SoapToAttrOrig(struct soap *soap, const enum jptype__attrOrig *in, glite_jp_attr_orig_t *out) +void glite_jpis_SoapToAttrOrig(const enum jptype__attrOrig *in, glite_jp_attr_orig_t *out) { assert(out); - // XXX: shlouldn't be ANY in WSDL?? if (!in) { *out = GLITE_JP_ATTR_ORIG_ANY; return; @@ -40,7 +39,6 @@ void glite_jpis_SoapToAttrOrig(struct soap *soap, const enum jptype__attrOrig *i switch ( *in ) { -// case NULL: *out = GLITE_JP_ATTR_ORIG_ANY; break; case SYSTEM: *out = GLITE_JP_ATTR_ORIG_SYSTEM; break; case USER: *out = GLITE_JP_ATTR_ORIG_USER; break; case FILE_: *out = GLITE_JP_ATTR_ORIG_FILE; break; @@ -49,7 +47,6 @@ void glite_jpis_SoapToAttrOrig(struct soap *soap, const enum jptype__attrOrig *i } static int SoapToQueryRecordVal( - struct soap *soap, struct jptype__stringOrBlob *in, int *binary, size_t *size, @@ -79,7 +76,6 @@ static int SoapToQueryRecordVal( static int SoapToQueryCond( - struct soap *soap, struct jptype__indexQuery *in, glite_jp_query_rec_t **out) { @@ -100,11 +96,11 @@ static int SoapToQueryCond( break; case GLITE_JP_QUERYOP_WITHIN: - SoapToQueryRecordVal(soap, record->value2, &(qr[i].binary), + SoapToQueryRecordVal(record->value2, &(qr[i].binary), &(qr[i].size2), &(qr[i].value2)); // fall through default: - if ( SoapToQueryRecordVal(soap, record->value, &(qr[i].binary), + if ( SoapToQueryRecordVal(record->value, &(qr[i].binary), &(qr[i].size), &(qr[i].value)) ) { *out = NULL; return 1; @@ -112,7 +108,7 @@ static int SoapToQueryCond( break; } - glite_jpis_SoapToAttrOrig(soap, in->origin, &(qr[i].origin) ); + glite_jpis_SoapToAttrOrig(in->origin, &(qr[i].origin) ); } *out = qr; @@ -123,11 +119,9 @@ static int SoapToQueryCond( /** * Translate JP index query conditions from soap to C query_rec * - * \param IN Soap structure * \param OUT array of glite_jp_query_rec_t query records */ int glite_jpis_SoapToQueryConds( - struct soap *soap, int size, struct jptype__indexQuery **in, glite_jp_query_rec_t ***out) @@ -139,7 +133,7 @@ int glite_jpis_SoapToQueryConds( qr = calloc(size+1, sizeof(*qr)); for (i=0; ivalue2, &(qr[0].binary), + SoapToQueryRecordVal(in->value2, &(qr[0].binary), &(qr[0].size2), &(qr[0].value2)); // fall through default: - if ( SoapToQueryRecordVal(soap, in->value, &(qr[0].binary), + if ( SoapToQueryRecordVal(in->value, &(qr[0].binary), &(qr[0].size), &(qr[0].value)) ) { *out = NULL; return 1; @@ -182,7 +175,7 @@ static int SoapToPrimaryQueryCond( break; } - glite_jpis_SoapToAttrOrig(soap, in->origin, &(qr[0].origin) ); + glite_jpis_SoapToAttrOrig(in->origin, &(qr[0].origin) ); return 0; } @@ -196,7 +189,6 @@ static int SoapToPrimaryQueryCond( * \param OUT array of glite_jp_query_rec_t query records */ int glite_jpis_SoapToPrimaryQueryConds( - struct soap *soap, int size, GLITE_SECURITY_GSOAP_LIST_TYPE(jptype, primaryQuery) in, glite_jp_query_rec_t ***out) @@ -208,7 +200,7 @@ int glite_jpis_SoapToPrimaryQueryConds( qr = calloc(size+1, sizeof(*qr)); for (i=0; i -#include "jpps_H.h" +#include "jp_H.h" #include "ws_typemap.h" #include "ws_ps_typeref.h" #include "glite/jp/ws_fault.c" diff --git a/org.glite.jp.ws-interface/Makefile b/org.glite.jp.ws-interface/Makefile index 905d02e..e04d45f 100644 --- a/org.glite.jp.ws-interface/Makefile +++ b/org.glite.jp.ws-interface/Makefile @@ -20,16 +20,17 @@ XMLLINT:=xmllint --nonet TIDY:=tidy -i -q --show-warnings no --tidy-mark no --wrap 0 docbookxls:=http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl -WSDL=JobProvenancePS.wsdl JobProvenanceIS.wsdl JobProvenanceTypes.wsdl +WSDL=JobProvenancePS.wsdl JobProvenanceIS.wsdl JobProvenanceTypes.wsdl +WSDL_S=jpdev.wsdl XSD=JobProvenanceTypes.xsd -all compile: ${WSDL} ${XSD} JobProvenance.html +all compile: ${WSDL} ${XSD} JobProvenance.html ${WSDL_S} check: @echo No unit test required for interface-only module. stage: ${WSDL} - $(MAKE) install PREFIX=${stagedir} + $(MAKE) install PREFIX=${stagedir} DOSTAGE=yes dist: distsrc distbin @@ -53,6 +54,9 @@ install: # cd ${top_srcdir}/interface && install -m 644 ${WSDL} ${PREFIX}/${STAGETO} install -m 644 ${WSDL} ${XSD} ${PREFIX}/${STAGETO} install -m 644 ${top_srcdir}/src/ws_fault.c ${PREFIX}/include/${globalprefix}/${jpprefix} + if [ x${DOSTAGE} = xyes ]; then \ + install -m 644 ${WSDL_S} ${PREFIX}/${STAGETO}; \ + fi clean: rm -f *.h @@ -71,3 +75,6 @@ JobProvenance.html: doc.xml JobProvenancePS.xml JobProvenanceIS.xml JobProvenanc -${TIDY} -xml -m doc-html.xml -${XMLLINT} --valid --noout doc-html.xml -${TIDY} -asxhtml -m $@ + +jpdev.xml: jpdev.xml.sh + ${top_srcdir}/src/jpdev.sh $< > $@ diff --git a/org.glite.jp.ws-interface/src/jpdev.sh b/org.glite.jp.ws-interface/src/jpdev.sh new file mode 100755 index 0000000..a1b9602 --- /dev/null +++ b/org.glite.jp.ws-interface/src/jpdev.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +xmlcut() { + echo -e "\t" + echo + grep "<$2>" $(dirname $0)/JobProvenance$1.xml -A 1000 | grep "" -B 1000 | grep -v "<$2>\|" +} + +xmlmerge() { + xmlcut PS $1 + echo + xmlcut IS $1 +} + +DOC="$(xmlmerge doc)" +OPERATIONS="$(xmlmerge operations)" + +XML_TMPL=$(sed $(dirname $0)/$1 -e 's/"/\\"/g') +eval "XML_RESULT=\"${XML_TMPL}\"" +echo "$XML_RESULT" diff --git a/org.glite.jp.ws-interface/src/jpdev.xml.sh b/org.glite.jp.ws-interface/src/jpdev.xml.sh new file mode 100644 index 0000000..1925109 --- /dev/null +++ b/org.glite.jp.ws-interface/src/jpdev.xml.sh @@ -0,0 +1,22 @@ + + + CVS revision: + + + + +${DOC} + + + + + +${OPERATIONS} + + diff --git a/org.glite.jp.ws-interface/src/ws_fault.c b/org.glite.jp.ws-interface/src/ws_fault.c index b334d86..896d627 100644 --- a/org.glite.jp.ws-interface/src/ws_fault.c +++ b/org.glite.jp.ws-interface/src/ws_fault.c @@ -5,6 +5,12 @@ #include #include +#ifdef __GNUC__ + #define UNUSED __attribute__((unused)) +#else + #define UNUSED +#endif + #define GSOAP_STRING(CHOICE) GLITE_SECURITY_GSOAP_CHOICE_GET(CHOICE, string, stringOrBlob, 1) #define GSOAP_BLOB(CHOICE) GLITE_SECURITY_GSOAP_CHOICE_GET(CHOICE, blob, stringOrBlob, 1) #define GSOAP_SETSTRING(CHOICE, VALUE) GLITE_SECURITY_GSOAP_CHOICE_SET(CHOICE, string, jptype, stringOrBlob, 1, VALUE) @@ -22,7 +28,14 @@ #define dprintf(FMT, ARGS...) printf(FMT, ##ARGS) #endif -static int glite_jp_clientCheckFault(struct soap *soap, int err, const char *name, int toSyslog) { + +static int glite_jp_clientCheckFault(struct soap *soap, int err, const char *name, int toSyslog) UNUSED; +static struct jptype__genericFault* jp2s_error(struct soap *soap, const glite_jp_error_t *err) UNUSED; +static void glite_jp_server_err2fault(const glite_jp_context_t ctx,struct soap *soap) UNUSED; + + +static int glite_jp_clientCheckFault(struct soap *soap, int err, const char *name, int toSyslog) +{ struct SOAP_ENV__Detail *detail; struct jptype__genericFault *f; char *reason,indent[200] = " "; @@ -124,3 +137,5 @@ static void glite_jp_server_err2fault(const glite_jp_context_t ctx,struct soap * if (soap->version == 2) soap->fault->SOAP_ENV__Detail = detail; else soap->fault->detail = detail; } + +#undef UNUSED