nothrflavour=gcc32
thrflavour=gcc32pthr
expat_prefix=/opt/expat
-ares_prefix=/opt/ares
gsoap_prefix=/software/gsoap-2.6
CC=gcc
GLOBUS_LIBS:=-L${globus_prefix}/lib \
-lglobus_common_${nothrflavour} \
-lglobus_gssapi_gsi_${nothrflavour} \
- -lglobus_ftp_client_gcc32dbg \
- -lglobus_ftp_control_gcc32dbg
+ -lglobus_ftp_client_${nothrflavour} \
+ -lglobus_ftp_control_${nothrflavour}
GLOBUS_CFLAGS:=-I${globus_prefix}/include/${nothrflavour}
examples: ${EXAMPLES}
+# XXX: should depend on -ltar but we have no dynamic version so far :-(
${LIB}: ${LIBOBJS}
- ${LINK} ${version_info} -o $@ ${LIBLOBJS} -rpath ${glite_location}/lib ${LBMAILDIRLIB} -ltar
+ ${LINK} ${version_info} -o $@ ${LIBLOBJS} -rpath ${glite_location}/lib ${LBMAILDIRLIB}
${daemon}: ${OBJS}
${LINK} -o $@ ${OBJS} ${LBMAILDIRLIB} ${GSOAPLIB} ${GLOBUS_LIBS}
${EXAMPLES}: ${LIB}
+
+# XXX: -ltar should be in the library
${EXAMPLES}: %: %.o
- ${LINK} -o $@ $< ${LIB} ${LBMAILDIRLIB}
+ ${LINK} -o $@ $< ${LIB} ${LBMAILDIRLIB} -ltar
install:
-mkdir -p ${PREFIX}/${STAGETO}
- -mkdir -p ${PREFIX}/bin
+ -mkdir -p ${PREFIX}/bin
+ -mkdir -p ${PREFIX}/lib
-mkdir -p ${PREFIX}/examples
${INSTALL} -m 755 ${daemon} ${PREFIX}/bin
${INSTALL} -m 644 ${LIB} ${PREFIX}/lib
${INSTALL} -m 644 jpps_upload_files ${PREFIX}/examples/glite-jp-primary-upload_files
+ cd ${top_srcdir}/examples && ${INSTALL} -m 755 glite-jp-importer.sh ${PREFIX}/examples/
cd ${top_srcdir}/interface && ${INSTALL} -m 644 ${HDRS} ${PREFIX}/${STAGETO}
if [ x${DOSTAGE} = xyes ]; then \
cd ${top_srcdir}/interface && ${INSTALL} -m 644 ${STAGE_HDRS} ${PREFIX}/${STAGETO} ; \
is stored in the /tmp/lb_server_jpreg directory.)
Then you should run the jpimporter daemon on the same host:
-./glite-jp-importer -k <hostcert> -k <hostkey> -p jpps.server.address:8900 -r /tmp/lb_server_jpreg -d /tmp/lb_server_jpdump
+./glite-jp-importer -c <hostcert> -k <hostkey> -p jpps.server.address:8900 -r /tmp/lb_server_jpreg -d /tmp/lb_server_jpdump
(Every job registration anounced in /tmp/lb_server_jpreg directory will be sent
to the JP PS at the address jpps.server.address:8900.)
--- /dev/null
+#! /bin/bash
+
+#
+# example script for purging LB and importing the dumps to JP
+#
+
+# job provenance server
+JBSERVER=umbar.ics.muni.cz:8901
+# bookkeeping server
+BKSERVER=scientific.civ.zcu.cz:9000
+# dump directory of bkserver (-D argument)
+BKSERVER_DUMPDIR=/tmp/dump
+# LB maildir for job registration (-J argument)
+BKSERVER_JOBREG_MAILDIR=/tmp/lb_server_jpreg
+
+if [ -z "$X509_USER_CERT" -o -z "$X509_USER_KEY" ]; then
+ echo "Please set X509_USER_CERT and X509_USER_KEY."
+ exit 1
+fi
+
+CERT_ARGS="-c $X509_USER_CERT -k $X509_USER_KEY"
+LB_DUMPDIR=/tmp/lb_server_dump
+BKSERVER_DUMPDIR_OLD=/tmp/dump.old
+LB_EXPORTDIR=/tmp/lb_export
+PREFIX=`dirname $0`/..
+LOGDIR=/tmp/log
+
+
+[ -d $LB_DUMPDIR ] || mkdir -p $LB_DUMPDIR
+[ -d $BKSERVER_DUMPDIR ] || mkdir -p $BKSERVER_DUMPDIR
+[ -d $BKSERVER_DUMPDIR_OLD ] || mkdir -p $BKSERVER_DUMPDIR_OLD
+[ -d $LB_EXPORTDIR ] || mkdir -p $LB_EXPORTDIR
+[ -d $LOGDIR ] || mkdir -p $LOGDIR
+
+echo "Using cert args $CERT_ARGS"
+
+$PREFIX/bin/glite-jp-importer -r $BKSERVER_JOBREG_MAILDIR -d $LB_DUMPDIR $CERT_ARGS -g -p $JBSERVER > $LOGDIR/jp-importer.log 2>&1 &
+JP_PID=$!
+trap "kill $JP_PID; exit 0" SIGINT
+
+while [ 1 ]; do
+ $PREFIX/sbin/glite-lb-purge -o 1 -l -m $BKSERVER
+
+ for file in $BKSERVER_DUMPDIR/*; do
+ rm -f $LB_EXPORTDIR/*
+ if [ -s $file ]; then
+ $PREFIX/sbin/glite-lb-lb_dump_exporter -d $file -s $LB_EXPORTDIR -m $LB_DUMPDIR
+ mv $file $BKSERVER_DUMPDIR_OLD
+ else
+ rm $file
+ fi
+ done
+
+ sleep 30
+done
+#Thu Dec 15 09:23:26 CET 2005
module.build=0
glite_location=${with.glite.location}
globus_prefix=${with.globus.prefix}
expat_prefix=${with.expat.prefix}
-ares_prefix=${with.ares.prefix}
gsoap_prefix=${with.gsoap.prefix}
gsoap_version=${ext.gsoap.version}
mysql_prefix=${with.mysql.prefix}
char *name,
pidfile[PATH_MAX] = GLITE_JPIMPORTER_PIDFILE;
+ glite_gsplugin_Context plugin_ctx;
+
name = strrchr(argv[0],'/');
if (name) name++; else name = argv[0];
soap = soap_new();
soap_init(soap);
soap_set_namespaces(soap, jpps__namespaces);
- soap_register_plugin(soap, glite_gsplugin);
+
+ glite_gsplugin_init_context(&plugin_ctx);
+ if (server_key) plugin_ctx->key_filename = strdup(server_key);
+ if (server_cert) plugin_ctx->cert_filename = strdup(server_cert);
+
+ soap_register_plugin_arg(soap, glite_gsplugin,plugin_ctx);
if ( (reg_pid = slave(reg_importer, "reg-imp")) < 0 ) {
perror("starting reg importer slave");
} else do {
su_in.job = tab[_job].val;
su_in.class_ = "urn:org.glite.jp.primary:lb";
- su_in.name = tab[_file].val;
+ su_in.name = NULL;
su_in.commitBefore = 1000 + time(NULL);
su_in.contentType = "text/lb";
dprintf(("[%s] Importing LB dump file '%s'\n", name, tab[_file].val));
if ( !debug ) syslog(LOG_INFO, "Importing LB dump file '%s'\n", msg);
ret = soap_call___jpsrv__StartUpload(soap, tab[_jpps].val?:jpps, "", &su_in, &su_out);
ret = check_soap_fault(soap, ret);
- /* XXX: grrrrrrr! test it!!!
- if ( (ret = check_soap_fault(soap, ret)) ) break;
- dprintf(("[%s] Destination: %s\n\tCommit before: %s\n", su_out.destination, ctime(&su_out.commitBefore)));
- */
+ /* XXX: grrrrrrr! test it!!!*/
+// if ( (ret = check_soap_fault(soap, ret)) ) break;
+ dprintf(("[%s] Destination: %s\n\tCommit before: %s\n", name, su_out.destination, ctime(&su_out.commitBefore)));
if ( (fhnd = open(tab[_file].val, O_RDONLY)) < 0 ) {
dprintf(("[%s] Can't open dump file: %s\n", name, tab[_file].val));
ret = 1;
break;
}
- /* XXX: grrrrrrr! remove next line!!! */
- su_out.destination = "gsiftp://nain.ics.muni.cz:5678/tmp/gsiftp-dump-tst-file";
if ( (ret = gftp_put_file(su_out.destination, fhnd)) ) break;
close(fhnd);
dprintf(("[%s] File sent, commiting the upload\n", name));
nothrflavour=gcc32
thrflavour=gcc32pthr
expat_prefix=/opt/expat
-ares_prefix=/opt/ares
gsoap_prefix=/software/gsoap-2.6
CC=gcc
-#Sat Oct 15 06:48:33 CEST 2005
+#Mon Jan 16 06:46:39 CET 2006
module.build=39
Revision history:
$Log$
+ Revision 1.3.4.1 2005/11/03 17:46:52 mmulac
+ ares to c-ares migration
+ - use dynamic library of c-ares, instead of ares static lib
+ - ares clean up (now should be mentioned only in modules that really need it)
+ - patch for security.gsoap-plugin not yet in CVS (sent to interation list)
+ I do not know what will happen when one try to mix ares with c-ares libs
+ => weird things may arise!
+
+ Revision 1.3 2004/12/01 18:45:38 zsalvet
+ *** empty log message ***
+
Revision 1.2 2004/11/22 13:36:42 dimeglio
First version of this file
globus_prefix=${with.globus.prefix}
expat_prefix=${with.expat.prefix}
gsoap_prefix=${with.gsoap.prefix}
-ares_prefix=${with.ares.prefix}
thrflavour=${with.globus.thr.flavor}
nothrflavour=${with.globus.nothr.flavor}
cppunit=${with.cppunit.prefix}
nothrflavour=gcc32
thrflavour=gcc32pthr
expat_prefix=/opt/expat
-ares_prefix=/opt/ares
gsoap_prefix=/software/gsoap-2.6
CC=gcc
DEBUG:=-W -Wall -Wno-unused-parameter -Wno-unused-function -g -O0
dotless_soap_ver:=${shell echo ${gsoap_version} | tr -d . }
-GSOAPLIB:=-L${stagedir}/lib -lglite_security_gsoap_plugin_${dotless_soap_ver}_${nothrflavour} -L${ares_prefix}/lib -lares
+GSOAPLIB:=-L${stagedir}/lib -lglite_security_gsoap_plugin_${dotless_soap_ver}_${nothrflavour}
gsoap_bin_prefix:=${shell if [ -x ${gsoap_prefix}/bin/soapcpp2 ]; then echo ${gsoap_prefix}/bin; else echo ${gsoap_prefix}; fi }
ps_prefix:=jpps_
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 \
+ 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 \
BONESLIB:=-lglite_lb_server_bones
TRIOLIB:=-lglite_jp_trio
-ifneq (${mysql_prefix},/usr)
- ifeq ($(shell echo ${mysql_version} | cut -d. -f1,2),4.1)
- MYSQLIB := -L${mysql_prefix}/lib/mysql -lmysqlclient
- else
- MYSQLIB := -L${mysql_prefix}/lib -lmysqlclient
- endif
-else
- MYSQLIB := -lmysqlclient
-endif
-
-
default all: compile
compile: ${daemon} ${example}
${daemon}: ${OBJS}
- ${LINK} -o $@ -export-dynamic ${OBJS} ${BONESLIB} ${TRIOLIB} ${COMMONLIB} ${GSOAPLIB} ${GLOBUS_LIBS} ${MYSQLIB} ${SRVCOMMONLIB}
+ ${LINK} -o $@ -export-dynamic ${OBJS} ${BONESLIB} ${TRIOLIB} ${COMMONLIB} ${GSOAPLIB} ${GLOBUS_LIBS} ${SRVCOMMONLIB}
${example}: ${EXA_OBJS}
- ${LINK} -o $@ ${EXA_OBJS} ${GSOAPLIB} ${GLOBUS_LIBS} ${COMMONLIB} ${TRIOLIB} ${MYSQLIB} ${SRVCOMMONLIB}
+ ${LINK} -o $@ ${EXA_OBJS} ${GSOAPLIB} ${GLOBUS_LIBS} ${COMMONLIB} ${TRIOLIB} ${SRVCOMMONLIB}
jpis-db-internal: jpis-db-internal.o db_ops.o conf.o context.o
${LINK} -o $@ $+ ${COMMONLIB} ${SRVCOMMONLIB} ${GLOBUS_LIBS}
${is_prefix}ClientLib.c ${is_prefix}Client.c \
${is_prefix}Server.c ${is_prefix}ServerLib.c \
-${is_prefix}C.c ${is_prefix}H.h: JobProvenanceIS.xh
+${is_prefix}C.c ${is_prefix}H.h ${is_prefix}_Stub.h: JobProvenanceIS.xh
${gsoap_bin_prefix}/soapcpp2 -n -w -c -p ${is_prefix} JobProvenanceIS.xh
${ps_prefix}Client.c ${ps_prefix}ClientLib.c \
-${ps_prefix}C.c ${ps_prefix}H.h: JobProvenancePS.xh
+${ps_prefix}C.c ${ps_prefix}H.h ${ps_prefix}_Stub.h: JobProvenancePS.xh
${gsoap_bin_prefix}/soapcpp2 -n -w -c -p ${ps_prefix} JobProvenancePS.xh
# rm -f JobProvenanceTypes.wsdl
# ${gsoap_prefix}/bin/soapcpp2 -w -c -p env_ env.xh
-check:
- -echo nothing yet
+check:
+ # ../test/run-test.sh
doc:
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
ws_ps_typeref.o: ws_ps_typeref.c jpis_H.h ws_typemap.h ws_ps_typeref.h
ws_is_typeref.o: ws_is_typeref.c jpis_H.h ws_typemap.h ws_is_typeref.h
+comon_server.o: common_server.c common_server.h
.PHONY: default all compile check doc stage dist distsrc distbin install clean
#create table attr_<attrid> (
# jobid char(32) binary not null,
# value varchar(255) binary not null,
-# full_value mediumblob not null,
+# full_value mediumblob not null,
+# origin int not null,
#
# index (jobid),
# index (value)
#
# startup script for JP index server
#
-# environment:
-# GLITE_JPIS_PS - required JP PrimaryStorage server
-# (for example http://umbar.ics.muni.cz:8901)
-# GLITE_JPIS_PORT - used port (default 8902)
-# GLITE_JPIS_DB - connection string (default jpis/@localhost:jpis1)
-#
GLITE_LOCATION=${GLITE_LOCATION:-/opt/glite}
GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-${GLITE_LOCATION}/var}
[ -f $GLITE_LOCATION/etc/jpis.conf ] && . $GLITE_LOCATION/etc/jpis.conf
[ -f $GLITE_LOCATION_VAR/etc/jpis.conf ] && . $GLITE_LOCATION_VAR/etc/jpis.conf
-[ -n "$GLITE_JPIS_SERVER_PIDFILE" ] && pidfile=$GLITE_JPIS_SERVER_PIDFILE ||
- pidfile=$GLITE_LOCATION_VAR/glite-jp-indexd.pid
+[ -n "$GLITE_JPIS_PIDFILE" ] || export GLITE_JPIS_PIDFILE=$GLITE_LOCATION_VAR/glite-jp-indexd.pid
+[ -n "$GLITE_JPIS_LOGFILE" ] || export GLITE_JPIS_LOGFILE=$GLITE_LOCATION_VAR/log/glite-jp-indexd.log
+pidfile="$GLITE_JPIS_PIDFILE"
+logfile="$GLITE_JPIS_LOGFILE"
unset creds port
start()
{
echo -n Starting glite-jp-indexd ...
- $GLITE_LOCATION/bin/glite-jp-indexd > $GLITE_LOCATION_VAR/log/glite-jp-index.log 2>&1 &
+ $GLITE_LOCATION/bin/glite-jp-indexd
echo " done"
}
echo " done"
rm -f $pidfile
else
- killall glite-jp-indexd
-# echo $pidfile does not exist - glite-jp-indexd not running? >&2
+ echo $pidfile does not exist - glite-jp-indexd not running? >&2
+ return 1
fi
echo done
}
echo glite-jp-indexd running as $pid
return 0
fi
- else
- ps xa | grep "glite-jp-indexd" > /dev/null
- if [ "$?" = 0 ]; then
- echo glite-jp-indexd running
- return 0
- fi
fi
echo glite-jp-indexd not running
GLITE_JPIS_DB - database connection string (default jpis/@localhost:jpis1)
+GLITE_JPIS_LOGFILE - log file
+
+GLITE_JPIS_PIDFILE - pid file
+
+GLITE_JPIS_DEBUG - don't daemonize
Other parameters will be configurable in close future. Its
current hard-coded values are in org.glite.jp.index/src/conf.[ch]
--- /dev/null
+<?xml version="1.0"?>
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+targetNamespace="http://www.w3schools.com"
+xmlns="http://www.w3schools.com"
+elementFormDefault="qualified">
+
+
+<!-- Simple types -->
+<xs:element name="attr" type="xs:string"/>
+<xs:element name="string" type="xs:string"/>
+<xs:element name="blob" type="xs:base64Binary"/>
+
+
+<!-- Enumeration types -->
+<xs:element name="orig">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="SYSTEM"/>
+ <xs:enumeration value="USER"/>
+ <xs:enumeration value="USER"/>
+ </xs:restriction>
+ </xs:simpleType>
+</xs:element>
+
+<xs:element name="op">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="EQUAL"/>
+ <xs:enumeration value="UNEQUAL"/>
+ <xs:enumeration value="LESS"/>
+ <xs:enumeration value="GREATER"/>
+ <xs:enumeration value="WITHIN"/>
+ <xs:enumeration value="EXISTS"/>
+ </xs:restriction>
+ </xs:simpleType>
+</xs:element>
+
+
+<!-- Complex types -->
+<xs:element name="attrs">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="attr" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:element>
+
+<xs:element name="value">
+ <xs:complexType>
+ <xs:choice>
+ <xs:element ref="string" minOccurs="1" maxOccurs="1"/>
+ <xs:element ref="blob" minOccurs="1" maxOccurs="1"/>
+ </xs:choice>
+ </xs:complexType>
+</xs:element>
+
+<xs:element name="record">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:element ref="op" minOccurs="1" maxOccurs="1"/>
+ <xs:element ref="value" minOccurs="0" maxOccurs="2"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:element>
+
+<xs:element name="query">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:element ref="attr" minOccurs="1" maxOccurs="1"/>
+ <xs:element ref="orig" minOccurs="0" maxOccurs="1"/>
+ <xs:element ref="record" minOccurs="1" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:element>
+
+<xs:element name="jpis_client_config">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:element ref="query" minOccurs="1" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:element>
+
+</xs:schema>
--- /dev/null
+<?xml version="1.0"?>
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+targetNamespace="http://www.w3schools.com"
+xmlns="http://www.w3schools.com"
+elementFormDefault="qualified">
+
+
+<!-- Simple types -->
+<xs:element name="attr" type="xs:string"/>
+<xs:element name="name" type="xs:string"/>
+<xs:element name="string" type="xs:string"/>
+<xs:element name="blob" type="xs:base64Binary"/>
+
+
+<!-- Enumeration types -->
+<xs:element name="orig">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="SYSTEM"/>
+ <xs:enumeration value="USER"/>
+ <xs:enumeration value="USER"/>
+ </xs:restriction>
+ </xs:simpleType>
+</xs:element>
+
+<xs:element name="op">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="EQUAL"/>
+ <xs:enumeration value="UNEQUAL"/>
+ <xs:enumeration value="LESS"/>
+ <xs:enumeration value="GREATER"/>
+ <xs:enumeration value="WITHIN"/>
+ <xs:enumeration value="EXISTS"/>
+ </xs:restriction>
+ </xs:simpleType>
+</xs:element>
+
+
+<!-- Complex types -->
+<xs:element name="plugins">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="name" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:element>
+
+<xs:element name="indexed_attrs">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="attr" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:element>
+
+<xs:element name="attrs">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="attr" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:element>
+
+<xs:element name="value">
+ <xs:complexType>
+ <xs:choice>
+ <xs:element ref="string" minOccurs="1" maxOccurs="1"/>
+ <xs:element ref="blob" minOccurs="1" maxOccurs="1"/>
+ </xs:choice>
+ </xs:complexType>
+</xs:element>
+
+<xs:element name="query">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:element ref="attr" minOccurs="1" maxOccurs="1"/>
+ <xs:element ref="op" minOccurs="1" maxOccurs="1"/>
+ <xs:element ref="orig" minOccurs="0" maxOccurs="1"/>
+ <xs:element ref="value" minOccurs="0" maxOccurs="2"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:element>
+
+<xs:element name="jpis_client_config">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:element ref="plugins" minOccurs="0" maxOccurs="1"/>
+ <xs:element ref="indexed_attrs" minOccurs="0" maxOccurs="1"/>
+ <xs:element ref="attrs" minOccurs="0" maxOccurs="1"/>
+ <xs:element ref="query" minOccurs="1" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:element>
+
+</xs:schema>
/* insert simulating FeedIndex call */
#define INSERT "insert into feeds value ('93', '12345', '8', '0' , 'http://localhost:8901', '2005-10-14 10:48:27', 'COND2');"
+#define DELETE "delete from feeds where feedid = '12345';"
static int check_fault(struct soap *soap,int err);
int main(int argc,char *argv[])
{
- char *server = "http://localhost:8902";
+ char *default_server = NULL;
+// char *default_server = "http://localhost:8902";
+ char server[512];
struct soap *soap = soap_new();
soap_init(soap);
glite_jp_init_context(&ctx);
glite_jp_get_conf(0, NULL, NULL, &conf);
+ if (default_server) strcpy(server, default_server);
+ else snprintf(server, sizeof(server), "http://localhost:%s", conf->port ? conf->port : GLITE_JPIS_DEFAULT_PORT_STR);
+ printf("JP index server: %s\n", server);
+
glite_jpis_init_context(&isctx, ctx, conf);
if (glite_jpis_init_db(isctx) != 0) {
fprintf(stderr, "Connect DB failed: %s (%s)\n",
goto end;
}
- if (glite_jp_db_execstmt(ctx,
- INSERT, &stmt) < 0) goto end;
+ if (glite_jp_db_execstmt(ctx, DELETE, &stmt) < 0) goto end;
+ if (glite_jp_db_execstmt(ctx, INSERT, &stmt) < 0) goto end;
end:
glite_jpis_free_context(isctx);
glite_jp_free_context(ctx);
//in.feedId = soap_strdup(soap, str2md5("http://localhost:8901"));
in.feedId = soap_strdup(soap, "12345");
in.feedDone = false_;
- in.__sizejobAttributes = 1;
+ in.__sizejobAttributes = 2;
in.jobAttributes = soap_malloc(soap,
in.__sizejobAttributes * sizeof(*(in.jobAttributes)));
{
rec = soap_malloc(soap, sizeof(*rec));
+ memset(rec, 0, sizeof(*rec));
+ rec->jobid = soap_strdup(soap, "https://localhost:7846/pokus1");
rec->jobid = soap_strdup(soap, "https://localhost:7846/pokus");
- rec->owner = soap_strdup(soap, "OwnerName");
+ {
+ gss_cred_id_t cred = GSS_C_NO_CREDENTIAL;
+ edg_wll_GssStatus gss_code;
+ char *subject = NULL;
+
+ if ( edg_wll_gss_acquire_cred_gsi(NULL, NULL, &cred, &subject, &gss_code) ) {
+ printf("Cannot obtain credentials - exiting.\n");
+ return EINVAL;
+ }
+ rec->owner = soap_strdup(soap, subject);
+ free(subject);
+ }
rec->__sizeprimaryStorage = 0;
rec->primaryStorage = NULL;
rec->__sizeattributes = 2;
}
in.jobAttributes[0] = rec;
+ {
+ rec = soap_malloc(soap, sizeof(*rec));
+ memset(rec, 0, sizeof(*rec));
+ rec->jobid = soap_strdup(soap, "https://localhost:7846/pokus2");
+ rec->owner = soap_strdup(soap, "OwnerName");
+ rec->__sizeprimaryStorage = 0;
+ rec->primaryStorage = NULL;
+ rec->__sizeattributes = 2;
+ rec->attributes = soap_malloc(soap,
+ rec->__sizeattributes * sizeof(*(rec->attributes)));
+ rec->attributes[0] = soap_malloc(soap, sizeof(*(rec->attributes[0])));
+ rec->attributes[0]->name = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:user");
+ rec->attributes[0]->value = soap_malloc(soap, sizeof(*(rec->attributes[0]->value)));
+ rec->attributes[0]->value->string = soap_strdup(soap, "CertSubj");
+ rec->attributes[0]->value->blob = NULL;
+ rec->attributes[0]->timestamp = 333;
+ rec->attributes[0]->origin = jptype__attrOrig__USER;
+ rec->attributes[0]->originDetail = NULL;
+ rec->attributes[1] = soap_malloc(soap, sizeof(*(rec->attributes[1])));
+ rec->attributes[1]->name = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus");
+ rec->attributes[1]->value = soap_malloc(soap, sizeof(*(rec->attributes[0]->value)));
+ rec->attributes[1]->value->string = soap_strdup(soap, "Ready");
+ rec->attributes[1]->value->blob = NULL;
+ rec->attributes[1]->timestamp = 333;
+ rec->attributes[1]->origin = jptype__attrOrig__SYSTEM;
+ rec->attributes[1]->originDetail = NULL;
+ }
+ in.jobAttributes[1] = rec;
check_fault(soap,
Revision history:
$Log$
+ Revision 1.5.2.1 2005/11/03 17:46:53 mmulac
+ ares to c-ares migration
+ - use dynamic library of c-ares, instead of ares static lib
+ - ares clean up (now should be mentioned only in modules that really need it)
+ - patch for security.gsoap-plugin not yet in CVS (sent to interation list)
+ I do not know what will happen when one try to mix ares with c-ares libs
+ => weird things may arise!
+
+ Revision 1.5 2005/10/11 20:45:45 akrenek
+ - detect gsoap stuff
+ - install what should be installed
+
Revision 1.4 2005/08/12 10:56:25 mmulac
void IS server
- seems compiling
expat_prefix=${with.expat.prefix}
gsoap_prefix=${with.gsoap.prefix}
gsoap_version=${ext.gsoap.version}
-ares_prefix=${with.ares.prefix}
mysql_prefix=${with.mysql.prefix}
mysql_version=${ext.mysql.version}
thrflavour=${with.globus.thr.flavor}
#include "db_ops.h"
#include "soap_ps_calls.h"
#include "context.h"
+#include "common_server.h"
#include "soap_version.h"
#include "jpis_H.h"
return 1;
}
+ /* daemonize */
+ if (!conf->debug) glite_jpis_daemonize("glite-jp-indexd", conf->pidfile, conf->logfile);
+
/* XXX preliminary support for plugins
for (i=0; conf->plugins[i]; i++)
glite_jp_typeplugin_load(ctx,conf->plugins[i]);
fprintf(stderr,"Server idenity: %s\n",mysubj);
else fputs("WARNING: Running unauthenticated\n",stderr);
- /* daemonise */
-
/* 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
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->user = (void *) private;
--- /dev/null
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+
+/* TODO: belongs to server-bones */
+
+int glite_jpis_daemonize(const char *servername, const char *custom_pidfile, const char *custom_logfile) {
+ int lfd, opid;
+ FILE *fpid;
+ pid_t master;
+ char *pidfile, *logfile;
+
+ if (!custom_logfile) {
+ asprintf(&logfile, "%s/%s.log", geteuid() == 0 ? "/var/log" : getenv("HOME"), servername);
+ } else {
+ logfile = NULL;
+ }
+ lfd = open(logfile ? logfile : custom_logfile,O_CREAT|O_TRUNC|O_WRONLY,0600);
+ if (lfd < 0) {
+ fprintf(stderr,"%s: %s: %s\n",servername,logfile,strerror(errno));
+ free(logfile);
+ return 0;
+ }
+// printf("logfile: %s\n", logfile ? logfile : custom_logfile);
+ free(logfile);
+
+ if (daemon(0,1) == -1) {
+ perror("can't daemonize");
+ return 0;
+ }
+ dup2(lfd,1);
+ dup2(lfd,2);
+
+ if (!custom_pidfile) {
+ asprintf(&pidfile, "%s/%s.pid", geteuid() == 0 ? "/var/run" : getenv("HOME"), servername);
+ } else {
+ pidfile = NULL;
+ }
+// printf("pidfile: %s\n", pidfile ? pidfile : custom_pidfile);
+ setpgrp(); /* needs for signalling */
+ master = getpid();
+ fpid = fopen(pidfile ? pidfile : custom_pidfile,"r");
+ if ( fpid )
+ {
+ opid = -1;
+
+ if ( fscanf(fpid,"%d",&opid) == 1 )
+ {
+ if ( !kill(opid,0) )
+ {
+ fprintf(stderr,"%s: another instance running, pid = %d\n",servername,opid);
+ return 0;
+ }
+ else if (errno != ESRCH) { perror("kill()"); return 0; }
+ }
+ fclose(fpid);
+ } else if (errno != ENOENT) { perror(pidfile ? pidfile : custom_pidfile); free(pidfile); return 0; }
+
+ fpid = fopen(pidfile ? pidfile : custom_pidfile, "w");
+ if (!fpid) { perror(pidfile ? pidfile : custom_pidfile); free(pidfile); return 0; }
+ free(pidfile);
+ fprintf(fpid, "%d", getpid());
+ fclose(fpid);
+
+ return 1;
+}
--- /dev/null
+#ifndef GLITE_JPIS_COMMON_SERVER_H
+#define GLITE_JPIS_COMMON_SERVER_H
+
+int glite_jpis_daemonize(const char *servername, const char *custom_pidfile, const char *custom_logfile);
+
+#endif
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include <stdarg.h>
#include <glite/jp/types.h>
#include <glite/jp/context.h>
int glite_jp_get_conf(int argc, char **argv, char *config_file, glite_jp_is_conf **configuration)
-{
+{
+ char *debug;
char *ps = NULL;
// read comman line options and configuration file
// configuration from environment
conf->cs = getenv("GLITE_JPIS_DB");
conf->port = getenv("GLITE_JPIS_PORT");
+ debug = getenv("GLITE_JPIS_DEBUG");
+ conf->debug = (debug != NULL) && (strcmp(debug, "0") != 0);
+ conf->no_auth = 0; // check authorization
+ conf->pidfile = getenv("GLITE_JPIS_PIDFILE");
+ conf->logfile = getenv("GLITE_JPIS_LOGFILE");
// prefixes & attributes defined in:
// lb.server/build/jp_job_attrs.h (created when build plugin)
conf->attrs = calloc(19, sizeof(*conf->attrs));
conf->attrs[0] = strdup("http://egee.cesnet.cz/en/Schema/JP/System:owner");
conf->attrs[1] = strdup("http://egee.cesnet.cz/en/Schema/JP/System:jobId");
- conf->attrs[2] = strdup("http://egee.cesnet.cz/en/Schema/JP/System::regtime");
+ conf->attrs[2] = strdup("http://egee.cesnet.cz/en/Schema/JP/System:regtime");
conf->attrs[3] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:user");
conf->attrs[4] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:aTag");
conf->attrs[5] = strdup("http://egee.cesnet.cz/en/Schema/LB/Attributes:eNodes");
// ps = "http://umbar.ics.muni.cz:8901";
if (!ps && ((ps = getenv("GLITE_JPIS_PS")) == NULL)) {
- printf("No JP PrimaryStrorage server specified in $GLITE_JPIS_PS, default feeds skipped.\n");
+ printf("No JP PrimaryStrorage server specified in $GLITE_JPIS_PS, default feeds skipped. (not fatal)\n");
conf->feeds = calloc(1, sizeof(*(conf->feeds)));
*configuration = conf;
return 0;
free(conf->feeds);
free(conf);
}
+
+
+void glite_jp_lprintf(const char *source, const char *fmt, ...) {
+ va_list ap;
+
+ printf("%s: ", source);
+ va_start(ap, fmt);
+ vprintf(fmt, ap);
+ va_end(ap);
+}
#define GLITE_JPIS_DEFAULT_PORT_STR "8902"
//#define lprintf
-#define lprintf printf
+#define lprintf(args...) glite_jp_lprintf(__FUNCTION__, ##args)
typedef struct _glite_jp_is_feed {
char *PS_URL; //URLs of Primary Storage servers
glite_jp_is_feed **feeds; // null terminated list of feeds
- char *cs, *port;
+ int debug;
+ int no_auth; // set if you do not want authorization
+ char *cs, // database contact string
+ *port, // server port
+ *pidfile,
+ *logfile;
} glite_jp_is_conf;
int glite_jp_get_conf(int argc, char **argv, char *config_file, 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, ...);
+
#endif
jobid CHAR(32) BINARY NOT NULL,\n\
value %s BINARY NOT NULL,\n\
full_value %s NOT NULL,\n\
+ origin INT NOT NULL,\n\
\n\
INDEX (jobid),\n\
INDEX (value)\n\
);"
-#define SQLCMD_INSERT_ATTRVAL "INSERT INTO " TABLE_PREFIX_DATA "%s (jobid, value, full_value) VALUES (\n\
+#define SQLCMD_INSERT_ATTRVAL "INSERT INTO " TABLE_PREFIX_DATA "%s (jobid, value, full_value, origin) VALUES (\n\
'%s',\n\
'%s',\n\
- '%s'\n\
+ '%s',\n\
+ '%d'\n\
)"
#define INDEX_LENGTH 255
// sql command: get info about the feed (via feedid)
glite_jp_db_create_params(&myparam, 1, GLITE_JP_DB_TYPE_CHAR, isctx->param_feedid, &isctx->param_feedid_len);
- glite_jp_db_create_results(&myres, 2,
+ glite_jp_db_create_results(&myres, 3,
GLITE_JP_DB_TYPE_INT, NULL, &isctx->param_uniqueid,
- GLITE_JP_DB_TYPE_INT, NULL, &isctx->param_state);
- if ((ret = glite_jp_db_prepare(jpctx, "SELECT uniqueid, state FROM feeds WHERE (feedid=?)", &isctx->select_info_feed_stmt, myparam, myres)) != 0) goto fail;
+ GLITE_JP_DB_TYPE_INT, NULL, &isctx->param_state,
+ GLITE_JP_DB_TYPE_VARCHAR, NULL, isctx->param_ps, sizeof(isctx->param_ps), &isctx->param_ps_len);
+ if ((ret = glite_jp_db_prepare(jpctx, "SELECT uniqueid, state, source FROM feeds WHERE (feedid=?)", &isctx->select_info_feed_stmt, myparam, myres)) != 0) goto fail;
// sql command: update state of the feed (via uniqueid)
glite_jp_db_create_params(&myparam, 2,
int glite_jpis_insertAttrVal(glite_jpis_context_t ctx, const char *jobid, glite_jp_attrval_t *av) {
char *sql, *table, *value, *full_value, *md5_jobid;
+ long int origin;
table = glite_jpis_attr_name2id(av->name);
value = glite_jp_attrval_to_db_index(ctx->jpctx, av, INDEX_LENGTH);
full_value = glite_jp_attrval_to_db_full(ctx->jpctx, av);
md5_jobid = str2md5(jobid);
- asprintf(&sql, SQLCMD_INSERT_ATTRVAL, table, md5_jobid, value, full_value);
+ origin = av->origin;
+ asprintf(&sql, SQLCMD_INSERT_ATTRVAL, table, md5_jobid, value, full_value, origin);
free(md5_jobid);
free(table);
free(value);
free(full_value);
- lprintf("%s(%s): sql=%s\n", __FUNCTION__, av->name, sql);
+ lprintf("(%s) sql=%s\n", av->name, sql);
if (glite_jp_db_execstmt(ctx->jpctx, sql, NULL) != 1) {
free(sql);
return ctx->jpctx->error->code;
}
-int glite_jpis_lazyInsertJob(glite_jpis_context_t ctx, const char *feedid, const char *jobid, const char *owner) {
+int glite_jpis_lazyInsertJob(glite_jpis_context_t ctx, const char *ps, const char *jobid, const char *owner) {
int ret;
char *md5_jobid = NULL, *md5_cert = NULL;
- lprintf("%s\n", __FUNCTION__);
+ lprintf("\n");
md5_jobid = str2md5(jobid);
+ md5_cert = str2md5(owner);
GLITE_JPIS_PARAM(ctx->param_jobid, ctx->param_jobid_len, md5_jobid);
-
switch (ret = glite_jp_db_execute(ctx->select_jobid_stmt)) {
case 1: lprintf("jobid '%s' found\n", jobid); goto ok0;
case 0:
- lprintf("%s:inserting jobid %s (%s)\n", __FUNCTION__, jobid, md5_jobid);
+ lprintf("inserting jobid %s (%s)\n", jobid, md5_jobid);
+
GLITE_JPIS_PARAM(ctx->param_dg_jobid, ctx->param_dg_jobid_len, jobid);
- GLITE_JPIS_PARAM(ctx->param_feedid, ctx->param_feedid_len, feedid);
+ GLITE_JPIS_PARAM(ctx->param_ownerid, ctx->param_ownerid_len, md5_cert);
+ GLITE_JPIS_PARAM(ctx->param_ps, ctx->param_ps_len, ps);
if (glite_jp_db_execute(ctx->insert_job_stmt) != 1) goto fail;
break;
default: assert(ret != 1); break;
}
ok0:
- md5_cert = str2md5(owner);
GLITE_JPIS_PARAM(ctx->param_ownerid, ctx->param_ownerid_len, md5_cert);
-
switch (ret = glite_jp_db_execute(ctx->select_user_stmt)) {
- case 1: lprintf("%s:jobid '%s' found\n", __FUNCTION__, jobid); goto ok;
+ case 1: lprintf("owner '%s' found\n", owner); goto ok;
case 0:
- lprintf("%s:inserting user %s (%s)\n", __FUNCTION__, owner, md5_cert);
+ lprintf("inserting user %s (%s)\n", owner, md5_cert);
GLITE_JPIS_PARAM(ctx->param_cert, ctx->param_cert_len, owner);
if (glite_jp_db_execute(ctx->insert_user_stmt) != 1) goto fail;
break;
int glite_jpis_insertAttrVal(glite_jpis_context_t ctx, const char *jobid, glite_jp_attrval_t *av);
-int glite_jpis_lazyInsertJob(glite_jpis_context_t ctx, const char *feedid, const char *jobid, const char *owner);
+int glite_jpis_lazyInsertJob(glite_jpis_context_t ctx, const char *ps, const char *jobid, const char *owner);
#endif
#define CONTEXT_FROM_SOAP(soap,ctx) glite_jpis_context_t ctx = (glite_jpis_context_t) ((slave_data_t *) (soap->user))->ctx
-static int updateJob(glite_jpis_context_t ctx, const char *feedid, struct jptype__jobRecord *jobAttrs) {
+static int updateJob(glite_jpis_context_t ctx, const char *ps, struct jptype__jobRecord *jobAttrs) {
glite_jp_attrval_t av;
struct jptype__attrValue *attr;
int ret, iattrs;
- lprintf("%s: jobid='%s', attrs=%d\n", __FUNCTION__, jobAttrs->jobid, jobAttrs->__sizeattributes);
+ lprintf("jobid='%s', attrs=%d\n", jobAttrs->jobid, jobAttrs->__sizeattributes);
- if (jobAttrs->remove) assert(*(jobAttrs->remove) == 0);
+ if (jobAttrs->remove) assert(*(jobAttrs->remove) == false_);
- if ((ret = glite_jpis_lazyInsertJob(ctx, feedid, jobAttrs->jobid, jobAttrs->owner)) != 0) return ret;
+ if ((ret = glite_jpis_lazyInsertJob(ctx, ps, jobAttrs->jobid, jobAttrs->owner)) != 0) return ret;
for (iattrs = 0; iattrs < jobAttrs->__sizeattributes; iattrs++) {
attr = jobAttrs->attributes[iattrs];
glite_jpis_SoapToAttrVal(&av, attr);
struct _jpelem__UpdateJobsResponse *jpelem__UpdateJobsResponse)
{
int ret, ijobs;
- const char *feedid;
+ const char *feedid, *ps;
int status, done;
CONTEXT_FROM_SOAP(soap, ctx);
glite_jp_context_t jpctx = ctx->jpctx;
// XXX: test client in examples/jpis-test
// sends to this function some data for testing
puts(__FUNCTION__);
+ ps = NULL;
// get info about the feed
feedid = jpelem__UpdateJobs->feedId;
GLITE_JPIS_PARAM(ctx->param_feedid, ctx->param_feedid_len, feedid);
if ((ret = glite_jp_db_execute(ctx->select_info_feed_stmt)) != 1) {
- fprintf(stderr, "can't get info about '%s', returned %d records: %s (%s)\n", feedid, ret, jpctx->error->desc, jpctx->error->source);
+ fprintf(stderr, "can't get info about feed '%s', returned %d records", feedid, ret);
+ if (jpctx->error) fprintf(stderr, ": %s (%s)\n", jpctx->error->desc, jpctx->error->source);
+ else fprintf(stderr, "\n");
goto fail;
}
- // update status, if needed (only oring)
+ ps = strdup(ctx->param_ps);
+ // update status, if needed (only orig)
status = ctx->param_state;
done = jpelem__UpdateJobs->feedDone ? GLITE_JP_IS_STATE_DONE : 0;
if ((done != (status & GLITE_JP_IS_STATE_DONE)) && done) {
// insert all attributes
for (ijobs = 0; ijobs < jpelem__UpdateJobs->__sizejobAttributes; ijobs++) {
- if (updateJob(ctx, feedid, jpelem__UpdateJobs->jobAttributes[ijobs]) != 0) goto fail;
+ if (updateJob(ctx, ps, jpelem__UpdateJobs->jobAttributes[ijobs]) != 0) goto fail;
}
+ free(ps);
return SOAP_OK;
fail:
+ free(ps);
+ if (ctx->jpctx->error) {
// TODO: bubble up
- err = glite_jp_error_chain(ctx->jpctx);
- fprintf(stderr, "%s:%s\n", __FUNCTION__, err);
- free(err);
+ err = glite_jp_error_chain(ctx->jpctx);
+ fprintf(stderr, "%s:%s\n", __FUNCTION__, err);
+ free(err);
+ }
return SOAP_FAULT;
}
return(0);
}
+/* 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)
{
char *qa = NULL, *qb = NULL, *qop = NULL, *attr_md5,
free(qa); qa = qb; qb = NULL;
}
- trio_asprintf(&query, "SELECT dg_jobid,ps FROM jobs%s WHERE %s;", qa, qwhere);
+ if (ctx->conf->no_auth) {
+ trio_asprintf(&query, "SELECT DISTINCT dg_jobid,ps FROM jobs%s WHERE %s;", qa, qwhere);
+ }
+ else {
+ trio_asprintf(&query, "SELECT DISTINCT dg_jobid,ps FROM jobs,users%s WHERE (jobs.ownerid = users.userid AND users.cert_subj='%s') AND %s;", qa, ctx->jpctx->peer, qwhere);
+ }
printf("Incomming QUERY:\n %s\n", query);
free(qwhere);
free(qa);
puts(__FUNCTION__);
memset(out, 0, sizeof(*out));
-
+
+ /* test whether there is any indexed aatribudet in the condition */
if ( checkIndexedConditions(ctx, in) ) {
fprintf(stderr, "No indexed attribute in query\n");
return SOAP_ERR;
}
+ /* get all jobids matching the conditions */
if ( get_jobids(soap, ctx, in, &jobids, &ps_list) ) {
return SOAP_ERR;
}
+ /* get all requested attributes for matching jobids */
for (i=0; (jobids && jobids[i]); i++);
size = i;
jr = soap_malloc(soap, size * sizeof(*jr));
return SOAP_ERR;
}
// XXX: in prototype we return only first value of PS URL
- // in future database shoul contain one more table with URLs
+ // in future database should contain one more table with URLs
jr[i]->__sizeprimaryStorage = 1;
jr[i]->primaryStorage = soap_malloc(soap, sizeof(*(jr[i]->primaryStorage)));
jr[i]->primaryStorage[0] = soap_strdup(soap, ps_list[i]);
--- /dev/null
+#! /bin/bash
+
+#
+# test script for the index server
+#
+# requires running mysql
+#
+# configuration:
+# GLITE_JPIS_TEST_PIDFILE.........pidfile (default `pwd`/glite-jp-indexd.pid)
+# GLITE_JPIS_TEST_LOGFILE.........logfile (default `pwd`/glite-jp-indexd.log)
+# GLITE_JPIS_TEST_PORT............index server port
+# GLITE_JPIS_TEST_DB..............connection string
+# (default jpis/@localhost:jpis1test,
+# autocreating the database when empty)
+# GLITE_JPIS_TEST_ROOT_USER.......root user (default empty)
+# GLITE_JPIS_TEST_ROOT_PASSWORD...root password (default empty)
+#
+
+# get the configuration
+GLITE_LOCATION=${GLITE_LOCATION:-"/opt/glite"}
+[ -f /etc/glite.conf ] && . /etc/glite.conf
+[ -f $HOME/.glite.conf ] && . $HOME/.glite.conf
+[ -f $GLITE_LOCATION/etc/jpis.conf ] && . $GLITE_LOCATION/etc/jpis.conf
+
+# handle the configuration
+ARGS="-u ${GLITE_JPIS_ROOT_USER:-root}"
+[ -z "$GLITE_JPIS_ROOT_PASSWORD" ] || ARGS="-p ${GLITE_JPIS_ROOT_PASSWORD} $ARGS"
+GLITE_JPIS_TEST_PORT=${GLITE_JPIS_TEST_PORT:-"10000"}
+GLITE_JPIS_TEST_PIDFILE=${GLITE_JPIS_TEST_PIDFILE:-"`pwd`/glite-jp-indexd.pid"}
+GLITE_JPIS_TEST_LOGFILE=${GLITE_JPIS_TEST_LOGFILE:-"`pwd`/glite-jp-indexd.log"}
+
+# create database when needed
+if [ -z "$GLITE_JPIS_TEST_DB" ]; then
+ GLITE_JPIS_TEST_DB="jpis/@localhost:jpis1test"
+ mysqladmin -f $ARGS drop jpis1test > /dev/null 2>&1
+ mysqladmin -f $ARGS create jpis1test && \
+ mysql $ARGS -e 'GRANT ALL on jpis1test.* to jpis@localhost' && \
+ mysql -u jpis jpis1test < ../config/glite-jp-index-dbsetup.sql || exit 1
+ db_created="1"
+fi
+
+# run index server
+GLITE_JPIS_PIDFILE=${GLITE_JPIS_TEST_PIDFILE} \
+GLITE_JPIS_LOGFILE=${GLITE_JPIS_TEST_LOGFILE} \
+GLITE_JPIS_DEBUG="0" \
+GLITE_JPIS_DB=$GLITE_JPIS_TEST_DB \
+GLITE_JPIS_PORT=$GLITE_JPIS_TEST_PORT \
+ ./glite-jp-indexd
+if [ x"$?" != x"0" ]; then
+ echo FAILED
+ [ -z "$db_created" ] || mysqladmin -f $ARGS drop jpis1test
+ exit 1
+fi
+if [ ! -s "./glite-jp-indexd.pid" ]; then
+ echo "Can't startup index server."
+ [ -z "$db_created" ] || mysqladmin -f $ARGS drop jpis1test
+ exit 1
+fi
+
+# wait for index server
+ret=1
+while [ x"$ret" != x"0" ]; do
+ LC_ALL=C netstat -tap 2>/dev/null | grep "\<$GLITE_JPIS_TEST_PORT\>" > /dev/null
+ ret=$?
+ LC_ALL=C sleep 0.1
+done
+# run the example
+numok=`GLITE_JPIS_DB=$GLITE_JPIS_TEST_DB \
+GLITE_JPIS_PORT=$GLITE_JPIS_TEST_PORT \
+ ./glite-jpis-test | grep "OK" | wc -l`
+
+# kill the index server
+kill `cat ${GLITE_JPIS_TEST_PIDFILE}`
+
+# drop databaze when created
+[ -z "$db_created" ] || mysqladmin -f $ARGS drop jpis1test >/dev/null
+
+if [ "$numok" -eq "2" ]; then
+ echo OK
+fi
nothrflavour=gcc32
thrflavour=gcc32pthr
expat_prefix=/opt/expat
-ares_prefix=/opt/ares
gsoap_prefix=/software/gsoap-2.6
CC=gcc
TRIOLIB:=-lglite_jp_trio
ifneq (${mysql_prefix},/usr)
- ifeq ($(shell echo ${mysql_version} | cut -d. -f1,2),4.1)
- MYSQLIB := -L${mysql_prefix}/lib/mysql -lmysqlclient
+ ifeq ($(shell test -f ${mysql_prefix}/lib/libmysqlclient.a -o -f ${mysql_prefix}/lib/libmysqlclient.so && echo ok),ok)
+ MYSQLIB := -L${mysql_prefix}/lib -lmysqlclient -lz
else
- MYSQLIB := -L${mysql_prefix}/lib -lmysqlclient
+ MYSQLIB := -L${mysql_prefix}/lib/mysql -L${mysql_prefix}/lib -lmysqlclient -lz
endif
else
MYSQLIB := -lmysqlclient
${INSTALL} -m 755 $$plugin ${PREFIX}/lib; \
done
${INSTALL} -m 755 ${top_srcdir}/config/startup ${PREFIX}/etc/init.d/glite-jp-primary
+ ${INSTALL} -m 755 ${top_srcdir}/config/glite-jp-primary-dbsetup.sql ${PREFIX}/etc
+ ${INSTALL} -m 755 ${top_srcdir}/config/glite-jp-primary-dbsetup.sh ${PREFIX}/etc
+ ${INSTALL} -m 644 ${top_srcdir}/examples/sample_job ${PREFIX}/examples/glite-jp-primary-sample_job.lb
clean:
--- /dev/null
+#! /bin/sh
+
+#
+# Shell example of preparing the database for JP Index Server
+#
+
+# database
+mysqladmin -u root -p create jpps
+
+# user
+mysql -u root -p -e 'GRANT ALL on jpps.* to jpps@localhost'
+
+# tables
+mysql -u jpps jpps < `dirname $0`/glite-jp-primary-dbsetup.sql
echo -n Starting glite-jp-primarystoraged ...
su - $GLITE_USER -c " $GLITE_LOCATION/bin/glite-jp-primarystoraged \
+ $GLITE_JP_DEBUG \
-P $GLITE_LOCATION/lib/glite-jp-tags.so -P $GLITE_LOCATION/lib/glite_lb_plugin.so \
$creds -a '$GLITE_JP_PRIMARY_PEERS' \
-i '$pidfile' -p $GLITE_JP_PRIMARY_PORT $GLITE_JP_PRIMARY_SPECIAL \
--- /dev/null
+0. install glite-jp-primary package
+
+1. create MySQL database of the service, preferably using
+ ${GLITE_LOCATION}/etc/glite-jp-primary-dbsetup.sh
+ (the script prompts two times for MySQL root password)
+
+2. create a directory where JPPS files will be stored and configure
+ gridftp server so that this directory is accessible via gridftp
+
+3. create the configuration file $GLITE_LOCATION/etc/jp.conf, it should
+ contain /bin/sh syntax assignment to the following variables (or they
+ have to be set in the environment of the startup script by other means:
+
+ GLITE_USER the unix user running the service
+
+ GLOBUS_LOCATION where is Globus installed
+
+ GLITE_JP_PRIMARY_FTP_PORT
+ port for the ftp JPPS interface (bulk file transfers)
+
+ GLITE_JP_PRIMARY_INTERNAL
+ directory where the JPPS files are stored (local path)
+
+ GLITE_JP_PRIMARY_EXTERNAL
+ URL prefix which is mapped by gridftp to the directory,
+ eg. gsiftp://this.host.name:$GLITE_JP_PRIMARY_FTP_PORT/some/directory
+
+
+ GLITE_JP_PRIMARY_PEERS
+ file with list (one per line) of X509 certificate subjects of "trusted peers", i.e. L&B servers which may upload data to this JPPS
+
+
+4. start the service with
+ $GLITE_LOCATION/etc/init.d/glite-jp-primary start
+
+
+5. This step taints the database with testing data. Don't do it if it is an issue.
+It is not necessary for the service operation, it's just checking its basic functionality.
+
+$ JOB=https://scientific.civ.zcu.cz:9200/1Yjk3Wlaspl07y45iX8Tng
+$ TEST=$GLITE_LOCATION/examples/glite-jp-primary-test
+$ export X5O9_USER_PROXY=/some/proxy.pem # must be among $GLITE_JP_PRIMARY_PEERS
+
+$ $TEST registerjob $JOB '/the/job/owner/x509/cert'
+
+$ $TEST startupload "urn:org.glite.jp.primary:lb" 1 text/plain
+ responds with destination gsiftp url
+
+$ globus-url-copy file:///$GLITE_LOCATION/examples/glite-jp-primary-sample_job.lb $DESTINATION_URL
+
+$ $TEST commitupload $DESTINATION_URL
+
+$ $TEST getjobattr $JOB http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus
+
+The command should output:
+
+ Waiting FILE Mon Oct 10 23:48:47 2005
+
+--
Check system attributes known from job registration:
-$ ./jpps-test GetJobAttr JOBID http://egee.cesnet.cz/en/WSDL/jp-system:owner
-$ ./jpps-test GetJobAttr JOBID http://egee.cesnet.cz/en/WSDL/jp-system:regtime
+$ ./jpps-test GetJobAttr JOBID http://egee.cesnet.cz/en/Schema/JP/System:owner
+$ ./jpps-test GetJobAttr JOBID http://egee.cesnet.cz/en/Schema/JP/System:regtime
Record JP tag:
--- /dev/null
+DG.ARRIVED=20051010204845.000000 DATE=20051010204845.409455 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="UserInterface" DG.SRC_INSTANCE="" DG.EVNT="RegJob" DG.JOBID="https://scientific.civ.zcu.cz:9200/1Yjk3Wlaspl07y45iX8Tng" DG.SEQCODE="UI=000001:NS=0000000000:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.REGJOB.JDL="blabla" DG.REGJOB.NS="NNNSSSS" DG.REGJOB.PARENT="" DG.REGJOB.JOBTYPE="SIMPLE" DG.REGJOB.NSUBJOBS="0" DG.REGJOB.SEED="uLU0BArrdV98O41PLThJ5Q"
+DG.ARRIVED=20051010204847.000000 DATE=20051010204847.451986 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="DeQueued" DG.JOBID="https://scientific.civ.zcu.cz:9200/1Yjk3Wlaspl07y45iX8Tng" DG.SEQCODE="UI=000002:NS=0000000004:WM=000001:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.DEQUEUED.QUEUE="queue name" DG.DEQUEUED.LOCAL_JOBID="new jobId assigned by the receiving component"
+DG.ARRIVED=20051010204847.000000 DATE=20051010204847.485702 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="HelperCall" DG.JOBID="https://scientific.civ.zcu.cz:9200/1Yjk3Wlaspl07y45iX8Tng" DG.SEQCODE="UI=000002:NS=0000000004:WM=000003:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.HELPERCALL.HELPER_NAME="name of the called component" DG.HELPERCALL.HELPER_PARAMS="parameters of the call" DG.HELPERCALL.SRC_ROLE="CALLING"
+DG.ARRIVED=20051010204847.000000 DATE=20051010204847.520663 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="Match" DG.JOBID="https://scientific.civ.zcu.cz:9200/1Yjk3Wlaspl07y45iX8Tng" DG.SEQCODE="UI=000002:NS=0000000004:WM=000005:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.MATCH.DEST_ID="destination CE/queue"
+DG.ARRIVED=20051010204847.000000 DATE=20051010204847.552015 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="HelperReturn" DG.JOBID="https://scientific.civ.zcu.cz:9200/1Yjk3Wlaspl07y45iX8Tng" DG.SEQCODE="UI=000002:NS=0000000004:WM=000007:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.HELPERRETURN.HELPER_NAME="name of the called component" DG.HELPERRETURN.RETVAL="returned data" DG.HELPERRETURN.SRC_ROLE="CALLING"
+DG.ARRIVED=20051010204847.000000 DATE=20051010204847.584267 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="EnQueued" DG.JOBID="https://scientific.civ.zcu.cz:9200/1Yjk3Wlaspl07y45iX8Tng" DG.SEQCODE="UI=000002:NS=0000000004:WM=000009:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.ENQUEUED.QUEUE="destination queue" DG.ENQUEUED.JOB="job description in receiver language" DG.ENQUEUED.RESULT="OK" DG.ENQUEUED.REASON="detailed description of transfer"
+DG.ARRIVED=20051010204847.000000 DATE=20051010204847.381506 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="NetworkServer" DG.SRC_INSTANCE="" DG.EVNT="Accepted" DG.JOBID="https://scientific.civ.zcu.cz:9200/1Yjk3Wlaspl07y45iX8Tng" DG.SEQCODE="UI=000002:NS=0000000001:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.ACCEPTED.FROM="UserInterface" DG.ACCEPTED.FROM_HOST="sending component hostname" DG.ACCEPTED.FROM_INSTANCE="sending component instance" DG.ACCEPTED.LOCAL_JOBID="new jobId (Condor Globus ...)"
+DG.ARRIVED=20051010204847.000000 DATE=20051010204847.409422 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="NetworkServer" DG.SRC_INSTANCE="" DG.EVNT="EnQueued" DG.JOBID="https://scientific.civ.zcu.cz:9200/1Yjk3Wlaspl07y45iX8Tng" DG.SEQCODE="UI=000002:NS=0000000003:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.ENQUEUED.QUEUE="destination queue" DG.ENQUEUED.JOB="job description in receiver language" DG.ENQUEUED.RESULT="OK" DG.ENQUEUED.REASON="detailed description of transfer"
Revision history:
$Log$
+ Revision 1.5.2.1 2005/11/03 17:46:53 mmulac
+ ares to c-ares migration
+ - use dynamic library of c-ares, instead of ares static lib
+ - ares clean up (now should be mentioned only in modules that really need it)
+ - patch for security.gsoap-plugin not yet in CVS (sent to interation list)
+ I do not know what will happen when one try to mix ares with c-ares libs
+ => weird things may arise!
+
+ Revision 1.5 2005/10/11 20:49:27 akrenek
+ - detect gsoap
+ - use flavoured gsoap plugin
+
Revision 1.4 2005/06/03 11:56:49 akrenek
make it build with the new ftp backend
glite_location=${with.glite.location}
globus_prefix=${with.globus.prefix}
expat_prefix=${with.expat.prefix}
-ares_prefix=${with.ares.prefix}
gsoap_prefix=${with.gsoap.prefix}
gsoap_version=${ext.gsoap.version}
mysql_prefix=${with.mysql.prefix}
const char *job,
glite_jp_attrval_t **attrs)
{
- int i,ret;
- char **ma;
-
- for (i=0; feed->attrs[i]; i++);
- ma = malloc((i+2) * sizeof *ma);
- ma[0] = GLITE_JP_ATTR_OWNER;
- memcpy(ma+1,feed->attrs,(i+1) * sizeof *ma);
- ret = glite_jpps_get_attrs(ctx,job,ma,i+1,attrs);
+ int i,ret,no_owner = 1;
+ char **ma = NULL;
+
+ for (i=0; feed->attrs[i]; i++)
+ if (!strcmp(feed->attrs[i],GLITE_JP_ATTR_OWNER)) no_owner = 0;
+
+ if (no_owner) {
+ ma = malloc((i+2) * sizeof *ma);
+ ma[0] = GLITE_JP_ATTR_OWNER;
+ memcpy(ma+1,feed->attrs,(i+1) * sizeof *ma);
+ }
+ ret = glite_jpps_get_attrs(ctx,job,
+ no_owner ? ma : feed->attrs,
+ i+no_owner,attrs);
free(ma);
return ret;
}
const glite_jp_attrval_t attrs[]
)
{
- int i,fed;
+ int i,fed,ret = 0;
int qi[QUERY_MAX];
char *owner = NULL;
glite_jp_attrval_t meta[QUERY_MAX+1];
j=0;
for (i=0; feed->qry[i].attr; i++) if (!qi[i]) {
assert(j<QUERY_MAX);
- meta[j].name = feed->qry[i].attr;
+ meta[j].name = strdup(feed->qry[i].attr);
qi2[j] = i;
j++;
}
if (glite_jppsbe_get_job_metadata(ctx,job,meta)) {
glite_jp_error_t err;
+
memset(&err,0,sizeof err);
err.code = EIO;
err.source = __FUNCTION__;
err.desc = "complete query";
- return glite_jp_stack_error(ctx,&err);
+ ret = glite_jp_stack_error(ctx,&err);
+ goto cleanup;
}
for (i=0; meta[i].name; i++) {
- if (!check_qry_item(ctx,feed->qry+qi2[i],meta+i))
- return 0;
+ if (!check_qry_item(ctx,feed->qry+qi2[i],meta+i)) {
+ ret = 0;
+ goto cleanup;
+ }
if (!strcmp(meta[i].name,GLITE_JP_ATTR_OWNER)) owner = meta[i].value;
}
}
}
glite_jpps_single_feed(ctx,feed->id,0,feed->destination,job,owner,attrs);
}
+
+cleanup:
for (i=0; meta[i].name; i++) glite_jp_attrval_free(meta+i,0);
- return 0;
+ return ret;
}
/* TODO: overit, ze do dalsich atributu se leze az kdyz matchuji metadata
err.code = EIO;
err.source = __FUNCTION__;
err.desc = buf;
- snprintf(buf,sizeof buf,"%s %s\n",
+ memset(buf, 0, sizeof(buf));
+ if (ctx->other_soap->fault) {
+ snprintf(buf,sizeof buf,"%s %s\n",
ctx->other_soap->fault->faultcode,
ctx->other_soap->fault->faultstring);
+ }
+ else {
+ sprintf(buf,"No detailed error description (JP IS not running?)\n");
+ }
buf[999] = 0;
glite_jp_stack_error(ctx,&err);
}
/* XXX authorization done in soap_ops.c */
/* XXX name length */
+ printf("data_basename: %s\n", data_basename);
if (asprintf(&data_basename, "%s%s%s", class,
(name != NULL) ? "." : "",
(name != NULL) ? name : "") == -1) {
char *qres[3] = { NULL, NULL, NULL };
int cmask = 0, owner_idx = -1, reg_idx = -1;
glite_jp_db_stmt_t q;
- glite_jp_attrval_t metadata[2];
+ glite_jp_attrval_t metadata[3];
memset(&err,0,sizeof err);
glite_jp_clear_error(ctx);
err.source = __FUNCTION__;
/* XXX: assuming not more than 2 */
- memset(metadata,0,sizeof metadata);
+ memset(metadata,0, sizeof metadata);
/* XXX: const discarding is OK */
for (i=0;attrs[i]; i++) metadata[i].name = (char *) attrs[i];
nothrflavour=gcc32
thrflavour=gcc32pthr
expat_prefix=/opt/expat
-ares_prefix=/opt/ares
gsoap_prefix=/software/gsoap-2.6
CC=gcc
LOBJS:=${OBJS:.o=.lo}
ifneq (${mysql_prefix},/usr)
- ifeq ($(shell echo ${mysql_version} | cut -d. -f1,2),4.1)
- MYSQLIB := -L${mysql_prefix}/lib/mysql -lmysqlclient
- else
+ ifeq ($(shell test -f ${mysql_prefix}/lib/libmysqlclient.a -o -f ${mysql_prefix}/lib/libmysqlclient.so && echo ok),ok)
MYSQLIB := -L${mysql_prefix}/lib -lmysqlclient
+ else
+ MYSQLIB := -L${mysql_prefix}/lib/mysql -lmysqlclient
endif
else
MYSQLIB := -lmysqlclient
Revision history:
$Log$
+ Revision 1.1.1.1.2.1 2005/11/03 17:46:53 mmulac
+ ares to c-ares migration
+ - use dynamic library of c-ares, instead of ares static lib
+ - ares clean up (now should be mentioned only in modules that really need it)
+ - patch for security.gsoap-plugin not yet in CVS (sent to interation list)
+ I do not know what will happen when one try to mix ares with c-ares libs
+ => weird things may arise!
+
+ Revision 1.1.1.1 2005/09/15 16:53:25 valtri
+ Initial import of common module for server side. It depends on mysql.
+
Revision 1.4 2005/08/12 10:56:25 mmulac
void IS server
- seems compiling
globus_prefix=${with.globus.prefix}
expat_prefix=${with.expat.prefix}
gsoap_prefix=${with.gsoap.prefix}
-ares_prefix=${with.ares.prefix}
mysql_prefix=${with.mysql.prefix}
mysql_version=${ext.mysql.version}
thrflavour=${with.globus.thr.flavor}
Revision history:
$Log$
+ Revision 1.10.2.1 2005/10/20 06:55:15 zsalvet
+ Add libtar and mysql external dependencies.
+
+ Revision 1.10 2005/10/14 17:23:07 akrenek
+ added jp.client
+
Revision 1.9 2005/10/11 20:37:50 akrenek
added dependencies on lb.server-bones and security.gsoap-plugin
</if>
</target>
- <target name="server-common" unless="setenvonly" depends="envset, common" >
+ <target name="server-common" unless="setenvonly" depends="envset, mysql, common" >
<if>
<isset property="small.memory" />
<then>
</if>
</target>
- <target name="client" unless="setenvonly" depends="envset, common" >
+ <target name="client" unless="setenvonly" depends="envset, libtar, common" >
<if>
<isset property="small.memory" />
<then>
org.glite.jp.index.version = HEAD
org.glite.jp.primary.version = HEAD
org.glite.jp.client.version = HEAD
+
+ext.gsoap.version = 2.7.0
Revision history:
$Log$
+ Revision 1.5 2005/11/23 08:24:23 zsalvet
+ Add jp.client component.
+
+ Revision 1.4.2.2 2005/10/20 06:55:15 zsalvet
+ Add libtar and mysql external dependencies.
+
+ Revision 1.4.2.1 2005/10/17 09:49:02 akrenek
+ added jp.client module targets
+
Revision 1.4 2005/10/03 17:00:50 valtri
Automatically checkout the new module yet.
<equals arg1="${org.glite.jp.server-common.version}" arg2="HEAD" />
</condition>
+ <condition property="client.head">
+ <equals arg1="${org.glite.jp.client.version}" arg2="HEAD" />
+ </condition>
+
</target>
<presetdef name="cvs-co">
<!-- All external libraries -->
<target name="external"
- description="Install external packages" depends="oscheck"/>
+ description="Install external packages" depends="oscheck, libtar, mysql"/>
<!-- =====================================================
GLite Middleware jp modules
<target name="project" depends="server-common,
ws-interface,
common,
+ client,
+ server-common,
index,
primary,
client" />