Class BambooTextProvider

java.lang.Object
com.opensymphony.xwork2.DefaultTextProvider
com.atlassian.bamboo.struts.BambooDefaultTextProvider
com.atlassian.bamboo.utils.i18n.BambooTextProvider
All Implemented Interfaces:
com.atlassian.struts.TextProvider, com.opensymphony.xwork2.TextProvider, com.opensymphony.xwork2.Unchainable, Serializable, org.apache.struts2.Unchainable

public class BambooTextProvider extends BambooDefaultTextProvider implements com.atlassian.struts.TextProvider
This class aims to allow a different classloader to be defined and propagated to all TextProvider instances (there are the one managed by Spring and In Bamboo, a different classloader is used to load Plugins and their resources. This classloader is set in BambooPluginManager after all plugins are loaded. Then, it is propagated to existing TextProvider instances. This class is a wrapper around the DefaultTextProvider class from xwork, and overrides all methods that retrieve i18n resources to use the classloader set in BambooPluginManager.
See Also:
  • Method Details

    • getInstance

      public static BambooTextProvider getInstance()
    • setWebAppClassLoader

      public static void setWebAppClassLoader(ClassLoader classLoader)
      Allows to set the classloader that will be used to retrieve i18n resources. Multiple threads with their own instance of this class will use the given classloader immediately, as it is stored in a static (volatile) field.
      Parameters:
      classLoader - the class loader to use
    • getMainAppClassloader

      public static ClassLoader getMainAppClassloader()
    • getText

      public String getText(String key)
      Specified by:
      getText in interface com.opensymphony.xwork2.TextProvider
      Overrides:
      getText in class BambooDefaultTextProvider
    • getText

      public String getText(String key, String defaultValue)
      Specified by:
      getText in interface com.opensymphony.xwork2.TextProvider
      Overrides:
      getText in class com.opensymphony.xwork2.DefaultTextProvider
    • getText

      public String getText(String key, List args)
      Specified by:
      getText in interface com.opensymphony.xwork2.TextProvider
      Overrides:
      getText in class BambooDefaultTextProvider
    • getText

      public String getText(String key, String[] args)
      Specified by:
      getText in interface com.opensymphony.xwork2.TextProvider
      Overrides:
      getText in class BambooDefaultTextProvider
    • getText

      public String getText(String key, String defaultValue, List args)
      Specified by:
      getText in interface com.opensymphony.xwork2.TextProvider
      Overrides:
      getText in class BambooDefaultTextProvider
    • getText

      public String getText(String key, String defaultValue, String[] args)
      Specified by:
      getText in interface com.opensymphony.xwork2.TextProvider
      Overrides:
      getText in class BambooDefaultTextProvider
    • getText

      public String getText(String key, String defaultValue, String obj)
      Specified by:
      getText in interface com.opensymphony.xwork2.TextProvider
      Overrides:
      getText in class com.opensymphony.xwork2.DefaultTextProvider
    • getText

      public String getText(String key, String defaultValue, List<?> args, com.opensymphony.xwork2.util.ValueStack stack)
      Specified by:
      getText in interface com.opensymphony.xwork2.TextProvider
      Overrides:
      getText in class com.opensymphony.xwork2.DefaultTextProvider
    • getText

      public String getText(String key, String defaultValue, String[] args, com.opensymphony.xwork2.util.ValueStack stack)
      Specified by:
      getText in interface com.opensymphony.xwork2.TextProvider
      Overrides:
      getText in class com.opensymphony.xwork2.DefaultTextProvider
    • getTexts

      public ResourceBundle getTexts(String bundleName)
      Specified by:
      getTexts in interface com.opensymphony.xwork2.TextProvider
      Overrides:
      getTexts in class BambooDefaultTextProvider
    • getTexts

      public ResourceBundle getTexts()
      Specified by:
      getTexts in interface com.opensymphony.xwork2.TextProvider
      Overrides:
      getTexts in class com.opensymphony.xwork2.DefaultTextProvider
    • hasKey

      public boolean hasKey(String key)
      Specified by:
      hasKey in interface com.opensymphony.xwork2.TextProvider
      Overrides:
      hasKey in class com.opensymphony.xwork2.DefaultTextProvider