ServiceRequestDeliveryTask.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "config.h"
00032
00033 #include "ServiceRequestDeliveryTask.hpp"
00034
00035 #include <Exception.hpp>
00036
00037 #include <Time.hpp>
00038
00039 #include <iostream>
00040
00041 using namespace mermaid::support::service;
00042 using mermaid::support::errorhandling::Exception;
00043 using mermaid::support::system::Time;
00044
00045 ServiceRequestDeliveryTask::ServiceRequestDeliveryTask (shared_ptr<Service> service, shared_ptr<ServiceRequest> request) : Task()
00046 {
00047
00048 service_ = service;
00049 request_ = request;
00050 };
00051
00052 void ServiceRequestDeliveryTask::run()
00053 {
00054
00055
00056
00057 Time now = Time::getCurrentTime();
00058
00059 Time delta = now - getScheduledTime();
00060
00061
00062 try {
00063
00064 service_->processServiceRequest (request_);
00065 }
00066 catch (Exception &e) {
00067 std::cerr << "ServiceRequestDeliveryTask : caught an exception while Service was processing a Service Request" << std::endl;
00068 std::cerr << "\tException : " << e.what() << std::endl;
00069 std::cerr << "\tRequester Entity Name : " << request_->getRequesterEntityName() << std::endl;
00070 std::cerr << "\tRequester Service Instance Name : " << request_->getRequesterServiceName() << std::endl;
00071 std::cerr << "\tTarget Entity Name : " << request_->getTargetEntityName() << std::endl;
00072 std::cerr << "\tTarget Service Instance Name : " << request_->getTargetServiceName() << std::endl;
00073 std::cerr << "\tTarget Service Interface Name : " << request_->getTargetServiceInterfaceName() << std::endl;
00074 std::cerr << "\tRequest Data Box contents : " << static_cast<std::string> (* (request_->getRequestDataBox())) << std::endl;
00075 }
00076
00077
00078
00079 };