///////////////////////////////////////////////////////////////////////////////
  //
  // init() is called whenever the cpi's instance data have changed.  In that
  // case, it re-initializes the proxy directory instance which points into the
  // locally mounted sshfs name spaces, or into the local file system in
  // general. 
  //
  // init() will generally throw if the idata->location points elsewhere.
  // init() is however assumed to be atomic, so it either succeeds, or it fails
  // but then leaves the object state unchanged.  That way, the individual
  // methods don't need to attempt to recover from a failed init.  The only side
  // effect can be an additionally mounted sshfs, which is getting cleaned up by
  // the adaptor d'tor (that cleanup is optional though).
  //
  // The single argument, the url 'save', is used to restore state on failure
  //
  void dir_cpi_impl::init (void)
  {
    adaptor_instance_data_t   adata (this);
    directory_instance_data_t idata (this);

    if ( idata->location_.get_scheme () != "ssh" &&
         idata->location_.get_scheme () != "any" )
    {
      SAGA_LOG_DEBUG ("sshfs can not handle url:");
      SAGA_LOG_DEBUG (idata->location_.get_string ().c_str ());

      std::stringstream ss;
      ss << "Cannot handle URL scheme " << idata->location_.get_scheme ()
         << " - can only handle schemas 'ssh' or 'any'." << std::endl;

      SAGA_ADAPTOR_THROW_NO_CONTEXT (ss.str ().c_str (), 
                                     saga::adaptors::AdaptorDeclined);
    }


    // create a new api object from the changed instance data.
    try
    {
      d_ = saga::filesystem::directory (adata->strip_session (s_),
                                        adata->try_translate (s_, idata->location_), 
                                        idata->mode_);
    }
    catch ( const saga:: exception & e )
    {
      std::stringstream ss;
      ss << "Cannot handle URL: \n\t" << e.what () << "\n";

      SSH_ADAPTOR_RETHROW (e, ss.str ().c_str (), saga::BadParameter);
    }
  }
Example #2
0
  dir_cpi_impl::~dir_cpi_impl (void)
  {
	SAGA_LOG_DEBUG("~dir_cpi_impl()");

	if (is_opened) {
	  is_opened = false;
	} else {
	  SAGA_LOG_DEBUG("this instance was closed.");
	}

  }
