YACC=bison -y
CC=gcc
+CXX=g++
ifeq ($(gsoap_version),2.7.0)
VPATH=${top_srcdir}/interface:${top_srcdir}/src:${top_srcdir}/test:${top_srcdir}/doc:${top_srcdir}/examples:${top_srcdir}/project:${gsoap_prefix}
-D_GNU_SOURCE ${LB_STANDALONE_FLAGS} ${LB_PERF_FLAGS} -DLB_EVENTS_BLOB \
-I${globus_prefix}/include/${nothrflavour} #gridsite needs this
+CXXFLAGS:=${CFLAGS}
+
ifdef LB_PROF
SRVBONES_LIB:= ${stagedir}/lib/libglite_lbu_server_bones.la
LB_COMMON_LIB:=${stagedir}/lib/libglite_lb_common_${nothrflavour}.la
TEST_INC:=-I${cppunit_prefix}/include
COMPILE:=libtool --mode=compile ${CC} ${CFLAGS}
+CXXCOMPILE:=libtool --mode=compile ${CXX} ${CXXFLAGS}
LINK:=libtool --mode=link ${CC} -rpath ${stagedir}/lib ${LDFLAGS}
SOLINK:=libtool --mode=link ${CC} -module ${LDFLAGS} -rpath ${stagedir}/lib
# XXX: not used? LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS}
lb_xml_parse_V21.o lb_text.o \
openserver.o query.o userjobs.o db_store.o request.o store.o \
stored_master.o srv_purge.o server_state.o dump.o lb_authz.o load.o \
- notification.o il_notification.o notif_match.o stats.o db_calls.o db_supp.o lb_rss.o
+ notification.o il_notification.o notif_match.o stats.o db_calls.o db_supp.o lb_rss.o pretty_print_wrapper.o
gsoap_version ?= ${gsoap_default_version}
INDEX_OBJS:= index.o index_parse.o jobstat_supp.o openserver.o \
jobstat.o query.o get_events.o write2rgma.o index_lex.o \
lb_authz.o store.o bkindex.o stats.o\
- request.o db_store.o srv_purge.o notif_match.o il_lbproxy.o dump.o lb_xml_parse.o il_notification.o lb_proto.o lb_text.o server_state.o lb_xml_parse_V21.o lb_html.o cond_dump.o notification.o seqcode.o userjobs.o load.o db_calls.o db_supp.o lb_rss.o
+ request.o db_store.o srv_purge.o notif_match.o il_lbproxy.o dump.o lb_xml_parse.o il_notification.o lb_proto.o lb_text.o server_state.o lb_xml_parse_V21.o lb_html.o cond_dump.o notification.o seqcode.o userjobs.o load.o db_calls.o db_supp.o lb_rss.o pretty_print_wrapper.o
INDEX_LIBS:= ${SRVBONES_LIB} ${COMMON_LIBS} ${LB_MACHINE_LIB} ${EXT_LIBS} ${LB_UTILS_DB_LIB}
openserver.o query.o userjobs.o db_store.o request.o store.o \
stored_master.o srv_purge.o server_state.o dump.o lb_authz.o load.o \
notification.o il_notification.o notif_match.o stats.o write2rgma.o \
- db_calls.o db_supp.o lb_rss.o
+ db_calls.o db_supp.o lb_rss.o pretty_print_wrapper.o
MONDB_OBJS:=mon-db.o ${LIB_OBJS_BK}
MONDB_LIBS:=${COMMON_LIBS} ${LB_MACHINE_LIB} ${LB_UTILS_DB_LIB} ${EXT_LIBS}
%.o %.lo: %.c
${COMPILE} -c $<
+%.o %.lo: %.cpp
+ ${CXXCOMPILE} -c $<
+
test_query_events.o: %.o: %.cpp
${CXX} -c ${CFLAGS} ${TEST_INC} $<
--- /dev/null
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int pretty_print(char *jdl, char **formated_print);
+
+#ifdef __cplusplus
+}
+#endif
+
#include "lb_html.h"
#include "lb_proto.h"
#include "cond_dump.h"
+#include "pretty_print_wrapper.h"
#include "glite/lb/context-int.h"
}
#define TR(name,type,field) \
+{ \
+ int l; \
if (field){ \
- int l = asprintf(&pomA,"<tr><th align=\"left\">" name ":</th>" \
- "<td>" type "</td></tr>", (field)); \
- pomB = realloc(pomB, sizeof(*pomB)*(pomL+l+1)); \
- strcpy(pomB+pomL, pomA); \
- pomL += l; \
- free(pomA); pomA=NULL; \
- }
+ l = asprintf(&pomA,"<tr><th align=\"left\">" name ":</th>" \
+ "<td>" type "</td></tr>", (field)); \
+ } \
+ else{ \
+ l = asprintf(&pomA,"<tr><th align=\"left\"><span style=\"color:grey\">" name \
+ "</span></th></tr>"); \
+ } \
+ pomB = realloc(pomB, sizeof(*pomB)*(pomL+l+1)); \
+ strcpy(pomB+pomL, pomA); \
+ pomL += l; \
+ free(pomA); pomA=NULL; \
+}
int edg_wll_NotificationToHTML(edg_wll_Context ctx UNUSED_VAR, notifInfo *ni, char **message){
char *pomA = NULL, *pomB = NULL, *flags, *cond;
TR("Destination", "%s", ni->destination);
TR("Valid until", "%s", ni->valid);
+ TR("Flags", "%s", flags);
+ free(flags);
if (! edg_wll_Condition_Dump(ni, &cond, 0)){
asprintf(&pomA, "%s<h3>Conditions</h3>\r\n<pre>%s</pre>\r\n",
}
free(cond);
- TR("Flags", "%s", flags);
- free(flags);
-
asprintf(&pomA, "<html>\r\n\t<body>\r\n"
"<h2>Notification %s</h2>\r\n"
"<table halign=\"left\">%s</table>"
time_t time = stat.stateEnterTime.tv_sec;
TR("State entered","%s",ctime(&time));
}
+ else
+ TR("State entered", "%s", NULL);
if ( (stat.lastUpdateTime.tv_sec) || (stat.lastUpdateTime.tv_usec) ) {
time_t time = stat.lastUpdateTime.tv_sec;
TR("Last update","%s",ctime(&time));
}
+ else
+ TR("Last update", "%s", NULL);
TR("Expect update","%s",stat.expectUpdate ? "YES" : "NO");
TR("Expect update from","%s",stat.expectFrom);
TR("Location","%s",stat.location);
TR("Destination","%s",stat.destination);
TR("Cancelling","%s",stat.cancelling>0 ? "YES" : "NO");
- if (stat.cancelReason != NULL) {
- TR("Cancel reason","%s",stat.cancelReason);
- }
+ TR("Cancel reason","%s",stat.cancelReason);
TR("CPU time","%d",stat.cpuTime);
TR("Done code","%d",stat.done_code);
TR("Exit code","%d",stat.exit_code);
- if (stat.jdl) asprintf(&jdl,"<h3>Job description</h3>\r\n"
- "<pre>%s</pre>\r\n",stat.jdl);
+ if (stat.jdl){
+ char *jdl_unp;
+ if (pretty_print(stat.jdl, &jdl_unp) == 0)
+ asprintf(&jdl,"<h3>Job description</h3>\r\n"
+ "<pre>%s</pre>\r\n",jdl_unp);
+ else
+ asprintf(&jdl,"<h3>Job description (not a ClassAd)"
+ "</h3>\r\n<pre>%s</pre>\r\n",stat.jdl);
+ }
if (stat.rsl) asprintf(&rsl,"<h3>RSL</h3>\r\n"
"<pre>%s</pre>\r\n",stat.rsl);
return -1;
}
-/*#define TR(name,type,field) \
- if (field) { \
- asprintf(&a,"%s%s=" type "\n", \
- b, name, field); \
- free(b); \
- b = a; \
- }*/
#define TR(name,type,field) \
- if (field){ \
- int l = asprintf(&a,"%s=" type "\n", \
+{ \
+ int l; \
+ if (field) \
+ l = asprintf(&a,"%s=" type "\n", \
name, field); \
- printf("a = %s l = %i\n", a, l); \
- b = realloc(b, sizeof(*b)*(pomL+l+1)); \
- strcpy(b+pomL, a); \
- pomL += l; \
- free(a); a=NULL; \
- }
+ else \
+ l = asprintf(&a,"%s=\n", name); \
+ b = realloc(b, sizeof(*b)*(pomL+l+1)); \
+ strcpy(b+pomL, a); \
+ pomL += l; \
+ free(a); a=NULL; \
+}
int edg_wll_UserInfoToText(edg_wll_Context ctx, edg_wlc_JobId *jobsOut, char **message)
{
TR("Notif_id", "%s", ni->notifid);
TR("Destination", "%s", ni->destination);
TR("Valid_until", "%s", ni->valid);
+ flags = edg_wll_stat_flags_to_string(ni->flags);
+ TR("Flags", "%s", flags);
+ free(flags);
if (! edg_wll_Condition_Dump(ni, &cond, 1)){
TR("Conditions", "%s", cond);
}
free(cond);
- flags = edg_wll_stat_flags_to_string(ni->flags);
- TR("Flags", "%s", flags);
- free(flags);
*message = b;
- printf("Returning message: %s\n", a);
return 0;
}
asprintf(&a, "%sstateEnterTime=%s", b, ctime(&time));
free(b); b = a;
}
+ else{
+ asprintf(&a, "%sstateEnterTime=", b);
+ free(b); b = a;
+ }
if ( (stat.lastUpdateTime.tv_sec) || (stat.lastUpdateTime.tv_usec) ) {
time_t time = stat.lastUpdateTime.tv_sec;
//TR("Last_update","%s",ctime(&time));
asprintf(&a, "%slastUpdateTime=%s", b, ctime(&time));
free(b); b = a;
}
+ else{
+ asprintf(&a, "%slastUpdateTime=", b);
+ free(b); b = a;
+ }
TR("expectUpdate","%s",stat.expectUpdate ? "YES" : "NO");
TR("expectFrom","%s",stat.expectFrom);
TR("location","%s",stat.location);
TR("destination","%s",stat.destination);
TR("cancelling","%s",stat.cancelling>0 ? "YES" : "NO");
- if (stat.cancelReason != NULL) {
- TR("cancelReason","%s",stat.cancelReason);
- }
+ TR("cancelReason","%s",stat.cancelReason);
TR("cpuTime","%d",stat.cpuTime);
-
TR("done_code","%d",stat.done_code);
TR("exit_code","%d",stat.exit_code);
asprintf(&jdl,"jdl=%s\n", my_jdl);
free(my_jdl);
}
- if (stat.rsl) asprintf(&rsl,"rsl=%s\n", stat.rsl);
+ else
+ asprintf(&jdl,"jdl=\n");
+ if (stat.rsl)
+ asprintf(&rsl,"rsl=%s\n", stat.rsl);
+ else
+ asprintf(&rsl,"rsl=\n");
asprintf(&a, "Job=%s\n"
"%s"
--- /dev/null
+#include "pretty_print_wrapper.h"
+
+#include <classad_distribution.h>
+#include <string>
+#include <string.h>
+
+int pretty_print(char *jdl, char **formated_print){
+ ClassAd *classad;
+ ClassAdParser parser;
+
+ classad = parser.ParseClassAd(std::string(jdl), true);
+ if (! classad){
+ *formated_print = NULL;
+ return -1; // not ClassAd data
+ }
+
+ PrettyPrint pp;
+ std::string buf;
+ pp.Unparse(buf, classad);
+ *formated_print = strdup(buf.c_str());
+
+ return 0;
+}
+