00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef GRIDCLIENT_JSON_MARSHALLER_HPP_INCLUDED
00011 #define GRIDCLIENT_JSON_MARSHALLER_HPP_INCLUDED
00012
00013 #include <vector>
00014 #include <boost/property_tree/json_parser.hpp>
00015
00016 #include "gridgain/impl/cmd/gridclientmessageauthrequestcommand.hpp"
00017 #include "gridgain/impl/cmd/gridclientmessageauthresult.hpp"
00018 #include "gridgain/impl/cmd/gridclientmessagelogrequestcommand.hpp"
00019 #include "gridgain/impl/cmd/gridclientmessagelogresult.hpp"
00020 #include "gridgain/impl/cmd/gridclientmessagetopologyrequestcommand.hpp"
00021 #include "gridgain/impl/cmd/gridclientmessagetopologyresult.hpp"
00022 #include "gridgain/impl/cmd/gridclientmessagecacheresult.hpp"
00023 #include "gridgain/impl/cmd/gridclientmessagecacherequestcommand.hpp"
00024 #include "gridgain/impl/cmd/gridclientmessagecachemodifyresult.hpp"
00025 #include "gridgain/impl/cmd/gridclientmessagecachemetricsresult.hpp"
00026 #include "gridgain/impl/cmd/gridclientmessagecachegetresult.hpp"
00027 #include "gridgain/impl/cmd/gridclientmessagetaskrequestcommand.hpp"
00028 #include "gridgain/impl/cmd/gridclientmessagetaskresult.hpp"
00029
00030 #include "gridgain/gridclientexception.hpp"
00031
00033 typedef std::map<std::string, std::string> TRequestParams;
00034
00036 typedef boost::property_tree::ptree TJson;
00037
00041 class GridClientJsonMarshaller {
00042 private:
00049 static void fillRequestHeader(const GridClientMessage& req, TRequestParams& params);
00050
00057 static void fillResponseHeader(const TJson& json, GridClientMessageResult& clientMsg) throw (GridClientException);
00058 public:
00065 static void wrap(const GridAuthenticationRequestCommand& req, TRequestParams& params);
00066
00073 static void unwrap(const TJson& json, GridClientMessageAuthenticationResult& resp);
00074
00081 static void wrap(const GridLogRequestCommand& req, TRequestParams& params);
00082
00089 static void unwrap(const TJson& json, GridClientMessageLogResult& resp);
00090
00097 static void wrap(const GridTopologyRequestCommand& req, TRequestParams& params);
00098
00105 static void unwrap(const TJson& json, GridClientMessageTopologyResult& resp);
00106
00113 static void wrap(const GridCacheRequestCommand& req, TRequestParams& params);
00114
00121 static void unwrap(const TJson& json, GridClientMessageCacheModifyResult& resp);
00122
00129 static void unwrap(const TJson& json, GridClientMessageCacheMetricResult& resp);
00130
00137 static void unwrap(const TJson& json, GridClientMessageCacheGetResult& resp);
00138
00145 static void wrap(const GridTaskRequestCommand& req, TRequestParams& params);
00146
00153 static void unwrap(const TJson& json, GridClientMessageTaskResult& resp);
00154 };
00155
00156 #endif