Class AbstractXmlUpgrader

java.lang.Object
com.atlassian.bamboo.upgrade.AbstractXmlUpgrader
Direct Known Subclasses:
BuildDefinitionUpgrader, ConfigurationUpgrader

public abstract class AbstractXmlUpgrader extends Object
An abstract Bamboo upgrader that will manipulate on raw XML.
  • Constructor Details

    • AbstractXmlUpgrader

      public AbstractXmlUpgrader()
  • Method Details

    • getDocument

      protected abstract org.dom4j.Document getDocument()
    • save

      public abstract void save() throws IOException
      Throws:
      IOException
    • setOrAdd

      public void setOrAdd(@NotNull @NotNull String elementName, @NotNull @NotNull String value)
    • setOrAdd

      public void setOrAdd(@NotNull @NotNull org.dom4j.Element parent, @NotNull @NotNull String elementName, @NotNull @NotNull String value)
    • setOrAdd

      public void setOrAdd(@NotNull @NotNull org.dom4j.Element element)
    • setOrAdd

      public void setOrAdd(@NotNull @NotNull org.dom4j.Element parent, @NotNull @NotNull org.dom4j.Element element)
    • update

      public void update(org.dom4j.Element element)
    • remove

      public void remove(org.dom4j.Element element)
    • getRootElement

      public org.dom4j.Element getRootElement()
    • getElement

      @Nullable public @Nullable org.dom4j.Element getElement(@NotNull @NotNull String xpathExpression)
    • getElement

      @Nullable public @Nullable org.dom4j.Element getElement(@NotNull @NotNull org.dom4j.Element parent, @NotNull @NotNull String xpathExpression)
    • asMap

      public static Map<String,String> asMap(@NotNull @NotNull org.dom4j.Element element)
    • asElement

      public static org.dom4j.Element asElement(Map<String,String> artifactHandlerConfiguration, String name)
    • saveNode

      public static void saveNode(org.dom4j.Node node, File file) throws IOException
      Save node contents to a file.
      Parameters:
      node - element to be persisted
      file - destination file
      Throws:
      IOException
    • appendComment

      public static void appendComment(String comment, File file) throws IOException
      Appends commend to file
      Parameters:
      comment - comment text, without comment marks
      file - destination file
      Throws:
      IOException
    • getElementText

      @Nullable public @Nullable String getElementText(@NotNull @NotNull org.dom4j.Element parent, @NotNull @NotNull String elementName)
    • closeQuietly

      protected static void closeQuietly(org.dom4j.io.XMLWriter writer)
    • logChanges

      protected static void logChanges(String xmlSourceIdentifier, String originalContent, String newContent)