Skip to content
Snippets Groups Projects
TMSSBridge.h 2.43 KiB
Newer Older
//  TMSSBridge.h: Implementation of the TMSS Bridge, interface between MAC Scheduler and TMSS
//
//  Copyright (C) 2020
//  ASTRON (Netherlands Foundation for Research in Astronomy)
//  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@astron.nl
//
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
//  $Id$
#include <Common/LofarTypes.h>
#include <Common/Exception.h>
#include <boost/date_time/posix_time/posix_time.hpp>
using namespace boost::posix_time;
using namespace std;
    // Just creates an object and registers the connection parameters.
    TMSSBridge ();
    TMSSBridge (const std::string &hostname, int port, const std::string &username, const std::string &password);
    Json::Value getSubTask(int subtask_id);

    Json::Value getSubTasksStartingInThreeMinutes();
    Json::Value getActiveSubTasks();
    Json::Value getFinishingSubTasks();
    string getParsetAsText(int subtask_id);
    string setSubtaskState(int subtask_id, const std::string& state);
    // Actually the next method are private, make it public to be able to use in UnitTest++
    vector<string> translateHttpResultToSortedUrlList(Json::Value result);
    string httpQuery(const string& target, const string& query_method="GET", const string& data="");
    Json::Value httpGETAsJson(const string& target);
    // Copying is not allowed
    TMSSBridge(const TMSSBridge&);
    TMSSBridge& operator=(const TMSSBridge&);
    string    itsUser;
    string    itsPassword;
    string    itsHost;
    int       itsPort;
EXCEPTION_CLASS(TMSSBridgeException, LOFAR::Exception);