ServiceRequest.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 "ServiceRequest.hpp"
00033
00034 #include "EntityDescriptionRepository.hpp"
00035 #include "Service.hpp"
00036 #include "ServiceInterfaceDescription.hpp"
00037 #include "ServiceInstanceDescription.hpp"
00038 #include "ServiceTypeDescription.hpp"
00039
00040 #include <DataFactory.hpp>
00041 #include <Exception.hpp>
00042
00043
00044 using namespace mermaid::support::service;
00045
00046 using mermaid::support::data::DataFactory;
00047 using mermaid::support::errorhandling::Exception;
00048
00049
00050 ServiceRequest::ServiceRequest()
00051 {
00052 throw Exception ("ServiceRequest::ServiceRequest()");
00053 };
00054
00055 ServiceRequest::ServiceRequest (std::string requesterEntityName, std::string requesterServiceName, std::string targetEntityName, std::string targetServiceName, std::string targetServiceInterfaceName, int requestId)
00056 {
00057 requesterEntityName_ = requesterEntityName;
00058 requesterServiceName_ = requesterServiceName;
00059 targetEntityName_ = targetEntityName;
00060 targetServiceName_ = targetServiceName;
00061 targetServiceInterfaceName_ = targetServiceInterfaceName;
00062 requestId_ = requestId;
00063
00064 std::string inputDataName = EntityDescriptionRepository::getInstance()->getEntityDescription (targetEntityName_)->getServiceInstanceDescription (targetServiceName_)->getServiceTypeDescriptionWithInterfaceName (targetServiceInterfaceName_)->getServiceInterfaceDescription (targetServiceInterfaceName_)->getServiceInterfaceInputDataName();
00065
00066 requestDataBox_ = DataFactory::buildDataBox (inputDataName);
00067
00068 };
00069
00070 ServiceRequest::ServiceRequest (const ServiceRequest &sar)
00071 {
00072 throw Exception ("ServiceRequest(const ServiceRequest &sar)");
00073 };
00074
00075 ServiceRequest& ServiceRequest::operator= (const ServiceRequest & sar)
00076 {
00077 throw Exception ("ServiceRequest::operator=(const ServiceRequest &sar)");
00078 };
00079
00080 std::string ServiceRequest::getRequesterEntityName()
00081 {
00082 return requesterEntityName_;
00083 };
00084
00085 std::string ServiceRequest::getRequesterServiceName()
00086 {
00087 return requesterServiceName_;
00088 };
00089
00090 std::string ServiceRequest::getTargetEntityName()
00091 {
00092 return targetEntityName_;
00093 };
00094
00095 std::string ServiceRequest::getTargetServiceName()
00096 {
00097 return targetServiceName_;
00098 };
00099
00100 std::string ServiceRequest::getTargetServiceInterfaceName()
00101 {
00102 return targetServiceInterfaceName_;
00103 };
00104
00105 int ServiceRequest::getRequestId()
00106 {
00107 return requestId_;
00108 };
00109
00110 shared_ptr<DataBox> ServiceRequest::getRequestDataBox()
00111 {
00112 if (requestDataBox_ == false) {
00113 throw Exception ("ServiceRequest::getRequestDataBox() : request data box is not valid");
00114 }
00115 return requestDataBox_;
00116 };
00117
00118 void ServiceRequest::setRequestDataBox (shared_ptr<DataBox> dataBox)
00119 {
00120 requestDataBox_ = dataBox;
00121 };
00122
00123 ServiceRequestState& ServiceRequest::getState()
00124 {
00125 return state_;
00126 };
00127
00128 void ServiceRequest::notifySent()
00129 {
00130 state_.notifySent();
00131 };
00132
00133 void ServiceRequest::notifyReplyReceived()
00134 {
00135 state_.notifyReplyReceived();
00136 };