Example #3
0
void logical_directory_cpi_impl::sync_close(saga::impl::void_t&, double)
{
//	SAGA_ADAPTOR_THROW ("Not implemented! sync_close", saga::NotImplemented);
	SAGA_LOG_DEBUG("sync_close()");
	check_state();

	if (is_opened) {
	  is_opened = false;
	  SAGA_LOG_CRITICAL("file is closed \n");
	}
	else {
	  SAGA_LOG_DEBUG("this instance was already closed.");
	}
}
Example #4
0
bool irods_dir::is_dir(const std::string& check_url)
{
    SAGA_LOG_DEBUG("irods_file_adaptor::api::irods_dir::is_dir");

    SAGA_LOG_CRITICAL("-------------- check is_dir -----------------\n");

    bool check = false;

    std::string sql_str_coll = "\"SELECT COLL_NAME WHERE COLL_NAME = ";
    sql_str_coll += "'" + check_url + "'";
    sql_str_coll += "\"";

    char* c_sql_coll = const_cast<char*>(sql_str_coll.c_str());
//		std::cout << "c_sql_coll:" << c_sql_coll << std::endl;

    int argc = 2;
    char *argv[2] = {"iquest", c_sql_coll};
//		std::vector <irdEnt_t*> irds_coll;
    std::vector <irdEnt_t> irds_coll;
    irds_coll = icmd.iquest(argc, argv);

    if (irds_coll.size() > 0) {
        check = true;
    }
    else {
        check = false;
    }

    return check;
}
Example #5
0
void logical_directory_cpi_impl::sync_list(std::vector<saga::url>& list,
                                           std::string pattern, int flags)
{
//    SAGA_ADAPTOR_THROW ("Not implemented! sync_list", saga::NotImplemented);
	SAGA_LOG_DEBUG("sync_list()");
	check_state();

	saga::url irods_url_org;
	this->sync_get_cwd(irods_url_org); // to get rid of the /. at the end...
	std::string irods_path = irods_url_org.get_path();

	std::vector <std::string> results;
	std::vector <saga::url>   list_tmp;

	try {
		results  = irdsdir.list(irods_path, pattern, flags);
		list_tmp.insert(list_tmp.begin(), results.begin(), results.end());
		for(unsigned int i=0; i< list_tmp.size(); i++){
			list_tmp[i].set_scheme(irods_url_org.get_scheme());
//			list_tmp[i].set_host(irods_url_org.get_host());
		}
		list = list_tmp;
	}
	catch (boost::system::system_error const& e) {
		SAGA_ADAPTOR_THROW(e.what(), saga::NoSuccess);
	}
}
Example #6
0
saga::off_t irods_dir::get_size(const std::string& check_url)
{
    SAGA_LOG_DEBUG("irods_file_adaptor::api::irods_dir::get_size");

    SAGA_LOG_CRITICAL("-------------- dir, get_size -----------------\n");

    saga::off_t data_size = 0;

    std::string sql_str_coll = "\"SELECT sum(DATA_SIZE) WHERE COLL_NAME = ";
    sql_str_coll += "'" + check_url + "'";
    sql_str_coll += "\"";

    char* c_sql_coll = const_cast<char*>(sql_str_coll.c_str());
    std::cout << "c_sql_data:" << c_sql_coll << std::endl;

    int argc = 2;
    char *argv[2] = {"iquest", c_sql_coll};
//		std::vector <irdEnt_t*> irds_coll;
    std::vector <irdEnt_t> irds_coll;
    irds_coll = icmd.iquest(argc, argv);

    if (irds_coll.size() == 1) {
//			data_size = irds_coll[0]->dataSize;
        data_size = irds_coll[0].dataSize;
    }
    else {
        data_size = 0;
    }

    return data_size;

}
Example #7
0
void irods_dir::meta(const std::string& meta_url,
                     const std::string& meta_cmd, const std::string& meta_opt,
                     const std::string& meta_key, const std::string& meta_val)
{
    SAGA_LOG_DEBUG("irods_file_adaptor::api::irods_file::meta");

    SAGA_LOG_CRITICAL("-------------- col metadata -----------------\n");

    // remove the '/' at the end of the pathname
    std::string col_path = meta_url;
    if (col_path.rfind('/') == col_path.size()-1) {
        col_path.erase(col_path.rfind('/'));
    }

    char* c_meta_url = const_cast<char*>(col_path.c_str());
    char* c_meta_cmd = const_cast<char*>(meta_cmd.c_str());
    char* c_meta_opt = const_cast<char*>(meta_opt.c_str());
    char* c_meta_key = const_cast<char*>(meta_key.c_str());
    char* c_meta_val = const_cast<char*>(meta_val.c_str());
//		std::cout << "c_meta_url=" << c_meta_url << std::endl;
//		std::cout << "c_meta_cmd=" << c_meta_cmd << std::endl;
//		std::cout << "c_meta_opt=" << c_meta_opt << std::endl;
//		std::cout << "c_meta_key=" << c_meta_key << std::endl;
//		std::cout << "c_meta_val=" << c_meta_val << std::endl;

    int argc = 6;
//		char *argv[6] = {"imeta", "ls", "-d", "hoge.txt", test_attr1, value1};
    char *argv[6] = {"imeta", c_meta_cmd, c_meta_opt, c_meta_url, c_meta_key, c_meta_val};
    icmd.imeta(argc, argv);
}
Example #8
0
  ///////////////////////////////////////////////////////////////////////////////
  // throws : BadParameter
  void helper::check_scheme(saga::url& rm, bool local_ok)
  {
    std::string scheme(rm.get_scheme());

    if (scheme == "rns") {
    	std::cout << "RNS good" << std::endl;
    	return;
    }

    if (scheme.empty() || scheme == "file") {
      if (local_ok) {
        SAGA_LOG_DEBUG("local file.");
        return;
      } else {
        SAGA_OSSTREAM strm;
        strm << "Could not initialize file for [" << rm << "]. "
             << "Only any:// and rns:// "
             << "schemes are supported.";
        SAGA_ADAPTOR_THROW_NO_CONTEXT(SAGA_OSSTREAM_GETSTRING(strm), saga::BadParameter);
      }
    }

    //SRA : rns
    if (!(scheme == "irods" || scheme == "any")) {
      SAGA_OSSTREAM strm;
      strm << "Could not initialize file for [" << rm << "]. "
           << "Only any:// and rns:// "
           << "schemes are supported.";
      SAGA_ADAPTOR_THROW_NO_CONTEXT(SAGA_OSSTREAM_GETSTRING(strm), saga::BadParameter);
    }
  }
