plugin:initialize-scope( $scope as xs:string ) as xs:integer
This function ensures the availability of all
plugins from a given scope. A scope is a directory
relative to
marklogic-dir/Assets/plugins
.
Attempting to reload the
System scope (with an empty string for
$scope
) has no effect
(and hence returns 0). Any application that calls this
function must do so through a function amped to the
application-plugin-registrar
role.
This function MUST be called by an application before querying or enumerating plugins (or else see an empty set of available plugins). Even if called on every request, this function will only load from the directory on the first call. This function checks the global debug flag, and if true, forces a reload on every request.
This function requires the privileges in the
application-plugin-registrar
role, and the
best practice is to put
plugin:initialize-scope
in a function that
is amped to the application-plugin-registrar
role.
xquery version "1.0-ml"; import module namespace plugin = "http://marklogic.com/extension/plugin" at "/MarkLogic/plugin/plugin.xqy"; plugin:initialize-scope("marklogic.appservices") (: Initializes all of the plugins located in /Assets/plugins/marklogic/appservices :)