1 package com.atlassian.plugin.webresource;
2
3 import com.atlassian.plugin.servlet.DownloadableResource;
4
5 import java.util.List;
6 import java.util.Map;
7
8 /**
9 * Assists in locating plugin resources in different ways.
10 * @since 2.2
11 */
12 public interface PluginResourceLocator
13 {
14 String[] BATCH_PARAMS = new String[] { "ieonly", "media", "content-type", "cache", "conditionalComment" };
15
16 /**
17 * Returns true if this locator can parse the given url.
18 */
19 boolean matches(String url);
20
21 /**
22 * Returns a {@link DownloadableResource} represented by the given url and query params.
23 * {@link #matches(String)} should be called before invoking this method. If the url is
24 * not understood by the locator or the resource cannot be found, null will be returned.
25 */
26 DownloadableResource getDownloadableResource(String url, Map<String, String> queryParams);
27
28 /**
29 * Returns a list of {@link PluginResource}s for a given plugin module's complete key. If
30 * the plugin the module belongs to is not enabled or does not exist, an empty list is returned.
31 */
32 List<PluginResource> getPluginResources(String moduleCompleteKey);
33
34 /**
35 * Constructs and returns url for the given resource.
36 * This method is not responsible for adding any static caching url prefixes.
37 *
38 * @param pluginModuleKey a plugin module's complete key
39 * @param resourceName the name of the resource described in the module
40 * @deprecated As of 2.9.0, replaced by {@link WebResourceUrlProvider#getResourceUrl(String, String)}
41 */
42 @Deprecated
43 String getResourceUrl(String pluginModuleKey, String resourceName);
44 }