Example #9
0
///////////////////////////////////////////////////////////////////////////////
// namespace_directory functions
///////////////////////////////////////////////////////////////////////////////
//
void logical_directory_cpi_impl::sync_change_dir(saga::impl::void_t&, saga::url name)
{

//    SAGA_ADAPTOR_THROW ("Not implemented! sync_change_dir", saga::NotImplemented);
	SAGA_LOG_DEBUG("dir, sync_change_dir()");
	check_state();

	saga::url irods_url_org;
	this->sync_get_cwd(irods_url_org); // to get rid of the /. at the end...

	std::string irods_path;
	boost::filesystem::path i_path(name.get_path());
	if (i_path.has_root_path()){
		irods_path = name.get_path();
	}
	else {
		irods_path = irods_url_org.get_path() + "/" + name.get_path();
	}

	try {
//		std::cout<< "irods_path    :" << irods_path << std::endl;
		irdsdir.change_dir(irods_path);
	}
	catch (boost::system::system_error const& e) {
		SAGA_ADAPTOR_THROW(e.what(), saga::NoSuccess);
	}

}
Example #10
0
	bool irods_file::meta_attr_exists(const std::string& meta_url, const std::string& attrName)
	{
		SAGA_LOG_DEBUG("irods_file_adaptor::api::irods_dir::exists");

		SAGA_LOG_CRITICAL("-------------- file metadata attr_exists -----------------\n");

		bool check = false;

		boost::filesystem::path meta_url_org(meta_url);
		std::string meta_name = meta_url_org.leaf();
		std::string meta_url_bpath = meta_url_org.branch_path().string();

		std::string sql_str_data = "\"SELECT META_DATA_ATTR_NAME, META_DATA_ATTR_VALUE WHERE COLL_NAME = ";
		sql_str_data += "'" + meta_url_bpath + "'";
		sql_str_data += " AND DATA_NAME = ";
		sql_str_data += "'" + meta_name + "'";
		sql_str_data += " AND META_DATA_ATTR_NAME = ";
		sql_str_data += "'" + attrName + "'";
		sql_str_data += "\"";

		char* c_sql_data = const_cast<char*>(sql_str_data.c_str());
//		std::cout << "c_sql_data:" << c_sql_data << std::endl;

		int argc = 2;
		char *argv[2] = {"iquest", c_sql_data};
		std::vector <std::string> results;
		std::vector <irdEnt_t> irds_meta;
		irds_meta = icmd.iquest(argc, argv);

		if (irds_meta.size() > 0){
			check = true;
		}

		return check;
	}
Example #11
0
	std::string irods_file::meta_get_val(const std::string& meta_url, const std::string& attrName)
	{
		SAGA_LOG_DEBUG("irods_file_adaptor::api::irods_file::meta");

		SAGA_LOG_CRITICAL("-------------- file metadata get_val -----------------\n");

		boost::filesystem::path meta_url_org(meta_url);
		std::string meta_name = meta_url_org.leaf();
		std::string meta_url_bpath = meta_url_org.branch_path().string();

		std::string sql_str_data = "\"SELECT META_DATA_ATTR_NAME, META_DATA_ATTR_VALUE WHERE COLL_NAME = ";
		sql_str_data += "'" + meta_url_bpath + "'";
		sql_str_data += " AND DATA_NAME = ";
		sql_str_data += "'" + meta_name + "'";
		sql_str_data += " AND META_DATA_ATTR_NAME = ";
		sql_str_data += "'" + attrName + "'";
		sql_str_data += "\"";

		char* c_sql_data = const_cast<char*>(sql_str_data.c_str());
//		std::cout << "c_sql_data:" << c_sql_data << std::endl;

		int argc = 2;
		char *argv[2] = {"iquest", c_sql_data};
		std::vector <std::string> results;
		std::vector <irdEnt_t> irds_meta;
		irds_meta = icmd.iquest(argc, argv);

		std::string val;
		val = irds_meta[0].metaDataVal;
//		std::cout << "val:" << val << std::endl;

		return val;
	}
