com.atlassian.bamboo.plugin.webresource
Class BambooWebResourceIntegration

java.lang.Object
  extended by com.atlassian.bamboo.plugin.webresource.BambooWebResourceIntegration
All Implemented Interfaces:
com.atlassian.plugin.webresource.WebResourceIntegration

public class BambooWebResourceIntegration
extends Object
implements com.atlassian.plugin.webresource.WebResourceIntegration

The integration layer between Plugin's Web Resource Handler, and specific applications (eg JIRA, Confluence).


Constructor Summary
BambooWebResourceIntegration(com.atlassian.config.HomeLocator homeLocator, I18nBeanFactory i18nBeanFactory, com.atlassian.plugin.PluginAccessor pluginAccessor, FeatureManager featureManager)
           
 
Method Summary
 AdministrationConfiguration getAdministrationConfiguration()
           
 String getBaseUrl()
          Returns the base URL for this application.
 String getBaseUrl(com.atlassian.plugin.webresource.UrlMode urlMode)
          Returns the base URL for this application in either relative or absolute format, depending on the value of urlMode.
 com.atlassian.plugin.webresource.cdn.CDNStrategy getCDNStrategy()
           
 String getI18nRawText(Locale locale, String s)
           
 String getI18nText(Locale locale, String s)
           
 Locale getLocale()
           
 com.atlassian.plugin.PluginAccessor getPluginAccessor()
          Applications must implement this method to get access to the application's PluginAccessor
 Map<String,Object> getRequestCache()
          This must be a thread-local cache that will be accessible from both the page, and the decorator
 String getStaticResourceLocale()
           
 String getSuperBatchVersion()
           
 String getSystemBuildNumber()
          Represents the last time the system was updated.
 String getSystemCounter()
          Represents the unique number for this system, which when updated will flush the cache.
 File getTemporaryDirectory()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BambooWebResourceIntegration

public BambooWebResourceIntegration(com.atlassian.config.HomeLocator homeLocator,
                                    I18nBeanFactory i18nBeanFactory,
                                    com.atlassian.plugin.PluginAccessor pluginAccessor,
                                    FeatureManager featureManager)
Method Detail

getPluginAccessor

public com.atlassian.plugin.PluginAccessor getPluginAccessor()
Applications must implement this method to get access to the application's PluginAccessor

Specified by:
getPluginAccessor in interface com.atlassian.plugin.webresource.WebResourceIntegration

getRequestCache

public Map<String,Object> getRequestCache()
This must be a thread-local cache that will be accessible from both the page, and the decorator

Specified by:
getRequestCache in interface com.atlassian.plugin.webresource.WebResourceIntegration

getSystemCounter

public String getSystemCounter()
Represents the unique number for this system, which when updated will flush the cache. This should be a number and is generally stored in the global application-properties.

Specified by:
getSystemCounter in interface com.atlassian.plugin.webresource.WebResourceIntegration
Returns:
A string representing the count

getSystemBuildNumber

public String getSystemBuildNumber()
Represents the last time the system was updated. This is generally obtained from BuildUtils or similar.

Specified by:
getSystemBuildNumber in interface com.atlassian.plugin.webresource.WebResourceIntegration

getBaseUrl

public String getBaseUrl()
Returns the base URL for this application. This method may return either an absolute or a relative URL. Implementations are free to determine which mode to use based on any criteria of their choosing. For example, an implementation may choose to return a relative URL if it detects that it is running in the context of an HTTP request, and an absolute URL if it detects that it is not. Or it may choose to always return an absolute URL, or always return a relative URL. Callers should only use this method when they are sure that either an absolute or a relative URL will be appropriate, and should not rely on any particular observed behavior regarding how this value is interpreted, which may vary across different implementations.

In general, the behavior of this method should be equivalent to calling getBaseUrl(com.atlassian.plugin.webresource.UrlMode) with a urlMode value of UrlMode.AUTO.

Specified by:
getBaseUrl in interface com.atlassian.plugin.webresource.WebResourceIntegration
Returns:
the string value of the base URL of this application

getBaseUrl

public String getBaseUrl(com.atlassian.plugin.webresource.UrlMode urlMode)
Returns the base URL for this application in either relative or absolute format, depending on the value of urlMode.

If urlMode == {@link UrlMode#ABSOLUTE}, this method returns an absolute URL, with URL scheme, hostname, port (if non-standard for the scheme), and context path.

If urlMode == {@link UrlMode#RELATIVE}, this method returns a relative URL containing just the context path.

If urlMode == {@link UrlMode#AUTO}, this method may return either an absolute or a relative URL. Implementations are free to determine which mode to use based on any criteria of their choosing. For example, an implementation may choose to return a relative URL if it detects that it is running in the context of an HTTP request, and an absolute URL if it detects that it is not. Or it may choose to always return an absolute URL, or always return a relative URL. Callers should only use WebResourceManager.UrlMode#AUTO when they are sure that either an absolute or a relative URL will be appropriate, and should not rely on any particular observed behavior regarding how this value is interpreted, which may vary across different implementations.

Specified by:
getBaseUrl in interface com.atlassian.plugin.webresource.WebResourceIntegration
Parameters:
urlMode - specifies whether to use absolute URLs, relative URLs, or allow the concrete implementation to decide
Returns:
the string value of the base URL of this application
Since:
2.3.0

getSuperBatchVersion

public String getSuperBatchVersion()
Specified by:
getSuperBatchVersion in interface com.atlassian.plugin.webresource.WebResourceIntegration

getTemporaryDirectory

public File getTemporaryDirectory()
Specified by:
getTemporaryDirectory in interface com.atlassian.plugin.webresource.WebResourceIntegration

getAdministrationConfiguration

public AdministrationConfiguration getAdministrationConfiguration()

getStaticResourceLocale

public String getStaticResourceLocale()
Specified by:
getStaticResourceLocale in interface com.atlassian.plugin.webresource.WebResourceIntegration

getCDNStrategy

public com.atlassian.plugin.webresource.cdn.CDNStrategy getCDNStrategy()
Specified by:
getCDNStrategy in interface com.atlassian.plugin.webresource.WebResourceIntegration

getLocale

public Locale getLocale()
Specified by:
getLocale in interface com.atlassian.plugin.webresource.WebResourceIntegration

getI18nRawText

@NotNull
public String getI18nRawText(Locale locale,
                                     String s)
Specified by:
getI18nRawText in interface com.atlassian.plugin.webresource.WebResourceIntegration

getI18nText

public String getI18nText(Locale locale,
                          String s)
Specified by:
getI18nText in interface com.atlassian.plugin.webresource.WebResourceIntegration


Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.