bes  Updated for version 3.20.6
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 #include "BESObj.h"
41 
42 class BESInfo ;
43 
56 class BESServiceRegistry : public BESObj
57 {
58 private:
59  typedef struct _service_cmd
60  {
61  std::string _description ;
62  std::map<std::string,std::string> _formats ;
63  } service_cmd ;
64  static BESServiceRegistry * _instance ;
65  std::map<std::string,std::map<std::string,service_cmd> >_services ;
66  std::map<std::string,std::map<std::string,std::string> > _handles ;
67 protected:
68  BESServiceRegistry(void) ;
69 public:
70  virtual ~BESServiceRegistry(void) ;
71 
72  virtual void add_service( const std::string &name ) ;
73  virtual void add_to_service( const std::string &service,
74  const std::string &cmd,
75  const std::string &cmd_descript,
76  const std::string &format ) ;
77  virtual void add_format( const std::string &service,
78  const std::string &cmd,
79  const std::string &format ) ;
80 
81  virtual void remove_service( const std::string &name ) ;
82 
83  virtual bool service_available( const std::string &name,
84  const std::string &cmd = "",
85  const std::string &format = "" ) ;
86 
87  virtual void handles_service( const std::string &handler,
88  const std::string &service ) ;
89 
90  virtual bool does_handle_service( const std::string &handler,
91  const std::string &service ) ;
92  virtual void services_handled( const std::string &handler,
93  std::list<std::string> &services ) ;
94 
95  virtual void show_services( BESInfo &info ) ;
96 
97  virtual void dump( std::ostream &strm ) const ;
98 
99  static BESServiceRegistry * TheRegistry() ;
100 };
101 
102 #endif // I_BESServiceRegistry_h
103 
BESServiceRegistry::show_services
virtual void show_services(BESInfo &info)
fills in the response object for the <showService /> request
Definition: BESServiceRegistry.cc:358
BESServiceRegistry::services_handled
virtual void services_handled(const std::string &handler, std::list< std::string > &services)
returns the list of servies provided by the handler in question
Definition: BESServiceRegistry.cc:334
BESServiceRegistry::add_to_service
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.
Definition: BESServiceRegistry.cc:90
BESServiceRegistry
The service registry allows modules to register services with the BES that they provide.
Definition: BESServiceRegistry.h:56
BESServiceRegistry::remove_service
virtual void remove_service(const std::string &name)
remove a service from the BES
Definition: BESServiceRegistry.cc:182
BESServiceRegistry::handles_service
virtual void handles_service(const std::string &handler, const std::string &service)
The specified handler can handle the specified service.
Definition: BESServiceRegistry.cc:271
BESServiceRegistry::add_format
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
Definition: BESServiceRegistry.cc:130
BESInfo
informational response object
Definition: BESInfo.h:63
BESObj
top level BES object to house generic methods
Definition: BESObj.h:49
BESServiceRegistry::does_handle_service
virtual bool does_handle_service(const std::string &handler, const std::string &service)
Asks if the specified handler can handle the specified service.
Definition: BESServiceRegistry.cc:309
BESServiceRegistry::dump
virtual void dump(std::ostream &strm) const
dumps information about this object
Definition: BESServiceRegistry.cc:397
BESServiceRegistry::service_available
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.
Definition: BESServiceRegistry.cc:222
BESServiceRegistry::add_service
virtual void add_service(const std::string &name)
Add a service to the BES.
Definition: BESServiceRegistry.cc:59