ServiceDataFeedDeliveryTask.cpp

Go to the documentation of this file.
00001 /*
00002 Copyright 2007, 2008, 2009, 2010, 2011 Instituto de Sistemas e Robotica, Instituto Superior Tecnico
00003 
00004 This file is part of MeRMaID.
00005 
00006 MeRMaID is free software: you can redistribute it and/or modify
00007 it under the terms of the GNU Lesser General Public License as published by
00008 the Free Software Foundation, either version 3 of the License, or
00009 (at your option) any later version.
00010 
00011 MeRMaID is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU Lesser General Public License for more details.
00015 
00016 You should have received a copy of the GNU Lesser General Public License
00017 along with MeRMaID.  If not, see <http://www.gnu.org/licenses/>.
00018 */
00019 
00020 
00021 
00022 /**
00023  * @Filename ServiceDataFeedDeliveryTask.cpp
00024  * @Description ServiceDataFeedDeliveryTask implementation
00025  * @Status Work in Progress
00026  * @Version $Id: ServiceDataFeedDeliveryTask.cpp 1 2011-03-04 18:13:18Z jreis $
00027  * @Maintainer
00028  */
00029 
00030 #include "config.h"
00031 
00032 #include "ServiceDataFeedDeliveryTask.hpp"
00033 #include "ServiceInstanceDescription.hpp"
00034 #include "EntityDescription.hpp"
00035 
00036 #include <Exception.hpp>
00037 
00038 #include <iostream>
00039 
00040 using namespace mermaid::support::service;
00041 using mermaid::support::errorhandling::Exception;
00042 
00043 ServiceDataFeedDeliveryTask::ServiceDataFeedDeliveryTask (shared_ptr<Service> consumerService, std::string producerEntityName, std::string producerServiceName, std::string dataFeedName, shared_ptr<DataBox> dataBox)
00044 {
00045 //     std::cerr << "ServiceDataFeedDeliveryTask::ServiceDataFeedDeliveryTask()" << std::endl;
00046   consumerService_ = consumerService;
00047   producerEntityName_ = producerEntityName;
00048   producerServiceName_ = producerServiceName;
00049   dataFeedName_ = dataFeedName;
00050   dataBox_ = dataBox;
00051 }; // ServiceDataFeedDeliveryTask()
00052 
00053 void ServiceDataFeedDeliveryTask::run()
00054 {
00055   try {
00056     //process data feed
00057     consumerService_->processDataFeedInput (producerEntityName_, producerServiceName_, dataFeedName_, dataBox_);
00058   }
00059   catch (Exception &e) {
00060     shared_ptr<ServiceInstanceDescription> serviceInstanceDescription = consumerService_->getServiceInstanceDescription();
00061     shared_ptr<EntityDescription> entityDescription = serviceInstanceDescription->getEntityDescription();
00062     //shared_ptr<ServiceTypeDescription> serviceTypeDescription = serviceInstanceDescription->getServiceTypeDescription();
00063     
00064     std::cerr << "ServiceDataFeedDeliveryTask : caught an exception while Service was processing a Data Feed input" << std::endl;
00065     std::cerr << "\tException : " << e.what() << std::endl;
00066     std::cerr << "\tProducer Entity Name : " << producerEntityName_ << std::endl;
00067     std::cerr << "\tProducer Service Instance Name : " << producerServiceName_ << std::endl;
00068     std::cerr << "\tData Feed Name : " << dataFeedName_ << std::endl;
00069     std::cerr << "\tData Box contents : " << std::endl << (std::string) ( (*dataBox_)) << std::endl;
00070     std::cerr << "\tConsumer Entity Name : " << entityDescription->getEntityName() << std::endl;
00071     //std::cerr << "\tConsumer Service Type Name : " << serviceTypeDescription->getServiceTypeName() << std::endl;
00072     std::cerr << "\tConsumer Service Instance Name : " << serviceInstanceDescription->getServiceInstanceName() << std::endl;
00073   }
00074 }; // run()
Generated on Fri Mar 4 22:14:58 2011 for MeRMaID::support by  doxygen 1.6.3