[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-948879 into lp:zorba

2012-04-13 Thread Matthias Brantner
Matthias Brantner has proposed merging lp:~zorba-coders/zorba/bug-948879 into 
lp:zorba.

Requested reviews:
  Matthias Brantner (matthias-brantner)
  Chris Hillery (ceejatec)
Related bugs:
  Bug #948879 in Zorba: --uri-path doesn't work with fetch:content()
  https://bugs.launchpad.net/zorba/+bug/948879

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101874

fix for bug #948879 (--uri-path doesn't work with fetch:content())

Deprecated the C++ API's XmlDataManager::fetch function and replaced it with 
two StaticContext::fetch functions.
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101874
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2012-04-12 09:32:55 +
+++ ChangeLog	2012-04-13 09:13:22 +
@@ -11,6 +11,7 @@
   * Fixed bug 955170 (Catch clause with URILiteral-based wilcard NameTest)
   * Fixed bug 955135 (err:XQDY0044 not caught by try-catch expressions)
   * Fixed bug #967864 (var substitution did not update theFreeVars property)
+  * Fixed bug #948879 (--uri-path doesn't work with fetch:content())
   * Fixed bug in window iterator (binding the end vars in the output tuple stream)
   * Fixed bug #866547 (protect index-join rule from general flwor)
   * Fixed bug #967428 (do not hoist index creation outside a try-catch)

=== modified file 'include/zorba/static_context.h'
--- include/zorba/static_context.h	2012-03-28 05:19:57 +
+++ include/zorba/static_context.h	2012-04-13 09:13:22 +
@@ -685,6 +685,38 @@
*/
   virtual void
   getFullLibPath(std::vectorString aLibPath) const = 0;
+
+  /** \brief Fetches an resource refered to by the given URI.
+   *
+   * Resolution is done using the URI mappers and resolvers registered
+   * in this static context. If no such mappers or resolvers have been
+   * registered, the built-in ones are used. 
+   *
+   * The default EntityKind for resources fetched by this function
+   * is SOME_CONTENT.
+   *
+   * @param aURI the name of the resource to fetch
+   *
+   * @return the fetched resource
+   */
+  virtual Item
+  fetch(const String aURI) const = 0;
+
+  /** \brief Fetches an resource refered to by the given URI.
+   *
+   * Resolution is done using the URI mappers and resolvers registered
+   * in this static context. If no such mappers or resolvers have been
+   * registered, the built-in ones are used. 
+   *
+   * @param aURI the name of the resource to fetch
+   *
+   * @param aEntityKind the kind of the entity to fetch (i.e.
+   *   SOME_CONTENT, SCHEMA, MODULE, THESAURUS, or STOP_WORDS)
+   *
+   * @return the fetched resource
+   */
+  virtual Item
+  fetch(const String aURI, const String aEntityKind) const = 0;
 };
 
 } /* namespace zorba */

=== modified file 'include/zorba/xmldatamanager.h'
--- include/zorba/xmldatamanager.h	2012-03-28 05:19:57 +
+++ include/zorba/xmldatamanager.h	2012-04-13 09:13:22 +
@@ -187,6 +187,8 @@
 ParseOptions aOptions) const = 0;
 
 /** \brief Fetches an resource refered to by the given URI.
+ *
+ * @deprecated this function has been replaced by StaticContext::fetch.
  */
 virtual Item
 fetch(const String aURI) const = 0;

=== modified file 'src/api/staticcontextimpl.cpp'
--- src/api/staticcontextimpl.cpp	2012-03-28 05:19:57 +
+++ src/api/staticcontextimpl.cpp	2012-04-13 09:13:22 +
@@ -25,6 +25,7 @@
 #include zorba/typeident.h
 #include zorba/util/path.h
 #include zorba/empty_sequence.h
+#include zorba/singleton_item_sequence.h
 
 #include store/api/item_factory.h
 #include store/api/temp_seq.h
@@ -1539,5 +1540,50 @@
   ZORBA_CATCH
 }
 
+Item
+StaticContextImpl::fetch(const String aURI) const
+{
+  return fetch(aURI, SOME_CONTENT);
+}
+
+Item
+StaticContextImpl::fetch(
+const String aURI,
+const String aEntityKind) const
+{
+  ZORBA_TRY
+  {
+Zorba* lZorba = Zorba::getInstance(0);
+ItemFactory* lFactory = lZorba-getItemFactory();
+
+Item lQName = lFactory-createQName(static_context::ZORBA_FETCH_FN_NS,
+  content);
+
+// create a streamable string item
+std::vectorItemSequence_t lArgs;
+lArgs.push_back(new SingletonItemSequence(lFactory-createString(aURI)));
+lArgs.push_back(
+new SingletonItemSequence(lFactory-createString(aEntityKind)));
+
+StaticContext_t lCtx = createChildContext();
+
+Zorba_CompilerHints_t lHints;
+std::ostringstream lProlog;
+lProlog
+   import module namespace d = '  static_context::ZORBA_FETCH_FN_NS   ';;
+
+lCtx-loadProlog(lProlog.str(), lHints);
+
+ItemSequence_t lSeq = lCtx-invoke(lQName, lArgs);
+Iterator_t lIter = lSeq-getIterator();
+lIter-open();
+Item lRes;
+lIter-next(lRes);
+return lRes;
+  }
+  ZORBA_CATCH
+  return 0;
+}
+
 } /* namespace zorba */
 /* vim:set et sw=2 ts=2: */

