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_generic_database_object.cpp
Go to the documentation of this file.
1 // =-=-=-=-=-=-=-
2 // irods includes
5 
6 namespace irods {
7 
8 // =-=-=-=-=-=-=-
9 // public - ctor
10  generic_database_object::generic_database_object(const std::string &_type) : type_(_type) {
11 
12  } // ctor
13 
14 // =-=-=-=-=-=-=-
15 // public - cctor
17  const generic_database_object& _rhs ) :
18  database_object( _rhs ), type_(_rhs.type_) {
19 
20  } // cctor
21 
22 // =-=-=-=-=-=-=-
23 // public - dtor
25  } // dtor
26 
27 // =-=-=-=-=-=-=-
28 // public - assignment operator
30  const generic_database_object& ) {
31 
32  return *this;
33 
34  } // operator=
35 
36 // =-=-=-=-=-=-=-
37 // public - equivalence operator
39  const generic_database_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 << "generic_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 generic resource
63  database_ptr db_ptr;
64  error ret = db_mgr.resolve( type_, 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(
72  type_,
73  type_,
74  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::generic_database_object::get_re_vars
virtual error get_re_vars(rule_engine_vars_t &)
Definition: irods_generic_database_object.cpp:101
irods::generic_database_object::type_
std::string type_
Definition: irods_generic_database_object.hpp:55
PASS
#define PASS(prev_error_)
Definition: irods_error.hpp:118
irods::database_manager::resolve
error resolve(std::string, database_ptr &)
Definition: irods_database_manager.cpp:32
irods::generic_database_object::operator=
virtual generic_database_object & operator=(const generic_database_object &)
Definition: irods_generic_database_object.cpp:29
SYS_INVALID_INPUT_PARAM
@ SYS_INVALID_INPUT_PARAM
Definition: rodsErrorTable.h:195
SUCCESS
#define SUCCESS()
Definition: irods_error.hpp:121
irods::generic_database_object::generic_database_object
generic_database_object(const std::string &)
Definition: irods_generic_database_object.cpp:10
irods::db_mgr
database_manager db_mgr
Definition: irods_database_manager.cpp:9
irods_database_manager.hpp
irods::generic_database_object::resolve
virtual error resolve(const std::string &, plugin_ptr &)
Definition: irods_generic_database_object.cpp:46
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
irods::generic_database_object
Definition: irods_generic_database_object.hpp:17
irods_generic_database_object.hpp
irods::generic_database_object::~generic_database_object
virtual ~generic_database_object()
Definition: irods_generic_database_object.cpp:24
irods::generic_database_object::operator==
virtual bool operator==(const generic_database_object &_rhs) const
Definition: irods_generic_database_object.cpp:38
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::error::ok
bool ok()
Definition: irods_error.cpp:258
irods::rule_engine_vars_t
std::map< std::string, std::string > rule_engine_vars_t
Definition: irods_first_class_object.hpp:20