7 #include <boost/lexical_cast.hpp>
8 #include <boost/algorithm/string.hpp>
17 std::string prop_name;
35 err = _resc->get_property<
rodsLong_t >( prop_name,
id );
37 std::stringstream msg;
38 msg <<
"failed to get property [";
47 std::string freespace;
48 err = _resc->get_property< std::string >( prop_name, freespace );
50 std::stringstream msg;
51 msg <<
"failed to get property [";
61 err = _resc->get_property<
long >( prop_name, quota );
63 std::stringstream msg;
64 msg <<
"failed to get property [";
74 err = _resc->get_property< std::string >( prop_name, zone );
76 std::stringstream msg;
77 msg <<
"failed to get property [";
87 err = _resc->get_property< std::string >( prop_name,
name );
89 std::stringstream msg;
90 msg <<
"failed to get property [";
100 err = _resc->get_property< std::string >( prop_name, location );
102 std::stringstream msg;
103 msg <<
"failed to get property [";
113 err = _resc->get_property< std::string >( prop_name,
type );
115 std::stringstream msg;
116 msg <<
"failed to get property [";
126 err = _resc->get_property< std::string >( prop_name, rclass );
128 std::stringstream msg;
129 msg <<
"failed to get property";
139 err = _resc->get_property< std::string >( prop_name, path );
141 std::stringstream msg;
142 msg <<
"failed to get property";
152 err = _resc->get_property< std::string >( prop_name, info );
154 std::stringstream msg;
155 msg <<
"failed to get property";
164 std::string comments;
165 err = _resc->get_property< std::string >( prop_name, comments );
167 std::stringstream msg;
168 msg <<
"failed to get property";
178 err = _resc->get_property< std::string >( prop_name, create );
180 std::stringstream msg;
181 msg <<
"failed to get property [";
191 err = _resc->get_property< std::string >( prop_name, modify );
193 std::stringstream msg;
194 msg <<
"failed to get property [";
204 err = _resc->get_property<
int >( prop_name,
status );
206 std::stringstream msg;
207 msg <<
"failed to get property [";
238 res =
parser.set_string( _resc_hier );
240 std::stringstream msg;
242 msg <<
" - Failed to parse hierarchy string \"" << _resc_hier <<
"\"";
243 return PASSMSG( msg.str(), res );
247 for ( ; res.
ok() && it !=
parser.end(); ++it ) {
268 if ( resc_err.
ok() ) {
270 std::stringstream msg;
279 std::stringstream msg;
280 msg <<
"Failed to get status for resource [";
284 return PASSMSG( msg.str(), resc_err );
299 const std::string& _resc_list,
300 const std::string& _option,
302 std::string& _resc_name ) {
305 if ( _resc_list.empty() &&
NULL == _cond_input ) {
311 std::string cond_input_resc;
316 if (
"null" != _resc_list &&
317 "forced" == _option &&
321 else if ( _cond_input ) {
331 cond_input_resc =
name;
347 std::string default_resc_name;
349 std::vector< std::string >::iterator itr =
resources.begin();
350 for ( ; itr !=
resources.end(); ++itr ) {
352 if ( resc_err.
ok() ) {
354 default_resc_name = *itr;
364 if (
"preferred" == _option && !cond_input_resc.empty() ) {
368 if ( resc_err.
ok() ) {
371 _resc_name = cond_input_resc;
378 _resc_name = default_resc_name;
386 if ( resc_err.
ok() ) {
389 _resc_name = cond_input_resc;
397 if ( resc_err.
ok() ) {
398 _resc_name = default_resc_name;
403 std::stringstream msg;
404 msg <<
"set_default_resource - failed to find default resource for list [";
406 msg <<
"] and option [";
409 return PASSMSG( msg.str(), resc_err );
419 std::stringstream msg;
420 msg <<
"should not reach here for list [";
422 msg <<
"] and option [";
433 const std::string& _resc_name,
435 std::string& _out ) {
436 if ( _resc_name.empty() ) {
440 _out = std::string(
name );
446 _out = std::string(
name );
452 _out = std::string(
name );
481 return PASSMSG(
"failed to resolve resource", err );
489 return PASSMSG(
"failed to get resource property", err );
503 if ( _resc_hier.empty() ) {
509 std::string resc_name;
516 if ( res_err.
ok() ) {
526 if ( info_err.
ok() ) {
531 return PASS( info_err );
537 return PASS( res_err );
548 error get_resc_grp_info( std::string _name, rescGrpInfo_t& _info ) {
549 if ( _name.empty() ) {
555 if ( res_err.ok() ) {
564 error info_err = resource_to_resc_grp_info( _info, resc );
565 if ( info_err.ok() ) {
569 return PASS( info_err );
574 return PASS( res_err );
582 const std::string& _hier_str,
588 if ( _hier_str.empty() ) {
603 ret = get_resource_property< rodsServerHost_t* >( resc_id,
RESOURCE_HOST,
host );
605 std::stringstream msg;
606 msg <<
"get_host_for_hier_string - failed to get host property for [";
609 return PASSMSG( msg.str(), ret );
614 std::stringstream msg;
616 msg <<
" - Host from hierarchy string: \"";
625 _local_flag =
host->localFlag;
634 const std::string& _hier,
635 std::string& _loc ) {
642 std::string location;
643 ret = get_resource_property< std::string >( resc_id,
RESOURCE_LOCATION, location );
646 return PASSMSG(
"get_loc_for_hier_string - failed in get_resource_property", ret );
659 const std::string& _hier,
660 std::string& _rtn_vault_path ) {
667 ret = get_resource_property<std::string>( resc_id,
RESOURCE_PATH, _rtn_vault_path );
678 const std::string& _hier,
679 std::string& _resc_type ) {
686 ret = get_resource_property<std::string>( resc_id,
RESOURCE_TYPE, _resc_type );