// $Header: https://oberon.oapd.inaf.it/shins/trunk/shins/src/data_mgr/dataManagerService.cpp 3817 2022-02-07 15:50:28Z depa $

#include "dataManagerService.hpp"

int dataManagerApplication::run(int _argc, char* _argv[])
{
  // LOG_SYSLOG;
  int status = EXIT_SUCCESS;
  // Ice::ObjectAdapterPtr adapter = this->communicator()->createObjectAdapterWithEndpoints("dataManagerAdapter", "default -p 10501");
  Ice::ObjectAdapterPtr adapter = this->communicator()->createObjectAdapter("dataManagerAdapter");
  std::cout << "created adapter for data_mgr service" << std::endl;
  I_LOG("created adapter for data_mgr service");
  fitsFileIPtr servantFits = new fitsFileI(_argc, _argv);

  adapter->add(servantFits, this->communicator()->stringToIdentity("dataManagerAdapter"));

  adapter->activate();
  this->communicator()->waitForShutdown();
  if (this->interrupted())
    {
//      std::cout << this->appName() << ": terminating" << std::endl;
      I_LOG(this->appName() << ": terminating");
      W_LOG(this->appName() << ": terminating");
    }
  return status;
}


int main(int argc, char* argv[])
{
  //
  dataManagerApplication app;
  I_LOG("Starting data manager application ...");
  return app.main(argc, argv);
}

