00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "rsApiHandler.h"
00014 #include "objMetaOpr.h"
00015 #include "resource.h"
00016 #include "examplesMS.h"
00017
00018
00019
00020 #include "eirods_resource_manager.h"
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 int
00031 msiHello( msParam_t *name, msParam_t *outParam,
00032 ruleExecInfo_t *rei )
00033 {
00034 char *tmpPtr;
00035 char outStr[MAX_NAME_LEN];
00036
00037 RE_TEST_MACRO( " Calling msiHello" );
00038
00039 tmpPtr = parseMspForStr (name);
00040
00041 if (tmpPtr == NULL) {
00042 rodsLog (LOG_ERROR, "msiHello: missing name input");
00043 rei->status = USER__NULL_INPUT_ERR;
00044 return USER__NULL_INPUT_ERR;
00045 }
00046
00047 snprintf (outStr, MAX_NAME_LEN, "Hello world from %s", tmpPtr);
00048
00049 fillStrInMsParam (outParam, outStr);
00050
00051 rei->status = 0;
00052 return 0;
00053 }
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064 int
00065 msiGetRescAddr( msParam_t *rescName, msParam_t *outAddress,
00066 ruleExecInfo_t *rei )
00067 {
00068 char *tmpPtr;
00069
00070 RE_TEST_MACRO( " Calling msiGetRescAddr" );
00071
00072 tmpPtr = parseMspForStr (rescName);
00073
00074 if (tmpPtr == NULL) {
00075 rodsLog (LOG_ERROR, "msiGetRescAddr: missing name input");
00076 rei->status = USER__NULL_INPUT_ERR;
00077 return USER__NULL_INPUT_ERR;
00078 }
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088 eirods::resource_ptr resc;
00089 eirods::error err = resc_mgr.resolve( tmpPtr, resc );
00090 if( !err.ok() ) {
00091 std::stringstream msg;
00092 msg << "failed to resolve resource [";
00093 msg << tmpPtr;
00094 msg << "]";
00095 eirods::log( PASSMSG( msg.str(), err ) );
00096 return err.code();
00097 }
00098
00099 std::string location;
00100 err = resc->get_property< std::string >( eirods::RESOURCE_LOCATION, location );
00101 if( !err.ok() ) {
00102 std::stringstream msg;
00103 msg << "failed to get property [location]";
00104 eirods::log( PASSMSG( msg.str(), err ) );
00105 return err.code();
00106 }
00107
00108 fillStrInMsParam (outAddress, const_cast<char*>( location.c_str() ) );
00109
00110 rei->status = 0;
00111 return 0;
00112 }
00113