ARC SDK
Data Structures | Public Member Functions
Arc::URLMap Class Reference

URLMap allows mapping certain patterns of URLs to other URLs. More...

#include <arc/data/URLMap.h>

Public Member Functions

 URLMap ()
 Construct an empty URLMap. More...
 
bool map (URL &url) const
 Map a URL if possible. More...
 
bool local (const URL &url) const
 Check if a mapping exists for a URL. More...
 
void add (const URL &templ, const URL &repl, const URL &accs=URL())
 Add an entry to the URLMap. More...
 
 operator bool () const
 Returns true if the URLMap is not empty. More...
 
bool operator! () const
 Returns true if the URLMap is empty. More...
 

Detailed Description

URLMap allows mapping certain patterns of URLs to other URLs.

A URLMap can be used if certain URLs can be more efficiently accessed by other means on a certain site. For example a GridFTP storage element may be mounted as a local file system and so a map can be made from a gsiftp:// URL to a local file path.

Constructor & Destructor Documentation

◆ URLMap()

Arc::URLMap::URLMap ( )

Construct an empty URLMap.

Member Function Documentation

◆ add()

void Arc::URLMap::add ( const URL templ,
const URL repl,
const URL accs = URL() 
)

Add an entry to the URLMap.

All URLs matching templ will have the templ part replaced by repl.

Parameters
templtemplate to replace, for example gsiftp://se.org/files
replreplacement for template, for example /export/grid/files
accsreplacement path if it differs in the place the file will actually be accessed (e.g. on worker nodes), for example /mount/grid/files

◆ local()

bool Arc::URLMap::local ( const URL url) const

Check if a mapping exists for a URL.

Checks to see if a URL will be mapped but does not do the mapping.

Parameters
urlURL to check
Returns
true if a mapping exists for this URL

◆ map()

bool Arc::URLMap::map ( URL url) const

Map a URL if possible.

If the given URL matches any template it will be changed to the mapped URL. Additionally, if the mapped URL is a local file, a permission check is done by attempting to open the file. If a different access path is specified for this URL the URL will be changed to link://accesspath. To check if a URL will be mapped without changing it local() can be used.

Parameters
urlURL to check
Returns
true if the URL was mapped to a new URL, false if it was not mapped or an error occurred during mapping

◆ operator bool()

Arc::URLMap::operator bool ( ) const
inline

Returns true if the URLMap is not empty.

◆ operator!()

bool Arc::URLMap::operator! ( void  ) const
inline

Returns true if the URLMap is empty.

Python interface deviation
Method is unavailable in Python interface

The documentation for this class was generated from the following file: