make it build with the new ftp backend
authorAleš Křenek <ljocha@ics.muni.cz>
Fri, 3 Jun 2005 11:56:49 +0000 (11:56 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Fri, 3 Jun 2005 11:56:49 +0000 (11:56 +0000)
org.glite.jp.primary/Makefile
org.glite.jp.primary/config/glite-jp-primary-dbsetup.sql
org.glite.jp.primary/project/configure.properties.xml
org.glite.jp.primary/src/mysql.c
org.glite.jp.primary/src/new_ftp_backend.c

index 652637b..73c3691 100644 (file)
@@ -33,7 +33,7 @@ GLOBUS_CFLAGS:=-I${globus_prefix}/include/${nothrflavour}
 
 DEBUG:=-g -O0  -DDEBUG
 
-CFLAGS:=${DEBUG} -I. -I${top_srcdir}/interface -I${top_srcdir}/src -I${gsoap_prefix}/include -I${stagedir}/include ${GLOBUS_CFLAGS}
+CFLAGS:=${DEBUG} -I. -I${top_srcdir}/interface -I${top_srcdir}/src -I${gsoap_prefix}/include -I${stagedir}/include ${GLOBUS_CFLAGS} -I${mysql_prefix}/include -I${mysql_prefix}/include/mysql
 LDFLAGS:=-L${stagedir}/lib
 
 LINK:=libtool --mode=link ${CC} ${LDFLAGS} 
@@ -53,7 +53,7 @@ HDRS_I=file_plugin.h
 HDRS_S=builtin_plugins.h backend.h
 
 SRCS:= bones_server.c soap_ops.c \
-       ftp_backend.c file_plugin.c \
+       new_ftp_backend.c mysql.c file_plugin.c \
        feed.c tags.c\
        is_client.c \
        ${ps_prefix}ServerLib.c \
@@ -70,13 +70,24 @@ COMMONLIB:=-lglite_jp_common
 BONESLIB:=-lglite_lb_server_bones
 GSOAPLIB:=-lglite_security_gsoap_plugin_${nothrflavour} -lglite_security_gss_${nothrflavour} \
        -L${gsoap_prefix}/lib -lgsoap${GSOAP_DEBUG} -L${ares_prefix}/lib -lares
+TRIOLIB:=-lglite_lb_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} ${plugins}
 
 ${daemon}: ${OBJS}
-       ${LINK} -o $@ ${OBJS} ${BONESLIB} ${COMMONLIB} ${GSOAPLIB} ${GLOBUS_LIBS
+       ${LINK} -o $@ ${OBJS} ${BONESLIB} ${TRIOLIB} ${COMMONLIB} ${GSOAPLIB} ${GLOBUS_LIBS} ${MYSQLIB
 
 ${example}: ${EXA_OBJS}
        ${LINK} -o $@ ${EXA_OBJS} ${GSOAPLIB} ${GLOBUS_LIBS}
index 8aa788e..f253f1d 100644 (file)
@@ -3,7 +3,7 @@ create table jobs (
        dg_jobid        varchar(255)    binary not null,
        owner           char(32)        binary not null,
 
-       reg_time        datetime        not null;
+       reg_time        datetime        not null,
        
        primary key (jobid),
        unique (dg_jobid),
@@ -18,11 +18,11 @@ create table files (
        ext_url         mediumblob      null,
 
        state           char(32)        binary not null,
-       deadline        datetime        null;
+       deadline        datetime        null,
        ul_userid       char(32)        binary not null,
 
        primary key (jobid,filename),
-       index (ext_url)
+       index (ext_url(255))
 );
 
 create table attrs (
index 3f88fbf..5e1ce29 100644 (file)
 
        Revision history:
        $Log$
+       Revision 1.3  2004/11/22 13:55:30  dimeglio
+       First version of this file
+       Use central subsystem definition
+       
        Revision 1.2  2004/10/15 12:19:28  akrenek
        build with gsoap 2.7 too
        
@@ -42,6 +46,8 @@ globus_prefix=${with.globus.prefix}
 expat_prefix=${with.expat.prefix}
 ares_prefix=${with.ares.prefix}
 gsoap_prefix=${with.gsoap.prefix}
+mysql_prefix=${with.mysql.prefix}
+mysql_version=${ext.mysql.version}
 thrflavour=${with.globus.thr.flavor}
 nothrflavour=${with.globus.nothr.flavor}
 cppunit=${with.cppunit.prefix}
index 591d8e1..2a6f7c0 100644 (file)
@@ -17,6 +17,7 @@
 #include "db.h"
 
 #define DEFAULTCS      "jpps/@localhost:jpps1"
+#define GLITE_JP_LB_MYSQL_VERSION 40018
 
 static int  my_err(glite_jp_context_t ctx, char *function)
 {      
@@ -66,7 +67,7 @@ int glite_jp_db_connect(glite_jp_context_t ctx,char *cs)
        if (!slash || !at || !colon) {
                free(buf);
                err.code = EINVAL;
-               err.desc = "Invalid DB connect string");
+               err.desc = "Invalid DB connect string";
                return glite_jp_stack_error(ctx,&err);
        }
 
@@ -93,7 +94,7 @@ void glite_jp_db_close(glite_jp_context_t ctx)
 
 int glite_jp_db_execstmt(glite_jp_context_t ctx,char *txt,glite_jp_db_stmt_t *stmt)
 {
-       int     err;
+       int     merr;
        int     retry_nr = 0;
        int     do_reconnect = 0;
 
@@ -111,12 +112,12 @@ int glite_jp_db_execstmt(glite_jp_context_t ctx,char *txt,glite_jp_db_stmt_t *st
                do_reconnect = 0;
                if (mysql_query((MYSQL *) ctx->dbhandle,txt)) {
                        /* error occured */
-                       switch (err = mysql_errno((MYSQL *) ctx->dbhandle)) {
+                       switch (merr = mysql_errno((MYSQL *) ctx->dbhandle)) {
                                case 0:
                                        break;
                                case ER_DUP_ENTRY: 
                                        err.code = EEXIST;
-                                       err.desc = mysql_error((MYSQL *) ctx->dbhandle));
+                                       err.desc = mysql_error((MYSQL *) ctx->dbhandle);
                                        glite_jp_stack_error(ctx,&err);
                                        return -1;
                                        break;
index 1344164..318d2e9 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "tags.h"
 #include "backend.h"
+#include "db.h"
 
 #define FTPBE_DEFAULT_DB_CS    "jpps/@localhost:jpps"
 
@@ -292,9 +293,10 @@ int glite_jppsbe_register_job(
        }
        
        if (glite_jp_db_execstmt(ctx, stmt, NULL) < 0) {
-               if (ctx->error->code == EEXIST) 
+               if (ctx->error->code == EEXIST) {
                        err.code = EEXIST;
                        err.desc = "Job already registered";
+               }
                else {
                        err.code = EIO;
                        err.desc = "DB access failed";
@@ -479,7 +481,7 @@ int glite_jppsbe_start_upload(
        */
 
        peerhash = str2md5(peername); /* static buffer */
-       if (store_user(ctx, peerhash, owner)) {
+       if (store_user(ctx, peerhash, peername)) {
                err.code = EIO;
                err.desc = "Cannot store upload user entry";
                goto error_out;
@@ -807,7 +809,7 @@ static int get_job_fname(
        err.source = __FUNCTION__;
 
        assert(job!=NULL);
-       assert(url_out != NULL);
+       assert(fname_out != NULL);
 
        assert(class!=NULL);