Class CmsXmlConfigUpdater

java.lang.Object
org.opencms.setup.xml.CmsXmlConfigUpdater

public class CmsXmlConfigUpdater extends 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.
  • Field Details

  • Constructor Details

    • CmsXmlConfigUpdater

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

    • getSystemConfigPosition

      public static int getSystemConfigPosition(String name) throws Exception
      Helper method for determining the position for a top-level configuration element in opencms-system.xml.

      This can be used by XSL transformations to insert optional nodes for new features on the top level.

      Parameters:
      name - the element name
      Returns:
      the position for the element name, or -1 if the position could not be determined
      Throws:
      Exception - if something goes wrong
    • isDone

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

      Returns:
      boolean
    • transform

      public void transform(String name, String transform) throws 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:
      Exception - if something goes wrong
    • transformConfig

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

      Gets validation errors either as a JSON string, or null if there are no validation errors.
      Returns:
      the validation error JSON