ServiceReply.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 #include "config.h"
00031
00032 #include "ServiceReply.hpp"
00033
00034 #include "EntityDescriptionRepository.hpp"
00035 #include "ServiceTypeDescription.hpp"
00036 #include "ServiceInterfaceDescription.hpp"
00037 #include "ServiceInstanceDescription.hpp"
00038
00039
00040 #include <DataFactory.hpp>
00041 #include <Exception.hpp>
00042 #include <Service.hpp>
00043
00044
00045 using namespace mermaid::support::service;
00046
00047 using mermaid::support::data::DataFactory;
00048 using mermaid::support::errorhandling::Exception;
00049
00050 ServiceReply::ServiceReply()
00051 {
00052 };
00053
00054
00055 ServiceReply::ServiceReply (shared_ptr<ServiceRequest> originalRequest, std::string executionStatus)
00056 {
00057 requesterEntityName_ = originalRequest->getRequesterEntityName();
00058 requesterServiceName_ = originalRequest->getRequesterServiceName();
00059 targetEntityName_ = originalRequest->getTargetEntityName();
00060 targetServiceName_ = originalRequest->getTargetServiceName();
00061 targetServiceInterfaceName_ = originalRequest->getTargetServiceInterfaceName();
00062 requestId_ = originalRequest->getRequestId();
00063 executionStatus_ = executionStatus;
00064
00065
00066 std::string outputDataName = EntityDescriptionRepository::getInstance()->getEntityDescription (targetEntityName_)->getServiceInstanceDescription (targetServiceName_)->getServiceTypeDescriptionWithInterfaceName (targetServiceInterfaceName_)->getServiceInterfaceDescription (targetServiceInterfaceName_)->getServiceInterfaceOutputDataName();
00067
00068 replyDataBox_ = DataFactory::buildDataBox (outputDataName);
00069 };
00070
00071 ServiceReply::ServiceReply (const ServiceReply &sr)
00072 {
00073 throw Exception ("ServiceReply::ServiceReply(const ServiceReply &sr)");
00074 };
00075
00076 ServiceReply& ServiceReply::operator= (const ServiceReply & sr)
00077 {
00078 throw Exception ("ServiceReply::operator=(const ServiceReply &sr)");
00079 };
00080
00081 std::string ServiceReply::getRequesterEntityName()
00082 {
00083 return requesterEntityName_;
00084 };
00085
00086 std::string ServiceReply::getRequesterServiceName()
00087 {
00088 return requesterServiceName_;
00089 };
00090
00091 std::string ServiceReply::getTargetEntityName()
00092 {
00093 return targetEntityName_;
00094 };
00095
00096 std::string ServiceReply::getTargetServiceName()
00097 {
00098 return targetServiceName_;;
00099 };
00100
00101 std::string ServiceReply::getTargetServiceInterfaceName()
00102 {
00103 return targetServiceInterfaceName_;
00104 };
00105
00106 int ServiceReply::getRequestId()
00107 {
00108 return requestId_;
00109 };
00110
00111 bool ServiceReply::executionIsOk()
00112 {
00113 return executionStatus_.compare ("OK") == 0;
00114 };
00115
00116 std::string ServiceReply::getExecutionStatus()
00117 {
00118 return executionStatus_;
00119 };
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136 shared_ptr<DataBox> ServiceReply::getReplyDataBox()
00137 {
00138 if (replyDataBox_ == false) {
00139 throw Exception ("ServiceReply::getReplyDataBox() : reply data box is not valid");
00140 }
00141 return replyDataBox_;
00142 };
00143
00144 void ServiceReply::setReplyDataBox (shared_ptr<DataBox> dataBox)
00145 {
00146 replyDataBox_ = dataBox;
00147 };