Class EnterpriseConfiguration

  • All Implemented Interfaces:
    SourceResolver, NotationSet

    public final class EnterpriseConfiguration
    extends ProfessionalConfiguration
    A subclass of Configuration that defines a processor with Saxon-EE capabilities. This contains helper methods invoked both at compile time and at run-time to perform operations that are allowed only in a schema-aware processor; the superclass Configuration contains the dummy versions of these methods used in a non-schema-aware processor. The interface is designed so that the calling classes contain no references to classes that are available only in the schema-aware product.

    Applications should avoid using this class directly, and should instead access all the necessary functionality through its superclass, Configuration.

    • Constructor Detail

      • EnterpriseConfiguration

        public EnterpriseConfiguration()
        Create an EnterpriseConfiguration
    • Method Detail

      • makeStaticQueryContext

        protected StaticQueryContext makeStaticQueryContext​(boolean copyFromDefault)
        Description copied from class: Configuration
        Make a new static query context object using the factory registered with this configuration
        Overrides:
        makeStaticQueryContext in class Configuration
        Parameters:
        copyFromDefault - true if the new static query context is to copy the properties of the default static query context held in the configuration
        Returns:
        the new static query context object
      • getEditionCode

        public java.lang.String getEditionCode()
        Get the edition code identifying this configuration: "HE", "PE" or "EE"
        Overrides:
        getEditionCode in class ProfessionalConfiguration
        Returns:
        the code identifying the Saxon edition associated with this configuration
      • setFeature

        protected void setFeature​(FeatureData feature,
                                  java.lang.Object value)
        Set a property of the configuration. This method underpins the setAttribute() method of the TransformerFactory implementation, and is provided to enable setting of Configuration properties using URIs without instantiating a TransformerFactory: specifically, this may be useful when running XQuery, and it is also used by the Validator API
        Overrides:
        setFeature in class ProfessionalConfiguration
        Parameters:
        feature - the property to be set. See the class Feature for constants representing the properties that can be set.
        value - the value of the property
        Throws:
        java.lang.IllegalArgumentException - if the property name is not recognized or if the value is not a valid value for the named property
      • getFeature

        protected java.lang.Object getFeature​(FeatureData feature)
        Get a property of the configuration
        Overrides:
        getFeature in class Configuration
        Parameters:
        feature - the required property. See the class Feature for constants representing the property names that can be requested.
        Returns:
        the value of the property
        Throws:
        java.lang.IllegalArgumentException - thrown if the property is not one that Saxon recognizes.
      • checkLicensedFeature

        public void checkLicensedFeature​(int feature,
                                         java.lang.String name,
                                         int localLicenseId)
                                  throws LicenseException
        Check whether a particular feature is licensed, with a fatal error if it is not
        Overrides:
        checkLicensedFeature in class ProfessionalConfiguration
        Parameters:
        feature - the feature in question, identified by a constant in class Configuration.LicenseFeature
        name - the name of the required feature, for use in diagnostics
        localLicenseId - identifies a license key embedded in the SEF file
        Throws:
        LicenseException - if the feature is not licensed
      • testFeature

        protected boolean testFeature​(int feature)
        Determine if a particular feature is licensed. Note, this method should only be called if it is known that the license file has been loaded. If it is not known whether the license file has been loaded, use the method Configuration.isLicensedFeature(int) which will load the license when necessary.
        Overrides:
        testFeature in class ProfessionalConfiguration
        Parameters:
        feature - the feature in question, identified by a constant in class Configuration.LicenseFeature
        Returns:
        true if the feature is available, otherwise false
      • needEnterpriseEdition

        protected void needEnterpriseEdition()
        Throw an error indicating that a request cannot be satisfied because it requires the enterprise edition of Saxon. If we get this far, we've got Saxon-EE loaded, and an EnterpriseConfiguration; the problem must therefore be with the license file.
        Overrides:
        needEnterpriseEdition in class Configuration
      • makeStyleNodeFactory

        public StyleNodeFactory makeStyleNodeFactory​(Compilation compilation)
        Factory method to make a StyleNodeFactory, used for constructing elements in a stylesheet document
        Overrides:
        makeStyleNodeFactory in class ProfessionalConfiguration
        Parameters:
        compilation - the compilation episode (compiling one XSLT package)
        Returns:
        the StyleNodeFactory used in this Configuration
      • makeAccumulatorRegistry

        public AccumulatorRegistry makeAccumulatorRegistry()
        Factory method to make the AccumulatorManager, used for static information about the accumulators used in a particular package
        Overrides:
        makeAccumulatorRegistry in class Configuration
        Returns:
        a new AccumulatorManager appropriate to this Configuration
      • newUserFunction

        public UserFunction newUserFunction​(boolean memoFunction,
                                            FunctionStreamability streamability)
        Make a UserFunction object. This method is for internal use.
        Overrides:
        newUserFunction in class Configuration
        Parameters:
        memoFunction - true if the function is to be a memo function, This option is ignored in Saxon-HE.
        streamability - the declared streamability of the function
        Returns:
        the newly created user-defined function
      • setSchemaURIResolver

        public void setSchemaURIResolver​(SchemaURIResolver resolver)
        Set a user-defined SchemaURIResolver for resolving URIs used in "import schema" declarations.
        Parameters:
        resolver - the URI resolver used for import schema declarations
      • newSchemaCompiler

        public SchemaCompiler newSchemaCompiler()
        Make a SchemaCompiler which can be used to compile schema documents. The initial settings of the SchemaCompiler are a snapshot of the settings in the EnterpriseConfiguration. Other methods in EnterpriseConfiguration provided for the purpose of compiling schemas are retained for compatibility reasons.
        Returns:
        a new SchemaCompiler object
        Since:
        8.9
      • setOccurrenceLimits

        public void setOccurrenceLimits​(int minimum,
                                        int maximum)
        Set the occurrence limits to be used when compiling a finite state automaton.
        Parameters:
        minimum - The highest value of minOccurs that will be strictly enforced. If the actual value of minOccurs in a schema is higher than this value, it will be treated as if this value had been specified. The default is 100.
        maximum - The highest value of maxOccurs that will be strictly enforced. If the actual value of maxOccurs in a schema is higher than this value, it will be treated as if "unbounded" had been specified. The default is 250.
      • getOccurrenceLimits

        public int[] getOccurrenceLimits()
        Get the occurrence limits previously set using setOccurrenceLimits (or the default)
        Returns:
        an array of two integers, the minimum occurrence limit and the maximum occurrence limit
      • getSchemaURIResolver

        public SchemaURIResolver getSchemaURIResolver()
        Get the user-defined SchemaURIResolver for resolving URIs used in "import schema" declarations; if none has been explicitly set, returns the standard schema URI resolver.
        Returns:
        the user-defined SchemaURIResolver if there is one; otherwise the standard schema URI resolver.
      • readSchema

        public java.lang.String readSchema​(PipelineConfiguration pipe,
                                           java.lang.String baseURI,
                                           java.lang.String schemaLocation,
                                           java.lang.String expected)
                                    throws SchemaException
        Read a schema from a given schema location
        Overrides:
        readSchema in class Configuration
        Parameters:
        pipe - the PipelineConfiguration
        baseURI - the base URI for resolving relative URIs
        schemaLocation - the location "hint" where to find the schema document. Must not be null. The document located may be either an XSD schema document or an SCM compiled schema.
        expected - the target namespace expected; null if there is no expectation
        Returns:
        the actual target namespace of the schema
        Throws:
        SchemaException - if the schema cannot be read
      • readMultipleSchemas

        public void readMultipleSchemas​(PipelineConfiguration pipe,
                                        java.lang.String baseURI,
                                        java.util.List<java.lang.String> schemaLocations,
                                        java.lang.String expected)
                                 throws SchemaException
        Read schema documents from a list of schema locations
        Overrides:
        readMultipleSchemas in class Configuration
        Parameters:
        pipe - the pipeline configuration
        baseURI - the base URI for resolving relative URIs
        schemaLocations - the list of location "hints" where to find the schema document. Must not be null.
        expected - the target namespace expected in each of the schema documents; null if there is no
        Throws:
        SchemaException - if an error occurs
      • readInlineSchema

        public java.lang.String readInlineSchema​(NodeInfo root,
                                                 java.lang.String expected,
                                                 ErrorReporter errorReporter)
                                          throws SchemaException
        Read an inline schema from a stylesheet
        Overrides:
        readInlineSchema in class Configuration
        Parameters:
        root - the xs:schema element in the stylesheet
        expected - the target namespace expected; "" if there is no expectation
        errorReporter - The destination for error messages. May be null, in which case the errorListener registered with this Configuration is used.
        Returns:
        the actual target namespace of the schema
        Throws:
        SchemaException - if the schema cannot be processed
      • addSchemaSource

        public void addSchemaSource​(javax.xml.transform.Source schemaSource,
                                    ErrorReporter errorReporter)
                             throws SchemaException
        Load a schema, which will be available for use by all subsequent operations using this EnterpriseConfiguration.
        Overrides:
        addSchemaSource in class Configuration
        Parameters:
        schemaSource - the JAXP Source object identifying the schema document to be loaded. This may be either a source schema document in XSD format, or a compiled schema in Saxon's SCM format
        errorReporter - the ErrorReporter to be notified of any errors in the schema. If null, the configuration's ErrorReporter is used
        Throws:
        SchemaException - if the schema cannot be read or parsed or if it is invalid
      • addSchemaSource

        public void addSchemaSource​(javax.xml.transform.Source schemaSource,
                                    ErrorReporter errorReporter,
                                    SchemaCompiler compiler)
                             throws SchemaException
        Load a schema, which will be available for use by all subsequent operations using this EnterpriseConfiguration.
        Parameters:
        schemaSource - the JAXP Source object identifying the schema document to be loaded. This may be either a source schema document in XSD format, or a compiled schema in Saxon's SCM format
        errorReporter - the ErrorListener to be notified of any errors in the schema. If null, the configuration's errorListener is used
        compiler - the schema compiler to be used. This allows a cache of schema documents (retained by the schema compiler) to be reused when compiling multiple schema documents. See bug #4982.
        Throws:
        SchemaException - if the schema cannot be read or parsed or if it is invalid
      • addSchema

        public void addSchema​(PreparedSchema pschema)
                       throws SchemaException
        Add a schema (a collection of schema components) to the cache
        Parameters:
        pschema - The schema to be added
        Throws:
        SchemaException - if the schema cannot be added because components in the schema are incompatible with components already in the cache
      • addSurrogateSchema

        public void addSurrogateSchema​(java.lang.String namespace)
        Put a temporary schema marker in the cache, to indicate that a schema for a given namespace is being processed. Used to detect circularities.

        This method is intended for internal use

        Parameters:
        namespace - the target namespace of the schema
      • addSchemaForBuiltInNamespace

        public void addSchemaForBuiltInNamespace​(java.lang.String namespace)
        Add a built-in schema for a given namespace. This is a no-op if the configuration is not schema-aware
        Overrides:
        addSchemaForBuiltInNamespace in class Configuration
        Parameters:
        namespace - the namespace. Currently built-in schemas are available for the XML, XSI, and FN namespaces
      • isSchemaAvailable

        public boolean isSchemaAvailable​(java.lang.String targetNamespace)
        Determine whether the Configuration contains a cached schema for a given target namespace
        Overrides:
        isSchemaAvailable in class Configuration
        Parameters:
        targetNamespace - the target namespace of the schema being sought (supply "" for the unnamed namespace)
        Returns:
        true if the schema for this namespace is available, false if not.
      • removeSchema

        public void removeSchema​(java.lang.String namespace)
        Remove the schema for a given namespace. This is done if it is found to be invalid. Note that this does not actually remove the schema components in this namespace; all it does is to mark the namespace as removed, which means that a new attempt to load a schema for this namespace is able to succeed.
        Parameters:
        namespace - the namespace of the schema to be removed
      • getImportedNamespaces

        public java.util.Set<java.lang.String> getImportedNamespaces()
        Get the set of namespaces of imported schemas
        Overrides:
        getImportedNamespaces in class Configuration
        Returns:
        a Set whose members are the namespaces of all schemas in the schema cache, as String objects
      • getSuperSchema

        public PreparedSchema getSuperSchema()
        Get the SuperSchema, containing references to all names defined in all known schemas
        Returns:
        the PreparedSchema containing the schema components for all loaded target namespaces
      • sealNamespace

        public void sealNamespace​(java.lang.String namespace)
        Mark a schema namespace as being sealed. This is done when components from this namespace are first used for validating a source document or compiling a source document or query. Once a namespace has been sealed, it is not permitted to change the schema components in that namespace by redefining them, deriving new types by extension, or adding to their substitution groups.
        Overrides:
        sealNamespace in class Configuration
        Parameters:
        namespace - the namespace URI of the components to be sealed
      • isSealedNamespace

        public boolean isSealedNamespace​(java.lang.String namespace)
        Test whether a schema namespace is sealed. Once a namespace has been sealed, it is not permitted to change the schema components in that namespace by redefining them, deriving new types by extension, or adding to their substitution groups.
        Parameters:
        namespace - the namespace URI of the components to be tested. Supply "" for the no-namespace.
        Returns:
        true if this namespace has been sealed, otherwise false
      • getDeclaredSchemaParameters

        public java.util.Collection<GlobalParam> getDeclaredSchemaParameters()
        Get the set of saxon:param schema parameters declared in the schema held by this Configuration.
        Overrides:
        getDeclaredSchemaParameters in class Configuration
        Returns:
        the set of parameters. May return null if none have been declared.
      • getExtensionsOfType

        public java.lang.Iterable<? extends SchemaType> getExtensionsOfType​(SchemaType type)
        Get the set of complex types that have been defined as extensions of a given type. Note that we do not seal the schema namespace, so this list is not necessarily final; we must assume that new extensions of built-in simple types can be added at any time
        Overrides:
        getExtensionsOfType in class Configuration
        Parameters:
        type - the type whose extensions are required
        Returns:
        an iterator over the types that are derived from the given type by extension
      • exportComponents

        public void exportComponents​(Receiver out)
                              throws XPathException
        Export a precompiled Schema Component Model containing all the components (except built-in components) that have been loaded into this Processor.
        Overrides:
        exportComponents in class Configuration
        Parameters:
        out - the destination to recieve the precompiled Schema Component Model in the form of an XML document
        Throws:
        XPathException - if a failure occurs
      • clearSchemaCache

        public void clearSchemaCache()
        Remove all schema components that have been loaded into this Configuration. This method must not be used if any processes (such as stylesheet or query compilations or executions) are currently active. In a multi-threaded environment, it is the user's responsibility to ensure that this method is not called unless it is safe to do so.
        Overrides:
        clearSchemaCache in class Configuration
      • getElementDeclaration

        public SchemaDeclaration getElementDeclaration​(int fingerprint)
        Get a global element declaration by fingerprint
        Overrides:
        getElementDeclaration in class Configuration
        Parameters:
        fingerprint - the NamePool fingerprint of the element name
        Returns:
        the element declaration whose name matches the given fingerprint, or null if no element declaration with this name has been registered.
      • getElementDeclaration

        public SchemaDeclaration getElementDeclaration​(StructuredQName qName)
        Get a global element declaration by name.
        Overrides:
        getElementDeclaration in class Configuration
        Parameters:
        qName - the name of the required element declaration
        Returns:
        the element declaration whose name matches the given name, or null if no element declaration with this name has been registered.
      • getAttributeDeclaration

        public SchemaDeclaration getAttributeDeclaration​(int fingerprint)
        Get a global attribute declaration by fingerprint
        Overrides:
        getAttributeDeclaration in class Configuration
        Parameters:
        fingerprint - the NamePool fingerprint of the element name
        Returns:
        the attribute declaration whose name matches the given fingerprint, or null if no element declaration with this name has been registered.
      • getAttributeDeclaration

        public SchemaDeclaration getAttributeDeclaration​(StructuredQName attributeName)
        Get a global attribute declaration by name
        Overrides:
        getAttributeDeclaration in class Configuration
        Parameters:
        attributeName - the name of the required attribute declaration
        Returns:
        the attribute declaration whose name matches the given fingerprint, or null if no element declaration with this name has been registered.
      • getSchemaType

        public SchemaType getSchemaType​(StructuredQName name)
        Get the top-level schema type definition with a given QName.
        Overrides:
        getSchemaType in class Configuration
        Parameters:
        name - the name of the required schema type
        Returns:
        the schema type , or null if there is none with this name.
        Since:
        9.7
      • makeUserUnionType

        public UserUnionType makeUserUnionType​(java.util.List<AtomicType> memberTypes)
        Make a union type with a given list of member types
        Overrides:
        makeUserUnionType in class Configuration
        Parameters:
        memberTypes - the member types
        Returns:
        the union type with these member types
      • isDeclaredNotation

        public boolean isDeclaredNotation​(java.lang.String uri,
                                          java.lang.String local)
        Ask whether a given notation has been declared in the schema
        Specified by:
        isDeclaredNotation in interface NotationSet
        Overrides:
        isDeclaredNotation in class Configuration
        Parameters:
        uri - the targetNamespace of the notation
        local - the local part of the notation name
        Returns:
        true if the notation has been declared, false if not
        Since:
        9.3
      • checkTypeDerivationIsOK

        public void checkTypeDerivationIsOK​(SchemaType derived,
                                            SchemaType base,
                                            int block)
                                     throws SchemaException
        Check that a type is validly derived from another type, following the rules for the Schema Component Constraint "Is Type Derivation OK (Simple)" (3.14.6) or "Is Type Derivation OK (Complex)" (3.4.6) as appropriate.
        Overrides:
        checkTypeDerivationIsOK in class Configuration
        Parameters:
        derived - the derived type
        base - the base type; the algorithm tests whether derivation from this type is permitted
        block - the derivations that are blocked by the relevant element declaration
        Throws:
        SchemaException - if the derivation is not allowed
      • prepareValidationReporting

        public void prepareValidationReporting​(XPathContext context,
                                               ParseOptions options)
        Set validation reporting options. Called by instructions that invoke validation to set up an appropriate invalidity handler
        Overrides:
        prepareValidationReporting in class Configuration
        Parameters:
        context - the XPath evaluation context
        options - the parser options, to be updated
      • getDocumentValidator

        public Receiver getDocumentValidator​(Receiver receiver,
                                             java.lang.String systemId,
                                             ParseOptions validationOptions,
                                             Location initiatingLocation)
        Get a document-level validator to add to a Receiver pipeline
        Overrides:
        getDocumentValidator in class Configuration
        Parameters:
        receiver - The receiver to which events should be sent after validation
        systemId - the base URI of the document being validated
        validationOptions - Supplies options relevant to XSD validation
        initiatingLocation - (optional) Location in query or stylesheet of instruction that requested validation
        Returns:
        A Receiver to which events can be sent for validation
      • getElementValidator

        public Receiver getElementValidator​(Receiver receiver,
                                            ParseOptions options,
                                            Location location)
                                     throws XPathException
        Get a Receiver that can be used to validate an element, and that passes the validated element on to a target receiver. If validation is not supported, the returned receiver will be the target receiver.
        Overrides:
        getElementValidator in class Configuration
        Parameters:
        receiver - the target receiver to receive the validated element; its pipelineConfiguration must be initialized.
        options - options affecting the way schema validation is done
        location - identifies the location of the element within its source document (or, if preferred, the location of the instruction requesting validation), relative to the LocationProvider in the PipelineConfiguration of the receiver
        Returns:
        The newly created receiver, which performs the validation and passes the validated elements on to the target receiver.
        Throws:
        XPathException - if a validator for the element cannot be created
      • getAnnotationStripper

        public Receiver getAnnotationStripper​(Receiver destination)
        Add to a pipeline a receiver that strips all type annotations. This has a null implementation in the Saxon-HE product, because type annotations can never arise.
        Overrides:
        getAnnotationStripper in class Configuration
        Parameters:
        destination - the destination for events after stripping type annotations
        Returns:
        the type-stripping receiver
      • newExpressionParser

        public XPathParser newExpressionParser​(java.lang.String language,
                                               boolean updating,
                                               int languageVersion)
                                        throws XPathException
        Make an expression Parser for a specified version of XPath or XQuery
        Overrides:
        newExpressionParser in class ProfessionalConfiguration
        Parameters:
        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-EE
        languageVersion - 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.1
        Returns:
        the QueryParser
        Throws:
        XPathException - if this version of Saxon does not support the requested options
      • newExpressionExporter

        public ExpressionPresenter newExpressionExporter​(java.lang.String target,
                                                         java.io.OutputStream destination,
                                                         StylesheetPackage rootPackage)
                                                  throws XPathException
        Get a new ExpressionPresenter capable of exporting a compiled stylesheet
        Overrides:
        newExpressionExporter in class Configuration
        Parameters:
        target - the target environment, e.g. EE, JS
        destination - the destination for the output file
        rootPackage - the compiled stylesheet package
        Returns:
        a suitable Expression Presenter
        Throws:
        XPathException - if none is available (e.g. because this is not Saxon-EE)
      • makeSchemaURIResolver

        public SchemaURIResolver makeSchemaURIResolver​(ResourceResolver resolver)
        Make a SchemaURIResolver that wraps a supplied URIResolver
        Overrides:
        makeSchemaURIResolver in class Configuration
        Parameters:
        resolver - the resolver to be used
        Returns:
        a new SchemaURIResolver (or null if this is not an EnterpriseConfiguration)
        Since:
        10.0
      • makeDocumentProjector

        public FilterFactory makeDocumentProjector​(PathMap.PathMapRoot map)
        Create a document projector for a given path map root. Document projection is available only in Saxon-EE, so the Saxon-HE version of this method throws an exception
        Overrides:
        makeDocumentProjector in class Configuration
        Parameters:
        map - a path map root in a path map. This might represent the call to the initial context item for a query, or it might represent a call on the doc() function. The path map contains information about the paths that the query uses within this document.
        Returns:
        a push filter that implements document projection
        Throws:
        java.lang.UnsupportedOperationException - if this is not a schema-aware configuration, or if no Saxon-EE license is available
      • makeDocumentProjector

        public FilterFactory makeDocumentProjector​(XQueryExpression exp)
        Create a document projector for the document supplied as the initial context item in a query. Document projection is available only in Saxon-EE, so the Saxon-HE version of this method throws an exception
        Overrides:
        makeDocumentProjector in class Configuration
        Parameters:
        exp - an XQuery expression. The document projector that is returned will be for the document supplied as the context item to this query.
        Returns:
        a push filter that implements document projection
        Throws:
        java.lang.UnsupportedOperationException - if this is not a schema-aware configuration, or if no Saxon-EE license is available
      • getFocusTrackerFactory

        public java.util.function.Function<SequenceIterator,​FocusTrackingIterator> getFocusTrackerFactory​(Executable exec,
                                                                                                                boolean multithreaded)
        Get a factory function that can be used to wrap a SequenceIterator in a FocusTrackingIterator. This is called by the Controller to get a default factory function; the value can be overridden by the application using Controller.setFocusTrackerFactory(java.util.function.Function). The FocusTrackingIterator that is created by the factory must be thread-safe if it is to be used for iterating over a sequence where the items might be processed asynchronously using xsl:result-document; for this reason this method is overridden for a Saxon-EE configuration.
        Overrides:
        getFocusTrackerFactory in class Configuration
        Parameters:
        exec - the executable; supplied so that the factory can be sensitive to whether calls on xsl:result-document are possible
        multithreaded - set to true to get a factory suitable for creating focus tracking iterators for a multi-threaded xsl:for-each instruction
        Returns:
        a suitable factory function
      • setStreamabilityEnabled

        public void setStreamabilityEnabled​(boolean enabled)
        Set the streamability rules to be applied. Requires an EET license.
        Parameters:
        enabled - set to true if streamability checking (using W3C standard rules) is enabled for this configuration. Must be false under Saxon-HE
        Since:
        9.6. Changed in 9.8 to drop support for streamability="extended". Simplified and renamed (from setStreamability) in 10.0
      • isStreamabilityEnabled

        public boolean isStreamabilityEnabled()
        Ask whether streamability checking is enabled for this configuration
        Overrides:
        isStreamabilityEnabled in class Configuration
        Returns:
        always false for Saxon-HE; for Saxon-EE, true if an appropriate license is installed
      • makeStreamingTransformer

        public Receiver makeStreamingTransformer​(Mode mode,
                                                 ParameterSet ordinaryParams,
                                                 ParameterSet tunnelParams,
                                                 Outputter out,
                                                 XPathContext context)
                                          throws XPathException
        Create a streaming transformer
        Overrides:
        makeStreamingTransformer in class Configuration
        Parameters:
        mode - the initial mode, which must be a streaming mode
        ordinaryParams - the parameters that are not tunnel parameters
        tunnelParams - the tunnel parameters
        out - the destination for the transformed document
        context - the initial XPath context
        Returns:
        a Receiver to which the streamed input document will be pushed
        Throws:
        XPathException - if a streaming transformer cannot be created (which is always the case in Saxon-HE and Saxon-PE)
      • isStreamedNode

        public boolean isStreamedNode​(NodeInfo node)
        Ask whether a given node is a streamed node
        Overrides:
        isStreamedNode in class Configuration
        Parameters:
        node - the node in question
        Returns:
        true if the node is a node in a streamed document
      • obtainOptimizer

        public Optimizer obtainOptimizer()
        Factory method to get an Optimizer
        Overrides:
        obtainOptimizer in class Configuration
        Returns:
        the optimizer used in this configuration, which is created if necessary
      • obtainOptimizer

        public Optimizer obtainOptimizer​(OptimizerOptions options)
        Factory method to get an Optimizer with specified optimizer options.

        This method is intended for internal use only.

        Overrides:
        obtainOptimizer in class Configuration
        Parameters:
        options - the optimizer options
        Returns:
        a new optimizer with the specified options set (provided the optimizations are available in this Saxon configuration)
      • isGenerateByteCode

        public boolean isGenerateByteCode​(HostLanguage hostLanguage)
        Ask whether bytecode should be generated. The default setting is true in Saxon Enterprise Edition and false in all other cases. Setting the option to true has no effect if Saxon-EE is not available (but if it is set to true, this method will return true). Setting the option to false in Saxon-EE is permitted if for some reason bytecode generation is to be suppressed (one possible reason is to improve compilation performance at the expense of evaluation performance).
        Overrides:
        isGenerateByteCode in class Configuration
        Parameters:
        hostLanguage - one of XSLT or XQUERY
        Returns:
        true if the option is switched on
      • isDeferredByteCode

        public boolean isDeferredByteCode​(HostLanguage hostLanguage)
        Ask whether bytecode should be generated in Just-In-time compilation and therefore deferring the byte code generation. The default setting is false. Setting the option to true has no effect if Saxon-EE is not available (but if it is set to true, this method will return true). Setting the option to false in Saxon-EE is permitted and therefore byte code generation will be generated in the compile phase.
        Overrides:
        isDeferredByteCode in class Configuration
        Parameters:
        hostLanguage - one of XSLT or XQUERY
        Returns:
        true if the option is switched on
      • isJITEnabled

        public boolean isJITEnabled()
        Description copied from class: Configuration
        Ask whether just-in-time compilation of XSLT template rules is in force
        Overrides:
        isJITEnabled in class Configuration
        Returns:
        true if just-in-time compilation is enabled (this is the default in Saxon-EE and not available in other configurations)
      • makeXQueryExpression

        public XQueryExpression makeXQueryExpression​(Expression exp,
                                                     QueryModule mainModule,
                                                     boolean streaming)
                                              throws XPathException
        Factory method to make an XQueryExpression
        Overrides:
        makeXQueryExpression in class Configuration
        Parameters:
        exp - the expression forming the body of the query
        mainModule - the query module containing the expression
        streaming - true if streamed execution is requested
        Returns:
        the XQueryExpression
        Throws:
        XPathException - if an error occurs
      • compileRegularExpression

        public RegularExpression compileRegularExpression​(UnicodeString regex,
                                                          java.lang.String flags,
                                                          java.lang.String hostLanguage,
                                                          java.util.List<java.lang.String> warnings)
                                                   throws XPathException
        Description copied from class: Configuration
        Compile a regular expression (or, in some configurations, get a compiled regular expression from a cache
        Overrides:
        compileRegularExpression in class Configuration
        Parameters:
        regex - the regular expression as a string
        flags - the value of the flags attribute
        hostLanguage - one of "XSD10", "XSD11", XP20" or "XP30". Also allow combinations, e.g. "XP20/XSD11".
        warnings - if non-null, any warnings from the regular expression compiler will be added to this list. If null, the warnings are ignored.
        Returns:
        the compiled regular expression
        Throws:
        XPathException - if the regular expression or the flags are invalid
      • makeSlotManager

        public SlotManager makeSlotManager()
        Description copied from class: Configuration
        Factory method to create a SlotManager.

        This method is provided for advanced users only, and is subject to change.

        Overrides:
        makeSlotManager in class Configuration
        Returns:
        a SlotManager (which is a skeletal stack frame representing the mapping of variable names to slots on the stack frame)
      • getResultDocumentThreadsLimit

        public int getResultDocumentThreadsLimit()
        Get the number of threads to be used for xsl:result-document instructions
        Returns:
        the concurrency of asynchronous xsl:result-document threads, defaulting to the number of (hardware) processors/CPUs available
      • processResultDocument

        public void processResultDocument​(ResultDocument instruction,
                                          Expression content,
                                          XPathContext context)
                                   throws XPathException
        Process an xsl:result-document instruction. The Saxon-HE version of this method simply executes the instruction. The Saxon-EE submits the instruction for execution asynchronously in an ExecutorService.
        Overrides:
        processResultDocument in class Configuration
        Parameters:
        instruction - the instruction to be executed
        content - the expression that defines the content of the new result document
        context - the evaluation context
        Throws:
        XPathException - if any dynamic error occurs
      • getMultithreadingFactory

        public MultithreadingFactory getMultithreadingFactory()
        Get the factory class used to handle creation of objects that support multithreaded execution.
        Returns:
        a MultithreadingFactory, which might be subclassed by advanced applications
      • setMultithreadingFactory

        public void setMultithreadingFactory​(MultithreadingFactory factory)
        Set a factory class to handle creation of objects that support multithreaded execution.
        Parameters:
        factory - a MultithreadingFactory, which can be subclassed by advanced applications
      • makeClosure

        public Sequence makeClosure​(Expression expression,
                                    int ref,
                                    XPathContext context)
                             throws XPathException
        Make a Closure, given the expected reference count
        Overrides:
        makeClosure in class Configuration
        Parameters:
        expression - the expression to be evaluated
        ref - the (nominal) number of times the value of the expression is required
        context - the XPath dynamic evaluation context
        Returns:
        the constructed Closure
        Throws:
        XPathException - if a failure occurs constructing the Closure
      • makeSequenceExtent

        public GroundedValue makeSequenceExtent​(Expression expression,
                                                int ref,
                                                XPathContext context)
                                         throws XPathException
        Make a SequenceExtent, given the expected reference count
        Overrides:
        makeSequenceExtent in class Configuration
        Parameters:
        expression - the expression to be evaluated
        ref - the (nominal) number of times the value of the expression is required
        context - the XPath dynamic evaluation context
        Returns:
        the constructed Closure
        Throws:
        XPathException - if evaluation of the expression fails
      • makeContextItemStaticInfo

        public ContextItemStaticInfo makeContextItemStaticInfo​(ItemType itemType,
                                                               boolean maybeUndefined)
        Factory method to make a ContextItemStaticInfo
        Overrides:
        makeContextItemStaticInfo in class Configuration
        Parameters:
        itemType - the item type of the context item. If the context item is absent, set this to ErrorType.getInstance().
        maybeUndefined - set to true if it is possible (or certain) that the context item will be absent.
        Returns:
        the ContextItemStaticInfo
      • makeMode

        public SimpleMode makeMode​(StructuredQName modeName,
                                   CompilerInfo compilerInfo)
        Make a new Mode - this can be overridden in subclasses to produce optimized variants
        Overrides:
        makeMode in class ProfessionalConfiguration
        Parameters:
        modeName - the name of the mode
        compilerInfo - information on the compiler, that can alter rule optimization
        Returns:
        an instantiated Mode
      • makeTemplateRule

        public TemplateRuleEE makeTemplateRule()
        Factory method to create a Template Rule
        Overrides:
        makeTemplateRule in class Configuration
        Returns:
        a new TemplateRule appropriate to this Configuration
      • makeCompilerInfo

        public CompilerInfo makeCompilerInfo()
        Make an XSLT CompilerInfo object - can be overridden in a subclass to produce variants capable of optimization
        Overrides:
        makeCompilerInfo in class Configuration
        Returns:
        a new CompilerInfo object
      • makeCompilerService

        public CompilerService makeCompilerService​(HostLanguage hostLanguage)
        Make a CompilerService object, to handle byte code generation, or null if byte code generation is not available
        Overrides:
        makeCompilerService in class Configuration
        Parameters:
        hostLanguage - for example Configuration.XSLT
        Returns:
        a CompilerService, or null
      • obtainByteCodeMonitor

        public ByteCodeMonitor obtainByteCodeMonitor()
        Obtain a ByteCodeMonitor for monitoring hotspot bytecode generation
        Returns:
        the existing ByteCodeMonitor if there is one, or a new one if not
      • createByteCodeReport

        public void createByteCodeReport​(java.lang.String fileName)
        Generate a report on byte code instrumentation to a specified file
        Overrides:
        createByteCodeReport in class Configuration
        Parameters:
        fileName - the specified file name