Ignore:
Timestamp:
Jan 3, 2019, 12:44:57 PM (5 years ago)
Author:
knut
Message:

Added some new logging functionality (function logMessage(), macros zooLog, zooLogMsg). Added utility functions setErrorMessage(), hasvalue(), and nonempty() in service.c. Added enum WPSException and arrays WPSExceptionText and WPSExceptionCode (see also function setErrorMessage). New conditional definition of type bool in service.c (to fix issue with bool). Null pointer check in function addToMap. Added missing return values and explicit type casts in some functions. Removed Windows-specific code in function dumpBackFinalFile (zoo_service_loader.c) that may cause error for async raw data output in formats other than XML.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/service.h

    r847 r889  
    4040#endif
    4141
     42// knut: add bool if necessary
     43#ifndef __cplusplus
     44  #ifndef WIN32
     45    #include <stdbool.h>
     46  #else
     47    typedef int bool;
     48    #define false 0
     49    #define true 1     
     50  #endif
     51#endif
     52#ifndef __bool_true_false_are_defined
     53  #define __bool_true_false_are_defined 1
     54#endif
     55
    4256#ifdef WIN32
    4357#define strncasecmp _strnicmp
     
    4761#define snprintf _snprintf
    4862#endif
     63/* knut: see new definition of bool above
    4964#if defined(_MSC_VER) && _MSC_VER < 1800
    5065#define false 0
     
    5267#define bool int
    5368#endif
     69*/
    5470#define zStrdup _strdup
    5571#define zMkdir _mkdir
     
    124140#ifndef WIN32
    125141#include <ctype.h>
    126 #include <stdbool.h>
     142//#include <stdbool.h> // knut: see new definition of bool above
    127143#endif
    128144
     
    274290    struct registry* next; //!< the next registry pointer
    275291  } registry;
     292 
     293  // knut
     294  enum WPSException {
     295    /*
     296    * StatusOK is not a WPS exception, it is added
     297    * here for convenience.
     298    */     
     299    StatusOK,                 
     300    /*
     301    * See WPS 1.0 specification, Table 38 and Table 62.
     302    */
     303    MissingParameterValue,   
     304    InvalidParameterValue,
     305    NoApplicableCode,
     306    NotEnoughStorage,
     307    ServerBusy,
     308    FileSizeExceeded,
     309    StorageNotSupported,
     310    VersionNegotiationFailed,
     311    /*
     312    * See WPS 2.0 specification, Tables 41, 46, 48, and 50.
     313    */
     314    NoSuchProcess,
     315    NoSuchMode,
     316    NoSuchInput,
     317    NoSuchOutput,
     318    DataNotAccessible,
     319    SizeExceeded,
     320    TooManyInputs,
     321    TooManyOutputs,
     322    NoSuchFormat,
     323    WrongInputData,
     324    InternalServerError,
     325    NoSuchJob,
     326    ResultNotReady
     327  };
     328 
     329  static const char* const WPSExceptionCode[] = {
     330    "StatusOK",
     331    "MissingParameterValue",
     332    "InvalidParameterValue",
     333    "NoApplicableCode",
     334    "NotEnoughStorage",
     335    "ServerBusy",
     336    "FileSizeExceeded",
     337    "StorageNotSupported",
     338    "VersionNegotiationFailed",
     339    "NoSuchProcess",
     340    "NoSuchMode",
     341    "NoSuchInput",
     342    "NoSuchOutput",
     343    "DataNotAccessible",
     344    "SizeExceeded",
     345    "TooManyInputs",
     346    "TooManyOutputs",
     347    "NoSuchFormat",
     348    "WrongInputData",
     349    "InternalServerError",
     350    "NoSuchJob",
     351    "ResultNotReady"   
     352  };     
     353
     354  static const char* const WPSExceptionText[] = {
     355    "No problem detected",
     356    "Operation request does not include a parameter value, and this server did not declare a default value for that parameter.",
     357    "Operation request contains an invalid parameter value.",
     358    "No other exceptionCode specified by this service and server applies to this exception.",
     359    "The server does not have enough space available to store the inputs and outputs associated with the request.",
     360    "The server is too busy to accept and queue the request at this time.",
     361    "The file size of one of the input parameters was too large for this process to handle.",
     362    "Execute operation request included transmission=”reference” for one of the outputs, but storage is not offered by this server.",
     363    "Service version for a ComplexData xlink:href input was not supported by the referenced server, and version negotiation failed.",
     364    "One of the identifiers passed does not match with any of the processes offered by this server.",
     365    "The process does not permit the desired execution mode.",
     366    "One or more of the input identifiers passed does not match with any of the input identifiers of this process.",
     367    "One or more of the output identifiers passed does not match with any of the input identifiers of this process.",
     368    "One of the referenced input data sets was inaccessible.",
     369    "The size of one of the input parameters was too large for this process to handle.",
     370    "Too many input items have been specified.",
     371    "Too many output items have been specified.",
     372    "One or more of the input or output formats specified in the request did not match with any of the formats defined for that particular input or output.",
     373    "One or more of inputs for which the service was able to retrieve the data but could not read it.",
     374    "",
     375    "The JobID from the request does not match any of the Jobs running on this server.",
     376    "The result for the requested JobID has not yet been generated."
     377  };
    276378
    277379  ZOO_DLL_EXPORT void _dumpMap(map*);
     
    340442  ZOO_DLL_EXPORT int snprintf(char *buffer, size_t n, const char *format, ...);
    341443#endif
     444
     445  // knut: some new utility functions; logMessage is primarily intended for debugging   
     446  ZOO_DLL_EXPORT bool nonempty(map* map);
     447  ZOO_DLL_EXPORT bool hasvalue(maps* source, const char* node, const char* key, map** kvp);
     448  ZOO_DLL_EXPORT void setErrorMessage(maps*& conf, const char* service, WPSException exc, const char* message = NULL);
     449  ZOO_DLL_EXPORT void logMessage(const char* source, const char* function, int line, const char* file = NULL, const char* message = NULL); 
     450  #define zooLogMsg(file,message) logMessage(__FILE__, __func__, __LINE__, (file), (message))
     451  #define zooLog logMessage(__FILE__, __func__, __LINE__) 
     452 
    342453#ifdef __cplusplus
    343454}
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png