View Javadoc

1   package com.atlassian.sal.api;
2   
3   import java.io.File;
4   import java.util.Date;
5   import javax.annotation.Nonnull;
6   import javax.annotation.Nullable;
7   
8   /**
9    * Component for looking up application properties specific to their web interface
10   *
11   * @since 2.0
12   */
13  @SuppressWarnings ("UnusedDeclaration")
14  public interface ApplicationProperties
15  {
16      public static final String PLATFORM_JIRA = "jira";
17      public static final String PLATFORM_CONFLUENCE = "conf";
18      public static final String PLATFORM_BAMBOO = "bamboo";
19      public static final String PLATFORM_CROWD = "crowd";
20      public static final String PLATFORM_FECRU = "fisheye";
21      public static final String PLATFORM_STASH = "stash";
22  
23      /**
24       * Get the base URL of the current application.
25       *
26       * @return the current application's base URL
27       * @deprecated since 2.10. This implementation is application-specific, and unreliable for a cross product plugin.
28       *   Use {@link #getBaseUrl(UrlMode)} instead.
29       */
30      @Deprecated
31      String getBaseUrl();
32  
33      /**
34       * Get the base URL of the current application, with respect to the given {@link UrlMode}. This varies as follows:
35       * <ul>
36       *     <li>If {@link UrlMode#CANONICAL} return the configured base URL.</li>
37       *     <li>If {@link UrlMode#ABSOLUTE} return either the base URL of a request in the current scope, or the
38       *       configured base URL if there is no such request.</li>
39       *     <li>If {@link UrlMode#RELATIVE} return either the context path of a request in the current scope, or the
40       *       configured context path if there is no such request.</li>
41       *     <li>If {@link UrlMode#RELATIVE_CANONICAL} return the configured context path.</li>
42       *     <li>If {@link UrlMode#AUTO} return either a relative URL if there is a request in the current scope, or the
43       *       canonical URL if there is no such request.</li>
44       * </ul>
45       * @param urlMode the UrlMode to use.
46       * @return the current application's base URL.
47       */
48      @Nonnull
49      String getBaseUrl(UrlMode urlMode);
50  
51      /**
52       * Returns the display name for this application.
53       * @return the displayable name of the application
54       * @see #getPlatformId()
55       */
56      @Nonnull
57      String getDisplayName();
58  
59      /**
60       * Returns the exact ID of this application/platform, as defined in HAMS and used for licensing purposes.
61       * <p/>
62       * Return values include:
63       * <ul>
64       *     <li>{@link #PLATFORM_JIRA}</li>
65       *     <li>{@link #PLATFORM_CONFLUENCE}</li>
66       *     <li>{@link #PLATFORM_BAMBOO}</li>
67       *     <li>{@link #PLATFORM_CROWD}</li>
68       *     <li>{@link #PLATFORM_FECRU}</li>
69       *     <li>{@link #PLATFORM_STASH}</li>
70       * </ul>
71       * Fisheye / Crucible is a snowflake in that they have two separate licenses with two separate application IDs
72       * ("fisheye" and "crucible"). For the purposes of having a single ID for the platform, FeCru will return "fisheye"
73       * ({@link #PLATFORM_FECRU}) from this method.
74       *
75       * @return the ID of this application/platform
76       * @see #getDisplayName()
77       * @since 3.0
78       */
79      @Nonnull
80      String getPlatformId();
81  
82      /**
83       * @return the version of the application
84       */
85      @Nonnull
86      String getVersion();
87  
88      /**
89       * @return the build date of the application
90       */
91      @Nonnull
92      Date getBuildDate();
93  
94      /**
95       * @return the build number of the application, must be parsable by {@link Long#parseLong(String)}
96       */
97      @Nonnull
98      String getBuildNumber();
99  
100     /**
101      * @return the home directory of the application or null if none is defined
102      */
103     @Nullable
104     File getHomeDirectory();
105 
106     /**
107      * Get the value of an application property by its key.
108      * @param key The Key of the property to retrieve.
109      * @return The value of the property or Null if the property does not exist
110      * @deprecated As of SAL 2.7.
111      */
112     @Deprecated
113     String getPropertyValue(String key);
114 }