| 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; |
| 9 | |
| 10 | /** |
| 11 | * The Version class holds the SAXON version information. |
| 12 | */ |
| 13 | |
| 14 | public final class Version { |
| 15 | |
| 16 | private static final int[] STRUCTURED_VERSION = {9, 9, 1, 5}; |
| 17 | private static final String VERSION = "9.9.1.5"; |
| 18 | private static final String BUILD = "090514"; //mmddhh |
| 19 | private static final String RELEASE_DATE = "2019-09-05"; |
| 20 | private static final String MAJOR_RELEASE_DATE = "2018-09-27"; |
| 21 | |
| 22 | private Version() { |
| 23 | // class is never instantiated |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Return the name of this product. Supports the XSLT 2.0 system property xsl:product-name |
| 28 | * |
| 29 | * @return the string "SAXON" |
| 30 | */ |
| 31 | |
| 32 | |
| 33 | public static String getProductName() { |
| 34 | return "SAXON"; |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Return the name of the product vendor. |
| 39 | * |
| 40 | * @return the string "Saxonica" |
| 41 | */ |
| 42 | |
| 43 | public static String getProductVendor() { |
| 44 | return "Saxonica"; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Get the specific variant and version number of the product |
| 49 | * |
| 50 | * @param edition the Saxon edition code, e.g. "EE", "HE", or "JS" |
| 51 | * @return the version number of this version of Saxon, as a string, for example "EE 9.9.0.1" |
| 52 | */ |
| 53 | |
| 54 | public static String getProductVariantAndVersion(String edition) { |
| 55 | return edition + " " + getProductVersion(); |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Get the user-visible version number of this version of the product |
| 60 | * |
| 61 | * @return the version number of this version of Saxon, as a string: for example "9.9.0.1" |
| 62 | */ |
| 63 | |
| 64 | public static String getProductVersion() { |
| 65 | return VERSION; |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Get the four components of the structured version number. This is used in the .NET product |
| 70 | * to locate an assembly in the dynamic assembly cache: the assumption is that the third |
| 71 | * and fourth components represent implementation changes rather than interface changes |
| 72 | * |
| 73 | * @return the four components of the version number, as an array: for example {9, 0, 1, 1} |
| 74 | */ |
| 75 | |
| 76 | public static int[] getStructuredVersionNumber() { |
| 77 | return STRUCTURED_VERSION; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * Get the issue date of this version of the product. This will be the release date of the |
| 82 | * latest maintenance release |
| 83 | * |
| 84 | * @return the release date, as an ISO 8601 string |
| 85 | */ |
| 86 | |
| 87 | public static String getReleaseDate() { |
| 88 | return RELEASE_DATE; |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * Get the issue date of the most recent major release of the product, that is, a release offering |
| 93 | * new functionality rather than just bug fixes (typically, a release in which the first two digits |
| 94 | * of the version number change, for example 9.2 to 9.3). |
| 95 | * |
| 96 | * @return the release date, as an ISO 8601 string |
| 97 | */ |
| 98 | |
| 99 | public static String getMajorReleaseDate() { |
| 100 | return MAJOR_RELEASE_DATE; |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * Get a message used to identify this product when a transformation is run using the -t option |
| 105 | * |
| 106 | * @return A string containing both the product name and the product |
| 107 | * version |
| 108 | */ |
| 109 | |
| 110 | public static String getProductTitle() { |
| 111 | return getProductName() + '-' + softwareEdition + ' ' + |
| 112 | getProductVersion() + (platform.isJava() ? 'J' : 'N') + " from Saxonica"; |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * Return a web site address containing information about the product. Supports the XSLT system property xsl:vendor-url |
| 117 | * |
| 118 | * @return the string "http://saxon.sf.net/" |
| 119 | */ |
| 120 | |
| 121 | public static String getWebSiteAddress() { |
| 122 | return "http://www.saxonica.com/"; |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * Invoking net.sf.saxon.Version from the command line outputs the build number |
| 127 | * |
| 128 | * @param args not used |
| 129 | */ |
| 130 | public static void main(String[] args) { |
| 131 | System.err.println(getProductTitle() + " (build " + BUILD + ')'); |
| 132 | } |
| 133 | |
| 134 | |
| 135 | public static Class<? extends Configuration> configurationClass; |
| 136 | |
| 137 | |
| 138 | public static String softwareEdition; |
| 139 | |
| 140 | static { |
| 141 | softwareEdition = "HE"; |
| 142 | //#if EE==true |
| 143 | softwareEdition = "EE"; |
| 144 | //#endif |
| 145 | //#if PE==true |
| 146 | softwareEdition = "PE"; |
| 147 | //#endif |
| 148 | } |
| 149 | |
| 150 | public static Platform platform; |
| 151 | |
| 152 | static { |
| 153 | //#if DOTNET==true |
| 154 | //#if EE==true || PE==true |
| 155 | platform = new com.saxonica.config.DotNetPlatformPE(); |
| 156 | //#else |
| 157 | platform = new net.sf.saxon.dotnet.DotNetPlatform(); |
| 158 | //#endif |
| 159 | //#else |
| 160 | platform = new net.sf.saxon.java.JavaPlatform(); |
| 161 | |
| 162 | //#if PE==true && DOTNET != true && SAXONC == true |
| 163 | platform = new com.saxonica.config.JavaPlatformC(); |
| 164 | //#endif |
| 165 | //#if EE==true && DOTNET != true && SAXONC==true |
| 166 | platform = new com.saxonica.config.JavaPlatformC(); |
| 167 | //#endif |
| 168 | //#if PE==true && SAXONC != true |
| 169 | platform = new com.saxonica.config.JavaPlatformPE(); |
| 170 | //#endif |
| 171 | //#if EE==true && SAXONC != true |
| 172 | platform = new com.saxonica.config.JavaPlatformEE(); |
| 173 | //#endif |
| 174 | //#endif |
| 175 | } |
| 176 | |
| 177 | |
| 178 | } |
| 179 |