| 1 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 2 | // Copyright (c) 2018 Saxonica Limited. |
| 3 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. |
| 4 | // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 | // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. |
| 6 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 7 | |
| 8 | package net.sf.saxon.query; |
| 9 | |
| 10 | import net.sf.saxon.Controller; |
| 11 | import net.sf.saxon.om.NodeInfo; |
| 12 | import net.sf.saxon.trans.XPathException; |
| 13 | |
| 14 | /** |
| 15 | * An UpdateAgent is a callback class that is called to handle a document after it has been updated. |
| 16 | * Typically the UpdateAgent might take responsibility for writing the updated document back to |
| 17 | * persistent storage. |
| 18 | */ |
| 19 | public interface UpdateAgent { |
| 20 | |
| 21 | /** |
| 22 | * Handle an updated document. |
| 23 | * This method is called by {@link XQueryExpression#runUpdate(DynamicQueryContext, UpdateAgent)} |
| 24 | * once for each document (or more generally, for the root of each tree) that has been modified |
| 25 | * by the update query. |
| 26 | * |
| 27 | * @param node the root of the tree that has been updated |
| 28 | * @param controller the Controller that was used for executing the query |
| 29 | * @throws XPathException if the callback code cannot handle the updated document |
| 30 | */ |
| 31 | |
| 32 | void update(NodeInfo node, Controller controller) throws XPathException; |
| 33 | } |
| 34 |