com.atlassian.plugin.webresource
Class SinglePluginResource

java.lang.Object
  extended by com.atlassian.plugin.webresource.SinglePluginResource
All Implemented Interfaces:
PluginResource

public class SinglePluginResource
extends Object
implements PluginResource

Represents a single plugin resource. It provides methods to parse and generate urls to locate a single plugin resource. Note: This PluginResource does not use it's parameters in generating the url.

Since:
2.2

Constructor Summary
SinglePluginResource(String resourceName, String moduleCompleteKey, boolean cached)
           
SinglePluginResource(String resourceName, String moduleCompleteKey, boolean cached, Map<String,String> params)
           
 
Method Summary
 String getModuleCompleteKey()
           
 Map<String,String> getParams()
           
 String getResourceName()
           
 String getUrl()
          Returns a url string in the format: /download/resources/MODULE_COMPLETE_KEY/RESOURCE_NAME e.g.
 String getVersion(WebResourceIntegration integration)
           
 boolean isCacheSupported()
           
static boolean matches(String url)
           
static SinglePluginResource parse(String url)
          Parses the given url into a SinglePluginResource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SinglePluginResource

public SinglePluginResource(String resourceName,
                            String moduleCompleteKey,
                            boolean cached)

SinglePluginResource

public SinglePluginResource(String resourceName,
                            String moduleCompleteKey,
                            boolean cached,
                            Map<String,String> params)
Method Detail

getResourceName

public String getResourceName()
Specified by:
getResourceName in interface PluginResource
Returns:
the resource name for the plugin resource.

getModuleCompleteKey

public String getModuleCompleteKey()
Specified by:
getModuleCompleteKey in interface PluginResource
Returns:
the plugin module's complete key for which this resource belongs to.

getParams

public Map<String,String> getParams()
Specified by:
getParams in interface PluginResource
Returns:
a map of parameter key and value pairs for this resource.

getVersion

public String getVersion(WebResourceIntegration integration)
Specified by:
getVersion in interface PluginResource
Returns:
the version prefix string for a cached resource

isCacheSupported

public boolean isCacheSupported()
Specified by:
isCacheSupported in interface PluginResource
Returns:
true if caching for this resource is supported. Use this check to append a static caching url prefix to this resource's url.

getUrl

public String getUrl()
Returns a url string in the format: /download/resources/MODULE_COMPLETE_KEY/RESOURCE_NAME e.g. /download/resources/example.plugin:webresources/foo.css

Specified by:
getUrl in interface PluginResource
Returns:
the url for this plugin resource.

matches

public static boolean matches(String url)

parse

public static SinglePluginResource parse(String url)
                                  throws UrlParseException
Parses the given url into a SinglePluginResource.

Parameters:
url - the url to parse
Returns:
The parsed SinglePluginResource.
Throws:
UrlParseException - if the url passed in is not a valid plugin resource url


Copyright © 2010 Atlassian. All Rights Reserved.