bes  Updated for version 3.17.4
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 
40 using std::string ;
41 using std::map ;
42 using std::list ;
43 
44 #include "BESObj.h"
45 
46 class BESInfo ;
47 
60 class BESServiceRegistry : public BESObj
61 {
62 private:
63  typedef struct _service_cmd
64  {
65  string _description ;
66  map<string,string> _formats ;
67  } service_cmd ;
68  static BESServiceRegistry * _instance ;
69  map<string,map<string,service_cmd> >_services ;
70  map<string,map<string,string> > _handles ;
71 protected:
72  BESServiceRegistry(void) ;
73 public:
74  virtual ~BESServiceRegistry(void) ;
75 
76  virtual void add_service( const string &name ) ;
77  virtual void add_to_service( const string &service,
78  const string &cmd,
79  const string &cmd_descript,
80  const string &format ) ;
81  virtual void add_format( const string &service,
82  const string &cmd,
83  const string &format ) ;
84 
85  virtual void remove_service( const string &name ) ;
86 
87  virtual bool service_available( const string &name,
88  const string &cmd = "",
89  const string &format = "" ) ;
90 
91  virtual void handles_service( const string &handler,
92  const string &service ) ;
93 
94  virtual bool does_handle_service( const string &handler,
95  const string &service ) ;
96  virtual void services_handled( const string &handler,
97  list<string> &services ) ;
98 
99  virtual void show_services( BESInfo &info ) ;
100 
101  virtual void dump( ostream &strm ) const ;
102 
103  static BESServiceRegistry * TheRegistry() ;
104 };
105 
106 #endif // I_BESServiceRegistry_h
107 
virtual bool does_handle_service(const string &handler, const string &service)
Asks if the specified handler can handle the specified service.
virtual void add_service(const string &name)
Add a service to the BES.
The service registry allows modules to register services with the BES that they provide.
virtual void add_to_service(const string &service, const string &cmd, const string &cmd_descript, const 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 remove_service(const string &name)
remove a service from the BES
Base object for bes objects.
Definition: BESObj.h:52
informational response object
Definition: BESInfo.h:68
virtual void add_format(const string &service, const string &cmd, const string &format)
add a format response to a command of a service
virtual void dump(ostream &strm) const
dumps information about this object
virtual bool service_available(const string &name, const string &cmd="", const string &format="")
Determines if a service and, optionally, a command and a return format, is available.
virtual void handles_service(const string &handler, const string &service)
The specified handler can handle the specified service.
virtual void services_handled(const string &handler, list< string > &services)
returns the list of servies provided by the handler in question