Class CmsXmlConfigUpdater


  • public class CmsXmlConfigUpdater
    extends java.lang.Object
    Class for updating the XML configuration files using a set of XSLT transforms. The XSLT transforms are stored in the directory update/xmlupdate, together with a file transforms.xml that contains the list of transformation files and the configuration files to which they should be applied to.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  CmsXmlConfigUpdater.EntityIgnoringUriResolver
      Need this so that 'dummy' entity resolver is also used for documents read with the document() function.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DEFAULT_XML
      Default XML for new config files.
    • Constructor Summary

      Constructors 
      Constructor Description
      CmsXmlConfigUpdater​(java.io.File xsltDir, java.io.File configDir)
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isDone()
      Checks if updater has tried to transform.
      void transform​(java.lang.String name, java.lang.String transform)
      Transforms a config file with an XSLT transform.
      void transformConfig()
      Transforms the configuration.
      java.lang.String validationErrors()
      Gets validation errors either as a JSON string, or null if there are no validation errors.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CmsXmlConfigUpdater

        public CmsXmlConfigUpdater​(java.io.File xsltDir,
                                   java.io.File configDir)
        Creates a new instance.
        Parameters:
        xsltDir - the directory containing the XSLT files
        configDir - the configuration directory
    • Method Detail

      • isDone

        public boolean isDone()
        Checks if updater has tried to transform.

        Returns:
        boolean
      • transform

        public void transform​(java.lang.String name,
                              java.lang.String transform)
                       throws java.lang.Exception
        Transforms a config file with an XSLT transform.
        Parameters:
        name - file name of the config file
        transform - file name of the XSLT file
        Throws:
        java.lang.Exception - if something goes wrong
      • transformConfig

        public void transformConfig()
                             throws java.lang.Exception
        Transforms the configuration.
        Throws:
        java.lang.Exception - if something goes wrong
      • validationErrors

        public java.lang.String validationErrors()
        Gets validation errors either as a JSON string, or null if there are no validation errors.
        Returns:
        the validation error JSON