|
|
plugin:asset(
|
|
$pid as xs:string,
|
|
$scope as xs:string,
|
|
$asset-path as xs:string
|
| ) as node()? |
|
 |
Summary:
Returns the named asset, which must exist in the
assets/ directory of the plugin, as stored in
the Extensions database. This will only return a value
for Library Module plugins.
|
Parameters:
$pid
:
A plugin ID.
|
$scope
:
A scope identifier. This must be a "dotted" package-style
path, which will be resolved relative to the
marklogic-dir/Assets/plugins directory.
For example, a $scope value of
my-plugin-scope is resolved to the
marklogic-dir/Assets/plugins/myplugin-scope
directory and a $scope value of
my.plugin.scope is resolved to the
marklogic-dir/Assets/plugins/my/plugin/scope
directory.
|
$asset-path
:
The filename (omitting any path information) of an
asset in this plugin space.
|
|
Example:
xquery version "1.0-ml";
import module namespace plugin = "http://marklogic.com/extension/plugin"
at "/MarkLogic/plugin/plugin.xqy";
plugin:asset-exists("collector-test", "marklogic.appservices", "picture.gif")
(: Returns the asset, 'picture.gif,' used by the collect-test plugin
located in the Extensions database. :)
|
|
|
|
plugin:register(
|
|
$capabilities as map:map,
|
|
$plugin-uri as xs:string
|
| ) as xs:string |
|
 |
Summary:
This function registers the capabilities map
for use by MarkLogic Server. It returns the URI of the
plugin.
|
Parameters:
$capabilities
:
The map of
capabilities to be registered.
|
$plugin-uri
:
An identifier that uniquely identifies this plugin. If a
plugin is added with the same identifier as an existing plugin,
then the newly registered plugin will be used.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/plugin-register
|
Example:
xquery version "1.0-ml";
declare namespace testdoc = "http://marklogic.com/extension/plugin/testdoc";
import module namespace plugin = "http://marklogic.com/extension/plugin"
at "/MarkLogic/plugin/plugin.xqy";
declare function testdoc:capabilities()
as map:map
{
let $map := map:map()
let $_ := map:put($map,
"http://marklogic.com/appservices/infostudio/collector/model",
xdmp:function(xs:QName("testdoc:model")))
let $_ := map:put($map,
"http://marklogic.com/appservices/infostudio/collector/start",
xdmp:function(xs:QName("testdoc:start")))
let $_ := map:put($map,
"http://marklogic.com/appservices/infostudio/collector/config-view",
xdmp:function(xs:QName("testdoc:view")))
let $_ := map:put($map,
"http://marklogic.com/appservices/infostudio/collector/cancel",
xdmp:function(xs:QName("testdoc:cancel")))
let $_ := map:put($map,
"http://marklogic.com/appservices/infostudio/collector/abort",
xdmp:function(xs:QName("testdoc:abort")))
let $_ := map:put($map,
"http://marklogic.com/appservices/infostudio/collector/validate",
xdmp:function(xs:QName("testdoc:validate")))
let $_ := map:put($map, "http://marklogic.com/appservices/string",
xdmp:function(xs:QName("testdoc:string")))
return $map
};
(: Implement the functions in the capabilities map. :)
plugin:register(testdoc:capabilities(), "testdoc.xqy")
(: Registers the capabilities in the map for this plugin. :)
|
|
|