=== modified file 'src/api/staticcontextimpl.h'
--- src/api/staticcontextimpl.h	2012-03-28 05:19:57 +

[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-948879 into lp:zorba

2012-04-13 Thread Matthias Brantner
The proposal to merge lp:~zorba-coders/zorba/bug-948879 into lp:zorba has been 
updated.

Commit Message changed to:

fix for bug #948879 (--uri-path doesn't work with fetch:content())

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101874
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101874
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-948879 into lp:zorba

2012-04-13 Thread Matthias Brantner
Review: Approve


-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101874
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-948879 into lp:zorba

2012-04-13 Thread Zorba Build Bot
Validation queue starting for merge proposal.
Log at: 
http://zorbatest.lambda.nu:8080/remotequeue/bug-948879-2012-04-13T09-21-02.501Z/log.html
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101874
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-948879 into lp:zorba

2012-04-13 Thread Zorba Build Bot
Validation queue job bug-948879-2012-04-13T09-21-02.501Z is finished. The final 
status was:

All tests succeeded!
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101874
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-948879 into lp:zorba

2012-04-13 Thread Zorba Build Bot
Voting does not meet specified criteria. Required: Approve  1, Disapprove  1, 
Needs Fixing  1, Pending  1. Got: 1 Approve, 1 Pending.
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101874
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-948879 into lp:zorba

2012-04-13 Thread Zorba Build Bot
The proposal to merge lp:~zorba-coders/zorba/bug-948879 into lp:zorba has been 
updated.

Status: Approved = Needs review

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101874
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101874
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-948879 into lp:zorba

2012-04-13 Thread Chris Hillery
Review: Approve


-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101874
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-948879 into lp:zorba

2012-04-13 Thread Chris Hillery
The proposal to merge lp:~zorba-coders/zorba/bug-948879 into lp:zorba has been 
updated.

Status: Needs review = Approved

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101874
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101874
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-948879 into lp:zorba

2012-04-13 Thread Zorba Build Bot
Validation queue starting for merge proposal.
Log at: 
http://zorbatest.lambda.nu:8080/remotequeue/bug-948879-2012-04-13T11-04-00.667Z/log.html
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101874
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-948879 into lp:zorba

2012-04-13 Thread Zorba Build Bot
Validation queue job bug-948879-2012-04-13T11-04-00.667Z is finished. The final 
status was:

All tests succeeded!
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101874
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-948879 into lp:zorba

2012-04-13 Thread noreply
The proposal to merge lp:~zorba-coders/zorba/bug-948879 into lp:zorba has been 
updated.

Status: Approved = Merged

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101874
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101874
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-948879 into lp:zorba

2012-04-12 Thread Matthias Brantner
Matthias Brantner has proposed merging lp:~zorba-coders/zorba/bug-948879 into 
lp:zorba.

Requested reviews:
  Matthias Brantner (matthias-brantner)
  Chris Hillery (ceejatec)
Related bugs:
  Bug #948879 in Zorba: --uri-path doesn't work with fetch:content()
  https://bugs.launchpad.net/zorba/+bug/948879

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101708

fix for bug #948879 (--uri-path doesn't work with fetch:content())

Deprecated the C++ API's XmlDataManager::fetch function and replaced it with 
two StaticContext::fetch functions.
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101708
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2012-04-10 15:41:57 +
+++ ChangeLog	2012-04-12 10:09:20 +
@@ -11,6 +11,7 @@
   * Fixed bug 955170 (Catch clause with URILiteral-based wilcard NameTest)
   * Fixed bug 955135 (err:XQDY0044 not caught by try-catch expressions)
   * Fixed bug #967864 (var substitution did not update theFreeVars property)
+  * Fixed bug #948879 (--uri-path doesn't work with fetch:content())
   * Fixed bug in window iterator (binding the end vars in the output tuple stream)
   * Fixed bug #866547 (protect index-join rule from general flwor)
   * Fixed bug #967428 (do not hoist index creation outside a try-catch)

=== modified file 'include/zorba/static_context.h'
--- include/zorba/static_context.h	2012-03-28 05:19:57 +
+++ include/zorba/static_context.h	2012-04-12 10:09:20 +
@@ -629,6 +629,38 @@
   virtual void
 	getExternalVariables(Iterator_t aVarsIter) const = 0;
 
+  /** \brief Fetches an resource refered to by the given URI.
+   *
+   * Resolution is done using the URI mappers and resolvers registered
+   * in this static context. If no such mappers or resolvers have been
+   * registered, the built-in ones are used. 
+   *
+   * The default EntityKind for resources fetched by this function
+   * is SOME_CONTENT.
+   *
+   * @param aURI the name of the resource to fetch
+   *
+   * @return the fetched resource
+   */
+  virtual Item
+  fetch(const String aURI) const = 0;
+
+  /** \brief Fetches an resource refered to by the given URI.
+   *
+   * Resolution is done using the URI mappers and resolvers registered
+   * in this static context. If no such mappers or resolvers have been
+   * registered, the built-in ones are used. 
+   *
+   * @param aURI the name of the resource to fetch
+   *
+   * @param aEntityKind the kind of the entity to fetch (i.e.
+   *   SOME_CONTENT, SCHEMA, MODULE, THESAURUS, or STOP_WORDS)
+   *
+   * @return the fetched resource
+   */
+  virtual Item
+  fetch(const String aURI, const String aEntityKind) const = 0;
+
   /**
* @brief Set the URI lookup path (list of filesystem directories) for this
* static context.

=== modified file 'include/zorba/xmldatamanager.h'
--- include/zorba/xmldatamanager.h	2012-03-28 05:19:57 +
+++ include/zorba/xmldatamanager.h	2012-04-12 10:09:20 +
@@ -187,6 +187,8 @@
 ParseOptions aOptions) const = 0;
 
 /** \brief Fetches an resource refered to by the given URI.
+ *
+ * @deprecated this function has been replaced by StaticContext::fetch.
  */
 virtual Item
 fetch(const String aURI) const = 0;

=== modified file 'src/api/staticcontextimpl.cpp'
--- src/api/staticcontextimpl.cpp	2012-03-28 05:19:57 +
+++ src/api/staticcontextimpl.cpp	2012-04-12 10:09:20 +
@@ -25,6 +25,7 @@
 #include zorba/typeident.h
 #include zorba/util/path.h
 #include zorba/empty_sequence.h
+#include zorba/singleton_item_sequence.h
 
 #include store/api/item_factory.h
 #include store/api/temp_seq.h
@@ -1539,5 +1540,50 @@
   ZORBA_CATCH
 }
 
