← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/feature-thesaurus-uriresolver into lp:zorba

 

Chris Hillery has proposed merging lp:~zorba-coders/zorba/feature-thesaurus-uriresolver into lp:zorba.

Requested reviews:
  Matthias Brantner (matthias-brantner)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/feature-thesaurus-uriresolver/+merge/80979
-- 
https://code.launchpad.net/~zorba-coders/zorba/feature-thesaurus-uriresolver/+merge/80979
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'bin/zorbacmd.cpp'
--- bin/zorbacmd.cpp	2011-07-11 11:12:23 +0000
+++ bin/zorbacmd.cpp	2011-11-02 06:07:27 +0000
@@ -70,7 +70,7 @@
 
 #ifndef ZORBA_NO_FULL_TEXT
 OneToOneURIMapper theStopWordsMapper(EntityData::STOP_WORDS);
-OneToOneURIMapper theThesaurusMapper(EntityData::THESAURUS, URIMapper::COMPONENT);
+OneToOneURIMapper theThesaurusMapper(EntityData::THESAURUS);
 #endif
 
 bool

=== modified file 'doc/zorba/ft_thesaurus.dox'
--- doc/zorba/ft_thesaurus.dox	2011-08-31 13:17:59 +0000
+++ doc/zorba/ft_thesaurus.dox	2011-11-02 06:07:27 +0000
@@ -438,7 +438,7 @@
 The \c Thesaurus class is:
 
 \code
