| XQUERY/XSLT API DOCUMENTATION 4.2 |
All XQuery & XSLT Functions MarkLogic Built-In Functions Admin (xdmp:) AppServer (xdmp:) Classifier (cts:) Debug (dbg:) Document Conversion (xdmp:) Extension (xdmp:) Documents, Directories, Properties, and Locks Functions Extension Functions Function Values Functions HTTP Functions JSON Functions MarkLogic Server Functions Search Functions XML Functions XQuery Context Functions XSLT Functions map (map:) Math (math:) Profile (prof:) Search (cts:) cts:query Constructors Functions Geospatial Functions Geospatial Lexicon Functions Lexicon Functions Search Functions Search Clustering Functions Security (xdmp:) Server Monitoring (xdmp:) Spell (spell:) Update (xdmp:) XQuery Library Modules Admin Library (admin:) Actions Functions Appserver Functions Database Functions Forest Functions Group Functions Host Functions Mimetypes Functions Scheduler Functions Alerting (alert:) Elastic Compute Cloud (ec2:) Entity Enrichment (entity:) Flexible Replication (flexrep:) Geospatial Supporting Functions GEO Functions GeoRSS Functions GML Functions KML Functions MCGM Functions Information Studio (info:) Information Studio Developer (infodev:) Library Services (dls:) cts:query Constructor Functions Document Management Functions Document Update Functions Retention Policy Functions XInclude Functions Modular Documents XInclude Functions XPointer Functions PKI (pki:) Plugin (plugin:) Search (search:) Security-sec (sec:) Spelling Dictionary Management (spell:) Thesaurus (thsr:) Triggers (trgr:) Triggers Library (trgr:) WordProcessingML (ooxml:) ZIP Package (ooxml:) CPF Functions Content Processing Framework (cpf:) CSS Conversion (css:) DocBook Conversion (dbk:) Domains (dom:) Excel Conversion (excel:) Generic Conversion (cvt:) Links (lnk:) MSWord Conversion (msword:) PDF Conversion (pdf:) Pipelines (p:) Powerpoint Conversion (ppt:) XHTML Conversion (xhtml:) W3C-Standard Functions Accessor (fn:) AnyURI (fn:) Boolean (fn:) Context (fn:) DurationDateTime (fn:) Error and Trace (fn:) Node (fn:) Numeric (fn:) QName (fn:) Sequence (fn:) String (fn:) XSLT (fn:) W3C XQuery/XSLT Reference W3C XQuery Functions W3C XQuery Language W3C XSLT Language
This page was generated September 12, 2012 5:59 AM | XQuery & XSLT Built-In & Modules Function Reference
Module: Admin Library - Host Functions
The Admin module is an XQuery library module that allows you to script administrative tasks that you otherwise would need the Admin Interface to perform. Most functions in this library perform adminstrative tasks and therefore require the user who runs the XQuery program to have the Admin role. Many of these functions provide new configuration information. In most cases, you must save the configuration (with `admin:save-configuration`, for example) in the same statement that you use the functions in order for them to take effect. To use the Admin module as part of your own XQuery module, include the following line in your XQuery prolog: `import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy" ;` The library namespace prefix `admin` is not predefined in the server.
Function Summary
admin:get-host-ids | This function returns all the host IDs from the configuration.
admin:host-exists | This function determines whether or not the specified Host exists.
admin:host-get-group | This function returns the group ID for the host with the specified ID.
admin:host-get-id | This function return the ID for the specified host from the configuration.
admin:host-get-name | This function returns the name for the host with the specified ID.
admin:host-get-port | This function returns the bind port for the host with the specified ID.
admin:host-set-group | This function changes the group to which an existing host belongs to the newly specified value.
admin:host-set-name | This function changes the name of an existing host to the newly specified value.
admin:host-set-port | This function changes the bind port value for the host to the newly specified value.
Function Detail
admin:get-host-ids(
| $config as element(configuration)
) as xs:unsignedLong*
Summary: This function returns all the host IDs from the configuration.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
Example:
      xquery version "1.0-ml";

      import module namespace admin = "http://marklogic.com/xdmp/admin"
          at "/MarkLogic/admin.xqy";

      let $config := admin:get-configuration()
      return
      admin:get-host-ids($config)
      (: returns the IDs of all the hosts :)
admin:host-exists(
| $config as element(configuration),
| $host-name as xs:string
) as xs:boolean
Summary: This function determines whether or not the specified Host exists. Returns `true` if the Host exists, otherwise `false` is returned.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$host-name : The name of the host to check.
Example:
      xquery version "1.0-ml";

      import module namespace admin = "http://marklogic.com/xdmp/admin"
          at "/MarkLogic/admin.xqy";

      let $config := admin:get-configuration()

      return admin:host-exists($config, "hp6910-624v64b.marklogic.com")

      (: Returns true, if the specified host exists. :)