Example #12
0
void irods_dir::open(const std::string& irods_url, int flags)
{
    SAGA_LOG_DEBUG("irods_file_adaptor::api::irods_dir::open");

    SAGA_LOG_CRITICAL("-------------- create entry (open) -----------------\n");

    // Create an empty file as dummy
    char emp_f[256] = "/tmp/sia-empty-dummy-file";
//		char emp_f[256] = "irods2.4.tgz_0";
    FILE *fp;
    fp = fopen(emp_f, "w");
    fclose(fp);

//		system("ls /tmp");
//		sleep(1);

    char* c_url = const_cast<char*>(irods_url.c_str());
    std::cout << "c_url:" << c_url << std::endl;
    std::cout << "emp_f:" << emp_f << std::endl;

    int argc = 3;
    char *argv[3] = {"iput", emp_f, c_url};
    icmd.iput(argc, argv);

}
Example #13
0
	void irods_file::meta(const std::string& meta_url,
			const std::string& meta_cmd, const std::string& meta_opt,
			const std::string& meta_key, const std::string& meta_val)
	{
		SAGA_LOG_DEBUG("irods_file_adaptor::api::irods_file::meta");

		SAGA_LOG_CRITICAL("-------------- metadata -----------------\n");

		char* c_meta_url = const_cast<char*>(meta_url.c_str());
		char* c_meta_cmd = const_cast<char*>(meta_cmd.c_str());
		char* c_meta_opt = const_cast<char*>(meta_opt.c_str());
		char* c_meta_key = const_cast<char*>(meta_key.c_str());
		char* c_meta_val = const_cast<char*>(meta_val.c_str());
//		std::cout << "c_meta_url=" << c_meta_url << std::endl;
//		std::cout << "c_meta_cmd=" << c_meta_cmd << std::endl;
//		std::cout << "c_meta_opt=" << c_meta_opt << std::endl;
//		std::cout << "c_meta_key=" << c_meta_key << std::endl;
//		std::cout << "c_meta_val=" << c_meta_val << std::endl;

//		SAGA_LOG_CRITICAL("c_meta_url=%s \n", c_meta_url);
//		SAGA_LOG_CRITICAL("c_meta_cmd=%s \n", c_meta_cmd);
//		SAGA_LOG_CRITICAL("c_meta_opt=%s \n", c_meta_opt);
//		SAGA_LOG_CRITICAL("c_meta_key=%s \n", c_meta_key);
//		SAGA_LOG_CRITICAL("c_meta_val=%s \n", c_meta_val);

		int argc = 6;
//		char *argv[6] = {"imeta", "ls", "-d", "hoge.txt", test_attr1, value1};
		char *argv[6] = {"imeta", c_meta_cmd, c_meta_opt, c_meta_url, c_meta_key, c_meta_val};
		icmd.imeta(argc, argv);
	}
Example #14
0
    ///////////////////////////////////////////////////////////////////////////////
    // logical_file functions
    void logical_file_cpi_impl::sync_list_locations(std::vector<saga::url>& locations)
    {

//        SAGA_ADAPTOR_THROW ("Not implemented! ", saga::NotImplemented);
    	SAGA_LOG_DEBUG("file sync_list_locations()");
    	check_state();

    	instance_data   instanceData (this);
        std::string rns_path = instanceData->location_.get_path();

    	std::vector <std::string> results;
    	std::vector <saga::url>   list_tmp;

    	try {
    		results = rns_lfile.list_locations(rns_path);
    		list_tmp.insert(list_tmp.begin(), results.begin(), results.end());
//    		for(unsigned int i=0; i< list_tmp.size(); i++){
//    			list_tmp[i].set_scheme(irods_url_org.get_scheme());
//    		}
    		locations = list_tmp;
    	}
    	catch (boost::system::system_error const& e) {
    		SAGA_ADAPTOR_THROW(e.what(), saga::NoSuccess);
    	}


    }
