H3D::URNResolver Class Reference

The URNResolver resolves URNs (Uniform Resource Name) into paths. More...

#include <URNResolver.h>

List of all members.

Public Member Functions

 URNResolver (const string &_config_file="")
 Constructor.
void loadConfigFile (const string &config_file)
 Loads a config file and adds its resolution rules to the URNResolver.
void addURNResolveRule (const string &name_space, const string &prefix, const string &path)
 Addes a new urn resolve rule to the URN resolver.
string resolveURN (const string &urn)
 Given a URN name the resolved path is returned.

Protected Types

typedef map< string, string,
lessthan_string > 
URNmap

Protected Member Functions

bool nonCaseEquals (const string &s1, const string &s2)
bool hasPrefix (const string &s, const string &prefix)
string toLower (const string &s)

Protected Attributes

URNmap urn_prefix_map
string config_file
bool initialised

Static Protected Attributes

static const unsigned int MAX_LINE_SIZE = 1024


Detailed Description

The URNResolver resolves URNs (Uniform Resource Name) into paths.

A URN allows an abstract resolution mechanism to be invoked to locate a resource (IETF RFC 2141 http://www.ietf.org/rfc/rfc2141.txt?number=2141). This allows a resource to be located on the local machine or a platform dependent resource to be located using the URN along with platform-specific identifiers.

A URN is specified on the following form urn:namespace:namespace_string

The namespace identifies how the namespace_string should be interpreted.

The URNResolver has a map from urn prefixes to paths that it will use to resolve the urn. Normally the rules resides in a config file that are given to the URNResolver constructor. The rules are on the form

urn:web3d: c: urn:h3d:textures http://www.h3d.org/textures

This means that e.g. urn:h3d:textures/concrete.jpg will be resolved to http://www.h3d.org/textures/concrete.jpg/


Constructor & Destructor Documentation

H3D::URNResolver::URNResolver const string &  _config_file = ""  )  [inline]
 

Constructor.

The config_file specifies a file containing URN lookup rules.


Member Function Documentation

void H3D::URNResolver::addURNResolveRule const string &  name_space,
const string &  prefix,
const string &  path
[inline]
 

Addes a new urn resolve rule to the URN resolver.

Parameters:
name_space The urn name space of the rule
prefix The prefix of the namespace string to match
path The path to replace the urn:name_space:prefix with if match.

string URNResolver::resolveURN const string &  urn  ) 
 

Given a URN name the resolved path is returned.

If no resolution could be found using the rules, urn is returned.


Generated on Thu Aug 24 12:40:16 2006 for H3D API by  doxygen 1.4.5