-class Thesaurus {
+class Thesaurus : public Resource {
 public:
   typedef /* implementation-defined */ ptr;
   typedef /* implementation-defined */ range_type;
@@ -446,12 +446,15 @@
   class iterator {
   public:
     typedef /* implementation-defined */ ptr;
+    virtual void destroy() const = 0;
     virtual bool next( String *synonym ) = 0;
   protected:
     virtual ~iterator();
   };
 
   virtual iterator::ptr lookup( String const &phrase, String const &relationship, range_type at_least, range_type at_most ) const = 0;
+
+  virtual void destroy() const = 0;     // interited from Resource
 protected:
   virtual ~Thesaurus();
 };
@@ -566,51 +569,49 @@
 A real thesaurus would load a large number of synonyms,
 of course.
 
-\subsection ft_class_thesaurus_provider The ThesaurusProvider Class
+\subsection ft_class_thesaurus_resolver A Thesaurus URL Resolver Class
 
 In addition to a \c Thesaurus,
-you must also implement a \c ThesaurusProvider
-that, given a language, provides a \c Thesaurus for that language:
-
-\code
-class ThesaurusProvider {
-public:
-  virtual ~ThesaurusProvider();
-  virtual Thesaurus::ptr getThesaurus( String const &uri, locale::iso639_1::type lang ) const = 0;
-};
-\endcode
-
-A simple \c ThesaurusProvider for our simple thesaurus can be implemented as:
-
-\code
-class MyThesaurusProvider : public ThesaurusProvider {
-public:
-  ThesaurusProvider( String const &uri ) : uri_( uri ) { }
-  Thesaurus::ptr getThesaurus( String const &uri, locale::iso639_1::type lang ) const;
+you must also implement a "thesaurus resolver" class
+that,
+given a URL and a language,
+provides a \c Thesaurus for that language.
+A simple \c ThesaurusURLResolver
+for our simple thesaurus can be implemented as:
+
+\code
+class ThesaurusURLResolver : public URLResolver {
+public:
+  ThesaurusURLResolver( String const &url ) : url_( url ) { }
+  Resource* resolveURL( String const &url, EntityData const* ); // inherited
 private:
-  String const uri_;
+  String const url_;
 };
 
-Thesaurus::ptr
-MyThesaurusProvider::getThesaurus( String const &uri, locale::iso639_1::type lang ) const {
+Resource*
+ThesaurusURLResolver::resolveURL( String const &url, EntityData const *data ) const {
+  ThesaurusEntityData const *const t_data = dynamic_cast<ThesaurusEntityData const*>( data );
+  assert( t_data );
   static MyThesaurus thesaurus;
-  Thesaurus::ptr result;
-  if ( uri == uri_ )
-    switch ( lang ) {
+  if ( url == url_ )
+    switch ( t_data->getLanguage() ) {
       case locale::iso639_1::en:
       case locale::iso639_1::unknown:
         //
-        // Here, we could test to ensure that the language of our thesaurus
-        // matches the language sought, but in our case, we want our thesaurus
-        // to be used for all languages since "foo" and "foobar" are universal.
+        // Here, we could test to ensure that the language of our thesaurus matches the
+        // language sought, but in our case, we want our thesaurus to be used for all
+        // languages since "foo" and "foobar" are universal.
         //
       default:
-        result.reset( &thesaurus );
+        return &thesaurus;
     }
-  return std::move( result );
+  return 0;
 }
 \endcode
 
+For more on \c URLResolver, see
+\ref uriresolvers.
+
 \subsection ft_thesaurus_enable Using Your Thesaurus
 
 To enable your thesaurus to be used,
@@ -618,8 +619,8 @@
 
 \code
 StaticContext_t sctx = zorba->createStaticContext();
-MyThesaurusProvider provider( "http://www.example.com"; );
-sctx->addThesaurusProvider( &provider );
+ThesaurusURLResolver resolver( "http://www.example.com"; );
+sctx->registerURLResolver( &resolver );
 \endcode
 
 You can then perform a query using your thesaurus:

=== modified file 'include/zorba/static_context.h'
--- include/zorba/static_context.h	2011-08-31 13:17:59 +0000
+++ include/zorba/static_context.h	2011-11-02 06:07:27 +0000
@@ -384,14 +384,6 @@
       virtual TypeIdentifier_t
       getCollectionType(const String& aCollectionUri) const = 0;
 
-#ifndef ZORBA_NO_FULL_TEXT
-      virtual void
-      addThesaurusProvider( ThesaurusProvider const* ) = 0;
-
-      virtual void
-      removeThesaurusProvider( ThesaurusProvider const* ) = 0;
-#endif /* ZORBA_NO_FULL_TEXT */
-
       /** \brief Check if a function with the given name and arity are registered in the context.
        */
       virtual bool

=== modified file 'include/zorba/thesaurus.h'
--- include/zorba/thesaurus.h	2011-09-07 20:08:18 +0000
+++ include/zorba/thesaurus.h	2011-11-02 06:07:27 +0000
@@ -24,6 +24,7 @@
 #include <zorba/internal/unique_ptr.h>
 #include <zorba/internal/ztd.h>
 #include <zorba/locale.h>
+#include <zorba/uri_resolvers.h>
 #include <zorba/zorba_string.h>
 
 namespace zorba {
@@ -31,9 +32,23 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 /**
- * A %Thesaurus is an abstract base class for thesaurus implementations.
- */
-class ZORBA_DLL_PUBLIC Thesaurus {
+ * Contains additional data for URIMappers and URLResolvers
+ * when mapping/resolving a Thesaurus URI.
+ */
+class ZORBA_DLL_PUBLIC ThesaurusEntityData : public EntityData {
+public:
+  /**
+   * Gets the language for which a thesaurus is being requested.
+   *
+   * @return said language.
+   */
+  virtual locale::iso639_1::type getLanguage() const = 0;
+};
+
+/**
+ * A %Thesaurus is-a Resource for thesaurus implementations.
+ */
+class ZORBA_DLL_PUBLIC Thesaurus : public Resource {
 public:
   typedef std::unique_ptr<Thesaurus,internal::ztd::destroy_delete<Thesaurus> >
           ptr;
@@ -64,20 +79,20 @@
      * @return Returns \c true only if there is a next synonym.
      */
     virtual bool next( String *synonym ) = 0;
+
   protected:
-    virtual ~iterator() {}
+    virtual ~iterator() { }
   };
 
   /**
    * Destroys this %Thesaurus.
    * This function is called by Zorba when the %Thesaurus is no longer needed.
    *
-   * If your ThesaurusProvider dynamically allocates %Thesaurus objects, then
-   * the implementation can simply be (and usually is) <code>delete
-   * this</code>.
+   * If your URLResolver dynamically allocates %Thesaurus objects, then the
+   * implementation can simply be (and usually is) <code>delete this</code>.
    *
-   * If your ThesaurusProvider returns a pointer to a static %Thesaurus object,
-   * then the implementation should do nothing.
+   * If your URLResolver returns a pointer to a static %Thesaurus object, then
+   * the implementation should do nothing.
    */
   virtual void destroy() const = 0;
 
@@ -102,25 +117,6 @@
   virtual ~Thesaurus();
 };
 
-/**
- * A %ThesaurusProvider, given an language, provies a thesaurus for it.
- */
-class ZORBA_DLL_PUBLIC ThesaurusProvider {
-public:
-  virtual ~ThesaurusProvider();
-
-  /**
-   * Gets a Thesaurus for the given language.
-   *
-   * @param uri The URI provided in the query for the thesaurus.
-   * @param lang The language to get a Thesaurus for.
-   * @return The relevant Thesaurus or \c NULL if no thesaurus for the given
-   * language is available.
-   */
-  virtual Thesaurus::ptr
-  getThesaurus( String const &uri, locale::iso639_1::type lang ) const = 0;
-};
-
 ///////////////////////////////////////////////////////////////////////////////
 
 } // namespace zorba

=== modified file 'include/zorba/uri_resolvers.h'
--- include/zorba/uri_resolvers.h	2011-08-17 15:48:35 +0000
+++ include/zorba/uri_resolvers.h	2011-11-02 06:07:27 +0000
@@ -25,6 +25,9 @@
 #include <zorba/item.h>
 #include <zorba/zorba_string.h>
 #include <zorba/streams.h>
+#include <zorba/locale.h>
+#include <zorba/internal/unique_ptr.h>
+#include <zorba/internal/ztd.h>
 
 /**
  * @file uri_resolvers.h
@@ -47,7 +50,19 @@
 class ZORBA_DLL_PUBLIC Resource
 {
 public:
+  typedef std::unique_ptr<Resource,internal::ztd::destroy_delete<Resource> > ptr;
+
   virtual ~Resource() = 0;
+
+  /**
+   * @brief Destroy/clean up this Resource.
+   *
+   * Zorba will call this method when it no longer needs the Resource. It
+   * is the responsibility of subclasses to clean up appropriate when
+   * this method is called, including calling "delete this" if the Resource
+   * was allocated with "new".
+   */
+  virtual void destroy() const = 0;
 };
 
 /**
@@ -90,9 +105,8 @@
  * and URLResolvers when mapping/resolving a URI.
  *
  * This base class specifies the kind of entity for which this URI is being
- * resolved - for instance, a schema URI or a module URI. In the future,
- * there may be kind-specific subclasses containing additional information;
- * as yet however there are none.
+ * resolved - for instance, a schema URI or a module URI. Subclasses of
+ * this class will provide additional data for specific kinds of entities.
  */
 class ZORBA_DLL_PUBLIC EntityData
 {
@@ -254,6 +268,7 @@
    * Constructor. Specify the Entity Kind you wish to map. Optionally,
    * specify whether this should be a CANDIDATE or COMPONENT mapper;
    * default is CANDIDATE.
+   * QQQ COMPONENT is no longer used; delete?
    */
   OneToOneURIMapper(EntityData::Kind aEntityKind,
                     URIMapper::Kind aMapperKind = URIMapper::CANDIDATE);

=== modified file 'src/api/collectionimpl.cpp'
--- src/api/collectionimpl.cpp	2011-11-01 13:47:10 +0000
+++ src/api/collectionimpl.cpp	2011-11-02 06:07:27 +0000
@@ -30,6 +30,7 @@
 #include "api/zorbaimpl.h"
 #include "api/unmarshaller.h"
 
+#include "diagnostics/assert.h"
 #include "diagnostics/xquery_diagnostics.h"
 #include "diagnostics/zorba_exception.h"
 
@@ -45,6 +46,7 @@
 
 #include "context/static_context.h"
 
+#include "types/typeimpl.h"
 #include "types/typeops.h"
 
 #include "compiler/xqddf/collection_decl.h"

=== modified file 'src/api/staticcontextimpl.cpp'
--- src/api/staticcontextimpl.cpp	2011-09-14 11:08:52 +0000
+++ src/api/staticcontextimpl.cpp	2011-11-02 06:07:27 +0000
@@ -749,34 +749,6 @@
   return TypeOps::get_type_identifier(theCtx->get_typemanager(), *xqType);
 }
 
-
-#ifndef ZORBA_NO_FULL_TEXT
-/*******************************************************************************
-
-********************************************************************************/
-
-void StaticContextImpl::addThesaurusProvider( ThesaurusProvider const *p ) {
-  if ( !theThesaurusProviders[ p ] ) {
-    internal::ThesaurusProviderWrapper *const w =
-      new internal::ThesaurusProviderWrapper( p );
-    theThesaurusProviders[ p ] = w;
-    theCtx->add_thesaurus_provider( w );
-  }
-}
-
-void StaticContextImpl::removeThesaurusProvider( ThesaurusProvider const *p ) {
-  thesaurus_providers_t::iterator const i = theThesaurusProviders.find( p );
-  if ( i != theThesaurusProviders.end() ) {
-    internal::ThesaurusProviderWrapper const *const w = i->second;
-    theThesaurusProviders.erase( i );
-    theCtx->remove_thesaurus_provider( w );
-    delete w;
-  }
-}
-
-#endif /* ZORBA_NO_FULL_TEXT */
-
-
 /*******************************************************************************
 
 ********************************************************************************/

=== modified file 'src/api/staticcontextimpl.h'
--- src/api/staticcontextimpl.h	2011-08-31 13:17:59 +0000
+++ src/api/staticcontextimpl.h	2011-11-02 06:07:27 +0000
@@ -30,11 +30,6 @@
   class DiagnosticHandler;
   class StaticCollectionManagerImpl;
   class static_context;
-#ifndef ZORBA_NO_FULL_TEXT
-  namespace internal {
-    class ThesaurusProviderWrapper;
-  }
-#endif /* ZORBA_NO_FULL_TEXT */
 
 /*******************************************************************************
 
@@ -62,14 +57,6 @@
   DiagnosticHandler                 * theDiagnosticHandler;
   bool                                theUserDiagnosticHandler;
 
-#ifndef ZORBA_NO_FULL_TEXT
-  typedef std::map<ThesaurusProvider const*,
-                   internal::ThesaurusProviderWrapper const*>
-          thesaurus_providers_t;
-
-  thesaurus_providers_t               theThesaurusProviders;
-#endif /* ZORBA_NO_FULL_TEXT */
-
   // allow for lazy creation
   mutable StaticCollectionManagerImpl* theCollectionMgr;
 
@@ -186,14 +173,6 @@
   virtual TypeIdentifier_t
   getCollectionType(const String& aCollectionUri) const;
 
-#ifndef ZORBA_NO_FULL_TEXT
-  virtual void
-  addThesaurusProvider( ThesaurusProvider const* );
-
-  virtual void
-  removeThesaurusProvider( ThesaurusProvider const* );
-#endif /* ZORBA_NO_FULL_TEXT */
-
   virtual bool
   containsFunction(const String& aFnNameUri, const String& aFnNameLocal, int arity) const;
 

=== modified file 'src/api/thesaurus.cpp'
--- src/api/thesaurus.cpp	2011-09-07 20:08:18 +0000
+++ src/api/thesaurus.cpp	2011-11-02 06:07:27 +0000
@@ -29,10 +29,6 @@
 //  // out-of-line since it's virtual
 //}
 
-ThesaurusProvider::~ThesaurusProvider() {
-  // out-of-line since it's virtual
-}
-
 ///////////////////////////////////////////////////////////////////////////////
 
 } // namespace zorba

=== modified file 'src/api/uri_resolver_wrappers.cpp'
--- src/api/uri_resolver_wrappers.cpp	2011-07-22 07:23:17 +0000
+++ src/api/uri_resolver_wrappers.cpp	2011-11-02 06:07:27 +0000
@@ -18,28 +18,39 @@
 #include "uri_resolver_wrappers.h"
 #include "uriresolverimpl.h"
 #include "unmarshaller.h"
+#include <zorba/thesaurus.h>
+#include <runtime/full_text/thesaurus.h>
+#include <context/thesaurus_wrappers.h>
 
 namespace zorba
 {
-
-  class EntityDataWrapper : public EntityData
+  // "Convenience" class for passing an internal EntityData object to
+  // external mappers/resolvers. This can serve as a plain EntityData or
+  // a ThesaurusEntityData. However, when there's another EntityData subclass
+  // in future, this won't work as EntityData becomes an ambiguous base class...
+  class EntityDataWrapper : public ThesaurusEntityData
   {
   public:
-    static EntityDataWrapper const* create(impl::EntityData::Kind aKind) {
+    static EntityDataWrapper const* create(internal::EntityData const* aData) {
       // More ugly: Create a public-API EntityData with the same Entity Kind,
       // but only if it's one of the publicly-supported kinds
-      switch (aKind) {
-      case impl::EntityData::MODULE:
+      switch (aData->getKind()) {
+      case internal::EntityData::MODULE:
         return new EntityDataWrapper(EntityData::MODULE);
-      case impl::EntityData::SCHEMA:
+      case internal::EntityData::SCHEMA:
         return new EntityDataWrapper(EntityData::SCHEMA);
-      case impl::EntityData::THESAURUS:
-        return new EntityDataWrapper(EntityData::THESAURUS);
-      case impl::EntityData::STOP_WORDS:
+      case internal::EntityData::THESAURUS:
+      {
+        EntityDataWrapper* retval = new EntityDataWrapper(EntityData::THESAURUS);
+        retval->theThesaurusLang =
+            dynamic_cast<const internal::ThesaurusEntityData*>(aData)->getLanguage();
+        return retval;
+      }
+      case internal::EntityData::STOP_WORDS:
         return new EntityDataWrapper(EntityData::STOP_WORDS);
-      case impl::EntityData::COLLECTION:
+      case internal::EntityData::COLLECTION:
         return new EntityDataWrapper(EntityData::COLLECTION);
-      case impl::EntityData::DOCUMENT:
+      case internal::EntityData::DOCUMENT:
         return new EntityDataWrapper(EntityData::DOCUMENT);
       default:
         return NULL;
@@ -50,12 +61,17 @@
       return theKind;
     }
 
+    virtual zorba::locale::iso639_1::type getLanguage() const {
+      return theThesaurusLang;
+    }
+
   private:
     EntityDataWrapper(EntityData::Kind aKind)
       : theKind(aKind)
     {}
 
     EntityData::Kind const theKind;
+    zorba::locale::iso639_1::type theThesaurusLang;
   };
 
   URIMapperWrapper::URIMapperWrapper(zorba::URIMapper& aUserMapper)
@@ -68,40 +84,40 @@
   void
   URIMapperWrapper::mapURI
   (const zstring& aUri,
-    impl::EntityData const* aEntityData,
+    internal::EntityData const* aEntityData,
     static_context const& aSctx,
     std::vector<zstring>& oUris)
   {
     std::auto_ptr<const EntityDataWrapper> lDataWrap
-        (EntityDataWrapper::create(aEntityData->getKind()));
+        (EntityDataWrapper::create(aEntityData));
     if (lDataWrap.get() == NULL) {
       return;
     }
 
     std::vector<zorba::String> lUserUris;
     // QQQ should public API have a StaticContext on it?
-    theUserMapper.mapURI(zorba::String(aUri.c_str()),
-      lDataWrap.get(), lUserUris);
+    theUserMapper.mapURI(zorba::String(aUri.c_str()), lDataWrap.get(),
+                         lUserUris);
     std::vector<zorba::String>::iterator iter;
     for (iter = lUserUris.begin(); iter != lUserUris.end(); iter++) {
       oUris.push_back(Unmarshaller::getInternalString(*iter));
     }
   }
 
-  impl::URIMapper::Kind
+  internal::URIMapper::Kind
   URIMapperWrapper::mapperKind()
   {
     // Still so ugly.
     switch (theUserMapper.mapperKind()) {
       case URIMapper::COMPONENT:
-        return impl::URIMapper::COMPONENT;
+        return internal::URIMapper::COMPONENT;
       case URIMapper::CANDIDATE:
-        return impl::URIMapper::CANDIDATE;
+        return internal::URIMapper::CANDIDATE;
     }
 
     assert(false);
     // dummy return
-    return impl::URIMapper::COMPONENT;
+    return internal::URIMapper::COMPONENT;
   }
 
 
@@ -112,39 +128,47 @@
   URLResolverWrapper::~URLResolverWrapper()
   {}
 
-  impl::Resource*
+  internal::Resource*
   URLResolverWrapper::resolveURL
   (const zstring& aUrl,
-    impl::EntityData const* aEntityData)
+    internal::EntityData const* aEntityData)
   {
     std::auto_ptr<const EntityDataWrapper> lDataWrap
-        (EntityDataWrapper::create(aEntityData->getKind()));
+        (EntityDataWrapper::create(aEntityData));
     if (lDataWrap.get() == NULL) {
       return NULL;
     }
 
-    impl::StreamResource* lRetval = nullptr;
-    // Get the user's Resource. It's OK to use an auto_ptr here for safety,
-    // because the Resource will have been created by a factory method inside
-    // libzorba (no cross-DLL memory allocation issue).
-    std::auto_ptr<Resource> lUserPtr
+    internal::Resource* lRetval = nullptr;
+    // Get the user's Resource.
+    Resource::ptr lUserPtr
       (theUserResolver.resolveURL(zorba::String(aUrl.c_str()),
                                   lDataWrap.get()));
     if (lUserPtr.get() != NULL) {
-      // This will get a bit more complicated when we publicly support more than
-      // one kind of Resource subclass.
+      // Sooo ugly... have to try down-casting to each subclass in turn to
+      // figure out what kind of Resource we've got.
       StreamResourceImpl* lUserStream =
           dynamic_cast<StreamResourceImpl*>(lUserPtr.get());
       if (lUserStream != NULL) {
         // Here we pass memory ownership of the std::istream to the internal
         // StreamResource, by passing the StreamReleaser to it and setting the
         // user's StreamResource's StreamReleaser to nullptr.
-        lRetval = new impl::StreamResource(lUserStream->getStream(),
+        lRetval = new internal::StreamResource(lUserStream->getStream(),
                                            lUserStream->getStreamReleaser());
         lUserStream->setStreamReleaser(nullptr);
       }
       else {
-        assert(false);
+        Thesaurus* lUserThesaurus = dynamic_cast<Thesaurus*>(lUserPtr.get());
+        if (lUserThesaurus != NULL) {
+          // Here we pass memory ownership of the actual Thesaurus to the
+          // internal ThesaurusWrapper.
+          lRetval = new internal::ThesaurusWrapper
+              (Thesaurus::ptr(lUserThesaurus));
+          lUserPtr.release();
+        }
+        else {
+          assert(false);
+        }
       }
     }
     return lRetval;

=== modified file 'src/api/uri_resolver_wrappers.h'
--- src/api/uri_resolver_wrappers.h	2011-07-12 20:15:01 +0000
+++ src/api/uri_resolver_wrappers.h	2011-11-02 06:07:27 +0000
@@ -37,7 +37,7 @@
 
 namespace zorba {
 
-class URIMapperWrapper : public zorba::impl::URIMapper
+class URIMapperWrapper : public zorba::internal::URIMapper
 {
   public:
 
@@ -46,18 +46,18 @@
   virtual ~URIMapperWrapper();
 
   virtual void mapURI(const zstring& aUri,
-    zorba::impl::EntityData const* aEntityData,
+    zorba::internal::EntityData const* aEntityData,
     static_context const& aSctx,
     std::vector<zstring>& oUris);
 
-  virtual zorba::impl::URIMapper::Kind mapperKind();
+  virtual zorba::internal::URIMapper::Kind mapperKind();
 
   private:
 
   zorba::URIMapper& theUserMapper;
 };
 
-class URLResolverWrapper : public zorba::impl::URLResolver
+class URLResolverWrapper : public zorba::internal::URLResolver
 {
   public:
 
@@ -65,8 +65,8 @@
 
   virtual ~URLResolverWrapper();
 
-  virtual zorba::impl::Resource* resolveURL(const zstring& aUrl,
-    zorba::impl::EntityData const* aEntityData);
+  virtual zorba::internal::Resource* resolveURL(const zstring& aUrl,
+    zorba::internal::EntityData const* aEntityData);
 
   private:
 

=== modified file 'src/api/uriresolverimpl.cpp'
--- src/api/uriresolverimpl.cpp	2011-08-17 15:48:35 +0000
+++ src/api/uriresolverimpl.cpp	2011-11-02 06:07:27 +0000
@@ -37,6 +37,11 @@
     }
   }
 
+  void StreamResourceImpl::destroy() const
+  {
+    delete this;
+  }
+
   StreamResource* StreamResource::create(std::istream* aStream,
                                          StreamReleaser aStreamReleaser)
   {

=== modified file 'src/api/uriresolverimpl.h'
--- src/api/uriresolverimpl.h	2011-07-22 07:23:17 +0000
+++ src/api/uriresolverimpl.h	2011-11-02 06:07:27 +0000
@@ -37,6 +37,8 @@
 
   virtual ~StreamResourceImpl();
 
+  virtual void destroy() const;
+
 private:
 
   StreamResourceImpl(std::istream* aStream, StreamReleaser aStreamReleaser);

=== modified file 'src/compiler/api/compiler_api.cpp'
--- src/compiler/api/compiler_api.cpp	2011-08-19 23:22:48 +0000
+++ src/compiler/api/compiler_api.cpp	2011-11-02 06:07:27 +0000
@@ -328,7 +328,7 @@
   "stream URL" hack in StreamResource - this is the only place in the code where
   we use the two-arg StreamResource constructor.
 *******************************************************************************/
-class FakeLibraryModuleURLResolver : public impl::URLResolver
+class FakeLibraryModuleURLResolver : public internal::URLResolver
 {
 public:
   FakeLibraryModuleURLResolver
@@ -341,8 +341,8 @@
   virtual ~FakeLibraryModuleURLResolver()
   {}
 
-  virtual impl::Resource* resolveURL
-  (zstring const& aUrl, impl::EntityData const* aEntityData)
+  virtual internal::Resource* resolveURL
+  (zstring const& aUrl, internal::EntityData const* aEntityData)
   {
     if (aUrl != theLibraryModuleNamespace) {
       return NULL;
@@ -351,7 +351,7 @@
     // Pass a nullptr StreamReleaser; memory ownership of the istream remains
     // with the caller of this method.
     // QQQ We can remove this third argument when we can compile modules individually
-    return new impl::StreamResource(&theStream, nullptr,
+    return new internal::StreamResource(&theStream, nullptr,
                                     theLibraryModuleFilename);
   }
 

=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp	2011-11-01 19:44:03 +0000
+++ src/compiler/translator/translator.cpp	2011-11-02 06:07:27 +0000
@@ -2011,16 +2011,16 @@
 
   try
   {
-    std::auto_ptr<impl::Resource> lSchema;
-    impl::StreamResource* lStream = NULL;
+    std::auto_ptr<internal::Resource> lSchema;
+    internal::StreamResource* lStream = NULL;
     zstring lErrorMessage;
     for (std::vector<zstring>::iterator lIter = lCandidates.begin();
          lIter != lCandidates.end();
          ++lIter)
     {
-      lSchema = theSctx->resolve_uri(*lIter, impl::EntityData::SCHEMA,
+      lSchema = theSctx->resolve_uri(*lIter, internal::EntityData::SCHEMA,
                                      lErrorMessage);
-      lStream = dynamic_cast<impl::StreamResource*>(lSchema.get());
+      lStream = dynamic_cast<internal::StreamResource*>(lSchema.get());
       if (lStream != NULL)
       {
         break;
@@ -2824,7 +2824,7 @@
     // Note the use of versioned_uri() here, so that the namespace with any
     // version fragment will be passed through to the mappers.
     theSctx->get_component_uris(modVer.versioned_uri(),
-                                impl::EntityData::MODULE, compURIs);
+                                internal::EntityData::MODULE, compURIs);
   }
   else
   {
@@ -2898,13 +2898,13 @@
       // rather than using compURI directly, because we want the version
       // fragment to be passed to the mappers.
       zstring lErrorMessage;
-      std::auto_ptr<impl::Resource> lResource =
+      std::auto_ptr<internal::Resource> lResource =
       theSctx->resolve_uri(compModVer.versioned_uri(),
-                           impl::EntityData::MODULE,
+                           internal::EntityData::MODULE,
                            lErrorMessage);
 
-      impl::StreamResource* lStreamResource =
-      dynamic_cast<impl::StreamResource*> (lResource.get());
+      internal::StreamResource* lStreamResource =
+      dynamic_cast<internal::StreamResource*> (lResource.get());
 
       if (lStreamResource != NULL)
       {

=== modified file 'src/context/default_uri_mappers.cpp'
--- src/context/default_uri_mappers.cpp	2011-08-10 09:40:29 +0000
+++ src/context/default_uri_mappers.cpp	2011-11-02 06:07:27 +0000
@@ -27,7 +27,7 @@
 
 namespace zorba {
 
-namespace impl {
+namespace internal {
 
 /******
  * Fileize mapper.

=== modified file 'src/context/default_uri_mappers.h'
--- src/context/default_uri_mappers.h	2011-07-12 20:15:01 +0000
+++ src/context/default_uri_mappers.h	2011-11-02 06:07:27 +0000
@@ -31,14 +31,14 @@
 
 namespace zorba {
 
-namespace impl {
+namespace internal {
 
 /**
  * @brief URI Mapper which ensures URIs look like they point to files. Helpful
  * for deploying modules both to filesystems and webservers; also the module
  * versioning mapper depends on this.
  */
-class FileizeURIMapper : public impl::URIMapper
+class FileizeURIMapper : public internal::URIMapper
 {
 public:
 
@@ -52,7 +52,7 @@
  * @brief URI Mapper which mangles non-file: URIs to a standardized location on
  * the filesystem, honoring Zorba's module-path.
  */
-class AutoFSURIMapper : public impl::URIMapper
+class AutoFSURIMapper : public internal::URIMapper
 {
 public:
 
@@ -66,13 +66,13 @@
  * @brief A URI mapper which returns a collection
  *        ressource from the store.
  */
-class ZorbaCollectionURIMapper : public impl::URIMapper
+class ZorbaCollectionURIMapper : public internal::URIMapper
 {
 public:
 
   virtual ~ZorbaCollectionURIMapper();
 
-  virtual impl::URIMapper::Kind mapperKind();
+  virtual internal::URIMapper::Kind mapperKind();
 
   virtual void mapURI(zstring const& aUri,
     EntityData const* aEntityData,
@@ -84,7 +84,7 @@
 /**
  * @brief Module versioning URI Mapper.
  */
-class ModuleVersioningURIMapper : public impl::URIMapper
+class ModuleVersioningURIMapper : public internal::URIMapper
 {
 public:
 

=== modified file 'src/context/default_url_resolvers.cpp'
--- src/context/default_url_resolvers.cpp	2011-10-20 19:50:15 +0000
+++ src/context/default_url_resolvers.cpp	2011-11-02 06:07:27 +0000
@@ -31,7 +31,7 @@
 
 namespace zorba {
 
-namespace impl {
+namespace internal {
 
 /******
  * http: (and https: and ftp:) URL resolver.
@@ -41,7 +41,7 @@
 HTTPURLResolver::resolveURL
 (zstring const& aUrl, EntityData const* aEntityData)
 {
-  if (aEntityData->getKind() == impl::EntityData::COLLECTION)
+  if (aEntityData->getKind() == EntityData::COLLECTION)
     return NULL;
 
   uri::scheme lScheme = uri::get_scheme(aUrl);
@@ -82,7 +82,7 @@
 FileURLResolver::resolveURL
 (zstring const& aUrl, EntityData const* aEntityData)
 {
-  if (aEntityData->getKind() == impl::EntityData::COLLECTION)
+  if (aEntityData->getKind() == EntityData::COLLECTION)
     return NULL;
 
   uri::scheme lScheme = uri::get_scheme(aUrl);
@@ -109,7 +109,7 @@
 ZorbaCollectionURLResolver::resolveURL
 (zstring const& aUrl, EntityData const* aEntityData)
 {
-  if (aEntityData->getKind() != impl::EntityData::COLLECTION)
+  if (aEntityData->getKind() != EntityData::COLLECTION)
     return NULL;
 
   store::Item_t lName;
@@ -122,7 +122,7 @@
   }
 }
 
-} /* namespace zorba::impl */
+} /* namespace zorba::internal */
 
 } /* namespace zorba */
 

=== modified file 'src/context/default_url_resolvers.h'
--- src/context/default_url_resolvers.h	2011-07-11 11:12:23 +0000
+++ src/context/default_url_resolvers.h	2011-11-02 06:07:27 +0000
@@ -31,12 +31,14 @@
 
 namespace zorba {
 
-namespace impl {
+namespace internal {
+
+///////////////////////////////////////////////////////////////////////////////
 
 /**
  * @brief http: URL Resolver.
  */
-class HTTPURLResolver : public impl::URLResolver
+class HTTPURLResolver : public internal::URLResolver
 {
 public:
 
@@ -47,7 +49,7 @@
 /**
  * @brief file: URL Resolver.
  */
-class FileURLResolver : public impl::URLResolver
+class FileURLResolver : public internal::URLResolver
 {
 public:
 
@@ -57,7 +59,7 @@
 
 /**
  */
-class ZorbaCollectionURLResolver : public impl::URLResolver
+class ZorbaCollectionURLResolver : public internal::URLResolver
 {
 public:
 
@@ -67,12 +69,24 @@
     EntityData const* aEntityData);
 };
 
+#ifndef ZORBA_NO_FULL_TEXT
+
+class ThesaurusURLResolver : public URLResolver
+{
+public:
+  // inherited
+  Resource* resolveURL( zstring const &aUrl, EntityData const* );
+};
+
+#endif /* ZORBA_NO_FULL_TEXT */
+
+///////////////////////////////////////////////////////////////////////////////
+
 } /* namespace zorba::impl */
 
 } /* namespace zorba */
 
 #endif /* ZORBA_DEFAULT_URL_RESOLVERS_H */
-
 /*
  * Local variables:
  * mode: c++

=== modified file 'src/context/root_static_context.cpp'
--- src/context/root_static_context.cpp	2011-08-19 00:03:31 +0000
+++ src/context/root_static_context.cpp	2011-11-02 06:07:27 +0000
@@ -95,13 +95,16 @@
 
 
   // TODO move into globalenv? memory leaks?
-  add_url_resolver(new impl::FileURLResolver());
-  add_url_resolver(new impl::HTTPURLResolver());
-  add_uri_mapper(new impl::FileizeURIMapper());
-  add_uri_mapper(new impl::ModuleVersioningURIMapper());
-  add_uri_mapper(new impl::AutoFSURIMapper());
-  add_url_resolver(new impl::ZorbaCollectionURLResolver());
-  add_uri_mapper(new impl::ZorbaCollectionURIMapper());
+  add_url_resolver(new internal::FileURLResolver());
+  add_url_resolver(new internal::HTTPURLResolver());
+#ifndef ZORBA_NO_FULL_TEXT
+  add_url_resolver(new internal::ThesaurusURLResolver());
+#endif /* ZORBA_NO_FULL_TEXT */
+  add_uri_mapper(new internal::FileizeURIMapper());
+  add_uri_mapper(new internal::ModuleVersioningURIMapper());
+  add_uri_mapper(new internal::AutoFSURIMapper());
+  add_url_resolver(new internal::ZorbaCollectionURLResolver());
+  add_uri_mapper(new internal::ZorbaCollectionURIMapper());
 
   set_validation_mode(StaticContextConsts::lax_validation);
 

=== modified file 'src/context/static_context.cpp'
--- src/context/static_context.cpp	2011-11-01 13:47:10 +0000
+++ src/context/static_context.cpp	2011-11-02 06:07:27 +0000
@@ -1359,71 +1359,57 @@
 /***************************************************************************//**
 
 ********************************************************************************/
-void static_context::add_uri_mapper(impl::URIMapper* aMapper)
-{
-  theURIMappers.push_back(std::auto_ptr<impl::URIMapper>(aMapper));
-}
-
-
-/***************************************************************************//**
-
-********************************************************************************/
-void static_context::add_url_resolver(impl::URLResolver* aResolver)
-{
-  theURLResolvers.push_back(std::auto_ptr<impl::URLResolver>(aResolver));
-}
-
-
-/***************************************************************************//**
-  Helper class for resolve_uri()
-********************************************************************************/
-class SimpleEntityData : public impl::EntityData
-{
-public:
-  SimpleEntityData(impl::EntityData::Kind aKind) : theKind(aKind)
-  {
-  }
-
-  virtual impl::EntityData::Kind getKind() const
-  {
-    return theKind;
-  }
-
-private:
-  impl::EntityData::Kind const theKind;
-};
-
-
-/***************************************************************************//**
-
-********************************************************************************/
-std::auto_ptr<impl::Resource> static_context::resolve_uri(
+void static_context::add_uri_mapper(internal::URIMapper* aMapper)
+{
+  theURIMappers.push_back(std::auto_ptr<internal::URIMapper>(aMapper));
+}
+
+
+/***************************************************************************//**
+
+********************************************************************************/
+void static_context::add_url_resolver(internal::URLResolver* aResolver)
+{
+  theURLResolvers.push_back(std::auto_ptr<internal::URLResolver>(aResolver));
+}
+
+
+/***************************************************************************//**
+
+********************************************************************************/
+std::auto_ptr<internal::Resource> static_context::resolve_uri(
     zstring const& aUri, 
-    impl::EntityData::Kind aEntityKind,
+    internal::EntityData::Kind aEntityKind,
     zstring& oErrorMessage) const
 {
   // Create a simple EntityData that just reports the specified Kind
-  SimpleEntityData const lData(aEntityKind);
+  internal::EntityData const lData(aEntityKind);
+  return this->resolve_uri(aUri, lData, oErrorMessage);
+}
 
+std::auto_ptr<internal::Resource> static_context::resolve_uri(
+    zstring const& aUri,
+    internal::EntityData const& aEntityData,
+    zstring& oErrorMessage) const
+{
   std::vector<zstring> lUris;
-  apply_uri_mappers(aUri, &lData, impl::URIMapper::CANDIDATE, lUris);
+  apply_uri_mappers(aUri, &aEntityData, internal::URIMapper::CANDIDATE, lUris);
 
-  std::auto_ptr<impl::Resource> lRetval;
-  apply_url_resolvers(lUris, &lData, lRetval, oErrorMessage);
+  std::auto_ptr<internal::Resource> lRetval;
+  apply_url_resolvers(lUris, &aEntityData, lRetval, oErrorMessage);
 
   return lRetval;
 }
 
-
 void static_context::get_component_uris(
     zstring const& aUri,
-    impl::EntityData::Kind aEntityKind,
+    internal::EntityData::Kind aEntityKind,
     std::vector<zstring>& oComponents) const
 {
   // Create a simple EntityData that just reports the specified Kind
-  SimpleEntityData const lData(aEntityKind);
+  internal::EntityData const lData(aEntityKind);
 
-  apply_uri_mappers(aUri, &lData, impl::URIMapper::COMPONENT, oComponents);
+  apply_uri_mappers(aUri, &lData, internal::URIMapper::COMPONENT, oComponents);
   if (oComponents.size() == 0) 
   {
     oComponents.push_back(aUri);
@@ -1436,8 +1422,8 @@
 ********************************************************************************/
 void static_context::apply_uri_mappers(
     zstring const& aUri, 
-    impl::EntityData const* aEntityData,
-    impl::URIMapper::Kind aMapperKind, 
+    internal::EntityData const* aEntityData,
+    internal::URIMapper::Kind aMapperKind, 
     std::vector<zstring>& oUris) const
 {
   // Initialize list with the one input URI.
@@ -1448,7 +1434,7 @@
        sctx != NULL; sctx = sctx->theParent)
   {
     // Iterate through all available mappers on this static_context...
-    for (ztd::auto_vector<impl::URIMapper>::const_iterator mapper =
+    for (ztd::auto_vector<internal::URIMapper>::const_iterator mapper =
            sctx->theURIMappers.begin();
          mapper != sctx->theURIMappers.end(); mapper++)
     {
@@ -1480,7 +1466,7 @@
           // Check the new entries for DENY_ACCESS.
           for (size_t i = lPreNumResultUris; i < lPostNumResultUris; i++) 
           {
-            if (lResultUris.at(i) == impl::URIMapper::DENY_ACCESS) {
+            if (lResultUris.at(i) == internal::URIMapper::DENY_ACCESS) {
               throw XQUERY_EXCEPTION(zerr::ZXQP0029_URI_ACCESS_DENIED,
                                      ERROR_PARAMS(aUri));
             }
@@ -1501,8 +1487,8 @@
 ********************************************************************************/
 void static_context::apply_url_resolvers(
     std::vector<zstring>& aUrls,
-    impl::EntityData const* aEntityData,
-    std::auto_ptr<impl::Resource>& oResource, 
+    internal::EntityData const* aEntityData,
+    std::auto_ptr<internal::Resource>& oResource, 
     zstring& oErrorMessage) const
 {
   oErrorMessage = "";
@@ -1516,7 +1502,7 @@
          sctx != NULL; sctx = sctx->theParent)
     {
       // Iterate through all available resolvers on this static_context...
-      for (ztd::auto_vector<impl::URLResolver>::const_iterator resolver =
+      for (ztd::auto_vector<internal::URLResolver>::const_iterator resolver =
              sctx->theURLResolvers.begin();
            resolver != sctx->theURLResolvers.end(); resolver++)
       {
@@ -3963,32 +3949,5 @@
   }
 }
 
-
-#ifndef ZORBA_NO_FULL_TEXT
-
-internal::Thesaurus::ptr
-static_context::get_thesaurus( zstring const &uri, iso639_1::type lang ) const {
-  FOR_EACH( thesaurus_providers_t, p, theThesaurusProviders ) {
-    internal::Thesaurus::ptr t( (*p)->get_thesaurus( uri, lang ) );
-    if ( t.get() )
-      return std::move( t );
-  }
-  return theParent ?
-    theParent->get_thesaurus( uri, lang ) :
-    internal::ThesaurusProvider::get_default_provider()
-      .get_thesaurus( uri, lang );
-}
-
-void static_context::remove_thesaurus_provider(
-    internal::ThesaurusProvider const *p ) {
-  ztd::erase_1st_if(
-    theThesaurusProviders,
-    std::bind2nd( std::equal_to<internal::ThesaurusProvider const*>(), p )
-  );
-}
-
-#endif /* ZORBA_NO_FULL_TEXT */
-
-
 } // namespace zorba
 /* vim:set et sw=2 ts=2: */

=== modified file 'src/context/static_context.h'
--- src/context/static_context.h	2011-11-01 13:47:10 +0000
+++ src/context/static_context.h	2011-11-02 06:07:27 +0000
@@ -40,10 +40,6 @@
 
 #include "zorbautils/hashmap_zstring.h"
 
-#ifndef ZORBA_NO_FULL_TEXT
-#include "runtime/full_text/thesaurus.h"
-#endif /* ZORBA_NO_FULL_TEXT */
-
 #include "common/shared_types.h"
 #include "util/stl_util.h"
 #include "util/auto_vector.h"
@@ -497,14 +493,9 @@
 
   BaseUriInfo                           * theBaseUriInfo;
 
-  ztd::auto_vector<impl::URIMapper>       theURIMappers;
-
-  ztd::auto_vector<impl::URLResolver>     theURLResolvers;
-
-#ifndef ZORBA_NO_FULL_TEXT
-  typedef std::deque<internal::ThesaurusProvider const*> thesaurus_providers_t;
-  thesaurus_providers_t                   theThesaurusProviders;
-#endif /* ZORBA_NO_FULL_TEXT */
+  ztd::auto_vector<internal::URIMapper>       theURIMappers;
+
+  ztd::auto_vector<internal::URLResolver>     theURLResolvers;
 
   checked_vector<zstring>                 theModulePaths;
 
@@ -665,20 +656,27 @@
    * Add a URIMapper to be used by this static context when resolving
    * URIs to resources.
    */
-  void add_uri_mapper(impl::URIMapper* aMapper);
+  void add_uri_mapper(internal::URIMapper* aMapper);
 
   /**
    * Add a URLResolver to be used by this static context when
    * resolving URIs to resources.
    */
-  void add_url_resolver(impl::URLResolver* aResolver);
+  void add_url_resolver(internal::URLResolver* aResolver);
 
   /**
    * Given a URI, return a Resource for that URI.
    * @param aEntityKind the expected kind of entity expected at this aUri
    */
-  std::auto_ptr<impl::Resource> resolve_uri
-  (zstring const& aUri, impl::EntityData::Kind aEntityKind, zstring& oErrorMessage) const;
+  std::auto_ptr<internal::Resource> resolve_uri
+  (zstring const& aUri, internal::EntityData::Kind aEntityKind, zstring& oErrorMessage) const;
+
+  /**
+   * Given a URI, return a Resource for that URI.
+   * @param aEntityData an EntityData object to pass to the mappers/resolvers.
+   */
+  std::auto_ptr<internal::Resource> resolve_uri
+  (zstring const& aUri, internal::EntityData const& aEntityData, zstring& oErrorMessage) const;
 
   /**
    * Given a URI, populate a vector with a list of component URIs.  If
@@ -686,20 +684,9 @@
    * with (only) the input URI.
    */
   void get_component_uris
-  (zstring const& aUri, impl::EntityData::Kind aEntityKind,
+  (zstring const& aUri, internal::EntityData::Kind aEntityKind,
     std::vector<zstring>& oComponents) const;
 
-#ifndef ZORBA_NO_FULL_TEXT
-  void add_thesaurus_provider( internal::ThesaurusProvider const *p ) {
-    theThesaurusProviders.push_front( p );
-  }
-
-  internal::Thesaurus::ptr get_thesaurus( zstring const &uri,
-                                          locale::iso639_1::type lang ) const;
-
-  void remove_thesaurus_provider( internal::ThesaurusProvider const *p );
-#endif /* ZORBA_NO_FULL_TEXT */
-
   void set_module_paths(const std::vector<zstring>& aModulePaths);
 
   void get_module_paths(std::vector<zstring>& aModulePaths) const;
@@ -1024,13 +1011,13 @@
 private:
 
   void apply_uri_mappers(zstring const& aUri,
-    impl::EntityData const* aEntityData,
-    impl::URIMapper::Kind aMapperKind,
+    internal::EntityData const* aEntityData,
+    internal::URIMapper::Kind aMapperKind,
     std::vector<zstring>& oUris) const;
 
   void apply_url_resolvers(std::vector<zstring>& aUrls,
-    impl::EntityData const* aEntityData,
-    std::auto_ptr<impl::Resource>& oResource,
+    internal::EntityData const* aEntityData,
+    std::auto_ptr<internal::Resource>& oResource,
     zstring& oErrorMessage) const;
 
 public:

=== modified file 'src/context/thesaurus_wrappers.cpp'
--- src/context/thesaurus_wrappers.cpp	2011-08-31 13:17:59 +0000
+++ src/context/thesaurus_wrappers.cpp	2011-11-02 06:07:27 +0000
@@ -87,27 +87,6 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-ThesaurusProviderWrapper::
-ThesaurusProviderWrapper( zorba::ThesaurusProvider const *p ) :
-  api_thesaurus_provider_( p )
-{
-  ZORBA_ASSERT( api_thesaurus_provider_ );
-}
-
-Thesaurus::ptr ThesaurusProviderWrapper::
-get_thesaurus( zstring const &uri, iso639_1::type lang ) const {
-  String const api_uri( Unmarshaller::newString( uri ) );
-  zorba::Thesaurus::ptr t(
-    api_thesaurus_provider_->getThesaurus( api_uri, lang )
-  );
-  Thesaurus::ptr result(
-    t.get() ? new ThesaurusWrapper( std::move( t ) ) : nullptr
-  );
-  return std::move( result );
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
 } // namespace internal
 } // namespace zorba
 

=== modified file 'src/context/thesaurus_wrappers.h'
--- src/context/thesaurus_wrappers.h	2011-08-31 13:17:59 +0000
+++ src/context/thesaurus_wrappers.h	2011-11-02 06:07:27 +0000
@@ -54,16 +54,6 @@
   zorba::Thesaurus::ptr api_thesaurus_;
 };
 
-class ThesaurusProviderWrapper : public ThesaurusProvider {
-public:
-  ThesaurusProviderWrapper( zorba::ThesaurusProvider const *p );
-
-  Thesaurus::ptr get_thesaurus( zstring const &uri,
-                                locale::iso639_1::type lang ) const;
-private:
-  zorba::ThesaurusProvider const *const api_thesaurus_provider_;
-};
-
 ///////////////////////////////////////////////////////////////////////////////
 
 } // namespace internal

=== modified file 'src/context/uri_resolver.cpp'
--- src/context/uri_resolver.cpp	2011-08-20 01:30:48 +0000
+++ src/context/uri_resolver.cpp	2011-11-02 06:07:27 +0000
@@ -26,13 +26,13 @@
 // We avoid the "static initialization order fiasco" by initializing both of
 // these constants here in the same file. This also makes it easy to ensure
 // both strings have the same value.
-const zorba::zstring zorba::impl::URIMapper::DENY_ACCESS("[~~Deny Access~~]");
-const zorba::String zorba::URIMapper::DENY_ACCESS(zorba::impl::URIMapper::DENY_ACCESS.c_str());
+const zorba::zstring zorba::internal::URIMapper::DENY_ACCESS("[~~Deny Access~~]");
+const zorba::String zorba::URIMapper::DENY_ACCESS(zorba::internal::URIMapper::DENY_ACCESS.c_str());
 
 
 namespace zorba {
 
-namespace impl {
+namespace internal {
 
 /*************
  * Implementation of the Resource class hierarchy.
@@ -100,6 +100,33 @@
     return theCollection;
   }
 
+/*************
+ * Implementation of EntityData hierarchy.
+ *************/
+  EntityData::EntityData(EntityData::Kind aKind)
+    : theKind(aKind)
+  {
+  }
+
+  EntityData::Kind EntityData::getKind() const
+  {
+    return theKind;
+  }
+
+  EntityData::~EntityData()
+  {
+  }
+
+  ThesaurusEntityData::ThesaurusEntityData(locale::iso639_1::type aLang)
+    : EntityData(EntityData::THESAURUS),
+      theLang(aLang)
+  {
+  }
+
+  locale::iso639_1::type ThesaurusEntityData::getLanguage() const
+  {
+    return theLang;
+  }
 
 /*************
  * URIMapper is an abstract class, but we have to define its vtbl and
@@ -117,15 +144,6 @@
   URLResolver::~URLResolver()
   {}
 
-  /*************
-   * EntityData is an abstract class, but we have to define its vtbl
-   * and base destructor somewhere.
-   *************/
-
-  EntityData::~EntityData()
-  {}
-
-
 } /* namespace zorba::impl */
 
 } /* namespace zorba */

=== modified file 'src/context/uri_resolver.h'
--- src/context/uri_resolver.h	2011-08-20 01:30:48 +0000
+++ src/context/uri_resolver.h	2011-11-02 06:07:27 +0000
@@ -34,13 +34,14 @@
 #include <util/auto_vector.h>
 #include <store/api/shared_types.h>
 #include <zorba/streams.h>
+#include <zorba/locale.h>
 
 namespace zorba {
 
 // Forward declaration
 class static_context;
 
-namespace impl {
+namespace internal {
 
 /**
  * @brief The class representing the result of URL resolution.
@@ -156,9 +157,8 @@
  * and URLResolvers when mapping/resolving a URI.
  *
  * This base class specifies the kind of entity for which this URI is being
- * resolved - for instance, a schema URI or a module URI. In the future,
- * there may be kind-specific subclasses containing additional information;
- * as yet however there are none.
+ * resolved - for instance, a schema URI or a module URI. Subclasses of
+ * this class will provide additional data for specific kinds of entities.
  */
 class EntityData
 {
@@ -178,12 +178,34 @@
     SOME_CONTENT
   };
 
+  EntityData(Kind aKind);
+
   /**
    * @brief Return the Kind of Entity for which this URI is being resolved.
    */
-  virtual Kind getKind() const = 0;
-
-  virtual ~EntityData() = 0;
+  virtual Kind getKind() const;
+
+  virtual ~EntityData();
+
+private:
+  Kind const theKind;
+};
+
+/**
+ * @brief The class containing additional data for URIMappers and URLResolvers
+ * when mapping/resolving a Thesaurus URI.
+ */
+class ThesaurusEntityData : public EntityData
+{
+public:
+  ThesaurusEntityData(locale::iso639_1::type aLang);
+  /**
+   * @brief Return the language for which a thesaurus is being requested.
+   */
+  virtual locale::iso639_1::type getLanguage() const;
+
+private:
+  locale::iso639_1::type const theLang;
 };
 
 /**

=== modified file 'src/functions/external_function.h'
--- src/functions/external_function.h	2011-06-14 17:26:33 +0000
+++ src/functions/external_function.h	2011-11-02 06:07:27 +0000
@@ -57,7 +57,7 @@
         const zstring& ns,
         const signature& sig,
         short scriptingType,
-        ExternalFunction* impl);
+        ExternalFunction* internal);
 
   ~external_function() { }
 

=== modified file 'src/runtime/collections/collections_impl.cpp'
--- src/runtime/collections/collections_impl.cpp	2011-11-01 13:47:10 +0000
+++ src/runtime/collections/collections_impl.cpp	2011-11-02 06:07:27 +0000
@@ -114,8 +114,8 @@
 {
   store::Item_t lURI, resolvedURIItem;
   store::Collection_t coll;
-  std::auto_ptr<impl::Resource> lResource;
-  impl::CollectionResource* lCollResource;
+  std::auto_ptr<internal::Resource> lResource;
+  internal::CollectionResource* lCollResource;
   zstring resolvedURIString;
   zstring lErrorMessage;
 
@@ -153,10 +153,10 @@
   }
 
   lResource = theSctx->resolve_uri(resolvedURIString,
-                                   impl::EntityData::COLLECTION,
+                                   internal::EntityData::COLLECTION,
                                    lErrorMessage);
 
-  lCollResource = dynamic_cast<impl::CollectionResource*>(lResource.get());
+  lCollResource = dynamic_cast<internal::CollectionResource*>(lResource.get());
 
   if ( lCollResource == 0 || !(coll = lCollResource->getCollection()) )
   {
@@ -236,8 +236,8 @@
 {
   store::Item_t lURI;
   store::Collection_t coll;
-  std::auto_ptr<impl::Resource> lResource;
-  impl::CollectionResource* lCollResource;
+  std::auto_ptr<internal::Resource> lResource;
+  internal::CollectionResource* lCollResource;
   zstring resolvedURIString;
   zstring lErrorMessage;
 
@@ -274,10 +274,10 @@
 
 
   lResource = theSctx->resolve_uri(resolvedURIString, 
-                                   impl::EntityData::COLLECTION,
+                                   internal::EntityData::COLLECTION,
                                    lErrorMessage);
 
-  lCollResource = dynamic_cast<impl::CollectionResource*>(lResource.get());
+  lCollResource = dynamic_cast<internal::CollectionResource*>(lResource.get());
 
   if ( lCollResource == 0 || !(coll = lCollResource->getCollection()) )
   {

=== modified file 'src/runtime/fetch/fetch_impl.cpp'
--- src/runtime/fetch/fetch_impl.cpp	2011-08-05 09:31:11 +0000
+++ src/runtime/fetch/fetch_impl.cpp	2011-11-02 06:07:27 +0000
@@ -43,11 +43,11 @@
 {
   store::Item_t lUri;
   store::Item_t lEntityKind;
-  impl::EntityData::Kind lKind;
+  internal::EntityData::Kind lKind;
   zstring lKindStr;
   zstring lErrorMessage;
-  std::auto_ptr<impl::Resource> lRes;
-  impl::StreamResource* lStreamRes;
+  std::auto_ptr<internal::Resource> lRes;
+  internal::StreamResource* lStreamRes;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
@@ -58,19 +58,19 @@
   // Figure out the EntityKind (any better way to do this?)
   lKindStr = lEntityKind->getStringValue();
   if ( ! lKindStr.compare("SOME_CONTENT")) {
-    lKind = impl::EntityData::SOME_CONTENT;
+    lKind = internal::EntityData::SOME_CONTENT;
   }
   else if ( ! lKindStr.compare("SCHEMA")) {
-    lKind = impl::EntityData::SCHEMA;
+    lKind = internal::EntityData::SCHEMA;
   }
   else if ( ! lKindStr.compare("MODULE")) {
-    lKind = impl::EntityData::MODULE;
+    lKind = internal::EntityData::MODULE;
   }
   else if ( ! lKindStr.compare("THESAURUS")) {
-    lKind = impl::EntityData::THESAURUS;
+    lKind = internal::EntityData::THESAURUS;
   }
   else if ( ! lKindStr.compare("STOP_WORDS")) {
-    lKind = impl::EntityData::STOP_WORDS;
+    lKind = internal::EntityData::STOP_WORDS;
   }
   else {
     throw XQUERY_EXCEPTION(
@@ -95,7 +95,7 @@
     );
   }
 
-  lStreamRes = dynamic_cast<impl::StreamResource*>(lRes.get());
+  lStreamRes = dynamic_cast<internal::StreamResource*>(lRes.get());
   if ( !lStreamRes ) {
     throw XQUERY_EXCEPTION(
       zerr::ZXQP0025_ITEM_CREATION_FAILED,

=== modified file 'src/runtime/full_text/apply.cpp'
--- src/runtime/full_text/apply.cpp	2011-08-31 13:17:59 +0000
+++ src/runtime/full_text/apply.cpp	2011-11-02 06:07:27 +0000
@@ -20,6 +20,7 @@
 #include <vector>
 
 #include <zorba/tokenizer.h>
+#include <context/uri_resolver.h>
 
 #include "compiler/expression/ftnode.h"
 #include "diagnostics/dict.h"
@@ -34,9 +35,9 @@
 #include "zorbamisc/ns_consts.h"
 
 #ifndef NDEBUG
-#include "system/properties.h"
-#define DOUT            Properties::instance()->debug_out()
-#define TRACE_FULL_TEXT Properties::instance()->traceFulltext()
+# include "system/properties.h"
+# define DOUT             Properties::instance()->debug_out()
+# define TRACE_FULL_TEXT  Properties::instance()->traceFulltext()
 #endif /* NDEBUG */
 
 #include "apply.h"
@@ -49,9 +50,9 @@
 
 #ifdef WIN32
 // Windows annoyingly defines these as macros.
-#undef max
-#undef min
-#endif
+# undef max
+# undef min
+#endif /* WIN32 */
 
 using namespace std;
 using namespace zorba::locale;
@@ -1207,19 +1208,25 @@
     at_least = 0, at_most = numeric_limits<ft_int>::max();
 
   zstring const &uri = tid.get_uri();
-  vector<zstring> comp_uris;
-  static_ctx_.get_component_uris( uri, impl::EntityData::THESAURUS, comp_uris );
-  if ( comp_uris.size() != 1 )
+
+  zstring error_msg;
+  auto_ptr<internal::Resource> rsrc = static_ctx_.resolve_uri(
+    uri, internal::ThesaurusEntityData( qt0.lang() ), error_msg
+  );
+  if ( !rsrc.get() )
     throw XQUERY_EXCEPTION( err::FTST0018, ERROR_PARAMS( uri ) );
 
   internal::Thesaurus::ptr thesaurus(
-    static_ctx_.get_thesaurus( comp_uris.front(), qt0.lang() )
+    dynamic_cast<internal::Thesaurus*>( rsrc.release() )
   );
+  ZORBA_ASSERT( thesaurus );
 
   internal::Thesaurus::iterator::ptr tresult(
-    thesaurus->lookup( query_phrase, tid.get_relationship(), at_least, at_most )
+    thesaurus->lookup(
+      query_phrase, tid.get_relationship(), at_least, at_most
+    )
   );
-  if ( !tresult.get() )
+  if ( !tresult )
     return;
 
   FTTokenSeqIterator::FTTokens synonyms;

=== modified file 'src/runtime/full_text/ft_stop_words_set.cpp'
--- src/runtime/full_text/ft_stop_words_set.cpp	2011-07-22 07:23:17 +0000
+++ src/runtime/full_text/ft_stop_words_set.cpp	2011-11-02 06:07:27 +0000
@@ -127,10 +127,10 @@
       }
 
       zstring error_msg;
-      std::auto_ptr<impl::Resource> rsrc =
-          sctx.resolve_uri(uri, impl::EntityData::STOP_WORDS, error_msg);
-      impl::StreamResource* stream_rsrc =
-          dynamic_cast<impl::StreamResource*>(rsrc.get());
+      std::auto_ptr<internal::Resource> rsrc =
+          sctx.resolve_uri(uri, internal::EntityData::STOP_WORDS, error_msg);
+      internal::StreamResource* stream_rsrc =
+          dynamic_cast<internal::StreamResource*>(rsrc.get());
       if ( !stream_rsrc ) {
         // Technically this should be thrown during static analysis.
         throw ZORBA_EXCEPTION(err::FTST0008, ERROR_PARAMS(uri));

=== modified file 'src/runtime/full_text/thesaurus.cpp'
--- src/runtime/full_text/thesaurus.cpp	2011-08-31 13:17:59 +0000
+++ src/runtime/full_text/thesaurus.cpp	2011-11-02 06:07:27 +0000
@@ -34,6 +34,8 @@
 #endif
 #include "thesauri/xqftts_thesaurus.h"
 
+#include "context/default_url_resolvers.h"
+
 using namespace std;
 using namespace zorba::locale;
 
@@ -108,27 +110,23 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-ThesaurusProvider::~ThesaurusProvider() {
-  // Out-of-line since it's virtual.
-}
-
-ThesaurusProvider const& ThesaurusProvider::get_default_provider() {
-  static ThesaurusProvider default_provider;
-  return default_provider;
-}
-
-Thesaurus::ptr
-ThesaurusProvider::get_thesaurus( zstring const &in_uri,
-                                  iso639_1::type lang )  const {
-  thesaurus_impl::type th_impl;
-  zstring uri;
-  parse_mapping( in_uri, &th_impl, &uri );
-
-  zstring th_path;
-  switch ( uri::get_scheme( uri ) ) {
+Resource*
+ThesaurusURLResolver::resolveURL( zstring const &url, EntityData const *data ) {
+  if ( data->getKind() != internal::EntityData::THESAURUS )
+    return nullptr;
+  ThesaurusEntityData const *const t_data =
+    dynamic_cast<ThesaurusEntityData const*>( data );
+  iso639_1::type const lang = t_data->getLanguage();
+
+  thesaurus_impl::type t_impl;
+  zstring mapped_url;
+  parse_mapping( url, &t_impl, &mapped_url );
+
+  zstring t_path;
+  switch ( uri::get_scheme( mapped_url ) ) {
     case uri::file:
     case uri::none:
-      th_path = fs::get_normalized_path( uri );
+      t_path = fs::get_normalized_path( mapped_url );
       break;
     default:
       throw XQUERY_EXCEPTION(
@@ -137,20 +135,17 @@
       );
   }
 
-  Thesaurus *result;
-  switch ( th_impl ) {
+  switch ( t_impl ) {
 #   ifdef ZORBA_WITH_FILE_ACCESS
     case thesaurus_impl::wordnet:
-      result = new wordnet::thesaurus( th_path, lang );
-      break;
+      return new wordnet::thesaurus( t_path, lang );
 #   endif /* ZORBA_WITH_FILE_ACCESS */
     case thesaurus_impl::xqftts:
-      result = new xqftts::thesaurus( th_path, lang );
-      break;
+      return new xqftts::thesaurus( t_path, lang );
     default:
-      throw XQUERY_EXCEPTION( err::FTST0018, ERROR_PARAMS( uri ) );
+      throw XQUERY_EXCEPTION( err::FTST0018, ERROR_PARAMS( url ) );
   }
-  return Thesaurus::ptr( result );
+  return nullptr;
 }
 
 ///////////////////////////////////////////////////////////////////////////////

=== modified file 'src/runtime/full_text/thesaurus.h'
--- src/runtime/full_text/thesaurus.h	2011-08-31 13:17:59 +0000
+++ src/runtime/full_text/thesaurus.h	2011-11-02 06:07:27 +0000
@@ -20,6 +20,7 @@
 #include <zorba/locale.h>
 #include <zorba/internal/unique_ptr.h>
 
+#include "context/uri_resolver.h"
 #include "util/stl_util.h"
 #include "zorbatypes/zstring.h"
 
@@ -33,7 +34,7 @@
 /**
  * A %Thesaurus is the abstract base class for thesaurus implementations.
  */
-class Thesaurus {
+class Thesaurus : public internal::Resource {
 public:
   typedef std::unique_ptr<Thesaurus,ztd::destroy_delete<Thesaurus> > ptr;
 
@@ -94,32 +95,6 @@
   Thesaurus& operator=( Thesaurus const& );
 };
 
-/**
- * A %ThesaurusProvider provides a Thesaurus for a particular language.
- */
-class ThesaurusProvider {
-public:
-  virtual ~ThesaurusProvider();
-
-  /**
-   * Gets the default %ThesaurusProvider.
-   *
-   * @return Returns said %ThesaurusProvider.
-   */
-  static ThesaurusProvider const& get_default_provider();
-
-  /**
-   * Gets and instance of a %Thesaurus for the given language.
-   *
-   * @param uri The URI provided in the query for the thesaurus.
-   * @param lang The language of the thesaurus.
-   * @return Returns said Thesaurus or \c NULL if no thesaurus is available for
-   * the given language.
-   */
-  virtual Thesaurus::ptr get_thesaurus( zstring const &uri,
-                                        locale::iso639_1::type lang ) const;
-};
-
 ///////////////////////////////////////////////////////////////////////////////
 
 } // namespace internal

=== modified file 'src/runtime/sequences/sequences_impl.cpp'
--- src/runtime/sequences/sequences_impl.cpp	2011-10-03 09:18:49 +0000
+++ src/runtime/sequences/sequences_impl.cpp	2011-11-02 06:07:27 +0000
@@ -1819,10 +1819,10 @@
 
   // Resolve URI to a stream
   zstring lErrorMessage;
-  std::auto_ptr<impl::Resource> lResource = aSctx->resolve_uri
-      (lNormUri, impl::EntityData::DOCUMENT, lErrorMessage);
-  impl::StreamResource* lStreamResource =
-      dynamic_cast<impl::StreamResource*>(lResource.get());
+  std::auto_ptr<internal::Resource> lResource = aSctx->resolve_uri
+      (lNormUri, internal::EntityData::DOCUMENT, lErrorMessage);
+  internal::StreamResource* lStreamResource =
+      dynamic_cast<internal::StreamResource*>(lResource.get());
   if (lStreamResource == NULL) {
     throw XQUERY_EXCEPTION
         (err::FODC0002, ERROR_PARAMS(aUri, lErrorMessage), ERROR_LOC(loc));

=== modified file 'src/runtime/xqdoc/xqdoc_impl.cpp'
--- src/runtime/xqdoc/xqdoc_impl.cpp	2011-08-04 02:14:56 +0000
+++ src/runtime/xqdoc/xqdoc_impl.cpp	2011-11-02 06:07:27 +0000
@@ -52,8 +52,8 @@
   zstring strval;
   std::string uriStr;
   static_context* lSctx;
-  std::auto_ptr<impl::Resource> lResource;
-  impl::StreamResource* lStream;
+  std::auto_ptr<internal::Resource> lResource;
+  internal::StreamResource* lStream;
   std::istream* lFile;
   zstring lErrorMessage;
 
@@ -78,8 +78,8 @@
   lSctx = theSctx;
   lItem->getStringValue2(strval);
   lURI = lSctx->resolve_relative_uri(strval);
-  lResource = lSctx->resolve_uri(lURI, impl::EntityData::MODULE, lErrorMessage);
-  lStream = static_cast<impl::StreamResource*>(lResource.get());
+  lResource = lSctx->resolve_uri(lURI, internal::EntityData::MODULE, lErrorMessage);
+  lStream = static_cast<internal::StreamResource*>(lResource.get());
   if ( ! lStream )
   {
     throw XQUERY_EXCEPTION(

=== modified file 'src/system/globalenv.cpp'
--- src/system/globalenv.cpp	2011-11-01 13:47:10 +0000
+++ src/system/globalenv.cpp	2011-11-02 06:07:27 +0000
@@ -97,7 +97,11 @@
 
   m_globalEnv->m_compilerSubSys = lSubSystem.release();
 
+<<<<<<< TREE
   m_globalEnv->m_http_resolver = new impl::HTTPURLResolver();
+=======
+  m_globalEnv->m_http_resolver      = new internal::HTTPURLResolver();
+>>>>>>> MERGE-SOURCE
 }
 
 

=== modified file 'src/system/globalenv.h'
--- src/system/globalenv.h	2011-06-26 09:43:12 +0000
+++ src/system/globalenv.h	2011-11-02 06:07:27 +0000
@@ -28,10 +28,13 @@
 class root_static_context;
 class XQueryXConvertor;
 
-namespace impl {
+namespace internal {
 class HTTPURLResolver;
 class FileURLResolver;
 class AutoFSURIMapper;
+#ifndef ZORBA_NO_FULL_TEXT
+class ThesaurusURLResolver;
+#endif /* ZORBA_NO_FULL_TEXT */
 }
 
 namespace store {
@@ -57,9 +60,12 @@
   XQueryXConvertor            * xqueryx_convertor;
 #endif
 
-  impl::HTTPURLResolver  * m_http_resolver;
-  impl::FileURLResolver  * m_file_resolver;
-  impl::AutoFSURIMapper  * m_autofs_mapper;
+  internal::HTTPURLResolver       * m_http_resolver;
+  internal::FileURLResolver       * m_file_resolver;
+  internal::AutoFSURIMapper       * m_autofs_mapper;
+#ifndef ZORBA_NO_FULL_TEXT
+  internal::ThesaurusURLResolver  * m_thesaurus_resolver;
+#endif /* ZORBA_NO_FULL_TEXT */
 
 public:
 
@@ -92,11 +98,15 @@
 
   store::IteratorFactory* getIteratorFactory();
 
-  impl::HTTPURLResolver* getHTTPURLResolver() const { return m_http_resolver; }
-
-  impl::FileURLResolver* getFileURLResolver() const { return m_file_resolver; }
-
-  impl::AutoFSURIMapper* getAutoFSURIMapper() const { return m_autofs_mapper; }
+  internal::HTTPURLResolver* getHTTPURLResolver() const { return m_http_resolver; }
+
+  internal::FileURLResolver* getFileURLResolver() const { return m_file_resolver; }
+
+  internal::AutoFSURIMapper* getAutoFSURIMapper() const { return m_autofs_mapper; }
+
+#ifndef ZORBA_NO_FULL_TEXT
+  internal::ThesaurusURLResolver* getThesaurusURLResolver() const { return m_thesaurus_resolver; }
+#endif /* ZORBA_NO_FULL_TEXT */
 
 #ifdef ZORBA_XQUERYX
   XQueryXConvertor* getXQueryXConvertor();

=== modified file 'src/types/schema/schema.cpp'
--- src/types/schema/schema.cpp	2011-10-26 16:55:08 +0000
+++ src/types/schema/schema.cpp	2011-11-02 06:07:27 +0000
@@ -205,7 +205,7 @@
         isSystemId = true;
       }
       
-      std::auto_ptr<impl::Resource> lResource;
+      std::auto_ptr<internal::Resource> lResource;
       
       zstring lStrId = StrX(lId).localForm();
       zstring lResolved;
@@ -228,9 +228,9 @@
       {
         TRACE("lId: " << StrX(lId) << " lResolved: " << lResolved);
         zstring lErrorMessage;
-        lResource = theSctx->resolve_uri(lResolved, impl::EntityData::SCHEMA, lErrorMessage);
-        impl::StreamResource* lStream =
-            dynamic_cast<impl::StreamResource*>(lResource.get());
+        lResource = theSctx->resolve_uri(lResolved, internal::EntityData::SCHEMA, lErrorMessage);
+        internal::StreamResource* lStream =
+            dynamic_cast<internal::StreamResource*>(lResource.get());
         if (lStream != NULL)
         {
           // Pass memory ownership of this istream to the new IstreamInputSource
@@ -265,7 +265,7 @@
   StaticContextEntityResolver(
     const XMLCh* const aLogicalURI,
     static_context * aSctx,
-    impl::StreamResource* aStreamResource)
+    internal::StreamResource* aStreamResource)
     : theLogicalURI(aLogicalURI), theSctx(aSctx)
   {
     // Take memory ownership of the istream
@@ -391,7 +391,7 @@
 *******************************************************************************/
 void Schema::registerXSD(const char* xsdURL,
   static_context * aSctx,
-  impl::StreamResource* stream,
+  internal::StreamResource* stream,
   const QueryLoc& loc)
 {
   std::auto_ptr<SAX2XMLReader> parser;

=== modified file 'src/types/schema/schema.h'
--- src/types/schema/schema.h	2011-06-14 17:26:33 +0000
+++ src/types/schema/schema.h	2011-11-02 06:07:27 +0000
@@ -51,7 +51,7 @@
 {
 
 // Forward reference
-namespace impl
+namespace internal
 {
   class StreamResource;
 }
@@ -103,7 +103,7 @@
   void registerXSD(
         const char* xsdURL,
         static_context * aSctx,
-        impl::StreamResource* aStreamResource,
+        internal::StreamResource* aStreamResource,
         const QueryLoc& loc);
 
   void getSubstitutionHeadForElement(

=== modified file 'test/unit/thesaurus.cpp'
--- test/unit/thesaurus.cpp	2011-08-31 13:17:59 +0000
+++ test/unit/thesaurus.cpp	2011-11-02 06:07:27 +0000
@@ -100,24 +100,20 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-class TestThesaurusProvider : public ThesaurusProvider {
+class TestThesaurusResolver : public URLResolver {
 public:
-  TestThesaurusProvider( String const &uri ) : uri_( uri ) { }
+  TestThesaurusResolver( String const &uri ) : uri_( uri ) { }
 
   // inherited
-  Thesaurus::ptr getThesaurus( String const &uri, iso639_1::type lang ) const;
+  Resource* resolveURL( String const &uri, EntityData const* );
 private:
   String const uri_;
 };
 
-Thesaurus::ptr
-TestThesaurusProvider::getThesaurus( String const &uri,
-                                     iso639_1::type lang ) const {
+Resource*
+TestThesaurusResolver::resolveURL( String const &uri, EntityData const *ed ) {
   static TestThesaurus thesaurus;
-  Thesaurus::ptr result;
-  if ( uri == uri_ )
-    result.reset( &thesaurus );
-  return std::move( result );
+  return uri == uri_ ? &thesaurus : 0;
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -137,8 +133,8 @@
       "  using thesaurus at \"http://test\"; \n";
 
     StaticContext_t sctx = zorba->createStaticContext();
-    TestThesaurusProvider provider( "http://test"; );
-    sctx->addThesaurusProvider( &provider );
+    TestThesaurusResolver resolver( "http://test"; );
+    sctx->registerURLResolver( &resolver );
     XQuery_t xquery = zorba->compileQuery( query_src, sctx );
 
     Zorba_SerializerOptions ser_options;
@@ -154,7 +150,7 @@
   }
   catch ( ZorbaException const &e ) {
     cerr << e << endl;
-    result = 2;
+    result = 3;
   }
 
   zorba->shutdown();


Follow ups