Public Types | Public Member Functions | Static Public Attributes | List of all members
zorba::OneToOneURIMapper Class Reference

Convenience implementation of a mapper that maps URIs to other single URIs. More...

#include <zorba/uri_resolvers.h>

Inheritance diagram for zorba::OneToOneURIMapper:
Inheritance graph
[legend]
Collaboration diagram for zorba::OneToOneURIMapper:
Collaboration graph
[legend]

Public Types

enum  Kind { COMPONENT, CANDIDATE }
 enum defining legal return values for mapperKind(). More...
 

Public Member Functions

void addMapping (const String &aUri, const String &aMappedUri)
 Add a mapping from a given URI to another URI. More...
 
virtual Kind mapperKind ()
 Declare whether this is a "component" or "candidate" URI mapper. More...
 
virtual void mapURI (const zorba::String aUri, EntityData const *aEntityData, std::vector< zorba::String > &oUris)
 Transform an input URI into a set of output URIs. More...
 
 OneToOneURIMapper (EntityData::Kind aEntityKind, URIMapper::Kind aMapperKind=URIMapper::CANDIDATE)
 Constructor. More...
 

Static Public Attributes

static const zorba::String DENY_ACCESS
 Constant indicating that Zorba should deny access to the given URI. More...
 

Detailed Description

Convenience implementation of a mapper that maps URIs to other single URIs.

Will only map for one specific Entity Kind.

Definition at line 270 of file uri_resolvers.h.

Member Enumeration Documentation

enum zorba::URIMapper::Kind
inherited

enum defining legal return values for mapperKind().

Enumerator
COMPONENT 
CANDIDATE 

Definition at line 224 of file uri_resolvers.h.

Constructor & Destructor Documentation

zorba::OneToOneURIMapper::OneToOneURIMapper ( EntityData::Kind  aEntityKind,
URIMapper::Kind  aMapperKind = URIMapper::CANDIDATE 
)

Constructor.

Specify the Entity Kind you wish to map. Optionally, specify whether this should be a CANDIDATE or COMPONENT mapper; default is CANDIDATE.

Member Function Documentation

void zorba::OneToOneURIMapper::addMapping ( const String aUri,
const String aMappedUri 
)

Add a mapping from a given URI to another URI.

virtual Kind zorba::OneToOneURIMapper::mapperKind ( )
virtual

Declare whether this is a "component" or "candidate" URI mapper.

Zorba supports two different kinds of URI mapping. The first, "component URI mapping", is to allow mapping from an input URI to a set of URIs which, taken together, comprise the entire entity to be resolved. This is currently only supported for module import, where it can be used to load a module which is physically stored in multiple library module files.

"Candidate URI mapping" is to allow mapping from an input URI to a set or URIs which are potential identifiers of the entity being resolved. Each of these URIs will be treated to any subsequent URI mappers, and then treated as URLs and passed in turn to all registered URLResolvers. This type of URI mapping is supported for all uses of URIs in Zorba. It can be used for example to redirect http: URIs to locally-cached file: URLs, or to provide several alternative locations for a given resource.

If you do not override this method, the default is "candidate".

Reimplemented from zorba::URIMapper.

virtual void zorba::OneToOneURIMapper::mapURI ( const zorba::String  aUri,
EntityData const *  aEntityData,
std::vector< zorba::String > &  oUris 
)
virtual

Transform an input URI into a set of output URIs.

The "aEntityData" parameter informs the URIMapper what kind of entity is being referenced by URI. URIMappers may choose to make use of this information to alter their behaviour.

Implementers of this method should provide output URIs by adding them to the oUris output parameter, using the push_back() method. They should not otherwise view or manipulate this vector.

If a URIMapper does not wish to provide any output URIs for the given input URI, they should simply do nothing and return. In this case, Zorba will continue with the original, unmapped URI.

Implements zorba::URIMapper.

Member Data Documentation

const zorba::String zorba::URIMapper::DENY_ACCESS
staticinherited

Constant indicating that Zorba should deny access to the given URI.

If any kind of URIMapper returns this value at any point in the vector of URIs, Zorba will cause the resolution of this URI to be denied with an error. This can be used, for example, to suppress importing particular modules by URI.

Definition at line 262 of file uri_resolvers.h.


The documentation for this class was generated from the following file:
blog comments powered by Disqus