| 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.lib; |
| 9 | |
| 10 | import java.util.Set; |
| 11 | |
| 12 | /** |
| 13 | * This interface defines a Saxon plug-in used to resolve calls on the XPath 3.0 |
| 14 | * functions available-environment-variables() and environment-variable(). The standard |
| 15 | * implementation reads environment variables using the Java method {@link System#getenv()}; |
| 16 | * this can be overridden by a user-provided implementation that resolves environment variables |
| 17 | * any way it likes. |
| 18 | */ |
| 19 | public interface EnvironmentVariableResolver { |
| 20 | |
| 21 | /** |
| 22 | * Get the list of available environment variables. |
| 23 | * |
| 24 | * @return a set of strings; each such string should be an acceptable argument to the |
| 25 | * method {@link #getEnvironmentVariable(String)} |
| 26 | */ |
| 27 | |
| 28 | public Set<String> getAvailableEnvironmentVariables(); |
| 29 | |
| 30 | /** |
| 31 | * Get the value of a specific environment variable |
| 32 | * |
| 33 | * @param name the name of the required environment variable |
| 34 | * @return the value of the named environment variable, or null if the variable is |
| 35 | * not defined. The method must not return null if the name is in the list of variables |
| 36 | * returned by the method {@link #getAvailableEnvironmentVariables()} |
| 37 | */ |
| 38 | |
| 39 | public String getEnvironmentVariable(String name); |
| 40 | } |
| 41 |