View Javadoc

1   package com.atlassian.plugin.webresource;
2   
3   import java.util.Map;
4   import java.util.Set;
5   
6   /**
7    * Represents a plugin resource.
8    * This object represents a page-time resource. It is used build a URL to the underlying resource,
9    * but does not know how to get the contents of that resource itself.
10   *
11   * @since 2.2
12   */
13  public interface PluginResource
14  {
15      /**
16       * @return true if caching for this resource is supported. Use this check to append a static
17       * caching url prefix to this resource's url.
18       */
19      boolean isCacheSupported();
20  
21      /**
22       * @return the url for this plugin resource.
23       */
24      String getUrl();
25  
26      /**
27       * @return the resource name for the plugin resource.
28       */
29      String getResourceName();
30  
31      /**
32       * @return the plugin module's complete key for which this resource belongs to.
33       */
34      String getModuleCompleteKey();
35  
36      /**
37       * @return a map of parameter key and value pairs for this resource.
38       */
39      Map<String, String> getParams();
40  
41      /**
42       * @return the version prefix string for a cached resource
43       */
44      String getVersion(WebResourceIntegration integration);
45  
46      /**
47       * @return the type (e.g. file extension) of the resource.
48       * @since 2.12.3
49       */
50      String getType();
51      
52      /**
53       * This method provides the mechanism for discovering the contents of a PluginResource.
54       * <p/>
55       * The primary use of this method is in providing a representation of the contents 
56       * (for dependency tracking) when formatting a PluginResource.
57       * 
58       * @return a Set of descriptors providing information about the contents of this PluginResource.
59       */
60      Set<BatchedWebResourceDescriptor> getBatchedWebResourceDescriptors();
61  }