Class JavaPlatform
java.lang.Object
net.sf.saxon.java.JavaPlatform
- All Implemented Interfaces:
Serializable, Platform
-
Constructor Summary
ConstructorsConstructorDescriptionThe constructor is called during the static initialization of the Configuration, by virtue of the class name appearing in the edition.properties file within the issued JAR file -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFunctionLibraries(FunctionLibraryList list, Configuration config, int hostLanguage) Add the platform-specific function libraries to a function library list.booleancanReturnCollationKeys(StringCollator collation) Given a collation, determine whether it is capable of returning collation keys.getClassLoaderForGeneratedClass(String definedClassName, byte[] classFile, Configuration config, Class thisClass) Return the class loader required to load the bytecode generated classesgetCollationKey(SimpleCollation namedCollation, String value) Given a collation, get a collation key.getExternalObjectType(Configuration config, String uri, String localName) Get a SchemaType representing a wrapped external (Java or .NET) objectgetInstallationDirectory(String edition, Configuration config) Return the name of the directory in which the software is installed (if available)getParserSource(PipelineConfiguration pipe, StreamSource input, int validation, boolean dtdValidation, int stripspace) Convert a StreamSource to either a SAXSource or a PullSource, depending on the native parser of the selected platformGet a suffix letter to add to the Saxon version number to identify the platformGet the platform versionGet the verifier appropriate to the platformvoidinitialize(Configuration config) Perform platform-specific initialization of the configurationbooleanisDotNet()Return true if this is the .NET platformbooleanisJava()Return true if this is the Java platformGet a parser by instantiating the SAXParserFactorymakeCollation(Configuration config, Properties props, String uri) Obtain a collation with a given set of properties.voidRegister all the external object models that are provided as standard with the relevant edition of Saxon for this ConfigurationvoidSet the default XML parser to be loaded by the SAXParserFactory on this platform.
-
Constructor Details
-
JavaPlatform
public JavaPlatform()The constructor is called during the static initialization of the Configuration, by virtue of the class name appearing in the edition.properties file within the issued JAR file
-
-
Method Details
-
initialize
Perform platform-specific initialization of the configuration- Specified by:
initializein interfacePlatform- Parameters:
config- the Saxon Configuration
-
isJava
-
isDotNet
-
getVerifierClassName
Get the verifier appropriate to the platform- Specified by:
getVerifierClassNamein interfacePlatform
-
getPlatformVersion
Get the platform version- Specified by:
getPlatformVersionin interfacePlatform- Returns:
- the version of the platform, for example "Java version 1.5.09"
-
getPlatformSuffix
Get a suffix letter to add to the Saxon version number to identify the platform- Specified by:
getPlatformSuffixin interfacePlatform- Returns:
- "J" for Java, "N" for .NET
-
loadParser
Get a parser by instantiating the SAXParserFactory- Specified by:
loadParserin interfacePlatform- Returns:
- the parser (XMLReader)
-
getParserSource
public Source getParserSource(PipelineConfiguration pipe, StreamSource input, int validation, boolean dtdValidation, int stripspace) Convert a StreamSource to either a SAXSource or a PullSource, depending on the native parser of the selected platform- Specified by:
getParserSourcein interfacePlatform- Parameters:
pipe- the pipeline configurationinput- the supplied StreamSourcevalidation- indicates whether schema validation is requireddtdValidation- indicates whether DTD validation is requiredstripspace- indicates whether whitespace text nodes should be stripped- Returns:
- the PullSource or SAXSource, initialized with a suitable parser, or the original input Source, if now special handling is required or possible. This implementation always returns the original input unchanged.
-
makeCollation
public StringCollator makeCollation(Configuration config, Properties props, String uri) throws XPathException Obtain a collation with a given set of properties. The set of properties is extensible and variable across platforms. Common properties with example values include lang=ed-GB, strength=primary, case-order=upper-first, ignore-modifiers=yes, alphanumeric=yes. Properties that are not supported are generally ignored; however some errors, such as failing to load a requested class, are fatal.- Specified by:
makeCollationin interfacePlatform- Parameters:
config- the configuration objectprops- the desired properties of the collationuri- the collation URI- Returns:
- a collation with these properties
- Throws:
XPathException- if a fatal error occurs
-
canReturnCollationKeys
Given a collation, determine whether it is capable of returning collation keys. The essential property of collation keys is that if two values are equal under the collation, then the collation keys are equal under the equals() method.- Specified by:
canReturnCollationKeysin interfacePlatform- Parameters:
collation- the collation, provided as a Comparator- Returns:
- true if this collation can supply collation keys
-
getCollationKey
Given a collation, get a collation key. The essential property of collation keys is that if two values are equal under the collation, then the collation keys are compare correctly under the equals() method.- Specified by:
getCollationKeyin interfacePlatform- Parameters:
namedCollation- the collation in usevalue- the string whose collation key is required- Returns:
- a representation of the collation key, such that two collation keys are equal() if and only if the string values they represent are equal under the specified collation.
- Throws:
ClassCastException- if the collation is not one that is capable of supplying collation keys (this should have been checked in advance)
-
addFunctionLibraries
Add the platform-specific function libraries to a function library list. This version of the method does nothing- Parameters:
list- the function library list that is to be extendedconfig- the ConfigurationhostLanguage- the host language, for example Configuration.XQUERY
-
getExternalObjectType
Description copied from interface:PlatformGet a SchemaType representing a wrapped external (Java or .NET) object- Specified by:
getExternalObjectTypein interfacePlatform- Parameters:
config- the Saxon Configurationuri- the namespace URI of the schema typelocalName- the local name of the schema type- Returns:
- the SchemaType object representing this type
-
getInstallationDirectory
Return the name of the directory in which the software is installed (if available)- Specified by:
getInstallationDirectoryin interfacePlatform- Parameters:
edition-config- the Saxon configuration- Returns:
- the name of the directory in which Saxon is installed, if available, or null otherwise
-
registerAllBuiltInObjectModels
Register all the external object models that are provided as standard with the relevant edition of Saxon for this Configuration- Specified by:
registerAllBuiltInObjectModelsin interfacePlatform- Since:
- 9.3
-
setDefaultSAXParserFactory
public void setDefaultSAXParserFactory()Set the default XML parser to be loaded by the SAXParserFactory on this platform. Needed because the Apache catalog resolver uses the SAXParserFactory to instantiate a parser, and if not customized this causes a failure on the .NET platform.- Specified by:
setDefaultSAXParserFactoryin interfacePlatform- Since:
- 9.4
-
getClassLoaderForGeneratedClass
public ClassLoader getClassLoaderForGeneratedClass(String definedClassName, byte[] classFile, Configuration config, Class thisClass) Return the class loader required to load the bytecode generated classes- Specified by:
getClassLoaderForGeneratedClassin interfacePlatform- Parameters:
definedClassName- The generated class nameclassFile- The bytecode of the generated classconfig- The cThe saxon configurationthisClass- The class object generated- Returns:
- the class loader object
- Since:
- 9.4
-