Example #15
0
void logical_directory_cpi_impl::sync_get_name(saga::url& name)
{
//    SAGA_ADAPTOR_THROW ("Not implemented! sync_get_name", saga::NotImplemented);
	SAGA_LOG_DEBUG("sync_get_name()");
	check_state();

	saga::url u;
    this->sync_get_cwd(u); // to get rid of the /. at the end...

    boost::filesystem::path path(u.get_path());
    std::string path_str(u.get_path());

    if (path.empty()) {
	  SAGA_ADAPTOR_THROW ("path is empty.", saga::NoSuccess);
	}

    if( !path.has_root_path() )
        path = boost::filesystem::path("/"+path_str);

    path_str = path.string();
    std::string::size_type idx = path_str.rfind("/");

    ( idx == 0 ) ? path = boost::filesystem::path(path_str.substr(1, path_str.size()-1)) :
    path = boost::filesystem::path(path_str.substr(idx+1, path_str.size()-1));

    if( path.string().size() == 0 ) path = boost::filesystem::path("/");

    name = path.string();
}
Example #16
0
void logical_directory_cpi_impl::sync_exists(bool& exists, saga::url url)
{
//    SAGA_ADAPTOR_THROW ("Not implemented! sync_exists", saga::NotImplemented);
	SAGA_LOG_DEBUG("sync_exists()");
	check_state();

	saga::url irods_url_org;
	this->sync_get_cwd(irods_url_org); // to get rid of the /. at the end...
	std::string irods_path = irods_url_org.get_path();

	std::string check_path;
	boost::filesystem::path i_path(url.get_path());
	if (i_path.has_root_path()){
		check_path = url.get_path();
	}
	else {
		check_path = irods_url_org.get_path() + "/" + url.get_path();
	}

	// to get rid of the / at the end the check_path
	if (check_path.substr(check_path.size()-1,1) == "/"){
		check_path.erase(check_path.size()-1);
//		std::cout << "check_path.erased:" << check_path << std::endl;
	}

	try {
		exists  = irdsdir.exists(check_path);
                std::string str_buf = "check_path:" + check_path;
                SAGA_LOG_CRITICAL(str_buf.c_str());
	}
	catch (boost::system::system_error const& e) {
		SAGA_ADAPTOR_THROW(e.what(), saga::NoSuccess);
	}
}
Example #17
0
std::vector <std::string>  irods_dir::find_attr(const std::string& meta_url, const std::string& attr_pattern)
{
    SAGA_LOG_DEBUG("irods_file_adaptor::api::irods_dir::find_attr");

    SAGA_LOG_CRITICAL("-------------- coll metadata find_attr -----------------\n");

    // Replace wildcard chars
    std::string attr_pattern_buf0 = boost::regex_replace(attr_pattern, boost::regex("[%_]"), "\\\\$0");
    std::string attr_pattern_buf1 = boost::regex_replace(attr_pattern_buf0, boost::regex("[*]"), "%");
    std::string attr_pattern_sql = boost::regex_replace(attr_pattern_buf1, boost::regex("[?]"), "_");

    std::string sql_str_data = "\"SELECT META_COLL_ATTR_NAME, META_COLL_ATTR_VALUE WHERE COLL_NAME = ";
    sql_str_data += "'" + meta_url + "'";
    sql_str_data += " AND META_COLL_ATTR_NAME like ";
    sql_str_data += "'" + attr_pattern_sql + "'";
    sql_str_data += "\"";

    char* c_sql_data = const_cast<char*>(sql_str_data.c_str());
//		std::cout << "c_sql_data:" << c_sql_data << std::endl;

    int argc = 2;
    char *argv[2] = {"iquest", c_sql_data};
    std::vector <std::string> results;
    std::vector <irdEnt_t> irds_meta;
    irds_meta = icmd.iquest(argc, argv);

    for ( unsigned int i = 0; i < irds_meta.size (); i++ )
    {
        results.push_back(irds_meta[i].metaCollAttr);
    }

    return results;
}
Example #18
0
std::vector <std::string> irods_dir::list(const std::string& irods_url, std::string pattern, int flags)
{
    SAGA_LOG_DEBUG("irods_file_adaptor::api::irods_dir::list");
    SAGA_LOG_CRITICAL("-------------- list entries -----------------\n");
    SAGA_LOG_CRITICAL("-------------- list entries (data) -----------------\n");

    std::string sql_str_data = "\"SELECT DATA_NAME  WHERE COLL_NAME = ";
    sql_str_data += "'" + irods_url + "'";
    sql_str_data += "\"";

    char* c_sql_data = const_cast<char*>(sql_str_data.c_str());
//		std::cout << "c_sql_data:" << c_sql_data << std::endl;

    int argc = 2;
    char *argv[2] = {"iquest", c_sql_data};
    std::vector <std::string> results_data;
//		std::vector <irdEnt_t*> irds_data;
    std::vector <irdEnt_t> irds_data;
    irds_data = icmd.iquest(argc, argv);

    for ( unsigned int i = 0; i < irds_data.size (); i++ )
    {
//			results_data.push_back(irds_data[i]->dataName);
        results_data.push_back(irds_data[i].dataName);
    }


    SAGA_LOG_CRITICAL("-------------- list entries (coll) -----------------\n");

    std::string sql_str_coll = "\"SELECT COLL_NAME  WHERE COLL_NAME like ";
    sql_str_coll += "'" + irods_url + "/%'";
    sql_str_coll += " AND COLL_NAME not like ";
    sql_str_coll += "'" + irods_url + "/%/%'";
    sql_str_coll += "\"";

    char* c_sql_coll = const_cast<char*>(sql_str_coll.c_str());
//		std::cout << "c_sql_coll:" << c_sql_coll << std::endl;

    int argc2 = 2;
    char *argv2[2] = {"iquest", c_sql_coll};
    std::vector <std::string> results_coll;
//		std::vector <irdEnt_t*> irds_coll;
    std::vector <irdEnt_t> irds_coll;
    irds_coll = icmd.iquest(argc2, argv2);

    for ( unsigned int i = 0; i < irds_coll.size (); i++ )
    {
//			boost::filesystem::path i_path(irds_coll[i]->collName);
        boost::filesystem::path i_path(irds_coll[i].collName);
        results_coll.push_back(i_path.leaf());
    }

    std::vector <std::string> results;
    results = results_data;
    results.insert(results.end(), results_coll.begin(), results_coll.end());

    return results;

}
Example #19
0
 logical_file_cpi_impl::~logical_file_cpi_impl (void)
 {
 	if (is_opened) {
 	  is_opened = false;
 	} else {
 	  SAGA_LOG_DEBUG("this instance was closed.");
 	}
 }
