Class BaseXsltService

java.lang.Object
net.solarnetwork.domain.BasicIdentity<String>
net.solarnetwork.service.support.BaseLocalizedServiceInfoProvider<String>
net.solarnetwork.settings.support.BaseSettingsSpecifierLocalizedServiceInfoProvider<String>
net.solarnetwork.central.support.xslt.BaseXsltService
All Implemented Interfaces:
Comparable<String>, net.solarnetwork.domain.Identity<String>, net.solarnetwork.service.LocalizedServiceInfoProvider, net.solarnetwork.settings.SettingSpecifierProvider, EntityResolver

public abstract class BaseXsltService extends net.solarnetwork.settings.support.BaseSettingsSpecifierLocalizedServiceInfoProvider<String> implements EntityResolver
Base service class for XSLT support.
  • Field Details

    • SETTING_XSLT

      public static final String SETTING_XSLT
      The setting key for the XSLT stylesheet.
      See Also:
    • SETTING_XSLT_CACHE_DURATION

      public static final String SETTING_XSLT_CACHE_DURATION
      The setting key for the XSLT stylesheet cache seconds.
      See Also:
    • XSLT_PARAM_JSON

      public static final String XSLT_PARAM_JSON
      The XSLT input parameter for input JSON.
      See Also:
    • transformerFactory

      protected final TransformerFactory transformerFactory
      The transformer factory.
    • documentBuilderFactory

      protected final DocumentBuilderFactory documentBuilderFactory
      The document builder factory.
    • objectMapper

      protected final com.fasterxml.jackson.databind.ObjectMapper objectMapper
      A JSON mapper.
    • templatesCacheTtl

      protected final Duration templatesCacheTtl
      A templates cache duration.
    • templatesCache

      protected final SharedValueCache<String,Templates,String> templatesCache
      A cache for templates.
    • DOCTYPE_PAT

      public static final Pattern DOCTYPE_PAT
      A regular expression matching an XML DOCTYPE declaration.
  • Constructor Details

    • BaseXsltService

      public BaseXsltService(String serviceId, DocumentBuilderFactory documentBuilderFactory, TransformerFactory transformerFactory, com.fasterxml.jackson.databind.ObjectMapper objectMapper, Duration templatesCacheTtl)
      Constructor.
      Parameters:
      serviceId - the service ID to use
      documentBuilderFactory - the XML document builder factory
      transformerFactory - the XSLT transformer factory to use
      objectMapper - the object mapper
      templatesCacheTtl - the TTL for the templates cache, or null or 0 for no caching
      Throws:
      IllegalArgumentException - if any argument is null
    • BaseXsltService

      public BaseXsltService(String serviceId, DocumentBuilderFactory documentBuilderFactory, TransformerFactory transformerFactory, com.fasterxml.jackson.databind.ObjectMapper objectMapper, Duration templatesCacheTtl, SharedValueCache<String,Templates,String> templatesCache)
      Constructor.

      If a templatesCache is provided then XSLT templates will be cached for up to the configured templatesCacheTtl seconds. The templates cache key can be provided by a

      invalid reference
      #PARAM_XSLT_CACHE_KEY
      parameter value, or will be derived from the XSLT value itself.

      Parameters:
      serviceId - the service ID to use
      documentBuilderFactory - the XML document builder factory
      transformerFactory - the XSLT transformer factory to use
      objectMapper - the object mapper
      templatesCacheTtl - the TTL for the templates cache, or null or 0 for no caching
      templatesCache - the templates cache to use
      Throws:
      IllegalArgumentException - if any argument except templatesCache is null
  • Method Details