build C++ library
authorAleš Křenek <ljocha@ics.muni.cz>
Fri, 2 Jul 2004 15:19:59 +0000 (15:19 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Fri, 2 Jul 2004 15:19:59 +0000 (15:19 +0000)
13 files changed:
org.glite.lb.client/Makefile
org.glite.lb.client/interface/CountRef.h [deleted file]
org.glite.lb.client/interface/Event.h.T [deleted file]
org.glite.lb.client/interface/Job.h [deleted file]
org.glite.lb.client/interface/JobStatus.h.T [deleted file]
org.glite.lb.client/interface/LoggingExceptions.h [deleted file]
org.glite.lb.client/interface/Notification.h [deleted file]
org.glite.lb.client/interface/ServerConnection.h [deleted file]
org.glite.lb.client/src/Event.cpp.T
org.glite.lb.client/src/Job.cpp
org.glite.lb.client/src/JobStatus.cpp.T
org.glite.lb.client/src/Notification.cpp
org.glite.lb.client/src/ServerConnection.cpp

index 2a99d3c..b12e012 100644 (file)
@@ -61,6 +61,7 @@ EXT_LIB:= ${EXPAT_LIBS} \
     ${ARES_LIBS}
 
 COMPILE:=libtool --mode=compile ${CC} ${CFLAGS}
+CXXCOMPILE:=libtool --mode=compile ${CXX} ${CXXFLAGS}
 LINK:=libtool --mode=link ${CC} ${LDFLAGS} 
 INSTALL:=libtool --mode=install install
 
@@ -75,12 +76,15 @@ LIBTHROBJS:=${LIBOBJS:.o=.thr.o}
 LIBLOBJS:=${LIBOBJS:.o=.lo}
 LIBTHRLOBJS:=${LIBOBJS:.o=.thr.lo}
 
+PLUSTHROBJS:=${PLUSOBJS:.o=.thr.o}
 PLUSLOBJS:=${PLUSOBJS:.o=.lo}
+PLUSTHRLOBJS:=${PLUSOBJS:.o=.thr.lo}
 
 LIB:=libglite_lb_client_${nothrflavour}.la
 THRLIB:=libglite_lb_client_${thrflavour}.la
 
-PLUSLIB:=libglite_lb_clientpp.la
+PLUSLIB:=libglite_lb_clientpp_${nothrflavour}.la
+THRPLUSLIB:=libglite_lb_clientpp_${thrflavour}.la
 
 TOOLS:=dump load purge
 
@@ -93,6 +97,9 @@ ${THRLIB}: ${LIBTHROBJS}
 ${PLUSLIB}: ${PLUSOBJS}
        ${LINK} -o $@ ${PLUSLOBJS} -rpath ${glite_location}/lib ${LIB}
 
+${THRPLUSLIB}: ${PLUSTHROBJS}
+       ${LINK} -o $@ ${PLUSTHRLOBJS} -rpath ${glite_location}/lib ${THRLIB}
+
 logevent: logevent.o args.o
        ${LINK} -o $@ logevent.o args.o ${LIB} ${EXT_LIB} ${GLOBUS_LIBS}
 
@@ -101,6 +108,12 @@ ${TOOLS}: %: %.o
 
 ${TOOLS}: ${LIB}
 
+${PLUSOBJS}: %.o: %.cpp
+       ${CXXCOMPILE} ${GLOBUSINC} -c $<
+
+${PLUSTHROBJS}: %.thr.o: %.cpp
+       ${CXXCOMPILE} ${GLOBUSTHRINC} -o $@ -c $<
+
 ${LIBOBJS}: %.o: %.c
        ${COMPILE} ${GLOBUSINC} -c $<
 
@@ -123,7 +136,7 @@ ${LIBTHROBJS}: %.thr.o: %.c
 
 default: all
 
-compile all: ${LIB} ${THRLIB} ${TOOLS} logevent
+compile all: ${LIB} ${THRLIB} ${TOOLS} logevent ${PLUSLIB} ${THRPLUSLIB}
 
 check:
        echo No unit tests so far.
@@ -147,7 +160,7 @@ distbin:
 install:
        mkdir -p ${PREFIX}/bin
        mkdir -p ${PREFIX}/lib
-       ${INSTALL} -m 644 ${LIB} ${PREFIX}/lib
+       ${INSTALL} -m 644 ${LIB} ${THRLIB} ${PREFIX}/lib
        for p in ${TOOLS} logevent; do \
                ${INSTALL} -m 755 "$$p" "${PREFIX}/bin/glite-lb-$$p"; \
        done
diff --git a/org.glite.lb.client/interface/CountRef.h b/org.glite.lb.client/interface/CountRef.h
deleted file mode 100644 (file)
index cedf203..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef __EDG_WORKLOAD_LOGGING_CLIENT_COUNTREF_HPP__
-#define __EDG_WORKLOAD_LOGGING_CLIENT_COUNTREF_HPP__
-
-#define EWL_BEGIN_NAMESPACE namespace edg { namespace workload { namespace logging { namespace client {
-#define EWL_END_NAMESPACE } } } }
-
-EWL_BEGIN_NAMESPACE;
-
-template<typename T>
-class CountRef {
-public:
-       CountRef(void *);
-//     CountRef(void *,void (*)(void *));
-
-       void use(void);
-       void release(void);
-
-       void    *ptr;
-private:
-       int     count;
-//     void    (*destroy)(void *);
-};
-
-template <typename T>
-CountRef<T>::CountRef(void *p)
-{
-       ptr = p;
-       count = 1;
-}
-
-template <typename T>
-void CountRef<T>::release(void)
-{
-       if (--count == 0) {
-               T::destroyFlesh(ptr);
-               delete this;
-       }
-}
-
-template <typename T>
-void CountRef<T>::use(void)
-{
-       count++;
-}
-
-EWL_END_NAMESPACE;
-
-#endif
diff --git a/org.glite.lb.client/interface/Event.h.T b/org.glite.lb.client/interface/Event.h.T
deleted file mode 100644 (file)
index 7aac0b4..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-#ifndef __EDG_WORKLOAD_LOGGING_CLIENT_EVENT_HPP__
-#define __EDG_WORKLOAD_LOGGING_CLIENT_EVENT_HPP__
-
-#include "edg/workload/logging/client/CountRef.h"
-#include "edg/workload/common/jobid/JobId.h"
-
-#include <utility>
-#include <vector>
-#include <string>
-
-#ident "$Header$"
-
-/** @file Event.h
- *  @version $Revision$
- */
-
-/*
-@@@AUTO
-*/
-@@@LANG: C++
-
-#include "edg/workload/logging/client/events.h"
-#include "edg/workload/logging/common/notifid.h"
-
-EWL_BEGIN_NAMESPACE;
-
-class Event {
-       friend class Job;
-       friend class ServerConnection;
-       friend class CountRef<Event>;
-public:
-       /** Event type codes.
-        * Identify which of the event fields are valid.
-        */
-
-       enum Type {
-               UNDEF = 0,
-@@@{
-       for my $e ($event->getTypesOrdered) {
-               my $u = uc $e;
-               my $c = getTypeComment $event $e;
-               gen "\t\t$u,\t/**< $c */\n";
-       }
-@@@}
-               TYPE_MAX
-       };
-
-       /** Event attribute symbolic identifier. */
-       enum Attr {
-@@@{
-       for (sort {$a cmp $b} getAllFields $event) {
-               my $u = $_;
-# $u =~ s/([a-z])([A-Z])/$1_$2/g;
-               $u = uc $u;
-
-               my $c = "\t/**\n";
-               for my $t (sort $event->getFieldOccurence($_)) {
-                       selectType $event $t;
-                       my $cc = getFieldComment $event $_;
-                       $t = 'common' if $t eq '_common_';
-                       $c .= "\t * $t: $cc\n";
-               }
-               $c .= "\t */\n";
-
-               gen "$c\t\t$u,\n";
-       }
-@@@}
-               ATTR_MAX
-       };
-
-@@@{
-       for my $f (getAllFields $event) {
-               for my $t (getFieldOccurence $event $f) {
-                       my $ff;
-                       my $ut;
-                       my $utf;
-                       if ($t eq '_common_') {
-                               $ff = $f;
-                               $ut = '';
-                               $utf = '';
-                       }
-                       else {
-                               selectType $event $t;
-                               selectField $event $f;
-                               $ff = getField $event;
-                               $ut = uc $t . '_';
-                               $utf = ucfirst $t;
-                       }
-                       if ($ff->{codes}) {
-                               gen qq{
-!      enum ${utf}Code \{
-};
-                               for (@{$ff->{codes}}) {
-                                       gen qq{
-!              $ut$_->{name},  /**< $_->{comment} */
-};
-                               }
-                               gen qq{
-!      \};
-};
-                       }
-               }
-       }
-@@@}
-
-       enum AttrType { INT_T, STRING_T, TIMEVAL_T, PORT_T, LOGSRC_T, JOBID_T, NOTIFID_T };
-
-       Type    type;
-
-       Event(void);
-        Event(edg_wll_Event *);
-       Event(const Event &);
-       ~Event(void);
-
-
-       /** Assign new Event to an existing instance. */
-       Event & operator= (const Event &);
-
-       /** String representation of the event type */
-       const std::string & name(void) const;
-
-       /** Retrieve integer attribute */
-       int     getValInt(Attr) const;
-
-       /** Retrieve string attribute */
-       std::string getValString(Attr) const;
-
-        /** Retrieve time attribute */
-        struct timeval getValTime(Attr) const;
-               
-        /** Retrieve jobid attribute */
-        const edg::workload::common::jobid::JobId getValJobId(Attr) const;
-
-       /** Attribute name */
-       const std::string & getAttrName(Attr) const;
-
-       /** List of attributes and types valid for this instance */
-       const std::vector<std::pair<Attr,AttrType> >  & getAttrs(void) const;
-
-private:
-       static void     destroyFlesh(void *);
-       CountRef<Event> *flesh;
-};
-
-EWL_END_NAMESPACE;
-
-#endif
diff --git a/org.glite.lb.client/interface/Job.h b/org.glite.lb.client/interface/Job.h
deleted file mode 100644 (file)
index d041dfe..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifndef __EDG_WORKLOAD_LOGGING_CLIENT_JOB_HPP__
-#define __EDG_WORKLOAD_LOGGING_CLIENT_JOB_HPP__
-
-#ident "$Header$"
-
-#include "edg/workload/common/jobid/JobId.h"
-#include "edg/workload/logging/client/Event.h"
-#include "edg/workload/logging/client/JobStatus.h"
-#include "edg/workload/logging/client/ServerConnection.h"
-
-
-/**
- * @file Job.h
- * @version $Revision$
- */
-
-EWL_BEGIN_NAMESPACE;
-
-/** L&B job.
- * Implementation of L&B job-specific calls.
- * Connection to the server is maintained transparently.
-*/
-  
-class Job {
-public:
-  Job(void);
-  Job(const edg::workload::common::jobid::JobId &);
-  ~Job();
-  
-  /** Assign new JobId to an existing instance.
-   * Connection to server is preserved if possible.
-   */
-  
-  Job & operator= (const edg::workload::common::jobid::JobId &);
-
-/**
- * Status retrieval bitmasks. Used ORed as Job::status() argument,
- * determine which status fields are actually retrieved.
- */
-  static const int STAT_CLASSADS;       /**< various job description fields */
-  static const int STAT_CHILDREN;       /**< list of subjob JobId's */
-  static const int STAT_CHILDSTAT;      /**< apply the flags recursively to subjobs */
-
-  /** Return job status */
-  JobStatus status(int) const;
-  
-  /** Return all events corresponding to this job */
-  void log(std::vector<Event> &) const;
-  const std::vector<Event> log(void) const;
-  
-  /** Return last known address of a listener associated to the job.
-   * \param name name of the listener
-   * \return hostname and port number
-   */
-  const std::pair<std::string,uint16_t> queryListener(const std::string & name) const;
-  
-  /** Manipulate LB parameters, the same as for edg_wll_Context in C */
-  void setParam(edg_wll_ContextParam, int); 
-  void setParam(edg_wll_ContextParam, const std::string); 
-  void setParam(edg_wll_ContextParam, const struct timeval &); 
-
-  int getParamInt(edg_wll_ContextParam) const;
-  std::string getParamString(edg_wll_ContextParam) const;
-  struct timeval getParamTime(edg_wll_ContextParam) const;
-  
-private:
-  ServerConnection     server;
-  edg::workload::common::jobid::JobId                  jobId;
-};
-
-EWL_END_NAMESPACE;
-
-#endif
diff --git a/org.glite.lb.client/interface/JobStatus.h.T b/org.glite.lb.client/interface/JobStatus.h.T
deleted file mode 100644 (file)
index c1519b0..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-#ifndef __EDG_WORKLOAD_LOGGING_CLIENT_JOBSTATUS_HPP__
-#define __EDG_WORKLOAD_LOGGING_CLIENT_JOBSTATUS_HPP__
-
-/*
-@@@AUTO
-*/
-
-@@@LANG: C++
-
-#include "edg/workload/logging/client/CountRef.h"
-#include "edg/workload/common/jobid/JobId.h"
-
-#include "edg/workload/common/jobid/jobid.h"
-#include <sys/time.h>
-#include "edg/workload/logging/client/jobstat.h"
-
-#include <string>
-#include <utility>
-#include <vector>
-
-EWL_BEGIN_NAMESPACE;
-
-/**
- * Description of job status.
- * The status is computed from a sequence of logged events
- */
-
-
-class JobStatus {
-       friend class Job;
-       friend class CountRef<JobStatus>;
-public:
-       enum Code {
-               UNDEF = 0,      /**< indicates invalid, i.e. uninitialized instance */
-@@@{
-       for my $stat ($status->getTypesOrdered)
-       {
-               my $u = uc($stat);
-               my $c = getTypeComment $status $stat;
-               gen qq{
-!              $u,     /**< $c */
-};
-       }
-@@@}
-               CODE_MAX
-       };
-
-       enum Attr {
-@@@{
-       selectType $status '_common_';
-       for my $u (sort {$a cmp $b} getAllFields $status) {
-               selectField $status $u;
-               my $f = getField $status;
-               $u =~ s/([a-z])([A-Z])/$1_$2/g;
-               $u = uc $u;
-
-               gen "\t/** $f->{comment} */\n\t\t$u,\n";
-       }
-@@@}
-               ATTR_MAX
-       };
-
-@@@{
-       selectType $status '_common_';
-       for my $n (getAllFields $status) {
-               selectField $status $n;
-               my $f = getField $status;
-               if ($f->{codes}) {
-                        my $n = uc getName $f;
-                       gen qq{
-!      enum \{
-};
-                       for (@{$f->{codes}}) {
-                               gen qq{
-!              $n\_$_->{name}, /**< $_->{comment} */
-};
-                       }
-                       gen qq{
-!      \};
-};
-               }
-       }
-@@@}
-       enum AttrType { INT_T, 
-                       STRING_T, 
-                       TIMEVAL_T, 
-                       BOOL_T,
-                       JOBID_T,
-                       INTLIST_T, 
-                       STRLIST_T, 
-                       TAGLIST_T, 
-                       STSLIST_T 
-       };
-  
-       /** Numeric status code */
-       Code    status;
-  
-       /** String representation of the status code */
-       const std::string & name(void) const;
-  
-       /** Retrieve integer attribute */
-       int     getValInt(Attr) const;
-  
-       /** Retrieve string attribute */
-       std::string getValString(Attr) const;
-  
-       /** Retrieve time attribute */
-       struct timeval  getValTime(Attr) const;
-  
-       /** Retrieve jobid attribute */
-       const edg::workload::common::jobid::JobId  getValJobId(Attr) const;
-
-       /** Retrieve bool attribute */
-       bool getValBool(Attr) const;
-
-       /** Retrieve int list attribute */
-       const std::vector<int> getValIntList(Attr) const;
-
-       /** Retrieve string list attribute */
-       const std::vector<std::string> getValStringList(Attr) const;
-
-       /** Retrieve tag list attribute */
-       const std::vector<std::pair<std::string,std::string> > getValTagList(Attr) const;
-
-       /** Retrieve job status list attribute */
-       const std::vector<JobStatus> getValJobStatusList(Attr) const;
-
-       /** Attribute name */
-       const std::string& getAttrName(Attr) const;
-  
-       /** List of attributes and types valid for this instance */
-       const std::vector<std::pair<Attr,AttrType> >& getAttrs(void) const;
-  
-       JobStatus(void);
-       JobStatus(const JobStatus &);
-       JobStatus & operator=(const JobStatus &);
-       JobStatus(const edg_wll_JobStat &);
-       JobStatus & operator=(const edg_wll_JobStat&);
-       virtual ~JobStatus();
-
-protected:
-       edg_wll_JobStat *c_ptr(void);
-
-private:
-       static void     destroyFlesh(void *);
-       CountRef<JobStatus> *flesh;
-};
-
-EWL_END_NAMESPACE;
-
-#endif
-
diff --git a/org.glite.lb.client/interface/LoggingExceptions.h b/org.glite.lb.client/interface/LoggingExceptions.h
deleted file mode 100644 (file)
index 9f3a2c9..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-#ifndef __EDG_WORKLOAD_LOGGING_CLIENT_LOGGING_EXCEPTIONS_HPP__
-#define __EDG_WORKLOAD_LOGGING_CLIENT_LOGGING_EXCEPTIONS_HPP__
-
-#include "edg/workload/common/utilities/Exceptions.h"
-
-#include <pthread.h>
-
-#ident "$Header$"
-
-/** @file LoggingExceptions.h
- *  @version $Revision$
- */
-
-EWL_BEGIN_NAMESPACE;
-
-class Exception: public edg::workload::common::utilities::Exception {
-public:
-       
-       /* constructor for mandatory fields */
-       Exception(const std::string& source,
-                 int line_number,
-                 const std::string& method,
-                 int   code,
-                 const std::string& exception) 
-               : edg::workload::common::utilities::Exception(source, 
-                                                             line_number, 
-                                                             method, 
-                                                             code, 
-                                                             "edg::workload::logging::Exception")
-               { error_message = exception; };
-       
-       /* constructor for mandatory fields AND exception chain */
-       Exception(const std::string& source,
-                 int line_number,
-                 const std::string& method,
-                 int   code,
-                 const std::string& exception,
-                 const edg::workload::common::utilities::Exception &exc)
-               : edg::workload::common::utilities::Exception(source, 
-                                                             line_number, 
-                                                             method, 
-                                                             code, 
-                                                             "edg::workload::logging::Exception")
-               { error_message = exception + ": " + exc.what(); };
-};
-
-
-class LoggingException: public Exception {
-public:
-       
-       /* constructor for mandatory fields */
-       LoggingException(const std::string& source,
-                        int line_number,
-                        const std::string& method,
-                        int   code,
-                        const std::string& exception) 
-               : Exception(source, line_number, method, code, exception)
-               {};
-       
-       /* constructor for mandatory fields AND exception chain */
-       LoggingException(const std::string& source,
-                        int line_number,
-                        const std::string& method,
-                        int   code,
-                        const std::string& exception, 
-                        const edg::workload::common::utilities::Exception &exc)
-               : Exception(source, line_number, method, code, exception)
-               {};
-};
-
-
-class OSException: public Exception {
-public:
-       
-       /* constructor for mandatory fields */
-       OSException(const std::string& source,
-                   int line_number,
-                   const std::string& method,
-                   int   code,
-                   const std::string& exception)
-               : Exception(source, 
-                           line_number, 
-                           method, 
-                           code, 
-                           exception + ": " + strerror(code))
-               {};
-       
-       /* constructor for mandatory fields AND exception chain */
-       OSException(const std::string& source,
-                   int line_number,
-                   const std::string& method,
-                   int   code,
-                   const std::string& exception,
-                   const edg::workload::common::utilities::Exception &exc)
-               : Exception(source, 
-                           line_number, 
-                           method, 
-                           code, 
-                           exception + ": " + strerror(code))
-               {};
-};
-
-
-#define EXCEPTION_MANDATORY                           \
-       __FILE__,                                     \
-        __LINE__,                                     \
-        std::string(CLASS_PREFIX) + __FUNCTION__         
-
-#define STACK_ADD                                     
-
-/* note: we can use __LINE__ several times in macro, it is expanded into one row */
-#define throw_exception(context, exception)           \
-{ STACK_ADD;                                          \
-  {                                                   \
-     char *text, *desc;                               \
-     int  code;                                       \
-     std::string exc;                                      \
-                                                      \
-     code = edg_wll_Error((context), &text, &desc);   \
-     exc = exception;                                 \
-     if (text) {                                     \
-       exc += ": ";                                  \
-       exc += text;                                  \
-     }                                               \
-     if (desc) {                                     \
-       exc += ": ";                                  \
-       exc += desc;                                  \
-     }                                               \
-     free(text);                                      \
-     free(desc);                                      \
-     throw LoggingException(EXCEPTION_MANDATORY,      \
-                           code,                     \
-                           exc);                     \
-  }                                                  \
-}
-#define check_result(code, context, desc)             \
-  if((code)) throw_exception((context), desc)
-
-
-
-EWL_END_NAMESPACE;
-
-#endif
diff --git a/org.glite.lb.client/interface/Notification.h b/org.glite.lb.client/interface/Notification.h
deleted file mode 100644 (file)
index d7a32e7..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-#ifndef __EDG_WORKLOAD_LOGGING_CLIENT_NOTIFICATION_HPP__
-#define __EDG_WORKLOAD_LOGGING_CLIENT_NOTIFICATION_HPP__
-
-#include "edg/workload/logging/client/consumer.h"
-#include "edg/workload/logging/client/notification.h"
-
-#include "edg/workload/common/jobid/JobId.h"
-#include "edg/workload/logging/client/JobStatus.h"
-
-
-EWL_BEGIN_NAMESPACE; 
-
-
-/** Manage LB notifications.
- * Simplified API, covers only a subset of C API functinality
- */
-
-class Notification {
-public:
-       Notification();
-
-       /** Create from NotifId */
-       Notification(const std::string);
-
-       /** Create from server,port pair */
-       Notification(const std::string,const u_int16_t);
-
-       ~Notification();
-
-       std::string getNotifId() const; /**< retrieve NotifId */
-       time_t getValid() const;        /**< until when it is valid */
-       int getFd() const;              /**< local listener filedescriptor */
-
-       /** Add this job to the list.
-        * Local operation only, Register() has to be called
-        * to propagate changes to server 
-        */
-       void addJob(const edg::workload::common::jobid::JobId &); 
-
-       /** Remove job from the list, local op again. */
-       void removeJob(const edg::workload::common::jobid::JobId &);
-
-       /** Get jobs on the list */
-       std::string getJobs();
-
-       /** Receive notifications on these states */
-       void setStates(const std::vector<edg::workload::logging::client::JobStatus::Code> &);
-
-       /** Get states */
-       std::string getStates();
-
-       /** Register (or re-register, i.e. change and extend) 
-        * with the server
-        */
-       void Register();
-
-       /** Receive notification.
-        * Blocks at most the specified timeout (maybe 0 for local polling).
-        * \retval 0 OK
-        * \retval 1 timeout 
-        */
-       int receive(edg::workload::logging::client::JobStatus &,timeval &);
-
-private:
-       std::vector<edg::workload::common::jobid::JobId>        jobs;
-       std::vector<edg::workload::logging::client::JobStatus::Code>    states;
-
-       edg_wll_Context ctx;
-       edg_wll_NotifId notifId;
-       time_t          valid;
-};
-
-
-EWL_END_NAMESPACE;
-
-#endif
diff --git a/org.glite.lb.client/interface/ServerConnection.h b/org.glite.lb.client/interface/ServerConnection.h
deleted file mode 100644 (file)
index fbeb55c..0000000
+++ /dev/null
@@ -1,306 +0,0 @@
-#ifndef __EDG_WORKLOAD_LOGGING_CLIENT_SERVERCONNECTION_HPP__
-#define __EDG_WORKLOAD_LOGGING_CLIENT_SERVERCONNECTION_HPP__
-
-#ident "$Header$"
-
-/**
- * @file ServerConnection.h
- * @version $Revision$
- */
-
-#include <string.h>
-#include <list>
-
-#include "edg/workload/common/jobid/JobId.h"
-#include "edg/workload/logging/client/Event.h"
-#include "edg/workload/logging/client/JobStatus.h"
-
-#include "edg/workload/logging/client/consumer.h"
-
-EWL_BEGIN_NAMESPACE;
-
-/** Auxiliary class to hold an atomic query condition. */
-class QueryRecord {
-public:
-       friend class ServerConnection;
-       friend edg_wll_QueryRec *convertQueryVector(const std::vector<QueryRecord> &in);
-
-       /* IMPORTANT: must match lbapi.h */
-       enum Attr {
-               UNDEF=0,        /**< Not-defined value, used to terminate lists etc. */
-               JOBID,          /**< Job Id \see _edg_wll_QueryRec */
-               OWNER,          /**< Job owner \see _edg_wll_QueryRec */
-               STATUS,         /**< Current job status */
-               LOCATION,       /**< Where is the job processed */
-               DESTINATION,    /**< Destination CE */
-               DONECODE,       /**< Minor done status (OK,fail,cancel) */
-               USERTAG,        /**< User tag (not implemented yet) */
-               TIME,           /**< Timestamp \see _edg_wll_QueryRec */
-               LEVEL,          /**< Logging level (see "dglog.h") * \see _edg_wll_QueryRec */
-               HOST,           /**< Where the event was generated */
-               SOURCE,         /**< Source component */
-               INSTANCE,       /**< Instance of the source component */
-               EVENT_TYPE,     /**< Event type \see _edg_wll_QueryRec */
-               CHKPT_TAG,      /**< Checkpoint tag */
-               RESUBMITTED,    /**< Job was resubmitted */
-               PARENT,         /**< Job was resubmitted */
-               EXITCODE,       /**< Unix exit code */
-       };
-
-       enum Op {
-               EQUAL=EDG_WLL_QUERY_OP_EQUAL,
-               LESS=EDG_WLL_QUERY_OP_LESS,
-               GREATER=EDG_WLL_QUERY_OP_GREATER,
-               WITHIN=EDG_WLL_QUERY_OP_WITHIN,
-               UNEQUAL=EDG_WLL_QUERY_OP_UNEQUAL
-       };
-  
-       QueryRecord();
-
-       /* copy and assignment */
-       QueryRecord(const QueryRecord &);
-       QueryRecord& operator=(const QueryRecord &);
-
-       /* constructors for simple attribute queries */
-       QueryRecord(const Attr, const Op, const std::string &);
-       QueryRecord(const Attr, const Op, const int);
-       QueryRecord(const Attr, const Op, const struct timeval &);
-       QueryRecord(const Attr, const Op, const edg::workload::common::jobid::JobId&);
-       /* this one is for attr==TIME and particular state */
-       QueryRecord(const Attr, const Op, const int, const struct timeval &);
-       
-       /* constructors for WITHIN operator */
-       QueryRecord(const Attr, const Op, const std::string &, const std::string &);
-       QueryRecord(const Attr, const Op, const int, const int);
-       QueryRecord(const Attr, const Op, const struct timeval &, const struct timeval &);
-       QueryRecord(const Attr, const Op, const int, const struct timeval &, const struct timeval &);
-
-       /* convenience for user tags */
-       QueryRecord(const std::string &, const Op, const std::string &);
-       QueryRecord(const std::string &, const Op, const std::string &, const std::string &);
-       
-       ~QueryRecord();
-  
-       static const std::string AttrName(const Attr) ;
-  
-protected:
-
-       /* conversion to C API type */
-       operator edg_wll_QueryRec() const;
-
-private:
-       Attr    attr;
-       Op      oper;
-       std::string tag_name;
-       int state;
-       std::string string_value;
-       edg::workload::common::jobid::JobId jobid_value;
-        int     int_value;
-        struct timeval timeval_value;
-       std::string string_value2;
-        int     int_value2;
-        struct timeval timeval_value2;
-};
-
-
-/** Supported aggregate operations */
-enum AggOp { AGG_MIN=1, AGG_MAX, AGG_COUNT };
-
-
-/**
- * Connection to the L&B server.
- * Maintain connection to the server.
- * Implement non job-specific API calls
- */
-
-class ServerConnection {
-public:
-       friend class Job;
-
-       ServerConnection(void);
-
-       /* DEPRECATED: do not use
-        * connections are now handled automagically inside the implementation
-        */
-       ServerConnection(const std::string &);
-
-       /** Open connection to a given server */
-       void open(const std::string &);
-
-       /** Close the current connection */
-       void close(void);
-
-       /* END DEPRECATED */
-
-       /* set & get parameter methods */
-
-       /* consumer parameter settings */
-       void setQueryServer(const std::string&, int);
-       void setQueryTimeout(int);
-
-       void setX509Proxy(const std::string&);
-       void setX509Cert(const std::string&, const std::string&);
-
-       std::pair<std::string, int> getQueryServer() const;
-       int getQueryTimeout() const;
-
-       std::string getX509Proxy() const;
-       std::pair<std::string, std::string> getX509Cert() const;
-
-       /* end of set & get */
-
-       virtual ~ServerConnection();
-
-
-       /* consumer API */
-
-       /** Retrieve the set of single indexed attributes.
-        * outer vector elements correspond to indices
-        * inner vector elements correspond to index columns
-        * if .first of the pair is USERTAG, .second is its name
-        * if .first is TIME, .second is state name
-        * otherwise .second is meaningless (empty string anyway)
-        */
-       std::vector<std::vector<std::pair<QueryRecord::Attr,std::string> > >
-               getIndexedAttrs(void);
-
-       /** Retrieve hard and soft result set size limit */
-       std::pair<int,int> getLimits(void) const;
-
-       /** Set the soft result set size limit */
-       void setQueryJobsLimit(int);
-       void setQueryEventsLimit(int);
-  
-       /** Retrieve all events satisfying the query records
-        * @param job_cond, event_cond - vectors of conditions to be satisfied 
-        *  by jobs as a whole or particular events, conditions are ANDed
-        * @param events vector of returned events
-        */
-       void queryEvents(const std::vector<QueryRecord>& job_cond,
-                        const std::vector<QueryRecord>& event_cond,
-                        std::vector<Event>&) const;
-  
-       const std::vector<Event> queryEvents(const std::vector<QueryRecord>& job_cond,
-                                            const std::vector<QueryRecord>& event_cond) const;
-
-       const std::list<Event> queryEventsList(const std::vector<QueryRecord>& job_cond,
-                                              const std::vector<QueryRecord>& event_cond) const;
-
-
-       /** The same as queryEvents but return only an aggregate.
-        * @param job_cond, event_cond - vectors of conditions to be satisfied 
-        *  by jobs as a whole or particular events, conditions are ANDed
-        * @param op aggregate operator to apply
-        * @param attr attribute to apply the operation to
-        */
-       std::string queryEventsAggregate(const std::vector<QueryRecord>& job_cond,
-                                        const std::vector<QueryRecord>& event_cond,
-                                        enum AggOp const op,
-                                        std::string const attr) const;
-  
-
-       /** Retrieve all events satisfying the query records
-        * @param job_cond, event_cond - vectors of vectors of job or event conditions, 
-        * respectively. The inner vectors are logically ANDed, the outer are ORed
-        * (cond1 AND cond2 AND ...) OR (condN AND ...)
-        * @param events vector of returned events
-        */
-       void queryEvents(const std::vector<std::vector<QueryRecord> >& job_cond,
-                        const std::vector<std::vector<QueryRecord> >& event_cond,
-                        std::vector<Event>&) const;
-  
-       const std::vector<Event> 
-       queryEvents(const std::vector<std::vector<QueryRecord> >& job_cond,
-                   const std::vector<std::vector<QueryRecord> >& event_cond) const;
-
-       
-       /** Retrieve jobs satisfying the query records, including their states
-        * @param query vector of Query records that are anded to form the
-        *      query
-        * @param ids vector of returned job id's
-        * @param states vector of returned job states
-        */
-  
-       void queryJobs(const std::vector<QueryRecord>& query,
-                      std::vector<edg::workload::common::jobid::JobId>& ids) const;
-  
-       const std::vector<edg::workload::common::jobid::JobId>
-       queryJobs(const std::vector<QueryRecord>& query) const;
-  
-       
-       /** Retrieve jobs satisfying the query records, including their states
-        * @param query vector of Query record vectors that are ORed and ANDed to form the
-        *      query
-        * @param ids vector of returned job id's
-        * @param states vector of returned job states
-        */
-   
-       void queryJobs(const std::vector<std::vector<QueryRecord> >& query,
-                      std::vector<edg::workload::common::jobid::JobId>& ids) const;
-  
-       const std::vector<edg::workload::common::jobid::JobId>
-       queryJobs(const std::vector<std::vector<QueryRecord> >& query) const;
-
-       /** Retrieve jobs satisfying the query records, including status
-        * information
-        * @param query vector of Query records that are anded to form the
-        *      query
-        * @param ids vector of returned job id's
-        * @param states vector of returned job states
-        */
-       void queryJobStates(const std::vector<QueryRecord>& query, 
-                           int flags,
-                           std::vector<JobStatus> & states) const;
-       const std::vector<JobStatus>  queryJobStates(const std::vector<QueryRecord>& query, 
-                                                    int flags) const;
-
-       const std::list<JobStatus>  queryJobStatesList(const std::vector<QueryRecord>& query,
-                                                    int flags) const;
-  
-       /** Retrieve jobs satisfying the query records, including status
-        * information
-        * @param query vector of Query records that are anded to form the
-        *      query
-        * @param ids vector of returned job id's
-        * @param states vector of returned job states
-        */
-       void queryJobStates(const std::vector<std::vector<QueryRecord> >& query, 
-                           int flags,
-                           std::vector<JobStatus> & states) const;
-       const std::vector<JobStatus>  
-       queryJobStates(const std::vector<std::vector<QueryRecord> >& query, 
-                      int flags) const;
-  
-       /** States of all user's jobs.
-        * Convenience wrapper around queryJobs.
-        */
-       void userJobStates(std::vector<JobStatus>& stateList) const;
-       const std::vector<JobStatus> userJobStates() const;
-  
-  
-       /** JobId's of all user's jobs.
-        * Convenience wrapper around queryJobs.
-        */
-       void userJobs(std::vector<edg::workload::common::jobid::JobId> &) const;
-       const std::vector<edg::workload::common::jobid::JobId> userJobs() const;
-
-       /** Manipulate LB parameters, the same as for edg_wll_Context in C */
-       void setParam(edg_wll_ContextParam, int); 
-       void setParam(edg_wll_ContextParam, const std::string); 
-       void setParam(edg_wll_ContextParam, const struct timeval &); 
-
-       int getParamInt(edg_wll_ContextParam) const;
-       std::string getParamString(edg_wll_ContextParam) const;
-       struct timeval getParamTime(edg_wll_ContextParam) const;
-  
-protected:
-
-       edg_wll_Context getContext(void) const;
-
-private:
-       edg_wll_Context context;
-};
-
-EWL_END_NAMESPACE;
-
-#endif
index cf24f00..9e07ed3 100644 (file)
@@ -11,9 +11,9 @@
 
 #include "glite/wms/jobid/cjobid.h"
 
-#include "Event.h"
+#include "glite/lb/Event.h"
 #include "glite/wms/jobid/JobIdExceptions.h"
-#include "LoggingExceptions.h"
+#include "glite/lb/LoggingExceptions.h"
 
 #include "glite/lb/consumer.h"
 #include "glite/lb/events.h"
@@ -21,7 +21,7 @@
 
 EWL_BEGIN_NAMESPACE;
 
-#define CLASS_PREFIX "edg::workload::logging::Event::"
+#define CLASS_PREFIX "glite::lb::Event::"
 
 @@@{
 sub typeswitch {
@@ -220,13 +220,13 @@ badattr:
 }
 
 const 
-edg::workload::common::jobid::JobId 
+glite::wms::jobid::JobId 
 Event::getValJobId(Attr attr) const
 {
        edg_wll_Event const *cev = (edg_wll_Event *) flesh->ptr;
        try {
                edg_wlc_JobId job_id = get_val_jobid(cev,attr);
-               return(edg::workload::common::jobid::JobId(job_id));
+               return(glite::wms::jobid::JobId(job_id));
        } 
        catch (Exception &e) {
                STACK_ADD;
index a37aa50..76f1e10 100644 (file)
 
 #include <string>
 
-#include "Job.h"
 #include "glite/wms/jobid/JobIdExceptions.h"
-#include "LoggingExceptions.h"
 
+#include "glite/lb/Job.h"
+#include "glite/lb/LoggingExceptions.h"
 #include "glite/lb/consumer.h"
 #include "glite/lb/context-int.h"
 
 EWL_BEGIN_NAMESPACE;
 
-#define CLASS_PREFIX "edg::workload::logging::Job::"
+#define CLASS_PREFIX "glite::lb::Job::"
 
 const int Job::STAT_CLASSADS = EDG_WLL_STAT_CLASSADS;
 const int Job::STAT_CHILDREN = EDG_WLL_STAT_CHILDREN;
@@ -32,7 +32,7 @@ Job::Job(void)
 }
 
 
-Job::Job(const edg::workload::common::jobid::JobId &in) 
+Job::Job(const glite::wms::jobid::JobId &in) 
 {
   try {
     jobId = in;
@@ -48,7 +48,7 @@ Job::~Job(void)
 }
 
 
-Job & Job::operator= (const edg::workload::common::jobid::JobId &in) 
+Job & Job::operator= (const glite::wms::jobid::JobId &in) 
 {
   try {
     jobId = in;
index 6e09ac7..d29f948 100644 (file)
@@ -4,16 +4,16 @@
 #include <errno.h>
 #include <stdlib.h>
 
-#include "JobStatus.h"
-#include "LoggingExceptions.h"
 #include "glite/wms/jobid/JobId.h"
 
+#include "glite/lb/JobStatus.h"
+#include "glite/lb/LoggingExceptions.h"
 #include "glite/lb/consumer.h"
 
 
 EWL_BEGIN_NAMESPACE;
 
-#define CLASS_PREFIX "edg::workload::logging::JobStatus::"
+#define CLASS_PREFIX "glite::lb::JobStatus::"
 
 @@@{
 sub typeswitch {
@@ -231,14 +231,14 @@ get_val_jobid(edg_wll_JobStat const *cstat, JobStatus::Attr attr)
 
 
 const 
-edg::workload::common::jobid::JobId  
+glite::wms::jobid::JobId  
 JobStatus::getValJobId(Attr attr) const
 {
   edg_wll_JobStat const *cstat = (edg_wll_JobStat *) flesh->ptr;
 
   try {
          edg_wlc_JobId job_id = get_val_jobid(cstat, attr);
-         return(edg::workload::common::jobid::JobId(job_id));
+         return(glite::wms::jobid::JobId(job_id));
   }
   catch(Exception &e) {
          STACK_ADD;
index 6b73c1e..f1cd57f 100644 (file)
 #include <string>
 #include <vector>
 
-#include "Notification.h"
-#include "JobStatus.h"
-#include "LoggingExceptions.h"
-#include "ServerConnection.h"
+#include "glite/lb/Notification.h"
+#include "glite/lb/JobStatus.h"
+#include "glite/lb/LoggingExceptions.h"
+#include "glite/lb/ServerConnection.h"
 
 #include "glite/lb/notifid.h"
 #include "glite/lb/notification.h"
 
 EWL_BEGIN_NAMESPACE;
 
-#define CLASS_PREFIX "edg::workload::logging::Notification::"
+#define CLASS_PREFIX "glite::lb::Notification::"
 
 /* external prototypes */
 extern edg_wll_QueryRec **
-convertQueryVectorExt(const std::vector<std::vector<edg::workload::logging::client::QueryRecord> > &);
+convertQueryVectorExt(const std::vector<std::vector<glite::lb::QueryRecord> > &);
 
 extern void
 freeQueryRecVector(edg_wll_QueryRec *);
@@ -115,9 +115,9 @@ Notification::getFd(void) const
 }
 
 void
-Notification::addJob(const edg::workload::common::jobid::JobId &jobId)
+Notification::addJob(const glite::wms::jobid::JobId &jobId)
 {
-   std::vector<edg::workload::common::jobid::JobId>::iterator it;
+   std::vector<glite::wms::jobid::JobId>::iterator it;
 
    try {
        for( it = jobs.begin(); it != jobs.end(); it++ ) {
@@ -135,9 +135,9 @@ Notification::addJob(const edg::workload::common::jobid::JobId &jobId)
 }
 
 void
-Notification::removeJob(const edg::workload::common::jobid::JobId &jobId)
+Notification::removeJob(const glite::wms::jobid::JobId &jobId)
 {
-   std::vector<edg::workload::common::jobid::JobId>::iterator it;
+   std::vector<glite::wms::jobid::JobId>::iterator it;
    int removed = 0;
 
    try {
@@ -162,7 +162,7 @@ Notification::removeJob(const edg::workload::common::jobid::JobId &jobId)
 std::string 
 Notification::getJobs(void)
 {
-   std::vector<edg::workload::common::jobid::JobId>::iterator it;
+   std::vector<glite::wms::jobid::JobId>::iterator it;
    std::string ret="";
 
    try {
@@ -179,7 +179,7 @@ Notification::getJobs(void)
 }
 
 void
-Notification::setStates(const std::vector<edg::workload::logging::client::JobStatus::Code> &jobStates)
+Notification::setStates(const std::vector<glite::lb::JobStatus::Code> &jobStates)
 {
        states = jobStates;     
 }
@@ -187,7 +187,7 @@ Notification::setStates(const std::vector<edg::workload::logging::client::JobSta
 std::string 
 Notification::getStates(void)
 {
-   std::vector<edg::workload::logging::client::JobStatus::Code>::iterator it;
+   std::vector<glite::lb::JobStatus::Code>::iterator it;
    JobStatus js;
    std::string ret="";
 
@@ -209,16 +209,16 @@ void
 Notification::Register(void)
 {
    int ret = 0;
-   std::vector<edg::workload::common::jobid::JobId>::iterator it;
-   std::vector<edg::workload::logging::client::JobStatus::Code>::iterator its;
-   std::vector<std::vector<edg::workload::logging::client::QueryRecord> > query;
+   std::vector<glite::wms::jobid::JobId>::iterator it;
+   std::vector<glite::lb::JobStatus::Code>::iterator its;
+   std::vector<std::vector<glite::lb::QueryRecord> > query;
    edg_wll_QueryRec **conditions = NULL;
    unsigned i;
 
    try {
        /* fill in the query: */
        for( it = jobs.begin(); it != jobs.end(); it++ ) {
-               std::vector<edg::workload::logging::client::QueryRecord> queryjob;
+               std::vector<glite::lb::QueryRecord> queryjob;
 
                QueryRecord r0(QueryRecord::JOBID,QueryRecord::EQUAL,*it);
                queryjob.push_back(r0);
@@ -259,7 +259,7 @@ Notification::Register(void)
    }
 }
 
-int Notification::receive(edg::workload::logging::client::JobStatus &jobStatus,timeval &timeout)
+int Notification::receive(glite::lb::JobStatus &jobStatus,timeval &timeout)
 {
        int ret = 0;
        edg_wll_JobStat *status = (edg_wll_JobStat *) calloc(1,sizeof(edg_wll_JobStat));
index 015cdeb..40ecde1 100644 (file)
 #include "glite/lb/context-int.h"
 #include "glite/lb/xml_conversions.h"
 
-#include "ServerConnection.h"
-#include "LoggingExceptions.h"
-
-///using namespace edg::workload::logging;
+#include "glite/lb/ServerConnection.h"
+#include "glite/lb/LoggingExceptions.h"
 
 EWL_BEGIN_NAMESPACE;
 
 /**
  * definitions of QueryRecord class
  */
-#define CLASS_PREFIX "edg::workload::logging::QueryRecord::"
+#define CLASS_PREFIX "glite::lb::QueryRecord::"
 
 
 QueryRecord::QueryRecord(const Attr a, 
@@ -91,7 +89,7 @@ QueryRecord::QueryRecord(const Attr a,
 
 QueryRecord::QueryRecord(const Attr a, 
                         const Op o, 
-                        const edg::workload::common::jobid::JobId& v)
+                        const glite::wms::jobid::JobId& v)
        : attr(a), oper(o), state(EDG_WLL_JOB_UNDEF), jobid_value(v)
 {
        switch(a) {
@@ -423,7 +421,7 @@ const std::string QueryRecord::AttrName(const QueryRecord::Attr attr)
  * definitions of ServerConnection class 
  */
 #undef CLASS_PREFIX
-#define CLASS_PREFIX "edg::workload::logging::ServerConnection::"
+#define CLASS_PREFIX "glite::lb::ServerConnection::"
 
 ServerConnection::ServerConnection()
 {
@@ -833,7 +831,7 @@ ServerConnection::queryEvents(const std::vector<std::vector<QueryRecord> >& job_
 
 
 void ServerConnection::queryJobs(const std::vector<QueryRecord>& query,
-                                std::vector<edg::workload::common::jobid::JobId> & ids) const
+                                std::vector<glite::wms::jobid::JobId> & ids) const
 {
        edg_wll_QueryRec *cond = NULL;
        edg_wlc_JobId *jobs, *j;
@@ -859,7 +857,7 @@ void ServerConnection::queryJobs(const std::vector<QueryRecord>& query,
                }
 
                for(j = jobs; *j; j++) 
-                       ids.push_back(edg::workload::common::jobid::JobId(*j));
+                       ids.push_back(glite::wms::jobid::JobId(*j));
 
                if (result) {
                        edg_wll_SetError(context, result, errstr);
@@ -883,10 +881,10 @@ void ServerConnection::queryJobs(const std::vector<QueryRecord>& query,
 }
 
 
-const std::vector<edg::workload::common::jobid::JobId>
+const std::vector<glite::wms::jobid::JobId>
 ServerConnection::queryJobs(const std::vector<QueryRecord>& query) const
 {
-       std::vector<edg::workload::common::jobid::JobId> jobList;
+       std::vector<glite::wms::jobid::JobId> jobList;
   
        queryJobs(query, jobList);
        return jobList;
@@ -895,7 +893,7 @@ ServerConnection::queryJobs(const std::vector<QueryRecord>& query) const
 
 void 
 ServerConnection::queryJobs(const std::vector<std::vector<QueryRecord> >& query,
-                           std::vector<edg::workload::common::jobid::JobId>& ids) const
+                           std::vector<glite::wms::jobid::JobId>& ids) const
 {
        edg_wll_QueryRec **cond = NULL;
        edg_wlc_JobId *jobs, *j;
@@ -922,7 +920,7 @@ ServerConnection::queryJobs(const std::vector<std::vector<QueryRecord> >& query,
                }
 
                for(j = jobs; *j; j++) 
-                       ids.push_back(edg::workload::common::jobid::JobId(*j));
+                       ids.push_back(glite::wms::jobid::JobId(*j));
 
                if (result) {
                        edg_wll_SetError(context, result, errstr);
@@ -958,10 +956,10 @@ ServerConnection::queryJobs(const std::vector<std::vector<QueryRecord> >& query,
 
   
 const 
-std::vector<edg::workload::common::jobid::JobId>
+std::vector<glite::wms::jobid::JobId>
 ServerConnection::queryJobs(const std::vector<std::vector<QueryRecord> >& query) const
 {
-       std::vector<edg::workload::common::jobid::JobId> jobList;
+       std::vector<glite::wms::jobid::JobId> jobList;
   
        queryJobs(query, jobList);
        return jobList;
@@ -1131,7 +1129,7 @@ ServerConnection::queryJobStates(const std::vector<std::vector<QueryRecord> >& q
 }
 
 
-void ServerConnection::userJobs(std::vector<edg::workload::common::jobid::JobId> & ids) const
+void ServerConnection::userJobs(std::vector<glite::wms::jobid::JobId> & ids) const
 {
        edg_wlc_JobId *jobs, *j;
        int     result, qresults_param;
@@ -1154,7 +1152,7 @@ void ServerConnection::userJobs(std::vector<edg::workload::common::jobid::JobId>
                }
 
                for(j = jobs; *j; j++) 
-                       ids.push_back(edg::workload::common::jobid::JobId(*j));
+                       ids.push_back(glite::wms::jobid::JobId(*j));
 
                if (result) {
                        edg_wll_SetError(context, result, errstr);
@@ -1172,10 +1170,10 @@ void ServerConnection::userJobs(std::vector<edg::workload::common::jobid::JobId>
 }
 
 
-const std::vector<edg::workload::common::jobid::JobId>
+const std::vector<glite::wms::jobid::JobId>
 ServerConnection::userJobs() const
 {
-       std::vector<edg::workload::common::jobid::JobId> jobList;
+       std::vector<glite::wms::jobid::JobId> jobList;
   
        userJobs(jobList);
        return jobList;