irods  4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.
  Fossies Dox: irods-4.2.8.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

irods_postgres_object.cpp
Go to the documentation of this file.
1 // =-=-=-=-=-=-=-
2 // irods includes
5 
6 namespace irods {
7 
8 // =-=-=-=-=-=-=-
9 // public - ctor
11 
12  } // ctor
13 
14 // =-=-=-=-=-=-=-
15 // public - cctor
17  const postgres_object& _rhs ) :
18  database_object( _rhs ) {
19 
20  } // cctor
21 
22 // =-=-=-=-=-=-=-
23 // public - dtor
25  } // dtor
26 
27 // =-=-=-=-=-=-=-
28 // public - assignment operator
30  const postgres_object& ) {
31 
32  return *this;
33 
34  } // operator=
35 
36 // =-=-=-=-=-=-=-
37 // public - equivalence operator
39  const postgres_object& ) const {
40  return false;
41 
42  } // operator==
43 
44 // =-=-=-=-=-=-=-
45 // plugin resolution operation
47  const std::string& _interface,
48  plugin_ptr& _ptr ) {
49  // =-=-=-=-=-=-=-
50  // check the interface type and error out if it
51  // isnt a database interface
52  if ( DATABASE_INTERFACE != _interface ) {
53  std::stringstream msg;
54  msg << "postgres_object does not support a [";
55  msg << _interface;
56  msg << "] plugin interface";
57  return ERROR( SYS_INVALID_INPUT_PARAM, msg.str() );
58 
59  }
60 
61  // =-=-=-=-=-=-=-
62  // ask the database manager for a postgres resource
63  database_ptr db_ptr;
65  if ( !ret.ok() ) {
66  // =-=-=-=-=-=-=-
67  // attempt to load the plugin, in this case the type,
68  // instance name, key etc are all tcp as there is only
69  // the need for one instance of a tcp object, etc.
70  std::string empty_context( "" );
71  ret = db_mgr.init_from_type(
75  empty_context,
76  db_ptr );
77  if ( !ret.ok() ) {
78  return PASS( ret );
79 
80  }
81  else {
82  // =-=-=-=-=-=-=-
83  // upcast for out variable
84  _ptr = boost::dynamic_pointer_cast< plugin_base >( db_ptr );
85  return SUCCESS();
86 
87  }
88 
89  } // if !ok
90 
91  // =-=-=-=-=-=-=-
92  // upcast for out variable
93  _ptr = boost::dynamic_pointer_cast< plugin_base >( db_ptr );
94 
95  return SUCCESS();
96 
97  } // resolve
98 
99 // =-=-=-=-=-=-=-
100 // public - get rule engine kvp
102  rule_engine_vars_t& ) {
103 
104  return SUCCESS();
105 
106  } // get_re_vars
107 
108 }; // namespace irods
109 
110 
111 
irods::plugin_ptr
boost::shared_ptr< plugin_base > plugin_ptr
Definition: irods_first_class_object.hpp:18
irods::postgres_object::operator=
virtual postgres_object & operator=(const postgres_object &)
Definition: irods_postgres_object.cpp:29
PASS
#define PASS(prev_error_)
Definition: irods_error.hpp:118
irods::postgres_object::postgres_object
postgres_object()
Definition: irods_postgres_object.cpp:10
irods::database_manager::resolve
error resolve(std::string, database_ptr &)
Definition: irods_database_manager.cpp:32
irods::postgres_object::~postgres_object
virtual ~postgres_object()
Definition: irods_postgres_object.cpp:24
irods_postgres_object.hpp
SYS_INVALID_INPUT_PARAM
@ SYS_INVALID_INPUT_PARAM
Definition: rodsErrorTable.h:195
irods::postgres_object::operator==
virtual bool operator==(const postgres_object &_rhs) const
Definition: irods_postgres_object.cpp:38
SUCCESS
#define SUCCESS()
Definition: irods_error.hpp:121
irods::db_mgr
database_manager db_mgr
Definition: irods_database_manager.cpp:9
irods_database_manager.hpp
irods
Definition: apiHandler.hpp:35
irods::DATABASE_INTERFACE
const std::string DATABASE_INTERFACE("irods_database_interface")
irods::database_manager::init_from_type
error init_from_type(const std::string &, const std::string &, const std::string &, const std::string &, database_ptr &)
Definition: irods_database_manager.cpp:83
ERROR
#define ERROR(code_, message_)
Definition: irods_error.hpp:117
irods::error
Definition: irods_error.hpp:23
irods::database_ptr
boost::shared_ptr< database > database_ptr
Definition: irods_database_types.hpp:21
irods::database_object
Definition: irods_database_object.hpp:19
irods::postgres_object::get_re_vars
virtual error get_re_vars(rule_engine_vars_t &)
Definition: irods_postgres_object.cpp:101
irods::postgres_object::resolve
virtual error resolve(const std::string &, plugin_ptr &)
Definition: irods_postgres_object.cpp:46
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
irods::POSTGRES_DATABASE_PLUGIN
const std::string POSTGRES_DATABASE_PLUGIN("postgres")
irods::rule_engine_vars_t
std::map< std::string, std::string > rule_engine_vars_t
Definition: irods_first_class_object.hpp:20
irods::postgres_object
Definition: irods_postgres_object.hpp:20