Example #20
0
void logical_directory_cpi_impl::sync_is_link(bool& is_link)
{
//    SAGA_ADAPTOR_THROW ("Not implemented! sync_is_link", saga::NotImplemented);
	SAGA_LOG_DEBUG("sync_is_link()");
	check_state();

	is_link = false;
}
Example #21
0
bool irods_dir::is_link(const std::string& check_url)
{
    SAGA_LOG_DEBUG("irods_file_adaptor::api::irods_dir::is_link");

    SAGA_LOG_CRITICAL("-------------- check is_link -----------------\n");

    bool check = false;	// current iRODS v2.2 does not support link.

    return check;
}
Example #22
0
void irods_dir::change_dir(const std::string& irods_url)
{
    SAGA_LOG_DEBUG("irods_file_adaptor::api::irods_dir::change_dir");
    SAGA_LOG_CRITICAL("-------------- change directory -----------------\n");

    char* c_url = const_cast<char*>(irods_url.c_str());

    int argc = 2;
    char *argv[2] = {"icd", c_url};
    icmd.icd(argc, argv);
}
Example #23
0
void irods_dir::remove(const std::string& irods_url, int flags)
{
    SAGA_LOG_DEBUG("irods_file_adaptor::api::irods_dir::remove");
    SAGA_LOG_CRITICAL("-------------- remove file -----------------\n");

    char* c_url = const_cast<char*>(irods_url.c_str());

    int argc = 3;
    char *argv[3] = {"irm", "-rf", c_url};
    icmd.irm(argc, argv);
}
Example #24
0
bool irods_dir::exists(const std::string& check_url)
{
    SAGA_LOG_DEBUG("irods_file_adaptor::api::irods_dir::exists");

    SAGA_LOG_CRITICAL("-------------- check exists -----------------\n");
    SAGA_LOG_CRITICAL("-------------- check exists (data) -----------------\n");

    bool check = false;

    boost::filesystem::path check_url_org(check_url);
    std::string check_name = check_url_org.leaf();
    std::string check_url_bpath = check_url_org.branch_path().string();

    std::string sql_str_data = "\"SELECT DATA_NAME, COLL_NAME WHERE COLL_NAME = ";
    sql_str_data += "'" + check_url_bpath + "'";
    sql_str_data += " AND DATA_NAME = ";
    sql_str_data += "'" + check_name + "'";
    sql_str_data += "\"";

    char* c_sql_data = const_cast<char*>(sql_str_data.c_str());
//		std::cout << "c_sql_data:" << c_sql_data << std::endl;

    int argc = 2;
    char *argv[2] = {"iquest", c_sql_data};
//		std::vector <irdEnt_t*> irds_data;
    std::vector <irdEnt_t> irds_data;
    irds_data = icmd.iquest(argc, argv);

    if (irds_data.size() > 0) {
        check = true;
    }

    SAGA_LOG_CRITICAL("-------------- check exists (coll) -----------------\n");

    std::string sql_str_coll = "\"SELECT COLL_NAME WHERE COLL_NAME = ";
    sql_str_coll += "'" + check_url + "'";
    sql_str_coll += "\"";

    char* c_sql_coll = const_cast<char*>(sql_str_coll.c_str());
//		std::cout << "c_sql_coll:" << c_sql_coll << std::endl;

    int argc2 = 2;
    char *argv2[2] = {"iquest", c_sql_coll};
//		std::vector <irdEnt_t*> irds_coll;
    std::vector <irdEnt_t> irds_coll;
    irds_coll = icmd.iquest(argc2, argv2);

    if (irds_coll.size() > 0) {
        check = true;
    }

    return check;
}
Example #25
0
void irods_dir::move(const std::string& irods_url_src,
                     const std::string& irods_url_tar, int flags)
{
    SAGA_LOG_DEBUG("irods_file_adaptor::api::irods_dir::move");
    SAGA_LOG_CRITICAL("-------------- move file -----------------\n");

    char* src_c_url = const_cast<char*>(irods_url_src.c_str());
    char* tar_c_url = const_cast<char*>(irods_url_tar.c_str());

    int argc = 3;
    char *argv[3] = {"imv", src_c_url, tar_c_url};
    icmd.imv(argc, argv);
}
Example #26
0
void irods_dir::open_dir(const std::string& irods_url, int flags)
{
    SAGA_LOG_DEBUG("irods_file_adaptor::api::irods_dir::open_dir");

    SAGA_LOG_CRITICAL("-------------- create directory (open_dir) -----------------\n");

    char* c_url = const_cast<char*>(irods_url.c_str());

    int argc = 3;
    char *argv[3] = {"imkdir", "-p", c_url};
    icmd.imkdir(argc, argv);

}
        ~log_processor()
        {
            SAGA_LOG_DEBUG(("Condor adaptor: Closing log "
                + filename_).c_str());

        #if BOOST_VERSION >= 103500
            thread_.interrupt();
        #else
            interrupt_thread_ = true;
        #endif

            thread_.join();
        }
