Back to index

nordugrid-arc-nox  1.1.0~rc6
Classes | Public Member Functions | Private Attributes | Static Private Attributes
Arc::URLMap Class Reference

#include <URLMap.h>

Inheritance diagram for Arc::URLMap:
Inheritance graph
[legend]
Collaboration diagram for Arc::URLMap:
Collaboration graph
[legend]

List of all members.

Classes

class  map_entry

Public Member Functions

 URLMap ()
 ~URLMap ()
bool map (URL &url) const
bool local (const URL &url) const
void add (const URL &templ, const URL &repl, const URL &accs=URL())

Private Attributes

std::list< map_entryentries

Static Private Attributes

static Logger logger

Detailed Description

Definition at line 13 of file URLMap.h.


Constructor & Destructor Documentation

Definition at line 19 of file URLMap.cpp.

{}

Definition at line 21 of file URLMap.cpp.

{}

Member Function Documentation

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

Definition at line 59 of file URLMap.cpp.

                                                                     {
    entries.push_back(map_entry(templ, repl, accs));
  }

Here is the caller graph for this function:

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

Definition at line 51 of file URLMap.cpp.

                                         {
    for (std::list<map_entry>::const_iterator i = entries.begin();
         i != entries.end(); ++i)
      if (url.str().substr(0, i->initial.str().length()) == i->initial.str())
        return true;
    return false;
  }

Here is the call graph for this function:

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

Definition at line 23 of file URLMap.cpp.

                                 {
    for (std::list<map_entry>::const_iterator i = entries.begin();
         i != entries.end(); ++i)
      if (url.str().substr(0, i->initial.str().length()) == i->initial.str()) {
        std::string tmp_url = url.str();
        tmp_url.replace(0, i->initial.str().length(), i->replacement.str());
        URL newurl = tmp_url;
        /* must return semi-valid url */
        if (newurl.Protocol() == "file") { /* local file - check permissions */
          int h = open(newurl.Path().c_str(), O_RDONLY);
          if (h == -1) {
            logger.msg(ERROR, "file %s is not accessible", newurl.Path());
            return false;
          }
          close(h);
          if (i->access) { /* how it should be accessed on nodes */
            tmp_url.replace(0, i->replacement.str().length(), i->access.str());
            newurl = tmp_url;
            newurl.ChangeProtocol("link");
          }
        }
        logger.msg(INFO, "Mapping %s to %s", url.str(), newurl.str());
        url = newurl;
        return true;
      }
    return false;
  }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

std::list<map_entry> Arc::URLMap::entries [private]

Definition at line 26 of file URLMap.h.

Logger Arc::URLMap::logger [static, private]

Definition at line 27 of file URLMap.h.


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