+Item
+StaticContextImpl::fetch(const String aURI) const
+{
+  return fetch(aURI, SOME_CONTENT);
+}
+
+Item
+StaticContextImpl::fetch(
+const String aURI,
+const String aEntityKind) const
+{
+  ZORBA_TRY
+  {
+Zorba* lZorba = Zorba::getInstance(0);
+ItemFactory* lFactory = lZorba-getItemFactory();
+
+Item lQName = lFactory-createQName(static_context::ZORBA_FETCH_FN_NS,
+  content);
+
+// create a streamable string item
+std::vectorItemSequence_t lArgs;
+lArgs.push_back(new SingletonItemSequence(lFactory-createString(aURI)));
+lArgs.push_back(
+new SingletonItemSequence(lFactory-createString(aEntityKind)));
+
+StaticContext_t lCtx = createChildContext();
+
+Zorba_CompilerHints_t lHints;
+std::ostringstream lProlog;
+lProlog
+   import module namespace d = '  static_context::ZORBA_FETCH_FN_NS   ';;
+
+lCtx-loadProlog(lProlog.str(), lHints);
+
+ItemSequence_t lSeq = lCtx-invoke(lQName, lArgs);
+Iterator_t lIter = lSeq-getIterator();
+lIter-open();
+Item lRes;
+lIter-next(lRes);
+return lRes;
+  }
+  ZORBA_CATCH
+  return 0;
+}
+
 } /* namespace zorba */
 /* vim:set et sw=2 ts=2: */

=== modified file 

[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-948879 into lp:zorba

2012-04-12 Thread Matthias Brantner
The proposal to merge lp:~zorba-coders/zorba/bug-948879 into lp:zorba has been 
updated.

Status: Needs review = Approved

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101708
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101708
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-948879 into lp:zorba

2012-04-12 Thread Matthias Brantner
Review: Approve


-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101708
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-948879 into lp:zorba

2012-04-12 Thread Zorba Build Bot
Validation queue starting for merge proposal.
Log at: 
http://zorbatest.lambda.nu:8080/remotequeue/bug-948879-2012-04-12T10-16-01.483Z/log.html
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101708
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-948879 into lp:zorba

2012-04-12 Thread Zorba Build Bot
Validation queue job bug-948879-2012-04-12T10-16-01.483Z is finished. The final 
status was:

All tests succeeded!
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101708
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-948879 into lp:zorba

2012-04-12 Thread Zorba Build Bot
The proposal to merge lp:~zorba-coders/zorba/bug-948879 into lp:zorba has been 
updated.

Status: Approved = Needs review

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101708
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101708
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-948879 into lp:zorba

2012-04-12 Thread Chris Hillery
Review: Needs Fixing

To maintain ABI compatibility, new virtual functions in the public API need to 
be added at the end of the class definition. At least, that is what I've been 
led to believe. Not sure if we're caring about ABI compat yet, but we might as 
well get into the habit.
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-948879/+merge/101708
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp