| 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 - Forest 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:forest-add-backup | This function adds scheduled backup specifications for a forest to a configuration.
admin:forest-add-failover-host | This function adds a failover host to the list of failover hosts for the specified forest in the specified configuration.
admin:forest-add-replica | This function adds a forest replica to a master forest.
admin:forest-copy | This function creates a new forest specification with the same settings as the forest with the specified ID.
admin:forest-create | This function creates a new forest configuration.
admin:forest-delete | This function deletes the configuration for the specified forest from the configuration.
admin:forest-delete-backup | This function deletes scheduled backup specifications for a forest from a configuration.
admin:forest-delete-failover-host | This function deletes the specified failover host(s) from the failover-host list in the specified configuration.
admin:forest-exists | This function determines whether or not the specified forest exists.
admin:forest-get-backups | This function returns the scheduled backups for the specified forest from the configuration.
admin:forest-get-data-directory | This function returns the name of the data directory of the specified forest.
admin:forest-get-database | This function returns the ID of the database that uses the specified forest.
admin:forest-get-enabled | This function returns the enabled state of the specified forest.
admin:forest-get-failover-enable | This function returns the state of whether failover is enabled for the specified forest.
admin:forest-get-failover-hosts | This function returns the IDs of the hosts defined as failover hosts for this forest.
admin:forest-get-host | This function returns the ID of the host in which the specified forest resides.
admin:forest-get-id | This function returns the ID of the forest with the specified name, from the specified configuration.
admin:forest-get-name | This function returns the name of the specified forest, given the forest ID.
admin:forest-get-replicas | This function returns the IDs of the forest replicas for the specified forest.
admin:forest-get-updates-allowed | This function returns the state of what kinds of updates are allowed for the specified forest.
admin:forest-hourly-backup | This function constructs a hourly scheduled forest backup.
admin:forest-minutely-backup | This function constructs a scheduled forest backup on a number-of-minutes basis.
admin:forest-monthly-backup | This function constructs a monthly scheduled backup.
admin:forest-one-time-backup | This function constructs a one-time backup.
admin:forest-remove-replica | This function removes a forest replica from a master forest.
admin:forest-set-enabled | This function sets the enabled state for a forest configuration.
admin:forest-set-failover-enable | This function sets the forest failover enabled state for a forest configuration.
admin:forest-set-host | This function sets a forest configuration to a new host.
admin:forest-set-updates-allowed | This function sets the updates-allowed state for a forest configuration.
admin:forest-weekly-backup | This function constructs a weekly scheduled backup.
admin:get-forest-ids | This function returns all the forest IDs from the configuration.
Function Detail
admin:forest-add-backup(
| $config as element(configuration),
| $forest-id as xs:unsignedLong,
| $backups as element(as:forest-backup)*
) as element(configuration)
Summary: This function adds scheduled backup specifications for a forest to a configuration.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-id : The id of the forest (for example, `xdmp:forest("myforest")`).
$backups : The scheduled backup specification(s), typically the result of an `admin:forest-one-time-backup` or an `admin:forest-monthly-backup` or an `admin:forest-weekly-backup` 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()
      let $forest := xdmp:forest("myforest")
      let $backup := admin:forest-one-time-backup("/backup-dir",
            xs:dateTime("2008-02-14T09:45:00"))
      return
      admin:forest-add-backup($config, $forest, $backup)
      (: 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:forest-add-failover-host(
| $config as element(configuration),
| $forest-id as xs:unsignedLong,
| $hosts as xs:unsignedLong*
) as element(configuration)
Summary: This function adds a failover host to the list of failover hosts for the specified forest in the specified configuration. If there are already any hosts specified, this host is added to the end of the list of failover hosts.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-id : The ID of the forest. For example, `xdmp:forest("myForest")` specified the ID for a forest named "myForest".
$hosts : The host ID(s) for the host(s) you want to restart. For example, `xdmp:host()` returns the ID for the current 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()
      return
      admin:forest-add-failover-host($config,
          admin:forest-get-id($config, "Documents"),
          xdmp:host("myFailoverHost"))

          => add the failover host "myFailoverHost" to the end of the
             list of failover hosts
admin:forest-add-replica(
| $config as element(configuration),
| $master-id as xs:unsignedLong,
| $replica-id as xs:unsignedLong
) as element(configuration)
Summary: This function adds a forest replica to a master forest.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$master-id : The ID of the master forest to which to add the replica forest (for example, `xdmp:forest("MasterForest")`).
$replica-id : The ID of the replica forest to add to the master forest (for example, `xdmp:forest("ReplicaForest")`).
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 $forest := xdmp:forest("Documents")
      let $replica-forest := xdmp:forest("my-replica")

      return admin:forest-add-replica($config, $forest, $replica-forest)

      (: 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:forest-copy(
| $config as element(configuration),
| $forest-id as xs:unsignedLong,
| $forest-name as xs:string,
| $data-directory as xs:string?
) as element(configuration)
Summary: This function creates a new forest specification with the same settings as the forest with the specified ID. The new forest configuration will have the specified name. It copies the forest configuration, but does not copy the forest data.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-id : The ID of the forest. For example, `xdmp:forest("myForest")` specified the ID for a forest named "myForest".
$forest-name : The name for the new forest.
$data-directory : The optional data directory of the forest. If no directory is specified, then it will be a private forest.
Example:
      xquery version "1.0-ml";

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

      admin:forest-copy(admin:get-configuration(), xdmp:forest("myForest"),
             "myNewForest",())
admin:forest-create(
| $config as element(configuration),
| $forest-name as xs:string,
| $host-id as xs:unsignedLong,
| $data-directory as xs:string?
) as element(configuration)
Summary: This function creates a new forest configuration.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-name : The name of the forest. The must be unique for all forests in the cluster.
$host-id : The ID of the host (for example, `xdmp:host()` for the current host.
$data-directory : The optional data directory of the forest. If no directory is specified, then it will be a private forest.
Example:
      xquery version "1.0-ml";

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

      admin:forest-create(admin:get-configuration(), "newForest", xdmp:host(), ())
admin:forest-delete(
| $config as element(configuration),
| $forest-ids as xs:unsignedLong*,
| $delete-data as xs:boolean
) as element(configuration)
Summary: This function deletes the configuration for the specified forest from the configuration.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-ids : One or more forest ids. For example, `xdmp:forest("myForest")` specified the ID for a forest named "myForest".
$delete-data : If set to true, deletes the data directory as well as the configuration (Note: all documents in the forest will be permanently deleted). If set to false, deletes only the configuration information, leaving the forest data in the data directory on disk.
Usage Notes: Any forest whose ID you pass into this function must not be attached to a database when the transaction begins, otherwise an exception is thrown. If you need to detach the forest, do so in a separate transaction before using them 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()
      return
      admin:forest-delete($config, admin:forest-get-id($config, "Documents"),
          fn:false())

          => deletes the forest configuration for the forest
             named "Documents"
admin:forest-delete-backup(
| $config as element(configuration),
| $forest-id as xs:unsignedLong,
| $backups as element(as:forest-backup)*
) as element(configuration)
Summary: This function deletes scheduled backup specifications for a forest from a configuration.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-id : The id of the forest (for example, `xdmp:forest("myforest")`).
$backups : The scheduled backup(s) to delete. Typically, the result of an `admin:forest-get-backups` 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()
      let $forest  := xdmp:forest("Documents")
      let $backups := admin:forest-get-backups($config, $forest)[1 to 3]
      return
      admin:forest-delete-backup($config, $forest, $backups)
      (: 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:forest-delete-failover-host(
| $config as element(configuration),
| $forest-id as xs:unsignedLong,
| $hosts as xs:unsignedLong*
) as element(configuration)
Summary: This function deletes the specified failover host(s) from the failover-host list in the specified configuration.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-id : The ID of the forest. For example, `xdmp:forest("myForest")` specified the ID for a forest named "myForest".
$hosts : The host ID(s) for the host(s) you want to delete. For example, `xdmp:host()` returns the ID for the current 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()
      return
      admin:forest-delete-failover-host($config,
          admin:forest-get-id($config, "Documents"),
          xdmp:host("myFailoverHost"))

          => deletes the failover host "myFailoverHost" from the
             list of failover hosts
admin:forest-exists(
| $config as element(configuration),
| $forest-name as xs:string
) as xs:boolean
Summary: This function determines whether or not the specified forest exists. Returns `true` if the forest exists, otherwise `false` is returned.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-name : The name of the forest 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:forest-exists($config, "Documents")

      (: Returns true, if the Documents forest exists. :)
admin:forest-get-backups(
| $config as element(configuration),
| $forest-id as xs:unsignedLong
) as element(as:forest-backup)*
Summary: This function returns the scheduled backups for the specified forest from the configuration.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-id : The id of the forest (for example, `xdmp:forest("myforest")`).
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:forest-get-backups($config, xdmp:forest("myforest") )
      (: returns the scheduled backups for the forest :)
admin:forest-get-data-directory(
| $config as element(configuration),
| $forest-id as xs:unsignedLong
) as xs:string
Summary: This function returns the name of the data directory of the specified forest.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-id : The ID of the forest. For example, `xdmp:forest("myForest")` specified the ID for a forest named "myForest".
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:forest-get-data-directory($config,
             admin:forest-get-id($config, "test"))
admin:forest-get-database(
| $config as element(configuration),
| $forest-id as xs:unsignedLong
) as xs:unsignedLong?
Summary: This function returns the ID of the database that uses the specified forest.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-id : The id of the forest used by the database to be returned (for example, `xdmp:forest("myForest")`).
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 $forest := xdmp:forest("Documents")

      return admin:forest-get-database($config, $forest)

      (: Returns the ID of the database that uses the Documents forest. :)
admin:forest-get-enabled(
| $config as element(configuration),
| $forest-id as xs:unsignedLong
) as xs:boolean
Summary: This function returns the enabled state of the specified forest.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-id : The ID of the forest. For example, `xdmp:forest("myForest")` specified the ID for a forest named "myForest".
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:forest-get-enabled($config, admin:forest-get-id($config, "test"))
admin:forest-get-failover-enable(
| $config as element(configuration),
| $forest-id as xs:unsignedLong
) as xs:boolean
Summary: This function returns the state of whether failover is enabled for the specified forest.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-id : The ID of the forest. For example, `xdmp:forest("myForest")` specified the ID for a forest named "myForest".
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:forest-get-failover-enable($config,
             admin:forest-get-id($config, "test"))
admin:forest-get-failover-hosts(
| $config as element(configuration),
| $forest-id as xs:unsignedLong
) as xs:unsignedLong*
Summary: This function returns the IDs of the hosts defined as failover hosts for this forest. The order in which the hosts IDs are returned is significant, with the first ID being the primary host, the second (if there is one) being the secondary, and so on.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-id : The ID of the forest. For example, `xdmp:forest("myForest")` specified the ID for a forest named "myForest".
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:forest-get-failover-hosts($config,
             admin:forest-get-id($config, "test"))
admin:forest-get-host(
| $config as element(configuration),
| $forest-id as xs:unsignedLong
) as xs:unsignedLong
Summary: This function returns the ID of the host in which the specified forest resides.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-id : The ID of the forest. For example, `xdmp:forest("myForest")` specified the ID for a forest named "myForest".
Example:
      xquery version "1.0-ml";

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

      admin:forest-get-host(admin:get-configuration(), xdmp:forest("myForest"))

      => the ID of the host that services the forest named "myForest"
admin:forest-get-id(
| $config as element(configuration),
| $forest-name as xs:string
) as xs:unsignedLong
Summary: This function returns the ID of the forest with the specified name, from the specified configuration. The difference between this function and `xdmp:forest()` is that the ID from this function can come from a forest that has not yet been saved (that is, from a forest that has been created in the same query with the Admin library but has not yet been saved to the cluster configuration files).
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-name : The name of the forest.
Example:
      xquery version "1.0-ml";

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

      admin:forest-get-id(admin:get-configuration(), "myForest")
admin:forest-get-name(
| $config as element(configuration),
| $forest-id as xs:unsignedLong
) as xs:string
Summary: This function returns the name of the specified forest, given the forest ID.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-id : The ID of the forest. If the ID does not correspond to a valid forest ID, then an exception is thrown.
Example:
      xquery version "1.0-ml";

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

      admin:forest-get-name(admin:get-configuration(), 18220031759147104956)
admin:forest-get-replicas(
| $config as element(configuration),
| $forest-id as xs:unsignedLong
) as xs:unsignedLong*
Summary: This function returns the IDs of the forest replicas for the specified forest. If it returns the empty sequence, then no replacas are assigned to the specified forest.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-id : The ID of the forest having the replica forests to be returned (for example, `xdmp:forest("myForest")`).
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 $forest := xdmp:forest("Documents")

      return admin:forest-get-replicas($config, $forest)

      (: Returns the forest replicas associated with the Documents forest. :)
admin:forest-get-updates-allowed(
| $config as element(configuration),
| $forest-id as xs:unsignedLong
) as xs:string
Summary: This function returns the state of what kinds of updates are allowed for the specified forest.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-id : The ID of the forest. For example, `xdmp:forest("myForest")` specified the ID for a forest named "myForest".
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:forest-get-updates-allowed($config,
             admin:forest-get-id($config, "test"))
admin:forest-hourly-backup(
| $backup-dir as xs:string,
| $backup-period as xs:positiveInteger,
| $start-minute as xs:nonNegativeInteger
) as element(as:forest-backup)
Summary: This function constructs a hourly scheduled forest backup.
Parameters:
$backup-dir : The directory to save the backup.
$backup-period : The number of hours to elapse between each backup
$start-minute : The number of minutes after the hour to start the backup. Note that this setting does not add to the backup period 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()
      return
        admin:forest-hourly-backup("/backup-dir", 2, 30)

      (: returns the hourly forest backup specification. For example, if the
         current time is 2:15pm, the backup will run at 4:30pm, 6:30pm, 8:30pm,
         and so on. :)
admin:forest-minutely-backup(
| $backup-dir as xs:string,
| $backup-period as xs:positiveInteger
) as element(as:forest-backup)
Summary: This function constructs a scheduled forest backup on a number-of-minutes basis.
Parameters:
$backup-dir : The directory to save the backup.
$backup-period : The number of minutes to elapse between each backup
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:forest-minutely-backup("/backup-dir", 45)

      (: returns the minutely forest backup specification. :)
admin:forest-monthly-backup(
| $backup-dir as xs:string,
| $backup-period as xs:positiveInteger,
| $backup-month-day as xs:unsignedInt,
| $start-time as xs:time
) as element(as:forest-backup)
Summary: This function constructs a monthly scheduled backup.
Parameters:
$backup-dir : The directory where the backup will be saved to.
$backup-period : The number of months to elapse between each backup.
$backup-month-day : The day of the month the backup will happen (between 1 and 31)
$start-time : A time for the scheduled backup to start.
Example:
      xquery version "1.0-ml";

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

      admin:forest-monthly-backup("/backup-dir", 1, 1, xs:time("09:45:00"))
      (: returns the monthly backup specification :)
admin:forest-one-time-backup(
| $backup-dir as xs:string,
| $start as xs:dateTime
) as element(as:forest-backup)
Summary: This function constructs a one-time backup.
Parameters:
$backup-dir : The directory where the backup will be saved to.
$start : The starting dateTime of the scheduled backup.
Example:
      xquery version "1.0-ml";

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

      admin:forest-one-time-backup("/backup-dir",
            xs:dateTime("2008-02-14T09:45:00"))
      (: returns the one-time backup :)
admin:forest-remove-replica(
| $config as element(configuration),
| $master-id as xs:unsignedLong,
| $replica-id as xs:unsignedLong
) as element(configuration)
Summary: This function removes a forest replica from a master forest.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$master-id : The ID of the master forest from which to remove the replica forest (for example, `xdmp:forest("MasterForest")`).
$replica-id : The ID of the replica forest to remove from the master forest (for example, `xdmp:forest("ReplicaForest")`).
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 $forest := xdmp:forest("failover1")
      let $replica-forest := xdmp:forest("replica1")

      return admin:forest-remove-replica($config, $forest, $replica-forest)

      (: 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:forest-set-enabled(
| $config as element(configuration),
| $forest-id as xs:unsignedLong,
| $value as xs:boolean
) as element(configuration)
Summary: This function sets the enabled state for a forest configuration.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-id : The ID of the forest. For example, `xdmp:forest("myForest")` specified the ID for a forest named "myForest".
$value : The new state of the forest, for example `fn:true()` for enabled, `fn:false()` for disabled.
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:forest-set-enabled($config, admin:forest-get-id($config, "Documents"),
          fn:false())

      => sets the forest named "Documents" to the disabled state
admin:forest-set-failover-enable(
| $config as element(configuration),
| $forest-id as xs:unsignedLong,
| $value as xs:boolean
) as element(configuration)
Summary: This function sets the forest failover enabled state for a forest configuration.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-id : The ID of the forest. For example, `xdmp:forest("myForest")` specified the ID for a forest named "myForest".
$value : The new failover-enable state of the forest, for example `fn:true()` for enabled, `fn:false()` for disabled.
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:forest-set-failover-enable($config,
          admin:forest-get-id($config, "Documents"),
          fn:true())

          => sets the failover state of the forest named "Documents" to
             the enabled state
admin:forest-set-host(
| $config as element(configuration),
| $forest-id as xs:unsignedLong,
| $value as xs:unsignedLong
) as element(configuration)
Summary: This function sets a forest configuration to a new host.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-id : The ID of the forest. For example, `xdmp:forest("myForest")` specified the ID for a forest named "myForest".
$value : The host ID of the new 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()
      return
      admin:forest-set-host($config, admin:forest-get-id($config, "Documents"),
                  xdmp:host("myNewHost"))
admin:forest-set-updates-allowed(
| $config as element(configuration),
| $forest-id as xs:unsignedLong,
| $value as xs:string
) as element(configuration)
Summary: This function sets the updates-allowed state for a forest configuration.
Parameters:
$config : A configuration specification, typically as returned from one of the Admin module functions.
$forest-id : The ID of the forest. For example, `xdmp:forest("myForest")` specified the ID for a forest named "myForest".
$value : The new updates-allowed state of the forest. Must be one of `all` for all updates allowed, `delete-only` for only deletes allowed, `read-only` for no updates allowed and to cause updating transactions to abort immediately, `flash-backup` for no updates allowed and to make updating transactions retry for a time period specified in the group's retry timeout.
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:forest-set-updates-allowed($config,
          admin:forest-get-id($config, "Documents"),
          "delete-only")

          => sets the updates-allowed state of the forest named "Documents" to
             the true state
admin:forest-weekly-backup(
| $backup-dir as xs:string,
| $backup-period as xs:positiveInteger,
| $days as xs:string+,
| $start-time as xs:time
) as element(as:forest-backup)
Summary: This function constructs a weekly scheduled backup.
Parameters:
$backup-dir : The directory where the backup will be saved to.
$backup-period : The how many weeks between each backup.
$days : The day(s) of the week. Must be a sequence of zero or more of `monday`, `tuesday`, `wednesday`, `thusday`, `friday`, `saturday`, `sunday`.
$start-time : A time for the scheduled backup to start.
Example:
      xquery version "1.0-ml";

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

      admin:forest-weekly-backup("/backup-dir", 2, "monday", xs:time("09:45:00"))
      (: returns the weekly backup specification :)
admin:get-forest-ids(
| $config as element(configuration)
) as xs:unsignedLong*
Summary: This function returns all the forest 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-forest-ids($config)
      (: returns the IDs of all the forests :)

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