Ejemplo n.º 1
0
void file_cpi_impl::sync_read_link (saga::url & target)
{
    adaptor_data_t AdaptorData(this);
    file_instance_data_t InstanceData (this);
    
    GridFTPConnection * ConnectionHandle = 
    AdaptorData->getConnectionHandleForURL(InstanceData->location_);    
    
	std::string source_entry("");
	
    try 
    {
        source_entry = ConnectionHandle->read_symlink(InstanceData->location_.get_url());
    } 
    catch( curl_file_adaptor::exception const &e)
    {
        error_package ep = curl_file_adaptor
        ::error_default_redirect(e, InstanceData->location_.get_url());
        SAGA_OSSTREAM strm;
        strm << "Could not read (sym-)link [" << InstanceData->location_ << "]. " 
             << ep.error_text;
        SAGA_ADAPTOR_THROW(SAGA_OSSTREAM_GETSTRING(strm), ep.saga_error);  
    }
	
	target = merge_urls(InstanceData->location_.get_url(), source_entry);
}
void dir_cpi_impl::sync_read_link (saga::url & ret, saga::url source)
{
    adaptor_data_t AdaptorData(this);
    directory_instance_data_t InstanceData(this);
    
    this->throw_if_local(InstanceData->location_);
    this->check_if_open ("dir_cpi_impl::sync_read_link", InstanceData->location_);
    
    saga::url url = merge_urls(InstanceData->location_.get_url(), source);  
    
	GridFTPConnection * ConnectionHandle = 
    AdaptorData->getConnectionHandleForURL(url, write_log_, logfile_loc_);    
    
    try 
    {
        ret = ConnectionHandle->read_symlink(url.get_url());
    } 
    catch( globus_gridftp_file_adaptor::exception const &e)
    {
        error_package ep = globus_gridftp_file_adaptor
        ::error_default_redirect(e, url.get_url());
        
		SAGA_OSSTREAM strm;
        strm << "Could not read (sym-)link [" << url << "]. " 
        << ep.error_text;
        SAGA_ADAPTOR_THROW(SAGA_OSSTREAM_GETSTRING(strm), ep.saga_error);
    }
}