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