Class TransformerPool
java.lang.Object
org.frankframework.util.TransformerPool
Pool of transformers. As of IBIS 4.2.e the Templates object is used to
improve performance and work around threading problems with the api.
- Author:
- Gerrit van Brakel
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closing the Pool doesn't automatically mean all references remaining in the pool will be terminated.static @NonNull TransformerPoolconfigureStyleSheetTransformer(@Nullable FrankElement scopeProvider, @Nullable String styleSheetName, int xsltVersion) static @Nullable TransformerPoolconfigureTransformer(@Nullable FrankElement scopeProvider, @Nullable String namespaceDefs, @Nullable String xPathExpression, @Nullable String styleSheetName, @NonNull TransformerPool.OutputType outputType, boolean includeXmlDeclaration, @Nullable ParameterList params, boolean mandatory) static @NonNull TransformerPoolconfigureTransformer(@Nullable FrankElement scopeProvider, @Nullable String namespaceDefs, @Nullable String xPathExpression, @Nullable String styleSheetName, @Nullable TransformerPool.OutputType outputType, boolean includeXmlDeclaration, @Nullable ParameterList params) static @NonNull TransformerPoolconfigureTransformer0(@Nullable FrankElement scopeProvider, @Nullable String namespaceDefs, @Nullable String xPathExpression, @Nullable String styleSheetName, @NonNull TransformerPool.OutputType outputType, boolean includeXmlDeclaration, @Nullable ParameterList params, int xsltVersion) protected Transformer@Nullable Boolean@Nullable Booleanstatic TransformerPoolgetInstance(@NonNull String xsltString, int xsltVersion, @Nullable IScopeProvider scopeProvider) Get an instance of a TransformerPool that can load additional resources such as referenced URIs from the providedIScopeProvider.static TransformerPoolgetInstance(@NonNull Resource resource) Get a TransformerPool instance that loads its XSLT stylesheet from the given resource.static TransformerPoolgetInstance(@NonNull Resource resource, int xsltVersion) Get a TransformerPool instance that loads its XSLT stylesheet from the given resource.@Nullable Boolean@Nullable Stringprotected @NonNull TransformergetTransformerFilter(@NonNull ThreadConnector<?> threadConnector, @NonNull ContentHandler handler) getTransformerFilter(@NonNull ContentHandler handler) getTransformerFilter(@NonNull ContentHandler handler, boolean removeNamespacesFromInput, boolean handleLexicalEvents) static TransformerPoolgetUtilityInstance(@NonNull String xsltString, int xsltVersion) Special utility method to create a new TransformerPool without a ClassLoader.static @NonNull TransformerPoolgetXPathTransformerPool(@NonNull String xpathExpression, int xsltVersion) static @NonNull TransformerPoolgetXPathTransformerPool(@Nullable String namespaceDefs, @NonNull String xpathExpression, @NonNull TransformerPool.OutputType outputMethod) static @NonNull TransformerPoolgetXPathTransformerPool(@Nullable String namespaceDefs, @NonNull String xPathExpression, @NonNull TransformerPool.OutputType outputType, boolean includeXmlDeclaration, @Nullable ParameterList params) static @NonNull TransformerPoolgetXPathTransformerPool(@Nullable String namespaceDefs, @NonNull String xPathExpression, @NonNull TransformerPool.OutputType outputType, boolean includeXmlDeclaration, @Nullable ParameterList params, int xsltVersion) protected voidprotected voidinvalidateTransformerNoThrow(Transformer transformer) voidopen()protected voidvoid@NonNull Message@NonNull MessageTransforms Frank messages.@NonNull Messagetransform(@NonNull Message message, @Nullable ParameterValueList pvl) transformToString(String s, Map<String, Object> parameters) transformToString(String s, Map<String, Object> parameters, boolean namespaceAware) transformToString(Source s, Map<String, Object> parameters) transformToString(@NonNull Message input) transformToString(Message m, Map<String, Object> parameters, boolean namespaceAware)
-
Method Details
-
getInstance
public static TransformerPool getInstance(@NonNull String xsltString, int xsltVersion, @Nullable IScopeProvider scopeProvider) throws TransformerConfigurationException Get an instance of a TransformerPool that can load additional resources such as referenced URIs from the providedIScopeProvider. WARNING: This should only be used to be able to load Configuration-specific resources in dynamically loaded configurations. This should not be used for application-wide transformer pools.- Parameters:
xsltString- The XSLT to be evaluated, as stringxsltVersion- Version of XSLT. Can be 0, 1, or 2. If 0, the actual version will be extracted from the stylesheet at a performance-penalty.scopeProvider- TheIScopeProviderfor loading additional resources- Returns:
- A TransformerPool instance for the input stylesheet.
- Throws:
TransformerConfigurationException
-
getUtilityInstance
public static TransformerPool getUtilityInstance(@NonNull String xsltString, int xsltVersion) throws TransformerConfigurationException Special utility method to create a new TransformerPool without a ClassLoader. Utility pools should never use configuration classloaders, instead always read from the classpath! Utility pools should always be cached statically for re-use. The caller-code is responsible for this. -
getInstance
public static TransformerPool getInstance(@NonNull Resource resource) throws TransformerConfigurationException, IOException Get a TransformerPool instance that loads its XSLT stylesheet from the given resource. The XSLT version will be dynamically derived from the stylesheet, at a performance penalty.- Parameters:
resource-Resourcefrom which to load the stylesheet- Returns:
- TransformerPool instance for the XSLT stylesheet.
- Throws:
TransformerConfigurationException- Thrown if there was an exception creating the TransformerPool or parsing the XSLT stylesheetIOException- Thrown if the resource cannot be loaded
-
getInstance
public static TransformerPool getInstance(@NonNull Resource resource, int xsltVersion) throws TransformerConfigurationException, IOException Get a TransformerPool instance that loads its XSLT stylesheet from the given resource. The XSLT version in the stylesheet should match thexlstVersionparameter, or be0for dynamic derivation at a performance penalty.- Parameters:
resource- TheResourcefrom which to load the XSLT stylesheetxsltVersion- The XSLT version of the stylesheet. Can be 0, 1, or 2. If 0, the actual version will be dynamically derived from the stylesheet itself on creation at a cost in performance.- Returns:
- TransformerPool instance for the XSLT stylesheet.
- Throws:
TransformerConfigurationException- Thrown if there was an exception creating the TransformerPool or parsing the XSLT stylesheetIOException- Thrown if the resource cannot be loaded
-
configureTransformer
public static @Nullable TransformerPool configureTransformer(@Nullable FrankElement scopeProvider, @Nullable String namespaceDefs, @Nullable String xPathExpression, @Nullable String styleSheetName, @NonNull TransformerPool.OutputType outputType, boolean includeXmlDeclaration, @Nullable ParameterList params, boolean mandatory) throws ConfigurationException - Throws:
ConfigurationException
-
configureTransformer
public static @NonNull TransformerPool configureTransformer(@Nullable FrankElement scopeProvider, @Nullable String namespaceDefs, @Nullable String xPathExpression, @Nullable String styleSheetName, @Nullable TransformerPool.OutputType outputType, boolean includeXmlDeclaration, @Nullable ParameterList params) throws ConfigurationException - Throws:
ConfigurationException
-
configureTransformer0
public static @NonNull TransformerPool configureTransformer0(@Nullable FrankElement scopeProvider, @Nullable String namespaceDefs, @Nullable String xPathExpression, @Nullable String styleSheetName, @NonNull TransformerPool.OutputType outputType, boolean includeXmlDeclaration, @Nullable ParameterList params, int xsltVersion) throws ConfigurationException - Throws:
ConfigurationException
-
configureStyleSheetTransformer
public static @NonNull TransformerPool configureStyleSheetTransformer(@Nullable FrankElement scopeProvider, @Nullable String styleSheetName, int xsltVersion) throws ConfigurationException - Throws:
ConfigurationException
-
getXPathTransformerPool
public static @NonNull TransformerPool getXPathTransformerPool(@NonNull String xpathExpression, int xsltVersion) throws TransformerConfigurationException -
getXPathTransformerPool
public static @NonNull TransformerPool getXPathTransformerPool(@Nullable String namespaceDefs, @NonNull String xpathExpression, @NonNull TransformerPool.OutputType outputMethod) throws TransformerConfigurationException -
getXPathTransformerPool
public static @NonNull TransformerPool getXPathTransformerPool(@Nullable String namespaceDefs, @NonNull String xPathExpression, @NonNull TransformerPool.OutputType outputType, boolean includeXmlDeclaration, @Nullable ParameterList params) throws TransformerConfigurationException -
getXPathTransformerPool
public static @NonNull TransformerPool getXPathTransformerPool(@Nullable String namespaceDefs, @NonNull String xPathExpression, @NonNull TransformerPool.OutputType outputType, boolean includeXmlDeclaration, @Nullable ParameterList params, int xsltVersion) throws TransformerConfigurationException -
open
public void open() -
close
public void close()Closing the Pool doesn't automatically mean all references remaining in the pool will be terminated. After closing, manually releases any associated resources in the pool -
getTransformer
-
releaseTransformer
-
invalidateTransformer
- Throws:
Exception
-
invalidateTransformerNoThrow
-
createTransformer
-
transformToString
public String transformToString(Message m, Map<String, Object> parameters, boolean namespaceAware) throws TransformerException, IOException, SAXException -
transformToString
-
transformToString
public String transformToString(String s, Map<String, Object> parameters) throws TransformerException, IOException, SAXException -
transformToString
public String transformToString(String s, Map<String, Object> parameters, boolean namespaceAware) throws TransformerException, IOException, SAXException -
transformToString
- Throws:
TransformerExceptionIOException
-
transformToString
public String transformToString(Source s, Map<String, Object> parameters) throws TransformerException, IOException- Throws:
TransformerExceptionIOException
-
transformToString
public String transformToString(@NonNull Message input) throws TransformerException, IOException, SAXException -
transform
public @NonNull Message transform(@NonNull Message message) throws IOException, TransformerException, SAXException -
transform
public @NonNull Message transform(@NonNull Message message, @Nullable ParameterValueList pvl) throws IOException, TransformerException, SAXException -
transform
public @NonNull Message transform(@NonNull Message m, @Nullable Map<String, Object> parameterMap) throws IOException, TransformerException, SAXExceptionTransforms Frank messages. -
transform
public void transform(@NonNull Source s, @NonNull Result r, Map<String, Object> parameters) throws TransformerException, IOException- Throws:
TransformerExceptionIOException
-
getTransformerFilter
public TransformerFilter getTransformerFilter(@NonNull ContentHandler handler) throws TransformerConfigurationException -
getTransformerFilter
public TransformerFilter getTransformerFilter(@NonNull ContentHandler handler, boolean removeNamespacesFromInput, boolean handleLexicalEvents) throws TransformerConfigurationException -
getTransformerFilter
public TransformerFilter getTransformerFilter(@NonNull ThreadConnector<?> threadConnector, @NonNull ContentHandler handler) throws TransformerConfigurationException -
getConfigMap
- Throws:
TransformerExceptionIOException
-
getOmitXmlDeclaration
- Throws:
TransformerExceptionIOException
-
getIndent
- Throws:
TransformerExceptionIOException
-
getOutputMethod
- Throws:
TransformerExceptionIOException
-
getDisableOutputEscaping
- Throws:
TransformerExceptionIOException
-