Example #28
0
void irods_dir::copy(const std::string& irods_url_src,
                     const std::string& irods_url_tar, int flags)
{
    SAGA_LOG_DEBUG("irods_file_adaptor::api::irods_dir::copy");
    SAGA_LOG_CRITICAL("-------------- copy file -----------------\n");

    char* src_c_url = const_cast<char*>(irods_url_src.c_str());
    char* tar_c_url = const_cast<char*>(irods_url_tar.c_str());

    int argc = 4;
    char *argv[4] = {"icp", "-r", src_c_url, tar_c_url};
    icmd.icp(argc, argv);
}
Example #29
0
void logical_directory_cpi_impl::sync_get_url(saga::url& url)
{

//    SAGA_ADAPTOR_THROW ("Not implemented! sync_get_url", saga::NotImplemented);
    SAGA_LOG_DEBUG("sync_get_url()");
    check_state();

	adaptor_data_t  adaptorData(this);
	instance_data   instanceData (this);

	saga::url lfn_url(instanceData->location_.get_url());
    url = lfn_url;
}
Example #30
0
std::string irods_dir::get_entry(const std::string& irods_url, std::size_t entry)
{
    SAGA_LOG_DEBUG("irods_file_adaptor::api::irods_dir::get_num_entries");

    SAGA_LOG_CRITICAL("-------------- get entry -----------------\n");

    std::string pattern;
    int flags; //dummy

    std::vector <std::string> entry_list;
    entry_list = this->list(irods_url, pattern, flags);

    return entry_list[entry];
}