public class ProfessionalConfiguration extends Configuration
As well as holding configuration settings, this class acts as a factory for classes providing service in particular areas: error handling, URI resolution, and the like. Some of these services are chosen on the basis of the current platform (Java or .NET), some vary depending whether the environment is schema-aware or not.
The Configuration
provides access to a NamePool
which is used to manage
all the names used in stylesheets, queries, schemas, and source and documents: the NamePool
allocates integer codes to these names allowing efficient storage and comparison. Normally
there will be a one-to-one relationship between a NamePool
and a Configuration
.
It is possible, however, for several Configuration
objects to share the same
NamePool
. Until Saxon 8.9, by default all Configuration
objects
shared a single NamePool
unless configured otherwise; this changed in 8.9 so that
the default is to allocate a new NamePool
for each Configuration
.
The Configuration
establishes the scope within which node identity is managed.
Every document belongs to a Configuration
, and every node has a distinct identity
within that Configuration
. In consequence, it is not possible for any query or
transformation to manipulate multiple documents unless they all belong to the same
Configuration
.
Saxon-EE has a subclass of the Configuration
class which provides the additional
services needed for schema-aware processing. The EnterpriseConfiguration
also holds a cache of loaded schema components used for compiling schema-aware transformations
and queries, and for validating instance documents.
Since Saxon 8.4, the JavaDoc documentation for Saxon attempts to identify interfaces that are considered stable, and will only be changed in a backwards-incompatible way if there is an overriding reason to do so. These interfaces and methods are labelled with the JavaDoc "since" tag. The value 8.n indicates a method in this category that was introduced in Saxon version 8.n: or in the case of 8.4, that was present in Saxon 8.4 and possibly in earlier releases. (In some cases, these methods have been unchanged for a long time.) Methods without a "since" tag, although public, are provided for internal use or for use by advanced users, and are subject to change from one release to the next. The presence of a "since" tag on a class or interface indicates that there are one or more methods in the class that are considered stable; it does not mean that all methods are stable.
Configuration.LicenseFeature
builtInExtensionLibraryList, byteCodeThreshold, collectionFinder, defaultStaticQueryContext, DO_NOT_RECOVER, JAVA_APPLICATION, optimizer, optimizerOptions, RECOVER_SILENTLY, RECOVER_WITH_WARNINGS, typeHierarchy, XML_SCHEMA, XML10, XML11, XPATH, XQUERY, XSD10, XSD11, xsdVersion, XSLT
Constructor and Description |
---|
ProfessionalConfiguration()
Create a Saxon Professional Edition configuration object with default settings for all options.
|
Modifier and Type | Method and Description |
---|---|
void |
addExtensionBinders(FunctionLibraryList list)
Add the registered extension binders to a function library.
|
void |
checkLicensedFeature(int feature,
java.lang.String name,
int localLicenseId)
Check whether a particular feature is licensed, with a fatal error if it is not
|
void |
declareBuiltInExtensionElementNamespaces()
Declare the built-in XSLT extension element namespaces
|
void |
declareBuiltInExtensionFunctions()
Declare built-in extension functions
|
void |
disableLicensing() |
void |
displayLicenseMessage()
Display a message about the license status.
|
protected void |
forceLoadLicense() |
FunctionLibraryList |
getBuiltInExtensionLibraryList() |
java.lang.Object |
getConfigurationProperty(java.lang.String name)
Get a property of the configuration
|
java.lang.String |
getEditionCode()
Get the edition code identifying this configuration: "HE", "PE" or "EE"
|
FunctionLibrary |
getExtensionBinder(java.lang.String scheme)
Get the FunctionLibrary used to bind calls on extension functions on the specified
platform.
|
ExtensionElementFactory |
getExtensionElementFactory(java.lang.String namespace)
Get the XSLT extension element factory for a given namespace
|
protected java.lang.String |
getFeature(java.lang.String name)
This method is called to read a feature of the license.
|
java.lang.String |
getLicenseFeature(java.lang.String name)
Get the value of a named license feature
|
Function |
getSystemFunction(StructuredQName name,
int arity)
Get a system function.
|
TypeHierarchy |
getTypeHierarchy()
Get the TypeHierarchy: a cache holding type information
|
BuiltInFunctionSet |
getUseWhenFunctionSet() |
BuiltInFunctionSet |
getXPath31FunctionSet() |
BuiltInFunctionSet |
getXQueryUpdateFunctionSet() |
BuiltInFunctionSet |
getXSLT30FunctionSet() |
void |
importLicenseDetails(Configuration other)
Share licensing data stored in one configuration with another configuration.
|
boolean |
isExtensionElementAvailable(StructuredQName qName)
Ask whether an extension element with a particular name is available
|
boolean |
isFeatureAllowedBySecondaryLicense(int localLicenseId,
int feature) |
boolean |
isLicensedFeature(int feature)
Determine if a particular feature is licensed.
|
boolean |
isLicenseFound()
Ask if the configuration is known to be licensed
|
boolean |
isLicenseNotFound()
Ask if the configuration is known to be unlicensed
|
protected void |
loadLicense()
Attempt to load the license file.
|
protected StaticQueryContext |
makeAppropriateStaticQueryContext() |
protected ConfigurationReader |
makeConfigurationReader() |
Expression |
makeEvaluateInstruction(XSLEvaluate source,
ComponentDeclaration decl)
Make an instruction to implement xsl:evaluate
|
Expression |
makeFunctionSequenceCoercer(SpecificFunctionType type,
Expression exp,
RoleDiagnostic role)
Generate a function sequence coercer, that is, an expression which converts a sequence of function
items to a sequence of function items satisfying a given required type; the coerced functions call the
original function with arguments converted as necessary, or fail if conversion is not possible
|
SimpleMode |
makeMode(StructuredQName modeName,
CompilerInfo compilerInfo)
Make a new Mode - this can be overridden in subclasses to produce optimized variants
|
PackageLoaderPE |
makePackageLoader() |
static Configuration |
makeProfessionalConfiguration(java.lang.ClassLoader classLoader,
java.lang.String className)
Static method to instantiate a professional configuration.
|
StyleNodeFactory |
makeStyleNodeFactory(Compilation compilation)
Factory method to make a StyleNodeFactory, used for constructing elements
in a stylesheet document
|
TypeAliasManager |
makeTypeAliasManager()
Make a TypeAliasManager appropriate to the type of Configuration
|
XPathParser |
newExpressionParser(java.lang.String language,
boolean updating,
int languageVersion)
Make an expression Parser for a specified version of XPath or XQuery
|
UserFunction |
newUserFunction(boolean memoFunction,
FunctionStreamability streamability)
Make a UserFunction object.
|
int |
registerLocalLicense(java.lang.String dmk)
Register a local license file (for use within a single transformation (etc))
|
protected void |
reportIfMissingLicenseFeature(int feature,
java.lang.String name) |
javax.xml.transform.Source |
resolveSource(javax.xml.transform.Source source,
Configuration config)
Resolve a Source.
|
void |
setConfigurationProperty(java.lang.String name,
java.lang.Object value)
Set a property of the configuration.
|
void |
setExtensionBinder(java.lang.String scheme,
FunctionLibrary binder)
Set the FunctionLibrary used to bind calls on extension functions.
|
void |
setExtensionElementNamespace(java.lang.String namespace,
java.lang.String className)
Set a namespace used to refer to a library of XSLT extension elements
|
protected void |
setLicensedFeatures() |
void |
supplyLicenseKey(java.io.BufferedReader reader)
This method allows the contents of a license key to be supplied programmatically.
|
protected boolean |
testFeature(int feature)
Test whether a particular feature is available, given that a valid license has been successfully loaded.
|
addSchemaForBuiltInNamespace, addSchemaSource, addSchemaSource, buildDocument, buildDocument, buildDocumentTree, buildDocumentTree, checkStrictStreamability, checkTypeDerivationIsOK, clearSchemaCache, createByteCodeReport, createValidityReporter, createXMLParser, exportComponents, finalize, getAnnotationStripper, getAttributeDeclaration, getAttributeDeclaration, getBooleanProperty, getCharacterSetFactory, getClass, getCollation, getCollation, getCollation, getCollationURIResolver, getCollectionFinder, getCollectionURIResolver, getConfiguration, getConversionContext, getConversionRules, getCountDown, getDebugger, getDeclaredSchemaParameters, getDefaultCollationName, getDefaultCollection, getDefaultContextItemStaticInfo, getDefaultCountry, getDefaultLanguage, getDefaultRegexEngine, getDefaultSerializationProperties, getDefaultStaticQueryContext, getDefaultXsltCompilerInfo, getDocumentNumberAllocator, getDocumentValidator, getDynamicLoader, getElementDeclaration, getElementDeclaration, getElementValidator, getErrorListener, getExtensionsOfType, getExternalObjectModel, getExternalObjectModel, getExternalObjectModels, getFunctionAnnotationHandler, getGlobalDocumentPool, getImportedNamespaces, getInstance, getIntegratedFunctionLibrary, getLabel, getLocalizerFactory, getLogger, getMediaQueryEvaluator, getMediaTypeForFileExtension, getMessageEmitterClass, getModuleURIResolver, getMultithreadedItemMappingIterator, getNamePool, getOutputURIResolver, getParseOptions, getProcessor, getProductTitle, getRecoveryPolicy, getResourceFactoryForMediaType, getSchemaAsFunctionItem, getSchemaComponentAsFunctionItem, getSchemaType, getSchemaValidationMode, getSerializerFactory, getSourceParser, getSourceParserClass, getSourceResolver, getStandardErrorOutput, getStandardModuleURIResolver, getStreamability, getStripsWhiteSpace, getStyleParser, getStyleParserClass, getSystemURIResolver, getTraceListener, getTraceListenerClass, getTraceListenerOutputFile, getTreeModel, getTypeChecker, getUnparsedTextURIResolver, getURIResolver, getValidCharacterChecker, getXMLVersion, getXsdVersion, importComponents, init, instantiateClassName, internalSetBooleanProperty, isCompatible, isCompileWithTracing, isDeclaredNotation, isDeferredByteCode, isExpandAttributeDefaults, isGenerateByteCode, isJITEnabled, isLineNumbering, isSchemaAvailable, isStripsAllWhiteSpace, isTiming, isValidation, isValidationWarnings, isVersionWarning, isXIncludeAware, loadSchema, locateResource, locateResourceSource, makeAccumulatorRegistry, makeClosure, makeCompilerInfo, makeCompilerService, makeContextItemStaticInfo, makeDocumentProjector, makeDocumentProjector, makeEmitter, makeLicensedConfiguration, makeNumberer, makeParser, makePipelineConfiguration, makeSequenceExtent, makeSlotManager, makeStreamingTransformer, makeStreamInstruction, makeStylesheetPackage, makeSystemFunction, makeTemplateRule, makeThreadManager, makeTraceListener, makeTraceListener, makeURIResolver, makeUserUnionType, makeXQueryExpression, needEnterpriseEdition, newConfiguration, newExpressionExporter, newPendingUpdateList, newStaticQueryContext, obtainOptimizer, prepareValidationReporting, processResultDocument, readConfiguration, readConfiguration, readConfigurationFile, readConfigurationFile, readInlineSchema, readMultipleSchemas, readSchema, registerCollation, registerCollection, registerExtensionFunction, registerExternalObjectModel, registerFileExtension, registerFunctionAnnotationHandler, registerMediaType, reportFatalError, requireBoolean, requireString, reuseSourceParser, reuseStyleParser, sealNamespace, setBooleanProperty, setCollationURIResolver, setCollectionFinder, setCollectionURIResolver, setCompileWithTracing, setConversionRules, setDebugger, setDefaultCollection, setDefaultCountry, setDefaultLanguage, setDefaultRegexEngine, setDefaultSerializationProperties, setDocumentNumberAllocator, setDynamicLoader, setErrorListener, setExpandAttributeDefaults, setLabel, setLineNumbering, setLocalizerFactory, setLogger, setMediaQueryEvaluator, setMessageEmitterClass, setModuleURIResolver, setModuleURIResolver, setNamePool, setOutputURIResolver, setParameterizedURIResolver, setProcessor, setRecoveryPolicy, setSchemaValidationMode, setSerializerFactory, setSourceParserClass, setSourceResolver, setStandardErrorOutput, setStaticQueryContextFactory, setStripsAllWhiteSpace, setStripsWhiteSpace, setStyleParserClass, setTiming, setTraceListener, setTraceListenerClass, setTraceListenerOutputFile, setTreeModel, setUnparsedTextURIResolver, setURIResolver, setValidation, setValidationWarnings, setVersionWarning, setXIncludeAware, setXMLVersion, unravel, validateAttribute
public ProfessionalConfiguration()
protected StaticQueryContext makeAppropriateStaticQueryContext()
makeAppropriateStaticQueryContext
in class Configuration
protected ConfigurationReader makeConfigurationReader()
makeConfigurationReader
in class Configuration
public static Configuration makeProfessionalConfiguration(java.lang.ClassLoader classLoader, java.lang.String className) throws java.lang.RuntimeException
On the .NET platform, this method should not be called unless it is known that the assembly saxon9sa.dll has already been loaded. This can be achieved by an appropriate call on Assembly.Load(): for an example, see the C# Configuration.cs class in the Saxon.Api namespace.
This method fails if Saxon-EE cannot be loaded, but it does not fail if there is no license available. In that case it returns a schema-aware configuration object, but any attempt to use schema-aware processing will fail.
classLoader
- - the class loader to be used. If null, the context class loader for the current
thread is used.className
- - the name of the schema aware configuration class. Defaults to
"com.saxonica.config.ProfessionalConfiguration" if null is supplied. This allows an assembly
qualified name to be supplied under .NET. The class, once instantiated, must be an instance
of Configuration, but despite the name of this method there is nothing that requires it to
be schema-aware.java.lang.RuntimeException
- if the Saxon-PE product cannot be loadedpublic java.lang.String getEditionCode()
getEditionCode
in class Configuration
public TypeHierarchy getTypeHierarchy()
getTypeHierarchy
in class Configuration
public TypeAliasManager makeTypeAliasManager()
makeTypeAliasManager
in class Configuration
public PackageLoaderPE makePackageLoader()
makePackageLoader
in class Configuration
public void setConfigurationProperty(java.lang.String name, java.lang.Object value)
setConfigurationProperty
in class Configuration
name
- the URI identifying the property to be set. See the class FeatureKeys
for
constants representing the property names that can be set.value
- the value of the propertyjava.lang.IllegalArgumentException
- if the property name is not recognized or if the value is not
a valid value for the named propertypublic java.lang.Object getConfigurationProperty(java.lang.String name)
getConfigurationProperty
in class Configuration
name
- the name of the required property. See the class FeatureKeys
for
constants representing the property names that can be requested.java.lang.IllegalArgumentException
- thrown if the property is not one that Saxon recognizes.public void supplyLicenseKey(java.io.BufferedReader reader)
reader
- A reader that will be used to read the contents of the license file
(for example, a StringReader)java.lang.IllegalArgumentException
- if the key supplied is not a valid OEM license keyprotected final void forceLoadLicense() throws LicenseException
LicenseException
public void importLicenseDetails(Configuration other)
importLicenseDetails
in class Configuration
other
- another Configuration, whose license information will be imported into this Configuration.protected java.lang.String getFeature(java.lang.String name)
name
- the name of the requested featurejava.lang.RuntimeException
- if no license is availablepublic void checkLicensedFeature(int feature, java.lang.String name, int localLicenseId) throws LicenseException
checkLicensedFeature
in class Configuration
feature
- the feature in question, identified by a constant in class Configuration.LicenseFeature
name
- the name of the feature for use in diagnosticslocalLicenseId
- LicenseException
- if the feature is not licensedpublic void disableLicensing()
disableLicensing
in class Configuration
public boolean isFeatureAllowedBySecondaryLicense(int localLicenseId, int feature)
isFeatureAllowedBySecondaryLicense
in class Configuration
protected void reportIfMissingLicenseFeature(int feature, java.lang.String name)
public final boolean isLicensedFeature(int feature) throws LicenseException
FeatureKeys.TIMING
is set (corresponding to -t on the command line).isLicensedFeature
in class Configuration
feature
- the feature in question, identified by a constant in class Configuration.LicenseFeature
LicenseException
public final java.lang.String getLicenseFeature(java.lang.String name)
getLicenseFeature
in class Configuration
name
- the name of the featureprotected final void loadLicense() throws LicenseException
LicenseException
- if the license cannot be loaded.protected void setLicensedFeatures()
public int registerLocalLicense(java.lang.String dmk)
registerLocalLicense
in class Configuration
dmk
- the license in encoded formprotected boolean testFeature(int feature)
feature
- a constant in class Configuration.LicenseFeature
public boolean isLicenseNotFound()
public boolean isLicenseFound()
public void displayLicenseMessage()
displayLicenseMessage
in class Configuration
public StyleNodeFactory makeStyleNodeFactory(Compilation compilation)
makeStyleNodeFactory
in class Configuration
compilation
- public Expression makeEvaluateInstruction(XSLEvaluate source, ComponentDeclaration decl) throws XPathException
makeEvaluateInstruction
in class Configuration
XPathException
public XPathParser newExpressionParser(java.lang.String language, boolean updating, int languageVersion) throws XPathException
newExpressionParser
in class Configuration
language
- set to "XP" (XPath) or "XQ" (XQuery) or "PATTERN" (XSLT Patterns)updating
- indicates whether or not XQuery update syntax may be used. Note that XQuery Update
is supported only in Saxon-EElanguageVersion
- the required version (e.g 10 for "1.0", 30 for "3.0", 31 for "3.1"). In Saxon 9.8,
a request for XQuery 1.0 or 3.0 delivers an XQuery 3.1 parser, while the values
supported for XPath are 2.0 and 3.1XPathException
- if this version of Saxon does not support the
requested optionspublic Expression makeFunctionSequenceCoercer(SpecificFunctionType type, Expression exp, RoleDiagnostic role)
makeFunctionSequenceCoercer
in class Configuration
type
- the required function typeexp
- the expression that delivers a sequence of function itemsrole
- diagnostic informationpublic BuiltInFunctionSet getXSLT30FunctionSet()
getXSLT30FunctionSet
in class Configuration
public BuiltInFunctionSet getUseWhenFunctionSet()
getUseWhenFunctionSet
in class Configuration
public BuiltInFunctionSet getXPath31FunctionSet()
getXPath31FunctionSet
in class Configuration
public BuiltInFunctionSet getXQueryUpdateFunctionSet()
getXQueryUpdateFunctionSet
in class Configuration
public void setExtensionBinder(java.lang.String scheme, FunctionLibrary binder)
JavaExtensionLibrary
. It thus disables the function libraries
for built-in Saxon extensions and for EXSLT extensions. It is possible to create a
function library that adds to the existing mechanisms, rather than replacing them,
by supplying as the FunctionLibrary a FunctionLibraryList
that itself contains two FunctionLibrary objects: a JavaExtensionLibrary, and a user-written
FunctionLibrary.scheme
- The scheme served by the extension binder. Typically this will be one
of "java" or "clitype". However, user-defined extension binders for other
schemes can be registered. Note that the scheme name does not have to be
related to the actual namespace used in function calls; all registered
function libraries have the opportunity to bind any extension function call.
The significance is purely local to this class: setting an extension binder
for a given scheme replaces the existing extension binder for that scheme.
The two schemes used by Saxon itself are "java" for dynamically-bound
Java extension functions, and "clitype" for dynamically-bound .NET extension
functionsbinder
- The FunctionLibrary object used to locate implementations of extension
functions, based on their name and aritypublic FunctionLibrary getExtensionBinder(java.lang.String scheme)
scheme
- The URI scheme served by the extension binder. This will typically be one
of "java" or "clitype". On the Java platform, the only scheme currently supported is "java";
on the .NET platform, the "java" and "clitype" schemes coexist.public void addExtensionBinders(FunctionLibraryList list)
addExtensionBinders
in class Configuration
list
- the function library listpublic Function getSystemFunction(StructuredQName name, int arity) throws XPathException
getSystemFunction
in class Configuration
XPathException
- if dynamic function calls are not permitted by this Saxon Configurationpublic FunctionLibraryList getBuiltInExtensionLibraryList()
getBuiltInExtensionLibraryList
in class Configuration
public UserFunction newUserFunction(boolean memoFunction, FunctionStreamability streamability)
newUserFunction
in class Configuration
memoFunction
- true if the function is to be a memo function, This option is ignored
in Saxon-HE.streamability
- the declared streamability of the functionpublic void declareBuiltInExtensionFunctions()
public void declareBuiltInExtensionElementNamespaces()
public void setExtensionElementNamespace(java.lang.String namespace, java.lang.String className) throws XPathException
namespace
- the namespace used for the extension elementsclassName
- the classname of the implementation of the ExtensionElementFactory
that instantiates extension elements in this namespaceXPathException
- if (for example) the supplied class does not implement
the ExtensionElementFactory interfacepublic ExtensionElementFactory getExtensionElementFactory(java.lang.String namespace)
namespace
- the namespace URI of the extension elementpublic boolean isExtensionElementAvailable(StructuredQName qName)
isExtensionElementAvailable
in class Configuration
qName
- the extension element namepublic javax.xml.transform.Source resolveSource(javax.xml.transform.Source source, Configuration config) throws XPathException
resolveSource
in interface SourceResolver
resolveSource
in class Configuration
source
- A source object, typically the source supplied as the first
argument to Transformer.transform(javax.xml.transform.Source, javax.xml.transform.Result)
or similar methods.config
- The Configuration. This provides the SourceResolver with access to
configuration information; it also allows the SourceResolver to invoke the
resolveSource() method on the Configuration object as a fallback implementation.AugmentedSource
,
NodeInfo
,
or PullSource
. Return null if the Source object is not
recognizedXPathException
- if the Source object is recognized but cannot be processedpublic SimpleMode makeMode(StructuredQName modeName, CompilerInfo compilerInfo)
makeMode
in class Configuration
modeName
- the name of the modecompilerInfo
- information on the compiler, that can alter rule optimizationCopyright (c) 2004-2018 Saxonica Limited. All rights reserved.