bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
BESServiceRegistry.h
1// BESServiceRegistry.h
2
3// This file is part of bes, A C++ back-end server implementation framework
4// for the OPeNDAP Data Access Protocol.
5
6// Copyright (c) 2004-2009 University Corporation for Atmospheric Research
7// Author: Patrick West <pwest@ucar.edu> and Jose Garcia <jgarcia@ucar.edu>
8//
9// This library is free software; you can redistribute it and/or
10// modify it under the terms of the GNU Lesser General Public
11// License as published by the Free Software Foundation; either
12// version 2.1 of the License, or (at your option) any later version.
13//
14// This library is distributed in the hope that it will be useful,
15// but WITHOUT ANY WARRANTY; without even the implied warranty of
16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17// Lesser General Public License for more details.
18//
19// You should have received a copy of the GNU Lesser General Public
20// License along with this library; if not, write to the Free Software
21// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22//
23// You can contact University Corporation for Atmospheric Research at
24// 3080 Center Green Drive, Boulder, CO 80301
25
26// (c) COPYRIGHT University Corporation for Atmospheric Research 2004-2005
27// Please read the full copyright statement in the file COPYRIGHT_UCAR.
28//
29// Authors:
30// pwest Patrick West <pwest@ucar.edu>
31// jgarcia Jose Garcia <jgarcia@ucar.edu>
32
33#ifndef I_BESServiceRegistry_h
34#define I_BESServiceRegistry_h 1
35
36#include <string>
37#include <map>
38#include <list>
39#include <mutex>
40
41#include "BESObj.h"
42
43class BESInfo ;
44
57class BESServiceRegistry : public BESObj
58{
59private:
60 typedef struct _service_cmd
61 {
62 std::string _description ;
63 std::map<std::string,std::string> _formats ;
64 } service_cmd ;
65 static BESServiceRegistry * d_instance ;
66 mutable std::recursive_mutex d_cache_lock_mutex;
67
68 static void initialize_instance();
69 static void delete_instance();
70
71 std::map<std::string,std::map<std::string,service_cmd> >_services ;
72 std::map<std::string,std::map<std::string,std::string> > _handles ;
73
74public:
75 BESServiceRegistry() ;
76 virtual ~BESServiceRegistry() ;
77
78 virtual void add_service( const std::string &name ) ;
79 virtual void add_to_service( const std::string &service,
80 const std::string &cmd,
81 const std::string &cmd_descript,
82 const std::string &format ) ;
83 virtual void add_format( const std::string &service,
84 const std::string &cmd,
85 const std::string &format ) ;
86
87 virtual void remove_service( const std::string &name ) ;
88
89 virtual bool service_available( const std::string &name,
90 const std::string &cmd = "",
91 const std::string &format = "" ) ;
92
93 virtual void handles_service( const std::string &handler,
94 const std::string &service ) ;
95
96 virtual bool does_handle_service( const std::string &handler,
97 const std::string &service ) ;
98 virtual void services_handled( const std::string &handler,
99 std::list<std::string> &services ) ;
100
101 virtual void show_services( BESInfo &info ) ;
102
103 virtual void dump( std::ostream &strm ) const ;
104
105 static BESServiceRegistry * TheRegistry() ;
106};
107
108#endif // I_BESServiceRegistry_h
109
informational response object
Definition BESInfo.h:63
top level BES object to house generic methods
Definition BESObj.h:54
virtual bool does_handle_service(const std::string &handler, const std::string &service)
Asks if the specified handler can handle the specified service.
virtual void services_handled(const std::string &handler, std::list< std::string > &services)
returns the list of servies provided by the handler in question
virtual bool service_available(const std::string &name, const std::string &cmd="", const std::string &format="")
Determines if a service and, optionally, a command and a return format, is available.
virtual void add_service(const std::string &name)
Add a service to the BES.
virtual void add_to_service(const std::string &service, const std::string &cmd, const std::string &cmd_descript, const std::string &format)
This function allows callers to add to a service that already exists.
virtual void show_services(BESInfo &info)
fills in the response object for the <showService /> request
virtual void handles_service(const std::string &handler, const std::string &service)
The specified handler can handle the specified service.
virtual void add_format(const std::string &service, const std::string &cmd, const std::string &format)
add a format response to a command of a service
virtual void dump(std::ostream &strm) const
dumps information about this object
virtual void remove_service(const std::string &name)
remove a service from the BES