admin:host-get-group(
| $config as element(configuration),
| $host-id as xs:unsignedLong
) as xs:unsignedLong
Summary: This function returns the group ID for the host with the specified ID.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$host-id : The host ID. Typically, the result of an `admin:host-get-id` call.
Example:
      xquery version "1.0-ml";

      import module namespace admin = "http://marklogic.com/xdmp/admin"
    		  at "/MarkLogic/admin.xqy";

      let $config := admin:get-configuration()
      return
      admin:host-get-group($config, admin:host-get-id($config, xdmp:host-name()))
      (: returns the group ID :)
admin:host-get-id(
| $config as element(configuration),
| $host-name as xs:string
) as xs:unsignedLong
Summary: This function return the ID for the specified host from the configuration. The difference between this function and `xdmp:host()` is that the ID from this function can come from a host that has not yet been saved (that is, from a host that has been created in the same query with the Admin library but has not yet been saved to the cluster configuration files). This ID enables you to completely configure a newly created host without the need to first save the configuration.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$host-name : The name of the host. If the host is the current host, `xdmp:host-name()` returns the name.
Example:
      xquery version "1.0-ml";

      import module namespace admin = "http://marklogic.com/xdmp/admin"
    		  at "/MarkLogic/admin.xqy";

      let $config := admin:get-configuration()
      return
      admin:host-get-id($config, xdmp:host-name())
      (: returns the host ID :)
admin:host-get-name(
| $config as element(configuration),
| $host-id as xs:unsignedLong
) as xs:string
Summary: This function returns the name for the host with the specified ID.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$host-id : The host ID. Typically, the result of an `admin:host-get-id` call.
Example:
      xquery version "1.0-ml";

      import module namespace admin = "http://marklogic.com/xdmp/admin"
    		  at "/MarkLogic/admin.xqy";

      let $config := admin:get-configuration()
      return
      admin:host-get-name($config, admin:host-get-id($config, xdmp:host-name()))
      (: returns the host name :)
admin:host-get-port(
| $config as element(configuration),
| $host-id as xs:unsignedLong
) as xs:unsignedInt
Summary: This function returns the bind port for the host with the specified ID.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$host-id : The host ID. Typically, the result of an `admin:host-get-id` call.
Example:
      xquery version "1.0-ml";

      import module namespace admin = "http://marklogic.com/xdmp/admin"
    		  at "/MarkLogic/admin.xqy";

      let $config := admin:get-configuration()
      return
      admin:host-get-port($config, admin:host-get-id($config, xdmp:host-name()))
      (: returns the bind port for the host :)
admin:host-set-group(
| $config as element(configuration),
| $host-id as xs:unsignedLong,
| $value as xs:unsignedLong
) as element(configuration)
Summary: This function changes the group to which an existing host belongs to the newly specified value.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$host-id : The host ID. Typically, the result of an `admin:host-get-id` call.
$value : The new group ID value (typically from a `admin:group-get-id` call.
Usage Notes: Any group whose ID you pass into this function must exist when the transaction begins, otherwise an exception is thrown. If you need to create the group, do so in a separate transaction before using them in in this function.
Example:
      xquery version "1.0-ml";

      import module namespace admin = "http://marklogic.com/xdmp/admin"
    		  at "/MarkLogic/admin.xqy";

      let $config := admin:get-configuration()
      let $hostid := admin:host-get-id($config, xdmp:host-name())
      return
      admin:host-set-group($config, $hostid,
          admin:group-get-id($config, "Default"))
      (: returns the new configuration element -- use admin:save-configuration
         to save the changes to the configuration or pass the configuration
         to other Admin API functions to make other changes.  :)
admin:host-set-name(
| $config as element(configuration),
| $host-id as xs:unsignedLong,
| $value as xs:string
) as element(configuration)
Summary: This function changes the name of an existing host to the newly specified value.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$host-id : The host ID. Typically, the result of an `admin:host-get-id` call.
$value : The new name of the host.
Example:
      xquery version "1.0-ml";

      import module namespace admin = "http://marklogic.com/xdmp/admin"
    		  at "/MarkLogic/admin.xqy";

      let $config := admin:get-configuration()
      let $hostid := admin:host-get-id($config, "myOldHostname")
      return
      admin:host-set-name($config, $hostid, "myNewHostName")
      (: returns the new configuration element -- use admin:save-configuration
         to save the changes to the configuration or pass the configuration
         to other Admin API functions to make other changes.  :)
admin:host-set-port(
| $config as element(configuration),
| $host-id as xs:unsignedLong,
| $value as xs:unsignedInt
) as element(configuration)
Summary: This function changes the bind port value for the host to the newly specified value.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$host-id : The host ID. Typically, the result of an `admin:host-get-id` call.
$value : The new bind port value.
Example:
      xquery version "1.0-ml";

      import module namespace admin = "http://marklogic.com/xdmp/admin"
    		  at "/MarkLogic/admin.xqy";

      let $config := admin:get-configuration()
      let $hostid := admin:host-get-id($config, xdmp:host-name())
      return
      admin:host-set-port($config, $hostid, 7999)
      (: returns the new configuration element -- use admin:save-configuration
         to save the changes to the configuration or pass the configuration
         to other Admin API functions to make other changes.  :)

© Copyright 2002-2012 MarkLogic Corporation. All rights reserved.