From 8234f0b000fcb3db0c09d8afcff4f2c00a3df7ab Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Fri, 14 Jan 2011 13:49:44 +0000 Subject: [PATCH] Assume, that explicit _null_ specification means the field is optional (_optional_ is not implemented in status so far), and reflect it in WS interface. --- org.glite.lb.server/src/ws_typeref.c.T | 10 ++++++++++ org.glite.lb.types/status.T | 1 + org.glite.lb.ws-interface/src/LBTypes.xml.T | 7 +++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/org.glite.lb.server/src/ws_typeref.c.T b/org.glite.lb.server/src/ws_typeref.c.T index 71d62c4..069400c 100644 --- a/org.glite.lb.server/src/ws_typeref.c.T +++ b/org.glite.lb.server/src/ws_typeref.c.T @@ -248,6 +248,14 @@ int edg_wll_StatusToSoap(struct soap *soap,edg_wll_JobStat const *src,struct lbt gen "\tjs->$usuc->tvUsec = src->$_.tv_usec;\n"; } elsif ($ft eq 'string') { gen "\tjs->$usuc = soap_strdup(soap,src->$_);\n"; + } elsif ($f->{null}) { + gen qq{ +! if (src->$_ == $f->{null}) js->$usuc = NULL; +! else { +! js->$usuc = soap_malloc(soap,sizeof *js->$usuc); +! *js->$usuc = src->$_; +! } +}; } else { gen "\tjs->$usuc = src->$_;\n"; } } @@@} @@ -318,6 +326,8 @@ void edg_wll_SoapToStatus(struct soap *soap,struct lbt__jobStatus const *src,edg } elsif ($ft eq 'string') { gen "\tdest->$_ = src->$usuc;\n"; gen "\tsoap_unlink(soap,src->$usuc);\n"; + } elsif ($f->{null}) { + gen "\tdest->$_ = (src->$usuc) ? *(src->$usuc) : $f->{null};\n"; } else { gen "\tdest->$_ = src->$usuc;\n"; } diff --git a/org.glite.lb.types/status.T b/org.glite.lb.types/status.T index 4e2b302..0ad9dd3 100644 --- a/org.glite.lb.types/status.T +++ b/org.glite.lb.types/status.T @@ -163,6 +163,7 @@ int cream_exit_code Job exit code bool cream_cancelling Cancellation request in process int cream_cpu_time Consumed CPU time int cream_jw_status Users jw_status enum + _null_ -1 _pad_ 30 diff --git a/org.glite.lb.ws-interface/src/LBTypes.xml.T b/org.glite.lb.ws-interface/src/LBTypes.xml.T index a932bad..610e123 100644 --- a/org.glite.lb.ws-interface/src/LBTypes.xml.T +++ b/org.glite.lb.ws-interface/src/LBTypes.xml.T @@ -80,6 +80,7 @@ } my $comment = getComment $f; +# XXX: if null value is specified, the field can be optional if ($name eq 'stateEnterTimes' || $name eq 'childrenHist') { # XXX: stateEnterTimes and childrenHist are the only case of enum-indexed array gen qq{ @@ -87,9 +88,11 @@ }; } else { -# XXX: currently nothing is "optional" as we don't know from status.T +# orig XXX: currently nothing is "optional" as we don't know from status.T +# XXX: if null is defined, the field is optional + my $opt = $f->{null} ? 'yes' : 'no'; gen qq{ -! $comment +! $comment }; } } -- 1.8.2.3