zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #01316
[Merge] lp:~ceejatec/zorba/feature-module-installation into lp:zorba
Chris Hillery has proposed merging lp:~ceejatec/zorba/feature-module-installation into lp:zorba.
Requested reviews:
Matthias Brantner (matthias-brantner)
For more details, see:
https://code.launchpad.net/~ceejatec/zorba/feature-module-installation/+merge/80040
--
https://code.launchpad.net/~ceejatec/zorba/feature-module-installation/+merge/80040
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2011-10-09 13:56:39 +0000
+++ CMakeLists.txt 2011-10-21 10:27:25 +0000
@@ -417,13 +417,35 @@
# zorba versioning
SET(ZORBA_MAJOR_NUMBER "2")
-SET(ZORBA_MINOR_NUMBER "0")
-SET(ZORBA_PATCH_NUMBER "1")
+SET(ZORBA_MINOR_NUMBER "1")
+SET(ZORBA_PATCH_NUMBER "0")
SET(ZORBA_VERSION ${ZORBA_MAJOR_NUMBER}.${ZORBA_MINOR_NUMBER}.${ZORBA_PATCH_NUMBER})
MESSAGE(STATUS "Zorba version number: ${ZORBA_VERSION}")
-SET(ZORBA_MODULES_INSTALL_DIR "share/zorba-${ZORBA_VERSION}/modules"
- CACHE STRING "Path (relative to installdir) to modules" FORCE)
-MARK_AS_ADVANCED(ZORBA_MODULES_INSTALL_DIR)
+
+SET(ZORBA_LIB_DIRNAME "lib" CACHE STRING
+ "directory name for libs (may want to set to 'lib64' on 64-bit Linux platforms)")
+
+# Directories for modules and schemas. "Core" are those which are
+# shipped with Zorba and must be present for correct Zorba
+# functionality. "Non-core" are developed independently of Zorba and
+# have different version lifecycles.
+#
+# URI dir is for things resolved by URI - specifically modules (.xq
+# files) and schemas (.xsd files) - which are platform-
+# independent. Lib dir is for platform-specific files, specifically
+# shared libraries for module external functions.
+SET(ZORBA_CORE_URI_DIR "share/zorba-${ZORBA_VERSION}/uris"
+ CACHE STRING "Path (relative to installdir) to core modules/schemas")
+MARK_AS_ADVANCED(ZORBA_CORE_URI_DIR)
+SET(ZORBA_NONCORE_URI_DIR "share/zorba/uris"
+ CACHE STRING "Path (relative to installdir) to non-core modules/schemas")
+MARK_AS_ADVANCED(ZORBA_NONCORE_URI_DIR)
+SET(ZORBA_CORE_LIB_DIR "${ZORBA_LIB_DIRNAME}/zorba-${ZORBA_VERSION}"
+ CACHE STRING "Path (relative to installdir) to core libraries")
+MARK_AS_ADVANCED(ZORBA_CORE_LIB_DIR)
+SET(ZORBA_NONCORE_LIB_DIR "${ZORBA_LIB_DIRNAME}/zorba"
+ CACHE STRING "Path (relative to installdir) to non-core libraries")
+MARK_AS_ADVANCED(ZORBA_NONCORE_LIB_DIR)
# add compiler variables
ADD_DEFINITIONS(${DEFINITIONS})
=== modified file 'NOTICE.txt'
--- NOTICE.txt 2011-10-19 15:28:51 +0000
+++ NOTICE.txt 2011-10-21 10:27:25 +0000
@@ -1,5 +1,5 @@
-----------
-Zorba 2.0.1
+Zorba 2.1.0
-----------
(Note: This file is generated automatically from NOTICE.xml.
=== modified file 'bin/CMakeLists.txt'
--- bin/CMakeLists.txt 2011-08-05 02:21:55 +0000
+++ bin/CMakeLists.txt 2011-10-21 10:27:25 +0000
@@ -41,7 +41,7 @@
zorbacmdproperties.cpp
error_printer.cpp
util.cpp
- module_path.cpp
+ path_util.cpp
)
INCLUDE("${CMAKE_SOURCE_DIR}/cmake_modules/ZorbaGenerateExe.cmake")
@@ -84,3 +84,34 @@
# test the --option option to set an option in the static context
ZORBA_ADD_TEST(bin/zorba_option zorbacmd -q "${CMAKE_CURRENT_SOURCE_DIR}/test/option.xq" -f --option "{http://www.zorba-xquery.com}option=value")
ZORBA_SET_TEST_PROPERTY(bin/zorba_option PASS_REGULAR_EXPRESSION "value")
+
+# test the --uri-path, --lib-path, and --module-path args.
+# Use the versioning tests as they utilize test modules already.
+SET (_testdir
+ "${CMAKE_CURRENT_SOURCE_DIR}/../test/rbkt/Queries/zorba/versioning")
+SET (_uridir "${CMAKE_BINARY_DIR}/TEST_URI_PATH")
+SET (_libdir "${CMAKE_BINARY_DIR}/TEST_LIB_PATH")
+ZORBA_ADD_TEST(bin/zorba_uri_path_1 zorbacmd -f -q "${_testdir}/import1.xq"
+ --uri-path "${_uridir}")
+ZORBA_SET_TEST_PROPERTY(bin/zorba_uri_path_1
+ PASS_REGULAR_EXPRESSION "hello, v2")
+
+ZORBA_ADD_TEST(bin/zorba_uri_path_2 zorbacmd -f -q "${_testdir}/external1.xq"
+ --uri-path "${_uridir}")
+ZORBA_SET_TEST_PROPERTY(bin/zorba_uri_path_2
+ PASS_REGULAR_EXPRESSION "ZXQP0008")
+
+ZORBA_ADD_TEST(bin/zorba_uri_path_3 zorbacmd -f -q "${_testdir}/external1.xq"
+ --uri-path "${_uridir}" --lib-path "${_libdir}")
+ZORBA_SET_TEST_PROPERTY(bin/zorba_uri_path_3
+ PASS_REGULAR_EXPRESSION "hello, v2")
+
+IF(WIN32)
+ SET(PATH_SEP ";")
+ELSE(WIN32)
+ SET(PATH_SEP ":")
+ENDIF(WIN32)
+ZORBA_ADD_TEST(bin/zorba_module_path_1 zorbacmd -f -q "${_testdir}/external1.xq"
+ --module-path "${_libdir}${PATH_SEP}${_uridir}")
+ZORBA_SET_TEST_PROPERTY(bin/zorba_module_path_1
+ PASS_REGULAR_EXPRESSION "hello, v2")
=== renamed file 'bin/module_path.cpp' => 'bin/path_util.cpp'
--- bin/module_path.cpp 2011-05-25 16:40:26 +0000
+++ bin/path_util.cpp 2011-10-21 10:27:25 +0000
@@ -14,85 +14,100 @@
* limitations under the License.
*/
-#include "module_path.h"
+#include "path_util.h"
#include <stdlib.h>
-#include "zorba/zorba_string.h"
+//#include "zorba/zorba_string.h"
#include "zorba/util/path.h"
#include "util.h"
#include "zorbacmdproperties.h"
+#include <zorba/static_context.h>
namespace zorba {
-std::string
-ModulePath::getEnvironmentModulePath()
+namespace PathUtil {
+
+static std::string
+getPathFromEnvironment(std::string const& aEnvVar)
{
- std::string lEnvName("ZORBA_MODULE_PATH");
#ifdef WIN32
char* lBuffer;
size_t lLen=0;
- errno_t lErr = getenv_s(&lLen, NULL, 0, lEnvName.c_str());
+ errno_t lErr = getenv_s(&lLen, NULL, 0, aEnvVar.c_str());
if (lErr || !lLen) return "";
lBuffer = (char*)malloc(lLen * sizeof(char));
if (!lBuffer) return "";
- getenv_s(&lLen, lBuffer, lLen, lEnvName.c_str());
+ getenv_s(&lLen, lBuffer, lLen, aEnvVar.c_str());
std::string lRes(lBuffer);
free(lBuffer);
return lRes;
#else
- const char* lEnvValue = getenv(lEnvName.c_str());
- return lEnvValue!=0?lEnvValue:"";
+ const char* lEnvValue = getenv(aEnvVar.c_str());
+ return lEnvValue != 0 ? lEnvValue : "";
#endif
}
-void
-ModulePath::convertVector(
- const std::vector<std::string>& aSource,
- std::vector<String>& aDest)
-{
- for (std::vector<std::string>::const_iterator lIter = aSource.begin();
- lIter != aSource.end(); ++lIter) {
- aDest.push_back(*lIter);
- }
-}
-void
-ModulePath::tokenizeModulePath(
- const std::string& aModulePath,
- std::vector<std::string>& aResult)
+static void
+tokenizePath(
+ const std::string& aPathStr,
+ std::vector<String>& aResult)
{
+ std::vector<std::string> lPath;
#ifdef WIN32
- Util::tokenize(aModulePath, ";", aResult);
+ Util::tokenize(aPathStr, ";", lPath);
#else
- Util::tokenize(aModulePath, ":", aResult);
+ Util::tokenize(aPathStr, ":", lPath);
#endif
+ for (std::vector<std::string>::iterator lIter = lPath.begin();
+ lIter != lPath.end(); ++lIter) {
+ aResult.push_back(*lIter);
+ }
}
void
-ModulePath::getModulePaths(
+setPathsOnContext(
const ZorbaCMDProperties& aProperties,
- std::vector<String>& aModulePaths)
+ StaticContext_t& aStaticCtx)
{
- std::vector<std::string> lModulePaths; // result vector
- std::string lModulePath; // temporary variable for collections paths
-
- // 1. add the module paths from the command line properties
- aProperties.getModulePaths(lModulePath);
-
- tokenizeModulePath(lModulePath, lModulePaths);
-
- // 2. add the module paths from the environment
- lModulePath = ModulePath::getEnvironmentModulePath();
-
- tokenizeModulePath(lModulePath, lModulePaths);
-
- // 3. add the current working directory as module path
+ std::vector<String> lPath;
+ std::string lPathStr, lEnvStr;
+
+ // Compute the current working directory to append to all paths.
filesystem_path lCWD;
- lModulePaths.push_back(lCWD.get_path());
-
- // convert std::string to zorba::String
- convertVector(lModulePaths, aModulePaths);
+
+ // setModulePaths() *overwrites* the URI path and lib path, so there's no
+ // sense in calling both. So if either --module-path or ZORBA_MODULE_PATH
+ // exists, just use those.
+ aProperties.getModulePath(lPathStr);
+ lEnvStr = getPathFromEnvironment("ZORBA_MODULE_PATH");
+ if (lPathStr.length() > 0 || lEnvStr.length() > 0) {
+ tokenizePath(lPathStr, lPath);
+ tokenizePath(lEnvStr, lPath);
+ lPath.push_back(lCWD.get_path());
+ aStaticCtx->setModulePaths(lPath);
+ }
+ else {
+ // Compute and set URI path
+ aProperties.getURIPath(lPathStr);
+ tokenizePath(lPathStr, lPath);
+ lEnvStr = getPathFromEnvironment("ZORBA_URI_PATH");
+ tokenizePath(lEnvStr, lPath);
+ lPath.push_back(lCWD.get_path());
+ aStaticCtx->setURIPath(lPath);
+ lPath.clear();
+
+ // Compute and set lib path
+ aProperties.getLibPath(lPathStr);
+ tokenizePath(lPathStr, lPath);
+ lEnvStr = getPathFromEnvironment("ZORBA_LIB_PATH");
+ lPath.push_back(lCWD.get_path());
+ tokenizePath(lEnvStr, lPath);
+ aStaticCtx->setLibPath(lPath);
+ }
}
+} /* namespace ModulePath */
+
} /* namespace zorba */
=== renamed file 'bin/module_path.h' => 'bin/path_util.h'
--- bin/module_path.h 2010-02-12 08:57:04 +0000
+++ bin/path_util.h 2011-10-21 10:27:25 +0000
@@ -18,6 +18,7 @@
#include <vector>
#include <string>
+#include <zorba/api_shared_types.h>
class ZorbaCMDProperties;
@@ -25,30 +26,14 @@
class String;
- class ModulePath {
- protected:
- static std::string
- getEnvironmentModulePath();
-
- static void
- convertVector(const std::vector<std::string>& aSource,
- std::vector<String>& aDest);
-
- static void
- tokenizeModulePath(const std::string& aModulePath,
- std::vector<std::string>& aResult);
-
- static void
- getInstalledModulePath(const std::string& aModulePath,
- std::vector<std::string>& aResult);
-
- public:
- static void
- getModulePaths(const ZorbaCMDProperties& aProperties,
- std::vector<String>& aModulePaths);
-
-
- };
+ namespace PathUtil {
+
+ void
+ setPathsOnContext(const ZorbaCMDProperties& aProperties,
+ zorba::StaticContext_t& aStaticCtx);
+
+
+ }
} /* namespace zorba */
#endif
=== modified file 'bin/zorbacmd.cpp'
--- bin/zorbacmd.cpp 2011-07-11 11:12:23 +0000
+++ bin/zorbacmd.cpp 2011-10-21 10:27:25 +0000
@@ -43,7 +43,7 @@
#include "error_printer.h"
#include "util.h"
-#include "module_path.h"
+#include "path_util.h"
// For setting the base URI from the current directory
#include <zorba/util/path.h>
@@ -85,10 +85,8 @@
// 2. environment ZORBA_MODULE_PATH
// 3. current working directory
{
- std::vector<String> lModulePaths;
- ModulePath::getModulePaths(aProperties, lModulePaths);
-
- aStaticContext->setModulePaths(lModulePaths);
+ std::vector<String> lModulePath;
+ PathUtil::setPathsOnContext(aProperties, aStaticContext);
}
if (aProperties.boundarySpace().size() != 0 )
=== modified file 'bin/zorbacmdproperties.cpp'
--- bin/zorbacmdproperties.cpp 2011-07-21 19:21:25 +0000
+++ bin/zorbacmdproperties.cpp 2011-10-21 10:27:25 +0000
@@ -166,11 +166,20 @@
}
-void ZorbaCMDProperties::getModulePaths(std::string& aPaths) const
-{
- aPaths = theModulePath;
-}
-
+void ZorbaCMDProperties::getModulePath(std::string& aPath) const
+{
+ aPath = theModulePath;
+}
+
+void ZorbaCMDProperties::getURIPath(std::string& aPath) const
+{
+ aPath = theUriPath;
+}
+
+void ZorbaCMDProperties::getLibPath(std::string& aPath) const
+{
+ aPath = theLibPath;
+}
std::vector<std::pair<std::string,std::string> > ZorbaCMDProperties::getSerializerParameters() const
{
=== modified file 'bin/zorbacmdproperties.h'
--- bin/zorbacmdproperties.h 2011-06-29 17:25:50 +0000
+++ bin/zorbacmdproperties.h 2011-10-21 10:27:25 +0000
@@ -84,8 +84,14 @@
getSerializerParameters() const;
void
- getModulePaths(std::string&) const;
+ getModulePath(std::string&) const;
+ void
+ getURIPath(std::string&) const;
+
+ void
+ getLibPath(std::string&) const;
+
bool isDebug(){ return theDebug; }
bool hasNoLogo(){ return theNoLogo; }
=== modified file 'bin/zorbacmdproperties.txt'
--- bin/zorbacmdproperties.txt 2011-07-04 08:31:01 +0000
+++ bin/zorbacmdproperties.txt 2011-10-21 10:27:25 +0000
@@ -28,7 +28,9 @@
("debug-port,p", po::value<unsigned int>()->default_value (28028), "The port on which the DBGP-enabled debugger client listens for connections. Defaults to: 28028")
("no-logo", "Print no logo when starting.")
("timeout", po::value<long>()->default_value(-1), "Specify a timeout in seconds. After the specified time, the execution of the query will be aborted.")
-("module-path", po::value<std::string>(), "Module paths added to the built-in resolver, i.e. where module imports are looking for modules.")
+("uri-path", po::value<std::string>(), "URI path (list of directories) added to the built-in URI resolver, i.e. where to find modules/schemas to import.")
+("lib-path", po::value<std::string>(), "Library path (list of directories) where Zorba will look for dynamic libraries (e.g., module external function implementations.")
+("module-path", po::value<std::string>(), "Path (list of directories) to add to both the URI and Library paths.")
("option", po::value<std::vector<std::string> >(), "Set an XQuery option in the static context. The QName of the option is passed as a string in the notation by James Clark (i.e. {namespace}localname). For example, --option {http://www.zorba-xquery.com}option=value").
("trailing-nl", "Output a trailing newline after the result of the query.")
("stop-words", po::value<std::vector<std::string> >(), "Mapping specifying a stop-words URI to another.")
=== modified file 'bin/zorbacmdproperties_base.h'
--- bin/zorbacmdproperties_base.h 2011-07-04 08:31:01 +0000
+++ bin/zorbacmdproperties_base.h 2011-10-21 10:27:25 +0000
@@ -34,7 +34,7 @@
class ZorbaCMDPropertiesBase : public ::zorba::PropertiesBase {
protected:
const char **get_all_options () const {
- static const char *result [] = { "--timing", "--output-file", "--serialization-parameter", "--serialize-html", "--serialize-text", "--indent", "--print-query", "--print-errors-as-xml", "--byte-order-mark", "--omit-xml-declaration", "--base-uri", "--boundary-space", "--default-collation", "--construction-mode", "--ordering-mode", "--multiple", "--query", "--as-files", "--external-variable", "--context-item", "--optimization-level", "--lib-module", "--parse-only", "--compile-only", "--no-serializer", "--debug", "--debug-host", "--debug-port", "--no-logo", "--timeout", "--module-path", "--option", "--trailing-nl", "--stop-words", "--thesaurus", NULL };
+ static const char *result [] = { "--timing", "--output-file", "--serialization-parameter", "--serialize-html", "--serialize-text", "--indent", "--print-query", "--print-errors-as-xml", "--byte-order-mark", "--omit-xml-declaration", "--base-uri", "--boundary-space", "--default-collation", "--construction-mode", "--ordering-mode", "--multiple", "--query", "--as-files", "--external-variable", "--context-item", "--optimization-level", "--lib-module", "--parse-only", "--compile-only", "--no-serializer", "--debug", "--debug-host", "--debug-port", "--no-logo", "--timeout", "--uri-path", "--lib-path", "--module-path", "--option", "--trailing-nl", "--stop-words", "--thesaurus", NULL };
return result;
}
bool theTiming;
@@ -67,6 +67,8 @@
unsigned int theDebugPort;
bool theNoLogo;
long theTimeout;
+ std::string theUriPath;
+ std::string theLibPath;
std::string theModulePath;
std::vector<std::string> theOption;
bool theTrailingNl;
@@ -127,6 +129,8 @@
const unsigned int &debugPort () const { return theDebugPort; }
const bool &noLogo () const { return theNoLogo; }
const long &timeout () const { return theTimeout; }
+ const std::string &uriPath () const { return theUriPath; }
+ const std::string &libPath () const { return theLibPath; }
const std::string &modulePath () const { return theModulePath; }
const std::vector<std::string> &option () const { return theOption; }
const bool &trailingNl () const { return theTrailingNl; }
@@ -262,6 +266,16 @@
if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
if (*argv == NULL) { result = "No value given for --timeout option"; break; } init_val (*argv, theTimeout, d);
}
+ else if (strcmp (*argv, "--uri-path") == 0) {
+ int d = 2;
+ if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
+ if (*argv == NULL) { result = "No value given for --uri-path option"; break; } init_val (*argv, theUriPath, d);
+ }
+ else if (strcmp (*argv, "--lib-path") == 0) {
+ int d = 2;
+ if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
+ if (*argv == NULL) { result = "No value given for --lib-path option"; break; } init_val (*argv, theLibPath, d);
+ }
else if (strcmp (*argv, "--module-path") == 0) {
int d = 2;
if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
@@ -327,11 +341,13 @@
"--compile-only\nOnly compile (don't execute)\n\n"
"--no-serializer\nDo not serialize (discard) result.\n\n"
"--debug, -d\nLaunch the Zorba debugger server and connect to a DBGP-enabled debugger client.\n\n"
-"--debug-host, -p\nThe host where the DBGP-enabled debugger client listens for connections. Defaults to: 127.0.0.1\n\n"
+"--debug-host, -h\nThe host where the DBGP-enabled debugger client listens for connections. Defaults to: 127.0.0.1\n\n"
"--debug-port, -p\nThe port on which the DBGP-enabled debugger client listens for connections. Defaults to: 28028\n\n"
"--no-logo\nPrint no logo when starting.\n\n"
"--timeout\nSpecify a timeout in seconds. After the specified time, the execution of the query will be aborted.\n\n"
-"--module-path\nModule paths added to the built-in resolver, i.e. where module imports are looking for modules.\n\n"
+"--uri-path\nURI path (list of directories) added to the built-in URI resolver, i.e. where to find modules/schemas to import.\n\n"
+"--lib-path\nLibrary path (list of directories) where Zorba will look for dynamic libraries (e.g., module external function implementations.\n\n"
+"--module-path\nPath (list of directories) to add to both the URI and Library paths.\n\n"
"--option\nSet an XQuery option in the static context. The QName of the option is passed as a string in the notation by James Clark (i.e. {namespace}localname). For example, --option {http://www.zorba-xquery.com}option=value\n\n"
"--trailing-nl\nOutput a trailing newline after the result of the query.\n\n"
"--stop-words\nMapping specifying a stop-words URI to another.\n\n"
=== modified file 'cmake_modules/ZorbaModule.cmake'
--- cmake_modules/ZorbaModule.cmake 2011-10-10 10:31:20 +0000
+++ cmake_modules/ZorbaModule.cmake 2011-10-21 10:27:25 +0000
@@ -272,12 +272,12 @@
IF(NOT ${PROJECT_NAME} STREQUAL "zorba")
STRING(REPLACE "-" "_" component_name ${PROJECT_NAME})
INSTALL(TARGETS ${module_lib_target}
- ${target_type} DESTINATION ${ZORBA_MODULES_INSTALL_DIR}/${module_path}
+ ${target_type} DESTINATION ${ZORBA_CORE_LIB_DIR}/${module_path}
COMPONENT ${component_name})
ELSE(NOT ${PROJECT_NAME} STREQUAL "zorba")
INSTALL(TARGETS ${module_lib_target}
- ${target_type} DESTINATION ${ZORBA_MODULES_INSTALL_DIR}/${module_path})
+ ${target_type} DESTINATION ${ZORBA_NONCORE_LIB_DIR}/${module_path})
ENDIF(NOT ${PROJECT_NAME} STREQUAL "zorba")
ENDIF (NOT MODULE_TEST_ONLY)
@@ -296,7 +296,7 @@
ENDIF (patch_ver)
ENDIF (MODULE_VERSION)
FOREACH (version_infix "" ${version_infixes})
- ADD_COPY_RULE ("${SOURCE_FILE}" "${module_path}/${module_filename}"
+ ADD_COPY_RULE ("URI" "${SOURCE_FILE}" "${module_path}/${module_filename}"
"${version_infix}" "" "${MODULE_TEST_ONLY}")
ENDFOREACH (version_infix)
@@ -304,7 +304,7 @@
IF (module_lib_target)
GET_TARGET_PROPERTY (lib_location "${module_lib_target}" LOCATION)
GET_FILENAME_COMPONENT (lib_filename "${lib_location}" NAME)
- ADD_COPY_RULE ("${lib_location}" "${module_path}/${lib_filename}"
+ ADD_COPY_RULE ("LIB" "${lib_location}" "${module_path}/${lib_filename}"
"" "${module_lib_target}" "${MODULE_TEST_ONLY}")
ENDIF (module_lib_target)
@@ -357,27 +357,30 @@
ADD_ZORBA_MANIFEST_ENTRY("schema" ${SCHEMA_URI} "")
ENDIF (NOT SCHEMA_TEST_ONLY)
- ADD_COPY_RULE ("${SOURCE_FILE}" "${schema_path}/${schema_filename}"
+ ADD_COPY_RULE ("URI" "${SOURCE_FILE}" "${schema_path}/${schema_filename}"
"" "" "${SCHEMA_TEST_ONLY}")
ENDMACRO (DECLARE_ZORBA_SCHEMA)
# Utility macro for setting up a build rule to copy a file to a
-# particular (possible versioned) file in URI_PATH if such a file has
+# particular (possibly versioned) file in a shared directory if such a file has
# not already been output.
+# FILE_TYPE: Either "URI" or "LIB"; will be used to determine which shared
+# directory to place output in (URI_PATH or LIB_PATH).
# INPUT_FILE: Absolute path to file to copy.
# OUTPUT_FILE: Relative path to output file (relative to URI_PATH).
# VERSION_ARG: Version; may be "" for non-versioned files.
# DEPEND_TARGET: A CMake target name upon which the copy rule should depend;
# may be "".
# TEST_ONLY: If 1, file is for testcases only; will be copied into
-# TEST_URI_PATH and will not be installed
-MACRO (ADD_COPY_RULE INPUT_FILE OUTPUT_FILE VERSION_ARG DEPEND_TARGET TEST_ONLY)
+# TEST_URI_PATH/TEST_LIB_PATH and will not be installed
+MACRO (ADD_COPY_RULE FILE_TYPE INPUT_FILE OUTPUT_FILE VERSION_ARG
+ DEPEND_TARGET TEST_ONLY)
# Choose output base directory
IF (${TEST_ONLY} EQUAL 1)
- SET (_output_basedir "${CMAKE_BINARY_DIR}/TEST_URI_PATH")
+ SET (_output_basedir "${CMAKE_BINARY_DIR}/TEST_${FILE_TYPE}_PATH")
ELSE (${TEST_ONLY} EQUAL 1)
- SET (_output_basedir "${CMAKE_BINARY_DIR}/URI_PATH")
+ SET (_output_basedir "${CMAKE_BINARY_DIR}/${FILE_TYPE}_PATH")
ENDIF (${TEST_ONLY} EQUAL 1)
# Compute the modified output filename by inserting VERSION_ARG (if
@@ -416,7 +419,7 @@
IF(NOT PROJECT_NAME STREQUAL "zorba")
STRING(REPLACE "-" "_" component_name ${PROJECT_NAME})
INSTALL (FILES "${INPUT_FILE}"
- DESTINATION "${ZORBA_MODULES_INSTALL_DIR}/${_output_path}"
+ DESTINATION "${ZORBA_CORE_URI_DIR}/${_output_path}"
RENAME "${_output_filename}"
COMPONENT "${component_name}")
@@ -436,7 +439,7 @@
ELSE(NOT PROJECT_NAME STREQUAL "zorba")
INSTALL (FILES "${INPUT_FILE}"
- DESTINATION "${ZORBA_MODULES_INSTALL_DIR}/${_output_path}"
+ DESTINATION "${ZORBA_NONCORE_URI_DIR}/${_output_path}"
RENAME "${_output_filename}")
ENDIF(NOT PROJECT_NAME STREQUAL "zorba")
=== modified file 'config/CMakeLists.txt'
--- config/CMakeLists.txt 2011-09-08 19:19:54 +0000
+++ config/CMakeLists.txt 2011-10-21 10:27:25 +0000
@@ -34,7 +34,8 @@
SET(Zorba_EXE_PATH "${ZORBA_ROOT}/bin/zorba")
SET(Zorba_EXTERNALMODULECONFIG_FILE
"${ZORBA_ROOT}/${ZORBA_CMAKE_DIR}/ExternalModuleConfig.cmake.in")
-SET(Zorba_MODULES_INSTALL_DIR "${ZORBA_ROOT}/${ZORBA_MODULES_INSTALL_DIR}")
+SET(Zorba_NONCORE_URI_DIR "${ZORBA_ROOT}/${ZORBA_NONCORE_URI_DIR}")
+SET(Zorba_NONCORE_LIB_DIR "${ZORBA_ROOT}/${ZORBA_NONCORE_LIB_DIR}")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/ZorbaConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/ZorbaConfig.cmake" @ONLY)
@@ -58,7 +59,7 @@
STRING (REPLACE ".exe" ".bat" Zorba_TESTDRIVER ${Zorba_TESTDRIVER})
ENDIF (WIN32)
-SET(Zorba_EXE_PATH "${ZORBA_EXE}")
+SET(Zorba_EXE_PATH "${ZORBA_EXE}")
SET(Zorba_EXTERNALMODULECONFIG_FILE
"${CMAKE_CURRENT_SOURCE_DIR}/ExternalModuleConfig.cmake.in")
# Note: We also set these two into the parent's scope, so that it is
@@ -67,10 +68,9 @@
"${CMAKE_CURRENT_SOURCE_DIR}/ExternalModuleConfig.cmake.in"
PARENT_SCOPE)
SET(Zorba_EXE "${ZORBA_EXE}" PARENT_SCOPE)
+SET(Zorba_NONCORE_URI_DIR "${ZORBA_NONCORE_URI_DIR}")
+SET(Zorba_NONCORE_LIB_DIR "${ZORBA_NONCORE_LIB_DIR}")
-# Note: This value doesn't really make much sense, but neither does any
-# other value
-SET(Zorba_MODULES_INSTALL_DIR "${ZORBA_MODULES_INSTALL_DIR}")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/ZorbaConfig.cmake.in"
"${CMAKE_BINARY_DIR}/ZorbaConfig.cmake" @ONLY)
=== modified file 'config/ZorbaConfig.cmake.in'
--- config/ZorbaConfig.cmake.in 2011-08-24 09:09:02 +0000
+++ config/ZorbaConfig.cmake.in 2011-10-21 10:27:25 +0000
@@ -47,10 +47,13 @@
"Path to Zorba's testdriver" FORCE)
SET_NORMALIZED (Zorba_EXE "@Zorba_EXE_PATH@" CACHE PATH "Path to Zorba executable" FORCE)
-# Tell the user project where modules are installed. Note: This variable
-# is all-uppercase because it is also used internally by Zorba's build.
-SET (ZORBA_MODULES_INSTALL_DIR "@Zorba_MODULES_INSTALL_DIR@"
- CACHE STRING "Path to Zorba modules in this Zorba installation" FORCE)
+# Tell the user project where (non-core) modules are installed. Note:
+# These variables are all-uppercase because they are also used
+# internally by Zorba's build.
+SET (ZORBA_NONCORE_URI_DIR "@Zorba_NONCORE_URI_DIR@"
+ CACHE STRING "Path to Zorba to non-core modules/schemas in this Zorba installation" FORCE)
+SET (ZORBA_NONCORE_LIB_DIR "@Zorba_NONCORE_LIB_DIR@"
+ CACHE STRING "Path to Zorba to non-core libraries in this Zorba installation" FORCE)
# Tell the user project where to find the "USE" file.
# This file uses the above settings to configure the user project.
=== modified file 'include/zorba/config.h.cmake'
--- include/zorba/config.h.cmake 2011-08-22 15:14:14 +0000
+++ include/zorba/config.h.cmake 2011-10-21 10:27:25 +0000
@@ -138,7 +138,10 @@
#define ZORBA_MAJOR_NUMBER ${ZORBA_MAJOR_NUMBER}
#define ZORBA_MINOR_NUMBER ${ZORBA_MINOR_NUMBER}
#define ZORBA_PATCH_NUMBER ${ZORBA_PATCH_NUMBER}
-#define ZORBA_MODULES_INSTALL_DIR "${ZORBA_MODULES_INSTALL_DIR}"
+#define ZORBA_CORE_URI_DIR "${ZORBA_CORE_URI_DIR}"
+#define ZORBA_CORE_LIB_DIR "${ZORBA_CORE_LIB_DIR}"
+#define ZORBA_NONCORE_URI_DIR "${ZORBA_NONCORE_URI_DIR}"
+#define ZORBA_NONCORE_LIB_DIR "${ZORBA_NONCORE_LIB_DIR}"
// Zorba features
#cmakedefine ZORBA_NO_FULL_TEXT
=== 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-10-21 10:27:25 +0000
@@ -450,12 +450,36 @@
virtual void
declareOption( const Item& aQName, const String& aOptionValue) = 0;
+ /**
+ * @brief Set the URI and library lookup paths (lists of filesystem
+ * directories) for this static context. Note that calling this method
+ * will override any values previously passed to \link setURIPath()
+ * and \link setLibPath().
+ * @deprecated Use \link setURIPath() and \link setLibPath().
+ *
+ * Convenience method which adds the listed directories to both the
+ * URI path and Library path for this static context.
+ */
virtual void
setModulePaths( const std::vector<String>& aModulePaths ) = 0;
+ /**
+ * @brief Return the union of the URI and library lookup paths (lists of
+ * filesystem directories) for this static context. @deprecated Use \link
+ * getURIPath() and \link getLibPath().
+ * @deprecated Use \link getURIPath() and \link getLibPath().
+ *
+ * Returns any values set by \link setLibPath() and/or \link setURIPath()
+ * on this static context.
+ */
virtual void
getModulePaths( std::vector<String>& aModulePaths ) const = 0;
+ /**
+ * @brief Return the union of the URI and library lookup paths (lists of
+ * filesystem directories) for this static context and all its parents.
+ * @deprecated Use \link getFullURIPath() and \link getFullLibPath().
+ */
virtual void
getFullModulePaths( std::vector<String>& aFullModulePaths ) const = 0;
@@ -576,6 +600,63 @@
virtual audit::Event*
getAuditEvent() = 0;
+ /**
+ * @brief Set the URI lookup path (list of filesystem directories) for this
+ * static context.
+ *
+ * Queries which resolve URIs (for instance, importing modules or schemas)
+ * will look in these directories.
+ */
+ virtual void
+ setURIPath(const std::vector<String>& aURIPath) = 0;
+
+ /**
+ * @brief Return the URI lookup path (list of filesystem directories) for
+ * this static context.
+ *
+ * Returns any values set by \link setURIPath() on this static context.
+ * To return the full URI lookup path for this static context and
+ * all its parents (usually most useful), call \link getFullURIPath().
+ */
+ virtual void
+ getURIPath(std::vector<String>& aURIPath) const = 0;
+
+ /**
+ * @brief Return the URI lookup path (list of filesystem directories) for
+ * this static context and all its parents.
+ */
+ virtual void
+ getFullURIPath(std::vector<String>& aURIPath) const = 0;
+
+ /**
+ * @brief Set the library lookup path (list of filesystem directories) for
+ * this static context.
+ *
+ * Queries which import modules that have external function
+ * implementations will look for the implementation of those functions
+ * (shared libraries) in these directories.
+ */
+ virtual void
+ setLibPath(const std::vector<String>& aLibPath) = 0;
+
+ /**
+ * @brief Return the URI lookup path (list of filesystem directories) for
+ * this static context.
+ *
+ * Returns any values set by \link setLibPath() on this static context.
+ * To return the full library lookup path for this static context and
+ * all its parents (usually most useful), call \link getFullLibPath().
+ */
+ virtual void
+ getLibPath(std::vector<String>& aLibPath) const = 0;
+
+ /**
+ * @brief Return the URI lookup path (list of filesystem directories) for
+ * this static context and all its parents.
+ */
+ virtual void
+ getFullLibPath(std::vector<String>& aLibPath) const = 0;
+
};
} /* namespace zorba */
#endif
=== modified file 'src/api/staticcontextimpl.cpp'
--- src/api/staticcontextimpl.cpp 2011-09-14 11:08:52 +0000
+++ src/api/staticcontextimpl.cpp 2011-10-21 10:27:25 +0000
@@ -963,50 +963,151 @@
theSctxMap = impl.theCompilerCB->theSctxMap;
}
-
-void StaticContextImpl::setModulePaths(const std::vector<String>& aModulePaths)
+static void
+toInternalPath(const std::vector<String>& aPublicStrings,
+ std::vector<zstring>& aInternalStrings)
{
- try
+ for (std::vector<String>::const_iterator lIter = aPublicStrings.begin();
+ lIter != aPublicStrings.end(); ++lIter)
{
- std::vector<zstring> lModulePaths;
-
- for (std::vector<String>::const_iterator lIter = aModulePaths.begin();
- lIter != aModulePaths.end(); ++lIter)
+ if (lIter->length() != 0)
{
- if (lIter->length() != 0)
+ aInternalStrings.push_back(Unmarshaller::getInternalString(*lIter).c_str());
+ zstring& lPath = aInternalStrings.back();
+ if (lPath[lPath.length() - 1] != *filesystem_path::get_directory_separator())
{
- lModulePaths.push_back(Unmarshaller::getInternalString(*lIter).c_str());
- zstring& lPath = lModulePaths.back();
- if (lPath.rfind(filesystem_path::get_directory_separator()) != std::string::npos)
- {
- lPath.append(filesystem_path::get_directory_separator());
- }
+ lPath.append(filesystem_path::get_directory_separator());
}
-
}
-
- theCtx->set_module_paths(lModulePaths);
- }
- catch (ZorbaException const& e)
- {
- ZorbaImpl::notifyError(theDiagnosticHandler, e);
- }
-}
-
+ }
+}
+
+static void
+toPublicPath(const std::vector<zstring>& aInternalStrings,
+ std::vector<String>& aPublicStrings)
+{
+ for (std::vector<zstring>::const_iterator lIter = aInternalStrings.begin();
+ lIter != aInternalStrings.end(); ++lIter)
+ {
+ aPublicStrings.push_back(lIter->c_str());
+ }
+}
+
+void
+StaticContextImpl::setURIPath(const std::vector<String> &aURIPath)
+{
+ try
+ {
+ std::vector<zstring> lInternalURIPath;
+ toInternalPath(aURIPath, lInternalURIPath);
+ theCtx->set_uri_path(lInternalURIPath);
+ }
+ catch (ZorbaException const& e)
+ {
+ ZorbaImpl::notifyError(theDiagnosticHandler, e);
+ }
+}
+
+void
+StaticContextImpl::getURIPath(std::vector<String> &aURIPath) const
+{
+ try
+ {
+ std::vector<zstring> lInternalURIPath;
+ theCtx->get_uri_path(lInternalURIPath);
+ toPublicPath(lInternalURIPath, aURIPath);
+ }
+ catch (ZorbaException const& e)
+ {
+ ZorbaImpl::notifyError(theDiagnosticHandler, e);
+ }
+}
+
+void
+StaticContextImpl::getFullURIPath(std::vector<String> &aURIPath) const
+{
+ try
+ {
+ std::vector<zstring> lInternalURIPath;
+ theCtx->get_full_uri_path(lInternalURIPath);
+ toPublicPath(lInternalURIPath, aURIPath);
+ }
+ catch (ZorbaException const& e)
+ {
+ ZorbaImpl::notifyError(theDiagnosticHandler, e);
+ }
+}
+
+void
+StaticContextImpl::setLibPath(const std::vector<String> &aLibPath)
+{
+ try
+ {
+ std::vector<zstring> lInternalLibPath;
+ toInternalPath(aLibPath, lInternalLibPath);
+ theCtx->set_lib_path(lInternalLibPath);
+ }
+ catch (ZorbaException const& e)
+ {
+ ZorbaImpl::notifyError(theDiagnosticHandler, e);
+ }
+}
+
+void
+StaticContextImpl::getLibPath(std::vector<String> &aLibPath) const
+{
+ try
+ {
+ std::vector<zstring> lInternalLibPath;
+ theCtx->get_lib_path(lInternalLibPath);
+ toPublicPath(lInternalLibPath, aLibPath);
+ }
+ catch (ZorbaException const& e)
+ {
+ ZorbaImpl::notifyError(theDiagnosticHandler, e);
+ }
+}
+
+void
+StaticContextImpl::getFullLibPath(std::vector<String> &aLibPath) const
+{
+ try
+ {
+ std::vector<zstring> lInternalLibPath;
+ theCtx->get_full_lib_path(lInternalLibPath);
+ toPublicPath(lInternalLibPath, aLibPath);
+ }
+ catch (ZorbaException const& e)
+ {
+ ZorbaImpl::notifyError(theDiagnosticHandler, e);
+ }
+}
+
+void StaticContextImpl::setModulePaths(const std::vector<String>& aModulePaths)
+{
+ try
+ {
+ std::vector<zstring> lInternalModulePath;
+ toInternalPath(aModulePaths, lInternalModulePath);
+ theCtx->set_lib_path(lInternalModulePath);
+ theCtx->set_uri_path(lInternalModulePath);
+ }
+ catch (ZorbaException const& e)
+ {
+ ZorbaImpl::notifyError(theDiagnosticHandler, e);
+ }
+}
void StaticContextImpl::getModulePaths(std::vector<String>& aModulePaths) const
{
try
{
- std::vector<zstring> lModulePaths;
-
- theCtx->get_module_paths(lModulePaths);
-
- for (std::vector<zstring>::const_iterator lIter = lModulePaths.begin();
- lIter != lModulePaths.end(); ++lIter)
- {
- aModulePaths.push_back(lIter->c_str());
- }
+ std::vector<zstring> lInternalModulePath;
+ theCtx->get_lib_path(lInternalModulePath);
+ toPublicPath(lInternalModulePath, aModulePaths);
+ lInternalModulePath.clear();
+ theCtx->get_uri_path(lInternalModulePath);
+ toPublicPath(lInternalModulePath, aModulePaths);
}
catch (ZorbaException const& e)
{
@@ -1020,15 +1121,12 @@
{
try
{
- std::vector<zstring> lFullModulePaths;
-
- theCtx->get_full_module_paths(lFullModulePaths);
-
- for (std::vector<zstring>::const_iterator lIter = lFullModulePaths.begin();
- lIter != lFullModulePaths.end(); ++lIter)
- {
- aFullModulePaths.push_back(lIter->c_str());
- }
+ std::vector<zstring> lInternalModulePath;
+ theCtx->get_full_lib_path(lInternalModulePath);
+ toPublicPath(lInternalModulePath, aFullModulePaths);
+ lInternalModulePath.clear();
+ theCtx->get_full_uri_path(lInternalModulePath);
+ toPublicPath(lInternalModulePath, aFullModulePaths);
}
catch (ZorbaException const& e)
{
=== modified file 'src/api/staticcontextimpl.h'
--- src/api/staticcontextimpl.h 2011-08-31 13:17:59 +0000
+++ src/api/staticcontextimpl.h 2011-10-21 10:27:25 +0000
@@ -269,6 +269,24 @@
virtual audit::Event*
getAuditEvent();
+ virtual void
+ setURIPath(const std::vector<String>& aURIPath);
+
+ virtual void
+ getURIPath(std::vector<String>& aURIPath) const;
+
+ virtual void
+ getFullURIPath(std::vector<String>& aURIPath) const;
+
+ virtual void
+ setLibPath(const std::vector<String>& aLibPath);
+
+ virtual void
+ getLibPath(std::vector<String>& aLibPath) const;
+
+ virtual void
+ getFullLibPath(std::vector<String>& aLibPath) const;
+
protected:
String
createInvokeQuery(const Function_t&, size_t aArity) const;
=== 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-10-21 10:27:25 +0000
@@ -147,7 +147,7 @@
// file: URI based on every member of the static context's module
// paths, and return that URI to the caller.
std::vector<zstring> lModulePaths;
- aSctx.get_full_module_paths(lModulePaths);
+ aSctx.get_full_uri_path(lModulePaths);
for (std::vector<zstring>::const_iterator lIter = lModulePaths.begin();
lIter != lModulePaths.end(); lIter++)
{
=== modified file 'src/context/dynamic_loader.cpp'
--- src/context/dynamic_loader.cpp 2011-08-08 13:51:27 +0000
+++ src/context/dynamic_loader.cpp 2011-10-21 10:27:25 +0000
@@ -216,12 +216,12 @@
ExternalModule*
DynamicLoader::getExternalModule(zstring const& aNsURI, static_context& aSctx)
{
- std::vector<zstring> lModulePaths;
- aSctx.get_full_module_paths(lModulePaths);
+ std::vector<zstring> lLibPath;
+ aSctx.get_full_lib_path(lLibPath);
std::auto_ptr<std::istream> modfile(0); // result file
- if (lModulePaths.size() != 0)
+ if (lLibPath.size() != 0)
{
URI lURI(aNsURI);
@@ -243,10 +243,9 @@
zstring lLibraryNameDebug = computeLibraryName(lURI, lImportedVersion, true);
- // Check all module path in the according order. The higher in the hirarchy
- // the static context is the higher the priority of its module paths.
- for (std::vector<zstring>::const_iterator ite = lModulePaths.begin();
- ite != lModulePaths.end();
+ // Check all module path in the according order.
+ for (std::vector<zstring>::const_iterator ite = lLibPath.begin();
+ ite != lLibPath.end();
++ite)
{
zstring potentialModuleFile = (*ite);
=== 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-10-21 10:27:25 +0000
@@ -40,6 +40,17 @@
theTypemgr = new RootTypeManager();
}
+#ifdef WIN32
+static void append_to_path(std::vector<zstring>& aPath, zstring& zorba_root,
+ zstring& relpath)
+{
+ ascii::replace_all(relpath, '/', '\\');
+ zstring full_path(zorba_root);
+ full_path.append(relpath);
+ full_path.append("\\");
+ aPath.push_back(full_path);
+}
+#endif
void root_static_context::init()
{
@@ -105,9 +116,10 @@
set_validation_mode(StaticContextConsts::lax_validation);
- std::vector<zstring> lRootModulePaths;
+ std::vector<zstring> lRootURIPath;
+ std::vector<zstring> lRootLibPath;
#ifdef WIN32
- //add first the relative path to zorba_simplestore.dll (this dll)
+ // compute the relative path to zorba_simplestore.dll (this dll)
WCHAR wdll_path[1024];
DWORD dll_path_size;
dll_path_size = GetModuleFileNameW(NULL, wdll_path, sizeof(wdll_path)/sizeof(wdll_path[0]));
@@ -116,30 +128,34 @@
wdll_path[dll_path_size] = 0;
char dll_path[1024];
WideCharToMultiByte(CP_UTF8, 0, wdll_path, -1, dll_path, sizeof(dll_path), NULL, NULL);
- char *last_slash;
- last_slash = strrchr(dll_path, '\\');
+ char *last_slash = strrchr(dll_path, '\\');
if(last_slash)
{
last_slash[1] = 0;
- zstring moddir(ZORBA_MODULES_INSTALL_DIR);
- ascii::replace_all(moddir, '/', '\\');
- zstring fileURL;
- fileURL = dll_path;
- fileURL = fileURL.append("..\\");
- fileURL = fileURL.append(moddir);
- fileURL = fileURL.append("\\");
- lRootModulePaths.push_back(fileURL);
+ zstring zorba_root_dir(dll_path);
+
+ append_to_path(lRootURIPath, zorba_root_dir, zstring(ZORBA_CORE_URI_DIR));
+ append_to_path(lRootURIPath, zorba_root_dir, zstring(ZORBA_NONCORE_URI_DIR));
+ append_to_path(lRootLibPath, zorba_root_dir, zstring(ZORBA_CORE_LIB_DIR));
+ append_to_path(lRootLibPath, zorba_root_dir, zstring(ZORBA_NONCORE_LIB_DIR));
}
}
#endif
- const char ** lPathsIter = get_builtin_module_paths();
- for (; *lPathsIter != 0; ++lPathsIter)
- {
- lRootModulePaths.push_back(*lPathsIter);
- }
- set_module_paths(lRootModulePaths);
-
- // by default enabled features
+ const char ** lURIPathIter = get_builtin_uri_path();
+ for (; *lURIPathIter != 0; ++lURIPathIter)
+ {
+ lRootURIPath.push_back(*lURIPathIter);
+ }
+ set_uri_path(lRootURIPath);
+
+ const char ** lLibPathIter = get_builtin_lib_path();
+ for (; *lLibPathIter != 0; ++lLibPathIter)
+ {
+ lRootLibPath.push_back(*lLibPathIter);
+ }
+ set_lib_path(lRootLibPath);
+
+ // by default enabled features
set_feature( feature::ddl );
set_feature( feature::scripting );
set_feature( feature::trace );
=== modified file 'src/context/root_static_context.h'
--- src/context/root_static_context.h 2011-07-12 23:32:16 +0000
+++ src/context/root_static_context.h 2011-10-21 10:27:25 +0000
@@ -26,8 +26,9 @@
friend class GlobalEnvironment;
friend class static_context;
-protected:
- static const char* theBuiltInModulePaths[];
+private:
+ static const char* theBuiltinURIPath[];
+ static const char* theBuiltinLibPath[];
protected:
zstring theImplementationBaseUri;
@@ -39,7 +40,8 @@
void init();
- const char** get_builtin_module_paths() const { return theBuiltInModulePaths; }
+ const char** get_builtin_uri_path() const { return theBuiltinURIPath; }
+ const char** get_builtin_lib_path() const { return theBuiltinLibPath; }
};
}
=== modified file 'src/context/root_static_context_init.cpp.in'
--- src/context/root_static_context_init.cpp.in 2011-07-22 08:36:51 +0000
+++ src/context/root_static_context_init.cpp.in 2011-10-21 10:27:25 +0000
@@ -20,9 +20,16 @@
namespace zorba {
- const char* root_static_context::theBuiltInModulePaths[] = {
- "@CMAKE_INSTALL_PREFIX@/@ZORBA_MODULES_INSTALL_DIR@/",
+ const char* root_static_context::theBuiltinURIPath[] = {
+ "@CMAKE_INSTALL_PREFIX@/@ZORBA_CORE_URI_DIR@/",
+ "@CMAKE_INSTALL_PREFIX@/@ZORBA_NONCORE_URI_DIR@/",
"@CMAKE_BINARY_DIR@/URI_PATH/",
0 };
+ const char* root_static_context::theBuiltinLibPath[] = {
+ "@CMAKE_INSTALL_PREFIX@/@ZORBA_CORE_LIB_DIR@/",
+ "@CMAKE_INSTALL_PREFIX@/@ZORBA_NONCORE_LIB_DIR@/",
+ "@CMAKE_BINARY_DIR@/LIB_PATH/",
+ 0 };
+
} /* namespace zorba */
=== modified file 'src/context/static_context.cpp'
--- src/context/static_context.cpp 2011-10-18 19:06:06 +0000
+++ src/context/static_context.cpp 2011-10-21 10:27:25 +0000
@@ -866,7 +866,8 @@
serialize_resolvers(ar);
serialize_tracestream(ar);
- ar & theModulePaths;
+ ar & theURIPath;
+ ar & theLibPath;
// Options must be serialized BEFORE external modules
ar & theOptionMap;
@@ -1519,6 +1520,13 @@
for (std::vector<zstring>::iterator url = aUrls.begin();
url != aUrls.end(); url++)
{
+ // if the http-client module is not available, we must not search
+ // for it by calling the http-client...
+ if (*url == "http://www.zorba-xquery.com/modules/http-client")
+ {
+ continue;
+ }
+
// Iterate upwards through the static_context tree...
for (static_context const* sctx = this;
sctx != NULL; sctx = sctx->theParent)
@@ -1530,18 +1538,13 @@
{
try
{
- // if the http-client module is not available, we must not search
- // for it by calling the http-client...
- if (*url != "http://www.zorba-xquery.com/modules/http-client")
+ // Take ownership of returned Resource (if any)
+ oResource.reset((*resolver)->resolveURL(*url, aEntityData));
+ if (oResource.get() != NULL)
{
- // Take ownership of returned Resource (if any)
- oResource.reset((*resolver)->resolveURL(*url, aEntityData));
- if (oResource.get() != NULL)
- {
- // Populate the URL used to load this Resource
- oResource->setUrl(*url);
- return;
- }
+ // Populate the URL used to load this Resource
+ oResource->setUrl(*url);
+ return;
}
}
catch (const std::exception& e)
@@ -1566,32 +1569,63 @@
/*******************************************************************************
********************************************************************************/
-void static_context::set_module_paths(const std::vector<zstring>& paths)
-{
- theModulePaths = paths;
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
-void static_context::get_module_paths(std::vector<zstring>& paths) const
-{
- paths.insert(paths.end(), theModulePaths.begin(), theModulePaths.end());
-}
-
-
-/*******************************************************************************
-
-********************************************************************************/
-void static_context::get_full_module_paths(std::vector<zstring>& paths) const
-{
- if (theParent != NULL)
- {
- theParent->get_full_module_paths(paths);
- }
-
- get_module_paths(paths);
+void static_context::set_uri_path(const std::vector<zstring>& path)
+{
+ theURIPath = path;
+}
+
+
+/*******************************************************************************
+
+********************************************************************************/
+void static_context::get_uri_path(std::vector<zstring>& path) const
+{
+ path.insert(path.end(), theURIPath.begin(), theURIPath.end());
+}
+
+
+/*******************************************************************************
+
+********************************************************************************/
+void static_context::get_full_uri_path(std::vector<zstring>& path) const
+{
+ if (theParent != NULL)
+ {
+ theParent->get_full_uri_path(path);
+ }
+
+ get_uri_path(path);
+}
+
+/*******************************************************************************
+
+********************************************************************************/
+void static_context::set_lib_path(const std::vector<zstring>& path)
+{
+ theLibPath = path;
+}
+
+
+/*******************************************************************************
+
+********************************************************************************/
+void static_context::get_lib_path(std::vector<zstring>& path) const
+{
+ path.insert(path.end(), theLibPath.begin(), theLibPath.end());
+}
+
+
+/*******************************************************************************
+
+********************************************************************************/
+void static_context::get_full_lib_path(std::vector<zstring>& path) const
+{
+ if (theParent != NULL)
+ {
+ theParent->get_full_lib_path(path);
+ }
+
+ get_lib_path(path);
}
=== modified file 'src/context/static_context.h'
--- src/context/static_context.h 2011-10-18 19:06:06 +0000
+++ src/context/static_context.h 2011-10-21 10:27:25 +0000
@@ -515,7 +515,9 @@
thesaurus_providers_t theThesaurusProviders;
#endif /* ZORBA_NO_FULL_TEXT */
- checked_vector<zstring> theModulePaths;
+ checked_vector<zstring> theURIPath;
+
+ checked_vector<zstring> theLibPath;
ExternalModuleMap * theExternalModulesMap;
@@ -711,12 +713,17 @@
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;
-
- void get_full_module_paths(std::vector<zstring>& aFullModulePaths) const;
-
+ void set_uri_path(const std::vector<zstring>& aURIPath);
+
+ void get_uri_path(std::vector<zstring>& oURIPath) const;
+
+ void get_full_uri_path(std::vector<zstring>& oURIPath) const;
+
+ void set_lib_path(const std::vector<zstring>& aLibPath);
+
+ void get_lib_path(std::vector<zstring>& oLibPath) const;
+
+ void get_full_lib_path(std::vector<zstring>& oLibPath) const;
//
// Validating Items
=== modified file 'test/rbkt/testdriver_common.cpp'
--- test/rbkt/testdriver_common.cpp 2011-09-06 14:04:01 +0000
+++ test/rbkt/testdriver_common.cpp 2011-10-21 10:27:25 +0000
@@ -527,8 +527,10 @@
}
lModulePaths.push_back(paths);
- // Add the default path for test modules.
+ // Add the default paths for test modules.
zorba::String lDefPath = zorba::CMAKE_BINARY_DIR + "/TEST_URI_PATH";
lModulePaths.push_back(lDefPath);
+ lDefPath = zorba::CMAKE_BINARY_DIR + "/TEST_LIB_PATH";
+ lModulePaths.push_back(lDefPath);
sctx->setModulePaths(lModulePaths);
}
Follow ups
-
[Merge] lp:~ceejatec/zorba/feature-module-installation into lp:zorba
From: noreply, 2011-11-04
-
[Merge] lp:~ceejatec/zorba/feature-module-installation into lp:zorba
From: Zorba Build Bot, 2011-11-04
-
[Merge] lp:~ceejatec/zorba/feature-module-installation into lp:zorba
From: Zorba Build Bot, 2011-11-04
-
[Merge] lp:~ceejatec/zorba/feature-module-installation into lp:zorba
From: Matthias Brantner, 2011-11-04
-
Re: [Merge] lp:~ceejatec/zorba/feature-module-installation into lp:zorba
From: Matthias Brantner, 2011-11-04
-
[Merge] lp:~ceejatec/zorba/feature-module-installation into lp:zorba
From: Zorba Build Bot, 2011-11-04
-
Re: [Merge] lp:~ceejatec/zorba/feature-module-installation into lp:zorba
From: Zorba Build Bot, 2011-11-04
-
[Merge] lp:~ceejatec/zorba/feature-module-installation into lp:zorba
From: Zorba Build Bot, 2011-11-04
-
[Merge] lp:~ceejatec/zorba/feature-module-installation into lp:zorba
From: Zorba Build Bot, 2011-11-04
-
[Merge] lp:~ceejatec/zorba/feature-module-installation into lp:zorba
From: Chris Hillery, 2011-11-04
-
Re: [Merge] lp:~ceejatec/zorba/feature-module-installation into lp:zorba
From: Chris Hillery, 2011-11-04
-
Re: [Merge] lp:~ceejatec/zorba/feature-module-installation into lp:zorba
From: Matthias Brantner, 2011-10-21
-
[Merge] lp:~ceejatec/zorba/feature-module-installation into lp:zorba
From: Zorba Build Bot, 2011-10-21
-
Re: [Merge] lp:~ceejatec/zorba/feature-module-installation into lp:zorba
From: Zorba Build Bot, 2011-10-21
-
[Merge] lp:~ceejatec/zorba/feature-module-installation into lp:zorba
From: Zorba Build Bot, 2011-10-21
-
[Merge] lp:~ceejatec/zorba/feature-module-installation into lp:zorba
From: Zorba Build Bot, 2011-10-21
-
Re: [Merge] lp:~ceejatec/zorba/feature-module-installation into lp:zorba
From: Chris Hillery, 2011-10-21
-
Re: [Merge] lp:~ceejatec/zorba/feature-module-installation into lp:zorba
From: Chris Hillery, 2011-10-21
-
[Merge] lp:~ceejatec/zorba/feature-module-installation into lp:zorba
From: Chris Hillery, 2011-10-21
-
[Merge] lp:~ceejatec/zorba/feature-module-installation into lp:zorba
From: Chris Hillery, 2011-10-21