Class XmlTransformService

    • Constructor Detail

      • XmlTransformService

        public XmlTransformService()

        Creates a new instance. Defaults to caching transforms and not allowing over-rides. Default metadata key is transformurl.

    • Method Detail

      • cacheAndGetTransformer

        protected javax.xml.transform.Transformer cacheAndGetTransformer​(java.lang.String urlToUse,
                                                                         XmlTransformerFactory xmlTransformerFactory)
                                                                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getUrl

        public java.lang.String getUrl()

        Returns the URL of the XSLT to use.

        Returns:
        the URL of the XSLT to use
      • setUrl

        public void setUrl​(java.lang.String s)

        Sets the URL of the XSLT to use. May not be empty.

        Parameters:
        s - the URL of the XSLT to use
      • getMetadataKey

        public java.lang.String getMetadataKey()

        Returns the metadata key against which an over-ride XSLT URL may be stored.

        Returns:
        the metadata key against which an over-ride XSLT URL may be stored
      • setMetadataKey

        public void setMetadataKey​(java.lang.String s)

        Sets the metadata key against which an over-ride XSLT URL may be stored. May not be empty.

        Parameters:
        s - the metadata key against which an over-ride XSLT URL may be stored, defaults to "transformurl"
      • getCacheTransforms

        public java.lang.Boolean getCacheTransforms()

        Returns true if XSLTs should be cached.

        Returns:
        true if XSLTs should be cached, otherwise false
        See Also:
        setCacheTransforms(Boolean)
      • setCacheTransforms

        public void setCacheTransforms​(java.lang.Boolean b)

        Sets whether XSLTs should be cached or not. If this is false the XSLT will be read for each message processed. Therefore while any changes to the XSLT will be picked up immediately, processing will take significantly longer, particularly if the XSLT is on a remote machine.

        Parameters:
        b - whether XSLTs should be cached or not, defaults to true.
      • getAllowOverride

        public java.lang.Boolean getAllowOverride()

        Returns true if a configured XSLT URL may be over-ridden by one stored against a metadata key.

        Returns:
        true if a configured XSLT URL may be over-ridden by one stored against a metadata key, otherwise false
      • setAllowOverride

        public void setAllowOverride​(java.lang.Boolean b)

        Sets whether the configured XSLT URL may be over-ridden by one stored against a metaddata key. If URL is configured this is implicitly true.

        Parameters:
        b - whether the configured XSLT URL may be over-ridden by one stored against a metaddata key, defaults to null (false)
      • getOutputMessageEncoding

        public java.lang.String getOutputMessageEncoding()
      • setOutputMessageEncoding

        public void setOutputMessageEncoding​(java.lang.String s)
        Force the output message encoding to be a particular encoding.

        If specified then the underlying AdaptrisMessage.setCharEncoding(String) is changed to match the encoding specified here before attempting any write operations.

        This is only useful if the underlying message is encoded in one way, and you wish to force the encoding directly in your stylesheet; e.g. the message is physically encoded using ISO-8859-1; but your xslt has <xsl:output method="xml" encoding="UTF-8" indent="yes"/> and you need to ensure that the message is physically encoded using UTF-8 after the transform.

        Parameters:
        s - the output encoding; if null, the the existing encoding specified by AdaptrisMessage.getCharEncoding() is used.
      • setXmlTransformerFactory

        public void setXmlTransformerFactory​(XmlTransformerFactory xmlTransformerFactory)