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