View Javadoc

1   package com.atlassian.sal.api;
2   
3   import java.io.File;
4   import java.util.Date;
5   
6   /**
7    * Component for looking up application properties specific to their web interface
8    *
9    * @since 2.0
10   */
11  public interface ApplicationProperties
12  {
13      /**
14       * Get the base URL of the current application.
15       *
16       * @return the current application's base URL
17       * @deprecated since 2.10. This implementation is application-specific, and unreliable for a cross product plugin.
18       *   Use {@link #getBaseUrl(UrlMode)} instead.
19       */
20      @Deprecated
21      String getBaseUrl();
22  
23      /**
24       * Get the base URL of the current application, with respect to the given {@link UrlMode}. This varies as follows:
25       * <ul>
26       *     <li>If {@link UrlMode#CANONICAL} return the configured base URL.</li>
27       *     <li>If {@link UrlMode#ABSOLUTE} return either the base URL of a request in the current scope, or the
28       *       configured base URL if there is no such request.</li>
29       *     <li>If {@link UrlMode#RELATIVE} return either the context path of a request in the current scope, or the
30       *       configured context path if there is no such request.</li>
31       *     <li>If {@link UrlMode#RELATIVE_CANONICAL} return the configured context path.</li>
32       *     <li>If {@link UrlMode#AUTO} return either a relative URL if there is a request in the current scope, or the
33       *       canonical URL if there is no such request.</li>
34       * </ul>
35       * @param urlMode the UrlMode to use.
36       * @return the current application's base URL.
37       */
38      String getBaseUrl(UrlMode urlMode);
39  
40      /**
41       * @return the displayable name of the application
42       */
43      String getDisplayName();
44  
45      /**
46       * @return the version of the application
47       */
48      String getVersion();
49  
50      /**
51       * @return the build date of the application
52       */
53      Date getBuildDate();
54  
55      /**
56       * @return the build number of the application, must be parsable by {@link Long#parseLong(String)}
57       */
58      String getBuildNumber();
59  
60  
61      /**
62       * @return the home directory of the application or null if none is defined
63       */
64      File getHomeDirectory();
65  
66      /**
67       * Get the value of an application property by its key.
68       * @param key The Key of the property to retrieve.
69       * @return The value of the property or Null if the property does not exist
70       * @deprecated As of SAL 2.7.
71       */
72      @Deprecated
73      String getPropertyValue(String key);
74  }